This repository has been archived by the owner on Feb 27, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
listorders_markcomplete.php
90 lines (90 loc) · 2.57 KB
/
listorders_markcomplete.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
<?php
$page_title = "Orders";
$page_subtitle = "Incomplete";
$post = $_SERVER['REQUEST_METHOD'] == "POST"; //Bool
include("inc/sql_queries.php");
function echo_data($data, $item) {
/*
Echos existing data, makes sure that it exists
*/
if(isset($data[$item])) {
echo $data[$item];
}
}
$data = select_all_incomplete_orders();
if($post) {
foreach($data as $item) {
if(in_array($item["OrderID"], $_REQUEST)) {
set_complete($item["OrderID"]);
}
}
header("Location: listorders_markcomplete.php");
exit(0);
}
include("templates/header.php");
?>
<div class="col-lg-12">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Orders Not Complete</h3>
</div>
<div class="panel-body">
<?php
if(count($data)):
?>
<form method="post">
<table class="table table-bordered table-hover">
<thead>
<tr>
<th></th>
<th></th>
<th>Quoted Price</th>
<th>Total Paid</th>
<th>Customer Name</th>
<th>Picked Up</th>
</tr>
</thead>
<tbody>
<?php
foreach($data as $row):
$rowlink = "editorder.php?admin&OrderID=".$row['OrderID'];
?>
<tr>
<td class="text-center" style="width: 50px;"><?php //Checkbox ?>
<input name="<?php echo $row["OrderID"]; ?>" type="checkbox" value='<?php echo $row["OrderID"]; ?>'>
</td>
<td class="text-center"><a href="<?php echo $rowlink; ?>"><span class="glyphicon glyphicon-pencil"></span></a></td>
<td><?php echo_data($row, 'QuotedPrice'); ?></td>
<td><?php echo_data($row, 'TotalPaid'); ?></td>
<td><?php echo_data($row, 'Name'); ?></td>
<td class="text-center"><span class="glyphicon <?php echo $row['PickedUp'] ? "glyphicon-ok" : "glyphicon-remove"; ?>"></span></td>
</tr>
<?php
endforeach;
?>
<tbody>
<!--
<tfoot>
<tr>
<th></th>
</tr>
</tfoot>
-->
</table>
<div class="text-center">
<button type="submit" class="btn btn-default">Mark Checked Orders as Complete</button>
</div>
</form>
<?php
else:
?>
<p>There are no Orders or all Orders are Complete</p>
<?php
endif;
?>
</div>
</div>
</div>
<?php
include("templates/footer.php");
?>