diff --git a/src/components/pages/production/recording/form/RecordingForm.tsx b/src/components/pages/production/recording/form/RecordingForm.tsx index 0d4a761b..f8f0bbc7 100644 --- a/src/components/pages/production/recording/form/RecordingForm.tsx +++ b/src/components/pages/production/recording/form/RecordingForm.tsx @@ -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:{' '} {formatNumber(pendingQty)} | pakai: {formatNumber(requestedUsage)} - {showTotalPrice && <> | total harga: {totalPrice}}) + {showTotalPrice && ( + <> | total harga: {formatCurrency(totalPrice)} + )} + ) ); } - 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)} + )} + ) ); } return ( (tersedia: {formatNumber(availableStock)} - {showTotalPrice && <> | total harga: {totalPrice}}) + {showTotalPrice && <> | total harga: {formatCurrency(totalPrice)}}) ); },