Merge branch 'feat/recording-detail-used-product-total-price' into 'development'

[FEAT/FE] Recording Detail Used Product Total Price

See merge request mbugroup/lti-web-client!515
This commit is contained in:
Rivaldi A N S
2026-06-11 04:19:48 +00:00
@@ -72,7 +72,7 @@ import {
} from '@/components/pages/production/recording/form/RecordingForm.schema'; } from '@/components/pages/production/recording/form/RecordingForm.schema';
import { isResponseSuccess, isResponseError } from '@/lib/api-helper'; import { isResponseSuccess, isResponseError } from '@/lib/api-helper';
import { formatDate, formatNumber, cn } from '@/lib/helper'; import { formatDate, formatNumber, cn, formatCurrency } from '@/lib/helper';
import { import {
getProductWarehouseOptionLabel, getProductWarehouseOptionLabel,
isProductWarehouseSelectableForKandang, isProductWarehouseSelectableForKandang,
@@ -1509,7 +1509,7 @@ const RecordingForm = ({ type = 'add', initialValues }: RecordingFormProps) => {
const { pendingQty } = getStockPendingInfo( const { pendingQty } = getStockPendingInfo(
stock.product_warehouse_id.value stock.product_warehouse_id.value
); );
const totalPrice = initialValues?.stocks?.[stockIdx].total_price; const totalPrice = initialValues?.stocks?.[stockIdx]?.total_price;
const showTotalPrice = const showTotalPrice =
type === 'detail' && typeof totalPrice === 'number'; type === 'detail' && typeof totalPrice === 'number';
@@ -1520,18 +1520,13 @@ const RecordingForm = ({ type = 'add', initialValues }: RecordingFormProps) => {
(tersedia: {formatNumber(availableStock)} | pending:{' '} (tersedia: {formatNumber(availableStock)} | pending:{' '}
<span className='text-error'>{formatNumber(pendingQty)}</span> | <span className='text-error'>{formatNumber(pendingQty)}</span> |
pakai: {formatNumber(requestedUsage)} pakai: {formatNumber(requestedUsage)}
{showTotalPrice && <> | total harga: {totalPrice}</>}) {showTotalPrice && (
<> | total harga: {formatCurrency(totalPrice)}</>
)}
)
</span> </span>
); );
} }
if (showTotalPrice) {
return (
<span className='text-sm text-gray-600 whitespace-nowrap'>
(total harga: {totalPrice})
</span>
);
}
return null;
} }
if (requestedUsage > 0) { if (requestedUsage > 0) {
@@ -1541,14 +1536,17 @@ const RecordingForm = ({ type = 'add', initialValues }: RecordingFormProps) => {
{formatNumber(requestedUsage)} | sisa:{' '} {formatNumber(requestedUsage)} | sisa:{' '}
{formatNumber(Math.max(remainingStock, 0))} | dipinjam:{' '} {formatNumber(Math.max(remainingStock, 0))} | dipinjam:{' '}
{formatNumber(Math.max(-remainingStock, 0))} {formatNumber(Math.max(-remainingStock, 0))}
{showTotalPrice && <> | total harga: {totalPrice}</>}) {showTotalPrice && (
<> | total harga: {formatCurrency(totalPrice)}</>
)}
)
</span> </span>
); );
} }
return ( return (
<span className='text-sm text-gray-600 whitespace-nowrap'> <span className='text-sm text-gray-600 whitespace-nowrap'>
(tersedia: {formatNumber(availableStock)} (tersedia: {formatNumber(availableStock)}
{showTotalPrice && <> | total harga: {totalPrice}</>}) {showTotalPrice && <> | total harga: {formatCurrency(totalPrice)}</>})
</span> </span>
); );
}, },