fix menu with parent data and remove action google sheet not available feature
This commit is contained in:
@@ -41,8 +41,8 @@ class GoogleSheets {
|
||||
tableContainer.innerHTML = "";
|
||||
|
||||
// Get user permissions from data attributes
|
||||
let canUpdate = tableContainer.getAttribute("data-updater") === "1";
|
||||
let canDelete = tableContainer.getAttribute("data-destroyer") === "1";
|
||||
// let canUpdate = tableContainer.getAttribute("data-updater") === "1";
|
||||
// let canDelete = tableContainer.getAttribute("data-destroyer") === "1";
|
||||
|
||||
this.table = new Grid({
|
||||
columns: [
|
||||
@@ -65,25 +65,25 @@ class GoogleSheets {
|
||||
</a>
|
||||
`;
|
||||
|
||||
if (canUpdate) {
|
||||
buttons += `
|
||||
<a href="#" class="btn btn-yellow btn-sm d-inline-flex align-items-center justify-content-center">
|
||||
<i class='bx bx-edit'></i>
|
||||
</a>
|
||||
`;
|
||||
}
|
||||
// if (canUpdate) {
|
||||
// buttons += `
|
||||
// <a href="#" 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-google-sheet d-inline-flex align-items-center justify-content-center">
|
||||
<i class='bx bxs-trash'></i>
|
||||
</button>
|
||||
`;
|
||||
}
|
||||
// if (canDelete) {
|
||||
// buttons += `
|
||||
// <button data-id="${cell}" class="btn btn-sm btn-red btn-delete-google-sheet d-inline-flex align-items-center justify-content-center">
|
||||
// <i class='bx bxs-trash'></i>
|
||||
// </button>
|
||||
// `;
|
||||
// }
|
||||
|
||||
if (!canUpdate && !canDelete) {
|
||||
buttons = `<span class="text-muted">No Privilege</span>`;
|
||||
}
|
||||
// if (!canUpdate && !canDelete) {
|
||||
// buttons = `<span class="text-muted">No Privilege</span>`;
|
||||
// }
|
||||
|
||||
return gridjs.html(
|
||||
`<div class="d-flex justify-content-center gap-2">${buttons}</div>`
|
||||
|
||||
@@ -39,7 +39,7 @@ class Menus {
|
||||
"Name",
|
||||
"Url",
|
||||
"Icon",
|
||||
"ParentID",
|
||||
"Parent Name",
|
||||
"Sort Order",
|
||||
{
|
||||
name: "Action",
|
||||
@@ -97,16 +97,22 @@ class Menus {
|
||||
.getAttribute("content")}`,
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
then: (data) =>
|
||||
data.data.map((item) => [
|
||||
item.id,
|
||||
item.name,
|
||||
item.url,
|
||||
item.icon,
|
||||
item.parent_id,
|
||||
item.sort_order,
|
||||
item.id,
|
||||
]),
|
||||
then: (data) => {
|
||||
console.log("Full API Response:", data); // Log the full response
|
||||
|
||||
return data.data.map((item, index) => {
|
||||
console.log(`Item ${index + 1}:`, item); // Log each item
|
||||
return [
|
||||
item.id,
|
||||
item.name,
|
||||
item.url,
|
||||
item.icon,
|
||||
item.parent?.name,
|
||||
item.sort_order,
|
||||
item.id,
|
||||
];
|
||||
});
|
||||
},
|
||||
total: (data) => data.total,
|
||||
},
|
||||
}).render(tableContainer);
|
||||
|
||||
@@ -15,9 +15,9 @@
|
||||
<div class="card w-100">
|
||||
<div class="card-body">
|
||||
<div class="d-flex flex-wrap justify-content-end align-items-center mb-2">
|
||||
@if ($user_menu_permission['allow_create'])
|
||||
<!-- @if ($user_menu_permission['allow_create'])
|
||||
<a href="#" class="btn btn-success btn-sm d-block d-sm-inline w-auto">Create</a>
|
||||
@endif
|
||||
@endif -->
|
||||
</div>
|
||||
<div id="table-data-google-sheets"
|
||||
data-updater="{{ $user_menu_permission['allow_update'] }}"
|
||||
|
||||
Reference in New Issue
Block a user