알림 수정
This commit is contained in:
@@ -5,6 +5,7 @@ import moment from 'moment';
|
||||
import { useAppAlarmMarkMutation } from '../api/use-app-alarm-mark-mutation';
|
||||
import { AppAlarmMarkParams, AppAlarmMarkResponse } from '../model/types';
|
||||
import { useStore } from '@/shared/model/store';
|
||||
import { useEffect, useState } from 'react';
|
||||
|
||||
export interface AlarmItemProps {
|
||||
appNotificationSequence?: number;
|
||||
@@ -13,6 +14,7 @@ export interface AlarmItemProps {
|
||||
appNotificationTitle?: string;
|
||||
appNotificationContent?: string;
|
||||
appNotificationLink?: string;
|
||||
appNotificationCategories: Array<any>;
|
||||
};
|
||||
|
||||
export const AlarmItem = ({
|
||||
@@ -21,13 +23,22 @@ export const AlarmItem = ({
|
||||
notificationReceivedDate,
|
||||
appNotificationTitle,
|
||||
appNotificationContent,
|
||||
appNotificationLink
|
||||
appNotificationLink,
|
||||
appNotificationCategories
|
||||
}: AlarmItemProps) => {
|
||||
const { navigate } = useNavigate();
|
||||
|
||||
let userInfo = useStore.getState().UserStore.userInfo;
|
||||
const {mutateAsync: appAlarmMark} = useAppAlarmMarkMutation();
|
||||
|
||||
const [appNotificationCategoryName, setAppNotificationCategoryName] = useState<string>('');
|
||||
|
||||
const getCategoryName = () => {
|
||||
let myCategory = appNotificationCategories.filter((value, index) => {
|
||||
return value.code1 === appNotificationCategory;
|
||||
});
|
||||
return myCategory[0].desc1;
|
||||
};
|
||||
const onClickToNavigate = () => {
|
||||
let path = PATHS.support.notice.detail + appNotificationSequence;
|
||||
let pathState = {};
|
||||
@@ -39,21 +50,27 @@ export const AlarmItem = ({
|
||||
console.log('appNotificationContent : [' + appNotificationContent + ']');
|
||||
console.log('appNotificationLink : [' + appNotificationLink + ']');
|
||||
|
||||
if(appNotificationCategory === '10'){
|
||||
if(appNotificationLink){
|
||||
path = appNotificationLink;
|
||||
/*
|
||||
if(appNotificationCategory === '10'){
|
||||
|
||||
}
|
||||
else if(appNotificationCategory === '20'){
|
||||
}
|
||||
else if(appNotificationCategory === '20'){
|
||||
|
||||
}
|
||||
else if(appNotificationCategory === '30'){
|
||||
}
|
||||
else if(appNotificationCategory === '30'){
|
||||
|
||||
}
|
||||
else if(appNotificationCategory === '40'){
|
||||
}
|
||||
else if(appNotificationCategory === '40'){
|
||||
|
||||
}
|
||||
else if(appNotificationCategory === '60'){
|
||||
}
|
||||
else if(appNotificationCategory === '60'){
|
||||
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
navigate(path, {
|
||||
state: pathState
|
||||
});
|
||||
@@ -73,22 +90,26 @@ export const AlarmItem = ({
|
||||
}
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
setAppNotificationCategoryName(getCategoryName());
|
||||
}, [appNotificationCategory]);
|
||||
|
||||
return (
|
||||
<div className="notice-item">
|
||||
<div
|
||||
className="notice-item"
|
||||
onClick={ () => callAppAlarmMark() }
|
||||
>
|
||||
<div className="notice-content">
|
||||
<div className="notice-title">{ appNotificationTitle }</div>
|
||||
<div className="notice-meta">
|
||||
<strong>{ appNotificationCategory }</strong>
|
||||
<strong>{ appNotificationCategoryName }</strong>
|
||||
<span>{ moment(notificationReceivedDate).format('YYYY.MM.DD HH:mm:ss') }</span>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
className="notice-arrow"
|
||||
onClick={ () => callAppAlarmMark() }
|
||||
>
|
||||
<div className="notice-arrow">
|
||||
<img
|
||||
src={ IMAGE_ROOT + '/Forward.svg' }
|
||||
alt={ appNotificationCategory + ' 바로가기' }
|
||||
alt={ appNotificationCategoryName + ' 바로가기' }
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -12,10 +12,12 @@ import { DefaultRequestPagination } from '@/entities/common/model/types';
|
||||
|
||||
export interface AlarmListProps {
|
||||
appNotificationCategory: string;
|
||||
appNotificationCategories: Array<any>;
|
||||
};
|
||||
|
||||
export const AlarmList = ({
|
||||
appNotificationCategory
|
||||
appNotificationCategory,
|
||||
appNotificationCategories
|
||||
}: AlarmListProps) => {
|
||||
const { navigate } = useNavigate();
|
||||
const { t } = useTranslation();
|
||||
@@ -108,6 +110,7 @@ export const AlarmList = ({
|
||||
appNotificationTitle={ resultList[i]?.appNotificationTitle }
|
||||
appNotificationContent={ resultList[i]?.appNotificationContent }
|
||||
appNotificationLink={ resultList[i]?.appNotificationLink }
|
||||
appNotificationCategories={ appNotificationCategories }
|
||||
></AlarmItem>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -481,7 +481,7 @@ export interface BillingInfo {
|
||||
};
|
||||
|
||||
export interface MerchantInfo {
|
||||
shopName?: string;
|
||||
companyName?: string;
|
||||
gid?: string;
|
||||
aid?: string;
|
||||
}
|
||||
|
||||
@@ -231,7 +231,7 @@ export const ListItem = ({
|
||||
</div>
|
||||
<div className="transaction-amount">
|
||||
<NumericFormat
|
||||
value={ goodsAmount || amount }
|
||||
value={ goodsAmount || amount || transactionAmount }
|
||||
thousandSeparator
|
||||
displayType="text"
|
||||
suffix={ '원' }
|
||||
|
||||
@@ -29,7 +29,7 @@ export const MerchantInfoSection = ({
|
||||
<ul className="kv-list">
|
||||
<li className="kv-row">
|
||||
<span className="k">· 상호</span>
|
||||
<span className="v">{ merchantInfo?.shopName }</span>
|
||||
<span className="v">{ merchantInfo?.companyName }</span>
|
||||
</li>
|
||||
<li className="kv-row">
|
||||
<span className="k">· GID</span>
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
import axios from 'axios';
|
||||
import { API_URL_VAT_RETURN } from '@/shared/api/api-url-vat-return';
|
||||
import { resultify } from '@/shared/lib/resultify';
|
||||
import { NiceAxiosError } from '@/shared/@types/error';
|
||||
import {
|
||||
VatReturnBreakdownResponse,
|
||||
VatReturnBreakdownParams,
|
||||
} from '../model/types';
|
||||
import {
|
||||
useMutation,
|
||||
UseMutationOptions
|
||||
} from '@tanstack/react-query';
|
||||
|
||||
export const vatReturnBreakdown = (params: VatReturnBreakdownParams) => {
|
||||
return resultify(
|
||||
axios.post<VatReturnBreakdownResponse>(API_URL_VAT_RETURN.vatReturnBreakdown(), params),
|
||||
);
|
||||
};
|
||||
|
||||
export const useVatReturnBreakdownMutation = (options?: UseMutationOptions<VatReturnBreakdownResponse, NiceAxiosError, VatReturnBreakdownParams>) => {
|
||||
const mutation = useMutation<VatReturnBreakdownResponse, NiceAxiosError, VatReturnBreakdownParams>({
|
||||
...options,
|
||||
mutationFn: (params: VatReturnBreakdownParams) => vatReturnBreakdown(params),
|
||||
});
|
||||
|
||||
return {
|
||||
...mutation,
|
||||
};
|
||||
};
|
||||
@@ -32,7 +32,19 @@ export interface VatReturnListParams {
|
||||
targetType?: VatReturnTargetType;
|
||||
page?: DefaultRequestPagination;
|
||||
};
|
||||
|
||||
export interface VatReturnBreakdownParams {
|
||||
taxInvoiceNumber: string;
|
||||
};
|
||||
export interface VatReturnBreakdownResponse {
|
||||
breakdown: Array<Breakdown>;
|
||||
};
|
||||
export interface Breakdown {
|
||||
transactionDate: string;
|
||||
totalAmount: number;
|
||||
supplyAmount: number;
|
||||
vatAmount: number;
|
||||
transactionCount: number;
|
||||
};
|
||||
|
||||
export interface VatReturnListResponse extends DefaulResponsePagination {
|
||||
content: Array<VatReturnListContent>;
|
||||
|
||||
@@ -1,13 +1,16 @@
|
||||
import { IMAGE_ROOT } from "@/shared/constants/common";
|
||||
import { Breakdown } from "../model/types";
|
||||
|
||||
export interface VatReturnListDetailBottomSheetProps {
|
||||
bottomSheetOn: boolean;
|
||||
setBottomSheetOn: (bottomSheetOn: boolean) => void;
|
||||
breakdown: Array<Breakdown>
|
||||
};
|
||||
|
||||
export const VatReturnListDetailBottomSheet = ({
|
||||
bottomSheetOn,
|
||||
setBottomSheetOn
|
||||
setBottomSheetOn,
|
||||
breakdown
|
||||
}: VatReturnListDetailBottomSheetProps) => {
|
||||
|
||||
const onClickToClose = () => {
|
||||
|
||||
@@ -23,6 +23,7 @@ export const ListPage = () => {
|
||||
let newAppNotificationCategories = appNotificationCategories.filter((value, index) => {
|
||||
return value.code1 !== '****' && value.code2 === '*';
|
||||
});
|
||||
console.log(newAppNotificationCategories)
|
||||
setAppNotificationCategories(newAppNotificationCategories);
|
||||
}
|
||||
};
|
||||
@@ -51,6 +52,7 @@ export const ListPage = () => {
|
||||
</div>
|
||||
<AlarmList
|
||||
appNotificationCategory={ appNotificationCategory }
|
||||
appNotificationCategories={ appNotificationCategories }
|
||||
></AlarmList>
|
||||
</div>
|
||||
</main>
|
||||
|
||||
@@ -5,6 +5,9 @@ import { useNavigate } from '@/shared/lib/hooks/use-navigate';
|
||||
import { useVatReturnDetailMutation } from '@/entities/vat-return/api/use-vat-return-detail-mutation';
|
||||
import { HeaderType } from '@/entities/common/model/types';
|
||||
import {
|
||||
Breakdown,
|
||||
VatReturnBreakdownParams,
|
||||
VatReturnBreakdownResponse,
|
||||
VatReturnDetailParams,
|
||||
VatReturnDetailResponse,
|
||||
VatReturnTaxInvoiceParams,
|
||||
@@ -22,6 +25,7 @@ import { IssueSection } from '@/entities/vat-return/ui/section/issue-section';
|
||||
import { AmountSection } from '@/entities/vat-return/ui/section/amount-section';
|
||||
import { useVatReturnTaxInvoiceMutation } from '@/entities/vat-return/api/use-vat-return-tax-invoice-mutation';
|
||||
import { VatReturnListDetailBottomSheet } from '@/entities/vat-return/ui/list-detail-bottom-sheet';
|
||||
import { useVatReturnBreakdownMutation } from '@/entities/vat-return/api/use-vat-return-breakdown-mutation';
|
||||
|
||||
export const DetailPage = () => {
|
||||
const { navigate } = useNavigate();
|
||||
@@ -33,6 +37,7 @@ export const DetailPage = () => {
|
||||
const [openAmount, setOpenAmount] = useState<boolean>(false);
|
||||
const [bottomSheetOn, setBottomSheetOn] = useState<boolean>(false);
|
||||
const [detail, setDetail] = useState<VatReturnTaxInvoiceResponse>({});
|
||||
const [breakdown, setBreakdown] = useState<Array<Breakdown>>([]);
|
||||
|
||||
useSetHeaderTitle('세금계산서 상세');
|
||||
useSetHeaderType(HeaderType.RightClose);
|
||||
@@ -43,6 +48,7 @@ export const DetailPage = () => {
|
||||
|
||||
const { mutateAsync: vatReturnTaxInvoice } = useVatReturnTaxInvoiceMutation();
|
||||
const { mutateAsync: vatReturnDetail } = useVatReturnDetailMutation();
|
||||
const { mutateAsync: vatReturnBreakdown } = useVatReturnBreakdownMutation();
|
||||
|
||||
const callTaxInvoice = () => {
|
||||
let params: VatReturnDetailParams = {
|
||||
@@ -52,6 +58,14 @@ export const DetailPage = () => {
|
||||
setDetail(rs);
|
||||
});
|
||||
};
|
||||
const callVatReturnBreakdown = () => {
|
||||
let params: VatReturnBreakdownParams = {
|
||||
taxInvoiceNumber: taxInvoiceNumber,
|
||||
};
|
||||
vatReturnBreakdown(params).then((rs: VatReturnBreakdownResponse) => {
|
||||
setBreakdown(rs.breakdown);
|
||||
});
|
||||
};
|
||||
|
||||
const onClickToOpenBottomSheet = () => {
|
||||
setBottomSheetOn(true);
|
||||
@@ -59,6 +73,7 @@ export const DetailPage = () => {
|
||||
|
||||
useEffect(() => {
|
||||
callTaxInvoice();
|
||||
// callVatReturnBreakdown();
|
||||
}, []);
|
||||
|
||||
return (
|
||||
@@ -98,6 +113,7 @@ export const DetailPage = () => {
|
||||
<VatReturnListDetailBottomSheet
|
||||
bottomSheetOn={ bottomSheetOn }
|
||||
setBottomSheetOn={ setBottomSheetOn }
|
||||
breakdown={ breakdown }
|
||||
></VatReturnListDetailBottomSheet>
|
||||
}
|
||||
</>
|
||||
|
||||
@@ -20,4 +20,8 @@ export const API_URL_VAT_RETURN = {
|
||||
// POST: 세금계산서 상세 조회
|
||||
return `${API_BASE_URL}/api/v1/${API_URL_KEY}/vat-return/detail`;
|
||||
},
|
||||
vatReturnBreakdown: () => {
|
||||
// POST: 세금계산서 세부내역 조회
|
||||
return `${API_BASE_URL}/api/v1/${API_URL_KEY}/vat-return/breakdown`;
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user