<style>
    :root {
        --primary-color: #1a4f8a;
        --secondary-color: #2c7be5;
        --accent-color: #4c9aff;
        --success-color: #28a745;
        --warning-color: #ffc107;
        --danger-color: #dc3545;
        --light-bg: #f8f9fc;
        --card-bg: #ffffff;
        --text-primary: #2d3748;
        --text-secondary: #718096;
        --border-color: #e2e8f0;
        --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
        --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
        --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
        --border-radius: 8px;
    }
    body {
        background-color: var(--light-bg);
        color: var(--text-primary);
        font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
        padding-left: 1%;
        padding-right: 1%;
    }
    .container-fluid {
        max-width: 1400px;
        padding-left: 0 !important;
        padding-right: 0 !important;
    }
    .section-title {
        border-left: 4px solid var(--primary-color);
        padding-left: 12px;
        margin-bottom: 16px;
        font-weight: 600;
        font-size: clamp(1.1rem, 1.5vw, 1.3rem);
        color: var(--primary-color);
        display: flex;
        align-items: center;
    }
    .section-title::before {
        content: "";
        display: inline-block;
        width: 8px;
        height: 8px;
        background-color: var(--accent-color);
        border-radius: 50%;
        margin-right: 10px;
    }
    .profile-card {
        background: var(--card-bg);
        border-radius: var(--border-radius);
        box-shadow: var(--shadow-md);
        padding: 18px;
        margin-bottom: 20px;
        border: 1px solid var(--border-color);
    }
    .profile-card .form-control-plaintext {
        background: var(--light-bg);
        padding: 8px 12px;
        border-radius: 6px;
        border: 1px solid var(--border-color);
        color: var(--text-primary);
        font-weight: 500;
    }
    .btn-styled {
        border-radius: 6px;
        font-weight: 500;
        padding: 6px 14px;
        box-shadow: var(--shadow-sm);
        vertical-align: middle;
        transition: all 0.2s ease;
    }
    .btn-styled:hover {
        transform: translateY(-2px);
        box-shadow: var(--shadow-md);
    }
    .btn-outline-primary {
        color: var(--primary-color);
        border-color: var(--primary-color);
    }
    .btn-outline-primary:hover {
        background-color: var(--primary-color);
        color: white;
    }
    .btn-outline-secondary {
        color: var(--text-secondary);
        border-color: var(--border-color);
    }
    .btn-outline-secondary:hover {
        background-color: var(--text-secondary);
        color: white;
    }
    .profile-photo {
        box-shadow: var(--shadow-lg);
        border-radius: 50%;
        object-fit: cover;
        border: 4px solid white;
    }
    .table {
        background-color: var(--card-bg);
        border-radius: var(--border-radius);
        overflow: hidden;
        box-shadow: var(--shadow-md);
    }
    .table th,
    .table td {
        vertical-align: middle;
        padding: 10px 12px;
        white-space: nowrap;
    }
    .table thead th {
        background-color: var(--primary-color);
        color: white;
        font-weight: 600;
        border: none;
        text-transform: uppercase;
        font-size: 0.85rem;
        letter-spacing: 0.5px;
        position: sticky;
        top: 0;
        z-index: 10;
    }
    .table tbody tr {
        border-bottom: 1px solid var(--border-color);
    }
    .table tbody tr:last-child {
        border-bottom: none;
    }
    .table tbody tr:hover {
        background-color: rgba(76, 154, 255, 0.05);
    }
    .badge {
        padding: 4px 8px;
        font-weight: 500;
        border-radius: 4px;
    }
    .member-info-card {
        background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
        border-radius: var(--border-radius);
        color: white;
        padding: 20px;
        margin-bottom: 20px;
        box-shadow: var(--shadow-lg);
        position: relative;
        overflow: hidden;
    }
    .member-info-card::after {
        content: "";
        position: absolute;
        top: -50px;
        right: -50px;
        width: 150px;
        height: 150px;
        background: rgba(255, 255, 255, 0.1);
        border-radius: 50%;
        z-index: 1;
    }
    .watermark {
        position: absolute;
        bottom: 10px;
        right: 15px;
        font-size: 1.5rem;
        font-weight: 700;
        color: rgba(255, 255, 255, 0.2);
        z-index: 2;
        pointer-events: none;
    }
    .member-info-card .row {
        position: relative;
        z-index: 3;
    }
    .member-id {
        background: rgba(255, 255, 255, 0.2);
        padding: 5px 10px;
        border-radius: 20px;
        display: inline-block;
        margin-top: 10px;
        cursor: pointer;
        transition: background 0.2s ease;
    }
    .member-id:hover {
        background: rgba(255, 255, 255, 0.3);
    }
    .data-card {
        background: var(--card-bg);
        border-radius: var(--border-radius);
        box-shadow: var(--shadow-md);
        padding: 16px;
        margin-bottom: 16px;
        border: 1px solid var(--border-color);
        transition: transform 0.2s ease, box-shadow 0.2s ease;
    }
    .data-card:hover {
        transform: translateY(-3px);
        box-shadow: var(--shadow-lg);
    }
    .data-label {
        font-size: 0.85rem;
        color: var(--text-secondary);
        margin-bottom: 4px;
        font-weight: 500;
    }
    .data-value {
        font-size: 1.1rem;
        color: var(--text-primary);
        font-weight: 600;
    }
    .signature-card {
        background: var(--light-bg);
        border: 1px dashed var(--border-color);
        border-radius: var(--border-radius);
        padding: 16px;
        text-align: center;
        margin-top: 20px;
    }
    .status-indicator {
        display: inline-block;
        width: 10px;
        height: 10px;
        border-radius: 50%;
        margin-right: 6px;
    }
    .status-active {
        background-color: var(--success-color);
    }
    .status-inactive {
        background-color: var(--danger-color);
    }
    .status-pending {
        background-color: var(--warning-color);
    }
    /* Reduced padding for rows and columns */
    .row {
        margin-left: -8px !important;
        margin-right: -8px !important;
    }
    .row > [class*="col-"] {
        padding-left: 8px !important;
        padding-right: 8px !important;
    }
    /* Table scroll styles */
    .table-responsive {
        border-radius: var(--border-radius);
        overflow: hidden;
        max-height: 400px;
        overflow-y: auto;
        overflow-x: auto;
        position: relative;
    }
    /* Custom scrollbar */
    .table-responsive::-webkit-scrollbar {
        width: 8px;
        height: 8px;
    }
    .table-responsive::-webkit-scrollbar-track {
        background: #f1f1f1;
        border-radius: 4px;
    }
    .table-responsive::-webkit-scrollbar-thumb {
        background: #888;
        border-radius: 4px;
    }
    .table-responsive::-webkit-scrollbar-thumb:hover {
        background: #555;
    }
    /* For horizontal scroll */
    .table-responsive::-webkit-scrollbar {
        width: 8px;
        height: 8px;
    }
    @media (max-width: 768px) {
        .table-responsive {
            border-radius: var(--border-radius);
            overflow: hidden;
            max-height: 300px;
        }
        
        .member-info-card {
            padding: 16px;
        }
        
        .watermark {
            font-size: 1.2rem;
            bottom: 8px;
            right: 10px;
        }
        
        .profile-card {
            padding: 14px;
        }
        
        .btn-styled {
            width: 100%;
            margin-bottom: 8px;
        }
        
        .row {
            margin-left: -6px !important;
            margin-right: -6px !important;
        }
        
        .row > [class*="col-"] {
            padding-left: 6px !important;
            padding-right: 6px !important;
        }
    }
