From 58105eab3d9a7505634a3fe0bf4b4d3398c22bc9 Mon Sep 17 00:00:00 2001 From: anna Date: Fri, 22 Mar 2024 11:43:35 +0800 Subject: [PATCH 1/2] org combo --- .../DemandNote/Search_Public/SearchForm.js | 127 +++++++++--------- .../UserInformationCard_Organization.js | 12 +- .../User/DetailsPage_Organization/index.js | 6 + 3 files changed, 80 insertions(+), 65 deletions(-) diff --git a/src/pages/DemandNote/Search_Public/SearchForm.js b/src/pages/DemandNote/Search_Public/SearchForm.js index 0e36399..2d54619 100644 --- a/src/pages/DemandNote/Search_Public/SearchForm.js +++ b/src/pages/DemandNote/Search_Public/SearchForm.js @@ -12,37 +12,37 @@ import * as React from "react"; import * as ComboData from "utils/ComboData"; import * as DateUtils from "utils/DateUtils"; import * as FormatUtils from "utils/FormatUtils"; -import {FormattedMessage, useIntl} from "react-intl"; -import {PNSPS_BUTTON_THEME} from "../../../themes/buttonConst"; -import {ThemeProvider} from "@emotion/react"; +import { FormattedMessage, useIntl } from "react-intl"; +import { PNSPS_BUTTON_THEME } from "../../../themes/buttonConst"; +import { ThemeProvider } from "@emotion/react"; import { makeStyles } from '@mui/styles'; // ==============================|| DASHBOARD - DEFAULT ||============================== // const useStyles = makeStyles(() => ({ root: { - position: "relative" + position: "relative" }, display: { - position: "absolute", - top: 2, - left: 12, - bottom: 2, - background: "white", - pointerEvents: "none", - right: 50, - display: "flex", - alignItems: "center" + position: "absolute", + top: 2, + left: 12, + bottom: 2, + background: "white", + pointerEvents: "none", + right: 50, + display: "flex", + alignItems: "center" }, - })); +})); const SearchDemandNoteForm = ({ applySearch, searchCriteria, issueComboData }) => { const intl = useIntl(); const { locale } = intl; - + const [type, setType] = React.useState([]); - const [issueSelected, setIssueSelected] = React.useState({ key: 0, i18nLabel: 'all', labelCht: '全部', label: 'All', type: 'all' }); + const [issueSelected, setIssueSelected] = React.useState({ key: 0, i18nLabel: 'all', labelCht: '全部', label: 'All', type: 'all' }); const [issueCombo, setIssueCombo] = React.useState([]); const [selectedStatus, setSelectedStatus] = React.useState(ComboData.denmandNoteStatus_Public[0]); @@ -53,58 +53,58 @@ const SearchDemandNoteForm = ({ applySearch, searchCriteria, issueComboData React.useEffect(() => { console.log(minDate) - if (minDate != searchCriteria.dateFrom){ + if (minDate != searchCriteria.dateFrom) { setFromDateValue(minDate); } }, [minDate]); - + React.useEffect(() => { console.log(maxDate) - if (maxDate != searchCriteria.dateTo){ + if (maxDate != searchCriteria.dateTo) { setToDateValue(maxDate); } }, [maxDate]); - function FormDateInputComponent({inputRef, ...props }) { + function FormDateInputComponent({ inputRef, ...props }) { const classes = useStyles(); return ( <> -
- {DateUtils.dateStr(fromDateValue)=="Invalid Date"? - fromDateValue - : - DateUtils.dateStr(fromDateValue)} -
- +
+ {DateUtils.dateStr(fromDateValue) == "Invalid Date" ? + fromDateValue + : + DateUtils.dateStr(fromDateValue)} +
+ ); } - function ToDateInputComponent({inputRef, ...props }) { + function ToDateInputComponent({ inputRef, ...props }) { const classes = useStyles(); return ( <> -
- {DateUtils.dateStr(toDateValue)=="Invalid Date"? - toDateValue - : - DateUtils.dateStr(toDateValue)} -
- +
+ {DateUtils.dateStr(toDateValue) == "Invalid Date" ? + toDateValue + : + DateUtils.dateStr(toDateValue)} +
+ ); } @@ -119,7 +119,7 @@ const SearchDemandNoteForm = ({ applySearch, searchCriteria, issueComboData typeArray.push(type[i].label); } - if( fromDateValue!="dd / mm / yyyy"&&toDateValue!="dd / mm / yyyy"){ + if (fromDateValue != "dd / mm / yyyy" && toDateValue != "dd / mm / yyyy") { sentDateFrom = DateUtils.dateValue(fromDateValue) sentDateTo = DateUtils.dateValue(toDateValue) } @@ -188,7 +188,7 @@ const SearchDemandNoteForm = ({ applySearch, searchCriteria, issueComboData - + @@ -212,7 +212,7 @@ const SearchDemandNoteForm = ({ applySearch, searchCriteria, issueComboData }} renderInput={(params) => ( { @@ -284,7 +285,7 @@ const SearchDemandNoteForm = ({ applySearch, searchCriteria, issueComboData }} id="dateTo" type="date" - label={intl.formatMessage({id: 'sendDateTo'})} + label={intl.formatMessage({ id: 'sendDateTo' })} defaultValue={searchCriteria.dateTo} /> @@ -296,8 +297,8 @@ const SearchDemandNoteForm = ({ applySearch, searchCriteria, issueComboData id="status" size="small" options={ComboData.denmandNoteStatus_Public} - getOptionLabel={(option) => option?.i18nLabel? intl.formatMessage({ id: option.i18nLabel }) : ""} - inputValue={selectedStatus?.i18nLabel? intl.formatMessage({ id: selectedStatus.i18nLabel }) : ""} + getOptionLabel={(option) => option?.i18nLabel ? intl.formatMessage({ id: option.i18nLabel }) : ""} + inputValue={selectedStatus?.i18nLabel ? intl.formatMessage({ id: selectedStatus.i18nLabel }) : ""} value={selectedStatus} onChange={(event, newValue) => { if (newValue !== null) { @@ -307,7 +308,7 @@ const SearchDemandNoteForm = ({ applySearch, searchCriteria, issueComboData renderInput={(params) => ( )} InputLabelProps={{ @@ -323,13 +324,13 @@ const SearchDemandNoteForm = ({ applySearch, searchCriteria, issueComboData {/*last row*/} - + diff --git a/src/pages/User/DetailsPage_Organization/UserInformationCard_Organization.js b/src/pages/User/DetailsPage_Organization/UserInformationCard_Organization.js index cb67bbb..64565ef 100644 --- a/src/pages/User/DetailsPage_Organization/UserInformationCard_Organization.js +++ b/src/pages/User/DetailsPage_Organization/UserInformationCard_Organization.js @@ -98,7 +98,7 @@ const UserInformationCard_Organization = ({ userData, loadDataFun, orgData }) => contactPerson: values.contactPerson, // enCompanyName: values.enCompanyName, // chCompanyName: values.chCompanyName, - orgId: values.orgId, + orgId: values.orgId?.id, // brNo: values.brNo, // brExpiryDate: values.brExpiryDate, preferLocale: values.preferLocale.type @@ -303,6 +303,14 @@ const UserInformationCard_Organization = ({ userData, loadDataFun, orgData }) => {FieldUtils.getComboField({ + label: "Organisation:", + valueName: "orgId", + getOptionLabel: (option) => option.brNo? option.brNo : "", + dataList: orgData, + disabled: (!editMode), + form: formik + })} + {/* {FieldUtils.getComboField({ label: "Organisation:", valueName: "orgId", disabled: (!editMode), @@ -343,7 +351,7 @@ const UserInformationCard_Organization = ({ userData, loadDataFun, orgData }) => formik.setFieldValue("orgId", newValue.id); }, form: formik - })} + })} */} diff --git a/src/pages/User/DetailsPage_Organization/index.js b/src/pages/User/DetailsPage_Organization/index.js index 8bb1905..bca1c70 100644 --- a/src/pages/User/DetailsPage_Organization/index.js +++ b/src/pages/User/DetailsPage_Organization/index.js @@ -90,6 +90,12 @@ const UserMaintainPage_Organization = () => { loadData(); } }, []); + + useEffect(() => { + if (orgData.length > 0 && userData["orgId"] != null){ + userData["orgId"] = getObjectByType(orgData, "id", userData["orgId"]); + } + }, [orgData, userData]); useEffect(() => { // console.log(userData); From cf6a571203cc0fc4386e7e0b87d165f57a94e183 Mon Sep 17 00:00:00 2001 From: anna Date: Fri, 22 Mar 2024 11:53:19 +0800 Subject: [PATCH 2/2] update status margin --- src/utils/statusUtils/Base.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/statusUtils/Base.js b/src/utils/statusUtils/Base.js index 4ed3754..3b64235 100644 --- a/src/utils/statusUtils/Base.js +++ b/src/utils/statusUtils/Base.js @@ -2,7 +2,7 @@ import { Typography } from "@mui/material" export function getStatusTag({ color = "#000", textColor = "#FFF", text = "" }) { return ( -
+
{text}