<?php

/**
 * Click to talk front end related code goes here
 */
if ( !defined( 'ABSPATH' ) ) {
    exit;
}
// All the default value set and update here
$sapmfly_click_talk_popup_heading_df = 'Talk With Us';
$sapmfly_click_talk_popup_subheading_df = 'Tap a member to chat instantly';
$sapmfly_click_talk_highlight_text_df = 'The team typically replies in a few minutes';
$sapmfly_click_talk_color_bg_df = '#2eb843';
$sapmfly_click_talk_qr_image_df = SAPMFLY_ASSETS . 'img/minifly-qr-code.png';
$sapmfly_click_talk_agent_1_name_df = 'Jhon Doe PMP';
$sapmfly_click_talk_agent_1_designation_df = 'Customer Support Engineer';
$sapmfly_click_talk_agent_1_image_df = SAPMFLY_ASSETS . 'img/jhon.png';
$sapmfly_click_talk_agent_2_name_df = 'Mike Johnson';
$sapmfly_click_talk_agent_2_designation_df = 'Partner Success Manager';
$sapmfly_click_talk_agent_2_image_df = SAPMFLY_ASSETS . 'img/devid.png';
$sapmfly_click_talk_agent_3_name_df = 'David Brown Smith';
$sapmfly_click_talk_agent_3_designation_df = 'General Support Agent';
$sapmfly_click_talk_agent_3_image_df = SAPMFLY_ASSETS . 'img/mike.png';
$sapmfly_click_talk_agent_4_name_df = 'Mullar Smith';
$sapmfly_click_talk_agent_4_designation_df = 'Call Center Executive';
$sapmfly_click_talk_agent_4_image_df = SAPMFLY_ASSETS . 'img/muller.png';
$sapmfly_click_talk_popup_heading = get_option( 'sapmfly_click_talk_popup_heading' );
if ( empty( $sapmfly_click_talk_popup_heading ) ) {
    $sapmfly_click_talk_popup_heading = $sapmfly_click_talk_popup_heading_df;
}
$sapmfly_click_talk_popup_subheading = get_option( 'sapmfly_click_talk_popup_subheading' );
if ( empty( $sapmfly_click_talk_popup_subheading ) ) {
    $sapmfly_click_talk_popup_subheading = $sapmfly_click_talk_popup_subheading_df;
}
$sapmfly_click_talk_highlight_text = get_option( 'sapmfly_click_talk_highlight_text' );
if ( empty( $sapmfly_click_talk_highlight_text ) ) {
    $sapmfly_click_talk_highlight_text = $sapmfly_click_talk_highlight_text_df;
}
$sapmfly_click_talk_color_bg = get_option( 'sapmfly_click_talk_color_bg' );
if ( empty( $sapmfly_click_talk_color_bg ) ) {
    $sapmfly_click_talk_color_bg = $sapmfly_click_talk_color_bg_df;
}
$sapmfly_click_talk_qr_image = get_option( 'sapmfly_click_talk_qr_image' );
if ( empty( $sapmfly_click_talk_qr_image ) ) {
    $sapmfly_click_talk_qr_image = $sapmfly_click_talk_qr_image_df;
}
$sapmfly_click_talk_agent_1_name = get_option( 'sapmfly_click_talk_agent_1_name' );
if ( empty( $sapmfly_click_talk_agent_1_name ) ) {
    $sapmfly_click_talk_agent_1_name = $sapmfly_click_talk_agent_1_name_df;
}
$sapmfly_click_talk_agent_1_designation = get_option( 'sapmfly_click_talk_agent_1_designation' );
if ( empty( $sapmfly_click_talk_agent_1_designation ) ) {
    $sapmfly_click_talk_agent_1_designation = $sapmfly_click_talk_agent_1_designation_df;
}
$sapmfly_click_talk_agent_1_image = get_option( 'sapmfly_click_talk_agent_1_image' );
if ( empty( $sapmfly_click_talk_agent_1_image ) ) {
    $sapmfly_click_talk_agent_1_image = $sapmfly_click_talk_agent_1_image_df;
}
$sapmfly_click_talk_agent_2_name = get_option( 'sapmfly_click_talk_agent_2_name' );
if ( empty( $sapmfly_click_talk_agent_2_name ) ) {
    $sapmfly_click_talk_agent_2_name = $sapmfly_click_talk_agent_2_name_df;
}
$sapmfly_click_talk_agent_2_designation = get_option( 'sapmfly_click_talk_agent_2_designation' );
if ( empty( $sapmfly_click_talk_agent_2_designation ) ) {
    $sapmfly_click_talk_agent_2_designation = $sapmfly_click_talk_agent_2_designation_df;
}
$sapmfly_click_talk_agent_2_image = get_option( 'sapmfly_click_talk_agent_2_image' );
if ( empty( $sapmfly_click_talk_agent_2_image ) ) {
    $sapmfly_click_talk_agent_2_image = $sapmfly_click_talk_agent_2_image_df;
}
$sapmfly_click_talk_agent_3_name = get_option( 'sapmfly_click_talk_agent_3_name' );
if ( empty( $sapmfly_click_talk_agent_3_name ) ) {
    $sapmfly_click_talk_agent_3_name = $sapmfly_click_talk_agent_3_name_df;
}
$sapmfly_click_talk_agent_3_designation = get_option( 'sapmfly_click_talk_agent_3_designation' );
if ( empty( $sapmfly_click_talk_agent_3_designation ) ) {
    $sapmfly_click_talk_agent_3_designation = $sapmfly_click_talk_agent_3_designation_df;
}
$sapmfly_click_talk_agent_3_image = get_option( 'sapmfly_click_talk_agent_3_image' );
if ( empty( $sapmfly_click_talk_agent_3_image ) ) {
    $sapmfly_click_talk_agent_3_image = $sapmfly_click_talk_agent_3_image_df;
}
$sapmfly_click_talk_agent_4_name = get_option( 'sapmfly_click_talk_agent_4_name' );
if ( empty( $sapmfly_click_talk_agent_4_name ) ) {
    $sapmfly_click_talk_agent_4_name = $sapmfly_click_talk_agent_4_name_df;
}
$sapmfly_click_talk_agent_4_designation = get_option( 'sapmfly_click_talk_agent_4_designation' );
if ( empty( $sapmfly_click_talk_agent_4_designation ) ) {
    $sapmfly_click_talk_agent_4_designation = $sapmfly_click_talk_agent_4_designation_df;
}
$sapmfly_click_talk_agent_4_image = get_option( 'sapmfly_click_talk_agent_4_image' );
if ( empty( $sapmfly_click_talk_agent_4_image ) ) {
    $sapmfly_click_talk_agent_4_image = $sapmfly_click_talk_agent_4_image_df;
}
$sapmfly_click_talk_agent_1_number = get_option( 'sapmfly_click_talk_agent_1_number' );
$sapmfly_click_talk_agent_2_number = get_option( 'sapmfly_click_talk_agent_2_number' );
$sapmfly_click_talk_agent_3_number = get_option( 'sapmfly_click_talk_agent_3_number' );
$sapmfly_click_talk_agent_4_number = get_option( 'sapmfly_click_talk_agent_4_number' );
$sapmfly_click_to_talk = get_option( 'sapmfly_click_to_talk', 'no' );
$sapmfly_click_to_call = get_option( 'sapmfly_click_to_call', 'no' );
?>

