fix update dashboard external

This commit is contained in:
arifal
2025-08-20 00:23:30 +07:00
parent 4b28bebcc2
commit 0a9d9071e4
9 changed files with 383 additions and 180 deletions

View File

@@ -8,6 +8,7 @@ use App\Models\Customer;
use App\Models\SpatialPlanning;
use Illuminate\Http\Request;
use App\Models\TourismBasedKBLI;
use App\Models\Tax;
class LackOfPotentialController extends Controller
{
@@ -20,6 +21,11 @@ class LackOfPotentialController extends Controller
$total_tata_ruang_usaha = SpatialPlanning::where('building_function','like', '%usaha%')->count();
$total_tata_ruang_non_usaha = SpatialPlanning::where('building_function','not like', '%usaha%')->count();
$data_report_tourism = TourismBasedKBLI::all();
$data_pajak_reklame = Tax::where('tax_code','Reklame')->count();
$data_pajak_restoran = Tax::where('tax_code','Restoran')->count();
$data_pajak_hiburan = Tax::where('tax_code','Hiburan')->count();
$data_pajak_hotel = Tax::where('tax_code','Hotel')->count();
$data_pajak_parkir = Tax::where('tax_code','Parkir')->count();
return response()->json([
'total_reklame' => $total_reklame,
@@ -28,6 +34,11 @@ class LackOfPotentialController extends Controller
'total_tata_ruang_usaha' => $total_tata_ruang_usaha,
'total_tata_ruang_non_usaha' => $total_tata_ruang_non_usaha,
'data_report' => $data_report_tourism,
'data_pajak_reklame' => $data_pajak_reklame,
'data_pajak_restoran' => $data_pajak_restoran,
'data_pajak_hiburan' => $data_pajak_hiburan,
'data_pajak_hotel' => $data_pajak_hotel,
'data_pajak_parkir' => $data_pajak_parkir,
], 200);
}catch(\Exception $e){
return response()->json([

View File

@@ -126,10 +126,10 @@ class RequestAssignmentController extends Controller
->whereIn("status", PbgTaskStatus::getNonVerified())
// Additional condition: unit IS NULL OR unit <= 1
->where(function ($q3) {
$q3->whereDoesntHave('pbg_task_detail', function ($q4) {
$q3->whereDoesntHave('pbg_task_details', function ($q4) {
$q4->where('unit', '>', 1);
})
->orWhereDoesntHave('pbg_task_detail');
->orWhereDoesntHave('pbg_task_details');
});
});
break;
@@ -152,7 +152,7 @@ class RequestAssignmentController extends Controller
})
->orWhereNull('function_type');
})
->whereHas('pbg_task_detail', function ($q4) {
->whereHas('pbg_task_details', function ($q4) {
$q4->where('unit', '>', 1);
});
});
@@ -204,10 +204,10 @@ class RequestAssignmentController extends Controller
->whereIn("status", PbgTaskStatus::getNonVerified())
// Additional condition: unit IS NULL OR unit <= 1
->where(function ($q3) {
$q3->whereDoesntHave('pbg_task_detail', function ($q4) {
$q3->whereDoesntHave('pbg_task_details', function ($q4) {
$q4->where('unit', '>', 1);
})
->orWhereDoesntHave('pbg_task_detail');
->orWhereDoesntHave('pbg_task_details');
});
})
->whereExists(function ($query) {
@@ -232,10 +232,10 @@ class RequestAssignmentController extends Controller
->whereIn("status", PbgTaskStatus::getNonVerified())
// Additional condition: unit IS NULL OR unit <= 1
->where(function ($q3) {
$q3->whereDoesntHave('pbg_task_detail', function ($q4) {
$q3->whereDoesntHave('pbg_task_details', function ($q4) {
$q4->where('unit', '>', 1);
})
->orWhereDoesntHave('pbg_task_detail');
->orWhereDoesntHave('pbg_task_details');
});
})
->whereExists(function ($query) {
@@ -265,7 +265,7 @@ class RequestAssignmentController extends Controller
})
->orWhereNull('function_type');
})
->whereHas('pbg_task_detail', function ($q4) {
->whereHas('pbg_task_details', function ($q4) {
$q4->where('unit', '>', 1);
});
});
@@ -299,7 +299,7 @@ class RequestAssignmentController extends Controller
})
->orWhereNull('function_type');
})
->whereHas('pbg_task_detail', function ($q4) {
->whereHas('pbg_task_details', function ($q4) {
$q4->where('unit', '>', 1);
});
});
@@ -333,7 +333,7 @@ class RequestAssignmentController extends Controller
})
->orWhereNull('function_type');
})
->whereHas('pbg_task_detail', function ($q4) {
->whereHas('pbg_task_details', function ($q4) {
$q4->where('unit', '>', 1);
});
});
@@ -370,7 +370,7 @@ class RequestAssignmentController extends Controller
});
// If search term exists, also find UUIDs from name_building search
$namesBuildingUuids = DB::table('pbg_task_detail')
$namesBuildingUuids = DB::table('pbg_task_details')
->where('name_building', 'LIKE', "%$search%")
->pluck('pbg_task_uid')
->toArray();
@@ -528,7 +528,7 @@ class RequestAssignmentController extends Controller
})
->orWhereNull('function_type');
})
->whereHas('pbg_task_detail', function ($q4) {
->whereHas('pbg_task_details', function ($q4) {
$q4->where('unit', '>', 1);
});
});
@@ -552,10 +552,10 @@ class RequestAssignmentController extends Controller
->whereIn("status", PbgTaskStatus::getNonVerified())
// Additional condition: unit IS NULL OR unit <= 1
->where(function ($q3) {
$q3->whereDoesntHave('pbg_task_detail', function ($q4) {
$q3->whereDoesntHave('pbg_task_details', function ($q4) {
$q4->where('unit', '>', 1);
})
->orWhereDoesntHave('pbg_task_detail');
->orWhereDoesntHave('pbg_task_details');
});
})
->where('is_valid', true)