<?php $__env->startSection('title', 'Families'); ?>
<?php $__env->startSection('page_title', 'Families'); ?>
<?php $__env->startSection('breadcrumbs'); ?>
    <li class="breadcrumb-item"><a href="<?php echo e(route('dashboard')); ?>">Home</a></li>
    <li class="breadcrumb-item active">Families</li>
<?php $__env->stopSection(); ?>
<?php $__env->startSection('page_actions'); ?>
    <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('update', App\Models\Family::class)): ?>
        <a href="<?php echo e(route('families.father-names')); ?>" class="btn btn-outline-primary"><i class="bi bi-person-vcard me-1"></i>Bulk Father Names</a>
    <?php endif; ?>
    <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('create', App\Models\Family::class)): ?>
        <a href="<?php echo e(route('families.create')); ?>" class="btn btn-primary"><i class="bi bi-plus-lg me-1"></i>Add Family</a>
    <?php endif; ?>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('content'); ?>
    <?php if($siblingsOnly ?? false): ?>
        <div class="alert alert-info d-flex justify-content-between align-items-center py-2">
            <span><i class="bi bi-people-fill me-1"></i>Showing only <b>sibling families</b> (2 or more students) — <?php echo e($families->count()); ?> found.</span>
            <a href="<?php echo e(route('families.index')); ?>" class="btn btn-sm btn-light border"><i class="bi bi-x-lg me-1"></i>Show all families</a>
        </div>
    <?php endif; ?>
    <div class="card">
        <div class="card-header"><i class="bi bi-people me-1"></i><?php echo e(($siblingsOnly ?? false) ? 'Sibling Families' : 'All Families'); ?> (<?php echo e($families->count()); ?>)</div>
        <div class="card-body">
            <div class="table-responsive">
                <table class="table table-hover align-middle js-datatable">
                    <thead>
                        <tr>
                            <th>Family</th><th>Father / Guardian</th><th>Mobile</th>
                            <th class="text-center">Students</th><th>CNIC</th><th class="text-end">Actions</th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php $__currentLoopData = $families; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $family): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                            <tr>
                                <td>
                                    <a href="<?php echo e(route('families.show', $family)); ?>" class="fw-semibold text-decoration-none">
                                        <i class="bi bi-house-heart text-primary me-1"></i><?php echo e($family->family_code); ?>

                                    </a>
                                </td>
                                <td><?php echo e($family->primary_contact_name); ?></td>
                                <td><?php echo e($family->primary_mobile); ?></td>
                                <td class="text-center"><span class="badge bg-soft-primary"><?php echo e($family->students_count); ?></span></td>
                                <td class="small text-muted"><?php echo e($family->father_cnic ?: '—'); ?></td>
                                <td class="text-end">
                                    <a href="<?php echo e(route('families.show', $family)); ?>" class="btn btn-sm btn-light border" title="View"><i class="bi bi-eye"></i></a>
                                    <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('update', $family)): ?>
                                        <a href="<?php echo e(route('families.edit', $family)); ?>" class="btn btn-sm btn-light border" title="Edit"><i class="bi bi-pencil"></i></a>
                                    <?php endif; ?>
                                    <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('delete', $family)): ?>
                                        <form method="POST" action="<?php echo e(route('families.destroy', $family)); ?>" class="d-inline" data-confirm="Delete family <?php echo e($family->family_code); ?>?">
                                            <?php echo csrf_field(); ?> <?php echo method_field('DELETE'); ?>
                                            <button class="btn btn-sm btn-light border text-danger" title="Delete"><i class="bi bi-trash"></i></button>
                                        </form>
                                    <?php endif; ?>
                                </td>
                            </tr>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                    </tbody>
                </table>
            </div>
        </div>
    </div>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.app', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH /home/u385418287/domains/itartificer.com/public_html/sms-erp/resources/views/families/index.blade.php ENDPATH**/ ?>