This repository has been archived by the owner on Dec 6, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
assenze.php
150 lines (142 loc) · 8.02 KB
/
assenze.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
149
150
<?php
include "include/top.php";
$axios = new axios;
$axios->postREFamilyData = $_SESSION["getPostREFamily"];
$axios->QuadrimestreFT = $_COOKIE["QuadrimestreFT"];
$axios->QuadrimestreFTAll = $_SESSION["QuadrimestreFTAll"];
$axios->student = $_SESSION["getStudentId"][$_COOKIE['studentNumber']];
$axios->cookies = $_SESSION["cookies"];
$result = $axios->getAbsences();
?>
<!DOCTYPE html>
<html>
<head>
<title>Assenze | REDignus</title>
<?php include "include/head.php";?>
</head>
<body>
<div class="wrapper">
<!-- Apertura Wrapper -->
<!-- Sidebar -->
<?php include "include/sidebar.php";?>
<!-- Page Content -->
<div id="content">
<?php include "include/navbar.php";?>
<div class="container-fluid">
<br>
<div class="jumbotron">
<div class="text-center">
<h3>Ore di assenza totali:</h3>
<div id="oreassenza">
<button type="button" class="btn btn-primary" onclick="calcolaAssenza()">Clicca qui per calcolarle...</button>
</div>
</div>
<br><hr><br>
<!-- GIUSTIFICATE start -->
<div class="card mb-5">
<div class="card-header bg-danger text-white">
Non giustificate
</div>
<div class="card-body" id="tojustify">
</div>
</div>
<!-- GIUSTIFICATE end -->
<!-- NON_GIUSTIFICATE start -->
<div class="card">
<div class="card-header bg-success text-white ">
Giustificate
</div>
<div class="card-body" id="justified">
</div>
</div>
<br>
</div>
</div>
<?php include "include/footer.php";?>
<script>
function calcolaAssenza() {
$('#oreassenza').html("<h3><i class='fas fa-circle-notch fa-spin'></i></h3>");
$.get('api/ajax/oreAssenza', function(data) {
$('#oreassenza').html("<h3>"+data+" Ore</h3>")
});
}
function assenza() {
// $('#registroelementi').html('<div class="text-center"><br><h2>Caricamento</h2><i class="fas fa-circle-notch fa-spin fa-4x"></i></div>');
$.getJSON('https://redignus.it/api/ajax/assenze', function(data) {
if (data.tojustify != null) {
var output_tojustify = "";
data.tojustify.forEach(element => {
if (element.type == "Assenza") {
output_tojustify += `<hr style="border-top: 1px solid rgba(0,0,0,.8);"><div class="row">
<div class="col-8 col-lg-10">
<div class="row" style="height: 100%;">
<div class="col text-center">
<h5>${element.date}</h5>
<hr>
<h5>${element.type}</h5>
</div>
</div>
</div>
<div class="col-4 col-lg-2">
<div class="p-2 bg-danger text-white" style="height: 100%; display: flex; justify-content: center; align-items: center;">
<div class="text-center">
<h5 class="text-white">${element.type.substring(0, 3)}</h5>
</div>
</div>
</div>
</div>`;
} else {
output_tojustify += `<hr style="border-top: 1px solid rgba(0,0,0,.8);"><div class="row">
<div class="col-8 col-lg-10">
<div class="row" style="height: 100%;">
<div class="col text-center">
<h5>${element.date}</h5>
<hr>
<h5>${element.type}</h5>
</div>
</div>
</div>
<div class="col-4 col-lg-2">
<div class="p-2 bg-warning text-dark" style="height: 100%; display: flex; justify-content: center; align-items: center;">
<div class="text-center">
<h5 class="text-dark">${element.type.substring(0, 3)}</h5>
</div>
</div>
</div>
</div>`;
}
});
}
if (data.justified != null) {
var output_justified = "";
data.justified.forEach(element => {
output_justified += `<hr style="border-top: 1px solid rgba(0,0,0,.8);"><div class="row">
<div class="col-8 col-lg-10">
<div class="row" style="height: 100%;">
<div class="col text-center">
<h5>${element.date}</h5>
<hr>
<h5>${element.type}</h5>
</div>
</div>
</div>
<div class="col-4 col-lg-2">
<div class="p-2 bg-success text-white" style="height: 100%; display: flex; justify-content: center; align-items: center;">
<div class="text-center">
<h5 class="text-white">${element.type.substring(0, 3)}</h5>
</div>
</div>
</div>
</div>`;
});
}
$("#tojustify").html(output_tojustify+`<hr style="border-top: 1px solid rgba(0,0,0,.8);">`);
$("#justified").html(output_justified+`<hr style="border-top: 1px solid rgba(0,0,0,.8);">`);
});
}
assenza();
</script>
</div><!-- Page Content -->
</div><!-- Chiusura Wrapper -->
</body>
</html>