<?php
/**
 * @package     productive-commerce
 * @author      productiveminds.com
 * @copyright   productiveminds.com
 */


// Start:: Slider Settings
$this->start_controls_section(
    'section_content_slider_settings',
    [
        'label' => esc_html__( 'Slider Options', 'productive-commerce' ),
        'tab' => \Elementor\Controls_Manager::TAB_CONTENT,
        'condition' => [
            'section_content_layout_format' => 'slider',
        ],
    ]
);

$slider_slides_per_view = productive_global_get_slides_per_view_values();
$this->add_responsive_control(
    'slider_slides_per_view',
    [
        'type' => \Elementor\Controls_Manager::SELECT,
        'label' => esc_html__( 'Slides per View', 'productive-commerce' ),
        'description' => esc_html__( '# of visible slides', 'productive-commerce' ),
        'options' => [
        ] + $slider_slides_per_view,
	'frontend_available' => true,
        'devices' => [ 'widescreen', 'desktop', 'tablet_extra', 'tablet', 'mobile_extra', 'mobile' ],
        'desktop_default'   => '4',
        'tablet_default'    => '2',
        'mobile_default'    => '1',
    ]
);

$this->add_control(
    'section_content_layout_slider_options_hr_1',
    [
        'type' => \Elementor\Controls_Manager::DIVIDER,
    ]
);
$this->add_control(
    'section_content_layout_slider_options_label',
    [
        'label' => esc_html__( 'Slider Nav Controls Options', 'productive-commerce' ),
        'type' => \Elementor\Controls_Manager::RAW_HTML,
    ]
);

$this->add_control(
    'slider_navigation_arrows_control_position',
    [
        'type' => \Elementor\Controls_Manager::SELECT,
        'label' => esc_html__( 'Nav Controls Position', 'productive-commerce' ),
        'options' => [
                'none-arrow' => esc_html__( 'None', 'productive-commerce' ),
                'nav-arrows-sides-in' => esc_html__( 'Inside Content (overlay)', 'productive-commerce' ),
                'nav-arrows-sides-out' => esc_html__( 'Beside Content', 'productive-commerce' ),
                'nav-arrows-top-out' => esc_html__( 'Above Content', 'productive-commerce' ),
                'nav-arrows-bottom-out' => esc_html__( 'Below Content', 'productive-commerce' ),
        ],
        'default' => 'nav-arrows-sides-in',
    ]
);

$slider_nav_controls_shapes = productive_global_get_slider_nav_control_shapes();
$this->add_control(
    'slider_navigation_arrows_control_shape',
    [
        'type' => \Elementor\Controls_Manager::SELECT,
        'label' => esc_html__( 'Nav Controls Shape', 'productive-commerce' ),
        'options' => [
        ] + $slider_nav_controls_shapes,
        'default' => 'slider_nav_shape_circle',
    ]
);

$this->add_responsive_control(
    'slider_navigation_arrows_control_padding',
    [
        'label' => esc_html__( 'Padding (px)', 'productive-commerce' ),
        'type' => \Elementor\Controls_Manager::SLIDER,
        'size_units' => [ 'px' ],
        'range' => [
            'px' => [
                'min' => 5,
                'max' => 50,
                'step' => 1,
            ],
        ],
        'default' => [
            'unit' => 'px',
            'size' => 20,
        ],
        'selectors' => [
            '{{WRAPPER}} .productiveminds-slider-content-container .swiper_container .swiper-button-prev' => 'padding: {{SIZE}}{{UNIT}};',
            '{{WRAPPER}} .productiveminds-slider-content-container .swiper_container .swiper-button-next' => 'padding: {{SIZE}}{{UNIT}};',
            '{{WRAPPER}} .productiveminds-slider-content-container .swiper_container.nav-arrows-top-out' => 'padding-top: calc( var(--swiper-navigation-size) + {{SIZE}}{{UNIT}} + {{SIZE}}{{UNIT}} );',
            '{{WRAPPER}} .productiveminds-slider-content-container .swiper_container.nav-arrows-bottom-out' => 'margin-bottom: calc( var(--swiper-navigation-size) + {{SIZE}}{{UNIT}} + {{SIZE}}{{UNIT}} );',
            '{{WRAPPER}} .productiveminds-slider-content-container .swiper_container.nav-arrows-top-out .swiper-button-prev' => 'right: calc( var(--swiper-navigation-size) + {{SIZE}}{{UNIT}} + {{SIZE}}{{UNIT}} );',
            '{{WRAPPER}} .productiveminds-slider-content-container .swiper_container.nav-arrows-bottom-out .swiper-button-prev' => 'right: calc( var(--swiper-navigation-size) + {{SIZE}}{{UNIT}} + {{SIZE}}{{UNIT}} );',
        ],
    ]
);

