diff --git a/src/Views/Home/Assets.cshtml b/src/Views/Home/Assets.cshtml
index 0b5cf94..4a20bd6 100644
--- a/src/Views/Home/Assets.cshtml
+++ b/src/Views/Home/Assets.cshtml
@@ -5,7 +5,7 @@
@{
ViewData["Title"] = T["Assets"];
}
-
+
@@ -179,9 +179,10 @@
-
+
-
@@ -390,9 +391,10 @@
-
+
-
@@ -764,38 +766,66 @@ document.addEventListener('DOMContentLoaded', () => {
document.addEventListener('DOMContentLoaded', () => {
const createModal = document.getElementById('createAssetModal');
createModal.addEventListener('show.bs.modal', async () => {
- const select = createModal.querySelector('#createLocationSelect');
- await loadLocationsIntoSelect(select);
+ const selectLocations = createModal.querySelector('#createLocationSelect');
+ await loadLocationsIntoSelect(selectLocations);
+ const selectUsers = createModal.querySelector('#createUsersSelect');
+ await loadUsersIntoSelect(selectUsers);
});
});
-
+
diff --git a/src/Views/Shared/_Layout.cshtml b/src/Views/Shared/_Layout.cshtml
index 0611bc7..fd97d68 100644
--- a/src/Views/Shared/_Layout.cshtml
+++ b/src/Views/Shared/_Layout.cshtml
@@ -20,7 +20,9 @@
diff --git a/src/wwwroot/js/site.js b/src/wwwroot/js/site.js
index 1d0fcb1..dfad9b8 100644
--- a/src/wwwroot/js/site.js
+++ b/src/wwwroot/js/site.js
@@ -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');
}
-}
\ No newline at end of file
+}
+
+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 = ``;
+
+ 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');
+ }
+}