feat: Improve Supplier wizard with delivery days and optional payment terms
Supplier Wizard Improvements: - Added 'Días de Entrega' (Lead Time Days) field - CRITICAL field - Field shows as required with asterisk and helper text - Validates that lead time is provided before allowing continue - Made 'Términos de Pago' optional (not critical info) - Added empty option 'Seleccionar...' to payment terms dropdown - Updated API call to include lead_time_days parameter - Payment terms now sends undefined if not selected - Lead time days properly parsed as integer before sending to API These changes ensure critical logistics information is captured while making optional business terms more flexible.
This commit is contained in:
@@ -18,7 +18,8 @@ const SupplierInfoStep: React.FC<WizardDataProps> = ({ data, onDataChange, onNex
|
||||
phone: data.phone || '',
|
||||
email: data.email || '',
|
||||
address: data.address || '',
|
||||
paymentTerms: data.paymentTerms || 'net30',
|
||||
paymentTerms: data.paymentTerms || '',
|
||||
leadTimeDays: data.leadTimeDays || '',
|
||||
notes: data.notes || '',
|
||||
});
|
||||
|
||||
@@ -107,13 +108,29 @@ const SupplierInfoStep: React.FC<WizardDataProps> = ({ data, onDataChange, onNex
|
||||
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-[var(--text-secondary)] mb-2">
|
||||
Términos de Pago
|
||||
Días de Entrega *
|
||||
<span className="ml-1 text-xs text-[var(--text-tertiary)]">(Tiempo de lead time)</span>
|
||||
</label>
|
||||
<input
|
||||
type="number"
|
||||
value={supplierData.leadTimeDays}
|
||||
onChange={(e) => setSupplierData({ ...supplierData, leadTimeDays: e.target.value })}
|
||||
placeholder="Ej: 7"
|
||||
min="0"
|
||||
className="w-full px-3 py-2 border border-[var(--border-secondary)] rounded-lg focus:outline-none focus:ring-2 focus:ring-[var(--color-primary)]"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-[var(--text-secondary)] mb-2">
|
||||
Términos de Pago (Opcional)
|
||||
</label>
|
||||
<select
|
||||
value={supplierData.paymentTerms}
|
||||
onChange={(e) => setSupplierData({ ...supplierData, paymentTerms: e.target.value })}
|
||||
className="w-full px-3 py-2 border border-[var(--border-secondary)] rounded-lg focus:outline-none focus:ring-2 focus:ring-[var(--color-primary)]"
|
||||
>
|
||||
<option value="">Seleccionar...</option>
|
||||
<option value="immediate">Inmediato</option>
|
||||
<option value="net30">Neto 30 días</option>
|
||||
<option value="net60">Neto 60 días</option>
|
||||
@@ -139,7 +156,7 @@ const SupplierInfoStep: React.FC<WizardDataProps> = ({ data, onDataChange, onNex
|
||||
<div className="flex justify-end pt-4 border-t border-[var(--border-primary)]">
|
||||
<button
|
||||
onClick={handleContinue}
|
||||
disabled={!supplierData.name || !supplierData.phone}
|
||||
disabled={!supplierData.name || !supplierData.phone || !supplierData.leadTimeDays}
|
||||
className="px-6 py-2.5 bg-[var(--color-primary)] text-white rounded-lg hover:bg-[var(--color-primary)]/90 disabled:opacity-50 disabled:cursor-not-allowed transition-colors"
|
||||
>
|
||||
Continuar
|
||||
@@ -216,7 +233,8 @@ const ProductsPricingStep: React.FC<WizardDataProps> = ({ data, onDataChange, on
|
||||
email: data.email || undefined,
|
||||
phone: data.phone,
|
||||
address: data.address || undefined,
|
||||
payment_terms: data.paymentTerms || 'net30',
|
||||
payment_terms: data.paymentTerms || undefined,
|
||||
lead_time_days: data.leadTimeDays ? parseInt(data.leadTimeDays) : undefined,
|
||||
tax_id: undefined,
|
||||
notes: data.notes || undefined,
|
||||
status: 'active',
|
||||
|
||||
Reference in New Issue
Block a user