35573-vm/index.php
2025-11-08 15:26:25 +00:00

108 lines
5.1 KiB
PHP

<?php
require_once __DIR__ . '/db/config.php';
// Fetch schemes from the database
$schemes = [];
try {
$stmt = db()->query("SELECT id, name, description, url FROM schemes ORDER BY name ASC");
$schemes = $stmt->fetchAll(PDO::FETCH_ASSOC);
} catch (PDOException $e) {
error_log("Could not fetch schemes: " . $e->getMessage());
// You could set a user-facing error message here if you want
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Smart Farmer Support System</title>
<meta name="description" content="A web application to support farmers in Maharashtra, India by providing access to government schemes, risk evaluation, and support services. Built with Flatlogic Generator.">
<meta name="keywords" content="farmer support, agriculture, Maharashtra, government schemes, crop insurance, farmer distress, Jalyukt Shivar, Kisan Credit Card, PMFBY, Built with Flatlogic Generator">
<!-- Social Media Meta Tags -->
<meta property="og:title" content="Smart Farmer Support System">
<meta property="og:description" content="Empowering Farmers, Saving Lives. An initiative to reduce farmer distress in Maharashtra.">
<meta property="og:image" content="<?php echo htmlspecialchars($_SERVER['PROJECT_IMAGE_URL'] ?? ''); ?>">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:image" content="<?php echo htmlspecialchars($_SERVER['PROJECT_IMAGE_URL'] ?? ''); ?>">
<!-- Bootstrap CSS -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
<!-- Bootstrap Icons -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">
<!-- Google Fonts -->
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;700&display=swap" rel="stylesheet">
<!-- Custom CSS -->
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
</head>
<body>
<?php include 'partials/navbar.php'; ?>
<!-- Hero Section -->
<header class="hero">
<div class="container">
<h1 class="display-4">Empowering Farmers, Saving Lives.</h1>
<p class="lead">Your one-stop solution for agricultural support, risk assessment, and government schemes in Maharashtra.</p>
<a href="#schemes" class="btn btn-primary btn-lg">Explore Schemes</a>
</div>
</header>
<!-- Government Schemes Section -->
<main id="schemes" class="container my-5">
<div class="text-center mb-5">
<h2>Government Schemes</h2>
<p class="lead">Explore central and state government schemes to support your farming activities.</p>
</div>
<div class="row g-4">
<?php if (empty($schemes)): ?>
<div class="col">
<div class="alert alert-warning" role="alert">
Could not load schemes at the moment. Please try again later.
</div>
</div>
<?php else: ?>
<?php foreach ($schemes as $scheme): ?>
<div class="col-md-6 col-lg-4 d-flex align-items-stretch">
<div class="card scheme-card w-100">
<div class="card-body d-flex flex-column">
<h5 class="card-title"><?php echo htmlspecialchars($scheme['name']); ?></h5>
<p class="card-text flex-grow-1"><?php echo htmlspecialchars($scheme['description']); ?></p>
<div class="mt-auto">
<a href="scheme.php?id=<?php echo $scheme['id']; ?>" class="btn btn-outline-secondary btn-sm">Learn More</a>
<?php if (isset($_SESSION['farmer_id'])):
$apply_url = 'apply.php?scheme_id=' . $scheme['id'];
$apply_text = 'Apply Now';
else:
$apply_url = 'register.php';
$apply_text = 'Register to Apply';
endif; ?>
<a href="<?php echo $apply_url; ?>" class="btn btn-primary btn-sm"><?php echo $apply_text; ?></a>
</div>
</div>
</div>
</div>
<?php endforeach; ?>
<?php endif; ?>
</div>
</main>
<!-- Footer -->
<footer class="footer">
<div class="container">
<p>&copy; <?php echo date('Y'); ?> Smart Farmer Support System. All Rights Reserved.</p>
<p>Developed by JAY | Senior Project 2025.</p>
</div>
</footer>
<!-- Bootstrap JS -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
<!-- Custom JS -->
<script src="assets/js/main.js?v=<?php echo time(); ?>"></script>
</body>
</html>