From 555eb2f810fc88b2f6ffdbfb0f8e2d11da166911 Mon Sep 17 00:00:00 2001 From: anna Date: Fri, 9 Feb 2024 12:07:14 +0800 Subject: [PATCH 01/21] proof returnBeforeDate -> reviseDeadline & proofPaymentDeadline --- src/pages/Proof/Create_FromApp/ProofForm.js | 55 ++++++++++++++----- src/pages/Proof/Create_FromApp/index.js | 3 +- src/pages/Proof/Payment/Pay.js | 2 +- .../Proof/Reply_GLD/ApplicationDetails.js | 11 +++- src/pages/Proof/Reply_GLD/index.js | 6 +- .../Proof/Reply_Public/ApplicationDetails.js | 24 +++++++- src/pages/Proof/Reply_Public/ProofForm.js | 6 +- src/pages/Proof/Search_Public/DataGrid.js | 10 ++-- src/translations/en.json | 3 +- src/translations/zh-CN.json | 1 + src/translations/zh-HK.json | 1 + src/utils/statusUtils/ProofStatus.js | 12 ++-- 12 files changed, 96 insertions(+), 38 deletions(-) diff --git a/src/pages/Proof/Create_FromApp/ProofForm.js b/src/pages/Proof/Create_FromApp/ProofForm.js index 359521a..be183f8 100644 --- a/src/pages/Proof/Create_FromApp/ProofForm.js +++ b/src/pages/Proof/Create_FromApp/ProofForm.js @@ -91,11 +91,11 @@ const FormPanel = ({ formData }) => { })); formik.setFieldValue("noOfPages", responseData.data.total_no_of_page); formik.setFieldValue("fee", (data.groupType == "Private Bill" ? 6552 * responseData.data.total_no_of_page : responseData.data.length * colValue)); - if(data.groupType == "Private Bill" && responseData.data.file.length>0){ + if (data.groupType == "Private Bill" && responseData.data.file.length > 0) { let attachmentList = attachments; - for(let i=0; i item.name == file.filename)["no_of_page"] = file.no_of_page; + attachmentList.find(item => item.name == file.filename)["no_of_page"] = file.no_of_page; } setAttachments(attachmentList); } @@ -129,7 +129,8 @@ const FormPanel = ({ formData }) => { length: values.length, colCount: columnPrice.colCount, noOfPages: values.noOfPages, - returnBeforeDate: DateUtils.convertToDate(values.beforeDate).getTime() + reviseDeadline: DateUtils.convertToDate(values.reviseDeadline).getTime(), + proofPaymentDeadline: DateUtils.convertToDate(values.proofPaymentDeadline).getTime() }, files: attachments, onSuccess: function (responeData) { @@ -196,15 +197,41 @@ const FormPanel = ({ formData }) => { - Return Before Date: + Return Revise Before: + + + + + + + Payment Before Date: + + { - + { @@ -414,7 +441,7 @@ const FormPanel = ({ formData }) => { variant="contained" color="success" type="submit" - disabled = {saving} + disabled={saving} sx={{ textTransform: 'capitalize', alignItems: 'end' diff --git a/src/pages/Proof/Create_FromApp/index.js b/src/pages/Proof/Create_FromApp/index.js index 1299d75..02be45a 100644 --- a/src/pages/Proof/Create_FromApp/index.js +++ b/src/pages/Proof/Create_FromApp/index.js @@ -59,7 +59,8 @@ const Index = () => { responseData.data["groupType"] = responseData.data.groupTitle; - responseData.data["beforeDate"] = DateUtils.datetimeFieldFormat(responseData.data.returnBeforeDate); + responseData.data["reviseDeadline"] = DateUtils.datetimeFieldFormat(responseData.data.reviseDeadline); + responseData.data["proofPaymentDeadline"] = DateUtils.datetimeFieldFormat(responseData.data.proofPaymentDeadline); setRecord(responseData.data); } }); diff --git a/src/pages/Proof/Payment/Pay.js b/src/pages/Proof/Payment/Pay.js index 46ef276..9d19ec2 100644 --- a/src/pages/Proof/Payment/Pay.js +++ b/src/pages/Proof/Payment/Pay.js @@ -109,7 +109,7 @@ const Index = () => { 我們已收到申請編號: {record?.appNo} 的稿件校對確定及可付印的指示。

- 請於 {DateUtils.dateStr_Cht(record?.returnBeforeDate)} 下午 2:00 前 完成繳費,我們將於收到繳費確認後處理刊出事宜。 + 請於 {DateUtils.datetimeStr(record?.proofPaymentDeadline)} 前 完成繳費,我們將於收到繳費確認後處理刊出事宜。

如你在憲報期數 {record?.issueYear} 年 {record?.issueVolume} 卷, 第 {record?.issueNo} 期內有多於一個公共啟事的申請,你可選擇完成所有此期所有稿件校對確定後,於繳費期限前在「我的公共啟事」內合併付款。
diff --git a/src/pages/Proof/Reply_GLD/ApplicationDetails.js b/src/pages/Proof/Reply_GLD/ApplicationDetails.js index 7207894..c68a81b 100644 --- a/src/pages/Proof/Reply_GLD/ApplicationDetails.js +++ b/src/pages/Proof/Reply_GLD/ApplicationDetails.js @@ -266,10 +266,17 @@ const ApplicationDetailCard = ({ - Deadline for payment and reply: + Deadline for payment: - Before {DateUtils.datetimeStr(data.returnBeforeDate)} + Before {DateUtils.datetimeStr(data.proofPaymentDeadline)} + + + Deadline for revise: + + + Before {DateUtils.datetimeStr(data.reviseDeadline)} diff --git a/src/pages/Proof/Reply_GLD/index.js b/src/pages/Proof/Reply_GLD/index.js index a22c395..6a2d44b 100644 --- a/src/pages/Proof/Reply_GLD/index.js +++ b/src/pages/Proof/Reply_GLD/index.js @@ -76,10 +76,10 @@ const Index = () => { responseData.data["groupType"] = responseData.data.groupTitle; responseData.data["action"] = responseData.data.replyDate ? responseData.data.action : true; - let returnBeforeDate = DateUtils.convertToDate(responseData.data.returnBeforeDate); + let proofPaymentDeadline = DateUtils.convertToDate(responseData.data.proofPaymentDeadline); let current = new Date(); - setIsOverTime(current.getTime() > returnBeforeDate.getTime()); - setShowCancelBtn(responseData.data.cancelled || responseData.data.replyDate || current.getTime() > returnBeforeDate.getTime()) + setIsOverTime(current.getTime() > proofPaymentDeadline.getTime()); + setShowCancelBtn(responseData.data.cancelled || responseData.data.replyDate || current.getTime() > proofPaymentDeadline.getTime()) diff --git a/src/pages/Proof/Reply_Public/ApplicationDetails.js b/src/pages/Proof/Reply_Public/ApplicationDetails.js index fa77bd7..2b736dc 100644 --- a/src/pages/Proof/Reply_Public/ApplicationDetails.js +++ b/src/pages/Proof/Reply_Public/ApplicationDetails.js @@ -240,12 +240,32 @@ const ApplicationDetailCard = ({ formData, }) => {   {locale === 'en' ? - `${intl.formatMessage({id: 'before'})} ${DateUtils.datetimeStr(data.returnBeforeDate)} ` + `${intl.formatMessage({id: 'before'})} ${DateUtils.datetimeStr(data.reviseDeadline)} ` : - `${DateUtils.datetimeStr_Cht(data.returnBeforeDate)} ${intl.formatMessage({id: 'before'})}` + `${DateUtils.datetimeStr_Cht(data.reviseDeadline)} ${intl.formatMessage({id: 'before'})}` } + + + + + + + : + + + +   + {locale === 'en' ? + `${intl.formatMessage({id: 'before'})} ${DateUtils.datetimeStr(data.proofPaymentDeadline)} ` + : + `${DateUtils.datetimeStr_Cht(data.proofPaymentDeadline)} ${intl.formatMessage({id: 'before'})}` + } + + + diff --git a/src/pages/Proof/Reply_Public/ProofForm.js b/src/pages/Proof/Reply_Public/ProofForm.js index 76530f5..d1fdc03 100644 --- a/src/pages/Proof/Reply_Public/ProofForm.js +++ b/src/pages/Proof/Reply_Public/ProofForm.js @@ -131,10 +131,10 @@ const FormPanel = ({ formData }) => { } const isOverTime = () => { - let returnBeforeDate = DateUtils.convertToDate(formik.values?.returnBeforeDate); - if (!returnBeforeDate) return true; + let proofPaymentDeadline = DateUtils.convertToDate(formik.values?.proofPaymentDeadline); + if (!proofPaymentDeadline) return true; let current = new Date(); - return current.getTime() > returnBeforeDate; + return current.getTime() > proofPaymentDeadline; } diff --git a/src/pages/Proof/Search_Public/DataGrid.js b/src/pages/Proof/Search_Public/DataGrid.js index 7d8e7d5..c15f6a0 100644 --- a/src/pages/Proof/Search_Public/DataGrid.js +++ b/src/pages/Proof/Search_Public/DataGrid.js @@ -105,15 +105,15 @@ export default function SearchPublicNoticeTable({ recordList }) { } }, { - id: 'returnBeforeDate', - field: 'returnBeforeDate', + id: 'proofPaymentDeadline', + field: 'proofPaymentDeadline', headerName: intl.formatMessage({id: 'replyBefore'}), width: isMdOrLg ? 'auto' : 250, flex: isMdOrLg ? 1.5 : undefined, valueGetter: (params) => { - let returnBeforeDate = DateUtils.convertToDate(params?.value); - returnBeforeDate = returnBeforeDate.setHours(14, 0, 0, 0); - return locale === 'en' ? DateUtils.datetimeStr(returnBeforeDate) : DateUtils.datetimeStr_Cht(returnBeforeDate); + let proofPaymentDeadline = DateUtils.convertToDate(params?.value); + proofPaymentDeadline = proofPaymentDeadline.setHours(14, 0, 0, 0); + return locale === 'en' ? DateUtils.datetimeStr(proofPaymentDeadline) : DateUtils.datetimeStr_Cht(proofPaymentDeadline); } }, { diff --git a/src/translations/en.json b/src/translations/en.json index 2709d54..5c3a766 100644 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -325,7 +325,8 @@ "applicationPublishDate": "Publish date", "pleaseCheckReminder": "Please download the following printed manuscript file and proofread it carefully", "payAnd": "Pay and ", - "commentDeadline": "Deadline for submission of manuscripts", + "commentDeadline": "Deadline for Revise", + "paymentDeadline": "Deadline for Payment", "before": "Before", "page": "Page", "proofReplyDate": "Proof Reply Date", diff --git a/src/translations/zh-CN.json b/src/translations/zh-CN.json index 4a92306..6c011ca 100644 --- a/src/translations/zh-CN.json +++ b/src/translations/zh-CN.json @@ -322,6 +322,7 @@ "pleaseCheckReminder": "请下载下列印刷稿档案,并仔细校对", "payAnd": "缴费及", "commentDeadline": "返稿最后限期", + "paymentDeadline": "付款最后限期", "before": "前", "page": "页", "proofReplyDate": "校对回覆日期", diff --git a/src/translations/zh-HK.json b/src/translations/zh-HK.json index 6828519..d8b906b 100644 --- a/src/translations/zh-HK.json +++ b/src/translations/zh-HK.json @@ -327,6 +327,7 @@ "pleaseCheckReminder": "請下載下列印刷稿檔案,並仔細校對", "payAnd": "繳費及", "commentDeadline": "返稿最後限期", + "paymentDeadline": "付款最後限期", "before": "前", "page": "頁", "proofReplyDate": "校對回覆日期", diff --git a/src/utils/statusUtils/ProofStatus.js b/src/utils/statusUtils/ProofStatus.js index fdf6b39..1cdde36 100644 --- a/src/utils/statusUtils/ProofStatus.js +++ b/src/utils/statusUtils/ProofStatus.js @@ -31,7 +31,7 @@ function getStatus(params) { // console.log(params) let replyDate = params.row?params.row.replyDate:params.replyDate; let action = params.row?params.row.action:params.action; - let returnBeforeDate = params.row?params.row.returnBeforeDate:params.returnBeforeDate; + let proofPaymentDeadline = params.row?params.row.proofPaymentDeadline:params.proofPaymentDeadline; let isCancelled = params.row?params.row.cancelled:params.cancelled; if(isCancelled) return cancel; @@ -40,14 +40,14 @@ function getStatus(params) { if(replyDate){ return action?confirm:unable; }else{ - return isOverTime(returnBeforeDate)? timeOut: pendingReply; + return isOverTime(proofPaymentDeadline)? timeOut: pendingReply; } } -const isOverTime = (returnBeforeDate) => { - if (!returnBeforeDate) return true; - returnBeforeDate = DateUtils.convertToDate(returnBeforeDate); +const isOverTime = (proofPaymentDeadline) => { + if (!proofPaymentDeadline) return true; + proofPaymentDeadline = DateUtils.convertToDate(proofPaymentDeadline); let current = new Date(); - return current.getTime() > returnBeforeDate.getTime(); + return current.getTime() > proofPaymentDeadline.getTime(); } From 61386cb5dc5e4983953bd66bc87b77f5106d03b1 Mon Sep 17 00:00:00 2001 From: anna Date: Fri, 9 Feb 2024 13:05:46 +0800 Subject: [PATCH 02/21] check issue when doing apply --- .../PublicNotice/ApplyForm/PublicNoticeApplyForm.js | 13 ++++++++++++- src/translations/en.json | 5 +++-- src/translations/zh-CN.json | 1 + src/translations/zh-HK.json | 1 + 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/pages/PublicNotice/ApplyForm/PublicNoticeApplyForm.js b/src/pages/PublicNotice/ApplyForm/PublicNoticeApplyForm.js index 5d5cd95..37fbd81 100644 --- a/src/pages/PublicNotice/ApplyForm/PublicNoticeApplyForm.js +++ b/src/pages/PublicNotice/ApplyForm/PublicNoticeApplyForm.js @@ -34,6 +34,7 @@ const PublicNoticeApplyForm = ({ loadedData, selections }) => { const intl = useIntl(); const [val, setVal] = React.useState({}); + const [reloadPage, setReloadPage] = React.useState(false); const [issueId, setIssueId] = React.useState(loadedData.issueId); const navigate = useNavigate(); @@ -121,7 +122,14 @@ const PublicNoticeApplyForm = ({ loadedData, selections }) => { remarks: values.remarks ? values.remarks : "", }, files: [attachment], - onSuccess: function () { + onSuccess: function (responData) { + if(responData.msg){ + setVal({}); + setReloadPage(true); + setWarningText(intl.formatMessage({id: responData.msg})); + setIsWarningPopUp(true); + return; + } notifyActionSuccess(intl.formatMessage({id: 'submissionSuccess'}) + '!') navigate("/publicNotice"); // location.reload(); @@ -345,6 +353,9 @@ const PublicNoticeApplyForm = ({ loadedData, selections }) => { setIsWarningPopUp(false); }else{ setIsWarningPopUp(false); + if(reloadPage){ + window.reload(); + } } }} > diff --git a/src/translations/en.json b/src/translations/en.json index 5c3a766..689a55a 100644 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -325,8 +325,8 @@ "applicationPublishDate": "Publish date", "pleaseCheckReminder": "Please download the following printed manuscript file and proofread it carefully", "payAnd": "Pay and ", - "commentDeadline": "Deadline for Revise", - "paymentDeadline": "Deadline for Payment", + "commentDeadline": "Deadline of Proof with Revise", + "paymentDeadline": "Deadline of Confirm Proof and Payment", "before": "Before", "page": "Page", "proofReplyDate": "Proof Reply Date", @@ -340,6 +340,7 @@ "requiredUploadFix": "Please upload the modified file of the manuscript", "upload": "Upload", "actionFail": "Action failed: Please check the content and submit the reply again", + "issueInvalidMsg": "Action failed: The Gazette Issue invalid, please apply again", "transactionNo": "Transaction number", "transactionDate": "Transaction date", diff --git a/src/translations/zh-CN.json b/src/translations/zh-CN.json index 6c011ca..b0eeb96 100644 --- a/src/translations/zh-CN.json +++ b/src/translations/zh-CN.json @@ -336,6 +336,7 @@ "requiredUploadFix": "请上载稿件修改的档案", "upload": "上载", "actionFail": "行动失败: 请检查内容并再次提交回覆", + "issueInvalidMsg": "行动失败: 无效宪报期数,请重新申请", "transactionNo": "交易号码", "transactionDate": "交易日期", diff --git a/src/translations/zh-HK.json b/src/translations/zh-HK.json index d8b906b..2b2ee40 100644 --- a/src/translations/zh-HK.json +++ b/src/translations/zh-HK.json @@ -341,6 +341,7 @@ "requiredUploadFix": "請上載稿件修改的檔案", "upload": "上載", "actionFail": "行動失敗: 請檢查內容並再次提交回覆", + "issueInvalidMsg": "行動失敗: 無效憲報期數,請重新申請", "transactionNo": "交易號碼", "transactionDate": "交易日期", From 55a57bd6cdce013863d988a730d325510d8066f2 Mon Sep 17 00:00:00 2001 From: anna Date: Thu, 15 Feb 2024 11:44:56 +0800 Subject: [PATCH 03/21] fix bug --- src/pages/PublicNotice/ApplyForm/PublicNoticeApplyForm.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/PublicNotice/ApplyForm/PublicNoticeApplyForm.js b/src/pages/PublicNotice/ApplyForm/PublicNoticeApplyForm.js index 37fbd81..b35d0c2 100644 --- a/src/pages/PublicNotice/ApplyForm/PublicNoticeApplyForm.js +++ b/src/pages/PublicNotice/ApplyForm/PublicNoticeApplyForm.js @@ -354,7 +354,7 @@ const PublicNoticeApplyForm = ({ loadedData, selections }) => { }else{ setIsWarningPopUp(false); if(reloadPage){ - window.reload(); + location.reload(); } } }} From 9b4124872ef6c543fb891a9ba7db46edfc6d5a0b Mon Sep 17 00:00:00 2001 From: anna Date: Fri, 16 Feb 2024 17:02:49 +0800 Subject: [PATCH 04/21] add announcement UI --- src/layout/MainLayout/Header/index.js | 3 + .../Announcement/Details/AnnouncementForm.js | 336 ++++++++++++++++++ src/pages/Announcement/Details/index.js | 64 ++++ src/pages/Announcement/Search/DataGrid.js | 83 +++++ src/pages/Announcement/Search/SearchForm.js | 155 ++++++++ src/pages/Announcement/Search/index.js | 104 ++++++ src/pages/dashboard/Public/Message.js | 2 +- src/pages/dashboard/Public/Notice.js | 53 ++- src/routes/GLDUserRoutes.js | 10 + src/themes/buttonConst.js | 4 + src/utils/ApiPathConst.js | 7 +- 11 files changed, 811 insertions(+), 10 deletions(-) create mode 100644 src/pages/Announcement/Details/AnnouncementForm.js create mode 100644 src/pages/Announcement/Details/index.js create mode 100644 src/pages/Announcement/Search/DataGrid.js create mode 100644 src/pages/Announcement/Search/SearchForm.js create mode 100644 src/pages/Announcement/Search/index.js diff --git a/src/layout/MainLayout/Header/index.js b/src/layout/MainLayout/Header/index.js index 7a33057..f06f37b 100644 --- a/src/layout/MainLayout/Header/index.js +++ b/src/layout/MainLayout/Header/index.js @@ -146,6 +146,9 @@ function Header(props) {
  • System Setting
  • +
  • + Announcement +
  • diff --git a/src/pages/Announcement/Details/AnnouncementForm.js b/src/pages/Announcement/Details/AnnouncementForm.js new file mode 100644 index 0000000..0a78ed8 --- /dev/null +++ b/src/pages/Announcement/Details/AnnouncementForm.js @@ -0,0 +1,336 @@ +// material-ui +import { + Grid, + Typography, + Button, + TextField, + Stack, Box +} from '@mui/material'; +import { useFormik } from 'formik'; +import * as yup from 'yup'; +import * as React from "react"; +import * as HttpUtils from "utils/HttpUtils"; +import * as UrlUtils from "utils/ApiPathConst"; +import titleBackgroundImg from 'assets/images/dashboard/gazette-bar.png' +import ForwardIcon from '@mui/icons-material/Forward'; +import Divider from '@mui/material/Divider'; +import {useParams} from "react-router-dom"; +import { useNavigate } from "react-router-dom"; +import { notifyActionSuccess } from 'utils/CommonFunction'; +import { useIntl } from "react-intl"; + +// ==============================|| DASHBOARD - DEFAULT ||============================== // + +const AnnouncementForm = ({ loadedData }) => { + const intl = useIntl(); + const params = useParams(); + const navigate = useNavigate(); + + const BackgroundHead = { + backgroundImage: `url(${titleBackgroundImg})`, + width: 'auto', + height: 'auto', + backgroundSize: 'contain', + backgroundRepeat: 'no-repeat', + backgroundColor: '#0C489E', + backgroundPosition: 'right' + } + + + const formik = useFormik({ + enableReinitialize: true, + initialValues: loadedData, + validationSchema: yup.object().shape({ + subjectEng: yup.string().max(255).required(), + subjectCht: yup.string().max(255).required(), + subjectChs: yup.string().max(255).required(), + contentEng: yup.string().required(), + contentCht: yup.string().required(), + contentChs: yup.string().required(), + }), + onSubmit: values => { + doSave(values); + } + }); + + const doSave = (values) => { + HttpUtils.post({ + url: UrlUtils.POST_ANNOUNCE_SAVE, + params: { + id: params?.id??0, + announceDate: values.announceDate, + subjectEng: values.subjectEng, + subjectCht: values.subjectCht, + subjectChs: values.subjectChs, + + contentEng: values.contentEng, + contentCht: values.contentCht, + contentChs: values.contentChs, + }, + onSuccess: function () { + notifyActionSuccess(intl.formatMessage({ id: 'submissionSuccess' }) + '!') + navigate("/setting/announcement"); + } + }); + } + + return ( + + +
    + + + Announcement + + +
    +
    + + + + + + +
    + + + + + + + + + + Announce Date: + + + + + + + + + English + + + + Subject: + + + + + + + + + + + Content: + + + + + + + + + Traditional Chinese + + + + Subject: + + + + + + + + + + + Content: + + + + + + + + + + + Simplified Chinese + + + + Subject: + + + + + + + + + + + + Content: + + + + + + + + +
    +
    +
    + +
    + ); +}; + + +export default AnnouncementForm; diff --git a/src/pages/Announcement/Details/index.js b/src/pages/Announcement/Details/index.js new file mode 100644 index 0000000..c24fa0b --- /dev/null +++ b/src/pages/Announcement/Details/index.js @@ -0,0 +1,64 @@ +// material-ui +import * as React from "react"; +import * as HttpUtils from "utils/HttpUtils"; +import * as UrlUtils from "utils/ApiPathConst"; +import * as DateUtils from "utils/DateUtils"; + +import { + Grid, +} from '@mui/material'; + +import { useParams } from 'react-router-dom'; +import Loadable from 'components/Loadable'; +import { lazy } from 'react'; +const LoadingComponent = Loadable(lazy(() => import('../../extra-pages/LoadingComponent'))); +const AnnouncementForm = Loadable(lazy(() => import('./AnnouncementForm'))); + + +// ==============================|| DASHBOARD - DEFAULT ||============================== // + +const CreateForm = () => { + const params = useParams(); + + const [formData, setFormData] = React.useState({}); + const [isLoading, setLoding] = React.useState(true); + + React.useEffect(() => { + loadData(); + }, []); + + const loadData = () => { + setLoding(true); + if (params.id > 0) { + HttpUtils.get({ + url: `${UrlUtils.GET_ANNOUNCE}`+"/"+params.id, + onSuccess: function (responseData) { + responseData["announceDate"] = DateUtils.datetimeFieldFormat(responseData.announceDate); + setFormData(responseData); + } + }); + }else{ + setFormData({"announceDate": DateUtils.datetimeFieldFormat(new Date())}); + } + }; + + React.useEffect(() => { + if (formData !== null && formData != {}) setLoding(false); + }, [formData]); + + return ( + isLoading ? + + + + + + : + + ); +}; + + +export default CreateForm; diff --git a/src/pages/Announcement/Search/DataGrid.js b/src/pages/Announcement/Search/DataGrid.js new file mode 100644 index 0000000..bcbeab0 --- /dev/null +++ b/src/pages/Announcement/Search/DataGrid.js @@ -0,0 +1,83 @@ +// material-ui +import * as React from 'react'; +import { + Button, + Box +} from '@mui/material'; +import * as DateUtils from "utils/DateUtils"; +import { useNavigate } from "react-router-dom"; +import { FiDataGrid } from "components/FiDataGrid"; +// ==============================|| EVENT TABLE ||============================== // + +export default function SearchPublicNoticeTable({ recordList }) { + const [rows, setRows] = React.useState(recordList); + const navigate = useNavigate() + + React.useEffect(() => { + setRows(recordList); + }, [recordList]); + + const handleEditClick = (params) => () => { + navigate('/setting/announcement/details/' + params.id); + }; + + + const columns = [ + { + field: 'announceDate', + headerName: 'Announce Date', + width: 250, + cellClassName: 'announceDate', + renderCell: (params) => { + return ; + }, + }, + { + id: 'subjec', + field: 'subjec', + headerName: 'Subjec', + minWidth: 400, + renderCell: (params) => { + return <> + + {params.row.subjectEng} + {params.row.subjectCht} + {params.row.subjectChs} + + + }, + }, + { + id: 'content', + field: 'content', + headerName: 'Content', + flex:1, + minWidth: 400, + renderCell: (params) => { + return <> + + {params.row.contentEng} + {params.row.contentCht} + {params.row.contentChs} + + + } + }, + ]; + + function handleRowDoubleClick(params) { + navigate('/setting/announcement/details/' + params.id); + } + + return ( +
    + 'auto'} + onRowDoubleClick={handleRowDoubleClick} + /> +
    + ); +} diff --git a/src/pages/Announcement/Search/SearchForm.js b/src/pages/Announcement/Search/SearchForm.js new file mode 100644 index 0000000..500385c --- /dev/null +++ b/src/pages/Announcement/Search/SearchForm.js @@ -0,0 +1,155 @@ +// material-ui +import { + Button, + Grid, TextField, + 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 {ThemeProvider} from "@emotion/react"; +import { useNavigate } from "react-router-dom"; +import {PNSPS_BUTTON_THEME} from "../../../themes/buttonConst"; +// ==============================|| DASHBOARD - DEFAULT ||============================== // + + +const SearchPublicNoticeForm = ({ applySearch, searchCriteria}) => { + const navigate = useNavigate() + + const [minDate, setMinDate] = React.useState(searchCriteria.dateFrom); + const [maxDate, setMaxDate] = React.useState(searchCriteria.dateTo); + + const marginBottom = 2.5; + const { reset, register, handleSubmit } = useForm() + const onSubmit = (data) => { + const temp = { + key: data.key, + dateFrom: data.dateFrom, + dateTo: data.dateTo, + }; + applySearch(temp); + }; + + + function resetForm() { + reset(); + } + + + return ( + + +
    + + {/*row 1*/} + + + Search + + + {/*row 2*/} + + + + + + + + + { + setMinDate(DateUtils.dateStr(newValue)); + }} + InputLabelProps={{ + shrink: true + }} + /> + + + + To + + + + { + setMaxDate(DateUtils.dateStr(newValue)); + }} + id="dateTo" + type="date" + //label={"Submit Date(To)"} + defaultValue={searchCriteria.dateTo} + /> + + + + + + + {/*last row*/} + + + + + + + + + + + + + + + +
    +
    + ); +}; + +export default SearchPublicNoticeForm; diff --git a/src/pages/Announcement/Search/index.js b/src/pages/Announcement/Search/index.js new file mode 100644 index 0000000..073f486 --- /dev/null +++ b/src/pages/Announcement/Search/index.js @@ -0,0 +1,104 @@ +// material-ui +import { + Grid, + Typography, + Stack +} from '@mui/material'; +import MainCard from "components/MainCard"; +import * as UrlUtils from "utils/ApiPathConst"; +import * as React from "react"; +import * as HttpUtils from "utils/HttpUtils"; +import * as DateUtils from "utils/DateUtils"; + +import Loadable from 'components/Loadable'; +const LoadingComponent = Loadable(React.lazy(() => import('pages/extra-pages/LoadingComponent'))); +const SearchForm = Loadable(React.lazy(() => import('./SearchForm'))); +const EventTable = Loadable(React.lazy(() => import('./DataGrid'))); +import titleBackgroundImg from 'assets/images/dashboard/gazette-bar.png' + +const BackgroundHead = { + backgroundImage: `url(${titleBackgroundImg})`, + width: '100%', + height: '100%', + backgroundSize: 'contain', + backgroundRepeat: 'no-repeat', + backgroundColor: '#0C489E', + backgroundPosition: 'right' +} + +// ==============================|| DASHBOARD - DEFAULT ||============================== // + +const UserSearchPage_Individual = () => { + + const [record, setRecord] = React.useState([]); + const [searchCriteria, setSearchCriteria] = React.useState({ + dateTo: DateUtils.dateStr(new Date()), + dateFrom: DateUtils.dateStr(new Date().setDate(new Date().getDate() - 90)), + }); + const [onReady, setOnReady] = React.useState(false); + + React.useEffect(() => { + getDataList(); + }, []); + + React.useEffect(() => { + setOnReady(true); + }, [record]); + + React.useEffect(() => { + getDataList(); + }, [searchCriteria]); + + function getDataList() { + HttpUtils.get({ + url: UrlUtils.GET_ANNOUNCE_LIST, + params: searchCriteria, + onSuccess: function (responseData) { + setRecord(responseData); + } + }); + } + + function applySearch(input) { + setSearchCriteria(input); + } + + return ( + !onReady ? + + + + + + : + + +
    + + Announcement + +
    +
    + {/*row 1*/} + + + + {/*row 2*/} + + + + + +
    + ); +} +export default UserSearchPage_Individual; diff --git a/src/pages/dashboard/Public/Message.js b/src/pages/dashboard/Public/Message.js index f959904..8d13377 100644 --- a/src/pages/dashboard/Public/Message.js +++ b/src/pages/dashboard/Public/Message.js @@ -26,7 +26,7 @@ const SearchDemandNoteForm = () => { const loadData = () => { HttpUtils.get({ - url: UrlUtils.GET_MSG_DESHBOARD, + url: UrlUtils.GET_MSG_DASHBOARD, onSuccess: function (response) { let list = [] response.map((item) => { diff --git a/src/pages/dashboard/Public/Notice.js b/src/pages/dashboard/Public/Notice.js index b7a1029..93b2247 100644 --- a/src/pages/dashboard/Public/Notice.js +++ b/src/pages/dashboard/Public/Notice.js @@ -1,29 +1,66 @@ // material-ui import { + Stack, Typography, - Stack } from '@mui/material'; import MainCard from "components/MainCard"; import * as React from "react"; +import * as HttpUtils from "utils/HttpUtils"; +import * as UrlUtils from "utils/ApiPathConst"; +import * as DateUtils from "utils/DateUtils"; + +import { useIntl} from "react-intl"; // ==============================|| DASHBOARD - DEFAULT ||============================== // const SearchDemandNoteForm = () => { + const [itemList, setItemList] = React.useState([]); + const [listData, setListData] = React.useState([]); + const intl = useIntl(); + const { locale } = intl; + + + React.useEffect(() => { + loadData(); + }, []); + + React.useEffect(() => { + let list = [] + if(listData == []) return; + listData.map((item) => { + list.push( + + {locale === 'en' ?item.subjectEng:locale === 'zh-HK' ?item.subjectCht:item.subjectChs} + {DateUtils.datetimeStr(item.announceDate)} + {locale === 'en' ?item.contentEng:locale === 'zh-HK' ?item.contentCht:item.contentChs} + + ) + }); + setItemList(list); + }, [listData,intl]); + + const loadData = () => { + + HttpUtils.get({ + url: UrlUtils.GET_ANNOUNCE_DASHBOARD, + onSuccess: function (response) { + setListData(response); + } + }); + }; + + return ( - - - - + + {itemList} - - ); }; diff --git a/src/routes/GLDUserRoutes.js b/src/routes/GLDUserRoutes.js index 475de96..a2f78c8 100644 --- a/src/routes/GLDUserRoutes.js +++ b/src/routes/GLDUserRoutes.js @@ -20,6 +20,8 @@ const DemandNote_Details = Loadable(lazy(() => import('pages/DemandNote/Details' const GFMIS_Search = Loadable(lazy(() => import('pages/GFMIS'))); const UserMaintainPage = Loadable(lazy(() => import('pages/User/GLDUserProfile'))); const SystemSetting = Loadable(lazy(() => import('pages/Setting/SystemSetting'))); +const AnnouncementDetails = Loadable(lazy(() => import('pages/Announcement/Details'))); +const AnnouncementSearch = Loadable(lazy(() => import('pages/Announcement/Search'))); // ==============================|| MAIN ROUTING ||============================== // @@ -90,6 +92,14 @@ const GLDUserRoutes = { path: '/setting/sys', element: }, + { + path: '/setting/announcement', + element: + }, + { + path: '/setting/announcement/details/:id', + element: + }, ] }, ] diff --git a/src/themes/buttonConst.js b/src/themes/buttonConst.js index 6ac414b..025c764 100644 --- a/src/themes/buttonConst.js +++ b/src/themes/buttonConst.js @@ -47,6 +47,10 @@ export const PNSPS_BUTTON_THEME = createTheme({ main: '#448DF2', contrastText: '#FFFFFF', }, + green:{ + main: '#4ac234', + contrastText: '#FFFFFF', + }, orange: { main: '#ed9740', light: '#ff5e5e', diff --git a/src/utils/ApiPathConst.js b/src/utils/ApiPathConst.js index 17e98f6..c3433e8 100644 --- a/src/utils/ApiPathConst.js +++ b/src/utils/ApiPathConst.js @@ -49,7 +49,12 @@ export const GET_PUB_ORG_MARK_AS_NON_CREDITOR = apiPath+'/org/pub/mark-as-non-cr export const GET_MSG_DETAILS = apiPath+'/msg/details'; export const GET_MSG_LIST = apiPath+'/msg/list'; -export const GET_MSG_DESHBOARD = apiPath+'/msg/list/deshboard'; +export const GET_MSG_DASHBOARD = apiPath+'/msg/list/deshboard'; + +export const POST_ANNOUNCE_SAVE = apiPath+'/announcement/save'; +export const GET_ANNOUNCE = apiPath+'/announcement'; +export const GET_ANNOUNCE_LIST = apiPath+'/announcement/list'; +export const GET_ANNOUNCE_DASHBOARD = apiPath+'/announcement/dashboard'; export const CHECK_OVERDUE = apiPath+'/application/check-overdue'; From cc6fbfd635661d0da9ea529845f058865cad1c6a Mon Sep 17 00:00:00 2001 From: anna Date: Fri, 16 Feb 2024 17:09:44 +0800 Subject: [PATCH 05/21] update public message ui --- src/pages/dashboard/Public/Notice.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/pages/dashboard/Public/Notice.js b/src/pages/dashboard/Public/Notice.js index 93b2247..e1ce7b8 100644 --- a/src/pages/dashboard/Public/Notice.js +++ b/src/pages/dashboard/Public/Notice.js @@ -2,13 +2,13 @@ import { Stack, Typography, + Divider } from '@mui/material'; import MainCard from "components/MainCard"; import * as React from "react"; import * as HttpUtils from "utils/HttpUtils"; import * as UrlUtils from "utils/ApiPathConst"; import * as DateUtils from "utils/DateUtils"; - import { useIntl} from "react-intl"; // ==============================|| DASHBOARD - DEFAULT ||============================== // @@ -34,7 +34,8 @@ const SearchDemandNoteForm = () => { {locale === 'en' ?item.subjectEng:locale === 'zh-HK' ?item.subjectCht:item.subjectChs} {DateUtils.datetimeStr(item.announceDate)} - {locale === 'en' ?item.contentEng:locale === 'zh-HK' ?item.contentCht:item.contentChs} + {locale === 'en' ?item.contentEng:locale === 'zh-HK' ?item.contentCht:item.contentChs} + ) }); @@ -58,7 +59,7 @@ const SearchDemandNoteForm = () => { content={false} sx={{ backgroundColor: '#fff' }} > - + {itemList} From 64e870d40f70965acda8eb6afad498ce63d058c7 Mon Sep 17 00:00:00 2001 From: anna Date: Fri, 16 Feb 2024 17:31:42 +0800 Subject: [PATCH 06/21] public search announcement --- .../Announcement/Search_Public/DataGrid.js | 77 +++++++++ .../Announcement/Search_Public/SearchForm.js | 158 ++++++++++++++++++ src/pages/Announcement/Search_Public/index.js | 104 ++++++++++++ src/pages/dashboard/Public/index.js | 28 ++-- src/routes/PublicUserRoutes.js | 6 + src/translations/en.json | 3 + src/translations/zh-CN.json | 3 + src/translations/zh-HK.json | 3 + 8 files changed, 369 insertions(+), 13 deletions(-) create mode 100644 src/pages/Announcement/Search_Public/DataGrid.js create mode 100644 src/pages/Announcement/Search_Public/SearchForm.js create mode 100644 src/pages/Announcement/Search_Public/index.js diff --git a/src/pages/Announcement/Search_Public/DataGrid.js b/src/pages/Announcement/Search_Public/DataGrid.js new file mode 100644 index 0000000..aa1229d --- /dev/null +++ b/src/pages/Announcement/Search_Public/DataGrid.js @@ -0,0 +1,77 @@ +// material-ui +import * as React from 'react'; +import { + Button, +} from '@mui/material'; +import * as DateUtils from "utils/DateUtils"; +import { useNavigate } from "react-router-dom"; +import { FiDataGrid } from "components/FiDataGrid"; +import { FormattedMessage, useIntl } from "react-intl"; +// ==============================|| EVENT TABLE ||============================== // + +export default function SearchPublicNoticeTable({ recordList }) { + const [rows, setRows] = React.useState(recordList); + const navigate = useNavigate() + const intl = useIntl(); + const { locale } = intl; + + React.useEffect(() => { + setRows(recordList); + }, [recordList]); + + const handleEditClick = (params) => () => { + navigate('/setting/announcement/details/' + params.id); + }; + + + const columns = [ + { + field: 'announceDate', + headerName: , + width: 250, + cellClassName: 'announceDate', + renderCell: (params) => { + return ; + }, + }, + { + id: 'subject', + field: 'subject', + headerName: , + minWidth: 400, + renderCell: (params) => { + return <> + {locale === 'en' ?params.row.subjectEng:locale === 'zh-HK' ?params.row.subjectCht:params.row.subjectChs} + + }, + }, + { + id: 'content', + field: 'content', + headerName: , + flex:1, + minWidth: 400, + renderCell: (params) => { + return <> + {locale === 'en' ?params.row.contentEng:locale === 'zh-HK' ?params.row.contentCht:params.row.contentChs} + + } + }, + ]; + + function handleRowDoubleClick(params) { + navigate('/setting/announcement/details/' + params.id); + } + + return ( +
    + 'auto'} + onRowDoubleClick={handleRowDoubleClick} + /> +
    + ); +} diff --git a/src/pages/Announcement/Search_Public/SearchForm.js b/src/pages/Announcement/Search_Public/SearchForm.js new file mode 100644 index 0000000..f10ad95 --- /dev/null +++ b/src/pages/Announcement/Search_Public/SearchForm.js @@ -0,0 +1,158 @@ +// material-ui +import { + Button, + Grid, TextField, + 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 { ThemeProvider } from "@emotion/react"; +import { useNavigate } from "react-router-dom"; +import { PNSPS_BUTTON_THEME } from "../../../themes/buttonConst"; +import { FormattedMessage, useIntl } from "react-intl"; +// ==============================|| DASHBOARD - DEFAULT ||============================== // + + +const SearchPublicNoticeForm = ({ applySearch, searchCriteria }) => { + const navigate = useNavigate() + + const [minDate, setMinDate] = React.useState(searchCriteria.dateFrom); + const [maxDate, setMaxDate] = React.useState(searchCriteria.dateTo); + + const intl = useIntl(); + + const marginBottom = 2.5; + const { reset, register, handleSubmit } = useForm() + const onSubmit = (data) => { + const temp = { + key: data.key, + dateFrom: data.dateFrom, + dateTo: data.dateTo, + }; + applySearch(temp); + }; + + + function resetForm() { + reset(); + } + + + return ( + + +
    + + {/*row 1*/} + + + + + + {/*row 2*/} + + + + + + + + + { + setMinDate(DateUtils.dateStr(newValue)); + }} + InputLabelProps={{ + shrink: true + }} + /> + + + + + + + + { + setMaxDate(DateUtils.dateStr(newValue)); + }} + id="dateTo" + type="date" + //label={"Submit Date(To)"} + defaultValue={searchCriteria.dateTo} + /> + + + + + + + {/*last row*/} + + + + + + + + + + + + + + + +
    +
    + ); +}; + +export default SearchPublicNoticeForm; diff --git a/src/pages/Announcement/Search_Public/index.js b/src/pages/Announcement/Search_Public/index.js new file mode 100644 index 0000000..351edb5 --- /dev/null +++ b/src/pages/Announcement/Search_Public/index.js @@ -0,0 +1,104 @@ +// material-ui +import { + Grid, + Typography, + Stack +} from '@mui/material'; +import MainCard from "components/MainCard"; +import * as UrlUtils from "utils/ApiPathConst"; +import * as React from "react"; +import * as HttpUtils from "utils/HttpUtils"; +import * as DateUtils from "utils/DateUtils"; + +import Loadable from 'components/Loadable'; +const LoadingComponent = Loadable(React.lazy(() => import('pages/extra-pages/LoadingComponent'))); +const SearchForm = Loadable(React.lazy(() => import('./SearchForm'))); +const EventTable = Loadable(React.lazy(() => import('./DataGrid'))); +import titleBackgroundImg from 'assets/images/dashboard/gazette-bar.png' +import { FormattedMessage } from "react-intl"; + +const BackgroundHead = { + backgroundImage: `url(${titleBackgroundImg})`, + width: '100%', + height: '100%', + backgroundSize: 'contain', + backgroundRepeat: 'no-repeat', + backgroundColor: '#0C489E', + backgroundPosition: 'right' +} + +// ==============================|| DASHBOARD - DEFAULT ||============================== // + +const UserSearchPage_Individual = () => { + const [record, setRecord] = React.useState([]); + const [searchCriteria, setSearchCriteria] = React.useState({ + dateTo: DateUtils.dateStr(new Date()), + dateFrom: DateUtils.dateStr(new Date().setDate(new Date().getDate() - 90)), + }); + const [onReady, setOnReady] = React.useState(false); + + React.useEffect(() => { + getDataList(); + }, []); + + React.useEffect(() => { + setOnReady(true); + }, [record]); + + React.useEffect(() => { + getDataList(); + }, [searchCriteria]); + + function getDataList() { + HttpUtils.get({ + url: UrlUtils.GET_ANNOUNCE_LIST, + params: searchCriteria, + onSuccess: function (responseData) { + setRecord(responseData); + } + }); + } + + function applySearch(input) { + setSearchCriteria(input); + } + + return ( + !onReady ? + + + + + + : + + +
    + + + +
    +
    + {/*row 1*/} + + + + {/*row 2*/} + + + + + +
    + ); +} +export default UserSearchPage_Individual; diff --git a/src/pages/dashboard/Public/index.js b/src/pages/dashboard/Public/index.js index aaa3d18..7a4320c 100644 --- a/src/pages/dashboard/Public/index.js +++ b/src/pages/dashboard/Public/index.js @@ -10,7 +10,7 @@ import { } from '@mui/material'; import { isORGLoggedIn, } from "utils/Utils"; import titleBackgroundImg from 'assets/images/dashboard/gazette-bar.png' -import {FormattedMessage, useIntl} from "react-intl"; +import { FormattedMessage, useIntl } from "react-intl"; import AdsClickRoundedIcon from '@mui/icons-material/AdsClickRounded'; import * as React from "react"; import Loadable from 'components/Loadable'; @@ -51,10 +51,10 @@ const DashboardDefault = () => { + +
    {
    + +
    import('pages/User/Det const OrganizationDetailPage = Loadable(lazy(() => import('pages/Organization/DetailPage'))); const Msg_Details = Loadable(lazy(() => import('pages/Message/Details'))); const Msg_Search = Loadable(lazy(() => import('pages/Message/Search'))); +const AnnouncementSearch = Loadable(lazy(() => import('pages/Announcement/Search_Public'))); + // ==============================|| MAIN ROUTING ||============================== // @@ -130,6 +132,10 @@ const PublicDashboard = { path: '/msg/search', element: }, + { + path: '/announcement/search', + element: + }, ] }, ] diff --git a/src/translations/en.json b/src/translations/en.json index 689a55a..f4c6a1e 100644 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -401,6 +401,9 @@ "create": "Create", "confirmTo": "Confirm to ", + "content": "Content", + "subject": "Subject", + "Dashboard": "Dashboard", "event": "Event" } \ No newline at end of file diff --git a/src/translations/zh-CN.json b/src/translations/zh-CN.json index b0eeb96..2c6e178 100644 --- a/src/translations/zh-CN.json +++ b/src/translations/zh-CN.json @@ -397,6 +397,9 @@ "create": "创建", "confirmTo": "确定", + "content": "内容", + "subject": "主题", + "Dashboard": "仪表板", "event": "活动" } \ No newline at end of file diff --git a/src/translations/zh-HK.json b/src/translations/zh-HK.json index 2b2ee40..33bc175 100644 --- a/src/translations/zh-HK.json +++ b/src/translations/zh-HK.json @@ -402,6 +402,9 @@ "create": "創建", "confirmTo": "確定", + "content": "内容", + "subject": "主題", + "Dashboard": "儀表板", "event": "活動" } \ No newline at end of file From 6391f4cc98e315bc9876f1630b63ac369468da04 Mon Sep 17 00:00:00 2001 From: anna Date: Fri, 16 Feb 2024 17:34:45 +0800 Subject: [PATCH 07/21] update public announcement search --- .../Announcement/Search_Public/DataGrid.js | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/src/pages/Announcement/Search_Public/DataGrid.js b/src/pages/Announcement/Search_Public/DataGrid.js index aa1229d..0482e52 100644 --- a/src/pages/Announcement/Search_Public/DataGrid.js +++ b/src/pages/Announcement/Search_Public/DataGrid.js @@ -1,17 +1,12 @@ // material-ui import * as React from 'react'; -import { - Button, -} from '@mui/material'; import * as DateUtils from "utils/DateUtils"; -import { useNavigate } from "react-router-dom"; import { FiDataGrid } from "components/FiDataGrid"; import { FormattedMessage, useIntl } from "react-intl"; // ==============================|| EVENT TABLE ||============================== // export default function SearchPublicNoticeTable({ recordList }) { const [rows, setRows] = React.useState(recordList); - const navigate = useNavigate() const intl = useIntl(); const { locale } = intl; @@ -19,11 +14,6 @@ export default function SearchPublicNoticeTable({ recordList }) { setRows(recordList); }, [recordList]); - const handleEditClick = (params) => () => { - navigate('/setting/announcement/details/' + params.id); - }; - - const columns = [ { field: 'announceDate', @@ -31,7 +21,7 @@ export default function SearchPublicNoticeTable({ recordList }) { width: 250, cellClassName: 'announceDate', renderCell: (params) => { - return ; + return DateUtils.datetimeStr(params?.value); }, }, { @@ -59,10 +49,6 @@ export default function SearchPublicNoticeTable({ recordList }) { }, ]; - function handleRowDoubleClick(params) { - navigate('/setting/announcement/details/' + params.id); - } - return (
    'auto'} - onRowDoubleClick={handleRowDoubleClick} />
    ); From 0abe8703cb060d533fb4c864aba7a2a814016037 Mon Sep 17 00:00:00 2001 From: Alex Cheung Date: Fri, 16 Feb 2024 17:52:34 +0800 Subject: [PATCH 08/21] add holiday setting and layout --- src/layout/MainLayout/Header/index.js | 3 + src/pages/DemandNote/Create/index.js | 2 +- src/pages/DemandNote/Search/index.js | 4 +- src/pages/DemandNote/Search_Public/index.js | 2 +- src/pages/EmailTemplate/Detail_GLD/index.js | 2 +- src/pages/EmailTemplate/Search_GLD/index.js | 2 +- src/pages/GFMIS/index.js | 2 +- src/pages/Holiday/Search_GLD/DataGrid.js | 59 +++++ src/pages/Holiday/Search_GLD/SearchForm.js | 113 ++++++++++ src/pages/Holiday/Search_GLD/index.js | 208 ++++++++++++++++++ src/pages/Message/Details/index.js | 2 +- src/pages/Organization/DetailPage/index.js | 4 +- src/pages/Organization/SearchPage/index.js | 4 +- src/pages/Payment/Card/index.js | 2 +- src/pages/Payment/Details_GLD/index.js | 2 +- src/pages/Payment/Details_Public/index.js | 2 +- src/pages/Payment/FPS/AckPage.js | 2 +- src/pages/Payment/FPS/FPS.js | 2 +- src/pages/Payment/FPS/fpscallback.js | 2 +- src/pages/Payment/PaymentCallback.js | 2 +- src/pages/Payment/Search_GLD/index.js | 2 +- src/pages/Proof/Create_FromApp/index.js | 2 +- src/pages/Proof/Payment/Pay.js | 2 +- src/pages/Proof/Payment/Pay_Creditor.js | 2 +- src/pages/Proof/Reply_GLD/index.js | 2 +- src/pages/Proof/Reply_Public/index.js | 2 +- src/pages/Proof/Search_GLD/index.js | 4 +- .../ApplyForm/PublicNoticeApplyForm.js | 2 +- src/pages/PublicNotice/ApplyForm/index.js | 2 +- src/pages/PublicNotice/ListPanel/index.js | 4 +- src/pages/PublicNotice/Search_GLD/index.js | 4 +- src/pages/Setting/SystemSetting/index.js | 2 +- src/pages/User/DetailPage/index.js | 4 +- .../User/DetailsPage_Individual/index.js | 4 +- .../User/DetailsPage_Organization/index.js | 4 +- src/pages/User/GLDUserProfile/index.js | 4 +- src/pages/User/SearchPage/index.js | 4 +- src/pages/User/SearchPage_Individual/index.js | 4 +- .../User/SearchPage_Organization/index.js | 4 +- src/pages/authentication/AuthWrapper.js | 4 +- src/pages/authentication/AuthWrapperCustom.js | 2 +- .../ForgotPassword/AfterForgotPasswordPage.js | 2 +- .../AuthCallback/ResetPasswordSuccess.js | 4 +- .../ForgotPassword/AuthCallback/index.js | 4 +- .../ForgotPassword/ForgotPasswordApplyForm.js | 2 +- .../authentication/ForgotPassword/index.js | 2 +- .../ForgotUsername/AfterForgotPasswordPage.js | 2 +- .../AuthCallback/ResetPasswordSuccess.js | 4 +- .../ForgotUsername/AuthCallback/index.js | 4 +- .../ForgotUsername/ForgotUsernameApplyForm.js | 2 +- .../authentication/ForgotUsername/index.js | 2 +- src/pages/authentication/Verify.js | 2 +- src/pages/dashboard/GLD/index.js | 2 +- src/pages/dashboard/Public/index.js | 2 +- src/pages/iAmSmart/AuthCallback/index.js | 2 +- .../iAmSmart/DirectLoginCallback/index.js | 2 +- src/pages/iAmSmart/FailCallback/index.js | 2 +- src/pages/iAmSmart/RegistryCallback/index.js | 2 +- src/pages/iAmSmart/SuccessCallback/index.js | 2 +- src/pages/pnspsUserGroupDetailPage/index.js | 2 +- src/pages/pnspsUserGroupSearchPage/index.js | 4 +- src/routes/SettingRoutes.js | 5 + src/utils/ApiPathConst.js | 6 +- src/utils/DateUtils.js | 4 + 64 files changed, 473 insertions(+), 77 deletions(-) create mode 100644 src/pages/Holiday/Search_GLD/DataGrid.js create mode 100644 src/pages/Holiday/Search_GLD/SearchForm.js create mode 100644 src/pages/Holiday/Search_GLD/index.js diff --git a/src/layout/MainLayout/Header/index.js b/src/layout/MainLayout/Header/index.js index 7a33057..910da40 100644 --- a/src/layout/MainLayout/Header/index.js +++ b/src/layout/MainLayout/Header/index.js @@ -146,6 +146,9 @@ function Header(props) {
  • System Setting
  • +
  • + Holiday Setting +
  • diff --git a/src/pages/DemandNote/Create/index.js b/src/pages/DemandNote/Create/index.js index e35b484..d22572c 100644 --- a/src/pages/DemandNote/Create/index.js +++ b/src/pages/DemandNote/Create/index.js @@ -80,7 +80,7 @@ const Index = () => { !onReady ? : - +
    diff --git a/src/pages/DemandNote/Search/index.js b/src/pages/DemandNote/Search/index.js index abd80f0..a0355bd 100644 --- a/src/pages/DemandNote/Search/index.js +++ b/src/pages/DemandNote/Search/index.js @@ -92,13 +92,13 @@ const UserSearchPage_Individual = () => { return ( !onReady ? - + : - +
    diff --git a/src/pages/DemandNote/Search_Public/index.js b/src/pages/DemandNote/Search_Public/index.js index 18c185c..d89b1ea 100644 --- a/src/pages/DemandNote/Search_Public/index.js +++ b/src/pages/DemandNote/Search_Public/index.js @@ -92,7 +92,7 @@ const UserSearchPage_Individual = () => { return ( !onReady ? - + diff --git a/src/pages/EmailTemplate/Detail_GLD/index.js b/src/pages/EmailTemplate/Detail_GLD/index.js index 8e03f5b..3117350 100644 --- a/src/pages/EmailTemplate/Detail_GLD/index.js +++ b/src/pages/EmailTemplate/Detail_GLD/index.js @@ -117,7 +117,7 @@ const Index = () => { return ( !onReady ? - + diff --git a/src/pages/EmailTemplate/Search_GLD/index.js b/src/pages/EmailTemplate/Search_GLD/index.js index 4358b7b..0b41928 100644 --- a/src/pages/EmailTemplate/Search_GLD/index.js +++ b/src/pages/EmailTemplate/Search_GLD/index.js @@ -55,7 +55,7 @@ const Index = () => { return ( !onReady ? - + diff --git a/src/pages/GFMIS/index.js b/src/pages/GFMIS/index.js index 8a59eea..4a96416 100644 --- a/src/pages/GFMIS/index.js +++ b/src/pages/GFMIS/index.js @@ -123,7 +123,7 @@ const Index = () => { !onReady ? : - +
    diff --git a/src/pages/Holiday/Search_GLD/DataGrid.js b/src/pages/Holiday/Search_GLD/DataGrid.js new file mode 100644 index 0000000..79873f0 --- /dev/null +++ b/src/pages/Holiday/Search_GLD/DataGrid.js @@ -0,0 +1,59 @@ +// material-ui +import * as React from 'react'; +// import { GridActionsCellItem, } from "@mui/x-data-grid"; +import { FiDataGrid } from "components/FiDataGrid"; +// import EditIcon from '@mui/icons-material/Edit'; +import { useEffect } from "react"; +import { dateStr } from "utils/DateUtils"; +// import { useNavigate } from "react-router-dom"; + +// ==============================|| EVENT TABLE ||============================== // + +export default function EmailTemplateTable({ recordList }) { + const [rows, setRows] = React.useState(recordList); + + // const navigate = useNavigate() + + useEffect(() => { + setRows(recordList); + }, [recordList]); + + // const handleEditClick = (id) => () => { + // navigate('/emailTemplate/' + id); + // }; + + const columns = [ + { + id: 'holiday_DAY', + field: 'holiday_DAY', + headerName: 'Date', + flex: 4, + renderCell: (params) => { + let holiday_DAY = params.row.holiday_DAY; + return
    {dateStr(holiday_DAY)}
    + }, + }, + { + id: 'description', + field: 'description', + headerName: 'Description', + flex: 5, + }, + ]; + + // function handleRowDoubleClick(params) { + // navigate('/emailTemplate/' + params.id); + // } + + return ( +
    + 'auto'} + /> +
    + ); +} \ No newline at end of file diff --git a/src/pages/Holiday/Search_GLD/SearchForm.js b/src/pages/Holiday/Search_GLD/SearchForm.js new file mode 100644 index 0000000..693dafd --- /dev/null +++ b/src/pages/Holiday/Search_GLD/SearchForm.js @@ -0,0 +1,113 @@ +// 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 SearchPublicNoticeForm = ({ applySearch, searchCriteria }) => { + + // const [minDate, setMinDate] = React.useState(searchCriteria.dateFrom); + const [maxDate] = React.useState(searchCriteria.dateFrom); + // const [status, setStatus] = React.useState(ComboData.paymentStatus[0]); + + const { register, handleSubmit } = useForm() + + const onSubmit = (data) => { + const temp = { + // code: data.code, + // transNo: data.transNo, + dateFrom: data.dateFrom, + dateTo: data.dateTo, + // status : (status?.type && status?.type != 'all') ? status?.type : "", + }; + applySearch(temp); + }; + + + return ( + + +
    + + {/*row 1*/} + + + Date + + + {/*row 2*/} + + + + { + // setMinDate(DateUtils.dateStr(newValue)); + // }} + InputLabelProps={{ + shrink: true + }} + /> + + + + {/* { + setMaxDate(DateUtils.dateStr(newValue)); + }} + id="dateTo" + type="date" + label="To" + defaultValue={searchCriteria.dateTo} + /> */} + + + {/* + */} + + + + + + + + + +
    +
    + ); +}; + +export default SearchPublicNoticeForm; diff --git a/src/pages/Holiday/Search_GLD/index.js b/src/pages/Holiday/Search_GLD/index.js new file mode 100644 index 0000000..37173c5 --- /dev/null +++ b/src/pages/Holiday/Search_GLD/index.js @@ -0,0 +1,208 @@ +// material-ui +import { + Grid, + Typography, + Stack, + Button, + Dialog, DialogTitle, DialogContent, DialogActions, +} from '@mui/material'; +import * as UrlUtils from "utils/ApiPathConst"; +import * as React from "react"; +import * as HttpUtils from "utils/HttpUtils"; + +import Loadable from 'components/Loadable'; +const LoadingComponent = Loadable(React.lazy(() => import('pages/extra-pages/LoadingComponent'))); +const HolidayTable = Loadable(React.lazy(() => import('pages/Holiday/Search_GLD/DataGrid'))) +import titleBackgroundImg from 'assets/images/dashboard/gazette-bar.png' +// import AddCircleOutlineIcon from '@mui/icons-material/AddCircleOutline'; +import MainCard from 'components/MainCard'; +const SearchForm = Loadable(React.lazy(() => import('./SearchForm'))); + +const BackgroundHead = { + backgroundImage: `url(${titleBackgroundImg})`, + width: '100%', + height: '100%', + backgroundSize: 'contain', + backgroundRepeat: 'no-repeat', + backgroundColor: '#0C489E', + backgroundPosition: 'right' +} +// import { useNavigate } from "react-router"; +import {PNSPS_LONG_BUTTON_THEME} from "themes/buttonConst"; +import {ThemeProvider} from "@emotion/react"; +import { dateStr_Year } from "utils/DateUtils"; +import { notifySaveSuccess } from 'utils/CommonFunction'; + +// ==============================|| DASHBOARD - DEFAULT ||============================== // + +const Index = () => { + + const [record, setRecord] = React.useState([]); + const [onReady, setOnReady] = React.useState(false); + // const navigate = useNavigate() + const [searchCriteria, setSearchCriteria] = React.useState({ + dateFrom: dateStr_Year(new Date()), + // dateFrom: DateUtils.dateStr(new Date().setDate(new Date().getDate()-14)), + }); + const [attachments, setAttachments] = React.useState([]); + const [wait, setWait] = React.useState(false); + const [isWarningPopUp, setIsWarningPopUp] = React.useState(false); + const [warningText, setWarningText] = React.useState(""); + + React.useLayoutEffect(() => { + loadForm(); + }, []); + + React.useLayoutEffect(() => { + setOnReady(true); + }, [record]); + + const loadForm = () => { + HttpUtils.get({ + url: UrlUtils.GET_HOLIDAY, + onSuccess: (responseData) => { + console.log(dateStr_Year(new Date())) + setRecord(responseData); + } + }); + } + + function applySearch(input) { + setSearchCriteria(input); + } + + React.useEffect(() => { + if (!attachments || attachments.length <= 0) { + setAttachments([]); + return; + } + importHoliday(); + }, [attachments]); + + const readFile = (event) => { + let file = event.target.files[0]; + if (file) { + if (!file.name.toLowerCase().substr(file.name.length - 5).includes(".xlsx")) { + setWarningText("Please upload a valid file (File format: .xlsx)."); + setIsWarningPopUp(true); + document.getElementById("uploadFileBtn").value = ""; + return; + } + file['id'] = attachments.length; + setAttachments([ + ...attachments, + file + ]); + document.getElementById("uploadFileBtn").value = ""; + } + } + + const importHoliday = () => { + setWait(true); + if (!attachments || attachments.length <= 0) { + setWarningText("Please upload file."); + setSaving(false); + return; + } + HttpUtils.postWithFiles({ + url: UrlUtils.POST_HOLIDAY, + files: attachments, + onSuccess: () => { + notifySaveSuccess() + setWait(false); + setAttachments([]); + loadForm(); + } + }); + } + + return ( + !onReady ? + + + + + + : + ( + + +
    + + Holiday Setting + +
    +
    + + + + { + readFile(event) + }} + /> + + + + + {/*row 1*/} + + + + {/*row 2*/} + + + + + +
    + setIsWarningPopUp(false)} + PaperProps={{ + sx: { + minWidth: '40vw', + maxWidth: { xs: '90vw', s: '90vw', m: '70vw', lg: '70vw' }, + maxHeight: { xs: '90vh', s: '70vh', m: '70vh', lg: '60vh' } + } + }} + > + Warning + + {warningText} + + + + + +
    +
    + ) + ); +}; + +export default Index; \ No newline at end of file diff --git a/src/pages/Message/Details/index.js b/src/pages/Message/Details/index.js index 29a65a2..e7eadeb 100644 --- a/src/pages/Message/Details/index.js +++ b/src/pages/Message/Details/index.js @@ -61,7 +61,7 @@ const Index = () => { return ( !onReady ? - + diff --git a/src/pages/Organization/DetailPage/index.js b/src/pages/Organization/DetailPage/index.js index 5d7ee4f..efed39c 100644 --- a/src/pages/Organization/DetailPage/index.js +++ b/src/pages/Organization/DetailPage/index.js @@ -124,13 +124,13 @@ const OrganizationDetailPage = () => { return ( isLoading ? - + : - +
    diff --git a/src/pages/Organization/SearchPage/index.js b/src/pages/Organization/SearchPage/index.js index 9969b27..5ec67e8 100644 --- a/src/pages/Organization/SearchPage/index.js +++ b/src/pages/Organization/SearchPage/index.js @@ -65,13 +65,13 @@ const OrganizationSearchPage = () => { return ( !onReady ? - + : - +
    diff --git a/src/pages/Payment/Card/index.js b/src/pages/Payment/Card/index.js index be8249d..9900418 100644 --- a/src/pages/Payment/Card/index.js +++ b/src/pages/Payment/Card/index.js @@ -125,7 +125,7 @@ const Index = () => { return ( !onReady ? - + diff --git a/src/pages/Payment/Details_GLD/index.js b/src/pages/Payment/Details_GLD/index.js index f4f36c3..302b87c 100644 --- a/src/pages/Payment/Details_GLD/index.js +++ b/src/pages/Payment/Details_GLD/index.js @@ -79,7 +79,7 @@ const Index = () => { return ( !onReady ? - + diff --git a/src/pages/Payment/Details_Public/index.js b/src/pages/Payment/Details_Public/index.js index ca4d4b6..96ee14d 100644 --- a/src/pages/Payment/Details_Public/index.js +++ b/src/pages/Payment/Details_Public/index.js @@ -92,7 +92,7 @@ const Index = () => { return ( !onReady ? - + diff --git a/src/pages/Payment/FPS/AckPage.js b/src/pages/Payment/FPS/AckPage.js index 6281fb8..17cefe5 100644 --- a/src/pages/Payment/FPS/AckPage.js +++ b/src/pages/Payment/FPS/AckPage.js @@ -149,7 +149,7 @@ const AckPage = () => { return ( !onReady ? - + diff --git a/src/pages/Payment/FPS/FPS.js b/src/pages/Payment/FPS/FPS.js index a2d3bce..692ee73 100644 --- a/src/pages/Payment/FPS/FPS.js +++ b/src/pages/Payment/FPS/FPS.js @@ -273,7 +273,7 @@ const Index = () => { return ( !onReady ? - + diff --git a/src/pages/Payment/FPS/fpscallback.js b/src/pages/Payment/FPS/fpscallback.js index 61bce13..d721243 100644 --- a/src/pages/Payment/FPS/fpscallback.js +++ b/src/pages/Payment/FPS/fpscallback.js @@ -139,7 +139,7 @@ const Fpscallback = () => { } return ( !onReady ? - + diff --git a/src/pages/Payment/PaymentCallback.js b/src/pages/Payment/PaymentCallback.js index 283297a..f3b2c74 100644 --- a/src/pages/Payment/PaymentCallback.js +++ b/src/pages/Payment/PaymentCallback.js @@ -151,7 +151,7 @@ const Index = () => { return ( !onReady ? - + diff --git a/src/pages/Payment/Search_GLD/index.js b/src/pages/Payment/Search_GLD/index.js index a63903d..64860d0 100644 --- a/src/pages/Payment/Search_GLD/index.js +++ b/src/pages/Payment/Search_GLD/index.js @@ -64,7 +64,7 @@ const Index = () => { !onReady ? : - +
    diff --git a/src/pages/Proof/Create_FromApp/index.js b/src/pages/Proof/Create_FromApp/index.js index 02be45a..ab5910b 100644 --- a/src/pages/Proof/Create_FromApp/index.js +++ b/src/pages/Proof/Create_FromApp/index.js @@ -69,7 +69,7 @@ const Index = () => { return ( !onReady ? - + diff --git a/src/pages/Proof/Payment/Pay.js b/src/pages/Proof/Payment/Pay.js index 9d19ec2..9d483d1 100644 --- a/src/pages/Proof/Payment/Pay.js +++ b/src/pages/Proof/Payment/Pay.js @@ -80,7 +80,7 @@ const Index = () => { return ( !onReady ? - + diff --git a/src/pages/Proof/Payment/Pay_Creditor.js b/src/pages/Proof/Payment/Pay_Creditor.js index 94998cf..8b7cef0 100644 --- a/src/pages/Proof/Payment/Pay_Creditor.js +++ b/src/pages/Proof/Payment/Pay_Creditor.js @@ -60,7 +60,7 @@ const Index = () => { return ( !onReady ? - + diff --git a/src/pages/Proof/Reply_GLD/index.js b/src/pages/Proof/Reply_GLD/index.js index 6a2d44b..160954e 100644 --- a/src/pages/Proof/Reply_GLD/index.js +++ b/src/pages/Proof/Reply_GLD/index.js @@ -112,7 +112,7 @@ const Index = () => { return ( !onReady ? - + diff --git a/src/pages/Proof/Reply_Public/index.js b/src/pages/Proof/Reply_Public/index.js index 0e9c584..ee00046 100644 --- a/src/pages/Proof/Reply_Public/index.js +++ b/src/pages/Proof/Reply_Public/index.js @@ -81,7 +81,7 @@ const Index = () => { return ( !onReady ? - + diff --git a/src/pages/Proof/Search_GLD/index.js b/src/pages/Proof/Search_GLD/index.js index 6de5186..2e7a327 100644 --- a/src/pages/Proof/Search_GLD/index.js +++ b/src/pages/Proof/Search_GLD/index.js @@ -90,13 +90,13 @@ const UserSearchPage_Individual = () => { return ( !onReady ? - + : -
    diff --git a/src/pages/PublicNotice/ApplyForm/PublicNoticeApplyForm.js b/src/pages/PublicNotice/ApplyForm/PublicNoticeApplyForm.js index b35d0c2..65ee239 100644 --- a/src/pages/PublicNotice/ApplyForm/PublicNoticeApplyForm.js +++ b/src/pages/PublicNotice/ApplyForm/PublicNoticeApplyForm.js @@ -158,7 +158,7 @@ const PublicNoticeApplyForm = ({ loadedData, selections }) => { return ( - +
    diff --git a/src/pages/PublicNotice/ApplyForm/index.js b/src/pages/PublicNotice/ApplyForm/index.js index a2195ce..b27d688 100644 --- a/src/pages/PublicNotice/ApplyForm/index.js +++ b/src/pages/PublicNotice/ApplyForm/index.js @@ -65,7 +65,7 @@ const ApplyForm = () => { return ( isLoading ? - + diff --git a/src/pages/PublicNotice/ListPanel/index.js b/src/pages/PublicNotice/ListPanel/index.js index d0092c5..7976dd5 100644 --- a/src/pages/PublicNotice/ListPanel/index.js +++ b/src/pages/PublicNotice/ListPanel/index.js @@ -102,13 +102,13 @@ const PublicNotice = () => { return ( isLoading ? - + : - +
    diff --git a/src/pages/PublicNotice/Search_GLD/index.js b/src/pages/PublicNotice/Search_GLD/index.js index 0913814..0dc3730 100644 --- a/src/pages/PublicNotice/Search_GLD/index.js +++ b/src/pages/PublicNotice/Search_GLD/index.js @@ -90,13 +90,13 @@ const UserSearchPage_Individual = () => { return ( !onReady ? - + : - +
    diff --git a/src/pages/Setting/SystemSetting/index.js b/src/pages/Setting/SystemSetting/index.js index 016e401..3ba0987 100644 --- a/src/pages/Setting/SystemSetting/index.js +++ b/src/pages/Setting/SystemSetting/index.js @@ -69,7 +69,7 @@ const SystemSetting = () => { return ( - <> diff --git a/src/pages/User/DetailPage/index.js b/src/pages/User/DetailPage/index.js index 567f74a..e3b7bd9 100644 --- a/src/pages/User/DetailPage/index.js +++ b/src/pages/User/DetailPage/index.js @@ -202,13 +202,13 @@ const UserMaintainPage = () => { return ( !onReady ? - + : - +
    diff --git a/src/pages/User/DetailsPage_Individual/index.js b/src/pages/User/DetailsPage_Individual/index.js index 3467e48..fd8ec54 100644 --- a/src/pages/User/DetailsPage_Individual/index.js +++ b/src/pages/User/DetailsPage_Individual/index.js @@ -118,13 +118,13 @@ const UserMaintainPage_Individual = () => { return ( isLoading ? - + : - +
    diff --git a/src/pages/User/DetailsPage_Organization/index.js b/src/pages/User/DetailsPage_Organization/index.js index f226ca7..a405f9f 100644 --- a/src/pages/User/DetailsPage_Organization/index.js +++ b/src/pages/User/DetailsPage_Organization/index.js @@ -179,13 +179,13 @@ const UserMaintainPage_Organization = () => { return ( isLoading ? - + : - +
    diff --git a/src/pages/User/GLDUserProfile/index.js b/src/pages/User/GLDUserProfile/index.js index 75353ef..68893af 100644 --- a/src/pages/User/GLDUserProfile/index.js +++ b/src/pages/User/GLDUserProfile/index.js @@ -75,13 +75,13 @@ const UserMaintainPage = () => { return ( !onReady ? - + : -
    diff --git a/src/pages/User/SearchPage/index.js b/src/pages/User/SearchPage/index.js index 6d3fb7b..cda72c3 100644 --- a/src/pages/User/SearchPage/index.js +++ b/src/pages/User/SearchPage/index.js @@ -70,13 +70,13 @@ const UserSettingPage = () => { return ( !onReady ? - + : - +
    diff --git a/src/pages/User/SearchPage_Individual/index.js b/src/pages/User/SearchPage_Individual/index.js index ed9687a..44d0b30 100644 --- a/src/pages/User/SearchPage_Individual/index.js +++ b/src/pages/User/SearchPage_Individual/index.js @@ -65,13 +65,13 @@ const UserSearchPage_Individual = () => { return ( !onReady ? - + : - +
    diff --git a/src/pages/User/SearchPage_Organization/index.js b/src/pages/User/SearchPage_Organization/index.js index 7dd73ae..1730740 100644 --- a/src/pages/User/SearchPage_Organization/index.js +++ b/src/pages/User/SearchPage_Organization/index.js @@ -66,13 +66,13 @@ const UserSearchPage_Organization = () => { return ( !onReady ? - + : - +
    diff --git a/src/pages/authentication/AuthWrapper.js b/src/pages/authentication/AuthWrapper.js index ec04cfa..483b2ca 100644 --- a/src/pages/authentication/AuthWrapper.js +++ b/src/pages/authentication/AuthWrapper.js @@ -26,7 +26,7 @@ const BackgroundHead = { // ==============================|| AUTHENTICATION - WRAPPER ||============================== // const AuthWrapper = ({ children }) => ( - + {/* */} {/* banner */}
    @@ -36,7 +36,7 @@ const AuthWrapper = ({ children }) => ( justifyContent="space-between" alignItems="center" sx={{ - minHeight: '90vh' + minHeight: '87vh' }} > diff --git a/src/pages/authentication/AuthWrapperCustom.js b/src/pages/authentication/AuthWrapperCustom.js index 6070812..4783b4c 100644 --- a/src/pages/authentication/AuthWrapperCustom.js +++ b/src/pages/authentication/AuthWrapperCustom.js @@ -24,7 +24,7 @@ const AuthWrapperCustom = ({ children }) => ( justifyContent="center" alignItems="flex-start" sx={{ - minHeight: '90vh', + minHeight: '87vh', }} > {/* diff --git a/src/pages/authentication/ForgotPassword/AfterForgotPasswordPage.js b/src/pages/authentication/ForgotPassword/AfterForgotPasswordPage.js index dce2bd9..fbbe889 100644 --- a/src/pages/authentication/ForgotPassword/AfterForgotPasswordPage.js +++ b/src/pages/authentication/ForgotPassword/AfterForgotPasswordPage.js @@ -41,7 +41,7 @@ const AfterForgotPasswordPage = () => { }; return ( - +
    diff --git a/src/pages/authentication/ForgotPassword/AuthCallback/ResetPasswordSuccess.js b/src/pages/authentication/ForgotPassword/AuthCallback/ResetPasswordSuccess.js index 03bf7ea..2b81f48 100644 --- a/src/pages/authentication/ForgotPassword/AuthCallback/ResetPasswordSuccess.js +++ b/src/pages/authentication/ForgotPassword/AuthCallback/ResetPasswordSuccess.js @@ -65,13 +65,13 @@ const ResetPasswordSuccess = () => { return ( isLoading ? - + : - +
    diff --git a/src/pages/authentication/ForgotPassword/AuthCallback/index.js b/src/pages/authentication/ForgotPassword/AuthCallback/index.js index bc42a00..018ab46 100644 --- a/src/pages/authentication/ForgotPassword/AuthCallback/index.js +++ b/src/pages/authentication/ForgotPassword/AuthCallback/index.js @@ -188,13 +188,13 @@ const Index = () => { return ( isLoading || verifyState == null ? - + : - +
    diff --git a/src/pages/authentication/ForgotPassword/ForgotPasswordApplyForm.js b/src/pages/authentication/ForgotPassword/ForgotPasswordApplyForm.js index 4372701..fced818 100644 --- a/src/pages/authentication/ForgotPassword/ForgotPasswordApplyForm.js +++ b/src/pages/authentication/ForgotPassword/ForgotPasswordApplyForm.js @@ -79,7 +79,7 @@ const ForgotPasswordApplyForm = () => { }); return ( - +
    diff --git a/src/pages/authentication/ForgotPassword/index.js b/src/pages/authentication/ForgotPassword/index.js index 01aa418..5e65f0e 100644 --- a/src/pages/authentication/ForgotPassword/index.js +++ b/src/pages/authentication/ForgotPassword/index.js @@ -32,7 +32,7 @@ const ApplyForm = () => { return ( isLoading ? - + diff --git a/src/pages/authentication/ForgotUsername/AfterForgotPasswordPage.js b/src/pages/authentication/ForgotUsername/AfterForgotPasswordPage.js index dce2bd9..fbbe889 100644 --- a/src/pages/authentication/ForgotUsername/AfterForgotPasswordPage.js +++ b/src/pages/authentication/ForgotUsername/AfterForgotPasswordPage.js @@ -41,7 +41,7 @@ const AfterForgotPasswordPage = () => { }; return ( - +
    diff --git a/src/pages/authentication/ForgotUsername/AuthCallback/ResetPasswordSuccess.js b/src/pages/authentication/ForgotUsername/AuthCallback/ResetPasswordSuccess.js index 05ba6b1..148d3bd 100644 --- a/src/pages/authentication/ForgotUsername/AuthCallback/ResetPasswordSuccess.js +++ b/src/pages/authentication/ForgotUsername/AuthCallback/ResetPasswordSuccess.js @@ -77,13 +77,13 @@ const ResetPasswordSuccess = () => { return ( isLoading ? - + : - +
    diff --git a/src/pages/authentication/ForgotUsername/AuthCallback/index.js b/src/pages/authentication/ForgotUsername/AuthCallback/index.js index ea9a78c..e005113 100644 --- a/src/pages/authentication/ForgotUsername/AuthCallback/index.js +++ b/src/pages/authentication/ForgotUsername/AuthCallback/index.js @@ -188,13 +188,13 @@ const Index = () => { return ( isLoading || verifyState == null ? - + : - +
    diff --git a/src/pages/authentication/ForgotUsername/ForgotUsernameApplyForm.js b/src/pages/authentication/ForgotUsername/ForgotUsernameApplyForm.js index e768894..30d3f2d 100644 --- a/src/pages/authentication/ForgotUsername/ForgotUsernameApplyForm.js +++ b/src/pages/authentication/ForgotUsername/ForgotUsernameApplyForm.js @@ -81,7 +81,7 @@ const ForgotUsernameApplyForm = () => { }); return ( - +
    diff --git a/src/pages/authentication/ForgotUsername/index.js b/src/pages/authentication/ForgotUsername/index.js index 5467959..f123c8f 100644 --- a/src/pages/authentication/ForgotUsername/index.js +++ b/src/pages/authentication/ForgotUsername/index.js @@ -32,7 +32,7 @@ const ApplyForm = () => { return ( isLoading ? - + diff --git a/src/pages/authentication/Verify.js b/src/pages/authentication/Verify.js index f141630..c332dd9 100644 --- a/src/pages/authentication/Verify.js +++ b/src/pages/authentication/Verify.js @@ -56,7 +56,7 @@ export default function Verify() { {isLoading || verifyState == null ? - + diff --git a/src/pages/dashboard/GLD/index.js b/src/pages/dashboard/GLD/index.js index 4d6443f..9d60aac 100644 --- a/src/pages/dashboard/GLD/index.js +++ b/src/pages/dashboard/GLD/index.js @@ -21,7 +21,7 @@ const DashboardDefault = () => { backgroundPosition: 'right' } return ( - +
    diff --git a/src/pages/dashboard/Public/index.js b/src/pages/dashboard/Public/index.js index aaa3d18..d6b2a5b 100644 --- a/src/pages/dashboard/Public/index.js +++ b/src/pages/dashboard/Public/index.js @@ -36,7 +36,7 @@ const DashboardDefault = () => { backgroundPosition: 'right' } return ( - +
    diff --git a/src/pages/iAmSmart/AuthCallback/index.js b/src/pages/iAmSmart/AuthCallback/index.js index bffcef8..91c1f9f 100644 --- a/src/pages/iAmSmart/AuthCallback/index.js +++ b/src/pages/iAmSmart/AuthCallback/index.js @@ -81,7 +81,7 @@ const Index = () => { } return ( - + diff --git a/src/pages/iAmSmart/DirectLoginCallback/index.js b/src/pages/iAmSmart/DirectLoginCallback/index.js index e7e3227..1223c82 100644 --- a/src/pages/iAmSmart/DirectLoginCallback/index.js +++ b/src/pages/iAmSmart/DirectLoginCallback/index.js @@ -66,7 +66,7 @@ const Index = () => { } return ( - + diff --git a/src/pages/iAmSmart/FailCallback/index.js b/src/pages/iAmSmart/FailCallback/index.js index aec67f7..0fe09dc 100644 --- a/src/pages/iAmSmart/FailCallback/index.js +++ b/src/pages/iAmSmart/FailCallback/index.js @@ -24,7 +24,7 @@ const Index = () => { return ( !onReady ? - + diff --git a/src/pages/iAmSmart/RegistryCallback/index.js b/src/pages/iAmSmart/RegistryCallback/index.js index a489d7b..362ef9b 100644 --- a/src/pages/iAmSmart/RegistryCallback/index.js +++ b/src/pages/iAmSmart/RegistryCallback/index.js @@ -46,7 +46,7 @@ const Index = () => { } return ( - + diff --git a/src/pages/iAmSmart/SuccessCallback/index.js b/src/pages/iAmSmart/SuccessCallback/index.js index 1273659..07bbb7c 100644 --- a/src/pages/iAmSmart/SuccessCallback/index.js +++ b/src/pages/iAmSmart/SuccessCallback/index.js @@ -32,7 +32,7 @@ const Index = () => { return ( !onReady ? - + diff --git a/src/pages/pnspsUserGroupDetailPage/index.js b/src/pages/pnspsUserGroupDetailPage/index.js index cfb6bb3..cc625d1 100644 --- a/src/pages/pnspsUserGroupDetailPage/index.js +++ b/src/pages/pnspsUserGroupDetailPage/index.js @@ -167,7 +167,7 @@ const UserMaintainPage = () => { return ( !onReady ? - + diff --git a/src/pages/pnspsUserGroupSearchPage/index.js b/src/pages/pnspsUserGroupSearchPage/index.js index b045aca..0d3a700 100644 --- a/src/pages/pnspsUserGroupSearchPage/index.js +++ b/src/pages/pnspsUserGroupSearchPage/index.js @@ -73,13 +73,13 @@ const UserGroupSearchPanel = () => { return ( !onReady ? - + : - +
    diff --git a/src/routes/SettingRoutes.js b/src/routes/SettingRoutes.js index 6cf81c8..fd3afe3 100644 --- a/src/routes/SettingRoutes.js +++ b/src/routes/SettingRoutes.js @@ -22,6 +22,7 @@ const OrganizationDetailPage = Loadable(lazy(() => import('pages/Organization/De const OrganizationDetailPage_fromUser = Loadable(lazy(() => import('pages/Organization/DetailPage_FromUser'))); const EmailTemplatePage = Loadable(lazy(() => import('pages/EmailTemplate/Search_GLD'))); const EmailTemplateDetailPage = Loadable(lazy(() => import('pages/EmailTemplate/Detail_GLD'))); +const HolidayPage = Loadable(lazy(() => import('pages/Holiday/Search_GLD'))); // ==============================|| AUTH ROUTING ||============================== // @@ -90,6 +91,10 @@ const SettingRoutes = { path: '/emailTemplate/:id', element: }, + { + path: 'holiday', + element: + }, ] }; diff --git a/src/utils/ApiPathConst.js b/src/utils/ApiPathConst.js index 17e98f6..644f16d 100644 --- a/src/utils/ApiPathConst.js +++ b/src/utils/ApiPathConst.js @@ -162,4 +162,8 @@ 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 \ No newline at end of file +export const GEN_GFMIS_XML = apiPath+'/gfmis'; //GET + +//Holiday +export const GET_HOLIDAY = apiPath+'/holiday/list'; //GET +export const POST_HOLIDAY = apiPath+'/holiday/import'; //POST \ No newline at end of file diff --git a/src/utils/DateUtils.js b/src/utils/DateUtils.js index 03ca962..43771f0 100644 --- a/src/utils/DateUtils.js +++ b/src/utils/DateUtils.js @@ -9,6 +9,10 @@ export const dateStr = (date) =>{ return dateFormat(date,"YYYY-MM-DD") }; +export const dateStr_Year = (date) =>{ + return dateFormat(date,'YYYY') +}; + export const datetimeStr_Cht = (date) =>{ return dateFormat(date,"YYYY年MM月DD日 HH:mm:ss") }; From 1e1d2b5053750e257d914ba5ebce5e2bd474da59 Mon Sep 17 00:00:00 2001 From: Alex Cheung Date: Mon, 19 Feb 2024 13:05:56 +0800 Subject: [PATCH 09/21] set download recipt --- src/pages/Payment/FPS/AckPage.js | 8 ++++---- src/pages/Payment/PaymentCallback.js | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/pages/Payment/FPS/AckPage.js b/src/pages/Payment/FPS/AckPage.js index 17cefe5..ac6d04e 100644 --- a/src/pages/Payment/FPS/AckPage.js +++ b/src/pages/Payment/FPS/AckPage.js @@ -44,7 +44,7 @@ const AckPage = () => { const [paymentData, setPaymentData] = React.useState({}); const [responeData, setResponeDataData] = React.useState({}); const [itemList, setItemList] = React.useState([]); - const [paymentId, setPaymentId] = React.useState(""); + // const [paymentId, setPaymentId] = React.useState(""); const [transactionData, setTransactionData] = React.useState({}); // const [transactionDate, setTransactionDate] = React.useState(""); @@ -110,8 +110,8 @@ const AckPage = () => { responseData2.data["transTimeStr"] = DateUtils.dateFormat(responseData2.data.transDateTime, "HH:mm:ss"); setItemList(responseData2.paymentItemList) setPaymentData(responseData2.data); - localStorage.removeItem("paymentId"); - setPaymentId(responseData2.id) + // localStorage.removeItem("paymentId"); + // setPaymentId(responseData2.id) } }); } @@ -143,7 +143,7 @@ const AckPage = () => { const doPrint = () => { // window.print(); HttpUtils.fileDownload({ - url: UrlUtils.GEN_PAYMENT_RECEIPT+"/"+paymentId, + url: UrlUtils.GEN_PAYMENT_RECEIPT+"/"+localStorage.getItem("paymentId"), }); }; diff --git a/src/pages/Payment/PaymentCallback.js b/src/pages/Payment/PaymentCallback.js index f3b2c74..72b93a8 100644 --- a/src/pages/Payment/PaymentCallback.js +++ b/src/pages/Payment/PaymentCallback.js @@ -39,7 +39,7 @@ const Index = () => { const [paymentData, setPaymentData] = React.useState({}); const [itemList, setItemList] = React.useState([]); - const [paymentId, setPaymentId] = React.useState(""); + // const [paymentId, setPaymentId] = React.useState(""); const [transactionData, setTransactionData] = React.useState({}); // const [transactionDate, setTransactionDate] = React.useState(""); @@ -132,8 +132,8 @@ const Index = () => { responseData2.data["transTimeStr"] = DateUtils.dateFormat(responseData2.data.transDateTime, "HH:mm:ss"); setItemList(responseData2.paymentItemList) setPaymentData(responseData2.data); - localStorage.removeItem("paymentId"); - setPaymentId(responseData2.id) + // localStorage.removeItem("paymentId"); + // setPaymentId(responseData2.id) } }); } @@ -145,7 +145,7 @@ const Index = () => { const doPrint = () => { // window.print(); HttpUtils.fileDownload({ - url: UrlUtils.GEN_PAYMENT_RECEIPT+"/"+paymentId, + url: UrlUtils.GEN_PAYMENT_RECEIPT+"/"+localStorage.getItem("paymentId"), }); }; From 352ec3b96decda79338efd77a2bf3b552d42ce73 Mon Sep 17 00:00:00 2001 From: Alex Cheung Date: Tue, 20 Feb 2024 11:23:24 +0800 Subject: [PATCH 10/21] layout update --- src/components/AutoLogoutProvider.js | 4 +- src/index.js | 6 +- .../UserInformationCard_Organization_Pub.js | 96 +++++++++---------- .../User/DetailsPage_Organization/index.js | 2 +- .../authentication/auth-forms/AuthLogin.js | 8 +- .../auth-forms/AuthLoginCustom.js | 40 ++++---- src/utils/FieldUtils.js | 32 ++++--- 7 files changed, 99 insertions(+), 89 deletions(-) diff --git a/src/components/AutoLogoutProvider.js b/src/components/AutoLogoutProvider.js index 27ccd6b..817baf9 100644 --- a/src/components/AutoLogoutProvider.js +++ b/src/components/AutoLogoutProvider.js @@ -56,10 +56,10 @@ const AutoLogoutProvider = ({ children }) => { //TODO: get auto logout time here if(isGLDLoggedIn()){ setLogoutInterval(240); - console.log("Set Logout Interval: 240") + // console.log("Set Logout Interval: 240") }else{ setLogoutInterval(60); - console.log("Set Logout Interval: 60") + // console.log("Set Logout Interval: 60") } // axios.get(`${apiPath}${GET_IDLE_LOGOUT_TIME}`, // ) diff --git a/src/index.js b/src/index.js index c58b3ca..ee0bb28 100644 --- a/src/index.js +++ b/src/index.js @@ -16,9 +16,9 @@ import 'assets/third-party/apex-chart.css'; import App from './App'; import { store } from 'store'; import reportWebVitals from './reportWebVitals'; -import {I18nProvider} from "./components/I18nProvider"; -import {AutoLogoutProvider} from "./components/AutoLogoutProvider"; -import {RefreshTokenProvider} from "./components/RefreshTokenProvider"; +import {I18nProvider} from "components/I18nProvider"; +import {AutoLogoutProvider} from "components/AutoLogoutProvider"; +import {RefreshTokenProvider} from "components/RefreshTokenProvider"; // ==============================|| MAIN - REACT DOM RENDER ||============================== // diff --git a/src/pages/User/DetailsPage_Organization/UserInformationCard_Organization_Pub.js b/src/pages/User/DetailsPage_Organization/UserInformationCard_Organization_Pub.js index ed94098..7b8b7a4 100644 --- a/src/pages/User/DetailsPage_Organization/UserInformationCard_Organization_Pub.js +++ b/src/pages/User/DetailsPage_Organization/UserInformationCard_Organization_Pub.js @@ -43,7 +43,7 @@ const UserInformationCard_Organization_Pub = ({ userData, loadDataFun,}) => { // console.log(currentApplicationDetailData) if (Object.keys(currentUserData).length > 0) { setOnReady(true); - console.log(currentUserData) + // console.log(currentUserData) } }, [currentUserData]); @@ -59,7 +59,7 @@ const UserInformationCard_Organization_Pub = ({ userData, loadDataFun,}) => { phoneNumber: yup.string().min(8, displayErrorMsg(intl.formatMessage({id: 'require8Number'}))).required(displayErrorMsg(intl.formatMessage({id: 'requireContactNumber'}))), }), onSubmit: (values) => { - console.log(values); + // console.log(values); HttpUtils.post({ url: UrlUtils.POST_PUB_ORG_USER, params: { @@ -105,50 +105,48 @@ const UserInformationCard_Organization_Pub = ({ userData, loadDataFun,}) => {
    {/*top button*/} - - - {editMode ? - <> - - - - - - - - - - : - <> - - - - - - - } + + + + {editMode ? + + + + + + + + + : + + + + + + } + {/*end top button*/} @@ -157,7 +155,7 @@ const UserInformationCard_Organization_Pub = ({ userData, loadDataFun,}) => { - + {FieldUtils.getTextField({ label: intl.formatMessage({id: 'userLoginName'}) + ":", valueName: "username", @@ -166,7 +164,7 @@ const UserInformationCard_Organization_Pub = ({ userData, loadDataFun,}) => { })} - + {FieldUtils.getTextField({ label: intl.formatMessage({id: 'userContactName'}) + ":", valueName: "contactPerson", @@ -175,7 +173,7 @@ const UserInformationCard_Organization_Pub = ({ userData, loadDataFun,}) => { })} - + {FieldUtils.getTextField({ label: intl.formatMessage({id: 'userContactEmail'}) + ":", valueName: "emailBus", @@ -184,7 +182,7 @@ const UserInformationCard_Organization_Pub = ({ userData, loadDataFun,}) => { })} - + {FieldUtils.getPhoneField({ label: intl.formatMessage({id: 'userContactNumber'}) + ":", valueName: { @@ -196,7 +194,7 @@ const UserInformationCard_Organization_Pub = ({ userData, loadDataFun,}) => { })} - + {FieldUtils.getTextField({ label: intl.formatMessage({id: 'primaryUser'}) + ":", valueName: "primaryUser", diff --git a/src/pages/User/DetailsPage_Organization/index.js b/src/pages/User/DetailsPage_Organization/index.js index a405f9f..4cc506b 100644 --- a/src/pages/User/DetailsPage_Organization/index.js +++ b/src/pages/User/DetailsPage_Organization/index.js @@ -166,7 +166,7 @@ const UserMaintainPage_Organization = () => { //response.data["orgId"] = response.data.brExpiryDate?DateUtils.dateStr(response.data.brExpiryDate):""; setUserData(response.data); setOrgData(response.orgList); - console.log(response.data) + // console.log(response.data) } }); } diff --git a/src/pages/authentication/auth-forms/AuthLogin.js b/src/pages/authentication/auth-forms/AuthLogin.js index 4eb1de5..b231bf4 100644 --- a/src/pages/authentication/auth-forms/AuthLogin.js +++ b/src/pages/authentication/auth-forms/AuthLogin.js @@ -1,4 +1,6 @@ -import React, {useContext, useEffect, useState} from 'react'; +import React, { + // useContext, + useEffect, useState} from 'react'; import {useNavigate} from 'react-router-dom'; // material-ui @@ -34,9 +36,9 @@ import { EyeOutlined, EyeInvisibleOutlined } from '@ant-design/icons'; import axios from "axios"; import {useDispatch} from "react-redux"; import {handleLogin} from "auth/index"; -import { notifyActionSuccess } from 'utils/CommonFunction'; +// import { notifyActionSuccess } from 'utils/CommonFunction'; import {FormattedMessage} from "react-intl"; -import LocaleContext from "../../../components/I18nProvider"; +// import LocaleContext from "../../../components/I18nProvider"; // ============================|| FIREBASE - LOGIN ||============================ // const AuthLogin = () => { diff --git a/src/pages/authentication/auth-forms/AuthLoginCustom.js b/src/pages/authentication/auth-forms/AuthLoginCustom.js index c5c226e..3afe339 100644 --- a/src/pages/authentication/auth-forms/AuthLoginCustom.js +++ b/src/pages/authentication/auth-forms/AuthLoginCustom.js @@ -47,6 +47,8 @@ import useJwt from "auth/jwt/useJwt"; import { handleLogoutFunction } from 'auth/index'; import {FormattedMessage, useIntl} from "react-intl"; // import LocaleContext from "components/I18nProvider"; +const LoadingComponent = Loadable(React.lazy(() => import('pages/extra-pages/LoadingComponent'))); + // ============================|| FIREBASE - LOGIN ||============================ // const AuthLoginCustom = () => { @@ -66,6 +68,7 @@ const AuthLoginCustom = () => { const [open, setOpen] = React.useState(false); const [isButtonDisabled, setIsButtonDisabled] = useState(true); const [errorMassage, setErrorMassage] = useState(''); + const [onLogin, setOnLogin] = useState(false); const handleMouseDownPassword = (event) => { event.preventDefault(); @@ -74,7 +77,7 @@ const AuthLoginCustom = () => { const tryLogin = () => { if (isValid) { dispatch(handleLogoutFunction()); - // setSumitting(true) + setOnLogin(true) useJwt .login({ username: values.username, password: values.password }) .then((response) => { @@ -114,8 +117,7 @@ const AuthLoginCustom = () => { }) .catch((error) => { // setSuccess(false) - console.error(error) - console.error(error.response.data.error) + setOnLogin(false) setErrorMassage(error.response.data.error) setOpen(true) }); @@ -323,20 +325,24 @@ const AuthLoginCustom = () => { - + {onLogin? + + : + + } diff --git a/src/utils/FieldUtils.js b/src/utils/FieldUtils.js index 5e08b63..d5dd1b4 100644 --- a/src/utils/FieldUtils.js +++ b/src/utils/FieldUtils.js @@ -27,25 +27,29 @@ export const getDateField = ({ label, valueName, form, disabled }) => { } export const getTextField = ({ label, valueName, form, disabled }) => { - return - - {label} - - - {initField({ - type: "text", - valueName: valueName, - form: form, - disabled: disabled - })} + return + + + + {label} + + + {initField({ + type: "text", + valueName: valueName, + form: form, + disabled: disabled + })} + + ; } export const getTextArea = ({ label, valueName, form, disabled, inputProps, ...props }) => { return - {label} @@ -73,7 +77,7 @@ export const getTextArea = ({ label, valueName, form, disabled, inputProps, ...p export const getPhoneField = ({ label, valueName, form, disabled }) => { return - {label} From 2d24120894fd187f0b7e61fadc1122b251c4e267 Mon Sep 17 00:00:00 2001 From: Alex Cheung Date: Tue, 20 Feb 2024 18:01:51 +0800 Subject: [PATCH 11/21] fix holiday with year selected --- src/layout/MainLayout/Header/index.js | 2 +- src/pages/Holiday/Search_GLD/DataGrid.js | 17 ++--- src/pages/Holiday/Search_GLD/SearchForm.js | 78 +++++++++++++--------- src/pages/Holiday/Search_GLD/index.js | 45 +++++++++---- src/utils/ApiPathConst.js | 3 +- 5 files changed, 90 insertions(+), 55 deletions(-) diff --git a/src/layout/MainLayout/Header/index.js b/src/layout/MainLayout/Header/index.js index 6b107ee..ea6c01e 100644 --- a/src/layout/MainLayout/Header/index.js +++ b/src/layout/MainLayout/Header/index.js @@ -361,7 +361,7 @@ function Header(props) { alignItems="center" spacing={0} > - + { + console.log(recordList) setRows(recordList); }, [recordList]); - // const handleEditClick = (id) => () => { - // navigate('/emailTemplate/' + id); - // }; - const columns = [ { - id: 'holiday_DAY', - field: 'holiday_DAY', + id: 'HOLIDAY_DAY', + field: 'HOLIDAY_DAY', headerName: 'Date', flex: 4, renderCell: (params) => { - let holiday_DAY = params.row.holiday_DAY; - return
    {dateStr(holiday_DAY)}
    + let HOLIDAY_DAY = params.row.HOLIDAY_DAY; + return
    {dateStr(HOLIDAY_DAY)}
    }, }, { - id: 'description', - field: 'description', + id: 'DESCRIPTION', + field: 'DESCRIPTION', headerName: 'Description', flex: 5, }, diff --git a/src/pages/Holiday/Search_GLD/SearchForm.js b/src/pages/Holiday/Search_GLD/SearchForm.js index 693dafd..fcaf358 100644 --- a/src/pages/Holiday/Search_GLD/SearchForm.js +++ b/src/pages/Holiday/Search_GLD/SearchForm.js @@ -3,7 +3,7 @@ import { Button, Grid, TextField, - // Autocomplete, + Autocomplete, Typography } from '@mui/material'; import MainCard from "components/MainCard"; @@ -16,25 +16,38 @@ import {ThemeProvider} from "@emotion/react"; // ==============================|| DASHBOARD - DEFAULT ||============================== // -const SearchPublicNoticeForm = ({ applySearch, searchCriteria }) => { +const SearchPublicNoticeForm = ({ applySearch, comboData}) => { + const [selectedYear, setSelectedYear] = React.useState([]); + // const [defaultYear, setDefaultYear] = React.useState(searchCriteria.year); + const [comboList, setComboList] = React.useState([]); + // const [onReady, setOnReady] = React.useState(false); - // const [minDate, setMinDate] = React.useState(searchCriteria.dateFrom); - const [maxDate] = React.useState(searchCriteria.dateFrom); - // const [status, setStatus] = React.useState(ComboData.paymentStatus[0]); + const { + // register, + handleSubmit } = useForm() - const { register, handleSubmit } = useForm() - - const onSubmit = (data) => { - const temp = { - // code: data.code, - // transNo: data.transNo, - dateFrom: data.dateFrom, - dateTo: data.dateTo, - // status : (status?.type && status?.type != 'all') ? status?.type : "", - }; - applySearch(temp); + const onSubmit = () => { + if (selectedYear !=null){ + const temp = { + year: selectedYear.label, + }; + applySearch(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*/} - + - Date + Year {/*row 2*/} - { - // setMinDate(DateUtils.dateStr(newValue)); - // }} - InputLabelProps={{ - shrink: true + 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) => } /> diff --git a/src/pages/Holiday/Search_GLD/index.js b/src/pages/Holiday/Search_GLD/index.js index 37173c5..f650638 100644 --- a/src/pages/Holiday/Search_GLD/index.js +++ b/src/pages/Holiday/Search_GLD/index.js @@ -38,10 +38,11 @@ import { notifySaveSuccess } from 'utils/CommonFunction'; const Index = () => { const [record, setRecord] = React.useState([]); + const [comboData, setComboData] = React.useState([]); const [onReady, setOnReady] = React.useState(false); // const navigate = useNavigate() const [searchCriteria, setSearchCriteria] = React.useState({ - dateFrom: dateStr_Year(new Date()), + year: dateStr_Year(new Date()), // dateFrom: DateUtils.dateStr(new Date().setDate(new Date().getDate()-14)), }); const [attachments, setAttachments] = React.useState([]); @@ -49,20 +50,41 @@ const Index = () => { const [isWarningPopUp, setIsWarningPopUp] = React.useState(false); const [warningText, setWarningText] = React.useState(""); - React.useLayoutEffect(() => { - loadForm(); - }, []); + // React.useLayoutEffect(() => { + // loadForm(); + // }, []); React.useLayoutEffect(() => { - setOnReady(true); - }, [record]); + if (comboData && comboData.length > 0) { + setOnReady(true); + } + }, [comboData]); - const loadForm = () => { + React.useEffect(() => { + // console.log(searchCriteria) + loadForm(); + }, [searchCriteria]); + + function loadForm() { HttpUtils.get({ url: UrlUtils.GET_HOLIDAY, + params: searchCriteria, onSuccess: (responseData) => { - console.log(dateStr_Year(new Date())) + console.log(comboData) setRecord(responseData); + if (comboData.length == 0) { + loadCombo(); + } + } + }); + } + + function loadCombo() { + HttpUtils.get({ + url: UrlUtils.GET_HOLIDAY_COMBO, + onSuccess: (responseData) => { + let combo = responseData; + setComboData(combo); } }); } @@ -72,11 +94,9 @@ const Index = () => { } React.useEffect(() => { - if (!attachments || attachments.length <= 0) { - setAttachments([]); - return; + if (attachments.length > 0) { + importHoliday(); } - importHoliday(); }, [attachments]); const readFile = (event) => { @@ -166,6 +186,7 @@ const Index = () => { applySearch={applySearch} // generateXML={generateXML} searchCriteria={searchCriteria} + comboData={comboData} /> {/*row 2*/} diff --git a/src/utils/ApiPathConst.js b/src/utils/ApiPathConst.js index 040b280..bcd1daf 100644 --- a/src/utils/ApiPathConst.js +++ b/src/utils/ApiPathConst.js @@ -171,4 +171,5 @@ export const GEN_GFMIS_XML = apiPath+'/gfmis'; //GET //Holiday export const GET_HOLIDAY = apiPath+'/holiday/list'; //GET -export const POST_HOLIDAY = apiPath+'/holiday/import'; //POST \ No newline at end of file +export const POST_HOLIDAY = apiPath+'/holiday/import'; //POST +export const GET_HOLIDAY_COMBO = apiPath+'/holiday/combo'; //GET \ No newline at end of file From 5d7df5ffbdd1636dcd40a8d0e45663478c0ec012 Mon Sep 17 00:00:00 2001 From: anna Date: Thu, 22 Feb 2024 17:07:51 +0800 Subject: [PATCH 12/21] DR import --- src/layout/MainLayout/Header/index.js | 3 + src/pages/Setting/DrImport/index.js | 176 ++++++++++++++++++++++++++ src/routes/GLDUserRoutes.js | 5 + src/utils/ApiPathConst.js | 5 + src/utils/HttpUtils.js | 141 +++++++++++---------- 5 files changed, 260 insertions(+), 70 deletions(-) create mode 100644 src/pages/Setting/DrImport/index.js diff --git a/src/layout/MainLayout/Header/index.js b/src/layout/MainLayout/Header/index.js index ea6c01e..25e0d66 100644 --- a/src/layout/MainLayout/Header/index.js +++ b/src/layout/MainLayout/Header/index.js @@ -149,6 +149,9 @@ function Header(props) {
  • Holiday Setting
  • +
  • + DR Import +
  • Announcement
  • diff --git a/src/pages/Setting/DrImport/index.js b/src/pages/Setting/DrImport/index.js new file mode 100644 index 0000000..4918323 --- /dev/null +++ b/src/pages/Setting/DrImport/index.js @@ -0,0 +1,176 @@ + +import * as React from "react"; +import * as HttpUtils from "utils/HttpUtils"; +import * as UrlUtils from "utils/ApiPathConst"; + +import { + Grid, Typography, Button, + Stack, Box, + Dialog, DialogTitle, DialogContent, DialogActions, +} from '@mui/material'; +import { notifyDownloadSuccess } from 'utils/CommonFunction'; + +import { FormattedMessage, useIntl } from "react-intl"; + +import titleBackgroundImg from 'assets/images/dashboard/gazette-bar.png' + +// ==============================|| DASHBOARD - DEFAULT ||============================== // + +const Index = () => { + const [isWarningPopUp, setIsWarningPopUp] = React.useState(false); + const [warningText, setWarningText] = React.useState(""); + const [resultStr, setResultStr] = React.useState(""); + + const intl = useIntl(); + + + const BackgroundHead = { + backgroundImage: `url(${titleBackgroundImg})`, + width: 'auto', + height: 'auto', + backgroundSize: 'contain', + backgroundRepeat: 'no-repeat', + backgroundColor: '#0C489E', + backgroundPosition: 'right' + } + + + const readFile = (event) => { + let file = event.target.files[0]; + if (file) { + if (file.name.toLowerCase().substr(file.name.length - 5).includes(".xlsx") + ) { + HttpUtils.postWithFiles({ + url: UrlUtils.DR_IMPORT, + params:null, + files: [event.target.files[0]], + onSuccess: function (responData) { + if(responData?.msg){ + setResultStr(<>Error:
    {responData?.msg}) + }else if(responData?.success){ + setResultStr(<>Success
    Record Count: {responData.recordCount}) + } + } + }); + } else { + setWarningText(intl.formatMessage({ id: 'requireValidFileWithFormat' })); + setIsWarningPopUp(true); + setAttachment({}); + document.getElementById("uploadFileBtn").value = ""; + return; + } + } + document.getElementById("uploadFileBtn").value = ""; + } + + return ( + + +
    + + + DR Import + + +
    +
    + + + + + + + + + + { + readFile(event) + }} + /> + + + + + + + + + + + + + + + + + + + + Result: + + {resultStr} + + + + + + +
    + setIsWarningPopUp(false)} + PaperProps={{ + sx: { + minWidth: '40vw', + maxWidth: { xs: '90vw', s: '90vw', m: '70vw', lg: '70vw' }, + maxHeight: { xs: '90vh', s: '70vh', m: '70vh', lg: '60vh' } + } + }} + > + + Action Fail + + + {warningText} + + + + + +
    +
    + ); +}; + +export default Index; \ No newline at end of file diff --git a/src/routes/GLDUserRoutes.js b/src/routes/GLDUserRoutes.js index a2f78c8..bfc21f6 100644 --- a/src/routes/GLDUserRoutes.js +++ b/src/routes/GLDUserRoutes.js @@ -22,6 +22,7 @@ const UserMaintainPage = Loadable(lazy(() => import('pages/User/GLDUserProfile') const SystemSetting = Loadable(lazy(() => import('pages/Setting/SystemSetting'))); const AnnouncementDetails = Loadable(lazy(() => import('pages/Announcement/Details'))); const AnnouncementSearch = Loadable(lazy(() => import('pages/Announcement/Search'))); +const DrImport = Loadable(lazy(() => import('pages/Setting/DrImport'))); // ==============================|| MAIN ROUTING ||============================== // @@ -100,6 +101,10 @@ const GLDUserRoutes = { path: '/setting/announcement/details/:id', element: }, + { + path: '/setting/drImport', + element: + }, ] }, ] diff --git a/src/utils/ApiPathConst.js b/src/utils/ApiPathConst.js index bcd1daf..c44004b 100644 --- a/src/utils/ApiPathConst.js +++ b/src/utils/ApiPathConst.js @@ -67,6 +67,11 @@ export const POST_FILE_LIST = apiPath+'/file/list'; export const GET_FILE_DELETE = apiPath+'/file/delete'; //export const FILE_DOWN_GET = ({id,skey,filename})=>{ return apiPath+'/file/dl/'+id+'/'+skey+'/'+filename}; +export const DR_EXPORT = apiPath+'/settings/dr/export'; +export const DR_IMPORT = apiPath+'/settings/dr/import'; + + + // POST request //Login export const POST_LOGIN = '/login'; diff --git a/src/utils/HttpUtils.js b/src/utils/HttpUtils.js index 8209476..1c208ac 100644 --- a/src/utils/HttpUtils.js +++ b/src/utils/HttpUtils.js @@ -1,109 +1,110 @@ import axios from "axios"; -import {FILE_UP_POST, FILE_DOWN_GET} from "../utils/ApiPathConst"; +import { FILE_UP_POST, FILE_DOWN_GET } from "../utils/ApiPathConst"; -export const get = ({url, params, onSuccess, onFail, onError}) =>{ - axios.get(url,{ +export const get = ({ url, params, onSuccess, onFail, onError }) => { + axios.get(url, { params: params }).then( - (response)=>{onResponse(response, onSuccess, onFail);} + (response) => { onResponse(response, onSuccess, onFail); } ).catch(error => { - return handleError(error,onError); + return handleError(error, onError); }); }; //TODO -export const put = ({url,params, onSuccess, onFail, onError}) =>{ - axios.put(url,params).then( - (response)=>{onResponse(response, onSuccess, onFail);} +export const put = ({ url, params, onSuccess, onFail, onError }) => { + axios.put(url, params).then( + (response) => { onResponse(response, onSuccess, onFail); } ).catch(error => { - return handleError(error,onError); + return handleError(error, onError); }); }; -export const patch = ({url,params, onSuccess, onFail, onError}) =>{ - axios.patch(url,params).then( - (response)=>{onResponse(response, onSuccess, onFail);} +export const patch = ({ url, params, onSuccess, onFail, onError }) => { + axios.patch(url, params).then( + (response) => { onResponse(response, onSuccess, onFail); } ).catch(error => { - return handleError(error,onError); + return handleError(error, onError); }); }; -export const post = ({url, params, onSuccess, onFail, onError, headers}) =>{ - headers = headers?headers:{ - "Content-Type":"application/json" +export const post = ({ url, params, onSuccess, onFail, onError, headers }) => { + headers = headers ? headers : { + "Content-Type": "application/json" }; - - axios.post(url,params, + + axios.post(url, params, { - headers:headers + headers: headers }).then( - (response)=>{onResponse(response, onSuccess, onFail);} - ).catch(error => { - return handleError(error,onError); - }); + (response) => { onResponse(response, onSuccess, onFail); } + ).catch(error => { + return handleError(error, onError); + }); }; -export const postWithFiles = ({url, params, files, onSuccess, onFail, onError}) =>{ +export const postWithFiles = ({ url, params, files, onSuccess, onFail, onError }) => { var formData = new FormData(); - for (let i = 0; i < files.length; i++){ + for (let i = 0; i < files.length; i++) { const file = files[i] formData.append("multipartFileList", file); } - for (var key in params) { - if(typeof(params[key]) ==='object'){ - formData.append(key, JSON.stringify(params[key])); - }else{ - formData.append(key, params[key]); - } - } - - axios.post(url,formData, - {headers: {"Content-Type":"multipart/form-data"}}) - .then( - (response)=>{onResponse(response, onSuccess, onFail);} - ).catch(error => { - return handleError(error,onError); - }); + if (params) + for (var key in params) { + if (typeof (params[key]) === 'object') { + formData.append(key, JSON.stringify(params[key])); + } else { + formData.append(key, params[key]); + } + } + + axios.post(url, formData, + { headers: { "Content-Type": "multipart/form-data" } }) + .then( + (response) => { onResponse(response, onSuccess, onFail); } + ).catch(error => { + return handleError(error, onError); + }); }; -export const fileDownload = ({url, fileId, skey, filename, params, method, onResponse, onError}) =>{ - if(!url){ - url = FILE_DOWN_GET+"/"+fileId+"/"+skey+"/"+filename +export const fileDownload = ({ url, fileId, skey, filename, params, method, onResponse, onError }) => { + if (!url) { + url = FILE_DOWN_GET + "/" + fileId + "/" + skey + "/" + filename } - if(method == 'post'){ - axios.post( url, params, + if (method == 'post') { + axios.post(url, params, { responseType: 'blob', - headers:{ - "Content-Type":"application/json" + headers: { + "Content-Type": "application/json" } } ).then( - (response)=>{ + (response) => { fileDownloadResponse(response, onResponse) } ).catch(error => { - return handleError(error,onError); + return handleError(error, onError); }); - }else{ - axios.get( url, + } else { + axios.get(url, { responseType: 'blob', - params:params + params: params } ).then( - (response)=>{ + (response) => { fileDownloadResponse(response, onResponse) } ).catch(error => { - return handleError(error,onError); + return handleError(error, onError); }); } }; -const fileDownloadResponse=(response, onResponse)=>{ - const fn = response.headers.get("content-disposition")?.split("filename=")[1]?.split('"')[1]?.trim()??filename; +const fileDownloadResponse = (response, onResponse) => { + const fn = response.headers.get("content-disposition")?.split("filename=")[1]?.split('"')[1]?.trim() ?? filename; const url = URL.createObjectURL(response.data); const a = document.createElement('a'); a.href = url; @@ -112,47 +113,47 @@ const fileDownloadResponse=(response, onResponse)=>{ a.click(); document.body.removeChild(a); URL.revokeObjectURL(url); - if(onResponse){ + if (onResponse) { onResponse(); } } -export const fileUpload = ({refType, refId, files, refCode, onSuccess, onFail, onError}) =>{ +export const fileUpload = ({ refType, refId, files, refCode, onSuccess, onFail, onError }) => { postWithFiles({ url: FILE_UP_POST, - params:{ + params: { refType: refType, refId: refId, refCode: refCode }, files: files, onSuccess: onSuccess, - onFail:onFail, - onError:onError + onFail: onFail, + onError: onError }); }; -const onResponse= (response, onSuccess, onFail) =>{ - if (response.status >= 300 ||response.status < 200) { +const onResponse = (response, onSuccess, onFail) => { + if (response.status >= 300 || response.status < 200) { console.log("onFail"); - if(onFail){ + if (onFail) { onFail(response); - }else{ + } else { console.log(response); } return; } - - if(onSuccess){ + + if (onSuccess) { onSuccess(response?.data); } } -const handleError= (error, onError) =>{ - if(onError){ +const handleError = (error, onError) => { + if (onError) { return onError(error); - }else{ + } else { console.log(error); return false; } From 48d5594aa418901f01c70c3bde15cd8b1fec4ea4 Mon Sep 17 00:00:00 2001 From: anna Date: Thu, 22 Feb 2024 17:11:09 +0800 Subject: [PATCH 13/21] update ui --- src/pages/Setting/DrImport/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pages/Setting/DrImport/index.js b/src/pages/Setting/DrImport/index.js index 4918323..033649c 100644 --- a/src/pages/Setting/DrImport/index.js +++ b/src/pages/Setting/DrImport/index.js @@ -46,9 +46,9 @@ const Index = () => { files: [event.target.files[0]], onSuccess: function (responData) { if(responData?.msg){ - setResultStr(<>Error:
    {responData?.msg}) + setResultStr(<>Error
    {responData?.msg}) }else if(responData?.success){ - setResultStr(<>Success
    Record Count: {responData.recordCount}) + setResultStr(<>Success
    Record Count: {responData.recordCount}) } } }); From 3cb6b5d94a3fb97987046364f7c21295a6cf0115 Mon Sep 17 00:00:00 2001 From: anna Date: Thu, 22 Feb 2024 17:29:11 +0800 Subject: [PATCH 14/21] add please wait --- src/pages/Setting/DrImport/index.js | 36 +++++++++++++++++++++++++---- 1 file changed, 32 insertions(+), 4 deletions(-) diff --git a/src/pages/Setting/DrImport/index.js b/src/pages/Setting/DrImport/index.js index 033649c..cbbc3bf 100644 --- a/src/pages/Setting/DrImport/index.js +++ b/src/pages/Setting/DrImport/index.js @@ -1,6 +1,7 @@ import * as React from "react"; import * as HttpUtils from "utils/HttpUtils"; +import * as DateUtils from "utils/DateUtils"; import * as UrlUtils from "utils/ApiPathConst"; import { @@ -20,6 +21,7 @@ const Index = () => { const [isWarningPopUp, setIsWarningPopUp] = React.useState(false); const [warningText, setWarningText] = React.useState(""); const [resultStr, setResultStr] = React.useState(""); + const [wait, setWait] = React.useState(false); const intl = useIntl(); @@ -37,7 +39,9 @@ const Index = () => { const readFile = (event) => { let file = event.target.files[0]; + setWait(true); if (file) { + if (file.name.toLowerCase().substr(file.name.length - 5).includes(".xlsx") ) { HttpUtils.postWithFiles({ @@ -45,20 +49,27 @@ const Index = () => { params:null, files: [event.target.files[0]], onSuccess: function (responData) { + setWait(false); if(responData?.msg){ - setResultStr(<>Error
    {responData?.msg}) + setResultStr(<>{DateUtils.datetimeStr(new Date())}
    Error
    {responData?.msg}) }else if(responData?.success){ - setResultStr(<>Success
    Record Count: {responData.recordCount}) + setResultStr(<>{DateUtils.datetimeStr(new Date())}
    Success
    Record Count: {responData.recordCount}) } + }, + onError: function(){ + setWait(false); + setResultStr(<>{DateUtils.datetimeStr(new Date())}
    Error
    Action Fail: Please import valid file.) } }); } else { - setWarningText(intl.formatMessage({ id: 'requireValidFileWithFormat' })); + setWait(false); + setWarningText("Please upload a valid file (file format: .xlsx)"); setIsWarningPopUp(true); - setAttachment({}); document.getElementById("uploadFileBtn").value = ""; return; } + }else{ + setWait(false); } document.getElementById("uploadFileBtn").value = ""; } @@ -169,6 +180,23 @@ const Index = () => {
    +
    + setWait(false)} + PaperProps={{ + sx: { + minWidth: '40vw', + maxWidth: { xs: '90vw', s: '90vw', m: '70vw', lg: '70vw' }, + maxHeight: { xs: '90vh', s: '70vh', m: '70vh', lg: '60vh' } + } + }} + > + + Please wait ... + + +
    ); }; From 014ca5600545e85112a7d1aa88ba88f3e849db64 Mon Sep 17 00:00:00 2001 From: anna Date: Thu, 22 Feb 2024 17:44:29 +0800 Subject: [PATCH 15/21] public Announcement datetime -> date --- src/pages/Announcement/Search_Public/DataGrid.js | 2 +- src/pages/dashboard/Public/Notice.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pages/Announcement/Search_Public/DataGrid.js b/src/pages/Announcement/Search_Public/DataGrid.js index 0482e52..e89ba81 100644 --- a/src/pages/Announcement/Search_Public/DataGrid.js +++ b/src/pages/Announcement/Search_Public/DataGrid.js @@ -21,7 +21,7 @@ export default function SearchPublicNoticeTable({ recordList }) { width: 250, cellClassName: 'announceDate', renderCell: (params) => { - return DateUtils.datetimeStr(params?.value); + return DateUtils.dateStr(params?.value); }, }, { diff --git a/src/pages/dashboard/Public/Notice.js b/src/pages/dashboard/Public/Notice.js index e1ce7b8..b518f11 100644 --- a/src/pages/dashboard/Public/Notice.js +++ b/src/pages/dashboard/Public/Notice.js @@ -33,7 +33,7 @@ const SearchDemandNoteForm = () => { list.push( {locale === 'en' ?item.subjectEng:locale === 'zh-HK' ?item.subjectCht:item.subjectChs} - {DateUtils.datetimeStr(item.announceDate)} + {DateUtils.dateStr(item.announceDate)} {locale === 'en' ?item.contentEng:locale === 'zh-HK' ?item.contentCht:item.contentChs} From 66341fe108257ba3296ae9880739584e2a471508 Mon Sep 17 00:00:00 2001 From: Alex Cheung Date: Thu, 22 Feb 2024 18:01:23 +0800 Subject: [PATCH 16/21] add excel export and import issue list --- src/layout/MainLayout/Header/index.js | 7 +- src/pages/DemandNote/Create/SearchForm.js | 2 +- src/pages/DemandNote/Search/SearchForm.js | 2 +- .../DemandNote/Search_Public/SearchForm.js | 2 +- src/pages/GazetteIssue/index.js | 167 ++++++++++++++++++ .../Holiday/{Search_GLD => }/DataGrid.js | 2 +- .../Holiday/{Search_GLD => }/SearchForm.js | 0 src/pages/Holiday/{Search_GLD => }/index.js | 88 ++++++--- src/pages/Proof/Search_GLD/SearchForm.js | 2 +- src/pages/Proof/Search_Public/SearchForm.js | 2 +- src/pages/PublicNotice/ApplyForm/index.js | 2 +- .../PublicNotice/Search_GLD/SearchForm.js | 2 +- src/routes/GLDUserRoutes.js | 20 +++ src/routes/SettingRoutes.js | 16 +- src/utils/ApiPathConst.js | 6 +- 15 files changed, 269 insertions(+), 51 deletions(-) create mode 100644 src/pages/GazetteIssue/index.js rename src/pages/Holiday/{Search_GLD => }/DataGrid.js (97%) rename src/pages/Holiday/{Search_GLD => }/SearchForm.js (100%) rename src/pages/Holiday/{Search_GLD => }/index.js (75%) diff --git a/src/layout/MainLayout/Header/index.js b/src/layout/MainLayout/Header/index.js index ea6c01e..07ebdc8 100644 --- a/src/layout/MainLayout/Header/index.js +++ b/src/layout/MainLayout/Header/index.js @@ -141,17 +141,20 @@ function Header(props) { My Profile
  • - Email Template + Email Template
  • System Setting
  • - Holiday Setting + Holiday Setting
  • Announcement
  • +
  • + Gazette Issue +
  • diff --git a/src/pages/DemandNote/Create/SearchForm.js b/src/pages/DemandNote/Create/SearchForm.js index f88bd65..d8b40c3 100644 --- a/src/pages/DemandNote/Create/SearchForm.js +++ b/src/pages/DemandNote/Create/SearchForm.js @@ -56,7 +56,7 @@ const SearchPublicNoticeForm = ({ applySearch, issueComboData, _paymentCount, _p function getIssueLabel(data) { if (data == {}) return ""; - return data.year + return data.issueYear + " Vol. " + FormatUtils.zeroPad(data.volume, 3) + ", No. " + FormatUtils.zeroPad(data.issueNo, 2) + ", " + DateUtils.dateFormat(data.issueDate, "D MMM YYYY (ddd)"); diff --git a/src/pages/DemandNote/Search/SearchForm.js b/src/pages/DemandNote/Search/SearchForm.js index 5981010..6dbf6db 100644 --- a/src/pages/DemandNote/Search/SearchForm.js +++ b/src/pages/DemandNote/Search/SearchForm.js @@ -75,7 +75,7 @@ const SearchDemandNoteForm = ({ applySearch, orgComboData, searchCriteria, issue function getIssueLabel(data) { if (data == {}) return ""; - return data.year + return data.issueYear + " Vol. " + FormatUtils.zeroPad(data.volume, 3) + ", No. " + FormatUtils.zeroPad(data.issueNo, 2) + ", " + DateUtils.dateFormat(data.issueDate, "D MMM YYYY (ddd)"); diff --git a/src/pages/DemandNote/Search_Public/SearchForm.js b/src/pages/DemandNote/Search_Public/SearchForm.js index 10ad3ba..3dfe8d6 100644 --- a/src/pages/DemandNote/Search_Public/SearchForm.js +++ b/src/pages/DemandNote/Search_Public/SearchForm.js @@ -64,7 +64,7 @@ const SearchDemandNoteForm = ({ applySearch, searchCriteria, issueComboData function getIssueLabel(data) { if (data == {}) return ""; - return data.year + return data.issueYear + " Vol. " + FormatUtils.zeroPad(data.volume, 3) + ", No. " + FormatUtils.zeroPad(data.issueNo, 2) + ", " + DateUtils.dateFormat(data.issueDate, "D MMM YYYY (ddd)"); diff --git a/src/pages/GazetteIssue/index.js b/src/pages/GazetteIssue/index.js new file mode 100644 index 0000000..f231349 --- /dev/null +++ b/src/pages/GazetteIssue/index.js @@ -0,0 +1,167 @@ +// material-ui +import { + Grid, + Typography, + Stack, + Button, + Dialog, DialogTitle, DialogContent, DialogActions, +} from '@mui/material'; +import * as UrlUtils from "utils/ApiPathConst"; +import * as React from "react"; +import * as HttpUtils from "utils/HttpUtils"; +import titleBackgroundImg from 'assets/images/dashboard/gazette-bar.png' + +const BackgroundHead = { + backgroundImage: `url(${titleBackgroundImg})`, + width: '100%', + height: '100%', + backgroundSize: 'contain', + backgroundRepeat: 'no-repeat', + backgroundColor: '#0C489E', + backgroundPosition: 'right' +} +import {PNSPS_LONG_BUTTON_THEME} from "themes/buttonConst"; +import {ThemeProvider} from "@emotion/react"; +import { notifySaveSuccess } from 'utils/CommonFunction'; + +// ==============================|| DASHBOARD - DEFAULT ||============================== // + +const Index = () => { + const [attachments, setAttachments] = React.useState([]); + const [waitImport, setWaitImport] = React.useState(false); + const [waitDownload, setWaitDownload] = React.useState(false); + const [isWarningPopUp, setIsWarningPopUp] = React.useState(false); + const [warningText, setWarningText] = React.useState(""); + + React.useEffect(() => { + if (attachments.length > 0) { + importHoliday(); + } + }, [attachments]); + + const readFile = (event) => { + let file = event.target.files[0]; + if (file) { + if (!file.name.toLowerCase().substr(file.name.length - 5).includes(".xlsx")) { + setWarningText("Please upload a valid file (File format: .xlsx)."); + setIsWarningPopUp(true); + document.getElementById("uploadFileBtn").value = ""; + return; + } + file['id'] = attachments.length; + setAttachments([ + ...attachments, + file + ]); + document.getElementById("uploadFileBtn").value = ""; + } + } + + const doExport=()=>{ + setWaitDownload(true) + HttpUtils.fileDownload({ + url: UrlUtils.GET_ISSUE_LIST, + onResponse: () => { + setTimeout(()=> setWaitDownload(false), 500) + } + }); + } + + const importHoliday = () => { + setWaitImport(true); + if (!attachments || attachments.length <= 0) { + setWarningText("Please upload file."); + setSaving(false); + return; + } + HttpUtils.postWithFiles({ + url: UrlUtils.POST_ISSUE_FILE, + files: attachments, + onSuccess: () => { + notifySaveSuccess() + setWaitImport(false); + setAttachments([]); + // loadForm(); + } + }); + } + + return ( + + +
    + + Gazette Issue + +
    +
    + + + + + + + + + { + readFile(event) + }} + /> + + + + + + +
    + setIsWarningPopUp(false)} + PaperProps={{ + sx: { + minWidth: '40vw', + maxWidth: { xs: '90vw', s: '90vw', m: '70vw', lg: '70vw' }, + maxHeight: { xs: '90vh', s: '70vh', m: '70vh', lg: '60vh' } + } + }} + > + Warning + + {warningText} + + + + + +
    +
    + ); +}; + +export default Index; \ No newline at end of file diff --git a/src/pages/Holiday/Search_GLD/DataGrid.js b/src/pages/Holiday/DataGrid.js similarity index 97% rename from src/pages/Holiday/Search_GLD/DataGrid.js rename to src/pages/Holiday/DataGrid.js index b8f7cb0..807188d 100644 --- a/src/pages/Holiday/Search_GLD/DataGrid.js +++ b/src/pages/Holiday/DataGrid.js @@ -47,7 +47,7 @@ export default function EmailTemplateTable({ recordList }) { 'auto'} /> diff --git a/src/pages/Holiday/Search_GLD/SearchForm.js b/src/pages/Holiday/SearchForm.js similarity index 100% rename from src/pages/Holiday/Search_GLD/SearchForm.js rename to src/pages/Holiday/SearchForm.js diff --git a/src/pages/Holiday/Search_GLD/index.js b/src/pages/Holiday/index.js similarity index 75% rename from src/pages/Holiday/Search_GLD/index.js rename to src/pages/Holiday/index.js index f650638..1a83f3d 100644 --- a/src/pages/Holiday/Search_GLD/index.js +++ b/src/pages/Holiday/index.js @@ -12,7 +12,7 @@ import * as HttpUtils from "utils/HttpUtils"; import Loadable from 'components/Loadable'; const LoadingComponent = Loadable(React.lazy(() => import('pages/extra-pages/LoadingComponent'))); -const HolidayTable = Loadable(React.lazy(() => import('pages/Holiday/Search_GLD/DataGrid'))) +const HolidayTable = Loadable(React.lazy(() => import('pages/Holiday/DataGrid'))) import titleBackgroundImg from 'assets/images/dashboard/gazette-bar.png' // import AddCircleOutlineIcon from '@mui/icons-material/AddCircleOutline'; import MainCard from 'components/MainCard'; @@ -40,13 +40,15 @@ const Index = () => { const [record, setRecord] = React.useState([]); const [comboData, setComboData] = React.useState([]); const [onReady, setOnReady] = React.useState(false); + const [onSearchReady, setOnSearchReady] = 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 [attachments, setAttachments] = React.useState([]); - const [wait, setWait] = React.useState(false); + const [waitImport, setWaitImport] = React.useState(false); + const [waitDownload, setWaitDownload] = React.useState(false); const [isWarningPopUp, setIsWarningPopUp] = React.useState(false); const [warningText, setWarningText] = React.useState(""); @@ -54,26 +56,29 @@ const Index = () => { // loadForm(); // }, []); - React.useLayoutEffect(() => { - if (comboData && comboData.length > 0) { - setOnReady(true); - } - }, [comboData]); + // React.useLayoutEffect(() => { + // if (comboData) { + // setOnReady(true); + // } + // }, [comboData]); React.useEffect(() => { // console.log(searchCriteria) + setOnSearchReady(false) loadForm(); }, [searchCriteria]); - + function loadForm() { HttpUtils.get({ url: UrlUtils.GET_HOLIDAY, params: searchCriteria, onSuccess: (responseData) => { - console.log(comboData) + // console.log(comboData) setRecord(responseData); if (comboData.length == 0) { loadCombo(); + }else{ + setOnSearchReady(true) } } }); @@ -85,6 +90,8 @@ const Index = () => { onSuccess: (responseData) => { let combo = responseData; setComboData(combo); + setOnReady(true); + setOnSearchReady(true) } }); } @@ -117,8 +124,19 @@ const Index = () => { } } + const doExport=()=>{ + setWaitDownload(true) + HttpUtils.fileDownload({ + url: UrlUtils.GET_HOLIDAY_TEMPLATE, + onResponse: () => { + setTimeout(()=> setWaitDownload(false), 500) + } + }); + } + const importHoliday = () => { - setWait(true); + setWaitImport(true); + setOnSearchReady(false); if (!attachments || attachments.length <= 0) { setWarningText("Please upload file."); setSaving(false); @@ -129,7 +147,7 @@ const Index = () => { files: attachments, onSuccess: () => { notifySaveSuccess() - setWait(false); + setWaitImport(false); setAttachments([]); loadForm(); } @@ -153,8 +171,23 @@ const Index = () => {
    - - + + + + + + + { type="file" accept=".xlsx" style={{ display: 'none' }} - disabled={wait} + disabled={waitImport} onChange={(event) => { readFile(event) }} @@ -172,14 +205,16 @@ const Index = () => { component="span" variant="contained" size="large" - disabled={wait} + disabled={waitImport} > Upload Files + + {/*row 1*/} { /> {/*row 2*/} - - - - - + {!onSearchReady? + : + + + + + + }
    { }; function getIssueLabel(data) { - return data.year + return data.issueYear + " Vol. " + FormatUtils.zeroPad(data.volume, 3) + ", No. " + FormatUtils.zeroPad(data.issueNo, 2) + ", " + DateUtils.dateFormat(data.issueDate, "D MMM YYYY (ddd)"); diff --git a/src/pages/PublicNotice/Search_GLD/SearchForm.js b/src/pages/PublicNotice/Search_GLD/SearchForm.js index 42579fd..a55750d 100644 --- a/src/pages/PublicNotice/Search_GLD/SearchForm.js +++ b/src/pages/PublicNotice/Search_GLD/SearchForm.js @@ -77,7 +77,7 @@ const SearchPublicNoticeForm = ({ applySearch, orgComboData, searchCriteria, iss function getIssueLabel(data) { if (data == {}) return ""; - return data.year + return data.issueYear + " Vol. " + FormatUtils.zeroPad(data.volume, 3) + ", No. " + FormatUtils.zeroPad(data.issueNo, 2) + ", " + DateUtils.dateFormat(data.issueDate, "D MMM YYYY (ddd)"); diff --git a/src/routes/GLDUserRoutes.js b/src/routes/GLDUserRoutes.js index a2f78c8..ca96592 100644 --- a/src/routes/GLDUserRoutes.js +++ b/src/routes/GLDUserRoutes.js @@ -22,6 +22,10 @@ const UserMaintainPage = Loadable(lazy(() => import('pages/User/GLDUserProfile') const SystemSetting = Loadable(lazy(() => import('pages/Setting/SystemSetting'))); const AnnouncementDetails = Loadable(lazy(() => import('pages/Announcement/Details'))); const AnnouncementSearch = Loadable(lazy(() => import('pages/Announcement/Search'))); +const EmailTemplatePage = Loadable(lazy(() => import('pages/EmailTemplate/Search_GLD'))); +const EmailTemplateDetailPage = Loadable(lazy(() => import('pages/EmailTemplate/Detail_GLD'))); +const HolidayPage = Loadable(lazy(() => import('pages/Holiday'))); +const GazetteIssuePage = Loadable(lazy(() => import('pages/GazetteIssue/index'))); // ==============================|| MAIN ROUTING ||============================== // @@ -100,6 +104,22 @@ const GLDUserRoutes = { path: '/setting/announcement/details/:id', element: }, + { + path: '/setting/emailTemplate', + element: + }, + { + path: '/setting/emailTemplate/:id', + element: + }, + { + path: '/setting/holiday', + element: + }, + { + path: '/setting/gazetteissuepage', + element: + }, ] }, ] diff --git a/src/routes/SettingRoutes.js b/src/routes/SettingRoutes.js index fd3afe3..c9ab06f 100644 --- a/src/routes/SettingRoutes.js +++ b/src/routes/SettingRoutes.js @@ -20,9 +20,6 @@ const UserGroupDetailPage = Loadable(lazy(() => import('pages/pnspsUserGroupDeta const OrganizationSearchPage = Loadable(lazy(() => import('pages/Organization/SearchPage'))); const OrganizationDetailPage = Loadable(lazy(() => import('pages/Organization/DetailPage'))); const OrganizationDetailPage_fromUser = Loadable(lazy(() => import('pages/Organization/DetailPage_FromUser'))); -const EmailTemplatePage = Loadable(lazy(() => import('pages/EmailTemplate/Search_GLD'))); -const EmailTemplateDetailPage = Loadable(lazy(() => import('pages/EmailTemplate/Detail_GLD'))); -const HolidayPage = Loadable(lazy(() => import('pages/Holiday/Search_GLD'))); // ==============================|| AUTH ROUTING ||============================== // @@ -83,18 +80,7 @@ const SettingRoutes = { path: 'passwordpolicy', element: }, - { - path: 'emailTemplate', - element: - }, - { - path: '/emailTemplate/:id', - element: - }, - { - path: 'holiday', - element: - }, + ] }; diff --git a/src/utils/ApiPathConst.js b/src/utils/ApiPathConst.js index bcd1daf..47289e2 100644 --- a/src/utils/ApiPathConst.js +++ b/src/utils/ApiPathConst.js @@ -111,7 +111,10 @@ export const SET_PUBLIC_NOTICE_STATUS_REVIEWED = apiPath+'/application/applicati export const SET_PUBLIC_NOTICE_STATUS_PUBLISH = apiPath+'/application/application-detail-status-publish'; export const UPDATE_PUBLIC_NOTICE_APPLY_DETAIL = apiPath+'/application/save'; +//gazette export const GET_ISSUE_COMBO = apiPath+'/gazette-issue/combo'; +export const GET_ISSUE_LIST = apiPath+'/gazette-issue/export'; +export const POST_ISSUE_FILE = apiPath+'/gazette-issue/import'; export const CHECK_CREATE_PROOF = apiPath+'/proof/check-create';//GET export const LIST_PROOF = apiPath+'/proof/list';//GET @@ -172,4 +175,5 @@ export const GEN_GFMIS_XML = apiPath+'/gfmis'; //GET //Holiday export const GET_HOLIDAY = apiPath+'/holiday/list'; //GET export const POST_HOLIDAY = apiPath+'/holiday/import'; //POST -export const GET_HOLIDAY_COMBO = apiPath+'/holiday/combo'; //GET \ No newline at end of file +export const GET_HOLIDAY_COMBO = apiPath+'/holiday/combo'; //GET +export const GET_HOLIDAY_TEMPLATE = apiPath+'/holiday/export'; //GET From b426a9ea19547aca7e0ec708f6a6d6171fa5fd5e Mon Sep 17 00:00:00 2001 From: anna Date: Thu, 22 Feb 2024 18:03:10 +0800 Subject: [PATCH 17/21] filename check null --- .../PublicNotice/Details_GLD/ApplicationDetailCard.js | 9 +++++---- .../PublicNotice/Details_Public/ApplicationDetailCard.js | 9 +++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/pages/PublicNotice/Details_GLD/ApplicationDetailCard.js b/src/pages/PublicNotice/Details_GLD/ApplicationDetailCard.js index 9b14856..0b8d7b6 100644 --- a/src/pages/PublicNotice/Details_GLD/ApplicationDetailCard.js +++ b/src/pages/PublicNotice/Details_GLD/ApplicationDetailCard.js @@ -75,9 +75,9 @@ const ApplicationDetailCard = ( const onDownloadClick = () => () => { HttpUtils.fileDownload({ - fileId: fileDetail.id, - skey: fileDetail.skey, - filename: fileDetail.filename, + fileId: fileDetail?.id, + skey: fileDetail?.skey, + filename: fileDetail?.filename, }); notifyDownloadSuccess() setUploadStatus(true) @@ -510,7 +510,7 @@ const ApplicationDetailCard = ( variant="h5" sx={{ wordBreak: 'break-word' }} > - {fileDetail.filename} + {fileDetail?.filename} @@ -519,6 +519,7 @@ const ApplicationDetailCard = ( size="small" variant="contained" onClick={onDownloadClick()} + disabled={!fileDetail?.filename} sx={{ textTransform: 'capitalize', alignItems: 'end', diff --git a/src/pages/PublicNotice/Details_Public/ApplicationDetailCard.js b/src/pages/PublicNotice/Details_Public/ApplicationDetailCard.js index 71a8ec2..69ccdc6 100644 --- a/src/pages/PublicNotice/Details_Public/ApplicationDetailCard.js +++ b/src/pages/PublicNotice/Details_Public/ApplicationDetailCard.js @@ -95,9 +95,9 @@ const ApplicationDetailCard = ( const onDownloadClick = () => () => { HttpUtils.fileDownload({ - fileId: fileDetail.id, - skey: fileDetail.skey, - filename: fileDetail.filename, + fileId: fileDetail?.id, + skey: fileDetail?.skey, + filename: fileDetail?.filename, }); }; @@ -537,7 +537,7 @@ const ApplicationDetailCard = ( id='fileName' variant="pnspsFormParagraph" > - {fileDetail.filename} + {fileDetail?.filename} + + + + + + + ); +}; + +export default SearchGazetteIssueForm; diff --git a/src/pages/GazetteIssue/index.js b/src/pages/GazetteIssue/index.js index f231349..1aaaa18 100644 --- a/src/pages/GazetteIssue/index.js +++ b/src/pages/GazetteIssue/index.js @@ -10,6 +10,12 @@ import * as UrlUtils from "utils/ApiPathConst"; import * as React from "react"; import * as HttpUtils from "utils/HttpUtils"; import titleBackgroundImg from 'assets/images/dashboard/gazette-bar.png' +import Loadable from 'components/Loadable'; +const LoadingComponent = Loadable(React.lazy(() => import('pages/extra-pages/LoadingComponent'))); +import MainCard from 'components/MainCard'; + +const SearchForm = Loadable(React.lazy(() => import('./SearchForm'))); +const GazetteIssueTable = Loadable(React.lazy(() => import('./DataGrid'))) const BackgroundHead = { backgroundImage: `url(${titleBackgroundImg})`, @@ -22,17 +28,66 @@ const BackgroundHead = { } import {PNSPS_LONG_BUTTON_THEME} from "themes/buttonConst"; import {ThemeProvider} from "@emotion/react"; +import { dateStr_Year } from "utils/DateUtils"; import { notifySaveSuccess } from 'utils/CommonFunction'; // ==============================|| DASHBOARD - DEFAULT ||============================== // const Index = () => { + const [record, setRecord] = React.useState([]); + const [comboData, setComboData] = React.useState([]); + const [onReady, setOnReady] = React.useState(false); + const [onSearchReady, setOnSearchReady] = 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 [attachments, setAttachments] = React.useState([]); const [waitImport, setWaitImport] = React.useState(false); const [waitDownload, setWaitDownload] = React.useState(false); const [isWarningPopUp, setIsWarningPopUp] = React.useState(false); const [warningText, setWarningText] = React.useState(""); + React.useEffect(() => { + // console.log(searchCriteria) + setOnSearchReady(false) + loadForm(); + }, [searchCriteria]); + + function loadForm() { + HttpUtils.get({ + url: UrlUtils.GET_ISSUE, + params: searchCriteria, + onSuccess: (responseData) => { + // console.log(comboData) + setRecord(responseData); + if (comboData.length == 0) { + loadCombo(); + }else{ + setOnSearchReady(true) + } + } + }); + } + + function loadCombo() { + HttpUtils.get({ + url: UrlUtils.GET_ISSUE_YEAR_COMBO, + onSuccess: (responseData) => { + let combo = responseData; + setComboData(combo); + setOnReady(true); + setOnSearchReady(true) + } + }); + } + + function applySearch(input) { + setSearchCriteria(input); + } + React.useEffect(() => { if (attachments.length > 0) { importHoliday(); @@ -81,12 +136,20 @@ const Index = () => { notifySaveSuccess() setWaitImport(false); setAttachments([]); - // loadForm(); + loadForm(); } }); } return ( + !onReady ? + + + + + + : + (
    @@ -138,7 +201,29 @@ const Index = () => { - + {/*row 1*/} + + + + {/*row 2*/} + {!onSearchReady? + : + + + + + + }
    {
    + ) ); }; diff --git a/src/pages/Holiday/DataGrid.js b/src/pages/Holiday/DataGrid.js index 807188d..5120dff 100644 --- a/src/pages/Holiday/DataGrid.js +++ b/src/pages/Holiday/DataGrid.js @@ -9,13 +9,13 @@ import { dateStr } from "utils/DateUtils"; // ==============================|| EVENT TABLE ||============================== // -export default function EmailTemplateTable({ recordList }) { +export default function HolidayTable({ recordList }) { const [rows, setRows] = React.useState(recordList); // const navigate = useNavigate() useEffect(() => { - console.log(recordList) + // console.log(recordList) setRows(recordList); }, [recordList]); diff --git a/src/pages/Holiday/SearchForm.js b/src/pages/Holiday/SearchForm.js index fcaf358..2ebdac6 100644 --- a/src/pages/Holiday/SearchForm.js +++ b/src/pages/Holiday/SearchForm.js @@ -16,7 +16,7 @@ import {ThemeProvider} from "@emotion/react"; // ==============================|| DASHBOARD - DEFAULT ||============================== // -const SearchPublicNoticeForm = ({ applySearch, comboData}) => { +const SearchHolidayForm = ({ applySearch, comboData}) => { const [selectedYear, setSelectedYear] = React.useState([]); // const [defaultYear, setDefaultYear] = React.useState(searchCriteria.year); const [comboList, setComboList] = React.useState([]); @@ -126,4 +126,4 @@ const SearchPublicNoticeForm = ({ applySearch, comboData}) => { ); }; -export default SearchPublicNoticeForm; +export default SearchHolidayForm; diff --git a/src/utils/ApiPathConst.js b/src/utils/ApiPathConst.js index a954e4a..01ce47e 100644 --- a/src/utils/ApiPathConst.js +++ b/src/utils/ApiPathConst.js @@ -117,9 +117,11 @@ export const SET_PUBLIC_NOTICE_STATUS_PUBLISH = apiPath+'/application/applicatio export const UPDATE_PUBLIC_NOTICE_APPLY_DETAIL = apiPath+'/application/save'; //gazette -export const GET_ISSUE_COMBO = apiPath+'/gazette-issue/combo'; -export const GET_ISSUE_LIST = apiPath+'/gazette-issue/export'; -export const POST_ISSUE_FILE = apiPath+'/gazette-issue/import'; +export const GET_ISSUE_COMBO = apiPath+'/gazette-issue/combo';//GET +export const GET_ISSUE_LIST = apiPath+'/gazette-issue/export';//GET +export const POST_ISSUE_FILE = apiPath+'/gazette-issue/import';//POST +export const GET_ISSUE = apiPath+'/gazette-issue/list'; //GET +export const GET_ISSUE_YEAR_COMBO = apiPath+'/gazette-issue/combo-year'; //GET export const CHECK_CREATE_PROOF = apiPath+'/proof/check-create';//GET export const LIST_PROOF = apiPath+'/proof/list';//GET From 5755e99b6ef627d3303105385e3e670f0ba35c96 Mon Sep 17 00:00:00 2001 From: Alex Cheung Date: Fri, 23 Feb 2024 15:55:24 +0800 Subject: [PATCH 19/21] update export issue and proof ui --- src/pages/GazetteIssue/ExportForm.js | 133 ++++++++++++++++++ src/pages/GazetteIssue/SearchForm.js | 2 +- src/pages/GazetteIssue/index.js | 71 +++++++--- .../Proof/Reply_Public/ApplicationDetails.js | 6 +- src/translations/en.json | 4 +- src/translations/zh-CN.json | 2 +- src/translations/zh-HK.json | 2 +- 7 files changed, 190 insertions(+), 30 deletions(-) create mode 100644 src/pages/GazetteIssue/ExportForm.js 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": "校對回覆日期", From a8ff97b7523ddf1536fb2c31024ab93c50bb4a74 Mon Sep 17 00:00:00 2001 From: Jason Date: Tue, 27 Feb 2024 14:05:36 +0800 Subject: [PATCH 20/21] update --- src/pages/DemandNote/Search/DataGrid.js | 4 ++-- src/pages/Organization/SearchPage/OrganizationSearchForm.js | 2 +- src/pages/Proof/Create_FromApp/ProofForm.js | 4 ++-- src/pages/Proof/Reply_GLD/ApplicationDetails.js | 4 ++-- src/translations/en.json | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/pages/DemandNote/Search/DataGrid.js b/src/pages/DemandNote/Search/DataGrid.js index f12a87c..2370d38 100644 --- a/src/pages/DemandNote/Search/DataGrid.js +++ b/src/pages/DemandNote/Search/DataGrid.js @@ -220,9 +220,9 @@ export default function SearchDemandNote({ recordList, reloadFun, applySearch }) { field: 'dnNo', headerName: 'DN No.', - width: 200, + width: 220, renderCell: (params) => { - return ; + return ; }, }, { diff --git a/src/pages/Organization/SearchPage/OrganizationSearchForm.js b/src/pages/Organization/SearchPage/OrganizationSearchForm.js index c3f8983..dc384b8 100644 --- a/src/pages/Organization/SearchPage/OrganizationSearchForm.js +++ b/src/pages/Organization/SearchPage/OrganizationSearchForm.js @@ -123,7 +123,7 @@ const OrganizationSearchForm = ({ applySearch }) => { renderInput={(params) => ( { - Return Revise Before: + Deadline for proof with revison: { - Payment Before Date: + Deadline for confirm proof and payment: - Deadline for payment: + Deadline for confirm proof and payment Before {DateUtils.datetimeStr(data.proofPaymentDeadline)} - Deadline for revise: + Deadline for proof with revison: Before {DateUtils.datetimeStr(data.reviseDeadline)} diff --git a/src/translations/en.json b/src/translations/en.json index 5c68358..875e498 100644 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -119,7 +119,7 @@ "resetPasswordSuccess": "Password reset successfully.", "securityCode": "Security Code", - "sentSecurityCode1": "We sent your code to your setting email", + "sentSecurityCode1": "We have sent an email with the verification link to your email.", "sentSecurityCode2": "Please check your emails for a message with your code.", "sentSecurityCode3": "Please check your emails for ", "sentSecurityCode4": "a message with your code.", From 7f5e2221cd460de3ddb37ee8e84c334b6310c024 Mon Sep 17 00:00:00 2001 From: Jason Date: Tue, 27 Feb 2024 14:23:10 +0800 Subject: [PATCH 21/21] update label --- src/pages/Proof/Reply_GLD/ApplicationDetails.js | 8 ++++---- src/pages/Proof/Reply_Public/ApplicationDetails.js | 3 --- src/translations/zh-CN.json | 2 +- src/translations/zh-HK.json | 2 +- 4 files changed, 6 insertions(+), 9 deletions(-) diff --git a/src/pages/Proof/Reply_GLD/ApplicationDetails.js b/src/pages/Proof/Reply_GLD/ApplicationDetails.js index f87fbd7..557113f 100644 --- a/src/pages/Proof/Reply_GLD/ApplicationDetails.js +++ b/src/pages/Proof/Reply_GLD/ApplicationDetails.js @@ -266,17 +266,17 @@ const ApplicationDetailCard = ({ - Deadline for confirm proof and payment + Deadline for proof with revison: - Before {DateUtils.datetimeStr(data.proofPaymentDeadline)} + Before {DateUtils.datetimeStr(data.reviseDeadline)} - Deadline for proof with revison: + Deadline for confirm proof and payment - Before {DateUtils.datetimeStr(data.reviseDeadline)} + Before {DateUtils.datetimeStr(data.proofPaymentDeadline)} diff --git a/src/pages/Proof/Reply_Public/ApplicationDetails.js b/src/pages/Proof/Reply_Public/ApplicationDetails.js index 64b6ad5..e00e020 100644 --- a/src/pages/Proof/Reply_Public/ApplicationDetails.js +++ b/src/pages/Proof/Reply_Public/ApplicationDetails.js @@ -250,9 +250,6 @@ const ApplicationDetailCard = ({ formData, }) => { - - - diff --git a/src/translations/zh-CN.json b/src/translations/zh-CN.json index 483f244..dae5511 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 2eafca0..0280d50 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": "校對回覆日期",