-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
148 lines (127 loc) · 3.76 KB
/
index.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
<?php
//index.php
include('header.php');
?>
<div class="container" style="margin-top:30px">
<div class="card">
<div class="card-header">
<div class="row">
<div class="col-md-9">Overall Student Attendance Status</div>
<div class="col-md-3" align="right">
</div>
</div>
</div>
<div class="card-body">
<div class="table-responsive">
<table class="table table-striped table-bordered" id="student_table">
<thead>
<tr>
<th>Student Name</th>
<th>Roll Number</th>
<th>Class</th>
<th>Attendance Percentage</th>
<th>Report</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
</div>
</div>
</body>
</html>
<script type="text/javascript" src="js/bootstrap-datepicker.js"></script>
<link rel="stylesheet" href="css/datepicker.css" />
<style>
.datepicker
{
z-index: 1600 !important; /* has to be larger than 1050 */
}
</style>
<div class="modal" id="formModal">
<div class="modal-dialog">
<div class="modal-content">
<!-- Modal Header -->
<div class="modal-header">
<h4 class="modal-title">Make Report</h4>
<button type="button" class="close" data-dismiss="modal">×</button>
</div>
<!-- Modal body -->
<div class="modal-body">
<div class="form-group">
<div class="input-daterange">
<input type="text" name="from_date" id="from_date" class="form-control" placeholder="From Date" readonly />
<span id="error_from_date" class="text-danger"></span>
<br />
<input type="text" name="to_date" id="to_date" class="form-control" placeholder="To Date" readonly />
<span id="error_to_date" class="text-danger"></span>
</div>
</div>
</div>
<!-- Modal footer -->
<div class="modal-footer">
<input type="hidden" name="student_id" id="student_id" />
<button type="button" name="create_report" id="create_report" class="btn btn-success btn-sm">Create Report</button>
<button type="button" class="btn btn-danger btn-sm" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<script>
$(document).ready(function(){
var dataTable = $('#student_table').DataTable({
"processing":true,
"serverSide":true,
"order":[],
"ajax":{
url:"attendance_action.php",
type:"POST",
data:{action:'index_fetch'}
}
});
$('.input-daterange').datepicker({
todayBtn:"linked",
format:"yyyy-mm-dd",
autoclose:true,
container: '#formModal modal-body'
});
$(document).on('click', '.report_button', function(){
var student_id = $(this).attr('id');
$('#student_id').val(student_id);
$('#formModal').modal('show');
});
$('#create_report').click(function(){
var student_id = $('#student_id').val();
var from_date = $('#from_date').val();
var to_date = $('#to_date').val();
var error = 0;
if(from_date == '')
{
$('#error_from_date').text('From Date is Required');
error++;
}
else
{
$('#error_from_date').text('');
}
if(to_date == '')
{
$('#error_to_date').text('To Date is Required');
error++;
}
else
{
$('#error_to_date').text('');
}
if(error == 0)
{
$('#from_date').val('');
$('#to_date').val('');
$('#formModal').modal('hide');
window.open("report.php?action=student_report&student_id="+student_id+"&from_date="+from_date+"&to_date="+to_date);
}
});
});
</script>