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


// Start:: Content
$this->start_controls_section(
    'section_content_content',
    [
        'label' => esc_html__( 'Content', 'productive-forms' ),
        'tab' => \Elementor\Controls_Manager::TAB_CONTENT,
    ]
);
$this->add_control(
    'submission_verify_type',
    [
        'type' => \Elementor\Controls_Manager::SELECT,
        'label' => esc_html__( 'Spam Protection', 'productive-forms' ),
        'options' => [
            'discreet' => esc_html__( 'Discreet Verification', 'productive-forms' ),
            'maths_challenge' => esc_html__( 'Simple Maths Challenge', 'productive-forms' ),
            'productive_g_recaptcha_v3' => esc_html__( 'Google Recaptcha V3', 'productive-forms' ),
        ],
        'default' => 'discreet',
    ]
);

$this->add_control(
    'newsletter_how_to_display_contact_name_field',
    [
        'type' => \Elementor\Controls_Manager::SELECT,
        'label' => esc_html__( 'Name Field Option', 'productive-forms' ),
        'options' => [
            'combined_field' => esc_html__( 'Combined Name Fields', 'productive-forms' ),
            'individual_fields' => esc_html__( 'First and Last Name Fields', 'productive-forms' ),
        ],
        'default' => 'combined_field',
    ]
);

$this->add_control(
    'display_contact_form_label',
    [
        'type' => \Elementor\Controls_Manager::SELECT,
        'label' => esc_html__( 'Display Form Labels', 'productive-forms' ),
        'options' => [
        ] + productive_global_get_yes_or_no_options(),
        'default' => '0',
    ]
);

$this->add_control(
    'request_data_privacy_consent',
    [
        'type' => \Elementor\Controls_Manager::SELECT,
        'label' => esc_html__( 'Ask for data privacy consent', 'productive-forms' ),
        'options' => [
        ] + productive_global_get_yes_or_no_options(),
        'default' => '1',
    ]
);

$this->add_control(
    'productive_forms_form_submit_text',
    [
        'label' => esc_html__( 'Send Button Label', 'productive-forms' ),
        'label_block' => true,
        'type' => \Elementor\Controls_Manager::TEXT,
        'default' => esc_html__( 'Subscribe', 'productive-forms' ),
        'dynamic' => [
            'active' => true,
        ],
    ]
);

$this->add_control(
    'productive_forms_form_footnote_text',
    [
        'label' => esc_html__( 'Footnote', 'productive-forms' ),
        'label_block' => true,
        'type' => \Elementor\Controls_Manager::WYSIWYG,
        'default' => '',
        'dynamic' => [
            'active' => true,
        ],
    ]
);


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







/**
 * 
 * Start:: Styles
 * 
 */
$this->start_controls_section(
    'section_style_content_form_block',
    [
        'label' => esc_html__( 'Form Fields', 'productive-forms' ),
        'tab' => \Elementor\Controls_Manager::TAB_STYLE,
    ]
);

$this->add_group_control(
    \Elementor\Group_Control_Typography::get_type(),
    [
        'label' => esc_html__( 'Typography', 'productive-forms' ),
        'name' => 'section_style_content_form_block_text_typography',
        'selector' => '{{WRAPPER}} .productiveminds_section.newsletter-element .productive_forms_form_newsletter_form *',
    ]
);

$this->add_responsive_control(
    'section_style_content_form_block_text_padding',
    [
        'label' => esc_html__( 'Padding', 'productive-forms' ),
        'type' => \Elementor\Controls_Manager::DIMENSIONS,
        'size_units' => [ 'rem', 'px', '%' ],
        'selectors' => [
            '{{WRAPPER}} .productiveminds_section.newsletter-element .productive_forms_form_newsletter_form input' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
        ],
    ]
);

$this->add_control(
    'section_style_content_form_block_border_radius',
    [
        'label' => esc_html__( 'Border Radius', 'productive-forms' ),
        'type' => \Elementor\Controls_Manager::DIMENSIONS,
        'size_units' => [ '%', 'px' ],
        'selectors' => [
            '{{WRAPPER}} .productiveminds_section.newsletter-element .productive_forms_form_newsletter_form input' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
        ],
    ]
);

$this->add_control(
    'section_style_contact_info_hr_labels',
    [
        'type' => \Elementor\Controls_Manager::DIVIDER,
    ]
);
$this->add_control(
    'section_style_contact_info_group_label_labels',
    [
        'label' => esc_html__( 'Form Labels', 'productive-forms' ),
        'type' => \Elementor\Controls_Manager::RAW_HTML,
    ]
);

