-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
335 lines (292 loc) · 10.3 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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
<?php
require_once "./constants.php";
require_once ___FUNCTIONS___;
session_start();
if (!isset($_SESSION[USER_GLOBAL_VAR]) || !array_key_exists(USER_GLOBAL_VAR, $_SESSION)) {
header('location: login.php');
} else {
// do nothing
}
$pn = isset($_GET['pn']) ? $_GET['pn'] : '404';
// ob_start("minifier");
?>
<!DOCTYPE html>
<html lang="en" class="light-style layout-menu-fixed" dir="ltr" data-theme="theme-default" data-assets-path="./" data-template="vertical-menu-template-free">
<head>
<?= loadMetaData() ?>
<?= loadTitleAndFavicon('The digital complaint box') ?>
<?= loadStyleSheets() ?>
<?= loadScripts() ?>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.9.4/Chart.js"></script>
<style>
canvas {
height: 100%;
width: 100%;
}
</style>
<script>
$.ajax({
url: '<?= NEWS_API ?>?nc=6',
method: 'GET',
dataType: 'json',
success: function(response) {
var swiper_news = '';
response.forEach(element => {
// console.log(element.description);
swiper_news += '<div class="swiper-slide">';
swiper_news += '<div class="news-title">' + element.title + '</div>';
swiper_news += '<div class="news-date">' + formatDate(element.updated_at) + '</div>';
swiper_news += '<div class="news-description">' + element.description + '</div>';
swiper_news += '</div>';
});
// console.log(swiper_news);
$('#swiper-news').html(swiper_news);
},
error: function(error) {
console.log(error);
}
});
</script>
</head>
<body>
<div class="loader-overlay">
<div class="loader-gate left-loader">
<div class="logo-left">
<img src="./assets/images/logo-left.png">
</div>
</div>
<div class="loader-gate right-loader">
<div class="logo-right">
<img src="./assets/images/logo-right.png">
</div>
</div>
<div class="shikayaat-name">
shikayaat
</div>
</div>
<main>
<div class="section-holder">
<?= getComponent('header') ?>
<?= getSidebar() ?>
<section class="right-content-section" id="right-content-section">
<div class="info-tiles">
<div class="tile">
<div class="icon"><i class="fa fa-comments" aria-hidden="true"></i></div>
<div class="content">
<div class="number"><?= getComplaintsCount() ?></div>
<div class="number number-desc">Raised Tickets</div>
</div>
</div>
<div class="tile">
<div class="icon"><i class="fa fa-users" aria-hidden="true"></i></div>
<div class="content">
<div class="number"><?= getUsersCount() ?></div>
<div class="number number-desc">Registered Users</div>
</div>
</div>
<div class="tile">
<div class="icon"><i class="fa fa-building" aria-hidden="true"></i></div>
<div class="content">
<div class="number"><?= getDepartmentsCount() ?></div>
<div class="number number-desc">Registered Departments</div>
</div>
</div>
<div class="tile">
<div class="icon"><i class="fa fa-university" aria-hidden="true"></i></div>
<div class="content">
<div class="number">1</div>
<div class="number number-desc">Organisation</div>
</div>
</div>
</div>
<div class="row m20px">
<div class="column-60">
<div class="card full-width p0 m0">
<h1 class="card-heading">Tickets against Departments</h1>
<div class="card-content m0 p0">
<div class="blank-60px"></div>
<canvas id="lineChart"></canvas>
<div class="blank-30px"></div>
</div>
</div>
</div>
<div class="column-40">
<div class="card full-width p0 m0 height-100">
<h1 class="card-heading">Tickets Soberness</h1>
<div class="card-content m0">
<div class="blank-60px"></div>
<canvas id="pieChart"></canvas>
<div class="blank-30px"></div>
</div>
</div>
</div>
</div>
<div class="row m20px">
<div class="column-70">
<div class="card full-width p0 m0">
<h1 class="card-heading">Tickets Frequency</h1>
<div class="card-content m0 p0">
<div class="blank-60px"></div>
<canvas id="barChart"></canvas>
<div class="blank-30px"></div>
</div>
</div>
</div>
<div class="column-30">
<div class="card full-width p0 m0 height-100">
<h1 class="card-heading">News</h1>
<div class="card-content m0">
<div class="blank-60px"></div>
<div class="swiper news-and-events" id="news-and-events">
<div class="swiper-wrapper" id="swiper-news">
<!-- <div class="swiper-slide">
<div class="news-title">SECOND last frontier for financial sector reforms: Cooperative Banks</div>
<div class="news-date">2023-04-19 12:23:26</div>
<div class="news-description">the Highlights India\u2019s cooperative banks have so far remained out of bounds of the multiple reforms for the financial sector taken since 1991 Cooperative banks still remain handy instruments for political parties, a channel for dispensing political patronage RBI observed a series of challenges regarding cooperative banks, including deficient corporate governance practices, and rising incidence of frauds Lines of distinction between commercial banks, and cooperative banks are fast blurring with everyone competing for the same set of clients Large-scale reforms, and not the gradualism noticed.</div>
</div>
<div class="swiper-slide">Slide 2</div>
<div class="swiper-slide">Slide 3</div>
<div class="swiper-slide">Slide 4</div>
<div class="swiper-slide">Slide 5</div>
<div class="swiper-slide">Slide 6</div> -->
</div>
</div>
<!-- <div class="swiper mySwiper">
<div class="swiper-wrapper height-100">
<div class="swiper-slide">Slide 1</div>
</div>
</div> -->
</div>
</div>
</div>
</div>
</section>
</div>
<?php
$priorities_list = getPrioritiesList();
$priority_colors = array();
$priority_names = array();
$priority_counts = array();
if (mysqli_num_rows($priorities_list) > 0) {
while ($row = mysqli_fetch_assoc($priorities_list)) {
if ($row['is_priority']) {
array_push($priority_colors, $row['color']);
array_push($priority_names, $row['priority_name']);
array_push($priority_counts, getPriorityCounts($row['priorityid'])['COUNT(*)']);
}
}
}
// Last 8 Months Graph
$months = array('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December');
$last8months_data = last8MonthsComplaintsCounts();
$last8months = array();
for ($i = 0; $i < 8; $i++) {
$timestamp = strtotime("-$i month");
$last8months[date('F Y', $timestamp)] = 0;
}
$last8months = array_reverse($last8months);
if (mysqli_num_rows($last8months_data) > 0) {
while ($row = mysqli_fetch_assoc($last8months_data)) {
$month_data = $months[$row['month'] - 1] . " " . $row['year'];
$last8months[$month_data] = $row['count'];
}
}
print_r($last8months);
?>
<script>
const xValues1 = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000];
new Chart("lineChart", {
type: "line",
data: {
labels: xValues1,
datasets: [{
data: [860, 1140, 1060, 1060, 1070, 1110, 1330, 2210, 7830, 2478],
borderColor: "red",
fill: false
},
{
data: [1600, 1700, 1700, 1900, 2000, 2700, 4000, 5000, 6000, 7000],
borderColor: "green",
fill: false
}, {
data: [300, 700, 2000, 5000, 6000, 4000, 2000, 1000, 200, 100],
borderColor: "blue",
fill: false
}
]
},
options: {
legend: {
display: false
}
}
});
// pie chart
var xValues = [<?php echo '"' . implode('", "', $priority_names) . '"'; ?>];
var yValues = [<?php echo '"' . implode('", "', $priority_counts) . '"'; ?>];
var barColors = [<?php echo '"#' . implode('", "#', $priority_colors) . '"'; ?>];
new Chart("pieChart", {
type: "pie",
data: {
labels: xValues,
datasets: [{
backgroundColor: barColors,
data: yValues
}]
}
});
var xValues3 = [
<?php
$last8months_keys = array_keys($last8months);
echo '"' . implode('", "', $last8months_keys) . '"';
?>
];
var yValues3 = [
<?php
$last8months_counts = array_values($last8months);
echo '"' . implode('", "', $last8months_counts) . '"';
?>
];
var barColors3 = "#8A8585";
new Chart("barChart", {
type: "bar",
data: {
labels: xValues3,
datasets: [{
backgroundColor: barColors3,
data: yValues3
}]
},
options: {
scales: {
y: {
type: 'linear',
ticks: {
stepSize: 1
}
}
},
legend: {
display: false
}
}
});
</script>
<?= loadFooterScripts() ?>
<script>
var swiper = new Swiper(".news-and-events", {
direction: "vertical",
loop: true,
autoplay: {
delay: 2000,
},
speed: 2000,
// autoHeight: true,
slidesPerView: 2,
});
</script>
</body>
</html>
<?php
ob_end_flush();
?>