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

$placeholder_image = $options->get_option('placeholder-image');
$var_price = $options->get_option('variable-product-price');
$product_info = $options->get_option('product-info');
$product_info = is_array($product_info) ? $product_info : [];
$expert_image = $options->get_option('expert-image');
$tabs_panel = $options->get_option('tabs-panel');
$sku_placement = $options->get_option('product-sku-placement');
$attributes = $options->get_option('product-attributes');
$attributes = is_array($attributes) ? $attributes : [];
?>
<div class="irk-settings-area irk-settings-product">
    <h2 class="irk-settings-title">
        <span class="irk-title-icon"><span uk-icon="album"></span></span>
        <strong><?php _e('Product', 'irk'); ?></strong>
    </h2>
    <ul uk-tab>
        <li class="uk-active"><a href="#"><?php _e('Global', 'irk'); ?></a></li>
        <li><a href="#"><?php _e('Comment', 'irk'); ?></a></li>
    </ul>
    <ul class="uk-switcher uk-margin">
        <li>
            <div class="uk-margin">
                <label class="uk-form-label"><?php _e('Placeholder image', 'irk'); ?></label>
                <div class="irk-upload-file-wrapper">
                    <img src="<?php echo intval($placeholder_image) ? wp_get_attachment_url( $placeholder_image ) : IRK_IMG_URI.'dot.png'; ?>" class="irk-image" alt="image">
                    <input type="hidden" name="placeholder-image" value="<?php echo esc_attr( $placeholder_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('Variable product price', 'irk'); ?></label>
                <div class="uk-margin-small">
                    <label>
                        <input class="uk-radio" type="radio" name="variable-product-price" value="range" <?php checked($var_price, 'range'); ?>>
                        <?php _e('Range price', 'irk'); ?>
                    </label>
                </div>
                <div class="uk-margin-small">
                    <label>
                        <input class="uk-radio" type="radio" name="variable-product-price" value="minimum" <?php checked($var_price, 'minimum'); ?>>
                        <?php _e('Minimum price', 'irk'); ?>
                    </label>
                </div>
            </div>
            <div class="uk-margin">
                <label class="uk-form-label" for="irk-empty-price-label"><?php _e('Empty price label', 'irk'); ?></label>
                <input type="text" class="uk-input" id="irk-empty-price-label" name="empty-price-label" value="<?php echo esc_attr($options->get_option('empty-price-label')); ?>">
            </div>
            <div class="uk-margin">
                <label class="uk-form-label"><?php _e('Product info', 'irk'); ?></label>
                <?php if (true): ?>
                    <div class="irk-description">
                        <span uk-icon="info"></span>
                        <a href="https://materialdesignicons.com/"
                           target="_blank"><?php _e('Get icon name from this link.', 'irk'); ?></a>
                    </div>
                <?php endif; ?>
                <div>
                    <?php if (count($product_info)): ?>
                        <?php foreach ($product_info as $info): ?>
                            <div class="uk-margin-small">
                                <input type="text" class="uk-input" name="product-info[]" value="<?php echo esc_attr($info); ?>" placeholder="<?php _e('Icon@Title', 'irk'); ?>">
                            </div>
                        <?php endforeach; ?>
                    <?php endif; ?>
                </div>
                <a href="#" class="irk-new-product-info uk-button uk-button-default uk-button-small"><?php _e('New item', 'irk'); ?></a>
            </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="new-style" value="1" <?php checked($options->get_option('new-style'), 1); ?>>
                        <?php _e('New style', 'irk'); ?>
                    </label>
                </div>
                <div class="uk-margin-small">
                    <label>
                        <input class="uk-checkbox" type="checkbox" name="active-fake-label"
                               value="1" <?php checked($options->get_option('active-fake-label'), 1); ?>>
                        <?php _e('Show fake label', 'irk'); ?>
                    </label>
                </div>
                <div class="uk-margin-small">
                    <label>
                        <input class="uk-checkbox" type="checkbox" name="gallery-thumb-slider"
                               value="1" <?php checked($options->get_option('gallery-thumb-slider'), 1); ?>>
                        <?php _e('Gallery thumbnail slider', 'irk'); ?>
                    </label>
                </div>
                <div class="uk-margin-small">
                    <label>
                        <input class="uk-checkbox" type="checkbox" name="short-attr"
                               value="1" <?php checked($options->get_option('short-attr'), 1); ?>>
                        <?php _e('Short attributes', 'irk'); ?>
                    </label>
                </div>
                <div class="uk-margin-small">
                    <label>
                        <input class="uk-checkbox" type="checkbox" name="product-sku" value="1" <?php checked($options->get_option('product-sku'), 1); ?>>
                        <?php _e('Product SKU', 'irk'); ?>
                    </label>
                </div>
                <div class="uk-margin-small">
                    <label>
                        <input class="uk-checkbox" type="checkbox" name="product-brand"
                               value="1" <?php checked($options->get_option('product-brand'), 1); ?>>
                        <?php _e('Product brand', 'irk'); ?>
                    </label>
                </div>
                <div class="uk-margin-small">
                    <label>
                        <input class="uk-checkbox" type="checkbox" name="single-seller" value="1" <?php checked($options->get_option('single-seller'), 1); ?>>
                        <?php _e('Show product seller', 'irk'); ?>
                    </label>
                </div>
                <div class="uk-margin-small">
                    <label>
                        <input class="uk-checkbox" type="checkbox" name="seller-score" value="1" <?php checked($options->get_option('seller-score'), 1); ?>>
                        <?php _e('Show seller score', 'irk'); ?>
                    </label>
                </div>
                <div class="uk-margin-small">
                    <label>
                        <input class="uk-checkbox" type="checkbox" name="seller-score-new-style" value="1" <?php checked($options->get_option('seller-score-new-style'), 1); ?>>
                        <?php _e('Seller score new score', 'irk'); ?>
                    </label>
                </div>
                <div class="uk-margin-small">
                    <label>
                        <input class="uk-checkbox" type="checkbox" name="single-services"
                               value="1" <?php checked($options->get_option('single-services'), 1); ?>>
                        <?php _e('Services', 'irk'); ?>
                    </label>
                </div>
                <div class="uk-margin-small">
                    <label>
                        <input class="uk-checkbox" type="checkbox" name="hide-stock"
                               value="1" <?php checked($options->get_option('hide-stock'), 1); ?>>
                        <?php _e('Hide stock', 'irk'); ?>
                    </label>
                </div>
                <div class="uk-margin-small">
                    <label>
                        <input class="uk-checkbox" type="checkbox" name="expert-in-desc"
                               value="1" <?php checked($options->get_option('expert-in-desc'), 1); ?>>
                        <?php _e('Show short description in description tab', 'irk'); ?>
                    </label>
                </div>
                <div class="uk-margin-small">
                    <div class="irk-upload-file-wrapper">
                        <img src="<?php echo intval($expert_image) ? wp_get_attachment_url( $expert_image ) : IRK_IMG_URI.'pen.svg'; ?>" class="irk-image" alt="image">
                        <input type="hidden" name="expert-image" value="<?php echo esc_attr( $expert_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>
            <div class="uk-margin">
                <label class="uk-form-label"><?php _e('Product hooks', 'irk'); ?></label>
                <div class="irk-description">
                    <span uk-icon="info"></span>
                    <?php _e('Enter text or code or shortcode to display on the product page.', 'irk'); ?>
                </div>
                <div class="uk-margin-small">
                    <input type="text" class="uk-input" name="woocommerce_before_single_product" value="<?php echo esc_attr($options->get_option('woocommerce_before_single_product')); ?>" placeholder="woocommerce_before_single_product">
                </div>
                <div class="uk-margin-small">
                    <input type="text" class="uk-input" name="woocommerce_before_single_product_summary" value="<?php echo esc_attr($options->get_option('woocommerce_before_single_product_summary')); ?>" placeholder="woocommerce_before_single_product_summary">
                </div>
                <div class="uk-margin-small">
                    <input type="text" class="uk-input" name="woocommerce_before_add_to_cart_form" value="<?php echo esc_attr($options->get_option('woocommerce_before_add_to_cart_form')); ?>" placeholder="woocommerce_before_add_to_cart_form">
                </div>
                <div class="uk-margin-small">
                    <input type="text" class="uk-input" name="woocommerce_before_variations_form" value="<?php echo esc_attr($options->get_option('woocommerce_before_variations_form')); ?>" placeholder="woocommerce_before_variations_form">
                </div>
                <div class="uk-margin-small">
                    <input type="text" class="uk-input" name="woocommerce_before_add_to_cart_button" value="<?php echo esc_attr($options->get_option('woocommerce_before_add_to_cart_button')); ?>" placeholder="woocommerce_before_add_to_cart_button">
                </div>
                <div class="uk-margin-small">
                    <input type="text" class="uk-input" name="woocommerce_before_single_variation" value="<?php echo esc_attr($options->get_option('woocommerce_before_single_variation')); ?>" placeholder="woocommerce_before_single_variation">
                </div>
                <div class="uk-margin-small">
                    <input type="text" class="uk-input" name="woocommerce_after_single_variation" value="<?php echo esc_attr($options->get_option('woocommerce_after_single_variation')); ?>" placeholder="woocommerce_after_single_variation">
                </div>
                <div class="uk-margin-small">
                    <input type="text" class="uk-input" name="woocommerce_after_add_to_cart_button" value="<?php echo esc_attr($options->get_option('woocommerce_after_add_to_cart_button')); ?>" placeholder="woocommerce_after_add_to_cart_button">
                </div>
                <div class="uk-margin-small">
                    <input type="text" class="uk-input" name="woocommerce_after_variations_form" value="<?php echo esc_attr($options->get_option('woocommerce_after_variations_form')); ?>" placeholder="woocommerce_after_variations_form">
                </div>
                <div class="uk-margin-small">
                    <input type="text" class="uk-input" name="woocommerce_after_add_to_cart_form" value="<?php echo esc_attr($options->get_option('woocommerce_after_add_to_cart_form')); ?>" placeholder="woocommerce_after_add_to_cart_form">
                </div>
                <div class="uk-margin-small">
                    <input type="text" class="uk-input" name="woocommerce_product_meta_start" value="<?php echo esc_attr($options->get_option('woocommerce_product_meta_start')); ?>" placeholder="woocommerce_product_meta_start">
                </div>
                <div class="uk-margin-small">
                    <input type="text" class="uk-input" name="woocommerce_product_meta_end" value="<?php echo esc_attr($options->get_option('woocommerce_product_meta_end')); ?>" placeholder="woocommerce_product_meta_end">
                </div>
                <div class="uk-margin-small">
                    <input type="text" class="uk-input" name="woocommerce_share" value="<?php echo esc_attr($options->get_option('woocommerce_share')); ?>" placeholder="woocommerce_share">
                </div>
                <div class="uk-margin-small">
                    <input type="text" class="uk-input" name="woocommerce_after_single_product_summary" value="<?php echo esc_attr($options->get_option('woocommerce_after_single_product_summary')); ?>" placeholder="woocommerce_after_single_product_summary">
                </div>
                <div class="uk-margin-small">
                    <input type="text" class="uk-input" name="woocommerce_after_single_product" value="<?php echo esc_attr($options->get_option('woocommerce_after_single_product')); ?>" placeholder="woocommerce_after_single_product">
                </div>
            </div>
            <div class="uk-margin">
                <label class="uk-form-label"><?php _e('Product SKU placement', 'irk'); ?></label>
                <div class="uk-margin-small">
                    <label>
                        <input class="uk-radio" type="radio" name="product-sku-placement" value="summary" <?php checked($sku_placement, 'summary'); ?>>
                        <?php _e('Product summary', 'irk'); ?>
                    </label>
                </div>
                <div class="uk-margin-small">
                    <label>
                        <input class="uk-radio" type="radio" name="product-sku-placement" value="bottom" <?php checked($sku_placement, 'bottom'); ?>>
                        <?php _e('Bottom', 'irk'); ?>
                    </label>
                </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="product-favorites"
                               value="1" <?php checked($options->get_option('product-favorites'), 1); ?>>
                        <?php _e('Favorites', 'irk'); ?>
                    </label>
                </div>
                <div class="uk-margin-small">
                    <label>
                        <input class="uk-checkbox" type="checkbox" name="product-share"
                               value="1" <?php checked($options->get_option('product-share'), 1); ?>>
                        <?php _e('Product share', 'irk'); ?>
                    </label>
                </div>
                <div class="uk-margin-small">
                    <label>
                        <input class="uk-checkbox" type="checkbox" name="price-chart"
                               value="1" <?php checked($options->get_option('price-chart'), 1); ?>>
                        <?php _e('Price chart', 'irk'); ?>
                    </label>
                </div>
                <div class="uk-margin-small">
                    <label>
                        <input class="uk-checkbox" type="checkbox" name="product-compare"
                               value="1" <?php checked($options->get_option('product-compare'), 1); ?>>
                        <?php _e('Product compare', 'irk'); ?>
                    </label>
                </div>
                <div class="uk-margin-small">
                    <label>
                        <input class="uk-checkbox" type="checkbox" name="product-video"
                               value="1" <?php checked($options->get_option('product-video'), 1); ?>>
                        <?php _e('Video', '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="outofstock-hide-price" value="1" <?php checked($options->get_option('outofstock-hide-price'), 1); ?>>
                        <?php _e('Hide price', 'irk'); ?>
                    </label>
                </div>
                <div class="uk-margin-small">
                    <label>
                        <input class="uk-checkbox" type="checkbox" name="out-of-stock-related-at-top" value="1" <?php checked($options->get_option('out-of-stock-related-at-top'), 1); ?>>
                        <?php _e('Related products at top', 'irk'); ?>
                    </label>
                </div>
            </div>
            <div class="uk-margin">
                <label class="uk-form-label"><?php _e('Related products', 'irk'); ?></label>
                <div class="uk-margin-small">
                    <label>
                        <input class="uk-checkbox" type="checkbox" name="hide-related" value="1" <?php checked($options->get_option('hide-related'), 1); ?>>
                        <?php _e('Hide related', 'irk'); ?>
                    </label>
                </div>
                <div class="uk-margin-small">
                    <label>
                        <input class="uk-checkbox" type="checkbox" name="hide-upsells" value="1" <?php checked($options->get_option('hide-upsells'), 1); ?>>
                        <?php _e('Hide upsells', 'irk'); ?>
                    </label>
                </div>
                <div class="uk-margin-small">
                    <label>
                        <input class="uk-checkbox" type="checkbox" name="hide-cross-sells" value="1" <?php checked($options->get_option('hide-cross-sells'), 1); ?>>
                        <?php _e('Hide cross sells', 'irk'); ?>
                    </label>
                </div>
                <div class="uk-margin-small">
                    <label>
                        <input class="uk-checkbox" type="checkbox" name="upsells-carousel" value="1" <?php checked($options->get_option('upsells-carousel'), 1); ?>>
                        <?php _e('Carousel', 'irk'); ?>
                    </label>
                </div>
                <div class="uk-margin-small">
                    <label>
                        <input class="uk-checkbox" type="checkbox" name="upsells-hide-outofstock" value="1" <?php checked($options->get_option('upsells-hide-outofstock'), 1); ?>>
                        <?php _e('Hide out of stock', 'irk'); ?>
                    </label>
                </div>
                <div class="uk-margin-small">
                    <input type="number" class="uk-input" name="upsells-count" value="<?php echo esc_attr($options->get_option('upsells-count')); ?>" placeholder="<?php _e('Upsells count', 'irk'); ?>">
                </div>
            </div>
            <div class="uk-margin">
                <label class="uk-form-label"><?php _e('Tabs panel visibility', 'irk'); ?></label>
                <div class="uk-margin-small">
                    <label>
                        <input class="uk-radio" type="radio" name="tabs-panel" value="expanded" <?php checked($tabs_panel, 'expanded'); ?>>
                        <?php _e('Expanded', 'irk'); ?>
                    </label>
                </div>
                <div class="uk-margin-small">
                    <label>
                        <input class="uk-radio" type="radio" name="tabs-panel" value="collapsed" <?php checked($tabs_panel, 'collapsed'); ?>>
                        <?php _e('Collapsed', 'irk'); ?>
                    </label>
                </div>
            </div>
            <div class="uk-margin">
                <label class="uk-form-label"><?php _e('Tabs', 'irk'); ?></label>
                <div class="uk-margin-small">
                    <input type="text" class="uk-input" name="description-title" value="<?php echo esc_attr($options->get_option('description-title')); ?>" placeholder="<?php _e('Description title', 'irk'); ?>">
                </div>
                <div class="uk-margin-small">
                    <input type="text" class="uk-input" name="additional-info-title" value="<?php echo esc_attr($options->get_option('additional-info-title')); ?>" placeholder="<?php _e('Additional info title', 'irk'); ?>">
                </div>
                <div class="uk-margin-small">
                    <input type="text" class="uk-input" name="reviews-title" value="<?php echo esc_attr($options->get_option('reviews-title')); ?>" placeholder="<?php _e('Reviews title', 'irk'); ?>">
                </div>
                <div class="uk-margin-small">
                    <textarea class="uk-textarea" name="tabs-data" rows="5" placeholder="<?php _e('Tabs data', 'irk'); ?>"><?php echo esc_textarea($options->get_option('tabs-data')); ?></textarea>
                    <div class="irk-description">
                        <span uk-icon="info"></span>
                        <?php _e('Put each item in a line:', 'irk'); ?>
                        <code><?php _e('Key:Priority:Title:Active', 'irk'); ?></code>
                    </div>
                </div>
                <div class="uk-margin-small">
                    <label>
                        <input class="uk-checkbox" type="checkbox" name="hide-dimensions" value="1" <?php checked($options->get_option('hide-dimensions'), 1); ?>>
                        <?php _e('Hide weight and dimensions', 'irk'); ?>
                    </label>
                </div>
            </div>
            <div class="uk-margin">
                <label class="uk-form-label"><?php _e('Product tag', 'irk'); ?></label>
                <div class="uk-margin-small">
                    <label>
                        <input class="uk-checkbox" type="checkbox" name="hide-product-tag"
                               value="1" <?php checked($options->get_option('hide-product-tag'), 1); ?>>
                        <?php _e('Hide', 'irk'); ?>
                    </label>
                </div>
            </div>
            <div class="uk-margin">
                <label class="uk-form-label"><?php _e('Variable product', 'irk'); ?></label>
                <div class="uk-margin-small">
                    <label>
                        <input class="uk-checkbox" type="checkbox" name="hide-variable-primary-price"
                               value="1" <?php checked($options->get_option('hide-variable-primary-price'), 1); ?>>
                        <?php _e('Hide variable primary price', 'irk'); ?>
                    </label>
                </div>
                <div class="uk-margin-small">
                    <label>
                        <input class="uk-checkbox" type="checkbox" name="hide-reset-variations"
                               value="1" <?php checked($options->get_option('hide-reset-variations'), 1); ?>>
                        <?php _e('Hide reset variations', 'irk'); ?>
                    </label>
                </div>
                <div class="uk-margin-small">
                    <label>
                        <input class="uk-checkbox" type="checkbox" name="advanced-attr"
                               value="1" <?php checked($options->get_option('advanced-attr'), 1); ?>>
                        <?php _e('Enable this option if you use the Advanced Attributes plugin.', 'irk'); ?>
                    </label>
                </div>
            </div>
        </li>
        <li>
            <div class="uk-margin">
                <label class="uk-form-label" for="irk-comments-rules"><?php _e('Comment rules', 'irk'); ?></label>
                <textarea class="uk-textarea" id="irk-comments-rules" name="comments-rules"
                          rows="15"><?php echo wp_unslash($options->get_option('comments-rules')); ?></textarea>
            </div>
            <div class="uk-margin">
                <label class="uk-form-label"><?php _e('Product attributes', 'irk'); ?></label>
                <div class="uk-margin-small">
                    <label>
                        <input class="uk-checkbox" type="checkbox" name="active-product-attributes" value="1" <?php echo checked($options->get_option('active-product-attributes'), 1); ?>>
                        <?php _e('Active', 'irk'); ?>
                    </label>
                </div>
                <div>
                    <?php if (count($attributes)): ?>
                        <?php foreach ($attributes as $item): ?>
                            <div class="uk-margin-small">
                                <input type="text" class="uk-input" name="product-attributes[]" value="<?php echo esc_attr($item); ?>" placeholder="<?php _e('Name@Label', 'irk'); ?>">
                            </div>
                        <?php endforeach; ?>
                    <?php endif; ?>
                </div>
                <a href="#" class="irk-new-attribute uk-button uk-button-default uk-button-small"><?php _e('New item', 'irk'); ?></a>
            </div>
            <div class="uk-margin">
                <label class="uk-form-label"><?php _e('Additional fields', 'irk'); ?></label>
                <div class="uk-margin-small">
                    <label>
                        <input class="uk-checkbox" type="checkbox" name="comment-title" value="1" <?php checked($options->get_option('comment-title'), 1); ?>>
                        <?php _e('Title', 'irk'); ?>
                    </label>
                </div>
                <div class="uk-margin-small">
                    <label>
                        <input class="uk-checkbox" type="checkbox" name="comment-advantage" value="1" <?php checked($options->get_option('comment-advantage'), 1); ?>>
                        <?php _e('Advantage', 'irk'); ?>
                    </label>
                </div>
                <div class="uk-margin-small">
                    <label>
                        <input class="uk-checkbox" type="checkbox" name="comment-disadvantage" value="1" <?php checked($options->get_option('comment-disadvantage'), 1); ?>>
                        <?php _e('Disadvantage', 'irk'); ?>
                    </label>
                </div>
                <div class="uk-margin-small">
                    <label>
                        <input class="uk-checkbox" type="checkbox" name="comment-questions" value="1" <?php checked($options->get_option('comment-questions'), 1); ?>>
                        <?php _e('Questions', 'irk'); ?>
                    </label>
                </div>
            </div>
            <div class="uk-margin">
                <label class="uk-form-label"><?php _e('Comment like', 'irk'); ?></label>
                <div class="uk-margin-small">
                    <label>
                        <input class="uk-checkbox" type="checkbox" name="comment-like" value="1" <?php echo checked($options->get_option('comment-like'), 1); ?>>
                        <?php _e('Active', 'irk'); ?>
                    </label>
                </div>
            </div>
        </li>
    </ul>
</div>