<?php

/**
 * Views class for Shortcode generator options.
 *
 * @link       https://themeatelier.net
 * @since      1.0.0
 *
 * @package domain-for-sale
 * @subpackage domain-for-sale/src/Admin/Views/DomainForSaleMetaboxMainOptions
 * @author     ThemeAtelier<themeatelierbd@gmail.com>
 */

namespace ThemeAtelier\DomainForSale\Admin\Views\Metabox;

use ThemeAtelier\DomainForSale\Admin\Framework\Classes\DOMAIN_FOR_SALE;

class FilterDomain
{
    /**
     * Create Option fields for the setting options.
     *
     * @param string $prefix Option setting key prefix.
     * @return void
     */
    public static function options($prefix)
    {
        // Main options
        DOMAIN_FOR_SALE::createSection(
            $prefix,
            array(
                'title'  => esc_html__('Filter Domain', 'domain-for-sale'),
                'icon'   => 'icofont-ui-settings',
                'fields' => array(
                    array(
                        'id'    => 'include_only_domains',
                        'type'  => 'select',
                        'title' => esc_html__('Include Only', 'domain-for-sale'),
                        'subtitle' => esc_html__('Manually choose specific domains to include in the listing. Only selected domains will be shown.', 'domain-for-sale'),
                        'options'     => 'posts',
                        'ajax'        => false,
                        'sortable'    => true,
                        'chosen'      => true,
                        'multiple'    => true,
                        'empty_message'    => esc_html__('No domain found.', 'domain-for-sale'),
                        'query_args'  => array(
                            'post_type'      => 'dfs_template',
                            'posts_per_page' => -1,
                            'cache_results'  => false,
                            'no_found_rows'  => true,
                        ),
                    ),
                    array(
                        'id'          => 'exclude_domains',
                        'type'        => 'select',
                        'title' => esc_html__('Exclude', 'domain-for-sale'),
                        'subtitle' => esc_html__('Exclude selected domains or domain types from appearing in the listing.', 'domain-for-sale'),
                        'options'     => 'posts',
                        'chosen'      => true,
                        'multiple'    => true,
                        'ajax'        => false,
                        'placeholder' => esc_html__('Choose domains to exclude', 'domain-for-sale'),
                        'query_args'  => array(
                            'post_type'      => 'dfs_template',
                            'posts_per_page' => -1,
                            'cache_results'  => false,
                            'no_found_rows'  => true,
                        ),
                        'dependency' => array('include_only_domains', '==', '', true),
                    ),
                    array(
                        'id'    => 'filter_order',
                        'type'  => 'select',
                        'title' => esc_html__('Order', 'domain-for-sale'),
                        'subtitle' => esc_html__('Choose ascending or descending order for domain.', 'domain-for-sale'),
                        'options' => array(
                            'ASC'  => esc_html__('Ascending', 'domain-for-sale'),
                            'DESC' => esc_html__('Descending', 'domain-for-sale'),
                        ),
                        'default' => 'ASC',
                    ),
                    array(
                        'id'    => 'domain_limit',
                        'type'  => 'spinner',
                        'title' => esc_html__('Limit', 'domain-for-sale'),
                        'title_help' => '<div class="domain-for-sale-info-desc">' . esc_html__('Set the maximum number of domains to display. Leave empty to show all domains.', 'domain-for-sale') . '</div> <a class="tooltip_btn_primary" target="_blank" href="' . esc_url(DOMAIN_FOR_SALE_DEMO_URL . 'docs/domain-listing/#6-limit?ref=1') . '">' . esc_html__('Open Docs', 'domain-for-sale') . '</a>',
                        'subtitle' => esc_html__('Set the total number of domains to display.', 'domain-for-sale'),
                        'default'  => 15,
                        'min'      => 1,
                    ),
                )
            )
        );
    }
}
