230 lines
5.3 KiB
PHP
230 lines
5.3 KiB
PHP
<!DOCTYPE html>
|
|
<html lang="id">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<title>Sensor - 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: 0.3s ease;
|
|
}
|
|
|
|
.sidebar a:hover {
|
|
background-color: rgba(255, 255, 255, 0.1);
|
|
}
|
|
|
|
.sidebar a.active {
|
|
background-color: rgba(255, 255, 255, 0.2);
|
|
}
|
|
|
|
.sidebar a i {
|
|
font-size: 20px;
|
|
}
|
|
|
|
.main-content {
|
|
flex: 1;
|
|
padding: 40px;
|
|
}
|
|
|
|
.main-content h1 {
|
|
margin-bottom: 30px;
|
|
color: #2e7d32;
|
|
}
|
|
|
|
table {
|
|
width: 100%;
|
|
border-collapse: collapse;
|
|
margin-top: 20px;
|
|
background-color: white;
|
|
box-shadow: 0 10px 25px rgba(0,0,0,0.1);
|
|
border-radius: 15px;
|
|
overflow: hidden;
|
|
}
|
|
|
|
th, td {
|
|
border: 1px solid #ddd;
|
|
padding: 12px 16px;
|
|
text-align: center;
|
|
}
|
|
|
|
th {
|
|
background-color: #2e7d32;
|
|
color: white;
|
|
font-weight: 600;
|
|
}
|
|
|
|
tr:nth-child(even) {
|
|
background-color: #f1f1f1;
|
|
}
|
|
|
|
tr:hover {
|
|
background-color: #e0f2f1;
|
|
}
|
|
|
|
.tabs {
|
|
margin-bottom: 20px;
|
|
}
|
|
|
|
.tab-buttons {
|
|
display: flex;
|
|
margin-bottom: 20px;
|
|
}
|
|
|
|
.tab-button {
|
|
padding: 12px 24px;
|
|
background-color: #e0e0e0;
|
|
border: none;
|
|
cursor: pointer;
|
|
border-radius: 5px 5px 0 0;
|
|
margin-right: 5px;
|
|
font-weight: 600;
|
|
transition: background-color 0.3s;
|
|
}
|
|
|
|
.tab-button.active {
|
|
background-color: #2e7d32;
|
|
color: white;
|
|
}
|
|
|
|
.tab-button:hover {
|
|
background-color: #c5e1a5;
|
|
}
|
|
|
|
.tab-button.active:hover {
|
|
background-color: #388e3c;
|
|
}
|
|
|
|
.tab-content {
|
|
display: none;
|
|
}
|
|
|
|
.tab-content.active {
|
|
display: block;
|
|
}
|
|
|
|
.data-source-badge {
|
|
display: inline-block;
|
|
padding: 4px 8px;
|
|
background-color: #4caf50;
|
|
color: white;
|
|
border-radius: 12px;
|
|
font-size: 12px;
|
|
margin-left: 10px;
|
|
}
|
|
|
|
.firebase-badge {
|
|
background-color: #ff9800;
|
|
}
|
|
|
|
.sync-info {
|
|
background-color: #e3f2fd;
|
|
border-left: 4px solid #2196f3;
|
|
padding: 15px;
|
|
margin-bottom: 20px;
|
|
border-radius: 5px;
|
|
}
|
|
</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') }}" class="active"><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') }}"><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>Data Sensor <span class="data-source-badge firebase-badge"><i class="fas fa-cloud"></i> Firebase</span></h1>
|
|
|
|
<div class="sync-info">
|
|
<i class="fas fa-database"></i>
|
|
<strong>Data Source:</strong> Firebase Realtime Database.
|
|
Total Records: <strong>{{ count($sensorData) }}</strong>
|
|
@if(count($sensorData) > 0)
|
|
| Last Update: <strong>{{ $sensorData[0]['created_at'] }}</strong>
|
|
@endif
|
|
</div>
|
|
|
|
<table>
|
|
<tr>
|
|
<th>Firebase Key</th>
|
|
<th>Temperature (°C)</th>
|
|
<th>Humidity (%)</th>
|
|
<th>pH</th>
|
|
<th>TDS (ppm)</th>
|
|
<th>Timestamp</th>
|
|
<th>Created At</th>
|
|
</tr>
|
|
@forelse($sensorData as $data)
|
|
<tr>
|
|
<td>{{ $data['firebase_key'] }}</td>
|
|
<td>{{ $data['temperature'] }}°C</td>
|
|
<td>{{ $data['humidity'] }}%</td>
|
|
<td>{{ $data['ph'] }}</td>
|
|
<td>{{ $data['tds'] }}</td>
|
|
<td>{{ $data['timestamp'] }}</td>
|
|
<td>{{ $data['created_at'] }}</td>
|
|
</tr>
|
|
@empty
|
|
<tr>
|
|
<td colspan="7" style="text-align: center; padding: 20px;">
|
|
<i class="fas fa-exclamation-circle"></i> Belum ada data sensor di Firebase<br>
|
|
<small>Kirim data dari ESP32/Arduino atau gunakan API endpoint</small>
|
|
</td>
|
|
</tr>
|
|
@endforelse
|
|
</table>
|
|
</div>
|
|
|
|
</body>
|
|
</html> |