fix redirect back reklame and tourisms

This commit is contained in:
arifal
2025-03-13 15:24:59 +07:00
parent 7787db02a3
commit 0116147e06
14 changed files with 48 additions and 47 deletions

View File

@@ -13,10 +13,10 @@ class GeneralTable {
init() {
const tableContainer = document.getElementById(this.tableId);
// Kosongkan container sebelum render ulang
tableContainer.innerHTML = "";
const table = new Grid({
columns: this.columns,
search: this.options.search || {
@@ -47,7 +47,7 @@ class GeneralTable {
total: (data) => data.meta.total,
},
});
table.render(tableContainer);
this.handleActions();
}
@@ -88,13 +88,15 @@ class GeneralTable {
handleCreate(event) {
// Menggunakan model dan ID untuk membangun URL dinamis
const model = event.target.getAttribute("data-model"); // Mengambil model dari data-model
window.location.href = `${this.baseUrl}/${model}/create`;
let menuId = event.target.getAttribute("data-menu");
window.location.href = `${this.baseUrl}/${model}/create?menu_id=${menuId}`;
}
handleBulkCreate(event) {
// Menggunakan model dan ID untuk membangun URL dinamis
const model = event.target.getAttribute("data-model");
window.location.href = `${this.baseUrl}/${model}/bulk-create`;
let menuId = event.target.getAttribute("data-menu");
window.location.href = `${this.baseUrl}/${model}/bulk-create?menu_id=${menuId}`;
}
// Fungsi untuk menangani edit
@@ -103,7 +105,8 @@ class GeneralTable {
const model = event.target.getAttribute("data-model"); // Mengambil model dari data-model
console.log("Editing record with ID:", id);
// Menggunakan model dan ID untuk membangun URL dinamis
window.location.href = `${this.baseUrl}/${model}/${id}/edit`;
let menuId = event.target.getAttribute("data-menu");
window.location.href = `${this.baseUrl}/${model}/${id}/edit?menu_id=${menuId}`;
}
// Fungsi untuk menangani delete