From 59e9431b2dc1271c2fdb6755da3edbacf4b57c89 Mon Sep 17 00:00:00 2001 From: arifal Date: Fri, 14 Feb 2025 18:28:14 +0700 Subject: [PATCH] fetch data from data setting and make seeder realisasi terbit, menunggu klik dpmptsp, proses dinas teknis --- database/seeders/DataSettingSeeder.php | 32 ++++++++++- resources/js/dashboards/bigdata.js | 74 +++++++++++-------------- resources/scss/dashboards/_bigdata.scss | 7 +-- 3 files changed, 65 insertions(+), 48 deletions(-) diff --git a/database/seeders/DataSettingSeeder.php b/database/seeders/DataSettingSeeder.php index 867118d..2b30e81 100644 --- a/database/seeders/DataSettingSeeder.php +++ b/database/seeders/DataSettingSeeder.php @@ -23,7 +23,37 @@ class DataSettingSeeder extends Seeder "key" => "TATA_RUANG", "value" => "10000000000", "type" => "integer" - ] + ], + [ + "key" => "REALISASI_TERBIT_PBG_SUM", + "value" => "1507253788", + "type" => "integer" + ], + [ + "key" => "REALISASI_TERBIT_PBG_COUNT", + "value" => "88", + "type" => "integer" + ], + [ + "key" => "MENUNGGU_KLIK_DPMPTSP_SUM", + "value" => "83457536", + "type" => "integer" + ], + [ + "key" => "MENUNGGU_KLIK_DPMPTSP_COUNT", + "value" => "266", + "type" => "integer" + ], + [ + "key" => "PROSES_DINAS_TEKNIS_SUM", + "value" => "83457536", + "type" => "integer" + ], + [ + "key" => "PROSES_DINAS_TEKNIS_COUNT", + "value" => "11", + "type" => "integer" + ], ]; foreach ($data_settings as $setting) { diff --git a/resources/js/dashboards/bigdata.js b/resources/js/dashboards/bigdata.js index 2da6ee4..4ece303 100644 --- a/resources/js/dashboards/bigdata.js +++ b/resources/js/dashboards/bigdata.js @@ -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") diff --git a/resources/scss/dashboards/_bigdata.scss b/resources/scss/dashboards/_bigdata.scss index 9d61d77..84e35ca 100644 --- a/resources/scss/dashboards/_bigdata.scss +++ b/resources/scss/dashboards/_bigdata.scss @@ -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 */