Browse Source

update

master
MSI\User 1 year ago
parent
commit
827fda4e8d
1 changed files with 34 additions and 6 deletions
  1. +34
    -6
      src/pages/PublicNotice/Search_GLD/SearchForm.js

+ 34
- 6
src/pages/PublicNotice/Search_GLD/SearchForm.js View File

@@ -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
</Grid>

<Grid item xs={9} s={6} md={5} lg={3} sx={{ ml: 3, mr: 3, mb: 3 }}>
<Autocomplete
{/* <Autocomplete
{...register("status")}
disablePortal
id="status"
@@ -183,6 +188,29 @@ const SearchPublicNoticeForm = ({ applySearch, orgComboData, searchCriteria,issu
InputLabelProps={{
shrink: true
}}
/> */}
<Autocomplete
multiple
{...register("status")}
id="status"
options={ComboData.publicNoticeStatic_GLD}
value={selectedStatus}
onChange={(event, newValue) => {
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) => (
<TextField
{...params}
label="Status"
/>
)}
/>
</Grid>



Loading…
Cancel
Save