Sindbad~EG File Manager

Current Path : /home/copmadinaarea/thecopmadinaarea.org/portal/members/
Upload File :
Current File : /home/copmadinaarea/thecopmadinaarea.org/portal/members/dashboard.php

<?php
require_once '../config/config.php';
require_once '../classes/MemberAuth.php';

// Check if member is logged in
if (!MemberAuth::isMemberLoggedIn()) {
    redirect('../login.php');
}

$pageTitle = "Member Dashboard - " . APP_NAME;
$db = Database::getInstance()->getConnection();

// Get current member data
$currentMember = MemberAuth::getCurrentMember();
if (!$currentMember) {
    redirect('../login.php');
}

// Check if member has officership title
$memberTitle = $_SESSION['member_title'] ?? '';
$pastorate_titles = ['Apostle', 'Prophet', 'Evangelist', 'Pastor', 'Overseer', 'Probational Overseer'];
$officer_titles = ['Elder', 'Deacon', 'Deaconess'];
$isOfficer = in_array($memberTitle, array_merge($pastorate_titles, $officer_titles));

// Get officership details if member is an officer
$ordinationDetails = null;
$retirementDetails = null;
$transfersCount = 0;
if ($isOfficer && $currentMember['member_id']) {
    // Get ordination details
    try {
        $stmt = $db->prepare("SELECT * FROM ordination WHERE member_id = :member_id");
        $stmt->execute(['member_id' => $currentMember['member_id']]);
        $ordinationDetails = $stmt->fetch(PDO::FETCH_ASSOC);
    } catch (Exception $e) {
        $ordinationDetails = null;
    }
    
    // Get retirement details
    try {
        $stmt = $db->prepare("SELECT * FROM retiree_details WHERE member_id = :member_id");
        $stmt->execute(['member_id' => $currentMember['member_id']]);
        $retirementDetails = $stmt->fetch(PDO::FETCH_ASSOC);
    } catch (Exception $e) {
        $retirementDetails = null;
    }
    
    // Get transfers count
    try {
        $stmt = $db->prepare("SELECT COUNT(*) as cnt FROM officer_transfers WHERE member_id = :member_id");
        $stmt->execute(['member_id' => $currentMember['member_id']]);
        $transfersCount = (int)($stmt->fetch()['cnt'] ?? 0);
    } catch (Exception $e) {
        $transfersCount = 0;
    }
}

