Browse Source

button add keyboard control

web_access_fix
Jason Chuang 1 week ago
parent
commit
3e4f5227b6
4 changed files with 79 additions and 15 deletions
  1. +19
    -4
      src/pages/GazetteIssue/index.js
  2. +19
    -4
      src/pages/Holiday/index.js
  3. +18
    -3
      src/pages/Proof/Create_FromApp/ProofForm.js
  4. +23
    -4
      src/pages/authentication/auth-forms/BusCustomFormWizard.js

+ 19
- 4
src/pages/GazetteIssue/index.js View File

@@ -52,6 +52,7 @@ const Index = () => {
const [waitDownload, setWaitDownload] = React.useState(false); const [waitDownload, setWaitDownload] = React.useState(false);
const [isWarningPopUp, setIsWarningPopUp] = React.useState(false); const [isWarningPopUp, setIsWarningPopUp] = React.useState(false);
const [warningText, setWarningText] = React.useState(""); const [warningText, setWarningText] = React.useState("");
const fileInputRef = React.useRef(null);


React.useEffect(() => { React.useEffect(() => {
setOnSearchReady(false); setOnSearchReady(false);
@@ -186,13 +187,27 @@ const Index = () => {
<Stack direction="row" justifyContent="flex-start" alignItems="center" spacing={2} sx={{ ml: 2, mt: 1 }}> <Stack direction="row" justifyContent="flex-start" alignItems="center" spacing={2} sx={{ ml: 2, mt: 1 }}>
<ThemeProvider theme={PNSPS_LONG_BUTTON_THEME}> <ThemeProvider theme={PNSPS_LONG_BUTTON_THEME}>
<Button <Button
component="label"
variant="contained" variant="contained"
size="large" size="large"
disabled={waitImport} disabled={waitImport}
type="button"
onClick={() => {
if (fileInputRef.current) {
fileInputRef.current.click();
}
}}
onKeyDown={(event) => {
if (event.key === 'Enter' || event.key === ' ') {
event.preventDefault();
if (fileInputRef.current) {
fileInputRef.current.click();
}
}
}}
> >
<Typography variant="h5">Upload Files</Typography> <Typography variant="h5">Upload Files</Typography>
<input
</Button>
<input
id="uploadFileBtn" id="uploadFileBtn"
name="file" name="file"
type="file" type="file"
@@ -201,8 +216,8 @@ const Index = () => {
disabled={waitImport} disabled={waitImport}
onChange={readFile} onChange={readFile}
aria-label={intl.formatMessage({ id: 'ariaUploadExcelFile' })} aria-label={intl.formatMessage({ id: 'ariaUploadExcelFile' })}
/>
</Button>
ref={fileInputRef}
/>
</ThemeProvider> </ThemeProvider>
</Stack> </Stack>
</Grid> </Grid>


+ 19
- 4
src/pages/Holiday/index.js View File

@@ -51,6 +51,7 @@ const Index = () => {
const [waitDownload, setWaitDownload] = React.useState(false); const [waitDownload, setWaitDownload] = React.useState(false);
const [isWarningPopUp, setIsWarningPopUp] = React.useState(false); const [isWarningPopUp, setIsWarningPopUp] = React.useState(false);
const [warningText, setWarningText] = React.useState(""); const [warningText, setWarningText] = React.useState("");
const fileInputRef = React.useRef(null);


React.useEffect(() => { React.useEffect(() => {
setOnSearchReady(false); setOnSearchReady(false);
@@ -181,13 +182,27 @@ const Index = () => {
{isGrantedAny(["MAINTAIN_GAZETTE_ISSUE"]) ? {isGrantedAny(["MAINTAIN_GAZETTE_ISSUE"]) ?
<ThemeProvider theme={PNSPS_LONG_BUTTON_THEME}> <ThemeProvider theme={PNSPS_LONG_BUTTON_THEME}>
<Button <Button
component="label"
variant="contained" variant="contained"
size="large" size="large"
disabled={waitImport} disabled={waitImport}
type="button"
onClick={() => {
if (fileInputRef.current) {
fileInputRef.current.click();
}
}}
onKeyDown={(event) => {
if (event.key === 'Enter' || event.key === ' ') {
event.preventDefault();
if (fileInputRef.current) {
fileInputRef.current.click();
}
}
}}
> >
<Typography variant="h5">Upload Files</Typography> <Typography variant="h5">Upload Files</Typography>
<input
</Button>
<input
id="uploadFileBtn" id="uploadFileBtn"
name="file" name="file"
type="file" type="file"
@@ -196,8 +211,8 @@ const Index = () => {
disabled={waitImport} disabled={waitImport}
onChange={readFile} onChange={readFile}
aria-label={intl.formatMessage({ id: 'ariaUploadExcelFile' })} aria-label={intl.formatMessage({ id: 'ariaUploadExcelFile' })}
/>
</Button>
ref={fileInputRef}
/>
</ThemeProvider> </ThemeProvider>
: null : null
} }


+ 18
- 3
src/pages/Proof/Create_FromApp/ProofForm.js View File

@@ -42,6 +42,7 @@ const FormPanel = ({ formData }) => {


const [proofPaymentDeadlineMin, setProofPaymentDeadlineMin] = React.useState({}); const [proofPaymentDeadlineMin, setProofPaymentDeadlineMin] = React.useState({});
const [reviseDeadlineMin, setReviseDeadlineMin] = React.useState({}); const [reviseDeadlineMin, setReviseDeadlineMin] = React.useState({});
const fileInputRef = React.useRef(null);


const navigate = useNavigate() const navigate = useNavigate()


@@ -278,12 +279,26 @@ const FormPanel = ({ formData }) => {
</Grid> </Grid>
<Grid item xs={12} md={12}> <Grid item xs={12} md={12}>
<Button <Button
component="label"
variant="contained" variant="contained"
size="large" size="large"
disabled={attachments.length >= (formik.values.groupType == "Private Bill" ? 2 : 1)} disabled={attachments.length >= (formik.values.groupType == "Private Bill" ? 2 : 1)}
type="button"
onClick={() => {
if (fileInputRef.current) {
fileInputRef.current.click();
}
}}
onKeyDown={(event) => {
if (event.key === 'Enter' || event.key === ' ') {
event.preventDefault();
if (fileInputRef.current) {
fileInputRef.current.click();
}
}
}}
> >
<Typography variant="h5">Upload Files</Typography>
<Typography variant="h5">Upload Files</Typography>
</Button>
<input <input
id="uploadFileBtn" id="uploadFileBtn"
name="file" name="file"
@@ -293,8 +308,8 @@ const FormPanel = ({ formData }) => {
disabled={attachments.length >= (formik.values.groupType == "Private Bill" ? 2 : 1)} disabled={attachments.length >= (formik.values.groupType == "Private Bill" ? 2 : 1)}
onChange={readFile} onChange={readFile}
aria-label={intl.formatMessage({ id: 'ariaUploadPdfFile' })} aria-label={intl.formatMessage({ id: 'ariaUploadPdfFile' })}
ref={fileInputRef}
/> />
</Button>
</Grid> </Grid>
<Grid item xs={12} md={12}> <Grid item xs={12} md={12}>
<UploadFileTable <UploadFileTable


+ 23
- 4
src/pages/authentication/auth-forms/BusCustomFormWizard.js View File

@@ -1,4 +1,4 @@
import { useEffect, useState, } from 'react';
import { useEffect, useState, useRef } from 'react';


// material-ui // material-ui
import { import {
@@ -100,6 +100,7 @@ const BusCustomFormWizard = (props) => {
const [termsAndConNotAccept, setTermsAndConNotAccept] = useState(false); const [termsAndConNotAccept, setTermsAndConNotAccept] = useState(false);
const [isValid, setisValid] = useState(false); const [isValid, setisValid] = useState(false);
const [checkCountry, setCheckCountry] = useState(false); const [checkCountry, setCheckCountry] = useState(false);
const fileInputRef = useRef(null);
const username = document.getElementById("username-login") const username = document.getElementById("username-login")
const [checkUsername, setCheckUsername] = useState(false); const [checkUsername, setCheckUsername] = useState(false);
const [checkUsernameBlur, setCheckUsernameBlur] = useState(false) const [checkUsernameBlur, setCheckUsernameBlur] = useState(false)
@@ -1480,8 +1481,26 @@ const BusCustomFormWizard = (props) => {
{/* <Typography display="inline" variant="h6" sx={{ fontSize: 12,color: 'primary.primary'}}>如: 香港身份證; 護照; 中國內地身份證等</Typography> */} {/* <Typography display="inline" variant="h6" sx={{ fontSize: 12,color: 'primary.primary'}}>如: 香港身份證; 護照; 中國內地身份證等</Typography> */}
<Stack mt={1} direction="row" justifyContent="flex-start" alignItems="center" spacing={2}> <Stack mt={1} direction="row" justifyContent="flex-start" alignItems="center" spacing={2}>
<ThemeProvider theme={PNSPS_LONG_BUTTON_THEME}> <ThemeProvider theme={PNSPS_LONG_BUTTON_THEME}>
<Button variant="contained" component="label" sx={{ height: '40px' }}>
<FormattedMessage id="uploadFile"/>
<Button
variant="contained"
sx={{ height: '40px' }}
type="button"
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="uploadFile" />
</Button>
<input <input
accept="image/png, .jpg, .bmp, .pdf" accept="image/png, .jpg, .bmp, .pdf"
//className={classes.input} //className={classes.input}
@@ -1489,9 +1508,9 @@ const BusCustomFormWizard = (props) => {
multiple multiple
type="file" type="file"
onChange={handleFileUpload} onChange={handleFileUpload}
ref={fileInputRef}
style={{ display: 'none' }} style={{ display: 'none' }}
/> />
</Button>
</ThemeProvider> </ThemeProvider>
{/* <Typography display="inline" variant="h6" sx={{ fontSize: 12, color: 'primary.primary'}}></Typography> */} {/* <Typography display="inline" variant="h6" sx={{ fontSize: 12, color: 'primary.primary'}}></Typography> */}
</Stack> </Stack>


Loading…
Cancel
Save