-
Notifications
You must be signed in to change notification settings - Fork 0
/
Notification.php
114 lines (106 loc) · 2.88 KB
/
Notification.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
<?php
include_once 'header.php';
?>
<div class="container">
<div class="page-title">
<p class="page-title-text"><i class="uil uil-bell"></i></i>Notification</p>
</div>
<div class="table__responsive">
<table id="data_table" class="table">
<thead>
<tr class="table-name">
<th scope="col">Username</th>
<th scope="col">Email</th>
<th scope="col">Requested Role</th>
<th scope="col">Option</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
<script type="text/javascript">
$(document).ready(function(){
fetch_data();
var sale_chart;
function fetch_data(start_date = '', end_date = '')
{
var dataTable = $('#data_table').DataTable({
"processing" : true,
"serverSide" : true,
"lengthMenu": [[10, 25, 50, -1], [10, 25, 50, "All"]],
"order" : [],
"ajax" : {
url:"includes/notification.fetch.inc.php",
type:"POST",
data:{action:'fetch', start_date:start_date, end_date:end_date}
},
"aoColumnDefs": [{
"bSortable": false,
"aTargets": [3]
}
]
})
}
});
$(document).on('click', '#accept', function(event) {
var table = $('#data_table').DataTable();
var ID = $(this).attr('data-ID');
event.preventDefault();
var rconfirm = confirm("Are you sure want to accept ? ");
if (rconfirm) {
$.ajax({
url: "includes/notification.accept.inc.php",
type: "POST",
data: {
ID: ID
},
success: function(data) {
var json = JSON.parse(data);
status = json.status;
if (status == 'success') {
var removingRow = $(this).closest('tr');
table.row(removingRow).remove().draw();
} else {
alert('Failed');
return;
}
}
});
} else {
return null;
}
});
$(document).on('click', '#deny', function(event) {
var table = $('#data_table').DataTable();
var ID = $(this).attr('data-ID');
event.preventDefault();
var rconfirm = confirm("Are you sure want to deny ? ");
if (rconfirm) {
$.ajax({
url: "includes/notification.delete.inc.php",
type: "POST",
data: {
ID: ID
},
success: function(data) {
var json = JSON.parse(data);
status = json.status;
if (status == 'success') {
var removingRow = $(this).closest('tr');
table.row(removingRow).remove().draw();
} else {
alert('Failed');
return;
}
}
});
} else {
return null;
}
})
</script>
<?php
include_once 'footer.php';
?>