feat: add description to invoices

This commit is contained in:
Vasily Zubarev
2025-05-09 15:34:35 +02:00
parent 11555a4dc0
commit 92dd66fd00
4 changed files with 152 additions and 156 deletions

View File

@@ -25,7 +25,13 @@ function invoiceFormReducer(state: InvoiceFormData, action: any): InvoiceFormDat
case "UPDATE_FIELD":
return { ...state, [action.field]: action.value }
case "ADD_ITEM":
return { ...state, items: [...state.items, { description: "", quantity: 1, unitPrice: 0, subtotal: 0 }] }
return {
...state,
items: [
...state.items,
{ name: "", subtitle: "", showSubtitle: false, quantity: 1, unitPrice: 0, subtotal: 0 },
],
}
case "UPDATE_ITEM": {
const items = [...state.items]
items[action.index] = { ...items[action.index], [action.field]: action.value }
@@ -146,7 +152,6 @@ export function InvoiceGenerator({
}
try {
// Get existing templates
const result = await addNewTemplateAction(user, {
id: `tmpl_${Math.random().toString(36).substring(2, 15)}`,
name: newTemplateName,