TKK_E32222628/hydrop_web/resources/views/dashboard.blade.php

168 lines
4.1 KiB
PHP

<!DOCTYPE html>
<html lang="id">
<head>
<meta charset="UTF-8">
<title>Dashboard IoT - Sidebar & Grafik</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">
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<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;
}
.chart-container {
background: white;
padding: 30px;
border-radius: 15px;
box-shadow: 0 10px 25px rgba(0,0,0,0.1);
}
canvas {
max-width: 100%;
}
.user-info {
background: white;
padding: 20px;
border-radius: 15px;
box-shadow: 0 10px 25px rgba(0,0,0,0.1);
margin-bottom: 30px;
}
.user-info h3 {
color: #2e7d32;
margin-bottom: 15px;
}
</style>
</head>
<body>
<div class="sidebar">
<h2><i class="fas fa-seedling"></i> Hidroponik</h2>
<a href="{{ route('dashboard') }}" class="active"><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') }}"><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>Dashboard Monitoring</h1>
<div class="user-info">
<h3>Selamat datang, {{ Auth::user()->name }}!</h3>
<p><strong>Email:</strong> {{ Auth::user()->email }}</p>
<p><strong>Login pada:</strong> {{ now()->format('d/m/Y H:i:s') }}</p>
</div>
<div class="chart-container">
<h3>Grafik Suhu & Kelembaban</h3>
<canvas id="sensorChart" height="100"></canvas>
</div>
</div>
<script>
const ctx = document.getElementById('sensorChart').getContext('2d');
const sensorChart = new Chart(ctx, {
type: 'line',
data: {
labels: ['10:00', '11:00', '12:00', '13:00', '14:00'],
datasets: [
{
label: 'Suhu (°C)',
data: [25, 27, 26, 28, 29],
borderColor: '#f39c12',
backgroundColor: 'rgba(243, 156, 18, 0.1)',
fill: true
},
{
label: 'Kelembaban (%)',
data: [60, 65, 62, 67, 70],
borderColor: '#3498db',
backgroundColor: 'rgba(52, 152, 219, 0.1)',
fill: true
}
]
},
options: {
responsive: true,
scales: {
y: {
beginAtZero: true
}
}
}
});
</script>
</body>
</html>