<x-app-layout>
    <x-slot name="header">
        <h2 class="h4 mb-0">Kontak</h2>
    </x-slot>

    <div class="row g-3">
        <div class="col-md-5">
            <div class="card">
                <div class="card-header">Tambah Kontak</div>
                <div class="card-body">
                    <form action="{{ route('admin-desa.contact.store') }}" method="POST">
                        @csrf
                        <div class="mb-2">
                            <select name="jenis" class="form-select" required>
                                <option value="whatsapp">WhatsApp</option>
                                <option value="email">Email</option>
                                <option value="telepon">Telepon</option>
                                <option value="alamat_kantor">Alamat Kantor</option>
                            </select>
                        </div>
                        <div class="mb-2">
                            <x-text-input name="value" placeholder="Nilai (nomor/email/alamat)" required />
                        </div>
                        <button class="btn btn-primary btn-sm">Tambah</button>
                    </form>
                </div>
            </div>
        </div>

        <div class="col-md-7">
            @foreach ($contacts as $contact)
                <div class="d-flex justify-content-between align-items-center border-bottom py-2">
                    <div>
                        <span class="badge bg-secondary">{{ str_replace('_', ' ', $contact->jenis) }}</span>
                        {{ $contact->value }}
                    </div>
                    <form action="{{ route('admin-desa.contact.destroy', $contact) }}" method="POST">
                        @csrf @method('DELETE')
                        <button class="btn btn-sm btn-outline-danger">Hapus</button>
                    </form>
                </div>
            @endforeach
        </div>
    </div>
</x-app-layout>
