250 lines
17 KiB
PHP
250 lines
17 KiB
PHP
<x-app-layout>
|
|
<div class="max-w-4xl mx-auto space-y-6 pb-12">
|
|
{{-- Header & Back Button --}}
|
|
<div class="flex items-center gap-4">
|
|
<a href="{{ route('cats.index') }}" class="p-3 bg-white border border-slate-200 rounded-2xl text-slate-400 hover:text-indigo-600 transition-all shadow-sm active:scale-90">
|
|
<i class="fas fa-arrow-left"></i>
|
|
</a>
|
|
<div>
|
|
<h2 class="text-2xl font-black text-slate-800 tracking-tight uppercase">Tambah Kucing Baru</h2>
|
|
<p class="text-sm text-slate-500 font-medium italic tracking-tight">Registrasi identitas permanen & silsilah ke database Ilycats.</p>
|
|
</div>
|
|
</div>
|
|
|
|
{{-- Notifikasi Error --}}
|
|
@if ($errors->any())
|
|
<div class="p-5 bg-rose-50 border-2 border-rose-100 text-rose-600 rounded-[2rem] shadow-sm animate-fade-in">
|
|
<div class="flex items-center gap-3 mb-2">
|
|
<i class="fas fa-exclamation-circle text-lg"></i>
|
|
<h3 class="text-xs font-black uppercase tracking-widest">Terdapat Kesalahan Input:</h3>
|
|
</div>
|
|
<ul class="list-disc list-inside text-[11px] font-bold space-y-1 ml-1">
|
|
@foreach ($errors->all() as $error)
|
|
<li>{{ $error }}</li>
|
|
@endforeach
|
|
</ul>
|
|
</div>
|
|
@endif
|
|
|
|
<form action="{{ route('cats.store') }}" method="POST" enctype="multipart/form-data" class="space-y-6">
|
|
@csrf
|
|
|
|
{{-- SECTION 1: IDENTITAS UTAMA --}}
|
|
<div class="bg-white border border-slate-200 rounded-[2.5rem] p-8 shadow-sm space-y-6">
|
|
<h4 class="text-xs font-black text-indigo-600 uppercase tracking-widest border-b border-slate-100 pb-4 mb-2 flex items-center gap-2 italic">
|
|
<i class="fas fa-id-card"></i> Identitas & Dokumen Resmi
|
|
</h4>
|
|
|
|
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
|
|
{{-- Nama Kucing --}}
|
|
<div class="space-y-2 md:col-span-2">
|
|
<label class="text-[10px] font-black text-slate-400 uppercase tracking-widest ml-1">Nama Lengkap Kucing (Sesuai Pedigree)</label>
|
|
<input type="text" name="nama_kucing" value="{{ old('nama_kucing') }}" required placeholder="Contoh: Earrin Cats Moonlight" class="w-full px-4 py-4 bg-slate-50 border border-slate-200 rounded-2xl focus:ring-2 focus:ring-indigo-500 transition-all text-sm font-bold text-slate-800">
|
|
</div>
|
|
|
|
{{-- No. Pedigree, Microchip, & EMS (GRID 3 KOLOM) --}}
|
|
<div class="md:col-span-2 grid grid-cols-1 md:grid-cols-3 gap-4">
|
|
<div class="space-y-2">
|
|
<label class="text-[10px] font-black text-slate-400 uppercase tracking-widest ml-1">No. Pedigree</label>
|
|
<input type="text" name="pedigree" value="{{ old('pedigree') }}" placeholder="ICA.LO.xxxx" class="w-full px-4 py-3 bg-slate-50 border border-slate-200 rounded-xl focus:ring-2 focus:ring-indigo-500 transition-all text-xs font-bold text-slate-800">
|
|
</div>
|
|
<div class="space-y-2">
|
|
<label class="text-[10px] font-black text-slate-400 uppercase tracking-widest ml-1">No. Microchip</label>
|
|
<input type="text" name="microchip" value="{{ old('microchip') }}" placeholder="90011xxxx" class="w-full px-4 py-3 bg-slate-50 border border-slate-200 rounded-xl focus:ring-2 focus:ring-indigo-500 transition-all text-xs font-bold text-slate-800">
|
|
</div>
|
|
<div class="space-y-2">
|
|
<label class="text-[10px] font-black text-slate-400 uppercase tracking-widest ml-1">Kode EMS</label>
|
|
<input type="text" name="kode_ems" value="{{ old('kode_ems') }}" placeholder="PER d 03" class="w-full px-4 py-3 bg-slate-50 border border-slate-200 rounded-xl focus:ring-2 focus:ring-indigo-500 transition-all text-xs font-bold text-slate-800">
|
|
</div>
|
|
</div>
|
|
|
|
{{-- Ras Kucing --}}
|
|
<div class="space-y-2">
|
|
<label class="text-[10px] font-black text-slate-400 uppercase tracking-widest ml-1">Ras / Breed</label>
|
|
<select name="ras" required class="w-full px-4 py-4 bg-slate-50 border border-slate-200 rounded-2xl focus:ring-2 focus:ring-indigo-500 transition-all text-sm font-bold text-slate-800">
|
|
<option value="Persian" {{ old('ras') == 'Persian' ? 'selected' : '' }}>Persian</option>
|
|
<option value="British Shorthair" {{ old('ras') == 'British Shorthair' ? 'selected' : '' }}>British Shorthair</option>
|
|
<option value="Lainnya" {{ old('ras') == 'Lainnya' ? 'selected' : '' }}>Lainnya</option>
|
|
</select>
|
|
</div>
|
|
|
|
{{-- Tanggal Lahir --}}
|
|
<div class="space-y-2">
|
|
<label class="text-[10px] font-black text-slate-400 uppercase tracking-widest ml-1">Tanggal Lahir</label>
|
|
<input type="date" name="tanggal_lahir" value="{{ old('tanggal_lahir') }}" class="w-full px-4 py-4 bg-slate-50 border border-slate-200 rounded-2xl focus:ring-2 focus:ring-indigo-500 transition-all text-sm font-bold text-slate-800">
|
|
</div>
|
|
|
|
{{-- Registry --}}
|
|
<div class="md:col-span-2 space-y-3">
|
|
<label class="text-[10px] font-black text-slate-400 uppercase tracking-widest ml-1 block">Federasi / Registry</label>
|
|
<div class="grid grid-cols-2 md:grid-cols-4 gap-3">
|
|
@foreach(['ICA', 'CFA', 'WCF', 'FFF'] as $reg)
|
|
<label class="block cursor-pointer group">
|
|
<input type="checkbox" name="registry[]" value="{{ $reg }}"
|
|
{{ is_array(old('registry')) && in_array($reg, old('registry')) ? 'checked' : '' }}
|
|
class="sr-only peer">
|
|
<div class="py-4 text-center border-2 border-slate-100 rounded-2xl text-[10px] font-black text-slate-400
|
|
peer-checked:bg-indigo-600 peer-checked:text-white peer-checked:border-indigo-600
|
|
transition-all shadow-sm group-hover:border-slate-300 uppercase">
|
|
{{ $reg }}
|
|
</div>
|
|
</label>
|
|
@endforeach
|
|
</div>
|
|
</div>
|
|
|
|
{{-- Jenis Kelamin --}}
|
|
<div class="space-y-2 md:col-span-2">
|
|
<label class="text-[10px] font-black text-slate-400 uppercase tracking-widest ml-1">Jenis Kelamin</label>
|
|
<div class="flex gap-4">
|
|
<label class="flex-1 cursor-pointer">
|
|
<input type="radio" name="jenis_kelamin" value="Jantan" {{ old('jenis_kelamin', 'Jantan') == 'Jantan' ? 'checked' : '' }} class="hidden peer">
|
|
<div class="p-4 text-center border-2 border-slate-100 rounded-2xl text-xs font-black text-slate-400 peer-checked:bg-blue-50 peer-checked:border-blue-500 peer-checked:text-blue-600 transition-all shadow-sm">
|
|
<i class="fas fa-mars mr-2"></i> JANTAN (SIRE)
|
|
</div>
|
|
</label>
|
|
<label class="flex-1 cursor-pointer">
|
|
<input type="radio" name="jenis_kelamin" value="Betina" {{ old('jenis_kelamin') == 'Betina' ? 'checked' : '' }} class="hidden peer">
|
|
<div class="p-4 text-center border-2 border-slate-100 rounded-2xl text-xs font-black text-slate-400 peer-checked:bg-pink-50 peer-checked:border-pink-500 peer-checked:text-pink-600 transition-all shadow-sm">
|
|
<i class="fas fa-venus mr-2"></i> BETINA (DAM)
|
|
</div>
|
|
</label>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
{{-- SECTION 2: GENETIK & LOKASI --}}
|
|
<div class="bg-white border border-slate-200 rounded-[2.5rem] p-8 shadow-sm space-y-6">
|
|
<h4 class="text-xs font-black text-indigo-600 uppercase tracking-widest border-b border-slate-100 pb-4 mb-2 flex items-center gap-2 italic">
|
|
<i class="fas fa-dna"></i> Penempatan & Silsilah Induk
|
|
</h4>
|
|
|
|
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6">
|
|
<div class="space-y-2">
|
|
<label class="text-[10px] font-bold text-slate-400 uppercase ml-1">Induk Jantan</label>
|
|
<select name="induk_jantan_id" class="w-full px-4 py-3 bg-slate-50 border border-slate-200 rounded-2xl text-xs font-bold text-slate-700">
|
|
<option value="">-- Tanpa Sire --</option>
|
|
@foreach($sires as $sire)
|
|
<option value="{{ $sire->id }}" {{ old('induk_jantan_id') == $sire->id ? 'selected' : '' }}>{{ $sire->nama_kucing }}</option>
|
|
@endforeach
|
|
</select>
|
|
</div>
|
|
|
|
<div class="space-y-2">
|
|
<label class="text-[10px] font-bold text-slate-400 uppercase ml-1">Induk Betina</label>
|
|
<select name="induk_betina_id" class="w-full px-4 py-3 bg-slate-50 border border-slate-200 rounded-2xl text-xs font-bold text-slate-700">
|
|
<option value="">-- Tanpa Dam --</option>
|
|
@foreach($dams as $dam)
|
|
<option value="{{ $dam->id }}" {{ old('induk_betina_id') == $dam->id ? 'selected' : '' }}>{{ $dam->nama_kucing }}</option>
|
|
@endforeach
|
|
</select>
|
|
</div>
|
|
|
|
<div class="space-y-2">
|
|
<label class="text-[10px] font-bold text-slate-400 uppercase ml-1">Lokasi Kandang</label>
|
|
<select name="lokasi_kandang" class="w-full px-4 py-3 bg-slate-50 border border-slate-200 rounded-2xl text-sm font-black text-indigo-600 uppercase">
|
|
@foreach(['A1', 'A2', 'Lorong', 'E1', 'E2'] as $loc)
|
|
<option value="{{ $loc }}" {{ old('lokasi_kandang') == $loc ? 'selected' : '' }}>{{ $loc }}</option>
|
|
@endforeach
|
|
</select>
|
|
</div>
|
|
|
|
<div class="space-y-2">
|
|
<label class="text-[10px] font-bold text-slate-400 uppercase ml-1">PIC (Penanggung Jawab)</label>
|
|
<select name="pic_id" class="w-full px-4 py-3 bg-slate-50 border border-slate-200 rounded-2xl text-xs font-bold text-slate-700">
|
|
@foreach($users as $user)
|
|
<option value="{{ $user->id }}" {{ old('pic_id', auth()->id()) == $user->id ? 'selected' : '' }}>{{ $user->name }}</option>
|
|
@endforeach
|
|
</select>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
{{-- SECTION 3: JADWAL & PERTUMBUHAN --}}
|
|
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
|
|
{{-- Jadwal Medis --}}
|
|
<div class="bg-white border border-slate-200 rounded-[2.5rem] p-8 shadow-sm space-y-4">
|
|
<h4 class="text-xs font-black text-rose-600 uppercase tracking-widest border-b border-slate-100 pb-4 mb-2 flex items-center gap-2 italic">
|
|
<i class="fas fa-calendar-alt"></i> Jadwal Perawatan
|
|
</h4>
|
|
<div class="grid grid-cols-2 gap-4">
|
|
@foreach (['vaksin', 'obat_cacing', 'obat_kutu', 'grooming'] as $task)
|
|
<div class="space-y-1">
|
|
<label class="text-[9px] font-bold text-slate-400 uppercase ml-1">{{ str_replace('_', ' ', $task) }}</label>
|
|
<input type="date" name="jadwal_{{ $task }}" value="{{ old('jadwal_'.$task) }}" class="w-full p-3 bg-slate-50 border border-slate-200 rounded-xl text-[10px] font-black text-slate-700 focus:ring-rose-500">
|
|
</div>
|
|
@endforeach
|
|
</div>
|
|
</div>
|
|
|
|
{{-- Monitoring Berat --}}
|
|
<div class="bg-white border border-slate-200 rounded-[2.5rem] p-8 shadow-sm space-y-4">
|
|
<h4 class="text-xs font-black text-emerald-600 uppercase tracking-widest border-b border-slate-100 pb-4 mb-2 flex items-center gap-2 italic">
|
|
<i class="fas fa-weight-scale"></i> Vitalitas & Berat
|
|
</h4>
|
|
<div class="space-y-4">
|
|
<div>
|
|
<label class="text-[10px] font-black text-slate-400 uppercase ml-1">Berat Badan Awal</label>
|
|
<div class="relative mt-2">
|
|
<input type="number" step="0.01" name="berat_badan" value="{{ old('berat_badan') }}" placeholder="0.00" class="w-full pl-6 pr-14 py-5 bg-slate-50 border border-slate-200 rounded-3xl text-2xl font-black text-slate-800 focus:ring-emerald-500">
|
|
<span class="absolute right-6 top-1/2 -translate-y-1/2 text-xs font-black text-slate-400">KG</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
{{-- SECTION 4: FOTO --}}
|
|
<div class="bg-white border border-slate-200 rounded-[2.5rem] p-8 shadow-sm space-y-4">
|
|
<h4 class="text-xs font-black text-slate-800 uppercase tracking-widest ml-1 mb-2">Unggah Foto Utama</h4>
|
|
<div class="relative group">
|
|
<input type="file" name="foto" id="foto" class="hidden" onchange="previewImage(event)">
|
|
<label for="foto" class="flex flex-col items-center justify-center border-4 border-dashed border-slate-100 rounded-[3rem] p-12 text-center cursor-pointer hover:border-indigo-200 hover:bg-indigo-50/20 transition-all duration-500 group">
|
|
<div id="preview-container" class="hidden mb-6">
|
|
<img id="image-preview" class="w-48 h-48 rounded-[2.5rem] object-cover shadow-2xl ring-8 ring-white">
|
|
</div>
|
|
<div id="upload-instruction" class="space-y-4">
|
|
<div class="w-20 h-20 bg-slate-50 rounded-3xl flex items-center justify-center mx-auto group-hover:scale-110 group-hover:bg-white transition-all duration-500 shadow-sm">
|
|
<i class="fas fa-camera-retro text-3xl text-slate-300 group-hover:text-indigo-500"></i>
|
|
</div>
|
|
<div>
|
|
<p class="text-xs text-slate-600 font-black tracking-widest uppercase">Pilih Foto Terbaik</p>
|
|
<p class="text-[10px] text-slate-400 mt-1 uppercase font-bold tracking-tighter italic">JPG, PNG, WEBP (Maks 2MB)</p>
|
|
</div>
|
|
</div>
|
|
</label>
|
|
</div>
|
|
</div>
|
|
|
|
{{-- Action Button --}}
|
|
<div class="pt-4">
|
|
<button type="submit" class="w-full py-6 bg-indigo-600 text-white text-xs font-black rounded-[2.5rem] shadow-2xl shadow-indigo-100 hover:bg-indigo-700 hover:-translate-y-1 transition-all active:scale-[0.98] flex items-center justify-center gap-4 group">
|
|
<i class="fas fa-save text-xl"></i>
|
|
<span class="tracking-[0.2em] uppercase">Simpan Record Baru</span>
|
|
</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
|
|
<style>
|
|
.animate-fade-in { animation: fadeIn 0.4s ease-out; }
|
|
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
|
|
</style>
|
|
|
|
<script>
|
|
function previewImage(event) {
|
|
const reader = new FileReader();
|
|
reader.onload = function() {
|
|
const output = document.getElementById('image-preview');
|
|
const container = document.getElementById('preview-container');
|
|
const instruction = document.getElementById('upload-instruction');
|
|
|
|
output.src = reader.result;
|
|
container.classList.remove('hidden');
|
|
instruction.classList.add('hidden');
|
|
}
|
|
reader.readAsDataURL(event.target.files[0]);
|
|
}
|
|
</script>
|
|
</x-app-layout> |