From 97dc3b6286ba472144fd38395570fddb63510fa9 Mon Sep 17 00:00:00 2001 From: "vamsi.balaga" Date: Wed, 28 Oct 2026 12:31:39 +0530 Subject: [PATCH] fix: show Asset Brand and Location first on the Add Asset form Co-Authored-By: Claude Opus 5.5 --- src/pages/assets/AddAssetModal.jsx | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/pages/assets/AddAssetModal.jsx b/src/pages/assets/AddAssetModal.jsx index 91c8d05..4883cba 100644 --- a/src/pages/assets/AddAssetModal.jsx +++ b/src/pages/assets/AddAssetModal.jsx @@ -12,10 +12,18 @@ import { import { emptyValues, validateActivity } from '../../api/activityForm' import { useAuth } from '../../store/AuthContext' +// Asset Brand and Asset Location come first, as on the Edit form; the rest +// keep the builder's order. +const FIRST_FIELDS = ['field_59', 'field_61'] +const FORM_FIELDS = [ + ...FIRST_FIELDS.map((id) => ASSET_FIELDS.find((f) => f.id === id)), + ...ASSET_FIELDS.filter((f) => !FIRST_FIELDS.includes(f.id)), +] + // Asset Owner sits after Condition, as in the builder. -const OWNER_AFTER = ASSET_FIELDS.findIndex((f) => f.id === 'field_47') + 1 -const FIELDS_BEFORE_OWNER = ASSET_FIELDS.slice(0, OWNER_AFTER) -const FIELDS_AFTER_OWNER = ASSET_FIELDS.slice(OWNER_AFTER) +const OWNER_AFTER = FORM_FIELDS.findIndex((f) => f.id === 'field_47') + 1 +const FIELDS_BEFORE_OWNER = FORM_FIELDS.slice(0, OWNER_AFTER) +const FIELDS_AFTER_OWNER = FORM_FIELDS.slice(OWNER_AFTER) const upload = (fieldId, file) => uploadAssetFile(ASSET_INIT_ACTIVITY_ID, fieldId, file)