| @@ -54,6 +54,7 @@ const FormPanel = ({ formData }) => { | |||||
| const [isSubmitting, setIsSubmitting] = React.useState(false); | const [isSubmitting, setIsSubmitting] = React.useState(false); | ||||
| const [isOnlyOnlinePayment, setOnlyOnlinePayment] = React.useState(); | const [isOnlyOnlinePayment, setOnlyOnlinePayment] = React.useState(); | ||||
| const [isNoPayment, setNoPayment] = React.useState(); | const [isNoPayment, setNoPayment] = React.useState(); | ||||
| const fileInputRef = React.useRef(null); | |||||
| const navigate = useNavigate() | const navigate = useNavigate() | ||||
| const params = useParams(); | const params = useParams(); | ||||
| @@ -627,6 +628,30 @@ const FormPanel = ({ formData }) => { | |||||
| </Grid> | </Grid> | ||||
| <Grid item xs={12} md={12} textAlign="left"> | <Grid item xs={12} md={12} textAlign="left"> | ||||
| <ThemeProvider theme={PNSPS_BUTTON_THEME}> | |||||
| <Button | |||||
| color="save" | |||||
| variant="contained" | |||||
| type="button" | |||||
| aria-label={intl.formatMessage({ id: 'upload' })} | |||||
| disabled={attachments.length >= (formik.values.groupType === "Private Bill" ? 2 : 1)} | |||||
| onClick={() => { | |||||
| if (fileInputRef.current) { | |||||
| fileInputRef.current.click(); | |||||
| } | |||||
| }} | |||||
| onKeyDown={(event) => { | |||||
| if (event.key === 'Enter' || event.key === ' ') { | |||||
| event.preventDefault(); | |||||
| if (fileInputRef.current) { | |||||
| fileInputRef.current.click(); | |||||
| } | |||||
| } | |||||
| }} | |||||
| > | |||||
| <FormattedMessage id="upload" /> | |||||
| </Button> | |||||
| </ThemeProvider> | |||||
| <input | <input | ||||
| id="uploadFileBtn" | id="uploadFileBtn" | ||||
| name="file" | name="file" | ||||
| @@ -637,20 +662,8 @@ const FormPanel = ({ formData }) => { | |||||
| onChange={(event) => { | onChange={(event) => { | ||||
| readFile(event) | readFile(event) | ||||
| }} | }} | ||||
| ref={fileInputRef} | |||||
| /> | /> | ||||
| <label htmlFor="uploadFileBtn"> | |||||
| <ThemeProvider theme={PNSPS_BUTTON_THEME}> | |||||
| <Button | |||||
| color="save" | |||||
| component="span" | |||||
| variant="contained" | |||||
| aria-label={intl.formatMessage({ id: 'upload' })} | |||||
| disabled={attachments.length >= (formik.values.groupType === "Private Bill" ? 2 : 1)} | |||||
| > | |||||
| <FormattedMessage id="upload" /> | |||||
| </Button> | |||||
| </ThemeProvider> | |||||
| </label> | |||||
| </Grid> | </Grid> | ||||