create filter and bigdata resume sync
This commit is contained in:
@@ -11,11 +11,21 @@ class DashboardController extends Controller
|
|||||||
{
|
{
|
||||||
use GlobalApiResponse;
|
use GlobalApiResponse;
|
||||||
|
|
||||||
public function businnessDocument(Request $request){
|
public function businnessDocument(Request $request)
|
||||||
$query = once(function () {
|
{
|
||||||
|
$request->validate([
|
||||||
|
"year" => "required|integer"
|
||||||
|
]);
|
||||||
|
|
||||||
|
$current_year = $request->get('year');
|
||||||
|
|
||||||
|
$startOfYear = "$current_year-01-01 00:00:00";
|
||||||
|
$endOfYear = "$current_year-12-31 23:59:59";
|
||||||
|
$query = once(function () use ($startOfYear, $endOfYear) {
|
||||||
return DB::table('pbg_task AS pt')
|
return DB::table('pbg_task AS pt')
|
||||||
->leftJoin('pbg_task_google_sheet AS ptgs', 'pt.registration_number', '=', 'ptgs.no_registrasi')
|
->leftJoin('pbg_task_google_sheet AS ptgs', 'pt.registration_number', '=', 'ptgs.no_registrasi')
|
||||||
->leftJoin('pbg_task_retributions AS ptr', 'pt.uuid', '=', 'ptr.pbg_task_uid')
|
->leftJoin('pbg_task_retributions AS ptr', 'pt.uuid', '=', 'ptr.pbg_task_uid')
|
||||||
|
->whereBetween("pt.task_created_at", [$startOfYear, $endOfYear])
|
||||||
->where(function ($query) {
|
->where(function ($query) {
|
||||||
$query->whereRaw('LOWER(TRIM(ptgs.status_verifikasi)) != ?', [strtolower(trim('Selesai Verifikasi'))])
|
$query->whereRaw('LOWER(TRIM(ptgs.status_verifikasi)) != ?', [strtolower(trim('Selesai Verifikasi'))])
|
||||||
->orWhereNull('ptgs.status_verifikasi');
|
->orWhereNull('ptgs.status_verifikasi');
|
||||||
@@ -37,11 +47,20 @@ class DashboardController extends Controller
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
public function nonBusinnessDocument(Request $request){
|
public function nonBusinnessDocument(Request $request){
|
||||||
|
$request->validate([
|
||||||
|
"year" => "required|integer"
|
||||||
|
]);
|
||||||
|
|
||||||
$query = once( function () {
|
$current_year = $request->get('year');
|
||||||
|
|
||||||
|
$startOfYear = "$current_year-01-01 00:00:00";
|
||||||
|
$endOfYear = "$current_year-12-31 23:59:59";
|
||||||
|
|
||||||
|
$query = once( function () use ($startOfYear, $endOfYear) {
|
||||||
return DB::table('pbg_task AS pt')
|
return DB::table('pbg_task AS pt')
|
||||||
->leftJoin('pbg_task_google_sheet AS ptgs', 'pt.registration_number', '=', 'ptgs.no_registrasi')
|
->leftJoin('pbg_task_google_sheet AS ptgs', 'pt.registration_number', '=', 'ptgs.no_registrasi')
|
||||||
->leftJoin('pbg_task_retributions AS ptr', 'pt.uuid', '=', 'ptr.pbg_task_uid') // Join ke pbg_task_retributions
|
->leftJoin('pbg_task_retributions AS ptr', 'pt.uuid', '=', 'ptr.pbg_task_uid') // Join ke pbg_task_retributions
|
||||||
|
->whereBetween("pt.task_created_at", [$startOfYear, $endOfYear])
|
||||||
->where(function ($query) {
|
->where(function ($query) {
|
||||||
$query->whereRaw('LOWER(TRIM(ptgs.status_verifikasi)) != ?', [strtolower(trim('Selesai Verifikasi'))])
|
$query->whereRaw('LOWER(TRIM(ptgs.status_verifikasi)) != ?', [strtolower(trim('Selesai Verifikasi'))])
|
||||||
->orWhereNull('ptgs.status_verifikasi'); // Include NULL values
|
->orWhereNull('ptgs.status_verifikasi'); // Include NULL values
|
||||||
@@ -61,13 +80,22 @@ class DashboardController extends Controller
|
|||||||
"total" => $taskTotal
|
"total" => $taskTotal
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
public function allTaskDocuments(){
|
public function allTaskDocuments(Request $request){
|
||||||
$query = once( function () {
|
$request->validate([
|
||||||
return DB::table('pbg_task')
|
"year" => "required|integer"
|
||||||
->leftJoin('pbg_task_retributions', 'pbg_task.uuid', '=', 'pbg_task_retributions.pbg_task_uid')
|
]);
|
||||||
|
|
||||||
|
$current_year = $request->get('year');
|
||||||
|
|
||||||
|
$startOfYear = "$current_year-01-01 00:00:00";
|
||||||
|
$endOfYear = "$current_year-12-31 23:59:59";
|
||||||
|
$query = once( function () use ($startOfYear, $endOfYear) {
|
||||||
|
return DB::table('pbg_task as pt')
|
||||||
|
->leftJoin('pbg_task_retributions as ptr', 'pt.uuid', '=', 'ptr.pbg_task_uid')
|
||||||
|
->whereBetween("pt.task_created_at", [$startOfYear, $endOfYear])
|
||||||
->select(
|
->select(
|
||||||
DB::raw('COUNT(DISTINCT pbg_task.id) as task_count'),
|
DB::raw('COUNT(DISTINCT pt.id) as task_count'),
|
||||||
DB::raw('SUM(pbg_task_retributions.nilai_retribusi_bangunan) as total_retribution')
|
DB::raw('SUM(ptr.nilai_retribusi_bangunan) as total_retribution')
|
||||||
)
|
)
|
||||||
->first();
|
->first();
|
||||||
});
|
});
|
||||||
@@ -79,11 +107,20 @@ class DashboardController extends Controller
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function verificationDocuments(){
|
public function verificationDocuments(Request $request){
|
||||||
$query = once( function (){
|
$request->validate([
|
||||||
|
"year" => "required|integer"
|
||||||
|
]);
|
||||||
|
|
||||||
|
$current_year = $request->get('year');
|
||||||
|
|
||||||
|
$startOfYear = "$current_year-01-01 00:00:00";
|
||||||
|
$endOfYear = "$current_year-12-31 23:59:59";
|
||||||
|
$query = once( function () use ($startOfYear, $endOfYear){
|
||||||
return DB::table('pbg_task AS pt')
|
return DB::table('pbg_task AS pt')
|
||||||
->leftJoin('pbg_task_google_sheet AS ptgs', 'pt.registration_number', '=', 'ptgs.no_registrasi')
|
->leftJoin('pbg_task_google_sheet AS ptgs', 'pt.registration_number', '=', 'ptgs.no_registrasi')
|
||||||
->leftJoin('pbg_task_retributions AS ptr', 'pt.uuid', '=', 'ptr.pbg_task_uid') // Menambahkan join ke pbg_task_retributions
|
->leftJoin('pbg_task_retributions AS ptr', 'pt.uuid', '=', 'ptr.pbg_task_uid')
|
||||||
|
->whereBetween("pt.task_created_at", [$startOfYear, $endOfYear])
|
||||||
->whereRaw('LOWER(TRIM(ptgs.status_verifikasi)) = ?', [strtolower(trim('Selesai Verifikasi'))])
|
->whereRaw('LOWER(TRIM(ptgs.status_verifikasi)) = ?', [strtolower(trim('Selesai Verifikasi'))])
|
||||||
->selectRaw('COUNT(pt.id) AS total_data,
|
->selectRaw('COUNT(pt.id) AS total_data,
|
||||||
SUM(ptr.nilai_retribusi_bangunan) AS total_retribution')
|
SUM(ptr.nilai_retribusi_bangunan) AS total_retribution')
|
||||||
@@ -99,11 +136,21 @@ class DashboardController extends Controller
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function nonVerificationDocuments(){
|
public function nonVerificationDocuments(Request $request){
|
||||||
$query = once(function () {
|
$request->validate([
|
||||||
|
"year" => "required|integer"
|
||||||
|
]);
|
||||||
|
|
||||||
|
$current_year = $request->get('year');
|
||||||
|
|
||||||
|
$startOfYear = "$current_year-01-01 00:00:00";
|
||||||
|
$endOfYear = "$current_year-12-31 23:59:59";
|
||||||
|
|
||||||
|
$query = once(function () use ($startOfYear, $endOfYear) {
|
||||||
return DB::table('pbg_task AS pt')
|
return DB::table('pbg_task AS pt')
|
||||||
->leftJoin('pbg_task_google_sheet AS ptgs', 'pt.registration_number', '=', 'ptgs.no_registrasi')
|
->leftJoin('pbg_task_google_sheet AS ptgs', 'pt.registration_number', '=', 'ptgs.no_registrasi')
|
||||||
->leftJoin('pbg_task_retributions AS ptr', 'pt.uuid', '=', 'ptr.pbg_task_uid') // Join tabel pbg_task_retributions
|
->leftJoin('pbg_task_retributions AS ptr', 'pt.uuid', '=', 'ptr.pbg_task_uid') // Join tabel pbg_task_retributions
|
||||||
|
->whereBetween("pt.task_created_at", [$startOfYear, $endOfYear])
|
||||||
->where(function ($query) {
|
->where(function ($query) {
|
||||||
$query->whereRaw('LOWER(TRIM(ptgs.status_verifikasi)) != ?', [strtolower(trim('Selesai Verifikasi'))])
|
$query->whereRaw('LOWER(TRIM(ptgs.status_verifikasi)) != ?', [strtolower(trim('Selesai Verifikasi'))])
|
||||||
->orWhereNull('ptgs.status_verifikasi'); // Include NULL values
|
->orWhereNull('ptgs.status_verifikasi'); // Include NULL values
|
||||||
|
|||||||
125
app/Models/BigdataResume.php
Normal file
125
app/Models/BigdataResume.php
Normal file
@@ -0,0 +1,125 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
|
||||||
|
class BigdataResume extends Model
|
||||||
|
{
|
||||||
|
protected $table = "bigdata_resumes";
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'import_datasource_id',
|
||||||
|
'potention_count',
|
||||||
|
'potention_sum',
|
||||||
|
'non_verified_count',
|
||||||
|
'non_verified_sum',
|
||||||
|
'verified_count',
|
||||||
|
'verified_sum',
|
||||||
|
'business_count',
|
||||||
|
'business_sum',
|
||||||
|
'non_business_count',
|
||||||
|
'non_business_sum',
|
||||||
|
];
|
||||||
|
|
||||||
|
public function importDatasource()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(ImportDatasource::class, 'import_datasource_id');
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function generateResumeData($import_datasource_id){
|
||||||
|
$query_verified = once( function () {
|
||||||
|
return DB::table('pbg_task AS pt')
|
||||||
|
->leftJoin('pbg_task_google_sheet AS ptgs', 'pt.registration_number', '=', 'ptgs.no_registrasi')
|
||||||
|
->leftJoin('pbg_task_retributions AS ptr', 'pt.uuid', '=', 'ptr.pbg_task_uid')
|
||||||
|
->whereRaw('LOWER(TRIM(ptgs.status_verifikasi)) = ?', [strtolower(trim('Selesai Verifikasi'))])
|
||||||
|
->selectRaw('COUNT(pt.id) AS total_data,
|
||||||
|
SUM(ptr.nilai_retribusi_bangunan) AS total_retribution')
|
||||||
|
->first();
|
||||||
|
});
|
||||||
|
|
||||||
|
$verified_count = $query_verified->total_data ?? 0;
|
||||||
|
$verified_total = $query_verified->total_retribution ?? 0;
|
||||||
|
|
||||||
|
$query_business = once(function () {
|
||||||
|
return DB::table('pbg_task AS pt')
|
||||||
|
->leftJoin('pbg_task_google_sheet AS ptgs', 'pt.registration_number', '=', 'ptgs.no_registrasi')
|
||||||
|
->leftJoin('pbg_task_retributions AS ptr', 'pt.uuid', '=', 'ptr.pbg_task_uid')
|
||||||
|
->where(function ($query) {
|
||||||
|
$query->whereRaw('LOWER(TRIM(ptgs.status_verifikasi)) != ?', [strtolower(trim('Selesai Verifikasi'))])
|
||||||
|
->orWhereNull('ptgs.status_verifikasi');
|
||||||
|
})
|
||||||
|
->where(function ($query) {
|
||||||
|
$query->whereRaw('LOWER(TRIM(pt.function_type)) = ?', [strtolower(trim('Sebagai Tempat Usaha'))]);
|
||||||
|
})
|
||||||
|
->selectRaw('COUNT(pt.id) AS total_data,
|
||||||
|
SUM(ptr.nilai_retribusi_bangunan) AS total_retribution')
|
||||||
|
->first();
|
||||||
|
});
|
||||||
|
|
||||||
|
$business_count = $query_business->total_data ?? 0;
|
||||||
|
$business_total = $query_business->total_retribution ?? 0;
|
||||||
|
|
||||||
|
$query_non_business = once( function () {
|
||||||
|
return DB::table('pbg_task AS pt')
|
||||||
|
->leftJoin('pbg_task_google_sheet AS ptgs', 'pt.registration_number', '=', 'ptgs.no_registrasi')
|
||||||
|
->leftJoin('pbg_task_retributions AS ptr', 'pt.uuid', '=', 'ptr.pbg_task_uid') // Join ke pbg_task_retributions
|
||||||
|
->where(function ($query) {
|
||||||
|
$query->whereRaw('LOWER(TRIM(ptgs.status_verifikasi)) != ?', [strtolower(trim('Selesai Verifikasi'))])
|
||||||
|
->orWhereNull('ptgs.status_verifikasi'); // Include NULL values
|
||||||
|
})
|
||||||
|
->where(function ($query) {
|
||||||
|
$query->whereRaw('LOWER(TRIM(pt.function_type)) != ?', [strtolower(trim('Sebagai Tempat Usaha'))])
|
||||||
|
->orWhereNull('pt.function_type'); // Include NULL values
|
||||||
|
})
|
||||||
|
->selectRaw('COUNT(pt.id) AS total_data,
|
||||||
|
SUM(ptr.nilai_retribusi_bangunan) AS total_retribution') // Menambahkan SUM dari pbg_task_retributions
|
||||||
|
->first();
|
||||||
|
});
|
||||||
|
$non_business_count = $query_non_business->total_data ?? 0;
|
||||||
|
$non_business_total = $query_non_business->total_retribution ?? 0;
|
||||||
|
|
||||||
|
$query_non_verified = once(function () {
|
||||||
|
return DB::table('pbg_task AS pt')
|
||||||
|
->leftJoin('pbg_task_google_sheet AS ptgs', 'pt.registration_number', '=', 'ptgs.no_registrasi')
|
||||||
|
->leftJoin('pbg_task_retributions AS ptr', 'pt.uuid', '=', 'ptr.pbg_task_uid') // Join tabel pbg_task_retributions
|
||||||
|
->where(function ($query) {
|
||||||
|
$query->whereRaw('LOWER(TRIM(ptgs.status_verifikasi)) != ?', [strtolower(trim('Selesai Verifikasi'))])
|
||||||
|
->orWhereNull('ptgs.status_verifikasi'); // Include NULL values
|
||||||
|
})
|
||||||
|
->selectRaw('COUNT(pt.id) AS total_data,
|
||||||
|
SUM(ptr.nilai_retribusi_bangunan) AS total_retribution') // Menambahkan SUM dari pbg_task_retributions
|
||||||
|
->first();
|
||||||
|
});
|
||||||
|
|
||||||
|
$non_verified_count = $query_non_verified->total_data ?? 0;
|
||||||
|
$non_verified_total = $query_non_verified->total_retribution ?? 0;
|
||||||
|
|
||||||
|
$query_potention = once( function () {
|
||||||
|
return DB::table('pbg_task as pt')
|
||||||
|
->leftJoin('pbg_task_retributions as ptr', 'pt.uuid', '=', 'ptr.pbg_task_uid')
|
||||||
|
->select(
|
||||||
|
DB::raw('COUNT(DISTINCT pt.id) as task_count'),
|
||||||
|
DB::raw('SUM(ptr.nilai_retribusi_bangunan) as total_retribution')
|
||||||
|
)
|
||||||
|
->first();
|
||||||
|
});
|
||||||
|
$potention_count = $query_potention->task_count ?? 0;
|
||||||
|
$potention_total = $query_potention->total_retribution ?? 0;
|
||||||
|
|
||||||
|
return self::create([
|
||||||
|
'import_datasource_id' => $import_datasource_id,
|
||||||
|
'potention_count' => $potention_count ?? 0,
|
||||||
|
'potention_sum' => $potention_total ?? 0.00,
|
||||||
|
'non_verified_count' => $non_verified_count ?? 0,
|
||||||
|
'non_verified_sum' => $non_verified_total ?? 0.00,
|
||||||
|
'verified_count' => $verified_count ?? 0,
|
||||||
|
'verified_sum' => $verified_total ?? 0.00,
|
||||||
|
'business_count' => $business_count ?? 0,
|
||||||
|
'business_sum' => $business_total ?? 0.00,
|
||||||
|
'non_business_count' => $non_business_count ?? 0,
|
||||||
|
'non_business_sum' => $non_business_total ?? 0.00,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -46,6 +46,7 @@ class ServiceClient
|
|||||||
$resultResponse = json_decode($response->getBody(), true);
|
$resultResponse = json_decode($response->getBody(), true);
|
||||||
return $this->resSuccess($resultResponse);
|
return $this->resSuccess($resultResponse);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
|
\Log::error('error from client service'. $e->getMessage());
|
||||||
return $this->resError($e->getMessage());
|
return $this->resError($e->getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
namespace App\Services;
|
namespace App\Services;
|
||||||
|
|
||||||
use App\Enums\ImportDatasourceStatus;
|
use App\Enums\ImportDatasourceStatus;
|
||||||
|
use App\Models\BigdataResume;
|
||||||
use App\Models\GlobalSetting;
|
use App\Models\GlobalSetting;
|
||||||
use App\Models\ImportDatasource;
|
use App\Models\ImportDatasource;
|
||||||
use App\Models\PbgTaskIndexIntegrations;
|
use App\Models\PbgTaskIndexIntegrations;
|
||||||
@@ -28,10 +29,10 @@ class ServiceSIMBG
|
|||||||
*/
|
*/
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->email = trim((string) GlobalSetting::where('key','SIMBG_EMAIL')->first()->value);
|
$this->email = trim((string) GlobalSetting::where('key','SIMBG_EMAIL')->firstOrFail()->value);
|
||||||
$this->password = trim((string) GlobalSetting::where('key','SIMBG_PASSWORD')->first()->value);
|
$this->password = trim((string) GlobalSetting::where('key','SIMBG_PASSWORD')->firstOrFail()->value);
|
||||||
$this->simbg_host = trim((string)GlobalSetting::where('key','SIMBG_HOST')->first()->value);
|
$this->simbg_host = trim((string)GlobalSetting::where('key','SIMBG_HOST')->firstOrFail()->value);
|
||||||
$this->fetch_per_page = trim((string)GlobalSetting::where('key','FETCH_PER_PAGE')->first()->value);
|
$this->fetch_per_page = trim((string)GlobalSetting::where('key','FETCH_PER_PAGE')->firstOrFail()->value);
|
||||||
$this->service_client = new ServiceClient($this->simbg_host);
|
$this->service_client = new ServiceClient($this->simbg_host);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -60,8 +61,6 @@ class ServiceSIMBG
|
|||||||
|
|
||||||
$res = $this->service_client->get($url, $headers);
|
$res = $this->service_client->get($url, $headers);
|
||||||
|
|
||||||
Log::info("response index integration", ['res' => $res]);
|
|
||||||
|
|
||||||
if (empty($res->original['success']) || !$res->original['success']) {
|
if (empty($res->original['success']) || !$res->original['success']) {
|
||||||
// Log error
|
// Log error
|
||||||
Log::error("API response indicates failure", ['url' => $url, 'uuid' => $uuid]);
|
Log::error("API response indicates failure", ['url' => $url, 'uuid' => $uuid]);
|
||||||
@@ -183,8 +182,22 @@ class ServiceSIMBG
|
|||||||
'created_at' => now(),
|
'created_at' => now(),
|
||||||
];
|
];
|
||||||
|
|
||||||
$this->syncIndexIntegration($item['uid'], $token);
|
$save_integration = $this->syncIndexIntegration($item['uid'], $token);
|
||||||
$this->syncTaskDetailSubmit($item['uid'], $token);
|
if (!$save_integration) {
|
||||||
|
$importDatasource->update([
|
||||||
|
'status' => ImportDatasourceStatus::Failed->value,
|
||||||
|
'message' => "Successfully processed: $savedCount, Failed: $failedCount"
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$save_detail = $this->syncTaskDetailSubmit($item['uid'], $token);
|
||||||
|
if( !$save_detail ) {
|
||||||
|
$importDatasource->update([
|
||||||
|
'status' => ImportDatasourceStatus::Failed->value,
|
||||||
|
'message' => "Successfully processed: $savedCount, Failed: $failedCount"
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
$savedCount++;
|
$savedCount++;
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$failedCount++;
|
$failedCount++;
|
||||||
@@ -213,6 +226,8 @@ class ServiceSIMBG
|
|||||||
'message' => "Successfully processed: $savedCount, Failed: $failedCount"
|
'message' => "Successfully processed: $savedCount, Failed: $failedCount"
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
BigdataResume::generateResumeData($importDatasource->id);
|
||||||
|
|
||||||
Log::info("syncTaskList completed", ['savedCount' => $savedCount, 'failedCount' => $failedCount]);
|
Log::info("syncTaskList completed", ['savedCount' => $savedCount, 'failedCount' => $failedCount]);
|
||||||
|
|
||||||
return $this->resSuccess(['savedCount' => $savedCount, 'failedCount' => $failedCount]);
|
return $this->resSuccess(['savedCount' => $savedCount, 'failedCount' => $failedCount]);
|
||||||
|
|||||||
@@ -0,0 +1,39 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::create('bigdata_resumes', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->unsignedBigInteger('import_datasource_id');
|
||||||
|
$table->integer('potention_count')->default(0);
|
||||||
|
$table->decimal('potention_sum', 20, 2)->default(0);
|
||||||
|
$table->integer('non_verified_count')->default(0);
|
||||||
|
$table->decimal('non_verified_sum', 20, 2)->default(0);
|
||||||
|
$table->integer('verified_count')->default(0);
|
||||||
|
$table->decimal('verified_sum', 20, 2)->default(0);
|
||||||
|
$table->integer('business_count')->default(0);
|
||||||
|
$table->decimal('business_sum', 20, 2)->default(0);
|
||||||
|
$table->integer('non_business_count')->default(0);
|
||||||
|
$table->decimal('non_business_sum', 20, 2)->default(0);
|
||||||
|
$table->timestamps();
|
||||||
|
$table->foreign('import_datasource_id')->references('id')->on('import_datasources')->onDelete('cascade');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('bigdata_resumes');
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -94,16 +94,25 @@
|
|||||||
"isEntry": true
|
"isEntry": true
|
||||||
},
|
},
|
||||||
"resources/js/dashboards/bigdata.js": {
|
"resources/js/dashboards/bigdata.js": {
|
||||||
"file": "assets/bigdata-C1y9KS-u.js",
|
"file": "assets/bigdata-DCJUcfXz.js",
|
||||||
"name": "bigdata",
|
"name": "bigdata",
|
||||||
"src": "resources/js/dashboards/bigdata.js",
|
"src": "resources/js/dashboards/bigdata.js",
|
||||||
"isEntry": true,
|
"isEntry": true,
|
||||||
"imports": [
|
"imports": [
|
||||||
"_global-config-9uDKFQ8j.js"
|
"_global-config-9uDKFQ8j.js"
|
||||||
|
],
|
||||||
|
"css": [
|
||||||
|
"assets/flatpickr-CksuuEqD.css"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"resources/js/data-settings/create.js": {
|
||||||
|
"file": "assets/create-C1IbeTHP.js",
|
||||||
|
"name": "create",
|
||||||
|
"src": "resources/js/data-settings/create.js",
|
||||||
|
"isEntry": true
|
||||||
|
},
|
||||||
"resources/js/data-settings/index.js": {
|
"resources/js/data-settings/index.js": {
|
||||||
"file": "assets/index-CzuDcG6g.js",
|
"file": "assets/index-Bm5aE3Il.js",
|
||||||
"name": "index",
|
"name": "index",
|
||||||
"src": "resources/js/data-settings/index.js",
|
"src": "resources/js/data-settings/index.js",
|
||||||
"isEntry": true,
|
"isEntry": true,
|
||||||
@@ -113,8 +122,26 @@
|
|||||||
"__commonjsHelpers-C4iS2aBk.js"
|
"__commonjsHelpers-C4iS2aBk.js"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"resources/js/data-settings/update.js": {
|
||||||
|
"file": "assets/update-nNw3P4hj.js",
|
||||||
|
"name": "update",
|
||||||
|
"src": "resources/js/data-settings/update.js",
|
||||||
|
"isEntry": true
|
||||||
|
},
|
||||||
|
"resources/js/master/users/create.js": {
|
||||||
|
"file": "assets/create-RO4xgm-f.js",
|
||||||
|
"name": "create",
|
||||||
|
"src": "resources/js/master/users/create.js",
|
||||||
|
"isEntry": true
|
||||||
|
},
|
||||||
|
"resources/js/master/users/update.js": {
|
||||||
|
"file": "assets/update-DhoG4v8r.js",
|
||||||
|
"name": "update",
|
||||||
|
"src": "resources/js/master/users/update.js",
|
||||||
|
"isEntry": true
|
||||||
|
},
|
||||||
"resources/js/master/users/users.js": {
|
"resources/js/master/users/users.js": {
|
||||||
"file": "assets/users-BoDXPe3W.js",
|
"file": "assets/users-uzXjZCws.js",
|
||||||
"name": "users",
|
"name": "users",
|
||||||
"src": "resources/js/master/users/users.js",
|
"src": "resources/js/master/users/users.js",
|
||||||
"isEntry": true,
|
"isEntry": true,
|
||||||
@@ -124,6 +151,29 @@
|
|||||||
"__commonjsHelpers-C4iS2aBk.js"
|
"__commonjsHelpers-C4iS2aBk.js"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"resources/js/menus/create.js": {
|
||||||
|
"file": "assets/create-ChUgh-yc.js",
|
||||||
|
"name": "create",
|
||||||
|
"src": "resources/js/menus/create.js",
|
||||||
|
"isEntry": true
|
||||||
|
},
|
||||||
|
"resources/js/menus/index.js": {
|
||||||
|
"file": "assets/index-qw4Wj-LG.js",
|
||||||
|
"name": "index",
|
||||||
|
"src": "resources/js/menus/index.js",
|
||||||
|
"isEntry": true,
|
||||||
|
"imports": [
|
||||||
|
"_gridjs.umd-BiCNXlqL.js",
|
||||||
|
"_global-config-9uDKFQ8j.js",
|
||||||
|
"__commonjsHelpers-C4iS2aBk.js"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"resources/js/menus/update.js": {
|
||||||
|
"file": "assets/update-8JQOGES4.js",
|
||||||
|
"name": "update",
|
||||||
|
"src": "resources/js/menus/update.js",
|
||||||
|
"isEntry": true
|
||||||
|
},
|
||||||
"resources/js/pages/chart.js": {
|
"resources/js/pages/chart.js": {
|
||||||
"file": "assets/chart-DQBoD9wk.js",
|
"file": "assets/chart-DQBoD9wk.js",
|
||||||
"name": "chart",
|
"name": "chart",
|
||||||
@@ -233,6 +283,35 @@
|
|||||||
"__commonjsHelpers-C4iS2aBk.js"
|
"__commonjsHelpers-C4iS2aBk.js"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"resources/js/roles/create.js": {
|
||||||
|
"file": "assets/create-Dd-lHOwF.js",
|
||||||
|
"name": "create",
|
||||||
|
"src": "resources/js/roles/create.js",
|
||||||
|
"isEntry": true
|
||||||
|
},
|
||||||
|
"resources/js/roles/index.js": {
|
||||||
|
"file": "assets/index-B9clkWIC.js",
|
||||||
|
"name": "index",
|
||||||
|
"src": "resources/js/roles/index.js",
|
||||||
|
"isEntry": true,
|
||||||
|
"imports": [
|
||||||
|
"_gridjs.umd-BiCNXlqL.js",
|
||||||
|
"_global-config-9uDKFQ8j.js",
|
||||||
|
"__commonjsHelpers-C4iS2aBk.js"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"resources/js/roles/role_menu.js": {
|
||||||
|
"file": "assets/role_menu-BuFAi1wM.js",
|
||||||
|
"name": "role_menu",
|
||||||
|
"src": "resources/js/roles/role_menu.js",
|
||||||
|
"isEntry": true
|
||||||
|
},
|
||||||
|
"resources/js/roles/update.js": {
|
||||||
|
"file": "assets/update-CapXnAP8.js",
|
||||||
|
"name": "update",
|
||||||
|
"src": "resources/js/roles/update.js",
|
||||||
|
"isEntry": true
|
||||||
|
},
|
||||||
"resources/js/settings/general/general-settings.js": {
|
"resources/js/settings/general/general-settings.js": {
|
||||||
"file": "assets/general-settings-BoJeYQk1.js",
|
"file": "assets/general-settings-BoJeYQk1.js",
|
||||||
"name": "general-settings",
|
"name": "general-settings",
|
||||||
@@ -277,7 +356,7 @@
|
|||||||
"isEntry": true
|
"isEntry": true
|
||||||
},
|
},
|
||||||
"resources/scss/style.scss": {
|
"resources/scss/style.scss": {
|
||||||
"file": "assets/style-B2v4WMju.css",
|
"file": "assets/style-B3TufzIa.css",
|
||||||
"src": "resources/scss/style.scss",
|
"src": "resources/scss/style.scss",
|
||||||
"isEntry": true
|
"isEntry": true
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,16 +1,64 @@
|
|||||||
import Big from "big.js";
|
import Big from "big.js";
|
||||||
import GlobalConfig, { addThousandSeparators } from "../global-config.js";
|
import GlobalConfig, { addThousandSeparators } from "../global-config.js";
|
||||||
|
import flatpickr from "flatpickr";
|
||||||
|
import "flatpickr/dist/flatpickr.min.css";
|
||||||
|
|
||||||
class BigData {
|
class BigData {
|
||||||
async init() {
|
async init() {
|
||||||
try {
|
try {
|
||||||
this.totalTargetPAD = await this.getTargetPAD();
|
this.filterYear = new Date().getFullYear(); // Set initial year
|
||||||
this.resultDataTotal = await this.getDataTotalPotensi();
|
|
||||||
this.dataVerification = await this.getDataVerfication();
|
let yearInput = document.querySelector("#yearPicker");
|
||||||
this.dataNonVerification = await this.getDataNonVerfication();
|
let filterButton = document.querySelector("#btnFilterYear");
|
||||||
this.dataBusiness = await this.getDataBusiness();
|
|
||||||
this.dataNonBusiness = await this.getDataNonBusiness();
|
if (!yearInput || !filterButton) {
|
||||||
this.dataTataRuang = await this.getDataTataRuang();
|
console.error(
|
||||||
|
"Element #yearPicker or #btnFilterYear not found."
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set default value for input
|
||||||
|
yearInput.value = this.filterYear;
|
||||||
|
|
||||||
|
// Handle manual input (pressing Enter)
|
||||||
|
yearInput.addEventListener("keypress", (event) => {
|
||||||
|
if (event.key === "Enter") {
|
||||||
|
this.updateYear(yearInput.value);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Handle button click
|
||||||
|
filterButton.addEventListener("click", () => {
|
||||||
|
this.updateYear(yearInput.value);
|
||||||
|
});
|
||||||
|
|
||||||
|
console.log("init filter this year", this.filterYear);
|
||||||
|
|
||||||
|
// Load initial data
|
||||||
|
await this.updateData(this.filterYear);
|
||||||
|
} catch (error) {
|
||||||
|
console.error("Error initializing data:", error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
updateYear(value) {
|
||||||
|
let inputYear = parseInt(value, 10);
|
||||||
|
if (!isNaN(inputYear)) {
|
||||||
|
this.filterYear = inputYear;
|
||||||
|
this.updateData(this.filterYear);
|
||||||
|
} else {
|
||||||
|
console.error("Invalid year input");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
async updateData(year) {
|
||||||
|
try {
|
||||||
|
this.totalTargetPAD = await this.getTargetPAD(year);
|
||||||
|
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);
|
||||||
|
|
||||||
// total potensi
|
// total potensi
|
||||||
this.bigTargetPAD = new Big(this.totalTargetPAD ?? 0);
|
this.bigTargetPAD = new Big(this.totalTargetPAD ?? 0);
|
||||||
@@ -54,7 +102,10 @@ class BigData {
|
|||||||
this.bigTotalNonVerification = new Big(
|
this.bigTotalNonVerification = new Big(
|
||||||
this.dataNonVerification.total
|
this.dataNonVerification.total
|
||||||
);
|
);
|
||||||
this.percentageResultNonVerification = this.bigTotalNonVerification
|
this.percentageResultNonVerification =
|
||||||
|
this.bigTotalNonVerification <= 0 || this.bigTotalPotensi
|
||||||
|
? 0
|
||||||
|
: this.bigTotalNonVerification
|
||||||
.div(this.bigTotalPotensi)
|
.div(this.bigTotalPotensi)
|
||||||
.times(100)
|
.times(100)
|
||||||
.toFixed(2);
|
.toFixed(2);
|
||||||
@@ -82,7 +133,8 @@ class BigData {
|
|||||||
// non-business documents
|
// non-business documents
|
||||||
this.bigTotalNonBusiness = new Big(this.dataNonBusiness.total);
|
this.bigTotalNonBusiness = new Big(this.dataNonBusiness.total);
|
||||||
this.percentageResultNonBusiness =
|
this.percentageResultNonBusiness =
|
||||||
this.bigTotalNonBusiness <= 0
|
this.bigTotalNonBusiness <= 0 ||
|
||||||
|
this.bigTotalNonVerification <= 0
|
||||||
? 0
|
? 0
|
||||||
: this.bigTotalNonBusiness
|
: this.bigTotalNonBusiness
|
||||||
.div(this.bigTotalNonVerification)
|
.div(this.bigTotalNonVerification)
|
||||||
@@ -110,10 +162,10 @@ class BigData {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async getDataTotalPotensi() {
|
async getDataTotalPotensi(year) {
|
||||||
try {
|
try {
|
||||||
const response = await fetch(
|
const response = await fetch(
|
||||||
`${GlobalConfig.apiHost}/api/all-task-documents`,
|
`${GlobalConfig.apiHost}/api/all-task-documents?year=${year}`,
|
||||||
{
|
{
|
||||||
credentials: "include",
|
credentials: "include",
|
||||||
headers: {
|
headers: {
|
||||||
@@ -132,7 +184,6 @@ class BigData {
|
|||||||
|
|
||||||
const data = await response.json();
|
const data = await response.json();
|
||||||
return {
|
return {
|
||||||
seriesData: data.data.series,
|
|
||||||
countData: data.data.count,
|
countData: data.data.count,
|
||||||
totalData: data.data.total,
|
totalData: data.data.total,
|
||||||
};
|
};
|
||||||
@@ -142,7 +193,7 @@ class BigData {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async getTargetPAD() {
|
async getTargetPAD(year) {
|
||||||
try {
|
try {
|
||||||
const response = await fetch(
|
const response = await fetch(
|
||||||
`${GlobalConfig.apiHost}/api/api-data-settings?search=target_pad`,
|
`${GlobalConfig.apiHost}/api/api-data-settings?search=target_pad`,
|
||||||
@@ -160,20 +211,24 @@ class BigData {
|
|||||||
|
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
console.error("Network response was not ok", response);
|
console.error("Network response was not ok", response);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
const data = await response.json();
|
const data = await response.json();
|
||||||
return data.data[0].value;
|
const valueTargetPAD = data.data[0]?.value ?? 0;
|
||||||
|
const currentMonth = new Date().getMonth() + 1;
|
||||||
|
let result = (currentMonth / 12) * valueTargetPAD;
|
||||||
|
return result;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Error fetching chart data:", error);
|
console.error("Error fetching chart data:", error);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async getDataVerfication() {
|
async getDataVerfication(year) {
|
||||||
try {
|
try {
|
||||||
const response = await fetch(
|
const response = await fetch(
|
||||||
`${GlobalConfig.apiHost}/api/verification-documents`,
|
`${GlobalConfig.apiHost}/api/verification-documents?year=${year}`,
|
||||||
{
|
{
|
||||||
credentials: "include",
|
credentials: "include",
|
||||||
headers: {
|
headers: {
|
||||||
@@ -201,10 +256,10 @@ class BigData {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async getDataNonVerfication() {
|
async getDataNonVerfication(year) {
|
||||||
try {
|
try {
|
||||||
const response = await fetch(
|
const response = await fetch(
|
||||||
`${GlobalConfig.apiHost}/api/non-verification-documents`,
|
`${GlobalConfig.apiHost}/api/non-verification-documents?year=${year}`,
|
||||||
{
|
{
|
||||||
credentials: "include",
|
credentials: "include",
|
||||||
headers: {
|
headers: {
|
||||||
@@ -232,10 +287,10 @@ class BigData {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async getDataBusiness() {
|
async getDataBusiness(year) {
|
||||||
try {
|
try {
|
||||||
const response = await fetch(
|
const response = await fetch(
|
||||||
`${GlobalConfig.apiHost}/api/business-documents`,
|
`${GlobalConfig.apiHost}/api/business-documents?year=${year}`,
|
||||||
{
|
{
|
||||||
credentials: "include",
|
credentials: "include",
|
||||||
headers: {
|
headers: {
|
||||||
@@ -263,10 +318,10 @@ class BigData {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async getDataNonBusiness() {
|
async getDataNonBusiness(year) {
|
||||||
try {
|
try {
|
||||||
const response = await fetch(
|
const response = await fetch(
|
||||||
`${GlobalConfig.apiHost}/api/non-business-documents`,
|
`${GlobalConfig.apiHost}/api/non-business-documents?year=${year}`,
|
||||||
{
|
{
|
||||||
credentials: "include",
|
credentials: "include",
|
||||||
headers: {
|
headers: {
|
||||||
|
|||||||
@@ -55,6 +55,11 @@
|
|||||||
MELALUI APLIKASI SIBEDAS PBG
|
MELALUI APLIKASI SIBEDAS PBG
|
||||||
|
|
||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
|
<div class="d-flex justify-content-end">
|
||||||
|
<input type="number" class="me-3" id="yearPicker" name="year">
|
||||||
|
<button class="btn btn-sm btn-primary" id="btnFilterYear">filter</button>
|
||||||
|
</div>
|
||||||
<div id="dashboard-fixed-container" style="width:1110px;height:770px;position:relative;margin:auto;">
|
<div id="dashboard-fixed-container" style="width:1110px;height:770px;position:relative;margin:auto;">
|
||||||
@component('components.circle', [
|
@component('components.circle', [
|
||||||
'document_title' => 'Kekurangan Potensi',
|
'document_title' => 'Kekurangan Potensi',
|
||||||
|
|||||||
@@ -47,7 +47,6 @@ export default defineConfig({
|
|||||||
//js-additional
|
//js-additional
|
||||||
"resources/js/dashboards/bigdata.js",
|
"resources/js/dashboards/bigdata.js",
|
||||||
"resources/js/settings/syncronize/syncronize.js",
|
"resources/js/settings/syncronize/syncronize.js",
|
||||||
"resources/js/data-settings/index.js",
|
|
||||||
"resources/js/pbg-task/index.js",
|
"resources/js/pbg-task/index.js",
|
||||||
"resources/js/settings/general/general-settings.js",
|
"resources/js/settings/general/general-settings.js",
|
||||||
"resources/js/tables/common-table.js",
|
"resources/js/tables/common-table.js",
|
||||||
@@ -55,7 +54,7 @@ export default defineConfig({
|
|||||||
"resources/js/roles/index.js",
|
"resources/js/roles/index.js",
|
||||||
"resources/js/roles/create.js",
|
"resources/js/roles/create.js",
|
||||||
"resources/js/roles/update.js",
|
"resources/js/roles/update.js",
|
||||||
"resources/roles/role_menu.js",
|
"resources/js/roles/role_menu.js",
|
||||||
// users
|
// users
|
||||||
"resources/js/master/users/users.js",
|
"resources/js/master/users/users.js",
|
||||||
"resources/js/master/users/create.js",
|
"resources/js/master/users/create.js",
|
||||||
@@ -64,6 +63,10 @@ export default defineConfig({
|
|||||||
"resources/js/menus/index.js",
|
"resources/js/menus/index.js",
|
||||||
"resources/js/menus/create.js",
|
"resources/js/menus/create.js",
|
||||||
"resources/js/menus/update.js",
|
"resources/js/menus/update.js",
|
||||||
|
//data-settings
|
||||||
|
"resources/js/data-settings/index.js",
|
||||||
|
"resources/js/data-settings/create.js",
|
||||||
|
"resources/js/data-settings/update.js",
|
||||||
],
|
],
|
||||||
refresh: true,
|
refresh: true,
|
||||||
}),
|
}),
|
||||||
|
|||||||
Reference in New Issue
Block a user