add status spatial plannings
This commit is contained in:
@@ -535,16 +535,14 @@ class BigData {
|
||||
});
|
||||
}
|
||||
initChartNonBusinessDLH() {
|
||||
document
|
||||
.querySelectorAll("#non-business-dlh-count")
|
||||
.forEach((element) => {
|
||||
const count = this.safeGet(
|
||||
this.resumeBigData,
|
||||
"non_business_dlh_count",
|
||||
0
|
||||
);
|
||||
element.innerText = `${count}`;
|
||||
});
|
||||
document.querySelectorAll("#business-dlh-count").forEach((element) => {
|
||||
const count = this.safeGet(
|
||||
this.resumeBigData,
|
||||
"business_dlh_count",
|
||||
0
|
||||
);
|
||||
element.innerText = `${count}`;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ import gridjs from "gridjs/dist/gridjs.umd.js";
|
||||
import "gridjs/dist/gridjs.umd.js";
|
||||
import GlobalConfig, { addThousandSeparators } from "../../global-config.js";
|
||||
import GeneralTable from "../../table-generator.js";
|
||||
import moment from "moment";
|
||||
|
||||
// Ambil hak akses dari data-attribute
|
||||
const tableElement = document.getElementById("spatial-planning-data-table");
|
||||
@@ -15,7 +16,11 @@ const dataSpatialPlanningColumns = [
|
||||
"Nama",
|
||||
"KBLI",
|
||||
"Kegiatan",
|
||||
"Luas",
|
||||
"Luas Lahan",
|
||||
"BCR",
|
||||
"Jenis Usaha",
|
||||
"Status Terbit",
|
||||
"Retribusi",
|
||||
"Lokasi",
|
||||
"Nomor",
|
||||
"Tanggal",
|
||||
@@ -23,7 +28,7 @@ const dataSpatialPlanningColumns = [
|
||||
name: "Actions",
|
||||
widht: "120px",
|
||||
formatter: function (cell, row) {
|
||||
const id = row.cells[8].data;
|
||||
const id = row.cells[12].data;
|
||||
const model = "data/web-spatial-plannings";
|
||||
|
||||
let actionButtons = '<div class="d-flex justify-items-end gap-10">';
|
||||
@@ -73,15 +78,27 @@ document.addEventListener("DOMContentLoaded", () => {
|
||||
|
||||
table.processData = function (data) {
|
||||
return data.data.map((item) => {
|
||||
// Format retribution amount
|
||||
const retributionAmount = item.calculated_retribution
|
||||
? addThousandSeparators(item.calculated_retribution)
|
||||
: "0";
|
||||
|
||||
// Format business type
|
||||
const businessType = item.is_business_type ? "USAHA" : "NON USAHA";
|
||||
|
||||
return [
|
||||
item.no,
|
||||
item.name,
|
||||
item.kbli,
|
||||
item.activities,
|
||||
addThousandSeparators(item.area),
|
||||
addThousandSeparators(item.land_area || item.area),
|
||||
addThousandSeparators(item.site_bcr),
|
||||
`${businessType}`,
|
||||
item.is_terbit ? "Sudah Terbit" : "Belum Terbit",
|
||||
`${retributionAmount}`,
|
||||
item.location,
|
||||
item.number,
|
||||
item.date,
|
||||
moment(item.date).format("YYYY-MM-DD"),
|
||||
item.id,
|
||||
];
|
||||
});
|
||||
|
||||
@@ -9,6 +9,9 @@ document.addEventListener("DOMContentLoaded", function () {
|
||||
|
||||
if (!saveButton || !form) return;
|
||||
|
||||
// Initialize is_terbit toggle
|
||||
initIsTerbitToggle();
|
||||
|
||||
saveButton.addEventListener("click", function () {
|
||||
// Disable tombol dan tampilkan spinner
|
||||
modalButton.disabled = true;
|
||||
@@ -29,6 +32,12 @@ document.addEventListener("DOMContentLoaded", function () {
|
||||
data[key] = value;
|
||||
});
|
||||
|
||||
// Handle checkbox properly - ensure boolean value is sent
|
||||
const isTerbitCheckbox = document.getElementById("is_terbit");
|
||||
if (isTerbitCheckbox) {
|
||||
data["is_terbit"] = isTerbitCheckbox.checked ? 1 : 0;
|
||||
}
|
||||
|
||||
const url = form.getAttribute("action");
|
||||
|
||||
const method = isEdit ? "PUT" : "POST";
|
||||
@@ -183,4 +192,29 @@ document.addEventListener("DOMContentLoaded", function () {
|
||||
document.querySelector(".btn-back").addEventListener("click", function () {
|
||||
window.history.back();
|
||||
});
|
||||
|
||||
// Function to handle is_terbit toggle
|
||||
function initIsTerbitToggle() {
|
||||
const checkbox = document.getElementById("is_terbit");
|
||||
const statusText = document.querySelector(".status-text");
|
||||
const statusDescription = statusText?.nextElementSibling;
|
||||
|
||||
if (checkbox && statusText) {
|
||||
checkbox.addEventListener("change", function () {
|
||||
if (this.checked) {
|
||||
statusText.textContent = "Sudah Terbit";
|
||||
if (statusDescription) {
|
||||
statusDescription.textContent =
|
||||
"Status PBG sudah diterbitkan";
|
||||
}
|
||||
} else {
|
||||
statusText.textContent = "Belum Terbit";
|
||||
if (statusDescription) {
|
||||
statusDescription.textContent =
|
||||
"Status PBG belum diterbitkan";
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user