<?php $__env->startSection('title', $member->full_name); ?>
<?php $__env->startSection('kicker', 'Member profile, QR code and history'); ?>

<?php $__env->startSection('content'); ?>
    <div class="row g-4">
        <div class="col-xl-4">
            <div class="content-card">
                <div class="d-flex align-items-center gap-3 mb-3">
                    <div class="avatar-initials"><?php echo e(strtoupper(substr($member->first_name, 0, 1).substr($member->last_name, 0, 1))); ?></div>
                    <div>
                        <div class="section-title"><?php echo e($member->full_name); ?></div>
                        <div class="text-muted small"><?php echo e($member->member_code); ?></div>
                    </div>
                </div>
                <div class="qr-frame p-3 mb-3">
                    <canvas data-qr-token="<?php echo e($member->qr_token); ?>" data-qr-size="190"></canvas>
                </div>
                <div class="d-flex gap-2">
                    <a href="<?php echo e(route('members.edit', $member)); ?>" class="btn btn-outline-primary flex-fill"><i data-lucide="pencil"></i><span>Edit</span></a>
                    <form method="POST" action="<?php echo e(route('members.regenerate-qr', $member)); ?>" class="flex-fill" data-confirm-delete="QR token ya sasa itaacha kutumika.">
                        <?php echo csrf_field(); ?>
                        <button class="btn btn-outline-secondary w-100"><i data-lucide="refresh-ccw"></i><span>QR</span></button>
                    </form>
                </div>
            </div>
        </div>
        <div class="col-xl-8">
            <div class="content-card mb-4">
                <div class="section-title mb-3">Basic Information</div>
                <div class="row g-3">
                    <div class="col-md-4"><span class="text-muted small">Gender</span><div class="fw-semibold"><?php echo e($member->gender ?? '-'); ?></div></div>
                    <div class="col-md-4"><span class="text-muted small">Phone</span><div class="fw-semibold"><?php echo e($member->phone ?? '-'); ?></div></div>
                    <div class="col-md-4"><span class="text-muted small">Email</span><div class="fw-semibold"><?php echo e($member->email ?? '-'); ?></div></div>
                    <div class="col-md-4"><span class="text-muted small">Jumuiya</span><div class="fw-semibold"><?php echo e($member->jumuiya?->name ?? '-'); ?></div></div>
                    <div class="col-md-4"><span class="text-muted small">Position</span><div class="fw-semibold"><?php echo e($member->position?->name ?? '-'); ?></div></div>
                    <div class="col-md-4"><span class="text-muted small">Status</span><div><span class="badge badge-soft"><?php echo e(ucfirst($member->status)); ?></span></div></div>
                    <div class="col-md-4"><span class="text-muted small">Baptized</span><div class="fw-semibold"><?php echo e($member->is_baptized ? 'Yes' : 'No'); ?></div></div>
                    <div class="col-md-4"><span class="text-muted small">Confirmed</span><div class="fw-semibold"><?php echo e($member->is_confirmed ? 'Yes' : 'No'); ?></div></div>
                    <div class="col-md-4"><span class="text-muted small">Sacrament</span><div class="fw-semibold"><?php echo e($member->is_allowed_sacrament ? 'Allowed' : 'Not allowed'); ?></div></div>
                </div>
            </div>

            <div class="row g-4">
                <div class="col-lg-6">
                    <div class="table-card h-100">
                        <div class="section-title mb-3">Attendance History</div>
                        <?php $__empty_1 = true; $__currentLoopData = $member->attendanceRecords->take(8); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $record): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                            <div class="scan-row">
                                <div>
                                    <strong><?php echo e($record->churchService?->name); ?></strong>
                                    <span><?php echo e($record->attendance_date?->format('d M Y')); ?> · <?php echo e(strtoupper($record->method)); ?></span>
                                </div>
                                <span class="badge badge-soft"><?php echo e(ucfirst($record->status)); ?></span>
                            </div>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                            <div class="empty-state">Hakuna attendance history bado.</div>
                        <?php endif; ?>
                    </div>
                </div>
                <div class="col-lg-6">
                    <div class="table-card h-100">
                        <div class="section-title mb-3">Sacrament History</div>
                        <?php $__empty_1 = true; $__currentLoopData = $member->sacramentRecords->take(8); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $record): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                            <div class="scan-row">
                                <div>
                                    <strong><?php echo e($record->sacramentType?->name); ?></strong>
                                    <span><?php echo e($record->sacrament_date?->format('d M Y')); ?> · <?php echo e($record->churchService?->name); ?></span>
                                </div>
                                <span class="badge badge-soft"><?php echo e(ucfirst(str_replace('_', ' ', $record->status))); ?></span>
                            </div>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                            <div class="empty-state">Hakuna sacrament history bado.</div>
                        <?php endif; ?>
                    </div>
                </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 /var/www/html/anglican/resources/views/members/show.blade.php ENDPATH**/ ?>