TKK_E32222628/hydrop_web/resources/views/pages/report.blade.php

372 lines
9.6 KiB
PHP

<!DOCTYPE html>
<html lang="id">
<head>
<meta charset="UTF-8">
<title>Report - IoT Dashboard</title>
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;600&display=swap" rel="stylesheet">
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.0/css/all.min.css" rel="stylesheet">
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: 'Poppins', sans-serif;
}
body {
display: flex;
min-height: 100vh;
background: #f0f4f8;
}
.sidebar {
width: 250px;
background-color: #2e7d32;
color: white;
padding: 20px;
height: 100vh;
display: flex;
flex-direction: column;
}
.sidebar h2 {
margin-bottom: 30px;
font-size: 22px;
}
.sidebar a {
display: flex;
align-items: center;
justify-content: flex-start;
gap: 15px;
padding: 16px 20px;
margin: 10px 0;
background-color: transparent;
color: white;
text-decoration: none;
border-radius: 10px;
font-size: 18px;
font-weight: 600;
transition: background-color 0.3s;
}
.sidebar a:hover {
background-color: rgba(255,255,255,0.1);
}
.sidebar a.active {
background-color: #388e3c;
}
.main-content {
flex: 1;
padding: 40px;
}
.main-content h1 {
color: #2e7d32;
margin-bottom: 20px;
font-size: 28px;
}
.filter-section {
background-color: white;
padding: 20px;
border-radius: 10px;
margin-bottom: 20px;
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}
.filter-form {
display: flex;
gap: 15px;
align-items: center;
flex-wrap: wrap;
}
.filter-form input, .filter-form select, .filter-form button {
padding: 10px 15px;
border: 1px solid #ddd;
border-radius: 5px;
font-size: 14px;
}
.filter-form button {
background-color: #2e7d32;
color: white;
border: none;
cursor: pointer;
transition: background-color 0.3s;
}
.filter-form button:hover {
background-color: #388e3c;
}
.export-buttons {
display: flex;
gap: 10px;
margin-bottom: 20px;
}
.export-btn {
padding: 12px 20px;
border: none;
border-radius: 5px;
cursor: pointer;
font-weight: 600;
text-decoration: none;
display: inline-flex;
align-items: center;
gap: 8px;
transition: background-color 0.3s;
}
.excel-btn {
background-color: #4caf50;
color: white;
}
.excel-btn:hover {
background-color: #45a049;
}
.report-table {
background-color: white;
border-radius: 10px;
overflow: hidden;
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
margin-bottom: 30px;
}
.table-title {
background-color: #2e7d32;
color: white;
padding: 15px 20px;
font-size: 18px;
font-weight: 600;
text-align: center;
}
table {
width: 100%;
border-collapse: collapse;
}
th, td {
border: 1px solid #ddd;
padding: 12px 16px;
text-align: center;
}
th {
background-color: #f5f5f5;
font-weight: 600;
color: #333;
}
tr:nth-child(even) {
background-color: #f9f9f9;
}
tr:hover {
background-color: #e8f5e8;
}
.no-data {
text-align: center;
padding: 30px;
color: #666;
font-style: italic;
}
.data-source-badge {
display: inline-block;
padding: 4px 8px;
background-color: #ff9800;
color: white;
border-radius: 12px;
font-size: 12px;
margin-left: 10px;
}
.summary-cards {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
gap: 20px;
margin-bottom: 30px;
}
.summary-card {
background-color: white;
padding: 20px;
border-radius: 10px;
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
text-align: center;
}
.summary-card h3 {
color: #2e7d32;
margin-bottom: 10px;
}
.summary-card .count {
font-size: 24px;
font-weight: 600;
color: #333;
}
</style>
</head>
<body>
<div class="sidebar">
<h2><i class="fas fa-seedling"></i> Hidroponik</h2>
<a href="{{ route('dashboard') }}"><i class="fas fa-tachometer-alt"></i> Dashboard</a>
<a href="{{ route('sensor') }}"><i class="fas fa-thermometer-half"></i> Sensor</a>
<a href="{{ route('actuator') }}"><i class="fas fa-microchip"></i> Aktuator</a>
<a href="{{ route('umur') }}"><i class="fas fa-leaf"></i> Umur Tanaman</a>
<a href="{{ route('report') }}" class="active"><i class="fas fa-download"></i> Report</a>
<a href="{{ route('help') }}"><i class="fas fa-question-circle"></i> Bantuan</a>
<form method="POST" action="{{ route('logout') }}" style="margin: 0;">
@csrf
<a href="#" onclick="this.closest('form').submit(); return false;"><i class="fas fa-sign-out-alt"></i> Logout</a>
</form>
</div>
<div class="main-content">
<h1>Report Data Monitoring <span class="data-source-badge"><i class="fas fa-cloud"></i> Firebase</span></h1>
<!-- Filter Section -->
<div class="filter-section">
<h3><i class="fas fa-filter"></i> Filter Data</h3>
<form method="GET" action="{{ route('report') }}" class="filter-form">
<label>Dari Tanggal:</label>
<input type="date" name="date_from" value="{{ $dateFrom ?? '' }}">
<label>Sampai Tanggal:</label>
<input type="date" name="date_to" value="{{ $dateTo ?? '' }}">
<button type="submit"><i class="fas fa-search"></i> Filter</button>
</form>
</div>
<!-- Export Buttons -->
<div class="export-buttons">
<a href="{{ route('report') }}?{{ http_build_query(array_merge(request()->all(), ['export' => 'csv'])) }}" class="export-btn excel-btn">
<i class="fas fa-file-excel"></i> Export Excel
</a>
</div>
<!-- Summary Cards -->
@if(isset($firebaseReportData['summary']))
<div class="summary-cards">
<div class="summary-card">
<h3><i class="fas fa-thermometer-half"></i> Data Sensor</h3>
<div class="count">{{ $firebaseReportData['summary']['total_sensor_records'] }}</div>
</div>
<div class="summary-card">
<h3><i class="fas fa-microchip"></i> Data Aktuator</h3>
<div class="count">{{ $firebaseReportData['summary']['total_actuator_records'] }}</div>
</div>
<div class="summary-card">
<h3><i class="fas fa-leaf"></i> Data Umur Tanaman</h3>
<div class="count">{{ $firebaseReportData['summary']['total_umur_tanaman_records'] }}</div>
</div>
</div>
@endif
<!-- Data Sensor Table -->
<!-- <div class="report-table">
<div class="table-title">
<i class="fas fa-thermometer-half"></i> Data Monitoring Sensor
</div>
<table>
<tr>
<th style="width:50px;">No</th>
<th style="width:100px;">Suhu (°C)</th>
<th style="width:120px;">Kelembaban (%)</th>
<th style="width:180px;">Waktu</th>
</tr>
@forelse($firebaseReportData['sensor'] ?? [] as $index => $data)
<tr>
<td>{{ $index + 1 }}</td>
<td>{{ $data['suhu'] }}</td>
<td>{{ $data['kelembaban'] }}</td>
<td>{{ $data['created_at'] }}</td>
</tr>
@empty
<tr>
<td colspan="4" class="no-data">
<i class="fas fa-exclamation-circle"></i> Tidak ada data sensor
</td>
</tr>
@endforelse
</table>
</div> -->
<!-- Data Aktuator Table -->
<!-- <div class="report-table">
<div class="table-title">
<i class="fas fa-microchip"></i> Data Monitoring Aktuator
</div>
<table>
<tr>
<th style="width:50px;">No</th>
<th style="width:150px;">Nama Aktuator</th>
<th style="width:100px;">Status</th>
<th style="width:180px;">Waktu</th>
</tr>
@forelse($firebaseReportData['actuator'] ?? [] as $index => $data)
<tr>
<td>{{ $index + 1 }}</td>
<td>{{ $data['nama'] }}</td>
<td>{{ $data['status'] }}</td>
<td>{{ $data['created_at'] }}</td>
</tr>
@empty
<tr>
<td colspan="4" class="no-data">
<i class="fas fa-exclamation-circle"></i> Tidak ada data aktuator
</td>
</tr>
@endforelse
</table>
</div> -->
<!-- Data Umur Tanaman Table -->
<!-- <div class="report-table">
<div class="table-title">
<i class="fas fa-leaf"></i> Data Monitoring Umur Tanaman
</div>
<table>
<tr>
<th style="width:50px;">No</th>
<th style="width:150px;">Jenis Tanaman</th>
<th style="width:120px;">Tanggal Tanam</th>
<th style="width:100px;">Umur (Hari)</th>
<th style="width:100px;">Status</th>
<th style="width:180px;">Waktu</th>
</tr>
@forelse($firebaseReportData['umur_tanaman'] ?? [] as $index => $data)
<tr>
<td>{{ $index + 1 }}</td>
<td>{{ $data['jenis_tanaman'] }}</td>
<td>{{ $data['tanggal_tanam'] }}</td>
<td>{{ $data['umur_hari'] }} hari</td>
<td>{{ ucfirst($data['status']) }}</td>
<td>{{ $data['created_at'] }}</td>
</tr>
@empty
<tr>
<td colspan="6" class="no-data">
<i class="fas fa-exclamation-circle"></i> Tidak ada data umur tanaman
</td>
</tr>
@endforelse
</table>
</div> -->
</div>
</body>