update detail transaction and transaction list
This commit is contained in:
@ -47,12 +47,9 @@ const DetailTransaction = () => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Dialog open={showDetailDialog} onOpenChange={setShowDetailDialog}>
|
<Dialog open={showDetailDialog} onOpenChange={setShowDetailDialog}>
|
||||||
<DialogContent className="container-fixed max-w-[768px] flex flex-col p-5 overflow-hidden">
|
<DialogContent className="container-fixed max-w-[1024px] flex flex-col p-5 overflow-hidden">
|
||||||
<DialogHeader>
|
<DialogHeader>
|
||||||
<DialogTitle>Transaction Details</DialogTitle>
|
<DialogTitle>Transaction Details</DialogTitle>
|
||||||
{/* <DialogDescription>
|
|
||||||
Viewing details for transaction ID: {selectedTransactionId}
|
|
||||||
</DialogDescription> */}
|
|
||||||
</DialogHeader>
|
</DialogHeader>
|
||||||
<DialogBody>
|
<DialogBody>
|
||||||
{/* Tabs Navigation */}
|
{/* Tabs Navigation */}
|
||||||
@ -63,6 +60,12 @@ const DetailTransaction = () => {
|
|||||||
>
|
>
|
||||||
Detail Transaction
|
Detail Transaction
|
||||||
</button>
|
</button>
|
||||||
|
<button
|
||||||
|
className={`py-2 px-4 font-medium text-sm focus:outline-none ${activeTab === 'origincustomer' ? 'text-blue-600 border-b-2 border-blue-600' : 'text-gray-500 hover:text-gray-700'}`}
|
||||||
|
onClick={() => setActiveTab('origincustomer')}
|
||||||
|
>
|
||||||
|
Origin Customer
|
||||||
|
</button>
|
||||||
<button
|
<button
|
||||||
className={`py-2 px-4 font-medium text-sm focus:outline-none ${activeTab === 'log' ? 'text-blue-600 border-b-2 border-blue-600' : 'text-gray-500 hover:text-gray-700'}`}
|
className={`py-2 px-4 font-medium text-sm focus:outline-none ${activeTab === 'log' ? 'text-blue-600 border-b-2 border-blue-600' : 'text-gray-500 hover:text-gray-700'}`}
|
||||||
onClick={() => setActiveTab('log')}
|
onClick={() => setActiveTab('log')}
|
||||||
@ -73,31 +76,303 @@ const DetailTransaction = () => {
|
|||||||
className={`py-2 px-4 font-medium text-sm focus:outline-none ${activeTab === 'approve' ? 'text-blue-600 border-b-2 border-blue-600' : 'text-gray-500 hover:text-gray-700'}`}
|
className={`py-2 px-4 font-medium text-sm focus:outline-none ${activeTab === 'approve' ? 'text-blue-600 border-b-2 border-blue-600' : 'text-gray-500 hover:text-gray-700'}`}
|
||||||
onClick={() => setActiveTab('approve')}
|
onClick={() => setActiveTab('approve')}
|
||||||
>
|
>
|
||||||
Log Approve
|
Approval Log
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
className={`py-2 px-4 font-medium text-sm focus:outline-none ${activeTab === 'p24' ? 'text-blue-600 border-b-2 border-blue-600' : 'text-gray-500 hover:text-gray-700'}`}
|
||||||
|
onClick={() => setActiveTab('p24')}
|
||||||
|
>
|
||||||
|
Log P24
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Tab Content */}
|
{/* Tab Content */}
|
||||||
<div className="py-4">
|
<div className="py-4 overflow-y-auto max-h-[400px]">
|
||||||
{activeTab === 'detail' && (
|
{activeTab === 'detail' && transactionDetails?.kind === 'P' && (
|
||||||
<div className="space-y-4">
|
<div className="space-y-4">
|
||||||
<h3 className="font-semibold">Transaction Information</h3>
|
<h3 className="font-semibold flex items-center">
|
||||||
|
Transaction Information
|
||||||
|
<span className="ml-2 bg-blue-100 text-blue-800 text-xs font-semibold mr-2 px-2.5 py-0.5 rounded">
|
||||||
|
Info
|
||||||
|
</span>
|
||||||
|
</h3>
|
||||||
<div className="grid grid-cols-2 gap-4">
|
<div className="grid grid-cols-2 gap-4">
|
||||||
<div>
|
<div>
|
||||||
<p className="text-sm text-gray-500">Transaction Date</p>
|
<p className="text-sm text-gray-500">Transaction Date</p>
|
||||||
<p className="font-medium">2023-11-15 14:30:22</p>
|
<p className="font-medium">{transactionDetails?.transaction_date}</p>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<p className="text-sm text-gray-500">Full Name</p>
|
||||||
|
<p className="font-medium">{transactionDetails?.origin_customer.fullname}</p>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<p className="text-sm text-gray-500">Amount</p>
|
<p className="text-sm text-gray-500">Amount</p>
|
||||||
<p className="font-medium">$1,250.00</p>
|
<p className="font-medium">{new Intl.NumberFormat('en-US', { style: 'currency', currency: 'USD' }).format(transactionDetails?.purchase.amount)}</p>
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<p className="text-sm text-gray-500">Status</p>
|
|
||||||
<p className="font-medium">COMPLETED</p>
|
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<p className="text-sm text-gray-500">Fee</p>
|
<p className="text-sm text-gray-500">Fee</p>
|
||||||
<p className="font-medium">$5.00</p>
|
<p className="font-medium">
|
||||||
|
{transactionDetails?.kind === 'P'
|
||||||
|
? transactionDetails?.purchase.fee_amount.toLocaleString('en-US', { style: 'currency', currency: 'USD' })
|
||||||
|
: transactionDetails?.transfer.fee_amount.toLocaleString('en-US', { style: 'currency', currency: 'USD' })}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<p className="text-sm text-gray-500">Status</p>
|
||||||
|
<p className="font-medium">
|
||||||
|
{(() => {
|
||||||
|
let status;
|
||||||
|
if (transactionDetails?.status === 'C') {
|
||||||
|
status = 'COMPLETE';
|
||||||
|
} else if (transactionDetails?.status === 'F') {
|
||||||
|
status = 'FAILED';
|
||||||
|
} else if (transactionDetails?.status === 'O') {
|
||||||
|
status = 'ON PROCESS';
|
||||||
|
} else {
|
||||||
|
status = 'PENDING';
|
||||||
|
}
|
||||||
|
return status;
|
||||||
|
})()}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<p className="text-sm text-gray-500">Transaction Type</p>
|
||||||
|
<p className="font-medium">
|
||||||
|
{(() => {
|
||||||
|
let kind;
|
||||||
|
if (transactionDetails?.kind === 'T') {
|
||||||
|
kind = 'TRANSFER';
|
||||||
|
} else if (transactionDetails?.kind === 'P') {
|
||||||
|
kind = 'PURCHASE';
|
||||||
|
} else if (transactionDetails?.kind === 'W') {
|
||||||
|
kind = 'WITHDRAW';
|
||||||
|
} else if (transactionDetails?.kind === 'U') {
|
||||||
|
kind = 'TOP UP';
|
||||||
|
} else if (transactionDetails?.kind === 'R') {
|
||||||
|
kind = 'RETURN';
|
||||||
|
}
|
||||||
|
return kind;
|
||||||
|
})()}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<p className="text-sm text-gray-500">Description</p>
|
||||||
|
<p className="font-medium">{transactionDetails?.description}</p>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<p className="text-sm text-gray-500">Name</p>
|
||||||
|
<p className="font-medium">{transactionDetails?.type.name}</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<h3 className="font-semibold flex items-center">
|
||||||
|
Origin Wallet
|
||||||
|
<span className="ml-2 bg-blue-100 text-blue-800 text-xs font-semibold mr-2 px-2.5 py-0.5 rounded">
|
||||||
|
Wallet
|
||||||
|
</span>
|
||||||
|
</h3>
|
||||||
|
<div className="grid grid-cols-2 gap-4">
|
||||||
|
<div>
|
||||||
|
<p className="text-sm text-gray-500">Name</p>
|
||||||
|
<p className="font-medium">{transactionDetails?.origin_wallet.name}</p>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<p className="text-sm text-gray-500">Description</p>
|
||||||
|
<p className="font-medium">{transactionDetails?.origin_wallet.description}</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<h3 className="font-semibold flex items-center">
|
||||||
|
Purchase
|
||||||
|
<span className="ml-2 bg-blue-100 text-blue-800 text-xs font-semibold mr-2 px-2.5 py-0.5 rounded">
|
||||||
|
Purchase
|
||||||
|
</span>
|
||||||
|
</h3>
|
||||||
|
<div className="grid grid-cols-2 gap-4">
|
||||||
|
<div>
|
||||||
|
<p className="text-sm text-gray-500">Amount</p>
|
||||||
|
<p className="font-medium">{new Intl.NumberFormat('en-US', { style: 'currency', currency: 'USD' }).format(transactionDetails?.purchase.amount)}</p>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<p className="text-sm text-gray-500">Cashback</p>
|
||||||
|
<p className="font-medium">{new Intl.NumberFormat('en-US', { style: 'currency', currency: 'USD' }).format(transactionDetails?.purchase.cashback)}</p>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<p className="text-sm text-gray-500">Cashback Point</p>
|
||||||
|
<p className="font-medium">{transactionDetails?.purchase.cashback_point}</p>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<p className="text-sm text-gray-500">Fee Amount</p>
|
||||||
|
<p className="font-medium">{new Intl.NumberFormat('en-US', { style: 'currency', currency: 'USD' }).format(transactionDetails?.purchase.fee_amount)}</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{activeTab === 'detail' && transactionDetails?.kind != 'P' && transactionDetails?.transfer!=null && (
|
||||||
|
<div className="space-y-4">
|
||||||
|
<h3 className="font-semibold flex items-center">
|
||||||
|
Transaction Information
|
||||||
|
<span className="ml-2 bg-blue-100 text-blue-800 text-xs font-semibold mr-2 px-2.5 py-0.5 rounded">
|
||||||
|
Info
|
||||||
|
</span>
|
||||||
|
</h3>
|
||||||
|
<div className="grid grid-cols-2 gap-4">
|
||||||
|
<div>
|
||||||
|
<p className="text-sm text-gray-500">Transaction Date</p>
|
||||||
|
<p className="font-medium">{transactionDetails?.transaction_date}</p>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<p className="text-sm text-gray-500">Full Name</p>
|
||||||
|
<p className="font-medium">{transactionDetails?.origin_customer.fullname}</p>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<p className="text-sm text-gray-500">Amount</p>
|
||||||
|
<p className="font-medium">{new Intl.NumberFormat('en-US', { style: 'currency', currency: 'USD' }).format(transactionDetails?.transfer.amount)}</p>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<p className="text-sm text-gray-500">Fee</p>
|
||||||
|
<p className="font-medium">
|
||||||
|
{transactionDetails?.transfer.fee_amount.toLocaleString('en-US', { style: 'currency', currency: 'USD' })}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<p className="text-sm text-gray-500">Status</p>
|
||||||
|
<p className="font-medium">
|
||||||
|
{(() => {
|
||||||
|
let status;
|
||||||
|
if (transactionDetails?.status === 'C') {
|
||||||
|
status = 'COMPLETE';
|
||||||
|
} else if (transactionDetails?.status === 'F') {
|
||||||
|
status = 'FAILED';
|
||||||
|
} else if (transactionDetails?.status === 'O') {
|
||||||
|
status = 'ON PROCESS';
|
||||||
|
} else {
|
||||||
|
status = 'PENDING';
|
||||||
|
}
|
||||||
|
return status;
|
||||||
|
})()}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<p className="text-sm text-gray-500">Transaction Type</p>
|
||||||
|
<p className="font-medium">
|
||||||
|
{(() => {
|
||||||
|
let kind;
|
||||||
|
if (transactionDetails?.kind === 'T') {
|
||||||
|
kind = 'TRANSFER';
|
||||||
|
} else if (transactionDetails?.kind === 'P') {
|
||||||
|
kind = 'PURCHASE';
|
||||||
|
} else if (transactionDetails?.kind === 'W') {
|
||||||
|
kind = 'WITHDRAW';
|
||||||
|
} else if (transactionDetails?.kind === 'U') {
|
||||||
|
kind = 'TOP UP';
|
||||||
|
} else if (transactionDetails?.kind === 'R') {
|
||||||
|
kind = 'RETURN';
|
||||||
|
}
|
||||||
|
return kind;
|
||||||
|
})()}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<p className="text-sm text-gray-500">Description</p>
|
||||||
|
<p className="font-medium">{transactionDetails?.description}</p>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<p className="text-sm text-gray-500">Name</p>
|
||||||
|
<p className="font-medium">{transactionDetails?.type.name}</p>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<p className="text-sm text-gray-500">Reference</p>
|
||||||
|
<p className="font-medium">{transactionDetails?.transfer.reference}</p>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<p className="text-sm text-gray-500">Destination Iban</p>
|
||||||
|
<p className="font-medium">{transactionDetails?.transfer.destination_iban}</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<h3 className="font-semibold flex items-center">
|
||||||
|
Destination Wallet
|
||||||
|
<span className="ml-2 bg-blue-100 text-blue-800 text-xs font-semibold mr-2 px-2.5 py-0.5 rounded">
|
||||||
|
Wallet
|
||||||
|
</span>
|
||||||
|
</h3>
|
||||||
|
<div className="grid grid-cols-2 gap-4">
|
||||||
|
<div>
|
||||||
|
<p className="text-sm text-gray-500">Name</p>
|
||||||
|
<p className="font-medium">{transactionDetails?.transfer.destination_wallet.name}</p>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<p className="text-sm text-gray-500">Description</p>
|
||||||
|
<p className="font-medium">{transactionDetails?.transfer.destination_wallet.description}</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<h3 className="font-semibold flex items-center">
|
||||||
|
Destination Customer
|
||||||
|
<span className="ml-2 bg-blue-100 text-blue-800 text-xs font-semibold mr-2 px-2.5 py-0.5 rounded">
|
||||||
|
Destination Customer
|
||||||
|
</span>
|
||||||
|
</h3>
|
||||||
|
<div className="grid grid-cols-2 gap-4">
|
||||||
|
<div>
|
||||||
|
<p className="text-sm text-gray-500">Name</p>
|
||||||
|
<p className="font-medium">{transactionDetails?.transfer.destination_customer.fullname}</p>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<p className="text-sm text-gray-500">MSISDN</p>
|
||||||
|
<p className="font-medium">{transactionDetails?.transfer.destination_customer.msisdn}</p>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<p className="text-sm text-gray-500">Email</p>
|
||||||
|
<p className="font-medium">{transactionDetails?.transfer.destination_customer.email}</p>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<p className="text-sm text-gray-500">MSISDN</p>
|
||||||
|
<p className="font-medium">{transactionDetails?.transfer.destination_customer.username}</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<h3 className="font-semibold flex items-center">
|
||||||
|
Origin Wallet
|
||||||
|
<span className="ml-2 bg-blue-100 text-blue-800 text-xs font-semibold mr-2 px-2.5 py-0.5 rounded">
|
||||||
|
Wallet
|
||||||
|
</span>
|
||||||
|
</h3>
|
||||||
|
<div className="grid grid-cols-2 gap-4">
|
||||||
|
<div>
|
||||||
|
<p className="text-sm text-gray-500">Name</p>
|
||||||
|
<p className="font-medium">{transactionDetails?.origin_wallet.name}</p>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<p className="text-sm text-gray-500">Description</p>
|
||||||
|
<p className="font-medium">{transactionDetails?.origin_wallet.description}</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
|
|
||||||
|
{activeTab === 'origincustomer' && (
|
||||||
|
<div className="space-y-4">
|
||||||
|
<h3 className="font-semibold">Origin Customer</h3>
|
||||||
|
<div className="grid grid-cols-2 gap-4">
|
||||||
|
<div>
|
||||||
|
<p className="text-sm text-gray-500">Full Name</p>
|
||||||
|
<p className="font-medium">{transactionDetails?.origin_customer.fullname}</p>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<p className="text-sm text-gray-500">Phone Number</p>
|
||||||
|
<p className="font-medium">{transactionDetails?.origin_customer.msisdn}</p>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<p className="text-sm text-gray-500">Email</p>
|
||||||
|
<p className="font-medium">{transactionDetails?.origin_customer.email}</p>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<p className="text-sm text-gray-500">Username</p>
|
||||||
|
<p className="font-medium">{transactionDetails?.origin_customer.username}</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -106,21 +381,53 @@ const DetailTransaction = () => {
|
|||||||
{activeTab === 'log' && (
|
{activeTab === 'log' && (
|
||||||
<div className="space-y-4">
|
<div className="space-y-4">
|
||||||
<h3 className="font-semibold">Transaction Logs</h3>
|
<h3 className="font-semibold">Transaction Logs</h3>
|
||||||
<div className="border rounded-lg divide-y">
|
<div className="border rounded-lg overflow-x-auto">
|
||||||
<div className="p-3">
|
<table className="min-w-full table-auto">
|
||||||
<div className="flex justify-between">
|
<thead>
|
||||||
<span className="font-medium">Status changed to COMPLETED</span>
|
<tr className="bg-gray-100">
|
||||||
<span className="text-sm text-gray-500">2023-11-15 14:35:22</span>
|
<th className="px-4 py-2 text-left text-sm text-gray-500">Status</th>
|
||||||
</div>
|
<th className="px-4 py-2 text-left text-sm text-gray-500">Request Date</th>
|
||||||
<p className="text-sm text-gray-600 mt-1">System processed the transaction successfully</p>
|
<th className="px-4 py-2 text-left text-sm text-gray-500">Request Body</th>
|
||||||
</div>
|
<th className="px-4 py-2 text-left text-sm text-gray-500">Response Body</th>
|
||||||
<div className="p-3">
|
<th className="px-4 py-2 text-left text-sm text-gray-500">Response Code</th>
|
||||||
<div className="flex justify-between">
|
<th className="px-4 py-2 text-left text-sm text-gray-500">Request End Point</th>
|
||||||
<span className="font-medium">Status changed to PROCESSING</span>
|
</tr>
|
||||||
<span className="text-sm text-gray-500">2023-11-15 14:31:22</span>
|
</thead>
|
||||||
</div>
|
<tbody>
|
||||||
<p className="text-sm text-gray-600 mt-1">Transaction received by system</p>
|
{transactionDetails?.log && transactionDetails?.log.length > 0 ? (
|
||||||
</div>
|
transactionDetails.log.map((log: { request_endpoint: string, status: string; request_date: string; response_date: string; request_body: string; response_body: string; response_code: number }, index: number) => (
|
||||||
|
<tr key={index} className="border-t">
|
||||||
|
<td className="px-4 py-2 font-medium">
|
||||||
|
{(() => {
|
||||||
|
let status;
|
||||||
|
if (log.status === 'P') {
|
||||||
|
status = 'PENDING';
|
||||||
|
} else if (log.status === 'O') {
|
||||||
|
status = 'ON PROCESS';
|
||||||
|
} else if (log.status === 'F') {
|
||||||
|
status = 'FAILED';
|
||||||
|
} else if (log.status === 'C') {
|
||||||
|
status = 'COMPLETE';
|
||||||
|
}
|
||||||
|
return status;
|
||||||
|
})()}
|
||||||
|
</td>
|
||||||
|
<td className="px-4 py-2 text-sm text-gray-500">{log.request_date ?? '-'}</td>
|
||||||
|
<td className="px-4 py-2 text-sm text-gray-500">{log.response_date ?? '-'}</td>
|
||||||
|
<td className="px-4 py-2 text-sm text-gray-500">{log.request_body ?? '-'}</td>
|
||||||
|
<td className="px-4 py-2 text-sm text-gray-500">{log.response_body ?? '-'}</td>
|
||||||
|
<td className="px-4 py-2 text-sm text-gray-500">{log.request_endpoint ?? '-'}</td>
|
||||||
|
</tr>
|
||||||
|
))
|
||||||
|
) : (
|
||||||
|
<tr>
|
||||||
|
<td colSpan={3} className="px-4 py-2 text-center text-sm text-gray-500">
|
||||||
|
No logs available
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
)}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
@ -128,17 +435,99 @@ const DetailTransaction = () => {
|
|||||||
{activeTab === 'approve' && (
|
{activeTab === 'approve' && (
|
||||||
<div className="space-y-4">
|
<div className="space-y-4">
|
||||||
<h3 className="font-semibold">Approval Logs</h3>
|
<h3 className="font-semibold">Approval Logs</h3>
|
||||||
<div className="border rounded-lg divide-y">
|
{transactionDetails?.log_approve.length === 0 ? (
|
||||||
<div className="p-3">
|
<p className="text-sm text-gray-500">No data available</p>
|
||||||
<div className="flex justify-between">
|
) : (
|
||||||
<span className="font-medium">Approved by Admin</span>
|
<div className="border rounded-lg overflow-x-auto">
|
||||||
<span className="text-sm text-gray-500">2023-11-15 14:32:22</span>
|
<table className="min-w-full table-auto">
|
||||||
</div>
|
<thead>
|
||||||
<p className="text-sm text-gray-600 mt-1">Transaction approved automatically by system</p>
|
<tr className="bg-gray-100">
|
||||||
|
<th className="px-4 py-2 text-left text-sm text-gray-500">Status</th>
|
||||||
|
<th className="px-4 py-2 text-left text-sm text-gray-500">Created At</th>
|
||||||
|
<th className="px-4 py-2 text-left text-sm text-gray-500">Updated At</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{transactionDetails?.log_approve && transactionDetails?.log_approve.length > 0 ? (
|
||||||
|
transactionDetails.log_approve.map((log: { created_at: string; status: string; updated_at: string }, index: number) => (
|
||||||
|
<tr key={index} className="border-t">
|
||||||
|
<td className="px-4 py-2 font-medium">
|
||||||
|
{(() => {
|
||||||
|
let status;
|
||||||
|
if (log.status === 'W') {
|
||||||
|
status = 'WAITING';
|
||||||
|
} else if (log.status === 'Y') {
|
||||||
|
status = 'APPROVE';
|
||||||
|
} else if (log.status === 'N') {
|
||||||
|
status = 'REJECT';
|
||||||
|
} else if (log.status === 'T') {
|
||||||
|
status = 'NO NEED';
|
||||||
|
}
|
||||||
|
return status;
|
||||||
|
})()}
|
||||||
|
</td>
|
||||||
|
<td className="px-4 py-2 text-sm text-gray-500">{log.created_at}</td>
|
||||||
|
<td className="px-4 py-2 text-sm text-gray-500">{log.updated_at}</td>
|
||||||
|
</tr>
|
||||||
|
))
|
||||||
|
) : (
|
||||||
|
<tr>
|
||||||
|
<td colSpan={3} className="px-4 py-2 text-center text-sm text-gray-500">
|
||||||
|
No logs available
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
)}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
)}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
{activeTab === 'p24' && (
|
||||||
|
<div className="space-y-4">
|
||||||
|
<h3 className="font-semibold">P24 Logs</h3>
|
||||||
|
{transactionDetails?.p24.length === 0 ? (
|
||||||
|
<p className="text-sm text-gray-500">No data available</p>
|
||||||
|
) : (
|
||||||
|
<div className="border rounded-lg overflow-x-auto">
|
||||||
|
<table className="min-w-full table-auto">
|
||||||
|
<thead>
|
||||||
|
<tr className="bg-gray-100">
|
||||||
|
<th className="px-4 py-2 text-left text-sm text-gray-500">Type</th>
|
||||||
|
<th className="px-4 py-2 text-left text-sm text-gray-500">Request Date</th>
|
||||||
|
<th className="px-4 py-2 text-left text-sm text-gray-500">Request Body</th>
|
||||||
|
<th className="px-4 py-2 text-left text-sm text-gray-500">Response Body</th>
|
||||||
|
<th className="px-4 py-2 text-left text-sm text-gray-500">Response Code</th>
|
||||||
|
<th className="px-4 py-2 text-left text-sm text-gray-500">Request Endpoint</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{transactionDetails?.p24 && transactionDetails?.p24.length > 0 ? (
|
||||||
|
transactionDetails.p24.map((log: { request_endpoint: string, type: string; request_date: string; response_date: string; request_body: string; response_body: string; response_code: number }, index: number) => (
|
||||||
|
<tr key={index} className="border-t">
|
||||||
|
<td className="px-4 py-2 text-sm text-gray-500">{log.type}</td>
|
||||||
|
<td className="px-4 py-2 text-sm text-gray-500">{log.request_date}</td>
|
||||||
|
<td className="px-4 py-2 text-sm text-gray-500">{log.response_date}</td>
|
||||||
|
<td className="px-4 py-2 text-sm text-gray-500">{log.request_body}</td>
|
||||||
|
<td className="px-4 py-2 text-sm text-gray-500">{log.response_body}</td>
|
||||||
|
<td className="px-4 py-2 text-sm text-gray-500">{log.request_endpoint ?? '-'}</td>
|
||||||
|
</tr>
|
||||||
|
))
|
||||||
|
) : (
|
||||||
|
<tr>
|
||||||
|
<td colSpan={3} className="px-4 py-2 text-center text-sm text-gray-500">
|
||||||
|
No logs available
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
)}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</DialogBody>
|
</DialogBody>
|
||||||
</DialogContent>
|
</DialogContent>
|
||||||
@ -146,4 +535,4 @@ const DetailTransaction = () => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default DetailTransaction;
|
export default DetailTransaction;
|
||||||
|
|||||||
@ -72,8 +72,12 @@ const TransactionProvider = ({ children }: { children: React.ReactNode }) => {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
accessorFn: (row) =>
|
accessorFn: (row) => {
|
||||||
new Intl.NumberFormat('en-US', { style: 'currency', currency: 'USD' }).format(row.purchase.amount),
|
const purchaseAmount = row?.purchase?.amount;
|
||||||
|
const transferAmount = row?.transfer?.amount;
|
||||||
|
|
||||||
|
return new Intl.NumberFormat('en-US', { style: 'currency', currency: 'USD' }).format(purchaseAmount ?? transferAmount ?? 0);
|
||||||
|
},
|
||||||
id: 'amount',
|
id: 'amount',
|
||||||
header: ({ column }) => <DataGridColumnHeader title="Amount" column={column} />,
|
header: ({ column }) => <DataGridColumnHeader title="Amount" column={column} />,
|
||||||
enableSorting: false,
|
enableSorting: false,
|
||||||
@ -84,19 +88,13 @@ const TransactionProvider = ({ children }: { children: React.ReactNode }) => {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
accessorFn: (row) => {
|
accessorFn: (row) => {
|
||||||
let fee;
|
const purchaseAmount = row?.purchase?.fee_amount;
|
||||||
if (row.kind === 'P') {
|
const transferAmount = row?.transfer?.fee_amount;
|
||||||
fee = row.purchase.fee_amount;
|
|
||||||
} else {
|
return new Intl.NumberFormat('en-US', { style: 'currency', currency: 'USD' }).format(purchaseAmount ?? transferAmount ?? 0);
|
||||||
fee = row.transfer.fee_amount;
|
|
||||||
}
|
|
||||||
return fee.toLocaleString('en-US', {
|
|
||||||
style: 'currency',
|
|
||||||
currency: 'USD',
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
accessorKey: 'fee',
|
id: 'feeamount',
|
||||||
header: ({ column }) => <DataGridColumnHeader title="Fee" column={column} />,
|
header: ({ column }) => <DataGridColumnHeader title="Fee Amount" column={column} />,
|
||||||
enableSorting: false,
|
enableSorting: false,
|
||||||
enableHiding: false,
|
enableHiding: false,
|
||||||
meta: {
|
meta: {
|
||||||
@ -152,8 +150,8 @@ const TransactionProvider = ({ children }: { children: React.ReactNode }) => {
|
|||||||
const row = data.row.original;
|
const row = data.row.original;
|
||||||
return (
|
return (
|
||||||
<div key={`actions-${row.id}`}>
|
<div key={`actions-${row.id}`}>
|
||||||
<button
|
<button
|
||||||
className="btn btn-sm btn-icon btn-clear btn-light"
|
className="btn btn-sm btn-icon btn-clear btn-light"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setSelectedTransactionId(row.id);
|
setSelectedTransactionId(row.id);
|
||||||
setShowDetailDialog(true);
|
setShowDetailDialog(true);
|
||||||
|
|||||||
22
yarn.lock
22
yarn.lock
@ -631,10 +631,10 @@
|
|||||||
resolved "https://registry.npmjs.org/@emotion/weak-memoize/-/weak-memoize-0.4.0.tgz"
|
resolved "https://registry.npmjs.org/@emotion/weak-memoize/-/weak-memoize-0.4.0.tgz"
|
||||||
integrity sha512-snKqtPW01tN0ui7yu9rGv69aJXr/a/Ywvl11sUjNtEcRc+ng/mQriFL0wLXMef74iHa/EkftbDzU9F8iFbH+zg==
|
integrity sha512-snKqtPW01tN0ui7yu9rGv69aJXr/a/Ywvl11sUjNtEcRc+ng/mQriFL0wLXMef74iHa/EkftbDzU9F8iFbH+zg==
|
||||||
|
|
||||||
"@esbuild/linux-x64@0.21.5":
|
"@esbuild/darwin-arm64@0.21.5":
|
||||||
version "0.21.5"
|
version "0.21.5"
|
||||||
resolved "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.21.5.tgz"
|
resolved "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.21.5.tgz"
|
||||||
integrity sha512-1rYdTpyv03iycF1+BhzrzQJCdOuAOtaqHTWJZCWvijKD2N5Xu0TtVC8/+1faWqcP9iBCWOmjmhoH94dH82BxPQ==
|
integrity sha512-DwqXqZyuk5AiWWf3UfLiRDJ5EDd49zg6O9wclZ7kUMv2WRFr4HKjXp/5t8JZ11QbQfUS6/cRCKGwYhtNAY88kQ==
|
||||||
|
|
||||||
"@eslint-community/eslint-utils@^4.2.0", "@eslint-community/eslint-utils@^4.4.0":
|
"@eslint-community/eslint-utils@^4.2.0", "@eslint-community/eslint-utils@^4.4.0":
|
||||||
version "4.4.1"
|
version "4.4.1"
|
||||||
@ -1580,15 +1580,10 @@
|
|||||||
resolved "https://registry.npmjs.org/@remix-run/router/-/router-1.21.0.tgz"
|
resolved "https://registry.npmjs.org/@remix-run/router/-/router-1.21.0.tgz"
|
||||||
integrity sha512-xfSkCAchbdG5PnbrKqFWwia4Bi61nH+wm8wLEqfHDyp7Y3dZzgqS2itV8i4gAq9pC2HsTpwyBC6Ds8VHZ96JlA==
|
integrity sha512-xfSkCAchbdG5PnbrKqFWwia4Bi61nH+wm8wLEqfHDyp7Y3dZzgqS2itV8i4gAq9pC2HsTpwyBC6Ds8VHZ96JlA==
|
||||||
|
|
||||||
"@rollup/rollup-linux-x64-gnu@4.24.2":
|
"@rollup/rollup-darwin-arm64@4.24.2":
|
||||||
version "4.24.2"
|
version "4.24.2"
|
||||||
resolved "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.24.2.tgz"
|
resolved "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.24.2.tgz"
|
||||||
integrity sha512-jOG/0nXb3z+EM6SioY8RofqqmZ+9NKYvJ6QQaa9Mvd3RQxlH68/jcB/lpyVt4lCiqr04IyaC34NzhUqcXbB5FQ==
|
integrity sha512-/UhrIxobHYCBfhi5paTkUDQ0w+jckjRZDZ1kcBL132WeHZQ6+S5v9jQPVGLVrLbNUebdIRpIt00lQ+4Z7ys4Rg==
|
||||||
|
|
||||||
"@rollup/rollup-linux-x64-musl@4.24.2":
|
|
||||||
version "4.24.2"
|
|
||||||
resolved "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.24.2.tgz"
|
|
||||||
integrity sha512-XAo7cJec80NWx9LlZFEJQxqKOMz/lX3geWs2iNT5CHIERLFfd90f3RYLLjiCBm1IMaQ4VOX/lTC9lWfzzQm14Q==
|
|
||||||
|
|
||||||
"@tanstack/query-core@5.59.20":
|
"@tanstack/query-core@5.59.20":
|
||||||
version "5.59.20"
|
version "5.59.20"
|
||||||
@ -2630,6 +2625,11 @@ fs.realpath@^1.0.0:
|
|||||||
resolved "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz"
|
resolved "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz"
|
||||||
integrity sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==
|
integrity sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==
|
||||||
|
|
||||||
|
fsevents@~2.3.2, fsevents@~2.3.3:
|
||||||
|
version "2.3.3"
|
||||||
|
resolved "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz"
|
||||||
|
integrity sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==
|
||||||
|
|
||||||
function-bind@^1.1.2:
|
function-bind@^1.1.2:
|
||||||
version "1.1.2"
|
version "1.1.2"
|
||||||
resolved "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz"
|
resolved "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz"
|
||||||
|
|||||||
Reference in New Issue
Block a user