diff --git a/src/pages/ProofCreate_FromApp/ProofForm.js b/src/pages/ProofCreate_FromApp/ProofForm.js index ec36c0e..1fbb0af 100644 --- a/src/pages/ProofCreate_FromApp/ProofForm.js +++ b/src/pages/ProofCreate_FromApp/ProofForm.js @@ -28,6 +28,8 @@ const FormPanel = ({ formData }) => { const [columnPrice, setColumnPrice] = React.useState(ComboData.proofPrice[0]); const [attachments, setAttachments] = React.useState([]); + const [wait, setWait] = React.useState(false); + const [isWarningPopUp, setIsWarningPopUp] = React.useState(false); const [warningText, setWarningText] = React.useState(""); @@ -45,10 +47,10 @@ const FormPanel = ({ formData }) => { React.useEffect(() => { - if (!attachments || attachments.length <= 0){ - formik.setFieldValue("length",0); - formik.setFieldValue("noOfPages",0); - formik.setFieldValue("fee",0); + if (!attachments || attachments.length <= 0) { + formik.setFieldValue("length", 0); + formik.setFieldValue("noOfPages", 0); + formik.setFieldValue("fee", 0); return; } @@ -56,10 +58,12 @@ const FormPanel = ({ formData }) => { }, [attachments]); - const doCalculate=()=>{ - if (!attachments || attachments.length <= 0){ - setWarningText("無法計算,請上傳有效文件。"); + const doCalculate = () => { + setWait(true); + if (!attachments || attachments.length <= 0) { + setWarningText("Unable to calculate, please upload a valid document."); setIsWarningPopUp(true); + setWait(false); return; } HttpUtils.postWithFiles({ @@ -69,23 +73,25 @@ const FormPanel = ({ formData }) => { }, files: attachments, onSuccess: function (responseData) { - if(responseData.data.detail){ - setWarningText("無法計算,請上傳有效文件或手動輸入。"); + if (responseData.data.detail) { + setWarningText("Unable to calculate, please upload a valid document or input manually."); setIsWarningPopUp(true); return; } - formik.setFieldValue("length",responseData.data.length); + formik.setFieldValue("length", responseData.data.length); let colValue = 0; - setColumnPrice(ComboData.proofPrice.find(obj=>{ + setColumnPrice(ComboData.proofPrice.find(obj => { colValue = obj.value; return obj.colCount === responseData.data.column })); - formik.setFieldValue("noOfPages",responseData.data.no_of_page); - formik.setFieldValue("fee",(data.groupType == "A"?6552*responseData.data.no_of_page :responseData.data.length*colValue)); + formik.setFieldValue("noOfPages", responseData.data.no_of_page); + formik.setFieldValue("fee", (data.groupType == "A" ? 6552 * responseData.data.no_of_page : responseData.data.length * colValue)); + setWait(false); }, - onError: function(){ - setWarningText("無法計算,請手動輸入。"); + onError: function () { + setWarningText("Unable to calculate, please input manually."); setIsWarningPopUp(true); + setWait(false); } }); } @@ -95,7 +101,7 @@ const FormPanel = ({ formData }) => { initialValues: data, onSubmit: values => { if (!attachments || attachments.length <= 0) { - setWarningText("請選擇上傳檔案"); + setWarningText("Please upload file."); setIsWarningPopUp(true); return; } @@ -121,13 +127,13 @@ const FormPanel = ({ formData }) => { let file = event.target.files[0]; if (file) { if (!file.name.toLowerCase().substr(file.name.length - 4).includes(".pdf")) { - setWarningText("請上傳有效檔案 (檔案格式: .pdf)"); + setWarningText("Please upload a valid file (File format: .pdf)."); setIsWarningPopUp(true); document.getElementById("uploadFileBtn").value = ""; return; } if (file.size >= (10 * 1024 * 1034)) { - setWarningText("上傳檔案大小應<10MB"); + setWarningText("The file size for uploading should be less than 10MB"); setIsWarningPopUp(true); return; } @@ -186,17 +192,27 @@ const FormPanel = ({ formData }) => { - - - + { + wait ? + + Doing calculate, please wait ... + + : + + + + } + + { formik.values.groupType == "A" ? @@ -352,7 +368,7 @@ const FormPanel = ({ formData }) => {
setIsWarningPopUp(false)} > - 注意 + Warning {warningText} diff --git a/src/pages/ProofPayment/Pay.js b/src/pages/ProofPayment/Pay.js new file mode 100644 index 0000000..58b5fa7 --- /dev/null +++ b/src/pages/ProofPayment/Pay.js @@ -0,0 +1,126 @@ +// material-ui +import { + Grid, + Typography, + Stack, + Button, +} from '@mui/material'; +import * as UrlUtils from "utils/ApiPathConst"; +import * as React from "react"; +import * as HttpUtils from "utils/HttpUtils"; +import { useParams } from "react-router-dom"; +import { useNavigate } from "react-router-dom"; +import * as DateUtils from "utils/DateUtils" + +import Loadable from 'components/Loadable'; +const LoadingComponent = Loadable(React.lazy(() => import('pages/extra-pages/LoadingComponent'))); + +import titleBackgroundImg from 'assets/images/dashboard/gazette-bar.png' +const BackgroundHead = { + backgroundImage: `url(${titleBackgroundImg})`, + width: '100%', + height: '100%', + backgroundSize: 'contain', + backgroundRepeat: 'no-repeat', + backgroundColor: '#0C489E', + backgroundPosition: 'right' +} + +// ==============================|| DASHBOARD - DEFAULT ||============================== // + +const Index = () => { + const params = useParams(); + const navigate = useNavigate() + + const [record, setRecord] = React.useState(); + const [onReady, setOnReady] = React.useState(false); + + React.useEffect(() => { + loadForm(); + }, []); + + React.useEffect(() => { + setOnReady(true); + }, [record]); + + + const loadForm = () => { + if (params.id > 0) { + HttpUtils.get({ + url: UrlUtils.GET_PROOF_PAY + "/" + params.id, + onSuccess: (responseData) => { + if (!responseData.data?.id) { + navigate("/proof/search"); + } + setRecord(responseData.data); + } + }); + } + } + + return ( + !onReady ? + + : + ( + + +
+ + 校對記錄 + +
+
+ {/*row 1*/} + + +
+ + + 公共啟事:交對完成及付款 + + + + 我們已收到申請編號: {record?.appNo} 的稿件交對確定及可付印的指示。 +

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

+ 如你在憲報期數 {record?.issueYear} 年 {record?.issueVolume} 卷, 第 {record?.issueNo} 期內有多於一個公共啟事的申請,你可選擇完成所有此期所有稿件交對確定後,於繳費期限前在「我的公共啟事」內合併付款。 +
+ + + 請按以下完成繳費: + + + 或 + + + +
+
+
+
+ {/*row 2*/} +
+ + + ) + + + ); +}; + +export default Index; diff --git a/src/pages/ProofPayment/Pay_Creditor.js b/src/pages/ProofPayment/Pay_Creditor.js new file mode 100644 index 0000000..b41a49b --- /dev/null +++ b/src/pages/ProofPayment/Pay_Creditor.js @@ -0,0 +1,115 @@ +// material-ui +import { + Grid, + Typography, + Stack, + Button, +} from '@mui/material'; +import * as UrlUtils from "utils/ApiPathConst"; +import * as React from "react"; +import * as HttpUtils from "utils/HttpUtils"; +import { useParams } from "react-router-dom"; +import { useNavigate } from "react-router-dom"; + +import Loadable from 'components/Loadable'; +const LoadingComponent = Loadable(React.lazy(() => import('pages/extra-pages/LoadingComponent'))); + +import titleBackgroundImg from 'assets/images/dashboard/gazette-bar.png' +const BackgroundHead = { + backgroundImage: `url(${titleBackgroundImg})`, + width: '100%', + height: '100%', + backgroundSize: 'contain', + backgroundRepeat: 'no-repeat', + backgroundColor: '#0C489E', + backgroundPosition: 'right' +} + +// ==============================|| DASHBOARD - DEFAULT ||============================== // + +const Index = () => { + const params = useParams(); + const navigate = useNavigate() + + const [record, setRecord] = React.useState(); + const [onReady, setOnReady] = React.useState(false); + + React.useEffect(() => { + loadForm(); + }, []); + + React.useEffect(() => { + setOnReady(true); + }, [record]); + + + const loadForm = () => { + if (params.id > 0) { + HttpUtils.get({ + url: UrlUtils.GET_PROOF_PAY + "/" + params.id, + onSuccess: (responseData) => { + if (!responseData.data?.id) { + navigate("/proof/search"); + } + setRecord(responseData.data); + } + }); + } + } + + return ( + !onReady ? + + : + ( + + +
+ + 校對記錄 + +
+
+ {/*row 1*/} + + +
+ + + 公共啟事:交對完成 + + + + + 我們已收到你已確定申請編號: {record?.appNo} 的稿件交對確定及可付印的指示,並將安排刊登於憲報 + 期數 {record?.appNo} 年 {record?.issueVolume} 卷 第 {record?.issueNo} 期內。 +

+ 此公共啟事申請的費用將於下期發出的繳費發票時收取,請依時繳費。 +
+ + + + +
+
+
+
+ {/*row 2*/} +
+ + + ) + + + ); +}; + +export default Index; diff --git a/src/pages/ProofPayment/index.js b/src/pages/ProofPayment/index.js new file mode 100644 index 0000000..3a6168b --- /dev/null +++ b/src/pages/ProofPayment/index.js @@ -0,0 +1,16 @@ +import * as React from "react"; +import Loadable from 'components/Loadable'; +const Pay = Loadable(React.lazy(() => import('./Pay'))); +const Pay_Creditor = Loadable(React.lazy(() => import('./Pay_Creditor'))); + + +const Index = () => { + return ( + JSON.parse(localStorage.getItem('userData')).creditor? + + : + + ); +} + +export default Index; \ No newline at end of file diff --git a/src/pages/ProofReply_Public/ApplicationDetails.js b/src/pages/ProofReply_Public/ApplicationDetails.js index 8a263a0..d1797c9 100644 --- a/src/pages/ProofReply_Public/ApplicationDetails.js +++ b/src/pages/ProofReply_Public/ApplicationDetails.js @@ -92,13 +92,13 @@ const ApplicationDetailCard = ({ formData, }) => { - + 申請狀態: - + {StatusUtils.getStatusByText(data.appStatus)} @@ -191,7 +191,7 @@ const ApplicationDetailCard = ({ formData, }) => { - 請下載下列印刷稿檔案,並仔細校對: + 請下載下列印刷稿檔案,並仔細校對: { - 繳費及返稿最後限期: + 繳費及返稿最後限期: - {DateUtils.dateStr_Cht(data.returnBeforeDate)} 下午 2:00前 + {DateUtils.dateStr_Cht(data.returnBeforeDate)} 下午 2:00前 - 應繳費用: + 應繳費用: - {currencyFormat(data.fee)} + {currencyFormat(data.fee)} { formik.values.groupType == "A" ? - ( {data.length} 頁 x $6,552 ) + ( {data.noOfPages} 頁 x $6,552 ) : - ( {data.length} cm x {data.colCount == 2 ? "$364 二格位" : "$182 一格位"} ) + ( {data.length} cm x {data.colCount == 2 ? "$364 二格位" : "$182 一格位"} ) } diff --git a/src/pages/ProofReply_Public/ProofForm.js b/src/pages/ProofReply_Public/ProofForm.js index eb9e6b2..b96612b 100644 --- a/src/pages/ProofReply_Public/ProofForm.js +++ b/src/pages/ProofReply_Public/ProofForm.js @@ -31,6 +31,8 @@ const FormPanel = ({ formData }) => { const [data, setData] = React.useState({}); const [attachments, setAttachments] = React.useState([]); + const [actionValue, setActionValue] = React.useState(true); + const [isWarningPopUp, setIsWarningPopUp] = React.useState(false); const [warningText, setWarningText] = React.useState(""); @@ -50,24 +52,34 @@ const FormPanel = ({ formData }) => { vaild: yup.string().max(255, "請輸入你的登入密碼").required('請輸入你的登入密碼'), }), onSubmit: values => { - if (!values.action) { + if (!actionValue) { if (!attachments || attachments.length <= 0) { setWarningText("請選擇上傳檔案"); setIsWarningPopUp(true); return; } } + + if (isOverTime()) { + setWarningText("回覆逾時,請重新申請。"); + setIsWarningPopUp(true); + return; + } // console.log(values); HttpUtils.postWithFiles({ url: UrlUtils.REPLY_PROOF, params: { id: data.id, - action: values.action, + action: actionValue, vaild: values.vaild, }, files: attachments ? attachments : [], onSuccess: function () { - navigate("/proof/search"); + if (actionValue) { + navigate("/proof/pay/"+params.id); + } else { + navigate("/proof/search"); + } }, onFail: function (response) { setWarningText("行動失敗: 請檢查內容並再次提交回覆"); @@ -138,19 +150,25 @@ const FormPanel = ({ formData }) => { 校對回覆: {formik.values.action ? "可以付印(稿件正確)" : "未能付印(需要修改)"} - - - + { + formik.values.action ? + null + : + + + + } + : ( @@ -169,57 +187,67 @@ const FormPanel = ({ formData }) => { id="action" name="action" defaultValue={true} + onChange={(event) => { + setActionValue(event.target.value == "true" ? true : false); + }} > } label="可以付印(稿件正確)" /> } label="未能付印(需要修改)" /> - - 請上載稿件修改的檔案: - - - - = (formik.values.groupType == "A" ? 2 : 1)} - onChange={(event) => { - readFile(event) - }} - /> - - - - - - - + { + actionValue ? + null + : + <> + + 請上載稿件修改的檔案: + + + + = (formik.values.groupType == "A" ? 2 : 1)} + onChange={(event) => { + readFile(event) + }} + /> + + + + + + + + + } - + 簽署: { const [type, setType] = React.useState([]); - const [status, setStatus] = React.useState({ key: 0, label: 'All', type: 'all' }); + const [status, setStatus] = React.useState(ComboData.proofStatus[0]); const [orgSelected, setOrgSelected] = React.useState({}); const [orgCombo, setOrgCombo] = React.useState(); const [issueSelected, setIssueSelected] = React.useState({}); @@ -66,7 +66,7 @@ const SearchPublicNoticeForm = ({ applySearch, orgComboData, searchCriteria,issu function resetForm() { setType([]); - setStatus({ key: 0, label: 'All', type: 'all' }); + setStatus(ComboData.proofStatus[0]); setOrgSelected({}); setIssueSelected({}); setGroupSelected({}); @@ -138,9 +138,7 @@ const SearchPublicNoticeForm = ({ applySearch, orgComboData, searchCriteria,issu inputValue={(issueSelected?.id) ? getIssueLabel(issueSelected) : ""} getOptionLabel={(option)=>getIssueLabel(option)} onChange={(event, newValue) => { - if (newValue !== null) { - setIssueSelected(newValue); - } + setIssueSelected(newValue); }} renderInput={(params) => ( option.label} onChange={(event, newValue) => { - if (newValue !== null) { - setGroupSelected(newValue); - } + setGroupSelected(newValue); }} renderInput={(params) => ( { - if (newValue !== null) { - setOrgSelected(newValue); - } + setOrgSelected(newValue); }} renderInput={(params) => ( { + switch (title) { + case 'Private Bill': + return "私人帳單"; + case 'Companies Ordinance': + return "公司條例"; + case 'High Court': + return "高等法院"; + case 'Notices': + return "通知"; + case 'Miscellaneous (Companies)': + return "其他"; + default: + return title; + } + } + const columns = [ { @@ -82,7 +99,7 @@ export default function SearchPublicNoticeTable({ recordList }) { headerName: '憲報類型', flex: 1, valueGetter: (params) => { - return (params?.value) ? (params?.value) : ""; + return getGroupTitle(params?.value); } }, { diff --git a/src/pages/ProofSearch_Public/SearchForm.js b/src/pages/ProofSearch_Public/SearchForm.js index d4bb4d2..60248c9 100644 --- a/src/pages/ProofSearch_Public/SearchForm.js +++ b/src/pages/ProofSearch_Public/SearchForm.js @@ -17,7 +17,7 @@ const SearchPublicNoticeForm = ({ applySearch, searchCriteria,issueComboData }) => { const [type, setType] = React.useState([]); - const [status, setStatus] = React.useState({ key: 0, label: 'All', type: 'all' }); + const [status, setStatus] = React.useState(ComboData.proofStatus[0]); const [issueSelected, setIssueSelected] = React.useState({}); const [issueCombo, setIssueCombo] = React.useState([]); const [groupSelected, setGroupSelected] = React.useState({}); @@ -42,7 +42,7 @@ const SearchPublicNoticeForm = ({ applySearch, searchCriteria,issueComboData gazettGroup: groupSelected?.type, dateFrom: data.dateFrom, dateTo: data.dateTo, - contact: data.contact, + //contact: data.contact, replyed: (status?.type && status?.type != 'all') ? status?.type : "", }; applySearch(temp); @@ -57,8 +57,7 @@ const SearchPublicNoticeForm = ({ applySearch, searchCriteria,issueComboData function resetForm() { setType([]); - setStatus({ key: 0, label: 'All', type: 'all' }); - setOrgSelected({}); + setStatus(ComboData.proofStatus[0]); setIssueSelected({}); setGroupSelected({}); reset(); @@ -129,9 +128,7 @@ const SearchPublicNoticeForm = ({ applySearch, searchCriteria,issueComboData inputValue={(issueSelected?.id) ? getIssueLabel(issueSelected) : ""} getOptionLabel={(option)=>getIssueLabel(option)} onChange={(event, newValue) => { - if (newValue !== null) { - setIssueSelected(newValue); - } + setIssueSelected(newValue); }} renderInput={(params) => ( option.labelCht} onChange={(event, newValue) => { - if (newValue !== null) { - setGroupSelected(newValue); - } + setGroupSelected(newValue); }} renderInput={(params) => ( - + {/* - + */} { const params = useParams(); // const navigate = useNavigate() const [applicationDetailData, setApplicationDetailData] = useState({}); + const [proofList, setProofList] = useState([]); // const [refApplicationDetailData, setRefApplicationDetailData] = React.useState({}); const [isLoading, setLoading] = useState(false); const LoadingComponent = Loadable(lazy(() => import('../extra-pages/LoadingComponent'))); @@ -83,7 +84,7 @@ const PublicNoticeDetail_GLD = () => { const title = groupNo != null ? ("Application / " + appNo + ", " + gazetteIssue + ", " + issueNum + " , " + groupNo) : ("Application / " + appNo + ", " + gazetteIssue + ", " + issueNum) useEffect(() => { - loadApplicationDetail() + loadApplicationDetail(); }, []); // useEffect(() => { @@ -110,6 +111,7 @@ const PublicNoticeDetail_GLD = () => { setIssueNum(" No. " + gazetteIssueDetail.issueNo); setIssueDate(DateUtils.dateFormat(gazetteIssueDetail.issueDate, "D MMM YYYY (ddd)")); setGroupNo(response.data.data.groupNo); + setProofList(response.data.proofList); setLoading(false); } }) @@ -171,9 +173,9 @@ const PublicNoticeDetail_GLD = () => { onComplatedClick() } else if (getStatus == "withdraw") { onWithdrawnClick() - } else if (getStatus == "notAccepted"){ + } else if (getStatus == "notAccepted") { onNotAcceptClick(getReason); - } else if (getStatus == "resubmit"){ + } else if (getStatus == "resubmit") { onReSubmitClick(); } } @@ -266,8 +268,8 @@ const PublicNoticeDetail_GLD = () => { }; useEffect(() => { - const status = applicationDetailData.data!=undefined?applicationDetailData.data.status:"" - if(status === "submitted" && params.id > 0 && getUploadStatus){ + const status = applicationDetailData.data != undefined ? applicationDetailData.data.status : "" + if (status === "submitted" && params.id > 0 && getUploadStatus) { axios.get(`${SET_PUBLIC_NOTICE_STATUS_REVIEWED}/${params.id}`) .then((response) => { if (response.status === 204) { @@ -279,7 +281,7 @@ const PublicNoticeDetail_GLD = () => { console.log(error); return false; }); - }else{ + } else { setUploadStatus(false); } }, [getUploadStatus]); @@ -346,7 +348,10 @@ const PublicNoticeDetail_GLD = () => { - + diff --git a/src/pages/PublicNoticeDetail_GLD/tabTableDetail/ProofTab.js b/src/pages/PublicNoticeDetail_GLD/tabTableDetail/ProofTab.js index 2a72449..be855f0 100644 --- a/src/pages/PublicNoticeDetail_GLD/tabTableDetail/ProofTab.js +++ b/src/pages/PublicNoticeDetail_GLD/tabTableDetail/ProofTab.js @@ -1,54 +1,53 @@ // material-ui import * as React from 'react'; +import * as DateUtils from "utils/DateUtils"; import {FiDataGrid} from "components/FiDataGrid"; -import { - Button -} from '@mui/material'; // ==============================|| EVENT TABLE ||============================== // export default function ProofTab({rows}) { + function currencyFormat(num) { + return num.toLocaleString('en-US', { + minimumFractionDigits: 2 + }); + } + + const columns = [ { - id: 'proofRef', - field: 'proofRef', - headerName: 'Proof Ref.', + + id: 'refNo', + field: 'refNo', + headerName: 'Proof No.', flex: 1, }, { - id: 'proofSent', - field: 'proofSent', - headerName: 'Proof Return', + id: 'created', + field: 'created', + headerName: 'Proof Date', flex: 1, + valueGetter: (params) => { + return DateUtils.datetimeStr(params?.value); + } }, { - id: 'proofReturn', - field: 'proofReturn', - headerName: 'Proof Return', - flex: 1, - }, - { - id: 'status', - field: 'status', - headerName: 'Status', + id: 'replyDate', + field: 'replyDate', + headerName: 'Confirmed/Return Date', flex: 1, + valueGetter: (params) => { + return params?.value?DateUtils.datetimeStr(params?.value):""; + } }, { id: 'fee', field: 'fee', - headerName: 'Fee (HKD)', - flex: 2, + headerName: 'Fee', + flex: 1, + valueGetter: (params) => { + return (params?.value)?"$ "+currencyFormat(params?.value):""; + } }, - { - field: 'detail', - type: 'actions', - headerName: '', - width: 50, - cellClassName: 'actions', - renderCell: () => { - return ; - }, - } ]; return ( diff --git a/src/pages/PublicNoticeDetail_GLD/tabTableDetail/TabTable.js b/src/pages/PublicNoticeDetail_GLD/tabTableDetail/TabTable.js index 942636b..f05f539 100644 --- a/src/pages/PublicNoticeDetail_GLD/tabTableDetail/TabTable.js +++ b/src/pages/PublicNoticeDetail_GLD/tabTableDetail/TabTable.js @@ -21,31 +21,28 @@ const ProofTab = Loadable(lazy(() => import('./ProofTab'))); // ==============================|| DASHBOARD - DEFAULT ||============================== // -const PublicNotice = ({applicationDetailData}) => { - const [submittedList, ] = React.useState([]); - const [inProgressList, ] = React.useState([]); +const PublicNotice = ({applicationDetailData, proofList}) => { + const [_proofList, setProofList] = React.useState([]); + const [inProgressList,] = React.useState([]); const [onReady,setOnReady] = React.useState(false); const [selectedTab, setSelectedTab] = React.useState("1"); // const navigate = useNavigate(); const [statusHistoryList, setStatusHistoryList] = React.useState([]); - - // useEffect(() => { - // loadData(); - // }, []); - const reloadPage = () => { window.location.reload(false); } React.useEffect(() => { - //if user data from parent are not null - // console.log(applicationDetailData) if (Object.keys(applicationDetailData).length > 0) { setStatusHistoryList(applicationDetailData.statusHistoryList); } }, [applicationDetailData]); + React.useEffect(() => { + setProofList(proofList); + }, [proofList]); + React.useEffect(() => { //if state data are ready and assign to different field if (statusHistoryList.length > 0) { @@ -75,14 +72,14 @@ const PublicNotice = ({applicationDetailData}) => { - + diff --git a/src/pages/authentication/auth-forms/BusCustomFormWizard.js b/src/pages/authentication/auth-forms/BusCustomFormWizard.js index 72d521a..bdb4c56 100644 --- a/src/pages/authentication/auth-forms/BusCustomFormWizard.js +++ b/src/pages/authentication/auth-forms/BusCustomFormWizard.js @@ -141,6 +141,7 @@ const BusCustomFormWizard = (props) => { data.address1 !==""&& data.email !==""&& data.emailConfirm !==""&& + data.email == data.emailConfirm&& data.phone !==""&& data.phoneCountryCode !==""&& termsAndConAccept == true&& @@ -389,13 +390,12 @@ const BusCustomFormWizard = (props) => { } function handleEmail(email) { - var validRegex = /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/; - // var result = reg.test(email); - var result = email.match(validRegex); - if (result == false) { + var validRegex = /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+.[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/; + if (!email.match(validRegex)) { return false; + }else{ + return true; } - return true; } const formik = useFormik({ diff --git a/src/pages/authentication/auth-forms/CustomFormWizard.js b/src/pages/authentication/auth-forms/CustomFormWizard.js index b0d3895..452dda1 100644 --- a/src/pages/authentication/auth-forms/CustomFormWizard.js +++ b/src/pages/authentication/auth-forms/CustomFormWizard.js @@ -136,6 +136,7 @@ const CustomFormWizard = (props) => { data.address1 !==""&& data.email !==""&& data.emailConfirm !==""&& + data.email == data.emailConfirm&& data.phone !==""&& data.phoneCountryCode !==""&& termsAndConAccept == true&& @@ -409,13 +410,11 @@ const CustomFormWizard = (props) => { function handleEmail(email) { var validRegex = /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/; - // var result = reg.test(email); - var result = email.match(validRegex); - if (result == false) { + if (!email.match(validRegex)) { return false; + }else{ + return true; } - console.log("email true") - return true; } const formik = useFormik({ diff --git a/src/pages/pnspsUserDetailPage_Organization/UserInformationCard_Organization.js b/src/pages/pnspsUserDetailPage_Organization/UserInformationCard_Organization.js index 3958686..3c9803e 100644 --- a/src/pages/pnspsUserDetailPage_Organization/UserInformationCard_Organization.js +++ b/src/pages/pnspsUserDetailPage_Organization/UserInformationCard_Organization.js @@ -58,31 +58,31 @@ const UserInformationCard_Organization = ({ userData, loadDataFun, orgData }) => }), onSubmit: (values) => { HttpUtils.post({ - url: UrlUtils.POST_IND_USER + "/" + userData.id, + url: UrlUtils.POST_ORG_USER + "/" + userData.id, params: { contactTel: { countryCode: values.tel_countryCode, phoneNumber: values.phoneNumber }, - faxNo: { - countryCode: values.fax_countryCode, - faxNumber: values.faxNumber - }, - addressBus: { - country: values.country, - district: values.district, - addressLine1: values.addressLine1, - addressLine2: values.addressLine2, - addressLine3: values.addressLine3, - }, + // faxNo: { + // countryCode: values.fax_countryCode, + // faxNumber: values.faxNumber + // }, + // addressBus: { + // country: values.country, + // district: values.district, + // addressLine1: values.addressLine1, + // addressLine2: values.addressLine2, + // addressLine3: values.addressLine3, + // }, identification: values.identification, emailBus: values.emailBus, contactPerson: values.contactPerson, - enCompanyName: values.enCompanyName, - chCompanyName: values.chCompanyName, + // enCompanyName: values.enCompanyName, + // chCompanyName: values.chCompanyName, orgId: values.orgId, - brNo: values.brNo, - brExpiryDate: values.brExpiryDate, + // brNo: values.brNo, + // brExpiryDate: values.brExpiryDate, }, onSuccess: function () { @@ -307,7 +307,7 @@ const UserInformationCard_Organization = ({ userData, loadDataFun, orgData }) => ); return displayOptions; }, - getOptionLabel: (item) => item ? typeof item === 'number' ? item + "" : (item["brNo"] ? item["brNo"] + "-" + item["enCompanyName"] : "") : "", + getOptionLabel: (item) => item ? typeof item === 'number' ? item + "" : (item["brNo"] ? item["brNo"] + "-" + item["enCompanyName"]: "") : "", isOptionEqualToValue: (option, newValue, setValue, setInputValue) => { if (option.id == newValue) { setValue(option); @@ -463,13 +463,16 @@ const UserInformationCard_Organization = ({ userData, loadDataFun, orgData }) => Organization - - - + {currentUserData.orgId==null? + + + + :null + } @@ -477,7 +480,7 @@ const UserInformationCard_Organization = ({ userData, loadDataFun, orgData }) => {FieldUtils.getTextField({ label: "Org.Name (English):", valueName: "enCompanyName", - disabled: (!editMode), + disabled: true, form: formik })} @@ -486,7 +489,7 @@ const UserInformationCard_Organization = ({ userData, loadDataFun, orgData }) => {FieldUtils.getTextField({ label: "Org.Name (Chinese):", valueName: "chCompanyName", - disabled: (!editMode), + disabled: true, form: formik })} @@ -495,7 +498,7 @@ const UserInformationCard_Organization = ({ userData, loadDataFun, orgData }) => {FieldUtils.getTextField({ label: "BR No.:", valueName: "brNo", - disabled: (!editMode), + disabled: true, form: formik })} @@ -505,7 +508,7 @@ const UserInformationCard_Organization = ({ userData, loadDataFun, orgData }) => label: "Country:", valueName: "country", dataList: ComboData.country, - disabled: (!editMode), + disabled: true, form: formik })} @@ -517,7 +520,7 @@ const UserInformationCard_Organization = ({ userData, loadDataFun, orgData }) => code: "fax_countryCode", num: "faxNumber" }, - disabled: (!editMode), + disabled: true, form: formik })} @@ -526,7 +529,7 @@ const UserInformationCard_Organization = ({ userData, loadDataFun, orgData }) => {FieldUtils.getDateField({ label: "BR Expiry Date.:", valueName: "brExpiryDate", - disabled: (!editMode), + disabled: true, form: formik })} @@ -535,7 +538,7 @@ const UserInformationCard_Organization = ({ userData, loadDataFun, orgData }) => {FieldUtils.getAddressField({ label: "Address:", valueName: ["addressLine1", "addressLine2", "addressLine3"], - disabled: (!editMode), + disabled: true, form: formik })} @@ -545,7 +548,7 @@ const UserInformationCard_Organization = ({ userData, loadDataFun, orgData }) => label: "District:", valueName: "district", dataList: ComboData.district, - disabled: (!editMode), + disabled: true, form: formik })} diff --git a/src/pages/pnspsUserDetailPage_Organization/index.js b/src/pages/pnspsUserDetailPage_Organization/index.js index a03c6b6..0adfcf7 100644 --- a/src/pages/pnspsUserDetailPage_Organization/index.js +++ b/src/pages/pnspsUserDetailPage_Organization/index.js @@ -27,7 +27,7 @@ const UserMaintainPage_Organization = () => { useEffect(()=>{ - console.log(userData); + // console.log(userData); loadData(); },[]); @@ -40,9 +40,24 @@ const UserMaintainPage_Organization = () => { HttpUtils.get({ url: `${UrlUtils.GET_ORG_USER_PATH}/${params.id}`, onSuccess: function(response){ - response.data["addressBus"] = JSON.parse(response.data["addressBus"]); - response.data["contactTel"] = JSON.parse(response.data["contactTel"]); - response.data["faxNo"] = JSON.parse(response.data["faxNo"]); + console.log(response) + if(response.data.orgId !=null){ + response.data["addressBus"] = response.orgDetail.data["addressTemp"]; + response.data["contactTel"] = response.orgDetail.data["contactTel"]; + response.data["faxNo"] = response.orgDetail.data["faxNo"]; + + response.data["brExpiryDate"] = response.orgDetail.data.brExpiryDate?DateUtils.dateStr(response.orgDetail.data.brExpiryDate):""; + response.data["brNo"] = response.orgDetail.data.brNo; + response.data["enCompanyName"] = response.orgDetail.data.enCompanyName; + response.data["chCompanyName"] = response.orgDetail.data.chCompanyName; + response.data["chCompanyName"] = response.orgDetail.data.chCompanyName; + }else{ + response.data["addressBus"] = JSON.parse(response.data["addressBus"]); + response.data["contactTel"] = JSON.parse(response.data["contactTel"]); + response.data["faxNo"] = JSON.parse(response.data["faxNo"]); + + response.data["brExpiryDate"] = response.data.brExpiryDate?DateUtils.dateStr(response.data.brExpiryDate):""; + } let createDate = DateUtils.datetimeStr(response.data.created); let modifiedBy = DateUtils.datetimeStr(response.data.modified)+", "+response.data.modifiedBy; @@ -64,10 +79,9 @@ const UserMaintainPage_Organization = () => { response.data["faxNumber"] = response.data.faxNo?.faxNumber; response.data["fax_countryCode"] = response.data.faxNo?.countryCode; - response.data["brExpiryDate"] = response.data.brExpiryDate?DateUtils.dateStr(response.data.brExpiryDate):""; - //response.data["orgId"] = response.data.brExpiryDate?DateUtils.dateStr(response.data.brExpiryDate):""; - + + setUserData(response.data); setOrgData(response.orgList); } diff --git a/src/routes/PublicUserRoutes.js b/src/routes/PublicUserRoutes.js index 27aba9b..2cddd80 100644 --- a/src/routes/PublicUserRoutes.js +++ b/src/routes/PublicUserRoutes.js @@ -13,6 +13,7 @@ const PublicNoticeApplyForm = Loadable(lazy(() => import('pages/PublicNotice/App const PublicNoticeDetail = Loadable(lazy(() => import('pages/PublicNoticeDetail'))); const ProofReply = Loadable(lazy(() => import('pages/ProofReply_Public'))); const ProofSearch = Loadable(lazy(() => import('pages/ProofSearch_Public'))); +const ProofPayment = Loadable(lazy(() => import('pages/ProofPayment'))); // ==============================|| MAIN ROUTING ||============================== // @@ -55,6 +56,10 @@ const PublicDashboard = { path: 'proof/search', element: }, + { + path: 'proof/pay/:id', + element: + }, ] }, ] diff --git a/src/utils/ApiPathConst.js b/src/utils/ApiPathConst.js index 5692622..3418085 100644 --- a/src/utils/ApiPathConst.js +++ b/src/utils/ApiPathConst.js @@ -20,6 +20,7 @@ export const GET_IND_USER_VERIFY = apiPath+'/user/verify'; export const POST_IND_USER = apiPath+'/user/ind'; export const GET_ORG_USER_PATH = apiPath+'/user/org'; +export const POST_ORG_USER = apiPath+'/user/org'; export const GET_ORG_PATH = apiPath+'/org'; export const GET_ORG_FROM_USER_PATH = apiPath+'/org/from-user'; @@ -75,6 +76,8 @@ export const CREATE_PROOF = apiPath+'/proof/create';//POST export const GET_PROOF = apiPath+'/proof/details';//GET export const REPLY_PROOF = apiPath+'/proof/reply';//GET export const PROOF_CHECK_PRICE = apiPath+'/proof/check-price';//GET +export const GET_PROOF_PAY = apiPath+'/proof/pay-details';//GET + //User Group export const POST_AND_UPDATE_USER_GROUP = apiPath+'/group/save'; \ No newline at end of file