| @@ -67,6 +67,18 @@ export default function SearchDemandNote({ recordList, reloadFun }) { | |||
| } | |||
| const doUploadFile = (event) => { | |||
| let file = event.target.files[0]; | |||
| HttpUtils.postWithFiles({ | |||
| url:UrlUtils.DEMAND_NOTE_ATTACH, | |||
| files:[file], | |||
| onSuccess() { | |||
| if (reloadFun) reloadFun(); | |||
| }, | |||
| }); | |||
| document.getElementById("uploadFileBtn").value = ""; | |||
| } | |||
| const markPaid = () => { | |||
| setConfirmPopUp(false); | |||
| let idList = []; | |||
| @@ -171,11 +183,32 @@ export default function SearchDemandNote({ recordList, reloadFun }) { | |||
| return ( | |||
| <div style={{ height: '100%', width: '100%' }}> | |||
| <Grid container maxWidth justifyContent="flex-start"> | |||
| <Grid item sx={{ ml: 3, mr: 3, mb: 3, mt: 3 }}> | |||
| <input | |||
| id="uploadFileBtn" | |||
| name="file" | |||
| type="file" | |||
| accept=".pdf" | |||
| style={{ display: 'none' }} | |||
| onChange={(event) => { | |||
| doUploadFile(event) | |||
| }} | |||
| /> | |||
| <label htmlFor="uploadFileBtn"> | |||
| <Button | |||
| component="span" | |||
| variant="contained" | |||
| size="large" | |||
| > | |||
| <Typography variant="h5">Attach DN</Typography> | |||
| </Button> | |||
| </label> | |||
| </Grid> | |||
| <Grid item sx={{ ml: 3, mr: 3, mb: 3, mt: 3 }}> | |||
| <Button | |||
| size="large" | |||
| variant="contained" | |||
| onClick={()=>setSendPopUp(true)} | |||
| onClick={() => setSendPopUp(true)} | |||
| sx={{ | |||
| textTransform: 'capitalize', | |||
| alignItems: 'end' | |||
| @@ -201,7 +234,7 @@ export default function SearchDemandNote({ recordList, reloadFun }) { | |||
| <Button | |||
| size="large" | |||
| variant="contained" | |||
| onClick={()=>setConfirmPopUp(true)} | |||
| onClick={() => setConfirmPopUp(true)} | |||
| sx={{ | |||
| textTransform: 'capitalize', | |||
| alignItems: 'end' | |||
| @@ -53,7 +53,10 @@ const Index = () => { | |||
| } | |||
| const doPrint = () => { | |||
| window.print(); | |||
| // window.print(); | |||
| HttpUtils.fileDownload({ | |||
| url: UrlUtils.GEN_PAYMENT_RECEIPT+"/"+params.id, | |||
| }); | |||
| }; | |||
| const loadForm = () => { | |||
| @@ -54,7 +54,10 @@ const Index = () => { | |||
| } | |||
| const doPrint = () => { | |||
| window.print(); | |||
| // window.print(); | |||
| HttpUtils.fileDownload({ | |||
| url: UrlUtils.GEN_PAYMENT_RECEIPT+"/"+params.id, | |||
| }); | |||
| }; | |||
| @@ -104,6 +104,7 @@ export const DEMAND_NOTE_LIST = apiPath+'/demandNote/list';//GET | |||
| export const DEMAND_NOTE_LOAD = apiPath+'/demandNote/load';//GET | |||
| export const DEMAND_NOTE_SEND = apiPath+'/demandNote/send-dn';//POST | |||
| export const DEMAND_NOTE_MARK_PAID = apiPath+'/demandNote/mark-as-paid';//POST | |||
| export const DEMAND_NOTE_ATTACH = apiPath+'/demandNote/attach';//POST | |||
| @@ -125,6 +126,7 @@ export const GET_SMART_LOGIN = apiPath+'/smart/login'; //POST | |||
| //gen report | |||
| export const GEN_GAZETTE_PROOF = apiPath+'/proof/gazetteProof'; //POST | |||
| export const GEN_PAYMENT_RECEIPT = apiPath+'/payment/receipt'; //POST | |||
| //gen report | |||
| export const GEN_GFMIS_XML = apiPath+'/gfmis'; //GET | |||
| @@ -86,54 +86,9 @@ export const fileDownload = ({url, fileId, skey, filename, onResponse, onError}) | |||
| }); | |||
| }; | |||
| // export const reportDownload = ({url, onError}) =>{ | |||
| // axios.get( url, | |||
| // { | |||
| // responseType: 'blob', | |||
| // } | |||
| // ).then( | |||
| // (response)=>{ | |||
| // const filename = response.headers | |||
| // .get("content-disposition") | |||
| // .split("filename=")[1] | |||
| // .split('"')[1].trim(); | |||
| // 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(); | |||
| // for (let i = 0; i < files.length; i++){ | |||
| // const file = files[i] | |||
| // formData.append("multipartFileList", file); | |||
| // } | |||
| // // formData.append("multipartFile", file); | |||
| // formData.append("refType", refType); | |||
| // formData.append("refId", refId); | |||
| // if(refCode){ | |||
| // formData.append("refCode", refCode); | |||
| // } | |||
| // console.log(formData) | |||
| // axios.post(FILE_UP_POST,formData,{ | |||
| // headers: { | |||
| // "Content-Type":"multipart/form-data" | |||
| // } | |||
| // }).then( | |||
| // (response)=>{ | |||
| // onResponse(response,onSuccess,onFail); | |||
| // } | |||
| // ).catch(error => { return handleError(error, onError); }); | |||
| export const fileUpload = ({refType, refId, files, refCode, onSuccess, onFail, onError}) =>{ | |||
| postWithFiles({ | |||
| url: FILE_UP_POST, | |||
| params:{ | |||