@@ -23,14 +23,15 @@ import PhotoArray from "./photo-array";
23
23
import { buildBase64URL } from "./utils" ;
24
24
25
25
// TODO: No link to display / download upload
26
- const Component = ( { name, field, label, disabled, formik, mode, recordType } ) => {
26
+ const Component = ( { name, field, label, disabled, formik, mode, recordType, helperText } ) => {
27
27
const i18n = useI18n ( ) ;
28
28
29
29
const loading = useMemoizedSelector ( state => getLoadingRecordState ( state , recordType ) ) ;
30
30
const processing = useMemoizedSelector ( state => getIsProcessingAttachments ( state , recordType , name ) ) ;
31
31
const recordAttachments = useMemoizedSelector ( state => getRecordAttachments ( state , recordType ) ) ;
32
32
33
33
const values = get ( formik . values , name , [ ] ) ;
34
+ const error = get ( formik . errors , name , "" ) ;
34
35
const attachment = FIELD_ATTACHMENT_TYPES [ field . type ] ;
35
36
36
37
const [ openLastDialog , setOpenLastDialog ] = useState ( false ) ;
@@ -109,7 +110,7 @@ const Component = ({ name, field, label, disabled, formik, mode, recordType }) =
109
110
if ( field . type === PHOTO_FIELD && mode . isShow ) {
110
111
const images = values ?. map ( value => value . attachment_url || buildBase64URL ( value . content_type , value . attachment ) ) ;
111
112
112
- return < PhotoArray images = { images } /> ;
113
+ return < PhotoArray images = { images } data-testid = "photo-array" /> ;
113
114
}
114
115
115
116
if ( field . type === AUDIO_FIELD && mode . isShow ) {
@@ -122,11 +123,12 @@ const Component = ({ name, field, label, disabled, formik, mode, recordType }) =
122
123
return (
123
124
< FieldArray name = { name } validateOnChange = { false } >
124
125
{ arrayHelpers => (
125
- < div >
126
+ < div data-testid = "field-array" >
126
127
< AttachmentLabel
127
128
label = { label }
128
129
mode = { mode }
129
- helpText = { field . help_text [ i18n . locale ] }
130
+ helpText = { helperText }
131
+ error = { error }
130
132
handleAttachmentAddition = { handleAttachmentAddition }
131
133
arrayHelpers = { arrayHelpers }
132
134
disabled = { disabled }
@@ -149,6 +151,7 @@ Component.propTypes = {
149
151
disabled : PropTypes . bool ,
150
152
field : PropTypes . object ,
151
153
formik : PropTypes . object ,
154
+ helperText : PropTypes . string ,
152
155
label : PropTypes . string ,
153
156
mode : PropTypes . object ,
154
157
name : PropTypes . string ,
0 commit comments