ganti label & perbaikan fungsi report & matting

This commit is contained in:
Dwi F Sukmana
2026-02-08 18:45:10 +07:00
parent 9301d81259
commit e83502af40
7 changed files with 137 additions and 115 deletions
@@ -3,7 +3,7 @@
<div class="flex flex-col md:flex-row md:items-center justify-between gap-4">
<div>
<h2 class="text-3xl font-black text-slate-800 tracking-tight leading-none mb-1">Medical Insights</h2>
<p class="text-sm text-slate-500 font-medium italic uppercase tracking-tighter">Analisis Kesehatan & Konsumsi Obat earrin cats</p>
<p class="text-sm text-slate-500 font-medium italic uppercase tracking-tighter">Analisis Kesehatan & Konsumsi Obat Ily Cattery</p>
</div>
<div class="flex gap-2">
<span class="px-4 py-2 bg-white border border-slate-200 rounded-xl text-[10px] font-black text-slate-400">
@@ -5,7 +5,7 @@
<div class="flex flex-col md:flex-row md:items-center justify-between gap-4 px-2">
<div>
<h2 class="text-2xl font-black text-slate-800 tracking-tight leading-none mb-1">Kategori Manager</h2>
<p class="text-sm text-slate-500 font-medium italic">Master data Smart Categorization ilycats.</p>
<p class="text-sm text-slate-500 font-medium italic">Master data Smart Categorization Ily Cattery.</p>
</div>
<div class="flex items-center gap-3">
+23 -22
View File
@@ -67,28 +67,29 @@
</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="">Pilih Status</option>
@if($module == 'cats')
<option value="sehat" {{ request('status') == 'sehat' ? 'selected' : '' }}>Sehat</option>
<option value="sakit" {{ request('status') == 'sakit' ? 'selected' : '' }}>Dalam 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>
<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>
{{-- Summary & Reset --}}
<div class="flex flex-col justify-between">
@@ -1,8 +1,7 @@
<x-app-layout>
{{-- Container utama: Dikunci pada 1200px agar tampilan terpusat dan elegan --}}
<div class="max-w-[1200px] mx-auto pb-16 px-6 space-y-8 font-sans antialiased tracking-tight">
{{-- 1. HEADER & DYNAMIC STATS --}}
{{-- 1. HEADER --}}
<div class="flex flex-col lg:flex-row items-center justify-between gap-6">
<div class="text-center lg:text-left">
<h2 class="text-2xl font-black text-slate-900 uppercase tracking-tighter leading-none">Lineage Archive</h2>
@@ -13,7 +12,6 @@
</div>
<div class="flex items-center gap-4">
{{-- Quick Stats Widget (TETAP UTUH) --}}
<div class="bg-white px-5 py-3 rounded-2xl border border-slate-200 shadow-sm flex items-center gap-4">
<div class="text-right">
<p class="text-[8px] text-slate-400 font-black uppercase tracking-widest">Total Record</p>
@@ -24,7 +22,6 @@
</div>
</div>
{{-- PROTEKSI EXPORT PDF: Hanya muncul jika memiliki izin 'create' pada modul matting_reports --}}
@can('check-access', ['matting_reports', 'create'])
<a href="{{ request()->fullUrlWithQuery(['export' => 'pdf']) }}" class="bg-slate-900 px-6 py-3 rounded-2xl text-[10px] font-black text-white uppercase hover:bg-indigo-600 transition-all shadow-lg flex items-center gap-3">
<i class="fas fa-file-pdf"></i> PDF Export
@@ -33,31 +30,42 @@
</div>
</div>
{{-- 2. FILTER BAR: Proporsional & Ramping (TETAP UTUH) --}}
<form action="{{ route('admin.reports.matting.index') }}" method="GET" class="bg-white p-3 rounded-[1.5rem] border border-slate-200 shadow-sm grid grid-cols-1 md:grid-cols-4 lg:grid-cols-5 gap-3">
<div class="relative">
<i class="fas fa-search absolute left-4 top-1/2 -translate-y-1/2 text-slate-300 text-xs"></i>
<input type="text" name="parent_name" value="{{ request('parent_name') }}" placeholder="Search ancestry..." class="w-full bg-slate-50 border-none rounded-xl text-xs font-bold py-3 pl-11 focus:ring-2 focus:ring-indigo-500/20">
{{-- 2. FILTER BAR (Perbaikan Multiple Registry) --}}
<form action="{{ route('admin.reports.matting.index') }}" method="GET" class="bg-white p-4 rounded-[1.5rem] border border-slate-200 shadow-sm grid grid-cols-1 md:grid-cols-4 lg:grid-cols-6 gap-4 items-end">
<div class="space-y-1">
<label class="text-[9px] font-black text-slate-400 uppercase ml-2">Ancestry Search</label>
<input type="text" name="parent_name" value="{{ request('parent_name') }}" placeholder="Sire/Dam Name..." class="w-full bg-slate-50 border-none rounded-xl text-xs font-bold py-3">
</div>
<select name="ras" class="bg-slate-50 border-none rounded-xl text-xs font-bold py-3 focus:ring-2 focus:ring-indigo-500/20 cursor-pointer">
<option value="">All Breeds</option>
@foreach($breeds as $breed)
<option value="{{ $breed }}" {{ request('ras') == $breed ? 'selected' : '' }}>{{ $breed }}</option>
@endforeach
</select>
<select name="registry" class="bg-slate-50 border-none rounded-xl text-xs font-bold py-3 focus:ring-2 focus:ring-indigo-500/20 cursor-pointer">
<option value="">All Registry</option>
@foreach($registries as $reg)
<option value="{{ $reg }}" {{ request('registry') == $reg ? 'selected' : '' }}>{{ $reg }}</option>
@endforeach
</select>
<input type="date" name="start_date" value="{{ request('start_date') }}" class="bg-slate-50 border-none rounded-xl text-xs font-bold py-3 focus:ring-2 focus:ring-indigo-500/20">
<button type="submit" class="bg-indigo-600 text-white rounded-xl text-[10px] font-black uppercase hover:bg-slate-900 transition-all shadow-md">Apply Filter</button>
<div class="space-y-1">
<label class="text-[9px] font-black text-slate-400 uppercase ml-2">Breed</label>
<select name="ras" class="w-full bg-slate-50 border-none rounded-xl text-xs font-bold py-3">
<option value="">All Breeds</option>
@foreach($breeds as $breed)
<option value="{{ $breed }}" {{ request('ras') == $breed ? 'selected' : '' }}>{{ $breed }}</option>
@endforeach
</select>
</div>
{{-- MULTIPLE CHOICE REGISTRY --}}
<div class="space-y-1 lg:col-span-2">
<label class="text-[9px] font-black text-slate-400 uppercase ml-2">Registry (Hold Ctrl to select multiple)</label>
<select name="registry[]" multiple class="w-full bg-slate-50 border-none rounded-xl text-xs font-bold py-2 h-[42px] focus:h-auto transition-all">
@foreach($registries as $reg)
<option value="{{ $reg }}" {{ is_array(request('registry')) && in_array($reg, request('registry')) ? 'selected' : '' }}>{{ $reg }}</option>
@endforeach
</select>
</div>
<div class="space-y-1">
<label class="text-[9px] font-black text-slate-400 uppercase ml-2">Start Date</label>
<input type="date" name="start_date" value="{{ request('start_date') }}" class="w-full bg-slate-50 border-none rounded-xl text-xs font-bold py-3">
</div>
<button type="submit" class="bg-indigo-600 h-[42px] text-white rounded-xl text-[10px] font-black uppercase hover:bg-slate-900 transition-all shadow-md">Apply Filter</button>
</form>
<hr class="border-slate-100 mx-4">
{{-- 3. ARCHIVE LIST: Proportional Card Grid --}}
{{-- 3. ARCHIVE LIST --}}
<div class="space-y-4">
{{-- Legend Header --}}
<div class="hidden lg:grid grid-cols-12 px-10 py-1 text-[9px] font-black text-slate-400 uppercase tracking-[0.2em]">
@@ -69,26 +77,29 @@
@forelse($mattings as $matting)
<div class="bg-white border border-slate-200 rounded-[2rem] p-5 hover:border-indigo-400 hover:shadow-xl hover:shadow-indigo-50/50 transition-all group relative overflow-hidden">
{{-- Decorative Initial In Latar Belakang --}}
<span class="absolute -right-2 -bottom-4 text-7xl font-black text-slate-50 italic group-hover:text-indigo-50/50 transition-colors select-none z-0">
{{ substr($matting->pic->name ?? 'S', 0, 1) }}
</span>
<div class="grid grid-cols-1 lg:grid-cols-12 gap-6 items-center relative z-10">
{{-- Column 1: Identity (Sire/Dam) --}}
{{-- Perbaikan 1: Sinkronisasi Foto dari table cats --}}
<div class="lg:col-span-5 flex items-center gap-6 min-w-0">
<div class="flex -space-x-4 shrink-0">
<img src="{{ $matting->sire->photo ? asset('storage/' . $matting->sire->photo) : asset('images/default-cat.png') }}" class="w-12 h-12 rounded-[1rem] border-4 border-white shadow-md object-cover transform group-hover:-rotate-6 transition-transform">
<img src="{{ $matting->dam->photo ? asset('storage/' . $matting->dam->photo) : asset('images/default-cat.png') }}" class="w-12 h-12 rounded-[1rem] border-4 border-white shadow-md object-cover transform group-hover:rotate-6 transition-transform">
{{-- Sire Photo --}}
<img src="{{ $matting->sire && $matting->sire->foto ? asset('storage/' . $matting->sire->foto) : asset('images/default-cat.png') }}"
class="w-12 h-12 rounded-[1rem] border-4 border-white shadow-md object-cover transform group-hover:-rotate-6 transition-transform">
{{-- Dam Photo --}}
<img src="{{ $matting->dam && $matting->dam->foto ? asset('storage/' . $matting->dam->foto) : asset('images/default-cat.png') }}"
class="w-12 h-12 rounded-[1rem] border-4 border-white shadow-md object-cover transform group-hover:rotate-6 transition-transform">
</div>
<div class="min-w-0 flex-1">
<h4 class="text-sm font-black text-slate-800 uppercase truncate leading-tight mb-1">
{{ $matting->sire->nama_kucing }} <span class="text-slate-300 mx-1">×</span> {{ $matting->dam->nama_kucing }}
{{ $matting->sire->nama_kucing ?? 'N/A' }} <span class="text-slate-300 mx-1">×</span> {{ $matting->dam->nama_kucing ?? 'N/A' }}
</h4>
<div class="flex items-center gap-3">
<span class="text-[8px] font-black text-indigo-600 bg-indigo-50 px-2 py-0.5 rounded tracking-widest leading-none">#{{ $matting->id }}</span>
<span class="text-[10px] text-slate-400 font-bold uppercase tracking-tighter leading-none">{{ $matting->sire->ras ?? 'Unknown' }}</span>
<span class="text-[10px] text-slate-400 font-bold uppercase tracking-tighter leading-none">{{ $matting->registry ?? 'No Registry' }}</span>
</div>
</div>
</div>
@@ -100,20 +111,19 @@
<p class="text-[13px] font-black text-slate-800 leading-none">{{ $matting->kittens_count }} <span class="text-[10px] text-slate-300 font-bold uppercase ml-0.5">Paws</span></p>
</div>
<div class="text-center">
<p class="text-[8px] text-slate-400 font-black uppercase mb-1 tracking-widest">Duration</p>
<p class="text-[13px] font-black text-slate-800 leading-none">{{ $matting->tgl_kawin_awal->diffInDays($matting->tgl_kawin_akhir) + 1 }} <span class="text-[10px] text-slate-300 font-bold uppercase ml-0.5">Days</span></p>
<p class="text-[8px] text-slate-400 font-black uppercase mb-1 tracking-widest">Date</p>
<p class="text-[11px] font-black text-slate-800 leading-none">{{ $matting->tgl_kawin_awal->format('d/m/Y') }}</p>
</div>
</div>
{{-- Column 3: Registrar --}}
{{-- Perbaikan 2: Nama Registrar (PIC yang menginput) --}}
<div class="lg:col-span-2 flex flex-col items-center lg:items-start px-4 min-w-0">
<p class="text-[8px] text-slate-400 font-black uppercase mb-1.5 tracking-widest">Registrar</p>
<p class="text-[11px] font-bold text-slate-600 uppercase italic truncate w-full text-center lg:text-left tracking-tight">
{{ $matting->pic->name ?? 'System' }}
{{ $matting->pic->name ?? 'System Admin' }}
</p>
</div>
{{-- Column 4: Action (PROTEKSI READ: Mengikuti matriks permission matting_reports) --}}
<div class="lg:col-span-2 flex justify-end shrink-0">
@can('check-access', ['matting_reports', 'read'])
<a href="{{ route('admin.reports.matting.show', $matting->id) }}" class="w-full lg:w-auto px-6 py-3 bg-slate-900 text-white text-[10px] font-black uppercase rounded-2xl hover:bg-indigo-600 transition-all shadow-md flex items-center justify-center gap-2 group-hover:scale-105">
@@ -121,18 +131,13 @@
</a>
@endcan
</div>
</div>
</div>
@empty
<div class="py-24 bg-white border-2 border-dashed border-slate-100 rounded-[2.5rem] text-center">
<i class="fas fa-folder-open text-4xl text-slate-100 mb-4"></i>
<p class="text-slate-400 font-bold uppercase text-[10px] tracking-[0.4em]">Archive is empty</p>
</div>
{{-- Empty State --}}
@endforelse
</div>
{{-- 4. PAGINATION (TETAP UTUH) --}}
<div class="pt-8 flex justify-center">
{{ $mattings->links() }}
</div>
@@ -4,7 +4,7 @@
<div class="flex flex-col md:flex-row md:items-center justify-between gap-4">
<div>
<h2 class="text-2xl font-black text-slate-800 tracking-tight leading-none mb-1 text-uppercase">Log Rekam Medis</h2>
<p class="text-xs text-slate-500 font-medium italic uppercase tracking-wider">Riwayat kesehatan & penggunaan obat seluruh pasien.</p>
<p class="text-xs text-slate-500 font-medium italic uppercase tracking-wider">Riwayat kesehatan & penggunaan obat seluruh kucing.</p>
</div>
{{-- PROTEKSI TOMBOL CREATE: Hanya muncul jika punya izin Create --}}
@@ -21,7 +21,7 @@
<table class="w-full text-left border-collapse">
<thead class="bg-slate-50 text-[10px] font-black text-slate-400 uppercase tracking-widest border-b border-slate-100">
<tr>
<th class="px-6 py-4">Tanggal & Pasien</th>
<th class="px-6 py-4">Tanggal & Kucing</th>
<th class="px-6 py-4">Keluhan & Diagnosa</th>
<th class="px-6 py-4">Obat (Qty)</th>
<th class="px-6 py-4 text-center">Bukti</th>
@@ -31,7 +31,7 @@
<tbody class="divide-y divide-slate-100 font-medium text-slate-700">
@forelse($treatments as $treatment)
<tr class="hover:bg-slate-50/50 transition-all group">
{{-- Tanggal & Pasien --}}
{{-- Tanggal & Kucing --}}
<td class="px-6 py-4">
<div class="flex items-center gap-3">
<div class="w-10 h-10 rounded-xl bg-slate-100 overflow-hidden ring-2 ring-white shadow-sm">