sistemato deeplinking alla serviceformscreen, aggiunto logout e sistemate altre cose

This commit is contained in:
2026-04-19 10:57:55 +02:00
parent e9f3327f31
commit 023665ae58
17 changed files with 742 additions and 198 deletions

View File

@@ -41,7 +41,7 @@ class CustomerCubit extends Cubit<CustomerState> {
Future<void> createCustomer(CustomerModel customer) async {
emit(state.copyWith(status: CustomerStatus.loading));
try {
final newCustomer = await _repository.createCustomer(customer);
final newCustomer = await _repository.saveCustomer(customer);
// Aggiorniamo la lista locale aggiungendo il nuovo cliente in cima
final updatedList = List<CustomerModel>.from(state.customers)
@@ -128,6 +128,29 @@ class CustomerCubit extends Cubit<CustomerState> {
});
}
Future<CustomerModel?> quickCreateCustomer({
required String name,
String? phone,
String? email,
}) async {
final newCustomer = CustomerModel(
nome: name,
telefono: phone ?? '',
email: email ?? '',
companyId: _sessionBloc.state.company!.id,
note: '',
);
try {
final saved = await _repository.saveCustomer(newCustomer);
// Lo aggiungiamo in cima ai suggerimenti
emit(state.copyWith(customers: [saved, ...state.customers]));
return saved;
} catch (e) {
return null;
}
}
// Pulizia della memoria quando il Cubit viene distrutto
@override
Future<void> close() {