fix pdam redirect back and advertisement partial update redirect
This commit is contained in:
@@ -8,6 +8,7 @@ import GeneralTable from "../../table-generator.js";
|
||||
const tableElement = document.getElementById("reklame-data-table");
|
||||
const canUpdate = tableElement.getAttribute("data-updater") === "1";
|
||||
const canDelete = tableElement.getAttribute("data-destroyer") === "1";
|
||||
let menuId = document.getElementById("menuId").value;
|
||||
|
||||
const dataAdvertisementsColumns = [
|
||||
"No",
|
||||
@@ -23,13 +24,13 @@ const dataAdvertisementsColumns = [
|
||||
{
|
||||
name: "Actions",
|
||||
width: "120px",
|
||||
formatter: function(cell, row) {
|
||||
formatter: function (cell, row) {
|
||||
const id = row.cells[10].data;
|
||||
const model = "data/advertisements";
|
||||
|
||||
const model = `data/web-advertisements`;
|
||||
|
||||
let actionButtons = '<div class="d-flex justify-items-end gap-10">';
|
||||
let hasPrivilege = false;
|
||||
|
||||
|
||||
// Tampilkan tombol Edit jika user punya akses update
|
||||
if (canUpdate) {
|
||||
hasPrivilege = true;
|
||||
@@ -40,7 +41,7 @@ const dataAdvertisementsColumns = [
|
||||
<i class='bx bx-edit'></i>
|
||||
</button>`;
|
||||
}
|
||||
|
||||
|
||||
// Tampilkan tombol Delete jika user punya akses delete
|
||||
if (canDelete) {
|
||||
hasPrivilege = true;
|
||||
@@ -50,13 +51,17 @@ const dataAdvertisementsColumns = [
|
||||
<i class='bx bxs-trash'></i>
|
||||
</button>`;
|
||||
}
|
||||
|
||||
actionButtons += '</div>';
|
||||
|
||||
|
||||
actionButtons += "</div>";
|
||||
|
||||
// Jika tidak memiliki akses, tampilkan teks "No Privilege"
|
||||
return gridjs.html(hasPrivilege ? actionButtons : '<span class="text-muted">No Privilege</span>');
|
||||
}
|
||||
}
|
||||
return gridjs.html(
|
||||
hasPrivilege
|
||||
? actionButtons
|
||||
: '<span class="text-muted">No Privilege</span>'
|
||||
);
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
document.addEventListener("DOMContentLoaded", () => {
|
||||
@@ -86,4 +91,4 @@ document.addEventListener("DOMContentLoaded", () => {
|
||||
};
|
||||
|
||||
table.init();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -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 () {
|
||||
}, 2000);
|
||||
|
||||
setTimeout(() => {
|
||||
window.location.href = "/data/web-advertisements";
|
||||
window.location.href = `/data/web-advertisements?menu_id=${menuId}`;
|
||||
}, 1000);
|
||||
} else {
|
||||
if (authLogo) {
|
||||
|
||||
Reference in New Issue
Block a user