-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
340 lines (327 loc) · 13.1 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
336
337
338
339
340
<?php
include "header.php";
setcookie("editId", "", time() - 3600);
setcookie("viewId", "", time() - 3600);
if(isset($_SESSION["scid"]))
{
$stmt = $obj->con1->prepare("SELECT
IFNULL(SUM(CASE WHEN status='new' THEN 1 ELSE 0 END),0) AS new_num,
IFNULL(SUM(CASE WHEN status='allocated' THEN 1 ELSE 0 END),0) AS allocated_num,
IFNULL(SUM(CASE WHEN status='pending' THEN 1 ELSE 0 END),0) AS pending_num,
IFNULL(SUM(CASE WHEN status='closed' THEN 1 ELSE 0 END),0) AS closed_num
FROM call_allocation c1, customer_reg c2 WHERE service_center_id=? AND c1.complaint_no=c2.complaint_no AND c2.warranty!=2");
$stmt->bind_param("i", $_SESSION["scid"]);
}
else{
$stmt = $obj->con1->prepare("SELECT
IFNULL(SUM(CASE WHEN status='new' THEN 1 ELSE 0 END),0) AS new_num,
IFNULL(SUM(CASE WHEN status='allocated' THEN 1 ELSE 0 END),0) AS allocated_num,
IFNULL(SUM(CASE WHEN status='pending' THEN 1 ELSE 0 END),0) AS pending_num,
IFNULL(SUM(CASE WHEN status='closed' THEN 1 ELSE 0 END),0) AS closed_num
FROM call_allocation c1, customer_reg c2 WHERE c1.complaint_no= c2.complaint_no AND c2.warranty!=2");
}
$stmt->execute();
$Resp = $stmt->get_result();
$data = $Resp->fetch_assoc();
$stmt->close();
?>
<main class='p-6' x-data="sales">
<div class="pt-5">
<div class="mb-6 grid grid-cols-1 gap-6 text-white sm:grid-cols-2 xl:grid-cols-4">
<!-- Users Visit -->
<a href="call_allocation.php">
<div class="panel bg-gradient-to-r from-cyan-500 to-cyan-400">
<div class="flex justify-between">
<div class="text-md font-semibold ltr:mr-1 rtl:ml-1">New calls</div>
</div>
<div class="mt-5 flex items-center">
<div class="text-3xl font-bold ltr:mr-3 rtl:ml-3">
<?php echo $data["new_num"]; ?>
</div>
</div>
</div>
</a>
<!-- Sessions -->
<a href="call_allocation.php">
<div class="panel bg-gradient-to-r from-violet-500 to-violet-400">
<div class="flex justify-between">
<div class="text-md font-semibold ltr:mr-1 rtl:ml-1">Allocated Call</div>
</div>
<div class="mt-5 flex items-center">
<div class="text-3xl font-bold ltr:mr-3 rtl:ml-3">
<?php echo $data["allocated_num"]; ?>
</div>
</div>
</div>
</a>
<!-- Time On-Site -->
<a href="call_allocation.php">
<div class="panel bg-gradient-to-r from-blue-500 to-blue-400">
<div class="flex justify-between">
<div class="text-md font-semibold ltr:mr-1 rtl:ml-1">Pending Call</div>
</div>
<div class="mt-5 flex items-center">
<div class="text-3xl font-bold ltr:mr-3 rtl:ml-3">
<?php echo $data["pending_num"]; ?>
</div>
</div>
</div>
</a>
<!-- Bounce Rate -->
<a href="call_allocation.php">
<div class="panel bg-gradient-to-r from-fuchsia-500 to-fuchsia-400">
<div class="flex justify-between">
<div class="text-md font-semibold ltr:mr-1 rtl:ml-1">Closed call</div>
</div>
<div class="mt-5 flex items-center">
<div class="text-3xl font-bold ltr:mr-3 rtl:ml-3">
<?php echo $data["closed_num"]; ?>
</div>
</div>
</div>
</a>
</div>
</div>
<div class='mb-6 grid gap-6 xl:grid-cols-3'>
<div class="panel xl:col-span-2 shadow-md">
<div class="mb-5 flex items-center">
<h5 class="text-2xl text-primary font-bold dark:text-white-light">
Daily Calls
</h5>
<!-- <span class="block text-sm font-normal text-white-dark">Go to columns for details.</span> -->
<div class="relative ltr:ml-auto rtl:mr-auto">
<div
class="grid h-11 w-11 place-content-center rounded-full bg-[#ffeccb] text-warning dark:bg-warning dark:text-[#ffeccb]">
<i class="ri-phone-line text-xl"></i>
</div>
</div>
</div>
<div class="overflow-hidden">
<div x-ref="dailySales" class="rounded-lg bg-white dark:bg-black">
<!-- loader -->
<div
class="grid min-h-[175px] place-content-center bg-white-light/30 dark:bg-dark dark:bg-opacity-[0.08]">
<span
class="inline-flex h-5 w-5 animate-spin rounded-full border-2 border-black !border-l-transparent dark:border-white"></span>
</div>
</div>
</div>
</div>
<div class="panel shadow-md">
<div class="mb-5 flex items-center">
<h5 class="text-2xl text-primary font-bold dark:text-white-light">Calls Data</h5>
</div>
<div class="overflow-hidden">
<div x-ref="salesByCategory" class="rounded-lg bg-white dark:bg-black">
<!-- loader -->
<div
class="grid min-h-[353px] place-content-center bg-white-light/30 dark:bg-dark dark:bg-opacity-[0.08]">
<span
class="inline-flex h-5 w-5 animate-spin rounded-full border-2 border-black !border-l-transparent dark:border-white"></span>
</div>
</div>
</div>
</div>
</div>
</main>
<script>
document.addEventListener('alpine:init', () => {
Alpine.data('sales', () => ({
init() {
isDark = this.$store.app.theme === 'dark' || this.$store.app.isDarkMode ? true : false;
isRtl = this.$store.app.rtlClass === 'rtl' ? true : false;
const revenueChart = null;
const salesByCategory = null;
const dailySales = null;
const totalOrders = null;
// revenue
setTimeout(() => {
this.salesByCategory = new ApexCharts(this.$refs.salesByCategory, this
.salesByCategoryOptions);
this.$refs.salesByCategory.innerHTML = '';
this.salesByCategory.render();
// daily sales
this.dailySales = new ApexCharts(this.$refs.dailySales, this
.dailySalesOptions);
this.$refs.dailySales.innerHTML = '';
this.dailySales.render();
}, 300);
this.$watch('$store.app.theme', () => {
isDark = this.$store.app.theme === 'dark' || this.$store.app.isDarkMode ?
true : false;
this.dailySales.updateOptions(this.dailySalesOptions);
this.salesByCategory.updateOptions(this.salesByCategoryOptions);
});
},
get salesByCategoryOptions() {
return {
series: [
<?php echo $data["new_num"]; ?>,
<?php echo $data["allocated_num"]; ?>,
<?php echo $data["pending_num"]; ?>,
<?php echo $data["closed_num"]; ?>
],
chart: {
type: 'donut',
height: 400,
fontFamily: 'Nunito, sans-serif',
},
dataLabels: {
enabled: false,
},
stroke: {
show: true,
width: 10,
colors: isDark ? '#0e1726' : '#fff',
},
colors: isDark ? ['#5c1ac3', '#e2a03f', '#e7515a', '#e2a03f'] : ['#2eb384',
'#e2a03f', '#e7515a', '#5c1ac3'
],
legend: {
position: 'bottom',
horizontalAlign: 'center',
fontSize: '14px',
markers: {
width: 10,
height: 10,
offsetX: -2,
},
height: 50,
offsetY: 20,
},
plotOptions: {
pie: {
donut: {
size: '75%',
background: 'transparent',
labels: {
show: true,
name: {
show: true,
fontSize: '25px',
offsetY: -10,
},
value: {
show: true,
fontSize: '26px',
color: isDark ? '#bfc9d4' : undefined,
offsetY: 16,
formatter: (val) => {
return val;
},
},
total: {
show: true,
label: 'Total',
color: '#888ea8',
fontSize: '22px',
formatter: (w) => {
return w.globals.seriesTotals.reduce(function(a,
b) {
return a + b;
}, 0);
},
},
},
},
},
},
labels: ['New Call', 'Allocated Call', 'Pending Call', 'Closed Call'],
states: {
hover: {
filter: {
type: 'none',
value: 0.15,
},
},
active: {
filter: {
type: 'none',
value: 0.15,
},
},
},
};
},
get dailySalesOptions() {
return {
series: [{
name: 'Calls',
data: [44, 55, 41, 67, 22, 43, 21],
},
{
name: 'Last Week',
data: [13, 23, 20, 33, 13, 27, 33],
},
],
chart: {
height: 250,
type: 'bar',
fontFamily: 'Nunito, sans-serif',
toolbar: {
show: false,
},
stacked: true,
stackType: '100%',
},
dataLabels: {
enabled: false,
},
stroke: {
show: true,
width: 1,
},
colors: ['#2eb384', '#e0e6ed'],
responsive: [{
breakpoint: 480,
options: {
legend: {
position: 'bottom',
offsetX: -10,
offsetY: 0,
},
},
}, ],
xaxis: {
labels: {
show: false,
},
categories: ['Sun', 'Mon', 'Tue', 'Wed', 'Thur', 'Fri', 'Sat'],
},
yaxis: {
show: false,
},
fill: {
opacity: 1,
},
plotOptions: {
bar: {
horizontal: false,
columnWidth: '25%',
},
},
legend: {
show: false,
},
grid: {
show: false,
xaxis: {
lines: {
show: false,
},
},
padding: {
top: 10,
right: -20,
bottom: -20,
left: -20,
},
},
};
},
}));
})
</script>
<?php
include "footer.php";
?>