필터 4개 이상 다중 버튼 처리

This commit is contained in:
focp212@naver.com
2025-09-15 14:48:02 +09:00
parent 359aa2921a
commit 5fd52bdd28
7 changed files with 100 additions and 66 deletions

View File

@@ -1,12 +0,0 @@
import { EscrowDeliveryStatus } from '@/entities/transaction/model/types';
export const deliveryStatusBtnGroup = [
{name: '전체', value: EscrowDeliveryStatus.ALL},
{name: '결제완료', value: EscrowDeliveryStatus.PAY_COMPLETE},
{name: '배송등록', value: EscrowDeliveryStatus.DELIVERY_INSERT},
{name: '배송완료', value: EscrowDeliveryStatus.DELIVERY_COMPLETE},
{name: '구매확인', value: EscrowDeliveryStatus.PURCHASE_CONFIRM},
{name: '구매거절', value: EscrowDeliveryStatus.PURCHASE_REJECT},
{name: '환불처리', value: EscrowDeliveryStatus.RETURN_PROCESSING},
{name: '지급완료', value: EscrowDeliveryStatus.DEPOSIT_COMPLETE},
];

View File

@@ -0,0 +1,41 @@
import {
BillingPaymentMethod,
BillingProcessResult,
BillingRequestStatus,
EscrowDeliveryStatus,
EscrowSettlementStatus
} from '@/entities/transaction/model/types';
export const deliveryStatusBtnGroup = [
{name: '전체', value: EscrowDeliveryStatus.ALL},
{name: '결제완료', value: EscrowDeliveryStatus.PAY_COMPLETE},
{name: '배송등록', value: EscrowDeliveryStatus.DELIVERY_INSERT},
{name: '배송완료', value: EscrowDeliveryStatus.DELIVERY_COMPLETE},
{name: '구매확인', value: EscrowDeliveryStatus.PURCHASE_CONFIRM},
{name: '구매거절', value: EscrowDeliveryStatus.PURCHASE_REJECT},
{name: '환불처리', value: EscrowDeliveryStatus.RETURN_PROCESSING},
{name: '지급완료', value: EscrowDeliveryStatus.DEPOSIT_COMPLETE},
];
export let settlementStatusBtnGroup = [
{name: '전체', value: EscrowSettlementStatus.ALL},
{name: '신용카드', value: EscrowSettlementStatus.CREDIT_CARD},
{name: '가상계좌', value: EscrowSettlementStatus.REAL_ACCOUNT},
{name: '계좌이체', value: EscrowSettlementStatus.ACCOUNT_TRANSFER},
];
export const requestStatusBtnGroup = [
{name: '전체', value: BillingRequestStatus.ALL},
{name: '진행중', value: BillingRequestStatus.IN_PROGRESS},
{name: '성공', value: BillingRequestStatus.SUCCESS},
{name: '요청취소', value: BillingRequestStatus.REQUEST_CANCEL},
];
export const processResultBtnGroup = [
{name: '전체', value: BillingProcessResult.ALL},
{name: '성공', value: BillingProcessResult.SUCCESS},
{name: '실패', value: BillingProcessResult.FAILURE},
];
export const paymentMethodBtnGroup = [
{name: '전체', value: BillingPaymentMethod.ALL},
{name: '신용카드', value: BillingPaymentMethod.CREDIT_CARD},
{name: '가상계좌', value: BillingPaymentMethod.VIRTUAL_ACCOUNT},
{name: '휴대폰', value: BillingPaymentMethod.MOBILE_PAYMENT},
];

View File

