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

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

$this->add_control(
    'section_content_summary_is_show_section_summary',
    [
        'type' => \Elementor\Controls_Manager::SELECT,
        'label' => esc_html__( 'Show Compare Summary', 'productive-commerce' ),
        'options' => [
                '' => esc_html__( 'Hide', 'productive-commerce' ),
                'top' => esc_html__( 'Above Products', 'productive-commerce' ),
                'bottom' => esc_html__( 'Below Products', 'productive-commerce' ),
        ],
        'default' => 'top',
    ]
);

$this->add_control(
    'section_content_summary_is_show_product_count',
    [
        'type' => \Elementor\Controls_Manager::SELECT,
        'label' => esc_html__( 'Show Product Count', 'productive-commerce' ),
        'options' => [
                '1' => esc_html__( 'Yes', 'productive-commerce' ),
                '0' => esc_html__( 'No', 'productive-commerce' ),
        ],
        'default' => '1',
    ]
);

$this->add_control(
    'section_content_summary_is_show_clear_all_button',
    [
        'type' => \Elementor\Controls_Manager::SELECT,
        'label' => esc_html__( 'Show Clear Comparison', 'productive-commerce' ),
        'options' => [
                '1' => esc_html__( 'Yes', 'productive-commerce' ),
                '0' => esc_html__( 'No', 'productive-commerce' ),
        ],
        'default' => '1',
    ]
);

$this->end_controls_section();
// End:: Content



/**
 * 
 * Start:: Styles
 * 
 */
$this->start_controls_section(
    'section_style_summary',
    [
        'label' => esc_html__( 'Summary', 'productive-commerce' ),
        'tab' => \Elementor\Controls_Manager::TAB_STYLE,
        'condition' => [
            'section_content_summary_is_show_section_summary' => [ 'top', 'bottom' ],
        ],
    ]
);

// Start:: Block Styles

$this->add_group_control(
    \Elementor\Group_Control_Background::get_type(),
    [
        'name' => 'section_style_summary_margin_bg_color',
        'types' => [ 'classic', 'gradient' ],
        'selector' => '{{WRAPPER}} .productiveminds_section-summary-container .productiveminds_section-summary-container_uno',
    ]
);

$this->add_responsive_control(
    'section_style_summary_border_radius',
    [
        'label' => esc_html__( 'Border Radius', 'productive-commerce' ),
        'type' => \Elementor\Controls_Manager::DIMENSIONS,
        'size_units' => [ 'px', '%' ],
        'selectors' => [
                '{{WRAPPER}} .productiveminds_section-summary-container .productiveminds_section-summary-container_uno' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
        ],
    ]
);

$this->add_responsive_control(
    'section_style_summary_padding',
    [
        'label' => esc_html__( 'Padding', 'productive-commerce' ),
        'type' => \Elementor\Controls_Manager::DIMENSIONS,
        'size_units' => [ 'rem', 'px' ],
        'selectors' => [
                '{{WRAPPER}} .productiveminds_section-summary-container .productiveminds_section-summary-container_uno' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
        ],
    ]
);

$this->add_responsive_control(
    'section_style_summary_margin',
    [
        'label' => esc_html__( 'Margin', 'productive-commerce' ),
        'type' => \Elementor\Controls_Manager::DIMENSIONS,
        'size_units' => [ 'rem', 'px' ],
        'selectors' => [
                '{{WRAPPER}} .productiveminds_section-summary-container .productiveminds_section-summary-container_uno' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
        ],
    ]
);

$this->add_group_control(
    \Elementor\Group_Control_Border::get_type(),
    [
        'name' => 'section_style_summary_border',
        'selector' => '{{WRAPPER}} .productiveminds_section-summary-container .productiveminds_section-summary-container_uno',
    ]
);

$this->add_group_control(
    \Elementor\Group_Control_Box_Shadow::get_type(),
    [
        'name' => 'section_style_summary_shadow',
        'selector' => '{{WRAPPER}} .productiveminds_section-summary-container .productiveminds_section-summary-container_uno',
    ]
);
// End:: Block Styles

// Start:: Product Count
$this->add_control(
    'section_content_summary_product_count_hr',
    [
        'type' => \Elementor\Controls_Manager::DIVIDER,
    ]
);
$this->add_control(
    'section_content_summary_product_count_label',
    [
        'label' => esc_html__( 'Product Count', 'productive-commerce' ),
        'type' => \Elementor\Controls_Manager::RAW_HTML,
    ]
);

$this->add_group_control(
    \Elementor\Group_Control_Typography::get_type(),
    [
        'label' => esc_html__( 'Typography', 'productive-commerce' ),
        'name' => 'section_style_summary_product_count_typography',
        'selector' => '{{WRAPPER}} .productiveminds_section-summary-container .productiveminds_qty_count',
    ]
);

$this->add_control(
    'section_style_summary_product_count_color',
    [
        'label' => esc_html__( 'Text Color', 'productive-commerce' ),
        'type' => \Elementor\Controls_Manager::COLOR,
        'selectors' => [
                '{{WRAPPER}} .productiveminds_section-summary-container .productiveminds_qty_count' => 'color: {{VALUE}};',
        ],
    ]
);

