@php $kabupaten = $kabupaten ?? null; @endphp

<div class="mb-3">
    <x-input-label for="nama" value="Nama Kabupaten" />
    <x-text-input id="nama" name="nama" value="{{ old('nama', $kabupaten?->nama) }}" required autofocus />
    <x-input-error :messages="$errors->get('nama')" class="mt-1" />
</div>

<div class="mb-3">
    <x-input-label for="kode_wilayah" value="Kode Wilayah (opsional)" />
    <x-text-input id="kode_wilayah" name="kode_wilayah" value="{{ old('kode_wilayah', $kabupaten?->kode_wilayah) }}" />
    <x-input-error :messages="$errors->get('kode_wilayah')" class="mt-1" />
</div>

<div class="mb-3">
    <x-input-label for="logo" value="Logo Kabupaten" />
    <input type="file" id="logo" name="logo" class="form-control" accept="image/*">
    <x-input-error :messages="$errors->get('logo')" class="mt-1" />
    @if ($kabupaten?->logo)
        <img src="{{ Storage::url($kabupaten->logo) }}" alt="Logo" class="mt-2" style="height: 60px;">
    @endif
</div>

<div class="mb-3 form-check form-switch">
    <input type="checkbox" class="form-check-input" id="is_active" name="is_active" value="1"
           {{ old('is_active', $kabupaten?->is_active ?? true) ? 'checked' : '' }}>
    <label class="form-check-label" for="is_active">Aktif</label>
</div>
