<?php

/**
 * Enable sitewide floating button related code goes in this page
 */
if ( !defined( 'ABSPATH' ) ) {
    exit;
}
$sapmfly_add_sitewide_floating_button = get_option( 'sapmfly_sitewide_floating_button', 'no' );
wp_localize_script( 'sapmfly-admin-script', 'sapmfly_floating_btn_ajax', [
    'nonce' => wp_create_nonce( 'sapmfly_floating_btn_popup_ajax' ),
] );
$sapmfly_floating_btn_text_df = 'Special Coupons';
$sapmfly_floating_btn_text = get_option( 'sapmfly_floating_btn_text' );
if ( empty( $sapmfly_floating_btn_text ) ) {
    $sapmfly_floating_btn_text = $sapmfly_floating_btn_text_df;
}
$sapmfly_floating_btn_url_df = '#';
$sapmfly_floating_btn_url = get_option( 'sapmfly_floating_btn_url' );
if ( empty( $sapmfly_floating_btn_url ) ) {
    $sapmfly_floating_btn_url = $sapmfly_floating_btn_url_df;
}
$sapmfly_floating_btn_color_df = '#fff';
$sapmfly_floating_btn_color = get_option( 'sapmfly_floating_btn_color' );
if ( empty( $sapmfly_floating_btn_color ) ) {
    $sapmfly_floating_btn_color = $sapmfly_floating_btn_color_df;
}
$sapmfly_floating_btn_bg_df = '#fc8443';
$sapmfly_floating_btn_bg = get_option( 'sapmfly_floating_btn_bg' );
if ( empty( $sapmfly_floating_btn_bg ) ) {
    $sapmfly_floating_btn_bg = $sapmfly_floating_btn_bg_df;
}
$sapmfly_floating_btn_hover_df = '#fe7c37';
$sapmfly_floating_btn_hover = get_option( 'sapmfly_floating_btn_hover' );
if ( empty( $sapmfly_floating_btn_hover ) ) {
    $sapmfly_floating_btn_hover = $sapmfly_floating_btn_hover_df;
}
$sapmfly_floating_btn_close_option = get_option( 'sapmfly_floating_btn_close_option', 'no-need' );
$sapmfly_floating_btn_open_link = get_option( 'sapmfly_floating_btn_open_link', 'same-tab' );
$sapmfly_floating_btn_style_df = 'rectangular';
$sapmfly_floating_btn_style = get_option( 'sapmfly_floating_btn_style' );
if ( empty( $sapmfly_floating_btn_style ) ) {
    $sapmfly_floating_btn_style = $sapmfly_floating_btn_style_df;
}
$sapmfly_floating_btn_position_df = 'bottom-right';
$sapmfly_floating_btn_position = get_option( 'sapmfly_floating_btn_position' );
if ( empty( $sapmfly_floating_btn_position ) ) {
    $sapmfly_floating_btn_position = $sapmfly_floating_btn_position_df;
}
?>

<div class="enable-sitewide-floating-button-wrap toggle-block-bg">

    <label class="sapmfly-switch-update">
        <div class="enable-sitewide-floating-button-header toggle-header">
            <?php 
echo esc_html__( 'Add sitewide floating button', 'minifly' );
?>
            <input type="checkbox" class="sapmfly-setting-toggle" name="sapmfly_sitewide_floating_button" <?php 
checked( $sapmfly_add_sitewide_floating_button, 'yes' );
?> />
            <span class="sapmfly-slider"></span>
        </div>
    </label>

    <div class="sapmfly-toggle-resource-body">
        <div class="sapmfly-adjust" onclick="miniflyFloatingBtnPopup(); return false;">
            <p><?php 
