diff --git a/src/routes/invoices.$invoiceId.tsx b/src/routes/invoices.$invoiceId.tsx index adee1dd..d3dbe86 100644 --- a/src/routes/invoices.$invoiceId.tsx +++ b/src/routes/invoices.$invoiceId.tsx @@ -377,41 +377,56 @@ function InvoiceDetail() { - {g.items.map((it) => ( - - {it.work_date ? formatDate(it.work_date) : "—"} - - {canEdit && isDraft ? ( - e.target.value !== it.description && updateItem(it.id, { description: e.target.value })} /> - ) : ( -
-
{it.description}
- {it.user?.full_name &&
{it.user.full_name}
} -
- )} - - - {canEdit && isDraft ? ( - Number(e.target.value) !== Number(it.quantity) && updateItem(it.id, { quantity: Number(e.target.value) })} /> - ) : Number(it.quantity).toFixed(2)} - - - {canEdit && isDraft ? ( - Number(e.target.value) !== Number(it.rate) && updateItem(it.id, { rate: Number(e.target.value) })} /> - ) : formatCurrency(it.rate)} - - {formatCurrency(it.amount)} - {canEdit && isDraft && ( - - + {g.subsections.map((sub) => ( + + + + {sub.label} - )} - + + {sub.billable ? formatCurrency(sub.subtotal) : "—"} + + {canEdit && isDraft && } + + {sub.items.map((it) => ( + + {it.work_date ? formatDate(it.work_date) : "—"} + + {canEdit && isDraft ? ( + e.target.value !== it.description && updateItem(it.id, { description: e.target.value })} /> + ) : ( +
+
{it.description}
+ {it.user?.full_name &&
{it.user.full_name}
} +
+ )} + + + {canEdit && isDraft ? ( + Number(e.target.value) !== Number(it.quantity) && updateItem(it.id, { quantity: Number(e.target.value) })} /> + ) : Number(it.quantity).toFixed(2)} + + + {canEdit && isDraft ? ( + Number(e.target.value) !== Number(it.rate) && updateItem(it.id, { rate: Number(e.target.value) })} /> + ) : formatCurrency(it.rate)} + + + {sub.billable ? formatCurrency(it.amount) : "—"} + + {canEdit && isDraft && ( + + + + )} + + ))} +
))}