diff --git a/src/components/FiDataGrid.js b/src/components/FiDataGrid.js index cf8aba6..67c389c 100644 --- a/src/components/FiDataGrid.js +++ b/src/components/FiDataGrid.js @@ -139,8 +139,14 @@ export function FiDataGrid({ rows, columns, sx, autoHeight = true, function CustomNoRowsOverlay() { return ( - - + + @@ -228,7 +234,7 @@ export function FiDataGrid({ rows, columns, sx, autoHeight = true, }), }} components={{ - noRowsOverlay: CustomNoRowsOverlay, + NoRowsOverlay: CustomNoRowsOverlay, ...(pagination ? { Pagination: () => ( diff --git a/src/pages/Payment/Search_GLD/DataGrid.js b/src/pages/Payment/Search_GLD/DataGrid.js index b7383f1..fc3f6a0 100644 --- a/src/pages/Payment/Search_GLD/DataGrid.js +++ b/src/pages/Payment/Search_GLD/DataGrid.js @@ -22,6 +22,7 @@ export default function SearchPaymentTable({ searchCriteria, applyGridOnReady, a const [isPopUp, setIsPopUp] = React.useState(false); const [bibId, setBibId] = React.useState(); const [bib, setBib] = React.useState(); + const [appNo, setAppNo] = React.useState(); const [refreshTrigger, setRefreshTrigger] = React.useState(0); const forceRefresh = () => { @@ -63,9 +64,10 @@ export default function SearchPaymentTable({ searchCriteria, applyGridOnReady, a }); } - const popUPBib = (id, bibFlag) => { + const popUPBib = (id, bibFlag, appNo) => { setBibId(id) setBib(bibFlag) + setAppNo(appNo) setIsPopUp(true); } @@ -115,7 +117,7 @@ export default function SearchPaymentTable({ searchCriteria, applyGridOnReady, a headerName: 'BIB', width: 150, renderCell: (params) => { - return {popUPBib(params.row.id, params.row.bib)}}/>; + return {popUPBib(params.row.id, params.row.bib, params.row.appNos)}}/>; } }, { @@ -170,7 +172,7 @@ export default function SearchPaymentTable({ searchCriteria, applyGridOnReady, a > Bank-in-bank - {bib?"Cancel Bank-in-bank?":"Is Bank-in-bank?"} + {bib?"Cancel Bank-in-bank?":"Set "+appNo+" as Bank-in-bank?"} diff --git a/src/pages/PublicNotice/Details_GLD/index.js b/src/pages/PublicNotice/Details_GLD/index.js index abe274f..2eba8ec 100644 --- a/src/pages/PublicNotice/Details_GLD/index.js +++ b/src/pages/PublicNotice/Details_GLD/index.js @@ -42,6 +42,7 @@ import * as DateUtils from "utils/DateUtils"; import { notifyActionSuccess, notifySaveSuccess } from "utils/CommonFunction"; import ForwardIcon from '@mui/icons-material/Forward'; import { useNavigate } from "react-router-dom"; +import {getModeByTextEng} from "utils/statusUtils/PublicNoteStatusUtils"; // ==============================|| Body - DEFAULT ||============================== // @@ -123,8 +124,9 @@ const PublicNoticeDetail_GLD = () => { setIssueNum(" No. " + gazetteIssueDetail.issueNo); setIssueDate(DateUtils.dateFormat(gazetteIssueDetail.issueDate, "D MMM YYYY (ddd)")); setGroupNo(response.data.data.groupNo); - if (response.data.data.mode != null){ - setMode("("+response.data.data.mode+")"); + if (response.data.data?.mode != null){ + const modeStr = getModeByTextEng(response.data.data.mode); + setMode("("+modeStr+")"); } setLoading(false); } diff --git a/src/pages/PublicNotice/ListPanel/BaseGrid.js b/src/pages/PublicNotice/ListPanel/BaseGrid.js index 9ac798a..3dafead 100644 --- a/src/pages/PublicNotice/ListPanel/BaseGrid.js +++ b/src/pages/PublicNotice/ListPanel/BaseGrid.js @@ -13,7 +13,7 @@ import { isDummyLoggedIn, } from "utils/Utils"; import {useTheme} from "@emotion/react"; -import {getStatusIntl,getModeEng} from "utils/statusUtils/PublicNoteStatusUtils"; +import {getStatusIntl,getModeIntl } from "utils/statusUtils/PublicNoteStatusUtils"; import {FormattedMessage, useIntl} from "react-intl"; // ==============================|| EVENT TABLE ||============================== // @@ -36,15 +36,8 @@ export default function BaseGrid({setCount, url}) { headerName: intl.formatMessage({id: 'applicationId'}), width: isMdOrLg ? 'auto' : 160, flex: isMdOrLg ? 1 : undefined, - }, - { - id: 'mode', - field: 'mode', - headerName: intl.formatMessage({ id: 'applicationMode' }), - width: isMdOrLg ? 'auto' : 100, - flex: isMdOrLg ? 1 : undefined, renderCell: (params) => { - return [getModeEng(params)] + return [params.row.appNo+getModeIntl(params,intl)] }, }, { diff --git a/src/pages/PublicNotice/ListPanel/SearchPublicNoticeTable.js b/src/pages/PublicNotice/ListPanel/SearchPublicNoticeTable.js index 9fac99d..96b6da8 100644 --- a/src/pages/PublicNotice/ListPanel/SearchPublicNoticeTable.js +++ b/src/pages/PublicNotice/ListPanel/SearchPublicNoticeTable.js @@ -13,6 +13,7 @@ import { isDummyLoggedIn, } from "utils/Utils"; import {GET_PUBLIC_NOTICE_LIST} from "utils/ApiPathConst"; +import {getModeIntl } from "utils/statusUtils/PublicNoteStatusUtils"; import { useTheme } from "@emotion/react"; import { FormattedMessage, useIntl } from "react-intl"; import * as React from 'react'; @@ -41,15 +42,8 @@ export default function SearchPublicNoticeTable({ searchCriteria, applyGridOnRea headerName: intl.formatMessage({ id: 'applicationId' }), width: isMdOrLg ? 'auto' : 160, flex: isMdOrLg ? 1 : undefined, - }, - { - id: 'mode', - field: 'mode', - headerName: intl.formatMessage({ id: 'applicationMode' }), - width: isMdOrLg ? 'auto' : 100, - flex: isMdOrLg ? 1 : undefined, renderCell: (params) => { - return [StatusUtils.getModeEng(params)] + return [params.row.appNo+getModeIntl(params,intl)] }, }, { diff --git a/src/pages/PublicNotice/Search_GLD/SearchForm.js b/src/pages/PublicNotice/Search_GLD/SearchForm.js index 21725f9..e63b5a2 100644 --- a/src/pages/PublicNotice/Search_GLD/SearchForm.js +++ b/src/pages/PublicNotice/Search_GLD/SearchForm.js @@ -26,11 +26,13 @@ const SearchPublicNoticeForm = ({ applySearch, orgComboData, searchCriteria, iss const [type, setType] = React.useState([]); // const [status, setStatus] = React.useState({ key: 0, label: 'All', type: 'all' }); - const [orgSelected, setOrgSelected] = React.useState({}); + const [orgSelected, setOrgSelected] = React.useState(null); + const [inputValue, setInputValue] = React.useState(""); const [orgCombo, setOrgCombo] = React.useState(); const [issueSelected, setIssueSelected] = React.useState({}); const [issueCombo, setIssueCombo] = React.useState([]); const [selectedStatus, setSelectedStatus] = React.useState({key: 0, label: 'All', type: 'all'}); + const [selectedMode, setSelectedMode] = React.useState({key: 0, label: 'All', type: 'all'}); const [groupSelected, setGroupSelected] = React.useState(searchCriteria.gazettGroup!=undefined?ComboData.groupTitle.find(item => item.code === searchCriteria.gazettGroup):{}); const [minDate, setMinDate] = React.useState(searchCriteria.dateFrom); @@ -44,9 +46,11 @@ const SearchPublicNoticeForm = ({ applySearch, orgComboData, searchCriteria, iss ComboData.publicNoticeStatic_GLD[0] }else{ setSelectedStatus(ComboData.publicNoticeStatic_GLD.find(item => item.type === searchCriteria.status)) + setSelectedMode(ComboData.publicNoticeMode_GLD.find(item => item.type === searchCriteria.mode)) } }else{ setSelectedStatus(ComboData.publicNoticeStatic_GLD[0]) + setSelectedMode(ComboData.publicNoticeMode_GLD[0]) } }, [searchCriteria]); @@ -66,6 +70,7 @@ const SearchPublicNoticeForm = ({ applySearch, orgComboData, searchCriteria, iss const onSubmit = (data) => { // localStorage.setItem('searchCriteria',"") data.status = selectedStatus?.type + data.mode = selectedMode?.type let typeArray = []; let sentDateFrom = ""; let sentDateTo = ""; @@ -89,7 +94,7 @@ const SearchPublicNoticeForm = ({ applySearch, orgComboData, searchCriteria, iss issueId: issueSelected?.id, groupNo: data.groupNo, gazettGroup: groupSelected?.code, - mode: data.mode, + mode: (data.mode === '' || data.mode?.includes("all")) ? "" : data.mode, start:0, limit:10 }; @@ -118,17 +123,18 @@ const SearchPublicNoticeForm = ({ applySearch, orgComboData, searchCriteria, iss function resetForm() { setType([]); // setStatus({ key: 0, label: 'All', type: 'all' }); - setOrgSelected({}); + setOrgSelected(null); + setInputValue(""); setIssueSelected({}); setGroupSelected({}); setSelectedStatus({key: 0, label: 'All', type: 'all'}); + setSelectedMode({key: 0, label: 'All', type: 'all'}); setMinDate(DateUtils.dateValue(new Date().setDate(new Date().getDate()-14))) setMaxDate(DateUtils.dateValue(new Date())) reset({ appNo:"", contact:"", - groupNo:"", - mode:"" + groupNo:"" }); localStorage.setItem('searchCriteria',"") } @@ -260,7 +266,7 @@ const SearchPublicNoticeForm = ({ applySearch, orgComboData, searchCriteria, iss - )} /> - {/* { - const findAllIndex = newValue.findIndex((ele) => { - return ele.type === "all" - }) - - if (findAllIndex > -1) { - setSelectedStatus([newValue[findAllIndex]]); - setSelectedLabelsString('all') - } else { - const selectedLabels = newValue.map(option => option.type); - const selectedLabelsString = `${selectedLabels.join(',')}`; - setSelectedStatus(newValue); - setSelectedLabelsString(selectedLabelsString); - } - }} - getOptionLabel={(option) => option.label} - renderInput={(params) => ( - - )} - /> */} { @@ -330,32 +303,37 @@ const SearchPublicNoticeForm = ({ applySearch, orgComboData, searchCriteria, iss groupBy={(option) => option.groupType} size="small" value={orgSelected} - getOptionLabel={(option) => option.name? option.name : ""} - inputValue={orgSelected ? orgSelected.name!=undefined?orgSelected.name:"" : ""} + getOptionLabel={(option) => option?.name ?? ""} + inputValue={inputValue} // 👈 controlled input text + onInputChange={(event, newInputValue) => { // 👈 update when user types + setInputValue(newInputValue); + }} onChange={(event, newValue) => { - if (newValue !== null) { - setOrgSelected(newValue); - }else{ - setOrgSelected({}); + if (newValue) { + setOrgSelected(newValue); + } else { + setOrgSelected({}); } }} renderInput={(params) => ( - )} renderGroup={(params) => ( - + {params.group} - - {params.children} + + {params.children} )} /> + : <> } @@ -421,15 +399,29 @@ const SearchPublicNoticeForm = ({ applySearch, orgComboData, searchCriteria, iss /> - { + if(newValue==null){ + setSelectedMode(ComboData.publicNoticeMode_GLD[0]); + }else{ + setSelectedMode(newValue); + } }} + getOptionLabel={(option) => option.label} + renderInput={(params) => ( + + )} /> diff --git a/src/translations/en.json b/src/translations/en.json index 14c4e43..121fb7c 100644 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -369,6 +369,8 @@ "searchApplyRecord": "Search application records", "applicationId": "Application No.", "applicationMode": "Mode", + "applicationModeOnline": "", + "applicationModeOffline": " (Offline)", "submitDate": "Submit Date", "submitDateFrom": "Submit Date (From)", "submitDateTo": "Submit Date (To)", diff --git a/src/translations/zh-CN.json b/src/translations/zh-CN.json index 81703f9..ea03853 100644 --- a/src/translations/zh-CN.json +++ b/src/translations/zh-CN.json @@ -402,6 +402,8 @@ "searchApplyRecord": "搜寻申请记录", "applicationId": "申请编号", "applicationMode": "方式", + "applicationModeOnline": "", + "applicationModeOffline": " (离线)", "submitDate": "提交日期", "submitDateFrom": "提交日期 (从)", "submitDateTo": "提交日期 (到)", diff --git a/src/translations/zh-HK.json b/src/translations/zh-HK.json index eb89dd3..5bb32ef 100644 --- a/src/translations/zh-HK.json +++ b/src/translations/zh-HK.json @@ -403,6 +403,8 @@ "searchApplyRecord": "搜尋申請記錄", "applicationId": "申請編號", "applicationMode": "方式", + "applicationModeOnline": "", + "applicationModeOffline": " (離線)", "submitDate": "提交日期", "submitDateFrom": "提交日期 (從)", "submitDateTo": "提交日期 (到)", diff --git a/src/utils/ComboData.js b/src/utils/ComboData.js index e816640..fc13672 100644 --- a/src/utils/ComboData.js +++ b/src/utils/ComboData.js @@ -74,6 +74,11 @@ export const publicNoticeStatic_GLD = [ { key: 9, label: 'Withdrawn', type: 'withdrawn' }, ]; +export const publicNoticeMode_GLD = [ + { key: 0, label: 'All', type: 'all' }, + { key: 1, label: 'Online', type: 'online' }, + { key: 1, label: 'Offline', type: 'offline' }, +]; // export const publicNoticeStatic_GLD = [ // { key: 0, label: 'All', type: 'all' }, diff --git a/src/utils/statusUtils/PublicNoteStatusUtils.js b/src/utils/statusUtils/PublicNoteStatusUtils.js index 89a1201..ba8eab9 100644 --- a/src/utils/statusUtils/PublicNoteStatusUtils.js +++ b/src/utils/statusUtils/PublicNoteStatusUtils.js @@ -116,3 +116,17 @@ export function getModeByTextEng(mode) { return "" } } + +export function getModeIntl(params,intl) { + return getModeByTextIntl(params.row.mode, intl); +} +export function getModeByTextIntl(mode, intl) { + switch (mode) { + case "offline": + return intl.formatMessage({id: 'applicationModeOffline'}) + case "online": + return intl.formatMessage({id: 'applicationModeOnline'}) + default: + return "" + } +}