@extends('layouts.admin') @section('title','Popup') @section('page_title','Popup Pengumuman') @section('page_subtitle','Dapat diaktifkan/nonaktifkan dan dijadwalkan')
@section('content')<div class="grid form-grid"><form class="card form" method="post" enctype="multipart/form-data" action="{{ route('popups.store') }}">@csrf<h3>Buat Popup</h3><label>Judul<input name="title" required></label><label>Isi<textarea name="body" required rows="4"></textarea></label><label>Gambar opsional<input type="file" name="image" accept="image/*"></label><div class="two"><label>Tombol<input name="button_label" placeholder="Lihat Pengumuman"></label><label>URL<input name="button_url" placeholder="/agenda"></label></div><div class="two"><label>Mulai<input type="datetime-local" name="starts_at"></label><label>Berakhir<input type="datetime-local" name="ends_at"></label></div><label>Frekuensi<select name="frequency"><option value="once_session">1x per sesi</option><option value="once_day">1x per hari</option><option value="always">Setiap kunjungan</option></select></label><div class="toggle-grid"><label><input type="checkbox" name="show_desktop" value="1" checked> Desktop</label><label><input type="checkbox" name="show_mobile" value="1" checked> Mobile</label><label><input type="checkbox" name="is_active" value="1" checked> Aktif</label></div><button class="btn primary">Simpan Popup</button></form><div class="card tip"><h3>Kontrol penuh</h3><p>Popup tersimpan walaupun dinonaktifkan, sehingga dapat digunakan lagi tanpa membuat ulang.</p></div></div><div class="card table-card"><div class="table-wrap"><table><thead><tr><th>Judul</th><th>Periode</th><th>Frekuensi</th><th>Status</th></tr></thead><tbody>@foreach($popups as $p)<tr><td><b>{{ $p->title }}</b><small>{{ \Illuminate\Support\Str::limit($p->body,90) }}</small></td><td>{{ $p->starts_at?->format('d M Y H:i') ?: 'Langsung' }} – {{ $p->ends_at?->format('d M Y H:i') ?: 'Tanpa batas' }}</td><td>{{ $p->frequency }}</td><td><form method="post" action="{{ route('popups.toggle',$p) }}">@csrf<button class="btn {{ $p->is_active?'primary':'' }}">{{ $p->is_active?'Aktif':'Nonaktif' }}</button></form></td></tr>@endforeach</tbody></table></div></div>@endsection
