<?php
/**
 * Banner Section
 *
 * @package clothing_marketplace
 */

$wp_customize->add_section(
	'clothing_marketplace_banner_section',
	array(
		'panel'    => 'clothing_marketplace_front_page_options',
		'title'    => esc_html__( 'Banner Section', 'clothing-marketplace' ),
		'priority' => 10,
	)
);

// Banner Section - Enable Section.
$wp_customize->add_setting(
	'clothing_marketplace_enable_banner_section',
	array(
		'default'           => false,
		'sanitize_callback' => 'clothing_marketplace_sanitize_switch',
	)
);

$wp_customize->add_control(
	new Clothing_Marketplace_Toggle_Switch_Custom_Control(
		$wp_customize,
		'clothing_marketplace_enable_banner_section',
		array(
			'label'    => esc_html__( 'Enable Banner Section', 'clothing-marketplace' ),
			'section'  => 'clothing_marketplace_banner_section',
			'settings' => 'clothing_marketplace_enable_banner_section',
		)
	)
);

if ( isset( $wp_customize->selective_refresh ) ) {
	$wp_customize->selective_refresh->add_partial(
		'clothing_marketplace_enable_banner_section',
		array(
			'selector' => '#clothing_marketplace_banner_section .section-link',
			'settings' => 'clothing_marketplace_enable_banner_section',
		)
	);
}

// Banner Section - Banner Sub Heading.
$wp_customize->add_setting(
	'clothing_marketplace_banner_section_sub_heading',
	array(
		'default'           => '',
		'sanitize_callback' => 'sanitize_text_field',
	)
);

$wp_customize->add_control(
	'clothing_marketplace_banner_section_sub_heading',
	array(
		'label'           => sprintf( esc_html__( 'Offer Text', 'clothing-marketplace' )),
		'section'         => 'clothing_marketplace_banner_section',
		'settings'        => 'clothing_marketplace_banner_section_sub_heading',
		'type'            => 'text',
		'active_callback' => 'clothing_marketplace_is_banner_slider_section_enabled',
	)
);

// Banner Section - Banner Heading.
$wp_customize->add_setting(
	'clothing_marketplace_banner_section_heading',
	array(
		'default'           => '',
		'sanitize_callback' => 'sanitize_text_field',
	)
);

$wp_customize->add_control(
	'clothing_marketplace_banner_section_heading',
	array(
		'label'           => sprintf( esc_html__( 'Main Heading One Word', 'clothing-marketplace' )),
		'section'         => 'clothing_marketplace_banner_section',
		'settings'        => 'clothing_marketplace_banner_section_heading',
		'type'            => 'text',
		'active_callback' => 'clothing_marketplace_is_banner_slider_section_enabled',
	)
);

// Banner Section - Banner Content.
$wp_customize->add_setting(
	'clothing_marketplace_banner_section_content',
	array(
		'default'           => '',
		'sanitize_callback' => 'sanitize_text_field',
	)
);

$wp_customize->add_control(
	'clothing_marketplace_banner_section_content',
	array(
		'label'           => sprintf( esc_html__( 'Subtitle Text (Bar)', 'clothing-marketplace' )),
		'section'         => 'clothing_marketplace_banner_section',
		'settings'        => 'clothing_marketplace_banner_section_content',
		'type'            => 'text',
		'active_callback' => 'clothing_marketplace_is_banner_slider_section_enabled',
	)
);

// Banner Section - Banner Description.
$wp_customize->add_setting(
	'clothing_marketplace_banner_section_description',
	array(
		'default'           => '',
		'sanitize_callback' => 'sanitize_textarea_field',
	)
);

$wp_customize->add_control(
	'clothing_marketplace_banner_section_description',
	array(
		'label'           => sprintf( esc_html__( 'Description Text', 'clothing-marketplace' )),
		'section'         => 'clothing_marketplace_banner_section',
		'settings'        => 'clothing_marketplace_banner_section_description',
		'type'            => 'textarea',
		'active_callback' => 'clothing_marketplace_is_banner_slider_section_enabled',
	)
);

// Banner Section - Button Label.
$wp_customize->add_setting(
	'clothing_marketplace_banner_button_label_',
	array(
		'default'           => '',
		'sanitize_callback' => 'sanitize_text_field',
	)
);

$wp_customize->add_control(
	'clothing_marketplace_banner_button_label_',
	array(
		'label'           => sprintf( esc_html__( 'Button Text', 'clothing-marketplace' )),
		'section'         => 'clothing_marketplace_banner_section',
		'settings'        => 'clothing_marketplace_banner_button_label_',
		'type'            => 'text',
		'active_callback' => 'clothing_marketplace_is_banner_slider_section_enabled',
	)
);

// Banner Section - Button Link.
$wp_customize->add_setting(
	'clothing_marketplace_banner_button_link_' ,
	array(
		'default'           => '',
		'sanitize_callback' => 'esc_url_raw',
	)
);

