<?php
/**
 * About Us Section 
*/
$wp_customize->add_section(new constructionarc_Toggle_Section($wp_customize, 'constructionarc_aboutus_section', array(
	'title'		=>	esc_html__('About Us Section','construction-arc'),
	'panel'		=> 'constructionarc_frontpage_settings',
	'priority'  => constructionarc_themes_get_section_position('constructionarc_aboutus_section'),
	'hiding_control' => 'constructionarc_aboutus_disable'
)));

//ENABLE/DISABLE ABOUT US SECTION
$wp_customize->add_setting('constructionarc_aboutus_disable', array(
	'default' => 'enable',
	'transport' => 'postMessage',
	'sanitize_callback' => 'constructionarc_themes_sanitize_switch',    
));
$wp_customize->add_control(new constructionarc_Switch_Control($wp_customize, 'constructionarc_aboutus_disable', array(
	'label' => esc_html__('Section', 'construction-arc'),
	'section' => 'constructionarc_aboutus_section',
	'switch_label' => array(
		'enable' => esc_html__('Enable', 'construction-arc'),
		'disable' => esc_html__('Disable', 'construction-arc'),
	),
	'class' => 'switch-section',
    'priority' => -1,
)));

$wp_customize->add_setting('constructionarc_about_nav', array(
	'transport' => 'postMessage',
	'sanitize_callback' => 'wp_kses_post',
));
$wp_customize->add_control(new constructionarc_Custom_Control_Tab($wp_customize, 'constructionarc_about_nav', array(
	'type' => 'tab',
	'section' => 'constructionarc_aboutus_section',
	'priority' => 1,
	'buttons' => array(
		array(
			'name' => esc_html__('Content', 'construction-arc'),
			'fields' => array(
				'constructionarc_aboutus_layout_design',
				'constructionarc_aboutus_super_title',
				'constructionarc_about',
				'constructionarc_about_image',
				'constructionarc_about_video_link',
				'constructionarc_progressbar_heading',
				'constructionarc_progress',
				'constructionarc_progressbar_item',
				'constructionarc_aboutus_button_text',
				'constructionarc_about_readmore_link',
				'constructionarc_more_about_us',
				'constructionarc_aboutus_content_length',
				'constructionarc_aboutus_profile_name',
				'constructionarc_aboutus_profile_role',
				'constructionarc_aboutus_profile_image',
				'constructionarc_aboutus_signature',
			),
			'active' => true,
		),
		array(
			'name' => esc_html__('Style', 'construction-arc'),
			'fields' => array(
				
			),
		),
		array(
			'name' => esc_html__('Advanced', 'construction-arc'),
			'fields' => array(
				'constructionarc_aboutus_bg_type',
				'constructionarc_aboutus_bg_color',
				'constructionarc_aboutus_bg_image',
				'constructionarc_aboutus_overlay_color',
				'constructionarc_aboutus_padding',
				'constructionarc_aboutus_cs_seperator',
			),
		),
	),
)));

	$wp_customize->add_setting( 'constructionarc_aboutus_super_title', array(
		'sanitize_callback' => 'sanitize_text_field', 	 
		'transport' => 'postMessage'
	));

	$wp_customize->add_control('constructionarc_aboutus_super_title', array(
		'label'		=> esc_html__( 'Super Title', 'construction-arc' ),
		'section'	=> 'constructionarc_aboutus_section',
		'type'      => 'text',
	));

	$wp_customize->add_setting( 'constructionarc_about', array(
		'transport' => 'postMessage',
		'sanitize_callback' => 'absint'			
	) );
	$wp_customize->add_control( 'constructionarc_about', array(
		'label'    => esc_html__( 'Select Page ', 'construction-arc' ),
		'section'  => 'constructionarc_aboutus_section',
		'type'     => 'dropdown-pages'
	));
	
	$wp_customize->add_setting('constructionarc_about_image', array(
		'transport' => 'postMessage',
		'sanitize_callback'	=> 'esc_url_raw'		
	));
	$wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'constructionarc_about_image', array(
		'label'	   => esc_html__('Upload Feature Image','construction-arc'),
		'section'  => 'constructionarc_aboutus_section',
	)));

	$wp_customize->add_setting( 'constructionarc_aboutus_button_text', array(
		'default'           => esc_html__( 'More About Us','construction-arc' ),
		'transport' => 'postMessage',
		'sanitize_callback' => 'sanitize_text_field'			
	) );
	$wp_customize->add_control( 'constructionarc_aboutus_button_text', array(
		'label'    => esc_html__( 'Button Text', 'construction-arc' ),
		'section'  => 'constructionarc_aboutus_section',
		'type'     => 'text',
	));

	$wp_customize->add_setting('constructionarc_about_readmore_link', array(
		'transport' => 'postMessage',
		'sanitize_callback'	=> 'esc_url_raw'		
	));
	$wp_customize->add_control('constructionarc_about_readmore_link', array(
		'label'	   => esc_html__('Read More Link','construction-arc'),
		'section'  => 'constructionarc_aboutus_section',
		'type'	   => 'url',
	));

	$wp_customize->add_setting('constructionarc_about_video_link', array(
		'transport' => 'postMessage',
		'sanitize_callback'	=> 'esc_url_raw'		
	));
	$wp_customize->add_control('constructionarc_about_video_link', array(
		'label'	   => esc_html__('Youtube Video Link','construction-arc'),
		'section'  => 'constructionarc_aboutus_section',
		'type'	   => 'url',
	));

	$wp_customize->add_setting('constructionarc_aboutus_layout_design', array(
		'default' => 'layouttwo',
		'transport' => 'postMessage',
		'sanitize_callback' => 'constructionarc_themes_sanitize_options'
	));
	$wp_customize->add_control(new constructionarc_Selector($wp_customize, 'constructionarc_aboutus_layout_design', array(
		'section' => 'constructionarc_aboutus_section',
		'label' => esc_html__('Select Layout', 'construction-arc'),
		'options' => array(
			'layoutone' => get_template_directory_uri() . '/inc/customizer/images/cover-image-left.webp',
			'layouttwo' => get_template_directory_uri() . '/inc/customizer/images/cover-image-right.webp',
			'layoutthree' => get_template_directory_uri() . '/inc/customizer/images/cover-image-center.webp',
		)
	)));

	/** Progress Bar */
	$wp_customize->add_setting('constructionarc_progressbar_heading', array(
        'sanitize_callback' => 'sanitize_text_field',
        'transport' => 'postMessage',
    ));
    $wp_customize->add_control(new constructionarc_Customize_Heading($wp_customize, 'constructionarc_progressbar_heading', array(
        'section' => 'constructionarc_aboutus_section',
        'label' => esc_html__('Progress Bar Settings', 'construction-arc')
    )));

	$wp_customize->add_setting('constructionarc_progress', array(
		'default' => 'disable',
		'transport' => 'postMessage',
		'sanitize_callback' => 'constructionarc_themes_sanitize_switch',     
	));
	$wp_customize->add_control(new constructionarc_Switch_Control($wp_customize, 'constructionarc_progress', array(
		'label' => esc_html__('Progress Bar', 'construction-arc'),
		'section' => 'constructionarc_aboutus_section',
		'switch_label' => array(
			'enable' => esc_html__('Show', 'construction-arc'),
			'disable' => esc_html__('Hide', 'construction-arc'),
		),
	)));

	$wp_customize->add_setting('constructionarc_progressbar_item', array(
		'sanitize_callback' => 'constructionarc_themes_sanitize_repeater',		
		'transport' => 'postMessage',
		'default' => json_encode(array(
			array(
				'progressbar_title'  =>'',
				'progressbar_number'  =>'',
				'progressbar_color'  =>'',       
			)
		))
	));
	$wp_customize->add_control(new constructionarc_Themes_Repeater_Control($wp_customize, 'constructionarc_progressbar_item', 
		array(
			'label' 	   => esc_html__('Progress Bar Item', 'construction-arc'),
			'section' 	   => 'constructionarc_aboutus_section',
			'box_label' => esc_html__('Progress Item', 'construction-arc'),
			'add_label' => esc_html__('Add New', 'construction-arc'),
			'limit' => 3,
		),
		array(
			'progressbar_title' => array(
				'type' => 'text',
				'label' => esc_html__('Title', 'construction-arc'),
				'default' => ''
			),
			'progressbar_number' => array(
				'type' => 'number',
				'label' => esc_html__('Number(%)', 'construction-arc'),
				'default' => ''
			),
			'progressbar_color' => array(
				'type' => 'colorpicker',
				'label' => esc_html__('Background Color', 'construction-arc'),
				'default' => ''
			),
		)
	));

	$wp_customize->add_setting('constructionarc_more_about_us', array(
		'sanitize_callback' => 'constructionarc_themes_sanitize_repeater',		
		'transport' => 'postMessage',
		'default' => json_encode(array(
			array(
				'aboutus_icon' => '',
				'aboutus_title'  =>'',
				'aboutus_desc'  =>''          
			)
		))
	));
	$wp_customize->add_control(new constructionarc_Themes_Repeater_Control($wp_customize, 'constructionarc_more_about_us', 
		array(
			'label' 	   => esc_html__('More About Us Item', 'construction-arc'),
			'section' 	   => 'constructionarc_aboutus_section',
			'box_label' => esc_html__('About Item', 'construction-arc'),
			'add_label' => esc_html__('Add New', 'construction-arc'),
			'limit' => 4,
		),
		array(
			'aboutus_icon' => array(
				'type' => 'icon',
				'label' => esc_html__('Icon', 'construction-arc'),
				'default' => ''
			),
			'aboutus_title' => array(
				'type' => 'text',
				'label' => esc_html__('Title', 'construction-arc'),
				'default' => ''
			),
			'aboutus_desc' => array(
				'type' => 'text',
				'label' => esc_html__('Description', 'construction-arc'),
				'default' => ''
			)
		)
	));





	$wp_customize->add_setting( 'constructionarc_aboutus_profile_image', array(
		'sanitize_callback' => 'sanitize_text_field', 	 
		'transport' => 'postMessage'
	));
	$wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'constructionarc_aboutus_profile_image', array(
		'label'	   => esc_html__('Upload Profile Image','construction-arc'),
		'section'  => 'constructionarc_aboutus_section',
	)));

	$wp_customize->add_setting( 'constructionarc_aboutus_profile_name', array(
		'sanitize_callback' => 'sanitize_text_field', 	 
		'transport' => 'postMessage'
	));
	$wp_customize->add_control('constructionarc_aboutus_profile_name', array(
		'label'		=> esc_html__( 'Profile Name', 'construction-arc' ),
		'section'	=> 'constructionarc_aboutus_section',
		'type'      => 'text',
		'priority' => 10
	));
	
	$wp_customize->add_setting( 'constructionarc_aboutus_profile_role', array(
		'sanitize_callback' => 'sanitize_text_field', 	
		'transport' => 'postMessage'
	));
	$wp_customize->add_control('constructionarc_aboutus_profile_role', array(
		'label'		=> esc_html__( 'Designation', 'construction-arc' ),
		'section'	=> 'constructionarc_aboutus_section',
		'type'      => 'text',
		'priority' => 10
	));

	$wp_customize->add_setting('constructionarc_aboutus_signature', array(
		'transport' => 'postMessage',
		'priority' => 10,
		'sanitize_callback'	=> 'esc_url_raw'		
	));
	$wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'constructionarc_aboutus_signature', array(
		'label'	   => esc_html__('Signature Image','construction-arc'),
		'section'  => 'constructionarc_aboutus_section',
	)));

	$wp_customize->add_setting('constructionarc_pro_aboutus', array(
		'sanitize_callback' => 'constructionarc_sanitize_text'
	));
	$wp_customize->add_control(new constructionarc_Themes_Upgrade_Text($wp_customize, 'constructionarc_pro_aboutus', array(
		'section' => 'constructionarc_aboutus_section',
		'label' => esc_html__('For More Settings,', 'construction-arc'),
		'choices' => array(
			esc_html__('More Settings and Layouts', 'construction-arc'),
			esc_html__('Text Alignment Options', 'construction-arc'),
			esc_html__('Progress Bar Layout & Settings', 'construction-arc'),
			esc_html__('Achievement Layout & Settings', 'construction-arc'),
			esc_html__('Video Link & button settings', 'construction-arc'),
			esc_html__('Title, sub title & text color options', 'construction-arc'),
			esc_html__('4+ Different Background Options( Color/Video/Gradient/Image ) ', 'construction-arc'),
			esc_html__('More Than 35+ Top & Bottom Separator Shape Illustrator with Color & Height Option', 'construction-arc'),
		),
		'priority' => 250,
	)));

	$wp_customize->selective_refresh->add_partial( "constructionarc_aboutus_settings", array (
		'settings' => array( 
			'constructionarc_aboutus_disable',
			'constructionarc_about',
			'constructionarc_about_image',
			'constructionarc_about_readmore_link',
			'constructionarc_about_video_link',
			'constructionarc_progress',
			'constructionarc_progressbar_item',
			'constructionarc_aboutus_super_title',
			'constructionarc_more_about_us',
			'constructionarc_aboutus_profile_image',
			'constructionarc_aboutus_profile_name',
			'constructionarc_aboutus_profile_role',
			'constructionarc_aboutus_signature',
		),
		'selector' => "#aboutus-section",
		'fallback_refresh' => true,
		'container_inclusive' => true,
		'render_callback' => function () {
			return get_template_part( 'section/section-aboutus' );
		}
	));