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