$this->add_control(
    'section_content_layout_slider_options_hr_3',
    [
        'type' => \Elementor\Controls_Manager::DIVIDER,
    ]
);
$this->add_control(
    'section_content_layout_slider_options_label_3',
    [
        'label' => esc_html__( 'Pagination Controls Options', 'productive-commerce' ),
        'type' => \Elementor\Controls_Manager::RAW_HTML,
    ]
);

$this->add_control(
    'slider_pagination_control_position',
    [
        'type' => \Elementor\Controls_Manager::SELECT,
        'label' => esc_html__( 'Position', 'productive-commerce' ),
        'options' => [
                'none-pagination' => esc_html__( 'None', 'productive-commerce' ),
                'nav-pagination-in' => esc_html__( 'Inside Content (overlay)', 'productive-commerce' ),
                'nav-pagination-out' => esc_html__( 'Below Content', 'productive-commerce' ),
        ],
        'default' => 'none-pagination',
    ]
);

$this->add_control(
    'slider_pagination_control_shape',
    [
        'type' => \Elementor\Controls_Manager::SELECT,
        'label' => esc_html__( 'Shape', 'productive-commerce' ),
        'options' => [
        ] + productive_global_get_slider_pagination_control_shapes(),
        'default' => 'slider_pagination_shape_hybrid',
    ]
);

$this->add_control(
    'section_content_layout_slider_options_hr_4',
    [
        'type' => \Elementor\Controls_Manager::DIVIDER,
    ]
);
$this->add_control(
    'section_content_layout_slider_options_label_4',
    [
        'label' => esc_html__( 'Controls Color Options', 'productive-commerce' ),
        'type' => \Elementor\Controls_Manager::RAW_HTML,
    ]
);

$this->add_control(
    'section_style_layout_slider_nav_color_secondary',
    [
        'label' => esc_html__( 'Secondary Color', 'productive-commerce' ),
        'type' => \Elementor\Controls_Manager::COLOR,
        'default' => '#f3f3f3',
        'selectors' => [
            '{{WRAPPER}} .productiveminds-slider-content-container .swiper_container .swiper-button-prev' => 'background: {{VALUE}};',
            '{{WRAPPER}} .productiveminds-slider-content-container .swiper_container .swiper-button-next' => 'background: {{VALUE}};',
            '{{WRAPPER}} .productiveminds-slider-content-container .swiper_container .swiper-pagination-bullet' => 'background: {{VALUE}};',
        ],
    ]
);

$this->add_control(
    'section_style_layout_slider_nav_color_primary',
    [
        'label' => esc_html__( 'Primary Color', 'productive-commerce' ),
        'type' => \Elementor\Controls_Manager::COLOR,
        'default' => '#0a47bb',
        'selectors' => [
            '{{WRAPPER}} .productiveminds-slider-content-container .swiper_container .swiper-button-prev' => 'color: {{VALUE}};',
            '{{WRAPPER}} .productiveminds-slider-content-container .swiper_container .swiper-button-next' => 'color: {{VALUE}};',
            '{{WRAPPER}} .productiveminds-slider-content-container .swiper_container .swiper-pagination-bullet:hover' => 'background: {{VALUE}};',
            '{{WRAPPER}} .productiveminds-slider-content-container .swiper_container .swiper-pagination-bullet-active' => 'background: {{VALUE}};',
        ],
    ]
);

$this->add_control(
    'section_content_layout_slider_options_hr_5',
    [
        'type' => \Elementor\Controls_Manager::DIVIDER,
    ]
);
$this->add_control(
    'section_content_layout_slider_options_label_5',
    [
        'label' => esc_html__( 'Other Options', 'productive-commerce' ),
        'type' => \Elementor\Controls_Manager::RAW_HTML,
    ]
);

$this->add_control(
    'section_slider_settings_swiper_var_effect',
    [
        'type' => \Elementor\Controls_Manager::SELECT,
        'label' => esc_html__( 'Slides Transition Effect', 'productive-commerce' ),
        'options' => productive_global_get_slider_transition_styles(),
        'default' => 'slide',
        'frontend_available' => true,
    ]
);

$this->add_control(
    'section_slider_settings_swiper_var_direction',
    [
        'label' => esc_html__( 'Slides Direction', 'productive-commerce' ),
        'type' => \Elementor\Controls_Manager::HIDDEN,
        'default' => 'horizontal',
        'frontend_available' => true,
    ]
);

