Ver código fonte

update issue label

master
Anna Ho 1 ano atrás
pai
commit
205a73f785
11 arquivos alterados com 242 adições e 68 exclusões
  1. +25
    -5
      src/pages/DemandNote/Create/SearchForm.js
  2. +26
    -5
      src/pages/DemandNote/Search/SearchForm.js
  3. +24
    -6
      src/pages/DemandNote/Search_Public/SearchForm.js
  4. +26
    -5
      src/pages/Proof/Search_GLD/SearchForm.js
  5. +23
    -5
      src/pages/Proof/Search_Public/SearchForm.js
  6. +6
    -1
      src/pages/PublicNotice/ApplyForm/PublicNoticeApplyForm.js
  7. +46
    -9
      src/pages/PublicNotice/ApplyForm/index.js
  8. +48
    -28
      src/pages/PublicNotice/Search_GLD/SearchForm.js
  9. +3
    -4
      src/pages/authentication/auth-forms/IAmSmartFormWizard.js
  10. +13
    -0
      src/utils/DateUtils.js
  11. +2
    -0
      src/utils/FormatUtils.js

+ 25
- 5
src/pages/DemandNote/Create/SearchForm.js Ver arquivo

@@ -16,6 +16,7 @@ import { useNavigate } from "react-router-dom";
import { notifyDownloadSuccess } from 'utils/CommonFunction';
import {PNSPS_BUTTON_THEME} from "../../../themes/buttonConst";
import {ThemeProvider} from "@emotion/react";
import { useIntl } from "react-intl";


