141 lines
7.4 KiB
PHP
141 lines
7.4 KiB
PHP
<?php
|
|
require_once 'config.php';
|
|
require_once 'db/config.php';
|
|
include 'header.php';
|
|
|
|
// Protected page
|
|
if (!isset($_SESSION['user_email'])) {
|
|
header('Location: login.php');
|
|
exit;
|
|
}
|
|
?>
|
|
|
|
<div class="container-fluid mt-5">
|
|
<div class="row">
|
|
<div class="col-12">
|
|
<div class="card">
|
|
<div class="card-header">
|
|
<h2><i class="bi bi-bar-chart-line-fill me-2"></i>Data Analysis Mockup</h2>
|
|
</div>
|
|
<div class="card-body">
|
|
<p>This is a static mockup to illustrate the data analysis interface. The data below is for demonstration purposes only.</p>
|
|
|
|
<!-- Filters -->
|
|
<div class="card mb-4">
|
|
<div class="card-body bg-light">
|
|
<h5 class="card-title">Filters</h5>
|
|
<form class="row g-3 align-items-end">
|
|
<div class="col-md-3">
|
|
<label for="filterYear" class="form-label">Year</label>
|
|
<select id="filterYear" class="form-select">
|
|
<option selected>2024</option>
|
|
<option>2023</option>
|
|
<option>2022</option>
|
|
</select>
|
|
</div>
|
|
<div class="col-md-3">
|
|
<label for="filterPollutant" class="form-label">Pollutant</label>
|
|
<select id="filterPollutant" class="form-select">
|
|
<option selected>Carbon Dioxide (CO2)</option>
|
|
<option>Methane (CH4)</option>
|
|
<option>Nitrogen Oxides (NOx)</option>
|
|
</select>
|
|
</div>
|
|
<div class="col-md-4">
|
|
<label for="filterRegion" class="form-label">Region / NUTS Code</label>
|
|
<input type="text" class="form-control" id="filterRegion" placeholder="e.g., UKN0">
|
|
</div>
|
|
<div class="col-md-2">
|
|
<button type="submit" class="btn btn-primary w-100">Apply</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Chart Placeholder -->
|
|
<div class="row text-center">
|
|
<div class="col-lg-8 mb-4">
|
|
<div class="card h-100">
|
|
<div class="card-header">Emissions Trend (Chart Placeholder)</div>
|
|
<div class="card-body d-flex align-items-center justify-content-center bg-light">
|
|
<div class="text-muted">
|
|
<i class="bi bi-graph-up" style="font-size: 3rem;"></i>
|
|
<p>Chart would be rendered here.</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="col-lg-4 mb-4">
|
|
<div class="card h-100">
|
|
<div class="card-header">Key Metrics</div>
|
|
<div class="card-body">
|
|
<div class="d-flex justify-content-between align-items-center border-bottom pb-2 mb-2">
|
|
<span>Total Facilities Reporting:</span>
|
|
<span class="badge bg-primary rounded-pill fs-6">1,204</span>
|
|
</div>
|
|
<div class="d-flex justify-content-between align-items-center border-bottom pb-2 mb-2">
|
|
<span>Total Emissions (Tons):</span>
|
|
<span class="badge bg-success rounded-pill fs-6">4.5M</span>
|
|
</div>
|
|
<div class="d-flex justify-content-between align-items-center">
|
|
<span>Compliance Rate:</span>
|
|
<span class="badge bg-warning rounded-pill fs-6">98.2%</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<!-- Data Table -->
|
|
<h5>Submitted Reports</h5>
|
|
<div class="table-responsive">
|
|
<table class="table table-striped table-hover">
|
|
<thead class="table-dark">
|
|
<tr>
|
|
<th>ID</th>
|
|
<th>Original Filename</th>
|
|
<th>Upload Time</th>
|
|
<th>Status</th>
|
|
<th>Uploaded By</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php
|
|
try {
|
|
$pdo = db();
|
|
$stmt = $pdo->query('SELECT id, original_filename, upload_time, status, uploaded_by FROM uploaded_files ORDER BY upload_time DESC');
|
|
$files = $stmt->fetchAll();
|
|
|
|
if (empty($files)):
|
|
?>
|
|
<tr>
|
|
<td colspan="5" class="text-center">No files have been uploaded yet.</td>
|
|
</tr>
|
|
<?php else: foreach ($files as $file): ?>
|
|
<tr>
|
|
<td><?php echo htmlspecialchars($file['id']); ?></td>
|
|
<td><?php echo htmlspecialchars($file['original_filename']); ?></td>
|
|
<td><?php echo htmlspecialchars($file['upload_time']); ?></td>
|
|
<td><span class="badge bg-secondary"><?php echo htmlspecialchars($file['status']); ?></span></td>
|
|
<td><?php echo htmlspecialchars($file['uploaded_by']); ?></td>
|
|
</tr>
|
|
<?php endforeach; endif;
|
|
} catch (PDOException $e) {
|
|
echo '<tr><td colspan="5" class="text-center text-danger">Error fetching data: ' . htmlspecialchars($e->getMessage()) . '</td></tr>';
|
|
}
|
|
?>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<div class="d-flex justify-content-end">
|
|
<button class="btn btn-secondary"><i class="bi bi-download me-2"></i>Export as CSV</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<?php include 'footer.php'; ?>
|