<?php
defined('ABSPATH') or die('No script kiddies please!!');
$url_open_tab = (!empty($ciws_main_settings['url']['open_in_new_tab'])) ? 1 : 0;
$url_for_desktop = (!empty($ciws_main_settings['url']['url_for_desktop'])) ? $ciws_main_settings['url']['url_for_desktop'] : 'web';
$url_for_mobile = (!empty($ciws_main_settings['url']['url_for_mobile'])) ? $ciws_main_settings['url']['url_for_mobile'] : 'api';
?>
<div class="ciws-settings-section" data-settings-ref="url">
    <div class="ciws-field-wrap">
        <label>
            <?php esc_html_e('Open in Another tab', 'chat-in-website'); ?>
        </label>
        <div class="ciws-field ciws-checkbox-toggle">
            <input type="checkbox" class="ciws-customize-status" name="ciws_main_settings[url][open_in_new_tab]"
                value="1" <?php checked($url_open_tab, '1'); ?> />
            <label></label>
        </div>
    </div>
    <div class="ciws-field-wrap">
        <label>
            <?php esc_html_e('URL for Desktop', 'chat-in-website'); ?>
        </label>
        <div class="ciws-field ciws-checkbox-toggle">
            <input name="ciws_main_settings[url][url_for_desktop]" id="url_for_desktop" type="hidden"
                value="<?php echo esc_attr($url_for_desktop); ?>" required="required" />
            <button
                class="button ciws-btn-web <?php echo esc_attr(($url_for_desktop == 'api') ? 'ciws-url-active' : ''); ?>"
                value="api" type="button">
                <?php esc_html_e('API', 'chat-in-website'); ?>
            </button>
            <button
                class="button ciws-btn-web <?php echo esc_attr(($url_for_desktop == 'web') ? 'ciws-url-active' : ''); ?>"
                value="web" type="button">
                <?php esc_html_e('Web', 'chat-in-website'); ?>
            </button>
        </div>
    </div>

    <div class="ciws-field-wrap">
        <label>
            <?php esc_html_e('URL for Mobile', 'chat-in-website'); ?>
        </label>
        <div class="ciws-field ciws-checkbox-toggle">
            <input name="ciws_main_settings[url][url_for_mobile]" id="url_for_mobile" type="hidden"
                value="<?php echo esc_attr($url_for_mobile); ?>" required="required" />
            <button
                class="button ciws-btn-mob <?php echo esc_attr(($url_for_mobile == 'api') ? 'ciws-url-active' : ''); ?>"
                value="api" type="button">
                <?php esc_html_e('API', 'chat-in-website'); ?>
            </button>
            <button
                class="button ciws-btn-mob <?php echo esc_attr(($url_for_mobile == 'protocol') ? 'ciws-url-active' : ''); ?>"
                value="protocol" type="button">
                <?php esc_html_e('Protocol', 'chat-in-website'); ?>
            </button>
        </div>
    </div>

</div>