235 lines
18 KiB
PHP
235 lines
18 KiB
PHP
<?php if (isset($component)) { $__componentOriginal9ac128a9029c0e4701924bd2d73d7f54 = $component; } ?>
|
|
<?php if (isset($attributes)) { $__attributesOriginal9ac128a9029c0e4701924bd2d73d7f54 = $attributes; } ?>
|
|
<?php $component = App\View\Components\AppLayout::resolve([] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
|
|
<?php $component->withName('app-layout'); ?>
|
|
<?php if ($component->shouldRender()): ?>
|
|
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
|
|
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
|
|
<?php $attributes = $attributes->except(\App\View\Components\AppLayout::ignoredParameterNames()); ?>
|
|
<?php endif; ?>
|
|
<?php $component->withAttributes([]); ?>
|
|
<div class="max-w-[1600px] mx-auto p-4 sm:px-6 lg:px-8 py-8 space-y-6">
|
|
|
|
|
|
<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">
|
|
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: <?php echo e(strtoupper(str_replace('_', ' ', $module))); ?>
|
|
|
|
</p>
|
|
</div>
|
|
|
|
|
|
<?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('check-access', ['reports', 'create'])): ?>
|
|
<div class="flex items-center gap-3">
|
|
|
|
<a href="<?php echo e(route('admin.reports.index', array_merge(request()->query(), ['export' => 'pdf']))); ?>"
|
|
class="bg-rose-600 text-white px-6 py-3.5 rounded-2xl text-[10px] font-black uppercase tracking-widest hover:bg-rose-700 shadow-lg shadow-rose-100 transition-all flex items-center gap-2">
|
|
<i class="fas fa-file-pdf text-sm"></i> Export PDF
|
|
</a>
|
|
|
|
|
|
<a href="<?php echo e(route('admin.reports.index', array_merge(request()->query(), ['export' => 'xlsx']))); ?>"
|
|
class="flex items-center gap-2 px-6 py-3.5 bg-emerald-50 text-emerald-700 border border-emerald-100 rounded-2xl text-[10px] font-black uppercase tracking-widest hover:bg-emerald-600 hover:text-white hover:border-emerald-600 shadow-lg shadow-emerald-100/50 transition-all active:scale-95 group">
|
|
<i class="fas fa-file-excel text-sm text-emerald-600 group-hover:text-white transition-colors"></i>
|
|
<span>Export Excel</span>
|
|
</a>
|
|
</div>
|
|
<?php endif; ?>
|
|
</div>
|
|
|
|
|
|
<div class="bg-white rounded-[3rem] border border-slate-100 shadow-sm p-8">
|
|
<form action="<?php echo e(route('admin.reports.index')); ?>" method="GET" class="grid grid-cols-1 md:grid-cols-4 gap-8">
|
|
|
|
|
|
<div class="space-y-3">
|
|
<label class="block text-[10px] font-black text-slate-400 uppercase tracking-widest ml-2">Data Source</label>
|
|
<select name="module" onchange="this.form.submit()" class="w-full bg-slate-50 border-none rounded-2xl text-xs font-bold text-slate-700">
|
|
<option value="cats" <?php echo e($module == 'cats' ? 'selected' : ''); ?>>Populasi Kucing</option>
|
|
<option value="vaccine" <?php echo e($module == 'vaccine' ? 'selected' : ''); ?>>Jadwal Vaksin</option>
|
|
<option value="deworming" <?php echo e($module == 'deworming' ? 'selected' : ''); ?>>Jadwal Obat Cacing</option>
|
|
<option value="flea" <?php echo e($module == 'flea' ? 'selected' : ''); ?>>Jadwal Obat Kutu</option>
|
|
<option value="grooming" <?php echo e($module == 'grooming' ? 'selected' : ''); ?>>Jadwal Grooming</option>
|
|
<option value="medicine" <?php echo e($module == 'medicine' ? 'selected' : ''); ?>>Inventori Obat</option>
|
|
<option value="food" <?php echo e($module == 'food' ? 'selected' : ''); ?>>Inventori Makanan</option>
|
|
<option value="supplies" <?php echo e($module == 'supplies' ? 'selected' : ''); ?>>Perlengkapan</option>
|
|
</select>
|
|
<input type="text" name="q" value="<?php echo e(request('q')); ?>" placeholder="Search Keyword..." class="w-full bg-slate-50 border-none rounded-2xl text-xs font-bold">
|
|
</div>
|
|
|
|
|
|
<div class="space-y-3">
|
|
<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</option>
|
|
<?php $__currentLoopData = $users; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $user): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
|
|
<option value="<?php echo e($user->id); ?>" <?php echo e(request('pic_id') == $user->id ? 'selected' : ''); ?>><?php echo e($user->name); ?></option>
|
|
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
|
|
</select>
|
|
<div class="grid grid-cols-2 gap-2">
|
|
<input type="date" name="start_date" value="<?php echo e(request('start_date')); ?>" class="w-full bg-slate-50 border-none rounded-2xl text-[10px] font-bold">
|
|
<input type="date" name="end_date" value="<?php echo e(request('end_date')); ?>" class="w-full bg-slate-50 border-none rounded-2xl text-[10px] font-bold">
|
|
</div>
|
|
</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>
|
|
<?php if($module == 'cats'): ?>
|
|
<option value="sehat" <?php echo e(request('status') == 'sehat' ? 'selected' : ''); ?>>Sehat (Sehat)</option>
|
|
<option value="sakit" <?php echo e(request('status') == 'sakit' ? 'selected' : ''); ?>>Dalam Perawatan (Perawatan)</option>
|
|
<?php elseif(in_array($module, ['vaccine', 'deworming', 'flea', 'grooming'])): ?>
|
|
<option value="not_set" <?php echo e(request('status') == 'not_set' ? 'selected' : ''); ?>>Date Not Set</option>
|
|
<option value="overdue" <?php echo e(request('status') == 'overdue' ? 'selected' : ''); ?>>Overdue (Terlewat)</option>
|
|
<option value="soon" <?php echo e(request('status') == 'soon' ? 'selected' : ''); ?>>Akan Datang (7 Hari)</option>
|
|
<?php elseif(in_array($module, ['medicine', 'food', 'supplies'])): ?>
|
|
<option value="critical" <?php echo e(request('status') == 'critical' ? 'selected' : ''); ?>>Stok Kritis (< 5)</option>
|
|
<option value="expired" <?php echo e(request('status') == 'expired' ? 'selected' : ''); ?>>Sudah Expired</option>
|
|
<option value="safe" <?php echo e(request('status') == 'safe' ? 'selected' : ''); ?>>Stok Aman</option>
|
|
<?php 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="flex flex-col justify-between">
|
|
<div class="bg-indigo-50 p-5 rounded-[2rem] border border-indigo-100 text-center">
|
|
<p class="text-[9px] font-black text-indigo-400 uppercase tracking-widest mb-1">Total Data</p>
|
|
<span class="text-3xl font-black text-indigo-700 leading-none"><?php echo e($results->total()); ?></span>
|
|
</div>
|
|
|
|
<a href="<?php echo e(route('admin.reports.index')); ?>" class="w-full bg-slate-100 text-slate-400 py-3 rounded-2xl text-[10px] font-black uppercase tracking-widest text-center hover:bg-rose-50 hover:text-rose-600 transition-all">
|
|
<i class="fas fa-sync-alt mr-2"></i> Reset Filter
|
|
</a>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
|
|
|
|
<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">
|
|
<thead class="bg-slate-50/50 border-b border-slate-100">
|
|
<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">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">
|
|
<?php $__empty_1 = true; $__currentLoopData = $results; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
|
|
<?php
|
|
$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};
|
|
}
|
|
?>
|
|
<tr class="group hover:bg-slate-50/30 transition-all">
|
|
<td class="p-6">
|
|
<p class="text-xs font-black text-slate-800 uppercase leading-none mb-1">
|
|
<?php echo e($item->nama_kucing ?? $item->nama_obat ?? $item->nama_makanan ?? $item->nama_perlengkapan); ?>
|
|
|
|
</p>
|
|
<p class="text-[9px] text-slate-400 font-bold uppercase tracking-widest italic">ID: #<?php echo e($item->id); ?></p>
|
|
</td>
|
|
<td class="p-6">
|
|
<?php if(isset($item->qty)): ?>
|
|
<div class="flex items-center gap-2">
|
|
<span class="text-xs font-black <?php echo e($item->qty < 5 ? 'text-rose-600' : 'text-slate-700'); ?>"><?php echo e($item->qty); ?></span>
|
|
<span class="text-[9px] font-bold text-slate-400 uppercase tracking-widest"><?php echo e($item->unit ?? 'Unit'); ?></span>
|
|
</div>
|
|
<?php else: ?>
|
|
<span class="text-[10px] font-black text-slate-500 uppercase"><?php echo e($item->ras ?? '-'); ?></span>
|
|
<?php endif; ?>
|
|
</td>
|
|
<td class="p-6">
|
|
<div class="flex flex-col gap-1">
|
|
<span class="text-[10px] font-black text-slate-600 uppercase"><?php echo e($item->pic->name ?? 'Sistem'); ?></span>
|
|
<span class="text-[9px] font-bold text-slate-400 italic">
|
|
|
|
<i class="far fa-calendar-alt mr-1"></i>
|
|
<?php if($module === 'cats'): ?>
|
|
<?php echo e($item->updated_at ? \Carbon\Carbon::parse($item->updated_at)->format('d/m/Y') : 'DATE NOT SET'); ?>
|
|
|
|
<?php else: ?>
|
|
<?php echo e(($dateValue && strtotime($dateValue)) ? \Carbon\Carbon::parse($dateValue)->format('d/m/Y') : 'DATE NOT SET'); ?>
|
|
|
|
<?php endif; ?>
|
|
</span>
|
|
</div>
|
|
</td>
|
|
<td class="p-6 text-right">
|
|
|
|
<?php if($module === 'cats'): ?>
|
|
<span class="px-3 py-1.5 <?php echo e($item->treatment_status == 1 ? 'bg-amber-100 text-amber-600' : 'bg-emerald-100 text-emerald-600'); ?> rounded-lg text-[8px] font-black uppercase">
|
|
<?php echo e($item->treatment_status == 1 ? 'Perawatan' : 'Sehat'); ?>
|
|
|
|
</span>
|
|
<?php elseif(in_array($module, ['vaccine', 'deworming', 'flea', 'grooming'])): ?>
|
|
<?php 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>
|
|
<?php 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>
|
|
<?php elseif(\Carbon\Carbon::parse($dateValue)->diffInDays(now()) <= 7): ?>
|
|
<span class="px-3 py-1.5 bg-amber-100 text-amber-600 rounded-lg text-[8px] font-black uppercase">Soon</span>
|
|
<?php else: ?>
|
|
<span class="px-3 py-1.5 bg-emerald-100 text-emerald-600 rounded-lg text-[8px] font-black uppercase">Scheduled</span>
|
|
<?php endif; ?>
|
|
<?php elseif(in_array($module, ['medicine', 'food', 'supplies'])): ?>
|
|
<?php 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>
|
|
<?php 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>
|
|
<?php else: ?>
|
|
<span class="px-3 py-1.5 bg-slate-100 text-slate-500 rounded-lg text-[8px] font-black uppercase">Safe</span>
|
|
<?php endif; ?>
|
|
<?php endif; ?>
|
|
</td>
|
|
</tr>
|
|
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
|
|
<tr>
|
|
<td colspan="4" class="p-20 text-center text-[10px] font-black text-slate-300 uppercase tracking-widest">Data Tidak Ditemukan</td>
|
|
</tr>
|
|
<?php endif; ?>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<div class="mt-8">
|
|
<?php echo e($results->links()); ?>
|
|
|
|
</div>
|
|
</div>
|
|
<?php echo $__env->renderComponent(); ?>
|
|
<?php endif; ?>
|
|
<?php if (isset($__attributesOriginal9ac128a9029c0e4701924bd2d73d7f54)): ?>
|
|
<?php $attributes = $__attributesOriginal9ac128a9029c0e4701924bd2d73d7f54; ?>
|
|
<?php unset($__attributesOriginal9ac128a9029c0e4701924bd2d73d7f54); ?>
|
|
<?php endif; ?>
|
|
<?php if (isset($__componentOriginal9ac128a9029c0e4701924bd2d73d7f54)): ?>
|
|
<?php $component = $__componentOriginal9ac128a9029c0e4701924bd2d73d7f54; ?>
|
|
<?php unset($__componentOriginal9ac128a9029c0e4701924bd2d73d7f54); ?>
|
|
<?php endif; ?><?php /**PATH /home/u806112658/domains/earrinasia.com/ilycats/resources/views/pages/reports/index.blade.php ENDPATH**/ ?>
|