diff --git a/src/pages/GazetteIssue/ExportForm.js b/src/pages/GazetteIssue/ExportForm.js new file mode 100644 index 0000000..e16b830 --- /dev/null +++ b/src/pages/GazetteIssue/ExportForm.js @@ -0,0 +1,133 @@ +// material-ui +import { + Button, + Grid, + TextField, + Autocomplete, + Typography +} from '@mui/material'; +import MainCard from "components/MainCard"; +import { useForm } from "react-hook-form"; +import * as React from "react"; +// import * as DateUtils from "utils/DateUtils"; +import {PNSPS_BUTTON_THEME} from "themes/buttonConst"; +import {ThemeProvider} from "@emotion/react"; +// import * as ComboData from "utils/ComboData"; +// ==============================|| DASHBOARD - DEFAULT ||============================== // + + +const SearchGazetteIssueForm = ({ applyExport, comboData, waitDownload}) => { + const [selectedYear, setSelectedYear] = React.useState([]); + // const [defaultYear, setDefaultYear] = React.useState(searchCriteria.year); + const [comboList, setComboList] = React.useState([]); + // const [onReady, setOnReady] = React.useState(false); + + const { + // register, + handleSubmit } = useForm() + + const onSubmit = () => { + console.log(selectedYear) + if (selectedYear !=null && Object.keys(selectedYear).length>0){ + console.log("okkkkkkkkkkkkkkkk") + const temp = { + year: selectedYear.label, + }; + applyExport(temp); + } + }; + + React.useEffect(() => { + if (comboData && comboData.length > 0) { + // console.log(comboData) + // const labelValue = comboData.find(obj => obj.label === searchCriteria.year); + // console.log(labelValue) + // if(selectedYear.length == 0){ + // setSelectedYear(comboData[0]) + // } + setComboList(comboData) + // setSelectedYear(searchCriteria.dateFrom) + } + }, [comboData]); + + + return ( + + +
+ + {/*row 1*/} + + + Export Preliminary Gazette Issue From Holiday Year + + + {/*row 2*/} + + + + option.label ? option.label : ""} + onChange={(event, newValue) => { + setSelectedYear(newValue); + }} + sx={{ + "& .MuiInputBase-root": { height: "41px" }, + "#year-combo": { padding: "0px 0px 0px 0px" }, + "& .MuiAutocomplete-endAdornment": { top: "auto" }, + }} + renderInput={(params) => } + /> + + + + {/* { + setMaxDate(DateUtils.dateStr(newValue)); + }} + id="dateTo" + type="date" + label="To" + defaultValue={searchCriteria.dateTo} + /> */} + + + {/* + */} + + + + + + + + + +
+
+ ); +}; + +export default SearchGazetteIssueForm; diff --git a/src/pages/GazetteIssue/SearchForm.js b/src/pages/GazetteIssue/SearchForm.js index 8d4782c..f4bf8e4 100644 --- a/src/pages/GazetteIssue/SearchForm.js +++ b/src/pages/GazetteIssue/SearchForm.js @@ -60,7 +60,7 @@ const SearchGazetteIssueForm = ({ applySearch, comboData}) => { {/*row 1*/} - Year + Search {/*row 2*/} diff --git a/src/pages/GazetteIssue/index.js b/src/pages/GazetteIssue/index.js index 1aaaa18..933a66f 100644 --- a/src/pages/GazetteIssue/index.js +++ b/src/pages/GazetteIssue/index.js @@ -14,6 +14,7 @@ import Loadable from 'components/Loadable'; const LoadingComponent = Loadable(React.lazy(() => import('pages/extra-pages/LoadingComponent'))); import MainCard from 'components/MainCard'; +const ExportForm = Loadable(React.lazy(() => import('./ExportForm'))); const SearchForm = Loadable(React.lazy(() => import('./SearchForm'))); const GazetteIssueTable = Loadable(React.lazy(() => import('./DataGrid'))) @@ -36,13 +37,20 @@ import { notifySaveSuccess } from 'utils/CommonFunction'; const Index = () => { const [record, setRecord] = React.useState([]); const [comboData, setComboData] = React.useState([]); + const [holidayComboData, setHolidayComboData] = React.useState([]); const [onReady, setOnReady] = React.useState(false); const [onSearchReady, setOnSearchReady] = React.useState(false); + const [onExportReady, setOnExportReady] = React.useState(false); // const navigate = useNavigate() const [searchCriteria, setSearchCriteria] = React.useState({ year: dateStr_Year(new Date()), // dateFrom: DateUtils.dateStr(new Date().setDate(new Date().getDate()-14)), }); + + const [exportCriteria, setExportCriteria] = React.useState({ + // year: dateStr_Year(new Date()), + // dateFrom: DateUtils.dateStr(new Date().setDate(new Date().getDate()-14)), + }); const [attachments, setAttachments] = React.useState([]); const [waitImport, setWaitImport] = React.useState(false); @@ -78,8 +86,21 @@ const Index = () => { onSuccess: (responseData) => { let combo = responseData; setComboData(combo); - setOnReady(true); setOnSearchReady(true) + loadHolidayCombo(true) + // setOnReady(true); + } + }); + } + + function loadHolidayCombo() { + HttpUtils.get({ + url: UrlUtils.GET_HOLIDAY_COMBO, + onSuccess: (responseData) => { + let combo = responseData + setHolidayComboData(combo) + setOnExportReady(true) + setOnReady(true) } }); } @@ -87,6 +108,17 @@ const Index = () => { function applySearch(input) { setSearchCriteria(input); } + + function applyExport(input) { + setExportCriteria(input); + } + + React.useEffect(() => { + if (Object.keys(exportCriteria).length > 0) { + // console.log(exportCriteria) + doExport(); + } + }, [exportCriteria]); React.useEffect(() => { if (attachments.length > 0) { @@ -116,6 +148,7 @@ const Index = () => { setWaitDownload(true) HttpUtils.fileDownload({ url: UrlUtils.GET_ISSUE_LIST, + params: exportCriteria, onResponse: () => { setTimeout(()=> setWaitDownload(false), 500) } @@ -158,23 +191,18 @@ const Index = () => { + {!onExportReady? + : + + + + } - - - - - { + {/*row 1*/} - + {/*row 2*/} {!onSearchReady? diff --git a/src/pages/Proof/Reply_Public/ApplicationDetails.js b/src/pages/Proof/Reply_Public/ApplicationDetails.js index 2b736dc..64b6ad5 100644 --- a/src/pages/Proof/Reply_Public/ApplicationDetails.js +++ b/src/pages/Proof/Reply_Public/ApplicationDetails.js @@ -231,9 +231,9 @@ const ApplicationDetailCard = ({ formData, }) => { - + {/* - + */} @@ -250,7 +250,7 @@ const ApplicationDetailCard = ({ formData, }) => { - + : diff --git a/src/translations/en.json b/src/translations/en.json index 5c68358..5678fd0 100644 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -363,8 +363,8 @@ "applicationPublishDate": "Publish date", "pleaseCheckReminder": "Please download the following printed manuscript file and proofread it carefully", "payAnd": "Pay and ", - "commentDeadline": "Deadline of Proof with Revise", - "paymentDeadline": "Deadline of Confirm Proof and Payment", + "commentDeadline": "Deadline for proof with revison", + "paymentDeadline": "Deadline for confirm proof and payment", "before": "Before", "page": "Page", "proofReplyDate": "Proof Reply Date", diff --git a/src/translations/zh-CN.json b/src/translations/zh-CN.json index 1d14f27..483f244 100644 --- a/src/translations/zh-CN.json +++ b/src/translations/zh-CN.json @@ -359,7 +359,7 @@ "pleaseCheckReminder": "请下载下列印刷稿档案,并仔细校对", "payAnd": "缴费及", "commentDeadline": "返稿最后限期", - "paymentDeadline": "付款最后限期", + "paymentDeadline": "确定付款及缴费最后限期", "before": "前", "page": "页", "proofReplyDate": "校对回覆日期", diff --git a/src/translations/zh-HK.json b/src/translations/zh-HK.json index f75c83c..2eafca0 100644 --- a/src/translations/zh-HK.json +++ b/src/translations/zh-HK.json @@ -364,7 +364,7 @@ "pleaseCheckReminder": "請下載下列印刷稿檔案,並仔細校對", "payAnd": "繳費及", "commentDeadline": "返稿最後限期", - "paymentDeadline": "付款最後限期", + "paymentDeadline": "確定付款及繳費最後限期", "before": "前", "page": "頁", "proofReplyDate": "校對回覆日期",