← All changes
|
includes/chat-sessions/reports/view/partials/view-single-chat.php
+194
-192
8.7.3
→
8.8.1
View file →
| @@ -1,192 +1,194 @@ | ||
| 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 | -<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/font/bootstrap-icons.css" integrity="sha384-4LISF5TTJX/fLmGSxO53rV4miRxdg84mZsxmO8Rx5jGtp/LbrixFETvWa5a6sESd" crossorigin="anonymous"> | |
| 4 | - | |
| 5 | -<?php | |
| 6 | - global $wpdb; | |
| 7 | - | |
| 8 | - $userid = absint( $_GET['userid'] ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended | |
| 9 | - | |
| 10 | - $userinfo = $wpdb->get_row( $wpdb->prepare( 'SELECT * FROM %i WHERE id = %d', $tableuser, $userid ) ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching | |
| 11 | - | |
| 12 | - $delurl = wp_nonce_url( admin_url( 'admin.php?page=wbcs-botsessions-page&userid=' . $userinfo->id . '&act=delete' ), 'wpcs_delete_session_' . $userinfo->id ); | |
| 13 | - | |
| 14 | - $export = wp_nonce_url( admin_url( 'admin-post.php?action=wpbot_conversations.csv&user_id=' . $userid ), 'wpbot_conversations_csv' ); | |
| 15 | - | |
| 16 | - wp_register_style( 'qcld-wp-chatbot-history-style', QCLD_wpCHATBOT_HISTORY_PLUGIN_URL . '/css/history-style.css', '', QCLD_wpCHATBOT_VERSION, 'screen' ); | |
| 17 | - wp_enqueue_style( 'qcld-wp-chatbot-history-style' ); | |
| 18 | -?> | |
| 19 | - | |
| 20 | -<div class="wpbot-session-details-page"> | |
| 21 | - <div class="sld_menu_title qcld_session_history_result wpbot-session-meta-card"> | |
| 22 | - <div class="wpbot-session-meta-card__header"> | |
| 23 | - <h2><?php echo esc_html__( 'Session Details', 'chatbot' ); ?></h2> | |
| 24 | - <div class="wpbot-session-meta-card__actions"> | |
| 25 | - <a href="<?php echo esc_url( $delurl ); ?>" class="btn btn-danger" onclick="return confirm('Are you sure?')"> | |
| 26 | - <i class="bi bi-trash me-1"></i> <?php echo esc_html__( 'Delete', 'chatbot' ); ?> | |
| 27 | - </a> | |
| 28 | - <a href="<?php echo esc_url( $export ); ?>" class="btn btn-primary"> | |
| 29 | - <i class="bi bi-filetype-csv me-1"></i> <?php echo esc_html__( 'Export', 'chatbot' ); ?> | |
| 30 | - </a> | |
| 31 | - </div> | |
| 32 | - </div> | |
| 33 | - | |
| 34 | - <div class="wpbot-session-meta-grid"> | |
| 35 | - <div class="wpbot-session-meta-item"> | |
| 36 | - <span class="wpbot-session-meta-item__label"><?php echo esc_html__( 'Session ID', 'chatbot' ); ?></span> | |
| 37 | - <span class="wpbot-session-meta-item__value"><?php echo ( $userinfo->session_id != '' ) ? esc_html( $userinfo->session_id ) : '---'; ?></span> | |
| 38 | - </div> | |
| 39 | - <div class="wpbot-session-meta-item"> | |
| 40 | - <span class="wpbot-session-meta-item__label"><?php echo esc_html__( 'User Name', 'chatbot' ); ?></span> | |
| 41 | - <span class="wpbot-session-meta-item__value"><?php echo esc_html( $userinfo->name ? $userinfo->name : '---' ); ?></span> | |
| 42 | - </div> | |
| 43 | - <div class="wpbot-session-meta-item"> | |
| 44 | - <span class="wpbot-session-meta-item__label"><?php echo esc_html__( 'User Email', 'chatbot' ); ?></span> | |
| 45 | - <span class="wpbot-session-meta-item__value"><?php echo ( $userinfo->email != '' ) ? esc_html( $userinfo->email ) : '---'; ?></span> | |
| 46 | - </div> | |
| 47 | - <div class="wpbot-session-meta-item"> | |
| 48 | - <span class="wpbot-session-meta-item__label"><?php echo esc_html__( 'Phone Number', 'chatbot' ); ?></span> | |
| 49 | - <span class="wpbot-session-meta-item__value"><?php echo ( $userinfo->phone != '' ) ? esc_html( $userinfo->phone ) : '---'; ?></span> | |
| 50 | - </div> | |
| 51 | - <div class="wpbot-session-meta-item"> | |
| 52 | - <span class="wpbot-session-meta-item__label"><?php echo esc_html__( 'Date and Time', 'chatbot' ); ?></span> | |
| 53 | - <span class="wpbot-session-meta-item__value"><?php echo esc_html( date( 'M d, Y h:i:s A', strtotime( $userinfo->date ) ) ); ?></span> | |
| 54 | - </div> | |
| 55 | - </div> | |
| 56 | - </div> | |
| 57 | - | |
| 58 | - <?php | |
| 59 | - $result = $wpdb->get_row( $wpdb->prepare( 'SELECT * FROM %i WHERE user_id = %d', $tableconversation, $userid ) ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching | |
| 60 | - | |
| 61 | - if ( ! empty( $result ) ) : | |
| 62 | - | |
| 63 | - $qcld_wb_chatbot_theme = get_option( 'qcld_wb_chatbot_theme' ); | |
| 64 | - | |
| 65 | - if ( file_exists( QCLD_wpCHATBOT_PLUGIN_DIR_PATH . '/templates/' . $qcld_wb_chatbot_theme . '/style.css' ) ) { | |
| 66 | - wp_register_style( 'qcld-wp-chatbot-style', QCLD_wpCHATBOT_PLUGIN_URL . '/templates/' . $qcld_wb_chatbot_theme . '/style.css', '', QCLD_wpCHATBOT_VERSION, 'screen' ); | |
| 67 | - wp_enqueue_style( 'qcld-wp-chatbot-style' ); | |
| 68 | - } | |
| 69 | - | |
| 70 | - wp_enqueue_style( 'qcld-wp-chatbot-jquery-ui' ); | |
| 71 | - wp_register_style( 'qcld-wp-chatbot-jquery-ui', QCLD_wpCHATBOT_HISTORY_PLUGIN_URL . '/css/jqueryui.css', '', '', 'screen' ); | |
| 72 | - wp_register_style( 'qcld-wp-chatbot-common-style', QCLD_wpCHATBOT_PLUGIN_URL . '/css/common-style.css', '', QCLD_wpCHATBOT_VERSION, 'screen' ); | |
| 73 | - wp_enqueue_style( 'qcld-wp-chatbot-common-style' ); | |
| 74 | - ?> | |
| 75 | - | |
| 76 | - <div class="single-chat-container-wrapper wpbot-session-chat-card"> | |
| 77 | - <div class="wpbot-session-chat-card__header"> | |
| 78 | - <h3><?php echo esc_html__( 'Chat Messages', 'chatbot' ); ?></h3> | |
| 79 | - <a href="<?php echo esc_url( admin_url( 'admin.php?page=wbcs-botsessions-page' ) ); ?>" class="btn btn-primary wpbot-session-back-btn"> | |
| 80 | - <i class="bi bi-arrow-left me-1"></i> <?php echo esc_html__( 'Conversation List', 'chatbot' ); ?> | |
| 81 | - </a> | |
| 82 | - </div> | |
| 83 | - <div class="wp-chatbot-messages-wrapper"> | |
| 84 | - <?php | |
| 85 | - $allowed_html = array_merge( | |
| 86 | - wp_kses_allowed_html( 'post' ), | |
| 87 | - array( | |
| 88 | - 'div' => array( | |
| 89 | - 'class' => true, | |
| 90 | - 'id' => true, | |
| 91 | - 'style' => true, | |
| 92 | - 'data-*' => true, | |
| 93 | - ), | |
| 94 | - 'span' => array( | |
| 95 | - 'class' => true, | |
| 96 | - 'id' => true, | |
| 97 | - 'style' => true, | |
| 98 | - 'data-*' => true, | |
| 99 | - ), | |
| 100 | - 'ul' => array( 'class' => true ), | |
| 101 | - 'li' => array( 'class' => true ), | |
| 102 | - 'img' => array( | |
| 103 | - 'src' => true, | |
| 104 | - 'alt' => true, | |
| 105 | - 'class' => true, | |
| 106 | - 'style' => true, | |
| 107 | - ), | |
| 108 | - ) | |
| 109 | - ); | |
| 110 | - echo wp_kses( htmlspecialchars_decode( $result->conversation ), $allowed_html ); | |
| 111 | - ?> | |
| 112 | - </div> | |
| 113 | - </div> | |
| 114 | - | |
| 115 | - <button type="button" class="wpbot-reply-fab" id="wpbot_reply_fab" aria-expanded="false" aria-controls="wpbot_reply_panel"> | |
| 116 | - <i class="bi bi-envelope" aria-hidden="true"></i> | |
| 117 | - <span><?php echo esc_html__( 'Reply via Email', 'chatbot' ); ?></span> | |
| 118 | - </button> | |
| 119 | - | |
| 120 | - <div class="wpbot-reply-panel" id="wpbot_reply_panel" hidden> | |
| 121 | - <div class="wpbot-reply-panel__header"> | |
| 122 | - <h4><?php echo esc_html__( 'Reply via Email', 'chatbot' ); ?></h4> | |
| 123 | - <button type="button" class="wpbot-reply-panel__close" id="wpbot_reply_panel_close" aria-label="<?php esc_attr_e( 'Close', 'chatbot' ); ?>">×</button> | |
| 124 | - </div> | |
| 125 | - <div class="wpbot-reply-panel__body"> | |
| 126 | - <?php if ( ! empty( $userinfo->email ) ) : ?> | |
| 127 | - <div class="email-reply-container"> | |
| 128 | - <p class="wpbot-reply-panel__to"><?php echo esc_html__( 'To:', 'chatbot' ); ?> <strong><?php echo esc_html( $userinfo->email ); ?></strong></p> | |
| 129 | - <div class="form-group mb-3"> | |
| 130 | - <label for="reply_subject" class="form-label"><?php echo esc_html__( 'Subject', 'chatbot' ); ?></label> | |
| 131 | - <input type="text" id="reply_subject" class="form-control" placeholder="<?php esc_attr_e( 'Reply to your chat session', 'chatbot' ); ?>"> | |
| 132 | - </div> | |
| 133 | - <div class="form-group mb-3"> | |
| 134 | - <label for="reply_message" class="form-label"><?php echo esc_html__( 'Message', 'chatbot' ); ?></label> | |
| 135 | - <textarea id="reply_message" class="form-control" rows="4" placeholder="<?php esc_attr_e( 'Type your reply here...', 'chatbot' ); ?>"></textarea> | |
| 136 | - </div> | |
| 137 | - <button type="button" class="btn btn-primary" id="btn_send_reply_email" data-email="<?php echo esc_attr( $userinfo->email ); ?>"><?php echo esc_html__( 'Send Reply', 'chatbot' ); ?></button> | |
| 138 | - </div> | |
| 139 | - <?php else : ?> | |
| 140 | - <p class="wpbot-reply-panel__warning"><?php echo esc_html__( 'No user email available for this session.', 'chatbot' ); ?></p> | |
| 141 | - <?php endif; ?> | |
| 142 | - <div class="forward-session-wrapper"> | |
| 143 | - <input type="hidden" id="details_session_id" value="<?php echo esc_attr( $userinfo->session_id ); ?>"> | |
| 144 | - <input type="email" id="details_session_email" class="form-control" placeholder="<?php esc_attr_e( 'Enter email to forward session details', 'chatbot' ); ?>"> | |
| 145 | - <span class="btn btn-secondary forward_session"><?php echo esc_html__( 'Forward Session', 'chatbot' ); ?></span> | |
| 146 | - </div> | |
| 147 | - </div> | |
| 148 | - </div> | |
| 149 | - | |
| 150 | - <script> | |
| 151 | - (function () { | |
| 152 | - var fab = document.getElementById('wpbot_reply_fab'); | |
| 153 | - var panel = document.getElementById('wpbot_reply_panel'); | |
| 154 | - var closeBtn = document.getElementById('wpbot_reply_panel_close'); | |
| 155 | - if (!fab || !panel) { | |
| 156 | - return; | |
| 157 | - } | |
| 158 | - function openPanel() { | |
| 159 | - panel.hidden = false; | |
| 160 | - panel.classList.add('is-open'); | |
| 161 | - fab.setAttribute('aria-expanded', 'true'); | |
| 162 | - fab.classList.add('is-active'); | |
| 163 | - } | |
| 164 | - function closePanel() { | |
| 165 | - panel.classList.remove('is-open'); | |
| 166 | - fab.setAttribute('aria-expanded', 'false'); | |
| 167 | - fab.classList.remove('is-active'); | |
| 168 | - window.setTimeout(function () { | |
| 169 | - if (!panel.classList.contains('is-open')) { | |
| 170 | - panel.hidden = true; | |
| 171 | - } | |
| 172 | - }, 220); | |
| 173 | - } | |
| 174 | - fab.addEventListener('click', function () { | |
| 175 | - if (panel.classList.contains('is-open')) { | |
| 176 | - closePanel(); | |
| 177 | - } else { | |
| 178 | - openPanel(); | |
| 179 | - } | |
| 180 | - }); | |
| 181 | - if (closeBtn) { | |
| 182 | - closeBtn.addEventListener('click', closePanel); | |
| 183 | - } | |
| 184 | - document.addEventListener('keydown', function (e) { | |
| 185 | - if (e.key === 'Escape' && panel.classList.contains('is-open')) { | |
| 186 | - closePanel(); | |
| 187 | - } | |
| 188 | - }); | |
| 189 | - })(); | |
| 190 | - </script> | |
| 191 | - <?php endif; ?> | |
| 192 | -</div> | |
| 1 | +<?php if ( ! defined( 'ABSPATH' ) ) { exit; } ?> | |
| 2 | + | |
| 3 | +<?php | |
| 4 | + global $wpdb; | |
| 5 | + | |
| 6 | + $tableuser = $wpdb->prefix . 'wpbot_user'; | |
| 7 | + $tableconversation = $wpdb->prefix . 'wpbot_conversation'; | |
| 8 | + $table_user_sql = '`' . esc_sql( $tableuser ) . '`'; | |
| 9 | + $table_conv_sql = '`' . esc_sql( $tableconversation ) . '`'; | |
| 10 | + $userid = isset( $_GET['userid'] ) ? absint( wp_unslash( $_GET['userid'] ) ) : 0; // phpcs:ignore WordPress.Security.NonceVerification.Recommended | |
| 11 | + | |
| 12 | + $userinfo = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$table_user_sql} WHERE id = %d", $userid ) ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter | |
| 13 | + | |
| 14 | + $delurl = wp_nonce_url( admin_url( 'admin.php?page=wbcs-botsessions-page&userid=' . $userinfo->id . '&act=delete' ), 'wpcs_delete_session_' . $userinfo->id ); | |
| 15 | + | |
| 16 | + $export = wp_nonce_url( admin_url( 'admin-post.php?action=wpbot_conversations.csv&user_id=' . $userid ), 'wpbot_conversations_csv' ); | |
| 17 | + | |
| 18 | + wp_register_style( 'qcld-wp-chatbot-history-style', QCLD_wpCHATBOT_HISTORY_PLUGIN_URL . '/css/history-style.css', '', QCLD_wpCHATBOT_VERSION, 'screen' ); | |
| 19 | + wp_enqueue_style( 'qcld-wp-chatbot-history-style' ); | |
| 20 | +?> | |
| 21 | + | |
| 22 | +<div class="wpbot-session-details-page"> | |
| 23 | + <div class="sld_menu_title qcld_session_history_result wpbot-session-meta-card"> | |
| 24 | + <div class="wpbot-session-meta-card__header"> | |
| 25 | + <h2><?php echo esc_html__( 'Session Details', 'chatbot' ); ?></h2> | |
| 26 | + <div class="wpbot-session-meta-card__actions"> | |
| 27 | + <a href="<?php echo esc_url( $delurl ); ?>" class="btn btn-danger" onclick="return confirm('Are you sure?')"> | |
| 28 | + <?php echo esc_html__( 'Delete', 'chatbot' ); ?> | |
| 29 | + </a> | |
| 30 | + <a href="<?php echo esc_url( $export ); ?>" class="btn btn-primary"> | |
| 31 | + <?php echo esc_html__( 'Export', 'chatbot' ); ?> | |
| 32 | + </a> | |
| 33 | + </div> | |
| 34 | + </div> | |
| 35 | + | |
| 36 | + <div class="wpbot-session-meta-grid"> | |
| 37 | + <div class="wpbot-session-meta-item"> | |
| 38 | + <span class="wpbot-session-meta-item__label"><?php echo esc_html__( 'Session ID', 'chatbot' ); ?></span> | |
| 39 | + <span class="wpbot-session-meta-item__value"><?php echo ( $userinfo->session_id != '' ) ? esc_html( $userinfo->session_id ) : '---'; ?></span> | |
| 40 | + </div> | |
| 41 | + <div class="wpbot-session-meta-item"> | |
| 42 | + <span class="wpbot-session-meta-item__label"><?php echo esc_html__( 'User Name', 'chatbot' ); ?></span> | |
| 43 | + <span class="wpbot-session-meta-item__value"><?php echo esc_html( $userinfo->name ? $userinfo->name : '---' ); ?></span> | |
| 44 | + </div> | |
| 45 | + <div class="wpbot-session-meta-item"> | |
| 46 | + <span class="wpbot-session-meta-item__label"><?php echo esc_html__( 'User Email', 'chatbot' ); ?></span> | |
| 47 | + <span class="wpbot-session-meta-item__value"><?php echo ( $userinfo->email != '' ) ? esc_html( $userinfo->email ) : '---'; ?></span> | |
| 48 | + </div> | |
| 49 | + <div class="wpbot-session-meta-item"> | |
| 50 | + <span class="wpbot-session-meta-item__label"><?php echo esc_html__( 'Phone Number', 'chatbot' ); ?></span> | |
| 51 | + <span class="wpbot-session-meta-item__value"><?php echo ( $userinfo->phone != '' ) ? esc_html( $userinfo->phone ) : '---'; ?></span> | |
| 52 | + </div> | |
| 53 | + <div class="wpbot-session-meta-item"> | |
| 54 | + <span class="wpbot-session-meta-item__label"><?php echo esc_html__( 'Date and Time', 'chatbot' ); ?></span> | |
| 55 | + <span class="wpbot-session-meta-item__value"><?php echo esc_html( gmdate( 'M d, Y h:i:s A', strtotime( $userinfo->date ) ) ); ?></span> | |
| 56 | + </div> | |
| 57 | + </div> | |
| 58 | + </div> | |
| 59 | + | |
| 60 | + <?php | |
| 61 | + $result = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$table_conv_sql} WHERE user_id = %d", $userid ) ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared | |
| 62 | + | |
| 63 | + if ( ! empty( $result ) ) : | |
| 64 | + | |
| 65 | + $qcld_wb_chatbot_theme = get_option( 'qcld_wb_chatbot_theme' ); | |
| 66 | + | |
| 67 | + if ( file_exists( QCLD_wpCHATBOT_PLUGIN_DIR_PATH . '/templates/' . $qcld_wb_chatbot_theme . '/style.css' ) ) { | |
| 68 | + wp_register_style( 'qcld-wp-chatbot-style', QCLD_wpCHATBOT_PLUGIN_URL . '/templates/' . $qcld_wb_chatbot_theme . '/style.css', '', QCLD_wpCHATBOT_VERSION, 'screen' ); | |
| 69 | + wp_enqueue_style( 'qcld-wp-chatbot-style' ); | |
| 70 | + } | |
| 71 | + | |
| 72 | + wp_enqueue_style( 'qcld-wp-chatbot-jquery-ui' ); | |
| 73 | + wp_register_style( 'qcld-wp-chatbot-jquery-ui', QCLD_wpCHATBOT_HISTORY_PLUGIN_URL . '/css/jqueryui.css', '', '', 'screen' ); | |
| 74 | + wp_register_style( 'qcld-wp-chatbot-common-style', QCLD_wpCHATBOT_PLUGIN_URL . '/css/common-style.css', '', QCLD_wpCHATBOT_VERSION, 'screen' ); | |
| 75 | + wp_enqueue_style( 'qcld-wp-chatbot-common-style' ); | |
| 76 | + ?> | |
| 77 | + | |
| 78 | + <div class="single-chat-container-wrapper wpbot-session-chat-card"> | |
| 79 | + <div class="wpbot-session-chat-card__header"> | |
| 80 | + <h3><?php echo esc_html__( 'Chat Messages', 'chatbot' ); ?></h3> | |
| 81 | + <a href="<?php echo esc_url( admin_url( 'admin.php?page=wbcs-botsessions-page' ) ); ?>" class="btn btn-primary wpbot-session-back-btn"> | |
| 82 | + <?php echo esc_html__( 'Conversation List', 'chatbot' ); ?> | |
| 83 | + </a> | |
| 84 | + </div> | |
| 85 | + <div class="wp-chatbot-messages-wrapper"> | |
| 86 | + <?php | |
| 87 | + $allowed_html = array_merge( | |
| 88 | + wp_kses_allowed_html( 'post' ), | |
| 89 | + array( | |
| 90 | + 'div' => array( | |
| 91 | + 'class' => true, | |
| 92 | + 'id' => true, | |
| 93 | + 'style' => true, | |
| 94 | + 'data-*' => true, | |
| 95 | + ), | |
| 96 | + 'span' => array( | |
| 97 | + 'class' => true, | |
| 98 | + 'id' => true, | |
| 99 | + 'style' => true, | |
| 100 | + 'data-*' => true, | |
| 101 | + ), | |
| 102 | + 'ul' => array( 'class' => true ), | |
| 103 | + 'li' => array( 'class' => true ), | |
| 104 | + 'img' => array( | |
| 105 | + 'src' => true, | |
| 106 | + 'alt' => true, | |
| 107 | + 'class' => true, | |
| 108 | + 'style' => true, | |
| 109 | + ), | |
| 110 | + ) | |
| 111 | + ); | |
| 112 | + echo wp_kses( htmlspecialchars_decode( $result->conversation ), $allowed_html ); | |
| 113 | + ?> | |
| 114 | + </div> | |
| 115 | + </div> | |
| 116 | + | |
| 117 | + <button type="button" class="wpbot-reply-fab" id="wpbot_reply_fab" aria-expanded="false" aria-controls="wpbot_reply_panel"> | |
| 118 | + | |
| 119 | + <span><?php echo esc_html__( 'Reply via Email', 'chatbot' ); ?></span> | |
| 120 | + </button> | |
| 121 | + | |
| 122 | + <div class="wpbot-reply-panel" id="wpbot_reply_panel" hidden> | |
| 123 | + <div class="wpbot-reply-panel__header"> | |
| 124 | + <h4><?php echo esc_html__( 'Reply via Email', 'chatbot' ); ?></h4> | |
| 125 | + <button type="button" class="wpbot-reply-panel__close" id="wpbot_reply_panel_close" aria-label="<?php esc_attr_e( 'Close', 'chatbot' ); ?>">×</button> | |
| 126 | + </div> | |
| 127 | + <div class="wpbot-reply-panel__body"> | |
| 128 | + <?php if ( ! empty( $userinfo->email ) ) : ?> | |
| 129 | + <div class="email-reply-container"> | |
| 130 | + <p class="wpbot-reply-panel__to"><?php echo esc_html__( 'To:', 'chatbot' ); ?> <strong><?php echo esc_html( $userinfo->email ); ?></strong></p> | |
| 131 | + <div class="form-group mb-3"> | |
| 132 | + <label for="reply_subject" class="form-label"><?php echo esc_html__( 'Subject', 'chatbot' ); ?></label> | |
| 133 | + <input type="text" id="reply_subject" class="form-control" placeholder="<?php esc_attr_e( 'Reply to your chat session', 'chatbot' ); ?>"> | |
| 134 | + </div> | |
| 135 | + <div class="form-group mb-3"> | |
| 136 | + <label for="reply_message" class="form-label"><?php echo esc_html__( 'Message', 'chatbot' ); ?></label> | |
| 137 | + <textarea id="reply_message" class="form-control" rows="4" placeholder="<?php esc_attr_e( 'Type your reply here...', 'chatbot' ); ?>"></textarea> | |
| 138 | + </div> | |
| 139 | + <button type="button" class="btn btn-primary" id="btn_send_reply_email" data-email="<?php echo esc_attr( $userinfo->email ); ?>"><?php echo esc_html__( 'Send Reply', 'chatbot' ); ?></button> | |
| 140 | + </div> | |
| 141 | + <?php else : ?> | |
| 142 | + <p class="wpbot-reply-panel__warning"><?php echo esc_html__( 'No user email available for this session.', 'chatbot' ); ?></p> | |
| 143 | + <?php endif; ?> | |
| 144 | + <div class="forward-session-wrapper"> | |
| 145 | + <input type="hidden" id="details_session_id" value="<?php echo esc_attr( $userinfo->session_id ); ?>"> | |
| 146 | + <input type="email" id="details_session_email" class="form-control" placeholder="<?php esc_attr_e( 'Enter email to forward session details', 'chatbot' ); ?>"> | |
| 147 | + <span class="btn btn-secondary forward_session"><?php echo esc_html__( 'Forward Session', 'chatbot' ); ?></span> | |
| 148 | + </div> | |
| 149 | + </div> | |
| 150 | + </div> | |
| 151 | + | |
| 152 | + <script> | |
| 153 | + (function () { | |
| 154 | + var fab = document.getElementById('wpbot_reply_fab'); | |
| 155 | + var panel = document.getElementById('wpbot_reply_panel'); | |
| 156 | + var closeBtn = document.getElementById('wpbot_reply_panel_close'); | |
| 157 | + if (!fab || !panel) { | |
| 158 | + return; | |
| 159 | + } | |
| 160 | + function openPanel() { | |
| 161 | + panel.hidden = false; | |
| 162 | + panel.classList.add('is-open'); | |
| 163 | + fab.setAttribute('aria-expanded', 'true'); | |
| 164 | + fab.classList.add('is-active'); | |
| 165 | + } | |
| 166 | + function closePanel() { | |
| 167 | + panel.classList.remove('is-open'); | |
| 168 | + fab.setAttribute('aria-expanded', 'false'); | |
| 169 | + fab.classList.remove('is-active'); | |
| 170 | + window.setTimeout(function () { | |
| 171 | + if (!panel.classList.contains('is-open')) { | |
| 172 | + panel.hidden = true; | |
| 173 | + } | |
| 174 | + }, 220); | |
| 175 | + } | |
| 176 | + fab.addEventListener('click', function () { | |
| 177 | + if (panel.classList.contains('is-open')) { | |
| 178 | + closePanel(); | |
| 179 | + } else { | |
| 180 | + openPanel(); | |
| 181 | + } | |
| 182 | + }); | |
| 183 | + if (closeBtn) { | |
| 184 | + closeBtn.addEventListener('click', closePanel); | |
| 185 | + } | |
| 186 | + document.addEventListener('keydown', function (e) { | |
| 187 | + if (e.key === 'Escape' && panel.classList.contains('is-open')) { | |
| 188 | + closePanel(); | |
| 189 | + } | |
| 190 | + }); | |
| 191 | + })(); | |
| 192 | + </script> | |
| 193 | + <?php endif; ?> | |
| 194 | +</div> | |