-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathempcheckorder.php
265 lines (258 loc) · 12.9 KB
/
empcheckorder.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
<?php require_once ("dbconnect.php"); ?>
<?php require_once ('includes/employee_header.php'); ?>
<!-- Main Menu -->
<div class="side-menu-container">
<ul class="nav navbar-nav">
<li><a href="employee.php"><span class="glyphicon glyphicon-home"></span>Home</a></li>
<li class="active"><a href="empcheckorder.php"><span class="glyphicon glyphicon-save"></span>Check Order</a></li>
<?php if($_SESSION['job_type'] == "Manager") { ?>
<li><a href="addemp.php"><span class="glyphicon glyphicon-cloud-upload"></span>Add Employee</a></li>
<li><a href="addproduct.php"><span class="glyphicon glyphicon-paperclip"></span>Add Product</a></li>
<li><a href="shipmentreq.php"><span class="glyphicon glyphicon-road"></span>Shipment Request</a></li>
<li><a href="emptrackproduct.php"><span class="glyphicon glyphicon-map-marker"></span>Vehicle Location</a></li>
<li><a href="showclient.php"><span class="glyphicon glyphicon-equalizer"></span>Client Graph</a></li>
<li><a href="driverlist.php"><span class="glyphicon glyphicon-user"></span>Driver List</a></li>
<li><a href="warehouseinfo.php"><span class="glyphicon glyphicon-tent"></span>Warehouse Info</a></li>
<?php }elseif($_SESSION['job_type'] == "Supervisor") { ?>
<li><a href="shipmentaccept.php"><span class="glyphicon glyphicon-tent"></span>Accepted Shipment</a></li>
<?php }?>
<li><a href="empsetting.php"><span class="glyphicon glyphicon-cog"></span>Profile Setting</a></li>
<li><a href="logout.php"><span class="glyphicon glyphicon-log-out"></span>Logout</a></li>
</ul>
</div><!-- /.navbar-collapse -->
</nav>
</div>
<!-- Main Content -->
<div class="container-fluid">
<div class="side-body">
<br>
<pre style="text-align:center;"> <b> Placed Order </b> </pre>
<?php if($_SESSION['job_type'] == "Manager") {?>
<div class="row">
<label style="margin-top:6px;" class="col-md-2 control-label" for="rolename" style="float:left;">Order Type</label>
<div class="col-md-10" style="float:left;">
<div style="text-align:center;">
<select id="order" class="form-control">
<option value="">Select Option</option>
<option value="allorder">Approved Orders</option>
<option value="assignedorder">Assigned Orders</option>
<option value="recievedorder">Received Orders</option>
</select>
</div>
</div>
</div>
<?php }elseif ($_SESSION['job_type'] == "Supervisor") {?>
<div class="row">
<label style="margin-top:6px;" class="col-md-2 control-label" for="rolename" style="float:left;">Order Type</label>
<div class="col-md-10" style="float:left;">
<div style="text-align:center;">
<select id="order" class="form-control">
<option value="">Select Option</option>
<option value="assignedorder">Assigned Orders</option>
</select>
</div>
</div>
</div>
<?php }else{ ?>
<p style="text-align:center"> <b>Approved Order List</b> </p>
<table class='table table-hover' style='width:100%;'>
<thead>
<tr>
<th>Order ID</th>
<th>Client</th>
<th>Details</th>
<th>Ordered date</th>
<th>Delivery date</th>
<th>Manager</th>
</tr>
</thead>
<tbody>
<?php
$sql = "SELECT * FROM orders WHERE approved = 'yes' ORDER BY id DESC";
$result = $connect->query($sql);
while ($row = $result->fetch_assoc()) {
$manager = $row['manager'];
$manresult = $connect->query("SELECT fullname FROM employee WHERE username='$manager'");
$manrow = $manresult->fetch_assoc();
$manfullname = $manrow['fullname'];
$client = $row['client_id'];
$clientresult = $connect->query("SELECT fullname FROM client WHERE id='$client'");
$clientrow = $clientresult->fetch_assoc();
$clientfullname = $clientrow['fullname'];
?>
<tr>
<td> <?php echo $row['id']; ?> </td>
<td> <?php echo $clientfullname; ?> </td>
<td> <?php echo $row['details']; ?> </td>
<td> <?php echo $row['ordering_date']; ?> </td>
<td> <?php echo $row['delivery_date']; ?> </td>
<td> <?php echo $manfullname; ?> </td>
</tr>
<?php
} ?>
</tbody>
</table>
<?php } ?>
<br>
<div id="tableinfo">
</div>
</div>
</div>
</div>
</div>
<div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header" style="background-color:#003366; color:white;">
<h5 class="modal-title" id="exampleModalLabel" style="font-weight:bold; font-size:17px;">New message</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span style="color:white;" aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<form action="#" method="post">
<div class="form-group">
<label for="orderid" class="form-control-label">Order ID:</label>
<input type="text" value="" class="form-control" id="orderid" disabled>
</div>
<div class="form-group">
<label for="message-text" class="form-control-label">Assign Supervisor:</label>
<select id="supervisor" required class="form-control">
<option value="">Select Option</option>
<?php
$query = $connect->query("SELECT * FROM employee WHERE job_type='Supervisor'");
while($row = $query->fetch_assoc()){ ?>
<option value="<?php echo $row['username']; ?>"><?php echo $row['fullname']; ?></option>
<?php
}
?>
</select>
</div>
<div class="form-group">
<label for="message-text" class="form-control-label">Message:</label>
<textarea class="form-control" id="msgbody" disabled required></textarea>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary" id="assignsupervisor">Send message</button>
</div>
</div>
</div>
</div>
<script type="text/javascript">
var dataType="";
$(document).ready(function() {
$("#order").change(function() {
var data = $(this).val();
var jobtype = "<?php echo $job_type; ?>";
dataType = "type=" + data+"&job="+jobtype;
$.ajax({
type: "post",
url: "get_order_emp.php",
data: dataType,
cache: false,
success: function(result) {
$("#tableinfo").html(result);
}
});
});
});
$('#exampleModal').on('show.bs.modal', function(event) {
var button = $(event.relatedTarget) // Button that triggered the modal
var recipient = button.data('whatever') // Extract info from data-* attributes
// If necessary, you could initiate an AJAX request here (and then do the updating in a callback).
// Update the modal's content. We'll use jQuery here, but you could use a data binding library or other methods instead.
var modal = $(this)
modal.find('#orderid').val(recipient)
modal.find('#msgbody').val("You have been assigned to "+recipient+" no order.")
});
$(document).ready(function (){
$(document).on('click', '#approve', function (){
var data = $(this).attr("data-id");
dataType = "type=shipment&order=" + data;
$.ajax({
type: "post",
url: "get_client_order.php",
data: dataType,
cache: false,
success: function(result) {
alert(result);
}
});
});
});
$(document).ready(function(){
$(document).on('click', '#receiveraw', function (){
var orderid = $(this).attr("data-whatever");
var jobtype = "<?php echo $job_type; ?>";
dataType = "type=rawreceive&job="+jobtype+"&orderid="+orderid;
$.ajax({
type: "post",
url: "get_order_emp.php",
data: dataType,
cache: false,
success: function(result){
var data = $("#order").val();
var jobtype = "<?php echo $job_type; ?>";
dataType = "type=" + data+"&job="+jobtype;
$.ajax({
type: "post",
url: "get_order_emp.php",
data: dataType,
cache: false,
success: function(result) {
$("#tableinfo").html(result);
}
});
}
});
});
});
$(document).ready(function (){
$(document).on('click', '#recieve', function (){
var data = $(this).attr("data-id");
dataType = "type=recieve&order=" + data;
$.ajax({
type: "post",
url: "get_client_order.php",
data: dataType,
cache: false,
success: function(result) {
alert(result);
}
});
});
});
$(document).ready(function(){
$(document).on('click', '#assignsupervisor', function(){
var orderid = $("#orderid").val();
var msg = $("#msgbody").val();
var supervisor = $("#supervisor").val();
dataType = "type=assignsup&job=Manager&orderid="+orderid+"&super="+supervisor+"&msg="+msg;
$.ajax({
type: "post",
url: "get_order_emp.php",
data: dataType,
cache: false,
success: function(result){
alert(result);
var data = $("#order").val();
var jobtype = "<?php echo $job_type; ?>";
dataType = "type=" + data+"&job="+jobtype;
$.ajax({
type: "post",
url: "get_order_emp.php",
data: dataType,
cache: false,
success: function(result) {
$("#tableinfo").html(result);
}
});
}
});
});
});
</script>
<?php require_once ('includes/employee_footer.php'); ?>