@@ -481,8 +481,8 @@ export interface EscrowFilterProps extends FilterProps {
endDate: string; endDate: string;
deliveryStatus: EscrowDeliveryStatus; deliveryStatus: EscrowDeliveryStatus;
settlementStatus: EscrowSettlementStatus; settlementStatus: EscrowSettlementStatus;
minAmount: number; minAmount?: number | string;
maxAmount: number; maxAmount?: number | string;
setMid: (mid: string) => void; setMid: (mid: string) => void;
setSearchType: (searchType: EscrowSearchType) => void; setSearchType: (searchType: EscrowSearchType) => void;
setSearchKeyword: (searchKeyword: string) => void; setSearchKeyword: (searchKeyword: string) => void;

View File

@@ -7,6 +7,11 @@ import { FilterSelectInput } from '@/shared/ui/filter/select-input';
import { FilterCalendar } from '@/shared/ui/filter/calendar'; import { FilterCalendar } from '@/shared/ui/filter/calendar';
import { FilterButtonGroups } from '@/shared/ui/filter/button-groups'; import { FilterButtonGroups } from '@/shared/ui/filter/button-groups';
import { FilterRangeAmount } from '@/shared/ui/filter/range-amount'; import { FilterRangeAmount } from '@/shared/ui/filter/range-amount';
import {
requestStatusBtnGroup,
processResultBtnGroup,
paymentMethodBtnGroup
} from '@/entities/transaction/model/contant';
import { import {
BillingFilterProps, BillingFilterProps,
BillingPaymentMethod, BillingPaymentMethod,
@@ -85,24 +90,6 @@ export const BillingFilter = ({
{name: 'TID', value: BillingSearchType.TID } {name: 'TID', value: BillingSearchType.TID }
]; ];
let requestStatusBtnGroup = [
{name: '전체', value: BillingRequestStatus.ALL},
{name: '진행중', value: BillingRequestStatus.IN_PROGRESS},
{name: '성공', value: BillingRequestStatus.SUCCESS},
{name: '요청취소', value: BillingRequestStatus.REQUEST_CANCEL},
];
let processResultBtnGroup = [
{name: '전체', value: BillingProcessResult.ALL},
{name: '성공', value: BillingProcessResult.SUCCESS},
{name: '실패', value: BillingProcessResult.FAILURE},
];
let paymentMethodBtnGroup = [
{name: '전체', value: BillingPaymentMethod.ALL},
{name: '신용카드', value: BillingPaymentMethod.CREDIT_CARD},
{name: '가상계좌', value: BillingPaymentMethod.VIRTUAL_ACCOUNT},
{name: '휴대폰', value: BillingPaymentMethod.MOBILE_PAYMENT},
];
useEffect(() => { useEffect(() => {
setFilterRequestStatus(requestStatus); setFilterRequestStatus(requestStatus);
}, [requestStatus]); }, [requestStatus]);

View File

@@ -7,6 +7,10 @@ import { FilterSelectInput } from '@/shared/ui/filter/select-input';
import { FilterCalendar } from '@/shared/ui/filter/calendar'; import { FilterCalendar } from '@/shared/ui/filter/calendar';
import { FilterButtonGroups } from '@/shared/ui/filter/button-groups'; import { FilterButtonGroups } from '@/shared/ui/filter/button-groups';
import { FilterRangeAmount } from '@/shared/ui/filter/range-amount'; import { FilterRangeAmount } from '@/shared/ui/filter/range-amount';
import {
deliveryStatusBtnGroup,
settlementStatusBtnGroup
} from '@/entities/transaction/model/contant';
import { import {
EscrowFilterProps, EscrowFilterProps,
EscrowSearchType, EscrowSearchType,
@@ -80,23 +84,6 @@ export const EscrowFilter = ({
{name: 'TID', value: EscrowSearchType.TID } {name: 'TID', value: EscrowSearchType.TID }
]; ];
let deliveryStatusBtnGroup = [
{name: '전체', value: EscrowDeliveryStatus.ALL},
{name: '결제완료', value: EscrowDeliveryStatus.PAY_COMPLETE},
{name: '배송등록', value: EscrowDeliveryStatus.DELIVERY_INSERT},
{name: '배송완료', value: EscrowDeliveryStatus.DELIVERY_COMPLETE},
{name: '구매확인', value: EscrowDeliveryStatus.PURCHASE_CONFIRM},
{name: '구매거절', value: EscrowDeliveryStatus.PURCHASE_REJECT},
{name: '환불처리', value: EscrowDeliveryStatus.RETURN_PROCESSING},
{name: '지급완료', value: EscrowDeliveryStatus.DEPOSIT_COMPLETE},
];
let settlementStatusBtnGroup = [
{name: '전체', value: EscrowSettlementStatus.ALL},
{name: '신용카드', value: EscrowSettlementStatus.CREDIT_CARD},
{name: '가상계좌', value: EscrowSettlementStatus.REAL_ACCOUNT},
{name: '계좌이체', value: EscrowSettlementStatus.ACCOUNT_TRANSFER},
];
useEffect(() => { useEffect(() => {
setFilterDeliveryStatus(deliveryStatus); setFilterDeliveryStatus(deliveryStatus);
}, [deliveryStatus]); }, [deliveryStatus]);

View File

@@ -9,8 +9,8 @@ import { EscrowListItem, TransactionCategory, SortByKeys, EscrowDeliveryStatus,
import { useEscrowListMutation } from '@/entities/transaction/api/use-escrow-list-mutation'; import { useEscrowListMutation } from '@/entities/transaction/api/use-escrow-list-mutation';
import { useDownloadExcelMutation } from '@/entities/transaction/api/use-download-excel-mutation'; import { useDownloadExcelMutation } from '@/entities/transaction/api/use-download-excel-mutation';
import { DEFAULT_PAGE_PARAM } from '@/entities/common/model/constants'; import { DEFAULT_PAGE_PARAM } from '@/entities/common/model/constants';
import { Filter } from '@/entities/transaction/ui/filter'; import { EscrowFilter } from '@/entities/transaction/ui/filter/escrow-filter';
import { deliveryStatusBtnGroup } from '@/entities/additional-service/model/contant'; import { deliveryStatusBtnGroup } from '@/entities/transaction/model/contant';
import { SortOptionsBox } from '@/entities/transaction/ui/sort-options-box'; import { SortOptionsBox } from '@/entities/transaction/ui/sort-options-box';
import { HeaderType } from '@/entities/common/model/types'; import { HeaderType } from '@/entities/common/model/types';
import { import {
@@ -65,7 +65,7 @@ export const EscrowListPage = () => {
} }
let listParams = { let listParams = {
mid: mid, mid: mid,
searchType: searchType, searchType: 'ORDER_NUMBER',
searchKeyword: searchKeyword, searchKeyword: searchKeyword,
startDate: startDate, startDate: startDate,
endDate: endDate, endDate: endDate,
@@ -180,10 +180,28 @@ export const EscrowListPage = () => {
</div> </div>
</div> </div>
</main> </main>
<Filter <EscrowFilter
filterOn={ filterOn } filterOn={ filterOn }
setFilterOn={ setFilterOn } setFilterOn={ setFilterOn }
></Filter> mid={ mid }
searchType={ searchType }
searchKeyword={searchKeyword }
startDate={ startDate }
endDate={ endDate }
deliveryStatus={ deliveryStatus }
settlementStatus={ settlementStatus }
minAmount={ minAmount }
maxAmount={ maxAmount }
setMid={ setMid }
setSearchType={ setSearchType }
setSearchKeyword={ setSearchKeyword }
setStartDate={ setStartDate }
setEndDate={ setEndDate }
setDeliveryStatus={ setDeliveryStatus }
setSettlementStatus={ setSettlementStatus }
setMinAmount={ setMinAmount }
setMaxAmount={ setMaxAmount }
></EscrowFilter>
</> </>
); );
}; };

View File

@@ -9,19 +9,30 @@ export const FilterButtonGroups = ({
const getBtns = () => { const getBtns = () => {
let rs = []; let rs = [];
if(!!btnGroups && btnGroups.length > 0){ if(!!btnGroups && btnGroups.length > 0){
let emptySpanCnt = 4 % btnGroups.length; console.log(' btnGroups.length : ', btnGroups.length)
let emptySpanCnt = 4 - (btnGroups.length % 4);
let innerList = [];
for(let i=0;i<btnGroups.length;i++){ for(let i=0;i<btnGroups.length;i++){
rs.push( innerList.push(
<span <span
key={ `key-btngroup-span-${i}` } key={ `key-btngroup-span-${i}` }
className={ `keyword-tag flex-1 ${(activeValue === btnGroups[i]?.value)? 'active': ''}` } className={ `keyword-tag flex-1 ${(activeValue === btnGroups[i]?.value)? 'active': ''}` }
onClick={ () => setter(btnGroups[i]?.value || '') } onClick={ () => setter(btnGroups[i]?.value || '') }
>{ btnGroups[i]?.name }</span> >{ btnGroups[i]?.name }</span>
) );
} if((i % 4) === 3 ){
for(let i=0;i<emptySpanCnt;i++){
rs.push( rs.push(
<div className="chip-row">{ innerList }</div>
);
innerList = [];
}
}
if(emptySpanCnt > 0 && emptySpanCnt < 4){
for(let i=0;i<emptySpanCnt;i++){
innerList.push(
<span <span
key={ `key-btngroup-span-nodata-${i}` } key={ `key-btngroup-span-nodata-${i}` }
className="keyword-tag flex-1" className="keyword-tag flex-1"
@@ -29,6 +40,10 @@ export const FilterButtonGroups = ({
></span> ></span>
); );
} }
rs.push(
<div className="chip-row">{ innerList }</div>
);
}
} }
return rs; return rs;
}; };
@@ -37,11 +52,9 @@ export const FilterButtonGroups = ({
<div className="opt-field"> <div className="opt-field">
<div className="opt-label">{ title }</div> <div className="opt-label">{ title }</div>
<div className="opt-controls col below h36"> <div className="opt-controls col below h36">
<div className="chip-row">
{ getBtns() } { getBtns() }
</div> </div>
</div> </div>
</div>
</> </>
); );
}; };