update
This commit is contained in:
@ -50,14 +50,14 @@ const DetailTransaction = () => {
|
|||||||
id: selectedTransactionId
|
id: selectedTransactionId
|
||||||
});
|
});
|
||||||
// setTransactionDetails(response?.data);
|
// setTransactionDetails(response?.data);
|
||||||
if (response?.data.result_edtl) {
|
// console.log(response?.data.result_edtl)
|
||||||
|
if (response?.data.result_edtl == undefined) {
|
||||||
|
setTransactionDetails(response?.data)
|
||||||
|
setEdtl(null);
|
||||||
|
} else {
|
||||||
setTransactionDetails(response?.data.detail)
|
setTransactionDetails(response?.data.detail)
|
||||||
setEdtl(response?.data.result_edtl.data)
|
setEdtl(response?.data.result_edtl.data)
|
||||||
} else {
|
|
||||||
setTransactionDetails(response?.data)
|
|
||||||
}
|
}
|
||||||
// console.log(response?.data.result_edtl.data);
|
|
||||||
// console.log(selectedTransactionId);
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error fetching transaction', error);
|
console.error('Error fetching transaction', error);
|
||||||
}
|
}
|
||||||
@ -134,6 +134,15 @@ const DetailTransaction = () => {
|
|||||||
return null;
|
return null;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const formatTokenDec = (token) => {
|
||||||
|
if (token != null && token !== "") {
|
||||||
|
return token.match(/.{1,4}/g)?.join(" ");
|
||||||
|
} else {
|
||||||
|
return "-";
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Dialog open={showDetailDialog} onOpenChange={setShowDetailDialog}>
|
<Dialog open={showDetailDialog} onOpenChange={setShowDetailDialog}>
|
||||||
<DialogContent className="container-fixed max-w-[1024px] flex flex-col p-5 overflow-hidden">
|
<DialogContent className="container-fixed max-w-[1024px] flex flex-col p-5 overflow-hidden">
|
||||||
@ -305,16 +314,15 @@ const DetailTransaction = () => {
|
|||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{edtl != null && (
|
||||||
|
<>
|
||||||
<div>
|
<div>
|
||||||
<p className="text-sm text-gray-500">Token KWh EDTL</p>
|
<p className="text-sm text-gray-500">Token KWh EDTL</p>
|
||||||
<p className="font-medium">
|
<p className="font-medium">
|
||||||
{(edtl.tokenDec ?? "-")
|
{formatTokenDec(edtl.tokenDec)}
|
||||||
.match(/.{1,4}/g) // bagi per 4 karakter
|
|
||||||
?.join(" ") // gabungkan dengan spasi
|
|
||||||
}
|
|
||||||
|
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<p className="text-sm text-gray-500">Meter SN</p>
|
<p className="text-sm text-gray-500">Meter SN</p>
|
||||||
<p className="font-medium">
|
<p className="font-medium">
|
||||||
@ -347,6 +355,8 @@ const DetailTransaction = () => {
|
|||||||
: "-"}
|
: "-"}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<p className="text-sm text-gray-500">Provider Type</p>
|
<p className="text-sm text-gray-500">Provider Type</p>
|
||||||
|
|||||||
Reference in New Issue
Block a user