<?= $this->extend('layouts/admin') ?><?= $this->section('content') ?>
<form class="panel" method="post" enctype="multipart/form-data" action="<?= base_url('admin/acara') ?>"><?= csrf_field() ?>
<div class="row g-3">
<?php foreach([['nama_acara','Nama Acara','text',true],['nama_anak','Nama Anak','text',true],['tanggal','Tanggal','date',true],['waktu_mulai','Waktu Mulai','time',true],['waktu_selesai','Waktu Selesai','time',true],['google_maps_url','Link Google Maps','url',true],['google_maps_embed','URL Embed Maps','url',false],['nama_orang_tua','Nama Keluarga/Orang Tua','text',true]] as $f): ?>
<div class="col-md-6"><label class="form-label"><?= $f[1] ?></label><input class="form-control" type="<?= $f[2] ?>" name="<?= $f[0] ?>" value="<?= esc(old($f[0], $acara[$f[0]] ?? '')) ?>" <?= $f[3] ? 'required' : '' ?>><?php if($f[0]==='google_maps_embed'): ?><div class="form-text">Opsional. Jika kosong, peta dibuat otomatis dari alamat lokasi.</div><?php endif ?></div>
<?php endforeach ?>
<div class="col-12"><label class="form-label">Lokasi</label><textarea class="form-control" name="lokasi" rows="3" required><?= esc(old('lokasi', $acara['lokasi'] ?? '')) ?></textarea></div>
<div class="col-12"><label class="form-label">Ucapan dan Doa</label><textarea class="form-control" name="doa" rows="3" required><?= esc(old('doa', $acara['doa'] ?? '')) ?></textarea></div>
<div class="col-md-6"><label class="form-label">Foto Anak</label><input class="form-control" type="file" name="foto_anak" accept=".jpg,.jpeg,.png,.webp"><div class="form-text">JPG, PNG, atau WebP. Maksimal 5 MB.</div></div>
<div class="col-12"><button class="btn btn-emerald"><i class="bi bi-save me-1"></i>Simpan Perubahan</button></div>
</div></form>
<?= $this->endSection() ?>
