70 lines
10 KiB
PHP
70 lines
10 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([]); ?>
|
|
<?php
|
|
$currentSort=request('sort','created_at'); $currentDir=request('direction','desc'); $nextDir=$currentDir==='asc'?'desc':'asc';
|
|
$sortIcon=function($field)use($currentSort,$currentDir){return $currentSort!==$field?'fa-sort text-slate-300':($currentDir==='asc'?'fa-sort-up text-indigo-600':'fa-sort-down text-indigo-600');};
|
|
?>
|
|
<div class="mb-6 flex flex-col gap-4 lg:flex-row lg:items-end lg:justify-between">
|
|
<div><h1 class="text-2xl font-bold text-slate-900">Data kucing</h1><p class="mt-1 text-sm text-slate-500">Profil, silsilah, pedigree, berat badan, dan jadwal perawatan.</p></div>
|
|
<div class="flex flex-wrap gap-2"><?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('check-access',['cats','update'])): ?><a href="<?php echo e(route('cats.bulk-weight')); ?>" class="border border-slate-300 bg-white px-4 py-2.5 text-sm font-semibold text-slate-700 hover:bg-slate-50"><i class="fas fa-weight-scale mr-2"></i>Input berat massal</a><?php endif; ?> <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('check-access',['cats','create'])): ?><a href="<?php echo e(route('cats.create')); ?>" class="bg-indigo-600 px-4 py-2.5 text-sm font-semibold text-white hover:bg-indigo-700"><i class="fas fa-plus mr-2"></i>Tambah kucing</a><?php endif; ?></div>
|
|
</div>
|
|
|
|
<div class="mb-5 grid gap-3 sm:grid-cols-3">
|
|
<div class="border border-slate-200 bg-white p-4"><p class="text-xs text-slate-500">Total kucing</p><p class="mt-1 text-2xl font-bold text-slate-900"><?php echo e($totalCats); ?></p></div>
|
|
<div class="border border-slate-200 bg-white p-4"><p class="text-xs text-slate-500">Sehat</p><p class="mt-1 text-2xl font-bold text-emerald-700"><?php echo e(max(0,$totalCats-$sickCats)); ?></p></div>
|
|
<div class="border border-slate-200 bg-white p-4"><p class="text-xs text-slate-500">Dalam perawatan</p><p class="mt-1 text-2xl font-bold text-rose-600"><?php echo e($sickCats); ?></p></div>
|
|
</div>
|
|
|
|
<section class="border border-slate-200 bg-white">
|
|
<div class="flex flex-col gap-3 border-b border-slate-200 p-4 lg:flex-row lg:items-center lg:justify-between">
|
|
<form method="GET" action="<?php echo e(route('cats.index')); ?>" class="flex w-full max-w-lg gap-2">
|
|
<input type="hidden" name="status" value="<?php echo e(request('status')); ?>"><input type="hidden" name="sort" value="<?php echo e(request('sort')); ?>"><input type="hidden" name="direction" value="<?php echo e(request('direction')); ?>">
|
|
<div class="relative flex-1"><i class="fas fa-search absolute left-3 top-1/2 -translate-y-1/2 text-sm text-slate-400"></i><input name="search" value="<?php echo e(request('search')); ?>" placeholder="Cari nama, EMS, microchip, ras, kandang..." class="field-input pl-9"></div><button class="border border-slate-300 px-4 text-sm font-semibold text-slate-700 hover:bg-slate-50">Cari</button>
|
|
</form>
|
|
<div class="flex flex-wrap gap-1 text-sm"><?php $__currentLoopData = [''=>'Semua','Dewasa'=>'Dewasa','Junior'=>'Junior','Kitten'=>'Kitten']; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $value=>$label): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?><a href="<?php echo e(route('cats.index',array_merge(request()->except('page','status'),$value?['status'=>$value]:[]))); ?>" class="px-3 py-2 <?php echo e(request('status','')===$value?'bg-slate-900 text-white':'text-slate-600 hover:bg-slate-100'); ?>"><?php echo e($label); ?></a><?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?></div>
|
|
</div>
|
|
|
|
<div class="overflow-x-auto">
|
|
<table class="min-w-full divide-y divide-slate-200 text-sm">
|
|
<thead class="bg-slate-50 text-left text-xs font-semibold text-slate-500"><tr>
|
|
<th class="px-4 py-3"><a class="flex items-center gap-2" href="<?php echo e(request()->fullUrlWithQuery(['sort'=>'nama_kucing','direction'=>$nextDir])); ?>">Kucing <i class="fas <?php echo e($sortIcon('nama_kucing')); ?>"></i></a></th>
|
|
<th class="px-4 py-3">Identitas & pedigree</th><th class="px-4 py-3">Silsilah</th>
|
|
<th class="px-4 py-3"><a class="flex items-center gap-2" href="<?php echo e(request()->fullUrlWithQuery(['sort'=>'berat_badan','direction'=>$nextDir])); ?>">Berat <i class="fas <?php echo e($sortIcon('berat_badan')); ?>"></i></a></th>
|
|
<th class="px-4 py-3"><a class="flex items-center gap-2" href="<?php echo e(request()->fullUrlWithQuery(['sort'=>'lokasi_kandang','direction'=>$nextDir])); ?>">Kandang <i class="fas <?php echo e($sortIcon('lokasi_kandang')); ?>"></i></a></th>
|
|
<th class="px-4 py-3 text-right">Aksi</th>
|
|
</tr></thead>
|
|
<tbody class="divide-y divide-slate-100">
|
|
<?php $__empty_1 = true; $__currentLoopData = $cats; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $cat): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
|
|
<tr class="hover:bg-slate-50">
|
|
<td class="px-4 py-3"><div class="flex min-w-52 items-center gap-3"><img src="<?php echo e($cat->foto_url); ?>" alt="<?php echo e($cat->nama_kucing); ?>" class="h-11 w-11 rounded-lg border border-slate-200 object-cover"><div><a href="<?php echo e(route('cats.show',$cat)); ?>" class="font-semibold text-slate-900 hover:text-indigo-600"><?php echo e($cat->nama_kucing); ?></a><p class="mt-0.5 text-xs text-slate-500"><?php echo e($cat->jenis_kelamin); ?> · <?php echo e($cat->ras); ?></p></div></div></td>
|
|
<td class="px-4 py-3"><div class="space-y-1"><p class="text-xs text-slate-600"><span class="text-slate-400">EMS:</span> <?php echo e($cat->kode_ems ?: '-'); ?></p><p class="text-xs text-slate-600"><span class="text-slate-400">Microchip:</span> <?php echo e($cat->microchip ?: '-'); ?></p><div class="flex flex-wrap gap-1"><?php $__empty_2 = true; $__currentLoopData = $cat->registrations; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $reg): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_2 = false; ?><span class="border border-slate-200 bg-slate-50 px-1.5 py-0.5 text-[11px] font-semibold text-slate-600"><?php echo e($reg->association->code); ?><?php echo e($reg->is_primary?' · utama':''); ?></span><?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_2): ?><span class="text-xs text-slate-400">Belum ada registrasi</span><?php endif; ?></div></div></td>
|
|
<td class="px-4 py-3"><p class="text-xs text-slate-600"><?php echo e($cat->age); ?></p><p class="mt-1 text-xs text-slate-500">Jantan: <?php echo e($cat->sire->nama_kucing ?? '-'); ?></p><p class="text-xs text-slate-500">Betina: <?php echo e($cat->dam->nama_kucing ?? '-'); ?></p></td>
|
|
<td class="px-4 py-3"><p class="font-semibold text-slate-800"><?php echo e(number_format((float)($cat->berat_badan ?? $cat->berat_terakhir ?? 0),2)); ?> kg</p><p class="text-xs <?php echo e($cat->treatment_status==1?'text-rose-600':'text-emerald-600'); ?>"><?php echo e($cat->treatment_status==1?'Dalam perawatan':'Sehat'); ?></p></td>
|
|
<td class="px-4 py-3"><p class="text-slate-700"><?php echo e($cat->lokasi_kandang ?: '-'); ?></p><p class="text-xs text-slate-500"><?php echo e($cat->pic->name ?? '-'); ?></p></td>
|
|
<td class="px-4 py-3"><div class="flex justify-end gap-1"><a href="<?php echo e(route('cats.show',$cat)); ?>" class="p-2 text-slate-500 hover:bg-slate-100" title="Lihat"><i class="fas fa-eye"></i></a><a href="<?php echo e(route('cats.pedigree',$cat)); ?>" class="p-2 text-slate-500 hover:bg-slate-100" title="Pedigree"><i class="fas fa-file-lines"></i></a><?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('check-access',['cats','update'])): ?><a href="<?php echo e(route('cats.edit',$cat)); ?>" class="p-2 text-slate-500 hover:bg-slate-100" title="Ubah"><i class="fas fa-pen"></i></a><?php endif; ?> <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('check-access',['cats','delete'])): ?><form id="delete-cat-<?php echo e($cat->id); ?>" method="POST" action="<?php echo e(route('cats.destroy',$cat)); ?>"><?php echo csrf_field(); ?> <?php echo method_field('DELETE'); ?><button type="button" onclick="confirmDelete('delete-cat-<?php echo e($cat->id); ?>','<?php echo e(addslashes($cat->nama_kucing)); ?>')" class="p-2 text-rose-500 hover:bg-rose-50" title="Hapus"><i class="fas fa-trash"></i></button></form><?php endif; ?></div></td>
|
|
</tr>
|
|
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?><tr><td colspan="6" class="px-4 py-12 text-center text-sm text-slate-500">Data kucing tidak ditemukan.</td></tr><?php endif; ?>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<div class="border-t border-slate-200 p-4"><?php echo e($cats->links()); ?></div>
|
|
</section>
|
|
<?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/cats/index.blade.php ENDPATH**/ ?>
|