Files
ilycats/resources/views/pages/matting/index.blade.php
T
2026-09-23 12:45:02 +07:00

15 lines
3.9 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<x-app-layout>
<div class="mb-6 flex flex-col gap-4 sm:flex-row sm:items-end sm:justify-between"><div><h1 class="text-2xl font-bold text-slate-900">Perkawinan & pembiakan</h1><p class="mt-1 text-sm text-slate-500">Riwayat pasangan induk, periode kawin, perkiraan kelahiran, dan data anakan.</p></div>@can('check-access',['matting','create'])<a href="{{ route('matting.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>Catat perkawinan</a>@endcan</div>
<div class="mb-4 border border-slate-200 bg-white p-4"><p class="text-xs text-slate-500">Total riwayat pembiakan</p><p class="mt-1 text-2xl font-bold text-slate-900">{{ $mattings->total() }}</p></div>
<section class="border border-slate-200 bg-white"><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">Pasangan induk</th><th class="px-4 py-3">Periode kawin</th><th class="px-4 py-3">Perkiraan lahir</th><th class="px-4 py-3">Status & anakan</th><th class="px-4 py-3 text-right">Aksi</th></tr></thead><tbody class="divide-y divide-slate-100">
@forelse($mattings as $m)
@php $edd=$m->tgl_kawin_awal?->copy()->addDays(63); $days=$edd ? (int)now()->startOfDay()->diffInDays($edd->copy()->startOfDay(),false) : null; @endphp
<tr class="hover:bg-slate-50"><td class="px-4 py-4"><div class="flex items-center gap-3"><div class="flex -space-x-2">@foreach([$m->sire,$m->dam] as $parent)<img src="{{ $parent?->foto_url ?? asset('images/default-cat.png') }}" class="h-10 w-10 rounded-full border-2 border-white object-cover" alt="">@endforeach</div><div><p class="font-semibold text-slate-900">{{ $m->sire->nama_kucing ?? '-' }} × {{ $m->dam->nama_kucing ?? '-' }}</p><p class="mt-1 text-xs text-slate-500">EMS {{ $m->sire->kode_ems ?? '-' }} × {{ $m->dam->kode_ems ?? '-' }}</p></div></div></td>
<td class="px-4 py-4"><p class="text-slate-700">{{ $m->tgl_kawin_awal?->format('d-m-Y') ?? '-' }}{{ $m->tgl_kawin_akhir ? ' s.d. '.$m->tgl_kawin_akhir->format('d-m-Y') : '' }}</p>@if($m->tgl_kawin_awal && $m->tgl_kawin_akhir)<p class="mt-1 text-xs text-slate-500">{{ $m->tgl_kawin_awal->diffInDays($m->tgl_kawin_akhir)+1 }} hari</p>@endif</td>
<td class="px-4 py-4">@if($edd)<p class="font-medium text-slate-800">{{ $edd->format('d-m-Y') }}</p><p class="mt-1 text-xs {{ $days!==null && $days<=7 && $days>=0?'text-rose-600':'text-slate-500' }}">{{ $days<0?'Lewat '.abs($days).' hari':($days===0?'Perkiraan hari ini':$days.' hari lagi') }}</p>@else<span class="text-slate-400">-</span>@endif</td>
<td class="px-4 py-4"><p class="font-medium {{ $m->status==='berhasil'?'text-emerald-700':($m->status==='gagal'?'text-rose-600':'text-indigo-700') }}">{{ $m->status==='proses'?'Dalam proses':ucfirst($m->status) }}</p><p class="mt-1 text-xs text-slate-500">{{ $m->kittens_count }} anakan tercatat</p></td>
<td class="px-4 py-4"><div class="flex justify-end gap-1">@can('check-access',['matting','update'])<a href="{{ route('matting.edit',$m) }}" class="p-2 text-slate-500 hover:bg-slate-100" title="Ubah"><i class="fas fa-pen"></i></a>@endcan @can('check-access',['matting','delete'])<form method="POST" action="{{ route('matting.destroy',$m) }}" id="delete-matting-{{ $m->id }}">@csrf @method('DELETE')<button type="button" onclick="confirmDelete('delete-matting-{{ $m->id }}','{{ addslashes(($m->sire->nama_kucing ?? '').' × '.($m->dam->nama_kucing ?? '')) }}')" class="p-2 text-rose-500 hover:bg-rose-50"><i class="fas fa-trash"></i></button></form>@endcan</div></td></tr>
@empty<tr><td colspan="5" class="px-4 py-12 text-center text-sm text-slate-500">Belum ada riwayat pembiakan.</td></tr>@endforelse
</tbody></table></div><div class="border-t border-slate-200 p-4">{{ $mattings->links() }}</div></section>
</x-app-layout>