diff --git a/.env.example b/.env.example index a1b3de4..b4fad41 100755 --- a/.env.example +++ b/.env.example @@ -64,3 +64,7 @@ AWS_BUCKET= AWS_USE_PATH_STYLE_ENDPOINT=false VITE_APP_NAME="${APP_NAME}" + +SIMBG_HOST="xxxxxx" +SIMBG_EMAIL="xxxxxx" +SIMBG_PASSWORD="xxxxx" \ No newline at end of file diff --git a/app/Helpers/ApiResponse.php b/app/Helpers/ApiResponse.php new file mode 100644 index 0000000..d5827cb --- /dev/null +++ b/app/Helpers/ApiResponse.php @@ -0,0 +1,29 @@ +json([ + 'success' => true, + 'message' => $message, + 'data' => $data + ]); + } + + public static function errorResponse($message, $statusCode = 400){ + return response()->json([ + 'success' => false, + 'message' => $message, + ], $statusCode); + } +} diff --git a/app/Http/Controllers/Api/DashboardController.php b/app/Http/Controllers/Api/DashboardController.php new file mode 100644 index 0000000..73a5c71 --- /dev/null +++ b/app/Http/Controllers/Api/DashboardController.php @@ -0,0 +1,72 @@ +leftJoin('pbg_task_retributions', 'pbg_task.uuid', '=', 'pbg_task_retributions.pbg_task_uid') + ->select( + DB::raw('COUNT(DISTINCT pbg_task.id) as task_count'), + DB::raw('SUM(pbg_task_retributions.nilai_retribusi_bangunan) as total_retribution') + ) + ->where(function ($query) { + $query->where("pbg_task.function_type", "NOT LIKE", "sebagai tempat usaha%") + ->orWhereNull("pbg_task.function_type"); + }) + ->first(); + $taskCount = $businessData->task_count; + $taskTotal = $businessData->total_retribution; + $result = [ + "count" => $taskCount, + "series" => [$taskCount], + "total" => $taskTotal + ]; + return ApiResponse::successResponse($result, "Successfully count businness doucument"); + } + public function nonBusinnessDocument(Request $request){ + $businessData = DB::table('pbg_task') + ->leftJoin('pbg_task_retributions', 'pbg_task.uuid', '=', 'pbg_task_retributions.pbg_task_uid') + ->select( + DB::raw('COUNT(DISTINCT pbg_task.id) as task_count'), + DB::raw('SUM(pbg_task_retributions.nilai_retribusi_bangunan) as total_retribution') + ) + ->where(function ($query) { + $query->where("pbg_task.function_type", "LIKE", "sebagai tempat usaha%"); + }) + ->first(); + $taskCount = $businessData->task_count; + $taskTotal = $businessData->total_retribution; + $result = [ + "count" => $taskCount, + "series" => [$taskCount], + "total" => $taskTotal + ]; + return ApiResponse::successResponse($result, "Successfully count not businness doucument"); + } + public function allTaskDocuments(){ + $query = DB::table('pbg_task') + ->leftJoin('pbg_task_retributions', 'pbg_task.uuid', '=', 'pbg_task_retributions.pbg_task_uid') + ->select( + DB::raw('COUNT(DISTINCT pbg_task.id) as task_count'), + DB::raw('SUM(pbg_task_retributions.nilai_retribusi_bangunan) as total_retribution') + ) + ->first(); + $taskCount = $query->task_count; + $taskTotal = $query->total_retribution; + $result = [ + "count" => $taskCount, + "series" => [$taskCount], + "total" => $taskTotal + ]; + return ApiResponse::successResponse($result, "Successfully count all tasks documents"); + } +} diff --git a/app/Http/Controllers/Api/UsersController.php b/app/Http/Controllers/Api/UsersController.php new file mode 100644 index 0000000..a347152 --- /dev/null +++ b/app/Http/Controllers/Api/UsersController.php @@ -0,0 +1,24 @@ +email)->first(); + + if(!$user || !Hash::check($request->password, $user->password)){ + return response(['message' => 'Invalid credentials'], 401); + } + + $token = $user->createToken($_ENV['APP_KEY'])->plainTextToken; + + return response(['user' => $user, 'token' => $token], 200); + } +} diff --git a/app/Http/Controllers/Dashboards/BigDataController.php b/app/Http/Controllers/Dashboards/BigDataController.php new file mode 100644 index 0000000..7968421 --- /dev/null +++ b/app/Http/Controllers/Dashboards/BigDataController.php @@ -0,0 +1,13 @@ +validate([ + 'name' => ['required', 'string', 'max:255'], + 'email' => ['required', 'string', 'email', 'max:255', 'unique:users'], + 'password' => ['required', 'confirmed', Rules\Password::defaults()], + 'firstname' => ['required', 'string', 'max:255'], + 'lastname' => ['required', 'string', 'max:255'], + 'position' => ['required', 'string', 'max:255'] + ]); + + dd($request); + + $user = User::create([ + 'name' => $request->name, + 'email' => $request->email, + 'password' => Hash::make($request->password), + 'firstname' => $request->firstname, + 'lastname' => $request->lastname, + 'position' => $request->position + ]); + + return redirect()->route('master.users')->with('success','Successfully registered'); + } + public function show($id){ + $user = User::find($id); + return view('master.users.show', compact('user')); + } + public function edit($id){ + $user = User::find($id); + return view('master.users.edit', compact('user')); + } + public function update(Request $request, $id){ + $user = User::find($id); + $validate = $request->validate([ + 'name' => ['required', 'string', 'max:255'], + 'email' => ['required', 'string', 'email', 'max:255', 'unique:users'], + 'password' => ['required', 'confirmed', Rules\Password::defaults()], + 'firstname' => ['required', 'string', 'max:255'], + 'lastname' => ['required', 'string', 'max:255'], + 'position' => ['required', 'string', 'max:255'] + ]); + $user->update($validate); + return redirect()->route('master.users')->with('success', 'Successfully'); + } + public function destroy($id){ + $user = User::find($id); + $user->delete(); + return redirect()->route('master.users')->with('success','Successfully deleted'); + } +} diff --git a/app/Http/Controllers/Settings/SettingsController.php b/app/Http/Controllers/Settings/SettingsController.php new file mode 100644 index 0000000..1ba3af3 --- /dev/null +++ b/app/Http/Controllers/Settings/SettingsController.php @@ -0,0 +1,17 @@ +syncTaskList(); + return $res; + } + + public function syncronizeTask(Request $request){ + $res = (new ServiceSIMBG())->syncTaskList(); + return redirect()->back()->with('success', 'Processing completed successfully'); + } + + public function getUserToken(){ + $res = (new ServiceSIMBG())->getToken(); + return $res; + } + + public function syncIndexIntegration($uuid){ + $res = (new ServiceSIMBG())->syncIndexIntegration($uuid); + return $res; + } + + public function syncTaskDetailSubmit($uuid){ + $res = (new ServiceSIMBG())->syncTaskDetailSubmit($uuid); + return $res; + } +} diff --git a/app/Models/PbgTask.php b/app/Models/PbgTask.php new file mode 100644 index 0000000..493682b --- /dev/null +++ b/app/Models/PbgTask.php @@ -0,0 +1,36 @@ +hasOne(PbgTaskRetributions::class, 'pbg_task_uid', 'uuid'); + } +} diff --git a/app/Models/PbgTaskIndexIntegrations.php b/app/Models/PbgTaskIndexIntegrations.php new file mode 100644 index 0000000..d0405a0 --- /dev/null +++ b/app/Models/PbgTaskIndexIntegrations.php @@ -0,0 +1,24 @@ +belongsTo(PbgTask::class, 'pbg_task_uid', 'uuid'); + } +} diff --git a/app/Models/User.php b/app/Models/User.php index 3dfbd80..3c1f934 100755 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -6,11 +6,12 @@ namespace App\Models; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Foundation\Auth\User as Authenticatable; use Illuminate\Notifications\Notifiable; +use Laravel\Sanctum\HasApiTokens; class User extends Authenticatable { /** @use HasFactory<\Database\Factories\UserFactory> */ - use HasFactory, Notifiable; + use HasFactory, Notifiable, HasApiTokens; /** * The attributes that are mass assignable. @@ -21,6 +22,9 @@ class User extends Authenticatable 'name', 'email', 'password', + 'firstname', + 'lastname', + 'position' ]; /** diff --git a/app/ServiceClient.php b/app/ServiceClient.php new file mode 100644 index 0000000..5518d49 --- /dev/null +++ b/app/ServiceClient.php @@ -0,0 +1,73 @@ +client = new Client(); + $this->baseUrl = $baseUrl; + $this->headers = array_merge( + [ + 'Accept' => 'application/json', + 'Content-Type' => 'application/json' + ], + $headers + ); + } + + public function makeRequest($url, $method = 'GET', $body = null, $headers = []){ + try { + + $headers = array_merge($this->headers, $headers); + + $options = [ + 'headers' => $headers, + ]; + + if ($body) { + $options['json'] = $body; // Guzzle akan mengonversi array ke JSON + } + + $response = $this->client->request($method, $this->baseUrl . $url, $options); + + $resultResponse = json_decode($response->getBody(), true); + return ApiResponse::successResponse($resultResponse, "Successfully fetched data"); + } catch (Exception $e) { + return ApiResponse::errorResponse($e->getMessage(), $e->getCode()); + } + } + + // Fungsi untuk melakukan permintaan GET + public function get($url, $headers = []) + { + return $this->makeRequest($url, 'GET', null, $headers); + } + + // Fungsi untuk melakukan permintaan POST + public function post($url, $body, $headers = []) + { + return $this->makeRequest($url, 'POST', $body, $headers); + } + + // Fungsi untuk melakukan permintaan PUT + public function put($url, $body, $headers = []) + { + return $this->makeRequest($url, 'PUT', $body, $headers); + } + + // Fungsi untuk melakukan permintaan DELETE + public function delete($url, $headers = []) + { + return $this->makeRequest($url, 'DELETE', null, $headers); + } +} diff --git a/app/ServiceSIMBG.php b/app/ServiceSIMBG.php new file mode 100644 index 0000000..bff6674 --- /dev/null +++ b/app/ServiceSIMBG.php @@ -0,0 +1,278 @@ +email = $_ENV['SIMBG_EMAIL']; + $this->password = $_ENV['SIMBG_PASSWORD']; + } + + public function getToken(){ + $clientHelper = new ServiceClient($_ENV['SIMBG_HOST']); + $url = "api/user/v1/auth/login/"; + $body = [ + 'email' => $this->email, + 'password' => $this->password, + ]; + + $res = $clientHelper->post($url, $body); + if(!$res->original['success']){ + return null; + } + return $res; + } + + public function syncIndexIntegration($uuid) + { + $clientHelper = new ServiceClient($_ENV['SIMBG_HOST']); + $url = "api/pbg/v1/detail/" . $uuid . "/retribution/indeks-terintegrasi/"; + $resToken = $this->getToken(); + + if (!isset($resToken) || empty($resToken->original['data']['token']['access'])) { + // Log error + \Log::error("Token not retrieved for syncIndexIntegration", ['uuid' => $uuid]); + return null; + } + + $apiToken = $resToken->original['data']['token']['access']; + $headers = [ + 'Authorization' => "Bearer " . $apiToken, + ]; + + $res = $clientHelper->get($url, $headers); + + if (empty($res->original['success']) || !$res->original['success']) { + // Log error + \Log::error("API response indicates failure", ['url' => $url, 'uuid' => $uuid]); + return null; + } + + $data = $res->original['data']['data'] ?? null; + if (!$data) { + \Log::error("No valid data returned from API", ['url' => $url, 'uuid' => $uuid]); + return null; + } + + PbgTaskIndexIntegrations::updateOrCreate( + ['pbg_task_uid' => $uuid], + [ + 'indeks_fungsi_bangunan' => $data['indeks_fungsi_bangunan'] ?? null, + 'indeks_parameter_kompleksitas' => $data['indeks_parameter_kompleksitas'] ?? null, + 'indeks_parameter_permanensi' => $data['indeks_parameter_permanensi'] ?? null, + 'indeks_parameter_ketinggian' => $data['indeks_parameter_ketinggian'] ?? null, + 'faktor_kepemilikan' => $data['faktor_kepemilikan'] ?? null, + 'indeks_terintegrasi' => $data['indeks_terintegrasi'] ?? null, + 'total' => $data['total'] ?? null, + ] + ); + + // Log success + \Log::info("syncIndexIntegration completed successfully", ['uuid' => $uuid]); + } + + + public function syncTaskList() + { + $clientHelper = new ServiceClient($_ENV['SIMBG_HOST']); + $resToken = $this->getToken(); + + if (!isset($resToken) || empty($resToken->original['data']['token']['access'])) { + \Log::error("Token not retrieved for syncTaskList"); + return ApiResponse::errorResponse("Failed to retrieve token", 401); + } + + $apiToken = $resToken->original['data']['token']['access']; + $queryParams = http_build_query([ + 'page' => 1, + 'size' => 20, + 'sort' => 'ASC', + 'type' => 'task', + ]); + + $url = "api/pbg/v1/list/?" . $queryParams; + $headers = ['Authorization' => "Bearer " . $apiToken]; + + $initialResponse = $clientHelper->get($url, $headers); + if (empty($initialResponse->original['data']['total_page'])) { + \Log::error("Invalid response: no total_page", ['response' => $initialResponse->original]); + return ApiResponse::errorResponse("Invalid response from API", 400); + } + + $totalPage = $initialResponse->original['data']['total_page']; + $savedCount = 0; + $failedCount = 0; + + for ($currentPage = 1; $currentPage <= $totalPage; $currentPage++) { + $queryParams = http_build_query([ + 'page' => $currentPage, + 'size' => 20, + 'sort' => 'ASC', + 'type' => 'task', + ]); + + $url = "api/pbg/v1/list/?" . $queryParams; + $response = $clientHelper->get($url, $headers); + + if (empty($response->original['data']['data'])) { + \Log::warning("No data found on page", ['page' => $currentPage]); + continue; + } + + foreach ($response->original['data']['data'] as $item) { + try { + $taskCreatedAt = isset($item['created_at']) + ? \Carbon\Carbon::parse($item['created_at'])->format('Y-m-d H:i:s') + : null; + PbgTask::updateOrCreate( + [ + 'uuid' => $item['uid'], + ], + [ + 'name' => $item['name'], + 'owner_name' => $item['owner_name'], + 'application_type' => $item['application_type'], + 'application_type_name' => $item['application_type_name'], + 'condition' => $item['condition'], + 'registration_number' => $item['registration_number'], + 'document_number' => $item['document_number'], + 'address' => $item['address'], + 'status' => $item['status'], + 'status_name' => $item['status_name'], + 'slf_status' => $item['slf_status'] ?? null, + 'slf_status_name' => $item['slf_status_name'] ?? null, + 'function_type' => $item['function_type'], + 'consultation_type' => $item['consultation_type'], + 'due_date' => $item['due_date'], + 'land_certificate_phase' => $item['land_certificate_phase'], + 'task_created_at' => $taskCreatedAt, + ] + ); + + // Synchronize additional details + $this->syncIndexIntegration($item['uid']); + $this->syncTaskDetailSubmit($item['uid']); + $savedCount++; + } catch (Exception $e) { + \Log::error("Failed to process task", [ + 'error' => $e->getMessage(), + 'task' => $item, + ]); + $failedCount++; + } + } + } + + $result = [ + "savedCount" => $savedCount, + "failedCount" => $failedCount, + ]; + + \Log::info("syncTaskList completed", $result); + + return ApiResponse::successResponse(json_encode($result), "Successfully saved"); + } + + + public function syncTaskDetailSubmit($uuid) + { + $clientHelper = new ServiceClient($_ENV['SIMBG_HOST']); + $resToken = $this->getToken(); + + if (!isset($resToken) || empty($resToken->original['data']['token']['access'])) { + // Log error + \Log::error("Token not retrieved for syncTaskDetailSubmit"); + return null; + } + + $apiToken = $resToken->original['data']['token']['access']; + $url = "api/pbg/v1/detail/" . $uuid . "/retribution/submit/"; + $headers = [ + 'Authorization' => "Bearer " . $apiToken, + ]; + + $res = $clientHelper->get($url, $headers); + + if (empty($res->original['success']) || !$res->original['success']) { + // Log error + \Log::error("API response indicates failure", ['url' => $url, 'uuid' => $uuid]); + return null; + } + + $data = $res->original['data']['data'] ?? []; + if (empty($data)) { + \Log::error("No data returned from API", ['url' => $url, 'uuid' => $uuid]); + return null; + } + + $detailCreatedAt = isset($data['created_at']) + ? \Carbon\Carbon::parse($data['created_at'])->format('Y-m-d H:i:s') + : null; + + $detailUpdatedAt = isset($data['updated_at']) + ? \Carbon\Carbon::parse($data['updated_at'])->format('Y-m-d H:i:s') + : null; + + PbgTaskRetributions::updateOrCreate( + ['detail_id' => $data['id']], + [ + 'detail_uid' => $data['uid'] ?? null, + 'detail_created_at' => $detailCreatedAt ?? null, + 'detail_updated_at' => $detailUpdatedAt ?? null, + 'luas_bangunan' => $data['luas_bangunan'] ?? null, + 'indeks_lokalitas' => $data['indeks_lokalitas'] ?? null, + 'wilayah_shst' => $data['wilayah_shst'] ?? null, + 'kegiatan_id' => $data['kegiatan']['id'] ?? null, + 'kegiatan_name' => $data['kegiatan']['name'] ?? null, + 'nilai_shst' => $data['nilai_shst'] ?? null, + 'indeks_terintegrasi' => $data['indeks_terintegrasi'] ?? null, + 'indeks_bg_terbangun' => $data['indeks_bg_terbangun'] ?? null, + 'nilai_retribusi_bangunan' => $data['nilai_retribusi_bangunan'] ?? null, + 'nilai_prasarana' => $data['nilai_prasarana'] ?? null, + 'created_by' => $data['created_by'] ?? null, + 'pbg_document' => $data['pbg_document'] ?? null, + 'underpayment' => $data['underpayment'] ?? null, + 'skrd_amount' => $data['skrd_amount'] ?? null, + 'pbg_task_uid' => $uuid, + ] + ); + + $prasaranaData = $data['prasarana'] ?? []; + if (is_array($prasaranaData) && count($prasaranaData) > 0) { + foreach ($prasaranaData as $item) { + PbgTaskPrasarana::updateOrCreate( + [ + 'pbg_task_uid' => $uuid, + 'prasarana_id' => $item['id'] ?? null, + ], + [ + 'pbg_task_uid' => $uuid, + 'prasarana_type' => $item['prasarana_type'] ?? null, + 'building_type' => $item['building_type'] ?? null, + 'total' => $item['total'] ?? null, + 'quantity' => $item['quantity'] ?? null, + 'unit' => $item['unit'] ?? null, + 'index_prasarana' => $item['index_prasarana'] ?? null, + ] + ); + } + } + + \Log::info("syncTaskDetailSubmit completed successfully", ['uuid' => $uuid]); + } + +} + diff --git a/bootstrap/app.php b/bootstrap/app.php index c26e3d1..1c8e87b 100755 --- a/bootstrap/app.php +++ b/bootstrap/app.php @@ -13,7 +13,6 @@ return Application::configure(basePath: dirname(__DIR__)) health: '/up', ) ->withMiddleware(function (Middleware $middleware) { - // $middleware->redirectGuestsTo('/auth/signin'); }) ->withExceptions(function (Exceptions $exceptions) { $exceptions->render(function (HttpException $exception){ diff --git a/composer.json b/composer.json index 71e9119..7ae003f 100755 --- a/composer.json +++ b/composer.json @@ -7,6 +7,7 @@ "license": "MIT", "require": { "php": "^8.2", + "guzzlehttp/guzzle": "^7.9", "laravel/framework": "^11.31", "laravel/sanctum": "^4.0", "laravel/tinker": "^2.9" diff --git a/composer.lock b/composer.lock index a76e7ea..f63b203 100755 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "f60f8b6e279e6de64f92f6b9fb420141", + "content-hash": "7bb7c3b4b4eb50972252c4683f797104", "packages": [ { "name": "brick/math", diff --git a/config/cors.php b/config/cors.php new file mode 100644 index 0000000..8a39e6d --- /dev/null +++ b/config/cors.php @@ -0,0 +1,34 @@ + ['api/*', 'sanctum/csrf-cookie'], + + 'allowed_methods' => ['*'], + + 'allowed_origins' => ['*'], + + 'allowed_origins_patterns' => [], + + 'allowed_headers' => ['*'], + + 'exposed_headers' => [], + + 'max_age' => 0, + + 'supports_credentials' => false, + +]; diff --git a/database/migrations/2025_01_21_094056_add_firstname_to_users.php b/database/migrations/2025_01_21_094056_add_firstname_to_users.php new file mode 100644 index 0000000..ff0e1b5 --- /dev/null +++ b/database/migrations/2025_01_21_094056_add_firstname_to_users.php @@ -0,0 +1,32 @@ +string('firstname'); + $table->string('lastname'); + $table->string('position'); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('users', function (Blueprint $table) { + $table->dropColumn('firstname'); + $table->dropColumn('lastname'); + $table->dropColumn('position'); + }); + } +}; diff --git a/database/migrations/2025_01_22_035902_create_pbg_task_table.php b/database/migrations/2025_01_22_035902_create_pbg_task_table.php new file mode 100644 index 0000000..eefda07 --- /dev/null +++ b/database/migrations/2025_01_22_035902_create_pbg_task_table.php @@ -0,0 +1,44 @@ +id(); + $table->string('uuid'); + $table->string('name')->nullable(); + $table->string('owner_name')->nullable(); + $table->string('application_type')->nullable(); + $table->string('application_type_name')->nullable(); + $table->string('condition')->nullable(); + $table->string('registration_number')->nullable(); + $table->string('document_number')->nullable(); + $table->string('address')->nullable(); + $table->integer('status')->nullable(); + $table->string('status_name')->nullable(); + $table->string('slf_status')->nullable(); + $table->string('slf_status_name')->nullable(); + $table->string('function_type')->nullable(); + $table->string('consultation_type')->nullable(); + $table->date('due_date')->nullable(); + $table->boolean('land_certificate_phase')->nullable(); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('pbg_task'); + } +}; diff --git a/database/migrations/2025_01_22_105313_add_column_task_created_at_topbg_task_table.php b/database/migrations/2025_01_22_105313_add_column_task_created_at_topbg_task_table.php new file mode 100644 index 0000000..7df9cdc --- /dev/null +++ b/database/migrations/2025_01_22_105313_add_column_task_created_at_topbg_task_table.php @@ -0,0 +1,28 @@ +timestamp('task_created_at')->nullable(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('pbg_task', function (Blueprint $table){ + $table->dropColumn('task_created_at'); + }); + } +}; diff --git a/database/migrations/2025_01_22_113217_create_table_pbg_task_retributions.php b/database/migrations/2025_01_22_113217_create_table_pbg_task_retributions.php new file mode 100644 index 0000000..2575499 --- /dev/null +++ b/database/migrations/2025_01_22_113217_create_table_pbg_task_retributions.php @@ -0,0 +1,45 @@ +id(); + $table->integer('detail_id')->nullable(); + $table->timestamp('detail_created_at')->nullable(); + $table->timestamp('detail_updated_at')->nullable(); + $table->string('detail_uid')->nullable(); + $table->decimal('luas_bangunan')->nullable(); + $table->decimal('indeks_lokalitas', 10,4)->nullable(); + $table->string('wilayah_shst')->nullable(); + $table->integer('kegiatan_id')->nullable(); + $table->string('kegiatan_name')->nullable(); + $table->decimal('nilai_shst')->nullable(); + $table->decimal('indeks_terintegrasi')->nullable(); + $table->decimal('indeks_bg_terbangun')->nullable(); + $table->decimal('nilai_retribusi_bangunan')->nullable(); + $table->decimal('nilai_prasarana')->nullable(); + $table->integer('created_by')->nullable(); + $table->integer('pbg_document')->nullable(); + $table->integer('underpayment')->nullable(); + $table->decimal('skrd_amount')->nullable(); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('pbg_task_retributions'); + } +}; diff --git a/database/migrations/2025_01_22_113242_create_table_pbg_task_prasarana.php b/database/migrations/2025_01_22_113242_create_table_pbg_task_prasarana.php new file mode 100644 index 0000000..d75b897 --- /dev/null +++ b/database/migrations/2025_01_22_113242_create_table_pbg_task_prasarana.php @@ -0,0 +1,35 @@ +id(); + $table->string('pbg_task_uid')->nullable(); + $table->integer('prasarana_id')->nullable(); + $table->string('prasarana_type')->nullable(); + $table->string('building_type')->nullable(); + $table->decimal('total')->nullable(); + $table->decimal('quantity')->nullable(); + $table->string('unit')->nullable(); + $table->decimal('index_prasarana')->nullable(); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('pbg_task_prasarana'); + } +}; diff --git a/database/migrations/2025_01_22_140748_create_pbg_task_index_integrations_table.php b/database/migrations/2025_01_22_140748_create_pbg_task_index_integrations_table.php new file mode 100644 index 0000000..43df9f0 --- /dev/null +++ b/database/migrations/2025_01_22_140748_create_pbg_task_index_integrations_table.php @@ -0,0 +1,35 @@ +id(); + $table->string('pbg_task_uid')->nullable(); + $table->string('indeks_fungsi_bangunan')->nullable(); + $table->string('indeks_parameter_kompleksitas')->nullable(); + $table->string('indeks_parameter_permanensi')->nullable(); + $table->string('indeks_parameter_ketinggian')->nullable(); + $table->string('faktor_kepemilikan')->nullable(); + $table->string('indeks_terintegrasi')->nullable(); + $table->decimal('total')->nullable(); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('pbg_task_index_integrations'); + } +}; diff --git a/database/migrations/2025_01_23_031742_add_column_pbg_task_uid_to_table_pbg_task_retributions.php b/database/migrations/2025_01_23_031742_add_column_pbg_task_uid_to_table_pbg_task_retributions.php new file mode 100644 index 0000000..72dc36b --- /dev/null +++ b/database/migrations/2025_01_23_031742_add_column_pbg_task_uid_to_table_pbg_task_retributions.php @@ -0,0 +1,28 @@ +string('pbg_task_uid')->nullable(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('pbg_task_retributions', function (Blueprint $table) { + $table->dropColumn('pbg_task_uid'); + }); + } +}; diff --git a/database/migrations/2025_01_23_043807_modify_nilai_shst_in_pbg_task_retributions.php b/database/migrations/2025_01_23_043807_modify_nilai_shst_in_pbg_task_retributions.php new file mode 100644 index 0000000..59da548 --- /dev/null +++ b/database/migrations/2025_01_23_043807_modify_nilai_shst_in_pbg_task_retributions.php @@ -0,0 +1,32 @@ +decimal('nilai_shst', 20,2)->nullable()->change(); + $table->decimal('nilai_retribusi_bangunan', 20,2)->nullable()->change(); + $table->decimal('indeks_terintegrasi', 20,15)->nullable()->change(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('pbg_task_retributions', function (Blueprint $table) { + $table->decimal('nilai_shst', 20,2)->nullable()->change(); + $table->decimal('nilai_retribusi_bangunan',20,2)->nullable()->change(); + $table->decimal('indeks_terintegrasi',20,15)->nullable()->change(); + }); + } +}; diff --git a/database/migrations/2025_01_23_045949_modify_total_in_pbg_task_prasarana.php b/database/migrations/2025_01_23_045949_modify_total_in_pbg_task_prasarana.php new file mode 100644 index 0000000..b926789 --- /dev/null +++ b/database/migrations/2025_01_23_045949_modify_total_in_pbg_task_prasarana.php @@ -0,0 +1,28 @@ +decimal('total', 20,2)->nullable()->change(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('pbg_task_prasarana', function (Blueprint $table) { + $table->decimal('total',20,2)->nullable()->change(); + }); + } +}; diff --git a/database/seeders/DatabaseSeeder.php b/database/seeders/DatabaseSeeder.php index 5166a2e..cb6f7dc 100755 --- a/database/seeders/DatabaseSeeder.php +++ b/database/seeders/DatabaseSeeder.php @@ -22,6 +22,9 @@ class DatabaseSeeder extends Seeder 'email' => 'user@demo.com', 'email_verified_at' => now(), 'password' => Hash::make('password'), + 'firstname' => 'John', + 'lastname' => 'Doe', + 'position' => 'crusial', 'remember_token' => Str::random(10), ]); } diff --git a/public/images/dputr-kab-bandung.png b/public/images/dputr-kab-bandung.png new file mode 100644 index 0000000..eef1f4c Binary files /dev/null and b/public/images/dputr-kab-bandung.png differ diff --git a/public/images/dputr.ico b/public/images/dputr.ico new file mode 100644 index 0000000..498e49e Binary files /dev/null and b/public/images/dputr.ico differ diff --git a/public/images/logo-dputr.png b/public/images/logo-dputr.png new file mode 100644 index 0000000..b31c941 Binary files /dev/null and b/public/images/logo-dputr.png differ diff --git a/resources/js/config.js b/resources/js/config.js index da3ebf5..c6f0bc7 100755 --- a/resources/js/config.js +++ b/resources/js/config.js @@ -26,4 +26,4 @@ window.innerWidth <= 1140 ? e.setAttribute("data-sidebar-size", "hidden") : e.setAttribute("data-sidebar-size", config.menu.size)); -})(); +})(); \ No newline at end of file diff --git a/resources/js/dashboards/bigdata.js b/resources/js/dashboards/bigdata.js new file mode 100644 index 0000000..4dbfa7d --- /dev/null +++ b/resources/js/dashboards/bigdata.js @@ -0,0 +1,868 @@ +import ApexCharts from "apexcharts"; + +import jsVectorMap from "jsvectormap/dist/jsvectormap.js"; +import 'jsvectormap/dist/maps/world-merc.js'; +import 'jsvectormap/dist/maps/world.js'; +import GlobalConfig, {addThousandSeparators} from '../global-config.js'; + +class BigData { + init(){ + this.initChartKekuranganPotensi(); + this.initChartTargetPAD(); + this.initChartUsaha(); + this.initChartNonUsaha(); + } + + initChartTargetPAD() { + console.log("api host : " + GlobalConfig.apiHost); + fetch(`${GlobalConfig.apiHost}/api/all-task-documents`) + .then(response => { + if(!response.ok){ + throw new Error("Network response was not ok"); + } + return response.json(); + }) + .then(data => { + const seriesData = data.data.series; + document.getElementById("countTargetPAD").innerText = `${data.data.count} Berkas`; + document.getElementById("totalTargetPAD").innerText = `Rp.${addThousandSeparators(data.data.total)}`; + var options1 = { + chart: { + type: 'area', + height: 50, + sparkline: { + enabled: true + } + }, + series: [{ + data: seriesData + }], + stroke: { + width: 2, + curve: 'smooth' + }, + markers: { + size: 0 + }, + colors: ["#7e67fe"], + tooltip: { + fixed: { + enabled: false + }, + x: { + show: false + }, + y: { + title: { + formatter: function (seriesName) { + return '' + } + } + }, + marker: { + show: false + } + }, + fill: { + opacity: [1], + type: ['gradient'], + gradient: { + type: "vertical", + // shadeIntensity: 1, + inverseColors: false, + opacityFrom: 0.5, + opacityTo: 0, + stops: [0, 100] + }, + }, + } + + new ApexCharts(document.querySelector("#chart12"), options1).render(); + }) + .catch(error => { + console.error("error fetching chart dara : ", error); + }); + } + + initChartUsaha(){ + fetch(`${GlobalConfig.apiHost}/api/business-documents`) + .then(response => { + if(!response.ok){ + throw new Error("Network response was not ok"); + } + return response.json(); + }) + .then(data => { + const seriesData = data.data.series; + document.getElementById("countBusinessDocuments").innerText = `${data.data.count} Berkas`; + document.getElementById("totalBusinessDocuments").innerText = `Rp.${addThousandSeparators(data.data.total)}`; + var options1 = { + chart: { + type: 'area', + height: 50, + sparkline: { + enabled: true + } + }, + series: [{ + data: seriesData + }], + stroke: { + width: 2, + curve: 'smooth' + }, + markers: { + size: 0 + }, + colors: ["#7e67fe"], + tooltip: { + fixed: { + enabled: false + }, + x: { + show: false + }, + y: { + title: { + formatter: function (seriesName) { + return '' + } + } + }, + marker: { + show: false + } + }, + fill: { + opacity: [1], + type: ['gradient'], + gradient: { + type: "vertical", + // shadeIntensity: 1, + inverseColors: false, + opacityFrom: 0.5, + opacityTo: 0, + stops: [0, 100] + }, + }, + } + + new ApexCharts(document.querySelector("#chartBusinessDocuments"), options1).render(); + }) + .catch(error => { + console.error("error fetching chart dara : ", error); + }); + } + + initChartNonUsaha(){ + fetch(`${GlobalConfig.apiHost}/api/non-business-documents`) + .then(response => { + if(!response.ok){ + throw new Error("Network response was not ok"); + } + return response.json(); + }) + .then(data => { + const seriesData = data.data.series; + document.getElementById("countNonUsaha").innerText = `${data.data.count} Berkas`; + document.getElementById("totalNonUsaha").innerText = `Rp.${addThousandSeparators(data.data.total)}`; + var options1 = { + chart: { + type: 'area', + height: 50, + sparkline: { + enabled: true + } + }, + series: [{ + data: seriesData + }], + stroke: { + width: 2, + curve: 'smooth' + }, + markers: { + size: 0 + }, + colors: ["#7e67fe"], + tooltip: { + fixed: { + enabled: false + }, + x: { + show: false + }, + y: { + title: { + formatter: function (seriesName) { + return '' + } + } + }, + marker: { + show: false + } + }, + fill: { + opacity: [1], + type: ['gradient'], + gradient: { + type: "vertical", + // shadeIntensity: 1, + inverseColors: false, + opacityFrom: 0.5, + opacityTo: 0, + stops: [0, 100] + }, + }, + } + + new ApexCharts(document.querySelector("#chartNonUsaha"), options1).render(); + }) + .catch(error => { + console.error("error fetching chart dara : ", error); + }); + } + + initChartKekuranganPotensi(){ + var options1 = { + chart: { + type: 'area', + height: 50, + sparkline: { + enabled: true + } + }, + series: [{ + data: [80, 100, 50, 30, 90] + }], + stroke: { + width: 2, + curve: 'smooth' + }, + markers: { + size: 0 + }, + colors: ["#7e67fe"], + tooltip: { + fixed: { + enabled: false + }, + x: { + show: false + }, + y: { + title: { + formatter: function (seriesName) { + return '' + } + } + }, + marker: { + show: false + } + }, + fill: { + opacity: [1], + type: ['gradient'], + gradient: { + type: "vertical", + // shadeIntensity: 1, + inverseColors: false, + opacityFrom: 0.5, + opacityTo: 0, + stops: [0, 100] + }, + }, + } + + new ApexCharts(document.querySelector("#chart01"), options1).render(); + + var options1 = { + chart: { + type: 'area', + height: 50, + sparkline: { + enabled: true + } + }, + series: [{ + data: [87, 54, 4, 76, 31, 95, 70, 92, 53, 9, 6] + }], + stroke: { + width: 2, + curve: 'smooth' + }, + markers: { + size: 0 + }, + colors: ["#7e67fe"], + tooltip: { + fixed: { + enabled: false + }, + x: { + show: false + }, + y: { + title: { + formatter: function (seriesName) { + return '' + } + } + }, + marker: { + show: false + } + }, + fill: { + opacity: [1], + type: ['gradient'], + gradient: { + type: "vertical", + // shadeIntensity: 1, + inverseColors: false, + opacityFrom: 0.5, + opacityTo: 0, + stops: [0, 100] + }, + }, + } + + new ApexCharts(document.querySelector("#chart02"), options1).render(); + + var options1 = { + chart: { + type: 'area', + height: 50, + sparkline: { + enabled: true + } + }, + series: [{ + data: [41, 42, 35, 42, 6, 12, 13, 22, 42, 94, 95] + }], + stroke: { + width: 2, + curve: 'smooth' + }, + markers: { + size: 0 + }, + colors: ["#7e67fe"], + tooltip: { + fixed: { + enabled: false + }, + x: { + show: false + }, + y: { + title: { + formatter: function (seriesName) { + return '' + } + } + }, + marker: { + show: false + } + }, + fill: { + opacity: [1], + type: ['gradient'], + gradient: { + type: "vertical", + // shadeIntensity: 1, + inverseColors: false, + opacityFrom: 0.5, + opacityTo: 0, + stops: [0, 100] + }, + }, + } + + new ApexCharts(document.querySelector("#chart03"), options1).render(); + + // var options1 = { + // chart: { + // type: 'area', + // height: 50, + // sparkline: { + // enabled: true + // } + // }, + // series: [{ + // data: [8, 41, 40, 48, 77, 35, 0, 77, 63, 100, 71] + // }], + // stroke: { + // width: 2, + // curve: 'smooth' + // }, + // markers: { + // size: 0 + // }, + // colors: ["#7e67fe"], + // tooltip: { + // fixed: { + // enabled: false + // }, + // x: { + // show: false + // }, + // y: { + // title: { + // formatter: function (seriesName) { + // return '' + // } + // } + // }, + // marker: { + // show: false + // } + // }, + // fill: { + // opacity: [1], + // type: ['gradient'], + // gradient: { + // type: "vertical", + // // shadeIntensity: 1, + // inverseColors: false, + // opacityFrom: 0.5, + // opacityTo: 0, + // stops: [0, 100] + // }, + // }, + // } + + // new ApexCharts(document.querySelector("#chart04"), options1).render(); + + // var options1 = { + // chart: { + // type: 'area', + // height: 50, + // sparkline: { + // enabled: true + // } + // }, + // series: [{ + // data: [80, 100, 50, 30, 90] + // }], + // stroke: { + // width: 2, + // curve: 'smooth' + // }, + // markers: { + // size: 0 + // }, + // colors: ["#7e67fe"], + // tooltip: { + // fixed: { + // enabled: false + // }, + // x: { + // show: false + // }, + // y: { + // title: { + // formatter: function (seriesName) { + // return '' + // } + // } + // }, + // marker: { + // show: false + // } + // }, + // fill: { + // opacity: [1], + // type: ['gradient'], + // gradient: { + // type: "vertical", + // // shadeIntensity: 1, + // inverseColors: false, + // opacityFrom: 0.5, + // opacityTo: 0, + // stops: [0, 100] + // }, + // }, + // } + + // new ApexCharts(document.querySelector("#chart05"), options1).render(); + + var options1 = { + chart: { + type: 'area', + height: 50, + sparkline: { + enabled: true + } + }, + series: [{ + data: [87, 54, 4, 76, 31, 95, 70, 92, 53, 9, 6] + }], + stroke: { + width: 2, + curve: 'smooth' + }, + markers: { + size: 0 + }, + colors: ["#7e67fe"], + tooltip: { + fixed: { + enabled: false + }, + x: { + show: false + }, + y: { + title: { + formatter: function (seriesName) { + return '' + } + } + }, + marker: { + show: false + } + }, + fill: { + opacity: [1], + type: ['gradient'], + gradient: { + type: "vertical", + // shadeIntensity: 1, + inverseColors: false, + opacityFrom: 0.5, + opacityTo: 0, + stops: [0, 100] + }, + }, + } + + new ApexCharts(document.querySelector("#chart06"), options1).render(); + + var options1 = { + chart: { + type: 'area', + height: 50, + sparkline: { + enabled: true + } + }, + series: [{ + data: [41, 42, 35, 42, 6, 12, 13, 22, 42, 94, 95] + }], + stroke: { + width: 2, + curve: 'smooth' + }, + markers: { + size: 0 + }, + colors: ["#7e67fe"], + tooltip: { + fixed: { + enabled: false + }, + x: { + show: false + }, + y: { + title: { + formatter: function (seriesName) { + return '' + } + } + }, + marker: { + show: false + } + }, + fill: { + opacity: [1], + type: ['gradient'], + gradient: { + type: "vertical", + // shadeIntensity: 1, + inverseColors: false, + opacityFrom: 0.5, + opacityTo: 0, + stops: [0, 100] + }, + }, + } + + new ApexCharts(document.querySelector("#chart07"), options1).render(); + + var options1 = { + chart: { + type: 'area', + height: 50, + sparkline: { + enabled: true + } + }, + series: [{ + data: [8, 41, 40, 48, 77, 35, 0, 77, 63, 100, 71] + }], + stroke: { + width: 2, + curve: 'smooth' + }, + markers: { + size: 0 + }, + colors: ["#7e67fe"], + tooltip: { + fixed: { + enabled: false + }, + x: { + show: false + }, + y: { + title: { + formatter: function (seriesName) { + return '' + } + } + }, + marker: { + show: false + } + }, + fill: { + opacity: [1], + type: ['gradient'], + gradient: { + type: "vertical", + // shadeIntensity: 1, + inverseColors: false, + opacityFrom: 0.5, + opacityTo: 0, + stops: [0, 100] + }, + }, + } + + new ApexCharts(document.querySelector("#chart08"), options1).render(); + + var options1 = { + chart: { + type: 'area', + height: 50, + sparkline: { + enabled: true + } + }, + series: [{ + data: [80, 100, 50, 30, 90] + }], + stroke: { + width: 2, + curve: 'smooth' + }, + markers: { + size: 0 + }, + colors: ["#7e67fe"], + tooltip: { + fixed: { + enabled: false + }, + x: { + show: false + }, + y: { + title: { + formatter: function (seriesName) { + return '' + } + } + }, + marker: { + show: false + } + }, + fill: { + opacity: [1], + type: ['gradient'], + gradient: { + type: "vertical", + // shadeIntensity: 1, + inverseColors: false, + opacityFrom: 0.5, + opacityTo: 0, + stops: [0, 100] + }, + }, + } + + new ApexCharts(document.querySelector("#chart09"), options1).render(); + + var options1 = { + chart: { + type: 'area', + height: 50, + sparkline: { + enabled: true + } + }, + series: [{ + data: [87, 54, 4, 76, 31, 95, 70, 92, 53, 9, 6] + }], + stroke: { + width: 2, + curve: 'smooth' + }, + markers: { + size: 0 + }, + colors: ["#7e67fe"], + tooltip: { + fixed: { + enabled: false + }, + x: { + show: false + }, + y: { + title: { + formatter: function (seriesName) { + return '' + } + } + }, + marker: { + show: false + } + }, + fill: { + opacity: [1], + type: ['gradient'], + gradient: { + type: "vertical", + // shadeIntensity: 1, + inverseColors: false, + opacityFrom: 0.5, + opacityTo: 0, + stops: [0, 100] + }, + }, + } + + new ApexCharts(document.querySelector("#chart10"), options1).render(); + + var options1 = { + chart: { + type: 'area', + height: 50, + sparkline: { + enabled: true + } + }, + series: [{ + data: [41, 42, 35, 42, 6, 12, 13, 22, 42, 94, 95] + }], + stroke: { + width: 2, + curve: 'smooth' + }, + markers: { + size: 0 + }, + colors: ["#7e67fe"], + tooltip: { + fixed: { + enabled: false + }, + x: { + show: false + }, + y: { + title: { + formatter: function (seriesName) { + return '' + } + } + }, + marker: { + show: false + } + }, + fill: { + opacity: [1], + type: ['gradient'], + gradient: { + type: "vertical", + // shadeIntensity: 1, + inverseColors: false, + opacityFrom: 0.5, + opacityTo: 0, + stops: [0, 100] + }, + }, + } + + new ApexCharts(document.querySelector("#chart11"), options1).render(); + + // var options1 = { + // chart: { + // type: 'area', + // height: 50, + // sparkline: { + // enabled: true + // } + // }, + // series: [{ + // data: [8, 41, 40, 48, 77, 35, 0, 77, 63, 100, 71] + // }], + // stroke: { + // width: 2, + // curve: 'smooth' + // }, + // markers: { + // size: 0 + // }, + // colors: ["#7e67fe"], + // tooltip: { + // fixed: { + // enabled: false + // }, + // x: { + // show: false + // }, + // y: { + // title: { + // formatter: function (seriesName) { + // return '' + // } + // } + // }, + // marker: { + // show: false + // } + // }, + // fill: { + // opacity: [1], + // type: ['gradient'], + // gradient: { + // type: "vertical", + // // shadeIntensity: 1, + // inverseColors: false, + // opacityFrom: 0.5, + // opacityTo: 0, + // stops: [0, 100] + // }, + // }, + // } + + // new ApexCharts(document.querySelector("#chart12"), options1).render(); + } +} + +document.addEventListener('DOMContentLoaded', function (e) { + new BigData().init(); +}); \ No newline at end of file diff --git a/resources/js/global-config.js b/resources/js/global-config.js new file mode 100644 index 0000000..701c698 --- /dev/null +++ b/resources/js/global-config.js @@ -0,0 +1,12 @@ +const GlobalConfig = { + apiHost: 'http://localhost:8000' +}; + +export default GlobalConfig; + +export function addThousandSeparators(number, fractionDigits = 2) { + return new Intl.NumberFormat('en-US', { + minimumFractionDigits: fractionDigits, + maximumFractionDigits: fractionDigits, + }).format(number); +} \ No newline at end of file diff --git a/resources/js/settings/syncronize/syncronize.js b/resources/js/settings/syncronize/syncronize.js new file mode 100644 index 0000000..f0aad44 --- /dev/null +++ b/resources/js/settings/syncronize/syncronize.js @@ -0,0 +1,23 @@ +class SyncronizeTask { + init(){ + this.onSyncSubmit(); + } + onSyncSubmit(){ + const form = document.getElementById("sync-form"); + if(form){ + form.addEventListener("submit", function (event) { + event.preventDefault(); // Prevent the default form submission + + const button = document.getElementById("btn-sync-submit"); + if (button) { + button.disabled = true; + button.innerText = "Processing..."; + } + form.submit(); + }); + } + } +} +document.addEventListener('DOMContentLoaded', function (e) { + new SyncronizeTask().init(); +}); \ No newline at end of file diff --git a/resources/js/tables/common-table.js b/resources/js/tables/common-table.js new file mode 100644 index 0000000..0831a6a --- /dev/null +++ b/resources/js/tables/common-table.js @@ -0,0 +1,128 @@ +import { Grid } from "gridjs/dist/gridjs.umd.js"; +import gridjs from 'gridjs/dist/gridjs.umd.js' +import 'gridjs/dist/gridjs.umd.js' +import GlobalConfig from "../global-config"; + +class CommonTable { + init() { + // this.CommonTableInit(); + this.CommonTableInitWithFetchApi(); + } + + CommonTableInit() { + new Grid({ + columns: [ + { + name: 'ID', + formatter: (function (cell) { + return gridjs.html('' + cell + ''); + }) + }, + "Name", + { + name: 'Email', + formatter: (function (cell) { + return gridjs.html('' + cell + ''); + }) + }, + "Position", "Company", "Country", + { + name: 'Actions', + width: '120px', + formatter: (function (cell) { + return gridjs.html(` +
+ `); + }) + }, + ], + pagination: { + limit: 10 + }, + sort: true, + search: true, + data: [ + ["11", "Alice", "alice@example.com", "Software Engineer", "ABC Company", "United States"], + ["12", "Bob", "bob@example.com", "Product Manager", "XYZ Inc", "Canada"], + ["13", "Charlie", "charlie@example.com", "Data Analyst", "123 Corp", "Australia"], + ["14", "David", "david@example.com", "UI/UX Designer", "456 Ltd", "United Kingdom"], + ["15", "Eve", "eve@example.com", "Marketing Specialist", "789 Enterprises", "France"], + ["11", "Alice", "alice@example.com", "Software Engineer", "ABC Company", "United States"], + ["12", "Bob", "bob@example.com", "Product Manager", "XYZ Inc", "Canada"], + ["13", "Charlie", "charlie@example.com", "Data Analyst", "123 Corp", "Australia"], + ["14", "David", "david@example.com", "UI/UX Designer", "456 Ltd", "United Kingdom"], + ["15", "Eve", "eve@example.com", "Marketing Specialist", "789 Enterprises", "France"], + ["11", "Alice", "alice@example.com", "Software Engineer", "ABC Company", "United States"], + ["12", "Bob", "bob@example.com", "Product Manager", "XYZ Inc", "Canada"], + ["13", "Charlie", "charlie@example.com", "Data Analyst", "123 Corp", "Australia"], + ["14", "David", "david@example.com", "UI/UX Designer", "456 Ltd", "United Kingdom"], + ["15", "Eve", "eve@example.com", "Marketing Specialist", "789 Enterprises", "France"], + ["11", "Alice", "alice@example.com", "Software Engineer", "ABC Company", "United States"], + ["12", "Bob", "bob@example.com", "Product Manager", "XYZ Inc", "Canada"], + ["13", "Charlie", "charlie@example.com", "Data Analyst", "123 Corp", "Australia"], + ["14", "David", "david@example.com", "UI/UX Designer", "456 Ltd", "United Kingdom"], + ["15", "Eve", "eve@example.com", "Marketing Specialist", "789 Enterprises", "France"], + ["16", "Frank", "frank@example.com", "HR Manager", "ABC Company", "Germany"], + ["17", "Grace", "grace@example.com", "Financial Analyst", "XYZ Inc", "Japan"], + ["18", "Hannah", "hannah@example.com", "Sales Representative", "123 Corp", "Brazil"], + ["19", "Ian", "ian@example.com", "Software Developer", "456 Ltd", "India"], + ["20", "Jane", "jane@example.com", "Operations Manager", "789 Enterprises", "China"] + ] + }).render(document.getElementById("common-table")); + } + + CommonTableInitWithFetchApi(){ + fetch(`${GlobalConfig.apiHost}/users`) + .then((response) => response.json()) + .then((data) => { + console.log("check log response"); + console.log(data.data); + new Grid({ + columns: [ + { + name: 'id', + formatter: (function (cell) { + return gridjs.html('' + cell + ''); + }) + }, + "name", + { + name: 'email', + formatter: (function (cell) { + return gridjs.html('' + cell + ''); + }) + }, + "position", "firstname", "lastname", + { + name: 'Actions', + width: '120px', + formatter: (function (cell) { + return gridjs.html(` + + `); + }) + }, + ], + pagination: { + limit: 10 + }, + sort: true, + search: true, + data: data.data + }).render(document.getElementById("common-table")); + }) + .catch((error) => console.error("Error fetching data: " + error)); + } +} + +document.addEventListener('DOMContentLoaded', function (e) { + new CommonTable().init(); +}); \ No newline at end of file diff --git a/resources/views/auth/signup.blade.php b/resources/views/auth/signup.blade.php index a5ba261..f668082 100755 --- a/resources/views/auth/signup.blade.php +++ b/resources/views/auth/signup.blade.php @@ -13,11 +13,11 @@ class="authentication-bg" -