Refactor inventory and layout templates: streamline script handling and improve toast message display
This commit is contained in:
parent
ebd2060fd8
commit
3492358645
3 changed files with 94 additions and 91 deletions
|
@ -130,17 +130,9 @@
|
|||
{% endblock %}
|
||||
|
||||
{% block script %}
|
||||
document.addEventListener("DOMContentLoaded", () => {
|
||||
const saveButton = document.getElementById("saveButton");
|
||||
const deleteButton = document.getElementById("deleteButton");
|
||||
|
||||
const toastData = localStorage.getItem("toastMessage");
|
||||
if (toastData) {
|
||||
const { message, type } = JSON.parse(toastData);
|
||||
renderToast({ message, type });
|
||||
localStorage.removeItem("toastMessage");
|
||||
}
|
||||
|
||||
if (saveButton) {
|
||||
saveButton.addEventListener("click", async (e) => {
|
||||
e.preventDefault();
|
||||
|
@ -228,5 +220,4 @@
|
|||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
{% endblock %}
|
|
@ -78,7 +78,16 @@
|
|||
searchInput.addEventListener('input', () => {
|
||||
searchButton.disabled = searchInput.value.trim() === '';
|
||||
});
|
||||
|
||||
document.addEventListener("DOMContentLoaded", () => {
|
||||
const toastData = localStorage.getItem("toastMessage");
|
||||
if (toastData) {
|
||||
const { message, type } = JSON.parse(toastData);
|
||||
renderToast({ message, type });
|
||||
localStorage.removeItem("toastMessage");
|
||||
}
|
||||
{% block script %} {% endblock %}
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
|
|
|
@ -12,3 +12,6 @@
|
|||
|
||||
{{ tables.render_table(headers=header, rows=rows, id='table', entry_route=entry_route) }}
|
||||
{% endblock %}
|
||||
|
||||
{% block script %}
|
||||
{% endblock %}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue