mirror of
https://github.com/LD-Reborn/Berufsschule_HAM.git
synced 2025-12-20 06:51:55 +00:00
Implemented owner dropdown with Tomselect in Assets view
This commit is contained in:
@@ -137,6 +137,29 @@ async function loadLocationsIntoSelect(selectElement, selectedValue = null) {
|
||||
});
|
||||
} catch (err) {
|
||||
console.error('Error loading locations:', err);
|
||||
showToast(appTranslations.errorLoading, 'danger');
|
||||
showToast(appTranslations.errorLoadingLocations, 'danger');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async function loadUsersIntoSelect(selectElement, selectedValue = null) {
|
||||
try {
|
||||
const response = await fetch('/Users/Index?Cn=false&Sn=false&Title=false&Description=false&JpegPhoto=false&UserPassword=false');
|
||||
const users = await response.json();
|
||||
|
||||
selectElement.innerHTML = `<option value="">${appTranslations.selectUser}</option>`;
|
||||
|
||||
users.forEach(usr => {
|
||||
const text = usr.uid;
|
||||
const option = document.createElement('option');
|
||||
option.value = usr.uid;
|
||||
option.textContent = text;
|
||||
if (selectedValue && selectedValue === usr.uid) {
|
||||
option.selected = true;
|
||||
}
|
||||
selectElement.appendChild(option);
|
||||
});
|
||||
} catch (err) {
|
||||
console.error('Error loading users:', err);
|
||||
showToast(appTranslations.errorLoadingUsers, 'danger');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user