filter mid 수정
This commit is contained in:
@@ -13,7 +13,7 @@ import { useStore } from '@/shared/model/store';
|
||||
|
||||
export const InfoWrap = () => {
|
||||
const { t } = useTranslation();
|
||||
const midOptions = useStore.getState().UserStore.selectOptionsMids;
|
||||
const midOptionsWithoutGids = useStore.getState().UserStore.selectOptionsMidsWithoutGids;
|
||||
const userMid = useStore.getState().UserStore.mid;
|
||||
|
||||
const [mid, setMid] = useState<string>(userMid);
|
||||
@@ -46,7 +46,7 @@ export const InfoWrap = () => {
|
||||
onChange={ (e: ChangeEvent<HTMLSelectElement>) => setMid(e.target.value) }
|
||||
>
|
||||
{
|
||||
midOptions.map((value, index) => (
|
||||
midOptionsWithoutGids.map((value, index) => (
|
||||
<option
|
||||
key={ value.value }
|
||||
value={ value.value }
|
||||
|
||||
@@ -17,7 +17,7 @@ import { useStore } from '@/shared/model/store';
|
||||
|
||||
export const RegistrationStatusWrap = () => {
|
||||
const { t } = useTranslation();
|
||||
const midOptions = useStore.getState().UserStore.selectOptionsMids;
|
||||
const midOptionsWithoutGids = useStore.getState().UserStore.selectOptionsMidsWithoutGids;
|
||||
const userMid = useStore.getState().UserStore.mid;
|
||||
|
||||
const [mid, setMid] = useState<string>(userMid);
|
||||
@@ -55,7 +55,7 @@ export const RegistrationStatusWrap = () => {
|
||||
onChange={ (e: ChangeEvent<HTMLSelectElement>) => setMid(e.target.value) }
|
||||
>
|
||||
{
|
||||
midOptions.map((value, index) => (
|
||||
midOptionsWithoutGids.map((value, index) => (
|
||||
<option
|
||||
key={ value.value }
|
||||
value={ value.value }
|
||||
|
||||
@@ -15,6 +15,7 @@ import { FilterSelect } from '@/shared/ui/filter/select';
|
||||
import { FilterCalendar } from '@/shared/ui/filter/calendar';
|
||||
import { SettlementPaymentMethodOptionsGroup, SettlementPeriodTypeBtnGroup } from '../../model/constant';
|
||||
import { FilterButtonGroups } from '@/shared/ui/filter/button-groups';
|
||||
import { FilterSelectMid } from '@/shared/ui/filter/select-mid';
|
||||
|
||||
export interface ListFilterProps {
|
||||
filterOn: boolean;
|
||||
@@ -98,12 +99,11 @@ export const ListFilter = ({
|
||||
</div>
|
||||
</div>
|
||||
<div className="option-list pt-16">
|
||||
<FilterSelect
|
||||
<FilterSelectMid
|
||||
title='가맹점'
|
||||
selectValue={ filterMid }
|
||||
selectSetter={ setFilterMid }
|
||||
selectOptions={ midOptions }
|
||||
></FilterSelect>
|
||||
selectSetter={ setMid }
|
||||
showType={ 'GID' }
|
||||
></FilterSelectMid>
|
||||
<FilterButtonGroups
|
||||
title='조회기준'
|
||||
activeValue={ filterPeriodType }
|
||||
|
||||
@@ -231,6 +231,7 @@ export interface AllTransactionListSummaryResponse {
|
||||
totalAmount: number;
|
||||
};
|
||||
export interface AllTransactionListParams {
|
||||
mid?: string;
|
||||
moid?: string;
|
||||
tid?: string;
|
||||
fromDate: string;
|
||||
|
||||
@@ -26,6 +26,7 @@ import {
|
||||
FilterMotionVariants
|
||||
} from '@/entities/common/model/constant';
|
||||
import { useStore } from '@/shared/model/store';
|
||||
import { FilterSelectMid } from '@/shared/ui/filter/select-mid';
|
||||
|
||||
export const BillingFilter = ({
|
||||
filterOn,
|
||||
@@ -119,12 +120,11 @@ export const BillingFilter = ({
|
||||
</div>
|
||||
|
||||
<div className="option-list pt-16">
|
||||
<FilterSelect
|
||||
<FilterSelectMid
|
||||
title='가맹점'
|
||||
selectValue={ filterMid }
|
||||
selectSetter={ setFilterMid }
|
||||
selectOptions={ midOptions }
|
||||
></FilterSelect>
|
||||
selectSetter={ setMid }
|
||||
showType={ 'GID' }
|
||||
></FilterSelectMid>
|
||||
<FilterSelectInput
|
||||
title='주문번호/TID'
|
||||
selectValue={ filterSearchType }
|
||||
|
||||
@@ -24,6 +24,7 @@ import {
|
||||
FilterMotionVariants
|
||||
} from '@/entities/common/model/constant';
|
||||
import { useStore } from '@/shared/model/store';
|
||||
import { FilterSelectMid } from '@/shared/ui/filter/select-mid';
|
||||
|
||||
export const EscrowFilter = ({
|
||||
filterOn,
|
||||
@@ -113,12 +114,11 @@ export const EscrowFilter = ({
|
||||
</div>
|
||||
|
||||
<div className="option-list pt-16">
|
||||
<FilterSelect
|
||||
<FilterSelectMid
|
||||
title='가맹점'
|
||||
selectValue={ filterMid }
|
||||
selectSetter={ setMid }
|
||||
selectOptions={ midOptions }
|
||||
></FilterSelect>
|
||||
showType={ 'GID' }
|
||||
></FilterSelectMid>
|
||||
<FilterSelectInput
|
||||
title='주문번호/TID'
|
||||
selectValue={ filterSearchType }
|
||||
|
||||
@@ -460,8 +460,7 @@ export const AmountInfoSection = ({
|
||||
}
|
||||
<div className="txn-doc">
|
||||
{
|
||||
((transactionCategory === TransactionCategory.CashReceipt) ||
|
||||
(transactionCategory === TransactionCategory.Escrow)) &&
|
||||
(transactionCategory === TransactionCategory.CashReceipt) &&
|
||||
!!canDownloadReceipt &&
|
||||
<button
|
||||
className="doc-btn"
|
||||
|
||||
@@ -17,7 +17,9 @@ export interface UserInfoState {
|
||||
setUserMids: (update: SetStateAction<Array<string>>) => void;
|
||||
setUserEmails: (update: SetStateAction<Array<string>>) => void;
|
||||
selectOptionsMids: Array<Record<string, string>>;
|
||||
selectOptionsMidsWithoutGids: Array<Record<string, string>>;
|
||||
setSelectOptionsMids: (update: SetStateAction<Array<Record<string, string>>>) => void;
|
||||
setSelectOptionsMidsWithoutGids: (update: SetStateAction<Array<Record<string, string>>>) => void;
|
||||
selectOptionsEmails: Array<Record<string, string>>;
|
||||
setSelectOptionsEmails: (update: SetStateAction<Array<Record<string, string>>>) => void;
|
||||
mid: string;
|
||||
@@ -35,6 +37,7 @@ const initialUserInfoState = {
|
||||
userMids: [] as Array<string>,
|
||||
userEmails: [] as Array<string>,
|
||||
selectOptionsMids: [] as Array<Record<string, string>>,
|
||||
selectOptionsMidsWithoutGids: [] as Array<Record<string, string>>,
|
||||
selectOptionsEmails: [] as Array<Record<string, string>>,
|
||||
mid: '' as string,
|
||||
email: '' as string,
|
||||
@@ -131,6 +134,18 @@ export const createUserInfoStore = lens<UserInfoState>((set, get) => ({
|
||||
};
|
||||
});
|
||||
},
|
||||
setSelectOptionsMidsWithoutGids: (update) => {
|
||||
set((state: UserInfoState) => {
|
||||
const newSelectOptionsMidsWithoutGids = (typeof update === 'function')
|
||||
? update(state.selectOptionsMidsWithoutGids): update;
|
||||
return {
|
||||
...state,
|
||||
selectOptionsMidsWithoutGids: [
|
||||
...newSelectOptionsMidsWithoutGids
|
||||
],
|
||||
};
|
||||
});
|
||||
},
|
||||
setSelectOptionsEmails: (update) => {
|
||||
set((state: UserInfoState) => {
|
||||
const newSelectOptionsEmails = (typeof update === 'function')
|
||||
|
||||
@@ -12,20 +12,18 @@ export const FilterSelectMid = ({
|
||||
showType = 'GID'
|
||||
}: FilterSelectMidProps) => {
|
||||
const midOptions = useStore.getState().UserStore.selectOptionsMids;
|
||||
const midOptionsWithoutGids = useStore.getState().UserStore.selectOptionsMidsWithoutGids;
|
||||
const userMid = useStore.getState().UserStore.mid;
|
||||
|
||||
const [filterMid, setFilterMid] = useState<string>(userMid);
|
||||
|
||||
const getSelectMidOptions = () => {
|
||||
let rs = [];
|
||||
for(let i=0;i<midOptions.length;i++){
|
||||
let value = midOptions[i]?.value;
|
||||
if(value && showType === 'MID'){
|
||||
let last = value.slice(-1);
|
||||
if(last.toLowerCase() === 'g'){
|
||||
continue;
|
||||
}
|
||||
}
|
||||
let options = midOptions;
|
||||
if(showType === 'MID'){
|
||||
options = midOptionsWithoutGids;
|
||||
}
|
||||
for(let i=0;i<options.length;i++){
|
||||
rs.push(
|
||||
<option
|
||||
key={ `key-filter-select-${i}` }
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import * as _ from 'lodash-es';
|
||||
import {
|
||||
Fragment,
|
||||
useCallback,
|
||||
@@ -88,6 +89,10 @@ export const SubLayout = () => {
|
||||
};
|
||||
homeGroups(params).then((rs: HomeGroupsResponse) => {
|
||||
useStore.getState().UserStore.setUserMids(rs.mids);
|
||||
if(!!rs.mids[0]){
|
||||
useStore.getState().UserStore.setMid(rs.mids[0]);
|
||||
setMid(rs.mids[0]);
|
||||
}
|
||||
let options: Array<Record<string, string>> = rs.mids.map((value, index) => {
|
||||
return {
|
||||
name: value,
|
||||
@@ -95,11 +100,20 @@ export const SubLayout = () => {
|
||||
};
|
||||
});
|
||||
useStore.getState().UserStore.setSelectOptionsMids(options);
|
||||
|
||||
let options2 = _.cloneDeep(options);
|
||||
options2.sort((a: Record<string, any>, b: Record<string, any>) => {
|
||||
if(a.value.toLowerCase() > b.value.toLowerCase()) return 1;
|
||||
else if(a.value.toLowerCase() < b.value.toLowerCase()) return -1;
|
||||
else return 0;
|
||||
});
|
||||
let optionsWithoutGids = options2.filter((value: Record<string, any>, index: number) => {
|
||||
let last = value.value.slice(-1);
|
||||
return last.toLowerCase() !== 'g';
|
||||
});
|
||||
console.log(options)
|
||||
useStore.getState().UserStore.setSelectOptionsMidsWithoutGids(optionsWithoutGids);
|
||||
|
||||
if(!!rs.mids[0]){
|
||||
useStore.getState().UserStore.setMid(rs.mids[0]);
|
||||
setMid(rs.mids[0]);
|
||||
}
|
||||
setLoginSuccess(true);
|
||||
setHeaderNavigationKey(headerNavigationKey + 1);
|
||||
|
||||
@@ -223,14 +237,17 @@ export const SubLayout = () => {
|
||||
const handleLogin = useCallback(async () => {
|
||||
let userParmas;
|
||||
if(!isNativeEnvironment){
|
||||
/*
|
||||
userParmas = {
|
||||
id: 'nictest00',
|
||||
password: 'nictest00'
|
||||
};
|
||||
// userParmas = {
|
||||
// id: 'woowahan5',
|
||||
// password: 'nictest00'
|
||||
// };
|
||||
|
||||
*/
|
||||
userParmas = {
|
||||
id: 'woowahan5',
|
||||
password: 'nictest00'
|
||||
};
|
||||
|
||||
}
|
||||
callLogin(userParmas).then(() => {
|
||||
|
||||
Reference in New Issue
Block a user