<?php $__env->startSection('title', 'Committee Accounts'); ?>

<?php $__env->startSection('content'); ?>
<div class="pg-head">
    <div>
        <h1>Committee Accounts</h1>
        <p>Register staff who can sign in to MeXCo Attend and verify participants for this event.</p>
    </div>
    <div class="pg-actions">
        <a href="<?php echo e($attendUrl); ?>" class="btn-outline" target="_blank" rel="noopener">Open MeXCo Attend ↗</a>
        <a href="<?php echo e(route('mexco.admin.committee.create')); ?>" class="btn-purple">+ Register committee</a>
    </div>
</div>

<div class="card" style="padding:1rem 1.15rem;margin-bottom:1rem;background:#F8FAFC">
    <div style="font-size:.875rem;color:var(--muted);line-height:1.5">
        Committee members sign in at <strong style="color:var(--ink)">MeXCo Attend</strong> with their
        <strong style="color:var(--ink)">email</strong> and <strong style="color:var(--ink)">IC number</strong>.
        They only see this event (and any other events you register them for).
    </div>
</div>

<div class="card">
    <form method="GET" class="filter-bar">
        <input type="search" name="q" value="<?php echo e($q); ?>" class="filter-search" placeholder="Search by name, email or IC…">
        <button type="submit" class="filter-btn">
            <svg width="16" height="16" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24"><path d="M4 6h16M7 12h10M10 18h4"/></svg>
            Search
        </button>
    </form>

    <div class="tbl-wrap">
        <table class="data-tbl">
            <thead>
                <tr>
                    <th>Name</th>
                    <th>Email</th>
                    <th>IC / ID</th>
                    <th>Roles</th>
                    <th>Organisation</th>
                    <th style="text-align:right">Actions</th>
                </tr>
            </thead>
            <tbody>
                <?php $__empty_1 = true; $__currentLoopData = $people; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $p): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                    <?php
                        $role = strtoupper($p['role'] ?? 'VISITOR');
                        $color = $roleColors[$role] ?? '#6366F1';
                        $committeeColor = $roleColors['COMMITTEE'] ?? '#5B21B6';
                    ?>
                    <tr>
                        <td>
                            <div class="cell-name"><?php echo e($p['name']); ?></div>
                            <?php if(!empty($p['phone'])): ?>
                                <div class="cell-sub"><?php echo e($p['phone']); ?></div>
                            <?php endif; ?>
                        </td>
                        <td><?php echo e($p['email']); ?></td>
                        <td><span class="mono" style="font-size:.82rem"><?php echo e($p['ic'] ?: '-'); ?></span></td>
                        <td>
                            <span class="status-pill" style="background:<?php echo e($color); ?>20;color:<?php echo e($color); ?>"><?php echo e($role); ?></span>
                            <span class="status-pill" style="background:<?php echo e($committeeColor); ?>20;color:<?php echo e($committeeColor); ?>;margin-left:.25rem">COMMITTEE</span>
                        </td>
                        <td><?php echo e($p['org'] ?: '-'); ?></td>
                        <td style="text-align:right;white-space:nowrap">
                            <a href="<?php echo e(route('mexco.admin.committee.edit', $p['slug'])); ?>" class="icon-btn" title="Edit">
                                <svg width="16" height="16" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24"><path d="M12 20h9"/><path d="M16.5 3.5a2.1 2.1 0 013 3L7 19l-4 1 1-4L16.5 3.5z"/></svg>
                            </a>
                            <form method="POST" action="<?php echo e(route('mexco.admin.committee.destroy', $p['slug'])); ?>" class="d-inline" onsubmit="return confirm('Remove committee access? Their participant role will be kept.')">
                                <?php echo csrf_field(); ?>
                                <?php echo method_field('DELETE'); ?>
                                <button type="submit" class="icon-btn" title="Remove committee access" style="color:#DC2626">
                                    <svg width="16" height="16" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24"><path d="M3 6h18M8 6V4h8v2M19 6l-1 14H6L5 6"/></svg>
                                </button>
                            </form>
                        </td>
                    </tr>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                    <tr>
                        <td colspan="6" style="text-align:center;padding:3rem;color:var(--muted)">
                            No committee accounts yet.
                            <a href="<?php echo e(route('mexco.admin.committee.create')); ?>" style="color:var(--primary);font-weight:600">Register the first one</a>
                        </td>
                    </tr>
                <?php endif; ?>
            </tbody>
        </table>
    </div>
</div>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('admin.layout', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH C:\laragon\www\myapp\resources\views/admin/committee/index.blade.php ENDPATH**/ ?>