

<?php $__env->startSection('page_title', 'Edit Announcement'); ?>

<?php $__env->startSection('content'); ?>
    <div class="row">
        <div class="col-lg-12">
            <div class="mb-4">
                <a href="<?php echo e(route('admin.announcements.index')); ?>" class="text-decoration-none text-muted small">
                    <i class="bi bi-arrow-left me-1"></i> Back to announcements
                </a>
            </div>

            <div class="card border-0 shadow-sm">
                <div class="card-header bg-white border-bottom p-4">
                    <h5 class="fw-bold mb-0">Edit Announcement</h5>
                </div>
                <div class="card-body p-4">
                    <form action="<?php echo e(route('admin.announcements.update', $announcement->id)); ?>" method="POST">
                        <?php echo csrf_field(); ?>
                        <?php echo method_field('PUT'); ?>

                        <div class="row mb-4">
                            <div class="col-md-8">
                                <label class="form-label fw-bold small text-uppercase text-muted">Title</label>
                                <input type="text" name="title" class="form-control"
                                    value="<?php echo e(old('title', $announcement->title)); ?>" required>
                            </div>
                            <div class="col-md-4">
                                <label class="form-label fw-bold small text-uppercase text-muted">Type</label>
                                <select name="type" class="form-select" required>
                                    <option value="general" <?php echo e($announcement->type == 'general' ? 'selected' : ''); ?>>General
                                    </option>
                                    <option value="policy" <?php echo e($announcement->type == 'policy' ? 'selected' : ''); ?>>Policy
                                    </option>
                                    <option value="event" <?php echo e($announcement->type == 'event' ? 'selected' : ''); ?>>Event
                                    </option>
                                    <option value="holiday" <?php echo e($announcement->type == 'holiday' ? 'selected' : ''); ?>>Holiday
                                    </option>
                                </select>
                            </div>
                        </div>

                        <div class="mb-4">
                            <label class="form-label fw-bold small text-uppercase text-muted">Content</label>
                            <textarea name="content" class="form-control" rows="6" required><?php echo e(old('content', $announcement->content)); ?></textarea>
                        </div>

                        <div class="row mb-4">
                            <div class="col-md-6">
                                <label class="form-label fw-bold small text-uppercase text-muted">Expiry Date</label>
                                <input type="date" name="expires_at" class="form-control"
                                    value="<?php echo e($announcement->expires_at ? $announcement->expires_at->format('Y-m-d') : ''); ?>">
                            </div>
                            <div class="col-md-6 pt-4">
                                <div class="form-check form-switch card p-3 border-0 bg-light">
                                    <input class="form-check-input ms-0 me-3" type="checkbox" name="is_active"
                                        id="isActive" <?php echo e($announcement->is_active ? 'checked' : ''); ?>>
                                    <label class="form-check-label fw-bold small text-uppercase" for="isActive">Publicly
                                        Active</label>
                                </div>
                            </div>
                        </div>

                        <div class="d-flex justify-content-end gap-2 border-top pt-4">
                            <a href="<?php echo e(route('admin.announcements.index')); ?>" class="btn btn-light px-4">Cancel</a>
                            <button type="submit" class="btn btn-primary px-4">Update Announcement</button>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.admin', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH G:\wamp64\www\projects\attendance\resources\views/admin/announcements/edit.blade.php ENDPATH**/ ?>