Fixed bug: /Home/Inventory modal showing despite invalid Asset Id

This commit is contained in:
2025-10-17 19:49:51 +02:00
parent fefe3a78c3
commit 86d9ce721f

View File

@@ -174,7 +174,6 @@
const modal = new bootstrap.Modal(viewModal); const modal = new bootstrap.Modal(viewModal);
viewContent.innerHTML = '<p class="text-center text-muted">@T["Loading..."]</p>'; viewContent.innerHTML = '<p class="text-center text-muted">@T["Loading..."]</p>';
modal.show();
try { try {
const response = await fetch(`/Assets/Get?cn=${decodedText}`); const response = await fetch(`/Assets/Get?cn=${decodedText}`);
@@ -182,9 +181,12 @@
const asset = json.assetsModel; const asset = json.assetsModel;
if (!asset) { if (!asset) {
viewContent.innerHTML = `<p class="text-danger text-center">@T["Asset not found."]</p>`; const input = document.getElementById("barcodeInput");
input.classList.add("is-invalid");
showToast('@T["Asset not found."]', 'danger');
return; return;
} }
modal.show();
const html = ` const html = `
<div class="row g-3"> <div class="row g-3">
@@ -378,6 +380,11 @@
} }
}); });
} }
document.getElementById("barcodeInput").addEventListener("input", e => {
e.target.classList.remove("is-invalid");
});
</script> </script>
} }