<?php
defined('ABSPATH') || exit('No Access!');

$all_roles = irk_editable_roles();
$roles = $options->get_option('remove-adminbar');
$favicon_image = $options->get_option('favicon-image');
$logo_image = $options->get_option('logo-image');
$mobile_logo_image = $options->get_option('mobile-logo-image');
$src_post_type = $options->get_option('src-post-type');
$pre_loader_style = $options->get_option('pre-loader-style');
?>
<div class="irk-settings-area irk-settings-general irk-active">
    <h2 class="irk-settings-title">
        <span class="irk-title-icon"><span uk-icon="settings"></span></span>
        <strong><?php _e('General', 'irk'); ?></strong>
    </h2>
    <div class="uk-margin">
        <?php if (!get_option('irk-hide-tuts-alert')): ?>
            <div class="irk-custom-alert irk-custom-alert-success">
                <h4><?php _e('Video tutorials', 'irk'); ?></h4>
                <p><?php _e('This product has an installation and configuration instructional video.', 'irk'); ?></p>
                <p><?php _e('The tutorials video can be downloaded from the user panel > downloads.', 'irk'); ?></p>
                <button class="uk-button uk-button-default irk-hide-tuts-alert"><?php _e('Do not show this message', 'irk'); ?></button>
                <span class="irk-custom-alert-icon" uk-icon="icon: cog; ratio: 9"></span>
            </div>
        <?php endif; ?>
    </div>
    <div class="uk-margin">
        <label class="uk-form-label"><?php _e('Remove admin bar', 'irk'); ?></label>
        <?php foreach ($all_roles as $role => $details): ?>
            <div class="uk-margin-small">
                <label>
                    <input class="uk-checkbox" type="checkbox" name="remove-adminbar[]" value="<?php echo $role; ?>" <?php echo is_array($roles) && in_array($role, $roles) ? 'checked' : null; ?>>
                    <?php echo translate_user_role($details['name']); ?>
                </label>
            </div>
        <?php endforeach; ?>
        <div class="irk-description">
            <span uk-icon="info"></span>
            <?php _e('Select the user roles to hide admin bar.', 'irk'); ?>
        </div>
    </div>
    <div class="uk-margin">
        <label class="uk-form-label" for="admin-email"><?php _e('Admin email', 'irk'); ?></label>
        <input type="text" class="uk-input" name="admin-email" id="admin-email" value="<?php echo esc_attr($options->get_option('admin-email')); ?>">
    </div>
    <div class="uk-margin">
        <label class="uk-form-label" for="src-shortcode"><?php _e('Search shortcode', 'irk'); ?></label>
        <input type="text" class="uk-input" name="src-shortcode" id="src-shortcode" value="<?php echo esc_attr($options->get_option('src-shortcode')); ?>">
    </div>
    <div class="uk-margin">
        <label class="uk-form-label"><?php _e('Favicon image', 'irk'); ?></label>
        <div class="irk-upload-file-wrapper">
            <img src="<?php echo intval($favicon_image) ? wp_get_attachment_url( $favicon_image ) : IRK_IMG_URI.'dot.png'; ?>" class="irk-image" alt="image">
            <input type="hidden" name="favicon-image" value="<?php echo esc_attr( $favicon_image ); ?>">
            <br>
            <button class="uk-button uk-button-primary irk-upload-file"><?php _e('Select image', 'irk'); ?></button>
        </div>
    </div>
    <div class="uk-margin">
        <label class="uk-form-label"><?php _e('Logo image', 'irk'); ?></label>
        <div class="irk-upload-file-wrapper">
            <img src="<?php echo intval($logo_image) ? wp_get_attachment_url( $logo_image ) : IRK_IMG_URI.'irankala.png'; ?>" class="irk-image" alt="image">
            <input type="hidden" name="logo-image" value="<?php echo esc_attr( $logo_image ); ?>">
            <br>
            <button class="uk-button uk-button-primary irk-upload-file"><?php _e('Select image', 'irk'); ?></button>
            <button class="uk-button uk-button-default irk-remove" data-default="<?php echo IRK_IMG_URI.'irankala.png'; ?>"><?php _e('Remove image', 'irk'); ?></button>
        </div>
    </div>
    <div class="uk-margin">
        <label class="uk-form-label"><?php _e('Logo image (mobile)', 'irk'); ?></label>
        <div class="irk-upload-file-wrapper">
            <img src="<?php echo intval($mobile_logo_image) ? wp_get_attachment_url( $mobile_logo_image ) : IRK_IMG_URI.'dot.png'; ?>" class="irk-image" alt="image">
            <input type="hidden" name="mobile-logo-image" value="<?php echo esc_attr( $mobile_logo_image ); ?>">
            <br>
            <button class="uk-button uk-button-primary irk-upload-file"><?php _e('Select image', 'irk'); ?></button>
            <button class="uk-button uk-button-default irk-remove" data-default="<?php echo IRK_IMG_URI.'dot.png'; ?>"><?php _e('Remove image', 'irk'); ?></button>
        </div>
    </div>
    <div class="uk-margin">
        <label class="uk-form-label"><?php _e('Search', 'irk'); ?></label>
        <div class="uk-margin-small">
            <label>
                <input class="uk-checkbox" type="checkbox" name="search-by-title" value="1" <?php echo checked($options->get_option('search-by-title'), 1); ?>>
                <?php _e('Search by title', 'irk'); ?>
            </label>
        </div>
        <div class="uk-margin-small">
            <label>
                <input class="uk-checkbox" type="checkbox" name="product-cat-in-search" value="1" <?php echo checked($options->get_option('product-cat-in-search'), 1); ?>>
                <?php _e('Product category in search form', 'irk'); ?>
            </label>
        </div>
        <div class="uk-margin-small">
            <label>
                <input class="uk-checkbox" type="checkbox" name="hide-out-of-stock-in-search" value="1" <?php echo checked($options->get_option('hide-out-of-stock-in-search'), 1); ?>>
                <?php _e('Hide out of stock items from the ajax search results.', 'irk'); ?>
            </label>
        </div>
        <div class="uk-margin-small">
            <label>
                <input class="uk-checkbox" type="checkbox" name="sku-search" value="1" <?php echo checked($options->get_option('sku-search'), 1); ?>>
                <?php _e('Search by SKU', 'irk'); ?>
            </label>
        </div>
        <div class="uk-margin-small">
            <label class="uk-form-label"><?php _e('Post type', 'irk'); ?></label>
            <div uk-form-custom="target: > * > span:first-child">
                <select name="src-post-type">
                    <option value="product" <?php selected($src_post_type, 'product'); ?>><?php _e('Product', 'irk'); ?></option>
                    <option value="post" <?php selected($src_post_type, 'post'); ?>><?php _e('Post', 'irk'); ?></option>
                    <option value="news" <?php selected($src_post_type, 'news'); ?>><?php _e('News', 'irk'); ?></option>
                    <option value="blog" <?php selected($src_post_type, 'blog'); ?>><?php _e('Blog', 'irk'); ?></option>
                </select>
                <button class="uk-button uk-button-default" type="button" tabindex="-1">
                    <span></span>
                    <span uk-icon="icon: chevron-down"></span>
                </button>
            </div>
        </div>
    </div>
    <div class="uk-margin">
        <label class="uk-form-label"><?php _e('Brand', 'irk'); ?></label>
        <div class="uk-margin-small">
            <label>
                <input class="uk-checkbox" type="checkbox" name="active-brand" value="1" <?php echo checked($options->get_option('active-brand'), 1); ?>>
                <?php _e('Active', 'irk'); ?>
            </label>
        </div>
        <div class="uk-margin-small">
            <input type="text" class="uk-input" name="brand-slug" value="<?php echo esc_attr($options->get_option('brand-slug')); ?>" placeholder="<?php _e('Slug', 'irk'); ?>">
        </div>
    </div>
    <div class="uk-margin">
        <label class="uk-form-label"><?php _e('Pre loader', 'irk'); ?></label>
        <div class="uk-margin-small">
            <label>
                <input class="uk-checkbox" type="checkbox" name="pre-loader" value="1" <?php echo checked($options->get_option('pre-loader'), 1); ?>>
                <?php _e('Active', 'irk'); ?>
            </label>
        </div>
        <div class="uk-margin-small">
            <label>
                <input class="uk-radio" type="radio" name="pre-loader-style" value="ball-scale-multiple" <?php checked($pre_loader_style, 'ball-scale-multiple'); ?>>
                <span><?php _e('Style', 'irk'); ?> 1</span>
            </label>
        </div>
        <div class="uk-margin-small">
            <label>
                <input class="uk-radio" type="radio" name="pre-loader-style" value="ball-beat" <?php checked($pre_loader_style, 'ball-beat'); ?>>
                <span><?php _e('Style', 'irk'); ?> 2</span>
            </label>
        </div>
        <div class="uk-margin-small">
            <label>
                <input class="uk-radio" type="radio" name="pre-loader-style" value="ball-circus" <?php checked($pre_loader_style, 'ball-circus'); ?>>
                <span><?php _e('Style', 'irk'); ?> 3</span>
            </label>
        </div>
        <div class="uk-margin-small">
            <label>
                <input class="uk-radio" type="radio" name="pre-loader-style" value="ball-elastic-dots" <?php checked($pre_loader_style, 'ball-elastic-dots'); ?>>
                <span><?php _e('Style', 'irk'); ?> 4</span>
            </label>
        </div>
        <div class="uk-margin-small">
            <label>
                <input class="uk-radio" type="radio" name="pre-loader-style" value="ball-clip-rotate" <?php checked($pre_loader_style, 'ball-clip-rotate'); ?>>
                <span><?php _e('Style', 'irk'); ?> 5</span>
            </label>
        </div>
    </div>
</div>