| @@ -19,6 +19,7 @@ export default function FileList({ refType, refId, allowDelete, sx, dateHideable | |||||
| const theme = useTheme(); | const theme = useTheme(); | ||||
| const isMdOrLg = useMediaQuery(theme.breakpoints.up('md')); | const isMdOrLg = useMediaQuery(theme.breakpoints.up('md')); | ||||
| const intl = useIntl(); | const intl = useIntl(); | ||||
| const [onDownload, setOnDownload] = React.useState(false); | |||||
| React.useEffect(() => { | React.useEffect(() => { | ||||
| loadData(); | loadData(); | ||||
| @@ -41,10 +42,17 @@ export default function FileList({ refType, refId, allowDelete, sx, dateHideable | |||||
| }; | }; | ||||
| const onDownloadClick = (fileId, skey, filename) => () => { | const onDownloadClick = (fileId, skey, filename) => () => { | ||||
| setOnDownload(true) | |||||
| HttpUtils.fileDownload({ | HttpUtils.fileDownload({ | ||||
| fileId: fileId, | fileId: fileId, | ||||
| skey: skey, | skey: skey, | ||||
| filename: filename, | filename: filename, | ||||
| onResponse:()=>{ | |||||
| setOnDownload(false) | |||||
| }, | |||||
| onError:()=>{ | |||||
| setOnDownload(false) | |||||
| } | |||||
| }); | }); | ||||
| }; | }; | ||||
| @@ -91,6 +99,7 @@ export default function FileList({ refType, refId, allowDelete, sx, dateHideable | |||||
| className="textPrimary" | className="textPrimary" | ||||
| onClick={onDownloadClick(params.id, params.row.skey, params.row.filename)} | onClick={onDownloadClick(params.id, params.row.skey, params.row.filename)} | ||||
| color="primary" | color="primary" | ||||
| disabled={onDownload} | |||||
| />] | />] | ||||
| }, | }, | ||||
| }, | }, | ||||
| @@ -139,6 +148,7 @@ export default function FileList({ refType, refId, allowDelete, sx, dateHideable | |||||
| className="textPrimary" | className="textPrimary" | ||||
| onClick={onDownloadClick(params.id, params.row.skey, params.row.filename)} | onClick={onDownloadClick(params.id, params.row.skey, params.row.filename)} | ||||
| color="primary" | color="primary" | ||||
| disabled={onDownload} | |||||
| />] | />] | ||||
| }, | }, | ||||
| }, | }, | ||||
| @@ -21,8 +21,8 @@ import {ThemeProvider} from "@emotion/react"; | |||||
| import * as DateUtils from "utils/DateUtils"; | import * as DateUtils from "utils/DateUtils"; | ||||
| import * as UrlUtils from "utils/ApiPathConst"; | import * as UrlUtils from "utils/ApiPathConst"; | ||||
| import * as HttpUtils from "utils/HttpUtils"; | import * as HttpUtils from "utils/HttpUtils"; | ||||
| import Loadable from 'components/Loadable'; | |||||
| const LoadingComponent = Loadable(React.lazy(() => import('pages/extra-pages/LoadingComponent'))); | |||||
| // import Loadable from 'components/Loadable'; | |||||
| // const LoadingComponent = Loadable(React.lazy(() => import('pages/extra-pages/LoadingComponent'))); | |||||
| import {DatePicker} from "@mui/x-date-pickers/DatePicker"; | import {DatePicker} from "@mui/x-date-pickers/DatePicker"; | ||||
| import dayjs from "dayjs"; | import dayjs from "dayjs"; | ||||
| @@ -190,16 +190,13 @@ const AuditLogSearchForm = ({ applySearch, searchCriteria, onGridReady}) => { | |||||
| <Grid container maxWidth justifyContent="flex-end"> | <Grid container maxWidth justifyContent="flex-end"> | ||||
| {isGranted("MAINTAIN_SETTING") ? | {isGranted("MAINTAIN_SETTING") ? | ||||
| <Grid item sx={{ ml: 3, mr: 3, mb: 3,}}> | <Grid item sx={{ ml: 3, mr: 3, mb: 3,}}> | ||||
| {onDownload? | |||||
| <LoadingComponent disableText={true} alignItems="flex-start"/> | |||||
| : | |||||
| <Button | |||||
| variant="contained" | |||||
| onClick={exportExcel} | |||||
| > | |||||
| Export | |||||
| </Button> | |||||
| } | |||||
| <Button | |||||
| variant="contained" | |||||
| onClick={exportExcel} | |||||
| disabled={onDownload} | |||||
| > | |||||
| Export | |||||
| </Button> | |||||
| </Grid> : null | </Grid> : null | ||||
| } | } | ||||
| <Grid item sx={{ ml: 3, mr: 3, mb: 3,}}> | <Grid item sx={{ ml: 3, mr: 3, mb: 3,}}> | ||||
| @@ -41,6 +41,7 @@ export default function SearchDemandNote({ applySearch, searchCriteria, applyGri | |||||
| const [_searchCriteria, set_searchCriteria] = useState({}); | const [_searchCriteria, set_searchCriteria] = useState({}); | ||||
| const [selectedRowItems, setSelectedRowItems] = useState([]); | const [selectedRowItems, setSelectedRowItems] = useState([]); | ||||
| const navigate = useNavigate() | const navigate = useNavigate() | ||||
| const [onDownload, setOnDownload] = useState(false); | |||||
| useEffect(() => { | useEffect(() => { | ||||
| set_searchCriteria(searchCriteria); | set_searchCriteria(searchCriteria); | ||||
| @@ -86,10 +87,17 @@ export default function SearchDemandNote({ applySearch, searchCriteria, applyGri | |||||
| } | } | ||||
| const onDownloadClick = (params) => () => { | const onDownloadClick = (params) => () => { | ||||
| setOnDownload(true) | |||||
| HttpUtils.fileDownload({ | HttpUtils.fileDownload({ | ||||
| fileId: params.row.fileId, | fileId: params.row.fileId, | ||||
| skey: params.row.skey, | skey: params.row.skey, | ||||
| filename: params.row.filename, | filename: params.row.filename, | ||||
| onResponse:()=>{ | |||||
| setOnDownload(false) | |||||
| }, | |||||
| onError:()=>{ | |||||
| setOnDownload(false) | |||||
| } | |||||
| }); | }); | ||||
| }; | }; | ||||
| @@ -282,7 +290,7 @@ export default function SearchDemandNote({ applySearch, searchCriteria, applyGri | |||||
| ), | ), | ||||
| width: 280, | width: 280, | ||||
| renderCell: (params) => { | renderCell: (params) => { | ||||
| return <Button onClick={onDownloadClick(params)}><u>{params.row.filename}</u></Button>; | |||||
| return <Button disabled={onDownload} onClick={onDownloadClick(params)}><u>{params.row.filename}</u></Button>; | |||||
| }, | }, | ||||
| }, | }, | ||||
| { | { | ||||
| @@ -24,6 +24,7 @@ const OrganizationSearchForm = ({ applySearch, onGridReady, searchCriteria }) => | |||||
| const [type, setType] = useState([]); | const [type, setType] = useState([]); | ||||
| const [creditorSelected, setCreditorSelected] = React.useState(ComboData.CreditorStatus[0]); | const [creditorSelected, setCreditorSelected] = React.useState(ComboData.CreditorStatus[0]); | ||||
| const { reset, register, handleSubmit } = useForm() | const { reset, register, handleSubmit } = useForm() | ||||
| const [onDownload, setOnDownload] = React.useState(false); | |||||
| useEffect(() => { | useEffect(() => { | ||||
| if(searchCriteria.creditor!=undefined){ | if(searchCriteria.creditor!=undefined){ | ||||
| @@ -65,8 +66,15 @@ const OrganizationSearchForm = ({ applySearch, onGridReady, searchCriteria }) => | |||||
| } | } | ||||
| const doExport=()=>{ | const doExport=()=>{ | ||||
| setOnDownload(true) | |||||
| HttpUtils.fileDownload({ | HttpUtils.fileDownload({ | ||||
| url: UrlUtils.GET_ORG_EXPORT | |||||
| url: UrlUtils.GET_ORG_EXPORT, | |||||
| onResponse:()=>{ | |||||
| setOnDownload(false) | |||||
| }, | |||||
| onError:()=>{ | |||||
| setOnDownload(false) | |||||
| } | |||||
| }); | }); | ||||
| } | } | ||||
| @@ -164,6 +172,7 @@ const OrganizationSearchForm = ({ applySearch, onGridReady, searchCriteria }) => | |||||
| <Button | <Button | ||||
| variant="contained" | variant="contained" | ||||
| onClick={doExport} | onClick={doExport} | ||||
| disabled={onDownload} | |||||
| > | > | ||||
| Export | Export | ||||
| </Button> | </Button> | ||||
| @@ -165,14 +165,10 @@ const PaymentDetails = ({ formData,doPrint,onDownload }) => { | |||||
| </FormLabel> | </FormLabel> | ||||
| </Grid> | </Grid> | ||||
| <Grid xs={6} md={5} sx={{ml:5,textAlign: "left" }}> | <Grid xs={6} md={5} sx={{ml:5,textAlign: "left" }}> | ||||
| {onDownload? | |||||
| <LoadingComponent disableText={true} alignItems="flex-start"/> | |||||
| : | |||||
| <Button className="printHidden" variant="contained" sx={{ mt:2 }} onClick={doPrint}> | |||||
| <DownloadIcon/> | |||||
| <Typography sx={{fontSize: "16px"}}>Download</Typography> | |||||
| </Button> | |||||
| } | |||||
| <Button className="printHidden" variant="contained" disabled={onDownload} sx={{ mt:2 }} onClick={doPrint}> | |||||
| <DownloadIcon/> | |||||
| <Typography sx={{fontSize: "16px"}}>Download</Typography> | |||||
| </Button> | |||||
| </Grid> | </Grid> | ||||
| </Grid> | </Grid> | ||||
| </Grid> | </Grid> | ||||
| @@ -208,16 +208,12 @@ const PaymentDetails = ({ formData,doPrint,onDownload }) => { | |||||
| </FormLabel> | </FormLabel> | ||||
| </Grid> | </Grid> | ||||
| <Grid item xs={6} md={5} sx={{textAlign: "left" }}> | <Grid item xs={6} md={5} sx={{textAlign: "left" }}> | ||||
| {onDownload? | |||||
| <LoadingComponent disableText={true} alignItems="flex-start"/> | |||||
| : | |||||
| <Button className="printHidden" variant="contained" sx={{ mt:2 }} onClick={doPrint}> | |||||
| <DownloadIcon/> | |||||
| <Typography sx={{fontSize: "16px"}}> | |||||
| <FormattedMessage id="download"/> | |||||
| </Typography> | |||||
| </Button> | |||||
| } | |||||
| <Button className="printHidden" variant="contained" disabled={onDownload} sx={{ mt:2 }} onClick={doPrint}> | |||||
| <DownloadIcon/> | |||||
| <Typography sx={{fontSize: "16px"}}> | |||||
| <FormattedMessage id="download"/> | |||||
| </Typography> | |||||
| </Button> | |||||
| </Grid> | </Grid> | ||||
| </Grid> | </Grid> | ||||
| </Grid> | </Grid> | ||||
| @@ -34,6 +34,7 @@ const ApplicationDetailCard = ({ | |||||
| const [data, setData] = useState({}); | const [data, setData] = useState({}); | ||||
| const [cancelPopUp, setCancelPopUp] = useState(false); | const [cancelPopUp, setCancelPopUp] = useState(false); | ||||
| const [onDownload, setOnDownload] = useState(false); | |||||
| useEffect(() => { | useEffect(() => { | ||||
| if (formData) { | if (formData) { | ||||
| @@ -108,8 +109,15 @@ const ApplicationDetailCard = ({ | |||||
| } | } | ||||
| const genProof = () => { | const genProof = () => { | ||||
| setOnDownload(true) | |||||
| HttpUtils.fileDownload({ | HttpUtils.fileDownload({ | ||||
| url: UrlUtils.GEN_GAZETTE_PROOF + "/" + params.id | |||||
| url: UrlUtils.GEN_GAZETTE_PROOF + "/" + params.id, | |||||
| onResponse:()=>{ | |||||
| setOnDownload(false) | |||||
| }, | |||||
| onError:()=>{ | |||||
| setOnDownload(false) | |||||
| } | |||||
| }); | }); | ||||
| } | } | ||||
| @@ -130,7 +138,7 @@ const ApplicationDetailCard = ({ | |||||
| component="span" | component="span" | ||||
| variant="contained" | variant="contained" | ||||
| size="large" | size="large" | ||||
| disabled={!showProofBtn} | |||||
| disabled={!showProofBtn||onDownload} | |||||
| onClick={genProof} | onClick={genProof} | ||||
| > | > | ||||
| <Typography variant="h5">Proof Slip</Typography> | <Typography variant="h5">Proof Slip</Typography> | ||||
| @@ -56,6 +56,7 @@ const ApplicationDetailCard = ( | |||||
| const [warningText, setWarningText] = useState(""); | const [warningText, setWarningText] = useState(""); | ||||
| const [remarksPopUp, setRemarksPopUp] = useState(false); | const [remarksPopUp, setRemarksPopUp] = useState(false); | ||||
| const [onDownload, setOnDownload] = useState(false); | |||||
| useEffect(() => { | useEffect(() => { | ||||
| //if user data from parent are not null | //if user data from parent are not null | ||||
| @@ -84,12 +85,19 @@ const ApplicationDetailCard = ( | |||||
| } | } | ||||
| const onDownloadClick = () => () => { | const onDownloadClick = () => () => { | ||||
| setOnDownload(true) | |||||
| HttpUtils.fileDownload({ | HttpUtils.fileDownload({ | ||||
| fileId: fileDetail?.id, | fileId: fileDetail?.id, | ||||
| skey: fileDetail?.skey, | skey: fileDetail?.skey, | ||||
| filename: fileDetail?.filename, | filename: fileDetail?.filename, | ||||
| onResponse:()=>{ | |||||
| setOnDownload(false) | |||||
| notifyDownloadSuccess() | |||||
| }, | |||||
| onError:()=>{ | |||||
| setOnDownload(false) | |||||
| } | |||||
| }); | }); | ||||
| notifyDownloadSuccess() | |||||
| setUploadStatus(true) | setUploadStatus(true) | ||||
| }; | }; | ||||
| @@ -680,7 +688,7 @@ const ApplicationDetailCard = ( | |||||
| size="small" | size="small" | ||||
| variant="contained" | variant="contained" | ||||
| onClick={onDownloadClick()} | onClick={onDownloadClick()} | ||||
| disabled={!fileDetail?.filename} | |||||
| disabled={!fileDetail?.filename||onDownload} | |||||
| sx={{ | sx={{ | ||||
| textTransform: 'capitalize', | textTransform: 'capitalize', | ||||
| alignItems: 'end', | alignItems: 'end', | ||||
| @@ -61,6 +61,8 @@ const ApplicationDetailCard = ( | |||||
| const [onReady, setOnReady] = useState(false); | const [onReady, setOnReady] = useState(false); | ||||
| const [issueNum, setIssueNum] = useState(""); | const [issueNum, setIssueNum] = useState(""); | ||||
| const [issueDate, setIssueDate] = useState(""); | const [issueDate, setIssueDate] = useState(""); | ||||
| const [onDownload, setOnDownload] = useState(false); | |||||
| const { register, | const { register, | ||||
| // getValues | // getValues | ||||
| } = useForm(); | } = useForm(); | ||||
| @@ -89,10 +91,17 @@ const ApplicationDetailCard = ( | |||||
| }, [currentApplicationDetailData]); | }, [currentApplicationDetailData]); | ||||
| const onDownloadClick = () => () => { | const onDownloadClick = () => () => { | ||||
| setOnDownload(true) | |||||
| HttpUtils.fileDownload({ | HttpUtils.fileDownload({ | ||||
| fileId: fileDetail?.id, | fileId: fileDetail?.id, | ||||
| skey: fileDetail?.skey, | skey: fileDetail?.skey, | ||||
| filename: fileDetail?.filename, | filename: fileDetail?.filename, | ||||
| onResponse:()=>{ | |||||
| setOnDownload(false) | |||||
| }, | |||||
| onError:()=>{ | |||||
| setOnDownload(false) | |||||
| } | |||||
| }); | }); | ||||
| }; | }; | ||||
| @@ -646,7 +655,7 @@ const ApplicationDetailCard = ( | |||||
| aria-label={intl.formatMessage({ id: 'download' })} | aria-label={intl.formatMessage({ id: 'download' })} | ||||
| title={intl.formatMessage({ id: 'download' })} | title={intl.formatMessage({ id: 'download' })} | ||||
| color="save" | color="save" | ||||
| disabled={!fileDetail?.filename} | |||||
| disabled={!fileDetail?.filename||onDownload} | |||||
| startIcon={<DownloadIcon sx={{ alignItems: "center" }} />} | startIcon={<DownloadIcon sx={{ alignItems: "center" }} />} | ||||
| > | > | ||||
| <FormattedMessage id="download" /> | <FormattedMessage id="download" /> | ||||