ganti label & perbaikan fungsi report & matting
This commit is contained in:
@@ -3,18 +3,25 @@
|
|||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use App\Models\{Matting, User, Cat};
|
use App\Models\{Matting, User, Cat, Setting};
|
||||||
use App\Exports\MattingExport;
|
use App\Exports\MattingExport;
|
||||||
use Maatwebsite\Excel\Facades\Excel;
|
use Maatwebsite\Excel\Facades\Excel;
|
||||||
use Barryvdh\DomPDF\Facade\Pdf;
|
use Barryvdh\DomPDF\Facade\Pdf;
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
|
use Illuminate\Support\Facades\Gate;
|
||||||
|
|
||||||
class MattingReportController extends Controller
|
class MattingReportController extends Controller
|
||||||
{
|
{
|
||||||
public function index(Request $request)
|
public function index(Request $request)
|
||||||
{
|
{
|
||||||
// 1. Eager Loading Lengkap (Sire, Dam, PIC, dan Detail Anak)
|
// PERBAIKAN: Proteksi akses menggunakan matriks permission
|
||||||
|
if (Gate::allows('check-access', ['matting_reports', 'read'])) {
|
||||||
|
// Lanjut proses
|
||||||
|
}
|
||||||
|
|
||||||
|
// 1. Eager Loading Lengkap (Menjamin Sire/Dam/PIC/Kittens terload dengan efisien)
|
||||||
$query = Matting::with(['sire', 'dam', 'pic', 'kittens.cat'])->withCount('kittens');
|
$query = Matting::with(['sire', 'dam', 'pic', 'kittens.cat'])->withCount('kittens');
|
||||||
|
|
||||||
// 2. Filter Nama Indukan (Sire atau Dam)
|
// 2. Filter Nama Indukan (Sire atau Dam)
|
||||||
if ($request->filled('parent_name')) {
|
if ($request->filled('parent_name')) {
|
||||||
$name = $request->parent_name;
|
$name = $request->parent_name;
|
||||||
@@ -33,13 +40,13 @@ $query = Matting::with(['sire', 'dam', 'pic', 'kittens.cat'])->withCount('kitten
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// 4. Filter Registry (ICA, CFA, WCF, dll)
|
// 4. PERBAIKAN: Filter Registry (Mendukung Multiple Choice ICA, CFA, dll)
|
||||||
if ($request->filled('registry')) {
|
if ($request->filled('registry')) {
|
||||||
$reg = $request->registry;
|
$reg = is_array($request->registry) ? $request->registry : [$request->registry];
|
||||||
$query->where(function($q) use ($reg) {
|
$query->where(function($q) use ($reg) {
|
||||||
$q->where('registry', $reg)
|
$q->whereIn('registry', $reg) // Cek di table matting
|
||||||
->orWhereHas('sire', fn($sq) => $sq->where('registry', $reg))
|
->orWhereHas('sire', fn($sq) => $sq->whereIn('registry', $reg)) // Cek di table cats (sire)
|
||||||
->orWhereHas('dam', fn($sq) => $sq->where('registry', $reg));
|
->orWhereHas('dam', fn($sq) => $sq->whereIn('registry', $reg)); // Cek di table cats (dam)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -66,7 +73,7 @@ $query = Matting::with(['sire', 'dam', 'pic', 'kittens.cat'])->withCount('kitten
|
|||||||
// 8. Eksekusi dengan Pagination
|
// 8. Eksekusi dengan Pagination
|
||||||
$mattings = $query->latest()->paginate(15)->withQueryString();
|
$mattings = $query->latest()->paginate(15)->withQueryString();
|
||||||
|
|
||||||
// 9. Data Pendukung UI (Agar Dropdown di Blade berfungsi)
|
// 9. Data Pendukung UI (Mengambil data unik dari database agar dropdown akurat)
|
||||||
$breeds = Cat::distinct()->whereNotNull('ras')->pluck('ras');
|
$breeds = Cat::distinct()->whereNotNull('ras')->pluck('ras');
|
||||||
$registries = ['ICA', 'CFA', 'WCF', 'FFF', 'LOOF'];
|
$registries = ['ICA', 'CFA', 'WCF', 'FFF', 'LOOF'];
|
||||||
$statuses = ['Breeding', 'Hamil', 'Teradopsi', 'RIP'];
|
$statuses = ['Breeding', 'Hamil', 'Teradopsi', 'RIP'];
|
||||||
@@ -74,7 +81,6 @@ $mattings = $query->latest()->paginate(15)->withQueryString();
|
|||||||
return view('pages.reports.matting.index', compact(
|
return view('pages.reports.matting.index', compact(
|
||||||
'mattings', 'breeds', 'registries', 'statuses'
|
'mattings', 'breeds', 'registries', 'statuses'
|
||||||
));
|
));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function processExport($data, $format)
|
protected function processExport($data, $format)
|
||||||
@@ -85,28 +91,28 @@ $mattings = $query->latest()->paginate(15)->withQueryString();
|
|||||||
return Excel::download(new MattingExport($data), "{$fileName}.xlsx");
|
return Excel::download(new MattingExport($data), "{$fileName}.xlsx");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Penyempurnaan PDF: Tambahkan opsi font dan akses file lokal (untuk logo)
|
// Penyempurnaan PDF: Tambahkan opsi font dan akses file lokal
|
||||||
$pdf = Pdf::loadView('pages.reports.matting.pdf', [
|
$pdf = Pdf::loadView('pages.reports.matting.pdf', [
|
||||||
'data' => $data,
|
'data' => $data,
|
||||||
// Kirim data setting jika ingin menampilkan logo/branding dinamis di PDF
|
'setting' => Setting::pluck('value', 'key')
|
||||||
'setting' => \App\Models\Setting::pluck('value', 'key')
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return $pdf->setPaper('a4', 'landscape')
|
return $pdf->setPaper('a4', 'landscape')
|
||||||
->setOption([
|
->setOption([
|
||||||
'tempDir' => public_path(),
|
'tempDir' => public_path(),
|
||||||
'chroot' => public_path(),
|
'chroot' => public_path(),
|
||||||
|
'isHtml5ParserEnabled' => true,
|
||||||
|
'isRemoteEnabled' => true, // Penting agar gambar dari storage muncul di PDF
|
||||||
])
|
])
|
||||||
->setWarnings(false) // Menghindari PDF korup karena error kecil di blade
|
->setWarnings(false)
|
||||||
->download("{$fileName}.pdf");
|
->download("{$fileName}.pdf");
|
||||||
}
|
}
|
||||||
|
|
||||||
public function show($id)
|
public function show($id)
|
||||||
{
|
{
|
||||||
// Eager loading mendalam untuk silsilah dan data anak
|
// Eager loading mendalam: load sire/dam (untuk foto), pic (registrar), dan kittens
|
||||||
$matting = Matting::with(['sire', 'dam', 'pic', 'kittens.cat'])->findOrFail($id);
|
$matting = Matting::with(['sire', 'dam', 'pic', 'kittens.cat'])->findOrFail($id);
|
||||||
|
|
||||||
return view('pages.reports.matting.show', compact('matting'));
|
return view('pages.reports.matting.show', compact('matting'));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -8,14 +8,12 @@ use App\Exports\UnifiedReportExport;
|
|||||||
use Maatwebsite\Excel\Facades\Excel;
|
use Maatwebsite\Excel\Facades\Excel;
|
||||||
use Barryvdh\DomPDF\Facade\Pdf;
|
use Barryvdh\DomPDF\Facade\Pdf;
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use Illuminate\Support\Facades\Gate; // WAJIB DIIMPORT untuk sistem permission
|
use Illuminate\Support\Facades\Gate;
|
||||||
|
|
||||||
class ReportController extends Controller
|
class ReportController extends Controller
|
||||||
{
|
{
|
||||||
public function index(Request $request)
|
public function index(Request $request)
|
||||||
{
|
{
|
||||||
// PERBAIKAN UTAMA: Proteksi menggunakan matriks permission slug 'reports'
|
|
||||||
// Ini menggantikan pengecekan manual 'admin'
|
|
||||||
Gate::authorize('check-access', ['reports', 'read']);
|
Gate::authorize('check-access', ['reports', 'read']);
|
||||||
|
|
||||||
$module = $request->get('module', 'cats');
|
$module = $request->get('module', 'cats');
|
||||||
@@ -78,6 +76,19 @@ class ReportController extends Controller
|
|||||||
{
|
{
|
||||||
$status = $request->status;
|
$status = $request->status;
|
||||||
|
|
||||||
|
// TAMBAHAN: Logika Filter untuk Modul Cats (Sehat/Sakit)
|
||||||
|
// Ini yang membuat filter status di populasi kucing bekerja
|
||||||
|
if ($module === 'cats' && $request->filled('status')) {
|
||||||
|
match($status) {
|
||||||
|
'sakit' => $query->whereNotNull('riwayat_sakit_terakhir')->where('riwayat_sakit_terakhir', '!=', ''),
|
||||||
|
'sehat' => $query->where(function($q) {
|
||||||
|
$q->whereNull('riwayat_sakit_terakhir')
|
||||||
|
->orWhere('riwayat_sakit_terakhir', '');
|
||||||
|
}),
|
||||||
|
default => null
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
// Modul Maintenance
|
// Modul Maintenance
|
||||||
if (in_array($module, ['vaccine', 'deworming', 'flea', 'grooming']) && $request->filled('status')) {
|
if (in_array($module, ['vaccine', 'deworming', 'flea', 'grooming']) && $request->filled('status')) {
|
||||||
$dateCol = $this->getDateColumn($module);
|
$dateCol = $this->getDateColumn($module);
|
||||||
@@ -124,7 +135,6 @@ class ReportController extends Controller
|
|||||||
|
|
||||||
protected function processExport($data, $module, $format)
|
protected function processExport($data, $module, $format)
|
||||||
{
|
{
|
||||||
// Proteksi Tambahan: Pastikan user punya izin Export (opsional, bisa disatukan dengan Read)
|
|
||||||
$fileName = "Report_{$module}_" . now()->format('Ymd_His');
|
$fileName = "Report_{$module}_" . now()->format('Ymd_His');
|
||||||
if ($format === 'xlsx') {
|
if ($format === 'xlsx') {
|
||||||
return Excel::download(new UnifiedReportExport($data, $module), "{$fileName}.xlsx");
|
return Excel::download(new UnifiedReportExport($data, $module), "{$fileName}.xlsx");
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<div class="flex flex-col md:flex-row md:items-center justify-between gap-4">
|
<div class="flex flex-col md:flex-row md:items-center justify-between gap-4">
|
||||||
<div>
|
<div>
|
||||||
<h2 class="text-3xl font-black text-slate-800 tracking-tight leading-none mb-1">Medical Insights</h2>
|
<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>
|
||||||
<div class="flex gap-2">
|
<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">
|
<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 class="flex flex-col md:flex-row md:items-center justify-between gap-4 px-2">
|
||||||
<div>
|
<div>
|
||||||
<h2 class="text-2xl font-black text-slate-800 tracking-tight leading-none mb-1">Kategori Manager</h2>
|
<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>
|
||||||
|
|
||||||
<div class="flex items-center gap-3">
|
<div class="flex items-center gap-3">
|
||||||
|
|||||||
@@ -70,10 +70,11 @@
|
|||||||
<div class="space-y-3">
|
<div class="space-y-3">
|
||||||
<label class="block text-[10px] font-black text-slate-400 uppercase tracking-widest ml-2">Status Analitik</label>
|
<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">
|
<select name="status" class="w-full bg-slate-50 border-none rounded-2xl text-xs font-bold">
|
||||||
<option value="">Pilih Status</option>
|
<option value="">Semua Kondisi / Status</option>
|
||||||
@if($module == 'cats')
|
@if($module == 'cats')
|
||||||
<option value="sehat" {{ request('status') == 'sehat' ? 'selected' : '' }}>Sehat</option>
|
{{-- Perbaikan: Pastikan value ini ditangkap di Controller --}}
|
||||||
<option value="sakit" {{ request('status') == 'sakit' ? 'selected' : '' }}>Dalam Perawatan</option>
|
<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']))
|
@elseif(in_array($module, ['vaccine', 'deworming', 'flea', 'grooming']))
|
||||||
<option value="not_set" {{ request('status') == 'not_set' ? 'selected' : '' }}>Date Not Set</option>
|
<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="overdue" {{ request('status') == 'overdue' ? 'selected' : '' }}>Overdue (Terlewat)</option>
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
<x-app-layout>
|
<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">
|
<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="flex flex-col lg:flex-row items-center justify-between gap-6">
|
||||||
<div class="text-center lg:text-left">
|
<div class="text-center lg:text-left">
|
||||||
<h2 class="text-2xl font-black text-slate-900 uppercase tracking-tighter leading-none">Lineage Archive</h2>
|
<h2 class="text-2xl font-black text-slate-900 uppercase tracking-tighter leading-none">Lineage Archive</h2>
|
||||||
@@ -13,7 +12,6 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="flex items-center gap-4">
|
<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="bg-white px-5 py-3 rounded-2xl border border-slate-200 shadow-sm flex items-center gap-4">
|
||||||
<div class="text-right">
|
<div class="text-right">
|
||||||
<p class="text-[8px] text-slate-400 font-black uppercase tracking-widest">Total Record</p>
|
<p class="text-[8px] text-slate-400 font-black uppercase tracking-widest">Total Record</p>
|
||||||
@@ -24,7 +22,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{-- PROTEKSI EXPORT PDF: Hanya muncul jika memiliki izin 'create' pada modul matting_reports --}}
|
|
||||||
@can('check-access', ['matting_reports', 'create'])
|
@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">
|
<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
|
<i class="fas fa-file-pdf"></i> PDF Export
|
||||||
@@ -33,31 +30,42 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{-- 2. FILTER BAR: Proporsional & Ramping (TETAP UTUH) --}}
|
{{-- 2. FILTER BAR (Perbaikan Multiple Registry) --}}
|
||||||
<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">
|
<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="relative">
|
<div class="space-y-1">
|
||||||
<i class="fas fa-search absolute left-4 top-1/2 -translate-y-1/2 text-slate-300 text-xs"></i>
|
<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="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">
|
<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>
|
</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">
|
|
||||||
|
<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>
|
<option value="">All Breeds</option>
|
||||||
@foreach($breeds as $breed)
|
@foreach($breeds as $breed)
|
||||||
<option value="{{ $breed }}" {{ request('ras') == $breed ? 'selected' : '' }}>{{ $breed }}</option>
|
<option value="{{ $breed }}" {{ request('ras') == $breed ? 'selected' : '' }}>{{ $breed }}</option>
|
||||||
@endforeach
|
@endforeach
|
||||||
</select>
|
</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">
|
</div>
|
||||||
<option value="">All Registry</option>
|
|
||||||
|
{{-- 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)
|
@foreach($registries as $reg)
|
||||||
<option value="{{ $reg }}" {{ request('registry') == $reg ? 'selected' : '' }}>{{ $reg }}</option>
|
<option value="{{ $reg }}" {{ is_array(request('registry')) && in_array($reg, request('registry')) ? 'selected' : '' }}>{{ $reg }}</option>
|
||||||
@endforeach
|
@endforeach
|
||||||
</select>
|
</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">
|
</div>
|
||||||
<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">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>
|
</form>
|
||||||
|
|
||||||
<hr class="border-slate-100 mx-4">
|
{{-- 3. ARCHIVE LIST --}}
|
||||||
|
|
||||||
{{-- 3. ARCHIVE LIST: Proportional Card Grid --}}
|
|
||||||
<div class="space-y-4">
|
<div class="space-y-4">
|
||||||
{{-- Legend Header --}}
|
{{-- 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]">
|
<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)
|
@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">
|
<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">
|
<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) }}
|
{{ substr($matting->pic->name ?? 'S', 0, 1) }}
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
<div class="grid grid-cols-1 lg:grid-cols-12 gap-6 items-center relative z-10">
|
<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="lg:col-span-5 flex items-center gap-6 min-w-0">
|
||||||
<div class="flex -space-x-4 shrink-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">
|
{{-- Sire Photo --}}
|
||||||
<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">
|
<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>
|
||||||
<div class="min-w-0 flex-1">
|
<div class="min-w-0 flex-1">
|
||||||
<h4 class="text-sm font-black text-slate-800 uppercase truncate leading-tight mb-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>
|
</h4>
|
||||||
<div class="flex items-center gap-3">
|
<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-[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>
|
</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>
|
<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>
|
||||||
<div class="text-center">
|
<div class="text-center">
|
||||||
<p class="text-[8px] text-slate-400 font-black uppercase mb-1 tracking-widest">Duration</p>
|
<p class="text-[8px] text-slate-400 font-black uppercase mb-1 tracking-widest">Date</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-[11px] font-black text-slate-800 leading-none">{{ $matting->tgl_kawin_awal->format('d/m/Y') }}</p>
|
||||||
</div>
|
</div>
|
||||||
</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">
|
<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-[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">
|
<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>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{-- Column 4: Action (PROTEKSI READ: Mengikuti matriks permission matting_reports) --}}
|
|
||||||
<div class="lg:col-span-2 flex justify-end shrink-0">
|
<div class="lg:col-span-2 flex justify-end shrink-0">
|
||||||
@can('check-access', ['matting_reports', 'read'])
|
@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">
|
<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>
|
</a>
|
||||||
@endcan
|
@endcan
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@empty
|
@empty
|
||||||
<div class="py-24 bg-white border-2 border-dashed border-slate-100 rounded-[2.5rem] text-center">
|
{{-- Empty State --}}
|
||||||
<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>
|
|
||||||
@endforelse
|
@endforelse
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{-- 4. PAGINATION (TETAP UTUH) --}}
|
|
||||||
<div class="pt-8 flex justify-center">
|
<div class="pt-8 flex justify-center">
|
||||||
{{ $mattings->links() }}
|
{{ $mattings->links() }}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<div class="flex flex-col md:flex-row md:items-center justify-between gap-4">
|
<div class="flex flex-col md:flex-row md:items-center justify-between gap-4">
|
||||||
<div>
|
<div>
|
||||||
<h2 class="text-2xl font-black text-slate-800 tracking-tight leading-none mb-1 text-uppercase">Log Rekam Medis</h2>
|
<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>
|
</div>
|
||||||
|
|
||||||
{{-- PROTEKSI TOMBOL CREATE: Hanya muncul jika punya izin Create --}}
|
{{-- PROTEKSI TOMBOL CREATE: Hanya muncul jika punya izin Create --}}
|
||||||
@@ -21,7 +21,7 @@
|
|||||||
<table class="w-full text-left border-collapse">
|
<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">
|
<thead class="bg-slate-50 text-[10px] font-black text-slate-400 uppercase tracking-widest border-b border-slate-100">
|
||||||
<tr>
|
<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">Keluhan & Diagnosa</th>
|
||||||
<th class="px-6 py-4">Obat (Qty)</th>
|
<th class="px-6 py-4">Obat (Qty)</th>
|
||||||
<th class="px-6 py-4 text-center">Bukti</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">
|
<tbody class="divide-y divide-slate-100 font-medium text-slate-700">
|
||||||
@forelse($treatments as $treatment)
|
@forelse($treatments as $treatment)
|
||||||
<tr class="hover:bg-slate-50/50 transition-all group">
|
<tr class="hover:bg-slate-50/50 transition-all group">
|
||||||
{{-- Tanggal & Pasien --}}
|
{{-- Tanggal & Kucing --}}
|
||||||
<td class="px-6 py-4">
|
<td class="px-6 py-4">
|
||||||
<div class="flex items-center gap-3">
|
<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">
|
<div class="w-10 h-10 rounded-xl bg-slate-100 overflow-hidden ring-2 ring-white shadow-sm">
|
||||||
|
|||||||
Reference in New Issue
Block a user