fix redirect back business or industries
This commit is contained in:
@@ -12,6 +12,8 @@ const spinner = document.getElementById("spinner");
|
||||
const toastNotification = document.getElementById("toastNotification");
|
||||
const toast = new bootstrap.Toast(toastNotification);
|
||||
|
||||
let menuId = document.getElementById("menuId").value;
|
||||
|
||||
(dropzonePreviewNode.id = ""),
|
||||
dropzonePreviewNode &&
|
||||
((previewTemplate = dropzonePreviewNode.parentNode.innerHTML),
|
||||
@@ -34,7 +36,7 @@ const toast = new bootstrap.Toast(toastNotification);
|
||||
response.message;
|
||||
toast.show();
|
||||
setTimeout(() => {
|
||||
window.location.href = "/data/business-industries";
|
||||
window.location.href = `/data/business-industries?menu_id=${menuId}`;
|
||||
}, 2000);
|
||||
});
|
||||
this.on("error", function (file, errorMessage) {
|
||||
|
||||
@@ -35,7 +35,8 @@ class BusinessIndustries {
|
||||
tableContainer.innerHTML = "";
|
||||
let canUpdate = tableContainer.getAttribute("data-updater") === "1";
|
||||
let canDelete = tableContainer.getAttribute("data-destroyer") === "1";
|
||||
|
||||
let menuId = tableContainer.getAttribute("data-menuId");
|
||||
|
||||
// Create a new Grid.js instance only if it doesn't exist
|
||||
this.table = new Grid({
|
||||
columns: [
|
||||
@@ -56,17 +57,16 @@ class BusinessIndustries {
|
||||
{
|
||||
name: "Action",
|
||||
formatter: (cell) => {
|
||||
|
||||
let buttons = `<div class="d-flex justify-content-center gap-2">`;
|
||||
|
||||
|
||||
if (canUpdate) {
|
||||
buttons += `
|
||||
<a href="/data/business-industries/${cell}/edit" class="btn btn-yellow btn-sm d-inline-flex align-items-center justify-content-center">
|
||||
<a href="/data/business-industries/${cell}/edit?menu_id=${menuId}" class="btn btn-yellow btn-sm d-inline-flex align-items-center justify-content-center">
|
||||
<i class='bx bx-edit'></i>
|
||||
</a>
|
||||
`;
|
||||
}
|
||||
|
||||
|
||||
if (canDelete) {
|
||||
buttons += `
|
||||
<button data-id="${cell}" class="btn btn-sm btn-red btn-delete-business-industry d-inline-flex align-items-center justify-content-center">
|
||||
@@ -74,9 +74,9 @@ class BusinessIndustries {
|
||||
</button>
|
||||
`;
|
||||
}
|
||||
|
||||
|
||||
buttons += `</div>`;
|
||||
|
||||
|
||||
return gridjs.html(buttons);
|
||||
},
|
||||
},
|
||||
|
||||
@@ -13,6 +13,8 @@ class UpdateBusinessIndustries {
|
||||
const spinner = document.getElementById("spinner");
|
||||
const toast = new bootstrap.Toast(toastNotification);
|
||||
|
||||
let menuId = document.getElementById("menuId").value;
|
||||
|
||||
if (!submitButton) {
|
||||
console.error("Error: Submit button not found!");
|
||||
return;
|
||||
@@ -53,7 +55,7 @@ class UpdateBusinessIndustries {
|
||||
data.message;
|
||||
toast.show();
|
||||
setTimeout(() => {
|
||||
window.location.href = "/data/business-industries";
|
||||
window.location.href = `/data/business-industries?menu_id=${menuId}`;
|
||||
}, 2000);
|
||||
} else {
|
||||
// Show error toast with message from API
|
||||
|
||||
Reference in New Issue
Block a user