<?php $__env->startSection('title', $family->family_code); ?>
<?php $__env->startSection('page_title', 'Family ' . $family->family_code); ?>
<?php $__env->startSection('breadcrumbs'); ?>
    <li class="breadcrumb-item"><a href="<?php echo e(route('families.index')); ?>">Families</a></li>
    <li class="breadcrumb-item active"><?php echo e($family->family_code); ?></li>
<?php $__env->stopSection(); ?>
<?php $__env->startSection('page_actions'); ?>
    <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('students.create')): ?>
        <a href="<?php echo e(route('students.create', ['family_id' => $family->id])); ?>" class="btn btn-outline-primary"><i class="bi bi-person-plus me-1"></i>Add Student</a>
    <?php endif; ?>
    <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('update', $family)): ?>
        <form method="POST" action="<?php echo e(route('families.create-login', $family)); ?>" class="d-inline" data-confirm="<?php echo e($family->portalUser ? 'Reset the parent login password?' : 'Create a parent-portal login for this family?'); ?>">
            <?php echo csrf_field(); ?>
            <button class="btn btn-outline-secondary"><i class="bi bi-key me-1"></i><?php echo e($family->portalUser ? 'Reset Parent Login' : 'Create Parent Login'); ?></button>
        </form>
        <a href="<?php echo e(route('families.edit', $family)); ?>" class="btn btn-primary"><i class="bi bi-pencil me-1"></i>Edit</a>
    <?php endif; ?>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('content'); ?>
    <div class="row g-3">
        <div class="col-lg-5">
            <div class="card h-100">
                <div class="card-header"><i class="bi bi-people me-1"></i>Family Details</div>
                <div class="card-body">
                    <dl class="row mb-0 small">
                        <dt class="col-5 text-muted">Family Code</dt><dd class="col-7"><?php echo e($family->family_code); ?></dd>
                        <dt class="col-5 text-muted">Father</dt><dd class="col-7"><?php echo e($family->father_name ?: '—'); ?></dd>
                        <dt class="col-5 text-muted">Father CNIC</dt><dd class="col-7"><?php echo e($family->father_cnic ?: '—'); ?></dd>
                        <dt class="col-5 text-muted">Father Mobile</dt><dd class="col-7"><?php echo e($family->father_mobile ?: '—'); ?></dd>
                        <dt class="col-5 text-muted">Occupation</dt><dd class="col-7"><?php echo e($family->father_occupation ?: '—'); ?></dd>
                        <dt class="col-5 text-muted">Mother</dt><dd class="col-7"><?php echo e($family->mother_name ?: '—'); ?></dd>
                        <dt class="col-5 text-muted">Mother Mobile</dt><dd class="col-7"><?php echo e($family->mother_mobile ?: '—'); ?></dd>
                        <dt class="col-5 text-muted">Guardian</dt><dd class="col-7"><?php echo e($family->guardian_name ?: '—'); ?></dd>
                        <dt class="col-5 text-muted">Email</dt><dd class="col-7"><?php echo e($family->email ?: '—'); ?></dd>
                        <dt class="col-5 text-muted">Emergency</dt><dd class="col-7"><?php echo e($family->emergency_contact ?: '—'); ?></dd>
                        <dt class="col-5 text-muted">Address</dt><dd class="col-7"><?php echo e($family->address ?: '—'); ?></dd>
                    </dl>
                </div>
            </div>
        </div>
        <div class="col-lg-7">
            <div class="card h-100">
                <div class="card-header"><i class="bi bi-mortarboard me-1"></i>Students (<?php echo e($family->students->count()); ?>)</div>
                <div class="card-body p-0">
                    <table class="table table-hover align-middle mb-0">
                        <thead><tr><th>Student</th><th>Class</th><th>Status</th><th></th></tr></thead>
                        <tbody>
                            <?php $__empty_1 = true; $__currentLoopData = $family->students; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $student): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                                <tr>
                                    <td>
                                        <div class="d-flex align-items-center gap-2">
                                            <span class="sms-avatar sm"><?php echo e($student->initials); ?></span>
                                            <div>
                                                <a href="<?php echo e(route('students.show', $student)); ?>" class="fw-semibold text-decoration-none"><?php echo e($student->name); ?></a>
                                                <div class="small text-muted"><?php echo e($student->admission_number); ?></div>
                                            </div>
                                        </div>
                                    </td>
                                    <td class="small"><?php echo e($student->schoolClass?->name ?? '—'); ?><?php echo e($student->section ? ' / '.$student->section->name : ''); ?></td>
                                    <td><span class="badge bg-soft-<?php echo e($student->status_color); ?> text-capitalize"><?php echo e(str_replace('_',' ',$student->status)); ?></span></td>
                                    <td class="text-end"><a href="<?php echo e(route('students.show', $student)); ?>" class="btn btn-sm btn-light border">Profile <i class="bi bi-arrow-right"></i></a></td>
                                </tr>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                                <tr><td colspan="4" class="text-center text-muted py-4">No students linked yet.</td></tr>
                            <?php endif; ?>
                        </tbody>
                    </table>
                </div>
            </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/show.blade.php ENDPATH**/ ?>