initial commit
This commit is contained in:
@@ -5,14 +5,14 @@
|
||||
<div class="flex flex-col md:flex-row justify-between items-center gap-6 bg-white p-8 rounded-[3rem] border border-slate-100 shadow-sm">
|
||||
<div>
|
||||
<h1 class="text-3xl font-black text-slate-800 tracking-tighter uppercase leading-none">
|
||||
Intelligence <span class="text-indigo-600">Center</span>
|
||||
Pusat <span class="text-indigo-600">Laporan</span>
|
||||
</h1>
|
||||
<p class="text-[10px] text-slate-400 font-bold uppercase tracking-[0.3em] mt-2">
|
||||
Laporan: {{ strtoupper(str_replace('_', ' ', $module)) }}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
{{-- PROTEKSI EXPORT: Hanya muncul jika memiliki izin 'create' pada modul reports --}}
|
||||
{{-- HAK AKSES EKSPOR: Hanya muncul jika memiliki izin 'create' pada modul reports --}}
|
||||
@can('check-access', ['reports', 'create'])
|
||||
<div class="flex items-center gap-3">
|
||||
{{-- Export PDF --}}
|
||||
@@ -31,7 +31,7 @@
|
||||
@endcan
|
||||
</div>
|
||||
|
||||
{{-- 2. ADVANCED FILTER PANEL (TETAP UTUH) --}}
|
||||
{{-- 2. PANEL FILTER --}}
|
||||
<div class="bg-white rounded-[3rem] border border-slate-100 shadow-sm p-8">
|
||||
<form action="{{ route('admin.reports.index') }}" method="GET" class="grid grid-cols-1 md:grid-cols-4 gap-8">
|
||||
|
||||
@@ -53,9 +53,9 @@
|
||||
|
||||
{{-- PIC & Period --}}
|
||||
<div class="space-y-3">
|
||||
<label class="block text-[10px] font-black text-slate-400 uppercase tracking-widest ml-2">Staff & Periode</label>
|
||||
<label class="block text-[10px] font-black text-slate-400 uppercase tracking-widest ml-2">PIC & Periode</label>
|
||||
<select name="pic_id" class="w-full bg-slate-50 border-none rounded-2xl text-xs font-bold">
|
||||
<option value="">Semua PIC Staff</option>
|
||||
<option value="">Semua PIC</option>
|
||||
@foreach($users as $user)
|
||||
<option value="{{ $user->id }}" {{ request('pic_id') == $user->id ? 'selected' : '' }}>{{ $user->name }}</option>
|
||||
@endforeach
|
||||
@@ -67,29 +67,28 @@
|
||||
</div>
|
||||
|
||||
{{-- Status Filter --}}
|
||||
<div class="space-y-3">
|
||||
<label class="block text-[10px] font-black text-slate-400 uppercase tracking-widest ml-2">Status Analitik</label>
|
||||
<select name="status" class="w-full bg-slate-50 border-none rounded-2xl text-xs font-bold">
|
||||
<option value="">Semua Kondisi / Status</option>
|
||||
@if($module == 'cats')
|
||||
{{-- Perbaikan: Pastikan value ini ditangkap di Controller --}}
|
||||
<option value="sehat" {{ request('status') == 'sehat' ? 'selected' : '' }}>Sehat (Healthy)</option>
|
||||
<option value="sakit" {{ request('status') == 'sakit' ? 'selected' : '' }}>Dalam Perawatan (Treatment)</option>
|
||||
@elseif(in_array($module, ['vaccine', 'deworming', 'flea', 'grooming']))
|
||||
<option value="not_set" {{ request('status') == 'not_set' ? 'selected' : '' }}>Date Not Set</option>
|
||||
<option value="overdue" {{ request('status') == 'overdue' ? 'selected' : '' }}>Overdue (Terlewat)</option>
|
||||
<option value="soon" {{ request('status') == 'soon' ? 'selected' : '' }}>Akan Datang (7 Hari)</option>
|
||||
@elseif(in_array($module, ['medicine', 'food', 'supplies']))
|
||||
<option value="critical" {{ request('status') == 'critical' ? 'selected' : '' }}>Stok Kritis (< 5)</option>
|
||||
<option value="expired" {{ request('status') == 'expired' ? 'selected' : '' }}>Sudah Expired</option>
|
||||
<option value="safe" {{ request('status') == 'safe' ? 'selected' : '' }}>Stok Aman</option>
|
||||
@endif
|
||||
</select>
|
||||
|
||||
<button type="submit" class="w-full bg-indigo-600 text-white py-3 rounded-2xl text-[10px] font-black uppercase tracking-widest hover:bg-slate-900 shadow-xl shadow-indigo-100 transition-all">
|
||||
<i class="fas fa-filter mr-2"></i> Apply Filter
|
||||
</button>
|
||||
</div>
|
||||
<div class="space-y-3">
|
||||
<label class="block text-[10px] font-black text-slate-400 uppercase tracking-widest ml-2">Status Analitik</label>
|
||||
<select name="status" class="w-full bg-slate-50 border-none rounded-2xl text-xs font-bold">
|
||||
<option value="">Semua Kondisi / Status</option>
|
||||
@if($module == 'cats')
|
||||
<option value="sehat" {{ request('status') == 'sehat' ? 'selected' : '' }}>Sehat (Sehat)</option>
|
||||
<option value="sakit" {{ request('status') == 'sakit' ? 'selected' : '' }}>Dalam Perawatan (Perawatan)</option>
|
||||
@elseif(in_array($module, ['vaccine', 'deworming', 'flea', 'grooming']))
|
||||
<option value="not_set" {{ request('status') == 'not_set' ? 'selected' : '' }}>Date Not Set</option>
|
||||
<option value="overdue" {{ request('status') == 'overdue' ? 'selected' : '' }}>Overdue (Terlewat)</option>
|
||||
<option value="soon" {{ request('status') == 'soon' ? 'selected' : '' }}>Akan Datang (7 Hari)</option>
|
||||
@elseif(in_array($module, ['medicine', 'food', 'supplies']))
|
||||
<option value="critical" {{ request('status') == 'critical' ? 'selected' : '' }}>Stok Kritis (< 5)</option>
|
||||
<option value="expired" {{ request('status') == 'expired' ? 'selected' : '' }}>Sudah Expired</option>
|
||||
<option value="safe" {{ request('status') == 'safe' ? 'selected' : '' }}>Stok Aman</option>
|
||||
@endif
|
||||
</select>
|
||||
|
||||
<button type="submit" class="w-full bg-indigo-600 text-white py-3 rounded-2xl text-[10px] font-black uppercase tracking-widest hover:bg-slate-900 shadow-xl shadow-indigo-100 transition-all">
|
||||
<i class="fas fa-filter mr-2"></i> Apply Filter
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{{-- Summary & Reset --}}
|
||||
<div class="flex flex-col justify-between">
|
||||
@@ -105,7 +104,7 @@
|
||||
</form>
|
||||
</div>
|
||||
|
||||
{{-- 3. DATA TABLE (TETAP UTUH) --}}
|
||||
{{-- 3. DATA TABLE --}}
|
||||
<div class="bg-white rounded-[3rem] border border-slate-100 shadow-sm overflow-hidden">
|
||||
<div class="overflow-x-auto">
|
||||
<table class="w-full text-left">
|
||||
@@ -113,23 +112,28 @@
|
||||
<tr>
|
||||
<th class="p-6 text-[10px] font-black text-slate-400 uppercase tracking-widest">Informasi Utama</th>
|
||||
<th class="p-6 text-[10px] font-black text-slate-400 uppercase tracking-widest">Detail Data</th>
|
||||
<th class="p-6 text-[10px] font-black text-slate-400 uppercase tracking-widest">Staff & Jadwal</th>
|
||||
<th class="p-6 text-[10px] font-black text-slate-400 uppercase tracking-widest">PIC & Jadwal</th>
|
||||
<th class="p-6 text-[10px] font-black text-slate-400 uppercase tracking-widest text-right">Status Aktif</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="divide-y divide-slate-50">
|
||||
@forelse($results as $item)
|
||||
@php
|
||||
$dateCol = match($module) {
|
||||
'cats' => 'tanggal_lahir',
|
||||
'vaccine' => 'jadwal_vaksin',
|
||||
'deworming' => 'jadwal_obat_cacing',
|
||||
'flea' => 'jadwal_obat_kutu',
|
||||
'grooming' => 'jadwal_grooming',
|
||||
'medicine', 'food', 'supplies' => 'expired_date',
|
||||
default => 'created_at'
|
||||
};
|
||||
$dateValue = $item->{$dateCol};
|
||||
$dateValue = null;
|
||||
|
||||
// PENGISIAN DATEVALUE KHUSUS SELAIN KUCING
|
||||
// Kucing tidak butuh dateValue untuk kolom status
|
||||
if ($module !== 'cats') {
|
||||
$dateCol = match($module) {
|
||||
'vaccine' => 'jadwal_vaksin',
|
||||
'deworming' => 'jadwal_obat_cacing',
|
||||
'flea' => 'jadwal_obat_kutu',
|
||||
'grooming' => 'jadwal_grooming',
|
||||
'medicine', 'food', 'supplies' => 'expired_date',
|
||||
default => 'created_at'
|
||||
};
|
||||
$dateValue = $item->{$dateCol};
|
||||
}
|
||||
@endphp
|
||||
<tr class="group hover:bg-slate-50/30 transition-all">
|
||||
<td class="p-6">
|
||||
@@ -150,15 +154,26 @@
|
||||
</td>
|
||||
<td class="p-6">
|
||||
<div class="flex flex-col gap-1">
|
||||
<span class="text-[10px] font-black text-slate-600 uppercase">{{ $item->pic->name ?? 'System' }}</span>
|
||||
<span class="text-[10px] font-black text-slate-600 uppercase">{{ $item->pic->name ?? 'Sistem' }}</span>
|
||||
<span class="text-[9px] font-bold text-slate-400 italic">
|
||||
<i class="far fa-calendar-alt mr-1"></i> {{ $dateValue ? \Carbon\Carbon::parse($dateValue)->format('d/m/Y') : 'DATE NOT SET' }}
|
||||
{{-- PROTEKSI TANGGAL DI KOLOM STAFF & JADWAL --}}
|
||||
<i class="far fa-calendar-alt mr-1"></i>
|
||||
@if($module === 'cats')
|
||||
{{ $item->updated_at ? \Carbon\Carbon::parse($item->updated_at)->format('d/m/Y') : 'DATE NOT SET' }}
|
||||
@else
|
||||
{{ ($dateValue && strtotime($dateValue)) ? \Carbon\Carbon::parse($dateValue)->format('d/m/Y') : 'DATE NOT SET' }}
|
||||
@endif
|
||||
</span>
|
||||
</div>
|
||||
</td>
|
||||
<td class="p-6 text-right">
|
||||
@if(in_array($module, ['vaccine', 'deworming', 'flea', 'grooming']))
|
||||
@if(empty($dateValue))
|
||||
{{-- PROTEKSI TANGGAL DI KOLOM STATUS AKTIF --}}
|
||||
@if($module === 'cats')
|
||||
<span class="px-3 py-1.5 {{ $item->treatment_status == 1 ? 'bg-amber-100 text-amber-600' : 'bg-emerald-100 text-emerald-600' }} rounded-lg text-[8px] font-black uppercase">
|
||||
{{ $item->treatment_status == 1 ? 'Perawatan' : 'Sehat' }}
|
||||
</span>
|
||||
@elseif(in_array($module, ['vaccine', 'deworming', 'flea', 'grooming']))
|
||||
@if(empty($dateValue) || !strtotime($dateValue))
|
||||
<span class="px-3 py-1.5 bg-slate-100 text-slate-400 rounded-lg text-[8px] font-black uppercase">Date Not Set</span>
|
||||
@elseif(\Carbon\Carbon::parse($dateValue)->isPast())
|
||||
<span class="px-3 py-1.5 bg-rose-100 text-rose-600 rounded-lg text-[8px] font-black uppercase animate-pulse">Overdue</span>
|
||||
@@ -168,17 +183,13 @@
|
||||
<span class="px-3 py-1.5 bg-emerald-100 text-emerald-600 rounded-lg text-[8px] font-black uppercase">Scheduled</span>
|
||||
@endif
|
||||
@elseif(in_array($module, ['medicine', 'food', 'supplies']))
|
||||
@if(isset($item->expired_date) && \Carbon\Carbon::parse($item->expired_date)->isPast())
|
||||
@if(!empty($item->expired_date) && strtotime($item->expired_date) && \Carbon\Carbon::parse($item->expired_date)->isPast())
|
||||
<span class="px-3 py-1.5 bg-rose-600 text-white rounded-lg text-[8px] font-black uppercase">Expired</span>
|
||||
@elseif($item->qty < 5)
|
||||
@elseif(isset($item->qty) && $item->qty < 5)
|
||||
<span class="px-3 py-1.5 bg-rose-100 text-rose-600 rounded-lg text-[8px] font-black uppercase">Low Stock</span>
|
||||
@else
|
||||
<span class="px-3 py-1.5 bg-slate-100 text-slate-500 rounded-lg text-[8px] font-black uppercase">Safe</span>
|
||||
@endif
|
||||
@else
|
||||
<span class="px-3 py-1.5 {{ $item->riwayat_sakit_terakhir ? 'bg-amber-100 text-amber-600' : 'bg-emerald-100 text-emerald-600' }} rounded-lg text-[8px] font-black uppercase">
|
||||
{{ $item->riwayat_sakit_terakhir ? 'Treatment' : 'Healthy' }}
|
||||
</span>
|
||||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
Reference in New Issue
Block a user