<html lang="bn">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>সদস্য রিপোর্ট - <?php echo e(config('app.name', 'Laravel')); ?></title>
    <!-- Bootstrap CSS -->
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet">
    <!-- Font Awesome -->
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
    <!-- DataTables CSS -->
    <link rel="stylesheet" href="https://cdn.datatables.net/1.11.5/css/dataTables.bootstrap5.min.css">
    <style>
        body {
            font-family: 'SolaimanLipi', 'Siyam Rupali', Arial, sans-serif;
            background-color: #f8f9fa;
        }
        .card {
            border-radius: 10px;
            box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
            margin-bottom: 20px;
            border: none;
        }
        .card-header {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            border-radius: 10px 10px 0 0 !important;
            padding: 15px 20px;
        }
        .stat-card {
            transition: transform 0.3s;
            border-left: 4px solid;
        }
        .stat-card:hover {
            transform: translateY(-5px);
        }
        .bg-primary-light {
            background-color: rgba(102, 126, 234, 0.1) !important;
            border-left-color: #667eea !important;
        }
        .bg-success-light {
            background-color: rgba(40, 167, 69, 0.1) !important;
            border-left-color: #28a745 !important;
        }
        .bg-warning-light {
            background-color: rgba(255, 193, 7, 0.1) !important;
            border-left-color: #ffc107 !important;
        }
        .bg-danger-light {
            background-color: rgba(220, 53, 69, 0.1) !important;
            border-left-color: #dc3545 !important;
        }
        .bg-info-light {
            background-color: rgba(23, 162, 184, 0.1) !important;
            border-left-color: #17a2b8 !important;
        }
        .table th {
            background-color: #f8f9fa;
            font-weight: 600;
            border-top: none;
        }
        .btn-primary {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            border: none;
        }
        .btn-primary:hover {
            opacity: 0.9;
        }
        .filter-box {
            background: white;
            border-radius: 10px;
            padding: 20px;
            margin-bottom: 20px;
            box-shadow: 0 2px 4px rgba(0,0,0,0.05);
        }
        .total-box {
            font-size: 1.8rem;
            font-weight: bold;
            color: #2c3e50;
        }
        .currency {
            font-size: 0.9rem;
            color: #7f8c8d;
        }
        .badge-status {
            font-size: 0.75rem;
            padding: 0.35em 0.65em;
        }
        .member-photo {
            width: 50px;
            height: 50px;
            border-radius: 50%;
            object-fit: cover;
            border: 2px solid #dee2e6;
        }
        @media print {
            .no-print {
                display: none !important;
            }
            .card {
                box-shadow: none !important;
                border: 1px solid #dee2e6 !important;
            }
            .table {
                font-size: 12px;
            }
        }
        .dataTables_wrapper {
            padding: 0;
        }
        .member-row {
            transition: all 0.3s;
        }
        .member-row:hover {
            background-color: #f8f9fa;
            transform: scale(1.002);
        }
        .action-buttons {
            min-width: 120px;
        }
        .status-active {
            color: #28a745;
            font-weight: 600;
        }
        .status-inactive {
            color: #6c757d;
            font-weight: 600;
        }
        .status-terminated {
            color: #dc3545;
            font-weight: 600;
        }
        .status-pending {
            color: #ffc107;
            font-weight: 600;
        }
    </style>
