test
This commit is contained in:
@@ -3,11 +3,13 @@ import { PATHS } from '@/shared/constants/paths';
|
||||
import { useNavigate } from '@/shared/lib/hooks/use-navigate';
|
||||
import { ListItemProps, TransactionCategory } from '../model/types';
|
||||
import moment from 'moment';
|
||||
import { useStore } from '@/shared/model/store';
|
||||
import { AllTracsactionStatusCode } from '../model/contant';
|
||||
|
||||
export const ListItem = ({
|
||||
transactionCategory,
|
||||
tid, mid, statusCode,
|
||||
installmentMonth, serviceCode,
|
||||
installmentMonth, serviceName, serviceCode,
|
||||
serviceDetailName, goodsAmount,
|
||||
id, amount, customerName, issueNumber,
|
||||
issueStatus, paymentMethod, processResult,
|
||||
@@ -94,15 +96,20 @@ export const ListItem = ({
|
||||
const getTitle = () => {
|
||||
let str = '';
|
||||
if(transactionCategory === TransactionCategory.AllTransaction){
|
||||
let strDetailName = serviceDetailName?.split('|').join(',');
|
||||
let strDetailName = '';
|
||||
if(serviceDetailName){
|
||||
strDetailName = serviceDetailName?.split('|').join(',');
|
||||
}
|
||||
if(strDetailName){
|
||||
let last = strDetailName.slice(-1);
|
||||
if(last === ','){
|
||||
strDetailName = strDetailName.substring(0, strDetailName.length - 1);
|
||||
}
|
||||
str = `(${strDetailName})`;
|
||||
str = `${serviceName}(${strDetailName})`;
|
||||
}
|
||||
else{
|
||||
str = `${serviceName}`;
|
||||
}
|
||||
|
||||
}
|
||||
else if(transactionCategory === TransactionCategory.CashReceipt){
|
||||
str = `${customerName}(${issueNumber})`
|
||||
@@ -116,14 +123,39 @@ export const ListItem = ({
|
||||
return str;
|
||||
};
|
||||
|
||||
const getStatusName = () => {
|
||||
let str;
|
||||
if(transactionCategory === TransactionCategory.AllTransaction){
|
||||
Loop1:
|
||||
for(let i=0;i<AllTracsactionStatusCode.length;i++){
|
||||
if(serviceCode === AllTracsactionStatusCode[i]?.serviceCode){
|
||||
let list = AllTracsactionStatusCode[i]?.list;
|
||||
if(!!list){
|
||||
Loop2:
|
||||
for(let j=0;j<list.length;j++){
|
||||
if(list[j]?.code === statusCode){
|
||||
str = list[j]?.ko;
|
||||
break Loop1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return str || '';
|
||||
};
|
||||
|
||||
const getDetail = () => {
|
||||
let rs = [];
|
||||
if(transactionCategory === TransactionCategory.AllTransaction){
|
||||
rs.push(
|
||||
<div className="transaction-details">
|
||||
<div
|
||||
className="transaction-details"
|
||||
key={ tid }
|
||||
>
|
||||
<span>{ getTime() }</span>
|
||||
<span className="separator">|</span>
|
||||
<span>{ statusCode }</span>
|
||||
<span>{ getStatusName() }</span>
|
||||
<span className="separator">|</span>
|
||||
<span>{ mid }</span>
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user