diff --git a/apps/home/static/home/js/tabs/filters.js b/apps/home/static/home/js/tabs/filters.js
index 553f3e0..166f131 100644
--- a/apps/home/static/home/js/tabs/filters.js
+++ b/apps/home/static/home/js/tabs/filters.js
@@ -69,6 +69,62 @@ async function loadFilterData() {
await loadTableData(filterTableId, "/api/filters/", "GET");
}
+// Table Delete Btns
+
+$(filterModalId).find(".modal-del-btn").on("click", async function() {
+ $(filterModalId).modal("hide");
+
+ const id = parseInt($(filterModalId).data("primary-key"));
+ const filter = $(filterTableId).DataTable().row((idx, row) => { return row.id === id }).data();
+ const name = sanitise(filter.name);
+
+ await confirmationModal(
+ `Delete a Content Filter`,
+ `Do you wish to permanently delete ${name}?`,
+ "danger",
+ "bi-trash3",
+ async () => {
+ await ajaxRequest(`/api/filters/${filter.id}/`, "DELETE");
+ setTimeout(async () => {
+ $(filterTableId).trigger("doDataLoad");
+ await loadSubModalOptions(
+ $(subModalId).find('[data-field="filters"]'),
+ `/api/filters/?server=${selectedServer.id}`
+ );
+ }, 600);
+ },
+ () => { $(filterModalId).modal("show") }
+ );
+})
+
+getTableFiltersComponent(filterTableId).find(".table-del-btn").on("click", async function() {
+ const rows = getSelectedTableRows(filterTableId);
+ const isMany = rows.length > 1;
+ const names = rows.map(row => row.name);
+ const namesString = arrayToHtmlList(names, true).prop("outerHTML");
+
+ await confirmationModal(
+ `Delete ${isMany ? "Many Content Filters" : "a Content Filter"}`,
+ `Do you wish to permanently delete ${isMany ? "these" : "this"} ${names.length} content filter${isMany ? "s" : ""}?
${namesString}`,
+ "danger",
+ "bi-trash3",
+ async () => {
+ rows.forEach(async row => {
+ await ajaxRequest(`/api/filters/${row.id}/`, "DELETE");
+ });
+
+ setTimeout(async () => {
+ $(filterTableId).trigger("doDataLoad");
+ await loadSubModalOptions(
+ $(subModalId).find('[data-field="filters"]'),
+ `/api/filters/?server=${selectedServer.id}`
+ );
+ }, 600);
+ },
+ null
+ )
+});
+
// region New/Edit Modal