From 60a73a73d7ad1cb9cd4e10942b714b813e6a952b Mon Sep 17 00:00:00 2001 From: "cyril.tsui" Date: Fri, 27 Oct 2023 17:42:16 +0800 Subject: [PATCH] Update --- .../PublicNotice/Search_GLD/SearchForm.js | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/src/pages/PublicNotice/Search_GLD/SearchForm.js b/src/pages/PublicNotice/Search_GLD/SearchForm.js index 4d2b812..a2b0165 100644 --- a/src/pages/PublicNotice/Search_GLD/SearchForm.js +++ b/src/pages/PublicNotice/Search_GLD/SearchForm.js @@ -45,8 +45,7 @@ const SearchPublicNoticeForm = ({ applySearch, orgComboData, searchCriteria,issu dateFrom: data.dateFrom, dateTo: data.dateTo, contact: data.contact, - // status: (status?.type && status?.type != 'all') ? status?.type : "", - status: data.status, + status: (data.status === '' || data.status.includes("all")) ? "" : data.status, orgId: (orgSelected?.key && orgSelected?.key > 0) ? orgSelected?.key : "", issueId: issueSelected?.id, groupNo: data.groupNo, @@ -197,12 +196,19 @@ const SearchPublicNoticeForm = ({ applySearch, orgComboData, searchCriteria,issu 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); + const findAllIndex = newValue.findIndex((ele) => { + return ele.type === "all" + }) + + if (findAllIndex > -1) { + setSelectedStatus([newValue[findAllIndex]]); + setSelectedLabelsString('all') + } else { + const selectedLabels = newValue.map(option => option.type); + const selectedLabelsString = `${selectedLabels.join(',')}`; + setSelectedStatus(newValue); + setSelectedLabelsString(selectedLabelsString); + } }} getOptionLabel={(option) => option.label} renderInput={(params) => (