aggiunta scelta business o privato

This commit is contained in:
2026-05-19 11:54:59 +02:00
parent 2bdba523ad
commit 4e03d52a5d
11 changed files with 173 additions and 38 deletions

View File

@@ -118,6 +118,38 @@ class _CustomerFormScreenState extends State<CustomerFormScreen> {
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Row(
children: [
ChoiceChip(
label: const Text('Privato (Domestico)'),
selected: !state.customer.isBusiness,
selectedColor: Colors.blue.withValues(alpha: 0.2),
checkmarkColor: Colors.blue.shade700,
onSelected: (selected) {
if (selected) {
context.read<CustomerFormCubit>().updateFields(
isBusiness: false,
);
}
},
),
const SizedBox(width: 12),
ChoiceChip(
label: const Text('Business (P.IVA)'),
selected: state.customer.isBusiness,
selectedColor: Colors.orange.withValues(alpha: 0.2),
checkmarkColor: Colors.orange.shade700,
onSelected: (selected) {
if (selected) {
context.read<CustomerFormCubit>().updateFields(
isBusiness: true,
);
}
},
),
],
),
const Divider(height: 32),
FluxTextField(
label: 'Nome Completo',
autoFocus: true,

View File

@@ -16,6 +16,7 @@ class _QuickCustomerDialogState extends State<QuickCustomerDialog> {
final _phoneCtrl = TextEditingController();
final _emailCtrl = TextEditingController();
final _noteCtrl = TextEditingController();
bool _isBusiness = false; // Aggiungiamo un campo per il tipo di cliente
bool _isLoading = false;
@@ -45,6 +46,7 @@ class _QuickCustomerDialogState extends State<QuickCustomerDialog> {
final newCustomer = await context
.read<CustomerFormCubit>()
.quickCreateCustomer(
isBusiness: _isBusiness,
name: _nameCtrl.text.trim(),
phone: _phoneCtrl.text.trim(),
email: _emailCtrl.text.trim(),
@@ -65,6 +67,38 @@ class _QuickCustomerDialogState extends State<QuickCustomerDialog> {
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Row(
children: [
ChoiceChip(
label: const Text('Privato (Domestico)'),
selected: _isBusiness == false,
selectedColor: Colors.blue.withValues(alpha: 0.2),
checkmarkColor: Colors.blue.shade700,
onSelected: (selected) {
if (selected) {
setState(() {
_isBusiness = false;
});
}
},
),
const SizedBox(width: 12),
ChoiceChip(
label: const Text('Business (P.IVA)'),
selected: _isBusiness == true,
selectedColor: Colors.orange.withValues(alpha: 0.2),
checkmarkColor: Colors.orange.shade700,
onSelected: (selected) {
if (selected) {
setState(() {
_isBusiness = true;
});
}
},
),
],
),
const Divider(height: 32),
TextField(
controller: _nameCtrl,
autofocus: true, // Focus immediato!