세금 계산서 및 달력 월 형태 수정

This commit is contained in:
focp212@naver.com
2025-10-23 11:07:56 +09:00
parent 06c47f8174
commit 74ed1ff1ad
10 changed files with 146 additions and 43 deletions

View File

@@ -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,
};
};

View File

@@ -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);

View File

@@ -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 {
};

View File

@@ -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;

View File

@@ -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='영수구분'

View File

@@ -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>
}
</>
);
};