From f6f1feec73393fad82971de13abe1cbb94fa93ad Mon Sep 17 00:00:00 2001 From: "jason.lam" Date: Mon, 8 Jan 2024 15:25:00 +0800 Subject: [PATCH 1/7] update layout --- src/components/FileList.js | 22 +- src/pages/PublicNotice/Details_GLD/index.js | 4 +- .../UserInformationCard_Individual.js | 525 +++++++++--------- .../User/DetailsPage_Individual/index.js | 53 +- src/utils/FieldUtils.js | 4 +- 5 files changed, 296 insertions(+), 312 deletions(-) diff --git a/src/components/FileList.js b/src/components/FileList.js index 045f3fe..202ecc2 100644 --- a/src/components/FileList.js +++ b/src/components/FileList.js @@ -8,11 +8,15 @@ import * as HttpUtils from "../utils/HttpUtils" import * as UrlUtils from "../utils/ApiPathConst" import * as DateUtils from "../utils/DateUtils" import { FiDataGrid } from './FiDataGrid'; +import {useTheme} from "@emotion/react"; +import {useMediaQuery} from "@mui/material"; // ==============================|| EVENT TABLE ||============================== // export default function FileList({ refType, refId, allowDelete, sx, dateHideable,lang, ...props }) { const [rows, setRows] = React.useState([]); const [rowModesModel] = React.useState({}); + const theme = useTheme(); + const isMdOrLg = useMediaQuery(theme.breakpoints.up('md')); React.useEffect(() => { loadData(); @@ -92,13 +96,15 @@ export default function FileList({ refType, refId, allowDelete, sx, dateHideable id: 'filename', field: 'filename', headerName: lang=="ch"?"檔案名稱":'File Name', - flex: 3, + width: isMdOrLg ? 'auto' : 400, + flex: isMdOrLg ? 3 : undefined, }, { id: 'filesize', field: 'filesize', headerName: lang=="ch"?"檔案大小":'File Size', - flex: 1, + width: isMdOrLg ? 'auto' : 160, + flex: isMdOrLg ? 1 : undefined, valueGetter: (params) => { return convertToStr(params.value); } @@ -110,7 +116,8 @@ export default function FileList({ refType, refId, allowDelete, sx, dateHideable id: 'created', field: 'created', headerName: lang=="ch"?"日期":'Created', - flex: 1, + width: isMdOrLg ? 'auto' : 160, + flex: isMdOrLg ? 1 : undefined, valueGetter: (params) => { return DateUtils.datetimeStr(params.value); } @@ -137,13 +144,15 @@ export default function FileList({ refType, refId, allowDelete, sx, dateHideable id: 'filename', field: 'filename', headerName: lang=="ch"?"檔案名稱":'File Name', - flex: 3, + width: isMdOrLg ? 'auto' : 400, + flex: isMdOrLg ? 3 : undefined, }, { id: 'filesize', field: 'filesize', headerName: lang=="ch"?"檔案大小":'File Size', - flex: 1, + width: isMdOrLg ? 'auto' : 160, + flex: isMdOrLg ? 1 : undefined, valueGetter: (params) => { return convertToStr(params.value); } @@ -175,7 +184,6 @@ export default function FileList({ refType, refId, allowDelete, sx, dateHideable } return ( - //
- //
); } diff --git a/src/pages/PublicNotice/Details_GLD/index.js b/src/pages/PublicNotice/Details_GLD/index.js index abdd7c7..a92c56e 100644 --- a/src/pages/PublicNotice/Details_GLD/index.js +++ b/src/pages/PublicNotice/Details_GLD/index.js @@ -380,10 +380,10 @@ const PublicNoticeDetail_GLD = () => { - + - + { :
{/*top button*/} - + - {editMode ? <> @@ -195,319 +194,319 @@ const UserInformationCard_Individual = ({ formData, loadDataFun }) => { } - {/*end top button*/} Individual User Details - - - {FieldUtils.getTextField({ - label: "Username:", - valueName: "username", - disabled: true, - form: formik - })} - + + + + {FieldUtils.getTextField({ + label: "Username:", + valueName: "username", + disabled: true, + form: formik + })} + - - {FieldUtils.getTextField({ - label: "English Name:", - valueName: "enName", - disabled: (!editMode), - form: formik - })} - + + {FieldUtils.getTextField({ + label: "English Name:", + valueName: "enName", + disabled: (!editMode), + form: formik + })} + - - {FieldUtils.getTextField({ - label: "Created Date:", - valueName: "createDate", - disabled: true, - form: formik - })} - - - {FieldUtils.getTextField({ - label: "Prefix:", - valueName: "prefix", - disabled: (!editMode), - form: formik - })} - + + {FieldUtils.getTextField({ + label: "Created Date:", + valueName: "createDate", + disabled: true, + form: formik + })} + + + {FieldUtils.getTextField({ + label: "Prefix:", + valueName: "prefix", + disabled: (!editMode), + form: formik + })} + - - {FieldUtils.getTextField({ - label: "Chinese Name:", - valueName: "chName", - disabled: (!editMode), - form: formik - })} - + + {FieldUtils.getTextField({ + label: "Chinese Name:", + valueName: "chName", + disabled: (!editMode), + form: formik + })} + - - {FieldUtils.getTextField({ - label: "Last Updated:", - valueName: "modifieDate", - disabled: true, - form: formik - })} - + + {FieldUtils.getTextField({ + label: "Last Updated:", + valueName: "modifieDate", + disabled: true, + form: formik + })} + - - {FieldUtils.getComboField({ - label: "ID Type:", - valueName: "idDocType", - disabled: (!editMode), - dataList: ComboData.idDocType, - filterOptions: (options) => options, - getOptionLabel: (item) => item ? typeof item === 'string' ? item : (item["type"] ? item["type"] + "-" + item["label"] : "") : "", - onInputChange: (event, newValue, setInputValue) => { - if (newValue == null) { - setInputValue(""); - } - let _val = newValue.split("-"); - if (_val[0]) { - setInputValue(_val[0]); - } - }, - onChange: (event, newValue) => { - if (newValue == null) { - formik.setFieldValue("idDocType", ""); - return; - } - formik.setFieldValue("idDocType", newValue.type); - }, - form: formik - })} - + + {FieldUtils.getComboField({ + label: "ID Type:", + valueName: "idDocType", + disabled: (!editMode), + dataList: ComboData.idDocType, + filterOptions: (options) => options, + getOptionLabel: (item) => item ? typeof item === 'string' ? item : (item["type"] ? item["type"] + "-" + item["label"] : "") : "", + onInputChange: (event, newValue, setInputValue) => { + if (newValue == null) { + setInputValue(""); + } + let _val = newValue.split("-"); + if (_val[0]) { + setInputValue(_val[0]); + } + }, + onChange: (event, newValue) => { + if (newValue == null) { + formik.setFieldValue("idDocType", ""); + return; + } + formik.setFieldValue("idDocType", newValue.type); + }, + form: formik + })} + - - {FieldUtils.getPhoneField({ - label: "Contact Tel:", - valueName: { - code: "tel_countryCode", - num: "phoneNumber" - }, - disabled: (!editMode), - form: formik - })} - + + {FieldUtils.getPhoneField({ + label: "Contact Tel:", + valueName: { + code: "tel_countryCode", + num: "phoneNumber" + }, + disabled: (!editMode), + form: formik + })} + - - - - Verified: - + + + + Verified: + - { - currentUserData.verifiedBy || editMode ? - - {FieldUtils.initField({ - valueName: "verifiedStatus", - disabled: true, - form: formik, - })} - - : - <> - + { + currentUserData.verifiedBy || editMode ? + {FieldUtils.initField({ valueName: "verifiedStatus", disabled: true, form: formik, })} - - - - - } - - - - - - - - ID No.: - - - - - {formik.values.idDocType == "HKID" ? + : <> - + {FieldUtils.initField({ - valueName: "identification", - disabled: (!editMode), + valueName: "verifiedStatus", + disabled: true, form: formik, - placeholder: "證件號碼", - inputProps: { - maxLength: 7, - onKeyDown: (e) => { - if (e.key === 'Enter') { - e.preventDefault(); - } - }, - } })} - - + + + + + } + + + + + + + + ID No.: + + + + + {formik.values.idDocType == "HKID" ? + <> + + {FieldUtils.initField({ + valueName: "identification", + disabled: (!editMode), + form: formik, + placeholder: "證件號碼", + inputProps: { + maxLength: 7, + onKeyDown: (e) => { + if (e.key === 'Enter') { + e.preventDefault(); + } + }, + } + })} + + + + {FieldUtils.initField({ + valueName: "checkDigit", + disabled: (!editMode), + form: formik + })} + + : + {FieldUtils.initField({ - valueName: "checkDigit", + valueName: "identification", disabled: (!editMode), form: formik })} - : - - {FieldUtils.initField({ - valueName: "identification", - disabled: (!editMode), - form: formik - })} - - } + } + - - - {FieldUtils.getPhoneField({ - label: "Fax No.:", - valueName: { - code: "fax_countryCode", - num: "faxNumber" - }, - disabled: (!editMode), - form: formik - })} - + + {FieldUtils.getPhoneField({ + label: "Fax No.:", + valueName: { + code: "fax_countryCode", + num: "faxNumber" + }, + disabled: (!editMode), + form: formik + })} + - - {FieldUtils.getTextField({ - label: "Last Login:", - valueName: "lastLoginDate", - disabled: true, - form: formik - })} - + + {FieldUtils.getTextField({ + label: "Last Login:", + valueName: "lastLoginDate", + disabled: true, + form: formik + })} + - - {FieldUtils.getComboField({ - label: "Country:", - valueName: "country", - dataList: ComboData.country, - disabled: (!editMode), - form: formik - })} - + + {FieldUtils.getComboField({ + label: "Country:", + valueName: "country", + dataList: ComboData.country, + disabled: (!editMode), + form: formik + })} + - - {FieldUtils.getTextField({ - label: "Email:", - valueName: "emailAddress", - disabled: (!editMode), - form: formik - })} - + + {FieldUtils.getTextField({ + label: "Email:", + valueName: "emailAddress", + disabled: (!editMode), + form: formik + })} + - - - - Status: - + + + + Status: + - { - editMode ? - - {FieldUtils.initField({ - valueName: "status", - disabled: true, - form: formik, - })} - - : - <> - + { + editMode ? + {FieldUtils.initField({ valueName: "status", disabled: true, form: formik, })} - {locked ? - - - - : - - + : + <> + + {FieldUtils.initField({ + valueName: "status", + disabled: true, + form: formik, + })} - } - - } + {locked ? + + + + : + + + + } + + } + - - - {FieldUtils.getAddressField({ - label: "Address:", - valueName: ["addressLine1", "addressLine2", "addressLine3"], - disabled: (!editMode), - form: formik - })} - + + {FieldUtils.getAddressField({ + label: "Address:", + valueName: ["addressLine1", "addressLine2", "addressLine3"], + disabled: (!editMode), + form: formik + })} + - - {FieldUtils.getComboField({ - label: "District:", - valueName: "district", - dataList: ComboData.district, - disabled: (!editMode), - form: formik - })} + + {FieldUtils.getComboField({ + label: "District:", + valueName: "district", + dataList: ComboData.district, + disabled: (!editMode), + form: formik + })} + - } diff --git a/src/pages/User/DetailsPage_Individual/index.js b/src/pages/User/DetailsPage_Individual/index.js index de2a01f..3dbece4 100644 --- a/src/pages/User/DetailsPage_Individual/index.js +++ b/src/pages/User/DetailsPage_Individual/index.js @@ -1,7 +1,7 @@ // material-ui import * as React from "react"; -import { Grid, Typography, Button, Stack, Box } from '@mui/material'; +import { Grid, Typography, Button, Stack } from '@mui/material'; import FileList from "../../../components/FileList" import MainCard from "../../../components/MainCard"; import * as HttpUtils from "../../../utils/HttpUtils"; @@ -35,26 +35,6 @@ const UserMaintainPage_Individual = () => { const [formData, setFormData] = React.useState({}) const [isLoading, setLoding] = React.useState(true); - const _sx = { - ml: 6, - mr: 6, - mb: 3, - mt: 3, - padding: "4 2 4 2", - boxShadow: 1, - border: 1, - borderColor: '#DDD', - '& .MuiDataGrid-cell': { - borderTop: 1, - borderBottom: 1, - borderColor: "#EEE" - }, - '& .MuiDataGrid-footerContainer': { - border: 1, - borderColor: "#EEE" - } - } - React.useEffect(() => { loadData(); }, []); @@ -102,7 +82,7 @@ const UserMaintainPage_Individual = () => { isLoading ? : - +
@@ -116,29 +96,26 @@ const UserMaintainPage_Individual = () => { {/*col 1*/} - + - - - - + + - - - - Files - + + + Files + + - - + +
diff --git a/src/utils/FieldUtils.js b/src/utils/FieldUtils.js index 1577fc5..457f3f4 100644 --- a/src/utils/FieldUtils.js +++ b/src/utils/FieldUtils.js @@ -27,8 +27,8 @@ export const getDateField = ({ label, valueName, form, disabled }) => { } export const getTextField = ({ label, valueName, form, disabled }) => { - return - + {label} From edaa18fe454c1ad22cd2c92f9b4ba20306b4407b Mon Sep 17 00:00:00 2001 From: anna Date: Mon, 8 Jan 2024 15:50:10 +0800 Subject: [PATCH 2/7] fix bug --- src/pages/Proof/Reply_Public/ProofForm.js | 9 ++++++--- src/pages/authentication/IAmSmartRegister.js | 1 + src/utils/statusUtils/PublicNoteStatusUtils.js | 12 ++++++------ 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/pages/Proof/Reply_Public/ProofForm.js b/src/pages/Proof/Reply_Public/ProofForm.js index 4d6c510..d99e197 100644 --- a/src/pages/Proof/Reply_Public/ProofForm.js +++ b/src/pages/Proof/Reply_Public/ProofForm.js @@ -76,11 +76,14 @@ const FormPanel = ({ formData }) => { }, files: attachments ? attachments : [], onSuccess: function () { + notifyActionSuccess("提交成功!") if (actionValue) { - notifyActionSuccess("提交成功!") - navigate("/proof/pay/" + params.id); + if(data.creditor){ + navigate("/proof/search"); + }else{ + navigate("/proof/pay/" + params.id); + } } else { - notifyActionSuccess("提交成功!") navigate("/proof/search"); } }, diff --git a/src/pages/authentication/IAmSmartRegister.js b/src/pages/authentication/IAmSmartRegister.js index b3d77fc..2e4c7be 100644 --- a/src/pages/authentication/IAmSmartRegister.js +++ b/src/pages/authentication/IAmSmartRegister.js @@ -56,6 +56,7 @@ const Register = () => { const [completed, setCompleted] = useState([false]); const [updateValid, setUpdateValid] = useState(false); const [base64Url, setBase64Url] = useState("") + const [checkCode, setCheckCode] = useState("") const [idNo, setIdNo] = useState(""); const totalSteps = () => { diff --git a/src/utils/statusUtils/PublicNoteStatusUtils.js b/src/utils/statusUtils/PublicNoteStatusUtils.js index 07e42ce..8fddc1b 100644 --- a/src/utils/statusUtils/PublicNoteStatusUtils.js +++ b/src/utils/statusUtils/PublicNoteStatusUtils.js @@ -3,17 +3,17 @@ import {getStatusTag} from "utils/statusUtils/Base"; export function getStatus(params) { - return getStatusByText(params.row.status); + return getStatusByText(params.row.status, params.row.creditor); } -export function getStatusByText(status) { +export function getStatusByText(status, creditor) { switch (status) { case "submitted": return getStatusTag({ color: "#f5a83d", text: "處理中" }) case "reviewed": return getStatusTag({ color: "#f5a83d", text: "處理中" }) case "confirmed": - if (localStorage.getItem('userData').creditor) + if (creditor) return getStatusTag({ color: "#22a13f", text: "待發布" }) else return getStatusTag({ color: "#22a13f", text: "待付款" }) @@ -37,16 +37,16 @@ export function getStatusByText(status) { } export function getStatusEng(params) { - return getStatusByTextEng(params.row.status); + return getStatusByTextEng(params.row.status, params.row.creditor); } -export function getStatusByTextEng(status) { +export function getStatusByTextEng(status, creditor) { switch (status) { case "submitted": return getStatusTag({ color: "#f5a83d", text: "Submitted" }) case "reviewed": return getStatusTag({ color: "#0C489E", text: "Reviewed" }) case "confirmed": - if (localStorage.getItem('userData').creditor) + if (creditor) return getStatusTag({ color: "#22a13f", text: "Pending Publish" }) else return getStatusTag({ color: "#22a13f", text: "Pending Payment" }) From 38b8304e6b668693889be8eace9159a929dec757 Mon Sep 17 00:00:00 2001 From: "jason.lam" Date: Mon, 8 Jan 2024 16:25:25 +0800 Subject: [PATCH 3/7] update individual user page --- .../UserInformationCard_Individual.js | 76 +++++++++---------- .../User/DetailsPage_Individual/index.js | 4 +- src/utils/FieldUtils.js | 14 ++-- 3 files changed, 45 insertions(+), 49 deletions(-) diff --git a/src/pages/User/DetailsPage_Individual/UserInformationCard_Individual.js b/src/pages/User/DetailsPage_Individual/UserInformationCard_Individual.js index f1b76d6..3213ec9 100644 --- a/src/pages/User/DetailsPage_Individual/UserInformationCard_Individual.js +++ b/src/pages/User/DetailsPage_Individual/UserInformationCard_Individual.js @@ -148,7 +148,7 @@ const UserInformationCard_Individual = ({ formData, loadDataFun }) => { {editMode ? <> - + : - + : - currentApplicationDetailData.status == "paid" ? + (currentApplicationDetailData.status == "confirmed" && currentApplicationDetailData.creditor == 1) ? <> - - : null + + : + (currentApplicationDetailData.status == "paid" && currentApplicationDetailData.creditor == 0) ? + <> + + + : null }
@@ -267,7 +287,7 @@ const ApplicationDetailCard = ( - + @@ -329,7 +349,7 @@ const ApplicationDetailCard = ( - + @@ -351,7 +371,7 @@ const ApplicationDetailCard = ( WebkitTextFillColor: "#000000", background: "#f8f8f8", }, - mr:1 + mr: 1 }} inputProps={{ maxLength: 3, @@ -414,7 +434,7 @@ const ApplicationDetailCard = ( - + @@ -436,7 +456,7 @@ const ApplicationDetailCard = ( WebkitTextFillColor: "#000000", background: "#f8f8f8", }, - mr:1, + mr: 1, }} inputProps={{ maxLength: 3, diff --git a/src/pages/PublicNotice/Details_GLD/index.js b/src/pages/PublicNotice/Details_GLD/index.js index a92c56e..e7a9bb3 100644 --- a/src/pages/PublicNotice/Details_GLD/index.js +++ b/src/pages/PublicNotice/Details_GLD/index.js @@ -32,7 +32,8 @@ import { SET_PUBLIC_NOTICE_STATUS_COMPLATED, SET_PUBLIC_NOTICE_STATUS_WITHDRAW, SET_PUBLIC_NOTICE_STATUS_RESUBMIT, - SET_PUBLIC_NOTICE_STATUS_REVIEWED + SET_PUBLIC_NOTICE_STATUS_REVIEWED, + SET_PUBLIC_NOTICE_STATUS_PUBLISH } from "utils/ApiPathConst"; const StatusChangeDialog = Loadable(lazy(() => import('./StatusChangeDialog'))); import * as DateUtils from "utils/DateUtils"; @@ -182,6 +183,8 @@ const PublicNoticeDetail_GLD = () => { onNotAcceptClick(getReason); } else if (getStatus == "resubmit") { onReSubmitClick(); + } else if (getStatus == "published") { + onPublishClick(); } } }, [statusWindowAccepted]); @@ -225,6 +228,19 @@ const PublicNoticeDetail_GLD = () => { }); } + const onPublishClick = () => { + if (params.id <= 0) return; + HttpUtils.post({ + url: `${SET_PUBLIC_NOTICE_STATUS_PUBLISH}/${params.id}`, + onSuccess: function () { + setOpen(false); + handleClose(); + loadApplicationDetail() + notifySaveSuccess() + } + }); + } + const onComplatedClick = () => { if (params.id > 0) { axios.get(`${SET_PUBLIC_NOTICE_STATUS_COMPLATED}/${params.id}`) @@ -301,7 +317,7 @@ const PublicNoticeDetail_GLD = () => { }, [getUploadStatus]); return ( - + {
- - {title} - + {/* @@ -341,7 +357,7 @@ const PublicNoticeDetail_GLD = () => { - + {isLoading && editMode ? : { - + { - + -
+
- + - + Date: Mon, 8 Jan 2024 17:32:47 +0800 Subject: [PATCH 7/7] fix bug --- src/pages/PublicNotice/Details_GLD/ApplicationDetailCard.js | 2 +- src/pages/PublicNotice/Details_GLD/index.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pages/PublicNotice/Details_GLD/ApplicationDetailCard.js b/src/pages/PublicNotice/Details_GLD/ApplicationDetailCard.js index dfd0d10..4ddf106 100644 --- a/src/pages/PublicNotice/Details_GLD/ApplicationDetailCard.js +++ b/src/pages/PublicNotice/Details_GLD/ApplicationDetailCard.js @@ -101,7 +101,7 @@ const ApplicationDetailCard = ( }; const doPublish =()=>()=>{ - setStatus("published") + setStatus("publish") } const onProofClick = () => { diff --git a/src/pages/PublicNotice/Details_GLD/index.js b/src/pages/PublicNotice/Details_GLD/index.js index e7a9bb3..f9a297d 100644 --- a/src/pages/PublicNotice/Details_GLD/index.js +++ b/src/pages/PublicNotice/Details_GLD/index.js @@ -183,7 +183,7 @@ const PublicNoticeDetail_GLD = () => { onNotAcceptClick(getReason); } else if (getStatus == "resubmit") { onReSubmitClick(); - } else if (getStatus == "published") { + } else if (getStatus == "publish") { onPublishClick(); } } @@ -230,7 +230,7 @@ const PublicNoticeDetail_GLD = () => { const onPublishClick = () => { if (params.id <= 0) return; - HttpUtils.post({ + HttpUtils.get({ url: `${SET_PUBLIC_NOTICE_STATUS_PUBLISH}/${params.id}`, onSuccess: function () { setOpen(false);