initial commit
This commit is contained in:
@@ -25,8 +25,8 @@
|
||||
<i class="fas fa-arrow-left"></i>
|
||||
</a>
|
||||
<div>
|
||||
<h2 class="text-3xl font-black text-slate-800 tracking-tighter leading-none mb-1 uppercase">Registrasi Breeding</h2>
|
||||
<p class="text-[10px] text-slate-500 font-bold uppercase tracking-[0.2em] italic">Earrin Cats Breeding Program</p>
|
||||
<h2 class="text-3xl font-black text-slate-800 tracking-tighter leading-none mb-1 uppercase">Pencatatan Pembiakan</h2>
|
||||
<p class="text-[10px] text-slate-500 font-bold uppercase tracking-[0.2em] italic">Program Pembiakan ILYCats</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -105,9 +105,9 @@
|
||||
<div class="bg-slate-900 rounded-[2.5rem] p-8 text-white shadow-2xl mb-12 relative overflow-hidden">
|
||||
<div class="grid grid-cols-1 md:grid-cols-4 gap-8 relative z-10">
|
||||
<div>
|
||||
<label class="text-[10px] font-black uppercase tracking-widest text-slate-400">Status Breeding</label>
|
||||
<label class="text-[10px] font-black uppercase tracking-widest text-slate-400">Status Pembiakan</label>
|
||||
<select name="status" class="w-full mt-2 bg-white/10 border-white/10 rounded-xl text-xs font-bold focus:ring-indigo-500 text-white" required>
|
||||
<option value="proses" class="text-slate-800">Proses (Monitoring)</option>
|
||||
<option value="proses" class="text-slate-800">Dalam proses</option>
|
||||
<option value="berhasil" class="text-slate-800">Berhasil (Lahir)</option>
|
||||
<option value="gagal" class="text-slate-800">Gagal</option>
|
||||
</select>
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
<i class="fas fa-arrow-left"></i>
|
||||
</a>
|
||||
<div>
|
||||
<h2 class="text-2xl font-black text-slate-800 tracking-tighter leading-none mb-1">EDIT BREEDING RECORD</h2>
|
||||
<h2 class="text-2xl font-black text-slate-800 tracking-tighter leading-none mb-1">UBAH DATA PEMBIAKAN</h2>
|
||||
<p class="text-[10px] text-slate-500 font-bold uppercase tracking-widest italic">Litter ID: #{{ str_pad($matting->id, 5, '0', STR_PAD_LEFT) }} • Update Lineage</p>
|
||||
</div>
|
||||
</div>
|
||||
@@ -114,7 +114,7 @@
|
||||
<div>
|
||||
<label class="text-[9px] font-black uppercase text-slate-400 mb-1 block">Status</label>
|
||||
<select name="status" class="w-full bg-white/10 border-white/10 rounded-xl py-3 text-xs font-black text-white">
|
||||
<option value="proses" class="text-slate-800" {{ $matting->status == 'proses' ? 'selected' : '' }}>MONITORING</option>
|
||||
<option value="proses" class="text-slate-800" {{ $matting->status == 'proses' ? 'selected' : '' }}>DALAM PROSES</option>
|
||||
<option value="berhasil" class="text-slate-800" {{ $matting->status == 'berhasil' ? 'selected' : '' }}>BERHASIL</option>
|
||||
<option value="gagal" class="text-slate-800" {{ $matting->status == 'gagal' ? 'selected' : '' }}>GAGAL</option>
|
||||
</select>
|
||||
@@ -202,7 +202,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{-- File Upload --}}
|
||||
{{-- File Unggah --}}
|
||||
<div class="pt-4 border-t border-slate-50">
|
||||
<label class="text-[9px] font-black uppercase text-slate-400 ml-1 mb-2 block italic">Documents (Max 4)</label>
|
||||
<div class="grid grid-cols-2 md:grid-cols-4 gap-3">
|
||||
@@ -226,7 +226,7 @@
|
||||
|
||||
<div class="mt-12 flex justify-end">
|
||||
<button type="submit" class="px-12 py-5 bg-slate-900 text-white rounded-[2rem] font-black text-[10px] uppercase tracking-[0.2em] shadow-2xl hover:bg-black transition-all">
|
||||
<i class="fas fa-sync-alt mr-2"></i> Update Breeding Record
|
||||
<i class="fas fa-sync-alt mr-2"></i> Perbarui data pembiakan
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@@ -1,219 +1,14 @@
|
||||
<x-app-layout>
|
||||
<div class="max-w-7xl mx-auto space-y-6 pb-12">
|
||||
{{-- SECTION 1: Header & Statistik --}}
|
||||
<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-tighter uppercase leading-none">Breeding Activity</h2>
|
||||
<p class="text-[10px] text-slate-400 font-bold uppercase tracking-widest mt-1 italic">Monitoring silsilah & kelahiran • Real-time Lineage Data</p>
|
||||
</div>
|
||||
|
||||
<div class="flex items-center gap-3">
|
||||
<div class="hidden sm:block bg-white border border-slate-200 px-4 py-2 rounded-xl shadow-sm">
|
||||
<p class="text-[8px] font-black text-slate-400 uppercase tracking-widest leading-none">Total Program</p>
|
||||
<p class="text-sm font-black text-indigo-600 mt-1">{{ $mattings->total() }}</p>
|
||||
</div>
|
||||
|
||||
{{-- PROTEKSI TOMBOL CREATE MATTING --}}
|
||||
@can('check-access', ['matting', 'create'])
|
||||
<a href="{{ route('matting.create') }}" class="inline-flex items-center px-5 py-3 bg-indigo-600 text-white text-[10px] font-black rounded-xl shadow-lg shadow-indigo-100 hover:bg-indigo-700 transition-all active:scale-95">
|
||||
<i class="fas fa-plus mr-2"></i> INPUT MATTING BARU
|
||||
</a>
|
||||
@endcan
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{-- SECTION 2: Tabel Matting --}}
|
||||
<div class="bg-white border border-slate-200 rounded-[2rem] overflow-hidden shadow-sm">
|
||||
<div class="overflow-x-auto">
|
||||
<table class="w-full text-left border-collapse table-auto">
|
||||
<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">Indukan (Sire x Dam)</th>
|
||||
<th class="px-4 py-4 text-center">Periode Kawin</th>
|
||||
<th class="px-4 py-4 text-center">Estimasi Lahir</th>
|
||||
<th class="px-4 py-4 text-center">Hasil</th>
|
||||
<th class="px-6 py-4 text-right" style="min-width: 280px;">Aksi</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="divide-y divide-slate-100 font-medium text-slate-700">
|
||||
@forelse($mattings as $m)
|
||||
<tr class="hover:bg-slate-50/50 transition-all group">
|
||||
{{-- Pasangan Indukan --}}
|
||||
<td class="px-6 py-4 align-middle">
|
||||
<div class="flex items-center gap-3">
|
||||
@if($m->sire->foto || $m->dam->foto)
|
||||
<div class="flex -space-x-3 shrink-0">
|
||||
@if($m->sire->foto)
|
||||
<div class="w-11 h-11 rounded-xl bg-slate-100 border-2 border-white overflow-hidden shadow-sm">
|
||||
<img src="{{ asset('storage/'.$m->sire->foto) }}" class="w-full h-full object-cover">
|
||||
</div>
|
||||
@endif
|
||||
@if($m->dam->foto)
|
||||
<div class="w-11 h-11 rounded-xl bg-slate-100 border-2 border-white overflow-hidden shadow-sm">
|
||||
<img src="{{ asset('storage/'.$m->dam->foto) }}" class="w-full h-full object-cover">
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<div class="min-w-0">
|
||||
<div class="text-xs font-black text-slate-800 flex items-center gap-1 whitespace-nowrap">
|
||||
{{ $m->sire->nama_kucing }} <i class="fas fa-heart text-[8px] text-rose-400"></i> {{ $m->dam->nama_kucing }}
|
||||
</div>
|
||||
<div class="flex gap-1.5 mt-1.5">
|
||||
<span class="text-[8px] font-black bg-slate-800 text-white px-2 py-0.5 rounded uppercase tracking-tighter shadow-sm">
|
||||
{{ $m->sire->kode_ems ?? 'NO EMS' }}
|
||||
</span>
|
||||
<span class="text-[8px] font-black bg-indigo-100 text-indigo-700 px-2 py-0.5 rounded uppercase border border-indigo-200 tracking-tighter shadow-sm">
|
||||
{{ $m->dam->kode_ems ?? 'NO EMS' }}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
|
||||
<td class="px-4 py-4 text-center align-middle whitespace-nowrap">
|
||||
<p class="text-[10px] font-black text-slate-700 leading-none">
|
||||
{{ $m->tgl_kawin_awal->format('d M') }} - {{ $m->tgl_kawin_akhir->format('d M Y') }}
|
||||
</p>
|
||||
<span class="text-[9px] text-slate-400 font-bold italic uppercase">{{ $m->tgl_kawin_awal->diffInDays($m->tgl_kawin_akhir) + 1 }} Hari</span>
|
||||
</td>
|
||||
|
||||
<td class="px-4 py-4 text-center align-middle" x-data="breedingCountdown('{{ $m->tgl_kawin_awal->addDays(63)->format('Y-m-d') }}')">
|
||||
<div :class="isUrgent ? 'bg-rose-50 border-rose-100' : 'bg-indigo-50 border-indigo-100'"
|
||||
class="inline-flex flex-col px-3 py-1.5 rounded-xl border border-dashed transition-all w-28">
|
||||
<div class="flex items-center justify-center gap-1.5 mb-0.5">
|
||||
<i :class="isUrgent ? 'text-rose-500 animate-pulse' : 'text-indigo-400'" class="fas fa-stopwatch text-[9px]"></i>
|
||||
<span class="text-[8px] font-black uppercase" :class="isUrgent ? 'text-rose-600' : 'text-indigo-600'">HPL: {{ $m->tgl_kawin_awal->addDays(63)->format('d/m') }}</span>
|
||||
</div>
|
||||
<p class="text-[10px] font-black" :class="isUrgent ? 'text-rose-700' : 'text-slate-700'">
|
||||
<template x-if="daysRemaining > 0"><span x-text="daysRemaining + ' Hari'"></span></template>
|
||||
<template x-if="daysRemaining === 0"><span>HARI H</span></template>
|
||||
<template x-if="daysRemaining < 0"><span class="text-slate-400 italic">LEWAT</span></template>
|
||||
</p>
|
||||
</div>
|
||||
</td>
|
||||
|
||||
<td class="px-4 py-4 text-center align-middle whitespace-nowrap">
|
||||
<div class="flex flex-col gap-1 items-center">
|
||||
<span class="px-3 py-1 bg-emerald-50 text-emerald-600 rounded-lg text-[10px] font-black border border-emerald-100 uppercase">
|
||||
{{ $m->kittens_count }} Anak
|
||||
</span>
|
||||
{!! $m->status_badge !!}
|
||||
</div>
|
||||
</td>
|
||||
|
||||
<td class="px-6 py-4 text-right align-middle">
|
||||
<div class="flex justify-end items-center gap-16">
|
||||
|
||||
{{-- PROTEKSI TOMBOL EDIT MATTING --}}
|
||||
@can('check-access', ['matting', 'update'])
|
||||
<a href="{{ route('matting.edit', $m->id) }}"
|
||||
class="flex items-center gap-3 p-3 text-slate-400 hover:text-indigo-600 hover:bg-indigo-50 rounded-2xl transition-all group/btn"
|
||||
title="Edit Data">
|
||||
<i class="fas fa-pencil-alt text-base"></i>
|
||||
<span class="text-[10px] font-black uppercase hidden group-hover/btn:inline tracking-widest">Edit</span>
|
||||
</a>
|
||||
@endcan
|
||||
|
||||
{{-- PROTEKSI TOMBOL HAPUS MATTING --}}
|
||||
@can('check-access', ['matting', 'delete'])
|
||||
<form action="{{ route('matting.destroy', $m->id) }}" method="POST" class="inline m-0">
|
||||
@csrf @method('DELETE')
|
||||
<button type="button"
|
||||
onclick="confirmDelete(this, '{{ addslashes($m->sire->nama_kucing) }} x {{ addslashes($m->dam->nama_kucing) }}')"
|
||||
class="flex items-center gap-3 p-3 text-slate-400 hover:text-rose-500 hover:bg-rose-50 rounded-2xl transition-all group/btn"
|
||||
title="Hapus Data">
|
||||
<i class="fas fa-trash-alt text-base"></i>
|
||||
<span class="text-[10px] font-black uppercase hidden group-hover/btn:inline tracking-widest">Hapus</span>
|
||||
</button>
|
||||
</form>
|
||||
@endcan
|
||||
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@empty
|
||||
<tr>
|
||||
<td colspan="5" class="px-6 py-20 text-center text-slate-400 uppercase text-[10px] font-black tracking-widest">
|
||||
Belum ada riwayat breeding
|
||||
</td>
|
||||
</tr>
|
||||
@endforelse
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="p-6 bg-slate-50/30 border-t border-slate-100">
|
||||
{{ $mattings->links() }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@push('scripts')
|
||||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
||||
<script>
|
||||
{{-- Script Alpine Init & SweetAlert Tetap Sama --}}
|
||||
document.addEventListener('alpine:init', () => {
|
||||
Alpine.data('breedingCountdown', (targetDate) => ({
|
||||
target: new Date(targetDate),
|
||||
daysRemaining: 0,
|
||||
isUrgent: false,
|
||||
init() {
|
||||
const now = new Date();
|
||||
now.setHours(0,0,0,0);
|
||||
const targetDateObj = new Date(this.target);
|
||||
targetDateObj.setHours(0,0,0,0);
|
||||
const diffTime = targetDateObj - now;
|
||||
const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24));
|
||||
this.daysRemaining = diffDays;
|
||||
this.isUrgent = diffDays <= 7 && diffDays >= 0;
|
||||
}
|
||||
}));
|
||||
});
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
const Toast = Swal.mixin({
|
||||
toast: true,
|
||||
position: 'top-end',
|
||||
showConfirmButton: false,
|
||||
timer: 3500,
|
||||
timerProgressBar: true
|
||||
});
|
||||
|
||||
@if(session('success'))
|
||||
Toast.fire({ icon: 'success', title: '{{ session('success') }}' });
|
||||
@endif
|
||||
|
||||
@if(session('error'))
|
||||
Swal.fire({
|
||||
icon: 'info',
|
||||
title: 'Informasi Sistem',
|
||||
text: '{{ session('error') }}',
|
||||
confirmButtonColor: '#4f46e5',
|
||||
customClass: { popup: 'rounded-[2rem]' }
|
||||
});
|
||||
@endif
|
||||
});
|
||||
|
||||
function confirmDelete(button, pairName) {
|
||||
Swal.fire({
|
||||
title: 'Hapus Riwayat?',
|
||||
html: "Anda akan menghapus data breeding:<br><b class='text-indigo-600'>" + pairName + "</b>",
|
||||
icon: 'warning',
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: '#ef4444',
|
||||
cancelButtonColor: '#64748b',
|
||||
confirmButtonText: 'Ya, Hapus!',
|
||||
cancelButtonText: 'Batal',
|
||||
reverseButtons: true,
|
||||
customClass: { popup: 'rounded-[2rem]' }
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
button.closest('form').submit();
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
@endpush
|
||||
</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>
|
||||
|
||||
Reference in New Issue
Block a user