partial update add env for setting api url from env, partial update detail pbg, add tata ruang for dashboard pimpinan, fix service sync simbg add unique for prasarana table
This commit is contained in:
@@ -1,9 +1,8 @@
|
||||
|
||||
import bootstrap from 'bootstrap/dist/js/bootstrap'
|
||||
import bootstrap from "bootstrap/dist/js/bootstrap";
|
||||
window.bootstrap = bootstrap;
|
||||
import 'iconify-icon';
|
||||
import 'simplebar/dist/simplebar'
|
||||
|
||||
import "iconify-icon";
|
||||
import "simplebar/dist/simplebar";
|
||||
|
||||
class Components {
|
||||
initBootstrapComponents() {
|
||||
[...document.querySelectorAll('[data-bs-toggle="popover"]')].map(
|
||||
|
||||
@@ -10,6 +10,7 @@ class BigData {
|
||||
this.dataNonVerification = await this.getDataNonVerfication();
|
||||
this.dataBusiness = await this.getDataBusiness();
|
||||
this.dataNonBusiness = await this.getDataNonBusiness();
|
||||
this.dataTataRuang = await this.getDataTataRuang();
|
||||
|
||||
// total potensi
|
||||
this.bigTargetPAD = new Big(this.totalTargetPAD ?? 0);
|
||||
@@ -26,6 +27,16 @@ class BigData {
|
||||
}
|
||||
}
|
||||
|
||||
// tata ruang
|
||||
this.bigTotalTataRuang = new Big(this.dataTataRuang);
|
||||
this.percentageResultTataRuang =
|
||||
this.bigTotalTataRuang <= 0 || this.bigTotalPotensi <= 0
|
||||
? 0
|
||||
: this.bigTotalTataRuang
|
||||
.div(this.bigTotalPotensi)
|
||||
.times(100)
|
||||
.toFixed(2);
|
||||
|
||||
// kekurangan potensi
|
||||
this.totalKekuranganPotensi = new Big(
|
||||
this.totalTargetPAD - this.bigTotalPotensi
|
||||
@@ -154,7 +165,7 @@ class BigData {
|
||||
return data.data[0].value;
|
||||
} catch (error) {
|
||||
console.error("Error fetching chart data:", error);
|
||||
return null;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -185,7 +196,7 @@ class BigData {
|
||||
};
|
||||
} catch (error) {
|
||||
console.error("Error fetching chart data:", error);
|
||||
return null;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -216,7 +227,7 @@ class BigData {
|
||||
};
|
||||
} catch (error) {
|
||||
console.error("Error fetching chart data:", error);
|
||||
return null;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -247,7 +258,7 @@ class BigData {
|
||||
};
|
||||
} catch (error) {
|
||||
console.error("Error fetching chart data:", error);
|
||||
return null;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -278,52 +289,55 @@ class BigData {
|
||||
};
|
||||
} catch (error) {
|
||||
console.error("Error fetching chart data:", error);
|
||||
return null;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
async getDataTataRuang() {
|
||||
try {
|
||||
const response = await fetch(
|
||||
`${GlobalConfig.apiHost}/api/api-data-settings?search=tata_ruang`,
|
||||
{
|
||||
credentials: "include",
|
||||
headers: {
|
||||
Authorization: `Bearer ${
|
||||
document.querySelector("meta[name='api-token']")
|
||||
.content
|
||||
}`,
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
if (!response.ok) {
|
||||
console.error("Network response was not ok", response);
|
||||
}
|
||||
|
||||
const data = await response.json();
|
||||
return data.data[0].value;
|
||||
} catch (error) {
|
||||
console.error("Error fetching chart data:", error);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
initChartTargetPAD() {
|
||||
let totalPad = 0;
|
||||
fetch(
|
||||
`${GlobalConfig.apiHost}/api/api-data-settings?search=target_pad`,
|
||||
{
|
||||
credentials: "include",
|
||||
headers: {
|
||||
Authorization: `Bearer ${
|
||||
document.querySelector("meta[name='api-token']").content
|
||||
}`,
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
}
|
||||
)
|
||||
.then((response) => {
|
||||
if (!response.ok) {
|
||||
throw new Error("Network response was not ok");
|
||||
}
|
||||
return response.json();
|
||||
})
|
||||
.then((data) => {
|
||||
totalPad = data.data[0].value;
|
||||
document
|
||||
.querySelectorAll(".document-count.chart-target-pad")
|
||||
.forEach((element) => {
|
||||
element.innerText = ``;
|
||||
});
|
||||
document
|
||||
.querySelectorAll(".document-total.chart-target-pad")
|
||||
.forEach((element) => {
|
||||
element.innerText = `Rp.${addThousandSeparators(
|
||||
totalPad
|
||||
)}`;
|
||||
});
|
||||
document
|
||||
.querySelectorAll(".small-percentage.chart-target-pad")
|
||||
.forEach((element) => {
|
||||
element.innerText = `${100}%`;
|
||||
});
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error("Error fetching target_pad:", error);
|
||||
document
|
||||
.querySelectorAll(".document-count.chart-target-pad")
|
||||
.forEach((element) => {
|
||||
element.innerText = ``;
|
||||
});
|
||||
document
|
||||
.querySelectorAll(".document-total.chart-target-pad")
|
||||
.forEach((element) => {
|
||||
element.innerText = `Rp.${addThousandSeparators(
|
||||
this.bigTargetPAD.toString()
|
||||
)}`;
|
||||
});
|
||||
document
|
||||
.querySelectorAll(".small-percentage.chart-target-pad")
|
||||
.forEach((element) => {
|
||||
element.innerText = `${100}%`;
|
||||
});
|
||||
}
|
||||
initChartTotalPotensi() {
|
||||
@@ -503,17 +517,19 @@ class BigData {
|
||||
document
|
||||
.querySelectorAll(".document-count.chart-potensi-tata-ruang")
|
||||
.forEach((element) => {
|
||||
element.innerText = `${0}`;
|
||||
element.innerText = "";
|
||||
});
|
||||
document
|
||||
.querySelectorAll(".document-total.chart-potensi-tata-ruang")
|
||||
.forEach((element) => {
|
||||
element.innerText = `Rp.${addThousandSeparators("0.00")}`;
|
||||
element.innerText = `Rp.${addThousandSeparators(
|
||||
this.bigTotalTataRuang.toString()
|
||||
)}`;
|
||||
});
|
||||
document
|
||||
.querySelectorAll(".small-percentage.chart-potensi-tata-ruang")
|
||||
.forEach((element) => {
|
||||
element.innerText = `0.00%`;
|
||||
element.innerText = `${this.percentageResultTataRuang}%`;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
const GlobalConfig = {
|
||||
apiHost: "http://147.93.121.38",
|
||||
};
|
||||
|
||||
export default GlobalConfig;
|
||||
export default GlobalConfig = window.GlobalConfig;
|
||||
|
||||
export function addThousandSeparators(value, fractionDigits = 2) {
|
||||
if (!value) return null; // Handle empty or null values
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { Grid } from "gridjs/dist/gridjs.umd.js";
|
||||
import "gridjs/dist/gridjs.umd.js";
|
||||
import gridjs from "gridjs/dist/gridjs.umd.js";
|
||||
import GlobalConfig from "../global-config";
|
||||
|
||||
class PbgTasks {
|
||||
@@ -19,7 +20,17 @@ class PbgTasks {
|
||||
"Status",
|
||||
"Function Type",
|
||||
"Consultation Type",
|
||||
{ name: "Due Date", width: "7%" },
|
||||
{ name: "Due Date", width: "10%" },
|
||||
{
|
||||
name: "Action",
|
||||
formatter: function (cell) {
|
||||
return gridjs.html(`
|
||||
<div class="d-flex justify-items-end gap-10">
|
||||
<a href="/pbg-task/${cell}" class="btn btn-yellow">Detail</a
|
||||
</div>
|
||||
`);
|
||||
},
|
||||
},
|
||||
],
|
||||
search: {
|
||||
server: {
|
||||
@@ -57,6 +68,7 @@ class PbgTasks {
|
||||
item.function_type,
|
||||
item.consultation_type,
|
||||
item.due_date,
|
||||
item.id,
|
||||
]),
|
||||
total: (data) => data.meta.total,
|
||||
},
|
||||
|
||||
@@ -19,7 +19,6 @@ class SyncronizeTask {
|
||||
name: "Actions",
|
||||
width: "120px",
|
||||
formatter: function (cell) {
|
||||
console.log("cell data", cell);
|
||||
return gridjs.html(`
|
||||
<div class="d-flex justify-items-end gap-10">
|
||||
<a href="/settings/general/${cell}/edit" class="btn btn-yellow me-2">Update</a>
|
||||
|
||||
Reference in New Issue
Block a user