diff --git a/app/Http/Controllers/Api/BigDataResumeController.php b/app/Http/Controllers/Api/BigDataResumeController.php index 071485c..c932e30 100644 --- a/app/Http/Controllers/Api/BigDataResumeController.php +++ b/app/Http/Controllers/Api/BigDataResumeController.php @@ -26,12 +26,12 @@ class BigDataResumeController extends Controller $type = $request->get("type"); if (!$filterDate || $filterDate === "latest") { - $big_data_resume = BigdataResume::where('year', $type)->latest()->first(); + $big_data_resume = BigdataResume::where('resume_type', $type)->latest()->first(); if (!$big_data_resume) { return $this->response_empty_resume(); } } else { - $big_data_resume = BigdataResume::where('year', $type) + $big_data_resume = BigdataResume::where('resume_type', $type) ->whereDate('created_at', $filterDate) ->orderBy('id', 'desc') ->first(); @@ -46,10 +46,6 @@ class BigDataResumeController extends Controller return response()->json(['message' => 'No data setting found']); } - function cleanNumber($value) { - return floatval(str_replace('.', '', $value)); - } - $target_pad = floatval(optional($data_settings->where('key', 'TARGET_PAD')->first())->value); $realisasi_terbit_pbg_sum = $big_data_resume->issuance_realization_pbg_sum; $realisasi_terbit_pbg_count = $big_data_resume->issuance_realization_pbg_count; @@ -107,6 +103,12 @@ class BigDataResumeController extends Controller $proses_dinas_teknis_percentage = $big_data_resume->verified_sum > 0 && $proses_dinas_teknis_sum >= 0 ? round(($proses_dinas_teknis_sum / $big_data_resume->verified_sum) * 100, 2) : 0; + $business_rab_count = $big_data_resume->business_rab_count; + $business_krk_count = $big_data_resume->business_krk_count; + $non_business_rab_count = $big_data_resume->non_business_rab_count; + $non_business_krk_count = $big_data_resume->non_business_krk_count; + $non_business_dlh_count = $big_data_resume->non_business_dlh_count; + $result = [ 'target_pad' => [ 'sum' => $target_pad, @@ -160,7 +162,12 @@ class BigDataResumeController extends Controller 'sum' => $proses_dinas_teknis_sum, 'count' => $proses_dinas_teknis_count, 'percentage' => $proses_dinas_teknis_percentage - ] + ], + 'business_rab_count' => $business_rab_count, + 'business_krk_count' => $business_krk_count, + 'non_business_rab_count' => $non_business_rab_count, + 'non_business_krk_count' => $non_business_krk_count, + 'non_business_dlh_count' => $non_business_dlh_count ]; return response()->json($result); }catch(\Exception $e){ diff --git a/app/Models/BigdataResume.php b/app/Models/BigdataResume.php index e276b1e..880fb20 100644 --- a/app/Models/BigdataResume.php +++ b/app/Models/BigdataResume.php @@ -37,6 +37,7 @@ class BigdataResume extends Model 'non_business_rab_count', 'non_business_krk_count', 'non_business_dlh_count', + 'resume_type', ]; public function importDatasource() diff --git a/app/Models/PbgTaskDetail.php b/app/Models/PbgTaskDetail.php index 55dfa5f..c3a3500 100644 --- a/app/Models/PbgTaskDetail.php +++ b/app/Models/PbgTaskDetail.php @@ -209,19 +209,19 @@ class PbgTaskDetail extends Model 'area_type' => $data['area_type'] ?? null, 'height' => $data['height'] ?? null, 'floor' => $data['floor'] ?? null, - 'floor_area' => $data['floor_area'] ?? null, + 'floor_area' => $data['floor_area'] ?? 0, 'basement' => $data['basement'] ?? null, - 'basement_height' => $data['basement_height'] ?? null, - 'basement_area' => $data['basement_area'] ?? null, + 'basement_height' => $data['basement_height'] ?? 0, + 'basement_area' => $data['basement_area'] ?? 0, 'unit' => $data['unit'] ?? null, - 'prev_retribution' => $data['prev_retribution'] ?? null, + 'prev_retribution' => $data['prev_retribution'] ?? 0, 'prev_pbg' => $data['prev_pbg'] ?? null, - 'prev_total_area' => $data['prev_total_area'] ?? null, - 'koefisien_dasar_bangunan' => $data['koefisien_dasar_bangunan'] ?? null, - 'koefisien_lantai_bangunan' => $data['koefisien_lantai_bangunan'] ?? null, - 'koefisien_lantai_hijau' => $data['koefisien_lantai_hijau'] ?? null, - 'koefisien_tapak_basement' => $data['koefisien_tapak_basement'] ?? null, - 'ketinggian_bangunan' => $data['ketinggian_bangunan'] ?? null, + 'prev_total_area' => $data['prev_total_area'] ?? 0, + 'koefisien_dasar_bangunan' => $data['koefisien_dasar_bangunan'] ?? 0, + 'koefisien_lantai_bangunan' => $data['koefisien_lantai_bangunan'] ?? 0, + 'koefisien_lantai_hijau' => $data['koefisien_lantai_hijau'] ?? 0, + 'koefisien_tapak_basement' => $data['koefisien_tapak_basement'] ?? 0, + 'ketinggian_bangunan' => $data['ketinggian_bangunan'] ?? 0, 'jalan_arteri' => $data['jalan_arteri'] ?? null, 'jalan_kolektor' => $data['jalan_kolektor'] ?? null, 'jalan_bangunan' => $data['jalan_bangunan'] ?? null, diff --git a/app/Services/ServiceGoogleSheet.php b/app/Services/ServiceGoogleSheet.php index c85f0e4..81e9c0a 100644 --- a/app/Services/ServiceGoogleSheet.php +++ b/app/Services/ServiceGoogleSheet.php @@ -276,7 +276,8 @@ class ServiceGoogleSheet BigdataResume::create([ 'import_datasource_id' => $import_datasource->id, - 'year' => 'leader', + 'year' => now()->year(), + 'resume_type' => 'leader', // USAHA 'business_count' => $this->convertToInteger($result['USAHA']['total'] ?? null) ?? 0, 'business_sum' => $this->convertToDecimal($result['USAHA']['nominal'] ?? null) ?? 0, @@ -303,7 +304,12 @@ class ServiceGoogleSheet 'process_in_technical_office_sum' => $this->convertToDecimal($result['PROSES_DINAS_TEKNIS']['nominal'] ?? null) ?? 0, // TATA RUANG 'spatial_count' => $this->getSpatialPlanningWithCalculationCount(), - 'spatial_sum' => $this->getSpatialPlanningCalculationSum() + 'spatial_sum' => $this->getSpatialPlanningCalculationSum(), + 'business_rab_count' => 0, + 'business_krk_count' => 0, + 'non_business_rab_count' => 0, + 'non_business_krk_count' => 0, + 'non_business_dlh_count' => 0, ]); // Save data settings diff --git a/resources/js/dashboards/bigdata.js b/resources/js/dashboards/bigdata.js index 41c104b..9d27117 100644 --- a/resources/js/dashboards/bigdata.js +++ b/resources/js/dashboards/bigdata.js @@ -36,6 +36,11 @@ class BigData { this.initChartMenungguKlikDPMPTSP(); this.initChartProsesDinasTeknis(); this.initChartPotensiTataRuang(); + this.initChartBusinessRAB(); + this.initChartBusinessKRK(); + this.initChartNonBusinessRAB(); + this.initChartNonBusinessKRK(); + this.initChartNonBusinessDLH(); } catch (e) { console.error(e); } @@ -318,6 +323,37 @@ class BigData { element.innerText = `${this.resumeBigData.tata_ruang.percentage}%`; }); } + initChartBusinessRAB() { + document.querySelectorAll("#business-rab-count").forEach((element) => { + element.innerText = `${this.resumeBigData.business_rab_count}`; + }); + } + initChartBusinessKRK() { + document.querySelectorAll("#business-krk-count").forEach((element) => { + element.innerText = `${this.resumeBigData.business_krk_count}`; + }); + } + initChartNonBusinessRAB() { + document + .querySelectorAll("#non-business-rab-count") + .forEach((element) => { + element.innerText = `${this.resumeBigData.non_business_rab_count}`; + }); + } + initChartNonBusinessKRK() { + document + .querySelectorAll("#non-business-krk-count") + .forEach((element) => { + element.innerText = `${this.resumeBigData.non_business_krk_count}`; + }); + } + initChartNonBusinessDLH() { + document + .querySelectorAll("#non-business-dlh-count") + .forEach((element) => { + element.innerText = `${this.resumeBigData.non_business_dlh_count}`; + }); + } } document.addEventListener("DOMContentLoaded", async function (e) { diff --git a/resources/views/dashboards/bigdata.blade.php b/resources/views/dashboards/bigdata.blade.php index 9903b6d..561a6cd 100644 --- a/resources/views/dashboards/bigdata.blade.php +++ b/resources/views/dashboards/bigdata.blade.php @@ -100,14 +100,14 @@