// ==============================|| DASHBOARD - DEFAULT ||============================== //
@@ -39,6 +40,9 @@ const SearchPublicNoticeForm = ({ applySearch, issueComboData, _paymentCount, _p
const [issueCombo, setIssueCombo] = React.useState([]);
const navigate = useNavigate()

const intl = useIntl();
const { locale } = intl;

React.useEffect(() => {
if (issueComboData && issueComboData.length > 0) {
setIssueCombo(issueComboData);
@@ -58,11 +62,27 @@ const SearchPublicNoticeForm = ({ applySearch, issueComboData, _paymentCount, _p
}, [issueSelected]);

function getIssueLabel(data) {
if (data == {}) return "";
return data.issueYear
+ " Vol. " + FormatUtils.zeroPad(data.volume, 3)
+ ", No. " + FormatUtils.zeroPad(data.issueNo, 2)
+ ", " + DateUtils.dateFormat(data.issueDate, "D MMM YYYY (ddd)");
let issueYear = data.issueYear
let volume = data.volume;
let issueNo = data.issueNo;
let issueDate = data.issueDate;
if (locale === 'zh-HK') {
return issueYear
+ " 第" + volume + "卷,"
+ " 第" + issueNo + "期,"
+ " " + DateUtils.dateFormat(issueDate, "YYYY年MM月DD日")
+ " (" + DateUtils.getWeekdayStr_ZH(issueDate) + ")";
} else if (locale === 'zh-CN') {
return issueYear
+ " 第" + volume + "卷,"
+ " 第" + issueNo + "期,"
+ " " + DateUtils.dateFormat(issueDate, "YYYY年MM月DD日")
+ " (" + DateUtils.getWeekdayStr_CN(issueDate) + ")";
}
return issueYear
+ " Vol. " + FormatUtils.zeroPad(volume, 3)
+ ", No. " + FormatUtils.zeroPad(issueNo, 2)
+ ", " + DateUtils.dateFormat(issueDate, "D MMM YYYY (ddd)");
}

const onSubmit = () => {


+ 26
- 5
src/pages/DemandNote/Search/SearchForm.js Ver arquivo

@@ -13,6 +13,7 @@ import * as DateUtils from "utils/DateUtils";
import * as FormatUtils from "utils/FormatUtils";
import {PNSPS_BUTTON_THEME} from "../../../themes/buttonConst";
import {ThemeProvider} from "@emotion/react";
import { useIntl } from "react-intl";
// ==============================|| DASHBOARD - DEFAULT ||============================== //


@@ -34,6 +35,10 @@ const SearchDemandNoteForm = ({ applySearch, orgComboData, searchCriteria, issue
const [minDueDate, setMinDueDate] = React.useState(searchCriteria.dueDateFrom);
const [maxDueDate, setMaxDueDate] = React.useState(searchCriteria.dueDateTo);

const intl = useIntl();
const { locale } = intl;


const { reset, register, handleSubmit } = useForm()
const onSubmit = (data) => {
data.status = selectedLabelsString
@@ -79,11 +84,27 @@ const SearchDemandNoteForm = ({ applySearch, orgComboData, searchCriteria, issue
}

function getIssueLabel(data) {
if (data == {}) return "";
return data.issueYear
+ " Vol. " + FormatUtils.zeroPad(data.volume, 3)
+ ", No. " + FormatUtils.zeroPad(data.issueNo, 2)
+ ", " + DateUtils.dateFormat(data.issueDate, "D MMM YYYY (ddd)");
let issueYear = data.issueYear
let volume = data.volume;
let issueNo = data.issueNo;
let issueDate = data.issueDate;
if (locale === 'zh-HK') {
return issueYear
+ " 第" + volume + "卷,"
+ " 第" + issueNo + "期,"
+ " " + DateUtils.dateFormat(issueDate, "YYYY年MM月DD日")
+ " (" + DateUtils.getWeekdayStr_ZH(issueDate) + ")";
} else if (locale === 'zh-CN') {
return issueYear
+ " 第" + volume + "卷,"
+ " 第" + issueNo + "期,"
+ " " + DateUtils.dateFormat(issueDate, "YYYY年MM月DD日")
+ " (" + DateUtils.getWeekdayStr_CN(issueDate) + ")";
}
return issueYear
+ " Vol. " + FormatUtils.zeroPad(volume, 3)
+ ", No. " + FormatUtils.zeroPad(issueNo, 2)
+ ", " + DateUtils.dateFormat(issueDate, "D MMM YYYY (ddd)");
}

return (


+ 24
- 6
src/pages/DemandNote/Search_Public/SearchForm.js Ver arquivo

@@ -20,7 +20,10 @@ import {ThemeProvider} from "@emotion/react";

const SearchDemandNoteForm = ({ applySearch, searchCriteria, issueComboData
}) => {

const intl = useIntl();
const { locale } = intl;
const [type, setType] = React.useState([]);
const [issueSelected, setIssueSelected] = React.useState({});
const [issueCombo, setIssueCombo] = React.useState([]);
@@ -63,13 +66,28 @@ const SearchDemandNoteForm = ({ applySearch, searchCriteria, issueComboData
}

function getIssueLabel(data) {
if (data == {}) return "";
return data.issueYear
+ " Vol. " + FormatUtils.zeroPad(data.volume, 3)
+ ", No. " + FormatUtils.zeroPad(data.issueNo, 2)
+ ", " + DateUtils.dateFormat(data.issueDate, "D MMM YYYY (ddd)");
let issueYear = data.issueYear
let volume = data.volume;
let issueNo = data.issueNo;
let issueDate = data.issueDate;
if (locale === 'zh-HK') {
return issueYear
+ " 第" + volume + "卷,"
+ " 第" + issueNo + "期,"
+ " " + DateUtils.dateFormat(issueDate, "YYYY年MM月DD日")
+ " (" + DateUtils.getWeekdayStr_ZH(issueDate) + ")";
} else if (locale === 'zh-CN') {
return issueYear
+ " 第" + volume + "卷,"
+ " 第" + issueNo + "期,"
+ " " + DateUtils.dateFormat(issueDate, "YYYY年MM月DD日")
+ " (" + DateUtils.getWeekdayStr_CN(issueDate) + ")";
}
return issueYear
+ " Vol. " + FormatUtils.zeroPad(volume, 3)
+ ", No. " + FormatUtils.zeroPad(issueNo, 2)
+ ", " + DateUtils.dateFormat(issueDate, "D MMM YYYY (ddd)");
}

return (
<MainCard xs={12} md={12} lg={12}
border={false}


+ 26
- 5
src/pages/Proof/Search_GLD/SearchForm.js Ver arquivo

@@ -13,6 +13,7 @@ import * as FormatUtils from "utils/FormatUtils";
import { Typography } from '../../../../node_modules/@mui/material/index';
import {PNSPS_BUTTON_THEME} from "../../../themes/buttonConst";
import {ThemeProvider} from "@emotion/react";
import { useIntl } from "react-intl";
// ==============================|| DASHBOARD - DEFAULT ||============================== //


@@ -30,6 +31,9 @@ const SearchPublicNoticeForm = ({ applySearch, orgComboData, searchCriteria, iss
const [minDate, setMinDate] = React.useState(searchCriteria.dateFrom);
const [maxDate, setMaxDate] = React.useState(searchCriteria.dateTo);

const intl = useIntl();
const { locale } = intl;

const marginBottom = 2.5;
const { reset, register, handleSubmit } = useForm()
const onSubmit = (data) => {
@@ -77,13 +81,30 @@ const SearchPublicNoticeForm = ({ applySearch, orgComboData, searchCriteria, iss
}

function getIssueLabel(data) {
if (data == {}) return "";
return data.issueYear
+ " Vol. " + FormatUtils.zeroPad(data.volume, 3)
+ ", No. " + FormatUtils.zeroPad(data.issueNo, 2)
+ ", " + DateUtils.dateFormat(data.issueDate, "D MMM YYYY (ddd)");
let issueYear = data.issueYear
let volume = data.volume;
let issueNo = data.issueNo;
let issueDate = data.issueDate;
if (locale === 'zh-HK') {
return issueYear
+ " 第" + volume + "卷,"
+ " 第" + issueNo + "期,"
+ " " + DateUtils.dateFormat(issueDate, "YYYY年MM月DD日")
+ " (" + DateUtils.getWeekdayStr_ZH(issueDate) + ")";
} else if (locale === 'zh-CN') {
return issueYear
+ " 第" + volume + "卷,"
+ " 第" + issueNo + "期,"
+ " " + DateUtils.dateFormat(issueDate, "YYYY年MM月DD日")
+ " (" + DateUtils.getWeekdayStr_CN(issueDate) + ")";
}
return issueYear
+ " Vol. " + FormatUtils.zeroPad(volume, 3)
+ ", No. " + FormatUtils.zeroPad(issueNo, 2)
+ ", " + DateUtils.dateFormat(issueDate, "D MMM YYYY (ddd)");
}


return (
<MainCard xs={12} md={12} lg={12}
border={false}


+ 23
- 5
src/pages/Proof/Search_Public/SearchForm.js Ver arquivo

@@ -21,6 +21,8 @@ import {FormattedMessage, useIntl} from "react-intl";
const SearchPublicNoticeForm = ({ applySearch, searchCriteria, issueComboData
}) => {
const intl = useIntl();
const { locale } = intl;
const [type, setType] = React.useState([]);
const [status, setStatus] = React.useState(ComboData.proofStatus[0]);
const [issueSelected, setIssueSelected] = React.useState({});
@@ -84,11 +86,27 @@ const SearchPublicNoticeForm = ({ applySearch, searchCriteria, issueComboData
}

function getIssueLabel(data) {
if (data == {}) return "";
return data.issueYear
+ " Vol. " + FormatUtils.zeroPad(data.volume, 3)
+ ", No. " + FormatUtils.zeroPad(data.issueNo, 2)
+ ", " + DateUtils.dateFormat(data.issueDate, "D MMM YYYY (ddd)");
let issueYear = data.issueYear
let volume = data.volume;
let issueNo = data.issueNo;
let issueDate = data.issueDate;
if (locale === 'zh-HK') {
return issueYear
+ " 第" + volume + "卷,"
+ " 第" + issueNo + "期,"
+ " " + DateUtils.dateFormat(issueDate, "YYYY年MM月DD日")
+ " (" + DateUtils.getWeekdayStr_ZH(issueDate) + ")";
} else if (locale === 'zh-CN') {
return issueYear
+ " 第" + volume + "卷,"
+ " 第" + issueNo + "期,"
+ " " + DateUtils.dateFormat(issueDate, "YYYY年MM月DD日")
+ " (" + DateUtils.getWeekdayStr_CN(issueDate) + ")";
}
return issueYear
+ " Vol. " + FormatUtils.zeroPad(volume, 3)
+ ", No. " + FormatUtils.zeroPad(issueNo, 2)
+ ", " + DateUtils.dateFormat(issueDate, "D MMM YYYY (ddd)");
}

return (


+ 6
- 1
src/pages/PublicNotice/ApplyForm/PublicNoticeApplyForm.js Ver arquivo

@@ -27,10 +27,11 @@ import {FormattedMessage, useIntl} from "react-intl";

// ==============================|| DASHBOARD - DEFAULT ||============================== //

const PublicNoticeApplyForm = ({ loadedData, selections }) => {
const PublicNoticeApplyForm = ({ loadedData, _selections }) => {
const [isWarningPopUp, setIsWarningPopUp] = React.useState(false);
const [warningText, setWarningText] = React.useState("");
const [attachment, setAttachment] = React.useState({});
const [selections, setsSelections] = React.useState(<></>);
const intl = useIntl();

const [val, setVal] = React.useState({});
@@ -57,6 +58,10 @@ const PublicNoticeApplyForm = ({ loadedData, selections }) => {
return intl.formatMessage({ id: 'noMoreThenNWords' },{num:num, fieldname:fieldname?intl.formatMessage({ id: fieldname})+": ":""});
}

React.useEffect(() => {
setsSelections(_selections)
}, [_selections]);

const formik = useFormik({
enableReinitialize: true,
initialValues: loadedData,


+ 46
- 9
src/pages/PublicNotice/ApplyForm/index.js Ver arquivo

@@ -2,8 +2,9 @@
import * as React from "react";
import * as HttpUtils from "utils/HttpUtils";
import * as UrlUtils from "utils/ApiPathConst";
import * as DateUtils from "utils/DateUtils";
import * as FormatUtils from "utils/FormatUtils";
import * as DateUtils from "utils/DateUtils";
import { useIntl } from "react-intl";

import {
Grid,
@@ -21,9 +22,14 @@ const PublicNoticeApplyForm = Loadable(lazy(() => import('./PublicNoticeApplyFor

const ApplyForm = () => {
const [userData, setUserData] = React.useState(null);
const [gazetteIssueList, setGazetteIssueList] = React.useState([]);

const [selections, setSelection] = React.useState([]);
const [isLoading, setLoding] = React.useState(true);

const intl = useIntl();
const { locale } = intl;

React.useEffect(() => {
loadUserData();
}, []);
@@ -43,22 +49,53 @@ const ApplyForm = () => {
var selection = [];
for (var i = 0; i < response?.gazetteIssueList?.length; i++) {
let data = response.gazetteIssueList[i];
let label = getIssueLabel(data);
selection.push(<FormControlLabel value={data.id} control={<Radio />} label={label} />);
//let label = getIssueLabel(data);
selection.push(<FormControlLabel value={data.id} control={<Radio />} label={getIssueLabel(data)} />);
}
setGazetteIssueList(response?.gazetteIssueList);
setSelection(selection);
setUserData(response);
}
});
};

function getIssueLabel(data) {
return data.issueYear
+ " Vol. " + FormatUtils.zeroPad(data.volume, 3)
+ ", No. " + FormatUtils.zeroPad(data.issueNo, 2)
+ ", " + DateUtils.dateFormat(data.issueDate, "D MMM YYYY (ddd)");
React.useEffect(() => {
if(gazetteIssueList?.length>0){
var selection = [];
for (var i = 0; i < gazetteIssueList?.length; i++) {
let data = gazetteIssueList[i];
let label = getIssueLabel(data);
selection.push(<FormControlLabel value={data.id} control={<Radio />} label={label} />);
}
setSelection(selection);
}
}, [locale]);

const getIssueLabel=(data)=> {
let issueYear = data.issueYear
let volume = data.volume;
let issueNo = data.issueNo;
let issueDate = data.issueDate;
if (locale === 'zh-HK') {
return issueYear
+ " 第" + volume + "卷,"
+ " 第" + issueNo + "期,"
+ " " + DateUtils.dateFormat(issueDate, "YYYY年MM月DD日")
+ " (" + DateUtils.getWeekdayStr_ZH(issueDate) + ")";
} else if (locale === 'zh-CN') {
return issueYear
+ " 第" + volume + "卷,"
+ " 第" + issueNo + "期,"
+ " " + DateUtils.dateFormat(issueDate, "YYYY年MM月DD日")
+ " (" + DateUtils.getWeekdayStr_CN(issueDate) + ")";
}
return issueYear
+ " Vol. " + FormatUtils.zeroPad(volume, 3)
+ ", No. " + FormatUtils.zeroPad(issueNo, 2)
+ ", " + DateUtils.dateFormat(issueDate, "D MMM YYYY (ddd)");
}


React.useEffect(() => {
if (userData !== null) setLoding(false);
}, [userData]);
@@ -73,7 +110,7 @@ const ApplyForm = () => {
:
<PublicNoticeApplyForm
loadedData={userData}
selections={selections}
_selections={selections}
/>
);
};


+ 48
- 28
src/pages/PublicNotice/Search_GLD/SearchForm.js Ver arquivo

@@ -11,8 +11,9 @@ import * as React from "react";
import * as ComboData from "utils/ComboData";
import * as DateUtils from "utils/DateUtils";
import * as FormatUtils from "utils/FormatUtils";
import {ThemeProvider} from "@emotion/react";
import {PNSPS_BUTTON_THEME} from "../../../themes/buttonConst";
import { ThemeProvider } from "@emotion/react";
import { PNSPS_BUTTON_THEME } from "../../../themes/buttonConst";
import { useIntl } from "react-intl";
// ==============================|| DASHBOARD - DEFAULT ||============================== //


@@ -31,6 +32,9 @@ const SearchPublicNoticeForm = ({ applySearch, orgComboData, searchCriteria, iss
const [minDate, setMinDate] = React.useState(searchCriteria.dateFrom);
const [maxDate, setMaxDate] = React.useState(searchCriteria.dateTo);

const intl = useIntl();
const { locale } = intl;

const marginBottom = 2.5;
const { reset, register, handleSubmit } = useForm()
const onSubmit = (data) => {
@@ -75,12 +79,28 @@ const SearchPublicNoticeForm = ({ applySearch, orgComboData, searchCriteria, iss
reset();
}

function getIssueLabel(data) {
if (data == {}) return "";
return data.issueYear
+ " Vol. " + FormatUtils.zeroPad(data.volume, 3)
+ ", No. " + FormatUtils.zeroPad(data.issueNo, 2)
+ ", " + DateUtils.dateFormat(data.issueDate, "D MMM YYYY (ddd)");
const getIssueLabel=(data)=> {
let issueYear = data.issueYear
let volume = data.volume;
let issueNo = data.issueNo;
let issueDate = data.issueDate;
if (locale === 'zh-HK') {
return issueYear
+ " 第" + volume + "卷,"
+ " 第" + issueNo + "期,"
+ " " + DateUtils.dateFormat(issueDate, "YYYY年MM月DD日")
+ " (" + DateUtils.getWeekdayStr_ZH(issueDate) + ")";
} else if (locale === 'zh-CN') {
return issueYear
+ " 第" + volume + "卷,"
+ " 第" + issueNo + "期,"
+ " " + DateUtils.dateFormat(issueDate, "YYYY年MM月DD日")
+ " (" + DateUtils.getWeekdayStr_CN(issueDate) + ")";
}
return issueYear
+ " Vol. " + FormatUtils.zeroPad(volume, 3)
+ ", No. " + FormatUtils.zeroPad(issueNo, 2)
+ ", " + DateUtils.dateFormat(issueDate, "D MMM YYYY (ddd)");
}

return (
@@ -91,9 +111,9 @@ const SearchPublicNoticeForm = ({ applySearch, orgComboData, searchCriteria, iss
>

<form onSubmit={handleSubmit(onSubmit)}>
<Grid container sx={{ backgroundColor: '#ffffff', ml: 2, mt: 1, mb: marginBottom}} width="98%">
<Grid container sx={{ backgroundColor: '#ffffff', ml: 2, mt: 1, mb: marginBottom }} width="98%">
{/*row 1*/}
<Grid item justifyContent="space-between" alignItems="center" sx={{mt:1,ml:3,mb:marginBottom}}>
<Grid item justifyContent="space-between" alignItems="center" sx={{ mt: 1, ml: 3, mb: marginBottom }}>
<Typography variant="pnspsFormHeader" >
Search
</Typography>
@@ -113,7 +133,7 @@ const SearchPublicNoticeForm = ({ applySearch, orgComboData, searchCriteria, iss
/>
</Grid>

<Grid item xs={9} s={6} md={5} lg={3} sx={{ml:3, mr:3, mb:marginBottom}}>
<Grid item xs={9} s={6} md={5} lg={3} sx={{ ml: 3, mr: 3, mb: marginBottom }}>
<Grid container>
<Grid item xs={5.25} s={5.25} md={5.25} lg={5.5}>
<TextField
@@ -133,7 +153,7 @@ const SearchPublicNoticeForm = ({ applySearch, orgComboData, searchCriteria, iss
/>
</Grid>

<Grid item xs={1.5} s={1.5} md={1.5} lg={1} sx={{mt:0.8, display: 'flex', justifyContent:"center", alignItems: 'flex-start'}}>
<Grid item xs={1.5} s={1.5} md={1.5} lg={1} sx={{ mt: 0.8, display: 'flex', justifyContent: "center", alignItems: 'flex-start' }}>
To
</Grid>

@@ -301,23 +321,23 @@ const SearchPublicNoticeForm = ({ applySearch, orgComboData, searchCriteria, iss
{/*last row*/}
<Grid container maxWidth justifyContent="flex-end">
<ThemeProvider theme={PNSPS_BUTTON_THEME}>
<Grid item sx={{ ml: 3 }}>
<Button
variant="contained"
onClick={resetForm}
>
Clear
</Button>
</Grid>
<Grid item sx={{ ml: 3 }}>
<Button
variant="contained"
onClick={resetForm}
>
Clear
</Button>
</Grid>

<Grid item sx={{ ml: 3 }}>
<Button
variant="contained"
type="submit"
>
Submit
</Button>
</Grid>
<Grid item sx={{ ml: 3 }}>
<Button
variant="contained"
type="submit"
>
Submit
</Button>
</Grid>
</ThemeProvider>
</Grid>
</Grid>


+ 3
- 4
src/pages/authentication/auth-forms/IAmSmartFormWizard.js Ver arquivo

@@ -276,8 +276,7 @@ const CustomFormWizard = (props) => {
const { handleSubmit } = useForm({})
const _onSubmit = () => {
setLoding(true);
values.address4 = selectedAddress4
values.address5 = selectedAddress5

const userAddress = {
"addressLine1": "",
"addressLine2": "",
@@ -288,8 +287,8 @@ const CustomFormWizard = (props) => {
userAddress.addressLine1 = values.address1
userAddress.addressLine2 = values.address2
userAddress.addressLine3 = values.address3
userAddress.district = values.address4
userAddress.country = values.address5
values.address4 = selectedAddress4 == null ? "" : selectedAddress4.key
values.address5 = selectedAddress5.key

const userFaxNo = {
"countryCode": values.faxCountryCode,


+ 13
- 0
src/utils/DateUtils.js Ver arquivo

@@ -1,5 +1,8 @@
import dayjs from 'dayjs';

var days_ZH = ['星期日','星期一','星期二','星期三','星期四','星期五','星期六']
var days_CN = ['星期日','星期一','星期二','星期三','星期四','星期五','星期六']

export const datetimeStr = (date) =>{
return dateFormat(date,"YYYY-MM-DD HH:mm:ss")
@@ -51,3 +54,13 @@ export const dateFormat = (date, format) =>{
date = convertToDate(date);
return dayjs(date).format(format);
};

export const getWeekdayStr_ZH = (date) =>{
date = convertToDate(date);
return days_ZH[date.getDay()]
};

export const getWeekdayStr_CN = (date) =>{
date = convertToDate(date);
return days_CN[date.getDay()]
};

+ 2
- 0
src/utils/FormatUtils.js Ver arquivo

@@ -1,4 +1,5 @@


export function currencyFormat(num) {
let val = num ? num : 0;
return val.toLocaleString('en-US', {
@@ -15,3 +16,4 @@ export function zeroPad(num, places) {





Carregando…
Cancelar
Salvar