-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
389 lines (357 loc) · 12.8 KB
/
index.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
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
<?php
session_start();
include("src/koneksi.php");
if (!isset($_SESSION['userName'])) {
$_SESSION['hakAkses'] = 0;
$_SESSION['userName'] = null;
}else{
switch ($_SESSION['hakAkses'])
{
case "1":
$tipe = "pelanggan";
break;
case "2":
$tipe = "karyawan";
break;
case "3":
$tipe = "admin";
break;
default:
$tipe = "pengunjung";
break;
}
}
?>
<!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">
<link rel="stylesheet" href="css/icon.css">
<link type="text/css" rel="stylesheet" href="css/materialize.min.css" media="screen,projection"/>
<!-- <link rel="stylesheet" href="css/style.css"> -->
<title>Tugas</title>
<style type="text/css">
body {
display: flex;
min-height: 100vh;
flex-direction: column;
}
main {
flex: 1 0 auto;
}
th {
cursor: pointer;
}
em{
radius: 5px;
background-color: yellow;
}
.bungkus {
padding-top: 20px;
padding-left: 310px;
}
@media only screen and (max-width : 992px) {
.bungkus {
padding-left: 0;
}
}
#qwe {
position: fixed;
bottom: 0;
right: 0;
}
</style>
</head>
<body>
<header>
<div class="navbar-fixed">
<!-- Dropdown Structure -->
<ul id="dropdown1" class="dropdown-content">
<li><?= isset($_SESSION['userName']) ?
'<a href="src/akun/logout.php">Logout</a>' :
'<a href="src/akun/login.php">Login</a>
<a href="src/akun/register.php">Daftar</a></li>' ?>
</li>
</ul>
<nav>
<div class="nav-wrapper">
<div class="row">
<div class="col s12">
<a href="#" data-target="mobile-demo" class="sidenav-trigger"><i class="material-icons">menu</i></a>
<a href="#!" class="brand-logo">Minimarket 500</a>
<ul class="right hide-on-med-and-down">
<li>Login sebagai : <?= $_SESSION['userName'] ? "$tipe - ".$_SESSION['userName']."" : "pengunjung" ?></li>
<li><a class="dropdown-trigger" href="#!" data-target="dropdown1"><i class="material-icons">more_vert</i></a></li>
</ul>
</div>
</div>
</div>
</nav>
</div>
</header>
<main>
<div class='bungkus'>
<div class="row">
<div class="col s12 m12 l9">
<!-- KONTEN -->
<div class="card white">
<?php //kalo pakai ini kada boleh lagi di include lain pakai get
$page = $aksi = "";
if (isset($_GET['page'])) {
if (isset($_GET['aksi'])) {
$aksi = $_GET['aksi'];
} else {
$aksi = "";
}
$page = $_GET['page'];
} else {
$page = "home";
}
if ($page == "home") {
include "src/home.php";
}
if ($page == "karyawan") {
if ($aksi == "") {
include "src/karyawan/tampil-kar.php";
}
if ($aksi == "tambah") {
include "src/karyawan/tambah-kar.php";
}
if ($aksi == "edit") {
include "src/karyawan/edit-kar.php";
}
if ($aksi == "hapus") {
include "src/karyawan/hapus-kar.php";
}
}
if ($page == "penjualan") {
if ($aksi == "") {
include "src/penjualan/tampil-pj.php";
}
if ($aksi == "tambah") {
include "src/penjualan/tambah-pj.php";
}
if ($aksi == "edit") {
include "src/penjualan/edit-pj.php";
}
if ($aksi == "hapus") {
include "src/penjualan/hapus-pj.php";
}
}
if ($page == "barang") {
if ($aksi == "") {
include "src/barang/tampil-brg.php";
}
if ($aksi == "tambah") {
include "src/barang/tambah-brg.php";
}
if ($aksi == "edit") {
include "src/barang/edit-brg.php";
}
if ($aksi == "hapus") {
include "src/barang/hapus-brg.php";
}
}
if ($page == "pasokan") {
if ($aksi == "") {
include "src/pasokan/tampil-pas.php";
}
if ($aksi == "tambah") {
include "src/pasokan/tambah-pas.php";
}
if ($aksi == "edit") {
include "src/pasokan/edit-pas.php";
}
if ($aksi == "hapus") {
include "src/pasokan/hapus-pas.php";
}
}
if ($page == "supplier") {
if ($aksi == "") {
include "src/supplier/tampil-spl.php";
}
if ($aksi == "tambah") {
include "src/supplier/tambah-spl.php";
}
if ($aksi == "edit") {
include "src/supplier/edit-spl.php";
}
if ($aksi == "hapus") {
include "src/supplier/hapus-spl.php";
}
}
if ($page == "plg") {
if ($aksi == "") {
include "src/pelanggan/tampil-plg.php";
}
if ($aksi == "tambah") {
include "src/pelanggan/tambah-plg.php";
}
if ($aksi == "edit") {
include "src/pelanggan/edit-plg.php";
}
if ($aksi == "hapus") {
include "src/pelanggan/hapus-plg.php";
}
}
if ($page == "beli") {
include "src/beli.php";
}
if ($page == "about") {
include "src/about.php";
}
if ($page == "kontak") {
include "src/kontak.php";
}
if ($page == "logout") {
include "src/logout.php";
}
?>
</div>
</div>
</div>
</div>
<!-- LINK/MENU BAGIAN SAMPING -->
<aside>
<ul class="sidenav sidenav-fixed" id="mobile-demo" style="top: 65px;">
<li>
<a class="waves-effect waves-light waves-block" href="?page=home">
<i class="material-icons prefix">home</i>
<span>Home</span></a>
</li>
<?php if ($_SESSION['hakAkses']>=2) : ?>
<li>
<a class="waves-effect waves-light waves-block" href="?page=barang">
<i class="material-icons prefix">widgets</i>
<span>Data Barang</span></a>
</li>
<li>
<a class="waves-effect waves-light waves-block" href="?page=penjualan">
<i class="material-icons prefix">storefront</i>
<span>Data Penjualan</span></a>
</li>
<li>
<a class="waves-effect waves-light waves-block" href="?page=pasokan">
<i class="material-icons prefix">home_work</i>
<span>Data Pasokan</span></a>
</li>
<li>
<a class="waves-effect waves-light waves-block" href="?page=karyawan">
<i class="material-icons prefix">people</i>
<span>Data Karyawan</span></a>
</li>
<li>
<a class="waves-effect waves-light waves-block" href="?page=supplier">
<i class="material-icons prefix">local_shipping</i>
<span>Data Supplier</span></a>
</li>
<li>
<a class="waves-effect waves-light waves-block" href="?page=plg">
<i class="material-icons prefix">record_voice_over</i>
<span>Data Pelanggans</span></a>
</li>
<?php else : ?>
<li>
<a class="waves-effect waves-light waves-block" href="?page=about">
<i class="material-icons prefix">help</i>
<span>Tentang Kami</span></a>
</li>
<li>
<a class="waves-effect waves-light waves-block" href="?page=kontak">
<i class="material-icons prefix">contact_support</i>
<span>Kontak</span></a>
</li>
<?php endif ?>
</ul>
</aside>
</main>
<footer class="page-footer bungkus">
<div class="container">
<div class="row">
<div class="col l6 s12">
<h5 class="white-text">Dibuat Oleh :</h5>
<p class="grey-text text-lighten-4">
<div class="col s6">Muhammad Rif'an</div>
<div class="col s6">: Direktur Proyek XD</div>
</p>
</div>
<div class="col l4 offset-l2 s12">
<h5 class="white-text">Link</h5>
<ul>
<li><a class="grey-text text-lighten-3" href="https://www.youtube.com/channel/UCBn_1MOcSiPHrEz5_GVEymQ">Official Youtube BPK Nurul Iman</a></li>
<li><a class="grey-text text-lighten-3" href="?page=about">Tentang Kami</a></li>
<li><a class="grey-text text-lighten-3" href="?page=kontak">Kontak Kami</a></li>
<li><a class="grey-text text-lighten-3" href="#!">Link 4</a></li>
</ul>
</div>
</div>
</div>
<div class="footer-copyright">
<div class="container">
© November 2019
</div>
</div>
</footer>
<div id="qwe"></div> <!--DIV UNTUK JAM-->
<!--JavaScript at end of body for optimized loading-->
<script type="text/javascript" src="js/materialize.min.js"></script>
<script src="js/jquery-3.4.1.min.js"></script>
<link rel="stylesheet" href="css/sweetalert2.min.css">
<script src="js/sweetalert2.min.js"></script>
<!-- <script type="text/javascript" src="https://code.jquery.com/jquery-2.1.1.min.js"></script> -->
<script>
$(document).ready(function(){
M.AutoInit();
// $(".dropdown-trigger").dropdown();
// TABLE SORT
$('th').click(function(){
var table = $(this).parents('table').eq(0)
var rows = table.find('tr:gt(0)').toArray().sort(comparer($(this).index()))
this.asc = !this.asc
if (!this.asc){rows = rows.reverse()}
for (var i = 0; i < rows.length; i++){table.append(rows[i])}
})
function comparer(index) {
return function(a, b) {
var valA = getCellValue(a, index), valB = getCellValue(b, index)
return $.isNumeric(valA) && $.isNumeric(valB) ? valA - valB : valA.toString().localeCompare(valB)
}
}
function getCellValue(row, index){ return $(row).children('td').eq(index).text() }
//TABLE SORT
//PENCARIAN
$("#cari").keyup(function () {
var value = this.value.toLowerCase().trim();
$("table tr").each(function (index) {
if (!index) return;
$(this).find("td").each(function () {
var id = $(this).text().toLowerCase().trim();
var not_found = (id.indexOf(value) == -1);
$(this).closest('tr').toggle(!not_found);
return not_found;
});
});
});
//PENCARIAN
//JAM LIVE
var now = new Date(<?php echo time() * 1000 ?>);
function startInterval(){
setInterval('updateTime();', 1000);
}
startInterval();//start it right away
function updateTime(){
var nowMS = now.getTime();
nowMS += 1000;
now.setTime(nowMS);
var clock = document.getElementById('qwe');
if(clock){
clock.innerHTML = now.toTimeString();//adjust to suit
}
}
//JAM LIVE
});
</script>
</body>
</html>