refactor nomi tabelle

This commit is contained in:
2026-05-20 11:03:33 +02:00
parent f190ad9353
commit c85f4b086e
24 changed files with 217 additions and 159 deletions

View File

@@ -104,6 +104,7 @@ class OperationFormCubit extends Cubit<OperationFormState> {
batchUuid: current.batchUuid, // MANTIENE IL COLLEGAMENTO
customerId: current.customerId, // MANTIENE IL CLIENTE
customer: current.customer,
reference: current.reference,
status: OperationStatus.draft,
createdAt: DateTime.now(),
),
@@ -122,7 +123,21 @@ class OperationFormCubit extends Cubit<OperationFormState> {
);
try {
final operationToSave = state.operation.copyWith(status: targetStatus);
OperationModel operationToSave = state.operation.copyWith(
status: targetStatus,
);
if (operationToSave.reference.isEmpty) {
if (operationToSave.customer != null &&
operationToSave.customer!.phoneNumber.isNotEmpty) {
operationToSave = operationToSave.copyWith(
reference: '${operationToSave.customer?.phoneNumber} - auto',
);
} else {
operationToSave = operationToSave.copyWith(
reference: 'Nessun riferimento',
);
}
}
final savedOperation = await _repository.saveFullOperation(
operation: operationToSave,
);