test
This commit is contained in:
@@ -2,29 +2,22 @@ import axios from 'axios';
|
||||
import { API_URL } from '@/shared/api/urls';
|
||||
import { resultify } from '@/shared/lib/resultify';
|
||||
import { CBDCAxiosError } from '@/shared/@types/error';
|
||||
import {
|
||||
CodesListByCodeClParams,
|
||||
CodesListByCodeClResponse
|
||||
} from '../model/types';
|
||||
import { CodesListByCodeClParams } from '../model/types';
|
||||
import {
|
||||
useMutation,
|
||||
UseMutationOptions
|
||||
} from '@tanstack/react-query';
|
||||
|
||||
export const codesListByCodeCl = ({ codeCl }: CodesListByCodeClParams) => {
|
||||
export const codesListByCodeCl = (params: CodesListByCodeClParams) => {
|
||||
return resultify(
|
||||
axios.get<CodesListByCodeClResponse>(API_URL.codesListByCodeCl(codeCl)),
|
||||
axios.get<Array<any>>(API_URL.codesListByCodeCl(params.codeCl)),
|
||||
);
|
||||
};
|
||||
|
||||
export const useCodesListByCodeClMutation = (options?: UseMutationOptions<CodesListByCodeClResponse, CBDCAxiosError, CodesListByCodeClParams>) => {
|
||||
const mutation = useMutation<CodesListByCodeClResponse, CBDCAxiosError, CodesListByCodeClParams>({
|
||||
export const useCodesListByCodeClMutation = (options?: UseMutationOptions<Array<any>, CBDCAxiosError, CodesListByCodeClParams>) => {
|
||||
const mutation = useMutation<Array<any>, CBDCAxiosError, CodesListByCodeClParams>({
|
||||
...options,
|
||||
mutationFn: ({
|
||||
codeCl
|
||||
}: CodesListByCodeClParams) => codesListByCodeCl({
|
||||
codeCl
|
||||
}),
|
||||
mutationFn: (params: CodesListByCodeClParams) => codesListByCodeCl(params),
|
||||
});
|
||||
|
||||
return {
|
||||
|
||||
@@ -129,9 +129,7 @@ export interface CodesSelectPostResponse {
|
||||
export interface CodesListByCodeClParams {
|
||||
codeCl: string;
|
||||
};
|
||||
export interface CodesListByCodeClResponse {
|
||||
codeList: Array<CodeListItem>;
|
||||
};
|
||||
|
||||
export interface CodesGroupByCodeClParams {
|
||||
codeCl: string;
|
||||
};
|
||||
|
||||
@@ -2,7 +2,7 @@ import {
|
||||
AllTransactionMoidTid,
|
||||
AllTransactionSearchCl,
|
||||
AllTransactionServiceCode,
|
||||
AllTransactionStateCode,
|
||||
AllTransactionStatusCode,
|
||||
BillingPaymentMethod,
|
||||
BillingProcessResult,
|
||||
BillingRequestStatus,
|
||||
@@ -20,11 +20,11 @@ export const AllTransactionMoidTidOptionsGroup = [
|
||||
{name: 'TID', value: AllTransactionMoidTid.TID},
|
||||
];
|
||||
|
||||
export const AllTransactionStateCodeBtnGroup = [
|
||||
{name: '전체', value: AllTransactionStateCode.ALL},
|
||||
{name: '승인/입금완료', value: AllTransactionStateCode.APPROVAL},
|
||||
{name: '전취소/취소', value: AllTransactionStateCode.CANCEL},
|
||||
{name: '후취소/환불', value: AllTransactionStateCode.REFUND}
|
||||
export const AllTransactionStatusCodeBtnGroup = [
|
||||
{name: '전체', value: AllTransactionStatusCode.ALL},
|
||||
{name: '승인/입금완료', value: AllTransactionStatusCode.APPROVAL},
|
||||
{name: '전취소/취소', value: AllTransactionStatusCode.CANCEL},
|
||||
{name: '후취소/환불', value: AllTransactionStatusCode.REFUND}
|
||||
];
|
||||
export const AllTransactionServiceCodeOptionsGroup = [
|
||||
{name: '전체', value: AllTransactionServiceCode.ALL},
|
||||
@@ -43,6 +43,8 @@ export const AllTransactionCardBankCodeOptionsGroup = {
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
export const CashReceiptPurposeTypeBtnGroup = [
|
||||
{name: '전체', value: CashReceiptPurposeType.ALL},
|
||||
{name: '소득공제', value: CashReceiptPurposeType.INCOME_DEDUCTION},
|
||||
|
||||
@@ -30,7 +30,7 @@ export enum AllTransactionMoidTid {
|
||||
MOID = 'MOID',
|
||||
TID = 'TID'
|
||||
};
|
||||
export enum AllTransactionStateCode {
|
||||
export enum AllTransactionStatusCode {
|
||||
ALL = '0',
|
||||
APPROVAL = '1',
|
||||
CANCEL = '2',
|
||||
@@ -136,7 +136,7 @@ export interface ListDateGroupProps {
|
||||
};
|
||||
export interface AllTransactionListProps {
|
||||
transactionCategory: TransactionCategory;
|
||||
listItems: Record<string, Array<ListItemProps>>
|
||||
listItems: Array<any>;
|
||||
};
|
||||
export interface CashReceiptListProps {
|
||||
transactionCategory: TransactionCategory;
|
||||
@@ -227,7 +227,7 @@ export interface AllTransactionListParams {
|
||||
tid?: string;
|
||||
fromDate: string;
|
||||
toDate: string;
|
||||
stateCode?: string;
|
||||
statusCode?: string;
|
||||
serviceCode?: string;
|
||||
minAmount?: number;
|
||||
maxAmount?: number;
|
||||
@@ -508,8 +508,8 @@ export interface AllTransactionFilterProps extends FilterProps {
|
||||
mid: string;
|
||||
fromDate: string;
|
||||
toDate: string;
|
||||
stateCode: AllTransactionStateCode;
|
||||
serviceCode: AllTransactionServiceCode;
|
||||
statusCode: string;
|
||||
serviceCode: string;
|
||||
minAmount?: number;
|
||||
maxAmount?: number;
|
||||
cardCode?: string;
|
||||
@@ -521,15 +521,15 @@ export interface AllTransactionFilterProps extends FilterProps {
|
||||
setTid: (tid: string) => void;
|
||||
setFromDate: (fromDate: string) => void;
|
||||
setToDate: (endDate: string) => void;
|
||||
setStateCode: (stateCode: AllTransactionStateCode) => void;
|
||||
setServiceCode: (serviceCode: AllTransactionServiceCode) => void;
|
||||
setStatusCode: (statusCode: string) => void;
|
||||
setServiceCode: (serviceCode: string) => void;
|
||||
setMinAmount: (minAmount?: number) => void;
|
||||
setMaxAmount: (maxAmount?: number) => void;
|
||||
setCardCode: (cardCode: string | undefined) => void;
|
||||
setBankCode: (bankCode: string | undefined) => void;
|
||||
setSearchCl: (searchCl: AllTransactionSearchCl | undefined) => void;
|
||||
setSearchValue: (searchValue: string | undefined) => void;
|
||||
|
||||
serviceCodeOptions?: Array<Record<string, any>>;
|
||||
};
|
||||
export interface CashReceiptFilterProps extends FilterProps {
|
||||
mid : string;
|
||||
|
||||
@@ -8,15 +8,26 @@ export const AllTransactionList = ({
|
||||
|
||||
const getListDateGroup = () => {
|
||||
let rs = [];
|
||||
for (const [key, value] of Object.entries(listItems)) {
|
||||
rs.push(
|
||||
<ListDateGroup
|
||||
transactionCategory={ transactionCategory }
|
||||
key={ key }
|
||||
date={ key }
|
||||
items={ value }
|
||||
></ListDateGroup>
|
||||
);
|
||||
let date = '';
|
||||
let list = [];
|
||||
for(let i=0;i<listItems.length;i++){
|
||||
let transactionDateTime = listItems[i].transactionDateTime;
|
||||
let transactionDate = transactionDateTime.substr(0, 8);
|
||||
if(date !== transactionDate){
|
||||
date = transactionDate;
|
||||
if(list.length > 0){
|
||||
rs.push(
|
||||
<ListDateGroup
|
||||
transactionCategory={ transactionCategory }
|
||||
key={ date }
|
||||
date={ date }
|
||||
items={ list }
|
||||
></ListDateGroup>
|
||||
)
|
||||
}
|
||||
list = [];
|
||||
}
|
||||
list.push(listItems[i]);
|
||||
}
|
||||
return rs;
|
||||
};
|
||||
|
||||
@@ -9,14 +9,14 @@ import { FilterButtonGroups } from '@/shared/ui/filter/button-groups';
|
||||
import { FilterRangeAmount } from '@/shared/ui/filter/range-amount';
|
||||
import {
|
||||
AllTransactionMoidTidOptionsGroup,
|
||||
AllTransactionStateCodeBtnGroup,
|
||||
AllTransactionStatusCodeBtnGroup,
|
||||
AllTransactionServiceCodeOptionsGroup,
|
||||
AllTransactionCardBankCodeOptionsGroup,
|
||||
} from '@/entities/transaction/model/contant';
|
||||
import {
|
||||
AllTransactionFilterProps,
|
||||
AllTransactionSearchCl,
|
||||
AllTransactionStateCode,
|
||||
AllTransactionStatusCode,
|
||||
AllTransactionServiceCode,
|
||||
AllTransactionMoidTid
|
||||
} from '../../model/types';
|
||||
@@ -33,7 +33,7 @@ export const AllTransactionFilter = ({
|
||||
mid,
|
||||
fromDate,
|
||||
toDate,
|
||||
stateCode,
|
||||
statusCode,
|
||||
serviceCode,
|
||||
minAmount,
|
||||
maxAmount,
|
||||
@@ -46,7 +46,7 @@ export const AllTransactionFilter = ({
|
||||
setTid,
|
||||
setFromDate,
|
||||
setToDate,
|
||||
setStateCode,
|
||||
setStatusCode,
|
||||
setServiceCode,
|
||||
setMinAmount,
|
||||
setMaxAmount,
|
||||
@@ -54,6 +54,7 @@ export const AllTransactionFilter = ({
|
||||
setBankCode,
|
||||
setSearchCl,
|
||||
setSearchValue,
|
||||
serviceCodeOptions
|
||||
}: AllTransactionFilterProps) => {
|
||||
|
||||
const [filterMid, setFilterMid] = useState<string>(mid);
|
||||
@@ -61,8 +62,8 @@ export const AllTransactionFilter = ({
|
||||
const [filterMoidTidValue, setFilterMoidTidValue] = useState<string>('');
|
||||
const [filterFromDate, setFilterFromDate] = useState<string>(fromDate);
|
||||
const [filterToDate, setFilterToDate] = useState<string>(toDate);
|
||||
const [filterStateCode, setFilterStateCode] = useState<AllTransactionStateCode>(stateCode);
|
||||
const [filterServiceCode, setFilterServiceCode] = useState<AllTransactionServiceCode>(serviceCode);
|
||||
const [filterStatusCode, setFilterStatusCode] = useState<string>(statusCode);
|
||||
const [filterServiceCode, setFilterServiceCode] = useState<string>(serviceCode);
|
||||
const [filterMinAmount, setFilterMinAmount] = useState<number | undefined>(minAmount);
|
||||
const [filterMaxAmount, setFilterMaxAmount] = useState<number | undefined>(maxAmount);
|
||||
|
||||
@@ -78,6 +79,8 @@ export const AllTransactionFilter = ({
|
||||
|
||||
const midOptions = useStore.getState().UserStore.selectOptionsMids;
|
||||
|
||||
console.log(serviceCodeOptions)
|
||||
|
||||
const onClickToClose = () => {
|
||||
setFilterOn(false);
|
||||
};
|
||||
@@ -98,7 +101,7 @@ export const AllTransactionFilter = ({
|
||||
}
|
||||
setFromDate(filterFromDate);
|
||||
setToDate(filterToDate);
|
||||
setStateCode(filterStateCode);
|
||||
setStatusCode(filterStatusCode);
|
||||
|
||||
setServiceCode(filterServiceCode);
|
||||
setMinAmount(filterMinAmount);
|
||||
@@ -110,9 +113,11 @@ export const AllTransactionFilter = ({
|
||||
onClickToClose();
|
||||
};
|
||||
|
||||
let setSearchClOptions = (value: AllTransactionServiceCode) => {
|
||||
let setSearchClOptions = (value: string) => {
|
||||
let options = [];
|
||||
setFilterServiceCode(value);
|
||||
|
||||
/*
|
||||
if(value === AllTransactionServiceCode.ALL){
|
||||
|
||||
}
|
||||
@@ -146,6 +151,7 @@ export const AllTransactionFilter = ({
|
||||
options.push({name: '티머니번호', value: AllTransactionSearchCl.TMONEY_CARD_NO});
|
||||
}
|
||||
setSearchClOptionsGroup(options);
|
||||
*/
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -206,16 +212,19 @@ export const AllTransactionFilter = ({
|
||||
|
||||
<FilterButtonGroups
|
||||
title='거래상태'
|
||||
activeValue={ filterStateCode }
|
||||
btnGroups={ AllTransactionStateCodeBtnGroup }
|
||||
setter={ setFilterStateCode }
|
||||
activeValue={ filterStatusCode }
|
||||
btnGroups={ AllTransactionStatusCodeBtnGroup }
|
||||
setter={ setFilterStatusCode }
|
||||
></FilterButtonGroups>
|
||||
|
||||
{ serviceCodeOptions &&
|
||||
<FilterSelect
|
||||
title='결제수단'
|
||||
selectValue={ filterServiceCode }
|
||||
selectSetter={ setSearchClOptions }
|
||||
selectOptions={ AllTransactionServiceCodeOptionsGroup }
|
||||
selectOptions={ serviceCodeOptions }
|
||||
></FilterSelect>
|
||||
}
|
||||
|
||||
<FilterRangeAmount
|
||||
title='거래금액'
|
||||
|
||||
Reference in New Issue
Block a user