세금 계산서 및 달력 월 형태 수정
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
import axios from 'axios';
|
||||
import { API_URL_USER } from '@/shared/api/api-url-user';
|
||||
import { resultify } from '@/shared/lib/resultify';
|
||||
import { NiceAxiosError } from '@/shared/@types/error';
|
||||
import {
|
||||
BusinessPropertyByMidParams,
|
||||
BusinessPropertyByMidResponse
|
||||
} from '../model/types';
|
||||
import {
|
||||
useMutation,
|
||||
UseMutationOptions
|
||||
} from '@tanstack/react-query';
|
||||
|
||||
export const businessPropertyByMid = (params: BusinessPropertyByMidParams) => {
|
||||
return resultify(
|
||||
axios.post<BusinessPropertyByMidResponse>(API_URL_USER.businessPropertyByMid(), params),
|
||||
);
|
||||
};
|
||||
|
||||
export const useBusinessPropertyByMidMutation = (options?: UseMutationOptions<BusinessPropertyByMidResponse, NiceAxiosError, BusinessPropertyByMidParams>) => {
|
||||
const mutation = useMutation<BusinessPropertyByMidResponse, NiceAxiosError, BusinessPropertyByMidParams>({
|
||||
...options,
|
||||
mutationFn: (params: BusinessPropertyByMidParams) => businessPropertyByMid(params),
|
||||
});
|
||||
|
||||
return {
|
||||
...mutation,
|
||||
};
|
||||
};
|
||||
@@ -1,12 +1,15 @@
|
||||
import { lens } from '@dhmk/zustand-lens';
|
||||
import { SetStateAction } from 'react';
|
||||
import { UserFavorite, UserInfo } from './types';
|
||||
import { BusinessInfo, UserFavorite, UserInfo } from './types';
|
||||
import { StorageKeys } from '@/shared/constants/local-storage';
|
||||
|
||||
export interface UserInfoState {
|
||||
userInfo: UserInfo;
|
||||
setUserInfo: (update: SetStateAction<Partial<UserInfo>>) => void;
|
||||
resetUserInfo: () => void;
|
||||
businessInfo: BusinessInfo;
|
||||
setBusinessInfo: (update: SetStateAction<Partial<BusinessInfo>>) => void;
|
||||
|
||||
userFavorite: Array<UserFavorite>;
|
||||
setUserFavorite: (update: SetStateAction<Array<UserFavorite>>) => void;
|
||||
userMids: Array<string>;
|
||||
@@ -21,6 +24,7 @@ export interface UserInfoState {
|
||||
|
||||
const initialUserInfoState = {
|
||||
userInfo: {} as UserInfo,
|
||||
businessInfo: {} as BusinessInfo,
|
||||
userFavorite: [] as Array<UserFavorite>,
|
||||
userMids: [] as Array<string>,
|
||||
selectOptionsMids: [] as Array<Record<string, string>>,
|
||||
@@ -43,6 +47,19 @@ export const createUserInfoStore = lens<UserInfoState>((set, get) => ({
|
||||
};
|
||||
});
|
||||
},
|
||||
setBusinessInfo: (update) => {
|
||||
set((state: UserInfoState) => {
|
||||
const newBusinessInfo = (typeof update === 'function')
|
||||
? update(state.businessInfo): update;
|
||||
return {
|
||||
...state,
|
||||
businessInfo: {
|
||||
...state.businessInfo,
|
||||
...newBusinessInfo
|
||||
},
|
||||
};
|
||||
});
|
||||
},
|
||||
resetUserInfo: () => {
|
||||
window.localStorage.removeItem(StorageKeys.TokenType);
|
||||
window.localStorage.removeItem(StorageKeys.AccessToken);
|
||||
|
||||
@@ -259,4 +259,15 @@ export interface ShortcutUserParams {
|
||||
export interface ShortcutUserResponse {
|
||||
shortcuts: Array<Shortcuts>;
|
||||
usingDefault: boolean;
|
||||
};
|
||||
|
||||
export interface BusinessPropertyByMidParams {
|
||||
mid: string;
|
||||
};
|
||||
export interface BusinessPropertyByMidResponse {
|
||||
companyNumber: string;
|
||||
businessScaleTypeName: string;
|
||||
};
|
||||
export interface BusinessInfo extends BusinessPropertyByMidResponse {
|
||||
|
||||
};
|
||||
@@ -26,8 +26,8 @@ export enum VatReturnTargetType {
|
||||
|
||||
export interface VatReturnListParams {
|
||||
mid: string;
|
||||
startDate?: string;
|
||||
endDate?: string;
|
||||
startMonth?: string;
|
||||
endMonth?: string;
|
||||
receiptType?: VatReturnReceiptType;
|
||||
targetType?: VatReturnTargetType;
|
||||
page?: DefaultRequestPagination;
|
||||
|
||||
@@ -13,13 +13,13 @@ export interface ListFilterProps {
|
||||
filterOn: boolean;
|
||||
setFilterOn: (filterOn: boolean) => void;
|
||||
mid: string;
|
||||
startDate: string;
|
||||
endDate: string;
|
||||
startMonth: string;
|
||||
endMonth: string;
|
||||
receiptType: VatReturnReceiptType;
|
||||
targetType: VatReturnTargetType;
|
||||
setMid: (mid: string) => void;
|
||||
setStartDate: (date: string) => void;
|
||||
setEndDate: (date: string) => void;
|
||||
setStartMonth: (startMonth: string) => void;
|
||||
setEndMonth: (endMonth: string) => void;
|
||||
setReceiptType: (receiptType: VatReturnReceiptType) => void;
|
||||
setTargetType: (targetType: VatReturnTargetType) => void;
|
||||
};
|
||||
@@ -28,20 +28,20 @@ export const ListFilter = ({
|
||||
filterOn,
|
||||
setFilterOn,
|
||||
mid,
|
||||
startDate,
|
||||
endDate,
|
||||
startMonth,
|
||||
endMonth,
|
||||
receiptType,
|
||||
targetType,
|
||||
setMid,
|
||||
setStartDate,
|
||||
setEndDate,
|
||||
setStartMonth,
|
||||
setEndMonth,
|
||||
setReceiptType,
|
||||
setTargetType
|
||||
}: ListFilterProps) => {
|
||||
|
||||
const [filterMid, setFilterMid] = useState<string>(mid);
|
||||
const [filterStartDate, setFilterStartDate] = useState<string>(startDate);
|
||||
const [filterEndDate, setFilterEndDate] = useState<string>(endDate);
|
||||
const [filterStartMonth, setFilterStartMonth] = useState<string>(startMonth);
|
||||
const [filterEndMonth, setFilterEndMonth] = useState<string>(endMonth);
|
||||
const [filterReceiptType, setFIlterReceiptType] = useState<VatReturnReceiptType>(receiptType);
|
||||
const [filterTargetType, setFilterTargetType] = useState<VatReturnTargetType>(targetType);
|
||||
|
||||
@@ -53,8 +53,8 @@ export const ListFilter = ({
|
||||
|
||||
const onClickToSetFilter = () => {
|
||||
setMid(filterMid);
|
||||
setStartDate(filterStartDate);
|
||||
setEndDate(filterEndDate);
|
||||
setStartMonth(filterStartMonth);
|
||||
setEndMonth(filterEndMonth);
|
||||
setReceiptType(filterReceiptType);
|
||||
setTargetType(filterTargetType);
|
||||
onClickToClose();
|
||||
@@ -95,10 +95,10 @@ export const ListFilter = ({
|
||||
></FilterSelect>
|
||||
<FilterCalendarMonth
|
||||
title='발행월'
|
||||
startMonth={ filterStartDate }
|
||||
endMonth={ filterEndDate }
|
||||
setStartMonth={ setFilterStartDate }
|
||||
setEndMonth={ setFilterEndDate }
|
||||
startMonth={ filterStartMonth }
|
||||
endMonth={ filterEndMonth }
|
||||
setStartMonth={ setFilterStartMonth }
|
||||
setEndMonth={ setFilterEndMonth }
|
||||
></FilterCalendarMonth>
|
||||
<FilterButtonGroups
|
||||
title='영수구분'
|
||||
|
||||
@@ -16,6 +16,7 @@ import {
|
||||
import { useVatReturnListMutation } from '../api/use-vat-return-list-mutation';
|
||||
import { ListDateGroup } from './list-date-group';
|
||||
import { useStore } from '@/shared/model/store';
|
||||
import { EmailBottomSheet } from '@/entities/common/ui/email-bottom-sheet';
|
||||
|
||||
export const ListWrap = () => {
|
||||
const userMid = useStore.getState().UserStore.mid;
|
||||
@@ -25,11 +26,13 @@ export const ListWrap = () => {
|
||||
const [listItems, setListItems] = useState<Array<VatReturnListContent>>([]);
|
||||
const [pageParam, setPageParam] = useState<DefaultRequestPagination>(DEFAULT_PAGE_PARAM);
|
||||
const [mid, setMid] = useState<string>(userMid);
|
||||
const [startDate, setStartDate] = useState(moment().subtract(1, 'month').format('YYYYMM'));
|
||||
const [endDate, setEndDate] = useState(moment().format('YYYYMM'));
|
||||
const [startMonth, setStartMonth] = useState<string>(moment().subtract(1, 'month').format('YYYYMM'));
|
||||
const [endMonth, setEndMonth] = useState<string>(moment().format('YYYYMM'));
|
||||
const [receiptType, setReceiptType] = useState<VatReturnReceiptType>(VatReturnReceiptType.ALL);
|
||||
const [targetType, setTargetType] = useState<VatReturnTargetType>(VatReturnTargetType.ALL);
|
||||
|
||||
const [emailBottomSheetOn, setEmailBottomSheetOn] = useState<boolean>(false);
|
||||
|
||||
const { mutateAsync: vatReturnList } = useVatReturnListMutation();
|
||||
|
||||
const callList = (option?: {
|
||||
@@ -37,8 +40,8 @@ export const ListWrap = () => {
|
||||
}) => {
|
||||
let params: VatReturnListParams = {
|
||||
mid: mid,
|
||||
startDate: startDate,
|
||||
endDate: endDate,
|
||||
startMonth: startMonth,
|
||||
endMonth: endMonth,
|
||||
receiptType: receiptType,
|
||||
targetType: targetType,
|
||||
page: pageParam
|
||||
@@ -59,10 +62,19 @@ export const ListWrap = () => {
|
||||
const onClickToSort = (sort: SortTypeKeys) => {
|
||||
setSortType(sort);
|
||||
};
|
||||
const onClickToDownloadExcel = () => {
|
||||
setEmailBottomSheetOn(true);
|
||||
};
|
||||
const onRequestDownloadExcel = (userEmail?: string) => {
|
||||
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
callList();
|
||||
}, [mid, startDate, endDate, receiptType, targetType]);
|
||||
}, [
|
||||
mid, startMonth, endMonth,
|
||||
receiptType, targetType
|
||||
]);
|
||||
|
||||
const getListDateGroup = () => {
|
||||
let rs = [];
|
||||
@@ -115,7 +127,7 @@ export const ListWrap = () => {
|
||||
<input
|
||||
type="text"
|
||||
className="credit-period"
|
||||
value={ moment(startDate+'01').format('YYYY.MM') + '-' + moment(endDate+'01').format('YYYY.MM')}
|
||||
value={ moment(startMonth+'01').format('YYYY.MM') + '-' + moment(endMonth+'01').format('YYYY.MM')}
|
||||
readOnly={ true }
|
||||
/>
|
||||
<button
|
||||
@@ -132,6 +144,7 @@ export const ListWrap = () => {
|
||||
<img
|
||||
src={ IMAGE_ROOT + '/ico_download.svg' }
|
||||
alt="다운로드"
|
||||
onClick={ onClickToDownloadExcel }
|
||||
/>
|
||||
</button>
|
||||
</div>
|
||||
@@ -149,16 +162,25 @@ export const ListWrap = () => {
|
||||
filterOn={ filterOn }
|
||||
setFilterOn={ setFilterOn }
|
||||
mid={ mid }
|
||||
startDate={ startDate }
|
||||
endDate={ endDate }
|
||||
startMonth={ startMonth }
|
||||
endMonth={ endMonth }
|
||||
receiptType={ receiptType }
|
||||
targetType={ targetType }
|
||||
setMid={ setMid }
|
||||
setStartDate={ setStartDate }
|
||||
setEndDate={ setEndDate }
|
||||
setStartMonth={ setStartMonth }
|
||||
setEndMonth={ setEndMonth }
|
||||
setReceiptType={ setReceiptType }
|
||||
setTargetType={ setTargetType }
|
||||
></ListFilter>
|
||||
{ !!emailBottomSheetOn &&
|
||||
<EmailBottomSheet
|
||||
bottomSheetOn={ emailBottomSheetOn }
|
||||
setBottomSheetOn={ setEmailBottomSheetOn }
|
||||
imageSave={ false }
|
||||
sendEmail={ true }
|
||||
sendRequest={ onRequestDownloadExcel }
|
||||
></EmailBottomSheet>
|
||||
}
|
||||
</>
|
||||
);
|
||||
};
|
||||
@@ -57,5 +57,10 @@ export const API_URL_USER = {
|
||||
shortcutUser: () => {
|
||||
// 사용자 바로가기 메뉴 조회
|
||||
return `${API_BASE_URL}/api/v1/${API_URL_KEY}/shortcut/user`;
|
||||
}
|
||||
},
|
||||
|
||||
// mid 로 사업자 정보 조회
|
||||
businessPropertyByMid: () => {
|
||||
return `${API_BASE_URL}/api/v1/amsw/business-property/by-mid`;
|
||||
},
|
||||
}
|
||||
@@ -25,10 +25,10 @@ const NiceCalendarMonth = ({
|
||||
calendarType,
|
||||
setNewMonth
|
||||
}: NiceCalendarProps) => {
|
||||
const [valueMonth, setValueMonth] = useState<string>();
|
||||
const [valueYear, setValueYear] = useState<string>();
|
||||
const [minMonth, setMinMonth] = useState<Date | undefined>();
|
||||
const [maxMonth, setMaxMonth] = useState<Date | undefined>();
|
||||
const onchangeToMonth = (selectedMonth: any) => {
|
||||
const onChangeToMonth = (selectedMonth: any) => {
|
||||
setNewMonth(moment(selectedMonth).format('YYYY.MM'));
|
||||
setCalendarOpen(false);
|
||||
};
|
||||
@@ -42,17 +42,17 @@ const NiceCalendarMonth = ({
|
||||
if(!!endMonth){
|
||||
setMaxMonth(new Date(endMonth));
|
||||
}
|
||||
setValueMonth(startMonth);
|
||||
setValueYear(startMonth?.substring(0, 4));
|
||||
}
|
||||
else if(calendarType === CalendarType.End){
|
||||
if(!!startMonth){
|
||||
setMinMonth(new Date(startMonth));
|
||||
}
|
||||
setMaxMonth(new Date());
|
||||
setValueMonth(endMonth);
|
||||
setValueYear(endMonth?.substring(0, 4));
|
||||
}
|
||||
else if(calendarType === CalendarType.Single){
|
||||
setValueMonth(singleMonth);
|
||||
setValueYear(singleMonth?.substring(0,4));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -97,8 +97,8 @@ const NiceCalendarMonth = ({
|
||||
<Calendar
|
||||
minDate={ minMonth }
|
||||
maxDate={ maxMonth }
|
||||
onClickMonth={ onchangeToMonth }
|
||||
value={ valueMonth }
|
||||
onClickMonth={ onChangeToMonth }
|
||||
value={ valueYear }
|
||||
formatMonthYear={ formatMonthYear }
|
||||
formatYear= { formatYear }
|
||||
formatMonth={ formmatMonth }
|
||||
|
||||
@@ -66,10 +66,10 @@ export const FilterCalendarMonth = ({
|
||||
const setNewMonth = (month: string) => {
|
||||
console.log(month)
|
||||
if(calendarType === CalendarType.Start){
|
||||
setStartMonth(month);
|
||||
setStartMonth(moment(month+'.01').format('YYYYMM'));
|
||||
}
|
||||
else if(calendarType === CalendarType.End){
|
||||
setEndMonth(month);
|
||||
setEndMonth(moment(month+'.01').format('YYYYMM'));
|
||||
}
|
||||
setCalendarOpen(false);
|
||||
}
|
||||
|
||||
@@ -18,10 +18,11 @@ import { useStore } from '@/shared/model/store';
|
||||
import { getLocalStorage, setLocalStorage } from '@/shared/lib';
|
||||
import { StorageKeys } from '@/shared/constants/local-storage';
|
||||
import { HomeGroupsParams, HomeGroupsResponse } from '@/entities/home/model/types';
|
||||
import { LoginResponse, ShortcutUserParams, ShortcutUserResponse } from '@/entities/user/model/types';
|
||||
import { BusinessPropertyByMidParams, BusinessPropertyByMidResponse, LoginResponse, ShortcutUserParams, ShortcutUserResponse } from '@/entities/user/model/types';
|
||||
import { useCodesListByCodeClMutation } from '@/entities/common/api/use-codes-list-by-codeCl-mutaion';
|
||||
import { useShortcutUserMutation } from '@/entities/user/api/use-shortcut-user-mutation';
|
||||
import { useShortcutDefaultMutation } from '@/entities/user/api/use-shortcut-detault-mutation';
|
||||
import { useBusinessPropertyByMidMutation } from '@/entities/user/api/use-business-property-by-mid-mutation';
|
||||
|
||||
export interface ContextType {
|
||||
setOnBack: (onBack: () => void) => void;
|
||||
@@ -56,12 +57,14 @@ export const SubLayout = () => {
|
||||
const [favoriteEdit, setFavoriteEdit] = useState<boolean>(false);
|
||||
const [headerNavigationKey, setHeaderNavigationKey] = useState<number>(1);
|
||||
const [loginSuccess, setLoginSuccess] = useState<boolean>(false);
|
||||
|
||||
const [mid, setMid] = useState<string>();
|
||||
|
||||
const { isNativeEnvironment } = useAppBridge();
|
||||
const { mutateAsync: homeGroups } = useHomeGroupsMutation();
|
||||
const { mutateAsync: codesListByCodeCl} = useCodesListByCodeClMutation();
|
||||
const { mutateAsync: shortcutUser } = useShortcutUserMutation();
|
||||
const { mutateAsync: shortcutDefault } = useShortcutDefaultMutation();
|
||||
const { mutateAsync: businessPropertyByMid } = useBusinessPropertyByMidMutation();
|
||||
|
||||
const wrapperClassName = 'wrapper';
|
||||
|
||||
@@ -82,6 +85,7 @@ export const SubLayout = () => {
|
||||
|
||||
if(!!rs.mids[0]){
|
||||
useStore.getState().UserStore.setMid(rs.mids[0]);
|
||||
setMid(rs.mids[0]);
|
||||
}
|
||||
setLoginSuccess(true);
|
||||
setHeaderNavigationKey(headerNavigationKey + 1);
|
||||
@@ -91,10 +95,21 @@ export const SubLayout = () => {
|
||||
codeCl: '0022',
|
||||
code1Filter: filter0022
|
||||
});
|
||||
|
||||
});
|
||||
};
|
||||
|
||||
const callBusinessPropertyByMid = () => {
|
||||
if(!!mid){
|
||||
let params: BusinessPropertyByMidParams = {
|
||||
mid: mid
|
||||
};
|
||||
businessPropertyByMid(params).then((rs: BusinessPropertyByMidResponse) => {
|
||||
console.log(rs);
|
||||
});
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
const callSortcutDefault = () => {
|
||||
console.log("============================callSortcutDefault")
|
||||
let userInfo = useStore.getState().UserStore.userInfo;
|
||||
@@ -196,8 +211,12 @@ export const SubLayout = () => {
|
||||
|
||||
useEffect(() => {
|
||||
handleLogin();
|
||||
|
||||
}, []);
|
||||
useEffect(() => {
|
||||
if(!!mid){
|
||||
// callBusinessPropertyByMid();
|
||||
}
|
||||
}, [mid]);
|
||||
|
||||
return (
|
||||
<div className={ wrapperClassName }>
|
||||
|
||||
Reference in New Issue
Block a user