diff --git a/.audit-screenshots/fix-08-new-quote-empty-qty.png b/.audit-screenshots/fix-08-new-quote-empty-qty.png new file mode 100644 index 0000000..977cde1 Binary files /dev/null and b/.audit-screenshots/fix-08-new-quote-empty-qty.png differ diff --git a/src/components/quote-form-item-card.tsx b/src/components/quote-form-item-card.tsx index 463d583..4043d49 100644 --- a/src/components/quote-form-item-card.tsx +++ b/src/components/quote-form-item-card.tsx @@ -10,7 +10,12 @@ import { Textarea } from "@/components/ui/textarea"; export interface DraftQuoteItem { id: string; description: string; - quantity: number; + /** + * Line-item count the operator typed. Starts empty so the operator + * can type e.g. "22" without having to delete a default "1" first. + * Falls back to 1 on submit when left blank — see quote-form.tsx. + */ + quantity: number | ""; notes: string; files: File[]; /** @@ -62,7 +67,15 @@ export function QuoteFormItemCard({ item, onChange, onRemove }: QuoteFormItemCar type="number" min={1} value={item.quantity} - onChange={(e) => onChange({ quantity: Math.max(1, Number(e.target.value) || 1) })} + onChange={(e) => { + const raw = e.target.value; + // Empty input = "not entered yet". Submit falls back to 1. + if (raw === "") { + onChange({ quantity: "" }); + } else { + onChange({ quantity: Math.max(1, Number(raw) || 1) }); + } + }} />
diff --git a/src/components/quote-form.tsx b/src/components/quote-form.tsx index 8133a9c..be40b66 100644 --- a/src/components/quote-form.tsx +++ b/src/components/quote-form.tsx @@ -106,7 +106,10 @@ export function QuoteForm({ open, onOpenChange, onSaved }: QuoteFormProps) { const addItem = () => { setItems([ ...items, - { id: crypto.randomUUID(), description: "", quantity: 1, notes: "", files: [], sku: "" }, + // Start with empty quantity so the operator can type the count + // directly (e.g. "22") without first deleting a "1". The submit + // path below falls back to 1 when the field is left blank. + { id: crypto.randomUUID(), description: "", quantity: "", notes: "", files: [], sku: "" }, ]); };