| @@ -7,7 +7,7 @@ import { | |||||
| } from '@mui/material'; | } from '@mui/material'; | ||||
| import MainCard from "components/MainCard"; | import MainCard from "components/MainCard"; | ||||
| import { useForm } from "react-hook-form"; | import { useForm } from "react-hook-form"; | ||||
| import * as React from "react"; | |||||
| import * as React from "react"; | |||||
| import * as ComboData from "utils/ComboData"; | import * as ComboData from "utils/ComboData"; | ||||
| import * as DateUtils from "utils/DateUtils"; | import * as DateUtils from "utils/DateUtils"; | ||||
| // ==============================|| DASHBOARD - DEFAULT ||============================== // | // ==============================|| DASHBOARD - DEFAULT ||============================== // | ||||
| @@ -17,11 +17,13 @@ const SearchPublicNoticeForm = ({ applySearch, orgComboData, searchCriteria,issu | |||||
| }) => { | }) => { | ||||
| const [type, setType] = React.useState([]); | 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 [orgSelected, setOrgSelected] = React.useState({}); | ||||
| const [orgCombo, setOrgCombo] = React.useState(); | const [orgCombo, setOrgCombo] = React.useState(); | ||||
| const [issueSelected, setIssueSelected] = React.useState({}); | const [issueSelected, setIssueSelected] = React.useState({}); | ||||
| const [issueCombo, setIssueCombo] = 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 [minDate, setMinDate] = React.useState(searchCriteria.dateFrom); | ||||
| const [maxDate, setMaxDate] = React.useState(searchCriteria.dateTo); | const [maxDate, setMaxDate] = React.useState(searchCriteria.dateTo); | ||||
| @@ -29,7 +31,9 @@ const SearchPublicNoticeForm = ({ applySearch, orgComboData, searchCriteria,issu | |||||
| const { reset, register, handleSubmit } = useForm() | const { reset, register, handleSubmit } = useForm() | ||||
| const onSubmit = (data) => { | const onSubmit = (data) => { | ||||
| console.log(selectedLabelsString) | |||||
| data.status = selectedLabelsString | |||||
| console.log(data.status) | |||||
| let typeArray = []; | let typeArray = []; | ||||
| for (let i = 0; i < type.length; i++) { | for (let i = 0; i < type.length; i++) { | ||||
| @@ -41,7 +45,8 @@ const SearchPublicNoticeForm = ({ applySearch, orgComboData, searchCriteria,issu | |||||
| dateFrom: data.dateFrom, | dateFrom: data.dateFrom, | ||||
| dateTo: data.dateTo, | dateTo: data.dateTo, | ||||
| contact: data.contact, | 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 : "", | orgId: (orgSelected?.key && orgSelected?.key > 0) ? orgSelected?.key : "", | ||||
| issueId: issueSelected?.id, | issueId: issueSelected?.id, | ||||
| groupNo: data.groupNo, | groupNo: data.groupNo, | ||||
| @@ -63,7 +68,7 @@ const SearchPublicNoticeForm = ({ applySearch, orgComboData, searchCriteria,issu | |||||
| function resetForm() { | function resetForm() { | ||||
| setType([]); | setType([]); | ||||
| setStatus({ key: 0, label: 'All', type: 'all' }); | |||||
| // setStatus({ key: 0, label: 'All', type: 'all' }); | |||||
| setOrgSelected({}); | setOrgSelected({}); | ||||
| setIssueSelected({}); | setIssueSelected({}); | ||||
| reset(); | reset(); | ||||
| @@ -162,7 +167,7 @@ const SearchPublicNoticeForm = ({ applySearch, orgComboData, searchCriteria,issu | |||||
| </Grid> | </Grid> | ||||
| <Grid item xs={9} s={6} md={5} lg={3} sx={{ ml: 3, mr: 3, mb: 3 }}> | <Grid item xs={9} s={6} md={5} lg={3} sx={{ ml: 3, mr: 3, mb: 3 }}> | ||||
| <Autocomplete | |||||
| {/* <Autocomplete | |||||
| {...register("status")} | {...register("status")} | ||||
| disablePortal | disablePortal | ||||
| id="status" | id="status" | ||||
| @@ -183,6 +188,29 @@ const SearchPublicNoticeForm = ({ applySearch, orgComboData, searchCriteria,issu | |||||
| InputLabelProps={{ | InputLabelProps={{ | ||||
| shrink: true | 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> | </Grid> | ||||