From 11f9a685a81c14bae26218ca40e93f660263adf1 Mon Sep 17 00:00:00 2001 From: randy-ar Date: Mon, 5 Jan 2026 13:42:01 +0700 Subject: [PATCH] fix(FE): permission for balance injection in finance detail page --- .../pages/finance/FinanceDetail.tsx | 28 +++++++++++++++++-- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/src/components/pages/finance/FinanceDetail.tsx b/src/components/pages/finance/FinanceDetail.tsx index 7f24178f..03291420 100644 --- a/src/components/pages/finance/FinanceDetail.tsx +++ b/src/components/pages/finance/FinanceDetail.tsx @@ -9,6 +9,7 @@ import Table from '@/components/Table'; import { FINANCE_INITIAL_BALANCE_STATUS, FINANCE_TRANSACTION_STATUS, + FINANCE_INJECTION_STATUS, } from '@/config/constant'; import { formatCurrency, formatDate, formatTitleCase } from '@/lib/helper'; import { FinanceApi } from '@/services/api/finance'; @@ -33,7 +34,7 @@ const FinanceDetail = ({ finance }: { finance: Finance }) => { }, { label: 'Pihak', - value: finance.party.name, + value: finance.party.id ? finance.party.name : '-', }, { label: 'Tanggal', @@ -51,7 +52,7 @@ const FinanceDetail = ({ finance }: { finance: Finance }) => { const informasiTransfer = [ { label: 'No. Referensi', - value: finance.reference_number, + value: finance.reference_number ?? '-', }, { label: 'Nomor Rekening', @@ -69,7 +70,16 @@ const FinanceDetail = ({ finance }: { finance: Finance }) => { label: 'Sisa', value: formatCurrency(finance.income_amount), }, - ]; + ].filter((item) => { + // Hide party account number row if transaction type is INJECTION + if ( + FINANCE_INJECTION_STATUS.includes(finance.transaction_type) && + item.label === `Rekening ${formatTitleCase(finance.party.type)}` + ) { + return false; + } + return true; + }); const confirmationModalDeleteClickHandler = async () => { setIsDeleteLoading(true); @@ -162,6 +172,18 @@ const FinanceDetail = ({ finance }: { finance: Finance }) => { )} + {FINANCE_INJECTION_STATUS.includes(finance.transaction_type) && ( + + + + )}