| @@ -32,6 +32,8 @@ import UnionPayIcon from "assets/images/icons/unionpay.svg"; | |||||
| import PpsIcon from "assets/images/icons/ppshk.svg"; | import PpsIcon from "assets/images/icons/ppshk.svg"; | ||||
| import FpsIcon from "assets/images/icons/fps.svg"; | import FpsIcon from "assets/images/icons/fps.svg"; | ||||
| import {FormattedMessage, useIntl} from "react-intl"; | import {FormattedMessage, useIntl} from "react-intl"; | ||||
| import * as HttpUtils from "utils/HttpUtils" | |||||
| import * as UrlUtils from "utils/ApiPathConst" | |||||
| const MultiPaymentWindow = (props) => { | const MultiPaymentWindow = (props) => { | ||||
| const intl = useIntl(); | const intl = useIntl(); | ||||
| @@ -52,7 +54,10 @@ const MultiPaymentWindow = (props) => { | |||||
| const [pPSClass, setPPSlass] = useState(""); | const [pPSClass, setPPSlass] = useState(""); | ||||
| const [filteredPaymentMethod, setFilteredPaymentMethod] = useState([]); | const [filteredPaymentMethod, setFilteredPaymentMethod] = useState([]); | ||||
| const [onReady, setOnReady] = useState(false); | const [onReady, setOnReady] = useState(false); | ||||
| const [paymentHoldedErrText, setPaymentHoldedErrText] = React.useState(""); | |||||
| const [paymentHoldedErr, setPaymentHoldedErr] = React.useState(false); | |||||
| useEffect(() => { | useEffect(() => { | ||||
| // console.log(props.transactionData) | // console.log(props.transactionData) | ||||
| if(Object.keys(props.transactionData).length > 0){ | if(Object.keys(props.transactionData).length > 0){ | ||||
| @@ -185,7 +190,49 @@ const MultiPaymentWindow = (props) => { | |||||
| }; | }; | ||||
| const confirmPaymentHandle = () => () =>{ | const confirmPaymentHandle = () => () =>{ | ||||
| props.setConfirmPayment(true); | |||||
| handlePaymentCheck() | |||||
| }; | |||||
| const handlePaymentCheck = () => { | |||||
| let appIdList = props.appIds | |||||
| // console.log(props.appIds) | |||||
| // console.log(appIdList) | |||||
| HttpUtils.post({ | |||||
| url: UrlUtils.PAYMENT_CHECK, | |||||
| params: { | |||||
| appIds: appIdList | |||||
| }, | |||||
| onSuccess: (responseData) => { | |||||
| const latestData = {}; | |||||
| responseData.forEach(item => { | |||||
| const { appId, timeDiff } = item; | |||||
| if (latestData[appId] === undefined || timeDiff < latestData[appId].timeDiff) { | |||||
| latestData[appId] = item; | |||||
| } | |||||
| }); | |||||
| const latestDataObjects = Object.values(latestData); | |||||
| const filteredData = latestDataObjects.filter(item => item.timeDiff > 20 && item.status !== "APPR"); | |||||
| const filteredAppIds = filteredData.map(item => item.appId); | |||||
| const appIdsNotInData = appIdList.filter(appId => !latestDataObjects.some(item => item.appId === appId)); | |||||
| const combinedAppIdsArray = [...appIdsNotInData, ...filteredAppIds]; | |||||
| const readyToPayment = appIdList.every(appId => combinedAppIdsArray.includes(appId)); | |||||
| if (readyToPayment){ | |||||
| // props.setConfirmPayment(true); | |||||
| return; | |||||
| }else{ | |||||
| const appIdsInData = appIdList.filter(appId => !combinedAppIdsArray.some(item => item === appId)); | |||||
| const HoldingApplication = latestDataObjects.filter(item => appIdsInData.includes(item.appId)); | |||||
| const resultString = HoldingApplication.map(item => item.appNo).join(' , '); | |||||
| setPaymentHoldedErrText(resultString); | |||||
| // setPaymentHoldedErrText(intl.formatMessage({ id: 'MSG.paymentHolded' }, { appNo: record.appNo })); | |||||
| setPaymentHoldedErr(true); | |||||
| } | |||||
| } | |||||
| }); | |||||
| }; | }; | ||||
| const closeHandle = () => () =>{ | const closeHandle = () => () =>{ | ||||
| @@ -391,6 +438,33 @@ const MultiPaymentWindow = (props) => { | |||||
| </Button> | </Button> | ||||
| </DialogActions> | </DialogActions> | ||||
| </Stack> | </Stack> | ||||
| <div> | |||||
| <Dialog | |||||
| open={paymentHoldedErr} | |||||
| onClose={() => setPaymentHoldedErr(false)} | |||||
| PaperProps={{ | |||||
| sx: { | |||||
| minWidth: '40vw', | |||||
| maxWidth: { xs: '90vw', s: '90vw', m: '70vw', lg: '70vw' }, | |||||
| maxHeight: { xs: '90vh', s: '70vh', m: '70vh', lg: '60vh' } | |||||
| } | |||||
| }} | |||||
| > | |||||
| <DialogTitle></DialogTitle> | |||||
| <Typography variant="h4" style={{ paddingLeft: '24px' }}><FormattedMessage id="MSG.actionFail" /></Typography> | |||||
| <DialogContent style={{ display: 'flex', }}> | |||||
| <Stack direction="column" justifyContent="space-between"> | |||||
| <div dangerouslySetInnerHTML={{ __html: intl.formatMessage({ id: 'MSG.paymentHolded' }, { appNo: paymentHoldedErrText }) }} /> | |||||
| </Stack> | |||||
| </DialogContent> | |||||
| <DialogActions> | |||||
| <Button onClick={() => setPaymentHoldedErr(false)} aria-label={intl.formatMessage({ id: 'close' })}> | |||||
| <Typography variant="h5"> | |||||
| <FormattedMessage id="close" /> | |||||
| </Typography></Button> | |||||
| </DialogActions> | |||||
| </Dialog> | |||||
| </div> | |||||
| </Dialog> | </Dialog> | ||||
| ); | ); | ||||
| }; | }; | ||||
| @@ -540,6 +540,8 @@ const Index = () => { | |||||
| onReady = {onReady} | onReady = {onReady} | ||||
| locale = {locale} | locale = {locale} | ||||
| isFullScreen={isFullScreen} | isFullScreen={isFullScreen} | ||||
| appIds={appIds} | |||||
| // appNo={itemList.appNo} | |||||
| /> | /> | ||||
| </Grid > | </Grid > | ||||
| ); | ); | ||||
| @@ -45,6 +45,8 @@ const Index = () => { | |||||
| const [record, setRecord] = React.useState({}); | const [record, setRecord] = React.useState({}); | ||||
| const [onReady, setOnReady] = React.useState(false); | const [onReady, setOnReady] = React.useState(false); | ||||
| const [isPopUp, setIsPopUp] = useState(false); | const [isPopUp, setIsPopUp] = useState(false); | ||||
| const [paymentHoldedErrText, setPaymentHoldedErrText] = React.useState(""); | |||||
| const [paymentHoldedErr, setPaymentHoldedErr] = React.useState(false); | |||||
| const intl = useIntl(); | const intl = useIntl(); | ||||
| @@ -77,9 +79,48 @@ const Index = () => { | |||||
| function doPayment() { | function doPayment() { | ||||
| setIsPopUp(false); | setIsPopUp(false); | ||||
| navigate('/paymentPage', { state: { amount: fee, appIdList: [record?.appId] } }); | |||||
| let appIdList = [record?.appId] | |||||
| handlePaymentCheck(appIdList) | |||||
| } | } | ||||
| const handlePaymentCheck = (appIdList) => { | |||||
| HttpUtils.post({ | |||||
| url: UrlUtils.PAYMENT_CHECK, | |||||
| params: { | |||||
| appIds: appIdList | |||||
| }, | |||||
| onSuccess: (responseData) => { | |||||
| const latestData = {}; | |||||
| responseData.forEach(item => { | |||||
| const { appId, timeDiff } = item; | |||||
| if (latestData[appId] === undefined || timeDiff < latestData[appId].timeDiff) { | |||||
| latestData[appId] = item; | |||||
| } | |||||
| }); | |||||
| const latestDataObjects = Object.values(latestData); | |||||
| const filteredData = latestDataObjects.filter(item => item.timeDiff > 20 && item.status !== "APPR"); | |||||
| const filteredAppIds = filteredData.map(item => item.appId); | |||||
| const appIdsNotInData = appIdList.filter(appId => !latestDataObjects.some(item => item.appId === appId)); | |||||
| const combinedAppIdsArray = [...appIdsNotInData, ...filteredAppIds]; | |||||
| const readyToPayment = appIdList.every(appId => combinedAppIdsArray.includes(appId)); | |||||
| if (readyToPayment){ | |||||
| navigate('/paymentPage', { state: { amount: fee, appIdList: appIdList } }); | |||||
| }else{ | |||||
| const appIdsInData = appIdList.filter(appId => !combinedAppIdsArray.some(item => item === appId)); | |||||
| const HoldingApplication = latestDataObjects.filter(item => appIdsInData.includes(item.appId)); | |||||
| const resultString = HoldingApplication.map(item => item.appNo).join(' , '); | |||||
| setPaymentHoldedErrText(resultString); | |||||
| // setPaymentHoldedErrText(intl.formatMessage({ id: 'MSG.paymentHolded' }, { appNo: record.appNo })); | |||||
| setPaymentHoldedErr(true); | |||||
| } | |||||
| } | |||||
| }); | |||||
| }; | |||||
| return ( | return ( | ||||
| !onReady ? | !onReady ? | ||||
| <Grid container sx={{ minHeight: '87vh', mb: 3 }} direction="column" justifyContent="center" alignItems="center"> | <Grid container sx={{ minHeight: '87vh', mb: 3 }} direction="column" justifyContent="center" alignItems="center"> | ||||
| @@ -200,6 +241,33 @@ const Index = () => { | |||||
| </Dialog> | </Dialog> | ||||
| </div> | </div> | ||||
| {/*row 2*/} | {/*row 2*/} | ||||
| <div> | |||||
| <Dialog | |||||
| open={paymentHoldedErr} | |||||
| onClose={() => setPaymentHoldedErr(false)} | |||||
| PaperProps={{ | |||||
| sx: { | |||||
| minWidth: '40vw', | |||||
| maxWidth: { xs: '90vw', s: '90vw', m: '70vw', lg: '70vw' }, | |||||
| maxHeight: { xs: '90vh', s: '70vh', m: '70vh', lg: '60vh' } | |||||
| } | |||||
| }} | |||||
| > | |||||
| <DialogTitle></DialogTitle> | |||||
| <Typography variant="h4" style={{ paddingLeft: '24px' }}><FormattedMessage id="MSG.actionFail" /></Typography> | |||||
| <DialogContent style={{ display: 'flex', }}> | |||||
| <Stack direction="column" justifyContent="space-between"> | |||||
| <div dangerouslySetInnerHTML={{ __html: intl.formatMessage({ id: 'MSG.paymentHolded' }, { appNo: paymentHoldedErrText }) }} /> | |||||
| </Stack> | |||||
| </DialogContent> | |||||
| <DialogActions> | |||||
| <Button onClick={() => setPaymentHoldedErr(false)} aria-label={intl.formatMessage({ id: 'close' })}> | |||||
| <Typography variant="h5"> | |||||
| <FormattedMessage id="close" /> | |||||
| </Typography></Button> | |||||
| </DialogActions> | |||||
| </Dialog> | |||||
| </div> | |||||
| </Grid > | </Grid > | ||||
| @@ -52,6 +52,8 @@ const ApplicationDetailCard = ( | |||||
| const [isPopUp, setIsPopUp] = useState(false); | const [isPopUp, setIsPopUp] = useState(false); | ||||
| const [errorText, setErrorText] = useState(""); | const [errorText, setErrorText] = useState(""); | ||||
| const [errorPopUp, setErrorPopUp] = useState(false); | const [errorPopUp, setErrorPopUp] = useState(false); | ||||
| const [paymentHoldedErrText, setPaymentHoldedErrText] = React.useState(""); | |||||
| const [paymentHoldedErr, setPaymentHoldedErr] = React.useState(false); | |||||
| // const params = useParams(); | // const params = useParams(); | ||||
| const [currentApplicationDetailData, setCurrentApplicationDetailData] = useState({}); | const [currentApplicationDetailData, setCurrentApplicationDetailData] = useState({}); | ||||
| const [fee, setFee] = useState(0); | const [fee, setFee] = useState(0); | ||||
| @@ -113,7 +115,8 @@ const ApplicationDetailCard = ( | |||||
| }, | }, | ||||
| onSuccess: (responData) => { | onSuccess: (responData) => { | ||||
| if (responData.success == true) { | if (responData.success == true) { | ||||
| setIsPopUp(true); | |||||
| let appIdList = [currentApplicationDetailData.id] | |||||
| handlePaymentCheck(appIdList) | |||||
| return; | return; | ||||
| } | } | ||||
| setErrorText("公共啟事申請已過期"); | setErrorText("公共啟事申請已過期"); | ||||
| @@ -125,9 +128,49 @@ const ApplicationDetailCard = ( | |||||
| function doPayment() { | function doPayment() { | ||||
| setIsPopUp(false); | setIsPopUp(false); | ||||
| navigate('/paymentPage', { state: { amount: fee, appIdList: [currentApplicationDetailData.id] } }); | |||||
| let appIdList = [currentApplicationDetailData.id] | |||||
| navigate('/paymentPage', { state: { amount: fee, appIdList: appIdList } }); | |||||
| } | } | ||||
| const handlePaymentCheck = (appIdList) => { | |||||
| HttpUtils.post({ | |||||
| url: UrlUtils.PAYMENT_CHECK, | |||||
| params: { | |||||
| appIds: appIdList | |||||
| }, | |||||
| onSuccess: (responseData) => { | |||||
| const latestData = {}; | |||||
| responseData.forEach(item => { | |||||
| const { appId, timeDiff } = item; | |||||
| if (latestData[appId] === undefined || timeDiff < latestData[appId].timeDiff) { | |||||
| latestData[appId] = item; | |||||
| } | |||||
| }); | |||||
| const latestDataObjects = Object.values(latestData); | |||||
| const filteredData = latestDataObjects.filter(item => item.timeDiff > 20 && item.status !== "APPR"); | |||||
| const filteredAppIds = filteredData.map(item => item.appId); | |||||
| const appIdsNotInData = appIdList.filter(appId => !latestDataObjects.some(item => item.appId === appId)); | |||||
| const combinedAppIdsArray = [...appIdsNotInData, ...filteredAppIds]; | |||||
| const readyToPayment = appIdList.every(appId => combinedAppIdsArray.includes(appId)); | |||||
| if (readyToPayment){ | |||||
| setIsPopUp(true); | |||||
| return; | |||||
| }else{ | |||||
| const appIdsInData = appIdList.filter(appId => !combinedAppIdsArray.some(item => item === appId)); | |||||
| const HoldingApplication = latestDataObjects.filter(item => appIdsInData.includes(item.appId)); | |||||
| const resultString = HoldingApplication.map(item => item.appNo).join(' , '); | |||||
| setPaymentHoldedErrText(resultString); | |||||
| // setPaymentHoldedErrText(intl.formatMessage({ id: 'MSG.paymentHolded' }, { appNo: record.appNo })); | |||||
| setPaymentHoldedErr(true); | |||||
| } | |||||
| } | |||||
| }); | |||||
| }; | |||||
| return ( | return ( | ||||
| !onReady ? | !onReady ? | ||||
| <LoadingComponent /> | <LoadingComponent /> | ||||
| @@ -669,6 +712,33 @@ const ApplicationDetailCard = ( | |||||
| </DialogActions> | </DialogActions> | ||||
| </Dialog> | </Dialog> | ||||
| </div> | </div> | ||||
| <div> | |||||
| <Dialog | |||||
| open={paymentHoldedErr} | |||||
| onClose={() => setPaymentHoldedErr(false)} | |||||
| PaperProps={{ | |||||
| sx: { | |||||
| minWidth: '40vw', | |||||
| maxWidth: { xs: '90vw', s: '90vw', m: '70vw', lg: '70vw' }, | |||||
| maxHeight: { xs: '90vh', s: '70vh', m: '70vh', lg: '60vh' } | |||||
| } | |||||
| }} | |||||
| > | |||||
| <DialogTitle></DialogTitle> | |||||
| <Typography variant="h4" style={{ paddingLeft: '24px' }}><FormattedMessage id="MSG.actionFail" /></Typography> | |||||
| <DialogContent style={{ display: 'flex', }}> | |||||
| <Stack direction="column" justifyContent="space-between"> | |||||
| <div dangerouslySetInnerHTML={{ __html: intl.formatMessage({ id: 'MSG.paymentHolded' }, { appNo: paymentHoldedErrText }) }} /> | |||||
| </Stack> | |||||
| </DialogContent> | |||||
| <DialogActions> | |||||
| <Button onClick={() => setPaymentHoldedErr(false)} aria-label={intl.formatMessage({ id: 'close' })}> | |||||
| <Typography variant="h5"> | |||||
| <FormattedMessage id="close" /> | |||||
| </Typography></Button> | |||||
| </DialogActions> | |||||
| </Dialog> | |||||
| </div> | |||||
| </form> | </form> | ||||
| </MainCard > | </MainCard > | ||||
| ); | ); | ||||
| @@ -34,8 +34,10 @@ export default function SubmittedTab({ rows }) { | |||||
| const [selectedCareOf, setSelectedCareOf] = React.useState(null); | const [selectedCareOf, setSelectedCareOf] = React.useState(null); | ||||
| const [expiryDateErrText, setExpiryDateErrText] = React.useState(""); | const [expiryDateErrText, setExpiryDateErrText] = React.useState(""); | ||||
| const [expiryDateErr, setExpiryDateErr] = React.useState(false); | const [expiryDateErr, setExpiryDateErr] = React.useState(false); | ||||
| const [paymentHoldedErrText, setPaymentHoldedErrText] = React.useState(""); | const [paymentHoldedErrText, setPaymentHoldedErrText] = React.useState(""); | ||||
| const [paymentHoldedErr, setPaymentHoldedErr] = React.useState(false); | const [paymentHoldedErr, setPaymentHoldedErr] = React.useState(false); | ||||
| 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(); | ||||