@@ -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
|
||||
|
||||
Reference in New Issue
Block a user