</head>
<body>
    <div class="container-fluid py-4">
        <!-- Header -->
        <div class="row mb-4">
            <div class="col-12">
                <div class="d-flex justify-content-between align-items-center">
                    <div>
                        <h2 class="mb-1"><i class="fas fa-users me-2"></i>সদস্য রিপোর্ট</h2>
                        <p class="text-muted mb-0"><?php echo e(now()->format('d F Y, h:i A')); ?></p>
                    </div>
                    <div class="no-print">
                        <a href="<?php echo e(route('reports.summary')); ?>" class="btn btn-outline-primary me-2">
                            <i class="fas fa-chart-line me-1"></i> সারাংশ
                        </a>
                        <a href="<?php echo e(route('reports.monthly')); ?>" class="btn btn-outline-secondary">
                            <i class="fas fa-calendar-alt me-1"></i> মাসিক রিপোর্ট
                        </a>
                    </div>
                </div>
                <hr>
            </div>
        </div>

        <!-- Filter Section -->
        <div class="row mb-4 no-print">
            <div class="col-12">
                <div class="filter-box">
                    <form method="GET" action="<?php echo e(route('reports.members')); ?>" class="row g-3">
                        <div class="col-md-4">
                            <label for="status" class="form-label">স্ট্যাটাস নির্বাচন করুন</label>
                            <select class="form-control" id="status" name="status">
                                <option value="all" <?php echo e($status == 'all' ? 'selected' : ''); ?>>সকল সদস্য</option>
                                <option value="active" <?php echo e($status == 'active' ? 'selected' : ''); ?>>সক্রিয় সদস্য</option>
                                <option value="inactive" <?php echo e($status == 'inactive' ? 'selected' : ''); ?>>নিষ্ক্রিয় সদস্য</option>
                                <option value="terminated" <?php echo e($status == 'terminated' ? 'selected' : ''); ?>>বাতিলকৃত সদস্য</option>
                                <option value="pending" <?php echo e($status == 'pending' ? 'selected' : ''); ?>>পেন্ডিং সদস্য</option>
                            </select>
                        </div>
                        <div class="col-md-4 d-flex align-items-end">
                            <button type="submit" class="btn btn-primary me-2">
                                <i class="fas fa-search me-1"></i> রিপোর্ট দেখুন
                            </button>
                            <button type="submit" name="download" value="1" class="btn btn-success">
                                <i class="fas fa-download me-1"></i> PDF ডাউনলোড
                            </button>
                        </div>
                        <div class="col-md-4 text-end d-flex align-items-end">
                            <a href="<?php echo e(route('reports.members')); ?>" class="btn btn-outline-secondary">
                                <i class="fas fa-sync-alt me-1"></i> রিসেট ফিল্টার
                            </a>
                        </div>
                    </form>
                </div>
            </div>
        </div>

        <!-- Selected Status Info -->
        <div class="row mb-4">
            <div class="col-12">
                <?php
                    $status_text = [
                        'all' => 'সকল সদস্য',
                        'active' => 'সক্রিয় সদস্য',
                        'inactive' => 'নিষ্ক্রিয় সদস্য',
                        'terminated' => 'বাতিলকৃত সদস্য',
                        'pending' => 'পেন্ডিং সদস্য'
                    ];
                ?>
                <div class="alert alert-info">
                    <h5 class="alert-heading mb-2">
                        <i class="fas fa-filter me-2"></i>
                        নির্বাচিত স্ট্যাটাস: 
                        <strong><?php echo e($status_text[$status] ?? 'সকল সদস্য'); ?></strong>
                    </h5>
                    <p class="mb-0">
                        <i class="fas fa-info-circle me-1"></i>
                        নিচের সারণীতে <?php echo e($status_text[$status] ?? 'সকল সদস্য'); ?> দেখানো হয়েছে।
                        মোট <?php echo e($members->count()); ?> জন সদস্য পাওয়া গেছে।
                    </p>
                </div>
            </div>
        </div>

        <!-- Member Summary Statistics -->
        <div class="row mb-4">
            <!-- Total Members -->
            <div class="col-xl-3 col-lg-6 col-md-6 mb-4">
                <div class="card stat-card bg-primary-light">
                    <div class="card-body">
                        <div class="d-flex justify-content-between align-items-center">
                            <div>
                                <h6 class="text-muted mb-1">মোট সদস্য</h6>
                                <h3 class="total-box"><?php echo e($total_members); ?></h3>
                                <small class="text-muted">
                                    <i class="fas fa-users me-1"></i>
                                    সমস্ত সদস্য
                                </small>
                            </div>
                            <div class="display-4 text-primary opacity-50">
                                <i class="fas fa-users"></i>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <!-- Active Members -->
            <div class="col-xl-3 col-lg-6 col-md-6 mb-4">
                <div class="card stat-card bg-success-light">
                    <div class="card-body">
                        <div class="d-flex justify-content-between align-items-center">
                            <div>
                                <h6 class="text-muted mb-1">সক্রিয় সদস্য</h6>
                                <h3 class="total-box"><?php echo e($active_members); ?></h3>
                                <small class="text-muted">
                                    <i class="fas fa-user-check me-1"></i>
                                    বর্তমানে সক্রিয়
                                </small>
                            </div>
                            <div class="display-4 text-success opacity-50">
                                <i class="fas fa-user-check"></i>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <!-- Total Savings -->
            <div class="col-xl-3 col-lg-6 col-md-6 mb-4">
                <div class="card stat-card bg-warning-light">
                    <div class="card-body">
                        <div class="d-flex justify-content-between align-items-center">
                            <div>
                                <h6 class="text-muted mb-1">মোট সঞ্চয়</h6>
                                <h3 class="total-box">
                                    <?php
                                        $total_all_savings = 0;
                                        foreach($members as $member) {
                                            $total_all_savings += $member->monthlySavings->sum('amount');
                                        }
                                    ?>
                                    <?php echo e(number_format($total_all_savings, 2)); ?> <span class="currency">টাকা</span>
                                </h3>
                                <small class="text-muted">
                                    <i class="fas fa-piggy-bank me-1"></i>
                                    সমস্ত সদস্যের সঞ্চয়
                                </small>
                            </div>
                            <div class="display-4 text-warning opacity-50">
                                <i class="fas fa-coins"></i>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <!-- Total Loans -->
            <div class="col-xl-3 col-lg-6 col-md-6 mb-4">
                <div class="card stat-card bg-danger-light">
                    <div class="card-body">
                        <div class="d-flex justify-content-between align-items-center">
                            <div>
                                <h6 class="text-muted mb-1">মোট লোন</h6>
                                <h3 class="total-box">
                                    <?php
                                        $total_all_loans = 0;
                                        $total_loan_count = 0;
                                        foreach($members as $member) {
                                            $total_all_loans += $member->loans->sum('loan_amount');
                                            $total_loan_count += $member->loans->count();
                                        }
                                    ?>
                                    <?php echo e(number_format($total_all_loans, 2)); ?> <span class="currency">টাকা</span>
                                </h3>
                                <small class="text-muted">
                                    <i class="fas fa-handshake me-1"></i>
                                    <?php echo e($total_loan_count); ?>টি লোন
                                </small>
                            </div>
                            <div class="display-4 text-danger opacity-50">
                                <i class="fas fa-money-bill-wave"></i>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <!-- Members Table -->
        <div class="row mb-4">
            <div class="col-12">
                <div class="card">
                    <div class="card-header">
                        <div class="d-flex justify-content-between align-items-center">
                            <h5 class="mb-0">
                                <i class="fas fa-list me-2"></i>
                                সদস্যের তালিকা (মোট: <?php echo e($members->count()); ?> জন)
                            </h5>
                            <span class="badge bg-primary">
                                <i class="fas fa-filter me-1"></i> <?php echo e($status_text[$status] ?? 'সকল'); ?>

                            </span>
                        </div>
                    </div>
                    <div class="card-body">
                        <?php if(count($members) > 0): ?>
                            <div class="table-responsive">
                                <table class="table table-hover" id="membersTable">
                                    <thead>
                                        <tr>
                                            <th>#</th>
                                            <th>ছবি</th>
                                            <th>সদস্য আইডি</th>
                                            <th>নাম</th>
                                            <th>মোবাইল</th>
                                            <th>কমিটি</th>
                                            <th class="text-end">মাসিক সঞ্চয়</th>
                                            <th class="text-end">মোট সঞ্চয়</th>
                                            <th class="text-end">মোট লোন</th>
                                            <th>স্ট্যাটাস</th>
                                            <th>নিবন্ধন তারিখ</th>
                                            <th class="no-print">কার্যক্রম</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <?php $__currentLoopData = $members; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key => $member): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                            <?php
                                                // Calculate member statistics
                                                $monthly_saving = $member->monthly_saving ?? 0;
                                                $total_saving = $member->monthlySavings->sum('amount');
                                                $total_loan = $member->loans->sum('loan_amount');
                                                $loan_count = $member->loans->count();
                                                
                                                // Status class
                                                $status_class = "status-{$member->status}";
                                                $status_text = [
                                                    'active' => 'সক্রিয়',
                                                    'inactive' => 'নিষ্ক্রিয়',
                                                    'terminated' => 'বাতিলকৃত',
                                                    'pending' => 'পেন্ডিং'
                                                ];
                                            ?>
                                            <tr class="member-row">
                                                <td><?php echo e($key + 1); ?></td>
                                                <td>
                                                    <?php if($member->photo): ?>
                                                        <img src="<?php echo e(asset('storage/' . $member->photo)); ?>" 
                                                             alt="<?php echo e($member->name); ?>" 
                                                             class="member-photo"
                                                             onerror="this.src='https://ui-avatars.com/api/?name=<?php echo e(urlencode($member->name)); ?>&background=667eea&color=fff&size=50'">
                                                    <?php else: ?>
                                                        <img src="https://ui-avatars.com/api/?name=<?php echo e(urlencode($member->name)); ?>&background=667eea&color=fff&size=50" 
                                                             alt="<?php echo e($member->name); ?>" 
                                                             class="member-photo">
                                                    <?php endif; ?>
                                                </td>
                                                <td>
                                                    <strong><?php echo e($member->member_id); ?></strong>
                                                </td>
                                                <td>
                                                    <strong><?php echo e($member->name); ?></strong>
                                                    <br>
                                                    <small class="text-muted">
                                                        <?php echo e($member->father_name ? 'পিতা: ' . $member->father_name : ''); ?>

                                                    </small>
                                                </td>
                                                <td>
                                                    <?php echo e($member->phone); ?>

                                                    <?php if($member->email): ?>
                                                        <br>
                                                        <small class="text-muted"><?php echo e($member->email); ?></small>
                                                    <?php endif; ?>
                                                </td>
                                                <td>
                                                    <?php if($member->committee): ?>
                                                        <span class="badge bg-info"><?php echo e($member->committee->name ?? ''); ?></span>
                                                    <?php else: ?>
                                                        <span class="text-muted">N/A</span>
                                                    <?php endif; ?>
                                                </td>
                                                <td class="text-end">
                                                    <span class="text-info"><?php echo e(number_format($monthly_saving, 2)); ?> টাকা</span>
                                                </td>
                                                <td class="text-end">
                                                    <span class="text-success"><?php echo e(number_format($total_saving, 2)); ?> টাকা</span>
                                                </td>
                                                <td class="text-end">
                                                    <?php if($loan_count > 0): ?>
                                                        <span class="text-danger"><?php echo e(number_format($total_loan, 2)); ?> টাকা</span>
                                                        <br>
                                                        <small class="text-muted"><?php echo e($loan_count); ?>টি লোন</small>
                                                    <?php else: ?>
                                                        <span class="text-muted">০ টাকা</span>
                                                    <?php endif; ?>
                                                </td>
                                                <td>
                                                    <span class="<?php echo e($status_class); ?>">
                                                        <i class="fas fa-circle me-1"></i>
                                                        <?php echo e($status_text[$member->status] ?? $member->status); ?>

                                                    </span>
                                                    <br>
                                                    <small class="text-muted">
                                                        <?php echo e($member->approval_status == 'approved' ? 'অনুমোদিত' : ($member->approval_status == 'pending' ? 'পেন্ডিং' : 'প্রত্যাখ্যাত')); ?>

                                                    </small>
                                                </td>
                                                <td>
                                                    <?php if($member->registration_date): ?>
                                                        <?php echo e(date('d/m/Y', strtotime($member->registration_date))); ?>

                                                    <?php else: ?>
                                                        <?php echo e(date('d/m/Y', strtotime($member->created_at))); ?>

                                                    <?php endif; ?>
                                                </td>
                                                <td class="no-print action-buttons">
                                                    <div class="btn-group" role="group">
                                                        <a href="<?php echo e(route('reports.member.detailed', $member->id)); ?>" 
                                                           class="btn btn-sm btn-outline-primary" 
                                                           title="বিস্তারিত দেখুন">
                                                            <i class="fas fa-eye"></i>
                                                        </a>
                                                        <?php if($member->status == 'active'): ?>
                                                            <a href="<?php echo e(route('reports.loans')); ?>?status=all&member=<?php echo e($member->id); ?>" 
                                                               class="btn btn-sm btn-outline-warning" 
                                                               title="লোন দেখুন">
                                                                <i class="fas fa-handshake"></i>
                                                            </a>
                                                        <?php endif; ?>
                                                        <?php if($total_saving > 0): ?>
                                                            <button type="button" 
                                                                    class="btn btn-sm btn-outline-success" 
                                                                    title="সঞ্চয় দেখুন"
                                                                    onclick="showSavings(<?php echo e($member->id); ?>, '<?php echo e($member->name); ?>')">
                                                                <i class="fas fa-piggy-bank"></i>
                                                            </button>
                                                        <?php endif; ?>
                                                    </div>
                                                </td>
                                            </tr>
                                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                    </tbody>
                                    <tfoot class="table-active">
                                        <tr>
                                            <td colspan="6" class="text-end"><strong>মোট:</strong></td>
                                            <td class="text-end">
                                                <strong class="text-info">
                                                    <?php echo e(number_format($members->sum('monthly_saving'), 2)); ?> টাকা
                                                </strong>
                                            </td>
                                            <td class="text-end">
                                                <strong class="text-success">
                                                    <?php echo e(number_format($total_all_savings, 2)); ?> টাকা
                                                </strong>
                                            </td>
                                            <td class="text-end">
                                                <strong class="text-danger">
                                                    <?php echo e(number_format($total_all_loans, 2)); ?> টাকা
                                                </strong>
                                                <br>
                                                <small class="text-muted"><?php echo e($total_loan_count); ?>টি লোন</small>
                                            </td>
                                            <td colspan="3"></td>
                                        </tr>
                                    </tfoot>
                                </table>
                            </div>
                        <?php else: ?>
                            <div class="text-center py-5">
                                <i class="fas fa-users fa-3x text-muted mb-3"></i>
                                <h5 class="text-muted">কোনো সদস্য পাওয়া যায়নি</h5>
                                <p class="text-muted">
                                    "<?php echo e($status_text[$status] ?? 'সকল সদস্য'); ?>" ক্যাটাগরিতে কোনো সদস্য নেই।
                                </p>
                                <a href="<?php echo e(route('reports.members')); ?>?status=all" class="btn btn-primary">
                                    <i class="fas fa-list me-1"></i> সকল সদস্য দেখুন
                                </a>
                            </div>
                        <?php endif; ?>
                    </div>
                </div>
            </div>
        </div>

        <!-- Status Distribution -->
        <div class="row mb-4">
            <div class="col-12">
                <div class="card">
                    <div class="card-header">
                        <h5 class="mb-0"><i class="fas fa-chart-pie me-2"></i>সদস্য স্ট্যাটাস বিতরণ</h5>
                    </div>
                    <div class="card-body">
                        <div class="row">
                            <div class="col-md-8">
                                <div class="table-responsive">
                                    <table class="table table-bordered">
                                        <thead>
                                            <tr>
                                                <th>স্ট্যাটাস</th>
                                                <th class="text-center">সদস্য সংখ্যা</th>
                                                <th class="text-center">মোট সঞ্চয়</th>
                                                <th class="text-center">মোট লোন</th>
                                                <th class="text-center">অনুমোদন স্ট্যাটাস</th>
                                            </tr>
                                        </thead>
                                        <tbody>
                                            <?php
                                                $status_counts = [
                                                    'active' => 0,
                                                    'inactive' => 0,
                                                    'terminated' => 0,
                                                    'pending' => 0
                                                ];
                                                
                                                $status_savings = [
                                                    'active' => 0,
                                                    'inactive' => 0,
                                                    'terminated' => 0,
                                                    'pending' => 0
                                                ];
                                                
                                                $status_loans = [
                                                    'active' => 0,
                                                    'inactive' => 0,
                                                    'terminated' => 0,
                                                    'pending' => 0
                                                ];
                                                
                                                $approval_counts = [
                                                    'approved' => 0,
                                                    'pending' => 0,
                                                    'rejected' => 0
                                                ];
                                                
                                                foreach($members as $member) {
                                                    $status_counts[$member->status]++;
                                                    $status_savings[$member->status] += $member->monthlySavings->sum('amount');
                                                    $status_loans[$member->status] += $member->loans->sum('loan_amount');
                                                    $approval_counts[$member->approval_status]++;
                                                }
                                            ?>
                                            
                                            <?php $__currentLoopData = $status_counts; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $status_key => $count): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                <?php if($count > 0): ?>
                                                    <tr>
                                                        <td>
                                                            <span class="status-<?php echo e($status_key); ?>">
                                                                <i class="fas fa-circle me-1"></i>
                                                                <?php echo e($status_text[$status_key] ?? $status_key); ?>

                                                            </span>
                                                        </td>
                                                        <td class="text-center"><?php echo e($count); ?></td>
                                                        <td class="text-center text-success"><?php echo e(number_format($status_savings[$status_key], 2)); ?> টাকা</td>
                                                        <td class="text-center text-danger"><?php echo e(number_format($status_loans[$status_key], 2)); ?> টাকা</td>
                                                        <td class="text-center">
                                                            <?php
                                                                $approval_text = [
                                                                    'approved' => 'অনুমোদিত',
                                                                    'pending' => 'পেন্ডিং',
                                                                    'rejected' => 'প্রত্যাখ্যাত'
                                                                ];
                                                            ?>
                                                            <span class="badge bg-<?php echo e($member->approval_status == 'approved' ? 'success' : ($member->approval_status == 'pending' ? 'warning' : 'danger')); ?>">
                                                                <?php echo e($approval_text[$member->approval_status] ?? $member->approval_status); ?>

                                                            </span>
                                                        </td>
                                                    </tr>
                                                <?php endif; ?>
                                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                        </tbody>
                                    </table>
                                </div>
                            </div>
                            <div class="col-md-4">
                                <div class="card h-100">
                                    <div class="card-body">
                                        <h6 class="text-center mb-3">সদস্য বিতরণ</h6>
                                        <div class="text-center">
                                            <?php
                                                $total_members_count = $members->count();
                                            ?>
                                            <?php if($total_members_count > 0): ?>
                                                <?php $__currentLoopData = $status_counts; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $status_key => $count): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                    <?php if($count > 0): ?>
                                                        <?php
                                                            $percentage = ($count / $total_members_count) * 100;
                                                            $colors = [
                                                                'active' => '#28a745',
                                                                'inactive' => '#6c757d',
                                                                'terminated' => '#dc3545',
                                                                'pending' => '#ffc107'
                                                            ];
                                                        ?>
                                                        <div class="mb-2">
                                                            <div class="d-flex justify-content-between mb-1">
                                                                <span class="text-muted">
                                                                    <?php echo e($status_text[$status_key] ?? $status_key); ?>

                                                                </span>
                                                                <span class="text-muted"><?php echo e(number_format($percentage, 1)); ?>%</span>
                                                            </div>
                                                            <div class="progress">
                                                                <div class="progress-bar" 
                                                                     role="progressbar" 
                                                                     style="width: <?php echo e($percentage); ?>%; background-color: <?php echo e($colors[$status_key] ?? '#6c757d'); ?>;">
                                                                </div>
                                                            </div>
                                                        </div>
                                                    <?php endif; ?>
                                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                            <?php else: ?>
                                                <p class="text-muted">কোনো ডেটা নেই</p>
                                            <?php endif; ?>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <!-- Action Buttons -->
        <div class="row mt-4 no-print">
            <div class="col-12">
                <div class="card">
                    <div class="card-body text-center">
                        <div class="btn-group" role="group">
                            <a href="<?php echo e(route('reports.members')); ?>?status=active" class="btn btn-outline-success me-2">
                                <i class="fas fa-user-check me-1"></i> সক্রিয় সদস্য
                            </a>
                            <a href="<?php echo e(route('reports.members')); ?>?status=inactive" class="btn btn-outline-secondary me-2">
                                <i class="fas fa-user-slash me-1"></i> নিষ্ক্রিয় সদস্য
                            </a>
                            <a href="<?php echo e(route('reports.members')); ?>?status=pending" class="btn btn-outline-warning me-2">
                                <i class="fas fa-clock me-1"></i> পেন্ডিং সদস্য
                            </a>
                            <a href="<?php echo e(route('reports.summary')); ?>" class="btn btn-outline-primary me-2">
                                <i class="fas fa-chart-line me-1"></i> সারাংশ
                            </a>
                            <button onclick="window.print()" class="btn btn-primary">
                                <i class="fas fa-print me-1"></i> প্রিন্ট রিপোর্ট
                            </button>
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <!-- Report Info -->
        <div class="row mt-4">
            <div class="col-12 text-center">
                <hr>
                <p class="text-muted small">
                    <i class="fas fa-clock me-1"></i>
                    রিপোর্ট তৈরি হয়েছে: <?php echo e(now()->format('d F Y, h:i A')); ?>

                    | 
                    <i class="fas fa-user me-1"></i>
                    ব্যবহারকারী: <?php echo e(Auth::user()->name ?? 'অজানা'); ?>

                    |
                    <i class="fas fa-filter me-1"></i>
                    স্ট্যাটাস: <?php echo e($status_text[$status] ?? 'সকল'); ?>

                    |
                    <i class="fas fa-users me-1"></i>
                    মোট সদস্য: <?php echo e($members->count()); ?> জন
                </p>
            </div>
        </div>
    </div>

    <!-- Bootstrap JS -->
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
    <!-- Font Awesome -->
    <script src="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/js/all.min.js"></script>
    <!-- DataTables JS -->
    <script src="https://cdn.datatables.net/1.11.5/js/jquery.dataTables.min.js"></script>
    <script src="https://cdn.datatables.net/1.11.5/js/dataTables.bootstrap5.min.js"></script>
    
    <script>
        $(document).ready(function() {
            // Initialize DataTable
            $('#membersTable').DataTable({
                language: {
                    search: "খুঁজুন:",
                    lengthMenu: "প্রতি পৃষ্ঠায় _MENU_টি দেখুন",
                    info: "মোট _TOTAL_টি সদস্যের মধ্যে _START_ থেকে _END_ পর্যন্ত দেখানো হচ্ছে",
                    infoEmpty: "কোনো সদস্য নেই",
                    infoFiltered: "(মোট _MAX_টি সদস্য থেকে ফিল্টার করা হয়েছে)",
                    paginate: {
                        first: "প্রথম",
                        last: "শেষ",
                        next: "পরবর্তী",
                        previous: "পূর্ববর্তী"
                    }
                },
                pageLength: 25,
                order: [[3, 'asc']] // Sort by name
            });

            // Show savings modal
            function showSavings(memberId, memberName) {
                alert('সদস্য: ' + memberName + '\nসঞ্চয় বিস্তারিত দেখতে সদস্য বিস্তারিত পৃষ্ঠায় যান।');
                // In a real application, you might want to show a modal with savings details
                // window.location.href = '/reports/member/' + memberId;
            }

            // Print function
            function printReport() {
                window.print();
            }

            // Format numbers with comma
            function formatNumber(num) {
                return new Intl.NumberFormat('bn-BD').format(num);
            }

            // Update all numbers on page
            document.querySelectorAll('.number-format').forEach(function(element) {
                const num = parseFloat(element.textContent);
                if (!isNaN(num)) {
                    element.textContent = formatNumber(num);
                }
            });
        });
    </script>
</body>
</html>
<?php echo $__env->make('layouts.app', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH /home/naowarin/somoti.naowarinternational.my.id/resources/views/reports/member.blade.php ENDPATH**/ ?>