b
This commit is contained in:
@@ -15,7 +15,8 @@ import 'package:flux/features/company/ui/company_settings_screen.dart';
|
|||||||
import 'package:flux/features/customers/blocs/customers_cubit.dart';
|
import 'package:flux/features/customers/blocs/customers_cubit.dart';
|
||||||
import 'package:flux/features/customers/models/customer_model.dart';
|
import 'package:flux/features/customers/models/customer_model.dart';
|
||||||
import 'package:flux/features/customers/ui/customer_detail_screen.dart';
|
import 'package:flux/features/customers/ui/customer_detail_screen.dart';
|
||||||
import 'package:flux/features/customers/ui/customers_content.dart';
|
import 'package:flux/features/customers/ui/customer_form.dart';
|
||||||
|
import 'package:flux/features/customers/ui/customers_list_screen.dart';
|
||||||
import 'package:flux/features/home/ui/home_screen.dart';
|
import 'package:flux/features/home/ui/home_screen.dart';
|
||||||
import 'package:flux/features/master_data/master_data_hub_content.dart';
|
import 'package:flux/features/master_data/master_data_hub_content.dart';
|
||||||
import 'package:flux/features/master_data/products/blocs/product_cubit.dart';
|
import 'package:flux/features/master_data/products/blocs/product_cubit.dart';
|
||||||
@@ -191,7 +192,7 @@ class AppRouter {
|
|||||||
path: '/customers',
|
path: '/customers',
|
||||||
name: Routes.customers,
|
name: Routes.customers,
|
||||||
builder: (context, state) =>
|
builder: (context, state) =>
|
||||||
const CustomersContent(), // O come si chiama il tuo widget della lista!
|
const CustomersListScreen(), // O come si chiama il tuo widget della lista!
|
||||||
),
|
),
|
||||||
GoRoute(
|
GoRoute(
|
||||||
path: '/tickets',
|
path: '/tickets',
|
||||||
@@ -310,8 +311,8 @@ class AppRouter {
|
|||||||
builder: (context, state) => const UploadSuccessScreen(),
|
builder: (context, state) => const UploadSuccessScreen(),
|
||||||
),
|
),
|
||||||
GoRoute(
|
GoRoute(
|
||||||
path: '/customer/form/:id',
|
path: '/customer/details/:id',
|
||||||
name: 'customer-form',
|
name: Routes.customerDetails,
|
||||||
builder: (context, state) {
|
builder: (context, state) {
|
||||||
final customer = state.extra as CustomerModel;
|
final customer = state.extra as CustomerModel;
|
||||||
return BlocProvider(
|
return BlocProvider(
|
||||||
@@ -323,6 +324,20 @@ class AppRouter {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
GoRoute(
|
||||||
|
path: '/customer/form/:id',
|
||||||
|
name: Routes.customerForm,
|
||||||
|
builder: (context, state) {
|
||||||
|
final customer = state.extra as CustomerModel?;
|
||||||
|
return BlocProvider(
|
||||||
|
create: (context) => AttachmentsBloc(
|
||||||
|
parentType: AttachmentParentType.customer,
|
||||||
|
parentId: customer.id,
|
||||||
|
),
|
||||||
|
child: CustomerForm(customer: customer),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
|
||||||
GoRoute(
|
GoRoute(
|
||||||
path: '/operations/form/:id',
|
path: '/operations/form/:id',
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ class Routes {
|
|||||||
static const String operationForm = 'operation-form';
|
static const String operationForm = 'operation-form';
|
||||||
static const String uploadSuccess = 'upload-success';
|
static const String uploadSuccess = 'upload-success';
|
||||||
static const String customerForm = 'customer-form';
|
static const String customerForm = 'customer-form';
|
||||||
|
static const String customerDetails = 'customer-details';
|
||||||
static const String upload = 'upload';
|
static const String upload = 'upload';
|
||||||
static const String ticketWorkspace = 'ticket-workspace';
|
static const String ticketWorkspace = 'ticket-workspace';
|
||||||
}
|
}
|
||||||
|
|||||||
106
lib/features/customers/blocs/customer_form_cubit.dart
Normal file
106
lib/features/customers/blocs/customer_form_cubit.dart
Normal file
@@ -0,0 +1,106 @@
|
|||||||
|
import 'package:equatable/equatable.dart';
|
||||||
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
|
import 'package:flux/core/blocs/session/session_cubit.dart';
|
||||||
|
import 'package:flux/features/customers/data/customer_repository.dart';
|
||||||
|
import 'package:flux/features/customers/models/customer_model.dart';
|
||||||
|
import 'package:get_it/get_it.dart';
|
||||||
|
|
||||||
|
part 'customer_form_state.dart';
|
||||||
|
|
||||||
|
class CustomerFormCubit extends Cubit<CustomerFormState> {
|
||||||
|
final CustomerRepository _repository = GetIt.I<CustomerRepository>();
|
||||||
|
final SessionCubit _sessionCubit = GetIt.I<SessionCubit>();
|
||||||
|
|
||||||
|
CustomerFormCubit({CustomerModel? existingCustomer})
|
||||||
|
: super(
|
||||||
|
CustomerFormState(customer: existingCustomer ?? CustomerModel.empty()),
|
||||||
|
);
|
||||||
|
|
||||||
|
Future<void> initForm({
|
||||||
|
CustomerModel? existingCustomer,
|
||||||
|
String? customerId,
|
||||||
|
}) async {
|
||||||
|
emit(state.copyWith(status: CustomerFormStatus.loading));
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (existingCustomer != null) {
|
||||||
|
emit(
|
||||||
|
state.copyWith(
|
||||||
|
customer: existingCustomer,
|
||||||
|
status: CustomerFormStatus.ready,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
} else if (customerId != null) {
|
||||||
|
final customer = await _repository.getCustomerById(customerId);
|
||||||
|
emit(
|
||||||
|
state.copyWith(customer: customer, status: CustomerFormStatus.ready),
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
// Nuovo cliente, inizializziamo con valori vuoti
|
||||||
|
emit(
|
||||||
|
state.copyWith(
|
||||||
|
customer: CustomerModel.empty().copyWith(
|
||||||
|
companyId: _sessionCubit.state.company!.id!,
|
||||||
|
),
|
||||||
|
status: CustomerFormStatus.ready,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} on Exception catch (e) {
|
||||||
|
emit(
|
||||||
|
state.copyWith(
|
||||||
|
status: CustomerFormStatus.failure,
|
||||||
|
errorMessage: e.toString(),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void updateDoNotDisturb(bool value) {
|
||||||
|
emit(
|
||||||
|
state.copyWith(customer: state.customer.copyWith(doNotDisturb: value)),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void updateFields({
|
||||||
|
String? name,
|
||||||
|
String? phoneNumber,
|
||||||
|
String? email,
|
||||||
|
String? note,
|
||||||
|
bool? doNotDisturb,
|
||||||
|
}) {
|
||||||
|
emit(
|
||||||
|
state.copyWith(
|
||||||
|
customer: state.customer.copyWith(
|
||||||
|
name: name ?? state.customer.name,
|
||||||
|
phoneNumber: phoneNumber ?? state.customer.phoneNumber,
|
||||||
|
email: email ?? state.customer.email,
|
||||||
|
note: note ?? state.customer.note,
|
||||||
|
doNotDisturb: doNotDisturb ?? state.customer.doNotDisturb,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> saveCustomer() async {
|
||||||
|
emit(state.copyWith(status: CustomerFormStatus.saving));
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (state.customer.id != null) {
|
||||||
|
// Aggiorna cliente esistente
|
||||||
|
await _repository.updateCustomer(state.customer);
|
||||||
|
} else {
|
||||||
|
// Crea nuovo cliente
|
||||||
|
await _repository.insertCustomer(state.customer);
|
||||||
|
}
|
||||||
|
emit(state.copyWith(status: CustomerFormStatus.success));
|
||||||
|
} on Exception catch (e) {
|
||||||
|
emit(
|
||||||
|
state.copyWith(
|
||||||
|
status: CustomerFormStatus.failure,
|
||||||
|
errorMessage: e.toString(),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
30
lib/features/customers/blocs/customer_form_state.dart
Normal file
30
lib/features/customers/blocs/customer_form_state.dart
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
part of 'customer_form_cubit.dart';
|
||||||
|
|
||||||
|
enum CustomerFormStatus { initial, loading, ready, saving, success, failure }
|
||||||
|
|
||||||
|
class CustomerFormState extends Equatable {
|
||||||
|
final CustomerFormStatus status;
|
||||||
|
final CustomerModel customer;
|
||||||
|
final String? errorMessage;
|
||||||
|
|
||||||
|
const CustomerFormState({
|
||||||
|
this.status = CustomerFormStatus.initial,
|
||||||
|
required this.customer,
|
||||||
|
this.errorMessage,
|
||||||
|
});
|
||||||
|
|
||||||
|
CustomerFormState copyWith({
|
||||||
|
CustomerFormStatus? status,
|
||||||
|
CustomerModel? customer,
|
||||||
|
String? errorMessage,
|
||||||
|
}) {
|
||||||
|
return CustomerFormState(
|
||||||
|
status: status ?? this.status,
|
||||||
|
customer: customer ?? this.customer,
|
||||||
|
errorMessage: errorMessage,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object?> get props => [status, customer, errorMessage];
|
||||||
|
}
|
||||||
@@ -11,7 +11,7 @@ class CustomerRepository {
|
|||||||
final String companyId = GetIt.I.get<SessionCubit>().state.company!.id!;
|
final String companyId = GetIt.I.get<SessionCubit>().state.company!.id!;
|
||||||
|
|
||||||
// Crea un nuovo cliente
|
// Crea un nuovo cliente
|
||||||
Future<CustomerModel> saveCustomer(CustomerModel customer) async {
|
Future<CustomerModel> insertCustomer(CustomerModel customer) async {
|
||||||
try {
|
try {
|
||||||
final response = await _supabase
|
final response = await _supabase
|
||||||
.from('customer')
|
.from('customer')
|
||||||
@@ -57,6 +57,23 @@ class CustomerRepository {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<CustomerModel> getCustomerById(String customerId) async {
|
||||||
|
try {
|
||||||
|
final response = await _supabase
|
||||||
|
.from('customer')
|
||||||
|
.select('''
|
||||||
|
*,
|
||||||
|
attachment(*)
|
||||||
|
''')
|
||||||
|
.eq('id', customerId)
|
||||||
|
.single();
|
||||||
|
|
||||||
|
return CustomerModel.fromMap(response);
|
||||||
|
} catch (e) {
|
||||||
|
throw '$e';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Ricerca clienti per nome o telefono (fondamentale per la UX)
|
// Ricerca clienti per nome o telefono (fondamentale per la UX)
|
||||||
Future<List<CustomerModel>> searchCustomers(
|
Future<List<CustomerModel>> searchCustomers(
|
||||||
String companyId,
|
String companyId,
|
||||||
|
|||||||
@@ -44,6 +44,15 @@ class CustomerModel extends Equatable {
|
|||||||
attachments,
|
attachments,
|
||||||
];
|
];
|
||||||
|
|
||||||
|
factory CustomerModel.empty() => CustomerModel(
|
||||||
|
name: '',
|
||||||
|
phoneNumber: '',
|
||||||
|
email: '',
|
||||||
|
note: '',
|
||||||
|
companyId:
|
||||||
|
'', // Dovrebbe essere sempre fornito, ma lasciamo vuoto per sicurezza
|
||||||
|
);
|
||||||
|
|
||||||
CustomerModel copyWith({
|
CustomerModel copyWith({
|
||||||
String? id,
|
String? id,
|
||||||
DateTime? createdAt,
|
DateTime? createdAt,
|
||||||
|
|||||||
@@ -1,16 +1,14 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
import 'package:flux/core/widgets/flux_text_field.dart';
|
import 'package:flux/core/widgets/flux_text_field.dart';
|
||||||
|
import 'package:flux/features/customers/blocs/customer_form_cubit.dart';
|
||||||
import 'package:flux/features/customers/models/customer_model.dart'; // Uso il tuo widget!
|
import 'package:flux/features/customers/models/customer_model.dart'; // Uso il tuo widget!
|
||||||
|
|
||||||
class CustomerForm extends StatefulWidget {
|
class CustomerForm extends StatefulWidget {
|
||||||
final CustomerModel? customer; // Se presente, siamo in modalità "Modifica"
|
final CustomerModel? customer;
|
||||||
final Function(CustomerModel customer) onSave;
|
final String? customerId;
|
||||||
|
|
||||||
const CustomerForm({
|
const CustomerForm({super.key, this.customer, this.customerId});
|
||||||
super.key,
|
|
||||||
this.customer, // Opzionale
|
|
||||||
required this.onSave,
|
|
||||||
});
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<CustomerForm> createState() => _CustomerFormState();
|
State<CustomerForm> createState() => _CustomerFormState();
|
||||||
@@ -20,25 +18,19 @@ class _CustomerFormState extends State<CustomerForm> {
|
|||||||
final _formKey = GlobalKey<FormState>();
|
final _formKey = GlobalKey<FormState>();
|
||||||
|
|
||||||
// Controller inizializzati con i dati del cliente (se presenti)
|
// Controller inizializzati con i dati del cliente (se presenti)
|
||||||
late final TextEditingController _nomeController;
|
final TextEditingController _nomeController = TextEditingController();
|
||||||
late final TextEditingController _telefonoController;
|
final TextEditingController _telefonoController = TextEditingController();
|
||||||
late final TextEditingController _emailController;
|
final TextEditingController _emailController = TextEditingController();
|
||||||
late final TextEditingController _noteController;
|
final TextEditingController _noteController = TextEditingController();
|
||||||
late bool _nonDisturbare;
|
bool _isInitialized = false;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
// Se widget.customer è null, i campi saranno vuoti
|
context.read<CustomerFormCubit>().initForm(
|
||||||
_nomeController = TextEditingController(text: widget.customer?.name ?? '');
|
customerId: widget.customerId,
|
||||||
_telefonoController = TextEditingController(
|
existingCustomer: widget.customer,
|
||||||
text: widget.customer?.phoneNumber ?? '',
|
|
||||||
);
|
);
|
||||||
_emailController = TextEditingController(
|
|
||||||
text: widget.customer?.email ?? '',
|
|
||||||
);
|
|
||||||
_noteController = TextEditingController(text: widget.customer?.note ?? '');
|
|
||||||
_nonDisturbare = widget.customer?.doNotDisturb ?? false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -50,89 +42,131 @@ class _CustomerFormState extends State<CustomerForm> {
|
|||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
void _submit() {
|
void _syncTextControllers(CustomerModel customer) {
|
||||||
if (_formKey.currentState!.validate()) {
|
if (_nomeController.text.isEmpty) {
|
||||||
// Creiamo un nuovo modello partendo da quello esistente (se c'è)
|
_nomeController.text = customer.name;
|
||||||
// o creandone uno da zero, preservando l'ID in caso di modifica.
|
}
|
||||||
final updatedCustomer =
|
if (_telefonoController.text.isEmpty) {
|
||||||
widget.customer?.copyWith(
|
_telefonoController.text = customer.phoneNumber;
|
||||||
name: _nomeController.text.trim(),
|
}
|
||||||
phoneNumber: _telefonoController.text.trim(),
|
if (_emailController.text.isEmpty) {
|
||||||
email: _emailController.text.trim(),
|
_emailController.text = customer.email;
|
||||||
note: _noteController.text.trim(),
|
}
|
||||||
doNotDisturb: _nonDisturbare,
|
if (_noteController.text.isEmpty) {
|
||||||
) ??
|
_noteController.text = customer.note;
|
||||||
CustomerModel(
|
}
|
||||||
// Caso nuovo cliente
|
_isInitialized = true;
|
||||||
name: _nomeController.text.trim(),
|
}
|
||||||
phoneNumber: _telefonoController.text.trim(),
|
|
||||||
email: _emailController.text.trim(),
|
|
||||||
note: _noteController.text.trim(),
|
|
||||||
doNotDisturb: _nonDisturbare,
|
|
||||||
companyId: '', // Verrà iniettato dal Bloc o dal chiamante
|
|
||||||
);
|
|
||||||
|
|
||||||
widget.onSave(updatedCustomer);
|
void _flushControllersToCubit() {
|
||||||
|
context.read<CustomerFormCubit>().updateFields(
|
||||||
|
name: _nomeController.text.trim(),
|
||||||
|
phoneNumber: _telefonoController.text.trim(),
|
||||||
|
email: _emailController.text.trim(),
|
||||||
|
note: _noteController.text.trim(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void _saveCustomer() {
|
||||||
|
if (_formKey.currentState!.validate()) {
|
||||||
|
_flushControllersToCubit();
|
||||||
|
context.read<CustomerFormCubit>().saveCustomer();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Form(
|
return BlocConsumer<CustomerFormCubit, CustomerFormState>(
|
||||||
key: _formKey,
|
listenWhen: (previous, current) => previous.status != current.status,
|
||||||
child: SingleChildScrollView(
|
listener: (context, state) {
|
||||||
child: Column(
|
if (state.status == CustomerFormStatus.ready && !_isInitialized) {
|
||||||
mainAxisSize: MainAxisSize.min,
|
_syncTextControllers(state.customer);
|
||||||
children: [
|
}
|
||||||
Text(
|
if (state.status == CustomerFormStatus.success) {
|
||||||
widget.customer == null ? 'Nuovo Cliente' : 'Modifica Cliente',
|
Navigator.of(context).pop(state.customer);
|
||||||
style: const TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
|
} else if (state.status == CustomerFormStatus.failure) {
|
||||||
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
|
SnackBar(content: Text(state.errorMessage ?? 'Errore sconosciuto')),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
builder: (context, state) {
|
||||||
|
return Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
title: Text(
|
||||||
|
state.customer.id == null
|
||||||
|
? 'Nuovo Cliente'
|
||||||
|
: 'Modifica ${state.customer.name}',
|
||||||
),
|
),
|
||||||
const SizedBox(height: 20),
|
actions: [],
|
||||||
FluxTextField(
|
),
|
||||||
label: 'Nome Completo',
|
body: Padding(
|
||||||
autoFocus: true,
|
padding: const EdgeInsets.all(8.0),
|
||||||
icon: Icons.person_outline,
|
child: Form(
|
||||||
controller: _nomeController,
|
key: _formKey,
|
||||||
),
|
child: SingleChildScrollView(
|
||||||
const SizedBox(height: 16),
|
child: Column(
|
||||||
FluxTextField(
|
mainAxisSize: MainAxisSize.min,
|
||||||
label: 'Telefono',
|
children: [
|
||||||
icon: Icons.phone_android_outlined,
|
FluxTextField(
|
||||||
controller: _telefonoController,
|
label: 'Nome Completo',
|
||||||
keyboardType: TextInputType.phone,
|
autoFocus: true,
|
||||||
),
|
icon: Icons.person_outline,
|
||||||
const SizedBox(height: 16),
|
controller: _nomeController,
|
||||||
FluxTextField(
|
keyboardType: TextInputType.name,
|
||||||
label: 'Email',
|
),
|
||||||
icon: Icons.alternate_email_outlined,
|
const SizedBox(height: 16),
|
||||||
controller: _emailController,
|
FluxTextField(
|
||||||
),
|
label: 'Telefono',
|
||||||
const SizedBox(height: 16),
|
icon: Icons.phone_android_outlined,
|
||||||
FluxTextField(
|
controller: _telefonoController,
|
||||||
label: 'Note',
|
keyboardType: TextInputType.phone,
|
||||||
icon: Icons.notes_outlined,
|
),
|
||||||
controller: _noteController,
|
const SizedBox(height: 16),
|
||||||
minLines: 3,
|
FluxTextField(
|
||||||
),
|
label: 'Email',
|
||||||
const SizedBox(height: 8),
|
icon: Icons.alternate_email_outlined,
|
||||||
SwitchListTile(
|
controller: _emailController,
|
||||||
title: const Text('Non disturbare'),
|
keyboardType: TextInputType.emailAddress,
|
||||||
value: _nonDisturbare,
|
),
|
||||||
onChanged: (v) => setState(() => _nonDisturbare = v),
|
const SizedBox(height: 16),
|
||||||
),
|
FluxTextField(
|
||||||
const SizedBox(height: 24),
|
label: 'Note',
|
||||||
SizedBox(
|
icon: Icons.notes_outlined,
|
||||||
width: double.infinity,
|
controller: _noteController,
|
||||||
height: 50,
|
minLines: 3,
|
||||||
child: ElevatedButton(
|
),
|
||||||
onPressed: _submit,
|
const SizedBox(height: 8),
|
||||||
child: Text(widget.customer == null ? 'SALVA' : 'AGGIORNA'),
|
SwitchListTile(
|
||||||
|
title: const Text('Non disturbare'),
|
||||||
|
value: state.customer.doNotDisturb,
|
||||||
|
onChanged: (v) => context
|
||||||
|
.read<CustomerFormCubit>()
|
||||||
|
.updateDoNotDisturb(v),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 24),
|
||||||
|
SizedBox(
|
||||||
|
width: double.infinity,
|
||||||
|
height: 50,
|
||||||
|
child: ElevatedButton(
|
||||||
|
onPressed: _saveCustomer,
|
||||||
|
style: ElevatedButton.styleFrom(
|
||||||
|
backgroundColor: Theme.of(context).primaryColor,
|
||||||
|
foregroundColor: Colors.white,
|
||||||
|
),
|
||||||
|
|
||||||
|
child: Text(
|
||||||
|
widget.customer == null ? 'SALVA' : 'AGGIORNA',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
),
|
||||||
),
|
);
|
||||||
),
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,14 +8,14 @@ import 'package:flux/features/customers/models/customer_model.dart';
|
|||||||
import 'package:flux/features/customers/ui/customer_form.dart';
|
import 'package:flux/features/customers/ui/customer_form.dart';
|
||||||
import 'package:go_router/go_router.dart';
|
import 'package:go_router/go_router.dart';
|
||||||
|
|
||||||
class CustomersContent extends StatefulWidget {
|
class CustomersListScreen extends StatefulWidget {
|
||||||
const CustomersContent({super.key});
|
const CustomersListScreen({super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<CustomersContent> createState() => _CustomersContentState();
|
State<CustomersListScreen> createState() => _CustomersListScreenState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _CustomersContentState extends State<CustomersContent> {
|
class _CustomersListScreenState extends State<CustomersListScreen> {
|
||||||
final TextEditingController _searchController = TextEditingController();
|
final TextEditingController _searchController = TextEditingController();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -111,7 +111,7 @@ class _CustomersContentState extends State<CustomersContent> {
|
|||||||
return _CustomerTile(
|
return _CustomerTile(
|
||||||
customer: customer,
|
customer: customer,
|
||||||
onTap: () => context.pushNamed(
|
onTap: () => context.pushNamed(
|
||||||
Routes.customerForm,
|
Routes.customerDetails,
|
||||||
pathParameters: {'id': customer.id!},
|
pathParameters: {'id': customer.id!},
|
||||||
extra: customer,
|
extra: customer,
|
||||||
),
|
),
|
||||||
0
lib/features/customers/utils/customer_utils.dart
Normal file
0
lib/features/customers/utils/customer_utils.dart
Normal file
Reference in New Issue
Block a user