diff --git a/src/pages/additional-service/alimtalk/list-page.tsx b/src/pages/additional-service/alimtalk/list-page.tsx index 00a6f23..880e3fd 100644 --- a/src/pages/additional-service/alimtalk/list-page.tsx +++ b/src/pages/additional-service/alimtalk/list-page.tsx @@ -38,6 +38,16 @@ import { checkGrant } from '@/shared/lib/check-grant'; import { showAlert } from '@/widgets/show-alert'; import { useStore } from '@/shared/model/store'; +const defaultParams = { + searchCl: AlimtalkSearchCl.BUYER_NAME, + searchValue: '', + serviceCode: ServiceCode.ALL, + alimCl: AlimtalkAlimCl.DEPOSIT_REQUEST, + fromDate: moment().format('YYYYMMDD'), + toDate: moment().format('YYYYMMDD'), + sendType: AlimtalkSendType.ALL, + sendCl: AlimTalkSendCl.ALL +}; export const AlimtalkListPage = () => { const { t } = useTranslation(); const { navigate } = useNavigate(); @@ -53,14 +63,14 @@ export const AlimtalkListPage = () => { const [filterOn, setFilterOn] = useState(false); const [pageParam, setPageParam] = useState(DEFAULT_PAGE_PARAM); const [mid, setMid] = useState(userMid); - const [searchCl, setSearchCl] = useState(AlimtalkSearchCl.BUYER_NAME); - const [searchValue, setSearchValue] = useState(''); - const [serviceCode, setServiceCode] = useState(ServiceCode.ALL); - const [alimCl, setAlimCl] = useState(AlimtalkAlimCl.DEPOSIT_REQUEST); - const [fromDate, setFromDate] = useState(moment().format('YYYYMMDD')); - const [toDate, setToDate] = useState(moment().format('YYYYMMDD')); - const [sendType, setSendType] = useState(AlimtalkSendType.ALL); - const [sendCl, setSendCl] = useState(AlimTalkSendCl.ALL); + const [searchCl, setSearchCl] = useState(defaultParams.searchCl); + const [searchValue, setSearchValue] = useState(defaultParams.searchValue); + const [serviceCode, setServiceCode] = useState(defaultParams.serviceCode); + const [alimCl, setAlimCl] = useState(defaultParams.alimCl); + const [fromDate, setFromDate] = useState(defaultParams.fromDate); + const [toDate, setToDate] = useState(defaultParams.toDate); + const [sendType, setSendType] = useState(defaultParams.sendType); + const [sendCl, setSendCl] = useState(defaultParams.sendCl); const [downloadBottomSheetOn, setDownloadBottomSheetOn] = useState(false); @@ -73,6 +83,7 @@ export const AlimtalkListPage = () => { const [groupDateOn, setGroupDateOn] = useState(false); const [listHeight, setListHeight] = useState(0); + const [filterUsed, setFilterUsed] = useState(false); const { mutateAsync: extensionAlimtalkList } = useExtensionAlimtalkListMutation(); const { mutateAsync: extensionAlimtalkDownloadExcel } = useExtensionAlimtalkDownloadExcelMutation(); @@ -268,8 +279,34 @@ export const AlimtalkListPage = () => { return rs; } + const checkUsedFilter = () => { + let rs: boolean = true; + console.log(`searchCl [${searchCl}] [${defaultParams.searchCl}]`); + console.log(`searchValue [${searchValue}] [${defaultParams.searchValue}]`); + console.log(`serviceCode [${serviceCode}] [${defaultParams.serviceCode}]`); + console.log(`alimCl [${alimCl}] [${defaultParams.alimCl}]`); + console.log(`fromDate [${fromDate}] [${defaultParams.fromDate}]`); + console.log(`toDate [${toDate}] [${defaultParams.toDate}]`); + console.log(`sendType [${sendType}] [${defaultParams.sendType}]`); + console.log(`sendCl [${sendCl}] [${defaultParams.sendCl}]`); + + if(searchCl === defaultParams.searchCl + && searchValue === defaultParams.searchValue + && serviceCode === defaultParams.serviceCode + && alimCl === defaultParams.alimCl + && fromDate === defaultParams.fromDate + && toDate === defaultParams.toDate + && sendType === defaultParams.sendType + && sendCl === defaultParams.sendCl + ){ + rs = false; + } + setFilterUsed(rs); + }; + useEffect(() => { callList(); + checkUsedFilter(); }, [ mid, searchCl, @@ -300,9 +337,11 @@ export const AlimtalkListPage = () => { }; }, []); + /* if (!hasAccess) { return ; } + */ return ( <> @@ -327,6 +366,9 @@ export const AlimtalkListPage = () => { src={IMAGE_ROOT + '/ico_setting.svg'} alt="검색옵션" /> + { filterUsed && + + }