Sindbad~EG File Manager

Current Path : /home/copmadinaarea/thecopmadinaarea.org/attendance/
Upload File :
Current File : /home/copmadinaarea/thecopmadinaarea.org/attendance/index.php

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

// Get active programs
$db = new Database();
$conn = $db->getConnection();

$query = "SELECT p.*, l.name as location_name FROM programs p 
          LEFT JOIN locations l ON p.location_id = l.id 
          WHERE p.is_active = 1 AND (p.end_date IS NULL OR p.end_date >= CURDATE())
          ORDER BY p.name";
$stmt = $conn->prepare($query);
$stmt->execute();
$programs = $stmt->fetchAll();

// Get site settings
$query = "SELECT setting_key, setting_value FROM settings WHERE setting_key IN ('site_title', 'site_logo', 'footer_title')";
$stmt = $conn->prepare($query);
$stmt->execute();
$settings = [];
while ($row = $stmt->fetch()) {
    $settings[$row['setting_key']] = $row['setting_value'];
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title><?php echo $settings['site_title'] ?? SITE_TITLE; ?></title>
    <script src="https://cdn.tailwindcss.com"></script>
    <script>
        tailwind.config = {
            theme: {
                extend: {
                    colors: {
                        primary: '#3B82F6',
                        secondary: '#F59E0B',
                        accent: '#6B7280'
                    }
                }
            }
        }
    </script>
    <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" rel="stylesheet">
    <link href="assets/css/mobile.css" rel="stylesheet">
    <style>
        .gradient-bg {
            background: linear-gradient(135deg, #3B82F6 0%, #F59E0B 50%, #6B7280 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), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
        }
    </style>
</head>
<body class="min-h-screen bg-gray-50">
    <!-- Navigation -->
    <nav class="gradient-bg shadow-lg">
        <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
            <div class="flex justify-between h-16">
                <div class="flex items-center">
                    <img src="<?php echo $settings['site_logo'] ?? SITE_LOGO; ?>" alt="Logo" class="h-8 w-8 mr-3">
                    <span class="text-white text-xl font-bold"><?php echo $settings['site_title'] ?? SITE_TITLE; ?></span>
                </div>
                <div class="flex items-center space-x-4">
                    <a href="check_status.php" class="text-white hover:text-yellow-200 transition duration-300">
                        <i class="fas fa-search mr-2"></i>Check Attendance
                    </a>
                    <div class="relative group">
                        <a href="admin/login.php" class="text-white hover:text-yellow-200 transition duration-300 flex items-center">
                            <i class="fas fa-sign-in-alt mr-2"></i>Admin Login
                            <i class="fas fa-chevron-down ml-1 text-xs"></i>
                        </a>
                        <div class="absolute right-0 mt-2 w-56 bg-white rounded-lg shadow-lg opacity-0 invisible group-hover:opacity-100 group-hover:visible transition-all duration-300 z-50">
                            <div class="py-2">
                                <a href="special_attendance_reports.php" class="block px-4 py-2 text-gray-800 hover:bg-gray-100 transition duration-300">
                                    <i class="fas fa-chart-bar mr-2 text-blue-600"></i>Special Reports
                                </a>
                                <div class="border-t border-gray-200 my-1"></div>
                                <a href="admin/login.php" class="block px-4 py-2 text-gray-800 hover:bg-gray-100 transition duration-300">
                                    <i class="fas fa-sign-in-alt mr-2 text-green-600"></i>Admin Login
                                </a>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </nav>

    <!-- Hero Section -->
    <div class="gradient-bg py-20">
        <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 text-center">
            <h1 class="text-4xl md:text-6xl font-bold text-white mb-6">
                Welcome to Our Church
            </h1>
            <p class="text-xl md:text-2xl text-white/90 mb-8 max-w-3xl mx-auto">
                Join us in worship and fellowship. Please select the program you're attending to register your attendance.
            </p>
            <div class="animate-bounce">
                <i class="fas fa-chevron-down text-white text-3xl"></i>
            </div>
        </div>
    </div>

    <!-- Programs Section -->
    <div class="py-16 bg-white">
        <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
            <div class="text-center mb-12">
                <h2 class="text-3xl md:text-4xl font-bold text-gray-900 mb-4">
                    Select Your Program
                </h2>
                <p class="text-lg text-gray-600 max-w-2xl mx-auto">
                    Choose the program you're attending today to fill out your attendance form
                </p>
            </div>

            <?php if (empty($programs)): ?>
                <div class="text-center py-12">
                    <h3 class="text-2xl font-semibold text-gray-700 mb-2">No Active Programs</h3>
                    <p class="text-gray-500">There are currently no active programs available for attendance.</p>
                </div>
            <?php else: ?>
                <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8">
                <?php foreach ($programs as $program): ?>
                    <?php 
                    // Check registration status for this program
                    $registration_status = checkRegistrationStatus($program['id']);
                    ?>
                    <div class="bg-white rounded-lg shadow-lg overflow-hidden card-hover card-mobile border border-gray-200 <?php echo !$registration_status['is_open'] ? 'opacity-75' : ''; ?>">
                        <div class="gradient-bg p-6">
                            <div class="flex items-center justify-between mb-2">
                                <h3 class="text-xl font-bold text-white">
                                    <?php echo htmlspecialchars($program['name']); ?>
                                </h3>
                                <?php if (!$registration_status['is_open']): ?>
                                    <span class="bg-red-500 text-white text-xs px-2 py-1 rounded-full">
                                        <i class="fas fa-lock mr-1"></i>Closed
                                    </span>
                                <?php elseif ($registration_status['status'] === 'scheduled_open'): ?>
                                    <span class="bg-yellow-500 text-white text-xs px-2 py-1 rounded-full">
                                        <i class="fas fa-clock mr-1"></i>Scheduled
                                    </span>
                                <?php else: ?>
                                    <span class="bg-green-500 text-white text-xs px-2 py-1 rounded-full">
                                        <i class="fas fa-check mr-1"></i>Open
                                    </span>
                                <?php endif; ?>
                            </div>
                            <p class="text-white/80">
                                <?php echo htmlspecialchars($program['location_name'] ?? 'All Locations'); ?>
                            </p>
                        </div>
                        <div class="p-6">
                            <p class="text-gray-600 mb-4">
                                <?php echo htmlspecialchars($program['description'] ?? 'Join us for this special program.'); ?>
                            </p>
                            
                            <!-- Registration Status Message -->
                            <?php if (!$registration_status['is_open']): ?>
                                <div class="bg-yellow-50 border border-yellow-200 rounded-lg p-3 mb-4">
                                    <div class="flex items-start">
                                        <i class="fas fa-exclamation-triangle text-yellow-600 mr-2 mt-0.5"></i>
                                        <div>
                                            <p class="text-sm text-yellow-800 font-medium">Registration Closed</p>
                                            <p class="text-xs text-yellow-700 mt-1"><?php echo htmlspecialchars($registration_status['message']); ?></p>
                                        </div>
                                    </div>
                                </div>
                            <?php elseif ($registration_status['status'] === 'scheduled_open' && isset($registration_status['close_date'])): ?>
                                <div class="bg-blue-50 border border-blue-200 rounded-lg p-3 mb-4">
                                    <div class="flex items-start">
                                        <i class="fas fa-info-circle text-blue-600 mr-2 mt-0.5"></i>
                                        <div>
                                            <p class="text-sm text-blue-800 font-medium">Registration Open</p>
                                            <p class="text-xs text-blue-700 mt-1">Closes on <?php echo date('M j, Y \a\t g:i A', strtotime($registration_status['close_date'])); ?></p>
                                        </div>
                                    </div>
                                </div>
                            <?php endif; ?>
                            
                            <div class="flex justify-between items-center text-sm text-gray-500 mb-4">
                                <span>
                                    <i class="fas fa-calendar mr-1"></i>
                                    <?php echo date('M j, Y', strtotime($program['start_date'])); ?>
                                </span>
                                <?php if ($program['end_date']): ?>
                                    <span>
                                        <i class="fas fa-calendar-check mr-1"></i>
                                        <?php echo date('M j, Y', strtotime($program['end_date'])); ?>
                                    </span>
                                <?php endif; ?>
                            </div>
                            
                            <?php if ($registration_status['is_open']): ?>
                                <a href="attendance/form.php?program=<?php echo $program['id']; ?>" 
                                   class="w-full bg-primary hover:bg-blue-700 text-white font-bold py-3 px-4 rounded-lg transition duration-300 block text-center">
                                    <i class="fas fa-edit mr-2"></i>
                                    Fill Attendance Form
                                </a>
                            <?php else: ?>
                                <button disabled 
                                        class="w-full bg-gray-400 text-white font-bold py-3 px-4 rounded-lg cursor-not-allowed block text-center">
                                    <i class="fas fa-lock mr-2"></i>
                                    Registration Closed
                                </button>
                            <?php endif; ?>
                        </div>
                    </div>
                    <?php endforeach; ?>
                </div>
            <?php endif; ?>
        </div>
    </div>

    <!-- Features Section -->
    <div class="py-16 bg-gray-50">
        <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
            <div class="text-center mb-12">
                <h2 class="text-3xl md:text-4xl font-bold text-gray-900 mb-4">
                    Why Attend Our Programs?
                </h2>
            </div>
            <div class="grid grid-cols-1 md:grid-cols-3 gap-8">
                <div class="text-center">
                    <div class="gradient-bg rounded-full w-16 h-16 flex items-center justify-center mx-auto mb-4">
                        <i class="fas fa-heart text-white text-2xl"></i>
                    </div>
                    <h3 class="text-xl font-semibold text-gray-900 mb-2">Fellowship</h3>
                    <p class="text-gray-600">Connect with fellow believers and build lasting relationships in our community.</p>
                </div>
                <div class="text-center">
                    <div class="gradient-bg rounded-full w-16 h-16 flex items-center justify-center mx-auto mb-4">
                        <i class="fas fa-book text-white text-2xl"></i>
                    </div>
                    <h3 class="text-xl font-semibold text-gray-900 mb-2">Learning</h3>
                    <p class="text-gray-600">Grow in faith through Bible study, sermons, and spiritual discussions.</p>
                </div>
                <div class="text-center">
                    <div class="gradient-bg rounded-full w-16 h-16 flex items-center justify-center mx-auto mb-4">
                        <i class="fas fa-hands text-white text-2xl"></i>
                    </div>
                    <h3 class="text-xl font-semibold text-gray-900 mb-2">Service</h3>
                    <p class="text-gray-600">Participate in community service and make a positive impact together.</p>
                </div>
            </div>
        </div>
    </div>

    <!-- Footer -->
    <footer class="gradient-bg py-8">
        <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
            <div class="text-center text-white">
                <p class="text-lg"><?php echo $settings['footer_title'] ?? FOOTER_TITLE; ?></p>
                <p class="text-white/70 mt-2">Built with love for our church community</p>
            </div>
        </div>
    </footer>

    <script>
        // Add smooth scrolling
        document.querySelectorAll('a[href^="#"]').forEach(anchor => {
            anchor.addEventListener('click', function (e) {
                e.preventDefault();
                document.querySelector(this.getAttribute('href')).scrollIntoView({
                    behavior: 'smooth'
                });
            });
        });

        // Add loading animation for form links
        document.querySelectorAll('a[href*="form.php"]').forEach(link => {
            link.addEventListener('click', function() {
                this.innerHTML = '<i class="fas fa-spinner fa-spin mr-2"></i>Loading...';
            });
        });
    </script>
</body>
</html>

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