$this->add_control(
    'section_style_content_form_block_label_text_color',
    [
        'label' => esc_html__( 'Labels Color', 'productive-forms' ),
        'type' => \Elementor\Controls_Manager::COLOR,
        'selectors' => [
            '{{WRAPPER}} .productiveminds_section.newsletter-element .productive_forms_form_newsletter_form label' => 'color: {{VALUE}};',
            '{{WRAPPER}} .productiveminds_section.newsletter-element .productive_forms_form_newsletter_form .required-field-asterik' => 'color: {{VALUE}};',
        ],
    ]
);

$this->add_control(
    'section_style_contact_info_hr_input_boxes',
    [
        'type' => \Elementor\Controls_Manager::DIVIDER,
    ]
);
$this->add_control(
    'section_style_contact_info_group_label_input_boxes',
    [
        'label' => esc_html__( 'Input Boxes', 'productive-forms' ),
        'type' => \Elementor\Controls_Manager::RAW_HTML,
    ]
);

$this->add_control(
    'section_style_content_form_block_fields_input_text_color',
    [
        'label' => esc_html__( 'Color', 'productive-forms' ),
        'type' => \Elementor\Controls_Manager::COLOR,
        'selectors' => [
            '{{WRAPPER}} .productiveminds_section.newsletter-element .productive_forms_form_newsletter_form input' => 'color: {{VALUE}};',
        ],
    ]
);

$this->add_control(
    'section_style_content_form_block_bg',
    [
        'label' => esc_html__( 'Background', 'productive-forms' ),
        'type' => \Elementor\Controls_Manager::COLOR,
        'selectors' => [
            '{{WRAPPER}} .productiveminds_section.newsletter-element .productive_forms_form_newsletter_form input' => 'background: {{VALUE}};',
        ],
    ]
);

$this->add_group_control(
    \Elementor\Group_Control_Border::get_type(),
    [
        'name' => 'section_style_form_block_border',
        'selector' => '{{WRAPPER}} .productiveminds_section.newsletter-element .productive_forms_form_newsletter_form input',
    ]
);

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






/**
 * 
 * Start:: Styles
 * 
 */
$this->start_controls_section(
    'section_style_content_form_button',
    [
        'label' => esc_html__( 'From Button', 'productive-forms' ),
        'tab' => \Elementor\Controls_Manager::TAB_STYLE,
    ]
);

$this->add_group_control(
    \Elementor\Group_Control_Typography::get_type(),
    [
        'label' => esc_html__( 'Typography', 'productive-forms' ),
        'name' => 'section_style_content_button_typography',
        'selector' => '{{WRAPPER}} .productiveminds_section.newsletter-element .productive_forms_form_newsletter_form button',
    ]
);

$this->start_controls_tabs(
    'style_tabs',
        [
        ]
);

    // Start:: Content button Normal Styles
    $this->start_controls_tab(
        'section_style_content_button_normal_tab',
        [
            'label' => esc_html__( 'Normal', 'productive-forms' ),
        ]
    );

    $this->add_control(
        'section_style_content_button_text_color',
        [
            'label' => esc_html__( 'Text Color', 'productive-forms' ),
            'type' => \Elementor\Controls_Manager::COLOR,
            'selectors' => [
                '{{WRAPPER}} .productiveminds_section.newsletter-element .productive_forms_form_newsletter_form button' => 'color: {{VALUE}};',
            ],
        ]
    );

    $this->add_control(
        'section_style_content_button_bg_color',
        [
            'label' => esc_html__( 'Background', 'productive-forms' ),
            'type' => \Elementor\Controls_Manager::COLOR,
            'selectors' => [
                '{{WRAPPER}} .productiveminds_section.newsletter-element .productive_forms_form_newsletter_form button' => 'background: {{VALUE}};',
                '{{WRAPPER}} .productiveminds_section.newsletter-element .productive_forms_form_newsletter_form button' => 'background-color: {{VALUE}};',
            ],
        ]
    );
    $this->end_controls_tab();
    // End:: Content button Normal Styles

    // Start:: Content button Hover Styles
    $this->start_controls_tab(
        'section_style_content_button_hover_tab',
        [
            'label' => esc_html__( 'On Hover', 'productive-forms' ),
        ]
    );

    $this->add_control(
        'section_style_content_button_text_color_hover',
        [
            'label' => esc_html__( 'Text Color', 'productive-forms' ),
            'type' => \Elementor\Controls_Manager::COLOR,
            'selectors' => [
                '{{WRAPPER}} .productiveminds_section.newsletter-element .productive_forms_form_newsletter_form button:hover' => 'color: {{VALUE}};',
            ],
        ]
    );

    $this->add_control(
        'section_style_content_button_bg_color_hover',
        [
            'label' => esc_html__( 'Background', 'productive-forms' ),
            'type' => \Elementor\Controls_Manager::COLOR,
            'selectors' => [
                '{{WRAPPER}} .productiveminds_section.newsletter-element .productive_forms_form_newsletter_form button:hover' => 'background: {{VALUE}};',
                '{{WRAPPER}} .productiveminds_section.newsletter-element .productive_forms_form_newsletter_form button:hover' => 'background-color: {{VALUE}};',
            ],
        ]
    );
    
    $this->add_control(
        'section_style_content_button_hover_animation',
        [
            'label' => esc_html__( 'Hover Animation', 'productive-forms' ),
            'type' => \Elementor\Controls_Manager::HOVER_ANIMATION,
        ]
    );
    $this->end_controls_tab();
    // End:: Content button Hover Styles

