mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-20 13:32:00 +00:00
fix: set stocks quantity to usage_amount + pending_qty
This commit is contained in:
@@ -4,6 +4,7 @@ import {
|
|||||||
CreateGrowingRecordingPayload,
|
CreateGrowingRecordingPayload,
|
||||||
CreateLayingRecordingPayload,
|
CreateLayingRecordingPayload,
|
||||||
CreateEggPayload,
|
CreateEggPayload,
|
||||||
|
RecordingStock,
|
||||||
} from '@/types/api/production/recording';
|
} from '@/types/api/production/recording';
|
||||||
import { getProductWarehouseOptionLabel } from '@/lib/product-warehouse';
|
import { getProductWarehouseOptionLabel } from '@/lib/product-warehouse';
|
||||||
|
|
||||||
@@ -282,8 +283,9 @@ export const getRecordingGrowingFormInitialValues = (
|
|||||||
label: getProductWarehouseOptionLabel(stock.product_warehouse),
|
label: getProductWarehouseOptionLabel(stock.product_warehouse),
|
||||||
},
|
},
|
||||||
qty:
|
qty:
|
||||||
(stock as { qty?: number; usage_amount?: number }).qty ||
|
(stock as RecordingStock).qty ||
|
||||||
(stock as { qty?: number; usage_amount?: number }).usage_amount ||
|
((stock as RecordingStock).usage_amount || 0) +
|
||||||
|
((stock as RecordingStock).pending_qty || 0) ||
|
||||||
'',
|
'',
|
||||||
})) ?? [
|
})) ?? [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1508,9 +1508,9 @@ const RecordingForm = ({ type = 'add', initialValues }: RecordingFormProps) => {
|
|||||||
if (pendingQty > 0) {
|
if (pendingQty > 0) {
|
||||||
return (
|
return (
|
||||||
<span className='text-sm text-gray-600 whitespace-nowrap'>
|
<span className='text-sm text-gray-600 whitespace-nowrap'>
|
||||||
(tersedia: {formatNumber(requestedUsage)} | pending:{' '}
|
(tersedia: {formatNumber(availableStock)} | pending:{' '}
|
||||||
<span className='text-error'>{formatNumber(pendingQty)}</span> |
|
<span className='text-error'>{formatNumber(pendingQty)}</span> |
|
||||||
pakai: {formatNumber(requestedUsage + pendingQty)})
|
pakai: {formatNumber(requestedUsage)})
|
||||||
</span>
|
</span>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
+1
@@ -62,6 +62,7 @@ export type RecordingDepletion = {
|
|||||||
|
|
||||||
export type RecordingStock = {
|
export type RecordingStock = {
|
||||||
product_warehouse_id: number;
|
product_warehouse_id: number;
|
||||||
|
qty?: number;
|
||||||
usage_amount?: number;
|
usage_amount?: number;
|
||||||
pending_qty: number;
|
pending_qty: number;
|
||||||
product_warehouse: ProductWarehouse;
|
product_warehouse: ProductWarehouse;
|
||||||
|
|||||||
Reference in New Issue
Block a user