// Get member details with location info
$stmt = $db->prepare("
    SELECT m.*, a.area_name, d.district_name, ass.assembly_name,
           mc.card_number
    FROM members m
    LEFT JOIN areas a ON m.area_id = a.id
    LEFT JOIN districts d ON m.district_id = d.id
    LEFT JOIN assemblies ass ON m.assembly_id = ass.id
    LEFT JOIN membership_cards mc ON m.id = mc.member_id
    WHERE m.id = :member_id
");
$stmt->execute(['member_id' => $currentMember['member_id']]);
$memberDetails = $stmt->fetch(PDO::FETCH_ASSOC);

// Get unread messages count
$unreadMessagesCount = 0;
try {
    $stmt = $db->prepare("SELECT COUNT(*) as cnt 
                          FROM chat_messages cm
                          JOIN chat_conversations cc ON cm.conversation_id = cc.id
                          WHERE cc.member_id = :member_id 
                          AND cm.sender_type = 'admin' 
                          AND cm.is_read = 0");
    $stmt->execute(['member_id' => $currentMember['member_id']]);
    $unreadMessagesCount = (int)($stmt->fetch()['cnt'] ?? 0);
} catch (Exception $e) {
    $unreadMessagesCount = 0;
}

// Get latest transfer request
$latestTransferRequest = null;
try {
    $stmt = $db->prepare("SELECT status, created_at 
                          FROM member_transfer_requests 
                          WHERE member_id = :member_id 
                          ORDER BY created_at DESC 
                          LIMIT 1");
    $stmt->execute(['member_id' => $currentMember['member_id']]);
    $latestTransferRequest = $stmt->fetch(PDO::FETCH_ASSOC);
} catch (Exception $e) {
    $latestTransferRequest = null;
}

// Get upcoming events count
$upcomingEventsCount = 0;
try {
    $stmt = $db->query("SELECT COUNT(*) as cnt 
                        FROM events 
                        WHERE start_date >= CURDATE() 
                        AND is_active = 1 
                        LIMIT 5");
    $upcomingEventsCount = (int)($stmt->fetch()['cnt'] ?? 0);
} catch (Exception $e) {
    $upcomingEventsCount = 0;
}

// Get settings for theme colors
$stmt = $db->query("SELECT * FROM general_settings ORDER BY id DESC LIMIT 1");
$settings = $stmt->fetch();
$settings = array_merge([
    'site_title' => APP_NAME,
    'theme_primary_color' => '#3B82F6',
    'theme_secondary_color' => '#10B981'
], $settings ?: []);
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title><?php echo $pageTitle; ?></title>
    <script src="https://cdn.tailwindcss.com"></script>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
    <style>
        :root {
            --primary-color: <?php echo $settings['theme_primary_color']; ?>;
            --secondary-color: <?php echo $settings['theme_secondary_color']; ?>;
        }
        .bg-primary { background-color: var(--primary-color); }
        .bg-secondary { background-color: var(--secondary-color); }
        .text-primary { color: var(--primary-color); }
        .border-primary { border-color: var(--primary-color); }
        .gradient-bg { background: linear-gradient(135deg, #1E40AF 0%, #9333EA 50%, #F97316 100%); }
        .card-hover { transition: all 0.3s ease; }
        .card-hover:hover { transform: translateY(-5px); box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1); }
    </style>
</head>
<body class="bg-gray-50">
    <!-- Member Portal Header -->
    <header class="bg-white shadow-lg sticky top-0 z-50">
        <div class="container mx-auto px-4">
            <div class="flex items-center justify-between h-16">
                <div class="flex items-center space-x-3">
                    <div class="w-10 h-10 rounded-xl flex items-center justify-center gradient-bg">
                        <i class="fas fa-church text-white"></i>
                    </div>
                    <div>
                        <h1 class="text-lg font-bold text-gray-800"><?php echo htmlspecialchars($settings['site_title']); ?></h1>
                        <p class="text-xs text-gray-500">Member Portal</p>
                    </div>
                </div>
                
                <nav class="hidden md:flex items-center space-x-6">
                    <a href="dashboard.php" class="text-blue-600 font-medium border-b-2 border-blue-600 pb-1">
                        <i class="fas fa-home mr-1"></i>Dashboard
                    </a>
                    <a href="directory.php" class="text-gray-700 hover:text-blue-600 transition">
                        <i class="fas fa-address-book mr-1"></i>Directory
                    </a>
                    <a href="profile.php" class="text-gray-700 hover:text-blue-600 transition">
                        <i class="fas fa-user mr-1"></i>Profile
                    </a>
                    <a href="messages.php" class="text-gray-700 hover:text-blue-600 transition relative">
                        <i class="fas fa-comments mr-1"></i>Messages
                        <?php if ($unreadMessagesCount > 0): ?>
                            <span class="absolute -top-2 -right-2 bg-red-500 text-white text-xs rounded-full w-5 h-5 flex items-center justify-center"><?php echo $unreadMessagesCount; ?></span>
                        <?php endif; ?>
                    </a>
                    <a href="event-checkin.php" class="text-gray-700 hover:text-green-600 transition">
                        <i class="fas fa-qrcode mr-1"></i>Event Check-in
                    </a>
                    <a href="transfer_request.php" class="text-gray-700 hover:text-blue-600 transition">
                        <i class="fas fa-exchange-alt mr-1"></i>Transfer
                    </a>
                </nav>
                
                <div class="flex items-center space-x-3">
                    <span class="text-sm text-gray-600 hidden md:block">Welcome, <?php echo htmlspecialchars($memberDetails['first_name'] ?? 'Member'); ?></span>
                    <a href="../logout.php?member=1" class="text-gray-600 hover:text-red-600 transition">
                        <i class="fas fa-sign-out-alt mr-1"></i>Logout
                    </a>
                </div>
            </div>
        </div>
    </header>

    <div class="container mx-auto px-4 py-8">
        <div class="max-w-7xl mx-auto">
            <!-- Welcome Section -->
            <div class="mb-8">
                <div class="gradient-bg rounded-2xl p-8 text-white shadow-xl">
                    <div class="flex items-center justify-between flex-wrap gap-4">
                        <div class="flex items-center space-x-4">
                            <?php if ($currentMember['profile_photo']): ?>
                                <img src="../<?php echo htmlspecialchars($currentMember['profile_photo']); ?>" 
                                     alt="Profile" 
                                     class="w-20 h-20 rounded-full border-4 border-white object-cover">
                            <?php else: ?>
                                <div class="w-20 h-20 rounded-full border-4 border-white bg-white/20 flex items-center justify-center">
                                    <i class="fas fa-user text-4xl text-white"></i>
                                </div>
                            <?php endif; ?>
                            <div>
                                <h1 class="text-3xl font-bold">
                                    Welcome back, <?php echo htmlspecialchars($memberDetails['first_name'] ?? 'Member'); ?>!
                                </h1>
                                <p class="text-white/90 mt-1">
                                    <?php echo htmlspecialchars($memberDetails['member_type'] ?? 'Member'); ?> • 
                                    <?php echo htmlspecialchars($memberDetails['assembly_name'] ?? 'Assembly'); ?>
                                </p>
                            </div>
                        </div>
                        <div class="text-right">
                            <p class="text-white/80 text-sm">Member Since</p>
                            <p class="text-2xl font-bold">
                                <?php echo $memberDetails['created_at'] ? date('Y', strtotime($memberDetails['created_at'])) : date('Y'); ?>
                            </p>
                        </div>
                    </div>
                </div>
            </div>

            <!-- Analytics Cards -->
            <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6 mb-8">
                <!-- Membership Card -->
                <div class="bg-white rounded-xl shadow-lg p-6 border-l-4 border-blue-500 card-hover">
                    <div class="flex items-center justify-between">
                        <div>
                            <p class="text-sm text-gray-600 mb-1">Membership Card</p>
                            <p class="text-2xl font-bold text-gray-800">
                                <?php echo htmlspecialchars($memberDetails['card_number'] ?? 'N/A'); ?>
                            </p>
                            <p class="text-xs text-gray-500 mt-1">Active</p>
                        </div>
                        <div class="w-14 h-14 rounded-full flex items-center justify-center" style="background: linear-gradient(135deg, #1E40AF 0%, #9333EA 100%);">
                            <i class="fas fa-id-card text-white text-xl"></i>
                        </div>
                    </div>
                </div>

                <!-- Messages Card -->
                <div class="bg-white rounded-xl shadow-lg p-6 border-l-4 border-orange-500 card-hover cursor-pointer" onclick="window.location='messages.php'">
                    <div class="flex items-center justify-between">
                        <div>
                            <p class="text-sm text-gray-600 mb-1">Unread Messages</p>
                            <p class="text-2xl font-bold text-gray-800"><?php echo $unreadMessagesCount; ?></p>
                            <p class="text-xs text-gray-500 mt-1">Click to view</p>
                        </div>
                        <div class="w-14 h-14 rounded-full flex items-center justify-center" style="background: linear-gradient(135deg, #F97316 0%, #FBBF24 100%);">
                            <i class="fas fa-envelope text-white text-xl"></i>
                        </div>
                    </div>
                </div>

                <!-- Transfer Request Card -->
                <div class="bg-white rounded-xl shadow-lg p-6 border-l-4 border-purple-500 card-hover">
                    <div class="flex items-center justify-between">
                        <div>
                            <p class="text-sm text-gray-600 mb-1">Transfer Request</p>
                            <p class="text-2xl font-bold text-gray-800">
                                <?php if ($latestTransferRequest): ?>
                                    <?php if ($latestTransferRequest['status'] === 'pending'): ?>
                                        <span class="text-yellow-600">Pending</span>
                                    <?php elseif ($latestTransferRequest['status'] === 'approved'): ?>
                                        <span class="text-green-600">Approved</span>
                                    <?php else: ?>
                                        <span class="text-red-600">Denied</span>
                                    <?php endif; ?>
                                <?php else: ?>
                                    <span class="text-gray-400">None</span>
                                <?php endif; ?>
                            </p>
                            <p class="text-xs text-gray-500 mt-1">
                                <?php echo $latestTransferRequest ? date('M j, Y', strtotime($latestTransferRequest['created_at'])) : 'No requests'; ?>
                            </p>
                        </div>
                        <div class="w-14 h-14 rounded-full flex items-center justify-center" style="background: linear-gradient(135deg, #9333EA 0%, #F97316 100%);">
                            <i class="fas fa-exchange-alt text-white text-xl"></i>
                        </div>
                    </div>
                </div>

                <!-- Upcoming Events Card -->
                <div class="bg-white rounded-xl shadow-lg p-6 border-l-4 border-green-500 card-hover cursor-pointer" onclick="window.location='event-checkin.php'">
                    <div class="flex items-center justify-between">
                        <div>
                            <p class="text-sm text-gray-600 mb-1">Upcoming Events</p>
                            <p class="text-2xl font-bold text-gray-800"><?php echo $upcomingEventsCount; ?></p>
                            <p class="text-xs text-gray-500 mt-1">Click to explore</p>
                        </div>
                        <div class="w-14 h-14 rounded-full flex items-center justify-center" style="background: linear-gradient(135deg, #10B981 0%, #34D399 100%);">
                            <i class="fas fa-calendar-alt text-white text-xl"></i>
                        </div>
                    </div>
                </div>
            </div>

            <!-- Officership Module (Only for Officers) -->
            <?php if ($isOfficer): ?>
            <div class="mb-8">
                <div class="bg-gradient-to-r from-indigo-600 to-purple-600 rounded-xl p-6 mb-6 shadow-lg">
                    <div class="flex items-center justify-between flex-wrap gap-4">
                        <div>
                            <h2 class="text-2xl font-bold text-white mb-2">
                                <i class="fas fa-certificate mr-2"></i>Officership Status
                            </h2>
                            <p class="text-white/90">Your church leadership position and details</p>
                        </div>
                        <div class="text-right">
                            <p class="text-white/80 text-sm">Your Title</p>
                            <p class="text-3xl font-bold text-white">
                                <?php echo htmlspecialchars($memberTitle); ?>
                            </p>
                        </div>
                    </div>
                </div>

                <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
                    <!-- Ordination & Service Card -->
                    <div class="bg-white rounded-xl shadow-lg p-4 border-l-4 border-indigo-500 card-hover">
                        <div class="flex items-center justify-between mb-2">
                            <h3 class="text-base font-bold text-gray-800">Ordination Details</h3>
                            <div class="w-8 h-8 rounded-full flex items-center justify-center" style="background: linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%);">
                                <i class="fas fa-certificate text-white text-sm"></i>
                            </div>
                        </div>
                        <?php if ($ordinationDetails): ?>
                        <div class="space-y-2 text-xs">
                            <div class="flex justify-between items-center py-1 border-b border-gray-100">
                                <span class="text-gray-600">Date Ordained</span>
                                <span class="font-semibold text-gray-800">
                                    <?php echo $ordinationDetails['date_ordained'] ? date('M j, Y', strtotime($ordinationDetails['date_ordained'])) : 'N/A'; ?>
                                </span>
                            </div>
                            <div class="flex justify-between items-center py-1 border-b border-gray-100">
                                <span class="text-gray-600">Card Number</span>
                                <span class="font-semibold text-gray-800"><?php echo htmlspecialchars($ordinationDetails['card_no'] ?? 'N/A'); ?></span>
                            </div>
                            <div class="flex justify-between items-center py-1 border-b border-gray-100">
                                <span class="text-gray-600">Ordained By</span>
                                <span class="font-semibold text-gray-800"><?php echo htmlspecialchars($ordinationDetails['ordained_by'] ?? 'N/A'); ?></span>
                            </div>
                            <div class="flex justify-between items-center py-1">
                                <span class="text-gray-600">Years Serving</span>
                                <span class="font-bold text-indigo-600 text-sm">
                                    <?php 
                                        if ($ordinationDetails['date_ordained']) {
                                            $ordained = new DateTime($ordinationDetails['date_ordained']);
                                            $now = new DateTime();
                                            $diff = $now->diff($ordained);
                                            echo $diff->y . ' years';
                                        } else {
                                            echo 'N/A';
                                        }
                                    ?>
                                </span>
                            </div>
                        </div>
                        <?php else: ?>
                        <div class="text-center py-4">
                            <i class="fas fa-info-circle text-gray-300 text-xl mb-1"></i>
                            <p class="text-xs text-gray-500">No ordination record found.<br>Please contact admin.</p>
                        </div>
                        <?php endif; ?>
                    </div>

                    <!-- Service Status Card -->
                    <div class="bg-white rounded-xl shadow-lg p-4 border-l-4 <?php echo $retirementDetails ? 'border-red-500' : 'border-green-500'; ?> card-hover">
                        <div class="flex items-center justify-between mb-2">
                            <h3 class="text-base font-bold text-gray-800">Service Status</h3>
                            <div class="w-8 h-8 rounded-full flex items-center justify-center" style="background: linear-gradient(135deg, <?php echo $retirementDetails ? '#EF4444 0%, #DC2626 100%' : '#10B981 0%, #059669 100%'; ?>);">
                                <i class="fas fa-<?php echo $retirementDetails ? 'user-clock' : 'user-check'; ?> text-white text-sm"></i>
                            </div>
                        </div>
                        <?php if ($retirementDetails): ?>
                        <div class="text-center py-3">
                            <div class="mb-4">
                                <span class="inline-flex items-center px-3 py-1 rounded-full text-xs font-bold bg-red-100 text-red-600">
                                    <i class="fas fa-user-clock mr-1"></i>Retired
                                </span>
                            </div>
                            <div class="space-y-1 text-xs">
                                <div class="flex justify-between items-center py-1 border-b border-gray-100">
                                    <span class="text-gray-600">Retired On</span>
                                    <span class="font-semibold text-gray-800">
                                        <?php echo $retirementDetails['date_retired'] ? date('M j, Y', strtotime($retirementDetails['date_retired'])) : 'N/A'; ?>
                                    </span>
                                </div>
                                <div class="flex justify-between items-center py-1 border-b border-gray-100">
                                    <span class="text-gray-600">Years Served</span>
                                    <span class="font-bold text-red-600"><?php echo htmlspecialchars($retirementDetails['years_of_service'] ?? 'N/A'); ?> years</span>
                                </div>
                                <div class="flex justify-between items-center py-1">
                                    <span class="text-gray-600">Transfers</span>
                                    <span class="font-semibold text-gray-800"><?php echo $transfersCount; ?></span>
                                </div>
                            </div>
                        </div>
                        <?php else: ?>
                        <div class="text-center py-3">
                            <div class="mb-4">
                                <span class="inline-flex items-center px-3 py-1 rounded-full text-xs font-bold bg-green-100 text-green-600">
                                    <i class="fas fa-check-circle mr-1"></i>Active Service
                                </span>
                            </div>
                            <p class="text-gray-600 mb-2 text-xs">Currently serving the church</p>
                            <div class="space-y-1 text-xs">
                                <?php if ($ordinationDetails && $ordinationDetails['date_ordained']): ?>
                                <div class="flex justify-between items-center py-2 border-b border-gray-100">
                                    <span class="text-gray-600">Service Duration</span>
                                    <span class="font-bold text-green-600">
                                        <?php 
                                            $ordained = new DateTime($ordinationDetails['date_ordained']);
                                            $now = new DateTime();
                                            $diff = $now->diff($ordained);
                                            echo $diff->y . ' years';
                                        ?>
                                    </span>
                                </div>
                                <?php endif; ?>
                                <div class="flex justify-between items-center py-2">
                                    <span class="text-gray-600">Transfers</span>
                                    <span class="font-semibold text-gray-800"><?php echo $transfersCount; ?></span>
                                </div>
                            </div>
                        </div>
                        <?php endif; ?>
                    </div>
                </div>
            </div>
            <?php endif; ?>

            <!-- Quick Action Modules -->
            <div class="mb-8">
                <h2 class="text-2xl font-bold text-gray-800 mb-6">
                    <i class="fas fa-th-large mr-2 text-blue-500"></i>Quick Actions
                </h2>
                <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
                    <!-- Member Directory -->
                    <a href="directory.php" class="bg-white rounded-xl shadow-lg p-6 card-hover group">
                        <div class="flex items-start space-x-4">
                            <div class="w-12 h-12 rounded-lg flex items-center justify-center group-hover:scale-110 transition" style="background: linear-gradient(135deg, #3B82F6 0%, #1D4ED8 100%);">
                                <i class="fas fa-address-book text-white text-xl"></i>
                            </div>
                            <div class="flex-1">
                                <h3 class="text-lg font-bold text-gray-800 group-hover:text-blue-600 transition">
                                    Member Directory
                                </h3>
                                <p class="text-sm text-gray-600 mt-1">Search and view contact information for members in your location</p>
                            </div>
                        </div>
                    </a>

                    <!-- Profile Management -->
                    <a href="profile.php" class="bg-white rounded-xl shadow-lg p-6 card-hover group">
                        <div class="flex items-start space-x-4">
                            <div class="w-12 h-12 rounded-lg flex items-center justify-center group-hover:scale-110 transition" style="background: linear-gradient(135deg, #1E40AF 0%, #9333EA 100%);">
                                <i class="fas fa-user text-white text-xl"></i>
                            </div>
                            <div class="flex-1">
                                <h3 class="text-lg font-bold text-gray-800 group-hover:text-blue-600 transition">
                                    Profile Management
                                </h3>
                                <p class="text-sm text-gray-600 mt-1">View and update your personal information, contact details, and profile photo</p>
                            </div>
                        </div>
                    </a>

                    <!-- Account Settings -->
                    <a href="account-settings.php" class="bg-white rounded-xl shadow-lg p-6 card-hover group">
                        <div class="flex items-start space-x-4">
                            <div class="w-12 h-12 rounded-lg flex items-center justify-center group-hover:scale-110 transition" style="background: linear-gradient(135deg, #F97316 0%, #FBBF24 100%);">
                                <i class="fas fa-cog text-white text-xl"></i>
                            </div>
                            <div class="flex-1">
                                <h3 class="text-lg font-bold text-gray-800 group-hover:text-orange-600 transition">
                                    Account Settings
                                </h3>
                                <p class="text-sm text-gray-600 mt-1">Manage your login credentials, email, and password security settings</p>
                            </div>
                        </div>
                    </a>

                    <!-- Security (2FA) -->
                    <a href="security.php" class="bg-white rounded-xl shadow-lg p-6 card-hover group">
                        <div class="flex items-start space-x-4">
                            <div class="w-12 h-12 rounded-lg flex items-center justify-center group-hover:scale-110 transition" style="background: linear-gradient(135deg, #1E40AF 0%, #9333EA 100%);">
                                <i class="fas fa-shield-alt text-white text-xl"></i>
                            </div>
                            <div class="flex-1">
                                <h3 class="text-lg font-bold text-gray-800 group-hover:text-blue-600 transition">
                                    Security Settings
                                </h3>
                                <p class="text-sm text-gray-600 mt-1">Enable two-factor authentication to protect your account</p>
                            </div>
                        </div>
                    </a>

                    <!-- Messages & Chats -->
                    <a href="messages.php" class="bg-white rounded-xl shadow-lg p-6 card-hover group relative">
                        <?php if ($unreadMessagesCount > 0): ?>
                            <span class="absolute top-3 right-3 bg-red-500 text-white text-xs font-bold rounded-full w-6 h-6 flex items-center justify-center">
                                <?php echo $unreadMessagesCount; ?>
                            </span>
                        <?php endif; ?>
                        <div class="flex items-start space-x-4">
                            <div class="w-12 h-12 rounded-lg flex items-center justify-center group-hover:scale-110 transition" style="background: linear-gradient(135deg, #9333EA 0%, #F97316 100%);">
                                <i class="fas fa-comments text-white text-xl"></i>
                            </div>
                            <div class="flex-1">
                                <h3 class="text-lg font-bold text-gray-800 group-hover:text-purple-600 transition">
                                    Messages & Chats
                                </h3>
                                <p class="text-sm text-gray-600 mt-1">Chat with church admins, view broadcasts, and manage conversations</p>
                            </div>
                        </div>
                    </a>

                    <!-- Transfer Request -->
                    <a href="transfer_request.php" class="bg-white rounded-xl shadow-lg p-6 card-hover group">
                        <div class="flex items-start space-x-4">
                            <div class="w-12 h-12 rounded-lg flex items-center justify-center group-hover:scale-110 transition" style="background: linear-gradient(135deg, #10B981 0%, #34D399 100%);">
                                <i class="fas fa-exchange-alt text-white text-xl"></i>
                            </div>
                            <div class="flex-1">
                                <h3 class="text-lg font-bold text-gray-800 group-hover:text-green-600 transition">
                                    Transfer Request
                                </h3>
                                <p class="text-sm text-gray-600 mt-1">Request to transfer your membership to another assembly or view request status</p>
                            </div>
                        </div>
                    </a>

                    <!-- Events -->
                    <a href="event-checkin.php" class="bg-white rounded-xl shadow-lg p-6 card-hover group">
                        <div class="flex items-start space-x-4">
                            <div class="w-12 h-12 rounded-lg flex items-center justify-center group-hover:scale-110 transition" style="background: linear-gradient(135deg, #FBBF24 0%, #F97316 100%);">
                                <i class="fas fa-calendar-alt text-white text-xl"></i>
                            </div>
                            <div class="flex-1">
                                <h3 class="text-lg font-bold text-gray-800 group-hover:text-yellow-600 transition">
                                    Church Events
                                </h3>
                                <p class="text-sm text-gray-600 mt-1">Browse upcoming church events, check in to events using your QR code</p>
                            </div>
                        </div>
                    </a>

                    <!-- My QR Codes -->
                    <a href="my-codes.php" class="bg-white rounded-xl shadow-lg p-6 card-hover group">
                        <div class="flex items-start space-x-4">
                            <div class="w-12 h-12 rounded-lg flex items-center justify-center group-hover:scale-110 transition" style="background: linear-gradient(135deg, #EC4899 0%, #8B5CF6 100%);">
                                <i class="fas fa-qrcode text-white text-xl"></i>
                            </div>
                            <div class="flex-1">
                                <h3 class="text-lg font-bold text-gray-800 group-hover:text-pink-600 transition">
                                    My QR Codes
                                </h3>
                                <p class="text-sm text-gray-600 mt-1">View and download your QR codes for event check-in and identification</p>
                            </div>
                        </div>
                    </a>

                    <!-- Home -->
                    <a href="../index.php" class="bg-white rounded-xl shadow-lg p-6 card-hover group">
                        <div class="flex items-start space-x-4">
                            <div class="w-12 h-12 rounded-lg flex items-center justify-center group-hover:scale-110 transition" style="background: linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%);">
                                <i class="fas fa-home text-white text-xl"></i>
                            </div>
                            <div class="flex-1">
                                <h3 class="text-lg font-bold text-gray-800 group-hover:text-indigo-600 transition">
                                    Back to Home
                                </h3>
                                <p class="text-sm text-gray-600 mt-1">Return to the main website homepage and public pages</p>
                            </div>
                        </div>
                    </a>
                </div>
            </div>

            <!-- Member Info Summary -->
            <div class="bg-white rounded-xl shadow-lg p-6">
                <h2 class="text-xl font-bold text-gray-800 mb-4">
                    <i class="fas fa-info-circle mr-2 text-blue-500"></i>Your Membership Information
                </h2>
                <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4 text-sm">
                    <div>
                        <p class="text-gray-600">Full Name</p>
                        <p class="font-semibold text-gray-800">
                            <?php echo htmlspecialchars(trim(($memberDetails['title'] ?? '') . ' ' . ($memberDetails['first_name'] ?? '') . ' ' . ($memberDetails['middle_name'] ?? '') . ' ' . ($memberDetails['last_name'] ?? ''))); ?>
                        </p>
                    </div>
                    <div>
                        <p class="text-gray-600">Member Type</p>
                        <p class="font-semibold text-gray-800"><?php echo htmlspecialchars($memberDetails['member_type'] ?? 'N/A'); ?></p>
                    </div>
                    <div>
                        <p class="text-gray-600">Email</p>
                        <p class="font-semibold text-gray-800"><?php echo htmlspecialchars($memberDetails['email'] ?? 'N/A'); ?></p>
                    </div>
                    <div>
                        <p class="text-gray-600">Phone</p>
                        <p class="font-semibold text-gray-800"><?php echo htmlspecialchars($memberDetails['phone'] ?? 'N/A'); ?></p>
                    </div>
                    <div>
                        <p class="text-gray-600">Area</p>
                        <p class="font-semibold text-gray-800"><?php echo htmlspecialchars($memberDetails['area_name'] ?? 'N/A'); ?></p>
                    </div>
                    <div>
                        <p class="text-gray-600">District</p>
                        <p class="font-semibold text-gray-800"><?php echo htmlspecialchars($memberDetails['district_name'] ?? 'N/A'); ?></p>
                    </div>
                    <div>
                        <p class="text-gray-600">Assembly</p>
                        <p class="font-semibold text-gray-800"><?php echo htmlspecialchars($memberDetails['assembly_name'] ?? 'N/A'); ?></p>
                    </div>
                    <div>
                        <p class="text-gray-600">Date of Birth</p>
                        <p class="font-semibold text-gray-800">
                            <?php echo $memberDetails['date_of_birth'] ? date('M j, Y', strtotime($memberDetails['date_of_birth'])) : 'N/A'; ?>
                        </p>
                    </div>
                    <div>
                        <p class="text-gray-600">Gender</p>
                        <p class="font-semibold text-gray-800"><?php echo htmlspecialchars($memberDetails['gender'] ?? 'N/A'); ?></p>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <!-- Footer -->
    <footer class="bg-gray-800 text-white py-6 mt-12">
        <div class="container mx-auto px-4 text-center">
            <p class="text-sm text-gray-400">
                © <?php echo date('Y'); ?> <?php echo htmlspecialchars($settings['site_title']); ?>. All rights reserved.
            </p>
        </div>
    </footer>

    <?php 
    // Include Chat Hub Widget (Admin Chat + AI Chatbot)
    if (file_exists(__DIR__ . '/../includes/chat-hub-widget.php')) {
        include '../includes/chat-hub-widget.php';
    }
    ?>
</body>
</html>

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists