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