<?php

$wp_customize->add_section(new constructionarc_Toggle_Section($wp_customize, 'constructionarc_team_section', array(
    'title'		=> 	esc_html__('Team Section','construction-arc'),
    'panel'		=> 'constructionarc_frontpage_settings',
    'priority'  => constructionarc_themes_get_section_position('constructionarc_team_section'),
    'hiding_control' => 'constructionarc_team_disable'
)));

//ENABLE/DISABLE TEAM MEMBER SECTION
$wp_customize->add_setting('constructionarc_team_disable', array(
	'default' => 'enable',
	'transport' => 'postMessage',
	'sanitize_callback' => 'constructionarc_themes_sanitize_switch',    
));
$wp_customize->add_control(new constructionarc_Switch_Control($wp_customize, 'constructionarc_team_disable', array(
	'label' => esc_html__('Section', 'construction-arc'),
	'section' => 'constructionarc_team_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_team_section_nav', array(
        'transport' => 'postMessage',
        'sanitize_callback' => 'wp_kses_post',
    ));
    $wp_customize->add_control(new constructionarc_Custom_Control_Tab($wp_customize, 'constructionarc_team_section_nav', array(
        'type' => 'tab',
        'section' => 'constructionarc_team_section',
        'priority' => 1,
        'buttons' => array(
            array(
                'name' => esc_html__('Content', 'construction-arc'),
                'fields' => array(
                    'constructionarc_team_section',
                    'constructionarc_team_super_title',
                    'constructionarc_team_title',
                    'constructionarc_team_title_style_heading',
                    'constructionarc_team_title_style',
                    'constructionarc_team_title_align',
                    'constructionarc_team_type_heading',
                    'constructionarc_team_type',
                    'constructionarc_team',
                    'constructionarc_team_advance',
                    'constructionarc_team_style',
                    'constructionarc_team_block_height',
                    'constructionarc_team_display_style',
                ),
                'active' => true,
            ),
            array(
                'name' => esc_html__('Style', 'construction-arc'),
                'fields' => array(
                ),
            ),
            array(
                'name' => esc_html__('Advanced', 'construction-arc'),
                'fields' => array(
                    'constructionarc_team_bg_type',
                    'constructionarc_team_bg_color',
                    'constructionarc_team_bg_image',
                    'constructionarc_team_overlay_color',
                    'constructionarc_team_padding',
                    'constructionarc_team_cs_seperator',
                ),
            ),
        ),
    )));

    $wp_customize->add_setting( 'constructionarc_team_super_title', array(
        'transport' => 'postMessage',
        'sanitize_callback' => 'sanitize_text_field'			
    ) );
    $wp_customize->add_control( 'constructionarc_team_super_title', array(
        'label'    => esc_html__( 'Super Title', 'construction-arc' ),
        'section'  => 'constructionarc_team_section',
        'type'     => 'text',
    ));

    $wp_customize->add_setting( 'constructionarc_team_title', array(
        'transport' => 'postMessage',
        'sanitize_callback' => 'sanitize_text_field'			
    ) );
    $wp_customize->add_control( 'constructionarc_team_title', array(
        'label'    => esc_html__( 'Title', 'construction-arc' ),
        'section'  => 'constructionarc_team_section',
        'type'     => 'text',
    ));

    $wp_customize->add_setting('constructionarc_team_title_align', array(
        'default' => 'text-center',
        'sanitize_callback' => 'constructionarc_themes_sanitize_select',
        'transport' => 'postMessage'
    ));
    $wp_customize->add_control(
        new constructionarc_Custom_Control_Buttonset( $wp_customize, 'constructionarc_team_title_align',
            array(
                'choices'  => array(
                    'text-left' => esc_html__('Left', 'construction-arc'),
                    'text-center' => esc_html__('Center', 'construction-arc'),
                    'text-right' => esc_html__('Right', 'construction-arc'),
                ),
                'label'    => esc_html__( 'Alignment', 'construction-arc' ),
                'section'  => 'constructionarc_team_section',
            )
        )
    );
  
    $wp_customize->add_setting('constructionarc_team_title_style_heading', array(
        'sanitize_callback' => 'sanitize_text_field',
        'transport' => 'postMessage',
    ));
    $wp_customize->add_control(new constructionarc_Customize_Heading($wp_customize, 'constructionarc_team_title_style_heading', array(
        'section' => 'constructionarc_team_section',
        'label' => esc_html__('Section Title Style', 'construction-arc')
    )));

    $wp_customize->add_setting('constructionarc_team_title_style', array(
        'default' => 'style1',
        'transport' => 'postMessage',
        'sanitize_callback' => 'constructionarc_themes_sanitize_select'         
    ));
    $wp_customize->add_control('constructionarc_team_title_style', array(
        'section' => 'constructionarc_team_section',
        'type'    => 'select',
        'choices' => array(
            'style1' => esc_html__('Style 1','construction-arc'),
            'style2' => esc_html__('Style 2','construction-arc'),			
            'style3' => esc_html__('Style 3','construction-arc'),			
        )
    ));

    $wp_customize->add_setting('constructionarc_team_type_heading', array(
        'sanitize_callback' => 'sanitize_text_field',
        'transport' => 'postMessage',
    ));
    $wp_customize->add_control(new constructionarc_Customize_Heading($wp_customize, 'constructionarc_team_type_heading', array(
        'section' => 'constructionarc_team_section',
        'label' => esc_html__('Select Type', 'construction-arc')
    )));
    
    $wp_customize->add_setting('constructionarc_team_type', array(
        'default' => 'default',
        'transport' => 'postMessage',
        'sanitize_callback' => 'constructionarc_themes_sanitize_select'
    ));
    $wp_customize->add_control('constructionarc_team_type', array(
        'section' => 'constructionarc_team_section',
        'type' => 'radio',
        'choices' => array(
            'default' => esc_html__('Default', 'construction-arc'),
            'advance' => esc_html__('Advanced', 'construction-arc')
        )
    ));
  
    $wp_customize->add_setting('constructionarc_team', array(
        'transport' => 'postMessage',
        'sanitize_callback' => 'constructionarc_themes_sanitize_repeater',	
        'default' => json_encode(array(
            array(
                'team_page'   => '',
                'teamimage'   => '',
                'designation' =>'',
                'facebook'    =>'',
                'twitter'     =>'',
                'linkedin'    =>'',
                'instagram'   => '',
            )
        ))
    ));
    $wp_customize->add_control(new constructionarc_Themes_Repeater_Control( $wp_customize, 'constructionarc_team', array(
            'label' 	   => esc_html__('Default Team Settings', 'construction-arc'),
            'section' 	   => 'constructionarc_team_section',
            'settings' 	   => 'constructionarc_team',
            'box_label' => esc_html__('Team Item', 'construction-arc'),
            'add_label' => esc_html__('Add New', 'construction-arc'),
            'limit' => 6,
        ),
        array(
            'team_page' => array(
                'type'    => 'select',
                'label'   => esc_html__('Select Page', 'construction-arc'),
                'options' => $pages
            ),
            'teamimage' => array(
                'type' => 'upload',
                'label' => esc_html__("Upload Image (Only Work Style 2)", 'construction-arc'),
            ),
            'designation' => array(
                'type'    => 'text',
                'label'   => esc_html__('Designation', 'construction-arc'),
                'default' => ''
            ),
            'facebook'  => array(
                'type'   => 'url',
                'label'  => esc_html__('Facebook Link', 'construction-arc'),
                'default' => ''
            ),
            'twitter' 	=> array(
                'type'    => 'url',
                'label'   => esc_html__('Twitter Link', 'construction-arc'),
                'default' => ''
            ),
            'linkedin'   => array(
                'type'    => 'url',
                'label'   => esc_html__('Linkedin Link', 'construction-arc'),
                'default' => ''
            ),
            'instagram' => array(
                'type'    => 'url',
                'label'   => esc_html__('Instagram Link', 'construction-arc'),
                'default' => ''
            )
        )
    ));
   
    $wp_customize->add_setting('constructionarc_team_advance', array(
        'transport' => 'postMessage',
        'sanitize_callback' => 'constructionarc_themes_sanitize_repeater',	
        'default' => json_encode(array(
            array(
                'team_image'     => '',
                'teamimage'   => '',
                'team_title'     => '',
                'team_designation' =>'',
                'team_desc'      => '',
                'team_url'       => '',
                'facebook'       =>'',
                'twitter'        =>'',
                'linkedin'       =>'',
                'instagram'      => '',
                'alignment'      => 'center',
            )
        ))
    ));
    $wp_customize->add_control(new constructionarc_Themes_Repeater_Control( $wp_customize, 'constructionarc_team_advance', array(
            'label' 	   => esc_html__('Advance Team Settings', 'construction-arc'),
            'section' 	   => 'constructionarc_team_section',
            'settings' 	   => 'constructionarc_team_advance',
            'box_label' => esc_html__('Team Item', 'construction-arc'),
            'add_label' => esc_html__('Add New', 'construction-arc'),
            'limit' => 6,
        ),
        array(
            'team_image' => array(
                'type' => 'upload',
                'label' => esc_html__("Upload Image", 'construction-arc'),
            ),
            'teamimage' => array(
                'type' => 'upload',
                'label' => esc_html__("Upload Image (Only Work Style 2)", 'construction-arc'),
            ),
            'team_title' => array(
                'type' => 'text',
                'label' => esc_html__("Title", 'construction-arc'),
            ),
            'team_designation' => array(
                'type'    => 'text',
                'label'   => esc_html__('Designation', 'construction-arc'),
                'default' => ''
            ),
            'team_desc' => array(
                'type' => 'textarea',
                'label' => esc_html__("Short Description", 'construction-arc'),
            ),
            'team_url' => array(
                'type' => 'url',
                'label' => esc_html__('Details Url', 'construction-arc'),
                'default' => ''
            ),
            'facebook'  => array(
                'type'   => 'url',
                'label'  => esc_html__('Facebook Link', 'construction-arc'),
                'default' => ''
            ),
            'twitter' 	=> array(
                'type'    => 'url',
                'label'   => esc_html__('Twitter Link', 'construction-arc'),
                'default' => ''
            ),
            'linkedin'   => array(
                'type'    => 'url',
                'label'   => esc_html__('Linkedin Link', 'construction-arc'),
                'default' => ''
            ),
            'instagram' => array(
                'type'    => 'url',
                'label'   => esc_html__('Instagram Link', 'construction-arc'),
                'default' => ''
            ),
            'alignment' => array(
                'type' => 'select',
                'default' => 'center',
                'label' => esc_html__('Alignment', 'construction-arc'),
                'options' => array(
                    'start' => esc_html__('Left', 'construction-arc'),
                    'center' => esc_html__('Center', 'construction-arc'),
                    'end' => esc_html__('Right', 'construction-arc')
                )
            ),
        )
    ));
   
    $wp_customize->add_setting('constructionarc_team_style', array(
        'sanitize_callback' => 'constructionarc_themes_sanitize_options',
        'default' => 'style2',
        'transport' => 'postMessage'
    ));
    $wp_customize->add_control(new constructionarc_Selector($wp_customize, 'constructionarc_team_style', array(
        'section' => 'constructionarc_team_section',
        'label' => esc_html__('Choose Style', 'construction-arc'),
        'options' => array(
            'style1' => get_template_directory_uri() . '/inc/customizer/images/team-style1.webp',
            'style2' => get_template_directory_uri() . '/inc/customizer/images/team-style3.webp',
            'style3' => get_template_directory_uri() . '/inc/customizer/images/team-style5.webp',
        )
    )));

    $wp_customize->add_setting('constructionarc_team_block_height', array(
        'sanitize_callback' => 'absint',
        'default' => 470,
        'transport' => 'postMessage'
    ));
    $wp_customize->add_control(new constructionarc_Themes_Range_Control($wp_customize, 'constructionarc_team_block_height', array(
        'section' => 'constructionarc_team_section',
        'label' => esc_html__('Team Block Height (PX)', 'construction-arc'),
        'input_attrs' => array(
            'min' => 300,
            'max' => 900,
            'step' => 1,
        )
    )));

    $wp_customize->add_setting('constructionarc_team_display_style', array(
        'default' => 'grid',
        'transport' => 'postMessage',
        'sanitize_callback' => 'constructionarc_themes_sanitize_select'         
    ));
    $wp_customize->add_control('constructionarc_team_display_style', array(
        'section' => 'constructionarc_team_section',
        'type'    => 'select',
        'label' => esc_html__('Display Style', 'construction-arc'),
        'choices' => array(
            'grid' => esc_html__('Grid','construction-arc'),
            'slide' => esc_html__('Slide','construction-arc'),			
        )
    ));

    $wp_customize->add_setting('constructionarc_pro_team', array(
        'sanitize_callback' => 'constructionarc_sanitize_text'
    ));
    $wp_customize->add_control(new constructionarc_Themes_Upgrade_Text($wp_customize, 'constructionarc_pro_team', array(
        'section' => 'constructionarc_team_section',
        'label' => esc_html__('For More Settings,', 'construction-arc'),
        'choices' => array(
            esc_html__('(6+) Different Layout & Settings', 'construction-arc'),
            esc_html__('Add Unlimited Team Items', 'construction-arc'),
            esc_html__('(5+) Different Section Title Style', 'construction-arc'),
            esc_html__('Advanced Team Items Settings', 'construction-arc'),
            esc_html__('More Icon Settings ( Background Color/Color/Border Color/Border Width & Padding )', '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_team_options_refresh", array (
    'settings' => array(
        'constructionarc_team_disable',
        'constructionarc_team_type',
        'constructionarc_team',
        'constructionarc_team_advance',
        'constructionarc_team_style',
        'constructionarc_team_display_style',
    ),
    'selector' => "#team-section",
    'fallback_refresh' => true,
    'container_inclusive' => true,
    'render_callback' => function () {
        return get_template_part( 'section/section-team' );
    }
));