create redirect link for dashboard pimpinan
This commit is contained in:
@@ -34,11 +34,42 @@ class PbgTasks {
|
||||
pbgType: "berita_acara",
|
||||
bindFlag: "uploadHandlerBoundBeritaAcara",
|
||||
});
|
||||
this.initTableRequestAssignment();
|
||||
this.handleFilterDatatable();
|
||||
this.handleSendNotification();
|
||||
}
|
||||
|
||||
initTableRequestAssignment() {
|
||||
handleFilterDatatable() {
|
||||
const form = document.getElementById("filter-form");
|
||||
const filterSelect = document.getElementById("filter-select");
|
||||
|
||||
const urlParams = new URLSearchParams(window.location.search);
|
||||
const initialFilter = urlParams.get("filter") || "";
|
||||
|
||||
this.initTableRequestAssignment(initialFilter); // Initial load with query param
|
||||
|
||||
form.addEventListener("submit", (e) => {
|
||||
e.preventDefault();
|
||||
|
||||
const selectedFilter = filterSelect.value;
|
||||
|
||||
const params = new URLSearchParams(window.location.search);
|
||||
params.set("filter", selectedFilter);
|
||||
|
||||
// Update the URL without reloading
|
||||
window.history.replaceState(
|
||||
{},
|
||||
"",
|
||||
`${location.pathname}?${params}`
|
||||
);
|
||||
|
||||
// Call the method again with the selected filter
|
||||
this.initTableRequestAssignment(selectedFilter);
|
||||
});
|
||||
}
|
||||
|
||||
initTableRequestAssignment(filterValue = "") {
|
||||
const urlBase = `${GlobalConfig.apiHost}/api/request-assignments`;
|
||||
|
||||
// Ambil token
|
||||
const token = document
|
||||
.querySelector('meta[name="api-token"]')
|
||||
@@ -124,7 +155,10 @@ class PbgTasks {
|
||||
],
|
||||
search: {
|
||||
server: {
|
||||
url: (prev, keyword) => `${prev}?search=${keyword}`,
|
||||
url: (prev, keyword) =>
|
||||
`${prev}${
|
||||
prev.includes("?") ? "&" : "?"
|
||||
}search=${keyword}`,
|
||||
},
|
||||
debounceTimeout: 1000,
|
||||
},
|
||||
@@ -139,7 +173,7 @@ class PbgTasks {
|
||||
},
|
||||
sort: true,
|
||||
server: {
|
||||
url: `${GlobalConfig.apiHost}/api/request-assignments`,
|
||||
url: `${urlBase}?filter=${filterValue}`,
|
||||
credentials: "include",
|
||||
headers: {
|
||||
Authorization: `Bearer ${token}`,
|
||||
|
||||
Reference in New Issue
Block a user