@@ -43,7 +43,7 @@ const donationSchema = yup.object({
4343 amount : yup
4444 . number ( )
4545 . typeError ( 'Amount must be a valid number' )
46- . required ( )
46+ . required ( i18n . t ( 'Amount is required' ) )
4747 . test (
4848 'Is amount in valid currency format?' ,
4949 'Amount must be in valid currency format' ,
@@ -70,12 +70,12 @@ const donationSchema = yup.object({
7070 ( value ) => ! value || parseFloat ( value as unknown as string ) > 0 ,
7171 ) ,
7272 appealId : yup . string ( ) . nullable ( ) ,
73- currency : yup . string ( ) . required ( ) ,
73+ currency : yup . string ( ) . required ( i18n . t ( 'Currency is required' ) ) ,
7474 designationAccountId : yup
7575 . string ( )
7676 . required ( i18n . t ( 'Designation Account is required' ) ) ,
77- donationDate : requiredDateTime ( ) ,
78- donorAccountId : yup . string ( ) . required ( ) ,
77+ donationDate : requiredDateTime ( i18n . t ( 'Date is required' ) ) ,
78+ donorAccountId : yup . string ( ) . required ( i18n . t ( 'Partner Account is required' ) ) ,
7979 memo : yup . string ( ) . nullable ( ) ,
8080 motivation : yup . string ( ) . nullable ( ) ,
8181 paymentMethod : yup . string ( ) . nullable ( ) ,
@@ -251,7 +251,7 @@ export const AddDonation = ({
251251 setFieldValue ( 'currency' , currencyCode ) ;
252252 } }
253253 textFieldProps = { {
254- error : ! ! errors . currency ,
254+ error : ! ! errors . currency && touched . currency ,
255255 } }
256256 size = "small"
257257 />
@@ -288,6 +288,13 @@ export const AddDonation = ({
288288 onChange = { ( date ) =>
289289 setFieldValue ( 'donationDate' , date )
290290 }
291+ error = { Boolean (
292+ errors . donationDate && touched . donationDate ,
293+ ) }
294+ helperText = {
295+ touched . donationDate &&
296+ ( errors . donationDate as string )
297+ }
291298 />
292299 ) }
293300 </ FastField >
@@ -355,6 +362,13 @@ export const AddDonation = ({
355362 autocompleteId = "partner-account-input"
356363 labelId = "partner-account-label"
357364 size = "small"
365+ textFieldProps = { {
366+ error :
367+ ! ! errors . donorAccountId &&
368+ touched . donorAccountId ,
369+ helperText :
370+ touched . donorAccountId && errors . donorAccountId ,
371+ } }
358372 />
359373 </ Box >
360374 ) }
@@ -474,6 +488,9 @@ export const AddDonation = ({
474488 'aria-labelledby' : 'appeal-amount-label' ,
475489 } }
476490 />
491+ < FormHelperText >
492+ { touched . appealAmount && errors . appealAmount }
493+ </ FormHelperText >
477494 </ Box >
478495 ) }
479496 </ Field >
0 commit comments