2026-02-08 15:16:35 +07:00
< 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 >
2026-09-23 12:45:02 +07:00
< h2 class = " text-2xl font-black text-slate-800 tracking-tight uppercase leading-none mb-1 " > Tambah Kucing Baru </ h2 >
< p class = " text-[10px] text-slate-400 font-bold uppercase tracking-[0.2em] " > Registrasi Identitas Permanen • Ilycats Database </ p >
2026-02-08 15:16:35 +07:00
</ 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 -- }}
2026-09-23 12:45:02 +07:00
< div class = " bg-white border border-slate-200 rounded-[2.5rem] p-8 shadow-sm space-y-8 " >
< div class = " flex items-center gap-4 mb-2 border-b border-slate-100 pb-4 " >
< div class = " w-8 h-8 bg-indigo-600 text-white rounded-xl flex items-center justify-center text-xs shadow-lg " >
< i class = " fas fa-id-card " ></ i >
</ div >
< h4 class = " font-black text-slate-800 uppercase tracking-tighter text-lg " > Identitas & Dokumen Resmi </ h4 >
</ div >
2026-02-08 15:16:35 +07:00
< 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 >
2026-09-23 12:45:02 +07:00
< input type = " text " name = " nama_kucing " value = " { { old('nama_kucing') }} " required placeholder = " Contoh: Earrin Cats Moonlight " class = " w-full px-5 py-4 bg-slate-50 border border-slate-200 rounded-2xl focus:ring-4 focus:ring-indigo-500/10 focus:border-indigo-500 transition-all text-sm font-bold text-slate-800 " >
2026-02-08 15:16:35 +07:00
</ div >
2026-09-23 12:45:02 +07:00
{{ -- GRID IDENTITAS -- }}
< div class = " md:col-span-2 grid grid-cols-1 md:grid-cols-3 gap-4 border-y border-slate-50 py-6 my-2 " >
2026-02-08 15:16:35 +07:00
< div class = " space-y-2 " >
< label class = " text-[10px] font-black text-slate-400 uppercase tracking-widest ml-1 " > No . Pedigree </ label >
2026-09-23 12:45:02 +07:00
{{ -- PERBAIKAN : Menghapus class ' uppercase ' agar input sesuai ketikan --}}
<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 text-xs font-bold text-slate-800">
2026-02-08 15:16:35 +07:00
</div>
<div class="space-y-2">
<label class="text-[10px] font-black text-slate-400 uppercase tracking-widest ml-1">No. Microchip</label>
2026-09-23 12:45:02 +07:00
<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 text-xs font-bold text-slate-800">
2026-02-08 15:16:35 +07:00
</div>
<div class="space-y-2">
2026-09-23 12:45:02 +07:00
<label class="text-[10px] font-black text-indigo-600 uppercase tracking-widest ml-1 flex items-center gap-2">
<i class="fas fa-dna text-[10px]"></i> Kode EMS
</label>
{{-- PERBAIKAN: Menghapus class ' uppercase ' agar input sesuai ketikan --}}
<input type="text" name="kode_ems" value="{{ old(' kode_ems ') }}" placeholder="PER d 03" class="w-full px-4 py-3 bg-indigo-50/30 border border-indigo-100 rounded-xl focus:ring-2 focus:ring-indigo-500 text-xs font-black text-indigo-700">
2026-02-08 15:16:35 +07:00
</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">
2026-09-23 12:45:02 +07:00
@foreach([' Persian ', ' British Shorthair ', ' Scottish Fold ', ' Maine Coon ', ' Munchkin ', ' Lainnya '] as $ras)
<option value="{{ $ras }}" {{ old(' ras ') == $ras ? ' selected ' : ' ' }}>{{ $ras }}</option>
@endforeach
2026-02-08 15:16:35 +07:00
</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>
2026-09-23 12:45:02 +07:00
<div class="grid grid-cols-2 md:grid-cols-5 gap-3">
@foreach([' ICA ', ' CFA ', ' WCF ', ' FFF ', ' NON - PED '] as $reg)
2026-02-08 15:16:35 +07:00
<label class="block cursor-pointer group">
<input type="checkbox" name="registry[]" value="{{ $reg }}"
2026-09-23 12:45:02 +07:00
{{ (is_array(old(' registry ')) && in_array($reg, old(' registry '))) || ($reg === ' NON - PED ' && !old(' registry ')) ? ' checked ' : ' ' }}
2026-02-08 15:16:35 +07:00
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">
2026-09-23 12:45:02 +07:00
<label class="flex-1 cursor-pointer group">
<input type="radio" name="jenis_kelamin" value="Jantan" {{ old(' jenis_kelamin ', ' Jantan ') == ' Jantan ' ? ' checked ' : ' ' }} class="sr-only 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 group-hover:border-slate-200">
2026-02-08 15:16:35 +07:00
<i class="fas fa-mars mr-2"></i> JANTAN (SIRE)
</div>
</label>
2026-09-23 12:45:02 +07:00
<label class="flex-1 cursor-pointer group">
<input type="radio" name="jenis_kelamin" value="Betina" {{ old(' jenis_kelamin ') == ' Betina ' ? ' checked ' : ' ' }} class="sr-only 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 group-hover:border-slate-200">
2026-02-08 15:16:35 +07:00
<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">
2026-09-23 12:45:02 +07:00
<i class="fas fa-dna text-sm"></i> Penempatan & Silsilah Induk
2026-02-08 15:16:35 +07:00
</h4>
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6">
2026-09-23 12:45:02 +07:00
{{-- Searchable Sire --}}
2026-02-08 15:16:35 +07:00
<div class="space-y-2">
2026-09-23 12:45:02 +07:00
<label class="text-[10px] font-bold text-slate-400 uppercase ml-1">Induk Jantan (Sire)</label>
<input type="text" list="sire_list" id="sire_search" placeholder="Ketik nama sire..." class="w-full px-4 py-3 bg-slate-50 border border-slate-200 rounded-2xl text-xs font-bold text-slate-700 focus:ring-2 focus:ring-indigo-500" autocomplete="off">
<datalist id="sire_list">
2026-02-08 15:16:35 +07:00
@foreach($sires as $sire)
2026-09-23 12:45:02 +07:00
<option data-id="{{ $sire->id }}" value="{{ $sire->nama_kucing }}">
2026-02-08 15:16:35 +07:00
@endforeach
2026-09-23 12:45:02 +07:00
</datalist>
<input type="hidden" name="induk_jantan_id" id="induk_jantan_id" value="{{ old(' induk_jantan_id ') }}">
2026-02-08 15:16:35 +07:00
</div>
2026-09-23 12:45:02 +07:00
{{-- Searchable Dam --}}
2026-02-08 15:16:35 +07:00
<div class="space-y-2">
2026-09-23 12:45:02 +07:00
<label class="text-[10px] font-bold text-slate-400 uppercase ml-1">Induk Betina (Dam)</label>
<input type="text" list="dam_list" id="dam_search" placeholder="Ketik nama dam..." class="w-full px-4 py-3 bg-slate-50 border border-slate-200 rounded-2xl text-xs font-bold text-slate-700 focus:ring-2 focus:ring-indigo-500" autocomplete="off">
<datalist id="dam_list">
2026-02-08 15:16:35 +07:00
@foreach($dams as $dam)
2026-09-23 12:45:02 +07:00
<option data-id="{{ $dam->id }}" value="{{ $dam->nama_kucing }}">
2026-02-08 15:16:35 +07:00
@endforeach
2026-09-23 12:45:02 +07:00
</datalist>
<input type="hidden" name="induk_betina_id" id="induk_betina_id" value="{{ old(' induk_betina_id ') }}">
2026-02-08 15:16:35 +07:00
</div>
<div class="space-y-2">
<label class="text-[10px] font-bold text-slate-400 uppercase ml-1">Lokasi Kandang</label>
2026-09-23 12:45:02 +07:00
<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 focus:ring-2 focus:ring-indigo-500">
@foreach([' A1 ', ' A2 ', ' Lorong ', ' E1 ', ' E2 ', ' Karantina '] as $loc)
2026-02-08 15:16:35 +07:00
<option value="{{ $loc }}" {{ old(' lokasi_kandang ') == $loc ? ' selected ' : ' ' }}>{{ $loc }}</option>
@endforeach
</select>
</div>
<div class="space-y-2">
2026-09-23 12:45:02 +07:00
<label class="text-[10px] font-bold text-slate-400 uppercase ml-1">PIC Bertugas</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 focus:ring-2 focus:ring-indigo-500">
2026-02-08 15:16:35 +07:00
@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 --}}
2026-09-23 12:45:02 +07:00
<div class="grid grid-cols-1 lg:grid-cols-3 gap-6">
<div class="lg:col-span-2 bg-white border border-slate-200 rounded-[2.5rem] p-8 shadow-sm">
<div class="flex items-center gap-3 mb-6 border-b border-slate-100 pb-4">
<div class="w-7 h-7 bg-rose-50 text-rose-600 rounded-lg flex items-center justify-center text-[10px]">
<i class="fas fa-calendar-alt"></i>
</div>
<h4 class="text-xs font-black text-rose-600 uppercase tracking-widest italic">Jadwal Perawatan</h4>
</div>
2026-02-08 15:16:35 +07:00
<div class="grid grid-cols-2 gap-4">
2026-09-23 12:45:02 +07:00
@foreach ([' vaksin ' => ' Vaksin ', ' obat_cacing ' => ' Obat Cacing ', ' obat_kutu ' => ' Obat Kutu ', ' grooming ' => ' Grooming '] as $task => $label)
2026-02-08 15:16:35 +07:00
<div class="space-y-1">
2026-09-23 12:45:02 +07:00
<label class="text-[9px] font-bold text-slate-400 uppercase ml-1">{{ $label }}</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-2 focus:ring-rose-200 transition-all">
2026-02-08 15:16:35 +07:00
</div>
@endforeach
</div>
</div>
2026-09-23 12:45:02 +07:00
<div class="bg-white border border-slate-200 rounded-[2.5rem] p-8 shadow-sm">
<h4 class="text-xs font-black text-emerald-600 uppercase tracking-widest border-b border-slate-100 pb-4 mb-6 italic flex items-center gap-2">
<i class="fas fa-weight-scale text-sm"></i> Vitalitas
2026-02-08 15:16:35 +07:00
</h4>
<div class="space-y-4">
2026-09-23 12:45:02 +07:00
<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-4 focus:ring-emerald-500/10 focus:border-emerald-500 transition-all">
<span class="absolute right-6 top-1/2 -translate-y-1/2 text-xs font-black text-slate-400">KG</span>
2026-02-08 15:16:35 +07:00
</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">
2026-09-23 12:45:02 +07:00
<h4 class="text-[10px] font-black text-slate-400 uppercase tracking-widest ml-1 mb-2">Unggah Foto Utama</h4>
2026-02-08 15:16:35 +07:00
<div class="relative group">
2026-09-23 12:45:02 +07:00
<input type="file" name="foto" id="foto" class="hidden" onchange="previewImage(event)" accept="image/*">
2026-02-08 15:16:35 +07:00
<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>
2026-09-23 12:45:02 +07:00
<p class="text-[10px] text-slate-400 mt-1 uppercase font-bold tracking-tighter italic">JPG, PNG, WEBP (Maks 3MB)</p>
2026-02-08 15:16:35 +07:00
</div>
</div>
</label>
</div>
</div>
2026-09-23 13:56:51 +07:00
{{-- Status keberadaan di cattery --}}
<div class="rounded-[2rem] border border-slate-200 bg-white p-6 shadow-sm">
<div class="mb-4">
<h4 class="text-xs font-black uppercase tracking-widest text-slate-700">Status keberadaan</h4>
<p class="mt-1 text-xs text-slate-500">Kucing teradopsi dan induk eksternal tetap tersimpan untuk riwayat/pedigree, tetapi tidak dihitung sebagai kucing aktif di cattery.</p>
</div>
<div class="grid gap-4 md:grid-cols-2">
<label class="flex cursor-pointer items-start gap-3 rounded-2xl border border-emerald-100 bg-emerald-50/50 p-4">
<input type="checkbox" id="is_adopted" name="is_adopted" value="1" {{ old(' is_adopted ') ? ' checked ' : ' ' }} class="mt-1 rounded border-slate-300 text-emerald-600">
<span><span class="block text-sm font-bold text-emerald-800">Kucing teradopsi</span><span class="mt-1 block text-xs text-emerald-700/80">Tandai bila kucing sudah keluar dari cattery karena adopsi.</span></span>
</label>
<label class="flex cursor-pointer items-start gap-3 rounded-2xl border border-amber-100 bg-amber-50/50 p-4">
<input type="checkbox" id="is_external_parent" name="is_external_parent" value="1" {{ old(' is_external_parent ') ? ' checked ' : ' ' }} class="mt-1 rounded border-slate-300 text-amber-600">
<span><span class="block text-sm font-bold text-amber-800">Induk eksternal / tidak tinggal di cattery</span><span class="mt-1 block text-xs text-amber-700/80">Gunakan untuk sire/dam yang hanya dibutuhkan pada silsilah dan pembiakan.</span></span>
</label>
</div>
<div class="mt-4 grid gap-4 md:grid-cols-2">
<div><label class="text-[10px] font-bold uppercase text-slate-400">Tanggal adopsi</label><input type="date" name="adopted_at" value="{{ old(' adopted_at ') }}" class="mt-1 w-full rounded-xl border-slate-200 bg-slate-50 text-sm"></div>
<div><label class="text-[10px] font-bold uppercase text-slate-400">Catatan adopsi / keberadaan</label><input type="text" name="adoption_notes" value="{{ old(' adoption_notes ') }}" class="mt-1 w-full rounded-xl border-slate-200 bg-slate-50 text-sm" placeholder="Opsional"></div>
</div>
</div>
2026-02-08 15:16:35 +07:00
{{-- 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">
2026-09-23 12:45:02 +07:00
<i class="fas fa-save text-xl group-hover:rotate-12 transition-transform"></i>
2026-09-23 13:56:51 +07:00
<span class="tracking-[0.2em] uppercase">Simpan Data Kucing Baru</span>
2026-02-08 15:16:35 +07:00
</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>
2026-09-23 12:45:02 +07:00
// Logika Sinkronisasi Searchable Datalist untuk Sire/Dam
function handleSearchableDatalist(inputId, listId, hiddenId) {
const input = document.getElementById(inputId);
const list = document.getElementById(listId);
const hidden = document.getElementById(hiddenId);
input.addEventListener(' input ', function() {
const options = list.options;
hidden.value = ""; // Reset hidden ID setiap kali input berubah
for (let i = 0; i < options.length; i++) {
if (options[i].value === input.value) {
hidden.value = options[i].getAttribute(' data - id ');
break;
}
}
});
}
handleSearchableDatalist(' sire_search ', ' sire_list ', ' induk_jantan_id ');
handleSearchableDatalist(' dam_search ', ' dam_list ', ' induk_betina_id ');
2026-09-23 13:56:51 +07:00
// Status teradopsi dan induk eksternal bersifat saling eksklusif.
const adoptedCheckbox = document.getElementById(' is_adopted ');
const externalParentCheckbox = document.getElementById(' is_external_parent ');
adoptedCheckbox?.addEventListener(' change ', () => {
if (adoptedCheckbox.checked && externalParentCheckbox) externalParentCheckbox.checked = false;
});
externalParentCheckbox?.addEventListener(' change ', () => {
if (externalParentCheckbox.checked && adoptedCheckbox) adoptedCheckbox.checked = false;
});
2026-09-23 12:45:02 +07:00
// Preview Foto
2026-02-08 15:16:35 +07:00
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 >