diff --git a/dashboard/15-final/app/dashboard/layout.tsx b/dashboard/15-final/app/dashboard/layout.tsx index d7b45e2..291d5ca 100644 --- a/dashboard/15-final/app/dashboard/layout.tsx +++ b/dashboard/15-final/app/dashboard/layout.tsx @@ -6,7 +6,7 @@ export default function Layout({ children }: { children: React.ReactNode }) {
-
{children}
+
{children}
); } diff --git a/dashboard/15-final/app/ui/button.tsx b/dashboard/15-final/app/ui/button.tsx index c634ac1..f65aa1d 100644 --- a/dashboard/15-final/app/ui/button.tsx +++ b/dashboard/15-final/app/ui/button.tsx @@ -9,7 +9,7 @@ export function Button({ children, className, ...rest }: ButtonProps) { + {/* Invoice Status */} +
+ +
+
+
+ + +
+
+ + +
+
+
+ {state.errors?.status ? ( +
+ {state.errors.status.map((error: string) => ( +

{error}

+ ))} +
+ ) : null} +
+ + {state.message ? ( +
+

{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

+
+
- - {/* Customer selection */} -
- - - - {state.errors?.customerId ? ( -
+ {/* 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 ? ( +
+

{state.message}

+
+ ) : null} +
+
+ + Cancel + + +
); diff --git a/dashboard/15-final/app/ui/login-form.tsx b/dashboard/15-final/app/ui/login-form.tsx index 2a8c3c6..3e4beaa 100644 --- a/dashboard/15-final/app/ui/login-form.tsx +++ b/dashboard/15-final/app/ui/login-form.tsx @@ -64,7 +64,7 @@ export default function LoginForm() { value={email} onChange={(e) => setEmail(e.target.value)} /> - +
@@ -83,7 +83,7 @@ export default function LoginForm() { value={password} onChange={(e) => setPassword(e.target.value)} /> - +
{error && (