<div class="sapmfly-click-talk-block">
    <div class="sapmfly-click-talk-container">

        <!-- Hidden Panel -->
        <div class="sapmfly-after-click-panel">
            <div class="sapmfly-after-click-content">
                <div class="sapmfly-after-click-header">
                    <div class="sapmfly-after-click-header-content">
                        <h3><?php 
echo esc_html( $sapmfly_click_talk_popup_heading );
?></h3>
                        <p><?php 
echo esc_html( $sapmfly_click_talk_popup_subheading );
?></p>
                    </div>
                    <?php 
?>
                </div>
                <?php 
?>
            </div>

            <?php 
if ( $sapmfly_click_to_talk == 'yes' ) {
    ?>
                <div class="sapmfly-after-click-body" data-phone="<?php 
    echo esc_attr( $sapmfly_click_talk_agent_1_number );
    ?>">
                    <img class="sapmfly-after-click-user" src="<?php 
    echo esc_url( $sapmfly_click_talk_agent_1_image );
    ?>" />
                    <div class="sapmfly-after-click-body-content">
                        <h3><?php 
    echo esc_html( $sapmfly_click_talk_agent_1_name );
    ?></h3>
                        <p><?php 
    echo esc_html( $sapmfly_click_talk_agent_1_designation );
    ?></p>
                    </div>
                    <img class="sapmfly-after-click-icon" src="<?php 
    echo esc_url( SAPMFLY_ASSETS . 'img/whatsapp-logo.png' );
    ?>" />
                </div>

                <?php 
    ?>
            <?php 
}
?>

            <?php 
if ( $sapmfly_click_to_call == 'yes' ) {
    ?>
                <div class="sapmfly-after-click-body-call" data-phone="<?php 
    echo esc_attr( $sapmfly_click_talk_agent_4_number );
    ?>">
                    <img class="sapmfly-after-click-user" src="<?php 
    echo esc_url( $sapmfly_click_talk_agent_4_image );
    ?>" />
                    <div class="sapmfly-after-click-body-content">
                        <h3><?php 
    echo esc_html( $sapmfly_click_talk_agent_4_name );
    ?></h3>
                        <p><?php 
    echo esc_html( $sapmfly_click_talk_agent_4_designation );
    ?></p>
                    </div>
                    <img class="sapmfly-after-click-icon" src="<?php 
    echo esc_url( SAPMFLY_ASSETS . 'img/call.png' );
    ?>" />
                </div>
            <?php 
}
?>
        </div>

        <!-- Toggle Button -->
        <div class="sapmfly-initial-panel">
            <p class="sapmfly-whatsapp-widget"><?php 
echo esc_html__( 'Need to talk? Click here', 'minifly' );
?></p>
            <img class="sapmfly-whatsapp-image" src="<?php 
echo esc_url( SAPMFLY_ASSETS . 'img/call-icon.png' );
?>" />
            <img class="sapmfly-close-image" src="<?php 
echo esc_url( SAPMFLY_ASSETS . 'img/whatsapp-icon-cross.png' );
?>" />
        </div>

    </div>
</div>