add latest created import datasource and change icon 404 page

This commit is contained in:
arifal
2025-02-07 18:31:52 +07:00
parent 55dc0751d3
commit 6307417ae3
4 changed files with 32 additions and 7 deletions

View File

@@ -2,9 +2,11 @@
namespace App\Http\Controllers\Api;
use App\Enums\ImportDatasourceStatus;
use App\Http\Controllers\Controller;
use App\Http\Requests\PbgTaskMultiStepRequest;
use App\Http\Resources\PbgTaskResource;
use App\Models\ImportDatasource;
use App\Models\PbgTask;
use App\Models\PbgTaskGoogleSheet;
use App\Services\GoogleSheetService;
@@ -112,6 +114,13 @@ class PbgTaskController extends Controller
$sheetData = $this->googleSheetService->getSheetDataCollection($totalRowCount);
$mapToUpsert = [];
$count = 0;
$import_datasource = ImportDatasource::create([
"message" => "initialization",
"response_body" => null,
"status" => ImportDatasourceStatus::Processing->value,
]);
foreach($sheetData as $data){
$mapToUpsert[] =
[
@@ -230,6 +239,13 @@ class PbgTaskController extends Controller
]);
}
$total_data = count($mapToUpsert);
$import_datasource->update([
"message" => "Successfully imported {$total_data}",
"status" => ImportDatasourceStatus::Success->value,
]);
DB::commit();
return response()->json([
@@ -238,6 +254,11 @@ class PbgTaskController extends Controller
], 200);
}catch(\Exception $ex){
DB::rollBack();
$import_datasource->update([
"message" => "Failed to importing",
"response_body" => $ex->getMessage(),
"status" => ImportDatasourceStatus::Failed->value,
]);
return response()->json([
"success" => false,
"message" => "Gagal menyimpan data",

View File

@@ -3,12 +3,16 @@
namespace App\Http\Controllers\Dashboards;
use App\Http\Controllers\Controller;
use App\Models\ImportDatasource;
use Illuminate\Http\Request;
class BigDataController extends Controller
{
public function index(){
return view('dashboards.bigdata');
$latest_import_datasource = ImportDatasource::latest()->first();
$latest_created = $latest_import_datasource ?
$latest_import_datasource->created_at->format("j F Y H:i:s") : null;
return view('dashboards.bigdata', compact('latest_created'));
}
public function pbg(){

View File

@@ -50,7 +50,7 @@
<div id="dashboard-fixed-wrapper" class="row">
<h2 style="margin-top:30px;margin-left:15px;color:#911701">
<span style="float:right;font-size:14px;margin-right:25px;color:black">terakhir di update - 6 Februari 2025</span>
<span style="float:right;font-size:14px;margin-right:25px;color:black">Terakhir di update - {{$latest_created}}</span>
ANALISA BIG DATA PROSES PBG <br>
MELALUI APLIKASI SIBEDAS PBG

View File

@@ -17,16 +17,16 @@ class="authentication-bg"
<div class="p-4">
<div class="mx-auto mb-4 text-center">
<div class="mx-auto text-center auth-logo">
<a href="{{ route('home') }}" class="logo-dark">
<img src="/images/logo-dark.png" height="32" alt="logo dark">
<!-- <a href="{{ route('home') }}" class="logo-dark">
<img src="/images/simbg-dputr.png" height="200" width="100%" alt="dputr logo">
</a>
<a href="{{ route('home') }}" class="logo-light">
<img src="/images/logo-light.png" height="28" alt="logo light">
</a>
<img src="/images/simbg-dputr.png" height="200" width="100%" alt="dputr light">
</a> -->
</div>
<img src="/images/404.svg" alt="auth" height="250" class="mt-5 mb-3" />
<img src="/images/simbg-dputr.png" alt="auth" height="250" class="mt-5 mb-3" />
<h2 class="fs-22 lh-base">Page Not Found !</h2>
<p class="text-muted mt-1 mb-4">The page you're trying to reach seems to have gone <br /> missing in the digital wilderness.</p>