<?php

/**
 * Click to call related code
 */
if ( !defined( 'ABSPATH' ) ) {
    exit;
}
$sapmfly_click_to_call = get_option( 'sapmfly_click_to_call', 'no' );
wp_localize_script( 'sapmfly-admin-script', 'sapmfly_click_call_ajax', [
    'nonce' => wp_create_nonce( 'sapmfly_click_call_popup_ajax' ),
] );
// Fetch value
$sapmfly_click_talk_heading = get_option( 'sapmfly_click_talk_popup_heading' );
$sapmfly_click_talk_subheading = get_option( 'sapmfly_click_talk_popup_subheading' );
$sapmfly_click_talk_highlight_text = get_option( 'sapmfly_click_talk_highlight_text' );
$sapmfly_click_talk_color_bg = get_option( 'sapmfly_click_talk_color_bg' );
$sapmfly_click_talk_agent_4_name = get_option( 'sapmfly_click_talk_agent_4_name' );
$sapmfly_click_talk_agent_4_designation = get_option( 'sapmfly_click_talk_agent_4_designation' );
$sapmfly_click_talk_agent_4_number = get_option( 'sapmfly_click_talk_agent_4_number' );
?>

<div class="click-call-wrap toggle-block-bg">

    <label class="sapmfly-switch-update">
        <div class="click-call-header toggle-header">
            <?php 
echo esc_html__( 'Enable click to call', 'minifly' );
?>
            <input type="checkbox" class="sapmfly-setting-toggle" name="sapmfly_click_to_call"
                <?php 
checked( $sapmfly_click_to_call, 'yes' );
?> />
            <span class="sapmfly-slider"></span>
        </div>
    </label>

    <div class="sapmfly-toggle-resource-body">
        <div class="sapmfly-adjust" onclick="miniflyClickCallPopup(); return false;">
            <p><?php 
echo esc_html__( 'Configure Number', 'minifly' );
?></p>
        </div>
        <div class="sapmfly-docs">
            <p>
                <a href="#" target="_blank">
                    <?php 
echo esc_html__( 'Docs', 'minifly' );
?>
                </a>
            </p>
        </div>
        <div class="sapmfly-tags">
            <p><?php 
echo esc_html__( 'New Feature', 'minifly' );
?></p>
        </div>
    </div>

</div>

<!-- Overlay -->
<div id="sapmfly-overlay" class="sapmfly-overlay"></div>

<!-- Click to Call Popup -->
<div id="sapmfly-click-to-call-block" class="sapmfly-click-to-call-area">

    <div class="sapmfly-click-call-popup-success" style="display: none;">
        <?php 
echo esc_html__( 'Settings saved successfully!', 'minifly' );
?>
    </div>

    <div id="sapmfly-admin-notice-call" class="sapmfly-notice" style="display:none;"></div>
    <?php 
