fix: format total price

This commit is contained in:
ValdiANS
2026-06-11 11:14:31 +07:00
parent 61cd56be22
commit a7cdf0f785
@@ -72,7 +72,7 @@ import {
} from '@/components/pages/production/recording/form/RecordingForm.schema';
import { isResponseSuccess, isResponseError } from '@/lib/api-helper';
import { formatDate, formatNumber, cn } from '@/lib/helper';
import { formatDate, formatNumber, cn, formatCurrency } from '@/lib/helper';
import {
getProductWarehouseOptionLabel,
isProductWarehouseSelectableForKandang,
@@ -1509,7 +1509,7 @@ const RecordingForm = ({ type = 'add', initialValues }: RecordingFormProps) => {
const { pendingQty } = getStockPendingInfo(
stock.product_warehouse_id.value
);
const totalPrice = initialValues?.stocks?.[stockIdx].total_price;
const totalPrice = initialValues?.stocks?.[stockIdx]?.total_price;
const showTotalPrice =
type === 'detail' && typeof totalPrice === 'number';
@@ -1520,11 +1520,13 @@ const RecordingForm = ({ type = 'add', initialValues }: RecordingFormProps) => {
(tersedia: {formatNumber(availableStock)} | pending:{' '}
<span className='text-error'>{formatNumber(pendingQty)}</span> |
pakai: {formatNumber(requestedUsage)}
{showTotalPrice && <> | total harga: {totalPrice}</>})
{showTotalPrice && (
<> | total harga: {formatCurrency(totalPrice)}</>
)}
)
</span>
);
}
return null;
}
if (requestedUsage > 0) {
@@ -1534,14 +1536,17 @@ const RecordingForm = ({ type = 'add', initialValues }: RecordingFormProps) => {
{formatNumber(requestedUsage)} | sisa:{' '}
{formatNumber(Math.max(remainingStock, 0))} | dipinjam:{' '}
{formatNumber(Math.max(-remainingStock, 0))}
{showTotalPrice && <> | total harga: {totalPrice}</>})
{showTotalPrice && (
<> | total harga: {formatCurrency(totalPrice)}</>
)}
)
</span>
);
}
return (
<span className='text-sm text-gray-600 whitespace-nowrap'>
(tersedia: {formatNumber(availableStock)}
{showTotalPrice && <> | total harga: {totalPrice}</>})
{showTotalPrice && <> | total harga: {formatCurrency(totalPrice)}</>})
</span>
);
},