<?php

/** Home content options Panel */
$wp_customize->add_panel( 'store_expert_home_settings', array(
    'title' => esc_html__( 'Home content Settings', 'store-expert' ),
    'description' => esc_html__( 'Configure home settings', 'store-expert' ),
    'priority' => 10,
));

/** Slider Options */
$wp_customize->add_section( 'store_expert_slider_options', array(
    'title' => esc_html__( 'Slider Settings', 'store-expert' ),
    'panel' => 'store_expert_home_settings',
));

/** Enable Slider Section */
$wp_customize->add_setting( 'store_expert_slider_menu_enable', array(
	'default' => 1,
	'transport' => 'refresh',
	'sanitize_callback' => 'store_expert_switch_sanitization'
));
$wp_customize->add_control( new Store_Expert_Toggle_Switch_Custom_control( $wp_customize, 'store_expert_slider_menu_enable',	array(
	'label' => esc_html__( 'Enable Slider Section?', 'store-expert' ),
	'section' => 'store_expert_slider_options',
	'description' => esc_html__( 'Show or hide this section', 'store-expert' ),
)));

/** Slider Header*/
$wp_customize->add_setting('store_expert_slider_menu_nav_heading', array(
    'sanitize_callback' => 'store_expert_text_sanitization',
    'transport' => 'refresh'
));
$wp_customize->add_control(new Store_Expert_Heading($wp_customize, 'store_expert_slider_menu_nav_heading', array(
    'section' => 'store_expert_slider_options',
    'label' => esc_html__('Category Menu Link', 'store-expert')
)));

/** Enable Category Navigational Menu */
$wp_customize->add_setting( 'store_expert_slider_nav_menu_enable', array(
	'default' => 1,
	'transport' => 'refresh',
	'sanitize_callback' => 'store_expert_switch_sanitization'
));
$wp_customize->add_control( new Store_Expert_Toggle_Switch_Custom_control( $wp_customize, 'store_expert_slider_nav_menu_enable',	array(
	'label' => esc_html__( 'Enable Navigational links?', 'store-expert' ),
	'section' => 'store_expert_slider_options'
)));

/** Select Category menu for slider area*/
$wp_customize->add_setting('store_expert_slider_navigation_menu', array(
    'sanitize_callback' => 'store_expert_sanitize_choices',
    'default' => 'none',
    'transport' => 'refresh'
));

$wp_customize->add_control('store_expert_slider_navigation_menu', array(
    'section' => 'store_expert_slider_options',
    'type' => 'select',
    'label' => esc_html__('Select Menu', 'store-expert'),
    'choices' => store_expert_customizer_menulist()
));

/** Slider Header*/
$wp_customize->add_setting('store_expert_slider_menu_heading', array(
    'sanitize_callback' => 'store_expert_text_sanitization',
    'transport' => 'refresh'
));
$wp_customize->add_control(new Store_Expert_Heading($wp_customize, 'store_expert_slider_menu_heading', array(
    'section' => 'store_expert_slider_options',
    'label' => esc_html__('Main Slider', 'store-expert')
)));

/** Select Slider Category */
$wp_customize->add_setting('store_expert_slider_category', array(
    'sanitize_callback' => 'store_expert_sanitize_choices',
    'default' => 'none',
    'transport' => 'refresh'
));

$wp_customize->add_control('store_expert_slider_category', array(
    'section' => 'store_expert_slider_options',
    'type' => 'select',
    'label' => esc_html__( 'Select Category to show in slider', 'store-expert' ),
    'description' => esc_html__( 'Three recent posts from selected Category will show in slider, if no Category selected then very recent three posts will appear in slider. Do not forget to add feature image in posts. Preferred image size is 1920 x 1080 pixels', 'store-expert' ),
    'choices' => store_expert_customizer_category_list()
));

