mirror of
https://github.com/LD-Reborn/Berufsschule_HAM.git
synced 2025-12-20 06:51:55 +00:00
Fixed users and locations not filling in in Assets modals
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user