-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDataSales_Manajer.php
415 lines (386 loc) · 22 KB
/
DataSales_Manajer.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
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
<?php
include $_SERVER['DOCUMENT_ROOT']."/ProyekManpro/services/database.php";
if (!isset($_SESSION['id_manajer'])) {
header("Location:login_manajer.php");
}
?>
<!doctype html>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.11.3/css/jquery.dataTables.css">
<meta charset="utf-8">
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="Assets/jquery-confirm/jquery-confirm.css"/>
<script src="Assets/jquery-confirm/jquery-confirm.js"></script>
<title>Data Sales</title>
<style>
.bd-placeholder-img {
font-size: 1.125rem;
text-anchor: middle;
-webkit-user-select: none;
-moz-user-select: none;
user-select: none;
}
@media (min-width: 768px) {
.bd-placeholder-img-lg {
font-size: 3.5rem;
}
}
body {
min-height: 100vh;
}
html {
height: -webkit-fill-available;
}
nav {
display: flex;
flex-wrap: nowrap;
height: 100vh;
overflow-x: auto;
overflow-y: hidden;
}
.grid-container {
display: grid;
grid-template-columns: max-content auto;
grid-gap: 10px;
}
.b-example-divider {
flex-shrink: 0;
width: 1.5rem;
height: 100vh;
background-color: rgba(0, 0, 0, .1);
border: solid rgba(0, 0, 0, .15);
border-width: 1px 0;
box-shadow: inset 0 .5em 1.5em rgba(0, 0, 0, .1), inset 0 .125em .5em rgba(0, 0, 0, .15);
}
.bi {
vertical-align: -.125em;
pointer-events: none;
fill: currentColor;
}
.dropdown-toggle { outline: 0; }
.nav-flush .nav-link {
border-radius: 0;
}
.btn-toggle {
display: inline-flex;
align-items: center;
padding: .25rem .5rem;
font-weight: 600;
color: rgba(0, 0, 0, .65);
background-color: transparent;
border: 0;
}
.btn-toggle:hover,
.btn-toggle:focus {
color: rgba(0, 0, 0, .85);
background-color: #d2f4ea;
}
.btn-toggle::before {
width: 1.25em;
line-height: 0;
content: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='rgba%280,0,0,.5%29' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M5 14l6-6-6-6'/%3e%3c/svg%3e");
transition: transform .35s ease;
transform-origin: .5em 50%;
}
.btn-toggle[aria-expanded="true"] {
color: rgba(0, 0, 0, .85);
}
.btn-toggle[aria-expanded="true"]::before {
transform: rotate(90deg);
}
.btn-toggle-nav a {
display: inline-flex;
padding: .1875rem .5rem;
margin-top: .125rem;
margin-left: 1.25rem;
text-decoration: none;
}
.btn-toggle-nav a:hover,
.btn-toggle-nav a:focus {
background-color: #d2f4ea;
}
.scrollarea {
overflow-y: auto;
}
.fw-semibold { font-weight: 600; }
.lh-tight { line-height: 1.25; }
hr {
display: block;
margin-top: 1em;
margin-bottom: 0.5em;
margin-left: auto;
margin-right: auto;
border-style: inset;
border-width: 1px;
}
</style>
</head>
<body>
<!-- SYMBOL -->
<svg xmlns="http://www.w3.org/2000/svg" style="display: none;">
<symbol id="home" viewBox="0 0 16 16">
<path d="M8.354 1.146a.5.5 0 0 0-.708 0l-6 6A.5.5 0 0 0 1.5 7.5v7a.5.5 0 0 0 .5.5h4.5a.5.5 0 0 0 .5-.5v-4h2v4a.5.5 0 0 0 .5.5H14a.5.5 0 0 0 .5-.5v-7a.5.5 0 0 0-.146-.354L13 5.793V2.5a.5.5 0 0 0-.5-.5h-1a.5.5 0 0 0-.5.5v1.293L8.354 1.146zM2.5 14V7.707l5.5-5.5 5.5 5.5V14H10v-4a.5.5 0 0 0-.5-.5h-3a.5.5 0 0 0-.5.5v4H2.5z"/>
</symbol>
<symbol id="product" viewBox="0 0 16 16">
<path d="M8.186 1.113a.5.5 0 0 0-.372 0L1.846 3.5l2.404.961L10.404 2l-2.218-.887zm3.564 1.426L5.596 5 8 5.961 14.154 3.5l-2.404-.961zm3.25 1.7-6.5 2.6v7.922l6.5-2.6V4.24zM7.5 14.762V6.838L1 4.239v7.923l6.5 2.6zM7.443.184a1.5 1.5 0 0 1 1.114 0l7.129 2.852A.5.5 0 0 1 16 3.5v8.662a1 1 0 0 1-.629.928l-7.185 2.874a.5.5 0 0 1-.372 0L.63 13.09a1 1 0 0 1-.63-.928V3.5a.5.5 0 0 1 .314-.464L7.443.184z"/>
</symbol>
<symbol id="people" viewBox="0 0 16 16">
<path d="M7 14s-1 0-1-1 1-4 5-4 5 3 5 4-1 1-1 1H7zm4-6a3 3 0 1 0 0-6 3 3 0 0 0 0 6z"/>
<path fill-rule="evenodd" d="M5.216 14A2.238 2.238 0 0 1 5 13c0-1.355.68-2.75 1.936-3.72A6.325 6.325 0 0 0 5 9c-4 0-5 3-5 4s1 1 1 1h4.216z"/>
<path d="M4.5 8a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5z"/>
</symbol>
<symbol id="book" viewBox="0 0 16 16">
<path fill-rule="evenodd" d="M6 1h6v7a.5.5 0 0 1-.757.429L9 7.083 6.757 8.43A.5.5 0 0 1 6 8V1z"/>
<path d="M3 0h10a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2v-1h1v1a1 1 0 0 0 1 1h10a1 1 0 0 0 1-1V2a1 1 0 0 0-1-1H3a1 1 0 0 0-1 1v1H1V2a2 2 0 0 1 2-2z"/>
<path d="M1 5v-.5a.5.5 0 0 1 1 0V5h.5a.5.5 0 0 1 0 1h-2a.5.5 0 0 1 0-1H1zm0 3v-.5a.5.5 0 0 1 1 0V8h.5a.5.5 0 0 1 0 1h-2a.5.5 0 0 1 0-1H1zm0 3v-.5a.5.5 0 0 1 1 0v.5h.5a.5.5 0 0 1 0 1h-2a.5.5 0 0 1 0-1H1z"/>
</symbol>
<symbol id="people-circle" viewBox="0 0 16 16">
<path d="M11 6a3 3 0 1 1-6 0 3 3 0 0 1 6 0z"/>
<path fill-rule="evenodd" d="M0 8a8 8 0 1 1 16 0A8 8 0 0 1 0 8zm8-7a7 7 0 0 0-5.468 11.37C3.242 11.226 4.805 10 8 10s4.757 1.225 5.468 2.37A7 7 0 0 0 8 1z"/>
</symbol>
<symbol id="gem" viewBox="0 0 16 16">
<path d="M3.1.7a.5.5 0 0 1 .4-.2h9a.5.5 0 0 1 .4.2l2.976 3.974c.149.185.156.45.01.644L8.4 15.3a.5.5 0 0 1-.8 0L.1 5.3a.5.5 0 0 1 0-.6l3-4zm11.386 3.785-1.806-2.41-.776 2.413 2.582-.003zm-3.633.004.961-2.989H4.186l.963 2.995 5.704-.006zM5.47 5.495 8 13.366l2.532-7.876-5.062.005zm-1.371-.999-.78-2.422-1.818 2.425 2.598-.003zM1.499 5.5l5.113 6.817-2.192-6.82L1.5 5.5zm7.889 6.817 5.123-6.83-2.928.002-2.195 6.828z"/>
</symbol>
<symbol id="edit" viewBox="0 0 16 16">
<path d="M15.502 1.94a.5.5 0 0 1 0 .706L14.459 3.69l-2-2L13.502.646a.5.5 0 0 1 .707 0l1.293 1.293zm-1.75 2.456-2-2L4.939 9.21a.5.5 0 0 0-.121.196l-.805 2.414a.25.25 0 0 0 .316.316l2.414-.805a.5.5 0 0 0 .196-.12l6.813-6.814z"/>
<path fill-rule="evenodd" d="M1 13.5A1.5 1.5 0 0 0 2.5 15h11a1.5 1.5 0 0 0 1.5-1.5v-6a.5.5 0 0 0-1 0v6a.5.5 0 0 1-.5.5h-11a.5.5 0 0 1-.5-.5v-11a.5.5 0 0 1 .5-.5H9a.5.5 0 0 0 0-1H2.5A1.5 1.5 0 0 0 1 2.5v11z"/>
</symbol>
<symbol id="trash" viewBox="0 0 16 16">
<path d="M2.5 1a1 1 0 0 0-1 1v1a1 1 0 0 0 1 1H3v9a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2V4h.5a1 1 0 0 0 1-1V2a1 1 0 0 0-1-1H10a1 1 0 0 0-1-1H7a1 1 0 0 0-1 1H2.5zm3 4a.5.5 0 0 1 .5.5v7a.5.5 0 0 1-1 0v-7a.5.5 0 0 1 .5-.5zM8 5a.5.5 0 0 1 .5.5v7a.5.5 0 0 1-1 0v-7A.5.5 0 0 1 8 5zm3 .5v7a.5.5 0 0 1-1 0v-7a.5.5 0 0 1 1 0z"/>
</symbol>
<symbol id="plus" viewBox="0 0 16 16">
<path fill-rule="evenodd" d="M8 2a.5.5 0 0 1 .5.5v5h5a.5.5 0 0 1 0 1h-5v5a.5.5 0 0 1-1 0v-5h-5a.5.5 0 0 1 0-1h5v-5A.5.5 0 0 1 8 2Z"/>
</symbol>
<symbol id="open" viewBox="0 0 16 16">
<path fill-rule="evenodd" d="M6.364 13.5a.5.5 0 0 0 .5.5H13.5a1.5 1.5 0 0 0 1.5-1.5v-10A1.5 1.5 0 0 0 13.5 1h-10A1.5 1.5 0 0 0 2 2.5v6.636a.5.5 0 1 0 1 0V2.5a.5.5 0 0 1 .5-.5h10a.5.5 0 0 1 .5.5v10a.5.5 0 0 1-.5.5H6.864a.5.5 0 0 0-.5.5z"/>
<path fill-rule="evenodd" d="M11 5.5a.5.5 0 0 0-.5-.5h-5a.5.5 0 0 0 0 1h3.793l-8.147 8.146a.5.5 0 0 0 .708.708L10 6.707V10.5a.5.5 0 0 0 1 0v-5z"/>
</symbol>
<symbol id="activity" viewBox="0 0 16 16">
<path fill-rule="evenodd" d="M6 2a.5.5 0 0 1 .47.33L10 12.036l1.53-4.208A.5.5 0 0 1 12 7.5h3.5a.5.5 0 0 1 0 1h-3.15l-1.88 5.17a.5.5 0 0 1-.94 0L6 3.964 4.47 8.171A.5.5 0 0 1 4 8.5H.5a.5.5 0 0 1 0-1h3.15l1.88-5.17A.5.5 0 0 1 6 2Z"/>
</symbol>
<symbol id="basket" viewBox="0 0 16 16">
<path d="M5.071 1.243a.5.5 0 0 1 .858.514L3.383 6h9.234L10.07 1.757a.5.5 0 1 1 .858-.514L13.783 6H15.5a.5.5 0 0 1 .5.5v2a.5.5 0 0 1-.5.5H15v5a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V9H.5a.5.5 0 0 1-.5-.5v-2A.5.5 0 0 1 .5 6h1.717L5.07 1.243zM3.5 10.5a.5.5 0 1 0-1 0v3a.5.5 0 0 0 1 0v-3zm2.5 0a.5.5 0 1 0-1 0v3a.5.5 0 0 0 1 0v-3zm2.5 0a.5.5 0 1 0-1 0v3a.5.5 0 0 0 1 0v-3zm2.5 0a.5.5 0 1 0-1 0v3a.5.5 0 0 0 1 0v-3zm2.5 0a.5.5 0 1 0-1 0v3a.5.5 0 0 0 1 0v-3z"/>
</symbol>
<symbol id="door" viewBox="0 0 16 16">
<path d="M1.5 15a.5.5 0 0 0 0 1h13a.5.5 0 0 0 0-1H13V2.5A1.5 1.5 0 0 0 11.5 1H11V.5a.5.5 0 0 0-.57-.495l-7 1A.5.5 0 0 0 3 1.5V15H1.5zM11 2h.5a.5.5 0 0 1 .5.5V15h-1V2zm-2.5 8c-.276 0-.5-.448-.5-1s.224-1 .5-1 .5.448.5 1-.224 1-.5 1z"/>
</symbol>
<symbol id="home" viewBox="0 0 16 16">
<path fill-rule="evenodd" d="m8 3.293 6 6V13.5a1.5 1.5 0 0 1-1.5 1.5h-9A1.5 1.5 0 0 1 2 13.5V9.293l6-6zm5-.793V6l-2-2V2.5a.5.5 0 0 1 .5-.5h1a.5.5 0 0 1 .5.5z"/>
<path fill-rule="evenodd" d="M7.293 1.5a1 1 0 0 1 1.414 0l6.647 6.646a.5.5 0 0 1-.708.708L8 2.207 1.354 8.854a.5.5 0 1 1-.708-.708L7.293 1.5z"/>
</symbol>
</svg>
<div class="d-flex">
<!-- SIDEBAR -->
<nav class="flex-column flex-shrink-0 p-3 text-white" style="width: 20%; background-color: #61a3d6; position: fixed;">
<img src="image\LogoWhite.png" width="160px" style="margin-left: auto; margin-right: auto;" class="d-flex mb-3 mb-md-0 me-md-auto text-white text-decoration-none">
<hr style="width: 98%; text-align: left;">
<ul class="nav nav-pills flex-column mb-auto">
<li>
<a href="Home_Manajer.php" class="nav-link text-white">
<svg class="bi me-2" width="16" height="16"><use xlink:href="#home"/></svg>
Home
</a>
</li>
<li>
<a href="Profile_Manajer.php" class="nav-link text-white">
<svg class="bi me-2" width="16" height="16"><use xlink:href="#people-circle"/></svg>
Profile
</a>
</li>
<li>
<a href="DataProduct_Manajer.php" class="nav-link text-white">
<svg class="bi me-2" width="16" height="16"><use xlink:href="#product"/></svg>
Product
</a>
</li>
<li class="nav-item">
<a href="DataSales_Manajer.php" class="nav-link active" aria-current="page">
<svg class="bi me-2" width="16" height="16"><use xlink:href="#people"/></svg>
Sales
</a>
</li>
<li>
<a href="laporan.php" class="nav-link text-white">
<svg class="bi me-2" width="16" height="16"><use xlink:href="#book"/></svg>
Report
</a>
</li>
<li>
<a href="Customer_Manajer.php" class="nav-link text-white">
<svg class="bi me-2" width="16" height="16"><use xlink:href="#gem"/></svg>
Customers
</a>
</li>
<li>
<a href="manager_show_all_activity.php" class="nav-link text-white">
<svg class="bi me-2" width="16" height="16"><use xlink:href="#activity"/></svg>
Sales Activities
</a>
</li>
<li>
<a href="manager_show_order.php" class="nav-link text-white">
<svg class="bi me-2" width="16" height="16"><use xlink:href="#basket"/></svg>
Orders
</a>
</li>
<li>
<a href="logout_manajer.php" class="nav-link text-white">
<svg class="bi me-2" width="16" height="16"><use xlink:href="#door"/></svg>
Logout
</a>
</li>
</ul>
</nav>
<!-- <div class="col-md-9 col-lg-8 m-3"> -->
<div class="p-3" style="margin-left: 20%; width:80%; position: static;">
<form class="p-2 grid-container">
<div style="font-weight: bold; font-size: 35px;">Data Sales</div>
<div style="text-align: right;">
<?php $sql="SELECT DAY(CURRENT_DATE), MONTHNAME(CURRENT_DATE), YEAR(CURRENT_DATE)";
$stmt=$pdo->prepare($sql);
$stmt->execute();
$res=$stmt->fetch();
echo $res['DAY(CURRENT_DATE)'], " ", $res['MONTHNAME(CURRENT_DATE)'], " ", $res['YEAR(CURRENT_DATE)']?>
</div>
</form>
<form class=" mt-4 grid-container">
<div class=""><a href="Add_DataSales.php"><button class="btn btn-danger" type="button" id="add-sales-btn">+ Add</button></a></div>
<div ><a href="DataTarget.php"><button class="btn btn-success" type="button">Lihat Target Penjualan</button></a></div>
</form>
<div class="row pt-4">
<div class="col-12 table-responsive-sm">
<table id="tableImage" class="table table-hover table-striped table-bordered">
<thead>
<tr>
<th width="5%" data-sortable="true">#</th>
<th width="5%" data-sortable="true">ID</th>
<th width="25%" data-sortable="true">Nama</th>
<th width="15%" data-sortable="true">Location</th>
<th width="20%" data-sortable="true">Mulai Bekerja</th>
<th width="20%" data-sortable="true">Berhenti Bekerja</th>
<th wdith="20%" data-sortable="true">Attributes</th>
</tr>
</thead>
<tbody id="sales-content">
</tbody>
</table>
<div id="divsales-content">
</div>
</div>
</div>
</div>
</div>
<!-- DataTable Query -->
<script type="text/javascript" charset="utf8" src="https://cdn.datatables.net/1.11.3/js/jquery.dataTables.js"></script>
<script>
function load_data() {
$.ajax({
url: "/ProyekManpro/services/get_sales.php",
method: "GET",
success: function(data) {
var cek=false;
var co = 1;
$("#sales-content").html('');
data.forEach(function(sales){
var row = $("<tr></tr>");
var col1 = $("<td scope='col' >" + co + "</td>");
var col2 = $("<td scope='col' >" + sales['id_sales'] + "</td>");
var col3 = $("<td scope='col'>" + sales['nama'] + "</td>")
var col4 = $("<td scope='col'><a href='sales_location.php?id=" + sales['id_sales'] + "'><button class='btn btn-sm btn-info' style=''>Track Location</button></a></td>");
var col5 = $("<td scope='col'>" + sales['tanggal_mulai_kerja'] + "</td>");
if(sales['tanggal_berhenti_kerja'] != "0000-00-00"){
var col6 = $("<td scope='col'>" + sales['tanggal_berhenti_kerja'] + "</td>");
}else{
var col6= $("<td scope='col'>" + "-" + "</td>");
}
col1.appendTo(row);
col2.appendTo(row);
col3.appendTo(row);
col4.appendTo(row);
col5.appendTo(row);
col6.appendTo(row);
var btn = $('<td scope="col"></td>');
var lihat = $('<a href="Halaman_Sales.php?id=' + sales['id_sales'] + '" id="lihat-btn"><svg class="bi me-2" width="16" height="16" style="color: black;"><use xlink:href="#open"/></svg></a>')
var edit = $('<a href="Edit_DataSales.php?id=' + sales['id_sales'] + '" id="edit-btn"><svg class="bi me-2" width="16" height="16" style="color: black; margin-left: 10px;"><use xlink:href="#edit"/></svg></a>')
var del = $('<a href="#" id="delete-btn"><svg class="bi me-2" width="16" height="16" style="color: black; margin-left: 10px;"><use xlink:href="#trash"/></svg></a>')
del.data('id_sales', sales['id_sales']);
lihat.appendTo(btn);
edit.appendTo(btn);
del.appendTo(btn);
btn.appendTo(row);
co++;
$("#sales-content").append(row);
});
$('#tableImage').DataTable();
},
error: function(data) {
alert("load data error!");
}
});
}
$(document).ready(function(){
load_data();
});
// DELETE
$("#sales-content").on("click", "[id='delete-btn']", function(){
var id_sales = $(this).data('id_sales');
var type = 0;
$.confirm({
title: 'Confirm!',
content: 'You cannot recover deleted data!',
buttons: {
confirm: {
text: 'Confirm',
btnClass: 'btn-success',
keys: ['enter'],
action: function(){
$.ajax({
url: '/ProyekManpro/services/delete_target.php',
method: 'POST',
data: {
type : type,
id_sales : id_sales
},
success: function(data) {
},
error: function($xhr, textStatus, errorThrown) {
alert($xhr.responseJSON['error']);
}
});
$.ajax({
url: '/ProyekManpro/services/delete_sales.php',
method: 'POST',
data: {
id_sales : id_sales
},
success: function(data) {
window.location.replace("DataSales_Manajer.php");
load_data();
},
error: function($xhr, textStatus, errorThrown) {
alert($xhr.responseJSON['error']);
}
});
}
},
cancel: {
text: 'Cancel',
btnClass: 'btn-secondary',
keys: ['shift'],
action: function(){
// alert("Cancel");
}
}
}
});
});
</script>
</body>
</html>