From 50786cf41fbdfb74008143561ad6f93fdcb0c64a Mon Sep 17 00:00:00 2001 From: Yaro Kasear Date: Wed, 23 Jul 2025 12:48:11 -0500 Subject: [PATCH] Refactor user form to replace select elements with dropdown rendering for supervisor and location, enhancing consistency and maintainability. --- inventory/templates/user.html | 41 +++++++++++++++-------------------- 1 file changed, 17 insertions(+), 24 deletions(-) diff --git a/inventory/templates/user.html b/inventory/templates/user.html index 568824a..c2ccab2 100644 --- a/inventory/templates/user.html +++ b/inventory/templates/user.html @@ -12,8 +12,8 @@ active: document.querySelector("input[name='activeCheck']").checked, last_name: document.querySelector("input[name='lastName']").value, first_name: document.querySelector("input[name='firstName']").value, - supervisor_id: parseInt(document.querySelector("select[name='supervisor']").value) || null, - location_id: parseInt(document.querySelector("select[name='location']").value) || null + supervisor_id: parseInt(document.querySelector("input[name='supervisor']").value) || null, + location_id: parseInt(document.querySelector("input[name='location']").value) || null }; try { @@ -97,31 +97,24 @@
- - + {{ dropdowns.render_dropdown( + id='supervisor', + list=users, + label='Supervisor', + current_item=user.supervisor if user.supervisor else None, + entry_link='user', + enabled=user.active + ) }}
- - + {{ dropdowns.render_dropdown( + id='location', + list=rooms, + label='Location', + current_item=user.location if user.location else None, + enabled=user.active + ) }}