</style>
<div class="container-fluid px-0 py-3">
    <div class="row mt-1 mx-0 g-2">
        
        <div class="col-12 d-flex justify-content-end gap-2 flex-wrap mb-2 px-0">
            <button class="btn btn-outline-primary btn-styled" data-bs-toggle="modal"
                data-bs-target="#updateProfileModal">
                <i class="ti ti-password-user me-1"></i> Update Photo
            </button>
            <button class="btn btn-outline-secondary btn-styled" data-bs-toggle="modal"
                data-bs-target="#updateSignatureModal">
                <i class="ti ti-certificate me-1"></i> Update Signature
            </button>
            <a href="<?php echo e(route('view_pdf', $member->id)); ?>" target="_blank"
                class="btn btn-primary btn-styled text-white">
                <i class="ti ti-file-text me-1"></i> Summary PDF
            </a>
            <a href="<?php echo e(route('view_pdf_personal', $member->id)); ?>" target="_blank"
                class="btn btn-info btn-styled text-white">
                <i class="ti ti-user me-1"></i> Personal Details PDF
            </a>
        </div>
        
        <div class="col-12 mb-3 px-0">
            <div class="member-info-card">
                <div class="watermark">SWOAD</div>
                <div class="row align-items-center">
                    <div class="col-md-3 text-center">
                        <img src="../memberimages/<?php echo e($member->profiePhoto); ?>?v=<?php echo e($user->updated_at->timestamp ?? time()); ?>" alt="Profile Photo" 
                            height="160px" width="160px" class="profile-photo">
                    </div>
                    <div class="col-md-9">
                        <h2 class="fw-bold mb-2 text-white"><?php echo e($member->title); ?>. <?php echo e($member->firstName); ?> <?php echo e($member->lastName); ?>

                        </h2>
                        <div class="d-flex flex-wrap align-items-center gap-3">
                            <div>
                                <span class="member-id selectable text-white" 
                                   onclick="copyMemberUniqueId('<?php echo e($member->uniqueId); ?>')"
                                   title="Click to copy Member Unique ID">
                                    <i class="ti ti-id me-1"></i> <?php echo e($member->uniqueId); ?>

                                </span>
                            </div>
                            <div>
                                <?php
                                    $statusValue = $member->status;
                                    $isActive = ($statusValue == 1);
                                    $statusText = $isActive ? 'Active' : 'Inactive';
                                    $statusClass = $isActive ? 'status-active' : 'status-inactive';
                                ?>
                                <span class="status-indicator <?php echo e($statusClass); ?>"></span>
                                <span class="text-white"><?php echo e($statusText); ?></span>
                            </div>
                            <div class="text-white">
                                <i class="ti ti-calendar me-1"></i> 
                                Member since: <?php echo e($member->created_at ? date('M Y', strtotime($member->created_at)) : '-'); ?>

                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        
        <div class="col-12 mb-3 px-0">
            <div class="profile-card">
                <div class="section-title">Member Details / அங்கத்தவர் விபரம்</div>
                
                <div class="row">
                    <?php
                        use Carbon\Carbon;
                        $ageString = '-';
                        if (!empty($member->dateOfBirth)) {
                            try {
                                $dob = Carbon::parse($member->dateOfBirth)->startOfDay();
                                $now = Carbon::now()->startOfDay();
                                $diff = $dob->diff($now);
                                $years = $diff->y;
                                $months = $diff->m;
                                $days = $diff->d;
                                $ageString = "{$years} years, {$months} months";
                            } catch (\Exception $e) {
                                $ageString = '-';
                            }
                        }
                    ?>
                    
                    
                    <div class="col-12 mb-3">
                        <h5 class="mb-2 text-primary">Personal Information</h5>
                        <div class="row g-2">
                            <div class="col-md-6 col-lg-4">
                                <div class="data-card">
                                    <div class="data-label">First Name / முதற்பெயர்</div>
                                    <div class="data-value"><?php echo e($member->firstName); ?></div>
                                </div>
                            </div>
                            <div class="col-md-6 col-lg-4">
                                <div class="data-card">
                                    <div class="data-label">Last Name / கடைசி பெயர்</div>
                                    <div class="data-value"><?php echo e($member->lastName); ?></div>
                                </div>
                            </div>
                            <div class="col-md-6 col-lg-4">
                                <div class="data-card">
                                    <div class="data-label">NIC / தே.அ. இலக்கம்</div>
                                    <div class="data-value"><?php echo e($member->nicNumber); ?></div>
                                </div>
                            </div>
                            <div class="col-md-6 col-lg-4">
                                <div class="data-card">
                                    <div class="data-label">NIC Issue Date / தே.அ. வழங்கப்பட்ட திகதி</div>
                                    <div class="data-value"><?php echo e($member->nicIssueDate); ?></div>
                                </div>
                            </div>
                            <div class="col-md-6 col-lg-4">
                                <div class="data-card">
                                    <div class="data-label">Gender / பால் நிலை</div>
                                    <div class="data-value"><?php echo e($member->gender); ?></div>
                                </div>
                            </div>
                            <div class="col-md-6 col-lg-4">
                                <div class="data-card">
                                    <div class="data-label">Marital Status / திருமண நிலை</div>
                                    <div class="data-value"><?php echo e($member->maritalStatus); ?></div>
                                </div>
                            </div>
                            <div class="col-md-6 col-lg-4">
                                <div class="data-card">
                                    <div class="data-label">Date of Birth / பிறந்த தேதி</div>
                                    <div class="data-value"><?php echo e($member->dateOfBirth ? Carbon::parse($member->dateOfBirth)->format('d-m-Y') : '-'); ?></div>
                                </div>
                            </div>
                            <div class="col-md-6 col-lg-4">
                                <div class="data-card">
                                    <div class="data-label">Age / வயது</div>
                                    <div class="data-value"><?php echo e($ageString); ?></div>
                                </div>
                            </div>
                            <div class="col-md-6 col-lg-4">
                                <div class="data-card">
                                    <div class="data-label">Phone Number / தொலைபேசி இலக்கம்</div>
                                    <div class="data-value"><?php echo e($member->phoneNumber); ?></div>
                                </div>
                            </div>
                        </div>
                    </div>
                    
                    
                    <div class="col-12 mb-3">
                        <h5 class="mb-2 text-primary">Account Information</h5>
                        <div class="row g-2">
                            <div class="col-md-6 col-lg-4">
                                <div class="data-card">
                                    <div class="data-label">New Account Number / புதிய க. இலக்கம்</div>
                                    <div class="data-value"><?php echo e($member->newAccountNumber); ?></div>
                                </div>
                            </div>
                            <div class="col-md-6 col-lg-4">
                                <div class="data-card">
                                    <div class="data-label">Old Account Number / பழைய க. இலக்கம்</div>
                                    <div class="data-value"><?php echo e($member->oldAccountNumber); ?></div>
                                </div>
                            </div>
                            <div class="col-md-6 col-lg-4">
                                <div class="data-card">
                                    <div class="data-label">Status / நிலை</div>
                                    <div class="data-value">
                                        <?php if($member->status == 1): ?>
                                            <span class="badge bg-label-success">Active</span>
                                        <?php else: ?>
                                            <span class="badge bg-label-danger">Inactive</span>
                                        <?php endif; ?>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    
                    
                    <div class="col-12 mb-3">
                        <h5 class="mb-2 text-primary">Location Information</h5>
                        <div class="row g-2">
                            <div class="col-md-6 col-lg-4">
                                <div class="data-card">
                                    <div class="data-label">Address / முகவரி</div>
                                    <div class="data-value"><?php echo e($member->address); ?></div>
                                </div>
                            </div>
                            <div class="col-md-6 col-lg-4">
                                <div class="data-card">
                                    <div class="data-label">Division / பிரதேசம்</div>
                                    <div class="data-value"><?php echo e(optional($member->division)->divisionName ?? '-'); ?></div>
                                </div>
                            </div>
                            <div class="col-md-6 col-lg-4">
                                <div class="data-card">
                                    <div class="data-label">Village / கிராமம்</div>
                                    <div class="data-value"><?php echo e(optional($member->village)->villageName ?? '-'); ?></div>
                                </div>
                            </div>
                            <div class="col-md-6 col-lg-4">
                                <div class="data-card">
                                    <div class="data-label">GN Division / கிராம சேவையாளர் பிரிவு</div>
                                    <div class="data-value"><?php echo e(optional($member->gnDivision)->gnDivisionName ?? '-'); ?></div>
                                </div>
                            </div>
                            <div class="col-md-6 col-lg-4">
                                <div class="data-card">
                                    <div class="data-label">Group Name / குழுவின் பெயர்</div>
                                    <div class="data-value"><?php echo e(optional($member->smallgroup)->smallGroupName ?? '-'); ?></div>
                                </div>
                            </div>
                        </div>
                    </div>
                    
                    
                    <div class="col-12 mb-3">
                        <h5 class="mb-2 text-primary">Professional Information</h5>
                        <div class="row g-2">
                            <div class="col-md-6 col-lg-4">
                                <div class="data-card">
                                    <div class="data-label">Profession Type / தொழில் பிரிவு</div>
                                    <div class="data-value"><?php echo e(optional(collect($getPro)->firstWhere('id', $member->profession))->name ?? '-'); ?></div>
                                </div>
                            </div>
                            <div class="col-md-6 col-lg-4">
                                <div class="data-card">
                                    <div class="data-label">Profession / தொழில்</div>
                                    <div class="data-value"><?php echo e(optional(collect($getSubPro)->firstWhere('id', $member->subprofession))->name ?? '-'); ?></div>
                                </div>
                            </div>
                        </div>
                    </div>
                    
                    
                    <div class="col-12 mb-3">
                        <div class="section-title">Follower Information / பின்னுருத்தளி விபரம்</div>
                        <div class="row g-2">
                            <div class="col-md-6 col-lg-4">
                                <div class="data-card">
                                    <div class="data-label">Follower Name / பின்னுருத்தளி பெயர்</div>
                                    <div class="data-value"><?php echo e($member->followerName); ?></div>
                                </div>
                            </div>
                            <div class="col-md-6 col-lg-4">
                                <div class="data-card">
                                    <div class="data-label">Follower NIC / பின்னுருத்தளி தே.அ. இலக்கம்</div>
                                    <div class="data-value"><?php echo e($member->followerNicNumber); ?></div>
                                </div>
                            </div>
                            <div class="col-md-6 col-lg-4">
                                <div class="data-card">
                                    <div class="data-label">NIC Issue Date / தே.அ. வழங்கப்பட்ட திகதி</div>
                                    <div class="data-value"><?php echo e($member->followerIssueDate); ?></div>
                                </div>
                            </div>
                            <div class="col-md-6 col-lg-4">
                                <div class="data-card">
                                    <div class="data-label">Follower Address / பின்னுருத்தளி முகவரி</div>
                                    <div class="data-value"><?php echo e($member->followerAddress); ?></div>
                                </div>
                            </div>
                        </div>
                    </div>
                    
                    
                    <div class="col-12">
                        <div class="signature-card">
                            <label class="fw-semibold d-block mb-2">Signature / கையொப்பம்</label>
                            <img src="<?php echo e(asset('memberimages/' . $member->signature)); ?>?v=<?php echo e($user->updated_at->timestamp ?? time()); ?>" alt="Signature"
                                class="border rounded shadow-sm mt-1" height="90" width="230">
                        </div>
                    </div>
                </div>
            </div>
        </div>
        
        <div class="col-12 mb-3 px-0">
            <div class="row g-2">
                <div class="col-md-4">
                    <div class="data-card text-center">
                        <div class="data-label">Total Savings</div>
                        <div class="data-value text-primary"><?php echo e($getSavings->totalAmount); ?></div>
                    </div>
                </div>
                <div class="col-md-4">
                    <div class="data-card text-center">
                        <div class="data-label">Active Loans</div>
                        <div class="data-value text-info"><?php echo e(count($getDataActive)); ?></div>
                    </div>
                </div>
                <div class="col-md-4">
                    <div class="data-card text-center">
                        <div class="data-label">Guarantor For</div>
                        <div class="data-value text-success"><?php echo e(count($getGurDetails)); ?></div>
                    </div>
                </div>
            </div>
        </div>
        
        <div class="col-12 mb-3 px-0">
            <div class="profile-card">
                <div class="section-title">Saving Details / சேமிப்பு விவரங்கள்</div>
                <div class="table-responsive">
                    <table class="table table-striped table-bordered text-center">
                        <thead>
                            <tr>
                                <th>#</th>
                                <th>ID</th>
                                <th>Total Saving Amount</th>
                                <th></th>
                            </tr>
                        </thead>
                        <tbody>
                            <?php
                                $count = 1;
                            ?>
                            <tr>
                                <?php
                                    $encId = Crypt::encrypt($getSavings->savingsId);
                                ?>
                                <td><?php echo e($count++); ?></td>
                                <td class="fw-bold"><a href="<?php echo e(route('view_saving_history',  $encId)); ?>">
                        <?php echo e($getSavings->savingsId); ?></a></td>
                                <td class="fw-bold"><?php echo e($getSavings->totalAmount); ?></td>
                                <td>
                                    <a href="<?php echo e(route('view_saving_history', $encId)); ?>" class="btn btn-sm btn-primary">
                                        <i class="ti ti-eye me-1"></i> View History
                                    </a>
                                </td>
                            </tr>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
        
        <div class="col-12 mb-3 px-0">
            <div class="profile-card">
                <div class="section-title">Loan Details / கடன் விவரங்கள்</div>
                <div class="table-responsive">
                    <table class="table table-bordered table-hover text-center">
                        <thead>
                            <tr>
                                <th>#</th>
                                <th>Loan ID</th>
                                <th>Purpose</th>
                                <th>Term</th>
                                <th>Interest</th>
                                <th>Amount</th>
                                <th>Paid</th>
                                <th>Balance</th>
                                <th>Status</th>
                                <th>Actions</th>
                            </tr>
                        </thead>
                        <tbody>
                            <?php $count = 1; ?>
                            <?php $__empty_1 = true; $__currentLoopData = $getDataActive; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $data): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                                <?php
                                    $loanEncId = Crypt::encrypt($data->id);
                                    $monthlyPaymentTotal = 0;
                                    foreach ($getLoanScheduleData as $schedule) {
                                        if ($schedule->loanId == $data->id && $schedule->status == 'paid') {
                                            $monthlyPaymentTotal += $schedule->monthlyPayment;
                                        }
                                    }
                                    $totalPayAmount = 0;
                                    $totalPrincipalArreas = 0;
                                    $totalInterestArreas = 0;
                                    $totalArreasAmount = null;
                                    foreach ($getRepaymentData as $repayment) {
                                        if ($repayment->loanId == $data->id) {
                                            $totalPayAmount += $repayment->repaymentAmount;
                                            $totalPrincipalArreas += $repayment->principalAmount;
                                            $totalInterestArreas += $repayment->interest;
                                            if (
                                                $totalArreasAmount === null ||
                                                $repayment->lastLoanBalance < $totalArreasAmount
                                            ) {
                                                $totalArreasAmount = $repayment->lastLoanBalance;
                                            }
                                        }
                                    }
                                    $totalArreasAmount ??= 0;
                                    $statusClass = match ($data->loanStatus) {
                                        'Active' => 'bg-success',
                                        'Rejected' => 'bg-danger',
                                        default => 'bg-primary',
                                    };
                                ?>
                                <tr>
                                    <td><?php echo e($count++); ?></td>
                                    <td class="fw-bold"><a href="<?php echo e(route('view_loan_details', $loanEncId)); ?>"><?php echo e($data->loanId); ?></a></td>
                                    <td class="fw-bold"><?php echo e($getLoanPurpose->firstWhere('id', $data->loanPurpose)?->name ?? '-'); ?></td>
                                    <td class="fw-bold"><?php echo e($data->loanterm); ?></td>
                                    <td class="fw-bold"><?php echo e($data->interestRate); ?>%</td>
                                    <td class="fw-bold"><?php echo e(number_format($data->principal, 2)); ?></td>
                                    <td class="fw-bold"><?php echo e(number_format($totalPayAmount, 2)); ?></td>
                                    <td class="fw-bold"><?php echo e(number_format($totalArreasAmount, 2)); ?></td>
                                    <td><span class="badge <?php echo e($statusClass); ?>"><?php echo e($data->loanStatus); ?></span></td>
                                    <td>
                                        <a href="<?php echo e(route('view_loan_details', $loanEncId)); ?>" class="btn btn-sm btn-primary">
                                            <i class="ti ti-eye me-1"></i> View
                                        </a>
                                    </td>
                                </tr>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                                <tr>
                                    <td colspan="10" class="text-muted">No loan records found.</td>
                                </tr>
                            <?php endif; ?>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
        
        <div class="col-12 mb-3 px-0">
            <div class="profile-card">
                <div class="section-title">Guarantor Details / உத்தரவாததாரர் விவரங்கள்</div>
                <div class="table-responsive">
                    <table class="table table-striped table-bordered text-center">
                        <thead>
                            <tr>
                                <th>#</th>
                                <th>Name</th>
                                <th>NIC</th>
                                <th>Loan ID</th>
                                <th>Loan Amount</th>
                                <th>Saving Amount</th>
                                <th>Actions</th>
                            </tr>
                        </thead>
                        <tbody>
                            <?php
                                $count = 1;
                                $allGurData = collect($getGurDetails);
                            ?>
                            <?php if($allGurData->isNotEmpty()): ?>
                                <?php $__currentLoopData = $allGurData; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $gur): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                    <?php
                                        // Determine the correct ID field
                                        $guarantorId = $gur->memberId ?? ($gur->gurrantos ?? null);
                                        $guarantor = $getAllMemberData->firstWhere('id', $guarantorId);
                                    ?>
                                    <tr>
                                        <td><?php echo e($count++); ?></td>
                                        <td>
                                            <?php if($guarantor): ?>
                                                <?php echo e($guarantor->firstName ?? '-'); ?> <?php echo e($guarantor->lastName ?? ''); ?>

                                            <?php else: ?>
                                                -
                                            <?php endif; ?>
                                        </td>
                                        <td><?php echo e($guarantor->nicNumber ?? '-'); ?></td>
                                        <td><?php echo e($gur->loanId); ?></td>
                                        <td><?php echo e(number_format($gur->principal, 2)); ?></td>
                                        <td><?php echo e(number_format($gur->savingAmount ?? 0, 2)); ?></td>
                                        <td>
                                            <?php if($guarantor): ?>
                                                <a href="<?php echo e(route('view_member', encrypt($guarantor->id))); ?>" class="btn btn-sm btn-primary">
                                                    <i class="ti ti-user me-1"></i> View
                                                </a>
                                            <?php endif; ?>
                                        </td>
                                    </tr>
                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                            <?php else: ?>
                                <tr>
                                    <td colspan="7" class="text-muted">No guarantor data available.</td>
                                </tr>
                            <?php endif; ?>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
        
        <div class="col-12 mb-3 px-0">
            <div class="profile-card">
                <div class="section-title">Feedback Details / கருத்து விவரங்கள்</div>
                <div class="table-responsive">
                    <table class="table table-striped table-bordered text-center">
                        <thead>
                            <tr>
                                <th>#</th>
                                <th>Id</th>
                                <th>Staff Name</th>
                                <th>Date & Time</th>
                                <th>Title</th>
                                <th>Description</th>
                            </tr>
                        </thead>
                        <tbody>
                            <?php
                                $count = 1;
                            ?>
                            <?php $__currentLoopData = $getMemberNotes; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $note): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <tr>
                                    <td><?php echo e($count++); ?></td>
                                    <td><?php echo e($note->randomId); ?></td>
                                    <td>
                                        <?php $__currentLoopData = $getAllUser; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $user): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                            <?php if($user->id == $note->createdBy): ?>
                                                <?php echo e($user->name); ?>

                                            <?php endif; ?>
                                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                    </td>
                                    <td><?php echo e($note->created_at); ?></td>
                                    <td><?php echo e($note->title); ?></td>
                                    <td><?php echo e($note->description); ?></td>
                                </tr>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>
<script>
function copyMemberUniqueId(id) {
    if(!id) return;
    navigator.clipboard.writeText(id).then(() => {
        // Create a modern toast notification
        const toast = document.createElement("div");
        toast.className = "position-fixed bottom-0 end-0 m-3 p-3 bg-success text-white rounded shadow-lg";
        toast.style.zIndex = "9999";
        toast.innerHTML = `
            <div class="d-flex align-items-center">
                <i class="ti ti-check-circle me-2"></i>
                <div>
                    <div class="fw-bold">Copied!</div>
                    <div>Member ID: ${id}</div>
                </div>
            </div>
        `;
        document.body.appendChild(toast);
        
        // Auto remove after 3 seconds
        setTimeout(() => {
            toast.style.opacity = "0";
            toast.style.transition = "opacity 0.5s ease";
            setTimeout(() => toast.remove(), 500);
        }, 3000);
    });
}
</script><?php /**PATH /home/techhdyz/new.technathi.cloud/resources/views/pages/allpages/memberpages/personal_details.blade.php ENDPATH**/ ?>