Merge branch 'fix/recording' into 'development'

[FIX/FE] Recording Form

See merge request mbugroup/lti-web-client!464
This commit is contained in:
Rivaldi A N S
2026-05-08 08:28:17 +00:00
4 changed files with 7 additions and 5 deletions
-1
View File
@@ -155,7 +155,6 @@ build:dev:
NEXT_PUBLIC_DASHBOARD_ACCOUNTING_URL: 'https://dev-dashboard-ho.mbugroup.id/' NEXT_PUBLIC_DASHBOARD_ACCOUNTING_URL: 'https://dev-dashboard-ho.mbugroup.id/'
NEXT_PUBLIC_S3_PUBLIC_BASE_URL: 'https://mbu-lti-storage.s3.ap-southeast-3.amazonaws.com' NEXT_PUBLIC_S3_PUBLIC_BASE_URL: 'https://mbu-lti-storage.s3.ap-southeast-3.amazonaws.com'
deploy:dev: deploy:dev:
<<: *deploy_template <<: *deploy_template
needs: ['build:dev'] needs: ['build:dev']
@@ -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
View File
@@ -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;