Add permission checks to link payment detail components
- Add checkGrant(55, 'W') for resend and separate approval in link-payment-history-detail - Add checkGrant(55, 'W') for delete in link-payment-wait-detail - Show alert message when user lacks permission - Simplify onClick handlers from arrow functions to direct method references 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -24,6 +24,8 @@ import moment from 'moment';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { DetailMotionDuration, DetailMotionStyle, DetailMotionVariants } from '@/entities/common/model/constant';
|
||||
import { FullMenuClose } from '@/entities/common/ui/full-menu-close';
|
||||
import { checkGrant } from '@/shared/lib/check-grant';
|
||||
import { showAlert } from '@/widgets/show-alert';
|
||||
|
||||
export interface LinkPaymentHistoryDetailProps {
|
||||
detailOn: boolean;
|
||||
@@ -95,6 +97,10 @@ export const LinkPaymentHistoryDetail = ({
|
||||
}
|
||||
|
||||
const onClickToResend = () => {
|
||||
if (!checkGrant(55, 'W')) {
|
||||
showAlert(t('common.nopermission'));
|
||||
return;
|
||||
}
|
||||
let msg = t('additionalService.linkPayment.resendConfirm');
|
||||
|
||||
overlay.open(({
|
||||
@@ -116,6 +122,10 @@ export const LinkPaymentHistoryDetail = ({
|
||||
};
|
||||
|
||||
const onClickToSeparateApproval = () => {
|
||||
if (!checkGrant(55, 'W')) {
|
||||
showAlert(t('common.nopermission'));
|
||||
return;
|
||||
}
|
||||
navigate(PATHS.additionalService.linkPayment.separateApproval, {
|
||||
state: { mid, requestId }
|
||||
});
|
||||
@@ -188,7 +198,7 @@ export const LinkPaymentHistoryDetail = ({
|
||||
<div className="link-payment-detail-button" style={{ paddingBottom: '100px' }}>
|
||||
<button
|
||||
className="btn-50 btn-blue flex-1"
|
||||
onClick={() => onClickToSeparateApproval()}
|
||||
onClick={onClickToSeparateApproval}
|
||||
disabled={detailExposure}
|
||||
>{t('additionalService.linkPayment.separateApprovalDetail')}</button>
|
||||
</div>
|
||||
@@ -196,7 +206,7 @@ export const LinkPaymentHistoryDetail = ({
|
||||
<div className="apply-row">
|
||||
<button
|
||||
className="btn-50 btn-blue flex-1"
|
||||
onClick={() => onClickToResend()}
|
||||
onClick={onClickToResend}
|
||||
disabled={!isResendEnabled()}
|
||||
>{t('additionalService.linkPayment.resend')}</button>
|
||||
</div>
|
||||
|
||||
@@ -12,6 +12,8 @@ import { snackBar } from '@/shared/lib';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { DetailMotionDuration, DetailMotionStyle, DetailMotionVariants } from '@/entities/common/model/constant';
|
||||
import { FullMenuClose } from '@/entities/common/ui/full-menu-close';
|
||||
import { checkGrant } from '@/shared/lib/check-grant';
|
||||
import { showAlert } from '@/widgets/show-alert';
|
||||
|
||||
export interface LinkPaymentWaitDetailProps {
|
||||
detailOn: boolean;
|
||||
@@ -62,6 +64,10 @@ export const LinkPaymentWaitDetail = ({
|
||||
}
|
||||
|
||||
const onClickToCancel = () => {
|
||||
if (!checkGrant(55, 'W')) {
|
||||
showAlert(t('common.nopermission'));
|
||||
return;
|
||||
}
|
||||
let msg = t('additionalService.linkPayment.deleteConfirm');
|
||||
|
||||
overlay.open(({
|
||||
@@ -131,7 +137,7 @@ export const LinkPaymentWaitDetail = ({
|
||||
<div className="apply-row">
|
||||
<button
|
||||
className="btn-50 btn-blue flex-1"
|
||||
onClick={() => onClickToCancel()}
|
||||
onClick={onClickToCancel}
|
||||
disabled={paymentInfo?.processStatus !== LinkPaymentProcessStatus.SEND_REQUEST}
|
||||
>{t('additionalService.linkPayment.delete')}</button>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user