update
parent
ae5c2cdcf3
commit
d499a13118
|
|
@ -4,6 +4,7 @@ namespace App\Http\Controllers;
|
|||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\Dataset;
|
||||
use App\Models\DatasetTambahan;
|
||||
use App\Models\Master\Topik;
|
||||
use App\Models\Master\Instansi;
|
||||
use App\Models\Master\Template;
|
||||
|
|
@ -30,21 +31,17 @@ class HomeController extends Controller
|
|||
public function dashboard()
|
||||
{
|
||||
$data['title'] = 'Dashboard';
|
||||
$data['route'] = $this->route;
|
||||
if((session('group_id') == 1) || (session('group_alias') == 'admin')){
|
||||
$data['dataset'] = Dataset::orderBy('DatasetId','DESC')->limit(10)->get();
|
||||
$data['dataset'] = Dataset::orderBy('DatasetId','DESC')->count();
|
||||
$data['datasetTambahan'] = DatasetTambahan::orderBy('DatasetId','DESC')->count();
|
||||
}else{
|
||||
$data['dataset'] = Dataset::orderBy('DatasetId','DESC')->whereIn('instansi_id',[auth()->user()->ms_instansi_id])->limit(10)->get();
|
||||
$data['dataset'] = Dataset::orderBy('DatasetId','DESC')->whereIn('instansi_id',[auth()->user()->ms_instansi_id])->count();
|
||||
$data['datasetTambahan'] = DatasetTambahan::whereIn('instansi_id',[auth()->user()->ms_instansi_id])->count();
|
||||
|
||||
}
|
||||
// $data['dataset'] = Dataset::orderBy('DatasetId','DESC')->limit(10)->get();
|
||||
$data['group'] = Group::where('MsGroupId','!=',1)->where('alias','!=','admin')->get();
|
||||
if((session('group_id') == 1) || (session('group_alias') == 'admin')){
|
||||
$data['resource'] = TabelData::with(['dataset'])->get();
|
||||
}else{
|
||||
$data['resource'] = TabelData::with(['dataset'])->whereHas('dataset',function($query){
|
||||
$query->where('instansi_id',auth()->user()->ms_instansi_id);
|
||||
})->where('show_dashboard',1)->get();
|
||||
}
|
||||
$data['classDataset'] = Dataset::class;
|
||||
$data['instansi'] = Instansi::count();
|
||||
$data['tabelData'] = tabelData::count();
|
||||
|
||||
return view($this->template.'.dashboard',$data);
|
||||
}
|
||||
|
|
@ -59,6 +56,32 @@ class HomeController extends Controller
|
|||
return view($this->template.'.dataset',$data);
|
||||
}
|
||||
|
||||
public function gridTabel(Request $request)
|
||||
{
|
||||
if((session('group_id') == 1) || (session('group_alias') == 'admin')){
|
||||
$data = Instansi::limit(10)->get();
|
||||
}else{
|
||||
$data = Instansi::where('MsInstansiId',auth()->user()->ms_instansi_id)->get();
|
||||
}
|
||||
// $data = User::with(['group'])->orderBy('id','DESC')->get();
|
||||
$_data = [];
|
||||
|
||||
foreach ($data as $key => $row) {
|
||||
|
||||
|
||||
$_data[] = [
|
||||
'no' => $key+1,
|
||||
'name' => @$row->name,
|
||||
'dataset' => '-',
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
// return response()->json($_data); // Return the data as a JSON response
|
||||
return response()->json($_data);
|
||||
|
||||
}
|
||||
|
||||
public function grid(Request $request)
|
||||
{
|
||||
if((session('group_id') == 1) || (session('group_alias') == 'admin')){
|
||||
|
|
|
|||
|
|
@ -39,11 +39,11 @@
|
|||
<div class="relative z-10">
|
||||
<div class="flex items-center space-x-3 mb-12">
|
||||
<div class="bg-white p-2 rounded-xl text-blue-600">
|
||||
<i data-lucide="layers" class="w-8 h-8"></i>
|
||||
<img src="{{asset('assets/logo-dinas.ico')}}" width="40" alt="">
|
||||
</div>
|
||||
<div>
|
||||
<h1 class="font-bold text-2xl tracking-tight leading-none uppercase text-white">SLHD</h1>
|
||||
<p class="text-[10px] uppercase tracking-widest text-blue-100 font-bold">Dinas Lingkungan Hidup Provinsi DKI Jakarta</p>
|
||||
<p class="text-[10px] uppercase tracking-widest text-blue-100 font-bold">Status Lingkungan Hidup Provinsi DKI Jakarta</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
|||
|
|
@ -41,12 +41,10 @@
|
|||
<nav id="main-nav" class="fixed w-full z-50 transition-all duration-300 py-4">
|
||||
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 flex justify-between items-center">
|
||||
<div class="flex items-center space-x-3">
|
||||
<div class="bg-blue-600 p-2 rounded-lg text-white">
|
||||
<i data-lucide="layers" class="w-6 h-6"></i>
|
||||
</div>
|
||||
<img src="{{asset('assets/logo-dinas.ico')}}" width="40" alt="">
|
||||
<div>
|
||||
<h1 class="font-bold text-xl tracking-tight text-blue-900 leading-none uppercase">SLHD</h1>
|
||||
<p class="text-[10px] uppercase tracking-widest text-blue-600 font-bold">DKI Jakarta</p>
|
||||
<p class="text-[10px] uppercase tracking-widest text-blue-600 font-bold">Status Lingkungan Hidup Provinsi DKI Jakarta</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
@ -87,9 +85,7 @@
|
|||
<div class="flex flex-col md:flex-row justify-between items-center">
|
||||
<div class="mb-6 md:mb-0">
|
||||
<div class="flex items-center justify-center md:justify-start space-x-3 mb-2">
|
||||
<div class="bg-blue-600 p-1.5 rounded-lg text-white">
|
||||
<i data-lucide="layers" class="w-4 h-4"></i>
|
||||
</div>
|
||||
<img src="{{asset('assets/logo-dinas.ico')}}" width="40" alt="">
|
||||
<span class="font-bold text-slate-900 uppercase">SLHD JAKARTA</span>
|
||||
</div>
|
||||
<p class="text-slate-500 text-xs">© {{ date('Y') }} Dinas Lingkungan Hidup Provinsi DKI Jakarta.</p>
|
||||
|
|
|
|||
|
|
@ -78,12 +78,12 @@
|
|||
<!-- Logo & Toggle Container -->
|
||||
<div class="p-6 border-b border-slate-50 flex items-center justify-between">
|
||||
<div class="flex items-center space-x-3 overflow-hidden">
|
||||
<div class="bg-blue-600 p-2 rounded-lg text-white shrink-0">
|
||||
<i data-lucide="layers" class="w-5 h-5"></i>
|
||||
</div>
|
||||
{{-- <div class="bg-white p-2 rounded-lg text-white shrink-0"> --}}
|
||||
<img src="{{asset('assets/logo-dinas.ico')}}" width="40" alt="">
|
||||
{{-- </div> --}}
|
||||
<div class="sidebar-header-text">
|
||||
<h1 class="font-bold text-lg tracking-tight text-blue-900 leading-none">SLHD</h1>
|
||||
<p class="text-[9px] uppercase tracking-widest text-blue-600 font-bold">Admin Panel</p>
|
||||
<p class="text-[7px] mt-2 uppercase tracking-widest text-blue-600 font-bold">Status Lingkungan Hidup</p>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Desktop Toggle Button -->
|
||||
|
|
|
|||
|
|
@ -10,43 +10,40 @@
|
|||
<div class="p-2 bg-blue-50 rounded-lg text-blue-600">
|
||||
<i data-lucide="database" class="w-5 h-5"></i>
|
||||
</div>
|
||||
<span class="text-xs font-bold text-green-500 bg-green-50 px-2 py-1 rounded">+12%</span>
|
||||
</div>
|
||||
<p class="text-slate-500 text-[10px] font-bold uppercase tracking-wider">Total Dataset</p>
|
||||
<h4 class="text-2xl font-black text-slate-900 mt-1">1,284</h4>
|
||||
<h4 class="text-2xl font-black text-slate-900 mt-1">{{ $dataset }}</h4>
|
||||
</div>
|
||||
<!-- Card 2 -->
|
||||
<div class="bg-white p-6 rounded-2xl border border-slate-200 shadow-sm hover:shadow-md transition-shadow">
|
||||
<div class="flex justify-between items-start mb-4">
|
||||
<div class="p-2 bg-green-50 rounded-lg text-green-600">
|
||||
<i data-lucide="download" class="w-5 h-5"></i>
|
||||
<i data-lucide="database" class="w-5 h-5"></i>
|
||||
</div>
|
||||
<span class="text-xs font-bold text-green-500 bg-green-50 px-2 py-1 rounded">+5%</span>
|
||||
</div>
|
||||
<p class="text-slate-500 text-[10px] font-bold uppercase tracking-wider">Unduhan Data</p>
|
||||
<h4 class="text-2xl font-black text-slate-900 mt-1">45.2K</h4>
|
||||
<p class="text-slate-500 text-[10px] font-bold uppercase tracking-wider">Total Dataset Tambahan</p>
|
||||
<h4 class="text-2xl font-black text-slate-900 mt-1">{{$datasetTambahan}}</h4>
|
||||
</div>
|
||||
<!-- Card 3 -->
|
||||
<div class="bg-white p-6 rounded-2xl border border-slate-200 shadow-sm hover:shadow-md transition-shadow">
|
||||
<div class="flex justify-between items-start mb-4">
|
||||
<div class="p-2 bg-orange-50 rounded-lg text-orange-600">
|
||||
<i data-lucide="file-check" class="w-5 h-5"></i>
|
||||
<i data-lucide="users" class="w-5 h-5"></i>
|
||||
</div>
|
||||
<span class="text-xs font-bold text-slate-400 bg-slate-50 px-2 py-1 rounded">Stabil</span>
|
||||
</div>
|
||||
<p class="text-slate-500 text-[10px] font-bold uppercase tracking-wider">Publikasi Aktif</p>
|
||||
<h4 class="text-2xl font-black text-slate-900 mt-1">312</h4>
|
||||
<p class="text-slate-500 text-[10px] font-bold uppercase tracking-wider">Organisasi Terdaftar</p>
|
||||
<h4 class="text-2xl font-black text-slate-900 mt-1">{{$instansi}}</h4>
|
||||
</div>
|
||||
<!-- Card 4 -->
|
||||
<div class="bg-white p-6 rounded-2xl border border-slate-200 shadow-sm hover:shadow-md transition-shadow">
|
||||
<div class="flex justify-between items-start mb-4">
|
||||
<div class="p-2 bg-purple-50 rounded-lg text-purple-600">
|
||||
<i data-lucide="eye" class="w-5 h-5"></i>
|
||||
<i data-lucide="table" class="w-5 h-5"></i>
|
||||
</div>
|
||||
<span class="text-xs font-bold text-red-500 bg-red-50 px-2 py-1 rounded">-2%</span>
|
||||
{{-- <span class="text-xs font-bold text-red-500 bg-red-50 px-2 py-1 rounded">-2%</span> --}}
|
||||
</div>
|
||||
<p class="text-slate-500 text-[10px] font-bold uppercase tracking-wider">Kunjungan</p>
|
||||
<h4 class="text-2xl font-black text-slate-900 mt-1">2,840</h4>
|
||||
<p class="text-slate-500 text-[10px] font-bold uppercase tracking-wider">Tabel Kinerja DPSIR</p>
|
||||
<h4 class="text-2xl font-black text-slate-900 mt-1">{{ $tabelData }}</h4>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
@ -54,21 +51,42 @@
|
|||
<div class="bg-white rounded-3xl border border-slate-200 shadow-sm overflow-hidden">
|
||||
<div class="p-6 border-b border-slate-100 flex flex-col md:flex-row md:items-center justify-between gap-4">
|
||||
<div>
|
||||
<h3 class="text-lg font-bold text-slate-900">Dataset Lingkungan Terbaru</h3>
|
||||
<p class="text-xs text-slate-500 font-medium">Pengelolaan data masuk dari berbagai stasiun pemantauan.</p>
|
||||
<h3 class="text-lg font-bold text-slate-900">Mapping Organisasi Dataset Lingkungan - Tahun {{date('Y')}}</h3>
|
||||
{{-- <p class="text-xs text-slate-500 font-medium">Pengelolaan data masuk dari berbagai stasiun pemantauan.</p> --}}
|
||||
</div>
|
||||
<div class="flex items-center space-x-2">
|
||||
{{-- <div class="flex items-center space-x-2">
|
||||
<button class="p-2 border border-slate-200 rounded-xl hover:bg-slate-50 transition-colors flex items-center text-sm font-semibold text-slate-600">
|
||||
<i data-lucide="download-cloud" class="w-4 h-4 mr-2"></i> Ekspor
|
||||
</button>
|
||||
<button class="p-2 bg-slate-900 text-white rounded-xl hover:bg-slate-800 transition-colors flex items-center text-sm font-semibold">
|
||||
<i data-lucide="filter" class="w-4 h-4 mr-2"></i> Filter
|
||||
</button>
|
||||
</div>
|
||||
</div> --}}
|
||||
</div>
|
||||
|
||||
<div class="overflow-x-auto">
|
||||
<table class="w-full text-left border-collapse">
|
||||
<div class="overflow-x-auto p-8">
|
||||
<table class="w-full text-left border-collapse"
|
||||
data-search="true"
|
||||
data-toggle="table"
|
||||
data-pagination="true"
|
||||
data-toolbar="#toolbar"
|
||||
data-show-refresh="true"
|
||||
data-url="{{route($route.'.gridTabel')}}"
|
||||
data-sort-name="ids"
|
||||
data-sort-order="desc"
|
||||
data-page-size="10"
|
||||
data-id-field="id"
|
||||
id="grid-data">
|
||||
<thead class="bg-slate-50/50 border-b border-slate-100">
|
||||
<tr>
|
||||
<th class="px-6 py-4 text-[10px] font-bold text-slate-400 uppercase tracking-widest" data-width="10" data-field="no">No</th>
|
||||
<th class="px-6 py-4 text-[10px] font-bold text-slate-400 uppercase tracking-widest" data-field="name">Instansi</th>
|
||||
<th class="px-6 py-4 text-[10px] font-bold text-slate-400 uppercase tracking-widest" data-field="dataset">Dataset</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody></tbody>
|
||||
</table>
|
||||
<table class="w-full text-left border-collapse hidden">
|
||||
<thead class="bg-slate-50/50 border-b border-slate-100">
|
||||
<tr>
|
||||
<th class="px-6 py-4 text-[10px] font-bold text-slate-400 uppercase tracking-widest">Judul Dataset</th>
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ Route::name('dashboard.')->prefix('dashboard')->group(function () {
|
|||
Route::get('/dataset/resource/{id}',[HomeController::class,'resource'])->name('resource');
|
||||
Route::get('/dataset/resource/instansi/{instansi_id}/{id}',[HomeController::class,'resource_instansi'])->name('resource_instansi');
|
||||
Route::get('/grid',[HomeController::class,'grid'])->name('grid');
|
||||
Route::get('/grid/tabel',[HomeController::class,'gridTabel'])->name('gridTabel');
|
||||
Route::get('/gridResource',[HomeController::class,'gridResource'])->name('gridResource');
|
||||
Route::get('/datasetGrid/{alias}',[HomeController::class,'datasetGrid'])->name('datasetGrid');
|
||||
Route::get('/api/chart/{template_id}/{instansi_id}',[HomeController::class,'apiChart'])->name('apiChart');
|
||||
|
|
|
|||
Loading…
Reference in New Issue