diff --git a/app/lib/actions/locationActions.ts b/app/lib/actions/locationActions.ts index ef54c39..d90c530 100644 --- a/app/lib/actions/locationActions.ts +++ b/app/lib/actions/locationActions.ts @@ -14,7 +14,6 @@ import { getTranslations, getLocale } from "next-intl/server"; export type State = { errors?: { locationName?: string[]; - locationNotes?: string[]; generateTenantCode?: string[]; tenantFirstName?: string[]; tenantLastName?: string[]; @@ -34,7 +33,6 @@ export type State = { const FormSchema = (t:IntlTemplateFn) => z.object({ _id: z.string(), locationName: z.coerce.string().min(1, t("location-name-required")), - locationNotes: z.string(), generateTenantCode: z.boolean().optional().nullable(), tenantFirstName: z.string().optional().nullable(), tenantLastName: z.string().optional().nullable(), @@ -92,7 +90,6 @@ export const updateOrAddLocation = withUser(async (user:AuthenticatedUser, locat const validatedFields = FormSchema(t).safeParse({ locationName: formData.get('locationName'), - locationNotes: formData.get('locationNotes'), generateTenantCode: formData.get('generateTenantCode') === 'on', tenantFirstName: formData.get('tenantFirstName') || null, tenantLastName: formData.get('tenantLastName') || null, @@ -115,7 +112,6 @@ export const updateOrAddLocation = withUser(async (user:AuthenticatedUser, locat const { locationName, - locationNotes, generateTenantCode, tenantFirstName, tenantLastName, @@ -156,7 +152,6 @@ export const updateOrAddLocation = withUser(async (user:AuthenticatedUser, locat { $set: { name: locationName, - notes: locationNotes, generateTenantCode: generateTenantCode || false, tenantFirstName: tenantFirstName || null, tenantLastName: tenantLastName || null, @@ -185,7 +180,6 @@ export const updateOrAddLocation = withUser(async (user:AuthenticatedUser, locat { $set: { name: locationName, - notes: locationNotes, generateTenantCode: generateTenantCode || false, tenantFirstName: tenantFirstName || null, tenantLastName: tenantLastName || null, @@ -207,7 +201,6 @@ export const updateOrAddLocation = withUser(async (user:AuthenticatedUser, locat { $set: { name: locationName, - notes: locationNotes, generateTenantCode: generateTenantCode || false, tenantFirstName: tenantFirstName || null, tenantLastName: tenantLastName || null, @@ -227,7 +220,6 @@ export const updateOrAddLocation = withUser(async (user:AuthenticatedUser, locat userId, userEmail, name: locationName, - notes: locationNotes, generateTenantCode: generateTenantCode || false, tenantFirstName: tenantFirstName || null, tenantLastName: tenantLastName || null, @@ -299,7 +291,6 @@ export const updateOrAddLocation = withUser(async (user:AuthenticatedUser, locat userId, userEmail, name: locationName, - notes: locationNotes, generateTenantCode: generateTenantCode || false, tenantFirstName: tenantFirstName || null, tenantLastName: tenantLastName || null, diff --git a/app/ui/LocationEditForm.tsx b/app/ui/LocationEditForm.tsx index 7e1d8a6..a2b9d93 100644 --- a/app/ui/LocationEditForm.tsx +++ b/app/ui/LocationEditForm.tsx @@ -78,14 +78,6 @@ export const LocationEditForm: FC = ({ location, yearMont ))} -
- {state.errors?.locationNotes && - state.errors.locationNotes.map((error: string) => ( -

- {error} -

- ))} -
{t("tenant-2d-code-legend")} @@ -284,11 +276,16 @@ export const LocationEditForm: FC = ({ location, yearMont } export const LocationEditFormSkeleton: FC = () => { + const t = useTranslations("location-edit-form"); + return (
+
-
-
+
+ {t("location-name-legend")} +
+