| @@ -5,7 +5,7 @@ import { motion } from 'framer-motion'; | |||||
| // ==============================|| ANIMATION BUTTON ||============================== // | // ==============================|| ANIMATION BUTTON ||============================== // | ||||
| export default function AnimateButton({ children, type }) { | |||||
| export default function AnimateButton({ children, type = 'scale' }) { | |||||
| switch (type) { | switch (type) { | ||||
| case 'rotate': // only available in paid version | case 'rotate': // only available in paid version | ||||
| case 'slide': // only available in paid version | case 'slide': // only available in paid version | ||||
| @@ -23,7 +23,3 @@ AnimateButton.propTypes = { | |||||
| children: PropTypes.node, | children: PropTypes.node, | ||||
| type: PropTypes.oneOf(['slide', 'scale', 'rotate']) | type: PropTypes.oneOf(['slide', 'scale', 'rotate']) | ||||
| }; | }; | ||||
| AnimateButton.defaultProps = { | |||||
| type: 'scale' | |||||
| }; | |||||
| @@ -279,6 +279,7 @@ export function FiDataGrid({ rows, columns, sx, autoHeight = true, | |||||
| ? { | ? { | ||||
| Pagination: () => ( | Pagination: () => ( | ||||
| <TablePagination | <TablePagination | ||||
| component="div" | |||||
| count={rowCount || 0} | count={rowCount || 0} | ||||
| page={page} | page={page} | ||||
| rowsPerPage={pageSize} | rowsPerPage={pageSize} | ||||
| @@ -1,5 +1,6 @@ | |||||
| import PropTypes from 'prop-types'; | import PropTypes from 'prop-types'; | ||||
| import { forwardRef } from 'react'; | import { forwardRef } from 'react'; | ||||
| import omit from 'lodash/omit'; | |||||
| // material-ui | // material-ui | ||||
| import { useTheme } from '@mui/material/styles'; | import { useTheme } from '@mui/material/styles'; | ||||
| @@ -8,6 +9,29 @@ import { Card, CardContent, CardHeader, Divider, Typography, Grid } from '@mui/m | |||||
| // project import | // project import | ||||
| import Highlighter from './third-party/Highlighter'; | import Highlighter from './third-party/Highlighter'; | ||||
| /** Props often mistaken for Card / Grid / sx — must not reach the underlying DOM node via `{...others}`. */ | |||||
| const PROPS_OMIT_FROM_CARD = [ | |||||
| 'backgroundColor', | |||||
| 'bgcolor', | |||||
| 'xs', | |||||
| 'sm', | |||||
| 'md', | |||||
| 'lg', | |||||
| 'xl', | |||||
| 'item', | |||||
| 'container', | |||||
| 'spacing', | |||||
| 'direction', | |||||
| 'justify', | |||||
| 'alignItems', | |||||
| 'alignContent', | |||||
| 'flexWrap', | |||||
| 'wrap', | |||||
| 'zeroMinWidth', | |||||
| 'rowSpacing', | |||||
| 'columnSpacing' | |||||
| ]; | |||||
| // header style | // header style | ||||
| const headerSX = { | const headerSX = { | ||||
| p: 2.5, | p: 2.5, | ||||
| @@ -38,6 +62,8 @@ const MainCard = forwardRef( | |||||
| const theme = useTheme(); | const theme = useTheme(); | ||||
| boxShadow = theme.palette.mode === 'dark' ? boxShadow || true : boxShadow; | boxShadow = theme.palette.mode === 'dark' ? boxShadow || true : boxShadow; | ||||
| const cardProps = omit(others, PROPS_OMIT_FROM_CARD); | |||||
| return ( | return ( | ||||
| <Grid container direction="column" | <Grid container direction="column" | ||||
| // alignItems="center" | // alignItems="center" | ||||
| @@ -46,7 +72,7 @@ const MainCard = forwardRef( | |||||
| <Card | <Card | ||||
| elevation={elevation || 0} | elevation={elevation || 0} | ||||
| ref={ref} | ref={ref} | ||||
| {...others} | |||||
| {...cardProps} | |||||
| sx={{ | sx={{ | ||||
| alignItems: "center", | alignItems: "center", | ||||
| border: border ? '1px solid' : 'none', | border: border ? '1px solid' : 'none', | ||||
| @@ -143,7 +143,7 @@ const AnnouncementForm = ({ loadedData }) => { | |||||
| </Grid> | </Grid> | ||||
| </Grid> | </Grid> | ||||
| <Grid item xs={12} md={12} sx={{ mt: 2 }}><Divider fullWidth></Divider></Grid> | |||||
| <Grid item xs={12} md={12} sx={{ mt: 2 }}><Divider sx={{ width: '100%' }} /></Grid> | |||||
| <Grid item xs={12} md={12}><Typography variant="h5">English</Typography></Grid> | <Grid item xs={12} md={12}><Typography variant="h5">English</Typography></Grid> | ||||
| <Grid item xs={12} md={12} > | <Grid item xs={12} md={12} > | ||||
| <Grid container alignItems={"center"} xs={12} sm={12} md={12} lg={12} sx={{ mb: 2 }}> | <Grid container alignItems={"center"} xs={12} sm={12} md={12} lg={12} sx={{ mb: 2 }}> | ||||
| @@ -202,7 +202,7 @@ const AnnouncementForm = ({ loadedData }) => { | |||||
| </Grid> | </Grid> | ||||
| </Grid> | </Grid> | ||||
| <Grid item xs={12} md={12} sx={{ mt: 2 }}><Divider fullWidth></Divider></Grid> | |||||
| <Grid item xs={12} md={12} sx={{ mt: 2 }}><Divider sx={{ width: '100%' }} /></Grid> | |||||
| <Grid item xs={12} md={12}><Typography variant="h5">Traditional Chinese</Typography></Grid> | <Grid item xs={12} md={12}><Typography variant="h5">Traditional Chinese</Typography></Grid> | ||||
| <Grid item xs={12} md={12}> | <Grid item xs={12} md={12}> | ||||
| <Grid container alignItems={"center"} xs={12} sm={12} md={12} lg={12} sx={{ mb: 2 }}> | <Grid container alignItems={"center"} xs={12} sm={12} md={12} lg={12} sx={{ mb: 2 }}> | ||||
| @@ -263,7 +263,7 @@ const AnnouncementForm = ({ loadedData }) => { | |||||
| <Grid item xs={12} md={12} sx={{ mt: 2 }}><Divider fullWidth></Divider></Grid> | |||||
| <Grid item xs={12} md={12} sx={{ mt: 2 }}><Divider sx={{ width: '100%' }} /></Grid> | |||||
| <Grid item xs={12} md={12}><Typography variant="h5">Simplified Chinese</Typography></Grid> | <Grid item xs={12} md={12}><Typography variant="h5">Simplified Chinese</Typography></Grid> | ||||
| <Grid item xs={12} md={12}> | <Grid item xs={12} md={12}> | ||||
| <Grid container alignItems={"center"} xs={12} sm={12} md={12} lg={12} sx={{ mb: 2 }}> | <Grid container alignItems={"center"} xs={12} sm={12} md={12} lg={12} sx={{ mb: 2 }}> | ||||
| @@ -201,7 +201,7 @@ const SearchPublicNoticeForm = ({ applySearch, issueComboData, _paymentCount, _p | |||||
| variant="contained" | variant="contained" | ||||
| onClick={onSubmit} | onClick={onSubmit} | ||||
| color="success" | color="success" | ||||
| minWidth={150} | |||||
| sx={{ minWidth: 150 }} | |||||
| > | > | ||||
| Create | Create | ||||
| </Button> | </Button> | ||||
| @@ -201,7 +201,7 @@ const SearchPublicNoticeForm = ({ applySearch, issueComboData }) => { | |||||
| onClick={onSubmit} | onClick={onSubmit} | ||||
| color="success" | color="success" | ||||
| disabled={waitDownload} | disabled={waitDownload} | ||||
| minWidth={150} | |||||
| sx={{ minWidth: 150 }} | |||||
| > | > | ||||
| Export | Export | ||||
| </Button> | </Button> | ||||
| @@ -443,7 +443,7 @@ const SearchDemandNoteForm = ({ applySearch, orgComboData, searchCriteria, issue | |||||
| '& .MuiAutocomplete-endAdornment': { top: '50%', transform: 'translateY(-50%)' }, | '& .MuiAutocomplete-endAdornment': { top: '50%', transform: 'translateY(-50%)' }, | ||||
| '& .MuiOutlinedInput-root': { height: 40 } | '& .MuiOutlinedInput-root': { height: 40 } | ||||
| }} | }} | ||||
| getOptionLabel={(option) => option.label} | |||||
| getOptionLabel={(option) => (option?.label != null ? String(option.label) : "")} | |||||
| renderInput={(params) => ( | renderInput={(params) => ( | ||||
| <TextField | <TextField | ||||
| {...params} | {...params} | ||||
| @@ -66,8 +66,7 @@ export default function SearchDemandNote({ searchCriteria, applyGridOnReady,appl | |||||
| width: isMdOrLg ? 'auto' : 175, | width: isMdOrLg ? 'auto' : 175, | ||||
| flex: isMdOrLg ? 1 : undefined, | flex: isMdOrLg ? 1 : undefined, | ||||
| renderCell: (params) => { | renderCell: (params) => { | ||||
| return [StatusUtils.getStatus_i18n(params, locale) ] | |||||
| return StatusUtils.getStatus_i18n(params, locale); | |||||
| }, | }, | ||||
| }, | }, | ||||
| { | { | ||||
| @@ -292,11 +292,9 @@ const SearchDemandNoteForm = ({ applySearch, searchCriteria, issueComboData, onG | |||||
| <TextField | <TextField | ||||
| {...params} | {...params} | ||||
| label={intl.formatMessage({ id: 'status' })} | label={intl.formatMessage({ id: 'status' })} | ||||
| InputLabelProps={{ shrink: true }} | |||||
| /> | /> | ||||
| )} | )} | ||||
| InputLabelProps={{ | |||||
| shrink: true | |||||
| }} | |||||
| clearText={intl.formatMessage({ id: "muiClear" })} | clearText={intl.formatMessage({ id: "muiClear" })} | ||||
| closeText={intl.formatMessage({ id: "muiClose" })} | closeText={intl.formatMessage({ id: "muiClose" })} | ||||
| openText={intl.formatMessage({ id: "muiOpen" })} | openText={intl.formatMessage({ id: "muiOpen" })} | ||||
| @@ -180,7 +180,7 @@ const SearchPublicNoticeForm = ({ applySearch, generateXML, searchCriteria, onGr | |||||
| filterOptions={(options) => options} | filterOptions={(options) => options} | ||||
| options={ComboData.payMethod} | options={ComboData.payMethod} | ||||
| value={payMethod} | value={payMethod} | ||||
| getOptionLabel={(option) => option.label} | |||||
| getOptionLabel={(option) => (option?.label != null ? String(option.label) : "")} | |||||
| inputValue={payMethod?.label ? payMethod?.label : ""} | inputValue={payMethod?.label ? payMethod?.label : ""} | ||||
| onChange={(event, newValue) => { | onChange={(event, newValue) => { | ||||
| if(newValue==null){ | if(newValue==null){ | ||||
| @@ -197,11 +197,9 @@ const SearchPublicNoticeForm = ({ applySearch, generateXML, searchCriteria, onGr | |||||
| renderInput={(params) => ( | renderInput={(params) => ( | ||||
| <TextField {...params} | <TextField {...params} | ||||
| label="Payment Method" | label="Payment Method" | ||||
| InputLabelProps={{ shrink: true }} | |||||
| /> | /> | ||||
| )} | )} | ||||
| InputLabelProps={{ | |||||
| shrink: true | |||||
| }} | |||||
| /> | /> | ||||
| </Grid> | </Grid> | ||||
| @@ -76,7 +76,11 @@ const SearchGazetteIssueForm = ({ applyExport, comboData, waitDownload}) => { | |||||
| // defaultValue={selectedYear} | // defaultValue={selectedYear} | ||||
| options={comboList} | options={comboList} | ||||
| // disabled={checkCountry} | // disabled={checkCountry} | ||||
| getOptionLabel={(option) => option.label ? option.label : ""} | |||||
| getOptionLabel={(option) => | |||||
| option != null && typeof option === "object" && option.label != null | |||||
| ? String(option.label) | |||||
| : "" | |||||
| } | |||||
| onChange={(event, newValue) => { | onChange={(event, newValue) => { | ||||
| setSelectedYear(newValue); | setSelectedYear(newValue); | ||||
| }} | }} | ||||
| @@ -74,7 +74,11 @@ const SearchGazetteIssueForm = ({ applySearch, comboData, onGridReady}) => { | |||||
| // defaultValue={selectedYear} | // defaultValue={selectedYear} | ||||
| options={comboList} | options={comboList} | ||||
| // disabled={checkCountry} | // disabled={checkCountry} | ||||
| getOptionLabel={(option) => option.label ? option.label : ""} | |||||
| getOptionLabel={(option) => | |||||
| option != null && typeof option === "object" && option.label != null | |||||
| ? String(option.label) | |||||
| : "" | |||||
| } | |||||
| onChange={(event, newValue) => { | onChange={(event, newValue) => { | ||||
| setSelectedYear(newValue); | setSelectedYear(newValue); | ||||
| }} | }} | ||||
| @@ -9,14 +9,19 @@ import { dateStr } from "utils/DateUtils"; | |||||
| // ==============================|| EVENT TABLE ||============================== // | // ==============================|| EVENT TABLE ||============================== // | ||||
| function holidayRowsFromResponse(recordList) { | |||||
| if (Array.isArray(recordList)) return recordList; | |||||
| if (recordList && Array.isArray(recordList.records)) return recordList.records; | |||||
| return []; | |||||
| } | |||||
| export default function HolidayTable({ recordList, applyGridOnReady }) { | export default function HolidayTable({ recordList, applyGridOnReady }) { | ||||
| const [rows, setRows] = React.useState(recordList); | |||||
| const [rows, setRows] = React.useState(() => holidayRowsFromResponse(recordList)); | |||||
| // const navigate = useNavigate() | // const navigate = useNavigate() | ||||
| useEffect(() => { | useEffect(() => { | ||||
| // console.log(recordList) | |||||
| setRows(recordList.records); | |||||
| setRows(holidayRowsFromResponse(recordList)); | |||||
| }, [recordList]); | }, [recordList]); | ||||
| const columns = [ | const columns = [ | ||||
| @@ -17,7 +17,7 @@ import {ThemeProvider} from "@emotion/react"; | |||||
| const SearchHolidayForm = ({ applySearch, comboData, onGridReady}) => { | const SearchHolidayForm = ({ applySearch, comboData, onGridReady}) => { | ||||
| const [selectedYear, setSelectedYear] = React.useState([]); | |||||
| const [selectedYear, setSelectedYear] = React.useState(null); | |||||
| // const [defaultYear, setDefaultYear] = React.useState(searchCriteria.year); | // const [defaultYear, setDefaultYear] = React.useState(searchCriteria.year); | ||||
| const [comboList, setComboList] = React.useState([]); | const [comboList, setComboList] = React.useState([]); | ||||
| // const [onReady, setOnReady] = React.useState(false); | // const [onReady, setOnReady] = React.useState(false); | ||||
| @@ -27,7 +27,7 @@ const SearchHolidayForm = ({ applySearch, comboData, onGridReady}) => { | |||||
| handleSubmit } = useForm() | handleSubmit } = useForm() | ||||
| const onSubmit = () => { | const onSubmit = () => { | ||||
| if (selectedYear !=null){ | |||||
| if (selectedYear != null) { | |||||
| const temp = { | const temp = { | ||||
| year: selectedYear.label, | year: selectedYear.label, | ||||
| }; | }; | ||||
| @@ -40,8 +40,8 @@ const SearchHolidayForm = ({ applySearch, comboData, onGridReady}) => { | |||||
| // console.log(comboData) | // console.log(comboData) | ||||
| // const labelValue = comboData.find(obj => obj.label === searchCriteria.year); | // const labelValue = comboData.find(obj => obj.label === searchCriteria.year); | ||||
| // console.log(labelValue) | // console.log(labelValue) | ||||
| if(selectedYear.length == 0){ | |||||
| setSelectedYear(comboData[0]) | |||||
| if (!selectedYear) { | |||||
| setSelectedYear(comboData[0]); | |||||
| } | } | ||||
| setComboList(comboData) | setComboList(comboData) | ||||
| // setSelectedYear(searchCriteria.dateFrom) | // setSelectedYear(searchCriteria.dateFrom) | ||||
| @@ -74,7 +74,11 @@ const SearchHolidayForm = ({ applySearch, comboData, onGridReady}) => { | |||||
| // defaultValue={selectedYear} | // defaultValue={selectedYear} | ||||
| options={comboList} | options={comboList} | ||||
| // disabled={checkCountry} | // disabled={checkCountry} | ||||
| getOptionLabel={(option) => option.label ? option.label : ""} | |||||
| getOptionLabel={(option) => | |||||
| option != null && typeof option === "object" && option.label != null | |||||
| ? String(option.label) | |||||
| : "" | |||||
| } | |||||
| onChange={(event, newValue) => { | onChange={(event, newValue) => { | ||||
| setSelectedYear(newValue); | setSelectedYear(newValue); | ||||
| }} | }} | ||||
| @@ -2,7 +2,7 @@ | |||||
| import { | import { | ||||
| Grid, Button, Checkbox, FormControlLabel, Typography, | Grid, Button, Checkbox, FormControlLabel, Typography, | ||||
| Dialog, DialogTitle, DialogContent, DialogActions, | Dialog, DialogTitle, DialogContent, DialogActions, | ||||
| FormHelperText, TextField, | |||||
| FormHelperText, TextField, CircularProgress, | |||||
| } from '@mui/material'; | } from '@mui/material'; | ||||
| // import { FormControlLabel } from '@material-ui/core'; | // import { FormControlLabel } from '@material-ui/core'; | ||||
| import MainCard from "components/MainCard"; | import MainCard from "components/MainCard"; | ||||
| @@ -111,56 +111,58 @@ const OrganizationCard = ({ userData, loadDataFun, id, setEditModeFun }) => { | |||||
| onSubmit: (values) => { | onSubmit: (values) => { | ||||
| if (values.country == null) { | if (values.country == null) { | ||||
| setErrorMsg(intl.formatMessage({ id: 'pleaseFillInCountry' })) | setErrorMsg(intl.formatMessage({ id: 'pleaseFillInCountry' })) | ||||
| } else { | |||||
| if (values.country.type == "hongKong" && values.district == null) { | |||||
| setErrorMsg(intl.formatMessage({ id: 'pleaseFillInDistrict' })) | |||||
| } else { | |||||
| let sentDateFrom = ""; | |||||
| if (fromDateValue == null) { | |||||
| setErrorMsg(intl.formatMessage({ id: 'pleaseFillInBusinessRegCertValidityDate' })) | |||||
| } else { | |||||
| sentDateFrom = DateUtils.dateValue(fromDateValue) | |||||
| HttpUtils.post({ | |||||
| url: UrlUtils.POST_ORG_SAVE_PATH, | |||||
| params: { | |||||
| id: id > 0 ? id : null, | |||||
| enCompanyName: values.enCompanyName, | |||||
| chCompanyName: values.chCompanyName, | |||||
| orgShortName: values.orgShortName === "N/A" ? "" : values.orgShortName, | |||||
| brNo: values.brNo, | |||||
| // brExpiryDate: values.brExpiryDate, | |||||
| brExpiryDate: sentDateFrom, | |||||
| enCompanyNameTemp: values.enCompanyNameTemp, | |||||
| chCompanyNameTemp: values.chCompanyNameTemp, | |||||
| brExpiryDateTemp: values.brExpiryDateTemp, | |||||
| contactPerson: values.contactPerson, | |||||
| contactTel: { | |||||
| countryCode: values.tel_countryCode, | |||||
| phoneNumber: values.phoneNumber | |||||
| }, | |||||
| faxNo: { | |||||
| countryCode: values.fax_countryCode, | |||||
| faxNumber: values.faxNumber | |||||
| }, | |||||
| addressTemp: { | |||||
| country: values.country.type, | |||||
| district: values.district?.type, | |||||
| addressLine1: values.addressLine1, | |||||
| addressLine2: values.addressLine2, | |||||
| addressLine3: values.addressLine3, | |||||
| }, | |||||
| creditor: values.creditor, | |||||
| }, | |||||
| onSuccess: function () { | |||||
| notifySaveSuccess() | |||||
| loadDataFun(); | |||||
| setEditMode(false); | |||||
| } | |||||
| }); | |||||
| } | |||||
| } | |||||
| return; | |||||
| } | |||||
| if (values.country.type == "hongKong" && values.district == null) { | |||||
| setErrorMsg(intl.formatMessage({ id: 'pleaseFillInDistrict' })) | |||||
| return; | |||||
| } | |||||
| if (fromDateValue == null) { | |||||
| setErrorMsg(intl.formatMessage({ id: 'pleaseFillInBusinessRegCertValidityDate' })) | |||||
| return; | |||||
| } | } | ||||
| const sentDateFrom = DateUtils.dateValue(fromDateValue); | |||||
| return new Promise((resolve, reject) => { | |||||
| HttpUtils.post({ | |||||
| url: UrlUtils.POST_ORG_SAVE_PATH, | |||||
| params: { | |||||
| id: id > 0 ? id : null, | |||||
| enCompanyName: values.enCompanyName, | |||||
| chCompanyName: values.chCompanyName, | |||||
| orgShortName: values.orgShortName === "N/A" ? "" : values.orgShortName, | |||||
| brNo: values.brNo, | |||||
| brExpiryDate: sentDateFrom, | |||||
| enCompanyNameTemp: values.enCompanyNameTemp, | |||||
| chCompanyNameTemp: values.chCompanyNameTemp, | |||||
| brExpiryDateTemp: values.brExpiryDateTemp, | |||||
| contactPerson: values.contactPerson, | |||||
| contactTel: { | |||||
| countryCode: values.tel_countryCode, | |||||
| phoneNumber: values.phoneNumber | |||||
| }, | |||||
| faxNo: { | |||||
| countryCode: values.fax_countryCode, | |||||
| faxNumber: values.faxNumber | |||||
| }, | |||||
| addressTemp: { | |||||
| country: values.country.type, | |||||
| district: values.district?.type, | |||||
| addressLine1: values.addressLine1, | |||||
| addressLine2: values.addressLine2, | |||||
| addressLine3: values.addressLine3, | |||||
| }, | |||||
| creditor: values.creditor, | |||||
| }, | |||||
| onSuccess: function () { | |||||
| notifySaveSuccess() | |||||
| loadDataFun(); | |||||
| setEditMode(false); | |||||
| resolve(); | |||||
| }, | |||||
| onFail: () => reject(), | |||||
| onError: () => reject(), | |||||
| }); | |||||
| }); | |||||
| } | } | ||||
| }); | }); | ||||
| @@ -267,6 +269,8 @@ const OrganizationCard = ({ userData, loadDataFun, id, setEditModeFun }) => { | |||||
| variant="contained" | variant="contained" | ||||
| type="submit" | type="submit" | ||||
| color="success" | color="success" | ||||
| disabled={formik.isSubmitting} | |||||
| startIcon={formik.isSubmitting ? <CircularProgress color="inherit" size={18} /> : null} | |||||
| > | > | ||||
| Create | Create | ||||
| </Button> | </Button> | ||||
| @@ -289,6 +293,8 @@ const OrganizationCard = ({ userData, loadDataFun, id, setEditModeFun }) => { | |||||
| variant="contained" | variant="contained" | ||||
| type="submit" | type="submit" | ||||
| color="success" | color="success" | ||||
| disabled={formik.isSubmitting} | |||||
| startIcon={formik.isSubmitting ? <CircularProgress color="inherit" size={18} /> : null} | |||||
| > | > | ||||
| Save | Save | ||||
| </Button> | </Button> | ||||
| @@ -4,7 +4,7 @@ import { | |||||
| // Checkbox, FormControlLabel, | // Checkbox, FormControlLabel, | ||||
| Typography, | Typography, | ||||
| Dialog, DialogTitle, DialogContent, DialogActions, | Dialog, DialogTitle, DialogContent, DialogActions, | ||||
| FormHelperText | |||||
| FormHelperText, CircularProgress, | |||||
| } from '@mui/material'; | } from '@mui/material'; | ||||
| // import { FormControlLabel } from '@material-ui/core'; | // import { FormControlLabel } from '@material-ui/core'; | ||||
| import MainCard from "components/MainCard"; | import MainCard from "components/MainCard"; | ||||
| @@ -61,42 +61,46 @@ const OrganizationPubCard = ({ userData, loadDataFun, id, setEditModeFun }) => { | |||||
| phoneNumber: yup.string().min(8, displayErrorMsg(intl.formatMessage({ id: 'requiredValidNumber' }))).required(displayErrorMsg(intl.formatMessage({ id: 'requireContactNumber' }))), | phoneNumber: yup.string().min(8, displayErrorMsg(intl.formatMessage({ id: 'requiredValidNumber' }))).required(displayErrorMsg(intl.formatMessage({ id: 'requireContactNumber' }))), | ||||
| faxNumber: yup.string().min(8, displayErrorMsg(intl.formatMessage({ id: 'require8Number' }))).nullable(), | faxNumber: yup.string().min(8, displayErrorMsg(intl.formatMessage({ id: 'require8Number' }))).nullable(), | ||||
| }), | }), | ||||
| onSubmit: values => { | |||||
| onSubmit: (values) => { | |||||
| if (values.country == null) { | if (values.country == null) { | ||||
| setErrorMsg(intl.formatMessage({ id: 'pleaseFillInCountry' })) | setErrorMsg(intl.formatMessage({ id: 'pleaseFillInCountry' })) | ||||
| } else { | |||||
| if (values.country.type == "hongKong" && values.district == null) { | |||||
| setErrorMsg(intl.formatMessage({ id: 'pleaseFillInDistrict' })) | |||||
| } else { | |||||
| HttpUtils.post({ | |||||
| url: UrlUtils.POST_PUB_ORG_SAVE_PATH, | |||||
| params: { | |||||
| contactPerson: values.contactPerson, | |||||
| contactTel: { | |||||
| countryCode: values.tel_countryCode, | |||||
| phoneNumber: values.phoneNumber | |||||
| }, | |||||
| faxNo: { | |||||
| countryCode: values.fax_countryCode, | |||||
| faxNumber: values.faxNumber | |||||
| }, | |||||
| addressTemp: { | |||||
| country: values.country.type, | |||||
| district: values.district?.type, | |||||
| addressLine1: values.addressLine1, | |||||
| addressLine2: values.addressLine2, | |||||
| addressLine3: values.addressLine3, | |||||
| }, | |||||
| //creditor: values.creditor, | |||||
| }, | |||||
| onSuccess: function () { | |||||
| notifySaveSuccess() | |||||
| loadDataFun(); | |||||
| setEditMode(false); | |||||
| } | |||||
| }); | |||||
| } | |||||
| return; | |||||
| } | |||||
| if (values.country.type == "hongKong" && values.district == null) { | |||||
| setErrorMsg(intl.formatMessage({ id: 'pleaseFillInDistrict' })) | |||||
| return; | |||||
| } | } | ||||
| return new Promise((resolve, reject) => { | |||||
| HttpUtils.post({ | |||||
| url: UrlUtils.POST_PUB_ORG_SAVE_PATH, | |||||
| params: { | |||||
| contactPerson: values.contactPerson, | |||||
| contactTel: { | |||||
| countryCode: values.tel_countryCode, | |||||
| phoneNumber: values.phoneNumber | |||||
| }, | |||||
| faxNo: { | |||||
| countryCode: values.fax_countryCode, | |||||
| faxNumber: values.faxNumber | |||||
| }, | |||||
| addressTemp: { | |||||
| country: values.country.type, | |||||
| district: values.district?.type, | |||||
| addressLine1: values.addressLine1, | |||||
| addressLine2: values.addressLine2, | |||||
| addressLine3: values.addressLine3, | |||||
| }, | |||||
| }, | |||||
| onSuccess: function () { | |||||
| notifySaveSuccess() | |||||
| loadDataFun(); | |||||
| setEditMode(false); | |||||
| resolve(); | |||||
| }, | |||||
| onFail: () => reject(), | |||||
| onError: () => reject(), | |||||
| }); | |||||
| }); | |||||
| } | } | ||||
| }); | }); | ||||
| @@ -147,6 +151,8 @@ const OrganizationPubCard = ({ userData, loadDataFun, id, setEditModeFun }) => { | |||||
| variant="contained" | variant="contained" | ||||
| type="submit" | type="submit" | ||||
| color="success" | color="success" | ||||
| disabled={formik.isSubmitting} | |||||
| startIcon={formik.isSubmitting ? <CircularProgress color="inherit" size={18} /> : null} | |||||
| > | > | ||||
| <FormattedMessage id="create" /> | <FormattedMessage id="create" /> | ||||
| </Button> | </Button> | ||||
| @@ -171,6 +177,8 @@ const OrganizationPubCard = ({ userData, loadDataFun, id, setEditModeFun }) => { | |||||
| variant="contained" | variant="contained" | ||||
| type="submit" | type="submit" | ||||
| color="success" | color="success" | ||||
| disabled={formik.isSubmitting} | |||||
| startIcon={formik.isSubmitting ? <CircularProgress color="inherit" size={18} /> : null} | |||||
| > | > | ||||
| <FormattedMessage id="save" /> | <FormattedMessage id="save" /> | ||||
| </Button> | </Button> | ||||
| @@ -154,7 +154,7 @@ const OrganizationSearchForm = ({ applySearch, onGridReady, searchCriteria }) => | |||||
| '& .MuiAutocomplete-endAdornment': { top: '50%', transform: 'translateY(-50%)' }, | '& .MuiAutocomplete-endAdornment': { top: '50%', transform: 'translateY(-50%)' }, | ||||
| '& .MuiOutlinedInput-root': { height: 40 } | '& .MuiOutlinedInput-root': { height: 40 } | ||||
| }} | }} | ||||
| getOptionLabel={(option) => option.label} | |||||
| getOptionLabel={(option) => (option?.label != null ? String(option.label) : "")} | |||||
| renderInput={(params) => ( | renderInput={(params) => ( | ||||
| <TextField | <TextField | ||||
| {...params} | {...params} | ||||
| @@ -163,7 +163,7 @@ const Index = () => { | |||||
| </Button> | </Button> | ||||
| </Grid> | </Grid> | ||||
| {/*row 1*/} | {/*row 1*/} | ||||
| <Grid item xs={12} md={12} spacing={2} sx={{ textAlign: "center" }}> | |||||
| <Grid item xs={12} md={12} sx={{ textAlign: "center" }}> | |||||
| <Grid container justifyContent="center" direction="column" spacing={2} sx={{ p: 2 }} alignitems="stretch" > | <Grid container justifyContent="center" direction="column" spacing={2} sx={{ p: 2 }} alignitems="stretch" > | ||||
| <Grid item className="printOrder" xs={12} md={12} sx={{ pt: 2 }} style={{ height: '100%', order: 1 }}> | <Grid item className="printOrder" xs={12} md={12} sx={{ pt: 2 }} style={{ height: '100%', order: 1 }}> | ||||
| <Box xs={12} md={12} sx={{ border: '3px solid #eee', borderRadius: '10px' }} > | <Box xs={12} md={12} sx={{ border: '3px solid #eee', borderRadius: '10px' }} > | ||||
| @@ -222,7 +222,7 @@ const SearchPublicNoticeForm = ({ applySearch, searchCriteria, onGridReady }) => | |||||
| filterOptions={(options) => options} | filterOptions={(options) => options} | ||||
| options={ComboData.paymentStatus} | options={ComboData.paymentStatus} | ||||
| value={status} | value={status} | ||||
| getOptionLabel={(option) => option.label} | |||||
| getOptionLabel={(option) => (option?.label != null ? String(option.label) : "")} | |||||
| inputValue={status?.label ? status?.label : ""} | inputValue={status?.label ? status?.label : ""} | ||||
| onChange={(event, newValue) => { | onChange={(event, newValue) => { | ||||
| if(newValue==null){ | if(newValue==null){ | ||||
| @@ -239,11 +239,9 @@ const SearchPublicNoticeForm = ({ applySearch, searchCriteria, onGridReady }) => | |||||
| renderInput={(params) => ( | renderInput={(params) => ( | ||||
| <TextField {...params} | <TextField {...params} | ||||
| label="Status" | label="Status" | ||||
| InputLabelProps={{ shrink: true }} | |||||
| /> | /> | ||||
| )} | )} | ||||
| InputLabelProps={{ | |||||
| shrink: true | |||||
| }} | |||||
| /> | /> | ||||
| </Grid> | </Grid> | ||||
| @@ -256,7 +254,7 @@ const SearchPublicNoticeForm = ({ applySearch, searchCriteria, onGridReady }) => | |||||
| filterOptions={(options) => options} | filterOptions={(options) => options} | ||||
| options={ComboData.payMethod} | options={ComboData.payMethod} | ||||
| value={payMethod} | value={payMethod} | ||||
| getOptionLabel={(option) => option.label} | |||||
| getOptionLabel={(option) => (option?.label != null ? String(option.label) : "")} | |||||
| inputValue={payMethod?.label ? payMethod?.label : ""} | inputValue={payMethod?.label ? payMethod?.label : ""} | ||||
| onChange={(event, newValue) => { | onChange={(event, newValue) => { | ||||
| if(newValue==null){ | if(newValue==null){ | ||||
| @@ -273,11 +271,9 @@ const SearchPublicNoticeForm = ({ applySearch, searchCriteria, onGridReady }) => | |||||
| renderInput={(params) => ( | renderInput={(params) => ( | ||||
| <TextField {...params} | <TextField {...params} | ||||
| label="Payment Method" | label="Payment Method" | ||||
| InputLabelProps={{ shrink: true }} | |||||
| /> | /> | ||||
| )} | )} | ||||
| InputLabelProps={{ | |||||
| shrink: true | |||||
| }} | |||||
| /> | /> | ||||
| </Grid> | </Grid> | ||||
| </Grid> | </Grid> | ||||
| @@ -206,13 +206,12 @@ const SearchPublicNoticeForm = ({ applySearch, searchCriteria, onGridReady }) => | |||||
| '& .MuiOutlinedInput-root': { height: 40 } | '& .MuiOutlinedInput-root': { height: 40 } | ||||
| }} | }} | ||||
| renderInput={(params) => ( | renderInput={(params) => ( | ||||
| <TextField {...params} | |||||
| <TextField | |||||
| {...params} | |||||
| label={intl.formatMessage({id: 'status'})} | label={intl.formatMessage({id: 'status'})} | ||||
| InputLabelProps={{ ...params.InputLabelProps, shrink: true }} | |||||
| /> | /> | ||||
| )} | )} | ||||
| InputLabelProps={{ | |||||
| shrink: true | |||||
| }} | |||||
| clearText={intl.formatMessage({ id: "muiClear" })} | clearText={intl.formatMessage({ id: "muiClear" })} | ||||
| closeText={intl.formatMessage({ id: "muiClose" })} | closeText={intl.formatMessage({ id: "muiClose" })} | ||||
| openText={intl.formatMessage({ id: "muiOpen" })} | openText={intl.formatMessage({ id: "muiOpen" })} | ||||
| @@ -24,6 +24,16 @@ import Loadable from 'components/Loadable'; | |||||
| import { notifySaveSuccess } from 'utils/CommonFunction'; | import { notifySaveSuccess } from 'utils/CommonFunction'; | ||||
| const UploadFileTable = Loadable(React.lazy(() => import('./UploadFileTable'))); | const UploadFileTable = Loadable(React.lazy(() => import('./UploadFileTable'))); | ||||
| /** Keeps Formik fields defined so inputs stay controlled before API data loads. */ | |||||
| const proofFormInitialValues = { | |||||
| reviseDeadline: '', | |||||
| proofPaymentDeadline: '', | |||||
| length: '', | |||||
| noOfPages: '', | |||||
| fee: '', | |||||
| groupType: '' | |||||
| }; | |||||
| const FormPanel = ({ formData }) => { | const FormPanel = ({ formData }) => { | ||||
| const intl = useIntl(); | const intl = useIntl(); | ||||
| const [data, setData] = React.useState({}); | const [data, setData] = React.useState({}); | ||||
| @@ -123,7 +133,7 @@ const FormPanel = ({ formData }) => { | |||||
| const formik = useFormik({ | const formik = useFormik({ | ||||
| enableReinitialize: true, | enableReinitialize: true, | ||||
| initialValues: data, | |||||
| initialValues: { ...proofFormInitialValues, ...data }, | |||||
| onSubmit: values => { | onSubmit: values => { | ||||
| setSaving(true); | setSaving(true); | ||||
| if (!attachments || attachments.length <= 0) { | if (!attachments || attachments.length <= 0) { | ||||
| @@ -207,7 +217,7 @@ const FormPanel = ({ formData }) => { | |||||
| } | } | ||||
| return ( | return ( | ||||
| <MainCard xs={12} md={12} lg={12} | |||||
| <MainCard | |||||
| border={false} | border={false} | ||||
| content={false}> | content={false}> | ||||
| @@ -425,7 +435,9 @@ const FormPanel = ({ formData }) => { | |||||
| options={ComboData.proofPrice} | options={ComboData.proofPrice} | ||||
| value={columnPrice} | value={columnPrice} | ||||
| inputValue={(columnPrice?.label) ? columnPrice?.label : ""} | inputValue={(columnPrice?.label) ? columnPrice?.label : ""} | ||||
| getOptionLabel={(option) => option.label ? option.label : ""} | |||||
| getOptionLabel={(option) => | |||||
| option != null && option.label != null ? String(option.label) : "" | |||||
| } | |||||
| onChange={(event, newValue) => { | onChange={(event, newValue) => { | ||||
| setColumnPrice(newValue) | setColumnPrice(newValue) | ||||
| formik.values["fee"] = newValue.value * formik.values.length; | formik.values["fee"] = newValue.value * formik.values.length; | ||||
| @@ -75,7 +75,7 @@ const Index = () => { | |||||
| </Grid> | </Grid> | ||||
| </Grid> | </Grid> | ||||
| : | : | ||||
| <Grid container sx={{ minHeight: '85vh', backgroundColor: "backgroundColor.default" }} direction="column" spacing={1} > | |||||
| <Grid container sx={{ minHeight: '85vh', bgcolor: 'background.default' }} direction="column" spacing={1} > | |||||
| <Grid item xs={12}> | <Grid item xs={12}> | ||||
| <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"> | ||||
| @@ -88,7 +88,7 @@ const Index = () => { | |||||
| border={false} | border={false} | ||||
| content={false} | content={false} | ||||
| sx={{ | sx={{ | ||||
| backgroundColor: "backgroundColor.default" | |||||
| bgcolor: 'background.default' | |||||
| }} | }} | ||||
| > | > | ||||
| @@ -126,7 +126,7 @@ const Index = () => { | |||||
| <MainCard elevation={0} | <MainCard elevation={0} | ||||
| border={false} | border={false} | ||||
| content={false} | content={false} | ||||
| backgroundColor={"backgroundColor.default"} | |||||
| sx={{ bgcolor: 'background.default' }} | |||||
| > | > | ||||
| <Box xs={12} ml={4} mt={3} sx={{ p: 1, borderRadius: '10px', backgroundColor: "#fff" }}> | <Box xs={12} ml={4} mt={3} sx={{ p: 1, borderRadius: '10px', backgroundColor: "#fff" }}> | ||||
| <ProofForm | <ProofForm | ||||
| @@ -114,12 +114,10 @@ const Index = () => { | |||||
| <Grid item xs={12} sm={12} md={12} lg={12} sx={{ width:'100%', mt:2, mb: -3}}> | <Grid item xs={12} sm={12} md={12} lg={12} sx={{ width:'100%', mt:2, mb: -3}}> | ||||
| <MainCard | <MainCard | ||||
| sx={{ | sx={{ | ||||
| mr:2, | |||||
| mr: 2, | |||||
| boxShadow: 1, | boxShadow: 1, | ||||
| border: 1, | |||||
| borderColor: '#DDD', | |||||
| border: '1px groove #DDD', | |||||
| }} | }} | ||||
| border= '1px groove grey' | |||||
| > | > | ||||
| <ApplicationDetails | <ApplicationDetails | ||||
| formData={record} | formData={record} | ||||
| @@ -132,11 +130,8 @@ const Index = () => { | |||||
| <MainCard | <MainCard | ||||
| sx={{ | sx={{ | ||||
| boxShadow: 1, | boxShadow: 1, | ||||
| border: 1, | |||||
| borderColor: '#DDD', | |||||
| border: '1px groove #DDD', | |||||
| }} | }} | ||||
| border= '1px groove grey' | |||||
| // sx={..._sx} | |||||
| > | > | ||||
| <ProofForm | <ProofForm | ||||
| formData={record} | formData={record} | ||||
| @@ -46,10 +46,14 @@ export default function SearchPublicNoticeTable({searchCriteria, applyGridOnRead | |||||
| }, | }, | ||||
| }, | }, | ||||
| { | { | ||||
| id: 'actions', | |||||
| id: 'proofStatus', | |||||
| field: 'proofStatus', | |||||
| headerName: 'Status', | headerName: 'Status', | ||||
| flex: 1, | flex: 1, | ||||
| minWidth: 150, | minWidth: 150, | ||||
| sortable: false, | |||||
| filterable: false, | |||||
| valueGetter: () => '', | |||||
| renderCell: (params) => { | renderCell: (params) => { | ||||
| return ProofStatus.getStatus_Eng(params); | return ProofStatus.getStatus_Eng(params); | ||||
| }, | }, | ||||
| @@ -26,11 +26,15 @@ const SearchPublicNoticeForm = ({ applySearch, orgComboData, searchCriteria, iss | |||||
| const [type, setType] = React.useState([]); | const [type, setType] = React.useState([]); | ||||
| const [status, setStatus] = React.useState(searchCriteria.statusKey!=undefined?ComboData.proofStatus_GLD[searchCriteria.statusKey]:ComboData.proofStatus_GLD[0]); | const [status, setStatus] = React.useState(searchCriteria.statusKey!=undefined?ComboData.proofStatus_GLD[searchCriteria.statusKey]:ComboData.proofStatus_GLD[0]); | ||||
| const [orgSelected, setOrgSelected] = React.useState({}); | |||||
| const [orgSelected, setOrgSelected] = React.useState(null); | |||||
| const [orgCombo, setOrgCombo] = React.useState(); | const [orgCombo, setOrgCombo] = React.useState(); | ||||
| const [issueSelected, setIssueSelected] = React.useState({}); | |||||
| const [issueSelected, setIssueSelected] = React.useState(null); | |||||
| const [issueCombo, setIssueCombo] = React.useState([]); | const [issueCombo, setIssueCombo] = React.useState([]); | ||||
| const [groupSelected, setGroupSelected] = React.useState(searchCriteria.gazettGroup!=undefined?ComboData.groupTitle.find(item => item.code === searchCriteria.gazettGroup):{}); | |||||
| const [groupSelected, setGroupSelected] = React.useState( | |||||
| searchCriteria.gazettGroup != undefined | |||||
| ? ComboData.groupTitle.find(item => item.code === searchCriteria.gazettGroup) ?? null | |||||
| : null | |||||
| ); | |||||
| const [minDate, setMinDate] = React.useState(searchCriteria.dateFrom); | const [minDate, setMinDate] = React.useState(searchCriteria.dateFrom); | ||||
| const [maxDate, setMaxDate] = React.useState(searchCriteria.dateTo); | const [maxDate, setMaxDate] = React.useState(searchCriteria.dateTo); | ||||
| @@ -136,9 +140,9 @@ const SearchPublicNoticeForm = ({ applySearch, orgComboData, searchCriteria, iss | |||||
| function resetForm() { | function resetForm() { | ||||
| setType([]); | setType([]); | ||||
| setStatus(ComboData.proofStatus[0]); | setStatus(ComboData.proofStatus[0]); | ||||
| setOrgSelected({}); | |||||
| setIssueSelected({}); | |||||
| setGroupSelected({}); | |||||
| setOrgSelected(null); | |||||
| setIssueSelected(null); | |||||
| setGroupSelected(null); | |||||
| setMinDate(DateUtils.dateValue(new Date().setDate(new Date().getDate()-14))) | setMinDate(DateUtils.dateValue(new Date().setDate(new Date().getDate()-14))) | ||||
| setMaxDate(DateUtils.dateValue(new Date())) | setMaxDate(DateUtils.dateValue(new Date())) | ||||
| reset({ | reset({ | ||||
| @@ -257,7 +261,7 @@ const SearchPublicNoticeForm = ({ applySearch, orgComboData, searchCriteria, iss | |||||
| options={ComboData.groupTitle} | options={ComboData.groupTitle} | ||||
| value={groupSelected} | value={groupSelected} | ||||
| inputValue={(groupSelected?.label) ? groupSelected?.label : ""} | inputValue={(groupSelected?.label) ? groupSelected?.label : ""} | ||||
| getOptionLabel={(option) => option.label} | |||||
| getOptionLabel={(option) => (option?.label != null ? String(option.label) : "")} | |||||
| onChange={(event, newValue) => { | onChange={(event, newValue) => { | ||||
| setGroupSelected(newValue); | setGroupSelected(newValue); | ||||
| }} | }} | ||||
| @@ -371,13 +375,12 @@ const SearchPublicNoticeForm = ({ applySearch, orgComboData, searchCriteria, iss | |||||
| '& .MuiOutlinedInput-root': { height: 40 } | '& .MuiOutlinedInput-root': { height: 40 } | ||||
| }} | }} | ||||
| renderInput={(params) => ( | renderInput={(params) => ( | ||||
| <TextField {...params} | |||||
| <TextField | |||||
| {...params} | |||||
| label="Status" | label="Status" | ||||
| InputLabelProps={{ shrink: true }} | |||||
| /> | /> | ||||
| )} | )} | ||||
| InputLabelProps={{ | |||||
| shrink: true | |||||
| }} | |||||
| /> | /> | ||||
| </Grid> | </Grid> | ||||
| @@ -396,11 +399,7 @@ const SearchPublicNoticeForm = ({ applySearch, orgComboData, searchCriteria, iss | |||||
| inputValue={orgSelected ? orgSelected.name!=undefined?orgSelected.name:"" : ""} | inputValue={orgSelected ? orgSelected.name!=undefined?orgSelected.name:"" : ""} | ||||
| onChange={(event, newValue) => { | onChange={(event, newValue) => { | ||||
| if (newValue !== null) { | |||||
| setOrgSelected(newValue); | |||||
| }else{ | |||||
| setOrgSelected({}); | |||||
| } | |||||
| setOrgSelected(newValue ?? null); | |||||
| }} | }} | ||||
| sx={{ | sx={{ | ||||
| '& .MuiInputBase-root': { alignItems: 'center' }, | '& .MuiInputBase-root': { alignItems: 'center' }, | ||||
| @@ -170,7 +170,7 @@ export default function SearchPublicNoticeTable({ searchCriteria, applyGridOnRea | |||||
| } | } | ||||
| }, | }, | ||||
| { | { | ||||
| id: 'actions', | |||||
| field: 'proofStatus', | |||||
| headerName: intl.formatMessage({ id: 'status' }), | headerName: intl.formatMessage({ id: 'status' }), | ||||
| width: isMdOrLg ? 'auto' : 160, | width: isMdOrLg ? 'auto' : 160, | ||||
| flex: isMdOrLg ? 1 : undefined, | flex: isMdOrLg ? 1 : undefined, | ||||
| @@ -29,7 +29,7 @@ const SearchPublicNoticeForm = ({ applySearch, searchCriteria, issueComboData, o | |||||
| const [type, setType] = React.useState([]); | const [type, setType] = React.useState([]); | ||||
| const [status, setStatus] = React.useState(searchCriteria.statusKey!=undefined?ComboData.proofStatusFull[searchCriteria.statusKey]:ComboData.proofStatusFull[0]); | const [status, setStatus] = React.useState(searchCriteria.statusKey!=undefined?ComboData.proofStatusFull[searchCriteria.statusKey]:ComboData.proofStatusFull[0]); | ||||
| const [issueSelected, setIssueSelected] = React.useState({}); | |||||
| const [issueSelected, setIssueSelected] = React.useState(null); | |||||
| const [issueCombo, setIssueCombo] = React.useState([]); | const [issueCombo, setIssueCombo] = React.useState([]); | ||||
| const [groupSelected, setGroupSelected] = React.useState(searchCriteria.gazettGroup!=undefined?ComboData.groupTitle.find(item => item.code === searchCriteria.gazettGroup):{}); | const [groupSelected, setGroupSelected] = React.useState(searchCriteria.gazettGroup!=undefined?ComboData.groupTitle.find(item => item.code === searchCriteria.gazettGroup):{}); | ||||
| @@ -110,7 +110,7 @@ const SearchPublicNoticeForm = ({ applySearch, searchCriteria, issueComboData, o | |||||
| if (issueComboData && issueComboData.length > 0) { | if (issueComboData && issueComboData.length > 0) { | ||||
| setIssueCombo(issueComboData); | setIssueCombo(issueComboData); | ||||
| if(searchCriteria.issueId!=undefined){ | if(searchCriteria.issueId!=undefined){ | ||||
| setIssueSelected(issueComboData.find(item => item.id === searchCriteria.issueId)) | |||||
| setIssueSelected(issueComboData.find(item => item.id === searchCriteria.issueId) ?? null) | |||||
| } | } | ||||
| } | } | ||||
| }, [issueComboData]); | }, [issueComboData]); | ||||
| @@ -118,7 +118,7 @@ const SearchPublicNoticeForm = ({ applySearch, searchCriteria, issueComboData, o | |||||
| function resetForm() { | function resetForm() { | ||||
| setType([]); | setType([]); | ||||
| setStatus(ComboData.proofStatusFull[0]); | setStatus(ComboData.proofStatusFull[0]); | ||||
| setIssueSelected({}); | |||||
| setIssueSelected(null); | |||||
| setGroupSelected({}); | setGroupSelected({}); | ||||
| setMinDate(DateUtils.dateValue(new Date().setDate(new Date().getDate()-14))) | setMinDate(DateUtils.dateValue(new Date().setDate(new Date().getDate()-14))) | ||||
| setMaxDate(DateUtils.dateValue(new Date())) | setMaxDate(DateUtils.dateValue(new Date())) | ||||
| @@ -205,8 +205,9 @@ const SearchPublicNoticeForm = ({ applySearch, searchCriteria, issueComboData, o | |||||
| id="issueId" | id="issueId" | ||||
| options={issueCombo} | options={issueCombo} | ||||
| value={issueSelected} | value={issueSelected} | ||||
| isOptionEqualToValue={(option, value) => option?.id === value?.id} | |||||
| inputValue={(issueSelected?.id) ? getIssueLabel(issueSelected) : ""} | inputValue={(issueSelected?.id) ? getIssueLabel(issueSelected) : ""} | ||||
| getOptionLabel={(option) => getIssueLabel(option)} | |||||
| getOptionLabel={(option) => (option?.id ? getIssueLabel(option) : "")} | |||||
| onChange={(event, newValue) => { | onChange={(event, newValue) => { | ||||
| setIssueSelected(newValue); | setIssueSelected(newValue); | ||||
| }} | }} | ||||
| @@ -352,11 +353,12 @@ const SearchPublicNoticeForm = ({ applySearch, searchCriteria, issueComboData, o | |||||
| renderInput={(params) => ( | renderInput={(params) => ( | ||||
| <TextField {...params} | <TextField {...params} | ||||
| label={intl.formatMessage({id: 'status'})} | label={intl.formatMessage({id: 'status'})} | ||||
| InputLabelProps={{ | |||||
| ...params.InputLabelProps, | |||||
| shrink: true | |||||
| }} | |||||
| /> | /> | ||||
| )} | )} | ||||
| InputLabelProps={{ | |||||
| shrink: true | |||||
| }} | |||||
| clearText={intl.formatMessage({ id: "muiClear" })} | clearText={intl.formatMessage({ id: "muiClear" })} | ||||
| closeText={intl.formatMessage({ id: "muiClose" })} | closeText={intl.formatMessage({ id: "muiClose" })} | ||||
| openText={intl.formatMessage({ id: "muiOpen" })} | openText={intl.formatMessage({ id: "muiOpen" })} | ||||
| @@ -64,7 +64,7 @@ const ApplyForm = () => { | |||||
| for (var i = 0; i < response?.gazetteIssueList?.length; i++) { | for (var i = 0; i < response?.gazetteIssueList?.length; i++) { | ||||
| let data = response.gazetteIssueList[i]; | let data = response.gazetteIssueList[i]; | ||||
| //let label = getIssueLabel(data); | //let label = getIssueLabel(data); | ||||
| selection.push(<FormControlLabel value={data.id} control={<Radio />} label={getIssueLabel(data)} />); | |||||
| selection.push(<FormControlLabel key={data.id} value={data.id} control={<Radio />} label={getIssueLabel(data)} />); | |||||
| } | } | ||||
| setGazetteIssueList(response?.gazetteIssueList); | setGazetteIssueList(response?.gazetteIssueList); | ||||
| setSelection(selection); | setSelection(selection); | ||||
| @@ -80,7 +80,7 @@ const ApplyForm = () => { | |||||
| for (var i = 0; i < gazetteIssueList?.length; i++) { | for (var i = 0; i < gazetteIssueList?.length; i++) { | ||||
| let data = gazetteIssueList[i]; | let data = gazetteIssueList[i]; | ||||
| let label = getIssueLabel(data); | let label = getIssueLabel(data); | ||||
| selection.push(<FormControlLabel value={data.id} control={<Radio />} label={label} />); | |||||
| selection.push(<FormControlLabel key={data.id} value={data.id} control={<Radio />} label={label} />); | |||||
| } | } | ||||
| setSelection(selection); | setSelection(selection); | ||||
| } | } | ||||
| @@ -855,7 +855,7 @@ const ApplicationDetailCard = ( | |||||
| } | } | ||||
| }} | }} | ||||
| > | > | ||||
| <DialogTitle><Typography variant="h3">Warning</Typography></DialogTitle> | |||||
| <DialogTitle component="div"><Typography variant="h3">Warning</Typography></DialogTitle> | |||||
| <DialogContent style={{ display: 'flex', }}> | <DialogContent style={{ display: 'flex', }}> | ||||
| <Typography variant="h4" style={{ padding: '16px' }}>{warningText}</Typography> | <Typography variant="h4" style={{ padding: '16px' }}>{warningText}</Typography> | ||||
| </DialogContent> | </DialogContent> | ||||
| @@ -877,7 +877,7 @@ const ApplicationDetailCard = ( | |||||
| }} | }} | ||||
| > | > | ||||
| <form onSubmit={handleSubmit(onSubmit)}> | <form onSubmit={handleSubmit(onSubmit)}> | ||||
| <DialogTitle><Typography variant="h3">Remarks</Typography></DialogTitle> | |||||
| <DialogTitle component="div"><Typography variant="h3">Remarks</Typography></DialogTitle> | |||||
| <DialogContent style={{ display: 'flex', }}> | <DialogContent style={{ display: 'flex', }}> | ||||
| <Grid container direction="column"> | <Grid container direction="column"> | ||||
| <Grid item sx={{ padding: '16px' }}> | <Grid item sx={{ padding: '16px' }}> | ||||
| @@ -928,7 +928,7 @@ const ApplicationDetailCard = ( | |||||
| filterOptions={(options) => options} | filterOptions={(options) => options} | ||||
| options={ComboData.paymentMeans} | options={ComboData.paymentMeans} | ||||
| value={paymentMeans} | value={paymentMeans} | ||||
| getOptionLabel={(option) => option.label} | |||||
| getOptionLabel={(option) => (option?.label != null ? String(option.label) : "")} | |||||
| inputValue={paymentMeans?.label ? paymentMeans?.label : ""} | inputValue={paymentMeans?.label ? paymentMeans?.label : ""} | ||||
| onChange={(event, newValue) => { | onChange={(event, newValue) => { | ||||
| setPaymentMeans(newValue); | setPaymentMeans(newValue); | ||||
| @@ -941,11 +941,9 @@ const ApplicationDetailCard = ( | |||||
| renderInput={(params) => ( | renderInput={(params) => ( | ||||
| <TextField {...params} | <TextField {...params} | ||||
| label="" | label="" | ||||
| InputLabelProps={{ shrink: true }} | |||||
| /> | /> | ||||
| )} | )} | ||||
| InputLabelProps={{ | |||||
| shrink: true, | |||||
| }} | |||||
| disableClearable={true} | disableClearable={true} | ||||
| /> | /> | ||||
| </Grid> | </Grid> | ||||
| @@ -53,11 +53,11 @@ const GazetteDetailCard = ( | |||||
| setIssueNum(applicationDetailData.gazetteIssueDetail.volume + "/" + applicationDetailData.gazetteIssueDetail.issueYear | setIssueNum(applicationDetailData.gazetteIssueDetail.volume + "/" + applicationDetailData.gazetteIssueDetail.issueYear | ||||
| + " No. " + applicationDetailData.gazetteIssueDetail.issueNo); | + " No. " + applicationDetailData.gazetteIssueDetail.issueNo); | ||||
| setIssueDate(DateUtils.dateFormat(applicationDetailData.gazetteIssueDetail.issueDate, "D MMM YYYY (ddd)")); | setIssueDate(DateUtils.dateFormat(applicationDetailData.gazetteIssueDetail.issueDate, "D MMM YYYY (ddd)")); | ||||
| setGazetteCode(applicationDetailData.data.groupNo) | |||||
| setGazetteCode(applicationDetailData.data.groupNo ?? '') | |||||
| // console.log(applicationDetailData) | // console.log(applicationDetailData) | ||||
| setSysType(applicationDetailData.userData.sysType) | setSysType(applicationDetailData.userData.sysType) | ||||
| setCareOf(applicationDetailData.data.careOf) | |||||
| setGroupTitle(applicationDetailData.data.groupTitle) | |||||
| setCareOf(applicationDetailData.data.careOf ?? '') | |||||
| setGroupTitle(applicationDetailData.data.groupTitle ?? '') | |||||
| if (applicationDetailData.data.mode != null){ | if (applicationDetailData.data.mode != null){ | ||||
| setMode(applicationDetailData.data.mode); | setMode(applicationDetailData.data.mode); | ||||
| } | } | ||||
| @@ -73,7 +73,11 @@ const GazetteDetailCard = ( | |||||
| }, [issueNum]); | }, [issueNum]); | ||||
| const groupDetailClick = () => () => { | const groupDetailClick = () => () => { | ||||
| if (gazetteCode == null) { | |||||
| // groupNo is normalized to '' when absent, so check empty string — not only null | |||||
| const hasGazetteCode = | |||||
| gazetteCode != null && | |||||
| String(gazetteCode).trim() !== ""; | |||||
| if (!hasGazetteCode) { | |||||
| setStatus("genGazetteCode"); | setStatus("genGazetteCode"); | ||||
| return; | return; | ||||
| } | } | ||||
| @@ -306,7 +310,9 @@ const GazetteDetailCard = ( | |||||
| maxHeight: { xs: '90vh', s: '70vh', m: '70vh', lg: '60vh' } | maxHeight: { xs: '90vh', s: '70vh', m: '70vh', lg: '60vh' } | ||||
| } | } | ||||
| }}> | }}> | ||||
| <DialogTitle><Typography variant="h3">Warning</Typography></DialogTitle> | |||||
| <DialogTitle component="div"> | |||||
| <Typography variant="h3" component="h2">Warning</Typography> | |||||
| </DialogTitle> | |||||
| <DialogContent style={{ display: 'flex', }}> | <DialogContent style={{ display: 'flex', }}> | ||||
| <Typography variant="h4" style={{ padding: '16px' }}>{warningText}</Typography> | <Typography variant="h4" style={{ padding: '16px' }}>{warningText}</Typography> | ||||
| </DialogContent> | </DialogContent> | ||||
| @@ -147,6 +147,11 @@ const StatusChangeDialog = (props) => { | |||||
| id="gazetteGroup" | id="gazetteGroup" | ||||
| options={groupTitleComboList} | options={groupTitleComboList} | ||||
| filterOptions={(options) => options} | filterOptions={(options) => options} | ||||
| getOptionLabel={(option) => { | |||||
| if (option == null) return ""; | |||||
| if (typeof option === "string") return option; | |||||
| return option.label != null ? String(option.label) : ""; | |||||
| }} | |||||
| inputValue={comboInputValue.label} | inputValue={comboInputValue.label} | ||||
| onChange={(event, newValue) => { | onChange={(event, newValue) => { | ||||
| if (newValue != null && newValue != {}) { | if (newValue != null && newValue != {}) { | ||||
| @@ -156,7 +161,6 @@ const StatusChangeDialog = (props) => { | |||||
| props.setSelectedGazetteGroup(newValue); | props.setSelectedGazetteGroup(newValue); | ||||
| formik.setFieldValue("", "") | formik.setFieldValue("", "") | ||||
| } else { | } else { | ||||
| gazetteGroup | |||||
| props.setSelectedGazetteGroupInputType(""); | props.setSelectedGazetteGroupInputType(""); | ||||
| } | } | ||||
| }} | }} | ||||
| @@ -195,7 +199,7 @@ const StatusChangeDialog = (props) => { | |||||
| <FormikProvider value={formik}> | <FormikProvider value={formik}> | ||||
| <form> | <form> | ||||
| <DialogContent> | <DialogContent> | ||||
| <DialogContentText> | |||||
| <DialogContentText component="div"> | |||||
| {content} | {content} | ||||
| </DialogContentText> | </DialogContentText> | ||||
| </DialogContent> | </DialogContent> | ||||
| @@ -86,6 +86,7 @@ export default function ProofTab({appId, setCount}) { | |||||
| } | } | ||||
| }, | }, | ||||
| { | { | ||||
| field: 'actions', | |||||
| type: 'actions', | type: 'actions', | ||||
| headerName: 'Proof Slip', | headerName: 'Proof Slip', | ||||
| width: 100, | width: 100, | ||||
| @@ -46,7 +46,7 @@ export default function StatusHistoryTab({appId, setCount}) { | |||||
| flex: isMdOrLg ? 1 : undefined, | flex: isMdOrLg ? 1 : undefined, | ||||
| renderHeader: renderHeaderWithAria, | renderHeader: renderHeaderWithAria, | ||||
| renderCell: (params) => { | renderCell: (params) => { | ||||
| return [StatusUtils.getStatusEng(params)] | |||||
| return StatusUtils.getStatusEng(params); | |||||
| }, | }, | ||||
| }, | }, | ||||
| ]; | ]; | ||||
| @@ -43,9 +43,9 @@ const PublicNotice = ({ appId, proofCount, paymentCount, statusHistoryCount, set | |||||
| <TabContext value={selectedTab}> | <TabContext value={selectedTab}> | ||||
| <Box sx={{ borderBottom: 1, borderColor: 'divider', overflowX: 'auto' }}> | <Box sx={{ borderBottom: 1, borderColor: 'divider', overflowX: 'auto' }}> | ||||
| <TabList onChange={handleChange} aria-label={intl.formatMessage({ id: 'ariaRelatedRecords' })}> | <TabList onChange={handleChange} aria-label={intl.formatMessage({ id: 'ariaRelatedRecords' })}> | ||||
| <Tab renderActiveOnly={false} label={"Proof (" + proofCount + ") "} value="1" /> | |||||
| <Tab renderActiveOnly={false} label={"Online Payment (" + paymentCount + ") "} value="2" /> | |||||
| <Tab renderActiveOnly={false} label={"Status History (" + statusHistoryCount + ") "} value="3" /> | |||||
| <Tab label={"Proof (" + proofCount + ") "} value="1" /> | |||||
| <Tab label={"Online Payment (" + paymentCount + ") "} value="2" /> | |||||
| <Tab label={"Status History (" + statusHistoryCount + ") "} value="3" /> | |||||
| </TabList> | </TabList> | ||||
| </Box> | </Box> | ||||
| <TabPanel value="1" sx={{ p: 0 }}> | <TabPanel value="1" sx={{ p: 0 }}> | ||||
| @@ -655,9 +655,9 @@ const ApplicationDetailCard = ( | |||||
| <Grid container direction="row" alignItems="center" justifyContent="flex-start"> | <Grid container direction="row" alignItems="center" justifyContent="flex-start"> | ||||
| <Grid item xs={12} sm={12} md={12} lg={12} sx={{ wordBreak: 'break-word', }}> | <Grid item xs={12} sm={12} md={12} lg={12} sx={{ wordBreak: 'break-word', }}> | ||||
| <Typography | <Typography | ||||
| fullWidth | |||||
| id='fileName' | id='fileName' | ||||
| variant="pnspsFormParagraph" | variant="pnspsFormParagraph" | ||||
| sx={{ width: '100%' }} | |||||
| > | > | ||||
| {fileDetail?.filename} | {fileDetail?.filename} | ||||
| </Typography> | </Typography> | ||||
| @@ -5,6 +5,7 @@ import { | |||||
| // material-ui | // material-ui | ||||
| import { | import { | ||||
| Box, | |||||
| Button, | Button, | ||||
| // Link, | // Link, | ||||
| Stack, | Stack, | ||||
| @@ -14,7 +15,6 @@ import { | |||||
| DialogContent, | DialogContent, | ||||
| DialogContentText, | DialogContentText, | ||||
| DialogTitle, | DialogTitle, | ||||
| FormLabel, | |||||
| } from '@mui/material'; | } from '@mui/material'; | ||||
| import { useFormik,FormikProvider } from 'formik'; | import { useFormik,FormikProvider } from 'formik'; | ||||
| import * as yup from 'yup'; | import * as yup from 'yup'; | ||||
| @@ -60,19 +60,20 @@ const StatusChangeDialog = (props) => { | |||||
| fullWidth={true} | fullWidth={true} | ||||
| maxWidth={'xs'} | maxWidth={'xs'} | ||||
| > | > | ||||
| <DialogTitle > | |||||
| <Typography variant="h4"> | |||||
| <DialogTitle component="div"> | |||||
| <Typography variant="h4" component="h2"> | |||||
| {status} {intl.formatMessage({id: 'publicNotice'})} | {status} {intl.formatMessage({id: 'publicNotice'})} | ||||
| </Typography> | </Typography> | ||||
| </DialogTitle> | </DialogTitle> | ||||
| <FormikProvider value={formik}> | <FormikProvider value={formik}> | ||||
| <form> | <form> | ||||
| <DialogContent> | <DialogContent> | ||||
| <DialogContentText> | |||||
| <FormLabel sx={{fontSize: "18px", color:"#000000",textAlign:"center"}}> | |||||
| <Typography variant="h5"> | |||||
| {intl.formatMessage({id: 'confirmTo'})}{status} {intl.formatMessage({id: 'publicNoticeApp'})}?</Typography> | |||||
| </FormLabel> | |||||
| <DialogContentText component="div"> | |||||
| <Box sx={{ fontSize: '18px', color: '#000000', textAlign: 'center' }}> | |||||
| <Typography variant="h5" component="p" sx={{ m: 0 }}> | |||||
| {intl.formatMessage({id: 'confirmTo'})}{status} {intl.formatMessage({id: 'publicNoticeApp'})}? | |||||
| </Typography> | |||||
| </Box> | |||||
| </DialogContentText> | </DialogContentText> | ||||
| </DialogContent> | </DialogContent> | ||||
| </form> | </form> | ||||
| @@ -25,8 +25,7 @@ export default function ProofTab({appId, setCount}) { | |||||
| const columns = [ | const columns = [ | ||||
| { | { | ||||
| field: 'actions', | |||||
| field: 'refNo', | |||||
| headerName: intl.formatMessage({id: 'proofId'}), | headerName: intl.formatMessage({id: 'proofId'}), | ||||
| width: 200, | width: 200, | ||||
| cellClassName: 'actions', | cellClassName: 'actions', | ||||
| @@ -36,7 +35,7 @@ export default function ProofTab({appId, setCount}) { | |||||
| }, | }, | ||||
| }, | }, | ||||
| { | { | ||||
| id: 'actions', | |||||
| field: 'status', | |||||
| headerName: intl.formatMessage({id: 'status'}), | headerName: intl.formatMessage({id: 'status'}), | ||||
| width: isMdOrLg ? 'auto' : 160, | width: isMdOrLg ? 'auto' : 160, | ||||
| flex: isMdOrLg ? 1 : undefined, | flex: isMdOrLg ? 1 : undefined, | ||||
| @@ -55,7 +55,7 @@ export default function StatusHistoryTab({appId, setCount}) { | |||||
| flex: isMdOrLg ? 1 : undefined, | flex: isMdOrLg ? 1 : undefined, | ||||
| renderHeader: renderHeaderWithAria, | renderHeader: renderHeaderWithAria, | ||||
| renderCell: (params) => { | renderCell: (params) => { | ||||
| return [StatusUtils.getStatusEng(params)] | |||||
| return StatusUtils.getStatusEng(params); | |||||
| }, | }, | ||||
| }, | }, | ||||
| ]; | ]; | ||||
| @@ -41,7 +41,7 @@ export default function BaseGrid({setCount, url}) { | |||||
| flex: isMdOrLg ? 1 : undefined, | flex: isMdOrLg ? 1 : undefined, | ||||
| renderHeader: renderHeaderWithAria, | renderHeader: renderHeaderWithAria, | ||||
| renderCell: (params) => { | renderCell: (params) => { | ||||
| return [params.row.appNo+getModeIntl(params,intl)] | |||||
| return params.row.appNo + getModeIntl(params, intl); | |||||
| }, | }, | ||||
| }, | }, | ||||
| { | { | ||||
| @@ -96,7 +96,7 @@ export default function BaseGrid({setCount, url}) { | |||||
| flex: isMdOrLg ? 1 : undefined, | flex: isMdOrLg ? 1 : undefined, | ||||
| renderHeader: renderHeaderWithAria, | renderHeader: renderHeaderWithAria, | ||||
| renderCell: (params) => { | renderCell: (params) => { | ||||
| return [getStatusIntl(params,intl)] | |||||
| return getStatusIntl(params, intl); | |||||
| }, | }, | ||||
| }, | }, | ||||
| { | { | ||||
| @@ -298,7 +298,7 @@ export default function SubmittedTab({ setCount, url }) { | |||||
| flex: isMdOrLg ? 1 : undefined, | flex: isMdOrLg ? 1 : undefined, | ||||
| renderHeader: renderHeaderWithAria, | renderHeader: renderHeaderWithAria, | ||||
| renderCell: (params) => { | renderCell: (params) => { | ||||
| return [StatusUtils.getStatusIntl(params, intl)] | |||||
| return StatusUtils.getStatusIntl(params, intl); | |||||
| }, | }, | ||||
| }, | }, | ||||
| { | { | ||||
| @@ -324,23 +324,27 @@ export default function SubmittedTab({ setCount, url }) { | |||||
| selectedRowItems.includes(row.id) | selectedRowItems.includes(row.id) | ||||
| ); | ); | ||||
| for (var i = 0; i < datas?.length; i++) { | for (var i = 0; i < datas?.length; i++) { | ||||
| content.push(<> | |||||
| <Stack direction="row" justifyContent="space-between"> | |||||
| <Typography variant="h5"> | |||||
| <FormattedMessage id="applicationId" />: {datas[i].appNo} | |||||
| </Typography> | |||||
| ({DateUtils.datetimeStr(datas[i].created)}) | |||||
| </Stack> | |||||
| <FormattedMessage id="extraMark" />: {datas[i].remarks} | |||||
| <br /><br /> | |||||
| </>); | |||||
| content.push( | |||||
| <React.Fragment key={datas[i].id}> | |||||
| <Stack direction="row" justifyContent="space-between"> | |||||
| <Typography variant="h5"> | |||||
| <FormattedMessage id="applicationId" />: {datas[i].appNo} | |||||
| </Typography> | |||||
| ({DateUtils.datetimeStr(datas[i].created)}) | |||||
| </Stack> | |||||
| <FormattedMessage id="extraMark" />: {datas[i].remarks} | |||||
| <br /><br /> | |||||
| </React.Fragment> | |||||
| ); | |||||
| totalAmount += datas[i].fee; | totalAmount += datas[i].fee; | ||||
| } | } | ||||
| content.push(<Typography variant="h5"> | |||||
| <FormattedMessage id="totalAmount" /> ($): {FormatUtils.currencyFormat(totalAmount)} | |||||
| <br /><br /> | |||||
| </Typography>); | |||||
| content.push( | |||||
| <Typography key="payment-total" variant="h5"> | |||||
| <FormattedMessage id="totalAmount" /> ($): {FormatUtils.currencyFormat(totalAmount)} | |||||
| <br /><br /> | |||||
| </Typography> | |||||
| ); | |||||
| return content; | return content; | ||||
| } | } | ||||
| @@ -402,6 +406,11 @@ export default function SubmittedTab({ setCount, url }) { | |||||
| id="careOfCombo" | id="careOfCombo" | ||||
| value={selectedCareOf === null ? null : selectedCareOf} | value={selectedCareOf === null ? null : selectedCareOf} | ||||
| options={careOfComboList} | options={careOfComboList} | ||||
| getOptionLabel={(option) => { | |||||
| if (option == null) return ""; | |||||
| if (typeof option === "string") return option; | |||||
| return option.label != null ? String(option.label) : ""; | |||||
| }} | |||||
| onChange={(event, newValue) => { | onChange={(event, newValue) => { | ||||
| // console.log(newValue) | // console.log(newValue) | ||||
| setSelectedCareOf(newValue); | setSelectedCareOf(newValue); | ||||
| @@ -234,7 +234,11 @@ const SearchPublicNoticeForm = ({ applySearch, searchCriteria, onGridReady }) => | |||||
| } | } | ||||
| value={status} | value={status} | ||||
| // inputValue={status?.labelCht} | // inputValue={status?.labelCht} | ||||
| getOptionLabel={(option) => intl.formatMessage({id: option.label})} | |||||
| getOptionLabel={(option) => { | |||||
| if (option == null || option.label == null) return ""; | |||||
| const s = intl.formatMessage({ id: option.label }); | |||||
| return typeof s === "string" ? s : String(s ?? ""); | |||||
| }} | |||||
| onChange={(event, newValue) => { | onChange={(event, newValue) => { | ||||
| if(newValue ==null){ | if(newValue ==null){ | ||||
| setStatus(localStorage.getItem('userData').creditor?ComboData.publicNoticeStatic_Creditor[0]:ComboData.publicNoticeStatic[0]); | setStatus(localStorage.getItem('userData').creditor?ComboData.publicNoticeStatic_Creditor[0]:ComboData.publicNoticeStatic[0]); | ||||
| @@ -280,7 +284,11 @@ const SearchPublicNoticeForm = ({ applySearch, searchCriteria, onGridReady }) => | |||||
| } | } | ||||
| value={status} | value={status} | ||||
| // inputValue={status?.labelCht} | // inputValue={status?.labelCht} | ||||
| getOptionLabel={(option) => intl.formatMessage({id: option.label})} | |||||
| getOptionLabel={(option) => { | |||||
| if (option == null || option.label == null) return ""; | |||||
| const s = intl.formatMessage({ id: option.label }); | |||||
| return typeof s === "string" ? s : String(s ?? ""); | |||||
| }} | |||||
| onChange={(event, newValue) => { | onChange={(event, newValue) => { | ||||
| console.log(newValue) | console.log(newValue) | ||||
| const findAllIndex = newValue.findIndex((ele) => { | const findAllIndex = newValue.findIndex((ele) => { | ||||
| @@ -48,7 +48,7 @@ export default function SearchPublicNoticeTable({ searchCriteria, applyGridOnRea | |||||
| flex: isMdOrLg ? 1 : undefined, | flex: isMdOrLg ? 1 : undefined, | ||||
| renderHeader: renderHeaderWithAria, | renderHeader: renderHeaderWithAria, | ||||
| renderCell: (params) => { | renderCell: (params) => { | ||||
| return [params.row.appNo+getModeIntl(params,intl)] | |||||
| return params.row.appNo + getModeIntl(params, intl); | |||||
| }, | }, | ||||
| }, | }, | ||||
| { | { | ||||
| @@ -126,7 +126,7 @@ export default function SearchPublicNoticeTable({ searchCriteria, applyGridOnRea | |||||
| width: 200, | width: 200, | ||||
| renderHeader: renderHeaderWithAria, | renderHeader: renderHeaderWithAria, | ||||
| renderCell: (params) => { | renderCell: (params) => { | ||||
| return [StatusUtils.getStatusIntl(params, intl)] | |||||
| return StatusUtils.getStatusIntl(params, intl); | |||||
| }, | }, | ||||
| }, | }, | ||||
| { | { | ||||
| @@ -77,7 +77,7 @@ export default function SearchPublicNoticeTable({ searchCriteria, applyGridOnRea | |||||
| width: 100, | width: 100, | ||||
| renderHeader: renderHeaderWithAria, | renderHeader: renderHeaderWithAria, | ||||
| renderCell: (params) => { | renderCell: (params) => { | ||||
| return [StatusUtils.getModeEng(params)] | |||||
| return StatusUtils.getModeEng(params); | |||||
| }, | }, | ||||
| }, | }, | ||||
| { | { | ||||
| @@ -88,7 +88,7 @@ export default function SearchPublicNoticeTable({ searchCriteria, applyGridOnRea | |||||
| width: 240, | width: 240, | ||||
| renderHeader: renderHeaderWithAria, | renderHeader: renderHeaderWithAria, | ||||
| renderCell: (params) => { | renderCell: (params) => { | ||||
| return [StatusUtils.getStatusEng(params)] | |||||
| return StatusUtils.getStatusEng(params); | |||||
| }, | }, | ||||
| }, | }, | ||||
| { | { | ||||
| @@ -99,7 +99,7 @@ export default function SearchPublicNoticeTable({ searchCriteria, applyGridOnRea | |||||
| width: 120, | width: 120, | ||||
| renderHeader: renderHeaderWithAria, | renderHeader: renderHeaderWithAria, | ||||
| renderCell: (params) => { | renderCell: (params) => { | ||||
| return [params.row.proofId != null ? "Yes" : ""] | |||||
| return params.row.proofId != null ? "Yes" : ""; | |||||
| }, | }, | ||||
| }, | }, | ||||
| { | { | ||||
| @@ -279,7 +279,7 @@ const SearchPublicNoticeForm = ({ applySearch, orgComboData, searchCriteria, iss | |||||
| setSelectedStatus(newValue); | setSelectedStatus(newValue); | ||||
| } | } | ||||
| }} | }} | ||||
| getOptionLabel={(option) => option.label} | |||||
| getOptionLabel={(option) => (option?.label != null ? String(option.label) : "")} | |||||
| sx={{ | sx={{ | ||||
| '& .MuiInputBase-root': { alignItems: 'center' }, | '& .MuiInputBase-root': { alignItems: 'center' }, | ||||
| '& .MuiAutocomplete-endAdornment': { top: '50%', transform: 'translateY(-50%)' }, | '& .MuiAutocomplete-endAdornment': { top: '50%', transform: 'translateY(-50%)' }, | ||||
| @@ -317,7 +317,7 @@ const SearchPublicNoticeForm = ({ applySearch, orgComboData, searchCriteria, iss | |||||
| setSelectedLabelsString(selectedLabelsString); | setSelectedLabelsString(selectedLabelsString); | ||||
| } | } | ||||
| }} | }} | ||||
| getOptionLabel={(option) => option.label} | |||||
| getOptionLabel={(option) => (option?.label != null ? String(option.label) : "")} | |||||
| renderInput={(params) => ( | renderInput={(params) => ( | ||||
| <TextField | <TextField | ||||
| {...params} | {...params} | ||||
| @@ -419,7 +419,7 @@ const SearchPublicNoticeForm = ({ applySearch, orgComboData, searchCriteria, iss | |||||
| options={ComboData.groupTitle} | options={ComboData.groupTitle} | ||||
| value={groupSelected} | value={groupSelected} | ||||
| inputValue={(groupSelected?.label) ? groupSelected?.label : ""} | inputValue={(groupSelected?.label) ? groupSelected?.label : ""} | ||||
| getOptionLabel={(option) => option.label} | |||||
| getOptionLabel={(option) => (option?.label != null ? String(option.label) : "")} | |||||
| onChange={(event, newValue) => { | onChange={(event, newValue) => { | ||||
| setGroupSelected(newValue); | setGroupSelected(newValue); | ||||
| }} | }} | ||||
| @@ -470,7 +470,7 @@ const SearchPublicNoticeForm = ({ applySearch, orgComboData, searchCriteria, iss | |||||
| '& .MuiAutocomplete-endAdornment': { top: '50%', transform: 'translateY(-50%)' }, | '& .MuiAutocomplete-endAdornment': { top: '50%', transform: 'translateY(-50%)' }, | ||||
| '& .MuiOutlinedInput-root': { height: 40 } | '& .MuiOutlinedInput-root': { height: 40 } | ||||
| }} | }} | ||||
| getOptionLabel={(option) => option.label} | |||||
| getOptionLabel={(option) => (option?.label != null ? String(option.label) : "")} | |||||
| renderInput={(params) => ( | renderInput={(params) => ( | ||||
| <TextField | <TextField | ||||
| {...params} | {...params} | ||||
| @@ -266,7 +266,7 @@ const SearchPublicNoticeForm = ({ applySearch, orgComboData, searchCriteria, iss | |||||
| setSelectedStatus(newValue); | setSelectedStatus(newValue); | ||||
| } | } | ||||
| }} | }} | ||||
| getOptionLabel={(option) => option.label} | |||||
| getOptionLabel={(option) => (option?.label != null ? String(option.label) : "")} | |||||
| sx={{ | sx={{ | ||||
| '& .MuiInputBase-root': { alignItems: 'center' }, | '& .MuiInputBase-root': { alignItems: 'center' }, | ||||
| '& .MuiAutocomplete-endAdornment': { top: '50%', transform: 'translateY(-50%)' }, | '& .MuiAutocomplete-endAdornment': { top: '50%', transform: 'translateY(-50%)' }, | ||||
| @@ -304,7 +304,7 @@ const SearchPublicNoticeForm = ({ applySearch, orgComboData, searchCriteria, iss | |||||
| setSelectedLabelsString(selectedLabelsString); | setSelectedLabelsString(selectedLabelsString); | ||||
| } | } | ||||
| }} | }} | ||||
| getOptionLabel={(option) => option.label} | |||||
| getOptionLabel={(option) => (option?.label != null ? String(option.label) : "")} | |||||
| renderInput={(params) => ( | renderInput={(params) => ( | ||||
| <TextField | <TextField | ||||
| {...params} | {...params} | ||||
| @@ -185,7 +185,7 @@ const SearchPublicNoticeForm = ({ applySearch, generateReport, onLoad }) => { | |||||
| filterOptions={(options) => options} | filterOptions={(options) => options} | ||||
| options={ComboData.paymentMethod} | options={ComboData.paymentMethod} | ||||
| value={method} | value={method} | ||||
| getOptionLabel={(option) => option.label} | |||||
| getOptionLabel={(option) => (option?.label != null ? String(option.label) : "")} | |||||
| inputValue={method?.label ? method?.label : ""} | inputValue={method?.label ? method?.label : ""} | ||||
| onChange={(event, newValue) => { | onChange={(event, newValue) => { | ||||
| if (newValue !== null) { | if (newValue !== null) { | ||||
| @@ -200,11 +200,9 @@ const SearchPublicNoticeForm = ({ applySearch, generateReport, onLoad }) => { | |||||
| renderInput={(params) => ( | renderInput={(params) => ( | ||||
| <TextField {...params} | <TextField {...params} | ||||
| label="Payment Method" | label="Payment Method" | ||||
| InputLabelProps={{ shrink: true }} | |||||
| /> | /> | ||||
| )} | )} | ||||
| InputLabelProps={{ | |||||
| shrink: true | |||||
| }} | |||||
| /> | /> | ||||
| </Grid> | </Grid> | ||||
| @@ -217,7 +215,7 @@ const SearchPublicNoticeForm = ({ applySearch, generateReport, onLoad }) => { | |||||
| filterOptions={(options) => options} | filterOptions={(options) => options} | ||||
| options={ComboData.paymentStatus} | options={ComboData.paymentStatus} | ||||
| value={status} | value={status} | ||||
| getOptionLabel={(option) => option.label} | |||||
| getOptionLabel={(option) => (option?.label != null ? String(option.label) : "")} | |||||
| inputValue={status?.label ? status?.label : ""} | inputValue={status?.label ? status?.label : ""} | ||||
| onChange={(event, newValue) => { | onChange={(event, newValue) => { | ||||
| if (newValue !== null) { | if (newValue !== null) { | ||||
| @@ -232,11 +230,9 @@ const SearchPublicNoticeForm = ({ applySearch, generateReport, onLoad }) => { | |||||
| renderInput={(params) => ( | renderInput={(params) => ( | ||||
| <TextField {...params} | <TextField {...params} | ||||
| label="Payment Status" | label="Payment Status" | ||||
| InputLabelProps={{ shrink: true }} | |||||
| /> | /> | ||||
| )} | )} | ||||
| InputLabelProps={{ | |||||
| shrink: true | |||||
| }} | |||||
| /> | /> | ||||
| </Grid> | </Grid> | ||||
| @@ -135,7 +135,7 @@ const SystemSetting = () => { | |||||
| </Grid> | </Grid> | ||||
| </Grid> | </Grid> | ||||
| <Grid item xs={12} sm={4} md={4} lg={4}> | <Grid item xs={12} sm={4} md={4} lg={4}> | ||||
| <Grid container spacing> | |||||
| <Grid container spacing={1}> | |||||
| <Grid item xs={12} md={12}> | <Grid item xs={12} md={12}> | ||||
| <MainCard elevation={0} | <MainCard elevation={0} | ||||
| border={false} | border={false} | ||||
| @@ -17,6 +17,7 @@ import { | |||||
| FormHelperText, | FormHelperText, | ||||
| TextField, | TextField, | ||||
| IconButton, InputAdornment, | IconButton, InputAdornment, | ||||
| CircularProgress, | |||||
| // Box, | // Box, | ||||
| // FormControl | // FormControl | ||||
| } from '@mui/material'; | } from '@mui/material'; | ||||
| @@ -78,6 +79,10 @@ const Index = () => { | |||||
| changePwdInFlightRef.current = false; | changePwdInFlightRef.current = false; | ||||
| setIsChangingPassword(false); | setIsChangingPassword(false); | ||||
| }, | }, | ||||
| onFail: function () { | |||||
| changePwdInFlightRef.current = false; | |||||
| setIsChangingPassword(false); | |||||
| }, | |||||
| onError:function (error) { | onError:function (error) { | ||||
| // console.log(error.response.data); | // console.log(error.response.data); | ||||
| setExpiryErrText(intl.formatMessage({ id: error.response.data.error })) | setExpiryErrText(intl.formatMessage({ id: error.response.data.error })) | ||||
| @@ -439,7 +444,11 @@ const Index = () => { | |||||
| <FormattedMessage id="close"/> | <FormattedMessage id="close"/> | ||||
| </Typography> | </Typography> | ||||
| </Button> | </Button> | ||||
| <Button disabled={isChangingPassword} onClick={() => goLogin(changePasswordValues)}> | |||||
| <Button | |||||
| disabled={isChangingPassword} | |||||
| onClick={() => goLogin(changePasswordValues)} | |||||
| startIcon={isChangingPassword ? <CircularProgress color="inherit" size={18} /> : null} | |||||
| > | |||||
| <Typography variant="h5"> | <Typography variant="h5"> | ||||
| <FormattedMessage id="confirm"/> | <FormattedMessage id="confirm"/> | ||||
| </Typography> | </Typography> | ||||
| @@ -578,7 +578,7 @@ const UserInformationCard_Individual = ({ formData, loadDataFun }) => { | |||||
| label: intl.formatMessage({ id: 'language' }) + ":", | label: intl.formatMessage({ id: 'language' }) + ":", | ||||
| valueName: "preferLocale", | valueName: "preferLocale", | ||||
| dataList: ComboData.Locale, | dataList: ComboData.Locale, | ||||
| getOptionLabel: (option) => option.label ? option.label : "", | |||||
| getOptionLabel: (option) => (option?.label != null ? String(option.label) : ""), | |||||
| disabled: (!editMode), | disabled: (!editMode), | ||||
| form: formik | form: formik | ||||
| })} | })} | ||||
| @@ -242,7 +242,7 @@ const UserInformationCard_Individual_Pub = ({ formData, loadDataFun }) => { | |||||
| })} | })} | ||||
| </Grid> | </Grid> | ||||
| <Grid xs={12} sm={12} md={12} lg={4}> | |||||
| <Grid item xs={12} sm={12} md={12} lg={4}> | |||||
| <Grid container alignItems={"center"} spacing={1} sx={{mb:2}} > | <Grid container alignItems={"center"} spacing={1} sx={{mb:2}} > | ||||
| <Grid item xs={12} sm={12} md={3} lg={3} sx={{ display: 'flex', alignItems: 'center' }}> | <Grid item xs={12} sm={12} md={3} lg={3} sx={{ display: 'flex', alignItems: 'center' }}> | ||||
| <Typography variant="pnspsFormParagraphBold"> | <Typography variant="pnspsFormParagraphBold"> | ||||
| @@ -345,7 +345,7 @@ const UserInformationCard_Individual_Pub = ({ formData, loadDataFun }) => { | |||||
| label: intl.formatMessage({id: 'language'}) + ":", | label: intl.formatMessage({id: 'language'}) + ":", | ||||
| valueName: "preferLocale", | valueName: "preferLocale", | ||||
| dataList: ComboData.Locale, | dataList: ComboData.Locale, | ||||
| getOptionLabel: (option) => option.label? option.label: "", | |||||
| getOptionLabel: (option) => (option?.label != null ? String(option.label) : ""), | |||||
| disabled: (!editMode), | disabled: (!editMode), | ||||
| form: formik | form: formik | ||||
| })} | })} | ||||
| @@ -2,6 +2,7 @@ | |||||
| import { | import { | ||||
| Grid, Typography, Button, | Grid, Typography, Button, | ||||
| Dialog, DialogTitle, DialogContent, DialogActions, | Dialog, DialogTitle, DialogContent, DialogActions, | ||||
| CircularProgress, | |||||
| } from '@mui/material'; | } from '@mui/material'; | ||||
| import MainCard from "components/MainCard"; | import MainCard from "components/MainCard"; | ||||
| import { useState, useEffect, lazy } from 'react'; | import { useState, useEffect, lazy } from 'react'; | ||||
| @@ -73,8 +74,8 @@ const UserInformationCard_Organization = ({ userData, loadDataFun, orgData }) => | |||||
| } | } | ||||
| }), | }), | ||||
| }), | }), | ||||
| onSubmit: (values, { setSubmitting }) => { | |||||
| return new Promise((resolve) => { | |||||
| onSubmit: (values) => { | |||||
| return new Promise((resolve, reject) => { | |||||
| HttpUtils.post({ | HttpUtils.post({ | ||||
| url: POST_ORG_USER + "/" + userData.id, | url: POST_ORG_USER + "/" + userData.id, | ||||
| params: { | params: { | ||||
| @@ -86,25 +87,18 @@ const UserInformationCard_Organization = ({ userData, loadDataFun, orgData }) => | |||||
| countryCode: values.fax_countryCode, | countryCode: values.fax_countryCode, | ||||
| faxNumber: values.faxNumber | faxNumber: values.faxNumber | ||||
| }, | }, | ||||
| // identification: values.identification, | |||||
| emailBus: values.emailBus, | emailBus: values.emailBus, | ||||
| contactPerson: values.contactPerson, | contactPerson: values.contactPerson, | ||||
| orgId: values.orgId?.id, | orgId: values.orgId?.id, | ||||
| preferLocale: values.preferLocale?.type | preferLocale: values.preferLocale?.type | ||||
| }, | }, | ||||
| onSuccess: function () { | onSuccess: function () { | ||||
| resolve(); | |||||
| notifySaveSuccess(); | notifySaveSuccess(); | ||||
| loadDataFun(); | loadDataFun(); | ||||
| }, | |||||
| onFail: function () { | |||||
| setSubmitting(false); | |||||
| resolve(); | resolve(); | ||||
| }, | }, | ||||
| onError: function () { | |||||
| setSubmitting(false); | |||||
| resolve(); | |||||
| } | |||||
| onFail: () => reject(), | |||||
| onError: () => reject(), | |||||
| }); | }); | ||||
| }); | }); | ||||
| } | } | ||||
| @@ -222,6 +216,7 @@ const UserInformationCard_Organization = ({ userData, loadDataFun, orgData }) => | |||||
| type="submit" | type="submit" | ||||
| color="success" | color="success" | ||||
| disabled={formik.isSubmitting} | disabled={formik.isSubmitting} | ||||
| startIcon={formik.isSubmitting ? <CircularProgress color="inherit" size={18} /> : null} | |||||
| > | > | ||||
| Save | Save | ||||
| </Button> | </Button> | ||||
| @@ -394,7 +389,7 @@ const UserInformationCard_Organization = ({ userData, loadDataFun, orgData }) => | |||||
| label: intl.formatMessage({ id: 'language' }) + ":", | label: intl.formatMessage({ id: 'language' }) + ":", | ||||
| valueName: "preferLocale", | valueName: "preferLocale", | ||||
| dataList: ComboData.Locale, | dataList: ComboData.Locale, | ||||
| getOptionLabel: (option) => option.label ? option.label : "", | |||||
| getOptionLabel: (option) => (option?.label != null ? String(option.label) : ""), | |||||
| disabled: (!editMode), | disabled: (!editMode), | ||||
| form: formik | form: formik | ||||
| })} | })} | ||||
| @@ -1,6 +1,7 @@ | |||||
| // material-ui | // material-ui | ||||
| import { | import { | ||||
| Grid, Typography, Button, | Grid, Typography, Button, | ||||
| CircularProgress, | |||||
| // Dialog, DialogTitle, DialogContent, DialogActions, | // Dialog, DialogTitle, DialogContent, DialogActions, | ||||
| } from '@mui/material'; | } from '@mui/material'; | ||||
| import MainCard from "components/MainCard"; | import MainCard from "components/MainCard"; | ||||
| @@ -59,8 +60,8 @@ const UserInformationCard_Organization_Pub = ({ userData, loadDataFun,}) => { | |||||
| tel_countryCode: yup.string().min(3, displayErrorMsg(intl.formatMessage({id: 'require3Number'}))).required(displayErrorMsg(intl.formatMessage({id: 'requireDialingCode'}))), | tel_countryCode: yup.string().min(3, displayErrorMsg(intl.formatMessage({id: 'require3Number'}))).required(displayErrorMsg(intl.formatMessage({id: 'requireDialingCode'}))), | ||||
| phoneNumber: yup.string().min(8, displayErrorMsg(intl.formatMessage({id: 'require8Number'}))).required(displayErrorMsg(intl.formatMessage({id: 'requireContactNumber'}))), | phoneNumber: yup.string().min(8, displayErrorMsg(intl.formatMessage({id: 'require8Number'}))).required(displayErrorMsg(intl.formatMessage({id: 'requireContactNumber'}))), | ||||
| }), | }), | ||||
| onSubmit: (values, { setSubmitting }) => { | |||||
| return new Promise((resolve) => { | |||||
| onSubmit: (values) => { | |||||
| return new Promise((resolve, reject) => { | |||||
| HttpUtils.post({ | HttpUtils.post({ | ||||
| url: UrlUtils.POST_PUB_ORG_USER, | url: UrlUtils.POST_PUB_ORG_USER, | ||||
| params: { | params: { | ||||
| @@ -75,18 +76,12 @@ const UserInformationCard_Organization_Pub = ({ userData, loadDataFun,}) => { | |||||
| preferLocale: values.preferLocale.type | preferLocale: values.preferLocale.type | ||||
| }, | }, | ||||
| onSuccess: function () { | onSuccess: function () { | ||||
| resolve(); | |||||
| notifySaveSuccess(); | notifySaveSuccess(); | ||||
| loadDataFun(); | loadDataFun(); | ||||
| }, | |||||
| onFail: function () { | |||||
| setSubmitting(false); | |||||
| resolve(); | resolve(); | ||||
| }, | }, | ||||
| onError: function () { | |||||
| setSubmitting(false); | |||||
| resolve(); | |||||
| } | |||||
| onFail: () => reject(), | |||||
| onError: () => reject(), | |||||
| }); | }); | ||||
| }); | }); | ||||
| } | } | ||||
| @@ -149,6 +144,7 @@ const UserInformationCard_Organization_Pub = ({ userData, loadDataFun,}) => { | |||||
| type="submit" | type="submit" | ||||
| color="success" | color="success" | ||||
| disabled={formik.isSubmitting} | disabled={formik.isSubmitting} | ||||
| startIcon={formik.isSubmitting ? <CircularProgress color="inherit" size={18} /> : null} | |||||
| > | > | ||||
| <FormattedMessage id="save" /> | <FormattedMessage id="save" /> | ||||
| @@ -244,7 +240,7 @@ const UserInformationCard_Organization_Pub = ({ userData, loadDataFun,}) => { | |||||
| label: intl.formatMessage({id: 'language'}) + ":", | label: intl.formatMessage({id: 'language'}) + ":", | ||||
| valueName: "preferLocale", | valueName: "preferLocale", | ||||
| dataList: ComboData.Locale, | dataList: ComboData.Locale, | ||||
| getOptionLabel: (option) => option.label? option.label: "", | |||||
| getOptionLabel: (option) => (option?.label != null ? String(option.label) : ""), | |||||
| disabled: (!editMode), | disabled: (!editMode), | ||||
| form: formik | form: formik | ||||
| })} | })} | ||||
| @@ -78,9 +78,10 @@ const ManageOrgUserPage = () => { | |||||
| }); | }); | ||||
| } | } | ||||
| function getHeader(headerStr) { | |||||
| return <Typography variant="h5" >{headerStr}</Typography>; | |||||
| } | |||||
| /** DataGrid `headerName` must be a string; use `renderHeader` for styled markup. */ | |||||
| const renderStyledHeader = (params) => ( | |||||
| <Typography variant="h5">{params.colDef.headerName}</Typography> | |||||
| ); | |||||
| function getStatus(params) { | function getStatus(params) { | ||||
| if (params.row.locked) { | if (params.row.locked) { | ||||
| @@ -125,7 +126,8 @@ const ManageOrgUserPage = () => { | |||||
| { | { | ||||
| id: 'username', | id: 'username', | ||||
| field: 'username', | field: 'username', | ||||
| headerName: getHeader(intl.formatMessage({ id: 'loginName' })), | |||||
| headerName: intl.formatMessage({ id: 'loginName' }), | |||||
| renderHeader: renderStyledHeader, | |||||
| width: isMdOrLg ? 'auto' : 160, | width: isMdOrLg ? 'auto' : 160, | ||||
| flex: isMdOrLg ? 1 : undefined, | flex: isMdOrLg ? 1 : undefined, | ||||
| @@ -133,7 +135,8 @@ const ManageOrgUserPage = () => { | |||||
| { | { | ||||
| id: 'contactPerson', | id: 'contactPerson', | ||||
| field: 'contactPerson', | field: 'contactPerson', | ||||
| headerName: getHeader(intl.formatMessage({ id: 'userName' })), | |||||
| headerName: intl.formatMessage({ id: 'userName' }), | |||||
| renderHeader: renderStyledHeader, | |||||
| width: isMdOrLg ? 'auto' : 160, | width: isMdOrLg ? 'auto' : 160, | ||||
| flex: isMdOrLg ? 1 : undefined, | flex: isMdOrLg ? 1 : undefined, | ||||
| @@ -141,7 +144,8 @@ const ManageOrgUserPage = () => { | |||||
| { | { | ||||
| id: 'contactTel', | id: 'contactTel', | ||||
| field: 'contactTel', | field: 'contactTel', | ||||
| headerName: getHeader(intl.formatMessage({ id: 'userContactNumber' })), | |||||
| headerName: intl.formatMessage({ id: 'userContactNumber' }), | |||||
| renderHeader: renderStyledHeader, | |||||
| width: isMdOrLg ? 'auto' : 160, | width: isMdOrLg ? 'auto' : 160, | ||||
| flex: isMdOrLg ? 1 : undefined, | flex: isMdOrLg ? 1 : undefined, | ||||
| valueGetter: (params) => { | valueGetter: (params) => { | ||||
| @@ -152,14 +156,16 @@ const ManageOrgUserPage = () => { | |||||
| { | { | ||||
| id: 'emailBus', | id: 'emailBus', | ||||
| field: 'emailBus', | field: 'emailBus', | ||||
| headerName: getHeader(intl.formatMessage({ id: 'userContactEmail' })), | |||||
| headerName: intl.formatMessage({ id: 'userContactEmail' }), | |||||
| renderHeader: renderStyledHeader, | |||||
| width: isMdOrLg ? 'auto' : 160, | width: isMdOrLg ? 'auto' : 160, | ||||
| flex: isMdOrLg ? 1 : undefined, | flex: isMdOrLg ? 1 : undefined, | ||||
| }, | }, | ||||
| { | { | ||||
| id: 'lastLogin', | id: 'lastLogin', | ||||
| field: 'lastLogin', | field: 'lastLogin', | ||||
| headerName: getHeader(intl.formatMessage({ id: 'lastLoginDate' })), | |||||
| headerName: intl.formatMessage({ id: 'lastLoginDate' }), | |||||
| renderHeader: renderStyledHeader, | |||||
| width: isMdOrLg ? 'auto' : 160, | width: isMdOrLg ? 'auto' : 160, | ||||
| flex: isMdOrLg ? 1 : undefined, | flex: isMdOrLg ? 1 : undefined, | ||||
| valueGetter: (params) => { | valueGetter: (params) => { | ||||
| @@ -169,7 +175,8 @@ const ManageOrgUserPage = () => { | |||||
| { | { | ||||
| id: 'lastApply', | id: 'lastApply', | ||||
| field: 'lastApply', | field: 'lastApply', | ||||
| headerName: getHeader(intl.formatMessage({ id: 'lastSubmissionDate' })), | |||||
| headerName: intl.formatMessage({ id: 'lastSubmissionDate' }), | |||||
| renderHeader: renderStyledHeader, | |||||
| width: isMdOrLg ? 'auto' : 160, | width: isMdOrLg ? 'auto' : 160, | ||||
| flex: isMdOrLg ? 1 : undefined, | flex: isMdOrLg ? 1 : undefined, | ||||
| valueGetter: () => { | valueGetter: () => { | ||||
| @@ -178,20 +185,21 @@ const ManageOrgUserPage = () => { | |||||
| }, | }, | ||||
| { | { | ||||
| field: 'actions', | field: 'actions', | ||||
| type: 'actions', | |||||
| headerName: getHeader(intl.formatMessage({ id: 'status' })), | |||||
| headerName: intl.formatMessage({ id: 'status' }), | |||||
| renderHeader: renderStyledHeader, | |||||
| width: isMdOrLg ? 'auto' : 160, | width: isMdOrLg ? 'auto' : 160, | ||||
| flex: isMdOrLg ? 1 : undefined, | flex: isMdOrLg ? 1 : undefined, | ||||
| cellClassName: 'actions', | cellClassName: 'actions', | ||||
| getActions: (params) => { | |||||
| return [getStatus(params)] | |||||
| }, | |||||
| sortable: false, | |||||
| filterable: false, | |||||
| renderCell: (params) => getStatus(params), | |||||
| }, | }, | ||||
| { | { | ||||
| id: 'primaryUser', | id: 'primaryUser', | ||||
| field: 'primaryUser', | field: 'primaryUser', | ||||
| type: 'bool', | type: 'bool', | ||||
| headerName: getHeader(intl.formatMessage({ id: 'primary' })), | |||||
| headerName: intl.formatMessage({ id: 'primary' }), | |||||
| renderHeader: renderStyledHeader, | |||||
| width: isMdOrLg ? 'auto' : 160, | width: isMdOrLg ? 'auto' : 160, | ||||
| flex: isMdOrLg ? 1 : undefined, | flex: isMdOrLg ? 1 : undefined, | ||||
| renderCell: (params) => { | renderCell: (params) => { | ||||
| @@ -129,14 +129,16 @@ export default function UserTable_Individual({ searchCriteria, applyGridOnReady, | |||||
| if (params.row.verifiedDate) | if (params.row.verifiedDate) | ||||
| return [ | return [ | ||||
| <GridActionsCellItem | <GridActionsCellItem | ||||
| key="" | |||||
| key="verified" | |||||
| icon={<CheckCircleOutline />} | icon={<CheckCircleOutline />} | ||||
| label="Verified" | |||||
| color="success" | color="success" | ||||
| />]; | />]; | ||||
| return [ | return [ | ||||
| <GridActionsCellItem | <GridActionsCellItem | ||||
| key="" | |||||
| key="unverified" | |||||
| icon={<HighlightOff />} | icon={<HighlightOff />} | ||||
| label="Not verified" | |||||
| color="error" | color="error" | ||||
| />]; | />]; | ||||
| }, | }, | ||||
| @@ -123,14 +123,16 @@ export default function UserTable_Organization({searchCriteria, applyGridOnReady | |||||
| if(params.row.verifiedDate) | if(params.row.verifiedDate) | ||||
| return [ | return [ | ||||
| <GridActionsCellItem | <GridActionsCellItem | ||||
| key="" | |||||
| key="verified" | |||||
| icon={<CheckCircleOutline/>} | icon={<CheckCircleOutline/>} | ||||
| label="Verified" | |||||
| color="success" | color="success" | ||||
| />]; | />]; | ||||
| return [ | return [ | ||||
| <GridActionsCellItem | <GridActionsCellItem | ||||
| key="" | |||||
| key="not-verified" | |||||
| icon={<HighlightOff/>} | icon={<HighlightOff/>} | ||||
| label="Not verified" | |||||
| color="error" | color="error" | ||||
| />]; | />]; | ||||
| }, | }, | ||||
| @@ -175,9 +175,11 @@ const AuthWrapper = ({ children }) => { | |||||
| '& p': { marginBottom: '12px', lineHeight: 1.7 } | '& p': { marginBottom: '12px', lineHeight: 1.7 } | ||||
| }} | }} | ||||
| > | > | ||||
| <Typography component="div" sx={{ fontSize: 18, lineHeight: 1.8 }}> | |||||
| <div dangerouslySetInnerHTML={{ __html: popupHtml }} /> | |||||
| </Typography> | |||||
| <Typography | |||||
| component="div" | |||||
| sx={{ fontSize: 18, lineHeight: 1.8 }} | |||||
| dangerouslySetInnerHTML={{ __html: popupHtml }} | |||||
| /> | |||||
| </DialogContent> | </DialogContent> | ||||
| </Dialog> | </Dialog> | ||||
| @@ -205,26 +207,24 @@ const AuthWrapper = ({ children }) => { | |||||
| > | > | ||||
| <Grid item xs={12} sx={{ px: { xs: 2 }, pl: { md: 4 }, pt: { xs: 4, sm: 2, md: 1.5 }, pb: { xs: 4, sm: 0 } }}> | <Grid item xs={12} sx={{ px: { xs: 2 }, pl: { md: 4 }, pt: { xs: 4, sm: 2, md: 1.5 }, pb: { xs: 4, sm: 0 } }}> | ||||
| {checkPaymentSuspension() ? ( | {checkPaymentSuspension() ? ( | ||||
| <Typography style={{ color: 'red', textAlign: 'flex-start' }}> | |||||
| <div | |||||
| style={{ padding: 12 }} | |||||
| dangerouslySetInnerHTML={{ | |||||
| __html: intl.formatMessage({ id: 'suspensionMessageText', defaultMessage: '' }) | |||||
| }} | |||||
| /> | |||||
| </Typography> | |||||
| <Typography | |||||
| component="div" | |||||
| sx={{ color: 'error.main', textAlign: 'start', p: 1.5 }} | |||||
| dangerouslySetInnerHTML={{ | |||||
| __html: intl.formatMessage({ id: 'suspensionMessageText', defaultMessage: '' }) | |||||
| }} | |||||
| /> | |||||
| ) : ( | ) : ( | ||||
| <Typography style={{ textAlign: 'flex-start' }}> | |||||
| <div | |||||
| style={{ padding: 12 }} | |||||
| dangerouslySetInnerHTML={{ | |||||
| __html: intl.formatMessage({ | |||||
| id: isOnlyOnline ? 'landingMessage' : 'homePageHeaderMessage', | |||||
| defaultMessage: '' | |||||
| }) | |||||
| }} | |||||
| /> | |||||
| </Typography> | |||||
| <Typography | |||||
| component="div" | |||||
| sx={{ textAlign: 'start', p: 1.5 }} | |||||
| dangerouslySetInnerHTML={{ | |||||
| __html: intl.formatMessage({ | |||||
| id: isOnlyOnline ? 'landingMessage' : 'homePageHeaderMessage', | |||||
| defaultMessage: '' | |||||
| }) | |||||
| }} | |||||
| /> | |||||
| )} | )} | ||||
| </Grid> | </Grid> | ||||
| @@ -29,13 +29,13 @@ const SearchDemandNoteForm = (props) => { | |||||
| React.useEffect(() => { | React.useEffect(() => { | ||||
| let list = [] | let list = [] | ||||
| if(listData == []) return; | if(listData == []) return; | ||||
| listData.map((item) => { | |||||
| listData.map((item, index) => { | |||||
| list.push( | list.push( | ||||
| <Stack direction="column"> | |||||
| <Stack key={item.id != null ? item.id : `announce-${index}`} direction="column"> | |||||
| <Typography variant='h4' align="justify"><b>{locale === 'en' ?item.subjectEng:locale === 'zh-HK' ?item.subjectCht:item.subjectChs}</b></Typography> | <Typography variant='h4' align="justify"><b>{locale === 'en' ?item.subjectEng:locale === 'zh-HK' ?item.subjectCht:item.subjectChs}</b></Typography> | ||||
| <Typography align="justify">{DateUtils.dateValue(item.announceDate)}</Typography> | <Typography align="justify">{DateUtils.dateValue(item.announceDate)}</Typography> | ||||
| <Typography sx={{pt: 1}} align="justify">{locale === 'en' ?item.contentEng:locale === 'zh-HK' ?item.contentCht:item.contentChs}</Typography> | <Typography sx={{pt: 1}} align="justify">{locale === 'en' ?item.contentEng:locale === 'zh-HK' ?item.contentCht:item.contentChs}</Typography> | ||||
| <Divider fullWidth sx={{ pt: 1 }}></Divider> | |||||
| <Divider sx={{ pt: 1 }} /> | |||||
| </Stack> | </Stack> | ||||
| ) | ) | ||||
| }); | }); | ||||
| @@ -92,10 +92,9 @@ const DashboardDefault = () => { | |||||
| HttpUtils.get({ | HttpUtils.get({ | ||||
| url: UrlUtils.GET_MSG_DASHBOARD, | url: UrlUtils.GET_MSG_DASHBOARD, | ||||
| onSuccess: function (response) { | onSuccess: function (response) { | ||||
| let list = [] | |||||
| response.map((item) => { | |||||
| list.push( | |||||
| const list = response.map((item) => ( | |||||
| <Button | <Button | ||||
| key={item.id} | |||||
| onClick={() => navigate("/msg/details/" + item.id)} | onClick={() => navigate("/msg/details/" + item.id)} | ||||
| sx={{ | sx={{ | ||||
| p: 2, | p: 2, | ||||
| @@ -119,8 +118,7 @@ const DashboardDefault = () => { | |||||
| <Typography align="justify">{DateUtils.datetimeStr(item.sentDate)}</Typography> | <Typography align="justify">{DateUtils.datetimeStr(item.sentDate)}</Typography> | ||||
| </Stack> | </Stack> | ||||
| </Button> | </Button> | ||||
| ) | |||||
| }); | |||||
| )); | |||||
| setItemList(list); | setItemList(list); | ||||
| setMessageOnReady(true); | setMessageOnReady(true); | ||||
| @@ -124,6 +124,12 @@ const UserAddCard = ({ isCollectData, updateGroupMember, userGroupData, isNewRec | |||||
| id="user-combo" | id="user-combo" | ||||
| value={selectedUser === null ? null : selectedUser} | value={selectedUser === null ? null : selectedUser} | ||||
| options={userComboList} | options={userComboList} | ||||
| getOptionLabel={(option) => { | |||||
| if (option == null) return ""; | |||||
| if (typeof option === "string") return option; | |||||
| const s = option.label ?? option.name ?? option.username ?? option.fullName ?? option.enName; | |||||
| return s != null ? String(s) : ""; | |||||
| }} | |||||
| onChange={(event, newValue) => { | onChange={(event, newValue) => { | ||||
| // console.log(newValue) | // console.log(newValue) | ||||
| setSelectedUser(newValue); | setSelectedUser(newValue); | ||||
| @@ -39,10 +39,10 @@ export default function ThemeRoutes() { | |||||
| return () => window.removeEventListener('storage', onStorage) | return () => window.removeEventListener('storage', onStorage) | ||||
| }, [dispatch]) | }, [dispatch]) | ||||
| if (isUserLoggedIn()) { | |||||
| //auto logout if token not valid | |||||
| SetupAxiosInterceptors(); | |||||
| } | |||||
| // Must run every render: SetupAxiosInterceptors uses useNavigate/useDispatch. Wrapping it in | |||||
| // isUserLoggedIn() caused fewer hooks after logout (e.g. Change Password → Back to Login). | |||||
| // Interceptor registration is still guarded inside by axiosInterceptorsSetup. | |||||
| SetupAxiosInterceptors(); | |||||
| // console.log(); | // console.log(); | ||||
| return useRoutes([{ | return useRoutes([{ | ||||
| path: '', | path: '', | ||||
| @@ -12,6 +12,9 @@ export default function Combo({ | |||||
| isOptionEqualToValue, | isOptionEqualToValue, | ||||
| onInputChange, | onInputChange, | ||||
| onChange, | onChange, | ||||
| /** TextField-only: must not be spread onto Autocomplete (root is a div). */ | |||||
| error, | |||||
| helperText, | |||||
| ...props | ...props | ||||
| }) { | }) { | ||||
| const formValue = form.values[valueName] ?? null; | const formValue = form.values[valueName] ?? null; | ||||
| @@ -24,7 +27,7 @@ export default function Combo({ | |||||
| if (!formValue) return; | if (!formValue) return; | ||||
| try { | try { | ||||
| const label = getOptionLabel ? getOptionLabel(formValue) : ""; | const label = getOptionLabel ? getOptionLabel(formValue) : ""; | ||||
| if (typeof label === "string") setInputValue(label); | |||||
| if (label != null) setInputValue(typeof label === "string" ? label : String(label)); | |||||
| } catch { | } catch { | ||||
| // ignore label errors | // ignore label errors | ||||
| } | } | ||||
| @@ -49,9 +52,15 @@ export default function Combo({ | |||||
| inputValue={inputValue} | inputValue={inputValue} | ||||
| filterOptions={filterOptions} | filterOptions={filterOptions} | ||||
| getOptionLabel={(opt) => { | getOptionLabel={(opt) => { | ||||
| if (!opt) return ""; | |||||
| const v = getOptionLabel ? getOptionLabel(opt) : String(opt); | |||||
| return typeof v === "string" ? v : ""; | |||||
| if (opt == null) return ""; | |||||
| let v; | |||||
| try { | |||||
| v = getOptionLabel ? getOptionLabel(opt) : String(opt); | |||||
| } catch { | |||||
| v = ""; | |||||
| } | |||||
| if (v == null) return ""; | |||||
| return typeof v === "string" ? v : String(v); | |||||
| }} | }} | ||||
| isOptionEqualToValue={(option, value) => { | isOptionEqualToValue={(option, value) => { | ||||
| return isOptionEqualToValue | return isOptionEqualToValue | ||||
| @@ -78,6 +87,8 @@ export default function Combo({ | |||||
| renderInput={(params) => ( | renderInput={(params) => ( | ||||
| <TextField | <TextField | ||||
| {...params} | {...params} | ||||
| error={error} | |||||
| helperText={helperText} | |||||
| sx={{ | sx={{ | ||||
| "& .MuiInputBase-input.Mui-disabled": { | "& .MuiInputBase-input.Mui-disabled": { | ||||
| WebkitTextFillColor: "#000000", | WebkitTextFillColor: "#000000", | ||||
| @@ -22,7 +22,17 @@ export default function Combo ({valueName, disabled, form, dataList, filterOptio | |||||
| inputValue={inputValue} | inputValue={inputValue} | ||||
| filterOptions={filterOptions} | filterOptions={filterOptions} | ||||
| options={dataList} | options={dataList} | ||||
| getOptionLabel={getOptionLabel} | |||||
| getOptionLabel={(opt) => { | |||||
| if (opt == null) return ""; | |||||
| let v; | |||||
| try { | |||||
| v = getOptionLabel ? getOptionLabel(opt) : String(opt); | |||||
| } catch { | |||||
| v = ""; | |||||
| } | |||||
| if (v == null) return ""; | |||||
| return typeof v === "string" ? v : String(v); | |||||
| }} | |||||
| isOptionEqualToValue={(option, newValue)=>{ | isOptionEqualToValue={(option, newValue)=>{ | ||||
| if(isOptionEqualToValue) | if(isOptionEqualToValue) | ||||
| isOptionEqualToValue(option,newValue, setValue,setInputValue ) | isOptionEqualToValue(option,newValue, setValue,setInputValue ) | ||||