mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-20 13:32:00 +00:00
fix(FE): permission for balance injection in finance detail page
This commit is contained in:
@@ -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 }) => {
|
||||
</Button>
|
||||
</RequirePermission>
|
||||
)}
|
||||
{FINANCE_INJECTION_STATUS.includes(finance.transaction_type) && (
|
||||
<RequirePermission permissions='lti.finance.injections.update'>
|
||||
<Button
|
||||
color='warning'
|
||||
className='min-w-24'
|
||||
href={`/finance/detail/edit/injection?financeId=${finance.id}`}
|
||||
>
|
||||
<Icon icon='mdi:pencil-outline' />
|
||||
Edit
|
||||
</Button>
|
||||
</RequirePermission>
|
||||
)}
|
||||
<RequirePermission permissions='lti.finance.transactions.delete'>
|
||||
<Button
|
||||
color='error'
|
||||
|
||||
Reference in New Issue
Block a user