From 1ac6487af94484e9bc9402038c68aa77c1e4605a Mon Sep 17 00:00:00 2001 From: anna Date: Thu, 18 Apr 2024 17:09:15 +0800 Subject: [PATCH 1/7] withdrawn button --- .../Details_GLD/ApplicationDetailCard.js | 75 +++++++++++++------ 1 file changed, 53 insertions(+), 22 deletions(-) diff --git a/src/pages/PublicNotice/Details_GLD/ApplicationDetailCard.js b/src/pages/PublicNotice/Details_GLD/ApplicationDetailCard.js index 1ac4159..96d8551 100644 --- a/src/pages/PublicNotice/Details_GLD/ApplicationDetailCard.js +++ b/src/pages/PublicNotice/Details_GLD/ApplicationDetailCard.js @@ -8,7 +8,7 @@ import { Stack, Dialog, DialogTitle, DialogContent, DialogActions, InputAdornment, } from '@mui/material'; -import {delBugMode} from "auth/utils"; +import { delBugMode } from "auth/utils"; const MainCard = Loadable(lazy(() => import('components/MainCard'))); import { useForm } from "react-hook-form"; import { @@ -94,17 +94,17 @@ const ApplicationDetailCard = ( setStatus("notAccepted") }; - const setCompleteDisable=()=>{ - if(delBugMode) return false; + const setCompleteDisable = () => { + if (delBugMode) return false; return (new Date()).getTime() < DateUtils.convertToDate(applicationDetailData.gazetteIssueDetail.issueDate).getTime(); } const complatedClick = () => () => { let issueDate = DateUtils.convertToDate(applicationDetailData.gazetteIssueDetail.issueDate); let current = new Date(); - if(delBugMode){ + if (delBugMode) { setStatus("complete") - }else if(current.getTime() >= issueDate.getTime()){ + } else if (current.getTime() >= issueDate.getTime()) { setStatus("complete") } }; @@ -113,7 +113,7 @@ const ApplicationDetailCard = ( setStatus("withdraw") }; - const doPublish =()=>()=>{ + const doPublish = () => () => { setStatus("publish") } @@ -231,24 +231,22 @@ const ApplicationDetailCard = ( Publish + : - (currentApplicationDetailData.status == "paid" && currentApplicationDetailData.creditor == 0) ? + (currentApplicationDetailData.status == "confirmed" && currentApplicationDetailData.creditor == 0) ? <> - - : null + + : + ( + (currentApplicationDetailData.status == "paid" && currentApplicationDetailData.creditor == 0) ? + <> + + + : null + ) + } From 41bd243b1febdb6b4d648fda0dd4aa5817785b9c Mon Sep 17 00:00:00 2001 From: anna Date: Fri, 19 Apr 2024 16:11:13 +0800 Subject: [PATCH 2/7] app status --- src/pages/PublicNotice/Details_GLD/ApplicationDetailCard.js | 2 +- src/pages/PublicNotice/Details_Public/ApplicationDetailCard.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pages/PublicNotice/Details_GLD/ApplicationDetailCard.js b/src/pages/PublicNotice/Details_GLD/ApplicationDetailCard.js index 96d8551..d2c32d0 100644 --- a/src/pages/PublicNotice/Details_GLD/ApplicationDetailCard.js +++ b/src/pages/PublicNotice/Details_GLD/ApplicationDetailCard.js @@ -343,7 +343,7 @@ const ApplicationDetailCard = ( - {StatusUtils.getStatusByTextEng(currentApplicationDetailData.status)} + {StatusUtils.getStatusByTextEng(currentApplicationDetailData.status, currentApplicationDetailData.creditor)} diff --git a/src/pages/PublicNotice/Details_Public/ApplicationDetailCard.js b/src/pages/PublicNotice/Details_Public/ApplicationDetailCard.js index 2a29f3f..a1be4f0 100644 --- a/src/pages/PublicNotice/Details_Public/ApplicationDetailCard.js +++ b/src/pages/PublicNotice/Details_Public/ApplicationDetailCard.js @@ -276,7 +276,7 @@ const ApplicationDetailCard = ( - {currentApplicationDetailData.status ? StatusUtils.getStatusByTextIntl(currentApplicationDetailData.status, false, intl) : ""} + {currentApplicationDetailData.status ? StatusUtils.getStatusByTextIntl(currentApplicationDetailData.status, currentApplicationDetailData.creditor, intl) : ""} From 8f50d2f8f94ea11ef9faddf70d03112237d66ce6 Mon Sep 17 00:00:00 2001 From: Alex Cheung Date: Fri, 19 Apr 2024 16:19:08 +0800 Subject: [PATCH 3/7] update application public btn status --- .../PublicNotice/Details_Public/ApplicationDetailCard.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/pages/PublicNotice/Details_Public/ApplicationDetailCard.js b/src/pages/PublicNotice/Details_Public/ApplicationDetailCard.js index 2a29f3f..ff6ed27 100644 --- a/src/pages/PublicNotice/Details_Public/ApplicationDetailCard.js +++ b/src/pages/PublicNotice/Details_Public/ApplicationDetailCard.js @@ -212,10 +212,16 @@ const ApplicationDetailCard = ( color="edit" disabled={currentApplicationDetailData.status == "rejected" || currentApplicationDetailData.status == "cancelled" + || currentApplicationDetailData.status == "withdrawn" + || currentApplicationDetailData.status == "completed" + || currentApplicationDetailData.status == "notAccepted" + || currentApplicationDetailData.status == "resubmit" || (!currentApplicationDetailData.creditor && currentApplicationDetailData.status == "paid") || (currentApplicationDetailData.creditor && currentApplicationDetailData.status == "confirmed") + || (currentApplicationDetailData.creditor + && currentApplicationDetailData.status == "published") } title={intl.formatMessage({ id: 'cancel' })} startIcon={} From 9f4fa9bdfb08c1b932f8f430db5ec807073ca9ff Mon Sep 17 00:00:00 2001 From: anna Date: Fri, 19 Apr 2024 17:04:30 +0800 Subject: [PATCH 4/7] clear demand note due date search --- src/pages/DemandNote/Search/SearchForm.js | 6 ++++-- src/pages/DemandNote/Search/index.js | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/pages/DemandNote/Search/SearchForm.js b/src/pages/DemandNote/Search/SearchForm.js index 117bd58..c0c5e1e 100644 --- a/src/pages/DemandNote/Search/SearchForm.js +++ b/src/pages/DemandNote/Search/SearchForm.js @@ -67,11 +67,11 @@ const SearchDemandNoteForm = ({ applySearch, orgComboData, searchCriteria, issue }, [maxDate]); React.useEffect(() => { - setFromDueDateValue(minDueDate); + setFromDueDateValue(minDueDate??"dd / mm / yyyy"); }, [minDueDate]); React.useEffect(() => { - setToDueDateValue(maxDueDate); + setToDueDateValue(maxDueDate??"dd / mm / yyyy"); }, [maxDueDate]); function FormDateInputComponent({ inputRef, ...props }) { @@ -219,6 +219,8 @@ const SearchDemandNoteForm = ({ applySearch, orgComboData, searchCriteria, issue setOrgSelected({}); setIssueSelected({}); setSelectedStatus(ComboData.denmandNoteStatus[0]); + setFromDueDateValue("dd / mm / yyyy"); + setToDueDateValue("dd / mm / yyyy"); reset(); } diff --git a/src/pages/DemandNote/Search/index.js b/src/pages/DemandNote/Search/index.js index cced1f0..383efbb 100644 --- a/src/pages/DemandNote/Search/index.js +++ b/src/pages/DemandNote/Search/index.js @@ -38,8 +38,8 @@ const SearchPage_DemandNote = () => { const [searchCriteria, setSearchCriteria] = React.useState({ dateTo: DateUtils.dateValue(new Date()), dateFrom: DateUtils.dateValue(new Date().setDate(new Date().getDate() - 14)), - dueDateTo: DateUtils.dateValue(new Date()), - dueDateFrom: DateUtils.dateValue(new Date().setDate(new Date().getDate() - 14)), + // dueDateTo: DateUtils.dateValue(new Date()), + // dueDateFrom: DateUtils.dateValue(new Date().setDate(new Date().getDate() - 14)), }); const [onReady, setOnReady] = React.useState(false); From 909229a0c4e96bff97557037cc54d130b1769439 Mon Sep 17 00:00:00 2001 From: anna Date: Fri, 19 Apr 2024 17:51:06 +0800 Subject: [PATCH 5/7] noteOnClientRemark & tradeMarkFootnote --- src/components/I18nProvider.js | 44 +++--- .../ApplyForm/PublicNoticeApplyForm.js | 132 ++++++++++-------- src/utils/ApiPathConst.js | 3 +- 3 files changed, 97 insertions(+), 82 deletions(-) diff --git a/src/components/I18nProvider.js b/src/components/I18nProvider.js index cd09a53..fdcd9f0 100644 --- a/src/components/I18nProvider.js +++ b/src/components/I18nProvider.js @@ -1,11 +1,11 @@ -import React, {useState, useEffect, createContext} from 'react'; +import { useState, useEffect, createContext } from 'react'; import { IntlProvider } from 'react-intl'; import enMessages from '../translations/en.json'; import cnMessages from '../translations/zh-CN.json'; import hkMessages from '../translations/zh-HK.json'; -import { GET_COMBO, POST_TERMS_N_CONDITIONS } from "utils/ApiPathConst"; -import * as HttpUtils from "utils/HttpUtils"; +import { GET_COMBO, GET_CONTENT } from "utils/ApiPathConst"; +import { get } from "utils/HttpUtils"; const LocaleContext = createContext(); @@ -16,46 +16,50 @@ export const I18nProvider = ({ children }) => { "zh-HK": hkMessages, "zh-CN": cnMessages }; - + const [locale, setLocale] = useState('en'); // Default locale, you can change this as per your requirement const [messages, setMessages] = useState(systemMessages[locale]); const loadTermsAndConditions = () => { - HttpUtils.get({ - url: POST_TERMS_N_CONDITIONS, + get({ + url: GET_CONTENT, onSuccess: (responseData) => { - enMessages["termsAndCon"]= responseData.en; - cnMessages["termsAndCon"]= responseData.cn; - hkMessages["termsAndCon"]= responseData.zh; + for (const key in responseData) { + const value = responseData[key]; + enMessages[key] = value.en??""; + cnMessages[key] = value.cn??""; + hkMessages[key] = value.zh??""; + } } }); - HttpUtils.get({ + + get({ url: GET_COMBO, onSuccess: (responseData) => { - for(let i =0; i { loadTermsAndConditions(); - if(localStorage.getItem('locale') === null){ + if (localStorage.getItem('locale') === null) { //no locale case - localStorage.setItem('locale','en'); + localStorage.setItem('locale', 'en'); } - else{ + else { setLocale(localStorage.getItem('locale')); } }, []); - + useEffect(() => { // Load the messages for the selected locale const fetchMessages = async () => { @@ -66,7 +70,7 @@ export const I18nProvider = ({ children }) => { }, [locale]); return ( - + {children} diff --git a/src/pages/PublicNotice/ApplyForm/PublicNoticeApplyForm.js b/src/pages/PublicNotice/ApplyForm/PublicNoticeApplyForm.js index 9dad89e..04805c5 100644 --- a/src/pages/PublicNotice/ApplyForm/PublicNoticeApplyForm.js +++ b/src/pages/PublicNotice/ApplyForm/PublicNoticeApplyForm.js @@ -17,13 +17,13 @@ import titleBackgroundImg from 'assets/images/dashboard/gazette-bar.png' import ForwardIcon from '@mui/icons-material/Forward'; import { isORGLoggedIn, - } from "utils/Utils"; +} from "utils/Utils"; import { useNavigate } from "react-router-dom"; import { notifyActionSuccess } from 'utils/CommonFunction'; -import {PNSPS_LONG_BUTTON_THEME} from "../../../themes/buttonConst"; -import {ThemeProvider} from "@emotion/react"; -import {FormattedMessage, useIntl} from "react-intl"; +import { PNSPS_LONG_BUTTON_THEME } from "../../../themes/buttonConst"; +import { ThemeProvider } from "@emotion/react"; +import { FormattedMessage, useIntl } from "react-intl"; import Loadable from 'components/Loadable'; import { lazy } from 'react'; const LoadingComponent = Loadable(lazy(() => import('../../extra-pages/LoadingComponent'))); @@ -58,8 +58,8 @@ const PublicNoticeApplyForm = ({ loadedData, _selections }) => { // loadedData.careOf = loadedData.contactPerson // },[]); - function getMaxErrStr(num, fieldname){ - return intl.formatMessage({ id: 'noMoreThenNWords' },{num:num, fieldname:fieldname?intl.formatMessage({ id: fieldname})+": ":""}); + function getMaxErrStr(num, fieldname) { + return intl.formatMessage({ id: 'noMoreThenNWords' }, { num: num, fieldname: fieldname ? intl.formatMessage({ id: fieldname }) + ": " : "" }); } React.useEffect(() => { @@ -70,54 +70,54 @@ const PublicNoticeApplyForm = ({ loadedData, _selections }) => { enableReinitialize: true, initialValues: loadedData, validationSchema: yup.object().shape({ - contactPerson: yup.string().max(40, intl.formatMessage({id: 'noMoreThen40Words'})).required(intl.formatMessage({id: 'requireContactPerson'})), - tel_countryCode: yup.string().min(3, intl.formatMessage({id: 'require3Number'})).required(intl.formatMessage({id: 'requireDialingCode'})), - fax_countryCode: yup.string().min(3, intl.formatMessage({id: 'require3Number'})), - phoneNumber: yup.string().min(8, intl.formatMessage({id: 'require8Number'})).required(intl.formatMessage({id: 'requireContactNumber'})), - faxNumber: yup.string().min(8, intl.formatMessage({id: 'require8Number'})), - remarks: yup.string().max(100,getMaxErrStr(100)).nullable(), - careOf: yup.string().max(60,getMaxErrStr(60)).nullable(), + contactPerson: yup.string().max(40, intl.formatMessage({ id: 'noMoreThen40Words' })).required(intl.formatMessage({ id: 'requireContactPerson' })), + tel_countryCode: yup.string().min(3, intl.formatMessage({ id: 'require3Number' })).required(intl.formatMessage({ id: 'requireDialingCode' })), + fax_countryCode: yup.string().min(3, intl.formatMessage({ id: 'require3Number' })), + phoneNumber: yup.string().min(8, intl.formatMessage({ id: 'require8Number' })).required(intl.formatMessage({ id: 'requireContactNumber' })), + faxNumber: yup.string().min(8, intl.formatMessage({ id: 'require8Number' })), + remarks: yup.string().max(100, getMaxErrStr(100)).nullable(), + careOf: yup.string().max(60, getMaxErrStr(60)).nullable(), }), onSubmit: values => { if (!values.issueId) { - setWarningText(intl.formatMessage({id: 'requireTargetVol'})); + setWarningText(intl.formatMessage({ id: 'requireTargetVol' })); setIsWarningPopUp(true); return; } if (!attachment) { - setWarningText(intl.formatMessage({id: 'requireFile'})); + setWarningText(intl.formatMessage({ id: 'requireFile' })); setIsWarningPopUp(true); return; } else if (!attachment.size || attachment.size <= 0) { - setWarningText(intl.formatMessage({id: 'requireValidFile'})); + setWarningText(intl.formatMessage({ id: 'requireValidFile' })); setIsWarningPopUp(true); return; } else if (attachment.size >= (10 * 1024 * 1034)) { - setWarningText(intl.formatMessage({id: 'fileSizeWarning'})); + setWarningText(intl.formatMessage({ id: 'fileSizeWarning' })); setIsWarningPopUp(true); return; } - if(isORGLoggedIn()){ + if (isORGLoggedIn()) { HttpUtils.get({ url: UrlUtils.CHECK_OVERDUE, - onSuccess: (responData)=>{ - if(responData.haveOverdue){ + onSuccess: (responData) => { + if (responData.haveOverdue) { setVal(values); - setWarningText(intl.formatMessage({id: 'dnOverdueWarning'})); + setWarningText(intl.formatMessage({ id: 'dnOverdueWarning' })); setIsWarningPopUp(true); - }else{ + } else { apply(values); } } }); - }else{ + } else { apply(values); } - + } }); - const apply = (values)=>{ + const apply = (values) => { setSubmitting(true) HttpUtils.postWithFiles({ url: UrlUtils.POST_PUBLIC_NOTICE_APPLY, @@ -133,20 +133,20 @@ const PublicNoticeApplyForm = ({ loadedData, _selections }) => { faxNumber: values.faxNumber }, issueId: issueId, - careOf: values.careOf ? values.careOf: "", + careOf: values.careOf ? values.careOf : "", remarks: values.remarks ? values.remarks : "", }, files: [attachment], onSuccess: function (responData) { - if(responData.msg){ + if (responData.msg) { setVal({}); setReloadPage(true); - setWarningText(intl.formatMessage({id: responData.msg})); + setWarningText(intl.formatMessage({ id: responData.msg })); setIsWarningPopUp(true); return; } setSubmitting(false) - notifyActionSuccess(intl.formatMessage({id: 'submissionSuccess'}) + '!') + notifyActionSuccess(intl.formatMessage({ id: 'submissionSuccess' }) + '!') navigate("/publicNotice"); // location.reload(); } @@ -163,7 +163,7 @@ const PublicNoticeApplyForm = ({ loadedData, _selections }) => { ) { setAttachment(event.target.files[0]); } else { - setWarningText(intl.formatMessage({id: 'requireValidFileWithFormat'})); + setWarningText(intl.formatMessage({ id: 'requireValidFileWithFormat' })); setIsWarningPopUp(true); setAttachment({}); document.getElementById("uploadFileBtn").value = ""; @@ -178,16 +178,16 @@ const PublicNoticeApplyForm = ({ loadedData, _selections }) => {
- - + +
- + + >{attachment ? intl.formatMessage({ id: 'uploadFileBtn' }) : intl.formatMessage({ id: 'reUpload' })} - {isORGLoggedIn()? + {isORGLoggedIn() ? <> {FieldUtils.getCarOfField({ - label: intl.formatMessage({id: 'careOf'}) + ":", + label: intl.formatMessage({ id: 'careOf' }) + ":", valueName: "careOf", form: formik, // disabled: true @@ -325,35 +325,47 @@ const PublicNoticeApplyForm = ({ loadedData, _selections }) => { - + - : + : null - + } {FieldUtils.getTextArea({ - label: intl.formatMessage({id: 'extraMark'}) + ":", + label: intl.formatMessage({ id: 'extraMark' }) + ":", valueName: "remarks", form: formik, inputProps: { maxLength: 255 } })} + + + +
+ + + +
- +
+ + + + @@ -372,21 +384,21 @@ const PublicNoticeApplyForm = ({ loadedData, _selections }) => { }} > - + {warningText}
- + diff --git a/src/pages/authentication/auth-forms/AuthLoginCustom.js b/src/pages/authentication/auth-forms/AuthLoginCustom.js index c6cb3e0..c37f78e 100644 --- a/src/pages/authentication/auth-forms/AuthLoginCustom.js +++ b/src/pages/authentication/auth-forms/AuthLoginCustom.js @@ -387,7 +387,7 @@ const AuthLoginCustom = () => { - + { intl.formatMessage({id: 'learnMore'})+" >"} diff --git a/src/translations/en.json b/src/translations/en.json index 09c8444..0db83b9 100644 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -3,6 +3,7 @@ "zh-HK": "繁體中文", "zh-CN": "简体中文", "language":"Language", + "iamsmartLink": "https://www.iamsmart.gov.hk/en/", "PNSPS": "PNSPS", "HKSARGOV": "HKSAR Government", diff --git a/src/translations/zh-CN.json b/src/translations/zh-CN.json index dca0c9d..16b23e3 100644 --- a/src/translations/zh-CN.json +++ b/src/translations/zh-CN.json @@ -3,6 +3,7 @@ "zh-HK": "繁體中文", "zh-CN": "简体中文", "language":"语言", + "iamsmartLink": "https://www.iamsmart.gov.hk/sc/", "PNSPS": "公共启事提交及缴费系统", "HKSARGOV": "香港特别行政区政府", diff --git a/src/translations/zh-HK.json b/src/translations/zh-HK.json index 1d3572e..b09e8bf 100644 --- a/src/translations/zh-HK.json +++ b/src/translations/zh-HK.json @@ -3,6 +3,7 @@ "zh-HK": "繁體中文", "zh-CN": "简体中文", "language":"語言", + "iamsmartLink": "https://www.iamsmart.gov.hk/tc/", "PNSPS": "公共啟事提交及繳費系統", "HKSARGOV": "香港特別行政區政府", From 2dbed11e3f21b7d8087b5906ab656c596bc10320 Mon Sep 17 00:00:00 2001 From: anna Date: Tue, 23 Apr 2024 12:46:01 +0800 Subject: [PATCH 7/7] add test function --- src/pages/_Test/index.js | 47 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/src/pages/_Test/index.js b/src/pages/_Test/index.js index 8d29fb6..19b84b6 100644 --- a/src/pages/_Test/index.js +++ b/src/pages/_Test/index.js @@ -42,6 +42,7 @@ const Mail = () => { url: apiPath + "/test/send-mail", params: { email: values.email, + tempKey: values.tempKey }, onSuccess: function () { setResponsText("Success"); @@ -77,6 +78,25 @@ const Mail = () => { }); } + const testDaily_checkDNStatus=()=>{ + HttpUtils.post({ + url: apiPath + "/test/daily_checkDNStatus", + onSuccess: function () { + setResponsText("Success"); + setIsResponsPopUp(true); + }, + onFail: (response) => { + setResponsText("Fail: " + response); + setIsResponsPopUp(true); + }, + onError: (error) => { + setResponsText("Error: " + error); + setIsResponsPopUp(true); + } + }); + } + + return ( !JSON.parse(localStorage.getItem('userData')).fullenName == "2fi" ? @@ -103,6 +123,17 @@ const Mail = () => { onChange={formik.handleChange} /> + + + + + Set DN Reminder Expect send Date + + +