PluginProbe
WPBot – AI ChatBot for Live Support, Lead Generation, WordPress Automation, AI Services / 8.4.9
WPBot – AI ChatBot for Live Support, Lead Generation, WordPress Automation, AI Services v8.4.9
8.7.7 8.7.6 8.7.5 8.7.4 8.7.3 8.7.2 8.7.1 8.7.0 8.6.9 8.6.8 8.6.7 8.6.6 8.6.5 8.6.4 8.6.2 8.6.1 8.6.0 8.5.9 8.5.8 8.5.7 8.5.6 8.5.5 8.5.4 8.5.3 8.5.2 All 533 releases
chatbot / includes / chat-sessions / reports / view / reporting-highlights.php

reporting-highlights.php in WPBot – AI ChatBot for Live Support, Lead Generation, WordPress Automation, AI Services 8.4.9, at includes/chat-sessions/reports/view/reporting-highlights.php

441 lines 12.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
2
3 <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.1/font/bootstrap-icons.css" integrity="sha384-4LISF5TTJX/fLmGSxO53rV4miRxdg84mZsxmO8Rx5jGtp/LbrixFETvWa5a6sESd" crossorigin="anonymous">
4
5 <link href="<?php echo QCLD_wpCHATBOT_HISTORY_PLUGIN_URL . '/reports/view/assets/style.css'; ?>" rel="stylesheet">
6
7 <main id="main" class="main clearfix">
8
9 <div class="pagetitle">
10 <h1>Bot - Reporting Dashboard</h1>
11 </div><!-- End Page Title -->
12
13 <section class="section dashboard">
14 <div class="row">
15
16 <!-- Left side columns -->
17 <div class="col-lg-12">
18 <div class="row">
19
20 <!-- Card 1 -->
21 <div class="col-xxl-4 col-md-6">
22 <div class="card info-card sales-card">
23
24 <div class="card-body">
25 <h5 class="card-title">Total Conversations</span></h5>
26
27 <div class="d-flex align-items-center">
28 <div class="card-icon rounded-circle d-flex align-items-center justify-content-center">
29 <i class="bi bi-wechat"></i>
30 </div>
31 <div class="ps-3">
32 <h6>
33 <?php echo botreports_get_total_conversation_count(); ?>
34 </h6>
35 <span class="text-success small pt-1 fw-bold">
36 <?php echo botreports_get_todays_conversation_count(); ?>
37 </span>
38 <span class="text-muted small pt-2 ps-1">Today</span>,
39 <span class="text-success small pt-1 fw-bold">
40 <?php echo botreports_get_weeks_conversation_count(); ?>
41 </span>
42 <span class="text-muted small pt-2 ps-1">Last Week</span>
43
44 </div>
45 </div>
46 </div>
47
48 </div>
49 </div><!-- End Card 1 -->
50 <!-- Card 1 -->
51 <div class="col-xxl-4 col-md-6">
52 <div class="card info-card sales-card feedback-card" data-type="like" style="cursor:pointer;">
53 <div class="card-body">
54 <h5 class="card-title">Positive Feedback</h5>
55 <div class="d-flex align-items-center">
56 <div class="card-icon rounded-circle d-flex align-items-center justify-content-center">
57 <i class="bi bi-hand-thumbs-up"></i>
58 </div>
59 <div class="ps-3">
60 <h6><?php echo wpbot_get_report_stats_count()['likes']; ?></h6>
61 </div>
62 </div>
63 </div>
64 </div>
65 </div>
66
67 <div class="col-xxl-4 col-md-6">
68 <div class="card info-card sales-card feedback-card" data-type="dislike" style="cursor:pointer;">
69 <div class="card-body">
70 <h5 class="card-title">Negative Feedback</h5>
71 <div class="d-flex align-items-center">
72 <div class="card-icon rounded-circle d-flex align-items-center justify-content-center">
73 <i class="bi bi-hand-thumbs-down"></i>
74 </div>
75 <div class="ps-3">
76 <h6><?php echo wpbot_get_report_stats_count()['dislikes']; ?></h6>
77 </div>
78 </div>
79 </div>
80 </div>
81 </div>
82 <div id="feedback-results" style="margin-top:30px;"></div>
83
84
85
86 <!-- Card 2 -->
87 <div class="col-xxl-4 col-md-6">
88 <div class="card info-card sales-card">
89
90 <div class="card-body">
91 <h5 class="card-title">Conversations in Last 30 Days</span></h5>
92
93 <div class="d-flex align-items-center">
94 <div class="card-icon rounded-circle d-flex align-items-center justify-content-center">
95 <i class="bi bi-bar-chart-steps"></i>
96 </div>
97 <div class="ps-3">
98 <h6>
99 <?php echo botreports_get_last30days_conversation_count(); ?>
100 </h6>
101 </div>
102 </div>
103 </div>
104
105 </div>
106 </div><!-- End Card 2 -->
107
108 <!-- Card 3 -->
109 <div class="col-xxl-4 col-md-6">
110 <div class="card info-card sales-card">
111
112 <div class="card-body">
113 <h5 class="card-title">Average Daily Conversation</span></h5>
114
115 <div class="d-flex align-items-center">
116 <div class="card-icon rounded-circle d-flex align-items-center justify-content-center">
117 <i class="bi bi-bar-chart"></i>
118 </div>
119 <div class="ps-3">
120 <h6><?php echo botreports_get_last30days_conversation_average(); ?></h6>
121 <span class="text-muted small">In</span>
122 <span class="text-success small pt-1 fw-bold">Last 30</span>
123 <span class="text-muted small pt-2 ps-1">Days</span>
124 </div>
125 </div>
126 </div>
127
128 </div>
129 </div><!-- End Card 3 -->
130
131 <?php
132 echo '<pre>';
133 botreports_get_last30days_conversation_density();
134 echo '</pre>';
135 ?>
136
137 <!-- Reports: Conversation Density Chart -->
138 <div class="col-lg-12">
139 <div class="card" style="max-width: 100% !important;">
140 <div class="card-body">
141 <h5 class="card-title">Conversation Density Chart</h5>
142
143 <!-- Area Chart -->
144 <div id="areaChart" style="min-height: 365px;">
145 <div id="apexchartsa0c3a8xu" class="apexcharts-canvas apexchartsa0c3a8xu apexcharts-theme-light">
146
147 </div>
148 <div class="apexcharts-menu">
149 <div class="apexcharts-menu-item exportSVG" title="Download SVG">Download SVG</div>
150 <div class="apexcharts-menu-item exportPNG" title="Download PNG">Download PNG</div>
151 <div class="apexcharts-menu-item exportCSV" title="Download CSV">Download CSV</div>
152 </div>
153 </div>
154
155 <?php
156
157 $densityTable = botreports_get_last30days_conversation_density();
158
159 $dates = array();
160 $conversation_count_in_date = array();
161
162 foreach ( $densityTable as $data ) {
163 array_push( $dates, $data->CONVERSATION_DATE );
164 array_push( $conversation_count_in_date, $data->CONVERSATION_NUM );
165 }
166
167 ?>
168
169 <script>
170 document.addEventListener("DOMContentLoaded", () => {
171 const series = {
172 "monthDataSeries1": {
173 "count": <?php echo json_encode( $conversation_count_in_date ); ?>,
174 "dates": <?php echo json_encode( $dates ); ?>,
175 },
176 }
177 new ApexCharts(document.querySelector("#areaChart"), {
178 series: [{
179 name: "Conversation Count: ",
180 data: series.monthDataSeries1.count
181 }],
182 chart: {
183 type: 'bar',
184 height: 350,
185 zoom: {
186 enabled: false
187 }
188 },
189 plotOptions: {
190 bar: {
191 horizontal: false
192 }
193 },
194 dataLabels: {
195 enabled: true
196 },
197 labels: series.monthDataSeries1.dates,
198 xaxis: {
199 type: 'datetime',
200 },
201 yaxis: {
202 opposite: true
203 },
204 legend: {
205 horizontalAlign: 'left'
206 }
207 }).render();
208 });
209 </script>
210 <!-- End Area Chart -->
211
212 </div>
213 </div>
214 </div><!-- End Reports: Conversation Density Chart -->
215
216 <!-- Recent Conversations -->
217 <div class="col-lg-12 clearfix">
218 <div class="card" style="max-width: 100% !important;">
219
220 <div class="card-body">
221 <h5 class="card-title">Recent 5 Conversations</span></h5>
222
223 <?php
224
225 $results = botreports_get_last5_conversations();
226
227 $numberOfRecords = count( $results );
228
229 if ( $numberOfRecords > 0 ) :
230
231 ?>
232
233 <table class="table table table-hover">
234 <thead>
235 <tr class="first-row text-center table-primary">
236 <th scope="col">#</th>
237 <th scope="col">Date & Time</th>
238 <th scope="col">Session ID</th>
239 <th scope="col">User Interaction Count</th>
240 <th scope="col">Action</th>
241 </tr>
242 </thead>
243 <tbody>
244
245 <?php
246
247 $counter = count( $results ) === 5 ? 5 : count( $results );
248
249 foreach ( $results as $result ) {
250
251 ?>
252
253 <tr class="text-center">
254 <th scope="row">
255 <a href="<?php echo admin_url( "admin.php?page=wbcs-botsessions-page&userid=$result->user_id" ); ?>">
256 <?php echo esc_html( $counter ); ?>
257 </a>
258 </th>
259 <td><?php echo date( 'd M, Y g:i A', strtotime( $result->date ) ); ?></td>
260 <td><?php echo esc_html( $result->session_id ); ?></td>
261 <td><?php echo get_user_interaction_count( $result->conversation ); ?></td>
262 <td>
263 <a href="<?php echo admin_url( "admin.php?page=wbcs-botsessions-page&userid=$result->user_id" ); ?>" class="btn btn-primary">
264 <i class="bi bi-eyeglasses"></i> View Chat
265 </a>
266 </td>
267 </tr>
268
269 <?php
270
271 --$counter;
272
273 }
274
275 ?>
276
277
278 </tbody>
279
280 </table>
281
282 <?php else : ?>
283
284 <div class="alert alert-info">No chat records were found in the database.</div>
285
286 <?php endif; ?>
287
288 </div>
289
290 </div>
291 </div><!-- End Recent Conversations -->
292 <!-- Reports Conversations -->
293 <div class="col-lg-12 clearfix">
294 <div class="card" style="max-width: 100% !important;">
295
296 <div class="card-body">
297 <h5 class="card-title">Conversations Reports</span></h5>
298
299 <?php
300
301 $reports_count = wpbot_get_report_stats_count()['reports_only'];
302
303
304
305 if ( $reports_count > 0 ) :
306
307 ?>
308
309 <table class="table table table-hover">
310 <thead>
311 <tr class="first-row text-center table-primary">
312 <th scope="col">#</th>
313 <th scope="col">Id</th>
314 <th scope="col">Email</th>
315 <th scope="col">Message</th>
316 <th scope="col">Report Text</th>
317 <th scope="col">Date</th>
318 </tr>
319 </thead>
320 <tbody>
321
322 <?php
323 $rests = wpbot_get_reports_list();
324 $counter = count( $rests ) === 5 ? 5 : count( $rests );
325
326 foreach ( $rests as $report ) {
327 $meta = maybe_unserialize( $report['meta_info'] );
328 $email = isset($meta['email']) ? $meta['email'] : '';
329 $report_text = isset($meta['report_text']) ? $meta['report_text'] : '';
330 ?>
331
332 <tr class="text-center">
333 <th scope="row">
334 <a href="<?php echo admin_url( "admin.php?page=wbcs-botsessions-page&userid=$result->user_id" ); ?>">
335 <?php echo esc_html( $counter ); ?>
336 </a>
337 </th>
338 <td><?php echo esc_html( $report['id'] ); ?></td>
339 <td><?php echo esc_html( $email ); ?></td>
340 <td><?php echo esc_html( $report['message'] ); ?></td>
341 <td><?php echo esc_html( $report_text ); ?></td>
342 <td><?php echo esc_html( $report['created_at'] ); ?></td>
343 </tr>
344
345 <?php
346
347 --$counter;
348
349 }
350
351 ?>
352
353
354 </tbody>
355
356 </table>
357
358 <?php else : ?>
359
360 <div class="alert alert-info">No chat records were found in the database.</div>
361
362 <?php endif; ?>
363
364 </div>
365
366 </div>
367 </div><!-- End Reports Conversations -->
368
369 </div>
370
371 <a href="<?php echo admin_url( 'admin.php?page=wbcs-botsessions-page' ); ?>" class="btn btn-primary">
372 <i class="bi bi-gear-wide-connected me-1"></i> Manage All Conversations
373 </a>
374
375 <button id="wpbot-clear-feedback" class="btn btn-danger"><i class="bi bi-trash me-1"></i>Clear All Feedback</button>
376 <div id="wpbot-clear-feedback-msg"></div>
377
378 </div><!-- End Left side columns -->
379
380 </div>
381 </section>
382
383 </main><!-- End #main -->
384
385 <script src="<?php echo QCLD_wpCHATBOT_HISTORY_PLUGIN_URL . '/reports/view/assets/apexcharts.min.js'; ?>"></script>
386 <script>
387 jQuery(document).ready(function($) {
388 $(".feedback-card").on("click", function() {
389 let type = $(this).data("type");
390 $("#feedback-results").html("<p>Loading...</p>");
391
392 $.post(ajaxurl, {
393 action: "wpbot_get_feedback_ajax",
394 feedback_type: type
395 }, function(response) {
396 if (response.success) {
397 $("#feedback-results").html(response.data.html);
398 } else {
399 $("#feedback-results").html("<p>No results found.</p>");
400 }
401 });
402 });
403 });
404 jQuery(document).on("click", ".wpbot-page-link", function(e) {
405 e.preventDefault();
406
407 let page = jQuery(this).data("page");
408 let type = jQuery(this).data("type");
409
410 jQuery.post(ajaxurl, {
411 action: "wpbot_get_feedback_ajax",
412 feedback_type: type,
413 page: page
414 }, function(response) {
415 if (response.success) {
416 jQuery("#feedback-results").html(response.data.html);
417 }
418 });
419 });
420 jQuery(document).on("click", "#wpbot-clear-feedback", function (e) {
421 console.log('kardi');
422 e.preventDefault();
423
424 if (!confirm("Are you sure you want to delete all feedback?")) {
425 return;
426 }
427
428 jQuery.post(ajaxurl, {
429 action: "wpbot_clear_all_feedback"
430 }, function (response) {
431 if (response.success) {
432 jQuery("#wpbot-clear-feedback-msg").text(response.data.message).css("color", "green");
433 // Optionally reload counters
434 location.reload();
435 } else {
436 jQuery("#wpbot-clear-feedback-msg").text(response.data.message).css("color", "red");
437 }
438 });
439 });
440
441 </script>