Implemented owner dropdown with Tomselect in Assets view

This commit is contained in:
2025-10-26 11:17:52 +01:00
parent 1ea286cf9c
commit 6a6e641621
3 changed files with 87 additions and 32 deletions

View File

@@ -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');
}
}