<?= $this->extend('layout/default') ?>

<?= $this->section('content') ?>
<div class="container-fluid px-4">
    <h1 class="mt-4">Edit Info Kontak</h1>
    <ol class="breadcrumb mb-4">
        <li class="breadcrumb-item"><a href="<?= base_url('admin/kontak') ?>">Kontak</a></li>
        <li class="breadcrumb-item active">Edit</li>
    </ol>

    <div class="card mb-4 col-lg-8 shadow border-0">
        <div class="card-body">
            <form action="<?= base_url('admin/kontak/update') ?>" method="post">
                <?= csrf_field() ?>
                <input type="hidden" name="id_kontak" value="<?= $kontak['id_kontak'] ?>">

                <div class="mb-3">
                    <label class="form-label fw-bold">Alamat Sekolah</label>
                    <textarea name="alamat" class="form-control" rows="3" required><?= $kontak['alamat'] ?></textarea>
                </div>

                <div class="row">
                    <div class="col-md-6 mb-3">
                        <label class="form-label fw-bold">Email Sekolah</label>
                        <input type="email" name="email" class="form-control" value="<?= $kontak['email'] ?>" required>
                    </div>
                    <div class="col-md-6 mb-3">
                        <label class="form-label fw-bold">Nomor Telepon</label>
                        <input type="text" name="telepon" class="form-control" value="<?= $kontak['telepon'] ?>" required>
                    </div>
                </div>

                <div class="mb-3">
                    <label class="form-label fw-bold">Username Instagram</label>
                    <div class="input-group">
                        <span class="input-group-text bg-danger text-white">@</span>
                        <input type="text" name="instagram" class="form-control" value="<?= $kontak['instagram'] ?>" placeholder="smkn1sukalarang" required>
                    </div>
                    <small class="text-muted">*Masukkan username tanpa tanda @</small>
                </div>

                <div class="mb-4">
                    <label class="form-label fw-bold">Embed Google Maps (Iframe)</label>
                    <textarea name="maps_iframe" class="form-control" rows="4" placeholder="Masukkan kode <iframe> dari Google Maps"><?= $kontak['maps_iframe'] ?></textarea>
                    <div class="mt-2 small bg-light p-2 rounded">
                        <strong>Cara ambil kode:</strong> Buka Google Maps > Klik Share > Embed a map > Copy HTML.
                    </div>
                </div>

                <div class="d-flex justify-content-end">
                    <a href="<?= base_url('admin/kontak') ?>" class="btn btn-secondary me-2">Batal</a>
                    <button type="submit" class="btn btn-success px-4">Simpan Perubahan</button>
                </div>
            </form>
        </div>
    </div>
</div>
<?= $this->endSection() ?>