@@ -402,7 +402,7 @@ export function InvoiceDetailSheet({
{fmtDate(invoice.dueDate)}
@@ -412,7 +412,7 @@ export function InvoiceDetailSheet({
{invoice.paidAt && (
Paid On
-
{fmtDate(invoice.paidAt)}
+
{fmtDate(invoice.paidAt)}
)}
@@ -464,8 +464,8 @@ export function InvoiceDetailSheet({
{discount > 0 && (
Discount
-
- −{fmtCurrency(discount, invoice.currency)}
+
+ −{fmtCurrency(discount, invoice.currency)}
)}
@@ -476,7 +476,7 @@ export function InvoiceDetailSheet({
{amountPaid > 0 && (
<>
-
+
Amount Paid
{fmtCurrency(amountPaid, invoice.currency)}
@@ -494,10 +494,10 @@ export function InvoiceDetailSheet({
Payment Details
-
+
-
-
+
+
{invoice.status === "PAID" ? "Fully paid" : "Partially paid"}
@@ -517,7 +517,7 @@ export function InvoiceDetailSheet({
{amountDue > 0 && (
Balance due
-
+
{fmtCurrency(amountDue, invoice.currency)}
@@ -554,7 +554,7 @@ export function InvoiceDetailSheet({
- {/* ── Footer actions ── */}
+ {/* ── Footer actions ── */}
{/* Primary row: Edit + Send */}
{isDraft && (
@@ -615,7 +615,7 @@ export function InvoiceDetailSheet({
- {/* ── Send modal (rendered outside sheet to avoid z-index nesting issues) ── */}
+ {/* ── Send modal (rendered outside sheet to avoid z-index nesting issues) ── */}
- {/* ── PDF preview dialog ── */}
+ {/* ── PDF preview dialog ── */}
0"),
unitPrice: z
.number({ invalid_type_error: "Must be a number" })
- .nonnegative("Price ≥ 0"),
+ .nonnegative("Price ≥ 0"),
});
const InvoiceSchema = z.object({
@@ -44,7 +44,7 @@ const InvoiceSchema = z.object({
type FormErrors = Partial>;
-// ── Line item helpers ──────────────────────────────────────────────────────────
+// ── Line item helpers ──────────────────────────────────────────────────────────
interface LineItemRow {
id: string;
@@ -80,7 +80,7 @@ function computeTotals(
return { subtotal, taxAmount, total };
}
-// ── Props ──────────────────────────────────────────────────────────────────────
+// ── Props ──────────────────────────────────────────────────────────────────────
interface InvoiceDrawerProps {
open: boolean;
@@ -92,7 +92,7 @@ interface InvoiceDrawerProps {
isLoading?: boolean;
}
-// ── Component ──────────────────────────────────────────────────────────────────
+// ── Component ──────────────────────────────────────────────────────────────────
export function InvoiceDrawer({
open,
@@ -104,12 +104,12 @@ export function InvoiceDrawer({
}: InvoiceDrawerProps) {
const isEditing = !!invoice;
- // ── Customer fields ──────────────────────────────────────────────────────────
+ // ── Customer fields ──────────────────────────────────────────────────────────
const [customerEmail, setCustomerEmail] = useState(invoice?.customerEmail ?? "");
const [customerName, setCustomerName] = useState(invoice?.customerName ?? "");
const [invoiceNumber, setInvoiceNumber] = useState(invoice?.invoiceNumber ?? "");
- // ── Line items ───────────────────────────────────────────────────────────────
+ // ── Line items ───────────────────────────────────────────────────────────────
const [rows, setRows] = useState(() => {
if (invoice?.lineItems?.length) {
return invoice.lineItems.map((li) => ({
@@ -122,7 +122,7 @@ export function InvoiceDrawer({
return [emptyRow()];
});
- // ── Pricing ──────────────────────────────────────────────────────────────────
+ // ── Pricing ──────────────────────────────────────────────────────────────────
const [currency, setCurrency] = useState(invoice?.currency ?? "USD");
const [taxRate, setTaxRate] = useState(
invoice?.taxRate ? String(Number(invoice.taxRate) * 100) : "",
@@ -131,21 +131,21 @@ export function InvoiceDrawer({
invoice?.discount ? String(Number(invoice.discount)) : "",
);
- // ── Meta ─────────────────────────────────────────────────────────────────────
+ // ── Meta ─────────────────────────────────────────────────────────────────────
const [dueDate, setDueDate] = useState(
invoice?.dueDate ? invoice.dueDate.split("T")[0] : "",
);
const [notes, setNotes] = useState(invoice?.notes ?? "");
- // ── Errors ───────────────────────────────────────────────────────────────────
+ // ── Errors ───────────────────────────────────────────────────────────────────
const [errors, setErrors] = useState({});
- // ── Computed totals ───────────────────────────────────────────────────────────
+ // ── Computed totals ───────────────────────────────────────────────────────────
const taxRatePct = parseFloat(taxRate) || 0;
const discountAmt = parseFloat(discount) || 0;
const { subtotal, taxAmount, total } = computeTotals(rows, taxRatePct, discountAmt);
- // ── Row handlers ──────────────────────────────────────────────────────────────
+ // ── Row handlers ──────────────────────────────────────────────────────────────
const addRow = () => setRows((prev) => [...prev, emptyRow()]);
const removeRow = useCallback((id: string) => {
@@ -166,7 +166,7 @@ export function InvoiceDrawer({
[],
);
- // ── Validation ────────────────────────────────────────────────────────────────
+ // ── Validation ────────────────────────────────────────────────────────────────
const validate = (): CreateInvoiceInput | null => {
const lineItemsForValidation = rows.map(rowToItem);
@@ -259,7 +259,7 @@ export function InvoiceDrawer({
- {/* ── Scrollable body ── */}
+ {/* ── Scrollable body ── */}
{/* Client details */}
@@ -466,7 +466,7 @@ export function InvoiceDrawer({
{discountAmt > 0 && (
Discount
- −{fmtCurrency(discountAmt)}
+ −{fmtCurrency(discountAmt)}
)}
@@ -496,7 +496,7 @@ export function InvoiceDrawer({
- {/* ── Footer ── */}
+ {/* ── Footer ── */}