<?php
function hotel_26_general_setting( $wp_customize )
{
    $selective_refresh = isset($wp_customize->selective_refresh) ? 'postMessage' : 'refresh';
    $wp_customize->add_panel(
        'hotel_26_general', array(
        'priority' => 31,
        'title' => esc_html__('General', 'hotel-26'),
        )
    );
    
    
    
    /*=========================================
    Scroller
    =========================================*/
    $wp_customize->add_section(
        'top_scroller', array(
        'title' => esc_html__('Scroller', 'hotel-26'),
        'priority' => 4,
        'panel' => 'hotel_26_general',
        )
    );
    
    $wp_customize->add_setting( 
        'hs_scroller', 
        array(
        'default' => '1',
        'sanitize_callback' => 'hotel_26_sanitize_checkbox',
        'capability' => 'edit_theme_options',
        'priority' => 1,
        ) 
    );
    
    $wp_customize->add_control(
        'hs_scroller', 
        array(
        'label'          => esc_html__('Hide / Show Scroller', 'hotel-26'),
        'section'     => 'top_scroller',
        'type'        => 'checkbox'
        ) 
    );
    
    if(function_exists('cleverfox_activate')) :
        // Scroller icon // 
        $wp_customize->add_setting(
            'scroller_icon',
            array(
            'default' => 'fa-arrow-up',
            'sanitize_callback' => 'sanitize_text_field',
            'capability' => 'edit_theme_options',
            )
        );    

        $wp_customize->add_control(
            new Hotel_26_Icon_Picker_Control(
                $wp_customize, 
                'scroller_icon',
                array(
                'label'           => __('Scroller Icon', 'hotel-26'),
                'section'         => 'top_scroller',
                'iconset' => 'fa',
            
                )
            )  
        );
        //Pro feature
        cleverfox_themes_section_upgrade_control(
            $wp_customize, array(
            'theme_slug' => 'hotel_26_',
            'setting_id' => 'top_scroller_locked',
            'section'    => 'top_scroller',
            'pro_url'    => hotel_26_premium_links(),
            'custom_text'    => __('Unlock With Pro', 'hotel-26'),
            ) 
        );
    endif;
    /*=========================================
    Breadcrumb  Section
    =========================================*/
    $wp_customize->add_section(
        'breadcrumb_setting', array(
        'title' => esc_html__('Breadcrumb', 'hotel-26'),
        'priority' => 12,
        'panel' => 'hotel_26_general',
        )
    );
    
    // Settings
    $wp_customize->add_setting(
        'breadcrumb_settings',
        array(
        'capability'         => 'edit_theme_options',
        'sanitize_callback' => 'hotel_26_sanitize_text',
        'priority' => 1,
        )
    );

    $wp_customize->add_control(
        'breadcrumb_settings',
        array(
        'type' => 'hidden',
        'label' => __('Settings', 'hotel-26'),
        'section' => 'breadcrumb_setting',
        )
    );
    
    // Breadcrumb Hide/ Show Setting // 
    $wp_customize->add_setting( 
        'hs_breadcrumb', 
        array(
        'default' => '1',
        'sanitize_callback' => 'hotel_26_sanitize_checkbox',
        'capability' => 'edit_theme_options',
        'priority' => 2,
        ) 
    );
    
    $wp_customize->add_control(
        'hs_breadcrumb', 
        array(
        'label'          => esc_html__('Hide / Show Section', 'hotel-26'),
        'section'     => 'breadcrumb_setting',
        'type'        => 'checkbox'
        ) 
    );
    
    // enable Effect
    $wp_customize->add_setting(
        'breadcrumb_effect_enable',
        array(
        'default' => '1',
        'capability'         => 'edit_theme_options',
        'sanitize_callback' => 'hotel_26_sanitize_checkbox',
        'priority' => 4,
        )
    );

    $wp_customize->add_control(
        'breadcrumb_effect_enable',
        array(
        'type' => 'checkbox',
        'label' => __('Enable Ken Burn Effect ?', 'hotel-26'),
        'section' => 'breadcrumb_setting',
        )
    );
    
    if (class_exists('Cleverfox_Customizer_Range_Slider_Control') ) {
        // Breadcrumb Content Section // 
        $wp_customize->add_setting(
            'breadcrumb_contents',
            array(
            'capability'         => 'edit_theme_options',
            'sanitize_callback' => 'hotel_26_sanitize_text',
            'priority' => 5,
            )
        );

        $wp_customize->add_control(
            'breadcrumb_contents',
            array(
            'type' => 'hidden',
            'label' => __('Content', 'hotel-26'),
            'section' => 'breadcrumb_setting',
            )
        );
    
        // Content size // 
        $wp_customize->add_setting(
            'breadcrumb_padding_top',
            array(
            'default' => 80,
            'capability'         => 'edit_theme_options',
            'sanitize_callback' => 'hotel_26_sanitize_range_value',
            'transport'         => 'postMessage',
            'priority' => 8,
            )
        );
        $wp_customize->add_control( 
            new Cleverfox_Customizer_Range_Slider_Control(
                $wp_customize, 'breadcrumb_padding_top', 
                array(
                'label'      => __('Padding top', 'hotel-26'),
                'section'  => 'breadcrumb_setting',
                'input_attrs' => array(
                'min'    => 1,
                'max'    => 1000,
                'step'   => 1,
                //'suffix' => 'px', //optional suffix
                ),
                ) 
            ) 
        );
            
        $wp_customize->add_setting(
            'breadcrumb_padding_bottom',
            array(
            'default' => 115,
            'capability'         => 'edit_theme_options',
            'sanitize_callback' => 'hotel_26_sanitize_range_value',
            'transport'         => 'postMessage',
            'priority' => 8,
            )
        );
        $wp_customize->add_control( 
            new Cleverfox_Customizer_Range_Slider_Control(
                $wp_customize, 'breadcrumb_padding_bottom', 
                array(
                'label'      => __('Padding Bottom', 'hotel-26'),
                'section'  => 'breadcrumb_setting',
                'input_attrs' => array(
                'min'    => 1,
                'max'    => 1000,
                'step'   => 1,
                //'suffix' => 'px', //optional suffix
                ),
                ) 
            ) 
        );
    }    
        
    // Background // 
    $wp_customize->add_setting(
        'breadcrumb_bg_head',
        array(
        'capability'         => 'edit_theme_options',
        'sanitize_callback' => 'hotel_26_sanitize_text',
        'priority' => 9,
        )
    );

    $wp_customize->add_control(
        'breadcrumb_bg_head',
        array(
        'type' => 'hidden',
        'label' => __('Background', 'hotel-26'),
        'section' => 'breadcrumb_setting',
        )
    );
    
    // Background Image // 
    $wp_customize->add_setting( 
        'breadcrumb_bg_img', 
        array(
        'default'             => esc_url(get_template_directory_uri() .'/assets/images/breadcrumb/img1.jpg'),
        'capability'         => 'edit_theme_options',
        'sanitize_callback' => 'hotel_26_sanitize_url',    
        'priority' => 10,
        ) 
    );
    
    $wp_customize->add_control(
        new WP_Customize_Image_Control(
            $wp_customize, 'breadcrumb_bg_img',
            array(
            'label'          => esc_html__('Background Image', 'hotel-26'),
            'section'        => 'breadcrumb_setting',
            ) 
        )
    );
    
    if(function_exists('cleverfox_activate')) :
        // Background Attachment // 
        $wp_customize->add_setting( 
            'breadcrumb_back_attach', 
            array(
            'default' => 'scroll',
            'capability'     => 'edit_theme_options',
            'sanitize_callback' => 'hotel_26_sanitize_select',
            'priority'  => 10,
            ) 
        );
    
        $wp_customize->add_control(
            'breadcrumb_back_attach', 
            array(
            'label'          => __('Background Attachment', 'hotel-26'),
            'section'        => 'breadcrumb_setting',
            'type'           => 'select',
            'choices'        => 
            array(
            'inherit' => __('Inherit', 'hotel-26'),
            'scroll' => __('Scroll', 'hotel-26'),
            'fixed'   => __('Fixed', 'hotel-26')
            ) 
            ) 
        );
    
        //Pro feature
        cleverfox_themes_section_upgrade_control(
            $wp_customize, array(
            'theme_slug' => 'hotel_26_',
            'setting_id' => 'breadcrumb_locked',
            'section'    => 'breadcrumb_setting',
            'pro_url'    => hotel_26_premium_links(),
            'custom_text'    => __('Unlock With Pro', 'hotel-26'),
            ) 
        );

        /*=========================================
        Hotel 26 Container
        =========================================*/
        $wp_customize->add_section(
            'hotel_26_container',
            array(
            'priority'      => 2,
            'title'         => __('Container', 'hotel-26'),
            'panel'          => 'hotel_26_general',
            )
        );
    
        if (class_exists('Cleverfox_Customizer_Range_Slider_Control') ) {
             //container width
            $wp_customize->add_setting(
                'hotel_26_site_cntnr_width',
                array(
                'default'            => '1320',
                'capability'         => 'edit_theme_options',
                'sanitize_callback' => 'hotel_26_sanitize_range_value',
                'transport'         => 'postMessage',
                'priority'      => 1,
                )
            );
            $wp_customize->add_control( 
                new Cleverfox_Customizer_Range_Slider_Control(
                    $wp_customize, 'hotel_26_site_cntnr_width', 
                    array(
                    'label'      => __('Container Width', 'hotel-26'),
                    'section'  => 'hotel_26_container',
                    'input_attrs' => array(
                    'min'           => 768,
                    'max'           => 2000,
                    'step'          => 1,
                    //'suffix' => 'px', //optional suffix
                    ),
                    ) 
                ) 
            );
        
             //Pro feature
            cleverfox_themes_section_upgrade_control(
                $wp_customize, array(
                'theme_slug' => 'hotel_26_',
                'setting_id' => 'container_locked',
                'section'    => 'hotel_26_container',
                'pro_url'    => hotel_26_premium_links(),
                'custom_text'    => __('Unlock With Pro', 'hotel-26'),
                ) 
            );
        }
    
        /*=========================================
        Hotel 26 Sidebar
        =========================================*/
        if (class_exists('Cleverfox_Customizer_Range_Slider_Control') ) {
            $wp_customize->add_section(
                'hotel_26_sidebar',
                array(
                'priority'      => 8,
                'title'         => __('Sidebar', 'hotel-26'),
                'panel'          => 'hotel_26_general',
                )
            );
    
            //  Pages Layout // 
            $wp_customize->add_setting(
                'hotel_26_pages_sidebar',
                array(
                'capability'         => 'edit_theme_options',
                'sanitize_callback' => 'hotel_26_sanitize_text',
                'priority' => 1,
                )
            );

            $wp_customize->add_control(
                'hotel_26_pages_sidebar',
                array(
                'type' => 'hidden',
                'label' => __('Sidebar Layout', 'hotel-26'),
                'section' => 'hotel_26_sidebar',
                )
            );
    
            // Default Page
            $wp_customize->add_setting( 
                'hotel_26_default_pg_sidebar', 
                array(
                'default' => 'right_sidebar',
                'capability'     => 'edit_theme_options',
                'sanitize_callback' => 'hotel_26_sanitize_select',
                'priority' => 2,
                ) 
            );

            $wp_customize->add_control(
                'hotel_26_default_pg_sidebar', 
                array(
                'label'          => __('Default Page Sidebar Option', 'hotel-26'),
                'section'        => 'hotel_26_sidebar',
                'type'           => 'select',
                'choices'        => 
                array(
                'left_sidebar'     => __('Left Sidebar', 'hotel-26'),
                'right_sidebar'     => __('Right Sidebar', 'hotel-26'),
                'no_sidebar'     => __('No Sidebar', 'hotel-26'),
                ) 
                ) 
            );
    
            // Archive Page
            $wp_customize->add_setting( 
                'hotel_26_archive_pg_sidebar', 
                array(
                'default' => 'right_sidebar',
                'capability'     => 'edit_theme_options',
                'sanitize_callback' => 'hotel_26_sanitize_select',
                'priority' => 3,
                ) 
            );

            $wp_customize->add_control(
                'hotel_26_archive_pg_sidebar', 
                array(
                'label'          => __('Archive Page Sidebar Option', 'hotel-26'),
                'section'        => 'hotel_26_sidebar',
                'type'           => 'select',
                'choices'        => 
                array(
                'left_sidebar'     => __('Left Sidebar', 'hotel-26'),
                'right_sidebar' => __('Right Sidebar', 'hotel-26'),
                'no_sidebar'     => __('No Sidebar', 'hotel-26'),
                ) 
                ) 
            );
    
    
            // Single Page
            $wp_customize->add_setting( 
                'hotel_26_single_pg_sidebar', 
                array(
                'default' => 'right_sidebar',
                'capability'     => 'edit_theme_options',
                'sanitize_callback' => 'hotel_26_sanitize_select',
                'priority' => 4,
                ) 
            );

            $wp_customize->add_control(
                'hotel_26_single_pg_sidebar', 
                array(
                'label'          => __('Single Page Sidebar Option', 'hotel-26'),
                'section'        => 'hotel_26_sidebar',
                'type'           => 'select',
                'choices'        => 
                array(
                'left_sidebar'     => __('Left Sidebar', 'hotel-26'),
                'right_sidebar' => __('Right Sidebar', 'hotel-26'),
                'no_sidebar'     => __('No Sidebar', 'hotel-26'),
                ) 
                ) 
            );
    
    
            // Blog Page
            $wp_customize->add_setting( 
                'hotel_26_blog_pg_sidebar', 
                array(
                'default' => 'right_sidebar',
                'capability'     => 'edit_theme_options',
                'sanitize_callback' => 'hotel_26_sanitize_select',
                'priority' => 5,
                ) 
            );

            $wp_customize->add_control(
                'hotel_26_blog_pg_sidebar', 
                array(
                'label'          => __('Blog Page Sidebar Option', 'hotel-26'),
                'section'        => 'hotel_26_sidebar',
                'type'           => 'select',
                'choices'        => 
                array(
                'left_sidebar'     => __('Left Sidebar', 'hotel-26'),
                'right_sidebar' => __('Right Sidebar', 'hotel-26'),
                'no_sidebar'     => __('No Sidebar', 'hotel-26'),
                ) 
                ) 
            );
    
            // Search Page
            $wp_customize->add_setting( 
                'hotel_26_search_pg_sidebar', 
                array(
                'default' => 'right_sidebar',
                'capability'     => 'edit_theme_options',
                'sanitize_callback' => 'hotel_26_sanitize_select',
                'priority' => 5,
                ) 
            );

            $wp_customize->add_control(
                'hotel_26_search_pg_sidebar', 
                array(
                'label'          => __('Search Page Sidebar Option', 'hotel-26'),
                'section'        => 'hotel_26_sidebar',
                'type'           => 'select',
                'choices'        => 
                array(
                'left_sidebar'     => __('Left Sidebar', 'hotel-26'),
                'right_sidebar' => __('Right Sidebar', 'hotel-26'),
                'no_sidebar'     => __('No Sidebar', 'hotel-26'),
                ) 
                ) 
            );

            //Pro feature
            cleverfox_themes_section_upgrade_control(
                $wp_customize, array(
                'theme_slug' => 'hotel_26_',
                'setting_id' => 'sidebar_locked',
                'section'    => 'hotel_26_sidebar',
                'pro_url'    => hotel_26_premium_links(),
                'custom_text'    => __('Unlock With Pro', 'hotel-26'),
                ) 
            );
    
        }
    endif;
    // Widget options
    $wp_customize->add_setting(
        'sidebar_options',
        array(
        'capability'         => 'edit_theme_options',
        'sanitize_callback' => 'hotel_26_sanitize_text',
        'priority'  => 6
        )
    );

    $wp_customize->add_control(
        'sidebar_options',
        array(
        'type' => 'hidden',
        'label' => __('Sidebar', 'hotel-26'),
        'section' => 'hotel_26_sidebar',
        )
    );
    
    // Sidebar Width 
    if (class_exists('Cleverfox_Customizer_Range_Slider_Control') ) {
        $wp_customize->add_setting(
            'hotel_26_sidebar_width',
            array(
            'default'          => esc_html__('33', 'hotel-26'),
            'capability'         => 'edit_theme_options',
            'sanitize_callback' => 'hotel_26_sanitize_range_value',
            'transport'         => 'postMessage',
            'priority'  => 7
            )
        );
        $wp_customize->add_control( 
            new Cleverfox_Customizer_Range_Slider_Control(
                $wp_customize, 'hotel_26_sidebar_width', 
                array(
                'label'      => __('Sidebar Width', 'hotel-26'),
                'section'  => 'hotel_26_sidebar',
                'input_attrs'    => array(                    
                        'min'           => 25,
                        'max'           => 50,
                        'step'          => 1,
                        // 'default_value' => 33,
                )
                ),
            ) 
        );
    }
    
    // Widget Typography
    $wp_customize->add_setting(
        'sidebar_typography',
        array(
        'capability'         => 'edit_theme_options',
        'sanitize_callback' => 'hotel_26_sanitize_text',
        )
    );

    $wp_customize->add_control(
        'sidebar_typography',
        array(
        'type' => 'hidden',
        'label' => __('Typography', 'hotel-26'),
        'section' => 'hotel_26_sidebar',
        )
    );
    
    // Widget Title // 
    if (class_exists('Cleverfox_Customizer_Range_Slider_Control') ) {
        $wp_customize->add_setting(
            'hotel_26_widget_ttl_size',
            array(
            'default' => 28,
            'capability'         => 'edit_theme_options',
            'sanitize_callback' => 'hotel_26_sanitize_range_value',
            'transport'         => 'postMessage'
            )
        );
        $wp_customize->add_control( 
            new Cleverfox_Customizer_Range_Slider_Control(
                $wp_customize, 'hotel_26_widget_ttl_size', 
                array(
                'label'      => __('Widget Title Font Size', 'hotel-26'),
                'section'  => 'hotel_26_sidebar',
                'input_attrs'    => array(                    
                        'min'           => 25,
                        'max'           => 100,
                        'step'          => 1,
                        // 'default_value' => 28,
                )
                ) 
            ) 
        );
    }
}

add_action('customize_register', 'hotel_26_general_setting');
