fetch data from data setting and make seeder realisasi terbit, menunggu klik dpmptsp, proses dinas teknis

This commit is contained in:
arifal
2025-02-14 18:28:14 +07:00
parent 074edc607d
commit 59e9431b2d
3 changed files with 65 additions and 48 deletions

View File

@@ -49,13 +49,31 @@ class BigData {
}
async updateData(year) {
try {
this.totalTargetPAD = await this.getTargetPAD(year);
this.totalTargetPAD = await this.getDataSettings("TARGET_PAD");
this.resultDataTotal = await this.getDataTotalPotensi(year);
this.dataVerification = await this.getDataVerfication(year);
this.dataNonVerification = await this.getDataNonVerfication(year);
this.dataBusiness = await this.getDataBusiness(year);
this.dataNonBusiness = await this.getDataNonBusiness(year);
this.dataTataRuang = await this.getDataTataRuang(year);
this.dataTataRuang = await this.getDataSettings("TATA_RUANG");
this.dataSumRealisasiTerbit = await this.getDataSettings(
"REALISASI_TERBIT_PBG_SUM"
);
this.dataCountRealisasiTerbit = await this.getDataSettings(
"REALISASI_TERBIT_PBG_COUNT"
);
this.dataSumMenungguKlikDPMPTSP = await this.getDataSettings(
"MENUNGGU_KLIK_DPMPTSP_SUM"
);
this.dataCountMenungguKlikDPMPTSP = await this.getDataSettings(
"MENUNGGU_KLIK_DPMPTSP_COUNT"
);
this.dataSumProsesDinasTeknis = await this.getDataSettings(
"PROSES_DINAS_TEKNIS_SUM"
);
this.dataCountProsesDinasTeknis = await this.getDataSettings(
"PROSES_DINAS_TEKNIS_COUNT"
);
// total potensi
this.bigTargetPAD = new Big(this.totalTargetPAD ?? 0);
@@ -190,38 +208,6 @@ class BigData {
}
}
async getTargetPAD(year) {
try {
const response = await 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",
},
}
);
if (!response.ok) {
console.error("Network response was not ok", response);
return 0;
}
const data = await response.json();
const valueTargetPAD = data.data[0]?.value ?? 0;
const currentMonth = new Date().getMonth() + 1;
let result = (currentMonth / 12) * valueTargetPAD;
return result;
} catch (error) {
console.error("Error fetching chart data:", error);
return 0;
}
}
async getDataVerfication(year) {
try {
const response = await fetch(
@@ -346,10 +332,10 @@ class BigData {
}
}
async getDataTataRuang() {
async getDataSettings(string_key) {
try {
const response = await fetch(
`${GlobalConfig.apiHost}/api/api-data-settings?search=tata_ruang`,
`${GlobalConfig.apiHost}/api/api-data-settings?search=${string_key}`,
{
credentials: "include",
headers: {
@@ -519,13 +505,13 @@ class BigData {
document
.querySelectorAll(".document-count.chart-realisasi-tebit-pbg")
.forEach((element) => {
element.innerText = `88`;
element.innerText = `${this.dataCountRealisasiTerbit}`;
});
document
.querySelectorAll(".document-total.chart-realisasi-tebit-pbg")
.forEach((element) => {
element.innerText = `Rp.${addThousandSeparators(
"1.507.253.788"
this.dataSumRealisasiTerbit
)}`;
});
document
@@ -538,12 +524,14 @@ class BigData {
document
.querySelectorAll(".document-count.chart-menunggu-klik-dpmptsp")
.forEach((element) => {
element.innerText = `${266}`;
element.innerText = `${this.dataCountMenungguKlikDPMPTSP}`;
});
document
.querySelectorAll(".document-total.chart-menunggu-klik-dpmptsp")
.forEach((element) => {
element.innerText = `Rp.${addThousandSeparators("83.457.536")}`;
element.innerText = `Rp.${addThousandSeparators(
this.dataSumMenungguKlikDPMPTSP
)}`;
});
document
.querySelectorAll(".small-percentage.chart-menunggu-klik-dpmptsp")
@@ -555,12 +543,14 @@ class BigData {
document
.querySelectorAll(".document-count.chart-proses-dinas-teknis")
.forEach((element) => {
element.innerText = `${11}`;
element.innerText = `${this.dataCountProsesDinasTeknis}`;
});
document
.querySelectorAll(".document-total.chart-proses-dinas-teknis")
.forEach((element) => {
element.innerText = `Rp.${addThousandSeparators("83.457.536")}`;
element.innerText = `Rp.${addThousandSeparators(
this.dataSumProsesDinasTeknis
)}`;
});
document
.querySelectorAll(".small-percentage.chart-proses-dinas-teknis")

View File

@@ -41,9 +41,10 @@
}
#dashboard-fixed-wrapper {
background-image: url("../../../public/images/bg-dashboard.jpg");
background-image: url("/public/images/bg-dashboard.jpg");
background-size: cover;
background-position: center;
max-width: 100vw; /* Ensures it doesn't exceed viewport */
}
#dashboard-fixed-wrapper::before {
@@ -62,10 +63,6 @@
); /* Black overlay with 50% opacity */
}
#dashboard-fixed-wrapper {
max-width: 100vw; /* Ensures it doesn't exceed viewport */
}
#dashboard-fixed-container {
min-width: 1110px;
max-width: unset; /* Allow it to grow if needed */