$this->add_control(
    'section_slider_settings_swiper_var_autoplay',
    [
        'type' => \Elementor\Controls_Manager::SELECT,
        'label' => esc_html__( 'Auto Play Slides', 'productive-commerce' ),
        'options' => [
                'false' => esc_html__( 'No', 'productive-commerce' ),
                'true' => esc_html__( 'Yes', 'productive-commerce' ),
        ],
        'default' => 'true',
        'frontend_available' => true,
    ]
);

$this->add_control(
    'section_slider_settings_swiper_var_pauseOnMouseEnter',
    [
        'type' => \Elementor\Controls_Manager::SELECT,
        'label' => esc_html__( 'Pause on Hover', 'productive-commerce' ),
        'options' => [
                'false' => esc_html__( 'No', 'productive-commerce' ),
                'true' => esc_html__( 'Yes', 'productive-commerce' ),
        ],
        'default' => 'true',
        'frontend_available' => true,
        'condition' => [
            'section_slider_settings_swiper_var_autoplay' => 'true',
        ],
    ]
);

$this->add_control(
    'section_slider_settings_swiper_var_delay',
    [
        'type' => \Elementor\Controls_Manager::SELECT,
        'label' => esc_html__( 'Slides Transitions Delay', 'productive-commerce' ),
        'options' => productive_global_get_slider_transition_delays(),
        'default' => '4000',
        'frontend_available' => true,
        'condition' => [
            'section_slider_settings_swiper_var_autoplay' => 'true',
        ],
    ]
);

$this->add_control(
    'section_slider_settings_swiper_var_loop',
    [
        'type' => \Elementor\Controls_Manager::SELECT,
        'label' => esc_html__( 'Play Slides in Loop', 'productive-commerce' ),
        'options' => [
                'false' => esc_html__( 'No', 'productive-commerce' ),
                'true' => esc_html__( 'Yes', 'productive-commerce' ),
        ],
        'default' => 'true',
        'frontend_available' => true,
    ]
);

$this->add_control(
    'section_slider_settings_swiper_var_simulateTouch',
    [
        'type' => \Elementor\Controls_Manager::SELECT,
        'label' => esc_html__( 'Simulate Touch on Desktop', 'productive-commerce' ),
        'options' => [
                'false' => esc_html__( 'No', 'productive-commerce' ),
                'true' => esc_html__( 'Yes', 'productive-commerce' ),
        ],
        'default' => 'false',
        'frontend_available' => true,
    ]
);

$this->add_control(
    'section_slider_settings_swiper_var_lazyLoading',
    [
        'type' => \Elementor\Controls_Manager::SELECT,
        'label' => esc_html__( 'Enable Lazy Loading', 'productive-commerce' ),
        'options' => [
                'false' => esc_html__( 'No', 'productive-commerce' ),
                'true' => esc_html__( 'Yes', 'productive-commerce' ),
        ],
        'default' => 'true',
        'frontend_available' => true,
    ]
);

$this->add_control(
    'section_slider_settings_swiper_var_grabCursor',
    [
        'type' => \Elementor\Controls_Manager::SELECT,
        'label' => esc_html__( 'Enable Cursor Effect', 'productive-commerce' ),
        'options' => [
                'false' => esc_html__( 'No', 'productive-commerce' ),
                'true' => esc_html__( 'Yes', 'productive-commerce' ),
        ],
        'default' => 'true',
        'frontend_available' => true,
    ]
);

$this->end_controls_section();
// End:: Slider Settings


// Start:: Data Settings
$this->start_controls_section(
    'section_content_settings',
    [
        'label' => esc_html__( 'Data Settings', 'productive-commerce' ),
        'tab' => \Elementor\Controls_Manager::TAB_CONTENT,
    ]
);

$this->add_control(
    'columns_per_row',
    [
        'label' => esc_html__( 'Columns per row', 'productive-commerce' ),
        'type' => \Elementor\Controls_Manager::NUMBER,
        'default' => 4,
        'min' => 1,
        'max' => 7,
        'condition' => [
            'section_content_layout_format' => [ 'grid', 'list_lefted_grided', 'list_righted_grided' ],
        ],
    ]
);

$this->add_control(
    'section_content_settings_unique_id',
    [
        'label' => esc_html__( 'Unique ID to use as CSS ID for the section', 'productive-commerce' ),
        'type' => \Elementor\Controls_Manager::HIDDEN,
        'default' => 'section_unique_id_' . rand() . '_' . rand(),
        'frontend_available' => true,
    ]
);

$this->end_controls_section();
// End:: Data Settings



/**
 * 
 * Start:: Styles
 * N / A
 */
// End:: Styles
        