<?php
    $layout = auth()->user()->role === 'super_admin' ? 'layouts.admin' : 'layouts.app';
?>



<?php $__env->startSection('title', 'VSLA/Community Groups'); ?>

<?php $__env->startSection('content'); ?>
<div class="container-fluid px-4 py-3">
    <!-- Header -->
    <div class="dashboard-header">
        <div class="container-fluid">
            <div class="row align-items-center dashboard-header-content">
                <div class="col-lg-6">
                    <h1 class="dashboard-title">
                        <i class="fas fa-tachometer-alt" style="color: var(--dhis2-blue-primary);"></i>
                        VSLA/Community Groups
                    </h1>
                    <nav aria-label="breadcrumb">
                        <ol class="breadcrumb">
                            <li class="breadcrumb-item"><a href="javascript:history.back()">Back</a></li>
                            <li class="breadcrumb-item"><a href="<?php echo e(route('component1.dashboard')); ?>">Component 1 Dashboard</a></li>
                            <li class="breadcrumb-item active">Groups</li>
                        </ol>
                    </nav>
                </div>
            </div>
        </div>
    </div>
</div>
<div class="container-fluid py-4">
    <div class="d-flex justify-content-between align-items-center mb-4">
        <h3 class="text-success">Registered VSLA/Community Groups</h3>
        <a href="<?php echo e(route('component1.groups.create')); ?>" class="btn btn-success">
            Register New VSLA/Community Group
        </a>
    </div>

    <?php if(session('success')): ?>
        <div class="alert alert-success"><?php echo e(session('success')); ?></div>
    <?php endif; ?>

    <div class="card border-0 shadow-sm">
        <div class="card-body p-0">
            <div class="table-responsive">
                <table class="table table-hover mb-0">
                    <thead class="table-light">
                        <tr>
                            <th>Name</th>
                            <th>Nature</th>
                            <th>County / Payam</th>
                            <th>Members</th>
                            <th>Formation</th>
                            <th>Actions</th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php $__empty_1 = true; $__currentLoopData = $groups; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $group): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                            <tr>
                                <td><?php echo e($group->name); ?></td>
                                <td>
                                    <span class="badge bg-<?php echo e($group->nature == 'new' ? 'warning' : ($group->nature == 'progressing' ? 'info' : 'success')); ?>">
                                        <?php echo e(ucfirst($group->nature)); ?>

                                    </span>
                                </td>
                                <td><?php echo e($group->county); ?> / <?php echo e($group->payam); ?></td>
                                <td><?php echo e($group->members_count); ?></td>
                                <td><?php echo e($group->date_formation->format('M Y')); ?></td>
                                <td>
                                    <a href="<?php echo e(route('component1.groups.show', $group)); ?>" class="btn btn-sm btn-outline-primary">View</a>
                                    <a href="<?php echo e(route('component1.groups.edit', $group)); ?>" class="btn btn-sm btn-outline-secondary">Edit</a>
                                    <?php if(auth()->user()->role === 'component_1_supervisor'): ?>
                                        <form action="<?php echo e(route('component1.groups.destroy', $group)); ?>" method="POST" class="d-inline">
                                            <?php echo csrf_field(); ?> <?php echo method_field('DELETE'); ?>
                                            <button type="submit" class="btn btn-sm btn-outline-danger" onclick="return confirm('Delete this group?')">Delete</button>
                                        </form>
                                    <?php endif; ?>
                                </td>
                            </tr>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                            <tr>
                                <td colspan="6" class="text-center text-muted py-4">
                                    No groups registered yet.
                                </td>
                            </tr>
                        <?php endif; ?>
                    </tbody>
                </table>
            </div>
        </div>
    </div>

    <div class="mt-4">
        <?php echo e($groups->links()); ?>

    </div>
</div>
<?php $__env->stopSection(); ?>
<?php echo $__env->make($layout, array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH C:\wampserver64\www\sswseepcomponents\resources\views/component1/groups/index.blade.php ENDPATH**/ ?>