Added location dropdown selection for Assets view

This commit is contained in:
2025-10-26 09:06:59 +01:00
parent c47d7f2dae
commit 2e8aee2181
4 changed files with 53 additions and 4 deletions

View File

@@ -171,7 +171,9 @@
<div class="col-md-6">
<label class="form-label">@T["Location"]</label>
<input type="text" class="form-control" name="Location" />
<select class="form-select" name="Location" id="createLocationSelect">
<option value="">@T["Select location"]</option>
</select>
</div>
<div class="col-md-6">
<label class="form-label">@T["Owner"]</label>
@@ -373,7 +375,6 @@
<form id="updateAssetForm">
<div class="modal-body">
<div class="row g-3">
<!-- Same fields as in Create -->
<div class="col-md-6">
<label class="form-label">@T["Name"]</label>
<input type="text" class="form-control" name="Name" />
@@ -381,7 +382,9 @@
<div class="col-md-6">
<label class="form-label">@T["Location"]</label>
<input type="text" class="form-control" name="Location" />
<select class="form-select" name="Location" id="updateLocationSelect">
<option value="">@T["Select location"]</option>
</select>
</div>
<div class="col-md-6">
<label class="form-label">@T["Owner"]</label>
@@ -482,7 +485,8 @@ 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();
@@ -754,6 +758,15 @@ 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);
});
});
</script>
<partial name="_Batch"/>

View File

@@ -17,6 +17,12 @@
<link rel="preload" href="~/css/site.css" as="style" onload="this.onload=null;this.rel='stylesheet'">
<noscript><link rel="stylesheet" href="~/css/site.css"></noscript>
<link rel="stylesheet" href="~/Berufsschule_HAM.styles.css" asp-append-version="true" />
<script>
window.appTranslations = {
selectLocation: '@T["Select location"]',
errorLoading: '@T["Error loading locations"]'
};
</script>
</head>
<body data-bs-theme="dark">
<script>