Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
2026-05-03 12:05:47 +02:00
parent 4559db620d
commit 6bb65e8296
13 changed files with 832 additions and 815 deletions

View File

@@ -165,7 +165,7 @@ class OperationsCubit extends Cubit<OperationsState> {
);
final updatedOperation = await _repository.saveFullOperation(
operationToSave,
operation: operationToSave,
);
emit(
@@ -233,6 +233,16 @@ class OperationsCubit extends Cubit<OperationsState> {
// Creiamo il modello aggiornato
// ATTENZIONE: adatta questa logica in base a come è scritto il tuo copyWith!
int? newQuantity;
if (clearQuantity) {
newQuantity = 1;
}
if (quantity != null && quantity <= 0) {
newQuantity = 0;
}
if (quantity != null && quantity > 0) {
newQuantity = quantity;
}
final updated = current.copyWith(
customerId: customerId,
customerDisplayName: customerDisplayName,
@@ -242,7 +252,7 @@ class OperationsCubit extends Cubit<OperationsState> {
providerDisplayName: clearProvider
? null
: (providerDisplayName ?? current.providerDisplayName),
quantity: clearQuantity ? 1 : (quantity ?? current.quantity),
quantity: newQuantity,
type: clearType ? null : (type ?? current.type),
subtype: clearSubtype ? null : (subtype ?? current.subtype),
expirationDate: clearExpiration