$this->end_controls_tabs();

$this->add_group_control(
    \Elementor\Group_Control_Border::get_type(),
    [
        'name' => 'section_style_content_button_border',
        'selector' => '{{WRAPPER}} .productiveminds_section.newsletter-element .productive_forms_form_newsletter_form button',
    ]
);

$this->add_control(
    'section_style_content_button_border_radius',
    [
        'label' => esc_html__( 'Border Radius', 'productive-forms' ),
        'type' => \Elementor\Controls_Manager::DIMENSIONS,
        'size_units' => [ '%', 'px' ],
        'selectors' => [
                '{{WRAPPER}} .productiveminds_section.newsletter-element .productive_forms_form_newsletter_form button' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
        ],
    ]
);

$this->add_responsive_control(
    'section_style_content_content_button_text_padding',
    [
        'label' => esc_html__( 'Button Padding', 'productive-forms' ),
        'type' => \Elementor\Controls_Manager::DIMENSIONS,
        'size_units' => [ 'rem', 'px', '%' ],
        'selectors' => [
                '{{WRAPPER}} .productiveminds_section.newsletter-element .productive_forms_form_newsletter_form button' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
        ],
    ]
);

$this->add_responsive_control(
    'section_style_content_content_button_text_margin',
    [
        'label' => esc_html__( 'Button Margin', 'productive-forms' ),
        'type' => \Elementor\Controls_Manager::DIMENSIONS,
        'size_units' => [ 'rem', 'px', '%' ],
        'selectors' => [
                '{{WRAPPER}} .productiveminds_section.newsletter-element .productive_forms_form_newsletter_form button' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
        ],
        'condition' => [
            'productive_forms_newsletter_form_style' => [ 'portrait', ],
        ],
    ]
);

$this->add_control(
    'section_style_content_button_width',
    [
        'type' => \Elementor\Controls_Manager::SELECT,
        'label' => esc_html__( 'Button Width', 'productive-forms' ),
        'options' => [
            'fit-content' => esc_html__( 'Fit Content', 'productive-forms' ),
            '100%' => esc_html__( 'Full Width', 'productive-forms' ),
        ],
        'selectors' => [
            '{{WRAPPER}} .productiveminds_section.newsletter-element .productive_forms_form_newsletter_form button' => 'width: {{VALUE}};',
        ],
        'default' => 'fit-content',
        'condition' => [
            'productive_forms_newsletter_form_style' => [ 'portrait', ],
        ],
    ]
);

// Button Alignment
$this->add_responsive_control(
    'section_style_content_button_alignment',
    [
        'label' => esc_html__( 'Button Alignment', 'productive-forms' ),
        'type' => \Elementor\Controls_Manager::CHOOSE,
        'options' => [
                'left' => [
                        'title' => esc_html__( 'Left', 'productive-forms' ),
                        'icon' => 'eicon-text-align-left',
                ],
                'center' => [
                        'title' => esc_html__( 'Center', 'productive-forms' ),
                        'icon' => 'eicon-text-align-center',
                ],
                'right' => [
                        'title' => esc_html__( 'Right', 'productive-forms' ),
                        'icon' => 'eicon-text-align-right',
                ],
        ],
        'toggle' => true,
        'selectors' => [
            '{{WRAPPER}} .productiveminds_section.newsletter-element .productive_forms_form_newsletter_form .productiveminds_form_field_box.action' => 'justify-items: {{VALUE}};',
        ],
        'condition' => [
            'productive_forms_newsletter_form_style' => [ 'portrait', ],
        ],
        'condition' => [
            'section_style_content_button_width' => [ 'fit-content', ],
        ],
    ]
);
// End:: Form Button

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

