Fixed users and locations not filling in in Assets modals

This commit is contained in:
2025-10-26 11:45:01 +01:00
parent 2c0ae9f5e9
commit dc5e117c93
2 changed files with 50 additions and 25 deletions

View File

@@ -489,13 +489,16 @@ document.addEventListener('DOMContentLoaded', () => {
updateAttributesContainer.innerHTML = '';
updateForm.reset();
const locationSelect = updateForm.querySelector('#updateLocationSelect');
await loadLocationsIntoSelect(locationSelect);
try {
const response = await fetch(`/Assets/Get?cn=${assetId}`);
const responseJson = await response.json();
const asset = responseJson.assetsModel;
const locationSelect = updateForm.querySelector('#updateLocationSelect');
await loadLocationsIntoSelect(locationSelect, asset.Location);
const usersSelect = updateForm.querySelector('#updateUsersSelect');
await loadUsersIntoSelect(usersSelect, asset.Owner);
for (const [key, value] of Object.entries(asset)) {
const input = updateForm.querySelector(`[name="${key}"]`);
if (input) input.value = value;