-
Notifications
You must be signed in to change notification settings - Fork 0
/
my_account.php
94 lines (92 loc) · 4.62 KB
/
my_account.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
<section class="py-2">
<div class="container">
<div class="card rounded-0">
<div class="card-body">
<div class="w-100 justify-content-between d-flex">
<h4><b>Orders</b></h4>
<a href="./?p=edit_account" class="btn btn btn-default btn-flat bg-maroon"><div class="fa fa-user-cog"></div> Manage Account</a>
</div>
<hr class="border-warning">
<table class="table table-stripped text-dark">
<colgroup>
<col width="10%">
<col width="15">
<col width="25">
<col width="25">
<col width="15">
</colgroup>
<thead>
<tr>
<th>#</th>
<th>DateTime</th>
<th>Transaction Ref Code</th>
<th>Amount</th>
<th>Order Status</th>
</tr>
</thead>
<tbody>
<?php
$i = 1;
$qry = $conn->query("SELECT o.*,concat(c.firstname,' ',c.lastname) as client from `orders` o inner join clients c on c.id = o.client_id where o.client_id = '".$_settings->userdata('id')."' order by unix_timestamp(o.date_created) desc ");
while($row = $qry->fetch_assoc()):
?>
<tr>
<td><?php echo $i++ ?></td>
<td><?php echo date("Y-m-d H:i",strtotime($row['date_created'])) ?></td>
<td><a href="javascript:void(0)" class="view_order" data-id="<?php echo $row['id'] ?>"><?php echo $row['ref_code'] ?></a></td>
<td><?php echo number_format($row['amount']) ?> </td>
<td class="text-center">
<?php if($row['status'] == 0): ?>
<span class="badge badge-light text-dark border px-3 rounded-pill">Pending</span>
<?php elseif($row['status'] == 1): ?>
<span class="badge badge-primary px-3 rounded-pill">Packed</span>
<?php elseif($row['status'] == 2): ?>
<span class="badge badge-warning px-3 rounded-pill">Out for Delivery</span>
<?php elseif($row['status'] == 3): ?>
<span class="badge badge-success px-3 rounded-pill">Delivered</span>
<?php else: ?>
<span class="badge badge-danger px-3 rounded-pill">Cancelled</span>
<?php endif; ?>
</td>
</tr>
<?php endwhile; ?>
</tbody>
</table>
</div>
</div>
</div>
</section>
<script>
function cancel_book($id){
start_loader()
$.ajax({
url:_base_url_+"classes/Master.php?f=update_book_status",
method:"POST",
data:{id:$id,status:2},
dataType:"json",
error:err=>{
console.log(err)
alert_toast("an error occured",'error')
end_loader()
},
success:function(resp){
if(typeof resp == 'object' && resp.status == 'success'){
alert_toast("Book cancelled successfully",'success')
setTimeout(function(){
location.reload()
},2000)
}else{
console.log(resp)
alert_toast("an error occured",'error')
}
end_loader()
}
})
}
$(function(){
$('.view_order').click(function(){
uni_modal("Order Details","./admin/orders/view_order.php?view=user&id="+$(this).attr('data-id'),'large')
})
$('table').dataTable();
})
</script>