diff --git a/src/pages/DemandNote/Create/DataGrid.js b/src/pages/DemandNote/Create/DataGrid.js index 0a4bc9f..7e7487f 100644 --- a/src/pages/DemandNote/Create/DataGrid.js +++ b/src/pages/DemandNote/Create/DataGrid.js @@ -67,7 +67,8 @@ export default function SearchPublicNoticeTable({ recordList }) { headerName: 'Contact Person', flex: 1, renderCell: (params) => { - let company = params.row.enCompanyName != null ? " (" + (params.row.enCompanyName) + ")" : ""; + let company = params.row.enCompanyName != null?params.row.enCompanyName: params.row.chCompanyName; + company = company != null ? " (" + (company) + ")" : ""; let phone = JSON.parse(params.row.contactTelNo); let faxNo = JSON.parse(params.row.contactFaxNo); diff --git a/src/pages/DemandNote/Search/DataGrid.js b/src/pages/DemandNote/Search/DataGrid.js index 1df365d..965a33f 100644 --- a/src/pages/DemandNote/Search/DataGrid.js +++ b/src/pages/DemandNote/Search/DataGrid.js @@ -7,8 +7,11 @@ import { Box, Dialog, DialogTitle, DialogContent, DialogActions, } from '@mui/material'; +import DownloadIcon from '@mui/icons-material/Download'; import * as DateUtils from "utils/DateUtils"; +import * as FormatUtils from "utils/FormatUtils"; import * as StatusUtils from "utils/statusUtils/DnStatus"; +import * as PublicNoteStatusUtils from "utils/statusUtils/PublicNoteStatusUtils"; import { useNavigate } from "react-router-dom"; import { FiDataGrid } from "components/FiDataGrid"; import { notifyDownloadSuccess } from 'utils/CommonFunction'; @@ -17,7 +20,7 @@ import * as UrlUtils from "utils/ApiPathConst"; import * as HttpUtils from "utils/HttpUtils"; // ==============================|| EVENT TABLE ||============================== // -export default function SearchDemandNote({ recordList, reloadFun }) { +export default function SearchDemandNote({ recordList, reloadFun, applySearch }) { const [isConfirmPopUp, setConfirmPopUp] = React.useState(false); const [isSendPopUp, setSendPopUp] = React.useState(false); @@ -37,15 +40,22 @@ export default function SearchDemandNote({ recordList, reloadFun }) { navigate('/paymentPage/demandNote/details/' + params.id); }; + const findReadyToSend=()=>{ + const temp = { + status: 'pending', + }; + applySearch(temp); + } + const exportXml = () => { let idList = []; const datas = rows?.filter((row) => selectedRowItems.includes(row.id) ); - if(datas?.length<1){ + if (datas?.length < 1) { setSelectonWarning(true); return; - }else if (datas?.length >= 100) { + } else if (datas?.length >= 100) { setIsErrorPopUp(true); return; } @@ -53,10 +63,10 @@ export default function SearchDemandNote({ recordList, reloadFun }) { idList.push(datas[i].id); } HttpUtils.fileDownload({ - method:'post', + method: 'post', url: UrlUtils.DEMAND_NOTE_EXPORT, params: { - dnIdList:idList + dnIdList: idList }, onSuccess: function () { notifyDownloadSuccess(); @@ -78,7 +88,7 @@ export default function SearchDemandNote({ recordList, reloadFun }) { const datas = rows?.filter((row) => selectedRowItems.includes(row.id) ); - if(datas?.length<1){ + if (datas?.length < 1) { setSelectonWarning(true); return; } @@ -104,16 +114,16 @@ export default function SearchDemandNote({ recordList, reloadFun }) { selectedRowItems.includes(row.id) ); for (var i = 0; i < datas?.length; i++) { - let dnNo = datas[i].dnNo.replaceAll("-",""); + let dnNo = datas[i].dnNo.replaceAll("-", ""); dnMap[dnNo] = datas[i].id } let file = event.target.files[0]; HttpUtils.postWithFiles({ - url:UrlUtils.DEMAND_NOTE_ATTACH, - params:{ - dnMap:dnMap + url: UrlUtils.DEMAND_NOTE_ATTACH, + params: { + dnMap: dnMap }, - files:[file], + files: [file], onSuccess() { setWait(false); if (reloadFun) reloadFun(); @@ -128,7 +138,7 @@ export default function SearchDemandNote({ recordList, reloadFun }) { const datas = rows?.filter((row) => selectedRowItems.includes(row.id) ); - if(datas?.length<1){ + if (datas?.length < 1) { setSelectonWarning(true); return; } @@ -151,18 +161,10 @@ export default function SearchDemandNote({ recordList, reloadFun }) { } const columns = [ - { - field: 'dnNo', - headerName: 'DN No.', - width: 200, - renderCell: (params) => { - return ; - }, - }, { field: 'appNo', headerName: 'App No.', - width: 150, + width: 120, }, { id: 'contactPerson', @@ -170,7 +172,8 @@ export default function SearchDemandNote({ recordList, reloadFun }) { headerName: 'Client', width: 300, renderCell: (params) => { - let company = params.row.enCompanyName != null ? " (" + (params.row.enCompanyName) + ")" : ""; + let company = params.row.enCompanyName != null ? params.row.enCompanyName : params.row.chCompanyName; + company = company != null ? " (" + (company) + ")" : ""; let phone = JSON.parse(params.row.contactTelNo); let faxNo = JSON.parse(params.row.contactFaxNo); @@ -193,38 +196,76 @@ export default function SearchDemandNote({ recordList, reloadFun }) { } }, { - id: 'issueDate', - field: 'issueDate', - headerName: 'Submit Date', - width: 175, + field: 'cm', + headerName: 'Length(cm)', + width: 100, + renderCell: (params) => { + return (<> + {params?.value + "cm"}
+ {params.row.column} + ); + } + }, + { + field: 'amount', + headerName: 'Amount($)', + width: 100, valueGetter: (params) => { - return DateUtils.dateStr(params?.value); + return FormatUtils.currencyFormat(params?.value); } }, { - field: 'status', - headerName: 'Status', - width: 175, + field: 'dnNo', + headerName: 'DN No.', + width: 200, renderCell: (params) => { - return [StatusUtils.getStatus_Eng(params)] + return ; }, }, + { + id: 'issueDate', + field: 'issueDate', + headerName: 'DN Issue/Due Date', + width: 175, + valueGetter: (params) => { + return DateUtils.dateStr(params?.value); + } + }, { field: 'sentDate', headerName: 'DN Sent Date', - flex: 1, + width: 175, valueGetter: (params) => { return params?.value ? DateUtils.datetimeStr(params?.value) + " - " + params.row.sentBy : ""; } }, { field: 'filename', - headerName: 'DN File', - flex: 1, + //headerName: 'DN File', + renderHeader: () => ( + <>DN File + ), + width: 250, renderCell: (params) => { return ; }, }, + { + field: 'appStatus', + headerName: 'App Status', + width: 175, + renderCell: (params) => { + return [PublicNoteStatusUtils.getStatusByTextEng(params?.value, true)] + }, + }, + { + field: 'status', + headerName: 'Status', + width: 175, + renderCell: (params) => { + return [StatusUtils.getStatus_Eng(params)] + }, + }, ]; return ( @@ -241,7 +282,7 @@ export default function SearchDemandNote({ recordList, reloadFun }) { const datas = rows?.filter((row) => selectedRowItems.includes(row.id) ); - if(datas.length==0){ + if (datas.length == 0) { setSelectonWarning(true); document.getElementById("uploadFileBtn").value = ""; return; @@ -259,6 +300,18 @@ export default function SearchDemandNote({ recordList, reloadFun }) { + + + @@ -317,16 +370,16 @@ export default function SearchDemandNote({ recordList, reloadFun }) { />
- setIsErrorPopUp(false)} > - Action Fail - - Number of DN record must less than 100.
Please edit search form.
-
- - - -
-
+ setIsErrorPopUp(false)} > + Action Fail + + Number of DN record must less than 100.
Please edit search form.
+
+ + + +
+
setSelectonWarning(false)} > Warning diff --git a/src/pages/DemandNote/Search/SearchForm.js b/src/pages/DemandNote/Search/SearchForm.js index d983aaa..d58283d 100644 --- a/src/pages/DemandNote/Search/SearchForm.js +++ b/src/pages/DemandNote/Search/SearchForm.js @@ -51,12 +51,6 @@ const SearchDemandNoteForm = ({ applySearch, orgComboData, searchCriteria, issue applySearch(temp); }; - const findReadyToSend=()=>{ - const temp = { - status: 'pending', - }; - applySearch(temp); - } React.useEffect(() => { if (orgComboData && orgComboData.length > 0) { @@ -264,20 +258,6 @@ const SearchDemandNoteForm = ({ applySearch, orgComboData, searchCriteria, issue {/*last row*/} - - - - -