mirror of
https://github.com/LD-Reborn/Berufsschule_HAM.git
synced 2025-12-20 06:51:55 +00:00
Fixed bug: /Home/Inventory modal showing despite invalid Asset Id
This commit is contained in:
@@ -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>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user