/** Slider Header*/
$wp_customize->add_setting('store_expert_slider_menu_banner_heading', array(
    'sanitize_callback' => 'store_expert_text_sanitization',
    'transport' => 'refresh'
));
$wp_customize->add_control(new Store_Expert_Heading($wp_customize, 'store_expert_slider_menu_banner_heading', array(
    'section' => 'store_expert_slider_options',
    'label' => esc_html__('Slider right images', 'store-expert')
)));

/** Enable Slider images */
$wp_customize->add_setting( 'store_expert_slider_images_enable', array(
	'default' => 1,
	'transport' => 'refresh',
	'sanitize_callback' => 'store_expert_switch_sanitization'
));
$wp_customize->add_control( new Store_Expert_Toggle_Switch_Custom_control( $wp_customize, 'store_expert_slider_images_enable',	array(
	'label' => esc_html__( 'Enable Right images?', 'store-expert' ),
	'section' => 'store_expert_slider_options',
	'description' => '',
)));

/** Select Slider Category */
$wp_customize->add_setting('store_expert_slider_banner_one', array(
    'sanitize_callback' => 'store_expert_sanitize_choices',
    'default' => 'none',
    'transport' => 'refresh'
));

$wp_customize->add_control('store_expert_slider_banner_one', array(
    'section' => 'store_expert_slider_options',
    'type' => 'select',
    'label' => esc_html__( 'Right Image 1', 'store-expert' ),
    'description' => esc_html__( 'Select a post to appear image here. Do not forget to add feature image in posts. Preferred image size is 1920 x 1080 pixels', 'store-expert' ),
    'choices' => store_expert_customizer_posts_list()
));

/** Select Slider Category */
$wp_customize->add_setting('store_expert_slider_banner_two', array(
    'sanitize_callback' => 'store_expert_sanitize_choices',
    'default' => 'none',
    'transport' => 'refresh'
));

$wp_customize->add_control('store_expert_slider_banner_two', array(
    'section' => 'store_expert_slider_options',
    'type' => 'select',
    'label' => esc_html__( 'Right Image 2', 'store-expert' ),
    'description' => esc_html__( 'Select a post to appear image here. Do not forget to add feature image in posts. Preferred image size is 1920 x 1080 pixels', 'store-expert' ),
    'choices' => store_expert_customizer_posts_list()
));

// Add section for category image
$wp_customize->add_section( 'store_expert_list_of_category_options', array(
    'title' => esc_html__( 'Category Lists', 'store-expert' ),
    'panel' => 'store_expert_home_settings',
));

/** Enable product by category Section */
$wp_customize->add_setting( 'store_expert_list_of_category_enable', array(
	'default' => 1,
	'transport' => 'refresh',
	'sanitize_callback' => 'store_expert_switch_sanitization'
));
$wp_customize->add_control( new Store_Expert_Toggle_Switch_Custom_control( $wp_customize, 'store_expert_list_of_category_enable',	array(
	'label' => esc_html__( 'Enable this section?', 'store-expert' ),
	'section' => 'store_expert_list_of_category_options',
	'description' => esc_html__( 'Show or hide this section', 'store-expert' ),
)));

// Category selector for home pages
$wp_customize->add_setting( 'store_expert_select_list_categories',
	array(
		'transport' => 'refresh',
		'sanitize_callback' => 'store_expert_text_sanitization'
	)
);
$wp_customize->add_control( new Store_Expert_Pill_Checkbox_Custom_Control( $wp_customize, 'store_expert_select_list_categories',
	array(
		'label' => __( 'Select product categories', 'store-expert' ),
		'description' => esc_html__( 'Select categories to show, select multiply of 6, Do not forget to add featured image in "Prodcuts -> Categories"', 'store-expert' ),
		'section' => 'store_expert_list_of_category_options',
		'input_attrs' => array(
			'sortable' => true,
			'fullwidth' => true,
		),
		'choices' => store_expert_customizer_woo_category_list()
	)
) );

