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

$sorting = $options->get_option('catalog-sorting');
$amazing_header_image = $options->get_option('amazing-header-image');
$catalog_second_image = $options->get_option('catalog-second-image');
?>
<div class="irk-settings-area irk-settings-catalog">
    <h2 class="irk-settings-title">
        <span class="irk-title-icon"><span uk-icon="cart"></span></span>
        <strong><?php _e('Product catalog', 'irk'); ?></strong>
    </h2>
    <div class="uk-margin">
        <label class="uk-form-label"><?php _e('Default sorting', 'irk'); ?></label>
        <div uk-form-custom="target: > * > span:first-child">
            <select name="catalog-sorting">
                <option value="menu-order" <?php selected($sorting, 'menu_order'); ?>><?php _e('Default sorting (custom ordering + name)', 'irk'); ?></option>
                <option value="popularity" <?php selected($sorting, 'popularity'); ?>><?php _e('Popularity (sales)', 'irk'); ?></option>
                <option value="rating" <?php selected($sorting, 'rating'); ?>><?php _e('Average rating', 'irk'); ?></option>
                <option value="date" <?php selected($sorting, 'date'); ?>><?php _e('Sort by most recent', 'irk'); ?></option>
                <option value="price" <?php selected($sorting, 'price'); ?>><?php _e('Sort by price (asc)', 'irk'); ?></option>
                <option value="price-desc" <?php selected($sorting, 'price-desc'); ?>><?php _e('Sort by price (desc)', '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 class="uk-margin">
        <label class="uk-form-label" for="irk-menu-order-label"><?php _e('Sorting labels', 'irk'); ?></label>
        <div class="uk-margin-small">
            <input type="text" class="uk-input" id="irk-menu-order-label" name="menu-order-label" value="<?php echo esc_attr($options->get_option('menu-order-label')); ?>" placeholder="<?php _e('Default', 'irk'); ?>">
        </div>
        <div class="uk-margin-small">
            <input type="text" class="uk-input" id="irk-popularity-label" name="popularity-label" value="<?php echo esc_attr($options->get_option('popularity-label')); ?>" placeholder="<?php _e('Popularity', 'irk'); ?>">
        </div>
        <div class="uk-margin-small">
            <input type="text" class="uk-input" id="irk-rating-label" name="rating-label" value="<?php echo esc_attr($options->get_option('rating-label')); ?>" placeholder="<?php _e('Average rating', 'irk'); ?>">
        </div>
        <div class="uk-margin-small">
            <input type="text" class="uk-input" id="irk-date-label" name="date-label" value="<?php echo esc_attr($options->get_option('date-label')); ?>" placeholder="<?php _e('Most recent', 'irk'); ?>">
        </div>
        <div class="uk-margin-small">
            <input type="text" class="uk-input" id="irk-price-label" name="price-label" value="<?php echo esc_attr($options->get_option('price-label')); ?>" placeholder="<?php _e('Price (asc)', 'irk'); ?>">
        </div>
        <div class="uk-margin-small">
            <input type="text" class="uk-input" id="irk-price-desc-label" name="price-desc-label" value="<?php echo esc_attr($options->get_option('price-desc-label')); ?>" placeholder="<?php _e('Price (desc)', 'irk'); ?>">
        </div>
    </div>
    <div class="uk-margin">
        <label class="uk-form-label" for="irk-loop-columns"><?php _e('Products per row', 'irk'); ?></label>
        <input type="number" class="uk-input" id="irk-loop-columns" name="loop-columns" value="<?php echo esc_attr($options->get_option('loop-columns')); ?>">
    </div>
    <div class="uk-margin">
        <label class="uk-form-label" for="irk-products-per-page"><?php _e('Products per page', 'irk'); ?></label>
        <input type="number" class="uk-input" id="irk-products-per-page" name="products-per-page" value="<?php echo esc_attr($options->get_option('products-per-page')); ?>">
    </div>
    <div class="uk-margin">
        <label class="uk-form-label"><?php _e('Product options', 'irk'); ?></label>
        <div class="uk-margin-small">
            <label>
                <input class="uk-checkbox" type="checkbox" name="catalog-seller" value="1" <?php checked($options->get_option('catalog-seller'), 1); ?>>
                <?php _e('Show product seller', 'irk'); ?>
            </label>
        </div>
        <div class="uk-margin-small">
            <label>
                <input class="uk-checkbox" type="checkbox" name="catalog-cart-button" value="1" <?php checked($options->get_option('catalog-cart-button'), 1); ?>>
                <?php _e('Add to cart button', 'irk'); ?>
            </label>
        </div>
        <div class="uk-margin-small">
            <label>
                <input class="uk-checkbox" type="checkbox" name="catalog-quantity-input" value="1" <?php checked($options->get_option('catalog-quantity-input'), 1); ?>>
                <?php _e('Quantity input', 'irk'); ?>
            </label>
        </div>
        <div class="uk-margin-small">
            <label>
                <input class="uk-checkbox" type="checkbox" name="catalog-stock" value="1" <?php checked($options->get_option('catalog-stock'), 1); ?>>
                <?php _e('In stock quantity', 'irk'); ?>
            </label>
        </div>
        <div class="uk-margin-small">
            <label>
                <input class="uk-checkbox" type="checkbox" name="added-to-cart-toast" value="1" <?php checked($options->get_option('added-to-cart-toast'), 1); ?>>
                <?php _e('Show message after product added to cart', 'irk'); ?>
            </label>
        </div>
        <div class="uk-margin-small">
            <label>
                <input class="uk-checkbox" type="checkbox" name="catalog-subcat" value="1" <?php checked($options->get_option('catalog-subcat'), 1); ?>>
                <?php _e('Show subcategory', 'irk'); ?>
            </label>
        </div>
    </div>
    <div class="uk-margin">
        <label class="uk-form-label"><?php _e('Out of stock products', 'irk'); ?></label>
        <div class="uk-margin-small">
            <label>
                <input class="uk-checkbox" type="checkbox" name="hide-outofstock" value="1" <?php checked($options->get_option('hide-outofstock'), 1); ?>>
                <?php _e('Hide', 'irk'); ?>
            </label>
        </div>
        <div class="uk-margin-small">
            <label>
                <input class="uk-checkbox" type="checkbox" name="outofstock-at-end" value="1" <?php checked($options->get_option('outofstock-at-end'), 1); ?>>
                <?php _e('Show at end', 'irk'); ?>
            </label>
        </div>
    </div>
    <div class="uk-margin">
        <label class="uk-form-label"><?php _e('Show description at end', 'irk'); ?></label>
        <div class="uk-margin-small">
            <label>
                <input class="uk-checkbox" type="checkbox" name="catalog-description-end" value="1" <?php checked($options->get_option('catalog-description-end'), 1); ?>>
                <?php _e('Active', 'irk'); ?>
            </label>
        </div>
    </div>
    <div class="uk-margin">
        <label class="uk-form-label"><?php _e('Products slider', 'irk'); ?></label>
        <div class="uk-margin-small">
            <label>
                <input class="uk-checkbox" type="checkbox" name="catalog-products-slider" value="1" <?php checked($options->get_option('catalog-products-slider'), 1); ?>>
                <?php _e('Show products slider at end of archive page.', 'irk'); ?>
            </label>
        </div>
        <div class="uk-margin-small">
            <input type="text" class="uk-input" name="catalog-products-slider-title" value="<?php echo esc_attr($options->get_option('catalog-products-slider-title')); ?>">
            <div class="irk-description">
                <span uk-icon="info"></span>
                <?php _e('You can add products to the slider on the product category edit page. Category title:', 'irk'); ?>
                <code class="irk-clipboard" uk-tooltip="<?php _e('Click to copy in clipboard.', 'irk'); ?>">{{title}}</code>
            </div>
        </div>
    </div>
    <div class="uk-margin">
        <label class="uk-form-label"><?php _e('Amazing offer', 'irk'); ?></label>
        <div class="uk-margin-small">
            <label>
                <input class="uk-checkbox" type="checkbox" name="catalog-amazing-show-expired" value="1" <?php echo checked($options->get_option('catalog-amazing-show-expired'), 1); ?>>
                <?php _e('Show expired product', 'irk'); ?>
            </label>
        </div>
        <div class="uk-margin-small">
            <label>
                <input class="uk-checkbox" type="checkbox" name="catalog-amazing-timer" value="1" <?php echo checked($options->get_option('catalog-amazing-timer'), 1); ?>>
                <?php _e('Countdown timer', 'irk'); ?>
            </label>
        </div>
    </div>
    <div class="uk-margin">
        <label class="uk-form-label"><?php _e('Amazing offer header image', 'irk'); ?></label>
        <div class="irk-upload-file-wrapper">
            <img src="<?php echo intval($amazing_header_image) ? wp_get_attachment_url( $amazing_header_image ) : IRK_IMG_URI.'amazing-title.svg'; ?>" class="irk-image" alt="image">
            <input type="hidden" name="amazing-header-image" value="<?php echo esc_attr( $amazing_header_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.'amazing-title.svg'; ?>"><?php _e('Remove image', 'irk'); ?></button>
        </div>
    </div>
    <div class="uk-margin">
        <label class="uk-form-label"><?php _e('Product actions', 'irk'); ?></label>
        <div class="uk-margin-small">
            <label>
                <input class="uk-checkbox" type="checkbox" name="catalog-favorites" value="1" <?php checked($options->get_option('catalog-favorites'), 1); ?>>
                <?php _e('Favorites', 'irk'); ?>
            </label>
        </div>
        <div class="uk-margin-small">
            <label>
                <input class="uk-checkbox" type="checkbox" name="catalog-quick-view" value="1" <?php checked($options->get_option('catalog-quick-view'), 1); ?>>
                <?php _e('Quick view', 'irk'); ?>
            </label>
        </div>
        <div class="uk-margin-small">
            <label>
                <input class="uk-checkbox" type="checkbox" name="catalog-compare" value="1" <?php checked($options->get_option('catalog-compare'), 1); ?>>
                <?php _e('Compare', 'irk'); ?>
            </label>
        </div>
    </div>
    <div class="uk-margin">
        <label class="uk-form-label"><?php _e('Second hover image', 'irk'); ?></label>
        <div class="uk-margin-small">
            <label>
                <input class="uk-radio" type="radio" name="catalog-second-image" value="none" <?php checked($catalog_second_image, 'none'); ?>>
                <?php _e('None', 'irk'); ?>
            </label>
        </div>
        <div class="uk-margin-small">
            <label>
                <input class="uk-radio" type="radio" name="catalog-second-image" value="first-gallery" <?php checked($catalog_second_image, 'first-gallery'); ?>>
                <?php _e('First gallery image', 'irk'); ?>
            </label>
        </div>
        <div class="uk-margin-small">
            <label>
                <input class="uk-radio" type="radio" name="catalog-second-image" value="custom" <?php checked($catalog_second_image, 'custom'); ?>>
                <?php _e('Custom', 'irk'); ?>
            </label>
        </div>
    </div>
</div>