auto isBusiness based on customer selected
This commit is contained in:
@@ -191,7 +191,6 @@ class OperationFormCubit extends Cubit<OperationFormState> {
|
||||
// --- GESTIONE DEI CAMPI IN TEMPO REALE ---
|
||||
|
||||
void updateFields({
|
||||
CustomerModel? customer,
|
||||
String? reference,
|
||||
String? note,
|
||||
String? type,
|
||||
@@ -224,8 +223,6 @@ class OperationFormCubit extends Cubit<OperationFormState> {
|
||||
if (quantity != null && quantity > 0) newQuantity = quantity;
|
||||
|
||||
final updated = current.copyWith(
|
||||
customer: customer ?? current.customer,
|
||||
customerId: customer?.id ?? current.customerId,
|
||||
reference: reference ?? current.reference,
|
||||
note: note ?? current.note,
|
||||
providerId: clearProvider ? null : (providerId ?? current.providerId),
|
||||
@@ -254,6 +251,16 @@ class OperationFormCubit extends Cubit<OperationFormState> {
|
||||
emit(state.copyWith(operation: updated));
|
||||
}
|
||||
|
||||
void updateCustomer(CustomerModel customer) {
|
||||
final bool isBusiness = customer.isBusiness;
|
||||
final updatedOperation = state.operation.copyWith(
|
||||
customer: customer,
|
||||
customerId: customer.id,
|
||||
isBusiness: isBusiness,
|
||||
);
|
||||
emit(state.copyWith(operation: updatedOperation));
|
||||
}
|
||||
|
||||
// --- UTILS ---
|
||||
|
||||
void setTypeWithSmartDefault(String type) {
|
||||
|
||||
Reference in New Issue
Block a user