- 부가서비스 : SMS 결제통보 재발송 Mesaage 수정가능 하도록 수정
This commit is contained in:
@@ -6,6 +6,7 @@ import { useExtensionSmsResendMutation } from '../../api/sms-payment/use-extensi
|
||||
import { snackBar } from '@/shared/lib';
|
||||
import { showAlert } from '@/widgets/show-alert';
|
||||
import { checkGrant } from '@/shared/lib/check-grant';
|
||||
import { useState, useEffect } from 'react';
|
||||
|
||||
export const SmsPaymentDetailResend = ({
|
||||
bottomSmsPaymentDetailResendOn,
|
||||
@@ -14,6 +15,7 @@ export const SmsPaymentDetailResend = ({
|
||||
seq
|
||||
}: SmsPaymentDetailResendProps) => {
|
||||
const { t } = useTranslation();
|
||||
const [editableMessage, setEditableMessage] = useState<string>('');
|
||||
|
||||
const variants = {
|
||||
hidden: { y: '100%' },
|
||||
@@ -22,9 +24,14 @@ export const SmsPaymentDetailResend = ({
|
||||
|
||||
const { mutateAsync: resendMessage } = useExtensionSmsResendMutation();
|
||||
|
||||
// smsDetailData가 변경되면 editableMessage 업데이트
|
||||
useEffect(() => {
|
||||
setEditableMessage(smsDetailData?.sendMessage || '');
|
||||
}, [smsDetailData?.sendMessage]);
|
||||
|
||||
const onClickResend = () => {
|
||||
// sendMessage가 없으면 재발송 불가
|
||||
if (!smsDetailData?.sendMessage) {
|
||||
// editableMessage가 없으면 재발송 불가
|
||||
if (!editableMessage || !editableMessage.trim()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -35,7 +42,7 @@ export const SmsPaymentDetailResend = ({
|
||||
|
||||
resendMessage({
|
||||
seq: seq,
|
||||
sendMessage: smsDetailData.sendMessage
|
||||
sendMessage: editableMessage
|
||||
}).then((rs) => {
|
||||
if (rs.status) {
|
||||
snackBar(t('additionalService.sms.sendSuccess'))
|
||||
@@ -90,14 +97,20 @@ export const SmsPaymentDetailResend = ({
|
||||
<div className="resend-row">{t('additionalService.sms.receiver')} : {smsDetailData?.receiverName || '-'}({smsDetailData?.receiverNumber || '-'})</div>
|
||||
</div>
|
||||
<div className="resend-box">
|
||||
<p className="resend-text">{smsDetailData?.sendMessage || '-'}</p>
|
||||
<textarea
|
||||
className="resend-text"
|
||||
value={editableMessage}
|
||||
onChange={(e) => setEditableMessage(e.target.value)}
|
||||
placeholder="-"
|
||||
style={{ border: 'none', outline: 'none' }}
|
||||
/>
|
||||
</div>
|
||||
<div className="bottomsheet-footer">
|
||||
<button
|
||||
className={`btn-50 flex-1 ${smsDetailData?.sendMessage ? 'btn-blue' : 'btn-gray'}`}
|
||||
className={`btn-50 flex-1 ${editableMessage && editableMessage.trim() ? 'btn-blue' : 'btn-gray'}`}
|
||||
type="button"
|
||||
onClick={onClickResend}
|
||||
disabled={!smsDetailData?.sendMessage}
|
||||
disabled={!editableMessage || !editableMessage.trim()}
|
||||
>
|
||||
{t('additionalService.sms.smsResendButton')}
|
||||
</button>
|
||||
|
||||
@@ -102,7 +102,7 @@ export const PayoutListPage = () => {
|
||||
});
|
||||
|
||||
const onClickToNavigation = () => {
|
||||
if (!checkGrant(53, 'X')) {
|
||||
if (!checkGrant(53, 'X') || !checkGrant(53, 'W')) {
|
||||
showAlert(t('common.nopermission'));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -194,7 +194,7 @@ export const SmsPaymentPage = () => {
|
||||
};
|
||||
|
||||
const onClickToShowDetail = (selectedSeq: number) => {
|
||||
if (!checkGrant(57, 'W')) {
|
||||
if (!checkGrant(57, 'X') || !checkGrant(57, 'W')) {
|
||||
showAlert(t('common.nopermission'));
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user