From d76f897840b37331c1eddcd54d90a6ed0c0575e0 Mon Sep 17 00:00:00 2001 From: rstubryan Date: Mon, 20 Oct 2025 11:32:35 +0700 Subject: [PATCH 1/3] refactor(FE-62): update wrapper class names for improved layout in MovementForm --- .../inventory/movement/form/MovementForm.tsx | 28 ++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/src/components/pages/inventory/movement/form/MovementForm.tsx b/src/components/pages/inventory/movement/form/MovementForm.tsx index a35937f7..034e7b91 100644 --- a/src/components/pages/inventory/movement/form/MovementForm.tsx +++ b/src/components/pages/inventory/movement/form/MovementForm.tsx @@ -1081,6 +1081,10 @@ const MovementForm = ({ type = 'add', initialValues }: MovementFormProps) => { options={getFilteredProductWarehouseOptions()} isDisabled={type === 'detail'} isClearable + className={{ + wrapper: + 'w-full min-w-52 md:min-w-72 lg:min-w-80', + }} /> @@ -1103,7 +1107,7 @@ const MovementForm = ({ type = 'add', initialValues }: MovementFormProps) => { } readOnly={type === 'detail'} className={{ - wrapper: 'w-full min-w-24', + wrapper: 'w-full min-w-48', }} /> @@ -1126,6 +1130,10 @@ const MovementForm = ({ type = 'add', initialValues }: MovementFormProps) => { isLoading={isLoadingSuppliers} isDisabled={type === 'detail'} isClearable + className={{ + wrapper: + 'w-full min-w-52 md:min-w-72 lg:min-w-80', + }} /> @@ -1141,6 +1149,10 @@ const MovementForm = ({ type = 'add', initialValues }: MovementFormProps) => { idx )} readOnly={type === 'detail'} + className={{ + wrapper: + 'w-full min-w-52 md:min-w-72 lg:min-w-80', + }} /> @@ -1165,6 +1177,10 @@ const MovementForm = ({ type = 'add', initialValues }: MovementFormProps) => { idx )} readOnly={type === 'detail'} + className={{ + wrapper: + 'w-full min-w-72 md:w-min-80 lg:w-min-96', + }} /> @@ -1183,6 +1199,9 @@ const MovementForm = ({ type = 'add', initialValues }: MovementFormProps) => { idx )} readOnly={type === 'detail'} + className={{ + wrapper: 'w-full min-w-48', + }} /> @@ -1204,6 +1223,9 @@ const MovementForm = ({ type = 'add', initialValues }: MovementFormProps) => { idx )} readOnly={type === 'detail'} + className={{ + wrapper: 'w-full min-w-48', + }} /> @@ -1219,6 +1241,10 @@ const MovementForm = ({ type = 'add', initialValues }: MovementFormProps) => { idx )} readOnly={type === 'detail'} + className={{ + wrapper: + 'w-full min-w-52 md:min-w-72 lg:min-w-80', + }} /> {type !== 'detail' && ( From c8db992b17a12b0dca4b667c28a0d1fd545ed2b3 Mon Sep 17 00:00:00 2001 From: rstubryan Date: Mon, 20 Oct 2025 11:50:19 +0700 Subject: [PATCH 2/3] feat(FE-62,63,65): add document_path field to deliveries in MovementForm --- .../movement/form/MovementForm.schema.ts | 43 +++++++------ .../inventory/movement/form/MovementForm.tsx | 63 +++++++++++-------- 2 files changed, 61 insertions(+), 45 deletions(-) diff --git a/src/components/pages/inventory/movement/form/MovementForm.schema.ts b/src/components/pages/inventory/movement/form/MovementForm.schema.ts index 2cc5d910..5df66930 100644 --- a/src/components/pages/inventory/movement/form/MovementForm.schema.ts +++ b/src/components/pages/inventory/movement/form/MovementForm.schema.ts @@ -14,6 +14,7 @@ export type DeliverySchema = { delivery_cost?: number | undefined; delivery_cost_per_item?: number | undefined; document?: File | string | null; + document_path?: string | null; driver_name: string; vehicle_plate: string; supplier: { @@ -86,6 +87,7 @@ const DeliveryObjectSchema: Yup.ObjectSchema = Yup.object({ ); } ), + document_path: Yup.string().optional(), document_index: Yup.number().optional(), document: Yup.mixed() .nullable() @@ -161,8 +163,8 @@ export const getMovementFormInitialValues = ( ? { value: initialValues.source_warehouse.id, label: initialValues.source_warehouse.name, - area: initialValues.source_warehouse.area?.name, - location: initialValues.source_warehouse.location?.name, + area: initialValues.source_warehouse.area?.name ?? undefined, + location: initialValues.source_warehouse.location?.name ?? undefined, } : null, source_warehouse_id: initialValues?.source_warehouse?.id ?? 0, @@ -170,8 +172,9 @@ export const getMovementFormInitialValues = ( ? { value: initialValues.destination_warehouse.id, label: initialValues.destination_warehouse.name, - area: initialValues.destination_warehouse.area?.name, - location: initialValues.destination_warehouse.location?.name, + area: initialValues.destination_warehouse.area?.name ?? undefined, + location: + initialValues.destination_warehouse.location?.name ?? undefined, } : null, destination_warehouse_id: initialValues?.destination_warehouse?.id ?? 0, @@ -185,19 +188,20 @@ export const getMovementFormInitialValues = ( product_qty: detail.quantity, })) ?? [], deliveries: - initialValues?.deliveries?.map((d) => { - return { - delivery_cost: d.shipping_cost_total, - delivery_cost_per_item: d.shipping_cost_item, - document_index: 0, - document: d.document_path || null, - driver_name: d.driver_name, - vehicle_plate: d.vehicle_plate, - supplier: d.supplier - ? { value: d.supplier.id, label: d.supplier.name } - : null, - supplier_id: d.supplier?.id ?? 0, - products: d.items.map((item) => { + initialValues?.deliveries?.map((d) => ({ + delivery_cost: d.shipping_cost_total ?? undefined, + delivery_cost_per_item: d.shipping_cost_item ?? undefined, + document_number: d.document_number ?? '', + document: d.document_path ?? null, + document_path: d.document_path ?? null, + driver_name: d.driver_name ?? '', + vehicle_plate: d.vehicle_plate ?? '', + supplier: d.supplier + ? { value: d.supplier.id, label: d.supplier.name } + : null, + supplier_id: d.supplier?.id ?? 0, + products: + d.items?.map((item) => { const productData = detailIdToProductId.get( item.stock_transfer_detail_id ); @@ -208,8 +212,7 @@ export const getMovementFormInitialValues = ( product_id: productData?.id ?? 0, product_qty: item.quantity, }; - }), - }; - }) ?? [], + }) ?? [], + })) ?? [], }; }; diff --git a/src/components/pages/inventory/movement/form/MovementForm.tsx b/src/components/pages/inventory/movement/form/MovementForm.tsx index 034e7b91..671615d9 100644 --- a/src/components/pages/inventory/movement/form/MovementForm.tsx +++ b/src/components/pages/inventory/movement/form/MovementForm.tsx @@ -83,6 +83,7 @@ const MovementForm = ({ type = 'add', initialValues }: MovementFormProps) => { delivery_cost: d.delivery_cost ?? 0, delivery_cost_per_item: d.delivery_cost_per_item ?? 0, document_index: documentIndex, + document_path: d.document_path, driver_name: d.driver_name, vehicle_plate: d.vehicle_plate, supplier_id: d.supplier_id, @@ -1156,32 +1157,44 @@ const MovementForm = ({ type = 'add', initialValues }: MovementFormProps) => { /> - { - const file = e.target.files?.[0]; - if (file) { - if (file.size > 2 * 1024 * 1024) { - toast.error('Ukuran dokumen maksimal 2 MB!'); - return; + {type === 'detail' ? ( + + ) : ( + { + const file = e.target.files?.[0]; + if (file) { + if (file.size > 2 * 1024 * 1024) { + toast.error( + 'Ukuran dokumen maksimal 2 MB!' + ); + return; + } + formik.setFieldValue( + `deliveries.${idx}.document`, + file + ); } - formik.setFieldValue( - `deliveries.${idx}.document`, - file - ); - } - }} - {...isRepeaterInputError( - 'deliveries', - 'document', - idx - )} - readOnly={type === 'detail'} - className={{ - wrapper: - 'w-full min-w-72 md:w-min-80 lg:w-min-96', - }} - /> + }} + {...isRepeaterInputError( + 'deliveries', + 'document', + idx + )} + className={{ + wrapper: + 'w-full min-w-72 md:w-min-80 lg:w-min-96', + }} + /> + )} Date: Mon, 20 Oct 2025 12:03:58 +0700 Subject: [PATCH 3/3] refactor(FE-62): update layout and remove unused delete confirmation in MovementForm --- .../inventory/movement/form/MovementForm.tsx | 30 ++++--------------- 1 file changed, 6 insertions(+), 24 deletions(-) diff --git a/src/components/pages/inventory/movement/form/MovementForm.tsx b/src/components/pages/inventory/movement/form/MovementForm.tsx index 671615d9..d5d28f5f 100644 --- a/src/components/pages/inventory/movement/form/MovementForm.tsx +++ b/src/components/pages/inventory/movement/form/MovementForm.tsx @@ -914,6 +914,10 @@ const MovementForm = ({ type = 'add', initialValues }: MovementFormProps) => { 'product', idx )} + className={{ + wrapper: + 'w-full min-w-52 md:min-w-72 lg:min-w-80', + }} /> @@ -943,7 +947,8 @@ const MovementForm = ({ type = 'add', initialValues }: MovementFormProps) => { } readOnly={type === 'detail'} className={{ - wrapper: 'w-full min-w-48', + wrapper: + 'w-full min-w-52 md:min-w-72 lg:min-w-80', }} /> @@ -1315,12 +1320,6 @@ const MovementForm = ({ type = 'add', initialValues }: MovementFormProps) => { type={type} formik={formik} - editUrl={ - initialValues - ? `/inventory/movement/detail/edit/?movementId=${initialValues.id}` - : undefined - } - onDelete={deleteMovementClickHandler} disableSubmit={hasInvalidQty || hasExceededStock} /> @@ -1336,23 +1335,6 @@ const MovementForm = ({ type = 'add', initialValues }: MovementFormProps) => { )} - - {type !== 'add' && ( - - )} ); };