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,
|
||||
CreateLayingRecordingPayload,
|
||||
CreateEggPayload,
|
||||
RecordingStock,
|
||||
} from '@/types/api/production/recording';
|
||||
import { getProductWarehouseOptionLabel } from '@/lib/product-warehouse';
|
||||
|
||||
@@ -282,8 +283,9 @@ export const getRecordingGrowingFormInitialValues = (
|
||||
label: getProductWarehouseOptionLabel(stock.product_warehouse),
|
||||
},
|
||||
qty:
|
||||
(stock as { qty?: number; usage_amount?: number }).qty ||
|
||||
(stock as { qty?: number; usage_amount?: number }).usage_amount ||
|
||||
(stock as RecordingStock).qty ||
|
||||
((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) {
|
||||
return (
|
||||
<span className='text-sm text-gray-600 whitespace-nowrap'>
|
||||
(tersedia: {formatNumber(requestedUsage)} | pending:{' '}
|
||||
(tersedia: {formatNumber(availableStock)} | pending:{' '}
|
||||
<span className='text-error'>{formatNumber(pendingQty)}</span> |
|
||||
pakai: {formatNumber(requestedUsage + pendingQty)})
|
||||
pakai: {formatNumber(requestedUsage)})
|
||||
</span>
|
||||
);
|
||||
}
|
||||
|
||||
+1
@@ -62,6 +62,7 @@ export type RecordingDepletion = {
|
||||
|
||||
export type RecordingStock = {
|
||||
product_warehouse_id: number;
|
||||
qty?: number;
|
||||
usage_amount?: number;
|
||||
pending_qty: number;
|
||||
product_warehouse: ProductWarehouse;
|
||||
|
||||
Reference in New Issue
Block a user