354 lines
10 KiB
PHP
354 lines
10 KiB
PHP
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
|
<title>Monitoring Tumbuhan</title>
|
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
|
|
<script src="https://code.jquery.com/jquery-3.7.1.min.js" integrity="sha256-/JqT3SQfawRcv/BIHPThkBvs0OEvtFFmqPF/lYI/Cxo=" crossorigin="anonymous"></script>
|
|
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
|
|
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css" rel="stylesheet">
|
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.min.css">
|
|
<style>
|
|
body {
|
|
font-family: Arial, sans-serif;
|
|
background-color: #f5f5f5;
|
|
}
|
|
.sidebar {
|
|
height: 100%; /*tinggi*/
|
|
width: 250px; /*lebar*/
|
|
position: fixed;
|
|
top: 0;
|
|
left: 0;
|
|
background-color: #343a40;
|
|
padding-top: 20px;
|
|
color: #ffffff;
|
|
}
|
|
.sidebar ul {
|
|
list-style-type: none;
|
|
padding: 0;
|
|
}
|
|
.sidebar li {
|
|
padding: 15px 10px;
|
|
font-size: 16px;
|
|
}
|
|
.sidebar li.active {
|
|
background-color: #495057;
|
|
}
|
|
.sidebar li a {
|
|
text-decoration: none;
|
|
color: #ffffff;
|
|
display: flex;
|
|
align-items: center;
|
|
}
|
|
.sidebar li a i {
|
|
margin-right: 10px; /*Menambahkan margin kanan pada ikon di sidebar*/
|
|
}
|
|
.content {
|
|
margin-left: 250px;
|
|
padding: 20px;
|
|
}
|
|
.navbar {
|
|
margin-left: 250px;
|
|
background-color: #DCDCDC;
|
|
}
|
|
.info-box {
|
|
display: block;
|
|
min-height: 90px;
|
|
background: #333333;
|
|
border-radius: 10px;
|
|
padding: 20px;
|
|
margin-bottom: 15px;
|
|
border: 1px solid #ddd;
|
|
transition: all 0.3s ease;
|
|
}
|
|
|
|
.info-box:hover {
|
|
box-shadow: 0 3px 10px rgba(0,0,0,0.1);
|
|
transform: translateY(-2px);
|
|
}
|
|
|
|
.info-box-content {
|
|
display: flex;
|
|
align-items: center;
|
|
}
|
|
|
|
.info-box-icon {
|
|
font-size: 36px;
|
|
color: #ADFF2F;
|
|
margin-right: 15px;
|
|
}
|
|
|
|
.info-box-text {
|
|
font-size: 16px;
|
|
font-weight: bold;
|
|
color: #fff;
|
|
}
|
|
|
|
.info-box-number {
|
|
font-size: 24px;
|
|
font-weight: bold;
|
|
color: #fff;
|
|
margin-left: 15px;
|
|
}
|
|
/* Tabel Riwayat Data */
|
|
table {
|
|
width: 100%;
|
|
border-collapse: collapse;
|
|
border-radius: 10px;
|
|
overflow: hidden;
|
|
}
|
|
th, td {
|
|
border: 1px solid #ddd;
|
|
padding: 12px;
|
|
text-align: left;
|
|
font-size: 14px;
|
|
}
|
|
th {
|
|
background-color: #333333;
|
|
color: #7FFF00;
|
|
}
|
|
tbody tr:nth-child(even) {
|
|
background-color: #f2f2f2; /*Memberi latar belakang abu-abu terang pada baris genap dalam tabel*/
|
|
}
|
|
tbody tr:hover {
|
|
background-color: #f1f1f1;
|
|
}
|
|
h1 {
|
|
text-align: center; /*Menambahkan teks rata tengah*/
|
|
font-size: 24px;
|
|
}
|
|
/* Custom pagination styles */
|
|
.pagination {
|
|
margin: 20px 0;
|
|
text-align: right;
|
|
}
|
|
|
|
.pagination a,
|
|
.pagination span {
|
|
margin: 0 2px;
|
|
padding: 5px 10px;
|
|
border: 1px solid #ddd;
|
|
text-decoration: none;
|
|
color: #333;
|
|
font-size: 12px;
|
|
}
|
|
|
|
.pagination a:hover,
|
|
.pagination span.current {
|
|
background-color: #f4f4f4;
|
|
}
|
|
|
|
.pagination .active {
|
|
background-color: #333;
|
|
color: white;
|
|
border: 1px solid #333;
|
|
}
|
|
|
|
@media (max-width: 768px) { /*membuat halaman lebih responsif*/
|
|
.sidebar {
|
|
width: 100%;
|
|
height: auto;
|
|
position: relative;
|
|
}
|
|
.sidebar ul {
|
|
display: flex;
|
|
flex-direction: row;
|
|
justify-content: space-around;
|
|
}
|
|
.sidebar li {
|
|
text-align: center;
|
|
padding: 10px;
|
|
}
|
|
.content, .navbar {
|
|
margin-left: 0;
|
|
padding: 20px;
|
|
}
|
|
.navbar {
|
|
margin-bottom: 20px;
|
|
}
|
|
}
|
|
|
|
@media (max-width: 576px) {
|
|
.info-box-content {
|
|
flex-direction: column;
|
|
align-items: flex-start;
|
|
}
|
|
.info-box-icon {
|
|
margin-right: 0;
|
|
margin-bottom: 10px;
|
|
}
|
|
.pagination {
|
|
text-align: center;
|
|
}
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
|
|
<div class="sidebar">
|
|
<ul>
|
|
@if(Auth::check() && Auth::user()->is_admin == 1)
|
|
<li class="active"><a href="/dashboard"><i class="fas fa-cogs"></i>Riwayat Data</a></li>
|
|
@endif
|
|
<li><a href="kontroling"><i class="fas fa-tachometer-alt"></i>Dashboard</a></li>
|
|
<li><a href="/blog"><i class="fas fa-blog"></i>Blog</a></li>
|
|
<li><a href="{{ route('logout') }}" class="fas fa-sign-out-alt">Logout</a></li>
|
|
</ul>
|
|
</div>
|
|
|
|
</form>
|
|
|
|
</ul>
|
|
</div>
|
|
|
|
<nav class="navbar navbar-expand-lg">
|
|
<div class="container-fluid">
|
|
<a class="navbar-brand fw-bold" href="#">GrowWatch</a>
|
|
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
|
|
<span class="navbar-toggler-icon"></span>
|
|
</button>
|
|
<form class="d-flex ms-auto" role="search">
|
|
<span class="navbar-text fw-bold animate__animated animate__fadeInUp"><i class="fas fa-user-circle fa-lg me-1"></i>
|
|
Selamat Datang, {{ Auth::user()->name }}</span>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</nav>
|
|
|
|
<div class="content">
|
|
<div class="info-box">
|
|
<div class="info-box-content">
|
|
<i class="info-box-icon fas fa-leaf"></i>
|
|
<span class="info-box-text">Daftar Riwayat Data Sensor</span>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Filter Date Input -->
|
|
<form method="GET" action="/filter">
|
|
<div class="mb-3">
|
|
<label>Start Date: </label>
|
|
<input type="date" name="start_date" class="form-control">
|
|
</div>
|
|
|
|
<div class="mb-3">
|
|
<label>End Date: </label>
|
|
<input type="date" name="end_date" class="form-control">
|
|
</div>
|
|
|
|
<div class="col-md-1 pt-4">
|
|
<button type="submit" class="btn btn-success w-100">Filter</button>
|
|
</div>
|
|
|
|
<br></br>
|
|
<table id="data-table">
|
|
<thead>
|
|
<tr>
|
|
<th>Soil</th>
|
|
<th>Humidity</th>
|
|
<th>Temperature</th>
|
|
<th>Intensity</th>
|
|
<th>Baterai</th>
|
|
<th>Waktu</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@foreach ($data as $record)
|
|
<tr>
|
|
<td>{{ $record->soil }}Rh</td>
|
|
<td>{{ $record->humidity }}%</td>
|
|
<td>{{ $record->temperature }}°C</td>
|
|
<td>{{ $record->intensity }} lux</td>
|
|
<td>{{ $record->baterai }}%</td>
|
|
<td>{{ $record->time }}</td>
|
|
</tr>
|
|
@endforeach
|
|
</tbody>
|
|
</table>
|
|
|
|
<!-- Chart Container -->
|
|
<div style="width: 100%; display: flex; flex-wrap: wrap;">
|
|
<div style="width: 45%; padding: 10px;">
|
|
<canvas id="chartIntensity" height="200"></canvas>
|
|
</div>
|
|
<div style="width: 45%; padding: 10px;">
|
|
<canvas id="chartSoil" height="200"></canvas>
|
|
</div>
|
|
<div style="width: 45%; padding: 10px;">
|
|
<canvas id="chartHumidity" height="200"></canvas>
|
|
</div>
|
|
<div style="width: 45%; padding: 10px;">
|
|
<canvas id="chartTemperature" height="200"></canvas>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<script>
|
|
var ctxIntensity = document.getElementById('chartIntensity').getContext('2d');
|
|
var ctxSoil = document.getElementById('chartSoil').getContext('2d');
|
|
var ctxHumidity = document.getElementById('chartHumidity').getContext('2d');
|
|
var ctxTemperature = document.getElementById('chartTemperature').getContext('2d');
|
|
|
|
var chartIntensity = new Chart(ctxIntensity, {
|
|
type: 'line',
|
|
data: {
|
|
labels: {!! json_encode($labels) !!},
|
|
datasets: [{
|
|
label: 'Intensity',
|
|
data: {!! json_encode($dataPointsIntensity) !!},
|
|
borderColor: 'rgba(75, 192, 192, 1)',
|
|
tension: 0.1
|
|
}]
|
|
},
|
|
options: {}
|
|
});
|
|
|
|
var chartSoil = new Chart(ctxSoil, {
|
|
type: 'line',
|
|
data: {
|
|
labels: {!! json_encode($labels) !!},
|
|
datasets: [{
|
|
label: 'Soil',
|
|
data: {!! json_encode($dataPointsSoil) !!},
|
|
borderColor: 'rgba(128, 0, 128, 1)',
|
|
tension: 0.1
|
|
}]
|
|
},
|
|
options: {}
|
|
});
|
|
|
|
var chartHumidity = new Chart(ctxHumidity, {
|
|
type: 'line',
|
|
data: {
|
|
labels: {!! json_encode($labels) !!},
|
|
datasets: [{
|
|
label: 'Humidity',
|
|
data: {!! json_encode($dataPointsHumidity) !!},
|
|
borderColor: 'rgba(255, 99, 132, 1)',
|
|
tension: 0.1
|
|
}]
|
|
},
|
|
options: {}
|
|
});
|
|
|
|
var chartTemperature = new Chart(ctxTemperature, {
|
|
type: 'line',
|
|
data: {
|
|
labels: {!! json_encode($labels) !!},
|
|
datasets: [{
|
|
label: 'Temperature',
|
|
data: {!! json_encode($dataPointsTemperature) !!},
|
|
borderColor: 'rgba(255, 206, 86, 1)',
|
|
tension: 0.1
|
|
}]
|
|
},
|
|
options: {}
|
|
});
|
|
</script>
|
|
|
|
|
|
</body>
|
|
</html>
|