-
Notifications
You must be signed in to change notification settings - Fork 1
/
homepage.php
261 lines (239 loc) · 9.4 KB
/
homepage.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
<?php
include "connection.php";
include "admin_privilege.php";
$namaLengkap = $_SESSION['namaLengkap'];
$query = "SELECT * FROM historis ORDER BY historis.ID DESC LIMIT 20";
$result = mysqli_query($conn, $query);
if (!$result) {
die('Error in query: ' . mysqli_error($conn));
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Home</title>
<link rel="icon" href="assets/adminlte/dist/img/OWLlogo.png" type="image/x-icon">
<!-- Google Font: Source Sans Pro -->
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700&display=fallback">
<!-- Font Awesome -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css">
<!-- Ionicons -->
<link rel="stylesheet" href="https://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css">
<!-- Theme style -->
<link rel="stylesheet" href="assets/adminlte/dist/css/adminlte.min.css">
<!-- overlayScrollbars -->
<link rel="stylesheet" href="assets/adminlte/plugins/overlayScrollbars/css/OverlayScrollbars.min.css">
<style>
.lebar-kolom1 {
width: 10%;
}
.lebar-kolom2 {
width: 22%;
}
.lebar-kolom3 {
width: 5%;
}
.lebar-kolom4 {
width: 5%;
}
.lebar-kolom5 {
width: 40%;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.lebar-kolom6 {
width: 18%;
}
.lebar-kolom7 {
width: 5%;
}
</style>
</head>
<body class="hold-transition sidebar-mini layout-fixed">
<div class="wrapper">
<?php
$rootPath = $_SERVER['DOCUMENT_ROOT'];
include $rootPath . "/owl_inventory/includes/navbar.php";
include $rootPath . "/owl_inventory/includes/sidebar.php";
?>
<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<div class="content-header">
<div class="container-fluid">
<div class="row mb-2">
<div class="col-sm-6">
<h1 class="m-0">Halo <?php echo $namaLengkap ?>!</h1>
</div><!-- /.col -->
<div class="col-sm-6">
<ol class="breadcrumb float-sm-right">
<li class="breadcrumb-item active">Home</li>
</ol>
</div><!-- /.col -->
</div><!-- /.row -->
</div><!-- /.container-fluid -->
</div>
<!-- /.content-header -->
<!-- Main content -->
<section class="content">
<div class="container-fluid">
<!-- Small boxes (Stat box) -->
<div class="row">
<div class="col-lg-3 col-6">
<!-- small box -->
<div class="small-box bg-info">
<div class="inner">
<h3><sup style="font-size: 24px">Produksi</sup></h3>
<p>Memproduksi device</p>
</div>
<div class="icon">
<i class="nav-icon fas fa-toolbox"></i>
</div>
<a href="produksi/produksi.php" class="small-box-footer">Go <i class="fas fa-arrow-circle-right"></i></a>
</div>
</div>
<!-- ./col -->
<div class="col-lg-3 col-6">
<!-- small box -->
<div class="small-box bg-danger">
<div class="inner">
<h3><sup style="font-size: 24px">Maintenance</sup></h3>
<p>Maintenance device</p>
</div>
<div class="icon">
<i class="nav-icon fas fa-wrench"></i>
</div>
<a href="maintenance/update.php" class="small-box-footer">Go <i class="fas fa-arrow-circle-right"></i></a>
</div>
</div>
<!-- ./col -->
<div class="col-lg-3 col-6">
<!-- small box -->
<div class="small-box bg-warning">
<div class="inner">
<h3><sup style="font-size: 24px">Prototype</sup></h3>
<p>Prototype device</p>
</div>
<div class="icon">
<i class="fas fa-screwdriver"></i>
</div>
<a href="prototype.php" class="small-box-footer">Go <i class="fas fa-arrow-circle-right"></i></a>
</div>
</div>
<div class="col-lg-3 col-6">
<!-- small box -->
<div class="small-box bg-success">
<div class="inner">
<h3><sup style="font-size: 24px">Restock</sup></h3>
<p>Restock bahan</p>
</div>
<div class="icon">
<i class="nav-icon fas fa-shopping-cart"></i>
</div>
<a href="restock.php" class="small-box-footer">Go <i class="fas fa-arrow-circle-right"></i></a>
</div>
</div>
<!-- ./col -->
<!-- ./col -->
</div>
<section class="content">
<div class="card">
<div class="card-header">
<h3 class="card-title"><b>Histori Transaksi Terakhir</b></h3>
</div>
<!-- /.card-header -->
<div class="card-body p-0">
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th class="text-center lebar-kolom1">User</th>
<th class="text-center lebar-kolom2">Nama Barang</th>
<th class="text-center lebar-kolom3">Kuantitas</th>
<th class="text-center lebar-kolom4">Aktivitas</th>
<th class="text-center lebar-kolom5">Deskripsi</th>
<th class="text-center lebar-kolom6">Waktu</th>
</tr>
</thead>
<tbody>
<?php
if ($result->num_rows > 0) {
while ($row = mysqli_fetch_assoc($result)) {
$tanggal = date('H:i d-m-Y', strtotime($row["waktu"]));
// Tentukan kelas badge berdasarkan nilai activity
$badgeClass = "";
switch ($row["activity"]) {
case "Produksi":
$badgeClass = "badge bg-info";
if (str_contains($row["quantity"], "-")) {
$badgeClass = "badge bg-danger";
}
break;
case "Restock":
$badgeClass = "badge bg-success";
break;
case "Maintenance":
$badgeClass = "badge bg-danger";
$row["quantity"] = "-" . $row["quantity"];
break;
case "Prototype":
$badgeClass = "badge bg-warning";
$row["quantity"] = "-" . $row["quantity"];
break;
case "Pengiriman":
$badgeClass = "badge bg-secondary";
$row["quantity"] = "-" . $row["quantity"];
break;
default:
$badgeClass = "badge bg-secondary";
break;
}
?>
<tr>
<td><?php echo $row["pengguna"]; ?></td>
<td><?php echo $row["nama_barang"]; ?></td>
<td><?php echo $row["quantity"]; ?></td>
<td style="text-align: center;"><span class="<?php echo $badgeClass; ?>"><?php echo $row["activity"]; ?></span></td>
<td><?php echo $row["deskripsi"]; ?></td>
<td><?php echo $tanggal; ?></td>
</tr>
<?php
}
} else {
echo "No rows found in the result set.";
}
?>
</tbody>
</table>
</div>
<!-- /.card-body -->
</div>
<!-- general form elements -->
<!-- /.card -->
</div><!-- /.container-fluid -->
</section>
</div><!-- /.container-fluid -->
</section>
<!-- /.content -->
</div>
<!-- /.content-wrapper -->
<!-- Control Sidebar -->
<aside class="control-sidebar control-sidebar-dark">
<!-- Control sidebar content goes here -->
</aside>
<!-- /.control-sidebar -->
</div>
<!-- ./wrapper -->
<!-- jQuery -->
<script src="assets/adminlte/plugins/jquery/jquery.min.js"></script>
<!-- Bootstrap 4 -->
<script src="assets/adminlte/plugins/bootstrap/js/bootstrap.bundle.min.js"></script>
<!-- overlayScrollbars -->
<script src="assets/adminlte/plugins/overlayScrollbars/js/jquery.overlayScrollbars.min.js"></script>
<!-- AdminLTE App -->
<script src="assets/adminlte/dist/js/adminlte.js"></script>
</body>
</html>