// Add section for product by category
$wp_customize->add_section( 'store_expert_products_by_category_options', array(
    'title' => esc_html__( 'Products By Category', 'store-expert' ),
    'panel' => 'store_expert_home_settings',
));

/** Enable product by category Section */
$wp_customize->add_setting( 'store_expert_products_by_category_enable', array(
	'default' => 1,
	'transport' => 'refresh',
	'sanitize_callback' => 'store_expert_switch_sanitization'
));
$wp_customize->add_control( new Store_Expert_Toggle_Switch_Custom_control( $wp_customize, 'store_expert_products_by_category_enable',	array(
	'label' => esc_html__( 'Enable this section?', 'store-expert' ),
	'section' => 'store_expert_products_by_category_options',
	'description' => esc_html__( 'Show or hide this section', 'store-expert' ),
)));

// Title of product by category section
$wp_customize->add_setting('store_expert_products_by_category_title', array(
    'sanitize_callback' => 'store_expert_text_sanitization',
    'default' => esc_html__( 'Product by Category', 'store-expert' )
));

$wp_customize->add_control('store_expert_products_by_category_title', array(
    'label'   => esc_html__( 'Title text','store-expert' ),
    'section' => 'store_expert_products_by_category_options',
    'type' => 'text'
));

// subtitle of product by category section
$wp_customize->add_setting('store_expert_products_by_category_subtitle', array(
    'sanitize_callback' => 'store_expert_text_sanitization',
    'default' => esc_html__( 'Use this place to display products based on category', 'store-expert' )
));

$wp_customize->add_control('store_expert_products_by_category_subtitle', array(
    'label'   => esc_html__( 'Title text','store-expert' ),
    'section' => 'store_expert_products_by_category_options',
    'type' => 'text'
));

// Category selector for home pages
$wp_customize->add_setting( 'store_expert_select_product_categories',
	array(
		'transport' => 'refresh',
		'sanitize_callback' => 'store_expert_text_sanitization'
	)
);
$wp_customize->add_control( new Store_Expert_Pill_Checkbox_Custom_Control( $wp_customize, 'store_expert_select_product_categories',
	array(
		'label' => __( 'Select product categories', 'store-expert' ),
		'description' => esc_html__( 'Select categories to show products, So much selection will make ugly', 'store-expert' ),
		'section' => 'store_expert_products_by_category_options',
		'input_attrs' => array(
			'sortable' => true,
			'fullwidth' => true,
		),
		'choices' => store_expert_customizer_woo_category_list()
	)
) );

// Number of Columns
$wp_customize->add_setting( 'store_expert_product_by_categories_columns',
	array(
		'default' => 5,
		'transport' => 'refresh',
		'sanitize_callback' => 'store_expert_sanitize_integer'
	)
);
$wp_customize->add_control( new Store_Expert_Slider_Custom_Control( $wp_customize, 'store_expert_product_by_categories_columns',
	array(
		'label' => esc_html__( 'Number of columns', 'store-expert' ),
		'section' => 'store_expert_products_by_category_options',
		'input_attrs' => array(
			'min' => 4, // Required. Minimum value for the slider
			'max' => 8, // Required. Maximum value for the slider
			'step' => 1, // Required. The size of each interval or step the slider takes between the minimum and maximum values
		),
	)
) );

// Number of Products
$wp_customize->add_setting( 'store_expert_product_by_categories_counts',
	array(
		'default' => 10,
		'transport' => 'refresh',
		'sanitize_callback' => 'store_expert_sanitize_integer'
	)
);
$wp_customize->add_control( new Store_Expert_Slider_Custom_Control( $wp_customize, 'store_expert_product_by_categories_counts',
	array(
		'label' => esc_html__( 'Number of Products', 'store-expert' ),
		'section' => 'store_expert_products_by_category_options',
		'input_attrs' => array(
			'min' => 1, // Required. Minimum value for the slider
			'max' => 40, // Required. Maximum value for the slider
			'step' => 1, // Required. The size of each interval or step the slider takes between the minimum and maximum values
		),
	)
) );

