@extends('layouts.admin')

@section('title', 'Edit Pengumuman')
@section('page-title', 'Edit Pengumuman')

@section('content')
<div class="card" style="padding: 1.5rem; max-width: 720px;">
    <form action="{{ route('admin.announcements.update', $announcement) }}" method="POST">
        @csrf
        @method('PUT')

        <div class="form-group">
            <label for="title">Judul Pengumuman</label>
            <input type="text" id="title" name="title" class="form-control" value="{{ old('title', $announcement->title) }}" required placeholder="Masukkan judul pengumuman">
        </div>

        <div class="form-group">
            <label for="date">Tanggal</label>
            <input type="date" id="date" name="date" class="form-control" value="{{ old('date', $announcement->date) }}" required>
        </div>

        <div class="form-group">
            <label for="content">Isi Pengumuman</label>
            <textarea id="content" name="content" class="form-control" rows="6" required placeholder="Tulis isi pengumuman...">{{ old('content', $announcement->content) }}</textarea>
        </div>

        <div class="form-group">
            <label style="display: inline-flex; align-items: center; gap: 8px; cursor: pointer;">
                <input type="checkbox" name="is_active" value="1" {{ old('is_active', $announcement->is_active) ? 'checked' : '' }} style="width: 16px; height: 16px; accent-color: var(--green-500);">
                Aktifkan pengumuman
            </label>
        </div>

        <div style="display: flex; gap: 10px; margin-top: 1.5rem;">
            <button type="submit" class="btn btn-primary">
                <i class="fas fa-save"></i> Simpan
            </button>
            <a href="{{ route('admin.announcements.index') }}" class="btn btn-secondary">
                <i class="fas fa-arrow-left"></i> Batal
            </a>
        </div>
    </form>
</div>
@endsection
