Merge branch 'main' of https://gitea.bpsoft.co.kr/nicepayments/nice-app-web
This commit is contained in:
@@ -1,11 +1,29 @@
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { PATHS } from '@/shared/constants/paths';
|
||||
import { useNavigate } from '@/shared/lib/hooks/use-navigate';
|
||||
import { checkGrant } from '@/shared/lib/check-grant';
|
||||
import { showAlert } from '@/widgets/show-alert';
|
||||
|
||||
export const PasswordManageWrap = () => {
|
||||
const { t } = useTranslation();
|
||||
const { navigate } = useNavigate();
|
||||
|
||||
const changeLoginPassword = () => {
|
||||
if (!checkGrant(46, 'X')) {
|
||||
showAlert(t('common.nopermission'));
|
||||
return;
|
||||
}
|
||||
navigate(PATHS.account.password.modifyLoginPassword);
|
||||
};
|
||||
|
||||
const changeCancelPassword = () => {
|
||||
if (!checkGrant(46, 'X')) {
|
||||
showAlert(t('common.nopermission'));
|
||||
return;
|
||||
}
|
||||
navigate(PATHS.account.password.modifyCancelPassword);
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className="ing-list">
|
||||
@@ -14,12 +32,12 @@ export const PasswordManageWrap = () => {
|
||||
<button
|
||||
className="btn-44 btn-white pwd-btn"
|
||||
type="button"
|
||||
onClick={ () => navigate(PATHS.account.password.modifyLoginPassword) }
|
||||
onClick={changeLoginPassword}
|
||||
>{t('account.changeLoginPassword')}</button>
|
||||
<button
|
||||
className="btn-44 btn-white pwd-btn"
|
||||
type="button"
|
||||
onClick={ () => navigate(PATHS.account.password.modifyCancelPassword) }
|
||||
onClick={changeCancelPassword}
|
||||
>{t('account.changeCancelPassword')}</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -6,6 +6,8 @@ import { useUserUpdatePermissionsMutation } from '@/entities/user/api/use-user-u
|
||||
import { UserMenuPermissionData } from '@/entities/user/model/types';
|
||||
import { MenuItems } from '@/entities/common/model/constant';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { checkGrant } from '@/shared/lib/check-grant';
|
||||
import { showAlert } from '@/widgets/show-alert';
|
||||
|
||||
export const UserAccountAuthWrap = ({
|
||||
mid,
|
||||
@@ -49,6 +51,21 @@ export const UserAccountAuthWrap = ({
|
||||
const idCLChanged = currentIdCL !== idCL;
|
||||
setHasChanges(statusChanged || idCLChanged);
|
||||
}, [currentStatus, currentIdCL, status, idCL]);
|
||||
|
||||
const handleSave = () => {
|
||||
if (!checkGrant(45, 'X')) {
|
||||
showAlert(t('common.nopermission'));
|
||||
return;
|
||||
}
|
||||
console.log('updatePermissionMutation');
|
||||
updatePermissionsMutation.mutate({
|
||||
mid: mid,
|
||||
usrid: usrid,
|
||||
idCl: currentIdCL,
|
||||
status: currentStatus
|
||||
});
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className="ing-list pdtop pb-86">
|
||||
@@ -89,16 +106,7 @@ export const UserAccountAuthWrap = ({
|
||||
className="btn-50 btn-blue flex-1"
|
||||
type="button"
|
||||
disabled={!hasChanges || updatePermissionsMutation.isPending}
|
||||
onClick={() => {
|
||||
console.log('updatePermissionMutation');
|
||||
updatePermissionsMutation.mutate(
|
||||
{
|
||||
mid: mid,
|
||||
usrid: usrid,
|
||||
idCl: currentIdCL,
|
||||
status: currentStatus
|
||||
});
|
||||
}}
|
||||
onClick={handleSave}
|
||||
>
|
||||
{updatePermissionsMutation.isPending ? t('common.saving') : t('common.save')}
|
||||
</button>
|
||||
|
||||
@@ -7,6 +7,8 @@ import { UserManageAuthList } from './user-manage-auth-list';
|
||||
import { useUserFindMutation } from '@/entities/user/api/use-user-find-mutation';
|
||||
import { UserListItem } from '@/entities/user/model/types';
|
||||
import { useStore } from '@/shared/model/store';
|
||||
import { checkGrant } from '@/shared/lib/check-grant';
|
||||
import { showAlert } from '@/widgets/show-alert';
|
||||
|
||||
export const UserManageWrap = () => {
|
||||
const { t } = useTranslation();
|
||||
@@ -33,6 +35,10 @@ export const UserManageWrap = () => {
|
||||
};
|
||||
|
||||
const onClickToNavigation = () => {
|
||||
if (!checkGrant(45, 'X')) {
|
||||
showAlert(t('common.nopermission'));
|
||||
return;
|
||||
}
|
||||
navigate(PATHS.account.user.addAccount, {
|
||||
state: {
|
||||
mid: mid,
|
||||
@@ -82,7 +88,7 @@ export const UserManageWrap = () => {
|
||||
<div className="apply-row">
|
||||
<button
|
||||
className="btn-50 btn-blue flex-1"
|
||||
onClick={ () => onClickToNavigation() }
|
||||
onClick={onClickToNavigation}
|
||||
>{t('account.addUser')}</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -7,7 +7,7 @@ import { useFaqListMutation } from '@/entities/support/api/use-faq-list-mutation
|
||||
import { DEFAULT_PAGE_PARAM } from '@/entities/common/model/constant';
|
||||
import { DetailData, FaqItem, FaqListParams, FaqListResponse, SearchCl } from '@/entities/support/model/types';
|
||||
import { SupportFaqItem } from '@/entities/support/ui/faq-item';
|
||||
import {
|
||||
import {
|
||||
useSetHeaderTitle,
|
||||
useSetHeaderType,
|
||||
useSetFooterMode,
|
||||
@@ -15,6 +15,7 @@ import {
|
||||
} from '@/widgets/sub-layout/use-sub-layout';
|
||||
import useIntersectionObserver from '@/widgets/intersection-observer';
|
||||
import { FaqDetail } from '@/entities/support/ui/detail/faq-detail';
|
||||
import { checkGrant } from '@/shared/lib/check-grant';
|
||||
import { showAlert } from '@/widgets/show-alert';
|
||||
|
||||
export const FaqListPage = () => {
|
||||
@@ -137,6 +138,10 @@ export const FaqListPage = () => {
|
||||
};
|
||||
|
||||
const onClickToNavigation = () => {
|
||||
if (!checkGrant(64, 'R')) {
|
||||
showAlert(t('common.nopermission'));
|
||||
return;
|
||||
}
|
||||
navigate(PATHS.support.qna.list);
|
||||
};
|
||||
|
||||
|
||||
@@ -3,6 +3,9 @@ import { useStore } from "../model/store";
|
||||
export const checkGrant = (menuId?: number, authType: string = 'R') => {
|
||||
const menuGrantsByKey = useStore.getState().UserStore.menuGrantsByKey;
|
||||
const myGrants = menuGrantsByKey['' + menuId];
|
||||
|
||||
console.log('checkGrant', menuId, authType, myGrants);
|
||||
|
||||
if(myGrants?.includes(authType) || menuId === -1){
|
||||
return true
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user