// Add section for product grids
$wp_customize->add_section( 'store_expert_products_grid_options', array(
    'title' => esc_html__( 'Products By Category - Grid', 'store-expert' ),
    'panel' => 'store_expert_home_settings',
));

/** Enable product by category Section */
$wp_customize->add_setting( 'store_expert_products_grid_enable', array(
	'default' => 1,
	'transport' => 'refresh',
	'sanitize_callback' => 'store_expert_switch_sanitization'
));
$wp_customize->add_control( new Store_Expert_Toggle_Switch_Custom_control( $wp_customize, 'store_expert_products_grid_enable',	array(
	'label' => esc_html__( 'Enable this section?', 'store-expert' ),
	'section' => 'store_expert_products_grid_options',
	'description' => esc_html__( 'Show or hide this section', 'store-expert' ),
)));

// Category selector for home pages
$wp_customize->add_setting( 'store_expert_select_product_categories_grid',
	array(
		'transport' => 'refresh',
		'sanitize_callback' => 'store_expert_text_sanitization'
	)
);
$wp_customize->add_control( new Store_Expert_Pill_Checkbox_Custom_Control( $wp_customize, 'store_expert_select_product_categories_grid',
	array(
		'label' => __( 'Select product categories', 'store-expert' ),
		'description' => esc_html__( 'Select categories to show products in grid, Choose four categories to get good result. So much selection will make ugly', 'store-expert' ),
		'section' => 'store_expert_products_grid_options',
		'input_attrs' => array(
			'sortable' => true,
			'fullwidth' => true,
		),
		'choices' => store_expert_customizer_woo_category_list()
	)
) );

// Number of Products
$wp_customize->add_setting( 'store_expert_product_grid_counts',
	array(
		'default' => 5,
		'transport' => 'refresh',
		'sanitize_callback' => 'store_expert_sanitize_integer'
	)
);
$wp_customize->add_control( new Store_Expert_Slider_Custom_Control( $wp_customize, 'store_expert_product_grid_counts',
	array(
		'label' => esc_html__( 'Number of Products', 'store-expert' ),
		'section' => 'store_expert_products_grid_options',
		'input_attrs' => array(
			'min' => 1, // Required. Minimum value for the slider
			'max' => 10, // Required. Maximum value for the slider
			'step' => 1, // Required. The size of each interval or step the slider takes between the minimum and maximum values
		),
	)
) );

// Orderby
$wp_customize->add_setting( 'store_expert_product_grid_orderby', array(
	'sanitize_callback' => 'store_expert_sanitize_choices',
	'default' => 'none',
	'transport' => 'refresh'
));

$wp_customize->add_control( 'store_expert_product_grid_orderby', array(
	'section' => 'store_expert_products_grid_options',
	'type' => 'select',
	'label' => esc_html__('Products Order By', 'store-expert'),
	'choices' => array(
	    'none' => __('None', 'store-expert'),
	    'ID' => __('ID', 'store-expert'),
	    'date' => __('Date', 'store-expert'),
	    'name' => __('Name', 'store-expert'),
	    'title' => __('Title', 'store-expert'),
	    'rand' => __('Random', 'store-expert'),
	    'comment_count' => __('Comment Count', 'store-expert'),
	)
));

//order
$wp_customize->add_setting( 'store_expert_product_grid_order', array(
	'sanitize_callback' => 'store_expert_sanitize_choices',
	'default' => 'DESC',
	'transport' => 'refresh'
));

$wp_customize->add_control( 'store_expert_product_grid_order', array(
	'section' => 'store_expert_products_grid_options',
	'type' => 'select',
	'label' => esc_html__('Products Order', 'store-expert'),
	'choices' => array(
		'ASC' => __('Ascending', 'store-expert'),
		'DESC' => __('Descending', 'store-expert'),
	)
));