From 827fda4e8d130be006e71a0b7da9f3e3757ba43c Mon Sep 17 00:00:00 2001 From: "MSI\\User" Date: Fri, 27 Oct 2023 17:28:04 +0800 Subject: [PATCH] update --- .../PublicNotice/Search_GLD/SearchForm.js | 40 ++++++++++++++++--- 1 file changed, 34 insertions(+), 6 deletions(-) diff --git a/src/pages/PublicNotice/Search_GLD/SearchForm.js b/src/pages/PublicNotice/Search_GLD/SearchForm.js index e399330..4d2b812 100644 --- a/src/pages/PublicNotice/Search_GLD/SearchForm.js +++ b/src/pages/PublicNotice/Search_GLD/SearchForm.js @@ -7,7 +7,7 @@ import { } from '@mui/material'; import MainCard from "components/MainCard"; import { useForm } from "react-hook-form"; -import * as React from "react"; +import * as React from "react"; import * as ComboData from "utils/ComboData"; import * as DateUtils from "utils/DateUtils"; // ==============================|| DASHBOARD - DEFAULT ||============================== // @@ -17,11 +17,13 @@ const SearchPublicNoticeForm = ({ applySearch, orgComboData, searchCriteria,issu }) => { const [type, setType] = React.useState([]); - const [status, setStatus] = React.useState({ key: 0, label: 'All', type: 'all' }); + // const [status, setStatus] = React.useState({ key: 0, label: 'All', type: 'all' }); const [orgSelected, setOrgSelected] = React.useState({}); const [orgCombo, setOrgCombo] = React.useState(); const [issueSelected, setIssueSelected] = React.useState({}); const [issueCombo, setIssueCombo] = React.useState([]); + const [selectedStatus, setSelectedStatus] = React.useState([]); + const [selectedLabelsString, setSelectedLabelsString] = React.useState(''); const [minDate, setMinDate] = React.useState(searchCriteria.dateFrom); const [maxDate, setMaxDate] = React.useState(searchCriteria.dateTo); @@ -29,7 +31,9 @@ const SearchPublicNoticeForm = ({ applySearch, orgComboData, searchCriteria,issu const { reset, register, handleSubmit } = useForm() const onSubmit = (data) => { - + console.log(selectedLabelsString) + data.status = selectedLabelsString + console.log(data.status) let typeArray = []; for (let i = 0; i < type.length; i++) { @@ -41,7 +45,8 @@ const SearchPublicNoticeForm = ({ applySearch, orgComboData, searchCriteria,issu dateFrom: data.dateFrom, dateTo: data.dateTo, contact: data.contact, - status: (status?.type && status?.type != 'all') ? status?.type : "", + // status: (status?.type && status?.type != 'all') ? status?.type : "", + status: data.status, orgId: (orgSelected?.key && orgSelected?.key > 0) ? orgSelected?.key : "", issueId: issueSelected?.id, groupNo: data.groupNo, @@ -63,7 +68,7 @@ const SearchPublicNoticeForm = ({ applySearch, orgComboData, searchCriteria,issu function resetForm() { setType([]); - setStatus({ key: 0, label: 'All', type: 'all' }); + // setStatus({ key: 0, label: 'All', type: 'all' }); setOrgSelected({}); setIssueSelected({}); reset(); @@ -162,7 +167,7 @@ const SearchPublicNoticeForm = ({ applySearch, orgComboData, searchCriteria,issu - */} + { + console.log(newValue) + const selectedLabels = newValue.map(option => option.type); + const selectedLabelsString = `${selectedLabels.join(',')}`; + console.log(selectedLabelsString) + setSelectedStatus(newValue); + setSelectedLabelsString(selectedLabelsString); + }} + getOptionLabel={(option) => option.label} + renderInput={(params) => ( + + )} />