- Localize 23 transaction UI component files - Add 150+ translation keys to ko.json and en.json - Organized translations under transaction namespace: * transaction.bottomSheet - Bottom sheet modals * transaction.sections - Section titles * transaction.fields - Field labels (90+ keys) * transaction.cancel - Cancellation flows * transaction.handWrittenIssuance - Manual issuance forms * transaction.list - List actions Updated files: - Bottom sheets: escrow-mail-resend, cash-receipt-purpose-update - Sections: billing-info, part-cancel-info, detail-info, issue-info, escrow-info, important-info, payment-info, transaction-info, settlement-info, merchant-info, amount-info, cancel-bank-group, cancel-password-group - Lists: list-item, billing-list, cash-receipt-list - Cancel flows: all-cancel, part-cancel, prevent-bond - Issuance: hand-written-issuance-step1, hand-written-issuance-step2 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
123 lines
4.3 KiB
TypeScript
123 lines
4.3 KiB
TypeScript
import moment from 'moment';
|
|
import { NumericFormat } from 'react-number-format';
|
|
import { SectionTitleArrow } from '@/entities/common/ui/section-title-arrow';
|
|
import { InfoSectionKeys, InfoSectionProps } from '../../model/types';
|
|
import { SlideDown } from 'react-slidedown';
|
|
import 'react-slidedown/lib/slidedown.css';
|
|
import { useTranslation } from 'react-i18next';
|
|
|
|
export const PartCancelInfoSection = ({
|
|
transactionCategory,
|
|
partCancelInfo,
|
|
serviceCode,
|
|
isOpen,
|
|
onClickToOpenInfo
|
|
}: InfoSectionProps) => {
|
|
const { t } = useTranslation();
|
|
|
|
const subItems: Record<string, Record<string, string>> = {
|
|
originalTid: {name: t('transaction.fields.originalTid'), type: 'string'},
|
|
originalAmount: {name: t('transaction.fields.originalAmount'), type: 'number'},
|
|
partCancelTid: {name: (serviceCode === '05')? t('transaction.fields.reApprovalTid'): t('transaction.fields.partCancelTid'), type: 'string'},
|
|
partCancelAmount: {name: t('transaction.fields.partCancelAmount'), type: 'number'},
|
|
remainingAmount: {name: (serviceCode === '05')? t('transaction.fields.reApprovalAmount'): t('transaction.fields.remainingAmount'), type: 'number'},
|
|
};
|
|
|
|
const openSubItems: Record<string, Array<string>> = {
|
|
// 신용카드
|
|
'01': ['originalTid', 'originalAmount', 'partCancelTid',
|
|
'partCancelAmount', 'remainingAmount'],
|
|
// 계좌이체
|
|
'02': ['originalTid', 'originalAmount', 'partCancelTid',
|
|
'partCancelAmount', 'remainingAmount'],
|
|
// 가상계좌
|
|
'03': ['originalTid', 'originalAmount', 'partCancelTid',
|
|
'partCancelAmount', 'remainingAmount'],
|
|
// 휴대폰
|
|
'04': ['originalTid', 'originalAmount', 'partCancelTid',
|
|
'partCancelAmount', 'remainingAmount'],
|
|
// 계좌간편결제
|
|
'26': ['originalTid', 'originalAmount', 'partCancelTid',
|
|
'partCancelAmount', 'remainingAmount'],
|
|
// SSG머니
|
|
'21': ['originalTid', 'originalAmount', 'partCancelTid',
|
|
'partCancelAmount', 'remainingAmount'],
|
|
// SSG은행계좌
|
|
'24': ['originalTid', 'originalAmount', 'partCancelTid',
|
|
'partCancelAmount', 'remainingAmount'],
|
|
// 문화상품권
|
|
'14': ['originalTid', 'originalAmount', 'partCancelTid',
|
|
'partCancelAmount', 'remainingAmount'],
|
|
// 티머니페이
|
|
'31': ['originalTid', 'originalAmount', 'partCancelTid',
|
|
'partCancelAmount', 'remainingAmount'],
|
|
};
|
|
|
|
const checkValue = (val: any) => {
|
|
return (!!val || val === 0);
|
|
};
|
|
let newPartCancelInfo: Record<string, any> | undefined = partCancelInfo;
|
|
const subLi = () => {
|
|
let rs = [];
|
|
|
|
if(!!newPartCancelInfo && !!serviceCode && !!openSubItems[serviceCode]){
|
|
for(let i=0;i<openSubItems[serviceCode].length;i++){
|
|
let k = openSubItems[serviceCode][i];
|
|
if(!!k){
|
|
rs.push(
|
|
<li
|
|
key={`key-important-item-${i}`}
|
|
className="kv-row"
|
|
>
|
|
<span className="k">· { subItems[k]?.name }</span>
|
|
<span className="v">
|
|
{ (checkValue(newPartCancelInfo[k]) && subItems[k]?.type === 'string') &&
|
|
newPartCancelInfo[k]
|
|
}
|
|
{ (checkValue(newPartCancelInfo[k]) && subItems[k]?.type === 'number') &&
|
|
<NumericFormat
|
|
value={ newPartCancelInfo[k] }
|
|
thousandSeparator
|
|
displayType="text"
|
|
suffix='원'
|
|
></NumericFormat>
|
|
}
|
|
{ (checkValue(newPartCancelInfo[k]) && subItems[k]?.type === 'date') &&
|
|
moment(newPartCancelInfo[k]).format('YYYY.MM.DD')
|
|
}
|
|
</span>
|
|
</li>
|
|
);
|
|
}
|
|
}
|
|
}
|
|
return rs;
|
|
};
|
|
|
|
const onClickToSetOpenInfo = () => {
|
|
if(!!onClickToOpenInfo){
|
|
onClickToOpenInfo(InfoSectionKeys.PartCancel);
|
|
}
|
|
};
|
|
|
|
return (
|
|
<>
|
|
<div className="txn-section">
|
|
<div
|
|
className="section-title with-toggle"
|
|
onClick={ () => onClickToSetOpenInfo() }
|
|
>
|
|
{ t('transaction.sections.partCancelInfo') } <SectionTitleArrow isOpen={ isOpen }></SectionTitleArrow>
|
|
</div>
|
|
<SlideDown className={'my-dropdown-slidedown'}>
|
|
{ !!isOpen &&
|
|
<ul className="kv-list">
|
|
{ subLi() }
|
|
</ul>
|
|
}
|
|
</SlideDown>
|
|
|
|
</div>
|
|
</>
|
|
)
|
|
}; |