mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-06-11 11:01:43 +00:00
feat: add total_price to recording stock type and display it in recording detail form
This commit is contained in:
@@ -1509,6 +1509,9 @@ const RecordingForm = ({ type = 'add', initialValues }: RecordingFormProps) => {
|
||||
const { pendingQty } = getStockPendingInfo(
|
||||
stock.product_warehouse_id.value
|
||||
);
|
||||
const totalPrice = initialValues?.stocks?.[stockIdx].total_price;
|
||||
const showTotalPrice =
|
||||
type === 'detail' && typeof totalPrice === 'number';
|
||||
|
||||
if (isDetail) {
|
||||
if (pendingQty > 0) {
|
||||
@@ -1516,7 +1519,8 @@ const RecordingForm = ({ type = 'add', initialValues }: RecordingFormProps) => {
|
||||
<span className='text-sm text-gray-600 whitespace-nowrap'>
|
||||
(tersedia: {formatNumber(availableStock)} | pending:{' '}
|
||||
<span className='text-error'>{formatNumber(pendingQty)}</span> |
|
||||
pakai: {formatNumber(requestedUsage)})
|
||||
pakai: {formatNumber(requestedUsage)}
|
||||
{showTotalPrice && <> | total harga: {totalPrice}</>})
|
||||
</span>
|
||||
);
|
||||
}
|
||||
@@ -1529,13 +1533,15 @@ const RecordingForm = ({ type = 'add', initialValues }: RecordingFormProps) => {
|
||||
(tersedia: {formatNumber(availableStock)} | pakai:{' '}
|
||||
{formatNumber(requestedUsage)} | sisa:{' '}
|
||||
{formatNumber(Math.max(remainingStock, 0))} | dipinjam:{' '}
|
||||
{formatNumber(Math.max(-remainingStock, 0))})
|
||||
{formatNumber(Math.max(-remainingStock, 0))}
|
||||
{showTotalPrice && <> | total harga: {totalPrice}</>})
|
||||
</span>
|
||||
);
|
||||
}
|
||||
return (
|
||||
<span className='text-sm text-gray-600 whitespace-nowrap'>
|
||||
(tersedia: {formatNumber(availableStock)})
|
||||
(tersedia: {formatNumber(availableStock)}
|
||||
{showTotalPrice && <> | total harga: {totalPrice}</>})
|
||||
</span>
|
||||
);
|
||||
},
|
||||
|
||||
+1
@@ -67,6 +67,7 @@ export type RecordingStock = {
|
||||
qty?: number;
|
||||
usage_amount?: number;
|
||||
pending_qty: number;
|
||||
total_price?: number;
|
||||
product_warehouse: ProductWarehouse;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user