@@ -24,7 +24,8 @@ import FileList from "components/FileList" | |||
// ==============================|| DASHBOARD - DEFAULT ||============================== // | |||
const ApplicationDetailCard = ({ | |||
formData, | |||
showCancelBtn | |||
showCancelBtn, | |||
showProofBtn | |||
// setBackButtonPos | |||
}) => { | |||
@@ -82,6 +83,14 @@ const ApplicationDetailCard = ({ | |||
setCancelPopUp(true); | |||
} | |||
const genProof = () =>{ | |||
// window.open(UrlUtils.GEN_GAZETTE_PROOF); | |||
HttpUtils.reportDownload({ | |||
url: UrlUtils.GEN_GAZETTE_PROOF+"/"+params.id, | |||
filename: "proof.pdf" | |||
}); | |||
} | |||
// React.useEffect(()=>{ | |||
// if (document.getElementById("applicationDetailsMainCard")) setBackButtonPos(`${document.getElementById("applicationDetailsMainCard")?.getBoundingClientRect().left / 3}px`) | |||
// },[document.getElementById("applicationDetailsMainCard")]) | |||
@@ -99,6 +108,15 @@ const ApplicationDetailCard = ({ | |||
alignItems="center" | |||
> | |||
Public Notice: Proofreading Reply | |||
<Button | |||
component="span" | |||
variant="contained" | |||
size="large" | |||
disabled={!showProofBtn} | |||
onClick={genProof} | |||
> | |||
<Typography variant="h5">Proof Slip</Typography> | |||
</Button> | |||
<Button | |||
component="span" | |||
variant="contained" | |||
@@ -40,6 +40,7 @@ const Index = () => { | |||
const [onReady, setOnReady] = React.useState(false); | |||
const [isOverTime, setIsOverTime] = React.useState(false); | |||
const [showCancelBtn, setShowCancelBtn] = React.useState(false); | |||
const [showProofBtn, setShowProofBtn] = React.useState(false); | |||
React.useLayoutEffect(() => { | |||
loadForm(); | |||
@@ -59,6 +60,7 @@ const Index = () => { | |||
if (!responseData.data?.id) { | |||
navigate("/proof/search"); | |||
} | |||
setShowProofBtn(responseData.data.action != null && responseData.data.action===true); | |||
responseData.data["phoneNumber"] = JSON.parse(responseData.data.contactTelNo).phoneNumber; | |||
responseData.data["tel_countryCode"] = JSON.parse(responseData.data.contactTelNo).countryCode; | |||
@@ -79,6 +81,8 @@ const Index = () => { | |||
setIsOverTime(current.getTime() > returnBeforeDate.getTime()); | |||
setShowCancelBtn(responseData.data.cancelled || responseData.data.replyDate || current.getTime() > returnBeforeDate.getTime()) | |||
setRecord(responseData.data); | |||
} | |||
}); | |||
@@ -134,6 +138,7 @@ const Index = () => { | |||
// setBackButtonPos={setBackButtonPos} | |||
formData={record} | |||
showCancelBtn={showCancelBtn} | |||
showProofBtn={showProofBtn} | |||
style={{ | |||
display: "flex", | |||
height: "100%", | |||
@@ -3,11 +3,17 @@ import * as React from 'react'; | |||
import { | |||
Button, | |||
} from '@mui/material'; | |||
import { | |||
GridActionsCellItem, | |||
} from "@mui/x-data-grid"; | |||
import * as Icon from 'utils/IconUtils'; | |||
import { useNavigate } from "react-router-dom"; | |||
import * as DateUtils from "utils/DateUtils"; | |||
import * as ProofStatus from "utils/statusUtils/ProofStatus"; | |||
import {FiDataGrid} from "components/FiDataGrid"; | |||
import * as FormatUtils from "utils/FormatUtils" | |||
import * as HttpUtils from "utils/HttpUtils" | |||
import * as UrlUtils from "utils/ApiPathConst" | |||
// ==============================|| EVENT TABLE ||============================== // | |||
export default function ProofTab({rows}) { | |||
@@ -18,10 +24,17 @@ export default function ProofTab({rows}) { | |||
navigate('/proof/reply/' + params.row.id); | |||
}; | |||
const onDownloadClick = (params) => () => { | |||
HttpUtils.reportDownload({ | |||
url: UrlUtils.GEN_GAZETTE_PROOF+"/"+params.row.id, | |||
filename: "proofSlip.pdf" | |||
}); | |||
}; | |||
const columns = [ | |||
{ | |||
field: 'actions', | |||
field: 'refNo', | |||
headerName: 'Proof No.', | |||
width: 200, | |||
cellClassName: 'actions', | |||
@@ -30,7 +43,7 @@ export default function ProofTab({rows}) { | |||
}, | |||
}, | |||
{ | |||
id: 'actions', | |||
field: 'status', | |||
headerName: 'Status', | |||
flex: 1, | |||
renderCell: (params) => { | |||
@@ -38,7 +51,6 @@ export default function ProofTab({rows}) { | |||
}, | |||
}, | |||
{ | |||
id: 'created', | |||
field: 'created', | |||
headerName: 'Proof Date', | |||
flex: 1, | |||
@@ -47,7 +59,6 @@ export default function ProofTab({rows}) { | |||
} | |||
}, | |||
{ | |||
id: 'replyDate', | |||
field: 'replyDate', | |||
headerName: 'Confirmed/Return Date', | |||
flex: 1, | |||
@@ -56,7 +67,6 @@ export default function ProofTab({rows}) { | |||
} | |||
}, | |||
{ | |||
id: 'fee', | |||
field: 'fee', | |||
headerName: 'Fee', | |||
flex: 1, | |||
@@ -64,6 +74,25 @@ export default function ProofTab({rows}) { | |||
return (params?.value)?"$ "+FormatUtils.currencyFormat(params?.value):""; | |||
} | |||
}, | |||
{ | |||
type: 'actions', | |||
headerName: 'Proof Slip', | |||
width: 100, | |||
cellClassName: 'actions', | |||
getActions: (params) => { | |||
if(params.row.action == null) return[]; | |||
if(params.row.action != true) return[]; | |||
return [ | |||
<GridActionsCellItem | |||
key="OutSave" | |||
icon={<Icon.Download />} | |||
label="Download" | |||
className="textPrimary" | |||
onClick={onDownloadClick(params)} | |||
color="primary" | |||
/>] | |||
}, | |||
}, | |||
]; | |||
return ( | |||
@@ -108,4 +108,8 @@ export const DELETE_EMAIL = apiPath+'/email/delete'; | |||
//iAmSmart | |||
export const GET_SMART_PROFILE = apiPath+'/smart/getProfile'; //POST | |||
export const GET_SMART_LOGIN = apiPath+'/smart/login'; //POST | |||
export const GET_SMART_LOGIN = apiPath+'/smart/login'; //POST | |||
//gen report | |||
export const GEN_GAZETTE_PROOF = apiPath+'/proof/gazetteProof'; //POST |
@@ -79,6 +79,27 @@ export const fileDownload = ({fileId, skey, filename, onError}) =>{ | |||
}); | |||
}; | |||
export const reportDownload = ({url, filename, onError}) =>{ | |||
axios.get( url, | |||
{ | |||
responseType: 'blob', | |||
} | |||
).then( | |||
(response)=>{ | |||
const url = URL.createObjectURL(response.data); | |||
const a = document.createElement('a'); | |||
a.href = url; | |||
a.setAttribute("download", filename); | |||
document.body.appendChild(a); | |||
a.click(); | |||
document.body.removeChild(a); | |||
URL.revokeObjectURL(url); | |||
} | |||
).catch(error => { | |||
return handleError(error,onError); | |||
}); | |||
}; | |||
export const fileUpload = ({ refType, refId, files, refCode, onSuccess, onFail, onError}) =>{ | |||
// console.log(files); | |||
// var formData = new FormData(); | |||