-
Notifications
You must be signed in to change notification settings - Fork 0
/
scripts.php
134 lines (119 loc) · 4.26 KB
/
scripts.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
<!-- chartjs begins -->
<script>
let myChart = document.getElementById('myChart').getContext('2d');
let virdiChart = new Chart(myChart, {
type:'bar', //bar, horizontalBar, pie, line, doughnut, radar, polarArea
data:{
labels:['Total', 'Active', 'Passive'], //data
datasets:[{
label:'Total',
data:[
<?php echo json_encode($total_employees) ?>,
<?php echo json_encode($active_employees) ?>,
<?php echo json_encode($passive_employees) ?>,
], //values
// backgroundColor: 'green'
backgroundColor: [ //color for each data
'rgb(0, 227, 150)',
'green',
'yellow'
],
borderWidth:1,
borderColor:'#777',
hoverBorderWidth:3,
hoverBorderColor:'#000'
}]
},
//options for design
options:{
//the title
title:{
display:true,
text:'Employee(s) information',
fontSize:20
},
//the smaller box of label info
legend:{
display:true,
position:'top'
},
//layout:{} //for styling
tooltips:{
enabled:true
}
}
});
// second chart
let myChart2 = document.getElementById('myChart2').getContext('2d');
let virdiChart2 = new Chart(myChart2, {
type:'pie', //bar, horizontalBar, pie, line, doughnut, radar, polarArea
data:{
labels:['Total', 'Present', 'Absent'], //data
datasets:[{
label:'Total',
data:[
//json_encode was used to encode the php values
<?php echo json_encode($processed_log) ?>,
// 558930,
72000,
30000
], //values
// backgroundColor: 'green'
backgroundColor: [ //color for each data
'rgb(0, 227, 150)',
'green',
'yellow'
],
borderWidth:1,
borderColor:'#777',
hoverBorderWidth:2,
hoverBorderColor:'#000'
}]
},
//options for design
options:{
//the title
title:{
display:true,
text:'Attendance information',
fontSize:20
},
//the smaller box of label info
legend:{
display:true,
position:'right'
},
//layout:{} //for styling
tooltips:{
enabled:true
}
}
})
</script>
<script>
//nav bar dropdown
$(document).ready(function(){
$('#department').hover(function(){
$('#sub-department').toggle();
});
$('#division').hover(function(){
$('#sub-division').toggle();
});
$('#attendance').hover(function(){
$('#sub-attendance').toggle();
});
// $('#division').hover(function(){
// $('#sub-division').toggle();
// });
//nav bar dropdown ends
})
// var date = new Date();
var date = new Date().getDate();
var month = new Date().getMonth() + 1; // Since getMonth() returns month from 0-11 not 1-12.
var year = new Date().getFullYear();
var dateString = date + "/" + month + "/" + year;
// console.log(dateString);
var date = document.getElementById('date');
date.innerHTML = dateString;
// $('#date').innerHTML = dateString;
</script>