This repository has been archived by the owner on Feb 27, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
history.php
169 lines (146 loc) · 5.78 KB
/
history.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
<?php
include 'header.php';
$_SESSION['page'] = 'history';
// if (!isset($_SESSION['username']) || $_SESSION['username'] == 'admin') {
// header("Location: index.php");
// exit();
// }
?>
<!DOCTYPE html>
<html lang="en">
<head>
<title>Pick Up History</title>
</head>
<style>
.header-area {
background-image: url("assets/history.jpg");
}
</style>
<div class="banner">
<div class="container">
<h1>PICK UP HISTORY</h1>
<p>Once upon a time at Andre Cepat Express...</p>
<a href="#content" class="button button-primary">View Pick Up History</a>
</div>
</div>
</header>
<script type="text/javascript">
$(document).ready(function() {
show();
});
function Search(table) {
$("#filterstatus").on("change", function() {
table.columns(2).search(this.value).draw();
});
$("#filterservice").on("change", function() {
table.columns(3).search(this.value).draw();
});
}
var ajaxcall;
function show() {
$("#historyTableBody").html("<span>Harap tunggu...</span>");
if (ajaxcall != null) {
ajaxcall.abort();
}
$.ajax({
url: "phps/refreshdelivery.php",
type: "get",
dataType: "json",
success: function(result) {
$("#historyTable").dataTable().fnDestroy();
var data = result;
var str = "";
var dataDiv = $("#historyTableBody");
var num = 1;
//loop dari data
for (var i = 0; i < data.length; i++) {
var d = data[i];
str += "<tr style='font-weight: 100;'>";
str += "<td>" + num + "</td>";
str += "<td>" + d.resi + "</td>";
if (d.delivery_status == 'DELIVERED') {
str += "<td style='font-weight: bold; color: #fc6203;'>" + d.delivery_status + "</td>";
} else {
str += "<td>" + d.delivery_status + "</td>";
}
str += "<td>" + d.delivery_type + "</td>";
str += "<td>" + d.delivery_date + "</td>";
str += "<td>" + d.sender_name + ", " + d.sender_origin_city + "</td>";
str += "<td>" + d.receiver_name + ", " + d.receiver_origin_city + "</td>";
str += "<td><a type='button' style='font-weight: bold; font-size: 12pt;' class='btn btn-warning' href='viewdata.php?resi=" + d.resi + "'>View</a></td>";
str += "</tr>";
num = num + 1;
}
dataDiv.html(str);
var table = $('#historyTable').DataTable({
"oLanguage": {
"sEmptyTable": "Anda belum pernah melakukan Request Pick Up!"
}
});
Search(table);
},
error: function(result) {
//Error handling
alert("ERROR!");
console.log();
}
});
}
</script>
<main>
<section id="content" class="content">
<div class="container" id="history">
<div class="row justify-content-center">
<h3 class="title">
PICK UP HISTORY
</h3>
</div><br>
<center>
<div>
<select class="form-control" id="filterstatus" style="width: 60%; height:40px; font-size: 12pt;">
<option value="">Lihat berdasarkan status</option>
<option value="PICKREQ">PICKREQ</option>
<option value="PICK">PICK</option>
<option value="ON TRANSIT">ON TRANSIT</option>
<option value="ON DELIVERY">ON DELIVERY</option>
<option value="DELIVERED">DELIVERED</option>
</select>
</div>
</center><br>
<center>
<div>
<select class="form-control" id="filterservice" style="width: 60%; height:40px; font-size: 12pt;">
<option value="">Lihat berdasarkan service</option>
<option value="ANDRE EKONOMIS">ANDRE EKONOMIS 💲</option>
<option value="ANDRE REGULAR">ANDRE REGULAR 🚚</option>
<option value="ANDRE HALILINTAR">ANDRE HALILINTAR ⚡</option>
</select>
</div>
</center>
<div class="row" style="margin-top: 20px;overflow-x: auto;">
<div class="col-12">
<table class="table table-hovered table-striped" id="historyTable" style="color: #412c27; text-align: center;">
<thead>
<tr style="font-weight: bold;">
<td>#</td>
<td>Nomor Resi</td>
<td>Status</td>
<td>Service</td>
<td>Dikirim tanggal</td>
<td>Dikirim oleh</td>
<td>Dikirim ke</td>
<td>Lihat data</td>
</tr>
</thead>
<tbody id="historyTableBody">
</tbody>
</table>
<h3 id="empty" style="text-align:center;"></h3>
</div>
</div>
<center>
<a href='user.php' class='button button-primary'>Back</a><br>
</center>
</div>
</section>
<?php include 'footer.php' ?>