+ {/* Customer Name */}
+
+
+
+
+
- ) : null}
-
- {/* Invoice Amount */}
-
-
-
-
- $
-
-
+ {state.errors?.customerId ? (
+
+ {state.errors.customerId.map((error: string) => (
+
{error}
+ ))}
+
+ ) : null}
- {state.errors?.amount ? (
-
- {state.errors.amount.map((error: string) => (
-
{error}
- ))}
+ {/* Invoice Amount */}
+
+
+
- ) : null}
-
- {/* Invoice Status */}
-
-
-
-
- {state.errors?.status ? (
-
- {state.errors.status.map((error: string) => (
-
{error}
- ))}
-
- ) : null}
-
-
- {state.message ? (
-
-
{state.message}
+ {state.errors?.amount ? (
+
+ {state.errors.amount.map((error: string) => (
+
{error}
+ ))}
+
+ ) : null}
- ) : null}
- {/* Submit Button */}
-
+ {/* Invoice Status */}
+
+
+
+ {state.errors?.status ? (
+
+ {state.errors.status.map((error: string) => (
+
{error}
+ ))}
+
+ ) : null}
+
+
+ {state.message ? (
+
+ ) : null}
+
+
+
+ Cancel
+
+
+
);
diff --git a/dashboard/15-final/app/ui/invoices/edit-form.tsx b/dashboard/15-final/app/ui/invoices/edit-form.tsx
index a9698c0..2776335 100644
--- a/dashboard/15-final/app/ui/invoices/edit-form.tsx
+++ b/dashboard/15-final/app/ui/invoices/edit-form.tsx
@@ -4,6 +4,17 @@ import { CustomerName, InvoiceForm } from '@/app/lib/definitions';
import { updateInvoice } from '@/app/lib/actions';
// @ts-ignore React types do not yet include useFormState
import { experimental_useFormState as useFormState } from 'react-dom';
+import Link from 'next/link';
+import { lusitana } from '@/app/ui/fonts';
+import { clsx } from 'clsx';
+import {
+ CheckIcon,
+ ClockIcon,
+ CurrencyDollarIcon,
+ UserCircleIcon,
+} from '@heroicons/react/24/outline';
+import { Button } from '../button';
+import { Breadcrumbs } from './breadcrumbs';
export default function EditInvoiceForm({
id,
@@ -18,120 +29,165 @@ export default function EditInvoiceForm({
const [state, dispatch] = useFormState(updateInvoice, initialState);
return (
-
-
Update Invoice
+
{error && (