← All changes
|
includes/chat-sessions/reports/view/reporting-highlights.php
+38
-107
8.6.0
→
8.8.0
View file →
| @@ -1,15 +1,10 @@ | ||
| 1 | 1 | <?php if ( ! defined( 'ABSPATH' ) ) { exit; } ?> |
| 2 | -<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous"> | |
| 3 | 2 | |
| 4 | -<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/font/bootstrap-icons.css" integrity="sha384-4LISF5TTJX/fLmGSxO53rV4miRxdg84mZsxmO8Rx5jGtp/LbrixFETvWa5a6sESd" crossorigin="anonymous"> | |
| 3 | +<main id="main" class="main clearfix wpbot-reports-dashboard"> | |
| 5 | 4 | |
| 6 | -<link href="<?php echo esc_url( QCLD_wpCHATBOT_HISTORY_PLUGIN_URL . '/reports/view/assets/style.css' ); ?>" rel="stylesheet"> | |
| 7 | - | |
| 8 | -<main id="main" class="main clearfix"> | |
| 9 | - | |
| 10 | 5 | <div class="pagetitle"> |
| 11 | - <h1>Bot - Reporting Dashboard</h1> | |
| 6 | + <h1><?php echo esc_html__( 'Bot - Reporting Dashboard', 'chatbot' ); ?></h1> | |
| 12 | 7 | </div><!-- End Page Title --> |
| 13 | 8 | |
| 14 | 9 | <section class="section dashboard"> |
| 15 | 10 | <div class="row"> |
| @@ -49,9 +44,9 @@ | ||
| 49 | 44 | </div> |
| 50 | 45 | </div><!-- End Card 1 --> |
| 51 | 46 | <!-- Card 1 --> |
| 52 | 47 | <div class="col-xxl-4 col-md-6"> |
| 53 | - <div class="card info-card sales-card feedback-card" data-type="like" style="cursor:pointer;"> | |
| 48 | + <div class="card info-card sales-card feedback-card feedback-card--like" data-type="like" style="cursor:pointer;"> | |
| 54 | 49 | <div class="card-body"> |
| 55 | 50 | <h5 class="card-title">Positive Feedback</h5> |
| 56 | 51 | <div class="d-flex align-items-center"> |
| 57 | 52 | <div class="card-icon rounded-circle d-flex align-items-center justify-content-center"> |
| @@ -65,9 +60,9 @@ | ||
| 65 | 60 | </div> |
| 66 | 61 | </div> |
| 67 | 62 | |
| 68 | 63 | <div class="col-xxl-4 col-md-6"> |
| 69 | - <div class="card info-card sales-card feedback-card" data-type="dislike" style="cursor:pointer;"> | |
| 64 | + <div class="card info-card sales-card feedback-card feedback-card--dislike" data-type="dislike" style="cursor:pointer;"> | |
| 70 | 65 | <div class="card-body"> |
| 71 | 66 | <h5 class="card-title">Negative Feedback</h5> |
| 72 | 67 | <div class="d-flex align-items-center"> |
| 73 | 68 | <div class="card-icon rounded-circle d-flex align-items-center justify-content-center"> |
| @@ -79,9 +74,9 @@ | ||
| 79 | 74 | </div> |
| 80 | 75 | </div> |
| 81 | 76 | </div> |
| 82 | 77 | </div> |
| 83 | -<div id="feedback-results" style="margin-top:30px;"></div> | |
| 78 | +<div id="feedback-results" class="col-12" style="margin-top:8px;"></div> | |
| 84 | 79 | |
| 85 | 80 | |
| 86 | 81 | |
| 87 | 82 | <!-- Card 2 --> |
| @@ -128,32 +123,17 @@ | ||
| 128 | 123 | |
| 129 | 124 | </div> |
| 130 | 125 | </div><!-- End Card 3 --> |
| 131 | 126 | |
| 132 | - <?php | |
| 133 | - echo '<pre>'; | |
| 134 | - botreports_get_last30days_conversation_density(); | |
| 135 | - echo '</pre>'; | |
| 136 | - ?> | |
| 137 | - | |
| 138 | 127 | <!-- Reports: Conversation Density Chart --> |
| 139 | 128 | <div class="col-lg-12"> |
| 140 | - <div class="card" style="max-width: 100% !important;"> | |
| 129 | + <div class="card wpbot-report-panel" style="max-width: 100% !important;"> | |
| 141 | 130 | <div class="card-body"> |
| 142 | 131 | <h5 class="card-title">Conversation Density Chart</h5> |
| 143 | 132 | |
| 144 | 133 | <!-- Area Chart --> |
| 145 | - <div id="areaChart" style="min-height: 365px;"> | |
| 146 | - <div id="apexchartsa0c3a8xu" class="apexcharts-canvas apexchartsa0c3a8xu apexcharts-theme-light"> | |
| 134 | + <div id="areaChart" style="min-height: 365px;"></div> | |
| 147 | 135 | |
| 148 | - </div> | |
| 149 | - <div class="apexcharts-menu"> | |
| 150 | - <div class="apexcharts-menu-item exportSVG" title="Download SVG">Download SVG</div> | |
| 151 | - <div class="apexcharts-menu-item exportPNG" title="Download PNG">Download PNG</div> | |
| 152 | - <div class="apexcharts-menu-item exportCSV" title="Download CSV">Download CSV</div> | |
| 153 | - </div> | |
| 154 | - </div> | |
| 155 | - | |
| 156 | 136 | <?php |
| 157 | 137 | |
| 158 | 138 | $densityTable = botreports_get_last30days_conversation_density(); |
| 159 | 139 | |
| @@ -170,31 +150,36 @@ | ||
| 170 | 150 | <script> |
| 171 | 151 | document.addEventListener("DOMContentLoaded", () => { |
| 172 | 152 | const series = { |
| 173 | 153 | "monthDataSeries1": { |
| 174 | - "count": <?php echo json_encode( $conversation_count_in_date ); ?>, | |
| 175 | - "dates": <?php echo json_encode( $dates ); ?>, | |
| 154 | + "count": <?php echo wp_json_encode( $conversation_count_in_date ); ?>, | |
| 155 | + "dates": <?php echo wp_json_encode( $dates ); ?>, | |
| 176 | 156 | }, |
| 177 | 157 | } |
| 178 | 158 | new ApexCharts(document.querySelector("#areaChart"), { |
| 179 | 159 | series: [{ |
| 180 | - name: "Conversation Count: ", | |
| 160 | + name: "Conversation Count", | |
| 181 | 161 | data: series.monthDataSeries1.count |
| 182 | 162 | }], |
| 183 | 163 | chart: { |
| 184 | 164 | type: 'bar', |
| 185 | 165 | height: 350, |
| 166 | + fontFamily: '"DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif', | |
| 186 | 167 | zoom: { |
| 187 | 168 | enabled: false |
| 188 | 169 | } |
| 189 | 170 | }, |
| 171 | + colors: ['#5B4E96'], | |
| 190 | 172 | plotOptions: { |
| 191 | 173 | bar: { |
| 192 | - horizontal: false | |
| 174 | + horizontal: false, | |
| 175 | + borderRadius: 6, | |
| 176 | + columnWidth: '55%' | |
| 193 | 177 | } |
| 194 | 178 | }, |
| 195 | 179 | dataLabels: { |
| 196 | - enabled: true | |
| 180 | + enabled: true, | |
| 181 | + style: { colors: ['#5B4E96'] } | |
| 197 | 182 | }, |
| 198 | 183 | labels: series.monthDataSeries1.dates, |
| 199 | 184 | xaxis: { |
| 200 | 185 | type: 'datetime', |
| @@ -201,8 +186,12 @@ | ||
| 201 | 186 | }, |
| 202 | 187 | yaxis: { |
| 203 | 188 | opposite: true |
| 204 | 189 | }, |
| 190 | + grid: { | |
| 191 | + borderColor: '#e4e0f2', | |
| 192 | + strokeDashArray: 4 | |
| 193 | + }, | |
| 205 | 194 | legend: { |
| 206 | 195 | horizontalAlign: 'left' |
| 207 | 196 | } |
| 208 | 197 | }).render(); |
| @@ -215,12 +204,12 @@ | ||
| 215 | 204 | </div><!-- End Reports: Conversation Density Chart --> |
| 216 | 205 | |
| 217 | 206 | <!-- Recent Conversations --> |
| 218 | 207 | <div class="col-lg-12 clearfix"> |
| 219 | - <div class="card" style="max-width: 100% !important;"> | |
| 208 | + <div class="card wpbot-report-panel" style="max-width: 100% !important;"> | |
| 220 | 209 | |
| 221 | 210 | <div class="card-body"> |
| 222 | - <h5 class="card-title">Recent 5 Conversations</span></h5> | |
| 211 | + <h5 class="card-title">Recent 5 Conversations</h5> | |
| 223 | 212 | |
| 224 | 213 | <?php |
| 225 | 214 | |
| 226 | 215 | $results = botreports_get_last5_conversations(); |
| @@ -230,11 +219,11 @@ | ||
| 230 | 219 | if ( $numberOfRecords > 0 ) : |
| 231 | 220 | |
| 232 | 221 | ?> |
| 233 | 222 | |
| 234 | - <table class="table table table-hover"> | |
| 223 | + <table class="table table-hover wpbot-report-table"> | |
| 235 | 224 | <thead> |
| 236 | - <tr class="first-row text-center table-primary"> | |
| 225 | + <tr class="first-row text-center"> | |
| 237 | 226 | <th scope="col">#</th> |
| 238 | 227 | <th scope="col">Date & Time</th> |
| 239 | 228 | <th scope="col">Session ID</th> |
| 240 | 229 | <th scope="col">Interaction Count</th> |
| @@ -256,9 +245,9 @@ | ||
| 256 | 245 | <a href="<?php echo esc_url( admin_url( "admin.php?page=wbcs-botsessions-page&userid={$result->user_id}" ) ); ?>"> |
| 257 | 246 | <?php echo esc_html( $counter ); ?> |
| 258 | 247 | </a> |
| 259 | 248 | </th> |
| 260 | - <td><?php echo esc_html( date( 'd M, Y g:i A', strtotime( $result->date ) ) ); ?></td> | |
| 249 | + <td><?php echo esc_html( gmdate( 'd M, Y g:i A', strtotime( $result->date ) ) ); ?></td> | |
| 261 | 250 | <td><?php echo esc_html( $result->session_id ); ?></td> |
| 262 | 251 | <td><?php echo intval( get_user_interaction_count( $result->conversation ) ); ?></td> |
| 263 | 252 | <td> |
| 264 | 253 | <a href="<?php echo esc_url( admin_url( "admin.php?page=wbcs-botsessions-page&userid={$result->user_id}" ) ); ?>" class="btn btn-primary"> |
| @@ -291,12 +280,12 @@ | ||
| 291 | 280 | </div> |
| 292 | 281 | </div><!-- End Recent Conversations --> |
| 293 | 282 | <!-- Reports Conversations --> |
| 294 | 283 | <div class="col-lg-12 clearfix"> |
| 295 | - <div class="card" style="max-width: 100% !important;"> | |
| 284 | + <div class="card wpbot-report-panel" style="max-width: 100% !important;"> | |
| 296 | 285 | |
| 297 | 286 | <div class="card-body"> |
| 298 | - <h5 class="card-title">Conversations Reports</span></h5> | |
| 287 | + <h5 class="card-title">Conversations Reports</h5> | |
| 299 | 288 | |
| 300 | 289 | <?php |
| 301 | 290 | |
| 302 | 291 | $reports_count = wpbot_get_report_stats_count()['reports_only']; |
| @@ -306,11 +295,11 @@ | ||
| 306 | 295 | if ( $reports_count > 0 ) : |
| 307 | 296 | |
| 308 | 297 | ?> |
| 309 | 298 | |
| 310 | - <table class="table table table-hover"> | |
| 299 | + <table class="table table-hover wpbot-report-table"> | |
| 311 | 300 | <thead> |
| 312 | - <tr class="first-row text-center table-primary"> | |
| 301 | + <tr class="first-row text-center"> | |
| 313 | 302 | <th scope="col">#</th> |
| 314 | 303 | <th scope="col">Id</th> |
| 315 | 304 | <th scope="col">Email</th> |
| 316 | 305 | <th scope="col">Message</th> |
| @@ -331,11 +320,9 @@ | ||
| 331 | 320 | ?> |
| 332 | 321 | |
| 333 | 322 | <tr class="text-center"> |
| 334 | 323 | <th scope="row"> |
| 335 | - <a href="<?php echo esc_url( admin_url( "admin.php?page=wbcs-botsessions-page&userid={$result->user_id}" ) ); ?>"> | |
| 336 | 324 | <?php echo esc_html( $counter ); ?> |
| 337 | - </a> | |
| 338 | 325 | </th> |
| 339 | 326 | <td><?php echo esc_html( $report['id'] ); ?></td> |
| 340 | 327 | <td><?php echo esc_html( $email ); ?></td> |
| 341 | 328 | <td><?php echo esc_html( $report['message'] ); ?></td> |
| @@ -368,14 +355,16 @@ | ||
| 368 | 355 | </div><!-- End Reports Conversations --> |
| 369 | 356 | |
| 370 | 357 | </div> |
| 371 | 358 | |
| 372 | - <a href="<?php echo esc_url( admin_url( 'admin.php?page=wbcs-botsessions-page' ) ); ?>" class="btn btn-primary"> | |
| 373 | - <i class="bi bi-gear-wide-connected me-1"></i> Manage All Conversations | |
| 374 | - </a> | |
| 359 | + <div class="wpbot-report-actions"> | |
| 360 | + <a href="<?php echo esc_url( admin_url( 'admin.php?page=wbcs-botsessions-page' ) ); ?>" class="btn btn-primary"> | |
| 361 | + <i class="bi bi-gear-wide-connected me-1"></i> Manage All Conversations | |
| 362 | + </a> | |
| 375 | 363 | |
| 376 | - <button id="wpbot-clear-feedback" class="btn btn-danger"><i class="bi bi-trash me-1"></i>Clear All Feedback</button> | |
| 377 | - <div id="wpbot-clear-feedback-msg"></div> | |
| 364 | + <button id="wpbot-clear-feedback" class="btn btn-danger"><i class="bi bi-trash me-1"></i>Clear All Feedback</button> | |
| 365 | + <div id="wpbot-clear-feedback-msg"></div> | |
| 366 | + </div> | |
| 378 | 367 | |
| 379 | 368 | </div><!-- End Left side columns --> |
| 380 | 369 | |
| 381 | 370 | </div> |
| @@ -380,63 +369,5 @@ | ||
| 380 | 369 | |
| 381 | 370 | </div> |
| 382 | 371 | </section> |
| 383 | 372 | |
| 384 | - </main><!-- End #main --> | |
| 385 | - | |
| 386 | - <script src="<?php echo esc_url( QCLD_wpCHATBOT_HISTORY_PLUGIN_URL . '/reports/view/assets/apexcharts.min.js' ); ?>"></script> | |
| 387 | - <script> | |
| 388 | - jQuery(document).ready(function($) { | |
| 389 | - $(".feedback-card").on("click", function() { | |
| 390 | - let type = $(this).data("type"); | |
| 391 | - $("#feedback-results").html("<p>Loading...</p>"); | |
| 392 | - | |
| 393 | - $.post(ajaxurl, { | |
| 394 | - action: "wpbot_get_feedback_ajax", | |
| 395 | - feedback_type: type | |
| 396 | - }, function(response) { | |
| 397 | - if (response.success) { | |
| 398 | - $("#feedback-results").html(response.data.html); | |
| 399 | - } else { | |
| 400 | - $("#feedback-results").html("<p>No results found.</p>"); | |
| 401 | - } | |
| 402 | - }); | |
| 403 | - }); | |
| 404 | -}); | |
| 405 | -jQuery(document).on("click", ".wpbot-page-link", function(e) { | |
| 406 | - e.preventDefault(); | |
| 407 | - | |
| 408 | - let page = jQuery(this).data("page"); | |
| 409 | - let type = jQuery(this).data("type"); | |
| 410 | - | |
| 411 | - jQuery.post(ajaxurl, { | |
| 412 | - action: "wpbot_get_feedback_ajax", | |
| 413 | - feedback_type: type, | |
| 414 | - page: page | |
| 415 | - }, function(response) { | |
| 416 | - if (response.success) { | |
| 417 | - jQuery("#feedback-results").html(response.data.html); | |
| 418 | - } | |
| 419 | - }); | |
| 420 | -}); | |
| 421 | -jQuery(document).on("click", "#wpbot-clear-feedback", function (e) { | |
| 422 | - console.log('kardi'); | |
| 423 | - e.preventDefault(); | |
| 424 | - | |
| 425 | - if (!confirm("Are you sure you want to delete all feedback?")) { | |
| 426 | - return; | |
| 427 | - } | |
| 428 | - | |
| 429 | - jQuery.post(ajaxurl, { | |
| 430 | - action: "wpbot_clear_all_feedback" | |
| 431 | - }, function (response) { | |
| 432 | - if (response.success) { | |
| 433 | - jQuery("#wpbot-clear-feedback-msg").text(response.data.message).css("color", "green"); | |
| 434 | - // Optionally reload counters | |
| 435 | - location.reload(); | |
| 436 | - } else { | |
| 437 | - jQuery("#wpbot-clear-feedback-msg").text(response.data.message).css("color", "red"); | |
| 438 | - } | |
| 439 | - }); | |
| 440 | -}); | |
| 441 | - | |
| 442 | -</script> | |
| 373 | + </main><!-- End #main --> | |