이용내역 권한 관련
This commit is contained in:
@@ -13,6 +13,7 @@ import { PATHS } from '@/shared/constants/paths';
|
|||||||
import { useStore } from '@/shared/model/store';
|
import { useStore } from '@/shared/model/store';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { showAlert } from '@/widgets/show-alert';
|
import { showAlert } from '@/widgets/show-alert';
|
||||||
|
import { checkGrant } from '@/shared/lib/check-grant';
|
||||||
|
|
||||||
export const BoxContainer1 = () => {
|
export const BoxContainer1 = () => {
|
||||||
const { navigate } = useNavigate();
|
const { navigate } = useNavigate();
|
||||||
@@ -57,17 +58,8 @@ export const BoxContainer1 = () => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const checkGrant = (menuId?: number) => {
|
|
||||||
const menuGrantsByKey = useStore.getState().UserStore.menuGrantsByKey;
|
|
||||||
const myGrants = menuGrantsByKey['' + menuId];
|
|
||||||
if(myGrants?.includes('R')){
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
};
|
|
||||||
|
|
||||||
const onClickToNavigate = () => {
|
const onClickToNavigate = () => {
|
||||||
if(checkGrant(36)){
|
if(checkGrant(36, 'R')){
|
||||||
navigate(PATHS.settlement.list);
|
navigate(PATHS.settlement.list);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import { PATHS } from '@/shared/constants/paths';
|
|||||||
import { useStore } from '@/shared/model/store';
|
import { useStore } from '@/shared/model/store';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { showAlert } from '@/widgets/show-alert';
|
import { showAlert } from '@/widgets/show-alert';
|
||||||
|
import { checkGrant } from '@/shared/lib/check-grant';
|
||||||
|
|
||||||
export const BoxContainer2 = () => {
|
export const BoxContainer2 = () => {
|
||||||
const { navigate } = useNavigate();
|
const { navigate } = useNavigate();
|
||||||
@@ -81,17 +82,8 @@ export const BoxContainer2 = () => {
|
|||||||
callOverview();
|
callOverview();
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const checkGrant = (menuId?: number) => {
|
|
||||||
const menuGrantsByKey = useStore.getState().UserStore.menuGrantsByKey;
|
|
||||||
const myGrants = menuGrantsByKey['' + menuId];
|
|
||||||
if(myGrants?.includes('R')){
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
};
|
|
||||||
|
|
||||||
const onClickToNavigate = () => {
|
const onClickToNavigate = () => {
|
||||||
if(checkGrant(36)){
|
if(checkGrant(36, 'R')){
|
||||||
navigate(PATHS.settlement.list);
|
navigate(PATHS.settlement.list);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import { UserFavorite } from '@/entities/user/model/types';
|
|||||||
import { useStore } from '@/shared/model/store';
|
import { useStore } from '@/shared/model/store';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { showAlert } from '@/widgets/show-alert';
|
import { showAlert } from '@/widgets/show-alert';
|
||||||
|
import { checkGrant } from '@/shared/lib/check-grant';
|
||||||
|
|
||||||
export interface FavoriteWrapperProps {
|
export interface FavoriteWrapperProps {
|
||||||
usingType: 'home' | 'menu',
|
usingType: 'home' | 'menu',
|
||||||
@@ -25,8 +26,7 @@ export const FavoriteWrapper = ({
|
|||||||
}: FavoriteWrapperProps) => {
|
}: FavoriteWrapperProps) => {
|
||||||
const { navigate } = useNavigate();
|
const { navigate } = useNavigate();
|
||||||
const { i18n, t } = useTranslation();
|
const { i18n, t } = useTranslation();
|
||||||
const menuGrantsByKey = useStore.getState().UserStore.menuGrantsByKey;
|
|
||||||
|
|
||||||
const [favoriteItems, setFavoriteItems] = useState<Array<UserFavorite>>([]);
|
const [favoriteItems, setFavoriteItems] = useState<Array<UserFavorite>>([]);
|
||||||
|
|
||||||
const itemAdd: UserFavorite = {
|
const itemAdd: UserFavorite = {
|
||||||
@@ -42,16 +42,9 @@ export const FavoriteWrapper = ({
|
|||||||
setEditMode(true);
|
setEditMode(true);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const checkGrant = (menuId?: number) => {
|
|
||||||
const myGrants = menuGrantsByKey['' + menuId];
|
|
||||||
if(myGrants?.includes('R') || menuId === -1){
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
};
|
|
||||||
|
|
||||||
const onClickToNavigate = (menuId?: number, path?: string) => {
|
const onClickToNavigate = (menuId?: number, path?: string) => {
|
||||||
if(menuId && checkGrant(menuId)){
|
if(menuId && checkGrant(menuId, 'R')){
|
||||||
if(!!path){
|
if(!!path){
|
||||||
navigate(path);
|
navigate(path);
|
||||||
if(setMenuOn){
|
if(setMenuOn){
|
||||||
|
|||||||
@@ -6,12 +6,12 @@ import { useTranslation } from 'react-i18next';
|
|||||||
import { IMAGE_ROOT } from '@/shared/constants/common';
|
import { IMAGE_ROOT } from '@/shared/constants/common';
|
||||||
import { useStore } from '@/shared/model/store';
|
import { useStore } from '@/shared/model/store';
|
||||||
import { showAlert } from '@/widgets/show-alert';
|
import { showAlert } from '@/widgets/show-alert';
|
||||||
|
import { checkGrant } from '@/shared/lib/check-grant';
|
||||||
|
|
||||||
export const HomeNoticeItem = ({
|
export const HomeNoticeItem = ({
|
||||||
noticeItem,
|
noticeItem,
|
||||||
setDetailData,
|
setDetailData,
|
||||||
}: NoticeItemProps) => {
|
}: NoticeItemProps) => {
|
||||||
const { navigate } = useNavigate();
|
|
||||||
const { t, i18n } = useTranslation();
|
const { t, i18n } = useTranslation();
|
||||||
|
|
||||||
const formatDate = (date?: string) => {
|
const formatDate = (date?: string) => {
|
||||||
@@ -22,16 +22,9 @@ export const HomeNoticeItem = ({
|
|||||||
}
|
}
|
||||||
return moment(date).format('YYYY.MM.DD');
|
return moment(date).format('YYYY.MM.DD');
|
||||||
};
|
};
|
||||||
const checkGrant = (menuId?: number) => {
|
|
||||||
const menuGrantsByKey = useStore.getState().UserStore.menuGrantsByKey;
|
|
||||||
const myGrants = menuGrantsByKey['' + menuId];
|
|
||||||
if(myGrants?.includes('R')){
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
};
|
|
||||||
const onClickToDetail = () => {
|
const onClickToDetail = () => {
|
||||||
if(checkGrant(62)){
|
if(checkGrant(62, 'R')){
|
||||||
if(setDetailData){
|
if(setDetailData){
|
||||||
setDetailData({
|
setDetailData({
|
||||||
seq: noticeItem.seq,
|
seq: noticeItem.seq,
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import { MenuItem } from '../model/types';
|
|||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { MenuItems } from '@/entities/common/model/constant';
|
import { MenuItems } from '@/entities/common/model/constant';
|
||||||
import { showAlert } from '@/widgets/show-alert';
|
import { showAlert } from '@/widgets/show-alert';
|
||||||
|
import { checkGrant } from '@/shared/lib/check-grant';
|
||||||
|
|
||||||
export interface MenuCategoryProps {
|
export interface MenuCategoryProps {
|
||||||
menuId?: number;
|
menuId?: number;
|
||||||
@@ -34,21 +35,12 @@ export const MenuCategory = ({
|
|||||||
}: MenuCategoryProps) => {
|
}: MenuCategoryProps) => {
|
||||||
const { navigate } = useNavigate();
|
const { navigate } = useNavigate();
|
||||||
const { i18n } = useTranslation();
|
const { i18n } = useTranslation();
|
||||||
const menuGrantsByKey = useStore.getState().UserStore.menuGrantsByKey;
|
|
||||||
|
|
||||||
const [favoriteItems, setFavoriteItems] = useState<Array<UserFavorite>>([]);
|
const [favoriteItems, setFavoriteItems] = useState<Array<UserFavorite>>([]);
|
||||||
const [menuIds, setMenuIds] = useState<Array<number | undefined>>([]);
|
const [menuIds, setMenuIds] = useState<Array<number | undefined>>([]);
|
||||||
|
|
||||||
const checkGrant = (menuId?: number) => {
|
|
||||||
const myGrants = menuGrantsByKey['' + menuId];
|
|
||||||
if(myGrants?.includes('R')){
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
};
|
|
||||||
|
|
||||||
const onClickToNavigate = (menuId?: number, path?: string) => {
|
const onClickToNavigate = (menuId?: number, path?: string) => {
|
||||||
if(menuId && checkGrant(menuId)){
|
if(menuId && checkGrant(menuId, 'R')){
|
||||||
if(!!path && !!setMenuOn && !editMode){
|
if(!!path && !!setMenuOn && !editMode){
|
||||||
setMenuOn(false);
|
setMenuOn(false);
|
||||||
navigate(path);
|
navigate(path);
|
||||||
|
|||||||
@@ -30,6 +30,8 @@ import {
|
|||||||
DetailMotionVariants
|
DetailMotionVariants
|
||||||
} from '@/entities/common/model/constant';
|
} from '@/entities/common/model/constant';
|
||||||
import { FullMenuClose } from '@/entities/common/ui/full-menu-close';
|
import { FullMenuClose } from '@/entities/common/ui/full-menu-close';
|
||||||
|
import { checkGrant } from '@/shared/lib/check-grant';
|
||||||
|
import { showAlert } from '@/widgets/show-alert';
|
||||||
|
|
||||||
export interface AllTransactionDetailProps {
|
export interface AllTransactionDetailProps {
|
||||||
detailOn: boolean;
|
detailOn: boolean;
|
||||||
@@ -38,6 +40,8 @@ export interface AllTransactionDetailProps {
|
|||||||
serviceCode: string;
|
serviceCode: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* 거래내역조회 31 */
|
||||||
|
const menuId = 31;
|
||||||
export const AllTransactionDetail = ({
|
export const AllTransactionDetail = ({
|
||||||
detailOn,
|
detailOn,
|
||||||
setDetailOn,
|
setDetailOn,
|
||||||
@@ -94,25 +98,30 @@ export const AllTransactionDetail = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
const onClickToCancel = () => {
|
const onClickToCancel = () => {
|
||||||
let msg = t('transaction.confirmCancel');
|
if(checkGrant(menuId, 'X')){
|
||||||
|
let msg = t('transaction.confirmCancel');
|
||||||
|
|
||||||
overlay.open(({
|
overlay.open(({
|
||||||
isOpen,
|
isOpen,
|
||||||
close,
|
close,
|
||||||
unmount
|
unmount
|
||||||
}) => {
|
}) => {
|
||||||
return (
|
return (
|
||||||
<Dialog
|
<Dialog
|
||||||
afterLeave={ unmount }
|
afterLeave={ unmount }
|
||||||
open={ isOpen }
|
open={ isOpen }
|
||||||
onClose={ close }
|
onClose={ close }
|
||||||
onConfirmClick={ () => onClickToNavigate(PATHS.transaction.allTransaction.cancel) }
|
onConfirmClick={ () => onClickToNavigate(PATHS.transaction.allTransaction.cancel) }
|
||||||
// onConfirmClick={ () => callCancelInfo() }
|
// onConfirmClick={ () => callCancelInfo() }
|
||||||
message={ msg }
|
message={ msg }
|
||||||
buttonLabel={[t('common.cancel'), t('common.confirm')]}
|
buttonLabel={[t('common.cancel'), t('common.confirm')]}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
showAlert('권한이 없습니다.');
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const onClickToClose = () => {
|
const onClickToClose = () => {
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ import { AmountInfoSection } from '@/entities/transaction/ui/section/amount-info
|
|||||||
import { snackBar } from '@/shared/lib';
|
import { snackBar } from '@/shared/lib';
|
||||||
import { DetailMotionDuration, DetailMotionStyle, DetailMotionVariants } from '@/entities/common/model/constant';
|
import { DetailMotionDuration, DetailMotionStyle, DetailMotionVariants } from '@/entities/common/model/constant';
|
||||||
import { FullMenuClose } from '@/entities/common/ui/full-menu-close';
|
import { FullMenuClose } from '@/entities/common/ui/full-menu-close';
|
||||||
|
import { checkGrant } from '@/shared/lib/check-grant';
|
||||||
|
|
||||||
export interface CashReceiptDetailProps {
|
export interface CashReceiptDetailProps {
|
||||||
detailOn: boolean;
|
detailOn: boolean;
|
||||||
@@ -31,6 +32,8 @@ export interface CashReceiptDetailProps {
|
|||||||
tid: string;
|
tid: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* 현금영수증 32 */
|
||||||
|
const menuId = 32;
|
||||||
export const CashReceiptDetail = ({
|
export const CashReceiptDetail = ({
|
||||||
detailOn,
|
detailOn,
|
||||||
setDetailOn,
|
setDetailOn,
|
||||||
@@ -105,7 +108,12 @@ export const CashReceiptDetail = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
const onClickToPurposeUpdate = () => {
|
const onClickToPurposeUpdate = () => {
|
||||||
setBottomSheetOn(true);
|
if(checkGrant(menuId, 'X')){
|
||||||
|
setBottomSheetOn(true);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
showAlert('권한이 없습니다.');
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -27,6 +27,8 @@ import { AmountInfoSection } from '@/entities/transaction/ui/section/amount-info
|
|||||||
import { EmailBottomSheet } from '@/entities/common/ui/email-bottom-sheet';
|
import { EmailBottomSheet } from '@/entities/common/ui/email-bottom-sheet';
|
||||||
import { DetailMotionDuration, DetailMotionStyle, DetailMotionVariants } from '@/entities/common/model/constant';
|
import { DetailMotionDuration, DetailMotionStyle, DetailMotionVariants } from '@/entities/common/model/constant';
|
||||||
import { FullMenuClose } from '@/entities/common/ui/full-menu-close';
|
import { FullMenuClose } from '@/entities/common/ui/full-menu-close';
|
||||||
|
import { checkGrant } from '@/shared/lib/check-grant';
|
||||||
|
import { showAlert } from '@/widgets/show-alert';
|
||||||
|
|
||||||
export interface EscrowDetailProps {
|
export interface EscrowDetailProps {
|
||||||
detailOn: boolean;
|
detailOn: boolean;
|
||||||
@@ -35,6 +37,8 @@ export interface EscrowDetailProps {
|
|||||||
serviceCode: string;
|
serviceCode: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* 에스크로 33 */
|
||||||
|
const menuId = 33;
|
||||||
export const EscrowDetail = ({
|
export const EscrowDetail = ({
|
||||||
detailOn,
|
detailOn,
|
||||||
setDetailOn,
|
setDetailOn,
|
||||||
@@ -91,7 +95,12 @@ export const EscrowDetail = ({
|
|||||||
|
|
||||||
|
|
||||||
const onClickToShowMailResend = () => {
|
const onClickToShowMailResend = () => {
|
||||||
setBottomSheetOn(true);
|
if(checkGrant(menuId, 'X')){
|
||||||
|
setBottomSheetOn(true);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
showAlert('권한이 없습니다.');
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const callMailResend = () => {
|
const callMailResend = () => {
|
||||||
|
|||||||
@@ -34,8 +34,10 @@ import { useTranslation } from 'react-i18next';
|
|||||||
import { AllTransactionDetail } from '@/entities/transaction/ui/detail/all-transaction-detail';
|
import { AllTransactionDetail } from '@/entities/transaction/ui/detail/all-transaction-detail';
|
||||||
import { showAlert } from '@/widgets/show-alert';
|
import { showAlert } from '@/widgets/show-alert';
|
||||||
import { snackBar } from '@/shared/lib';
|
import { snackBar } from '@/shared/lib';
|
||||||
|
import { checkGrant } from '@/shared/lib/check-grant';
|
||||||
|
|
||||||
/* 거래내역조회 31 */
|
/* 거래내역조회 31 */
|
||||||
|
const menuId = 31;
|
||||||
export const AllTransactionListPage = () => {
|
export const AllTransactionListPage = () => {
|
||||||
const { navigate } = useNavigate();
|
const { navigate } = useNavigate();
|
||||||
|
|
||||||
@@ -54,8 +56,7 @@ export const AllTransactionListPage = () => {
|
|||||||
const [tid, setTid] = useState<string>('');
|
const [tid, setTid] = useState<string>('');
|
||||||
const [dateCl, setDateCl] = useState<string>('');
|
const [dateCl, setDateCl] = useState<string>('');
|
||||||
const [goodsName, setGoodsName] = useState<string>('');
|
const [goodsName, setGoodsName] = useState<string>('');
|
||||||
// const [fromDate, setFromDate] = useState(moment().subtract(1, 'month').format('YYYYMMDD'));
|
const [fromDate, setFromDate] = useState(moment().subtract(1, 'month').format('YYYYMMDD'));
|
||||||
const [fromDate, setFromDate] = useState(moment().subtract(2, 'year').format('YYYYMMDD'));
|
|
||||||
const [toDate, setToDate] = useState(moment().format('YYYYMMDD'));
|
const [toDate, setToDate] = useState(moment().format('YYYYMMDD'));
|
||||||
const [statusCode, setStatusCode] = useState<string>('');
|
const [statusCode, setStatusCode] = useState<string>('');
|
||||||
const [serviceCode, setServiceCode] = useState<string>('01');
|
const [serviceCode, setServiceCode] = useState<string>('01');
|
||||||
@@ -174,18 +175,17 @@ export const AllTransactionListPage = () => {
|
|||||||
const onClickToOpenFilter = () => {
|
const onClickToOpenFilter = () => {
|
||||||
setFilterOn(!filterOn);
|
setFilterOn(!filterOn);
|
||||||
};
|
};
|
||||||
|
|
||||||
const onClickToDownloadExcel = () => {
|
const onClickToDownloadExcel = () => {
|
||||||
setEmailBottomSheetOn(true);
|
if(checkGrant(menuId, 'D')){
|
||||||
|
setEmailBottomSheetOn(true);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
showAlert('권한이 없습니다.');
|
||||||
|
}
|
||||||
};
|
};
|
||||||
const onRequestDownloadExcel = (userEmail?: string) => {
|
const onRequestDownloadExcel = (userEmail?: string) => {
|
||||||
// tid??? 확인 필요
|
|
||||||
/*
|
|
||||||
downloadExcel({
|
|
||||||
// tid: tid
|
|
||||||
}).then((rs) => {
|
|
||||||
|
|
||||||
});
|
|
||||||
*/
|
|
||||||
};
|
};
|
||||||
const onClickToSort = (sort: SortTypeKeys) => {
|
const onClickToSort = (sort: SortTypeKeys) => {
|
||||||
setSortType(sort);
|
setSortType(sort);
|
||||||
|
|||||||
@@ -33,7 +33,11 @@ import {
|
|||||||
import { EmailBottomSheet } from '@/entities/common/ui/email-bottom-sheet';
|
import { EmailBottomSheet } from '@/entities/common/ui/email-bottom-sheet';
|
||||||
import useIntersectionObserver from '@/widgets/intersection-observer';
|
import useIntersectionObserver from '@/widgets/intersection-observer';
|
||||||
import { BillingDetail } from '@/entities/transaction/ui/detail/billing-detail';
|
import { BillingDetail } from '@/entities/transaction/ui/detail/billing-detail';
|
||||||
|
import { showAlert } from '@/widgets/show-alert';
|
||||||
|
import { checkGrant } from '@/shared/lib/check-grant';
|
||||||
|
|
||||||
|
/* 빌링 34 */
|
||||||
|
const menuId = 34;
|
||||||
export const BillingListPage = () => {
|
export const BillingListPage = () => {
|
||||||
const { navigate } = useNavigate();
|
const { navigate } = useNavigate();
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
@@ -144,7 +148,12 @@ export const BillingListPage = () => {
|
|||||||
setFilterOn(!filterOn);
|
setFilterOn(!filterOn);
|
||||||
};
|
};
|
||||||
const onClickToOpenDownloadBottomSheet = () => {
|
const onClickToOpenDownloadBottomSheet = () => {
|
||||||
setDownloadBottomSheetOn(true);
|
if(checkGrant(menuId, 'D')){
|
||||||
|
setDownloadBottomSheetOn(true);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
showAlert('권한이 없습니다.');
|
||||||
|
}
|
||||||
};
|
};
|
||||||
const onClickToSort = (sort: SortTypeKeys) => {
|
const onClickToSort = (sort: SortTypeKeys) => {
|
||||||
setSortType(sort);
|
setSortType(sort);
|
||||||
@@ -154,7 +163,12 @@ export const BillingListPage = () => {
|
|||||||
setRequestStatus(val);
|
setRequestStatus(val);
|
||||||
};
|
};
|
||||||
const onClickToNavigate = () => {
|
const onClickToNavigate = () => {
|
||||||
navigate(PATHS.transaction.billing.charge);
|
if(checkGrant(menuId, 'X')){
|
||||||
|
navigate(PATHS.transaction.billing.charge);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
showAlert('권한이 없습니다.');
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const onRequestDownload = (userEmail?: string) => {
|
const onRequestDownload = (userEmail?: string) => {
|
||||||
|
|||||||
@@ -36,7 +36,11 @@ import { useCashReceiptSummaryMutation } from '@/entities/transaction/api/use-ca
|
|||||||
import { EmailBottomSheet } from '@/entities/common/ui/email-bottom-sheet';
|
import { EmailBottomSheet } from '@/entities/common/ui/email-bottom-sheet';
|
||||||
import useIntersectionObserver from '@/widgets/intersection-observer';
|
import useIntersectionObserver from '@/widgets/intersection-observer';
|
||||||
import { CashReceiptDetail } from '@/entities/transaction/ui/detail/cash-receit-detail';
|
import { CashReceiptDetail } from '@/entities/transaction/ui/detail/cash-receit-detail';
|
||||||
|
import { checkGrant } from '@/shared/lib/check-grant';
|
||||||
|
import { showAlert } from '@/widgets/show-alert';
|
||||||
|
|
||||||
|
/* 현금영수증 32 */
|
||||||
|
const menuId = 32;
|
||||||
export const CashReceiptListPage = () => {
|
export const CashReceiptListPage = () => {
|
||||||
const { navigate } = useNavigate();
|
const { navigate } = useNavigate();
|
||||||
const { t, i18n } = useTranslation();
|
const { t, i18n } = useTranslation();
|
||||||
@@ -174,12 +178,12 @@ export const CashReceiptListPage = () => {
|
|||||||
setFilterOn(!filterOn);
|
setFilterOn(!filterOn);
|
||||||
};
|
};
|
||||||
const onClickToDownloadExcel = () => {
|
const onClickToDownloadExcel = () => {
|
||||||
// tid??? 확인 필요
|
if(checkGrant(menuId, 'D')){
|
||||||
downloadExcel({
|
setEmailBottomSheetOn(true);
|
||||||
// tid: tid
|
}
|
||||||
}).then((rs) => {
|
else{
|
||||||
|
showAlert('권한이 없습니다.');
|
||||||
});
|
}
|
||||||
};
|
};
|
||||||
const onClickToSort = (sort: SortTypeKeys) => {
|
const onClickToSort = (sort: SortTypeKeys) => {
|
||||||
setSortType(sort);
|
setSortType(sort);
|
||||||
|
|||||||
@@ -32,7 +32,11 @@ import {
|
|||||||
import { EmailBottomSheet } from '@/entities/common/ui/email-bottom-sheet';
|
import { EmailBottomSheet } from '@/entities/common/ui/email-bottom-sheet';
|
||||||
import useIntersectionObserver from '@/widgets/intersection-observer';
|
import useIntersectionObserver from '@/widgets/intersection-observer';
|
||||||
import { EscrowDetail } from '@/entities/transaction/ui/detail/escrow-detail';
|
import { EscrowDetail } from '@/entities/transaction/ui/detail/escrow-detail';
|
||||||
|
import { checkGrant } from '@/shared/lib/check-grant';
|
||||||
|
import { showAlert } from '@/widgets/show-alert';
|
||||||
|
|
||||||
|
/* 에스크로 33 */
|
||||||
|
const menuId = 33;
|
||||||
export const EscrowListPage = () => {
|
export const EscrowListPage = () => {
|
||||||
const { navigate } = useNavigate();
|
const { navigate } = useNavigate();
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
@@ -144,7 +148,12 @@ export const EscrowListPage = () => {
|
|||||||
setFilterOn(!filterOn);
|
setFilterOn(!filterOn);
|
||||||
};
|
};
|
||||||
const onClickToDownloadExcel = () => {
|
const onClickToDownloadExcel = () => {
|
||||||
setEmailBottomSheetOn(true);
|
if(checkGrant(menuId, 'D')){
|
||||||
|
setEmailBottomSheetOn(true);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
showAlert('권한이 없습니다.');
|
||||||
|
}
|
||||||
};
|
};
|
||||||
const onRequestDownloadExcel = (userEmail?: string) => {
|
const onRequestDownloadExcel = (userEmail?: string) => {
|
||||||
// tid??? 확인 필요
|
// tid??? 확인 필요
|
||||||
|
|||||||
10
src/shared/lib/check-grant.ts
Normal file
10
src/shared/lib/check-grant.ts
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
import { useStore } from "../model/store";
|
||||||
|
|
||||||
|
export const checkGrant = (menuId?: number, authType: string = 'R') => {
|
||||||
|
const menuGrantsByKey = useStore.getState().UserStore.menuGrantsByKey;
|
||||||
|
const myGrants = menuGrantsByKey['' + menuId];
|
||||||
|
if(myGrants?.includes(authType) || menuId === -1){
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
};
|
||||||
@@ -10,6 +10,7 @@ import { useAppBridge } from '@/hooks';
|
|||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { useStore } from '@/shared/model/store';
|
import { useStore } from '@/shared/model/store';
|
||||||
import { showAlert } from '../show-alert';
|
import { showAlert } from '../show-alert';
|
||||||
|
import { checkGrant } from '@/shared/lib/check-grant';
|
||||||
|
|
||||||
export const FooterNavigation = ({
|
export const FooterNavigation = ({
|
||||||
setMenuOn,
|
setMenuOn,
|
||||||
@@ -18,20 +19,11 @@ export const FooterNavigation = ({
|
|||||||
}: FooterProps) => {
|
}: FooterProps) => {
|
||||||
const { navigate } = useNavigate();
|
const { navigate } = useNavigate();
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const menuGrantsByKey = useStore.getState().UserStore.menuGrantsByKey;
|
|
||||||
|
|
||||||
const [isFooterOn, setIsFooterOn] = useState<boolean>(true);
|
const [isFooterOn, setIsFooterOn] = useState<boolean>(true);
|
||||||
|
|
||||||
const checkGrant = (menuId?: number) => {
|
|
||||||
const myGrants = menuGrantsByKey['' + menuId];
|
|
||||||
if(myGrants?.includes('R') || menuId === -1){
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
};
|
|
||||||
|
|
||||||
const onClickToNavigate = (menuId?: number, path?: string) => {
|
const onClickToNavigate = (menuId?: number, path?: string) => {
|
||||||
if(menuId && checkGrant(menuId)){
|
if(menuId && checkGrant(menuId, 'R')){
|
||||||
if(!!path){
|
if(!!path){
|
||||||
navigate(path);
|
navigate(path);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user