| @@ -321,8 +321,65 @@ | ||
| 321 | 321 | </div> |
| 322 | 322 | </div> |
| 323 | 323 | </div> |
| 324 | 324 | |
| 325 | + <!-- Satisfaction (last 30 days) — plan-a5b006 --> | |
| 326 | + <div class="mxch-card mxch-satisfaction-card"> | |
| 327 | + <div class="mxch-card-header"> | |
| 328 | + <h3 class="mxch-card-title"> | |
| 329 | + <svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M7 10v12"/><path d="M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H7"/><path d="M3 10h4"/></svg> | |
| 330 | + <?php esc_html_e('Satisfaction (last 30 days)', 'mxchat'); ?> | |
| 331 | + </h3> | |
| 332 | + </div> | |
| 333 | + <div class="mxch-card-body"> | |
| 334 | + <?php | |
| 335 | + $satisfaction_stats = isset($satisfaction_stats) && is_array($satisfaction_stats) ? $satisfaction_stats : array(); | |
| 336 | + if (empty($satisfaction_stats)) : | |
| 337 | + ?> | |
| 338 | + <p class="mxch-satisfaction-empty"> | |
| 339 | + <?php esc_html_e('No ratings yet. The widget shows the prompt after a conversation has had at least two bot replies and the visitor goes idle for 60 seconds.', 'mxchat'); ?> | |
| 340 | + </p> | |
| 341 | + <?php | |
| 342 | + else : | |
| 343 | + ?> | |
| 344 | + <ul class="mxch-satisfaction-list"> | |
| 345 | + <?php foreach ($satisfaction_stats as $row) : | |
| 346 | + $bot_label = $row['bot_id'] === 'default' | |
| 347 | + ? esc_html__('Default bot', 'mxchat') | |
| 348 | + : esc_html($row['bot_id']); | |
| 349 | + ?> | |
| 350 | + <li class="mxch-satisfaction-row"> | |
| 351 | + <span class="mxch-satisfaction-bot"><?php echo $bot_label; ?></span> | |
| 352 | + <span class="mxch-satisfaction-meta"> | |
| 353 | + <span class="mxch-satisfaction-total"><?php | |
| 354 | + echo esc_html(sprintf( | |
| 355 | + /* translators: %d: number of rated sessions */ | |
| 356 | + _n('%d rated session', '%d rated sessions', $row['total'], 'mxchat'), | |
| 357 | + $row['total'] | |
| 358 | + )); | |
| 359 | + ?></span> | |
| 360 | + <span class="mxch-satisfaction-bar" aria-hidden="true"> | |
| 361 | + <span class="mxch-satisfaction-bar-up" style="width: <?php echo esc_attr($row['positive_pct']); ?>%;"></span> | |
| 362 | + <span class="mxch-satisfaction-bar-down" style="width: <?php echo esc_attr($row['negative_pct']); ?>%;"></span> | |
| 363 | + </span> | |
| 364 | + <span class="mxch-satisfaction-pct mxch-satisfaction-pct-up" title="<?php esc_attr_e('Positive ratings', 'mxchat'); ?>"> | |
| 365 | + <svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M7 10v12"/><path d="M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H7"/><path d="M3 10h4"/></svg> | |
| 366 | + <?php echo esc_html($row['positive_pct']); ?>% | |
| 367 | + </span> | |
| 368 | + <span class="mxch-satisfaction-pct mxch-satisfaction-pct-down" title="<?php esc_attr_e('Negative ratings', 'mxchat'); ?>"> | |
| 369 | + <svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M17 14V2"/><path d="M9 18.12 10 14H4.17a2 2 0 0 1-1.92-2.56l2.33-8A2 2 0 0 1 6.5 2H17"/><path d="M21 14h-4"/></svg> | |
| 370 | + <?php echo esc_html($row['negative_pct']); ?>% | |
| 371 | + </span> | |
| 372 | + </span> | |
| 373 | + </li> | |
| 374 | + <?php endforeach; ?> | |
| 375 | + </ul> | |
| 376 | + <?php | |
| 377 | + endif; | |
| 378 | + ?> | |
| 379 | + </div> | |
| 380 | + </div> | |
| 381 | + | |
| 325 | 382 | <!-- Activity Chart --> |
| 326 | 383 | <div class="mxch-card mxch-activity-chart-card"> |
| 327 | 384 | <div class="mxch-card-header"> |
| 328 | 385 | <h3 class="mxch-card-title"> |
| @@ -472,8 +529,12 @@ | ||
| 472 | 529 | </div> |
| 473 | 530 | <div class="mxch-detail-row" id="mxch-detail-email-row" style="display: none;"> |
| 474 | 531 | <span class="mxch-detail-label"><?php esc_html_e('Email', 'mxchat'); ?></span> |
| 475 | 532 | <span class="mxch-detail-value" id="mxch-detail-email">-</span> |
| 533 | + </div> | |
| 534 | + <div class="mxch-detail-row" id="mxch-detail-feedback-row" style="display: none;"> | |
| 535 | + <span class="mxch-detail-label"><?php esc_html_e('Feedback', 'mxchat'); ?></span> | |
| 536 | + <span class="mxch-detail-value mxch-detail-feedback-value" id="mxch-detail-feedback">-</span> | |
| 476 | 537 | </div> |
| 477 | 538 | </div> |
| 478 | 539 | <div class="mxch-details-section" id="mxch-clicked-section" style="display: none;"> |
| 479 | 540 | <h4><?php esc_html_e('Clicked Links', 'mxchat'); ?></h4> |