100 lines
4.3 KiB
PHP
100 lines
4.3 KiB
PHP
<?php
|
|
declare(strict_types=1);
|
|
@ini_set('display_errors', '1');
|
|
@error_reporting(E_ALL);
|
|
@date_default_timezone_set('UTC');
|
|
|
|
require_once 'db/config.php';
|
|
|
|
$plants = [];
|
|
try {
|
|
$pdo = db();
|
|
$stmt = $pdo->query('SELECT * FROM plants ORDER BY created_at DESC');
|
|
$plants = $stmt->fetchAll();
|
|
} catch (PDOException $e) {
|
|
// If the table doesn't exist, we can ignore the error for now
|
|
}
|
|
|
|
?>
|
|
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Solyug Tracker</title>
|
|
<meta name="description" content="Built with Flatlogic Generator">
|
|
<meta name="keywords" content="solar plant monitoring, solar energy, renewable energy, plant management, solar panel tracking, energy analytics, solar farm, Built with Flatlogic Generator">
|
|
<meta property="og:title" content="Solyug Tracker">
|
|
<meta property="og:description" content="Built with Flatlogic Generator">
|
|
<meta property="og:image" content="">
|
|
<meta name="twitter:card" content="summary_large_image">
|
|
<meta name="twitter:image" content="">
|
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
|
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">
|
|
<link rel="stylesheet" href="assets/css/custom.css">
|
|
</head>
|
|
<body>
|
|
<nav class="navbar navbar-expand-lg navbar-dark bg-primary">
|
|
<div class="container-fluid">
|
|
<a class="navbar-brand" href="index.php">Solyug Tracker</a>
|
|
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
|
|
<span class="navbar-toggler-icon"></span>
|
|
</button>
|
|
<div class="collapse navbar-collapse" id="navbarNav">
|
|
<ul class="navbar-nav">
|
|
<li class="nav-item">
|
|
<a class="nav-link active" aria-current="page" href="index.php">Home</a>
|
|
</li>
|
|
<li class="nav-item">
|
|
<a class="nav-link" href="add_plant.php">Add Plant</a>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
</nav>
|
|
|
|
<div class="container mt-5">
|
|
<div class="jumbotron text-center">
|
|
<h1 class="display-4">Welcome to Solyug Tracker</h1>
|
|
<p class="lead">Your central hub for monitoring and managing your solar plant portfolio.</p>
|
|
<hr class="my-4">
|
|
<p>Start by adding a new solar plant to your portfolio.</p>
|
|
<a class="btn btn-primary btn-lg" href="add_plant.php" role="button"><i class="bi bi-plus-circle"></i> Add New Plant</a>
|
|
</div>
|
|
|
|
<div class="mt-5">
|
|
<h2><i class="bi bi-speedometer2"></i> Recently Added Plants</h2>
|
|
<?php if (empty($plants)): ?>
|
|
<div class="alert alert-info mt-3">
|
|
No plants have been registered yet.
|
|
</div>
|
|
<?php else: ?>
|
|
<table class="table table-striped mt-3">
|
|
<thead>
|
|
<tr>
|
|
<th>Name</th>
|
|
<th>Location</th>
|
|
<th>Capacity (kW)</th>
|
|
<th>Commissioning Date</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php foreach ($plants as $plant): ?>
|
|
<tr>
|
|
<td><?php echo htmlspecialchars($plant['name']); ?></td>
|
|
<td><?php echo htmlspecialchars($plant['location']); ?></td>
|
|
<td><?php echo htmlspecialchars($plant['capacity']); ?></td>
|
|
<td><?php echo htmlspecialchars($plant['commissioning_date']); ?></td>
|
|
</tr>
|
|
<?php endforeach; ?>
|
|
</tbody>
|
|
</table>
|
|
<?php endif; ?>
|
|
</div>
|
|
</div>
|
|
|
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
|
|
<script src="assets/js/main.js"></script>
|
|
</body>
|
|
</html>
|