diff --git a/app/Console/Commands/CheckSpatialPlanningConstraints.php b/app/Console/Commands/CheckSpatialPlanningConstraints.php
deleted file mode 100644
index bec54b8..0000000
--- a/app/Console/Commands/CheckSpatialPlanningConstraints.php
+++ /dev/null
@@ -1,101 +0,0 @@
-info('Checking Spatial Planning Constraints...');
- $this->newLine();
-
- try {
- // Get total spatial plannings
- $totalSpatialPlannings = SpatialPlanning::count();
-
- // Get spatial plannings with retribution proposals
- $withProposals = SpatialPlanning::whereHas('retributionProposals')->count();
-
- // Get spatial plannings without retribution proposals
- $withoutProposals = SpatialPlanning::whereDoesntHave('retributionProposals')->count();
-
- // Get total retribution proposals
- $totalProposals = RetributionProposal::count();
-
- // Get retribution proposals linked to spatial plannings
- $linkedProposals = RetributionProposal::whereNotNull('spatial_planning_id')->count();
-
- // Get standalone retribution proposals
- $standaloneProposals = RetributionProposal::whereNull('spatial_planning_id')->count();
-
- // Display statistics
- $this->table(
- ['Metric', 'Count'],
- [
- ['Total Spatial Plannings', $totalSpatialPlannings],
- ['├─ With Retribution Proposals', $withProposals],
- ['└─ Without Retribution Proposals', $withoutProposals],
- ['', ''],
- ['Total Retribution Proposals', $totalProposals],
- ['├─ Linked to Spatial Planning', $linkedProposals],
- ['└─ Standalone Proposals', $standaloneProposals],
- ]
- );
-
- $this->newLine();
-
- // Show constraint implications
- if ($withProposals > 0) {
- $this->warn("⚠️ CONSTRAINT WARNING:");
- $this->warn(" {$withProposals} spatial plannings have retribution proposals linked to them.");
- $this->warn(" These cannot be deleted directly due to foreign key constraints.");
- $this->newLine();
-
- $this->info("💡 TRUNCATE OPTIONS:");
- $this->info(" • Use --truncate to delete ALL data (spatial plannings + linked proposals)");
- $this->info(" • Use --safe-truncate to delete only spatial plannings without proposals");
- $this->info(" • Manual cleanup: Delete proposals first, then spatial plannings");
- } else {
- $this->info("✅ No foreign key constraints found.");
- $this->info(" All spatial plannings can be safely truncated.");
- }
-
- $this->newLine();
-
- // Show example commands
- $this->info("📋 EXAMPLE COMMANDS:");
- $this->info(" php artisan spatial:init --truncate # Delete all data (smart method)");
- $this->info(" php artisan spatial:init --safe-truncate # Delete safe data only");
- $this->info(" php artisan spatial:init --force-truncate # Force truncate (disable FK checks)");
- $this->info(" php artisan spatial:init file.csv --truncate # Import with truncate");
-
- return 0;
-
- } catch (\Exception $e) {
- $this->error('Error checking constraints: ' . $e->getMessage());
- return 1;
- }
- }
-}
\ No newline at end of file
diff --git a/app/Console/Commands/ClearDatabaseSessions.php b/app/Console/Commands/ClearDatabaseSessions.php
deleted file mode 100644
index 6751a8f..0000000
--- a/app/Console/Commands/ClearDatabaseSessions.php
+++ /dev/null
@@ -1,45 +0,0 @@
-option('force') && !$this->confirm('Are you sure you want to clear all database sessions?')) {
- $this->info('Operation cancelled.');
- return 0;
- }
-
- try {
- $count = DB::table('sessions')->count();
- DB::table('sessions')->delete();
-
- $this->info("Successfully cleared {$count} database sessions.");
- return 0;
- } catch (\Exception $e) {
- $this->error('Failed to clear database sessions: ' . $e->getMessage());
- return 1;
- }
- }
-}
diff --git a/app/Console/Commands/ScrapingData.php b/app/Console/Commands/ScrapingData.php
index 3539cc6..6aa7d96 100644
--- a/app/Console/Commands/ScrapingData.php
+++ b/app/Console/Commands/ScrapingData.php
@@ -42,54 +42,4 @@ class ScrapingData extends Command
$this->info("Scraping job dispatched successfully");
}
-
- /**
- * Execute the console command.
- */
- // public function handle()
- // {
-
- // try {
- // // Create a record with "processing" status
- // $import_datasource = ImportDatasource::create([
- // 'message' => 'Initiating scraping...',
- // 'response_body' => null,
- // 'status' => 'processing',
- // 'start_time' => now()
- // ]);
-
- // // Run the service
- // $service_google_sheet = new ServiceGoogleSheet();
- // $service_google_sheet->run_service();
-
- // // Run the ServicePbgTask with injected Guzzle Client
- // $this->service_pbg_task->run_service();
-
- // // run the service pbg task assignments
- // $this->service_tab_pbg_task->run_service();
-
- // // Update the record status to "success" after completion
- // $import_datasource->update([
- // 'status' => 'success',
- // 'message' => 'Scraping completed successfully.',
- // 'finish_time' => now()
- // ]);
-
- // } catch (\Exception $e) {
-
- // // Log the error for debugging
- // Log::error('Scraping failed: ' . $e->getMessage(), ['trace' => $e->getTraceAsString()]);
-
- // // Handle errors by updating the status to "failed"
- // if (isset($import_datasource)) {
- // $import_datasource->update([
- // 'status' => 'failed',
- // 'response_body' => 'Error: ' . $e->getMessage(),
- // 'finish_time' => now()
- // ]);
- // }
- // }
- // }
-
-
}
diff --git a/app/Http/Controllers/Api/LackOfPotentialController.php b/app/Http/Controllers/Api/LackOfPotentialController.php
index 145f8c8..7d358e0 100644
--- a/app/Http/Controllers/Api/LackOfPotentialController.php
+++ b/app/Http/Controllers/Api/LackOfPotentialController.php
@@ -17,12 +17,16 @@ class LackOfPotentialController extends Controller
$total_reklame = Advertisement::count();
$total_pdam = Customer::count();
$total_tata_ruang = SpatialPlanning::count();
+ $total_tata_ruang_usaha = SpatialPlanning::where('building_function','like', '%usaha%')->count();
+ $total_tata_ruang_non_usaha = SpatialPlanning::where('building_function','like', '%hunian%')->count();
$data_report_tourism = TourismBasedKBLI::all();
return response()->json([
'total_reklame' => $total_reklame,
'total_pdam' => $total_pdam,
'total_tata_ruang' => $total_tata_ruang,
+ 'total_tata_ruang_usaha' => $total_tata_ruang_usaha,
+ 'total_tata_ruang_non_usaha' => $total_tata_ruang_non_usaha,
'data_report' => $data_report_tourism,
], 200);
}catch(\Exception $e){
diff --git a/app/Jobs/ScrapingDataJob.php b/app/Jobs/ScrapingDataJob.php
index fbe6704..c8fd86c 100644
--- a/app/Jobs/ScrapingDataJob.php
+++ b/app/Jobs/ScrapingDataJob.php
@@ -60,10 +60,10 @@ class ScrapingDataJob implements ShouldQueue
throw $e;
}
- $data_setting_result = $service_google_sheet->get_big_resume_data();
+ // $data_setting_result = $service_google_sheet->get_big_resume_data();
- BigdataResume::generateResumeData($import_datasource->id, "all", $data_setting_result);
- BigdataResume::generateResumeData($import_datasource->id, now()->year, $data_setting_result);
+ // BigdataResume::generateResumeData($import_datasource->id, "all", $data_setting_result);
+ // BigdataResume::generateResumeData($import_datasource->id, now()->year, $data_setting_result);
// Update status to success
$import_datasource->update([
diff --git a/app/Models/PbgTask.php b/app/Models/PbgTask.php
index 5d8bc37..06177d4 100644
--- a/app/Models/PbgTask.php
+++ b/app/Models/PbgTask.php
@@ -38,6 +38,10 @@ class PbgTask extends Model
return $this->hasOne(PbgTaskIndexIntegrations::class, 'pbg_task_uid', 'uuid');
}
+ public function pbg_task_detail(){
+ return $this->hasOne(PbgTaskDetail::class, 'pbg_task_uid', 'uuid');
+ }
+
public function googleSheet(){
return $this->hasOne(PbgTaskGoogleSheet::class, 'no_registrasi', 'registration_number');
}
diff --git a/app/Models/PbgTaskDetail.php b/app/Models/PbgTaskDetail.php
new file mode 100644
index 0000000..a0e1526
--- /dev/null
+++ b/app/Models/PbgTaskDetail.php
@@ -0,0 +1,252 @@
+ 'array',
+ 'is_mbr' => 'boolean',
+ 'total_area' => 'decimal:2',
+ 'area' => 'decimal:2',
+ 'height' => 'decimal:2',
+ 'floor_area' => 'decimal:2',
+ 'basement_height' => 'decimal:2',
+ 'basement_area' => 'decimal:2',
+ 'prev_retribution' => 'decimal:2',
+ 'prev_total_area' => 'decimal:2',
+ 'koefisien_dasar_bangunan' => 'decimal:4',
+ 'koefisien_lantai_bangunan' => 'decimal:4',
+ 'koefisien_lantai_hijau' => 'decimal:4',
+ 'koefisien_tapak_basement' => 'decimal:4',
+ 'ketinggian_bangunan' => 'decimal:2',
+ 'gsb' => 'decimal:2',
+ 'latitude' => 'decimal:8',
+ 'longitude' => 'decimal:8',
+ 'file_pbg_date' => 'date',
+ 'due_date' => 'date',
+ 'start_date' => 'date',
+ 'api_created_at' => 'datetime',
+ ];
+
+ /**
+ * Get the PBG task that owns this detail
+ */
+ public function pbgTask(): BelongsTo
+ {
+ return $this->belongsTo(PbgTask::class, 'pbg_task_uid', 'uuid');
+ }
+
+ /**
+ * Create or update PbgTaskDetail from API response
+ */
+ public static function createFromApiResponse(array $data, string $pbgTaskUuid): self
+ {
+ $detailData = [
+ 'pbg_task_uid' => $pbgTaskUuid,
+ 'uid' => $data['uid'] ?? null,
+ 'nik' => $data['nik'] ?? null,
+ 'type_card' => $data['type_card'] ?? null,
+ 'ownership' => $data['ownership'] ?? null,
+ 'owner_name' => $data['owner_name'] ?? null,
+ 'ward_id' => $data['ward_id'] ?? null,
+ 'ward_name' => $data['ward_name'] ?? null,
+ 'district_id' => $data['district_id'] ?? null,
+ 'district_name' => $data['district_name'] ?? null,
+ 'regency_id' => $data['regency_id'] ?? null,
+ 'regency_name' => $data['regency_name'] ?? null,
+ 'province_id' => $data['province_id'] ?? null,
+ 'province_name' => $data['province_name'] ?? null,
+ 'address' => $data['address'] ?? null,
+ 'owner_email' => $data['owner_email'] ?? null,
+ 'owner_phone' => $data['owner_phone'] ?? null,
+ 'user' => $data['user'] ?? null,
+ 'name' => $data['name'] ?? null,
+ 'email' => $data['email'] ?? null,
+ 'phone' => $data['phone'] ?? null,
+ 'user_nik' => $data['user_nik'] ?? null,
+ 'user_province_id' => $data['user_province_id'] ?? null,
+ 'user_province_name' => $data['user_province_name'] ?? null,
+ 'user_regency_id' => $data['user_regency_id'] ?? null,
+ 'user_regency_name' => $data['user_regency_name'] ?? null,
+ 'user_district_id' => $data['user_district_id'] ?? null,
+ 'user_district_name' => $data['user_district_name'] ?? null,
+ 'user_address' => $data['user_address'] ?? null,
+ 'status' => $data['status'] ?? null,
+ 'status_name' => $data['status_name'] ?? null,
+ 'slf_status' => $data['slf_status'] ?? null,
+ 'slf_status_name' => $data['slf_status_name'] ?? null,
+ 'sppst_status' => $data['sppst_status'] ?? null,
+ 'sppst_file' => $data['sppst_file'] ?? null,
+ 'sppst_status_name' => $data['sppst_status_name'] ?? null,
+ 'file_pbg' => $data['file_pbg'] ?? null,
+ 'file_pbg_date' => isset($data['file_pbg_date']) ? Carbon::parse($data['file_pbg_date'])->format('Y-m-d') : null,
+ 'due_date' => isset($data['due_date']) ? Carbon::parse($data['due_date'])->format('Y-m-d') : null,
+ 'start_date' => isset($data['start_date']) ? Carbon::parse($data['start_date'])->format('Y-m-d') : null,
+ 'document_number' => $data['document_number'] ?? null,
+ 'registration_number' => $data['registration_number'] ?? null,
+ 'function_type' => $data['function_type'] ?? null,
+ 'application_type' => $data['application_type'] ?? null,
+ 'application_type_name' => $data['application_type_name'] ?? null,
+ 'consultation_type' => $data['consultation_type'] ?? null,
+ 'condition' => $data['condition'] ?? null,
+ 'prototype' => $data['prototype'] ?? null,
+ 'permanency' => $data['permanency'] ?? null,
+ 'building_type' => $data['building_type'] ?? null,
+ 'building_type_name' => $data['building_type_name'] ?? null,
+ 'building_purpose' => $data['building_purpose'] ?? null,
+ 'building_use' => $data['building_use'] ?? null,
+ 'occupancy' => $data['occupancy'] ?? null,
+ 'name_building' => $data['name_building'] ?? null,
+ 'total_area' => $data['total_area'] ?? null,
+ 'area' => $data['area'] ?? null,
+ 'area_type' => $data['area_type'] ?? null,
+ 'height' => $data['height'] ?? null,
+ 'floor' => $data['floor'] ?? null,
+ 'floor_area' => $data['floor_area'] ?? null,
+ 'basement' => $data['basement'] ?? null,
+ 'basement_height' => $data['basement_height'] ?? null,
+ 'basement_area' => $data['basement_area'] ?? null,
+ 'unit' => $data['unit'] ?? null,
+ 'prev_retribution' => $data['prev_retribution'] ?? null,
+ '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,
+ 'jalan_arteri' => $data['jalan_arteri'] ?? null,
+ 'jalan_kolektor' => $data['jalan_kolektor'] ?? null,
+ 'jalan_bangunan' => $data['jalan_bangunan'] ?? null,
+ 'gsb' => $data['gsb'] ?? null,
+ 'kkr_number' => $data['kkr_number'] ?? null,
+ 'unit_data' => $data['unit_data'] ?? null,
+ 'is_mbr' => $data['is_mbr'] ?? false,
+ 'code' => $data['code'] ?? null,
+ 'building_ward_id' => $data['building_ward_id'] ?? null,
+ 'building_ward_name' => $data['building_ward_name'] ?? null,
+ 'building_district_id' => $data['building_district_id'] ?? null,
+ 'building_district_name' => $data['building_district_name'] ?? null,
+ 'building_regency_id' => $data['building_regency_id'] ?? null,
+ 'building_regency_name' => $data['building_regency_name'] ?? null,
+ 'building_province_id' => $data['building_province_id'] ?? null,
+ 'building_province_name' => $data['building_province_name'] ?? null,
+ 'building_address' => $data['building_address'] ?? null,
+ 'latitude' => $data['latitude'] ?? null,
+ 'longitude' => $data['longitude'] ?? null,
+ 'building_photo' => $data['building_photo'] ?? null,
+ 'pbg_parent' => $data['pbg_parent'] ?? null,
+ 'api_created_at' => isset($data['created_at']) ? Carbon::parse($data['created_at'])->format('Y-m-d H:i:s') : null,
+ ];
+
+ return static::updateOrCreate(
+ ['uid' => $data['uid']],
+ $detailData
+ );
+ }
+}
diff --git a/app/Services/ServiceTabPbgTask.php b/app/Services/ServiceTabPbgTask.php
index 4421112..85574d6 100644
--- a/app/Services/ServiceTabPbgTask.php
+++ b/app/Services/ServiceTabPbgTask.php
@@ -4,6 +4,7 @@ namespace App\Services;
use App\Models\GlobalSetting;
use App\Models\PbgTask;
+use App\Models\PbgTaskDetail;
use App\Models\PbgTaskIndexIntegrations;
use App\Models\PbgTaskPrasarana;
use App\Models\PbgTaskRetributions;
@@ -53,6 +54,7 @@ class ServiceTabPbgTask
}
try{
$this->current_uuid = $pbg_task->uuid;
+ $this->scraping_task_details($pbg_task->uuid);
$this->scraping_task_assignments($pbg_task->uuid);
$this->scraping_task_retributions($pbg_task->uuid);
$this->scraping_task_integrations($pbg_task->uuid);
@@ -71,6 +73,75 @@ class ServiceTabPbgTask
return $this->current_uuid;
}
+ private function scraping_task_details($uuid)
+ {
+ $url = "{$this->simbg_host}/api/pbg/v1/detail/{$uuid}/";
+ $options = [
+ 'headers' => [
+ 'Authorization' => "Bearer {$this->user_token}",
+ 'Content-Type' => 'application/json'
+ ]
+ ];
+
+ $maxRetries = 3;
+ $initialDelay = 1;
+ $retriedAfter401 = false;
+
+ for ($retryCount = 0; $retryCount < $maxRetries; $retryCount++) {
+ try {
+ $response = $this->client->get($url, $options);
+ $responseData = json_decode($response->getBody()->getContents(), true, 512, JSON_THROW_ON_ERROR);
+
+ if (empty($responseData['data']) || !is_array($responseData['data'])) {
+ return true;
+ }
+
+ $data = $responseData['data'];
+
+ // Use the static method from PbgTaskDetail model to create/update
+ PbgTaskDetail::createFromApiResponse($data, $uuid);
+
+ return $responseData;
+ } catch (\GuzzleHttp\Exception\ClientException $e) {
+ if ($e->getCode() === 401 && !$retriedAfter401) {
+ Log::warning("401 Unauthorized - Refreshing token and retrying...");
+ try{
+ $this->refreshToken();
+ $options['headers']['Authorization'] = "Bearer {$this->user_token}";
+ $retriedAfter401 = true;
+ continue;
+ }catch(\Exception $refreshError){
+ Log::error("Token refresh and login failed: " . $refreshError->getMessage());
+ return false;
+ }
+ }
+
+ return false;
+ } catch (\GuzzleHttp\Exception\ServerException | \GuzzleHttp\Exception\ConnectException $e) {
+ if ($e->getCode() === 502) {
+ Log::warning("502 Bad Gateway - Retrying in {$initialDelay} seconds...");
+ } else {
+ Log::error("Network error ({$e->getCode()}) - Retrying in {$initialDelay} seconds...");
+ }
+
+ sleep($initialDelay);
+ $initialDelay *= 2;
+ } catch (\GuzzleHttp\Exception\RequestException $e) {
+ Log::error("Request error ({$e->getCode()}): " . $e->getMessage());
+ return false;
+ } catch (\JsonException $e) {
+ Log::error("JSON decoding error: " . $e->getMessage());
+ return false;
+ } catch (\Throwable $e) {
+ Log::critical("Unhandled error: " . $e->getMessage(), ['trace' => $e->getTraceAsString()]);
+ return false;
+ }
+ }
+
+ Log::error("Failed to fetch task details for UUID {$uuid} after {$maxRetries} retries.");
+ throw new \Exception("Failed to fetch task details for UUID {$uuid} after retries.");
+ }
+
private function scraping_task_assignments($uuid)
{
$url = "{$this->simbg_host}/api/pbg/v1/list-tim-penilai/{$uuid}/?page=1&size=10";
diff --git a/database/migrations/2025_06_18_113014_create_pbg_task_details_table.php b/database/migrations/2025_06_18_113014_create_pbg_task_details_table.php
new file mode 100644
index 0000000..73bf692
--- /dev/null
+++ b/database/migrations/2025_06_18_113014_create_pbg_task_details_table.php
@@ -0,0 +1,166 @@
+id();
+
+ // Foreign key relationship
+ $table->string('pbg_task_uid')->index();
+
+ // Basic information
+ $table->string('uid')->unique();
+ $table->string('nik');
+ $table->string('type_card');
+ $table->string('ownership')->nullable();
+ $table->string('owner_name');
+
+ // Owner location information
+ $table->bigInteger('ward_id');
+ $table->string('ward_name');
+ $table->integer('district_id');
+ $table->string('district_name');
+ $table->integer('regency_id');
+ $table->string('regency_name');
+ $table->integer('province_id');
+ $table->string('province_name');
+ $table->text('address');
+
+ // Owner contact information
+ $table->string('owner_email');
+ $table->string('owner_phone');
+
+ // User information
+ $table->integer('user');
+ $table->string('name');
+ $table->string('email');
+ $table->string('phone');
+ $table->string('user_nik');
+
+ // User location information
+ $table->integer('user_province_id');
+ $table->string('user_province_name');
+ $table->integer('user_regency_id');
+ $table->string('user_regency_name');
+ $table->integer('user_district_id');
+ $table->string('user_district_name');
+ $table->text('user_address');
+
+ // Status information
+ $table->integer('status');
+ $table->string('status_name');
+ $table->integer('slf_status')->nullable();
+ $table->string('slf_status_name')->nullable();
+ $table->integer('sppst_status');
+ $table->string('sppst_file')->nullable();
+ $table->string('sppst_status_name');
+
+ // Files and documents
+ $table->string('file_pbg')->nullable();
+ $table->date('file_pbg_date')->nullable();
+ $table->date('due_date')->nullable();
+ $table->date('start_date');
+ $table->string('document_number')->nullable();
+ $table->string('registration_number');
+
+ // Application information
+ $table->string('function_type')->nullable();
+ $table->string('application_type')->nullable();
+ $table->string('application_type_name')->nullable();
+ $table->string('consultation_type')->nullable();
+ $table->string('condition')->nullable();
+ $table->string('prototype')->nullable();
+ $table->string('permanency')->nullable();
+
+ // Building information
+ $table->integer('building_type')->nullable();
+ $table->string('building_type_name')->nullable();
+ $table->string('building_purpose')->nullable();
+ $table->string('building_use')->nullable();
+ $table->string('occupancy')->nullable();
+ $table->string('name_building')->nullable();
+
+ // Building dimensions and specifications
+ $table->decimal('total_area', 10, 2);
+ $table->decimal('area', 10, 2)->nullable();
+ $table->string('area_type')->nullable();
+ $table->decimal('height', 8, 2);
+ $table->integer('floor');
+ $table->decimal('floor_area', 10, 2)->nullable();
+ $table->integer('basement');
+ $table->decimal('basement_height', 8, 2)->nullable();
+ $table->decimal('basement_area', 10, 2);
+ $table->integer('unit')->nullable();
+
+ // Previous information
+ $table->decimal('prev_retribution', 15, 2)->nullable();
+ $table->string('prev_pbg')->nullable();
+ $table->decimal('prev_total_area', 10, 2)->nullable();
+
+ // Coefficients
+ $table->decimal('koefisien_dasar_bangunan', 8, 4)->nullable();
+ $table->decimal('koefisien_lantai_bangunan', 8, 4)->nullable();
+ $table->decimal('koefisien_lantai_hijau', 8, 4)->nullable();
+ $table->decimal('koefisien_tapak_basement', 8, 4)->nullable();
+ $table->decimal('ketinggian_bangunan', 8, 2)->nullable();
+
+ // Road information
+ $table->string('jalan_arteri')->nullable();
+ $table->string('jalan_kolektor')->nullable();
+ $table->string('jalan_bangunan')->nullable();
+ $table->decimal('gsb', 8, 2)->nullable();
+ $table->string('kkr_number')->nullable();
+
+ // Unit data as JSON
+ $table->json('unit_data')->nullable();
+
+ // Additional flags
+ $table->boolean('is_mbr')->default(false);
+ $table->string('code');
+
+ // Building location information
+ $table->bigInteger('building_ward_id');
+ $table->string('building_ward_name');
+ $table->integer('building_district_id');
+ $table->string('building_district_name');
+ $table->integer('building_regency_id');
+ $table->string('building_regency_name');
+ $table->integer('building_province_id');
+ $table->string('building_province_name');
+ $table->text('building_address');
+
+ // Coordinates
+ $table->decimal('latitude', 10, 8)->nullable();
+ $table->decimal('longitude', 11, 8)->nullable();
+
+ // Additional files
+ $table->string('building_photo')->nullable();
+ $table->string('pbg_parent')->nullable();
+
+ // Original created_at from API
+ $table->timestamp('api_created_at')->nullable();
+
+ $table->timestamps();
+
+ // Add foreign key constraint
+ $table->foreign('pbg_task_uid')->references('uuid')->on('pbg_task')->onDelete('cascade');
+ });
+ }
+
+ /**
+ * Reverse the migrations.
+ */
+ public function down(): void
+ {
+ Schema::dropIfExists('pbg_task_details');
+ }
+};
diff --git a/resources/js/dashboards/potentials/inside_system.js b/resources/js/dashboards/potentials/inside_system.js
index 4ef19f2..c518a73 100644
--- a/resources/js/dashboards/potentials/inside_system.js
+++ b/resources/js/dashboards/potentials/inside_system.js
@@ -15,6 +15,8 @@ class DashboardPotentialInsideSystem {
this.reklameCount = this.allCountData.total_reklame ?? 0;
this.pdamCount = this.allCountData.total_pdam ?? 0;
this.tataRuangCount = this.allCountData.total_tata_ruang ?? 0;
+ this.tataRuangUsahaCount = this.allCountData.total_tata_ruang_usaha ?? 0;
+ this.tataRuangNonUsahaCount = this.allCountData.total_tata_ruang_non_usaha ?? 0;
let dataReportTourism = this.allCountData.data_report;
@@ -156,7 +158,9 @@ class DashboardPotentialInsideSystem {
document.getElementById("tata-ruang-count").innerText =
this.tataRuangCount;
document.getElementById("tata-ruang-usaha-count").innerText =
- this.tataRuangCount;
+ this.tataRuangUsahaCount;
+ document.getElementById("tata-ruang-non-usaha-count").innerText =
+ this.tataRuangNonUsahaCount;
document.getElementById("restoran-count").innerText =
this.totalRestoran;
document.getElementById("villa-count").innerText = this.totalVilla;
diff --git a/resources/views/dashboards/potentials/inside_system.blade.php b/resources/views/dashboards/potentials/inside_system.blade.php
index c82a2da..841d962 100644
--- a/resources/views/dashboards/potentials/inside_system.blade.php
+++ b/resources/views/dashboards/potentials/inside_system.blade.php
@@ -122,10 +122,12 @@