$this->add_responsive_control(
    'section_style_summary_product_count_margin',
    [
        'label' => esc_html__( 'Margin', 'productive-commerce' ),
        'type' => \Elementor\Controls_Manager::DIMENSIONS,
        'size_units' => [ 'rem', 'px' ],
        'selectors' => [
                '{{WRAPPER}} .productiveminds_section-summary-container .productiveminds_qty_count' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
        ],
    ]
);
// End:: Product Count

// Start:: Clear Comparison
$this->add_control(
    'section_content_summary_remove_all_link_hr',
    [
        'type' => \Elementor\Controls_Manager::DIVIDER,
    ]
);
$this->add_control(
    'section_content_summary_remove_all_link_label',
    [
        'label' => esc_html__( 'Clear Comparison Hyperlink', 'productive-commerce' ),
        'type' => \Elementor\Controls_Manager::RAW_HTML,
    ]
);

$this->add_group_control(
    \Elementor\Group_Control_Typography::get_type(),
    [
        'label' => esc_html__( 'Typography', 'productive-commerce' ),
        'name' => 'section_style_summary_remove_all_link_typography',
        'selector' => '{{WRAPPER}} .productiveminds_section-summary-container .productiveminds_section_container_compare_remove.ALL',
    ]
);

$this->add_control(
    'section_style_summary_remove_all_link_color',
    [
        'label' => esc_html__( 'Text Color', 'productive-commerce' ),
        'type' => \Elementor\Controls_Manager::COLOR,
        'selectors' => [
                '{{WRAPPER}} .productiveminds_section-summary-container .productiveminds_section_container_compare_remove.ALL' => 'color: {{VALUE}};',
        ],
    ]
);

$this->add_control(
    'section_style_summary_remove_all_link_bg_color',
    [
        'label' => esc_html__( 'Text Color (on Hover)', 'productive-commerce' ),
        'type' => \Elementor\Controls_Manager::COLOR,
        'selectors' => [
                '{{WRAPPER}} .productiveminds_section-summary-container .productiveminds_section_container_compare_remove.ALL:hover' => 'color: {{VALUE}};',
        ],
    ]
);

// End:: Clear Comparison

// Start:: Block Alignments
$this->add_control(
    'section_content_summary_section_alignments_hr',
    [
        'type' => \Elementor\Controls_Manager::DIVIDER,
    ]
);
$this->add_control(
    'section_content_summary_section_alignments_label',
    [
        'label' => esc_html__( 'Block Alignments', 'productive-commerce' ),
        'type' => \Elementor\Controls_Manager::RAW_HTML,
    ]
);

$this->add_responsive_control(
    'section_style_summary_width_content_box',
    [
        'label' => esc_html__( 'Width', 'productive-commerce' ),
        'type' => \Elementor\Controls_Manager::SLIDER,
        'size_units' => [ 'px', '%' ],
        'range' => [
            'px' => [
                'min' => 100,
                'max' => 32000,
                'step' => 10,
            ],
            '%' => [
                'min' => 10,
                'max' => 100,
                'step' => 1,
            ],
        ],
        'default' => [
            'unit' => '%',
            'size' => 100,
        ],
        'selectors' => [
            '{{WRAPPER}} .productiveminds_section-summary-container .productiveminds_section-summary-container_uno' => 'width: {{SIZE}}{{UNIT}};',
        ],
    ]
);

$this->add_responsive_control(
    'section_style_summary_max_width_content_box',
    [
        'label' => esc_html__( 'Max Width (px)', 'productive-commerce' ),
        'type' => \Elementor\Controls_Manager::SLIDER,
        'size_units' => [ 'px' ],
        'range' => [
            'px' => [
                'min' => 100,
                'max' => 3000,
                'step' => 10,
            ],
        ],
        'selectors' => [
            '{{WRAPPER}} .productiveminds_section-summary-container .productiveminds_section-summary-container_uno' => 'max-width: {{SIZE}}{{UNIT}};',
        ],
    ]
);

$this->add_responsive_control(
    'section_style_summary_align_text',
    [
        'label' => esc_html__( 'Alignment', 'productive-commerce' ),
        'type' => \Elementor\Controls_Manager::CHOOSE,
        'options' => [
            'left' => [
                'title' => esc_html__( 'Left', 'productive-commerce' ),
                'icon' => 'eicon-text-align-left',
            ],
            'center' => [
                'title' => esc_html__( 'Center', 'productive-commerce' ),
                'icon' => 'eicon-text-align-center',
            ],
            'right' => [
                'title' => esc_html__( 'Right', 'productive-commerce' ),
                'icon' => 'eicon-text-align-right',
            ],
        ],
        'toggle' => true,
        'default' => 'center',
        'selectors' => [
            '{{WRAPPER}} .productiveminds_section-summary-container .productiveminds_section-summary-container_uno' => 'text-align: {{VALUE}};',
        ],
    ]
);

$this->add_responsive_control(
    'section_style_summary_align_box',
    [
        'type' => \Elementor\Controls_Manager::SELECT,
        'label' => esc_html__( 'Container Justification', 'productive-commerce' ),
        'options' => [
        ] + productive_global_get_horizontal_css_align_options(),
        'default' => 'center',
        'selectors' => [
            '{{WRAPPER}} .productiveminds_section-summary-container' => 'justify-content: {{VALUE}}; justify-items: {{VALUE}}',
        ],
    ]
);
// End:: Block Alignments

$this->end_controls_section();
// End:: Styles
        