<?php $__env->startSection('title', 'Manual Entry'); ?>
<?php $__env->startSection('kicker', 'Mark attendance when QR is unavailable'); ?>

<?php $__env->startSection('content'); ?>
    <?php echo $__env->make('partials.module-tabs', ['tabs' => [
        ['label' => 'QR Attendance', 'route' => 'attendance.qr', 'icon' => 'scan-qr-code'],
        ['label' => 'Manual Entry', 'route' => 'attendance.manual', 'icon' => 'list-checks'],
        ['label' => 'Records', 'route' => 'attendance.records', 'icon' => 'clipboard-list'],
        ['label' => 'Today', 'route' => 'attendance.today', 'icon' => 'calendar-check'],
        ['label' => 'Absent', 'route' => 'attendance.absent', 'icon' => 'user-x'],
    ]], array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>

    <div class="content-card mb-3">
        <form method="POST" action="<?php echo e(route('attendance.manual.filter')); ?>" class="row g-3 align-items-end">
            <?php echo csrf_field(); ?>
            <div class="col-lg-4">
                <label class="form-label">Open Service/Event</label>
                <select id="manual-service-id" name="church_service_id" class="form-select">
                    <option value="">Select service/event</option>
                    <?php $__currentLoopData = $openServices; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $service): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                        <option value="<?php echo e($service->id); ?>" <?php if((string) $selectedServiceId === (string) $service->id): echo 'selected'; endif; ?>><?php echo e($service->name); ?> · <?php echo e($service->service_date?->format('d M Y')); ?></option>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                </select>
            </div>
            <div class="col-lg-3">
                <label class="form-label">Search Member</label>
                <input type="search" name="search" value="<?php echo e($filters['search'] ?? ''); ?>" class="form-control" placeholder="Name, phone, code">
            </div>
            <div class="col-lg-3">
                <label class="form-label">Jumuiya</label>
                <select name="jumuiya_id" class="form-select">
                    <option value="">All Jumuiya</option>
                    <?php $__currentLoopData = $jumuiyas; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $jumuiya): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                        <option value="<?php echo e($jumuiya->id); ?>" <?php if((string) ($filters['jumuiya_id'] ?? '') === (string) $jumuiya->id): echo 'selected'; endif; ?>><?php echo e($jumuiya->name); ?></option>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                </select>
            </div>
            <div class="col-lg-2 d-flex gap-2">
                <button class="btn btn-outline-primary flex-fill"><i data-lucide="search"></i><span>Find</span></button>
                <button class="btn btn-outline-secondary" type="submit" name="clear_filters" value="1" title="Clear filters"><i data-lucide="rotate-ccw"></i></button>
            </div>
        </form>
    </div>

    <div class="table-card">
        <div class="table-responsive">
            <table class="table">
                <thead>
                    <tr>
                        <th>Member</th>
                        <th>Code</th>
                        <th>Jumuiya</th>
                        <th>Phone</th>
                        <th>Sacrament</th>
                        <th class="text-end">Action</th>
                    </tr>
                </thead>
                <tbody>
                    <?php $__empty_1 = true; $__currentLoopData = $members; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $member): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                        <tr>
                            <td class="fw-semibold"><?php echo e($member->full_name); ?></td>
                            <td><?php echo e($member->member_code); ?></td>
                            <td><?php echo e($member->jumuiya?->name ?? 'No Jumuiya'); ?></td>
                            <td><?php echo e($member->phone ?? '-'); ?></td>
                            <td><span class="badge <?php echo e($member->is_allowed_sacrament ? 'badge-soft' : 'badge-soft-gold'); ?>"><?php echo e($member->is_allowed_sacrament ? 'Eligible' : 'Not eligible'); ?></span></td>
                            <td class="text-end">
                                <button class="btn btn-sm btn-outline-primary" type="button" data-attendance-member="<?php echo e($member->id); ?>">
                                    <i data-lucide="check"></i>
                                    <span>Mark Present</span>
                                </button>
                            </td>
                        </tr>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                        <tr><td colspan="6"><div class="empty-state">Hakuna active members waliopatikana.</div></td></tr>
                    <?php endif; ?>
                </tbody>
            </table>
        </div>
        <?php echo e($members->links()); ?>

    </div>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.app', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH /var/www/html/anglican/resources/views/attendance/manual.blade.php ENDPATH**/ ?>