| @@ -1,11 +1,11 @@ | |||||
| import React, {useState, useEffect, createContext} from 'react'; | |||||
| import { useState, useEffect, createContext } from 'react'; | |||||
| import { IntlProvider } from 'react-intl'; | import { IntlProvider } from 'react-intl'; | ||||
| import enMessages from '../translations/en.json'; | import enMessages from '../translations/en.json'; | ||||
| import cnMessages from '../translations/zh-CN.json'; | import cnMessages from '../translations/zh-CN.json'; | ||||
| import hkMessages from '../translations/zh-HK.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(); | const LocaleContext = createContext(); | ||||
| @@ -16,46 +16,50 @@ export const I18nProvider = ({ children }) => { | |||||
| "zh-HK": hkMessages, | "zh-HK": hkMessages, | ||||
| "zh-CN": cnMessages | "zh-CN": cnMessages | ||||
| }; | }; | ||||
| const [locale, setLocale] = useState('en'); // Default locale, you can change this as per your requirement | const [locale, setLocale] = useState('en'); // Default locale, you can change this as per your requirement | ||||
| const [messages, setMessages] = useState(systemMessages[locale]); | const [messages, setMessages] = useState(systemMessages[locale]); | ||||
| const loadTermsAndConditions = () => { | const loadTermsAndConditions = () => { | ||||
| HttpUtils.get({ | |||||
| url: POST_TERMS_N_CONDITIONS, | |||||
| get({ | |||||
| url: GET_CONTENT, | |||||
| onSuccess: (responseData) => { | 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, | url: GET_COMBO, | ||||
| onSuccess: (responseData) => { | onSuccess: (responseData) => { | ||||
| for(let i =0; i<responseData.length; i++){ | |||||
| for (let i = 0; i < responseData.length; i++) { | |||||
| let item = responseData[i]; | let item = responseData[i]; | ||||
| enMessages[item.key]= item.en; | |||||
| cnMessages[item.key]= item.cn; | |||||
| hkMessages[item.key]= item.zh; | |||||
| enMessages[item.key] = item.en; | |||||
| cnMessages[item.key] = item.cn; | |||||
| hkMessages[item.key] = item.zh; | |||||
| } | } | ||||
| } | } | ||||
| }); | }); | ||||
| } | } | ||||
| useEffect(() => { | useEffect(() => { | ||||
| loadTermsAndConditions(); | loadTermsAndConditions(); | ||||
| if(localStorage.getItem('locale') === null){ | |||||
| if (localStorage.getItem('locale') === null) { | |||||
| //no locale case | //no locale case | ||||
| localStorage.setItem('locale','en'); | |||||
| localStorage.setItem('locale', 'en'); | |||||
| } | } | ||||
| else{ | |||||
| else { | |||||
| setLocale(localStorage.getItem('locale')); | setLocale(localStorage.getItem('locale')); | ||||
| } | } | ||||
| }, []); | }, []); | ||||
| useEffect(() => { | useEffect(() => { | ||||
| // Load the messages for the selected locale | // Load the messages for the selected locale | ||||
| const fetchMessages = async () => { | const fetchMessages = async () => { | ||||
| @@ -66,7 +70,7 @@ export const I18nProvider = ({ children }) => { | |||||
| }, [locale]); | }, [locale]); | ||||
| return ( | return ( | ||||
| <LocaleContext.Provider value={{ locale, setLocale }} > | |||||
| <LocaleContext.Provider value={{ locale, setLocale }} > | |||||
| <IntlProvider locale={locale} messages={messages}> | <IntlProvider locale={locale} messages={messages}> | ||||
| {children} | {children} | ||||
| </IntlProvider> | </IntlProvider> | ||||
| @@ -67,11 +67,11 @@ const SearchDemandNoteForm = ({ applySearch, orgComboData, searchCriteria, issue | |||||
| }, [maxDate]); | }, [maxDate]); | ||||
| React.useEffect(() => { | React.useEffect(() => { | ||||
| setFromDueDateValue(minDueDate); | |||||
| setFromDueDateValue(minDueDate??"dd / mm / yyyy"); | |||||
| }, [minDueDate]); | }, [minDueDate]); | ||||
| React.useEffect(() => { | React.useEffect(() => { | ||||
| setToDueDateValue(maxDueDate); | |||||
| setToDueDateValue(maxDueDate??"dd / mm / yyyy"); | |||||
| }, [maxDueDate]); | }, [maxDueDate]); | ||||
| function FormDateInputComponent({ inputRef, ...props }) { | function FormDateInputComponent({ inputRef, ...props }) { | ||||
| @@ -219,6 +219,8 @@ const SearchDemandNoteForm = ({ applySearch, orgComboData, searchCriteria, issue | |||||
| setOrgSelected({}); | setOrgSelected({}); | ||||
| setIssueSelected({}); | setIssueSelected({}); | ||||
| setSelectedStatus(ComboData.denmandNoteStatus[0]); | setSelectedStatus(ComboData.denmandNoteStatus[0]); | ||||
| setFromDueDateValue("dd / mm / yyyy"); | |||||
| setToDueDateValue("dd / mm / yyyy"); | |||||
| reset(); | reset(); | ||||
| } | } | ||||
| @@ -37,8 +37,8 @@ const UserSearchPage_Individual = () => { | |||||
| const [searchCriteria, setSearchCriteria] = React.useState({ | const [searchCriteria, setSearchCriteria] = React.useState({ | ||||
| dateTo: DateUtils.dateValue(new Date()), | dateTo: DateUtils.dateValue(new Date()), | ||||
| dateFrom: DateUtils.dateValue(new Date().setDate(new Date().getDate() - 14)), | 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); | const [onReady, setOnReady] = React.useState(false); | ||||
| @@ -17,13 +17,13 @@ import titleBackgroundImg from 'assets/images/dashboard/gazette-bar.png' | |||||
| import ForwardIcon from '@mui/icons-material/Forward'; | import ForwardIcon from '@mui/icons-material/Forward'; | ||||
| import { | import { | ||||
| isORGLoggedIn, | isORGLoggedIn, | ||||
| } from "utils/Utils"; | |||||
| } from "utils/Utils"; | |||||
| import { useNavigate } from "react-router-dom"; | import { useNavigate } from "react-router-dom"; | ||||
| import { notifyActionSuccess } from 'utils/CommonFunction'; | 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 Loadable from 'components/Loadable'; | ||||
| import { lazy } from 'react'; | import { lazy } from 'react'; | ||||
| const LoadingComponent = Loadable(lazy(() => import('../../extra-pages/LoadingComponent'))); | const LoadingComponent = Loadable(lazy(() => import('../../extra-pages/LoadingComponent'))); | ||||
| @@ -58,8 +58,8 @@ const PublicNoticeApplyForm = ({ loadedData, _selections }) => { | |||||
| // loadedData.careOf = loadedData.contactPerson | // 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(() => { | React.useEffect(() => { | ||||
| @@ -70,54 +70,54 @@ const PublicNoticeApplyForm = ({ loadedData, _selections }) => { | |||||
| enableReinitialize: true, | enableReinitialize: true, | ||||
| initialValues: loadedData, | initialValues: loadedData, | ||||
| validationSchema: yup.object().shape({ | 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 => { | onSubmit: values => { | ||||
| if (!values.issueId) { | if (!values.issueId) { | ||||
| setWarningText(intl.formatMessage({id: 'requireTargetVol'})); | |||||
| setWarningText(intl.formatMessage({ id: 'requireTargetVol' })); | |||||
| setIsWarningPopUp(true); | setIsWarningPopUp(true); | ||||
| return; | return; | ||||
| } | } | ||||
| if (!attachment) { | if (!attachment) { | ||||
| setWarningText(intl.formatMessage({id: 'requireFile'})); | |||||
| setWarningText(intl.formatMessage({ id: 'requireFile' })); | |||||
| setIsWarningPopUp(true); | setIsWarningPopUp(true); | ||||
| return; | return; | ||||
| } else if (!attachment.size || attachment.size <= 0) { | } else if (!attachment.size || attachment.size <= 0) { | ||||
| setWarningText(intl.formatMessage({id: 'requireValidFile'})); | |||||
| setWarningText(intl.formatMessage({ id: 'requireValidFile' })); | |||||
| setIsWarningPopUp(true); | setIsWarningPopUp(true); | ||||
| return; | return; | ||||
| } else if (attachment.size >= (10 * 1024 * 1034)) { | } else if (attachment.size >= (10 * 1024 * 1034)) { | ||||
| setWarningText(intl.formatMessage({id: 'fileSizeWarning'})); | |||||
| setWarningText(intl.formatMessage({ id: 'fileSizeWarning' })); | |||||
| setIsWarningPopUp(true); | setIsWarningPopUp(true); | ||||
| return; | return; | ||||
| } | } | ||||
| if(isORGLoggedIn()){ | |||||
| if (isORGLoggedIn()) { | |||||
| HttpUtils.get({ | HttpUtils.get({ | ||||
| url: UrlUtils.CHECK_OVERDUE, | url: UrlUtils.CHECK_OVERDUE, | ||||
| onSuccess: (responData)=>{ | |||||
| if(responData.haveOverdue){ | |||||
| onSuccess: (responData) => { | |||||
| if (responData.haveOverdue) { | |||||
| setVal(values); | setVal(values); | ||||
| setWarningText(intl.formatMessage({id: 'dnOverdueWarning'})); | |||||
| setWarningText(intl.formatMessage({ id: 'dnOverdueWarning' })); | |||||
| setIsWarningPopUp(true); | setIsWarningPopUp(true); | ||||
| }else{ | |||||
| } else { | |||||
| apply(values); | apply(values); | ||||
| } | } | ||||
| } | } | ||||
| }); | }); | ||||
| }else{ | |||||
| } else { | |||||
| apply(values); | apply(values); | ||||
| } | } | ||||
| } | } | ||||
| }); | }); | ||||
| const apply = (values)=>{ | |||||
| const apply = (values) => { | |||||
| setSubmitting(true) | setSubmitting(true) | ||||
| HttpUtils.postWithFiles({ | HttpUtils.postWithFiles({ | ||||
| url: UrlUtils.POST_PUBLIC_NOTICE_APPLY, | url: UrlUtils.POST_PUBLIC_NOTICE_APPLY, | ||||
| @@ -133,20 +133,20 @@ const PublicNoticeApplyForm = ({ loadedData, _selections }) => { | |||||
| faxNumber: values.faxNumber | faxNumber: values.faxNumber | ||||
| }, | }, | ||||
| issueId: issueId, | issueId: issueId, | ||||
| careOf: values.careOf ? values.careOf: "", | |||||
| careOf: values.careOf ? values.careOf : "", | |||||
| remarks: values.remarks ? values.remarks : "", | remarks: values.remarks ? values.remarks : "", | ||||
| }, | }, | ||||
| files: [attachment], | files: [attachment], | ||||
| onSuccess: function (responData) { | onSuccess: function (responData) { | ||||
| if(responData.msg){ | |||||
| if (responData.msg) { | |||||
| setVal({}); | setVal({}); | ||||
| setReloadPage(true); | setReloadPage(true); | ||||
| setWarningText(intl.formatMessage({id: responData.msg})); | |||||
| setWarningText(intl.formatMessage({ id: responData.msg })); | |||||
| setIsWarningPopUp(true); | setIsWarningPopUp(true); | ||||
| return; | return; | ||||
| } | } | ||||
| setSubmitting(false) | setSubmitting(false) | ||||
| notifyActionSuccess(intl.formatMessage({id: 'submissionSuccess'}) + '!') | |||||
| notifyActionSuccess(intl.formatMessage({ id: 'submissionSuccess' }) + '!') | |||||
| navigate("/publicNotice"); | navigate("/publicNotice"); | ||||
| // location.reload(); | // location.reload(); | ||||
| } | } | ||||
| @@ -163,7 +163,7 @@ const PublicNoticeApplyForm = ({ loadedData, _selections }) => { | |||||
| ) { | ) { | ||||
| setAttachment(event.target.files[0]); | setAttachment(event.target.files[0]); | ||||
| } else { | } else { | ||||
| setWarningText(intl.formatMessage({id: 'requireValidFileWithFormat'})); | |||||
| setWarningText(intl.formatMessage({ id: 'requireValidFileWithFormat' })); | |||||
| setIsWarningPopUp(true); | setIsWarningPopUp(true); | ||||
| setAttachment({}); | setAttachment({}); | ||||
| document.getElementById("uploadFileBtn").value = ""; | document.getElementById("uploadFileBtn").value = ""; | ||||
| @@ -178,16 +178,16 @@ const PublicNoticeApplyForm = ({ loadedData, _selections }) => { | |||||
| <Grid item xs={12} md={12} width="100%" > | <Grid item xs={12} md={12} width="100%" > | ||||
| <div style={BackgroundHead}> | <div style={BackgroundHead}> | ||||
| <Stack direction="row" height='70px' justifyContent="flex-start" alignItems="center"> | <Stack direction="row" height='70px' justifyContent="flex-start" alignItems="center"> | ||||
| <Typography ml={15} color='#FFF' variant="h4" sx={{display: { xs: 'none', sm: 'none', md: 'block' }}}> | |||||
| <FormattedMessage id="applyPublicNotice"/> | |||||
| <Typography ml={15} color='#FFF' variant="h4" sx={{ display: { xs: 'none', sm: 'none', md: 'block' } }}> | |||||
| <FormattedMessage id="applyPublicNotice" /> | |||||
| </Typography> | </Typography> | ||||
| </Stack> | </Stack> | ||||
| </div> | </div> | ||||
| </Grid> | </Grid> | ||||
| <Grid item xs={12} width={{xs:"90%", sm:"90%", md:"60%", lg:"60%"}}> | |||||
| <Grid item xs={12} width={{ xs: "90%", sm: "90%", md: "60%", lg: "60%" }}> | |||||
| <Button | <Button | ||||
| aria-label={intl.formatMessage({id: 'back'})} | |||||
| title={intl.formatMessage({id: 'back'})} | |||||
| aria-label={intl.formatMessage({ id: 'back' })} | |||||
| title={intl.formatMessage({ id: 'back' })} | |||||
| sx={{ ml: 0, mt: 2.5 }} style={{ border: '2px solid' }} variant="outlined" onClick={() => { navigate(-1) }} | sx={{ ml: 0, mt: 2.5 }} style={{ border: '2px solid' }} variant="outlined" onClick={() => { navigate(-1) }} | ||||
| > | > | ||||
| <ForwardIcon style={{ height: 30, width: 50, transform: "rotate(180deg)" }} /> | <ForwardIcon style={{ height: 30, width: 50, transform: "rotate(180deg)" }} /> | ||||
| @@ -201,14 +201,14 @@ const PublicNoticeApplyForm = ({ loadedData, _selections }) => { | |||||
| <Grid item xs={12} md={12} width={{ md: "60%", xs: "90%" }}> | <Grid item xs={12} md={12} width={{ md: "60%", xs: "90%" }}> | ||||
| <LoadingComponent /> | <LoadingComponent /> | ||||
| </Grid> | </Grid> | ||||
| : | |||||
| : | |||||
| <Grid item xs={12} md={12} width={{ md: "60%", xs: "90%" }}> | <Grid item xs={12} md={12} width={{ md: "60%", xs: "90%" }}> | ||||
| <Box xs={12} mt={1} sx={{ p: 2, border: '3px groove grey', borderRadius: '10px' }}> | <Box xs={12} mt={1} sx={{ p: 2, border: '3px groove grey', borderRadius: '10px' }}> | ||||
| <form onSubmit={formik.handleSubmit}> | <form onSubmit={formik.handleSubmit}> | ||||
| <Grid container spacing={1} sx={{ minHeight: '80vh' }} direction="row" justifyContent="flex-start" alignItems="center"> | <Grid container spacing={1} sx={{ minHeight: '80vh' }} direction="row" justifyContent="flex-start" alignItems="center"> | ||||
| <Grid item xs={12} md={12} lg={12} sx={{ mb: 1 }}> | <Grid item xs={12} md={12} lg={12} sx={{ mb: 1 }}> | ||||
| {FieldUtils.getTextField({ | {FieldUtils.getTextField({ | ||||
| label: intl.formatMessage({id: 'contactPerson'}) + ":", | |||||
| label: intl.formatMessage({ id: 'contactPerson' }) + ":", | |||||
| valueName: "contactPerson", | valueName: "contactPerson", | ||||
| form: formik, | form: formik, | ||||
| disabled: true | disabled: true | ||||
| @@ -216,7 +216,7 @@ const PublicNoticeApplyForm = ({ loadedData, _selections }) => { | |||||
| </Grid> | </Grid> | ||||
| <Grid item xs={12} md={12}> | <Grid item xs={12} md={12}> | ||||
| {FieldUtils.getPhoneField({ | {FieldUtils.getPhoneField({ | ||||
| label: intl.formatMessage({id: 'userContactNumber'}) + ":", | |||||
| label: intl.formatMessage({ id: 'userContactNumber' }) + ":", | |||||
| disabled: true, | disabled: true, | ||||
| valueName: { | valueName: { | ||||
| code: "tel_countryCode", | code: "tel_countryCode", | ||||
| @@ -227,7 +227,7 @@ const PublicNoticeApplyForm = ({ loadedData, _selections }) => { | |||||
| </Grid> | </Grid> | ||||
| <Grid item xs={12} md={12}> | <Grid item xs={12} md={12}> | ||||
| {FieldUtils.getPhoneField({ | {FieldUtils.getPhoneField({ | ||||
| label: intl.formatMessage({id: 'contactFaxNumber'}) + ":", | |||||
| label: intl.formatMessage({ id: 'contactFaxNumber' }) + ":", | |||||
| disabled: true, | disabled: true, | ||||
| valueName: { | valueName: { | ||||
| code: "fax_countryCode", | code: "fax_countryCode", | ||||
| @@ -266,7 +266,7 @@ const PublicNoticeApplyForm = ({ loadedData, _selections }) => { | |||||
| <Grid item xs={12} md={3} lg={3} | <Grid item xs={12} md={3} lg={3} | ||||
| sx={{ display: 'flex', alignItems: 'center' }}> | sx={{ display: 'flex', alignItems: 'center' }}> | ||||
| <Typography variant="pnspsFormParagraphBold"> | <Typography variant="pnspsFormParagraphBold"> | ||||
| <FormattedMessage id="draftFile"/> ({intl.formatMessage({id: 'fileSizeWarning'})}): | |||||
| <FormattedMessage id="draftFile" /> ({intl.formatMessage({ id: 'fileSizeWarning' })}): | |||||
| </Typography> | </Typography> | ||||
| </Grid> | </Grid> | ||||
| <Grid item xs={12} md={6} lg={6} sx={{ wordBreak: 'break-word' }}> | <Grid item xs={12} md={6} lg={6} sx={{ wordBreak: 'break-word' }}> | ||||
| @@ -302,22 +302,22 @@ const PublicNoticeApplyForm = ({ loadedData, _selections }) => { | |||||
| <Grid item xs={12} md={6} lg={6} > | <Grid item xs={12} md={6} lg={6} > | ||||
| <label htmlFor="uploadFileBtn"> | <label htmlFor="uploadFileBtn"> | ||||
| <Button | <Button | ||||
| aria-label={intl.formatMessage({id: 'uploadFileBtn'})} | |||||
| aria-label={intl.formatMessage({ id: 'uploadFileBtn' })} | |||||
| component="span" | component="span" | ||||
| variant="outlined" | variant="outlined" | ||||
| size="large" | size="large" | ||||
| >{attachment ? intl.formatMessage({id: 'uploadFileBtn'}) : intl.formatMessage({id: 'reUpload'})}</Button> | |||||
| >{attachment ? intl.formatMessage({ id: 'uploadFileBtn' }) : intl.formatMessage({ id: 'reUpload' })}</Button> | |||||
| </label> | </label> | ||||
| </Grid> | </Grid> | ||||
| <Grid item xs={12} md={3} lg={3}> | <Grid item xs={12} md={3} lg={3}> | ||||
| </Grid> | </Grid> | ||||
| </Grid> | </Grid> | ||||
| </Grid> | </Grid> | ||||
| {isORGLoggedIn()? | |||||
| {isORGLoggedIn() ? | |||||
| <> | <> | ||||
| <Grid item xs={12} md={12} lg={12}> | <Grid item xs={12} md={12} lg={12}> | ||||
| {FieldUtils.getCarOfField({ | {FieldUtils.getCarOfField({ | ||||
| label: intl.formatMessage({id: 'careOf'}) + ":", | |||||
| label: intl.formatMessage({ id: 'careOf' }) + ":", | |||||
| valueName: "careOf", | valueName: "careOf", | ||||
| form: formik, | form: formik, | ||||
| // disabled: true | // disabled: true | ||||
| @@ -325,35 +325,47 @@ const PublicNoticeApplyForm = ({ loadedData, _selections }) => { | |||||
| </Grid> | </Grid> | ||||
| <Grid item xs={12} md={12} lg={12} sx={{ mb: 3 }}> | <Grid item xs={12} md={12} lg={12} sx={{ mb: 3 }}> | ||||
| <Typography display="inline" variant="subtitle1" sx={{ color: 'primary.primary' }}> | <Typography display="inline" variant="subtitle1" sx={{ color: 'primary.primary' }}> | ||||
| <FormattedMessage id="careOfRemark" /> | |||||
| <FormattedMessage id="noteOnClientRemark" /> | |||||
| </Typography> | </Typography> | ||||
| </Grid> | </Grid> | ||||
| </> | </> | ||||
| : | |||||
| : | |||||
| null | null | ||||
| } | } | ||||
| <Grid item xs={12} md={12} lg={12}> | <Grid item xs={12} md={12} lg={12}> | ||||
| {FieldUtils.getTextArea({ | {FieldUtils.getTextArea({ | ||||
| label: intl.formatMessage({id: 'extraMark'}) + ":", | |||||
| label: intl.formatMessage({ id: 'extraMark' }) + ":", | |||||
| valueName: "remarks", | valueName: "remarks", | ||||
| form: formik, | form: formik, | ||||
| inputProps: { maxLength: 255 } | inputProps: { maxLength: 255 } | ||||
| })} | })} | ||||
| </Grid> | </Grid> | ||||
| <Grid item xs={12}> | |||||
| <Typography variant="h6" height="100%" > | |||||
| <div style={{ padding: 12 }} dangerouslySetInnerHTML={{ __html: intl.formatMessage({ id: "tradeMarkFootnote" }) }} /> | |||||
| </Typography> | |||||
| </Grid> | |||||
| <Grid item xs={12}> | <Grid item xs={12}> | ||||
| <center> | <center> | ||||
| <ThemeProvider theme={PNSPS_LONG_BUTTON_THEME}> | <ThemeProvider theme={PNSPS_LONG_BUTTON_THEME}> | ||||
| <Button | |||||
| aria-label={intl.formatMessage({id: 'applyPublicNotice'})} | |||||
| variant="contained" | |||||
| type="submit" | |||||
| > | |||||
| <FormattedMessage id="applyPublicNotice"/> | |||||
| </Button> | |||||
| <Button | |||||
| aria-label={intl.formatMessage({ id: 'applyPublicNotice' })} | |||||
| variant="contained" | |||||
| type="submit" | |||||
| > | |||||
| <FormattedMessage id="applyPublicNotice" /> | |||||
| </Button> | |||||
| </ThemeProvider> | </ThemeProvider> | ||||
| </center> | </center> | ||||
| </Grid> | </Grid> | ||||
| </Grid> | </Grid> | ||||
| </form> | </form> | ||||
| </Box> | </Box> | ||||
| @@ -372,21 +384,21 @@ const PublicNoticeApplyForm = ({ loadedData, _selections }) => { | |||||
| }} | }} | ||||
| > | > | ||||
| <DialogTitle> | <DialogTitle> | ||||
| <FormattedMessage id="attention"/> | |||||
| <FormattedMessage id="attention" /> | |||||
| </DialogTitle> | </DialogTitle> | ||||
| <DialogContent style={{ display: 'flex', }}> | <DialogContent style={{ display: 'flex', }}> | ||||
| <Typography variant="h3" style={{ padding: '16px' }}>{warningText}</Typography> | <Typography variant="h3" style={{ padding: '16px' }}>{warningText}</Typography> | ||||
| </DialogContent> | </DialogContent> | ||||
| <DialogActions> | <DialogActions> | ||||
| <Button | <Button | ||||
| aria-label={intl.formatMessage({id: 'ok'})} | |||||
| aria-label={intl.formatMessage({ id: 'ok' })} | |||||
| onClick={() => { | onClick={() => { | ||||
| if(val.contactPerson){ | |||||
| if (val.contactPerson) { | |||||
| apply(val); | apply(val); | ||||
| setIsWarningPopUp(false); | setIsWarningPopUp(false); | ||||
| }else{ | |||||
| } else { | |||||
| setIsWarningPopUp(false); | setIsWarningPopUp(false); | ||||
| if(reloadPage){ | |||||
| if (reloadPage) { | |||||
| location.reload(); | location.reload(); | ||||
| } | } | ||||
| } | } | ||||
| @@ -8,7 +8,7 @@ import { | |||||
| Stack, | Stack, | ||||
| Dialog, DialogTitle, DialogContent, DialogActions, InputAdornment, | Dialog, DialogTitle, DialogContent, DialogActions, InputAdornment, | ||||
| } from '@mui/material'; | } from '@mui/material'; | ||||
| import {delBugMode} from "auth/utils"; | |||||
| import { delBugMode } from "auth/utils"; | |||||
| const MainCard = Loadable(lazy(() => import('components/MainCard'))); | const MainCard = Loadable(lazy(() => import('components/MainCard'))); | ||||
| import { useForm } from "react-hook-form"; | import { useForm } from "react-hook-form"; | ||||
| import { | import { | ||||
| @@ -94,17 +94,17 @@ const ApplicationDetailCard = ( | |||||
| setStatus("notAccepted") | setStatus("notAccepted") | ||||
| }; | }; | ||||
| const setCompleteDisable=()=>{ | |||||
| if(delBugMode) return false; | |||||
| const setCompleteDisable = () => { | |||||
| if (delBugMode) return false; | |||||
| return (new Date()).getTime() < DateUtils.convertToDate(applicationDetailData.gazetteIssueDetail.issueDate).getTime(); | return (new Date()).getTime() < DateUtils.convertToDate(applicationDetailData.gazetteIssueDetail.issueDate).getTime(); | ||||
| } | } | ||||
| const complatedClick = () => () => { | const complatedClick = () => () => { | ||||
| let issueDate = DateUtils.convertToDate(applicationDetailData.gazetteIssueDetail.issueDate); | let issueDate = DateUtils.convertToDate(applicationDetailData.gazetteIssueDetail.issueDate); | ||||
| let current = new Date(); | let current = new Date(); | ||||
| if(delBugMode){ | |||||
| if (delBugMode) { | |||||
| setStatus("complete") | setStatus("complete") | ||||
| }else if(current.getTime() >= issueDate.getTime()){ | |||||
| } else if (current.getTime() >= issueDate.getTime()) { | |||||
| setStatus("complete") | setStatus("complete") | ||||
| } | } | ||||
| }; | }; | ||||
| @@ -113,7 +113,7 @@ const ApplicationDetailCard = ( | |||||
| setStatus("withdraw") | setStatus("withdraw") | ||||
| }; | }; | ||||
| const doPublish =()=>()=>{ | |||||
| const doPublish = () => () => { | |||||
| setStatus("publish") | setStatus("publish") | ||||
| } | } | ||||
| @@ -231,24 +231,22 @@ const ApplicationDetailCard = ( | |||||
| <DoneIcon /> | <DoneIcon /> | ||||
| <Typography ml={1} variant="h5">Publish</Typography> | <Typography ml={1} variant="h5">Publish</Typography> | ||||
| </Button> | </Button> | ||||
| <Button | |||||
| // size="large" | |||||
| variant="contained" | |||||
| onClick={withdrawnClick()} | |||||
| sx={{ | |||||
| textTransform: 'capitalize', | |||||
| alignItems: 'end', | |||||
| backgroundColor: '#ffa733' | |||||
| }}> | |||||
| <CloseIcon /> | |||||
| <Typography ml={1} variant="h5">Withdraw</Typography> | |||||
| </Button> | |||||
| </> | </> | ||||
| : | : | ||||
| (currentApplicationDetailData.status == "paid" && currentApplicationDetailData.creditor == 0) ? | |||||
| (currentApplicationDetailData.status == "confirmed" && currentApplicationDetailData.creditor == 0) ? | |||||
| <> | <> | ||||
| <Button | |||||
| // size="large" | |||||
| variant="contained" | |||||
| onClick={complatedClick()} | |||||
| disabled={setCompleteDisable()} | |||||
| sx={{ | |||||
| textTransform: 'capitalize', | |||||
| alignItems: 'end', | |||||
| backgroundColor: '#52b202' | |||||
| }}> | |||||
| <DoneIcon /> | |||||
| <Typography ml={1} variant="h5">Publish</Typography> | |||||
| </Button> | |||||
| <Button | <Button | ||||
| // size="large" | // size="large" | ||||
| variant="contained" | variant="contained" | ||||
| @@ -261,7 +259,40 @@ const ApplicationDetailCard = ( | |||||
| <CloseIcon /> | <CloseIcon /> | ||||
| <Typography ml={1} variant="h5">Withdraw</Typography> | <Typography ml={1} variant="h5">Withdraw</Typography> | ||||
| </Button> | </Button> | ||||
| </> : null | |||||
| </> | |||||
| : | |||||
| ( | |||||
| (currentApplicationDetailData.status == "paid" && currentApplicationDetailData.creditor == 0) ? | |||||
| <> | |||||
| <Button | |||||
| // size="large" | |||||
| variant="contained" | |||||
| onClick={complatedClick()} | |||||
| disabled={setCompleteDisable()} | |||||
| sx={{ | |||||
| textTransform: 'capitalize', | |||||
| alignItems: 'end', | |||||
| backgroundColor: '#52b202' | |||||
| }}> | |||||
| <DoneIcon /> | |||||
| <Typography ml={1} variant="h5">Publish</Typography> | |||||
| </Button> | |||||
| <Button | |||||
| // size="large" | |||||
| variant="contained" | |||||
| onClick={withdrawnClick()} | |||||
| sx={{ | |||||
| textTransform: 'capitalize', | |||||
| alignItems: 'end', | |||||
| backgroundColor: '#ffa733' | |||||
| }}> | |||||
| <CloseIcon /> | |||||
| <Typography ml={1} variant="h5">Withdraw</Typography> | |||||
| </Button> | |||||
| </> : null | |||||
| ) | |||||
| } | } | ||||
| </Stack> | </Stack> | ||||
| </Grid> | </Grid> | ||||
| @@ -312,7 +343,7 @@ const ApplicationDetailCard = ( | |||||
| <Grid item xs={12} md={8} lg={8}> | <Grid item xs={12} md={8} lg={8}> | ||||
| <FormControl variant="outlined"> | <FormControl variant="outlined"> | ||||
| {StatusUtils.getStatusByTextEng(currentApplicationDetailData.status)} | |||||
| {StatusUtils.getStatusByTextEng(currentApplicationDetailData.status, currentApplicationDetailData.creditor)} | |||||
| </FormControl> | </FormControl> | ||||
| </Grid> | </Grid> | ||||
| </Grid> | </Grid> | ||||
| @@ -212,10 +212,16 @@ const ApplicationDetailCard = ( | |||||
| color="edit" | color="edit" | ||||
| disabled={currentApplicationDetailData.status == "rejected" | disabled={currentApplicationDetailData.status == "rejected" | ||||
| || currentApplicationDetailData.status == "cancelled" | || currentApplicationDetailData.status == "cancelled" | ||||
| || currentApplicationDetailData.status == "withdrawn" | |||||
| || currentApplicationDetailData.status == "completed" | |||||
| || currentApplicationDetailData.status == "notAccepted" | |||||
| || currentApplicationDetailData.status == "resubmit" | |||||
| || (!currentApplicationDetailData.creditor | || (!currentApplicationDetailData.creditor | ||||
| && currentApplicationDetailData.status == "paid") | && currentApplicationDetailData.status == "paid") | ||||
| || (currentApplicationDetailData.creditor | || (currentApplicationDetailData.creditor | ||||
| && currentApplicationDetailData.status == "confirmed") | && currentApplicationDetailData.status == "confirmed") | ||||
| || (currentApplicationDetailData.creditor | |||||
| && currentApplicationDetailData.status == "published") | |||||
| } | } | ||||
| title={intl.formatMessage({ id: 'cancel' })} | title={intl.formatMessage({ id: 'cancel' })} | ||||
| startIcon={<CloseIcon />} | startIcon={<CloseIcon />} | ||||
| @@ -276,7 +282,7 @@ const ApplicationDetailCard = ( | |||||
| <Grid item xs={12} md={9} lg={9}> | <Grid item xs={12} md={9} lg={9}> | ||||
| <FormControl variant="outlined"> | <FormControl variant="outlined"> | ||||
| {currentApplicationDetailData.status ? StatusUtils.getStatusByTextIntl(currentApplicationDetailData.status, false, intl) : ""} | |||||
| {currentApplicationDetailData.status ? StatusUtils.getStatusByTextIntl(currentApplicationDetailData.status, currentApplicationDetailData.creditor, intl) : ""} | |||||
| </FormControl> | </FormControl> | ||||
| </Grid> | </Grid> | ||||
| @@ -42,6 +42,7 @@ const Mail = () => { | |||||
| url: apiPath + "/test/send-mail", | url: apiPath + "/test/send-mail", | ||||
| params: { | params: { | ||||
| email: values.email, | email: values.email, | ||||
| tempKey: values.tempKey | |||||
| }, | }, | ||||
| onSuccess: function () { | onSuccess: function () { | ||||
| setResponsText("Success"); | 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 ( | return ( | ||||
| !JSON.parse(localStorage.getItem('userData')).fullenName == "2fi" ? | !JSON.parse(localStorage.getItem('userData')).fullenName == "2fi" ? | ||||
| <Grid container > | <Grid container > | ||||
| @@ -103,6 +123,17 @@ const Mail = () => { | |||||
| onChange={formik.handleChange} | onChange={formik.handleChange} | ||||
| /> | /> | ||||
| </Stack> | </Stack> | ||||
| <Stack direction="row" justifyContent="flex-end" alignItems="center"> | |||||
| <TextField | |||||
| fullWidth | |||||
| id="tempKey" | |||||
| name="tempKey" | |||||
| type="tempKey" | |||||
| placeholder="tempKey" | |||||
| label="tempKey" | |||||
| onChange={formik.handleChange} | |||||
| /> | |||||
| </Stack> | |||||
| </Grid> | </Grid> | ||||
| <Button | <Button | ||||
| variant="contained" | variant="contained" | ||||
| @@ -131,6 +162,22 @@ const Mail = () => { | |||||
| </Button> | </Button> | ||||
| </Grid> | </Grid> | ||||
| <Grid item xs={12} mt={1} style={{ width: '100%', paddingLeft: 64, paddingBottom: 60 }}> | |||||
| <Typography variant="h4" style={{ padding: 8 }}>Set DN Reminder Expect send Date</Typography> | |||||
| <Button | |||||
| variant="contained" | |||||
| onClick={()=>{ | |||||
| testDaily_checkDNStatus(); | |||||
| }} | |||||
| sx={{ | |||||
| textTransform: 'capitalize', | |||||
| alignItems: 'end', | |||||
| width: 250 | |||||
| }}> | |||||
| Test daily_checkDNStatus | |||||
| </Button> | |||||
| </Grid> | |||||
| <div> | <div> | ||||
| <Dialog | <Dialog | ||||
| open={isResponsPopUp} | open={isResponsPopUp} | ||||
| @@ -108,7 +108,7 @@ const RegisterCustom = () => { | |||||
| <Typography textAlign='justify' variant="body1" display="block" gutterBottom> | <Typography textAlign='justify' variant="body1" display="block" gutterBottom> | ||||
| <div dangerouslySetInnerHTML={{ __html: intl.formatMessage({id: 'MSG.registerIAmSmart'}) }} /> | <div dangerouslySetInnerHTML={{ __html: intl.formatMessage({id: 'MSG.registerIAmSmart'}) }} /> | ||||
| </Typography> | </Typography> | ||||
| <Link href="https://www.iamsmart.gov.hk/tc/"> | |||||
| <Link href={intl.formatMessage({ id: "iamsmartLink" })}> | |||||
| <FormattedMessage id="learnMore"/> | <FormattedMessage id="learnMore"/> | ||||
| </Link> | </Link> | ||||
| </Box> | </Box> | ||||
| @@ -192,7 +192,7 @@ const RegisterCustom = () => { | |||||
| <FormattedMessage id="iAmSmartAutoFillIn"/> | <FormattedMessage id="iAmSmartAutoFillIn"/> | ||||
| </Typography></Button> | </Typography></Button> | ||||
| <br/> | <br/> | ||||
| <Link href="https://www.iamsmart.gov.hk/tc/"> | |||||
| <Link href={intl.formatMessage({ id: "iamsmartLink" })}> | |||||
| <FormattedMessage id="learnMore"/> | <FormattedMessage id="learnMore"/> | ||||
| </Link> | </Link> | ||||
| </DialogContent> | </DialogContent> | ||||
| @@ -387,7 +387,7 @@ const AuthLoginCustom = () => { | |||||
| </Grid> | </Grid> | ||||
| <Grid item xs={12}> | <Grid item xs={12}> | ||||
| <Stack direction="row" justifyContent="space-between" alignItems="center" spacing={2}> | <Stack direction="row" justifyContent="space-between" alignItems="center" spacing={2}> | ||||
| <Link href="https://www.iamsmart.gov.hk/tc/" color="primary" sx={{textDecoration:"none"}}> | |||||
| <Link href={intl.formatMessage({ id: "iamsmartLink" })} color="primary" sx={{textDecoration:"none"}}> | |||||
| <Typography align="center" variant="h7"> | <Typography align="center" variant="h7"> | ||||
| { intl.formatMessage({id: 'learnMore'})+" >"} | { intl.formatMessage({id: 'learnMore'})+" >"} | ||||
| </Typography> | </Typography> | ||||
| @@ -3,6 +3,7 @@ | |||||
| "zh-HK": "繁體中文", | "zh-HK": "繁體中文", | ||||
| "zh-CN": "简体中文", | "zh-CN": "简体中文", | ||||
| "language":"Language", | "language":"Language", | ||||
| "iamsmartLink": "https://www.iamsmart.gov.hk/en/", | |||||
| "PNSPS": "PNSPS", | "PNSPS": "PNSPS", | ||||
| "HKSARGOV": "HKSAR Government", | "HKSARGOV": "HKSAR Government", | ||||
| @@ -3,6 +3,7 @@ | |||||
| "zh-HK": "繁體中文", | "zh-HK": "繁體中文", | ||||
| "zh-CN": "简体中文", | "zh-CN": "简体中文", | ||||
| "language":"语言", | "language":"语言", | ||||
| "iamsmartLink": "https://www.iamsmart.gov.hk/sc/", | |||||
| "PNSPS": "公共启事提交及缴费系统", | "PNSPS": "公共启事提交及缴费系统", | ||||
| "HKSARGOV": "香港特别行政区政府", | "HKSARGOV": "香港特别行政区政府", | ||||
| @@ -3,6 +3,7 @@ | |||||
| "zh-HK": "繁體中文", | "zh-HK": "繁體中文", | ||||
| "zh-CN": "简体中文", | "zh-CN": "简体中文", | ||||
| "language":"語言", | "language":"語言", | ||||
| "iamsmartLink": "https://www.iamsmart.gov.hk/tc/", | |||||
| "PNSPS": "公共啟事提交及繳費系統", | "PNSPS": "公共啟事提交及繳費系統", | ||||
| "HKSARGOV": "香港特別行政區政府", | "HKSARGOV": "香港特別行政區政府", | ||||
| @@ -72,12 +72,11 @@ export const DR_IMPORT = apiPath+'/settings/dr/import'; | |||||
| export const AUDIT_LOG_EXPORT = apiPath+'/settings/auditLog-export'; | export const AUDIT_LOG_EXPORT = apiPath+'/settings/auditLog-export'; | ||||
| // POST request | // POST request | ||||
| //Login | //Login | ||||
| export const POST_LOGIN = '/login'; | export const POST_LOGIN = '/login'; | ||||
| export const POST_CAPTCHA = apiPath+'/captcha'; | export const POST_CAPTCHA = apiPath+'/captcha'; | ||||
| export const POST_TERMS_N_CONDITIONS = apiPath+'/termsAndConditions'; | |||||
| export const GET_CONTENT = apiPath+'/getContent'; | |||||
| export const POST_VERIFY_CAPTCHA = apiPath+'/verifyCaptcha'; | export const POST_VERIFY_CAPTCHA = apiPath+'/verifyCaptcha'; | ||||
| export const GET_COMBO = apiPath+'/combo-data'; | export const GET_COMBO = apiPath+'/combo-data'; | ||||