$wp_customize->add_control(
	'clothing_marketplace_banner_button_link_' ,
	array(
		'label'           => sprintf( esc_html__( 'Button Link', 'clothing-marketplace' )  ),
		'section'         => 'clothing_marketplace_banner_section',
		'settings'        => 'clothing_marketplace_banner_button_link_' ,
		'type'            => 'url',
		'active_callback' => 'clothing_marketplace_is_banner_slider_section_enabled',
	)
);

$wp_customize->add_setting('clothing_marketplace_banner_background_image', array(
	'default'           => get_template_directory_uri() . '/resource/img/background.png',
    'sanitize_callback' => 'esc_url_raw',
));

$wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'clothing_marketplace_banner_background_image', array(
    'label' => __('Banner Background Image', 'clothing-marketplace'),
    'section' => 'clothing_marketplace_banner_section',
	'active_callback' => 'clothing_marketplace_is_banner_slider_section_enabled',
)));

$wp_customize->add_setting('clothing_marketplace_banner_section_image', array(
	'default' => get_template_directory_uri() . '/resource/img/default1.png',
    'sanitize_callback' => 'esc_url_raw',
));

$wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'clothing_marketplace_banner_section_image', array(
    'label' => __('Banner Image', 'clothing-marketplace'),
    'section' => 'clothing_marketplace_banner_section',
	'active_callback' => 'clothing_marketplace_is_banner_slider_section_enabled',
)));



// Discount Percentage
$wp_customize->add_setting('clothing_marketplace_banner_discount', [
	'default' => '',
    'sanitize_callback' => 'sanitize_text_field'
]);

$wp_customize->add_control('clothing_marketplace_banner_discount', [
	'label' => __('Discount Percentage (Example: 50%)', 'clothing-marketplace'),
    'section' => 'clothing_marketplace_banner_section',
    'type' => 'text',
	'active_callback' => 'clothing_marketplace_is_banner_slider_section_enabled',
]);

// Discount Label (UP TO)
$wp_customize->add_setting('clothing_marketplace_banner_discount_label', [
	'default' => '',
    'sanitize_callback' => 'sanitize_text_field'
]);

$wp_customize->add_control('clothing_marketplace_banner_discount_label', [
    'label' => __('Discount Label', 'clothing-marketplace'),
    'section' => 'clothing_marketplace_banner_section',
    'type' => 'text',
	'active_callback' => 'clothing_marketplace_is_banner_slider_section_enabled',
]);

// Discount OFF text
$wp_customize->add_setting('clothing_marketplace_banner_discount_off', [
	'default' => '',
    'sanitize_callback' => 'sanitize_text_field'
]);

$wp_customize->add_control('clothing_marketplace_banner_discount_off', [
    'label' => __('Discount OFF Text', 'clothing-marketplace'),
    'section' => 'clothing_marketplace_banner_section',
    'type' => 'text',
	'active_callback' => 'clothing_marketplace_is_banner_slider_section_enabled',
]);

// Bottom strip text
$wp_customize->add_setting('clothing_marketplace_banner_bottom_text', [
	'default' => '',
    'sanitize_callback' => 'sanitize_text_field'
]);

$wp_customize->add_control('clothing_marketplace_banner_bottom_text', [
	'label' => __('Free Shipping Text', 'clothing-marketplace'),
    'section' => 'clothing_marketplace_banner_section',
    'type' => 'text',
	'active_callback' => 'clothing_marketplace_is_banner_slider_section_enabled',
]);



// Banner Button Label Color
$wp_customize->add_setting(
	'clothing_marketplace_banner_btn_color',
	array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color',
	)
);
$wp_customize->add_control(new WP_Customize_Color_Control($wp_customize,'clothing_marketplace_banner_btn_color',array(
			'label' => __('Banner Button Label Color','clothing-marketplace'),
			'section' => 'clothing_marketplace_banner_section',
			'settings' => 'clothing_marketplace_banner_btn_color',
			'active_callback' => 'clothing_marketplace_is_banner_slider_section_enabled',
		)
	)
);

// Banner Button Background Color
$wp_customize->add_setting('clothing_marketplace_banner_btn_bg_color',array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color',
	)
);
$wp_customize->add_control(new WP_Customize_Color_Control($wp_customize,'clothing_marketplace_banner_btn_bg_color',array(
			'label' => __('Banner Button Background Color','clothing-marketplace'),
			'section' => 'clothing_marketplace_banner_section',
			'settings' => 'clothing_marketplace_banner_btn_bg_color',
			'active_callback' => 'clothing_marketplace_is_banner_slider_section_enabled',
		)
	)
);
// Banner Button Border Color
$wp_customize->add_setting(
	'clothing_marketplace_banner_btn_border_color',array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color',
	)
);
$wp_customize->add_control(new WP_Customize_Color_Control($wp_customize,'clothing_marketplace_banner_btn_border_color',array(
			'label' => __('Banner Button Border Color','clothing-marketplace'),
			'section' => 'clothing_marketplace_banner_section',
			'settings' => 'clothing_marketplace_banner_btn_border_color',
			'active_callback' => 'clothing_marketplace_is_banner_slider_section_enabled',
		)
	)
);


