diff --git a/next-env.d.ts b/next-env.d.ts index c4b7818..9edff1c 100644 --- a/next-env.d.ts +++ b/next-env.d.ts @@ -1,6 +1,6 @@ /// /// -import "./.next/dev/types/routes.d.ts"; +import "./.next/types/routes.d.ts"; // NOTE: This file should not be edited // see https://nextjs.org/docs/app/api-reference/config/typescript for more information. diff --git a/src/app/(full-page)/login/page.tsx b/src/app/(full-page)/login/page.tsx index d137fb5..adcc559 100644 --- a/src/app/(full-page)/login/page.tsx +++ b/src/app/(full-page)/login/page.tsx @@ -6,6 +6,7 @@ import { PasswordField } from '@/components/form'; import { Button } from '@/components/ui/button'; import { Input } from '@/components/ui/input'; import { Label } from '@/components/ui/label'; +import { AuthBackground } from '@/components/auth/AuthBackground'; import { GuestGuard } from '@/guards'; import { useLoginForm } from '@/hooks/useLoginForm'; import { ROUTES } from '@/utils/routes'; @@ -17,8 +18,8 @@ export default function LoginPage() { return (
-
-
+ +

diff --git a/src/app/(modules)/clients/components/ClientSheet.tsx b/src/app/(modules)/clients/components/ClientSheet.tsx index 661bed3..453dc1b 100644 --- a/src/app/(modules)/clients/components/ClientSheet.tsx +++ b/src/app/(modules)/clients/components/ClientSheet.tsx @@ -1,9 +1,10 @@ 'use client'; import type { ComponentProps } from 'react'; -import type { UseFormRegister } from 'react-hook-form'; +import type { FieldErrors, UseFormRegister } from 'react-hook-form'; import { Loader2 } from 'lucide-react'; +import { FormField } from '@/components/form'; import { Button } from '@/components/ui/button'; import { Dialog, @@ -14,7 +15,6 @@ import { DialogTitle, } from '@/components/ui/dialog'; import { Input } from '@/components/ui/input'; -import { Label } from '@/components/ui/label'; import type { ClientFormValues } from '../hooks/useClientForm'; interface ClientSheetProps { @@ -22,7 +22,10 @@ interface ClientSheetProps { onOpenChange: (open: boolean) => void; clientId?: number; register: UseFormRegister; + errors: FieldErrors; + isSubmitted: boolean; onSubmit: ComponentProps<'form'>['onSubmit']; + canSubmit: boolean; isSaving: boolean; } @@ -31,115 +34,168 @@ export function ClientSheet({ onOpenChange, clientId, register, + errors, + isSubmitted, onSubmit, + canSubmit, isSaving, }: ClientSheetProps) { + const nameErrorMessage = isSubmitted ? errors.name?.message : undefined; + const emailErrorMessage = isSubmitted ? errors.email?.message : undefined; + const landlineErrorMessage = isSubmitted + ? errors.landline_number?.message + : undefined; + const addressErrorMessage = isSubmitted ? errors.address?.message : undefined; + const contactNameErrorMessage = isSubmitted + ? errors.contact_name?.message + : undefined; + const contactPhoneErrorMessage = isSubmitted + ? errors.contact_phone_number?.message + : undefined; + const contactEmailErrorMessage = isSubmitted + ? errors.contact_email?.message + : undefined; + return (

- - - + + + {clientId ? 'Edit Client' : 'Create Client'} - + Manage company and primary contact details. -
-
-
- - +
+
+ -
-
- - + + + + + error={emailErrorMessage} + > + +
-
-
-
- - + -
-
- - + + + + + error={addressErrorMessage} + > + +
-
-
-
- - -
-
- - -
-
- - -
-
+
+ + + -
-
- - + + + + + + +
+ +
+ -
-
- - + + + + -
-
- - + + + + + error={contactEmailErrorMessage} + > + +
- + - diff --git a/src/app/(modules)/plans/components/PlanSheet.tsx b/src/app/(modules)/plans/components/PlanSheet.tsx index 65a94b0..f4353ff 100644 --- a/src/app/(modules)/plans/components/PlanSheet.tsx +++ b/src/app/(modules)/plans/components/PlanSheet.tsx @@ -1,14 +1,15 @@ 'use client'; import type { ComponentProps } from 'react'; -import type { Control, UseFormRegister } from 'react-hook-form'; +import type { Control, FieldErrors, UseFormRegister } from 'react-hook-form'; import { Controller } from 'react-hook-form'; import { Loader2 } from 'lucide-react'; +import { FormField } from '@/components/form'; import { PermissionTree } from '@/components/permission-tree'; import { Button } from '@/components/ui/button'; import { Input } from '@/components/ui/input'; -import { Label } from '@/components/ui/label'; +import { Textarea } from '@/components/ui/textarea'; import { Select, SelectContent, @@ -34,7 +35,10 @@ interface PlanSheetProps { planId?: number; register: UseFormRegister; control: Control; + errors: FieldErrors; + isSubmitted: boolean; onSubmit: ComponentProps<'form'>['onSubmit']; + canSubmit: boolean; permissionTree: PermissionTreeItem[]; permissionIds: number[]; onPermissionIdsChange: (ids: number[]) => void; @@ -48,177 +52,237 @@ export function PlanSheet({ planId, register, control, + errors, + isSubmitted, onSubmit, + canSubmit, permissionTree, permissionIds, onPermissionIdsChange, isPermissionsLoading, isSaving, }: PlanSheetProps) { + const fieldError = (field: keyof PlanFormValues) => + isSubmitted ? errors[field]?.message : undefined; + return ( - - - {planId ? 'Edit Plan' : 'Create Plan'} - + + + + {planId ? 'Edit Plan' : 'Create Plan'} + + Configure subscription limits, billing, and permission access. - -
-
- - +
+
+ -
-
- - + + + + + error={fieldError('slug')} + > + +
-
-
- -