mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-20 13:32:00 +00:00
refactor(FE-208,212): initialize items in PurchaseRequestForm with initial values
This commit is contained in:
@@ -140,5 +140,29 @@ export const getPurchaseRequestFormInitialValues = (
|
||||
: null,
|
||||
location_id: initialValues?.location?.id ?? undefined,
|
||||
notes: initialValues?.notes ?? null,
|
||||
items: [],
|
||||
items: initialValues?.items?.length ? initialValues.items.map((item) => ({
|
||||
warehouse: item.warehouse
|
||||
? {
|
||||
value: item.warehouse.id,
|
||||
label: item.warehouse.name,
|
||||
}
|
||||
: null,
|
||||
warehouse_id: item.warehouse?.id ?? 0,
|
||||
product: item.product
|
||||
? {
|
||||
value: item.product.id,
|
||||
label: item.product.name,
|
||||
}
|
||||
: null,
|
||||
product_id: item.product?.id ?? 0,
|
||||
qty: item.qty ?? 0,
|
||||
})) : [
|
||||
{
|
||||
warehouse: null,
|
||||
warehouse_id: 0,
|
||||
product: null,
|
||||
product_id: 0,
|
||||
qty: 0,
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user