From 748099c8246245d94db73c7ab227b1d93185d6f2 Mon Sep 17 00:00:00 2001 From: "jason.lam" Date: Fri, 12 Jan 2024 12:27:10 +0800 Subject: [PATCH] update public notice --- src/layout/MainLayout/Header/index.js | 7 +++- src/pages/Proof/Reply_Public/ProofForm.js | 6 ++- .../ApplyForm/PublicNoticeApplyForm.js | 14 +++++-- src/pages/PublicNotice/ListPanel/BaseGrid.js | 6 ++- .../ListPanel/SearchPublicNoticeForm.js | 8 ++-- src/pages/PublicNotice/ListPanel/index.js | 21 +++++----- src/pages/dashboard/Public/index.js | 5 ++- src/translations/en.json | 21 +++++++++- src/translations/zh-CN.json | 19 ++++++++++ src/translations/zh-HK.json | 19 ++++++++++ src/utils/ComboData.js | 36 +++++++++--------- src/utils/statusUtils/Base.js | 6 ++- .../statusUtils/PublicNoteStatusUtils.js | 38 ++++++++++++++++++- 13 files changed, 159 insertions(+), 47 deletions(-) diff --git a/src/layout/MainLayout/Header/index.js b/src/layout/MainLayout/Header/index.js index fa31438..f3f776b 100644 --- a/src/layout/MainLayout/Header/index.js +++ b/src/layout/MainLayout/Header/index.js @@ -300,8 +300,11 @@ function Header(props) { - 公共啟事提交 - 及繳費系統 + {/*公共啟事提交*/} + {/*及繳費系統*/} + + + diff --git a/src/pages/Proof/Reply_Public/ProofForm.js b/src/pages/Proof/Reply_Public/ProofForm.js index 457e946..c96053d 100644 --- a/src/pages/Proof/Reply_Public/ProofForm.js +++ b/src/pages/Proof/Reply_Public/ProofForm.js @@ -24,7 +24,7 @@ import Loadable from 'components/Loadable'; import { notifyActionSuccess } from 'utils/CommonFunction'; import {PNSPS_BUTTON_THEME} from "../../../themes/buttonConst"; import {ThemeProvider} from "@emotion/react"; -import {useIntl} from "react-intl"; +import {FormattedMessage, useIntl} from "react-intl"; const UploadFileTable = Loadable(React.lazy(() => import('./UploadFileTable'))); // ==============================|| DASHBOARD - DEFAULT ||============================== // @@ -299,7 +299,9 @@ const FormPanel = ({ formData }) => {
setIsWarningPopUp(false)} > - 注意 + + + {warningText} diff --git a/src/pages/PublicNotice/ApplyForm/PublicNoticeApplyForm.js b/src/pages/PublicNotice/ApplyForm/PublicNoticeApplyForm.js index cab65d1..b88e858 100644 --- a/src/pages/PublicNotice/ApplyForm/PublicNoticeApplyForm.js +++ b/src/pages/PublicNotice/ApplyForm/PublicNoticeApplyForm.js @@ -23,7 +23,7 @@ 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 {useIntl} from "react-intl"; +import {FormattedMessage, useIntl} from "react-intl"; // ==============================|| DASHBOARD - DEFAULT ||============================== // @@ -132,7 +132,9 @@ const PublicNoticeApplyForm = ({ loadedData, selections }) => {
- 申請公共啟事 + + +
@@ -256,7 +258,9 @@ const PublicNoticeApplyForm = ({ loadedData, selections }) => { + > + + @@ -266,7 +270,9 @@ const PublicNoticeApplyForm = ({ loadedData, selections }) => {
setIsWarningPopUp(false)} > - 注意 + + + {warningText} diff --git a/src/pages/PublicNotice/ListPanel/BaseGrid.js b/src/pages/PublicNotice/ListPanel/BaseGrid.js index 40b7e49..fa03cf4 100644 --- a/src/pages/PublicNotice/ListPanel/BaseGrid.js +++ b/src/pages/PublicNotice/ListPanel/BaseGrid.js @@ -6,18 +6,20 @@ import { Typography, useMediaQuery } from '@mui/material'; import * as DateUtils from "utils/DateUtils" -import * as StatusUtils from "utils/statusUtils/PublicNoteStatusUtils"; import {useNavigate} from "react-router-dom"; import { isORGLoggedIn, } from "utils/Utils"; import {useTheme} from "@emotion/react"; +import {getStatusIntl} from "utils/statusUtils/PublicNoteStatusUtils"; +import {useIntl} from "react-intl"; // ==============================|| EVENT TABLE ||============================== // export default function BaseGrid({rows}) { const navigate = useNavigate() const theme = useTheme(); const isMdOrLg = useMediaQuery(theme.breakpoints.up('md')); + const intl = useIntl(); const handleDetailClick = (params) => () => { navigate('/publicNotice/'+ params.id); @@ -93,7 +95,7 @@ export default function BaseGrid({rows}) { width: isMdOrLg ? 'auto' : 160, flex: isMdOrLg ? 1 : undefined, renderCell: (params) => { - return [StatusUtils.getStatus(params)] + return [getStatusIntl(params,intl)] }, }, { diff --git a/src/pages/PublicNotice/ListPanel/SearchPublicNoticeForm.js b/src/pages/PublicNotice/ListPanel/SearchPublicNoticeForm.js index 3f50227..eaa272c 100644 --- a/src/pages/PublicNotice/ListPanel/SearchPublicNoticeForm.js +++ b/src/pages/PublicNotice/ListPanel/SearchPublicNoticeForm.js @@ -15,14 +15,14 @@ import { } from "utils/Utils"; import {PNSPS_BUTTON_THEME} from "../../../themes/buttonConst"; import {ThemeProvider} from "@emotion/react"; -import {FormattedMessage} from "react-intl"; +import {FormattedMessage, useIntl} from "react-intl"; // ==============================|| DASHBOARD - DEFAULT ||============================== // const SearchPublicNoticeForm = ({ applySearch, searchCriteria }) => { - + const intl = useIntl(); const [type, setType] = React.useState([]); - const [status, setStatus] = React.useState([{ key: 0, label: 'All', labelCht: "全部", type: 'all' }]); + const [status, setStatus] = React.useState([{ key: 0, label: 'all', type: 'all' }]); const [minDate, setMinDate] = React.useState(searchCriteria.dateFrom); const [maxDate, setMaxDate] = React.useState(searchCriteria.dateTo); @@ -160,7 +160,7 @@ const SearchPublicNoticeForm = ({ applySearch, searchCriteria }) => { } value={status} // inputValue={status?.labelCht} - getOptionLabel={(option) => option.labelCht} + getOptionLabel={(option) => intl.formatMessage({id: option.label})} onChange={(event, newValue) => { console.log(newValue) const findAllIndex = newValue.findIndex((ele) => { diff --git a/src/pages/PublicNotice/ListPanel/index.js b/src/pages/PublicNotice/ListPanel/index.js index dfe6192..72112f0 100644 --- a/src/pages/PublicNotice/ListPanel/index.js +++ b/src/pages/PublicNotice/ListPanel/index.js @@ -25,7 +25,7 @@ const SearchTab = Loadable(lazy(() => import('./SearchPublicNoticeTab'))); import titleBackgroundImg from 'assets/images/dashboard/gazette-bar.png' import {PNSPS_LONG_BUTTON_THEME} from "../../../themes/buttonConst"; import {ThemeProvider} from "@emotion/react"; -import {FormattedMessage} from "react-intl"; +import {FormattedMessage, useIntl} from "react-intl"; // ==============================|| DASHBOARD - DEFAULT ||============================== // @@ -37,6 +37,7 @@ const PublicNotice = () => { const [isLoading, setLoding] = useState(true); const [selectedTab, setSelectedTab] = useState("1"); const navigate = useNavigate(); + const intl = useIntl(); const _sx = { padding: "4 2 4 2", @@ -118,7 +119,7 @@ const PublicNotice = () => { @@ -132,10 +133,10 @@ const PublicNotice = () => { - - - - + + + + @@ -169,10 +170,10 @@ const PublicNotice = () => { - - - - + + + + diff --git a/src/pages/dashboard/Public/index.js b/src/pages/dashboard/Public/index.js index 116dcd6..941e79b 100644 --- a/src/pages/dashboard/Public/index.js +++ b/src/pages/dashboard/Public/index.js @@ -10,6 +10,7 @@ import { isORGLoggedIn, } from "utils/Utils"; import titleBackgroundImg from 'assets/images/dashboard/gazette-bar.png' +import {FormattedMessage} from "react-intl"; // ==============================|| DASHBOARD - DEFAULT ||============================== // const DashboardDefault = () => { @@ -30,7 +31,9 @@ const DashboardDefault = () => {
{/* 我的公共啟事 */} - {isORGLoggedIn() ?userData.fullenName:userData.fullchName}, 午安! 請選擇所需服務。 + + {isORGLoggedIn() ?userData.fullenName:userData.fullchName}, +
diff --git a/src/translations/en.json b/src/translations/en.json index f3ae6f8..d67bf33 100644 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -24,6 +24,7 @@ "onlinePaymentHistory": "Online Payment History", "setting": "Setting", "companyOrUserRecord": "Company/Institutional User Records", + "welcomeMsg": "Good afternoon! Please select the required service.", "login": "Login", "iAmSmartLogin": "iAM Smart Login", @@ -86,7 +87,7 @@ "businessChName": "Chinese name of Organization/Company", "preview": "Preview", "finishSubmission": "Finish Submission", - "reset": "reset", + "reset": "Reset", "requireString": "Items marked with * must be filled in", "confirmPassword": "Confirm password", "pleaseConfirmPassword": "Please confirm password", @@ -181,6 +182,24 @@ "lammaIslandCombo": "Lamma Island District", "pengChauCombo": "Peng Chau District", + "applyPublicNotice": "Apply for public notice", + "attention": "attention", + "all": "All", + "processing": "Processing", + "pendingPayment": "Pending payment", + "pendingPublish": "To be Published", + "completed": "Completed", + "notAccepted": "Not accepted", + "resubmit": "Re-submit Required", + "cancelled": "Cancelled", + "withdrawn": "Withdrawn", + "searchApplyRecord": "Search application record", + "applicationId": "Application number", + "submitDate": "submit date", + "myRemarks": "My notes", + "status": "status", + "viewDetail": "View details", + "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 d2739f2..fc30631 100644 --- a/src/translations/zh-CN.json +++ b/src/translations/zh-CN.json @@ -24,6 +24,7 @@ "onlinePaymentHistory": "网上付款记录", "setting": "设置", "companyOrUserRecord": "公司/机构用户记录", + "welcomeMsg": "午安! 请选择所需服务。", "login": "登录", "iAmSmartLogin": "智方便登录", @@ -181,6 +182,24 @@ "lammaIslandCombo": "南丫岛区", "pengChauCombo": "坪洲区", + "applyPublicNotice": "申請公共啟事", + "attention": "注意", + "all": "全部", + "processing": "處理中", + "pendingPayment": "待付款", + "pendingPublish": "待發佈", + "completed": "已完成", + "notAccepted": "不接受", + "resubmit": "需重新提交", + "cancelled": "已取消", + "withdrawn": "已撤銷", + "searchApplyRecord": "搜尋申請記錄", + "applicationId": "申請編號", + "submitDate": "提交日期", + "myRemarks": "我的備註", + "status": "狀態", + "viewDetail": "查看詳細", + "Dashboard": "仪表板", "event": "活动" } \ No newline at end of file diff --git a/src/translations/zh-HK.json b/src/translations/zh-HK.json index 4f85b13..60437f0 100644 --- a/src/translations/zh-HK.json +++ b/src/translations/zh-HK.json @@ -24,6 +24,7 @@ "onlinePaymentHistory": "網上付款記錄", "setting": "設定", "companyOrUserRecord": "公司/機構用戶記錄", + "welcomeMsg": "午安! 請選擇所需服務。", "login": "登入", "iAmSmartLogin": "智方便登入", @@ -181,6 +182,24 @@ "lammaIslandCombo": "南丫島區", "pengChauCombo": "坪洲區", + "applyPublicNotice": "申請公共啟事", + "attention": "注意", + "all": "全部", + "processing": "處理中", + "pendingPayment": "待付款", + "pendingPublish": "待發佈", + "completed": "已完成", + "notAccepted": "不接受", + "resubmit": "需重新提交", + "cancelled": "已取消", + "withdrawn": "已撤銷", + "searchApplyRecord": "搜尋申請記錄", + "applicationId": "申請編號", + "submitDate": "提交日期", + "myRemarks": "我的備註", + "status": "狀態", + "viewDetail": "查看詳細", + "Dashboard": "儀表板", "event": "活動" } \ No newline at end of file diff --git a/src/utils/ComboData.js b/src/utils/ComboData.js index c7ffa59..52c4adb 100644 --- a/src/utils/ComboData.js +++ b/src/utils/ComboData.js @@ -24,27 +24,27 @@ export const country = (intl) => { export const accountFilter = [{ id: 1, key: 1, label: 'Active', type: 'active' }, { id: 2, key: 2, label: 'Locked', type: 'locked' }, { id: 3, key: 3, label: 'Not verified', type: 'notVerified' }]; export const publicNoticeStatic = [ - { key: 0, labelCht: '全部', label: 'All', type: 'all' }, - { key: 1, labelCht: '處理中', label: 'Processing', type: 'processing' }, // submitted and reviewed - { key: 2, labelCht: '待付款', label: 'Pending Payment', type: 'confirmed' }, - { key: 3, labelCht: '待發布', label: 'To be published', type: 'paid' }, - { key: 4, labelCht: '已完成', label: 'Completed', type: 'completed' }, - { key: 5, labelCht: '不接受', label: 'Not accepted', type: 'notAccepted' }, - { key: 6, labelCht: '需重新提交', label: 'Re-submit Required', type: 'resubmit' }, - { key: 7, labelCht: '已取消', label: 'Cancelled', type: 'cancelled' }, - { key: 8, labelCht: '已撤銷', label: 'Withdrawn', type: 'withdrawn' }, + { key: 0, label: 'all', type: 'all' }, + { key: 1, label: 'processing', type: 'processing' }, // submitted and reviewed + { key: 2, label: 'pendingPayment', type: 'confirmed' }, + { key: 3, label: 'pendingPublish', type: 'paid' }, + { key: 4, label: 'completed', type: 'completed' }, + { key: 5, label: 'notAccepted', type: 'notAccepted' }, + { key: 6, label: 'resubmit', type: 'resubmit' }, + { key: 7, label: 'cancelled', type: 'cancelled' }, + { key: 8, label: 'withdrawn', type: 'withdrawn' }, ]; export const publicNoticeStatic_Creditor = [ - { key: 0, labelCht: '全部', label: 'All', type: 'all' }, - { key: 1, labelCht: '處理中', label: 'Processing', type: 'processing' }, // submitted and reviewed - { key: 2, labelCht: '待發布', label: 'To be published', type: 'confirmed' }, - { key: 3, labelCht: '待付款', label: 'Pending Payment', type: 'published' }, - { key: 4, labelCht: '已完成', label: 'Completed', type: 'completed' }, - { key: 5, labelCht: '不接受', label: 'Not accepted', type: 'notAccepted' }, - { key: 6, labelCht: '需重新提交', label: 'Re-submit Required', type: 'resubmit' }, - { key: 7, labelCht: '已取消', label: 'Cancelled', type: 'cancelled' }, - { key: 8, labelCht: '已撤銷', label: 'Withdrawn', type: 'withdrawn' }, + { key: 0, label: 'all', type: 'all' }, + { key: 1, label: 'processing', type: 'processing' }, // submitted and reviewed + { key: 2, label: 'pendingPublish', type: 'confirmed' }, + { key: 3, label: 'pendingPayment', type: 'published' }, + { key: 4, label: 'completed', type: 'completed' }, + { key: 5, label: 'notAccepted', type: 'notAccepted' }, + { key: 6, label: 'resubmit', type: 'resubmit' }, + { key: 7, label: 'cancelled', type: 'cancelled' }, + { key: 8, label: 'withdrawn', type: 'withdrawn' }, ]; diff --git a/src/utils/statusUtils/Base.js b/src/utils/statusUtils/Base.js index 60d03cb..4ed3754 100644 --- a/src/utils/statusUtils/Base.js +++ b/src/utils/statusUtils/Base.js @@ -2,6 +2,10 @@ import { Typography } from "@mui/material" export function getStatusTag({ color = "#000", textColor = "#FFF", text = "" }) { return ( -
{text}
+
+ + {text} + +
) } \ No newline at end of file diff --git a/src/utils/statusUtils/PublicNoteStatusUtils.js b/src/utils/statusUtils/PublicNoteStatusUtils.js index 4c6c592..64cdc31 100644 --- a/src/utils/statusUtils/PublicNoteStatusUtils.js +++ b/src/utils/statusUtils/PublicNoteStatusUtils.js @@ -14,13 +14,13 @@ export function getStatusByText(status, creditor) { return getStatusTag({ color: "#f5a83d", text: "處理中" }) case "confirmed": if (creditor) - return getStatusTag({ color: "#22a13f", text: "待發布" }) + return getStatusTag({ color: "#22a13f", text: "待發佈" }) else return getStatusTag({ color: "#22a13f", text: "待付款" }) case "published": return getStatusTag({ color: "#22a13f", text: "待付款" }) case "paid": - return getStatusTag({ color: "#22a13f", text: "待發布" }) + return getStatusTag({ color: "#22a13f", text: "待發佈" }) case "complated": return getStatusTag({ color: "#8a8784", text: "已完成" }) case "notAccepted": @@ -68,3 +68,37 @@ export function getStatusByTextEng(status, creditor) { return getStatusTag({ text: status }) } } + +export function getStatusIntl(params, intl) { + return getStatusByTextIntl(params.row.status, params.row.creditor, intl); +} + +export function getStatusByTextIntl(status, creditor, intl) { + switch (status) { + case "submitted": + return getStatusTag({ color: "#f5a83d", text: intl.formatMessage({id: 'processing'}) }) + case "reviewed": + return getStatusTag({ color: "#f5a83d", text: intl.formatMessage({id: 'processing'}) }) + case "confirmed": + if (creditor) + return getStatusTag({ color: "#22a13f", text: intl.formatMessage({id: 'pendingPublish'}) }) + else + return getStatusTag({ color: "#22a13f", text: intl.formatMessage({id: 'pendingPayment'}) }) + case "published": + return getStatusTag({ color: "#22a13f", text: intl.formatMessage({id: 'pendingPayment'}) }) + case "paid": + return getStatusTag({ color: "#22a13f", text: intl.formatMessage({id: 'pendingPublish'}) }) + case "complated": + return getStatusTag({ color: "#8a8784", text: intl.formatMessage({id: 'completed'}) }) + case "notAccepted": + return getStatusTag({ color: "#d9372b", text: intl.formatMessage({id: 'notAccepted'}) }) + case "resubmit": + return getStatusTag({ color: "#757373", text: intl.formatMessage({id: 'resubmit'}) }) + case "cancelled": + return getStatusTag({ color: "#909497", text: intl.formatMessage({id: 'cancelled'}) }) + case "withdrawn": + return getStatusTag({ color: "#909497", text: intl.formatMessage({id: 'withdrawn'}) }) + default: + return getStatusTag({ text: status }) + } +}