-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathcollection.php
98 lines (90 loc) · 3.35 KB
/
collection.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
+<?php include 'includes/header.php'; ?>
<?php
require_once "includes/classes/admin-class.php";
$admins = new Admins($dbh);
if(isset($_POST['from'])){
//$date = $_POST['date'];
$amount = $_POST['amount'];
$from = $_POST['from'];
$remarks = $_POST['remarks'];
if(!$admins->colleciton($amount, $from, $remarks)){
echo "Something went wrong ! Try again later.";
}else{
echo "Expanse added !";
}
}
?>
<div class="dashboard">
<div class="col-md-12 col-sm-12">
<div class="col-md-9">
<h3><a href="daily_data.php" class="btn btn-sm btn-primary"> Back</a> Expanse History</h3>
</div>
<div class="col-md-3 pull-right">
<form class="form-inline pull-right">
<div class="form-group">
<label class="sr-only" for="search">Search for</label>
<div class="input-group">
<div class="input-group-addon"><span class="glyphicon glyphicon-search" aria-hidden="true"></span></div>
<input type="text" class="form-control" id="search" placeholder="Type a name">
<div class="input-group-addon"></div>
</div>
</div>
<!-- <button type="submit" class="btn btn-info">Search</button> -->
</form>
</div>
<hr>
<div class="col-md-12 col-sm-12">
<table class="table center table-striped table-bordered" id="grid-basic">
<thead class="thead-inverse">
<tr class="info">
<th>ID </th>
<th>Date</th>
<th>Amount</th>
<th>From</th>
<th>Remarks</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php
$collection = $admins->fetchCollectin();
if (isset($collection) && sizeof($collection) > 0){
foreach($collection as $collect) {
?>
<tr>
<td><?=$collect->id?></td>
<td class="search"><?=date("j F y",strtotime($collect->created_at))?></td>
<td class="search"><?=$collect->amount?></td>
<td class="search"><?=$collect->payee?></td>
<td class="search"><?=$collect->remarks?></td>
<td><button type="button" data-id="<?=$collect->id?>" class="btn btn-danger btn-sm delete disabled">DELETE</button></td>
</tr>
<?php }} ?>
</tbody>
</table>
</div>
</div>
<?php include 'includes/footer.php'; ?>
<script type="text/javascript">
document.getElementById('date').valueAsDate = new Date();
</script>
<script type="text/javascript">
$(function() {
grid = $('#grid-basic');
// handle search fields of members key up event
$('#search').keyup(function(e) {
text = $(this).val(); // grab search term
if(text.length > 1) {
grid.find('tr:has(td)').hide(); // hide data rows, leave header row showing
// iterate through all grid rows
grid.find('tr').each(function(i) {
// check to see if search term matches Name column
if($(this).find('.search').text().toUpperCase().match(text.toUpperCase()))
$(this).show(); // show matching row
});
}
else
grid.find('tr').show(); // if no matching name is found, show all rows
});
});
</script>