bottomsheet back key
This commit is contained in:
@@ -38,7 +38,7 @@ import { checkGrant } from '@/shared/lib/check-grant';
|
||||
import { snackBar } from '@/shared/lib';
|
||||
import { useSettlementsHistoryExcelMutation } from '../api/use-settlements-history-excel-mutation';
|
||||
import { VatReturnDownloadExcelResponse } from '@/entities/vat-return/model/types';
|
||||
import { useDetailOnStore, useFilterlOnStore, useStore } from '@/shared/model/store';
|
||||
import { useDetailOnStore, useDownloadBottomSheetOnStore, useFilterlOnStore, useStore } from '@/shared/model/store';
|
||||
|
||||
export interface ListWrapProps {
|
||||
startDateFromCalendar?: string;
|
||||
@@ -92,7 +92,7 @@ export const ListWrap = ({
|
||||
const [detailSettlementId, setDetailSettlementId] = useState<string>('');
|
||||
const [detailTid, setDetailTid] = useState<string>('');
|
||||
|
||||
const [downloadBottomSheetOn, setDownloadBottomSheetOn] = useState<boolean>(false);
|
||||
const { downloadBottomSheetOn, setDownloadBottomSheetOn } = useDownloadBottomSheetOnStore();
|
||||
|
||||
const [groupDate, setGroupDate] = useState<string>('');
|
||||
const [groupDateOn, setGroupDateOn] = useState<boolean>(false);
|
||||
|
||||
@@ -26,6 +26,7 @@ import { DetailMotionDuration, DetailMotionStyle, DetailMotionVariants } from '@
|
||||
import { FullMenuClose } from '@/entities/common/ui/full-menu-close';
|
||||
import { checkGrant } from '@/shared/lib/check-grant';
|
||||
import { showAlert } from '@/widgets/show-alert';
|
||||
import { useDownloadBottomSheetOnStore } from '@/shared/model/store';
|
||||
|
||||
export interface CashReceiptDetailProps {
|
||||
detailOn: boolean;
|
||||
@@ -49,7 +50,7 @@ export const CashReceiptDetail = ({
|
||||
const [detailInfo, setDetailInfo] = useState<DetailInfo>();
|
||||
const [showAmountInfo, setShowAmountInfo] = useState<boolean>(false);
|
||||
const [showDetailInfo, setShowDetailInfo] = useState<boolean>(false);
|
||||
const [bottomSheetOn, setBottomSheetOn] = useState<boolean>(false);
|
||||
const { downloadBottomSheetOn, setDownloadBottomSheetOn } = useDownloadBottomSheetOnStore();
|
||||
const [purposeType, setPurposeType] = useState<string>();
|
||||
const [canDownloadReceipt, setCanDownloadReceipt] = useState<boolean>(false);
|
||||
|
||||
@@ -65,7 +66,7 @@ export const CashReceiptDetail = ({
|
||||
};
|
||||
cashReceiptPurposeUpdate(params).then((rs) => {
|
||||
setPurposeType(rs.afterPurposeType);
|
||||
setBottomSheetOn(false);
|
||||
setDownloadBottomSheetOn(false);
|
||||
snackBar('용도 변경을 성공하였습니다.', function(){
|
||||
reload();
|
||||
}, 2000);
|
||||
@@ -120,7 +121,7 @@ export const CashReceiptDetail = ({
|
||||
|
||||
const onClickToPurposeUpdate = () => {
|
||||
if(checkGrant(menuId, 'W')){
|
||||
setBottomSheetOn(true);
|
||||
setDownloadBottomSheetOn(true);
|
||||
}
|
||||
else{
|
||||
showAlert(t('common.nopermission'));
|
||||
@@ -196,10 +197,10 @@ export const CashReceiptDetail = ({
|
||||
}
|
||||
</div>
|
||||
</motion.div>
|
||||
{ bottomSheetOn &&
|
||||
{ downloadBottomSheetOn &&
|
||||
<CashReceitPurposeUpdateBottomSheet
|
||||
setBottomSheetOn={ setBottomSheetOn }
|
||||
bottomSheetOn={ bottomSheetOn }
|
||||
setBottomSheetOn={ setDownloadBottomSheetOn }
|
||||
bottomSheetOn={ downloadBottomSheetOn }
|
||||
callPurposeUpdate={ callPurposeUpdate }
|
||||
></CashReceitPurposeUpdateBottomSheet>
|
||||
}
|
||||
|
||||
@@ -33,6 +33,7 @@ import { checkGrant } from '@/shared/lib/check-grant';
|
||||
import { showAlert } from '@/widgets/show-alert';
|
||||
import { snackBar } from '@/shared/lib';
|
||||
import { EscrowMailResendBottomSheet } from '../escrow-mail-resend-bottom-sheet';
|
||||
import { useDownloadBottomSheetOnStore } from '@/shared/model/store';
|
||||
|
||||
export interface EscrowDetailProps {
|
||||
detailOn: boolean;
|
||||
@@ -68,7 +69,7 @@ export const EscrowDetail = ({
|
||||
const [showSettlementInfo, setShowSettlementInfo] = useState<boolean>(false);
|
||||
const [showMerchantInfo, setShowMerchantInfo] = useState<boolean>(false);
|
||||
|
||||
const [downloadBottomSheetOn, setDownloadBottomSheetOn] = useState<boolean>(false);
|
||||
const { downloadBottomSheetOn, setDownloadBottomSheetOn } = useDownloadBottomSheetOnStore();
|
||||
|
||||
const [orderNumber, setOrderNumber] = useState<string>();
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ import { useState } from 'react';
|
||||
import { DownloadBottomSheet, DownloadSelectedMode } from '@/entities/common/ui/download-bottom-sheet';
|
||||
import { CashReceiptSample } from '@/entities/common/ui/cash-receipt-sample';
|
||||
import { useCashReceiptReceiptSendEmailMutation } from '../../api/use-cash-receipt-receipt-send-email-mutation';
|
||||
import { useDownloadBottomSheetOnStore } from '@/shared/model/store';
|
||||
|
||||
export const AmountInfoSection = ({
|
||||
transactionCategory,
|
||||
@@ -25,7 +26,7 @@ export const AmountInfoSection = ({
|
||||
const { mutateAsync: cashReceiptReceiptDownload } = useCashReceiptReceiptDownloadMutation();
|
||||
const { mutateAsync: cashReceiptReceiptSendEamil } = useCashReceiptReceiptSendEmailMutation();
|
||||
|
||||
const [downloadBottomSheetOn, setDownloadBottomSheetOn] = useState<boolean>(false);
|
||||
const { downloadBottomSheetOn, setDownloadBottomSheetOn } = useDownloadBottomSheetOnStore();
|
||||
const [cashReceiptSampleOn, setCashReceiptSampleOn] = useState<boolean>(false);
|
||||
|
||||
const [receiptIssueInfo, setReceiptIssueInfo] = useState<IssueInfo>({});
|
||||
|
||||
@@ -21,6 +21,7 @@ import { DetailMotionDuration, DetailMotionStyle, DetailMotionVariants } from '@
|
||||
import { FullMenuClose } from '@/entities/common/ui/full-menu-close';
|
||||
import { showAlert } from '@/widgets/show-alert';
|
||||
import { snackBar } from '@/shared/lib';
|
||||
import { useDownloadBottomSheetOnStore } from '@/shared/model/store';
|
||||
|
||||
export interface TaxInvoiceDetailProps {
|
||||
detailOn: boolean;
|
||||
@@ -38,7 +39,7 @@ export const TaxInvoiceDetail = ({
|
||||
const location = useLocation();
|
||||
|
||||
const [openAmount, setOpenAmount] = useState<boolean>(false);
|
||||
const [bottomSheetOn, setBottomSheetOn] = useState<boolean>(false);
|
||||
const { downloadBottomSheetOn, setDownloadBottomSheetOn } = useDownloadBottomSheetOnStore();
|
||||
const [detail, setDetail] = useState<VatReturnDetailResponse>({});
|
||||
const [breakdown, setBreakdown] = useState<Array<Breakdown>>([]);
|
||||
|
||||
@@ -76,7 +77,7 @@ export const TaxInvoiceDetail = ({
|
||||
};
|
||||
|
||||
const onClickToOpenBottomSheet = () => {
|
||||
setBottomSheetOn(true);
|
||||
setDownloadBottomSheetOn(true);
|
||||
};
|
||||
|
||||
const onClickToClose = () => {
|
||||
@@ -144,10 +145,10 @@ export const TaxInvoiceDetail = ({
|
||||
</div>
|
||||
}
|
||||
</motion.div>
|
||||
{ !!bottomSheetOn &&
|
||||
{ !!downloadBottomSheetOn &&
|
||||
<VatReturnListDetailBottomSheet
|
||||
bottomSheetOn={ bottomSheetOn }
|
||||
setBottomSheetOn={ setBottomSheetOn }
|
||||
bottomSheetOn={ downloadBottomSheetOn }
|
||||
setBottomSheetOn={ setDownloadBottomSheetOn }
|
||||
breakdown={ breakdown }
|
||||
transactionAmount={ detail?.transactionAmount }
|
||||
supplyAmount={ detail?.supplyAmount }
|
||||
|
||||
@@ -18,7 +18,7 @@ import {
|
||||
} from '../model/types';
|
||||
import { useVatReturnListMutation } from '../api/use-vat-return-list-mutation';
|
||||
import { ListDateGroup } from './list-date-group';
|
||||
import { useDetailOnStore, useFilterlOnStore, useStore } from '@/shared/model/store';
|
||||
import { useDetailOnStore, useDownloadBottomSheetOnStore, useFilterlOnStore, useStore } from '@/shared/model/store';
|
||||
import { DownloadBottomSheet, DownloadSelectedMode } from '@/entities/common/ui/download-bottom-sheet';
|
||||
import useIntersectionObserver from '@/widgets/intersection-observer';
|
||||
import { TaxInvoiceDetail } from './detail/tax-invoice-detail';
|
||||
@@ -50,7 +50,7 @@ export const ListWrap = () => {
|
||||
const [receiptType, setReceiptType] = useState<VatReturnReceiptType>(defaultParams.receiptType);
|
||||
const [targetType, setTargetType] = useState<VatReturnTargetType>(defaultParams.targetType);
|
||||
|
||||
const [downloadBottomSheetOn, setDownloadBottomSheetOn] = useState<boolean>(false);
|
||||
const { downloadBottomSheetOn, setDownloadBottomSheetOn } = useDownloadBottomSheetOnStore();
|
||||
|
||||
const { detailOn, setDetailOn } = useDetailOnStore();
|
||||
const [detailTaxInvoiceNumber, setDetailTaxInvoiceNumber] = useState<string>('');
|
||||
|
||||
@@ -10,6 +10,7 @@ import { useVatReturnTaxInvoiceMutation } from '../../api/use-vat-return-tax-inv
|
||||
import { TaxInvoiceSample } from '@/entities/common/ui/tax-invoice-sample';
|
||||
import { useVatReturnTaxInvoiceSendEmailMutation } from '../../api/use-vat-return-tax-invoice-send-email-mutation';
|
||||
import { snackBar } from '@/shared/lib';
|
||||
import { useDownloadBottomSheetOnStore } from '@/shared/model/store';
|
||||
|
||||
export interface AmountSectionProps {
|
||||
taxInvoiceNumber: string;
|
||||
@@ -22,7 +23,7 @@ export const AmountSection = ({
|
||||
}: AmountSectionProps) => {
|
||||
const { t, i18n } = useTranslation();
|
||||
const [isOpen, setIsOpen] = useState<boolean>(false);
|
||||
const [downloadBottomSheetOn, setDownloadBottomSheetOn] = useState<boolean>(false);
|
||||
const { downloadBottomSheetOn, setDownloadBottomSheetOn } = useDownloadBottomSheetOnStore();
|
||||
|
||||
const [taxInvoiceSampleOn, setTaxInvoiceSampleOn] = useState<boolean>(false);
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import moment from 'moment';
|
||||
import { useDetailOnStore, useFilterlOnStore, useStore } from '@/shared/model/store';
|
||||
import { useDetailOnStore, useDownloadBottomSheetOnStore, useFilterlOnStore, useStore } from '@/shared/model/store';
|
||||
import { ChangeEvent, useEffect, useState } from 'react';
|
||||
import { IMAGE_ROOT } from '@/shared/constants/common';
|
||||
import { PATHS } from '@/shared/constants/paths';
|
||||
@@ -87,7 +87,7 @@ export const AllTransactionListPage = () => {
|
||||
const [totalCount, setTotalCount] = useState<number>(0);
|
||||
const [totalAmount, setTotalAmount] = useState<number>(0);
|
||||
|
||||
const [downloadBottomSheetOn, setDownloadBottomSheetOn] = useState<boolean>(false);
|
||||
const { downloadBottomSheetOn, setDownloadBottomSheetOn } = useDownloadBottomSheetOnStore();
|
||||
|
||||
const { detailOn, setDetailOn } = useDetailOnStore();
|
||||
const [detailTid, setDetailTid] = useState<string>('');
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import moment from 'moment';
|
||||
import { useEffect, useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { useDetailOnStore, useFilterlOnStore, useStore } from '@/shared/model/store';
|
||||
import { useDetailOnStore, useDownloadBottomSheetOnStore, useFilterlOnStore, useStore } from '@/shared/model/store';
|
||||
import { IMAGE_ROOT } from '@/shared/constants/common';
|
||||
import { PATHS } from '@/shared/constants/paths';
|
||||
import { useNavigate } from '@/shared/lib/hooks/use-navigate';
|
||||
@@ -72,7 +72,7 @@ export const BillingListPage = () => {
|
||||
const [minAmount, setMinAmount] = useState<number | undefined>(defaultParams.minAmount);
|
||||
const [maxAmount, setMaxAmount] = useState<number | undefined>(defaultParams.maxAmount);
|
||||
|
||||
const [downloadBottomSheetOn, setDownloadBottomSheetOn] = useState<boolean>(false);
|
||||
const { downloadBottomSheetOn, setDownloadBottomSheetOn } = useDownloadBottomSheetOnStore();
|
||||
|
||||
const { detailOn, setDetailOn } = useDetailOnStore();
|
||||
const [detailTid, setDetailTid] = useState<string>('');
|
||||
|
||||
@@ -33,7 +33,7 @@ import {
|
||||
useSetFooterMode
|
||||
} from '@/widgets/sub-layout/use-sub-layout';
|
||||
import { getCashReceiptTransactionTypeBtnGroup } from '@/entities/transaction/model/contant';
|
||||
import { useDetailOnStore, useFilterlOnStore, useStore } from '@/shared/model/store';
|
||||
import { useDetailOnStore, useDownloadBottomSheetOnStore, useFilterlOnStore, useStore } from '@/shared/model/store';
|
||||
import { useCashReceiptSummaryMutation } from '@/entities/transaction/api/use-cash-receipt-summary-mutation';
|
||||
import { DownloadBottomSheet, DownloadSelectedMode } from '@/entities/common/ui/download-bottom-sheet';
|
||||
import useIntersectionObserver from '@/widgets/intersection-observer';
|
||||
@@ -78,7 +78,7 @@ export const CashReceiptListPage = () => {
|
||||
const [cancelAmount, setCancelAmount] = useState<number>(0);
|
||||
const [totalCount, setTotalCount] = useState<number>(0);
|
||||
|
||||
const [downloadBottomSheetOn, setDownloadBottomSheetOn] = useState<boolean>(false);
|
||||
const { downloadBottomSheetOn, setDownloadBottomSheetOn } = useDownloadBottomSheetOnStore();
|
||||
|
||||
const { detailOn, setDetailOn } = useDetailOnStore();
|
||||
const [detailTid, setDetailTid] = useState<string>('');
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import moment from 'moment';
|
||||
import { useEffect, useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { useDetailOnStore, useFilterlOnStore, useStore } from '@/shared/model/store';
|
||||
import { useDetailOnStore, useDownloadBottomSheetOnStore, useFilterlOnStore, useStore } from '@/shared/model/store';
|
||||
import { IMAGE_ROOT } from '@/shared/constants/common';
|
||||
import { PATHS } from '@/shared/constants/paths';
|
||||
import { useNavigate } from '@/shared/lib/hooks/use-navigate';
|
||||
@@ -71,7 +71,7 @@ export const EscrowListPage = () => {
|
||||
const [minAmount, setMinAmount] = useState<number | undefined>();
|
||||
const [maxAmount, setMaxAmount] = useState<number | undefined>();
|
||||
|
||||
const [downloadBottomSheetOn, setDownloadBottomSheetOn] = useState<boolean>(false);
|
||||
const { downloadBottomSheetOn, setDownloadBottomSheetOn } = useDownloadBottomSheetOnStore();
|
||||
|
||||
const { detailOn, setDetailOn } = useDetailOnStore();
|
||||
const [detailTid, setDetailTid] = useState<string>('');
|
||||
|
||||
@@ -6,6 +6,10 @@ import { createUserInfoStore, UserInfoState } from '@/entities/user/model/store'
|
||||
import { createBannerInfoStore, BannerInfoState, createCommonStore, CommonState } from '@/entities/common/model/store';
|
||||
import { StorageKeys } from '@/shared/constants/local-storage';
|
||||
|
||||
export interface DownloadBottomSheetOnStore {
|
||||
downloadBottomSheetOn: boolean;
|
||||
setDownloadBottomSheetOn: (downloadBottomSheetOn: boolean) => void;
|
||||
};
|
||||
export interface FilterOnStore {
|
||||
filterOn: boolean;
|
||||
setFilterOn: (filterOn: boolean) => void;
|
||||
@@ -38,6 +42,15 @@ export interface MenuIdsStore {
|
||||
deleteMenuId: (menuId: number) => void;
|
||||
};
|
||||
|
||||
export const useDownloadBottomSheetOnStore = create<DownloadBottomSheetOnStore>((set) => ({
|
||||
downloadBottomSheetOn: false,
|
||||
setDownloadBottomSheetOn: (downloadBottomSheetOn: boolean) => {
|
||||
set((state: {downloadBottomSheetOn: boolean}) => ({
|
||||
downloadBottomSheetOn: (state.downloadBottomSheetOn = downloadBottomSheetOn)
|
||||
}));
|
||||
}
|
||||
}));
|
||||
|
||||
export const useFilterlOnStore = create<FilterOnStore>((set) => ({
|
||||
filterOn: false,
|
||||
setFilterOn: (filterOn: boolean) => {
|
||||
|
||||
@@ -18,7 +18,7 @@ import {
|
||||
import { useHomeGroupsMutation } from '@/entities/home/api/use-home-groups-mutation';
|
||||
import { useUserInfo } from '@/entities/user/lib/use-user-info';
|
||||
import { useAppBridge } from '@/hooks';
|
||||
import { useDetailOnStore, useFavoriteEditOnStore, useFilterlOnStore, useMenuOnStore, useStore, useTransactionCancelOnStore, useTransactionCancelPreventBondOnStore } from '@/shared/model/store';
|
||||
import { useDetailOnStore, useDownloadBottomSheetOnStore, useFavoriteEditOnStore, useFilterlOnStore, useMenuOnStore, useStore, useTransactionCancelOnStore, useTransactionCancelPreventBondOnStore } from '@/shared/model/store';
|
||||
import { HomeGroupsParams, HomeGroupsResponse } from '@/entities/home/model/types';
|
||||
import {
|
||||
BusinessPropertyParams,
|
||||
@@ -38,6 +38,7 @@ import { MenuItems } from '@/entities/common/model/constant';
|
||||
import { AlarmLinkOptions } from '@/entities/alarm/model/types';
|
||||
import { AlarmRoutes } from '@/entities/alarm/ui/alarm-routes';
|
||||
import { useNavigate } from '@/shared/lib/hooks';
|
||||
import { PATHS } from '@/shared/constants/paths';
|
||||
|
||||
export interface ContextType {
|
||||
setOnBack: (onBack: () => void) => void;
|
||||
@@ -67,7 +68,7 @@ export const SubLayout = () => {
|
||||
updateUserData
|
||||
} = useUserInfo();
|
||||
|
||||
const { reload, navigateBack } = useNavigate();
|
||||
const { reload, navigateBack, navigate } = useNavigate();
|
||||
|
||||
const { menuOn, setMenuOn } = useMenuOnStore();
|
||||
const { favoriteEditOn, setFavoriteEditOn } = useFavoriteEditOnStore();
|
||||
@@ -75,6 +76,7 @@ export const SubLayout = () => {
|
||||
const { transactionCancelOn, setTransactionCancelOn } = useTransactionCancelOnStore();
|
||||
const { cancelPreventBondOn, setCancelPreventBondOn } = useTransactionCancelPreventBondOnStore();
|
||||
const { filterOn, setFilterOn } = useFilterlOnStore();
|
||||
const { downloadBottomSheetOn, setDownloadBottomSheetOn } = useDownloadBottomSheetOnStore();
|
||||
|
||||
const location = useLocation();
|
||||
console.log(location)
|
||||
@@ -411,6 +413,9 @@ export const SubLayout = () => {
|
||||
console.log('pathname = [' + pathname + ']');
|
||||
if(pathname === '/home'){
|
||||
|
||||
}
|
||||
else if(pathname === '/additionalService/list'){
|
||||
navigate(PATHS.home);
|
||||
}
|
||||
else{
|
||||
if(menuOn){
|
||||
@@ -423,6 +428,9 @@ export const SubLayout = () => {
|
||||
else if(transactionCancelOn){
|
||||
setTransactionCancelOn(false);
|
||||
}
|
||||
else if(downloadBottomSheetOn){
|
||||
setDownloadBottomSheetOn(false);
|
||||
}
|
||||
else if(detailOn){
|
||||
setDetailOn(false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user