echo esc_html__( 'Configure button', '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-floating-btn-block" class="sapmfly-floating-btn-area">

    <div id="sapmfly-admin-notice-floating" class="sapmfly-notice" style="display:none;"></div>

    <?php 
if ( $sapmfly_add_sitewide_floating_button == 'yes' ) {
    ?>

        <!-- Section title -->
        <h3><?php 
    echo esc_html__( 'Add necessary details carefully', 'minifly' );
    ?></h3>
        <span class="sapmfly-click-popup-close-icon">&times;</span>

        <div class="sapmfly-floating-btn-group">
            <label><?php 
    echo esc_html__( 'Button text:', 'minifly' );
    ?></label>
            <input type="text" id="sapmfly_floating_btn_text" name="sapmfly_floating_btn_text" placeholder="<?php 
    echo esc_attr( $sapmfly_floating_btn_text );
    ?>" value="<?php 
    echo esc_attr( $sapmfly_floating_btn_text );
    ?>">
        </div>

        <div class="sapmfly-floating-btn-group">
            <label><?php 
    echo esc_html__( 'Button url:', 'minifly' );
    ?></label>
            <input type="text" id="sapmfly_floating_btn_url" name="sapmfly_floating_btn_url" placeholder="<?php 
    echo esc_attr( $sapmfly_floating_btn_url );
    ?>" value="<?php 
    echo esc_attr( $sapmfly_floating_btn_url );
    ?>">
        </div>

        <div class="sapmfly-floating-btn-group">
            <label><?php 
    echo esc_html__( 'Button color:', 'minifly' );
    ?></label>
            <input type="color" id="sapmfly_floating_btn_color" value="<?php 
    echo esc_attr( $sapmfly_floating_btn_color );
    ?>">
        </div>

        <div class="sapmfly-floating-btn-group">
            <label><?php 
    echo esc_html__( 'Background:', 'minifly' );
    ?></label>
            <input type="color" id="sapmfly_floating_btn_bg" value="<?php 
    echo esc_attr( $sapmfly_floating_btn_bg );
    ?>">
        </div>

        <div class="sapmfly-floating-btn-group">
            <label><?php 
    echo esc_html__( 'Hover color:', 'minifly' );
    ?></label>
            <input type="color" id="sapmfly_floating_btn_hover" value="<?php 
    echo esc_attr( $sapmfly_floating_btn_hover );
    ?>">
        </div>

        <?php 
    ?>
            <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>
                    <div class="sapmfly-floating-btn-image-group">
                        <label><?php 
    echo esc_html__( 'Button Icon:', 'minifly' );
    ?></label>
                        <input type="file" id="" accept="image/*" disabled>
                    </div>

                    <!-- Enable closable option -->
                    <div class="sapmfly-floating-btn-style-group">
                        <strong><?php 
    echo esc_html__( 'Close option:', 'minifly' );
    ?></strong><br>

                        <label>
                            <input type="radio" name="" value="" disabled>
                            <?php 
    echo esc_html__( 'Enable', 'minifly' );
    ?>
                        </label>

                        <label>
                            <input type="radio" name="" value="" disabled>
                            <?php 
    echo esc_html__( 'No need', 'minifly' );
    ?>
                        </label><br>
                    </div>

                    <!-- Open in new tab -->
                    <div class="sapmfly-floating-btn-style-group">
                        <strong><?php 
    echo esc_html__( 'Open page in:', 'minifly' );
    ?></strong><br>

                        <label>
                            <input type="radio" name="" value="" disabled>
                            <?php 
    echo esc_html__( 'Same tab', 'minifly' );
    ?>
                        </label>

                        <label>
                            <input type="radio" name="" value="" disabled>
                            <?php 
    echo esc_html__( 'New tab', 'minifly' );
    ?>
                        </label><br>
                    </div>

                </a>
            </div>
        <?php 
    ?>

        <!-- Style Radio Buttons -->
        <div class="sapmfly-floating-btn-style-group">
            <strong><?php 
    echo esc_html__( 'Button style:', 'minifly' );
    ?></strong><br>

            <label>
                <input type="radio" name="sapmfly_floating_btn_style" value="rectangular" <?php 
    checked( $sapmfly_floating_btn_style, 'rectangular' );
    ?>>
                <?php 
    echo esc_html__( 'Rectangular', 'minifly' );
    ?>
            </label>

            <label>
                <input type="radio" name="sapmfly_floating_btn_style" value="circular" <?php 
    checked( $sapmfly_floating_btn_style, 'circular' );
    ?>>
                <?php 
    echo esc_html__( 'Circular', 'minifly' );
    ?>
            </label><br>
        </div>

        <!-- Position Select -->
        <div class="sapmfly-floating-btn-selected-group">
            <label for="sapmfly_floating_btn_position">
                <strong><?php 
    echo esc_html__( 'Position:', 'minifly' );
    ?></strong>
            </label><br>

            <select id="sapmfly_floating_btn_position" name="sapmfly_floating_btn_position">
                <option value="top-left" <?php 
    selected( $sapmfly_floating_btn_position, 'top-left' );
    ?>>
                    <?php 
    echo esc_html__( 'Top Left', 'minifly' );
    ?>
                </option>

                <option value="top-right" <?php 
    selected( $sapmfly_floating_btn_position, 'top-right' );
    ?>>
                    <?php 
    echo esc_html__( 'Top Right', 'minifly' );
    ?>
                </option>

                <option value="center-left" <?php 
    selected( $sapmfly_floating_btn_position, 'center-left' );
    ?>>
                    <?php 
    echo esc_html__( 'Center Left', 'minifly' );
    ?>
                </option>

                <option value="center-right" <?php 
    selected( $sapmfly_floating_btn_position, 'center-right' );
    ?>>
                    <?php 
    echo esc_html__( 'Center Right', 'minifly' );
    ?>
                </option>

                <option value="bottom-left" <?php 
    selected( $sapmfly_floating_btn_position, 'bottom-left' );
    ?>>
                    <?php 
    echo esc_html__( 'Bottom Left', 'minifly' );
    ?>
                </option>

                <option value="bottom-right" <?php 
    selected( $sapmfly_floating_btn_position, 'bottom-right' );
    ?>>
                    <?php 
    echo esc_html__( 'Bottom Right', 'minifly' );
    ?>
                </option>
            </select>
        </div>

    <?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-click-popup-close-icon">&times;</span>

            <div class="sapmfly-floating-btn-group">
                <label><?php 
    echo esc_html__( 'Button text:', 'minifly' );
    ?></label>
                <input type="text" id="" name="" placeholder="<?php 
    echo esc_attr( $sapmfly_floating_btn_text );
    ?>" value="" disabled>
            </div>

            <div class="sapmfly-floating-btn-group">
                <label><?php 
    echo esc_html__( 'Button url:', 'minifly' );
    ?></label>
                <input type="text" id="" name="" placeholder="<?php 
    echo esc_attr( $sapmfly_floating_btn_url );
    ?>" value="" disabled>
            </div>

            <div class="sapmfly-floating-btn-group">
                <label><?php 
    echo esc_html__( 'Button color:', 'minifly' );
    ?></label>
                <input type="color" id="" value="" disabled>
            </div>

            <div class="sapmfly-floating-btn-group">
                <label><?php 
    echo esc_html__( 'Background:', 'minifly' );
    ?></label>
                <input type="color" id="" value="" disabled>
            </div>

            <div class="sapmfly-floating-btn-group">
                <label><?php 
    echo esc_html__( 'Hover color:', 'minifly' );
    ?></label>
                <input type="color" id="" value="" disabled>
            </div>

            <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>
                    <div class="sapmfly-floating-btn-image-group">
                        <label><?php 
    echo esc_html__( 'Button icon:', 'minifly' );
    ?></label>
                        <input type="file" id="sapmfly_floating_btn_icon" accept="image/*" disabled>
                    </div>
                </a>
            </div>

            <!-- Enable closable option -->
            <div class="sapmfly-floating-btn-style-group">
                <strong><?php 
    echo esc_html__( 'Close option:', 'minifly' );
    ?></strong><br>

                <label>
                    <input type="radio" name="" value="" disabled>
                    <?php 
    echo esc_html__( 'Enable', 'minifly' );
    ?>
                </label>

                <label>
                    <input type="radio" name="" value="" disabled>
                    <?php 
    echo esc_html__( 'No need', 'minifly' );
    ?>
                </label><br>
            </div>

            <!-- Open in new tab -->
            <div class="sapmfly-floating-btn-style-group">
                <strong><?php 
    echo esc_html__( 'Open page in:', 'minifly' );
    ?></strong><br>

                <label>
                    <input type="radio" name="" value="" disabled>
                    <?php 
    echo esc_html__( 'Same tab', 'minifly' );
    ?>
                </label>

                <label>
                    <input type="radio" name="" value="" disabled>
                    <?php 
    echo esc_html__( 'New tab', 'minifly' );
    ?>
                </label><br>
            </div>

            <!-- Style Radio Buttons -->
            <div class="sapmfly-floating-btn-style-group">
                <strong><?php 
    echo esc_html__( 'Button style:', 'minifly' );
    ?></strong><br>

                <label>
                    <input type="radio" name="" value="" disabled>
                    <?php 
    echo esc_html__( 'Rectangular', 'minifly' );
    ?>
                </label>

                <label>
                    <input type="radio" name="" value="" disabled>
                    <?php 
    echo esc_html__( 'Circular', 'minifly' );
    ?>
                </label><br>

            </div>

            <!-- Position Select -->
            <div class="sapmfly-floating-btn-selected-group">
                <label for="sapmfly_floating_btn_position">
                    <strong><?php 
    echo esc_html__( 'Position:', 'minifly' );
    ?></strong>
                </label><br>

                <select id="" name="" disabled>
                    <option value="top-left" <?php 
    selected( $sapmfly_floating_btn_position, 'top-left' );
    ?>>
                        <?php 
    echo esc_html__( 'Top Left', 'minifly' );
    ?>
                    </option>

                    <option value="top-right" <?php 
    selected( $sapmfly_floating_btn_position, 'top-right' );
    ?>>
                        <?php 
    echo esc_html__( 'Top Right', 'minifly' );
    ?>
                    </option>

                    <option value="center-left" <?php 
    selected( $sapmfly_floating_btn_position, 'center-left' );
    ?>>
                        <?php 
    echo esc_html__( 'Center Left', 'minifly' );
    ?>
                    </option>

                    <option value="center-right" <?php 
    selected( $sapmfly_floating_btn_position, 'center-right' );
    ?>>
                        <?php 
    echo esc_html__( 'Center Right', 'minifly' );
    ?>
                    </option>

                    <option value="bottom-left" <?php 
    selected( $sapmfly_floating_btn_position, 'bottom-left' );
    ?>>
                        <?php 
    echo esc_html__( 'Bottom Left', 'minifly' );
    ?>
                    </option>

                    <option value="bottom-right" <?php 
    selected( $sapmfly_floating_btn_position, 'bottom-right' );
    ?>>
                        <?php 
    echo esc_html__( 'Bottom Right', 'minifly' );
    ?>
                    </option>
                </select>
            </div>

        </div>
    <?php 
}
?>

    <!-- Bottom Buttons -->
    <div class="sapmfly-floating-btn-popup-actions">
        <button type="button" class="sapmfly-popup-save sapmfly-floating-btn-save"><?php 
echo esc_html__( 'Save', 'minifly' );
?></button>
        <button type="button" class="sapmfly-popup-clear sapmfly-floating-btn-clear"><?php 
echo esc_html__( 'Clear', 'minifly' );
?></button>
        <button type="button" class="sapmfly-popup-close sapmfly-floating-btn-close"><?php 
echo esc_html__( 'Close', 'minifly' );
?></button>
    </div>
</div>