diff --git a/source/frontend/src/features/leases/add/AddLeaseYupSchema.ts b/source/frontend/src/features/leases/add/AddLeaseYupSchema.ts index 60a39adb1c..c15514c5a0 100644 --- a/source/frontend/src/features/leases/add/AddLeaseYupSchema.ts +++ b/source/frontend/src/features/leases/add/AddLeaseYupSchema.ts @@ -1,3 +1,4 @@ +/* eslint-disable no-template-curly-in-string */ import * as Yup from 'yup'; import { isLeaseCategoryVisible } from './AdministrationSubForm'; @@ -9,12 +10,12 @@ export const AddLeaseYupSchema = Yup.object().shape({ paymentReceivableTypeCode: Yup.string().required('Payment Receivable Type is required'), regionId: Yup.string().required('MOTI Region Type is required'), programTypeCode: Yup.string().required('Program Type is required'), - motiName: Yup.string().max(200, 'MOTI Contact must be at most 200 characters'), + motiName: Yup.string().max(200, 'MOTI Contact must be at most ${max} characters'), otherProgramTypeDescription: Yup.string().when('programTypeCode', { is: (programTypeCode: string) => programTypeCode && programTypeCode === 'OTHER', then: Yup.string() .required('Other Description required') - .max(200, 'Other Description must be at most 200 characters'), + .max(200, 'Other Description must be at most ${max} characters'), otherwise: Yup.string().nullable(), }), leaseTypeCode: Yup.string().required('Lease Type is required'), @@ -24,7 +25,7 @@ export const AddLeaseYupSchema = Yup.object().shape({ is: (leaseTypeCode: string) => leaseTypeCode && leaseTypeCode === 'OTHER', then: Yup.string() .required('Other Description required') - .max(200, 'Other Description must be at most 200 characters'), + .max(200, 'Other Description must be at most ${max} characters'), otherwise: Yup.string().nullable(), }), categoryTypeCode: Yup.string() @@ -39,7 +40,7 @@ export const AddLeaseYupSchema = Yup.object().shape({ is: (categoryTypeCode: string) => categoryTypeCode && categoryTypeCode === 'OTHER', then: Yup.string() .required('Other Description required') - .max(200, 'Other Description must be at most 200 characters'), + .max(200, 'Other Description must be at most ${max} characters'), otherwise: Yup.string().nullable(), }), purposeTypeCode: Yup.string().required('Purpose Type is required'), @@ -47,15 +48,20 @@ export const AddLeaseYupSchema = Yup.object().shape({ is: (purposeTypeCode: string) => purposeTypeCode && purposeTypeCode === 'OTHER', then: Yup.string() .required('Other Description required') - .max(200, 'Other Description must be at most 200 characters'), + .max(200, 'Other Description must be at most ${max} characters'), otherwise: Yup.string().nullable(), }), documentationReference: Yup.string().max( 500, - 'Location of documents must be at most 500 characters', + 'Location of documents must be at most ${max} characters', + ), + description: Yup.string().max(4000, 'Description must be at most ${max} characters'), + note: Yup.string().max(4000, 'Notes must be at most ${max} characters'), + tfaFileNumber: Yup.string().max(50, 'LIS # must be at most ${max} characters'), + psFileNo: Yup.string().max(50, 'PS # must be at most ${max} characters'), + properties: Yup.array().of( + Yup.object().shape({ + name: Yup.string().max(250, 'Property name must be at most ${max} characters'), + }), ), - description: Yup.string().max(4000, 'Description must be at most 4000 characters'), - note: Yup.string().max(4000, 'Notes must be at most 4000 characters'), - tfaFileNumber: Yup.string().max(50, `LIS # must be at most 50 characters`), - psFileNo: Yup.string().max(50, 'PS # must be at most 50 characters'), });