FEAT : Update Dashboard DONE
This commit is contained in:
parent
c1b1a00c90
commit
a8bd400753
@ -1,8 +1,9 @@
|
||||
<?php
|
||||
use Carbon\Carbon;
|
||||
|
||||
if(!function_exists('formatTanggalWaktu')){
|
||||
function formatTanggalWaktu($tanggal, $time=false, $showDay=false, $locale = 'id_ID')
|
||||
use Carbon\Carbon;
|
||||
|
||||
if (!function_exists('formatTanggalWaktu')) {
|
||||
function formatTanggalWaktu($tanggal, $time = false, $showDay = false, $locale = 'id_ID')
|
||||
{
|
||||
// Parse tanggal dan waktu
|
||||
$datetime = $time ? $tanggal . ' ' . $time : $tanggal;
|
||||
@ -19,4 +20,16 @@
|
||||
return $carbon->isoFormat('LL');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function formatNotifikasi($notifikasi)
|
||||
{
|
||||
$data = json_decode(json_encode($notifikasi->data));
|
||||
$message = $data->message;
|
||||
$data = $data->data;
|
||||
$notifikasi = [
|
||||
'title' => $message->title,
|
||||
'message' => $message->message,
|
||||
];
|
||||
return $notifikasi;
|
||||
}
|
||||
|
@ -15,12 +15,13 @@
|
||||
"intervention/image": "^3.10",
|
||||
"joshbrw/laravel-module-installer": "^2.0",
|
||||
"laravel/framework": "^12.0",
|
||||
"jackiedo/log-reader": "^2.4",
|
||||
"laravel/pulse": "^1.2",
|
||||
"laravel/tinker": "^2.9",
|
||||
"maatwebsite/excel": "^3.1",
|
||||
"nwidart/laravel-modules": "^11.0",
|
||||
"opcodesio/log-viewer": "^3.10",
|
||||
"rasyahroel/itsecurity": "dev-main",
|
||||
"rasyahroel/itsecurity-module": "dev-main",
|
||||
"rasyahroel/usermanagement-module": "dev-master",
|
||||
"spatie/laravel-activitylog": "^4.8",
|
||||
"spatie/laravel-pdf": "^1.5",
|
||||
@ -41,7 +42,10 @@
|
||||
"App\\": "app/",
|
||||
"Database\\Factories\\": "database/factories/",
|
||||
"Database\\Seeders\\": "database/seeders/"
|
||||
}
|
||||
},
|
||||
"files": [
|
||||
"app/Helpers/helpers.php"
|
||||
]
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
@ -106,9 +110,14 @@
|
||||
"url": "https://git.putrakuningan.com/daengdeni/authentication"
|
||||
},
|
||||
{
|
||||
"name": "rasyahroel/itsecurity",
|
||||
"name": "rasyahroel/itsecurity-module",
|
||||
"type": "vcs",
|
||||
"url": "https://git.putrakuningan.com/rasyahroel/itsecurity"
|
||||
},
|
||||
{
|
||||
"name": "jackiedo/log-reader",
|
||||
"type": "vcs",
|
||||
"url": "https://github.com/daengdeni/Laravel-Log-Reader.git"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -50,11 +50,10 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="grid grid-cols-1 lg:grid-cols-2 gap-5 lg:gap-7.5 items-stretch">
|
||||
{{-- Report History User --}}
|
||||
<div class="grid my-5 gap-5 lg:gap-7.5">
|
||||
<div class="card border border-agi-100 card-grid min-w-full" data-datatable="false"
|
||||
data-datatable-page-size="5" data-datatable-state-save="false" id="dashboardreport-table"
|
||||
<div class="card border border-agi-100 card-grid min-w-full" data-datatable="false" data-datatable-page-size="5"
|
||||
data-datatable-state-save="false" id="dashboardreport-table"
|
||||
data-api-url="{{ route('report.laporanhistory.datatables') }}">
|
||||
<div class="card-header bg-agi-50 py-5 flex-wrap">
|
||||
<h3 class="card-title">
|
||||
@ -109,14 +108,50 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{-- Audit Rail --}}
|
||||
<div class="grid grid-cols-1 lg:grid-cols-2 gap-5 lg:gap-7.5 items-stretch">
|
||||
{{-- History User --}}
|
||||
<div class="grid my-5 gap-5 lg:gap-7.5">
|
||||
<div class="card border border-agi-100 card-grid min-w-full" data-datatable="false"
|
||||
data-datatable-page-size="5" data-datatable-state-save="false" id="audit-table"
|
||||
data-api-url="{{ route('auditrail.datatables') }}">
|
||||
<div class="card border border-agi-100 card-grid min-w-full" id="dashboardhistory">
|
||||
<div class="card-header bg-agi-50 py-5 flex-wrap">
|
||||
<h3 class="card-title">
|
||||
Audit Trail
|
||||
History User Akses
|
||||
</h3>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
@foreach (auth()->user()->unreadNotifications->take(5) as $notification)
|
||||
<div class="flex items-center grow gap-2.5 px-5 py-4">
|
||||
<div
|
||||
class="flex items-center justify-center size-8 bg-success-light rounded-full border border-success-clarity">
|
||||
<i class="ki-filled ki-check text-lg text-success">
|
||||
</i>
|
||||
</div>
|
||||
<div class="flex flex-col gap-1">
|
||||
<span class="text-2sm font-medium text-gray-700">
|
||||
{{ formatNotifikasi($notification)['title'] }}<br>
|
||||
{{ formatNotifikasi($notification)['message'] }}<br>
|
||||
|
||||
</span>
|
||||
<span class="font-medium text-gray-500 text-2xs">
|
||||
{{ $notification->created_at->diffForHumans() }}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@if (!$loop->last)
|
||||
<div class="border-b border-b-gray-200"></div>
|
||||
@endif
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{-- Audit Rail --}}
|
||||
<div class="grid my-5 gap-5 lg:gap-7.5">
|
||||
<div class="card border-agi-100 card-grid min-w-full" data-datatable="false" data-datatable-page-size="5"
|
||||
data-datatable-state-save="false" id="audit-logs-table"
|
||||
data-api-url="{{ route('logs.audit.datatables') }}">
|
||||
<div class="card-header bg-agi-50 py-5 flex-wrap">
|
||||
<h3 class="card-title">
|
||||
Audit Logs
|
||||
</h3>
|
||||
</div>
|
||||
<div class="scrollable-x-auto">
|
||||
@ -124,28 +159,24 @@
|
||||
data-datatable-table="true">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="min-w-[100px]" data-datatable-column="nik">
|
||||
<span class="sort"> <span class="sort-label"> NIK </span>
|
||||
<th class="min-w-[100px]" data-datatable-column="log_name">
|
||||
<span class="sort"> <span class="sort-label"> Log Type </span>
|
||||
<span class="sort-icon"> </span> </span>
|
||||
</th>
|
||||
<th class="min-w-[100px]" data-datatable-column="name">
|
||||
<span class="sort"> <span class="sort-label"> Name </span>
|
||||
<th class="min-w-[100px]" data-datatable-column="subject_type">
|
||||
<span class="sort"> <span class="sort-label"> Subject Type </span>
|
||||
<span class="sort-icon"> </span> </span>
|
||||
</th>
|
||||
<th class="min-w-[100px]" data-datatable-column="action_type">
|
||||
<span class="sort"> <span class="sort-label"> Action Type </span>
|
||||
<th class="min-w-[100px]" data-datatable-column="description">
|
||||
<span class="sort"> <span class="sort-label"> Description </span>
|
||||
<span class="sort-icon"> </span> </span>
|
||||
</th>
|
||||
<th class="min-w-[100px]" data-datatable-column="action_description">
|
||||
<span class="sort"> <span class="sort-label"> Action Description</span>
|
||||
<th class="min-w-[100px]" data-datatable-column="causer_id">
|
||||
<span class="sort"> <span class="sort-label"> Causer ID </span>
|
||||
<span class="sort-icon"> </span> </span>
|
||||
</th>
|
||||
<th class="min-w-[100px]" data-datatable-column="target_table">
|
||||
<span class="sort"> <span class="sort-label"> Target Table </span>
|
||||
<span class="sort-icon"> </span> </span>
|
||||
</th>
|
||||
<th class="min-w-[100px]" data-datatable-column="target_record_id">
|
||||
<span class="sort"> <span class="sort-label"> Target Record Id </span>
|
||||
<th class="min-w-[150px]" data-datatable-column="created_at">
|
||||
<span class="sort"> <span class="sort-label"> Date/Time </span>
|
||||
<span class="sort-icon"> </span> </span>
|
||||
</th>
|
||||
</tr>
|
||||
@ -157,8 +188,7 @@
|
||||
<div class="flex items-center gap-2">
|
||||
Show
|
||||
<select class="select select-sm w-16" data-datatable-size="true" name="perpage"> </select>
|
||||
per
|
||||
page
|
||||
per page
|
||||
</div>
|
||||
<div class="flex items-center gap-4">
|
||||
<span data-datatable-info="true"> </span>
|
||||
@ -182,7 +212,7 @@
|
||||
const ctx = document.getElementById('dashboardChart').getContext('2d');
|
||||
|
||||
new Chart(ctx, {
|
||||
type: 'pie', // tipe chart
|
||||
type: 'pie',
|
||||
data: {
|
||||
labels: labels,
|
||||
datasets: [{
|
||||
@ -276,34 +306,43 @@
|
||||
};
|
||||
const datatableReport = new KTDataTable(elementReport, dataTableReportOptions);
|
||||
|
||||
const elementAudit = document.querySelector('#audit-table');
|
||||
const elementAudit = document.querySelector('#audit-logs-table');
|
||||
const apiUrlAudit = elementAudit.getAttribute('data-api-url');
|
||||
|
||||
// Inisialisasi DataTable
|
||||
// Inisialisasi DataTable Audit
|
||||
const dataTableAuditOptions = {
|
||||
apiEndpoint: apiUrlAudit,
|
||||
pageSize: 5,
|
||||
columns: {
|
||||
nik: {
|
||||
title: 'nik',
|
||||
render: (item, data) => data?.user?.nik || 'Unknown',
|
||||
log_name: {
|
||||
title: 'Log Type',
|
||||
render: (item, data) => {
|
||||
return `<span class="badge badge-light-primary">${data.log_name || 'N/A'}</span>`;
|
||||
}
|
||||
},
|
||||
name: {
|
||||
title: 'name',
|
||||
render: (item, data) => data?.user?.name || 'Unknown',
|
||||
description: {
|
||||
title: 'Description',
|
||||
},
|
||||
action_type: {
|
||||
title: 'action_type',
|
||||
subject_type: {
|
||||
title: 'Subject Type',
|
||||
render: (item, data) => {
|
||||
if (!data.subject_type) return 'N/A';
|
||||
return data.subject_type.split('\\').pop();
|
||||
}
|
||||
},
|
||||
action_description: {
|
||||
title: 'action_description',
|
||||
},
|
||||
target_table: {
|
||||
title: 'target_table',
|
||||
},
|
||||
target_record_id: {
|
||||
title: 'target_record_id',
|
||||
causer_id: {
|
||||
title: 'Causer ID',
|
||||
render: (item, data) => {
|
||||
return data.creator_name || 'System';
|
||||
}
|
||||
},
|
||||
created_at: {
|
||||
title: 'Date/Time',
|
||||
render: (item, data) => {
|
||||
const date = new Date(data.created_at);
|
||||
return window.formatTanggalWaktuIndonesia(date)
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
const datatableAudit = new KTDataTable(elementAudit, dataTableAuditOptions);
|
||||
|
@ -1,15 +1,15 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use App\Http\Controllers\DashboardController;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
Route::middleware(['auth'])->group(function () {
|
||||
Route::get('/notifications/count', function () {
|
||||
return response()->json([
|
||||
'count' => auth()->user()->unreadNotifications->count()
|
||||
]);
|
||||
})->name('notifications.count')->middleware('auth');
|
||||
});
|
||||
Route::middleware(['auth'])->group(function () {
|
||||
|
||||
Route::get('/', [DashboardController::class, 'index'])->name('dashboard');
|
||||
});
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user