if ( $sapmfly_click_to_call == 'yes' ) {
    ?>
        <!-- Section title -->
        <h3><?php 
    echo esc_html__( 'Add necessary details carefully', 'minifly' );
    ?></h3>
        <span class="sapmfly-popup-call-close-btn">&times;</span>

        <?php 
    ?>
            <!-- Header -->
            <div class="click-chat-header">
                <div class="click-chat-header-group">
                    <label><?php 
    echo esc_html__( 'Popup Heading:', 'minifly' );
    ?></label>
                    <input type="text" id="sapmfly_click_call_popup_heading" name="sapmfly_click_call_popup_heading" placeholder="<?php 
    echo esc_attr( $sapmfly_click_talk_heading );
    ?>" value="<?php 
    echo esc_attr( $sapmfly_click_talk_heading );
    ?>">
                </div>

                <div class="click-chat-header-group">
                    <label><?php 
    echo esc_html__( 'Popup Subtitle:', 'minifly' );
    ?></label>
                    <input type="text" id="sapmfly_click_call_popup_subheading" name="sapmfly_click_call_popup_subheading" placeholder="<?php 
    echo esc_attr( $sapmfly_click_talk_subheading );
    ?>" value="<?php 
    echo esc_attr( $sapmfly_click_talk_subheading );
    ?>">
                </div>

            </div>
            <hr />

            <div class="sapmfly-pro-available-label">
                <a href="https://brainywp.com/minifly/pricing/" target="_blank">
                    <p class="pro-label-href"><?php 
    echo esc_html__( 'Available in PRO plan', 'minifly' );
    ?></p>
                    <!-- Reply Text -->
                    <div class="click-chat-promote">
                        <div class="click-chat-image-group">
                            <label><?php 
    echo esc_html__( 'QR Code Image:', 'minifly' );
    ?></label>
                            <input type="file" id="" accept="image/*" disabled>
                        </div>
                        <div class="click-chat-agent-group">
                            <label><?php 
    echo esc_html__( 'Highlight Text:', 'minifly' );
    ?></label>
                            <input type="text" id="" name="" placeholder="" value="" disabled>
                        </div>
                        <div class="click-chat-agent-group">
                            <label><?php 
    echo esc_html__( 'Background Color:', 'minifly' );
    ?></label>
                            <input type="color" id="" value="#2eb843" disabled>
                        </div>
                    </div>
                </a>
            </div>
            <hr />
            <!-- Agent 4 -->
            <div class="click-chat-agent">
                <div class="click-chat-agent-group">
                    <label><?php 
    echo esc_html__( 'Agent Name:', 'minifly' );
    ?></label>
                    <input type="text" id="sapmfly_click_talk_agent_4_name" name="sapmfly_click_talk_agent_4_name" placeholder="<?php 
    echo esc_attr( $sapmfly_click_talk_agent_4_name );
    ?>" value="<?php 
    echo esc_attr( $sapmfly_click_talk_agent_4_name );
    ?>">
                </div>
                <div class="click-chat-agent-group">
                    <label><?php 
    echo esc_html__( 'Agent Role:', 'minifly' );
    ?></label>
                    <input type="text" id="sapmfly_click_talk_agent_4_designation" name="sapmfly_click_talk_agent_4_designation" placeholder="<?php 
    echo esc_attr( $sapmfly_click_talk_agent_4_designation );
    ?>" value="<?php 
    echo esc_attr( $sapmfly_click_talk_agent_4_designation );
    ?>">
                </div>
                <div class="click-chat-agent-group">
                    <label><?php 
    echo esc_html__( 'Agent Number:', 'minifly' );
    ?></label>
                    <input type="number" id="sapmfly_click_talk_agent_4_number" name="sapmfly_click_talk_agent_4_number" placeholder="<?php 
    echo esc_attr( $sapmfly_click_talk_agent_4_number );
    ?>" value="<?php 
    echo esc_attr( $sapmfly_click_talk_agent_4_number );
    ?>">
                </div>
                <div class="click-chat-image-group">
                    <label><?php 
    echo esc_html__( 'Agent Image:', 'minifly' );
    ?></label>
                    <input type="file" id="sapmfly_click_talk_agent_4_image" accept="image/*">
                </div>
            </div>
        <?php 
    ?>
    <?php 
} else {
    ?>

        <div class="sapmfly-toggle-blocked">
            <!-- Section title -->
            <h3><?php 
    echo esc_html__( 'Please toggle ON and save changes to add information', 'minifly' );
    ?></h3>
            <span class="sapmfly-popup-call-close-btn">&times;</span>

            <!-- Header -->
            <div class="click-chat-header">
                <div class="click-chat-header-group">
                    <label><?php 
    echo esc_html__( 'Popup Heading:', 'minifly' );
    ?></label>
                    <input type="text" id="" name="" placeholder="" value="" disabled>
                </div>

                <div class="click-chat-header-group">
                    <label><?php 
    echo esc_html__( 'Popup Subtitle:', 'minifly' );
    ?></label>
                    <input type="text" id="" name="" placeholder="" value="" disabled>
                </div>

                <div class="click-chat-image-group">
                    <label><?php 
    echo esc_html__( 'QR Code Image:', 'minifly' );
    ?></label>
                    <input type="file" id="" accept="image/*" disabled>
                </div>

            </div>
            <hr />
            <!-- Reply Text -->
            <div class="click-chat-promote">
                <div class="click-chat-agent-group">
                    <label><?php 
    echo esc_html__( 'Highlight Text:', 'minifly' );
    ?></label>
                    <input type="text" id="" name="" placeholder="" value="" disabled>
                </div>
                <div class="click-chat-agent-group">
                    <label><?php 
    echo esc_html__( 'Background Color:', 'minifly' );
    ?></label>
                    <input type="color" id="" value="#2eb843" disabled>
                </div>
            </div>
            <hr />
            <!-- Agent 4 -->
            <div class="click-chat-agent">
                <div class="click-chat-agent-group">
                    <label><?php 
    echo esc_html__( 'Agent Name:', 'minifly' );
    ?></label>
                    <input type="text" id="" name="" placeholder="" value="" disabled>
                </div>
                <div class="click-chat-agent-group">
                    <label><?php 
    echo esc_html__( 'Agent Role:', 'minifly' );
    ?></label>
                    <input type="text" id="" name="" placeholder="" value="" disabled>
                </div>
                <div class="click-chat-agent-group">
                    <label><?php 
    echo esc_html__( 'Agent Number:', 'minifly' );
    ?></label>
                    <input type="number" id="" name="" placeholder="" value="" disabled>
                </div>
                <div class="click-chat-image-group">
                    <label><?php 
    echo esc_html__( 'Agent Image:', 'minifly' );
    ?></label>
                    <input type="file" id="" accept="image/*" disabled>
                </div>
            </div>
        </div>
    <?php 
}
?>
    <br />
    <!-- Bottom Buttons -->
    <div class="sapmfly-click-call-popup-actions">
        <button type="button" class="click-call-save-btn"><?php 
echo esc_html__( 'Save', 'minifly' );
?></button>
        <button type="button" class="click-chat-clear-btn"><?php 
echo esc_html__( 'Clear', 'minifly' );
?></button>
        <button type="button" class="click-call-close-btn"><?php 
echo esc_html__( 'Close', 'minifly' );
?></button>
    </div>
</div>