|
|
@@ -10,13 +10,15 @@ import { |
|
|
Dialog, DialogTitle, DialogContent, DialogActions, |
|
|
Dialog, DialogTitle, DialogContent, DialogActions, |
|
|
} from '@mui/material'; |
|
|
} from '@mui/material'; |
|
|
import { FiDataGrid } from "components/FiDataGrid"; |
|
|
import { FiDataGrid } from "components/FiDataGrid"; |
|
|
|
|
|
import * as HttpUtils from "utils/HttpUtils" |
|
|
|
|
|
import * as UrlUtils from "utils/ApiPathConst" |
|
|
import * as DateUtils from "utils/DateUtils" |
|
|
import * as DateUtils from "utils/DateUtils" |
|
|
import * as FormatUtils from "utils/FormatUtils" |
|
|
import * as FormatUtils from "utils/FormatUtils" |
|
|
import * as StatusUtils from "utils/statusUtils/PublicNoteStatusUtils"; |
|
|
import * as StatusUtils from "utils/statusUtils/PublicNoteStatusUtils"; |
|
|
import { useNavigate } from "react-router-dom"; |
|
|
import { useNavigate } from "react-router-dom"; |
|
|
import { |
|
|
import { |
|
|
isORGLoggedIn, |
|
|
isORGLoggedIn, |
|
|
} from "utils/Utils"; |
|
|
|
|
|
|
|
|
} from "utils/Utils"; |
|
|
// ==============================|| EVENT TABLE ||============================== // |
|
|
// ==============================|| EVENT TABLE ||============================== // |
|
|
|
|
|
|
|
|
export default function SubmittedTab({ rows }) { |
|
|
export default function SubmittedTab({ rows }) { |
|
|
@@ -27,6 +29,8 @@ export default function SubmittedTab({ rows }) { |
|
|
const [getCareOfList, setCareOfList] = React.useState([]); |
|
|
const [getCareOfList, setCareOfList] = React.useState([]); |
|
|
const [careOfComboList, setCareOfComboList] = React.useState([{}]); |
|
|
const [careOfComboList, setCareOfComboList] = React.useState([{}]); |
|
|
const [selectedCareOf, setSelectedCareOf] = React.useState(null); |
|
|
const [selectedCareOf, setSelectedCareOf] = React.useState(null); |
|
|
|
|
|
const [expiryDateErrText, setExpiryDateErrText] = React.useState(""); |
|
|
|
|
|
const [expiryDateErr, setExpiryDateErr] = React.useState(false); |
|
|
|
|
|
|
|
|
//const [amount, setAmount] = React.useState(0); |
|
|
//const [amount, setAmount] = React.useState(0); |
|
|
const navigate = useNavigate() |
|
|
const navigate = useNavigate() |
|
|
@@ -40,7 +44,7 @@ export default function SubmittedTab({ rows }) { |
|
|
key: index, |
|
|
key: index, |
|
|
id: obj.id, |
|
|
id: obj.id, |
|
|
label: obj.careOf, |
|
|
label: obj.careOf, |
|
|
})); |
|
|
|
|
|
|
|
|
})); |
|
|
// console.log(formattedData) |
|
|
// console.log(formattedData) |
|
|
setCareOfList(formattedData) |
|
|
setCareOfList(formattedData) |
|
|
}, []); |
|
|
}, []); |
|
|
@@ -51,11 +55,11 @@ export default function SubmittedTab({ rows }) { |
|
|
}, [getCareOfList]); |
|
|
}, [getCareOfList]); |
|
|
|
|
|
|
|
|
React.useEffect(() => { |
|
|
React.useEffect(() => { |
|
|
if(selectedCareOf != null){ |
|
|
|
|
|
|
|
|
if (selectedCareOf != null) { |
|
|
const afteSelectedList = []; |
|
|
const afteSelectedList = []; |
|
|
afteSelectedList.push(rows.find(obj => obj.id === selectedCareOf.id)); |
|
|
afteSelectedList.push(rows.find(obj => obj.id === selectedCareOf.id)); |
|
|
setRowList(afteSelectedList) |
|
|
setRowList(afteSelectedList) |
|
|
}else{ |
|
|
|
|
|
|
|
|
} else { |
|
|
setRowList(rows) |
|
|
setRowList(rows) |
|
|
} |
|
|
} |
|
|
}, [selectedCareOf]); |
|
|
}, [selectedCareOf]); |
|
|
@@ -64,6 +68,37 @@ export default function SubmittedTab({ rows }) { |
|
|
navigate('/publicNotice/' + params.id); |
|
|
navigate('/publicNotice/' + params.id); |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
const handlePaymentBtn = () => { |
|
|
|
|
|
let appIdList = []; |
|
|
|
|
|
const datas = rows?.filter((row) => |
|
|
|
|
|
selectedRowItems.includes(row.id) |
|
|
|
|
|
); |
|
|
|
|
|
// console.log(datas) |
|
|
|
|
|
for (var i = 0; i < datas?.length; i++) { |
|
|
|
|
|
appIdList.push(datas[i].id); |
|
|
|
|
|
} |
|
|
|
|
|
HttpUtils.post({ |
|
|
|
|
|
url: UrlUtils.POST_CHECK_APP_EXPRITY_DATE, |
|
|
|
|
|
params: { |
|
|
|
|
|
ids: appIdList |
|
|
|
|
|
}, |
|
|
|
|
|
onSuccess: (responData) => { |
|
|
|
|
|
if (responData.success == true) { |
|
|
|
|
|
setIsPopUp(true); |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
let str = ""; |
|
|
|
|
|
responData.msg.forEach((item) => { |
|
|
|
|
|
str += "App: " + item.appNo + ", 到期日: " + DateUtils.datetimeStr_Cht(item.expiryDate) + "\n"; |
|
|
|
|
|
}); |
|
|
|
|
|
setExpiryDateErrText(str.split('\n').map(str => <>{str}<br/></>)); |
|
|
|
|
|
setExpiryDateErr(true); |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
const columns = [ |
|
|
const columns = [ |
|
|
{ |
|
|
{ |
|
|
id: 'appNo', |
|
|
id: 'appNo', |
|
|
@@ -109,18 +144,18 @@ export default function SubmittedTab({ rows }) { |
|
|
{ |
|
|
{ |
|
|
id: 'remarks', |
|
|
id: 'remarks', |
|
|
field: 'remarks', |
|
|
field: 'remarks', |
|
|
headerName: isORGLoggedIn()?"Care Of / 我的備註":"我的備註", |
|
|
|
|
|
|
|
|
headerName: isORGLoggedIn() ? "Care Of / 我的備註" : "我的備註", |
|
|
flex: 3, |
|
|
flex: 3, |
|
|
renderCell: (params) => ( |
|
|
renderCell: (params) => ( |
|
|
isORGLoggedIn()? |
|
|
|
|
|
<div> |
|
|
|
|
|
<Typography>Care Of: {params.row.careOf}</Typography> |
|
|
|
|
|
<Typography>我的備註: {params.row.remarks}</Typography> |
|
|
|
|
|
</div>: |
|
|
|
|
|
<div> |
|
|
|
|
|
<Typography>{params.row.remarks}</Typography> |
|
|
|
|
|
</div> |
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
isORGLoggedIn() ? |
|
|
|
|
|
<div> |
|
|
|
|
|
<Typography>Care Of: {params.row.careOf}</Typography> |
|
|
|
|
|
<Typography>我的備註: {params.row.remarks}</Typography> |
|
|
|
|
|
</div> : |
|
|
|
|
|
<div> |
|
|
|
|
|
<Typography>{params.row.remarks}</Typography> |
|
|
|
|
|
</div> |
|
|
|
|
|
) |
|
|
}, |
|
|
}, |
|
|
{ |
|
|
{ |
|
|
id: 'fee', |
|
|
id: 'fee', |
|
|
@@ -192,11 +227,11 @@ export default function SubmittedTab({ rows }) { |
|
|
} |
|
|
} |
|
|
const firstCareOf = datas[0].careOf; |
|
|
const firstCareOf = datas[0].careOf; |
|
|
const areAllCareOfEqual = datas.every(obj => obj.careOf === firstCareOf); |
|
|
const areAllCareOfEqual = datas.every(obj => obj.careOf === firstCareOf); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (appIdList.length>0&&areAllCareOfEqual){ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (appIdList.length > 0 && areAllCareOfEqual) { |
|
|
navigate('/paymentPage', { state: { amount: totalAmount, appIdList: appIdList } }); |
|
|
navigate('/paymentPage', { state: { amount: totalAmount, appIdList: appIdList } }); |
|
|
}else{ |
|
|
|
|
|
|
|
|
} else { |
|
|
setCheckCareOf(true); |
|
|
setCheckCareOf(true); |
|
|
// console.log("The selected applications should be from the same Care of.") |
|
|
// console.log("The selected applications should be from the same Care of.") |
|
|
} |
|
|
} |
|
|
@@ -219,7 +254,7 @@ export default function SubmittedTab({ rows }) { |
|
|
return ( |
|
|
return ( |
|
|
<> |
|
|
<> |
|
|
<div style={{ minHeight: 400, width: '100%', padding: 4 }}> |
|
|
<div style={{ minHeight: 400, width: '100%', padding: 4 }}> |
|
|
{isORGLoggedIn()? |
|
|
|
|
|
|
|
|
{isORGLoggedIn() ? |
|
|
<Grid container direction="row" justifyContent="flex-start" alignItems="center" > |
|
|
<Grid container direction="row" justifyContent="flex-start" alignItems="center" > |
|
|
<Grid item xs={3} md={1}> |
|
|
<Grid item xs={3} md={1}> |
|
|
<Typography variant="h5">Care Of:</Typography> |
|
|
<Typography variant="h5">Care Of:</Typography> |
|
|
@@ -237,7 +272,7 @@ export default function SubmittedTab({ rows }) { |
|
|
renderInput={(params) => <TextField {...params} />} |
|
|
renderInput={(params) => <TextField {...params} />} |
|
|
/> |
|
|
/> |
|
|
</Grid> |
|
|
</Grid> |
|
|
</Grid>:null |
|
|
|
|
|
|
|
|
</Grid> : null |
|
|
} |
|
|
} |
|
|
<FiDataGrid |
|
|
<FiDataGrid |
|
|
checkboxSelection |
|
|
checkboxSelection |
|
|
@@ -255,8 +290,8 @@ export default function SubmittedTab({ rows }) { |
|
|
onRowDoubleClick={handleRowDoubleClick} |
|
|
onRowDoubleClick={handleRowDoubleClick} |
|
|
getRowHeight={() => 'auto'} |
|
|
getRowHeight={() => 'auto'} |
|
|
/> |
|
|
/> |
|
|
<br/> |
|
|
|
|
|
<Button variant="contained" onClick={() => { setIsPopUp(true) }}><Typography variant="h5">付款</Typography></Button> |
|
|
|
|
|
|
|
|
<br /> |
|
|
|
|
|
<Button variant="contained" onClick={() => { handlePaymentBtn() }}><Typography variant="h5">付款</Typography></Button> |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
|
|
|
<div> |
|
|
<div> |
|
|
@@ -282,16 +317,33 @@ export default function SubmittedTab({ rows }) { |
|
|
<DialogContent style={{ display: 'flex', }}> |
|
|
<DialogContent style={{ display: 'flex', }}> |
|
|
<Stack direction="column" justifyContent="space-between"> |
|
|
<Stack direction="column" justifyContent="space-between"> |
|
|
<Typography variant="h5" color="error"> |
|
|
<Typography variant="h5" color="error"> |
|
|
You have been selected different Care of applications. Are you want to pay? |
|
|
|
|
|
|
|
|
You have been selected different Care of applications. Are you want to pay? |
|
|
</Typography> |
|
|
</Typography> |
|
|
</Stack> |
|
|
</Stack> |
|
|
</DialogContent> |
|
|
</DialogContent> |
|
|
<DialogActions> |
|
|
<DialogActions> |
|
|
<Button onClick={() => setCheckCareOf(false)}><Typography variant="h5">Close</Typography></Button> |
|
|
|
|
|
|
|
|
<Button onClick={() => setCheckCareOf(false)}><Typography variant="h5">關閉</Typography></Button> |
|
|
<Button onClick={() => afterWarningPayment()}><Typography variant="h5">確認</Typography></Button> |
|
|
<Button onClick={() => afterWarningPayment()}><Typography variant="h5">確認</Typography></Button> |
|
|
</DialogActions> |
|
|
</DialogActions> |
|
|
</Dialog> |
|
|
</Dialog> |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
<div> |
|
|
|
|
|
<Dialog open={expiryDateErr} onClose={() => setExpiryDateErr(false)} > |
|
|
|
|
|
<DialogTitle></DialogTitle> |
|
|
|
|
|
<Typography variant="h2" style={{ padding: '16px' }}>行動失敗</Typography> |
|
|
|
|
|
<DialogContent style={{ display: 'flex', }}> |
|
|
|
|
|
<Stack direction="column" justifyContent="space-between"> |
|
|
|
|
|
{ |
|
|
|
|
|
expiryDateErrText |
|
|
|
|
|
} |
|
|
|
|
|
</Stack> |
|
|
|
|
|
</DialogContent> |
|
|
|
|
|
<DialogActions> |
|
|
|
|
|
<Button onClick={() => setExpiryDateErr(false)}><Typography variant="h5">關閉</Typography></Button> |
|
|
|
|
|
</DialogActions> |
|
|
|
|
|
</Dialog> |
|
|
|
|
|
</div> |
|
|
</> |
|
|
</> |
|
|
); |
|
|
); |
|
|
|
|
|
|
|
|
|