diff --git a/apps/home/static/home/js/tabs/filters.js b/apps/home/static/home/js/tabs/filters.js index c8989d0..8c66c52 100644 --- a/apps/home/static/home/js/tabs/filters.js +++ b/apps/home/static/home/js/tabs/filters.js @@ -1,4 +1,5 @@ const filterTableId = "#filterTable"; +const filterModalId = "#filterFormModal"; // region Init Module @@ -66,3 +67,15 @@ async function loadFilterData() { setTableFilter(filterTableId, "server", selectedServer.id); await loadTableData(filterTableId, "/api/filters/", "GET"); } + + +// region New/Edit Modal + +$(filterTableId).closest('.js-tableBody').siblings('.js-tableFilters').on("click", ".table-new-btn", async function() { + await openDataModal(filterModalId, -1); +}); + +$(filterTableId).on("click", ".edit-modal", async function() { + const id = $(filterTableId).DataTable().row($(this).closest("tr")).data().id; + await openDataModal(filterModalId, id, `/api/filters/${id}/`); +}); diff --git a/apps/home/templates/home/index.html b/apps/home/templates/home/index.html index 0e9ff2d..247e8db 100644 --- a/apps/home/templates/home/index.html +++ b/apps/home/templates/home/index.html @@ -81,15 +81,15 @@