From 6a07b6cc717cb6cb61f8c92f7a17b9108706dc19 Mon Sep 17 00:00:00 2001 From: Alex Cheung Date: Fri, 29 Nov 2024 15:29:08 +0800 Subject: [PATCH] add careOf and org combo --- .../Proof/Reply_Public/ApplicationDetails.js | 29 ++++++++ .../UserSearchForm_Organization.js | 67 ++++++++++++++----- .../User/SearchPage_Organization/index.js | 20 +++++- 3 files changed, 100 insertions(+), 16 deletions(-) diff --git a/src/pages/Proof/Reply_Public/ApplicationDetails.js b/src/pages/Proof/Reply_Public/ApplicationDetails.js index 6c260dd..51cd27f 100644 --- a/src/pages/Proof/Reply_Public/ApplicationDetails.js +++ b/src/pages/Proof/Reply_Public/ApplicationDetails.js @@ -18,6 +18,9 @@ const MainCard = Loadable(React.lazy(() => import('components/MainCard'))); import * as StatusUtils from "utils/statusUtils/PublicNoteStatusUtils"; import FileList from "components/FileList" import { FormattedMessage, useIntl } from "react-intl"; +import { + isORGLoggedIn, +} from "utils/Utils"; // ==============================|| DASHBOARD - DEFAULT ||============================== // const ApplicationDetailCard = ({ formData, }) => { @@ -175,6 +178,32 @@ const ApplicationDetailCard = ({ formData, }) => { + {isORGLoggedIn() ? + <> + + + + + + : + + + + + + + + + + + + + : + null + + } diff --git a/src/pages/User/SearchPage_Organization/UserSearchForm_Organization.js b/src/pages/User/SearchPage_Organization/UserSearchForm_Organization.js index 796bb0e..35a403e 100644 --- a/src/pages/User/SearchPage_Organization/UserSearchForm_Organization.js +++ b/src/pages/User/SearchPage_Organization/UserSearchForm_Organization.js @@ -8,17 +8,18 @@ import { import MainCard from "../../../components/MainCard"; import {useForm} from "react-hook-form"; -import { useState} from "react"; +import { useState, useEffect} from "react"; import {PNSPS_BUTTON_THEME} from "../../../themes/buttonConst"; import {ThemeProvider} from "@emotion/react"; // ==============================|| DASHBOARD - DEFAULT ||============================== // -const UserSearchForm_Organization = ({applySearch, onGridReady}) => { +const UserSearchForm_Organization = ({applySearch, orgComboData, onGridReady}) => { const [type, setType] = useState([]); const [accountFilter, setAccountFilter] = useState("All"); - + const [orgCombo, setOrgCombo] = useState(); + const [orgSelected, setOrgSelected] = useState({}); const { reset, register, handleSubmit } = useForm() const onSubmit = (data) => { @@ -36,15 +37,22 @@ const UserSearchForm_Organization = ({applySearch, onGridReady}) => { contactTel: data.phone, contactPerson: data.contactPerson, brNoStr: data.brNoStr, - orgName: data.orgName, + orgName: orgSelected?.name ? orgSelected?.name : "", accountFilter: accountFilter=="All"?null:accountFilter, }; applySearch(temp); }; + useEffect(() => { + if (orgComboData && orgComboData.length > 0) { + setOrgCombo(orgComboData); + } + }, [orgComboData]); + function resetForm(){ setType([]); setAccountFilter("All"); + setOrgSelected({}); reset(); } @@ -64,17 +72,46 @@ const UserSearchForm_Organization = ({applySearch, onGridReady}) => { {/*row 2*/} - - - + { + orgCombo ? + + option.groupType} + size="small" + value={orgSelected} + getOptionLabel={(option) => option.name? option.name : ""} + inputValue={orgSelected ? orgSelected.name : ""} + onChange={(event, newValue) => { + if (newValue !== null) { + setOrgSelected(newValue); + }else{ + setOrgSelected({}); + } + }} + renderInput={(params) => ( + + )} + renderGroup={(params) => ( + + + {params.group} + + {params.children} + + )} + /> + + : <> + } import('../../extra-pages/LoadingComponent'))); const SearchForm = Loadable(lazy(() => import('./UserSearchForm_Organization'))); const EventTable = Loadable(lazy(() => import('./UserTable_Organization'))); @@ -23,11 +26,25 @@ const BackgroundHead = { // ==============================|| DASHBOARD - DEFAULT ||============================== // const UserSearchPage_Organization = () => { - + const [orgCombo, setOrgCombo] = useState([]); const [searchCriteria, setSearchCriteria] = useState({}); const [onReady, setOnReady] = useState(false); const [onGridReady, setGridOnReady] = useState(false); + useEffect(() => { + getOrgCombo(); + // getIssueCombo(); + }, []); + + function getOrgCombo() { + HttpUtils.get({ + url: GET_ORG_COMBO, + onSuccess: function (responseData) { + let combo = responseData; + setOrgCombo(combo); + } + }); + } useEffect(() => { setOnReady(true); @@ -62,6 +79,7 @@ const UserSearchPage_Organization = () => {