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

@@ -37,7 +37,8 @@ const dataAdvertisementsColumns = [
actionButtons += `
<button class="btn btn-warning me-2 btn-edit"
data-id="${id}"
data-model="${model}">
data-model="${model}"
data-menu="${menuId}">
<i class='bx bx-edit'></i>
</button>`;
}

View File

@@ -6,6 +6,7 @@ document.addEventListener("DOMContentLoaded", function () {
const form = document.querySelector("form#create-update-form");
var authLogo = document.querySelector(".auth-logo");
let menuId = document.getElementById("menuId").value;
console.log(menuId);
if (!saveButton || !form) return;

View File

@@ -28,6 +28,7 @@ console.log(dropzonePreviewNode);
.getAttribute("content")}`,
},
init: function () {
let menuId = document.getElementById("menuId").value;
// Listen for the success event
this.on("success", function (file, response) {
console.log("File successfully uploaded:", file);
@@ -39,7 +40,7 @@ console.log(dropzonePreviewNode);
"Upload Files";
// Tunggu sebentar lalu reload halaman
setTimeout(() => {
window.location.href = "/data/web-advertisements";
window.location.href = `/data/web-advertisements?menu_id=${menuId}`;
}, 2000);
});
// Listen for the error event

View File

@@ -11,6 +11,7 @@ const tableElement = document.getElementById("tourisms-data-table");
const canView = "1";
const canUpdate = tableElement.getAttribute("data-updater") === "1";
const canDelete = tableElement.getAttribute("data-destroyer") === "1";
let menuId = document.getElementById("menuId").value;
const dataTourismsColumns = [
"No",
@@ -32,7 +33,7 @@ const dataTourismsColumns = [
const district = row.cells[4].data;
const long = row.cells[9].data;
const lat = row.cells[10].data;
const model = "data/tourisms";
const model = "data/web-tourisms";
let actionButtons = '<div class="d-flex justify-items-end gap-10">';
let hasPrivilege = false;
@@ -53,7 +54,8 @@ const dataTourismsColumns = [
actionButtons += `
<button class="btn btn-warning me-2 btn-edit"
data-id="${id}"
data-model="${model}">
data-model="${model}"
data-menu="${menuId}">
<i class='bx bx-edit'></i>
</button>`;
}

View File

@@ -5,6 +5,7 @@ document.addEventListener("DOMContentLoaded", function () {
const modalButton = document.querySelector(".btn-modal");
const form = document.querySelector("form#create-update-form");
var authLogo = document.querySelector(".auth-logo");
let menuId = document.getElementById("menuId").value;
if (!saveButton || !form) return;
@@ -73,7 +74,7 @@ document.addEventListener("DOMContentLoaded", function () {
}, 3000);
setTimeout(() => {
window.location.href = "/data/web-tourisms";
window.location.href = `/data/web-tourisms?menu_id=${menuId}`;
}, 3000);
} else {
if (authLogo) {

View File

@@ -28,6 +28,7 @@ console.log(dropzonePreviewNode);
.getAttribute("content")}`,
},
init: function () {
let menuId = document.getElementById("menuId").value;
// Listen for the success event
this.on("success", function (file, response) {
console.log("File successfully uploaded:", file);
@@ -39,7 +40,7 @@ console.log(dropzonePreviewNode);
"Upload Files";
// Tunggu sebentar lalu reload halaman
setTimeout(() => {
window.location.href = "/data/web-tourisms";
window.location.href = `/data/web-tourisms?menu_id=${menuId}`;
}, 2000);
});
// Listen for the error event

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