<?php
/**
 * Elementor Contact Widget.
 *
 * Elementor widget that inserts an embbedable content into the page, from any given URL.
 *
 * @since 1.0.5
 */
class Elementor_Contact_Form_7_Widget extends \Elementor\Widget_Base {

	/**
	 * Get widget name.
	 *
	 * Retrieve Contact widget name.
	 *
	 * @since 1.0.5
	 * @access public
	 *
	 * @return string Widget name.
	 */
	public function get_name() {
		return 'contact';
	}

	/**
	 * Get widget title.
	 *
	 * Retrieve Contact widget title.
	 *
	 * @since 1.0.5
	 * @access public
	 *
	 * @return string Widget title.
	 */
	public function get_title() {
		return __( 'Contact Form 7', 'endless-addons' );
	}

	/**
	 * Get widget icon.
	 *
	 * Retrieve Contact widget icon.
	 *
	 * @since 1.0.5
	 * @access public
	 *
	 * @return string Widget icon.
	 */
	public function get_icon() {
		return 'fa fa-wpforms';
	}

	/**
	 * Get widget categories.
	 *
	 * Retrieve the list of categories the Contact widget belongs to.
	 *
	 * @since 1.0.5
	 * @access public
	 *
	 * @return array Widget categories.
	 */
	public function get_categories() {
		return [ 'endless-elements' ];
	}

	/**
	 * Register Contact widget controls.
	 *
	 * Adds different input fields to allow the user to change and customize the widget settings.
	 *
	 * @since 1.0.5
	 * @access protected
	 */
	protected function register_controls() {

		$this->start_controls_section(
			'default_section',
			[    
				'label' => __( 'Settings', 'endless-addons' ),
				'tab' => \Elementor\Controls_Manager::TAB_CONTENT
			]
		);

		$this->add_control(
			'show_contact',
			[
				'label' => __( 'Show/Hide Contact Section', 'endless-addons' ),
				'type' => \Elementor\Controls_Manager::CHOOSE,
				'options' => [
					'show' => [
						'title' => __( 'Show', 'endless-addons' ),
						'icon' => 'fa fa-check'
					],
					'hide' => [
						'title' => __( 'Hide', 'endless-addons' ),
						'icon' => 'fa fa-close'
					]
				],
				'default' => 'show',
				'toggle' => true
			]
		);

		$this->add_control(
			'select_contact_style',
			[
				'label' => __( 'Select Contact Style', 'endless-addons' ),
				'type' => \Elementor\Controls_Manager::SELECT,
				'input_type' => 'SELECT',
				'options' => [
					'style-01' => __( 'Style 01', 'endless-addons' ),
					'style-02' => __( 'Style 02', 'endless-addons' ),
					'style-03' => __( 'Style 03', 'endless-addons' ),
					'style-04' => __( 'Style 04', 'endless-addons' ),
					'style-05' => __( 'Style 05', 'endless-addons' ),
					'style-06' => __( 'Style 06', 'endless-addons' ),
					'style-07' => __( 'Style 07', 'endless-addons' )
				],
				'default' => 'style-01'
			]
		);

		$this->end_controls_section();

		$this->start_controls_section(
			'contact_section',
			[
				'label' => __( 'Contact Section', 'endless-addons' ),
				'tab' => \Elementor\Controls_Manager::TAB_CONTENT,
			]
		);
		
		$this->add_control(
			'contact_title',
			[
				'label' => __( 'Contact Title', 'endless-addons' ),
				'type' => \Elementor\Controls_Manager::TEXT,
				'input_type' => 'text',
				'placeholder' => __( 'Title', 'endless-addons' ),
				'default'  => __( 'Design 1', 'endless-addons' )
			]
		);

		$this->add_control(
			'contact_desc',
			[
				'label' => __( 'Contact Description', 'endless-addons' ),
				'type' => \Elementor\Controls_Manager::WYSIWYG,
				'input_type' => 'WYSIWYG',
				'placeholder' => __( 'Description', 'endless-addons' ),
				'default' => __( 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt dolore magna aliqua. Quis ipsum suspendisse ultrices gravida.', 'endless-addons')
			]
		);

		$this->add_group_control(
			\Elementor\Group_Control_Background::get_type(),
			[
				'name' => 'section_background',
				'label' => __( 'Background', 'plugin-domain' ),
				'types' => [ 'classic', 'gradient', 'video' ],
				'selector' => '{{WRAPPER}} .ea-contact-form-area',
			]
		);

		$this->add_control(
			'contact_featured_img',
			[
				'label' => __( 'Featured Image', 'endless-addons' ),
				'type' => \Elementor\Controls_Manager::MEDIA,
				'show_label' => true,
				'default' => [
					'url' => plugin_dir_url( dirname( __FILE__ ) ) . '../public/img/contact/contact-img-2.jpg'
				],
				'condition' => [
                    'select_contact_style' => array('style-06', 'style-07')
                ]
			]
		);

		$this->end_controls_section();

		$this->start_controls_section(
			'contact_google_map',
			[
				'label' => __( 'Contact Google Map', 'endless-addons' ),
				'tab' => \Elementor\Controls_Manager::TAB_CONTENT,
				'condition' => [
                    'select_contact_style' => 'style-05',
                ]
			]
		);

		$this->add_control(
			'contact_google_map_code',
			[
				'label' => __( 'Google Map Embed Code', 'endless-addons' ),
				'type' => \Elementor\Controls_Manager::WYSIWYG,
				'input_type' => 'WYSIWYG',
				'placeholder' => __( 'Embed Code', 'endless-addons' ),
				'default' => __( '<iframe src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d3372.0724100885036!2d-90.26198178451098!3d32.30990831496168!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x862834556664e363%3A0xe90d3dbbbc0b39d!2s2929%20St%20Clair%20St%2C%20Jackson%2C%20MS%2039209%2C%20USA!5e0!3m2!1sen!2sbd!4v1622623591819!5m2!1sen!2sbd"></iframe>', 'endless-addons')
			]
		);

		$this->end_controls_section();

		$this->start_controls_section(
			'contact_info',
			[
				'label' => __( 'Contact Info', 'endless-addons' ),
				'tab' => \Elementor\Controls_Manager::TAB_CONTENT,
				'condition' => [
                    'select_contact_style' => array('style-01', 'style-02', 'style-03', 'style-04')
                ]
			]
		);

		$this->add_control(
			'contact_info_title',
			[
				'label' => __( 'Contact Info Title', 'endless-addons' ),
				'type' => \Elementor\Controls_Manager::TEXT,
				'input_type' => 'text',
				'placeholder' => __( 'Title', 'endless-addons' ),
				'default'  => __( 'Get in touch', 'endless-addons' ),
				'condition' => [
                    'select_contact_style' => array('style-01', 'style-02', 'style-03')
                ]
			]
		);

		$this->add_control(
			'contact_info_desc',
			[
				'label' => __( 'Contact Info Description', 'endless-addons' ),
				'type' => \Elementor\Controls_Manager::TEXTAREA,
				'input_type' => 'textarea',
				'placeholder' => __( 'Description', 'endless-addons' ),
				'default' => __( 'Quis ipsum suspendisse ultrices gravida. Risus commodo viverra maecenas accumsan lacus vel facilisis.', 'endless-addons'),
				'condition' => [
                    'select_contact_style' => array('style-01', 'style-02', 'style-03')
                ]
			]
		);

		$this->add_control(
			'contact_info_bg_img',
			[
				'label' => __( 'Background Image', 'endless-addons' ),
				'type' => \Elementor\Controls_Manager::MEDIA,
				'show_label' => true,
				'condition' => [
                    'select_contact_style' => array('style-03')
                ]
			]
		);

		$repeater = new \Elementor\Repeater();

		$repeater->add_control(
			'icon_type',
			[
				'label' => __( 'Icon Type', 'endless-addons' ),
				'type' => \Elementor\Controls_Manager::SELECT,
				'input_type' => 'SELECT',
				'options' => [
					'general' => __( 'General', 'endless-addons' ),
					'library' => __( 'Library', 'endless-addons' ),
				],
				'default' => 'general'
			]
		);

		$repeater->add_control(
			'single_contact_icon1', [
				'label' => __( 'Icon', 'endless-addons' ),
				'type' => \Elementor\Controls_Manager::ICON,
				'show_label' => true,
				'options' => endless_addons_icons(),
				'condition' => [
                    'icon_type' => 'general'
                ]
			]
		);

		$repeater->add_control(
			'single_contact_icon2', [
				'label' => __( 'Icon', 'endless-addons' ),
				'type' => \Elementor\Controls_Manager::ICONS,
				'show_label' => true,
				'options' => endless_addons_icons(),
				'condition' => [
                    'icon_type' => 'library'
                ]
			]
		);

		$repeater->add_control(
			'single_contact_title', [
				'label' => __( 'Title', 'endless-addons' ),
				'type' => \Elementor\Controls_Manager::TEXT,
				'input_type' => 'text',
				'placeholder' => __( 'Title', 'endless-addons' ),
				'default'  => __( 'Address', 'endless-addons' )
			]
		);

		$repeater->add_control(
			'single_contact_content', [
				'label' => __( 'Content', 'endless-addons' ),
				'type' => \Elementor\Controls_Manager::TEXTAREA,
				'input_type' => 'textarea',
				'placeholder' => __( 'Content', 'endless-addons' ),
				'default'  => __( '2929 Saint Clair Street Greenwood, MS 38930', 'endless-addons' )
			]
		);

		$this->add_control(
			'single_contact_info',
			[
				'label' => __( 'Single Contact Info', 'endless-addons' ),
				'type' => \Elementor\Controls_Manager::REPEATER,
				'fields' => $repeater->get_controls(),
				'default' => [
					[
						'list_title' => __( 'Single Contact #1', 'endless-addons' ),
						'list_content' => __( 'Single Contact Content', 'endless-addons' ),
					],
				
				],
			]
		);

		$this->end_controls_section();

		$this->start_controls_section(
			'contact_form',
			[
				'label' => __( 'Contact Form', 'endless-addons' ),
				'tab' => \Elementor\Controls_Manager::TAB_CONTENT
			]
		);

		$this->add_control(
			'contact_form_title',
			[
				'label' => __( 'Contact Form Title', 'endless-addons' ),
				'type' => \Elementor\Controls_Manager::TEXT,
				'input_type' => 'text',
				'placeholder' => __( 'Title', 'endless-addons' ),
				'default'  => __( 'Drop us a message', 'endless-addons' )
			]
		);

		$this->add_control(
			'contact_form_type',
			[
				'label' => __( 'Form Type', 'endless-addons' ),
				'type' => \Elementor\Controls_Manager::SELECT,
				'input_type' => 'SELECT',
				'options' => [
					'dropdown' => __( 'Dropdown', 'endless-addons' ),
					'shortcode' => __( 'Shortcode', 'endless-addons' ),
				],
				'default' => 'dropdown'
			]
		);

		$this->add_control(
            'select_contact_form',
            [
                'label' => esc_html__('Select Form', 'endless-addons'),
                'type' => \Elementor\Controls_Manager::SELECT,
                'label_block' => true,
                'options' => endless_addons_get_wpcf7_list(),
                'default' => '0',
                'condition' => [
                    'contact_form_type' => 'dropdown'
                ]
            ]
        );

		$this->add_control(
			'contact_form_shortcode',
			[
				'label' => __( 'Contact Form Shortcode', 'endless-addons' ),
				'type' => \Elementor\Controls_Manager::TEXTAREA,
				'input_type' => 'text',
				'placeholder' => __( 'Shortcode', 'endless-addons' ),
				'condition' => [
                    'contact_form_type' => 'shortcode'
                ]
			]
		);

		$this->add_control(
            'contact_form_error_messages',
            [
                'label' => __('Error Messages', 'endless-addons'),
                'type' => \Elementor\Controls_Manager::SELECT,
                'default' => 'show',
                'options' => [
                    'show' => __('Show', 'endless-addons'),
                    'hide' => __('Hide', 'endless-addons'),
                ],
                'selectors_dictionary' => [
                    'show' => 'block',
                    'hide' => 'none',
                ],
                'selectors' => [
                    '{{WRAPPER}} .ea-contact-form .wpcf7-not-valid-tip' => 'display: {{VALUE}} !important;',
                ],
            ]
        );

        $this->add_control(
            'contact_form_validation_errors',
            [
                'label' => __('Validation Errors', 'endless-addons'),
                'type' => \Elementor\Controls_Manager::SELECT,
                'default' => 'show',
                'options' => [
                    'show' => __('Show', 'endless-addons'),
                    'hide' => __('Hide', 'endless-addons'),
                ],
                'selectors_dictionary' => [
                    'show' => 'block',
                    'hide' => 'none',
                ],
                'selectors' => [
                    '{{WRAPPER}} .ea-contact-form .wpcf7-validation-errors' => 'display: {{VALUE}} !important;',
                ],
            ]
        );

		$this->end_controls_section();

		$this->start_controls_section(
			'contact_section_style',
			[
				'label' => __( 'Section Style', 'endless-addons' ),
				'tab' => \Elementor\Controls_Manager::TAB_STYLE
			]
		);

		$this->add_control(
			'contact_bg_color',
			[
				'label' => __( 'Background Color', 'endless-addons' ),
				'type' => \Elementor\Controls_Manager::COLOR,
				'selectors' => [
                    '{{WRAPPER}} .ea-contact-form-area' => 'background: {{VALUE}}'
                ],
                'condition' => [
                    'select_contact_style' => array('style-01', 'style-03', 'style-05', 'style-06', 'style-07'),
                ]
			]
		);

		$this->add_control(
			'section_title_color',
			[
				'label' => __( 'Section Title Color', 'endless-addons' ),
				'type' => \Elementor\Controls_Manager::COLOR,
				'selectors' => [
                    '{{WRAPPER}} .ea-contact-form-area .section-title h2' => 'color: {{VALUE}}'
                ]
			]
		);

		$this->add_group_control(
            \Elementor\Group_Control_Typography::get_type(),
            [
                'name' => 'section_title_typography',
                'label' => __( 'Section Title Typography', 'endless-addons' ),
                'scheme' => \Elementor\Core\Schemes\Typography::TYPOGRAPHY_1,
                'selector' => '{{WRAPPER}} .ea-contact-form-area .section-title h2'
            ]
        );

        $this->add_control(
			'section_desc_color',
			[
				'label' => __( 'Section Description Color', 'endless-addons' ),
				'type' => \Elementor\Controls_Manager::COLOR,
				'selectors' => [
                    '{{WRAPPER}} .ea-contact-form-area .section-title p' => 'color: {{VALUE}}'
                ]
			]
		);

        $this->add_group_control(
            \Elementor\Group_Control_Typography::get_type(),
            [
                'name' => 'section_desc_typography',
                'label' => __( 'Section Description Typography', 'endless-addons' ),
                'scheme' => \Elementor\Core\Schemes\Typography::TYPOGRAPHY_1,
                'selector' => '{{WRAPPER}} .ea-contact-form-area .section-title p'
            ]
        );

        $this->end_controls_section();

        $this->start_controls_section(
			'contact_img_style',
			[
				'label' => __( 'Image Style', 'endless-addons' ),
				'tab' => \Elementor\Controls_Manager::TAB_STYLE,
				'condition' => [
                    'select_contact_style' => array('style-06', 'style-07')
                ]
			]
		);

        $this->add_control(
			'contact_img_height',
			[
				'label' => __( 'Featured Image Height', 'endless-addons' ),
				'type' => \Elementor\Controls_Manager::SLIDER,
				'range' => [
					'px' => [
						'min' => 50,
						'max' => 500
					]
				],
				'selectors' => [
					'{{WRAPPER}} .ea-contact-form-area .ea-contact-img img, .ea-contact-form-area .ea-img-two img' => 'height: {{SIZE}}{{UNIT}}',
				]
			]
		);

		$this->add_control(
			'contact_img_width',
			[
				'label' => __( 'Featured Image Width', 'endless-addons' ),
				'type' => \Elementor\Controls_Manager::SLIDER,
				'range' => [
					'px' => [
						'min' => 50,
						'max' => 500
					]
				],
				'selectors' => [
					'{{WRAPPER}} .ea-contact-form-area .ea-contact-img img, .ea-contact-form-area .ea-img-two img' => 'width: {{SIZE}}{{UNIT}}',
				],
			]
		);

		$this->add_control(
            'contact_img_border_radius',
            [
                'label' => __( 'Image Border Radius', 'endless-addons' ),
                'type' => \Elementor\Controls_Manager::DIMENSIONS,
                'size_units' => [ 'px', '%' ],
                'separator' => 'after',
                'selectors' => [
                    '{{WRAPPER}} .ea-contact-form-area .ea-contact-img img, .ea-contact-form-area .ea-img-two img' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
                ],
            ]
        );

		$this->end_controls_section();

		$this->start_controls_section(
			'contact_form_style',
			[
				'label' => __( 'Form Style', 'endless-addons' ),
				'tab' => \Elementor\Controls_Manager::TAB_STYLE
			]
		);

		$this->add_control(
			'contact_form_heading_color',
			[
				'label' => __( 'Heading Color', 'endless-addons' ),
				'type' => \Elementor\Controls_Manager::COLOR,
				'selectors' => [
                    '{{WRAPPER}} .ea-contact-form h3' => 'color: {{VALUE}}'
                ],
                'condition' => [
                    'select_contact_style' => array('style-01', 'style-02', 'style-03', 'style-05', 'style-06', 'style-07')
                ]
			]
		);

		$this->add_group_control(
            \Elementor\Group_Control_Typography::get_type(),
            [
                'name' => 'contact_form_heading_typography',
                'label' => __( 'Heading Typography', 'endless-addons' ),
                'scheme' => \Elementor\Core\Schemes\Typography::TYPOGRAPHY_1,
                'selector' => '{{WRAPPER}} .ea-contact-form h3',
                'condition' => [
	                'select_contact_style' => array('style-01', 'style-02', 'style-03', 'style-05', 'style-06', 'style-07')
	            ]
            ]
        );

		$this->add_control(
			'contact_label_color',
			[
				'label' => __( 'Label Color', 'endless-addons' ),
				'type' => \Elementor\Controls_Manager::COLOR,
				'selectors' => [
                    '{{WRAPPER}} .ea-contact-form label' => 'color: {{VALUE}}'
                ]
			]
		);

		$this->add_group_control(
            \Elementor\Group_Control_Typography::get_type(),
            [
                'name' => 'contact_label_typography',
                'label' => __( 'Label Typography', 'endless-addons' ),
                'scheme' => \Elementor\Core\Schemes\Typography::TYPOGRAPHY_1,
                'selector' => '{{WRAPPER}} .ea-contact-form label'
            ]
        );

        $this->add_control(
			'contact_placeholder_color',
			[
				'label' => __( 'Placeholder Color', 'endless-addons' ),
				'type' => \Elementor\Controls_Manager::COLOR,
				'selectors' => [
                    '{{WRAPPER}} .ea-contact-form input::placeholder, .ea-contact-form textarea::placeholder' => 'color: {{VALUE}} !important'
                ]
			]
		);

        $this->add_group_control(
            \Elementor\Group_Control_Typography::get_type(),
            [
                'name' => 'contact_placeholder_typography',
                'label' => __( 'Placeholder Typography', 'endless-addons' ),
                'scheme' => \Elementor\Core\Schemes\Typography::TYPOGRAPHY_1,
                'selector' => '{{WRAPPER}} .ea-contact-form input::placeholder, .ea-contact-form textarea::placeholder'
            ]
        );

		$this->end_controls_section();

		$this->start_controls_section(
			'contact_details_style',
			[
				'label' => __( 'Details Style', 'endless-addons' ),
				'tab' => \Elementor\Controls_Manager::TAB_STYLE,
				'condition' => [
	                'select_contact_style' => array('style-01', 'style-02', 'style-03')
	            ]
			],
		);

		$this->add_control(
			'contact_details_heading_color',
			[
				'label' => __( 'Heading Color', 'endless-addons' ),
				'type' => \Elementor\Controls_Manager::COLOR,
				'selectors' => [
                    '{{WRAPPER}} .ea-get-in-touch h3' => 'color: {{VALUE}}'
                ]
			]
		);

		$this->add_group_control(
            \Elementor\Group_Control_Typography::get_type(),
            [
                'name' => 'contact_details_heading_typography',
                'label' => __( 'Heading Typography', 'endless-addons' ),
                'scheme' => \Elementor\Core\Schemes\Typography::TYPOGRAPHY_1,
                'selector' => '{{WRAPPER}} .ea-get-in-touch h3',
            ]
        );

        $this->add_control(
			'contact_details_desc_color',
			[
				'label' => __( 'Description Color', 'endless-addons' ),
				'type' => \Elementor\Controls_Manager::COLOR,
				'selectors' => [
                    '{{WRAPPER}} .ea-get-in-touch p' => 'color: {{VALUE}}'
                ]
			]
		);

		$this->add_group_control(
            \Elementor\Group_Control_Typography::get_type(),
            [
                'name' => 'contact_details_desc_typography',
                'label' => __( 'Description Typography', 'endless-addons' ),
                'scheme' => \Elementor\Core\Schemes\Typography::TYPOGRAPHY_1,
                'selector' => '{{WRAPPER}} .ea-get-in-touch p',
            ]
        );

        $this->add_control(
			'contact_details_title_color',
			[
				'label' => __( 'Title Color', 'endless-addons' ),
				'type' => \Elementor\Controls_Manager::COLOR,
				'selectors' => [
                    '{{WRAPPER}} .ea-get-in-touch ul li span' => 'color: {{VALUE}}'
                ]
			]
		);

		$this->add_group_control(
            \Elementor\Group_Control_Typography::get_type(),
            [
                'name' => 'contact_details_title_typography',
                'label' => __( 'Title Typography', 'endless-addons' ),
                'scheme' => \Elementor\Core\Schemes\Typography::TYPOGRAPHY_1,
                'selector' => '{{WRAPPER}} .ea-get-in-touch ul li span',
            ]
        );

        $this->add_control(
			'contact_details_data_color',
			[
				'label' => __( 'Data Color', 'endless-addons' ),
				'type' => \Elementor\Controls_Manager::COLOR,
				'selectors' => [
                    '{{WRAPPER}} .ea-get-in-touch ul li' => 'color: {{VALUE}}'
                ]
			]
		);

		$this->add_group_control(
            \Elementor\Group_Control_Typography::get_type(),
            [
                'name' => 'contact_details_data_typography',
                'label' => __( 'Data Typography', 'endless-addons' ),
                'scheme' => \Elementor\Core\Schemes\Typography::TYPOGRAPHY_1,
                'selector' => '{{WRAPPER}} .ea-get-in-touch ul li',
            ]
        );

		$this->end_controls_section();

		$this->start_controls_section(
			'contact_button_style',
			[
				'label' => __( 'Button Style', 'endless-addons' ),
				'tab' => \Elementor\Controls_Manager::TAB_STYLE
			],
		);

		$this->add_control(
			'button_bg_color',
			[
				'label' => __( 'Button Background Color', 'endless-addons' ),
				'type' => \Elementor\Controls_Manager::COLOR,
				'selectors' => [
                    '{{WRAPPER}} .ea-contact-form .submit-btn' => 'background: {{VALUE}}'
                ],
			]
		);

		$this->add_control(
			'button_color',
			[
				'label' => __( 'Button Color', 'endless-addons' ),
				'type' => \Elementor\Controls_Manager::COLOR,
				'selectors' => [
                    '{{WRAPPER}} .ea-contact-form .submit-btn' => 'color: {{VALUE}}'
                ],
			]
		);

		$this->add_control(
			'button_icon_color',
			[
				'label' => __( 'Button Icon Color', 'endless-addons' ),
				'type' => \Elementor\Controls_Manager::COLOR,
				'selectors' => [
                    '{{WRAPPER}} .ea-contact-form-area .ea-contact-form .submit-btn + i, .ea-contact-form-area .ea-contact-form .submit-btn + .ajax-loader + i' => 'color: {{VALUE}}'
                ],
			]
		);

		$this->add_control(
			'button_bg_hover_color',
			[
				'label' => __( 'Button Background Hover Color', 'endless-addons' ),
				'type' => \Elementor\Controls_Manager::COLOR,
				'selectors' => [
                    '{{WRAPPER}} .ea-contact-form .submit-btn:hover' => 'background: {{VALUE}}'
                ],
			]
		);

		$this->add_control(
			'button_hover_color',
			[
				'label' => __( 'Button Hover Color', 'endless-addons' ),
				'type' => \Elementor\Controls_Manager::COLOR,
				'selectors' => [
                    '{{WRAPPER}} .ea-contact-form .submit-btn:hover' => 'color: {{VALUE}}'
                ],
			]
		);

		$this->add_control(
			'button_hover_icon_color',
			[
				'label' => __( 'Button Hover Icon Color', 'endless-addons' ),
				'type' => \Elementor\Controls_Manager::COLOR,
				'selectors' => [
                    '{{WRAPPER}} .ea-contact-form-area .ea-contact-form .submit-btn:hover + i, .ea-contact-form-area .ea-contact-form .submit-btn:hover + .ajax-loader + i' => 'color: {{VALUE}}'
                ],
			]
		);

		$this->end_controls_section();

		$this->start_controls_section(
			'_section_overlay_style',
			[
				'label' => __('Background Overlay', 'endless-addons'),
				'tab' => \Elementor\Controls_Manager::TAB_STYLE,
				'condition' => [
                    'select_contact_style' => array('style-01', 'style-02', 'style-03', 'style-04', 'style-05', 'style-07'),
                ]
			]
		);

		$this->start_controls_tabs('_tabs_overlay_style');

		$this->start_controls_tab(
			'_tab_overlay_normal',
			[
				'label' => __('Normal', 'endless-addons'),
			]
		);

		$this->add_group_control(
			\Elementor\Group_Control_Background::get_type(),
			[
				'name'     => 'hover_overlay_normal',
				'label' => __('Background', 'endless-addons'),
				'show_label' => true,
				'types' => ['classic', 'gradient'],
				'exclude' => [
					'classic' => 'image'
				],
				'selector' => '{{WRAPPER}} .ea-contact-form-area, .ea-contact-form-area.style-two, .ea-contact-form-area.style-four::before',
			]
		);

		$this->end_controls_tab();

		$this->start_controls_tab(
			'_tab_overlay_hover',
			[
				'label' => __('Hover', 'endless-addons'),
			]
		);


		$this->add_group_control(
			\Elementor\Group_Control_Background::get_type(),
			[
				'name'     => 'hover_overlay_hover',
				'label' => __('Background', 'endless-addons'),
				'show_label' => true,
				'types' => ['classic', 'gradient'],
				'exclude' => [
					'classic' => 'image'
				],
				'selector' => '{{WRAPPER}} .ea-contact-form-area:hover, .ea-contact-form-area.style-two:hover, .ea-contact-form-area.style-four:hover::before',
			]
		);

		$this->end_controls_tab();

		$this->end_controls_tabs();

		$this->end_controls_section();

		require plugin_dir_path( dirname( __FILE__ ) ) . 'floating/ea-contact-floating.php';

	}

	/**
	 * Render Contact widget output on the frontend.
	 *
	 * Written in PHP and used to generate the final HTML.
	 *
	 * @since 1.0.5
	 * @access protected
	 */
	protected function render() {

		$settings = $this->get_settings_for_display(); 

		if( $settings['show_contact'] == 'show' ) : 

			if( $settings['select_contact_style'] == 'style-01' ) : ?>
				<!-- Start Contact Form Design One Area -->
		        <section class="ea-contact-form-area pb-100">
		            <div class="container">
		                <div class="section-title">
		                    <h2><?php echo esc_html__($settings['contact_title']); ?></h2>
		                    <p><?php echo wp_kses_post($settings['contact_desc']); ?></p>
		                </div>

		                <div class="row">
		                    <div class="col-lg-8">
		                        <div class="ea-contact-form ea-mb-30">
		                            <h3><?php echo esc_html__($settings['contact_form_title']); ?></h3>
                                    <?php if($settings['contact_form_type'] == 'dropdown' && !empty($settings['select_contact_form'])) :
	                                        echo do_shortcode('[contact-form-7 id="' . $settings['select_contact_form'] . '" ]');
	                                else:
                                        echo do_shortcode($settings['contact_form_shortcode']);
                                    endif; ?>
                                </div>
		                    </div>
		                    <div class="col-lg-4">
		                        <div class="ea-get-in-touch">
		                            <h3><?php echo esc_html__($settings['contact_info_title']); ?></h3>
		                            <p><?php echo wp_kses_post($settings['contact_info_desc']); ?></p>
		                            <ul>
		                            	<?php foreach ( $settings['single_contact_info'] as $item ) : ?>
			                                <li>
			                                	<?php if( $item['icon_type'] == 'general' ) : ?>
			                                	    <i class="<?php echo wp_kses_post( $item['single_contact_icon1'] ); ?>"></i>
			                                	<?php else: 
			                                		endad_render_icon( $item, 'icon', 'single_contact_icon2' ); 
			                                	endif; ?>
			                                    <span><?php echo esc_html__($item['single_contact_title']); ?></span>
			                                    <?php echo wp_kses_post($item['single_contact_content']); ?>
			                                </li>
		                                <?php endforeach; ?>
		                            </ul>
		                        </div>
		                    </div>
		                </div>
		            </div>
		        </section>
		        <!-- End Contact Form Design One Area -->
			<?php elseif( $settings['select_contact_style'] == 'style-02' ) : ?>
				<!-- Start Contact Form Design Two Area -->
		        <section class="ea-contact-form-area style-two pt-100">
		            <div class="container">
		                <div class="section-title">
		                    <h2><?php echo esc_html__($settings['contact_title']); ?></h2>
		                    <p><?php echo wp_kses_post($settings['contact_desc']); ?></p>
		                </div>
		                <div class="row">
		                	<div class="col-lg-4">
		                        <div class="ea-get-in-touch style-two ea-mb-30">
		                            <h3><?php echo esc_html__($settings['contact_info_title']); ?></h3>
		                            <p><?php echo wp_kses_post($settings['contact_info_desc']); ?></p>
		                            <ul>
		                            	<?php foreach ( $settings['single_contact_info'] as $item ) : ?>
			                                <li>
			                                	<?php if( $item['icon_type'] == 'general' ) : ?>
			                                	    <i class="<?php echo wp_kses_post( $item['single_contact_icon1'] ); ?>"></i>
			                                	<?php else: 
			                                		endad_render_icon( $item, 'icon', 'single_contact_icon2' ); 
			                                	endif; ?>
			                                    <span><?php echo esc_html__($item['single_contact_title']); ?></span>
			                                    <?php echo wp_kses_post($item['single_contact_content']); ?>
			                                </li>
		                                <?php endforeach; ?>
		                            </ul>
		                        </div>
		                    </div>
		                    <div class="col-lg-8">
		                        <div class="ea-contact-form style-two">
		                            <h3><?php echo esc_html__($settings['contact_form_title']); ?></h3>
                                    <?php if($settings['contact_form_type'] == 'dropdown' && !empty($settings['select_contact_form'])) :
	                                        echo do_shortcode('[contact-form-7 id="' . $settings['select_contact_form'] . '" ]');
	                                else:
                                        echo do_shortcode($settings['contact_form_shortcode']); 
                                    endif; ?>
		                        </div>
		                    </div>
		                </div>
		            </div>
		        </section>
		        <!-- End Contact Form Design Two Area -->
			<?php elseif( $settings['select_contact_style'] == 'style-03' ) : ?>
				<!-- Start Contact Form Design Three Area -->
		        <section class="ea-contact-form-area ptb-100">
		            <div class="container">
		                <div class="section-title">
		                    <h2><?php echo esc_html__($settings['contact_title']); ?></h2>
		                    <p><?php echo wp_kses_post($settings['contact_desc']); ?></p>
		                </div>
		                <div class="row align-items-center">
		                	<div class="col-lg-6">
		                        <div class="ea-contact-form style-three ea-mb-30">
		                            <h3><?php echo esc_html__($settings['contact_form_title']); ?></h3>
                                    <?php if($settings['contact_form_type'] == 'dropdown' && !empty($settings['select_contact_form'])) :
	                                        echo do_shortcode('[contact-form-7 id="' . $settings['select_contact_form'] . '" ]');
	                                else:
                                        echo do_shortcode($settings['contact_form_shortcode']); 
                                    endif; ?>
		                        </div>
		                    </div>
		                	<div class="col-lg-6">
		                        <div class="ea-get-in-touch style-three" style="background-image:url(<?php echo esc_url( $settings['contact_info_bg_img']['url'] ); ?>);">
		                            <h3><?php echo esc_html__($settings['contact_info_title']); ?></h3>
		                            <p><?php echo wp_kses_post($settings['contact_info_desc']); ?></p>
		                            <ul>
		                            	<?php foreach ( $settings['single_contact_info'] as $item ) : ?>
			                                <li>
			                                	<?php if( $item['icon_type'] == 'general' ) : ?>
			                                	    <i class="<?php echo wp_kses_post( $item['single_contact_icon1'] ); ?>"></i>
			                                	<?php else: 
			                                		endad_render_icon( $item, 'icon', 'single_contact_icon2' ); 
			                                	endif; ?>
			                                    <span><?php echo esc_html__($item['single_contact_title']); ?></span>
			                                    <?php echo wp_kses_post($item['single_contact_content']); ?>
			                                </li>
		                                <?php endforeach; ?>
		                            </ul>
		                        </div>
		                    </div>
		                </div>
		            </div>
		        </section>
		        <!-- End Contact Form Design Three Area -->
			<?php elseif( $settings['select_contact_style'] == 'style-04' ) : ?>
				<!-- Start Contact Form Design Four Area -->
		        <section class="ea-contact-form-area style-four ptb-100">
		            <div class="container">
		                <div class="section-title white-title">
		                    <h2><?php echo esc_html__($settings['contact_title']); ?></h2>
		                    <p><?php echo wp_kses_post($settings['contact_desc']); ?></p>
		                </div>
		                <div class="ea-contact-form style-four">
                            <?php if($settings['contact_form_type'] == 'dropdown' && !empty($settings['select_contact_form'])) :
                                    echo do_shortcode('[contact-form-7 id="' . $settings['select_contact_form'] . '" ]');
                            else:
                                echo do_shortcode($settings['contact_form_shortcode']); 
                            endif; ?>
	                        <div class="row">
                            	<?php foreach ( $settings['single_contact_info'] as $item ) : ?>
	                                <div class="contact-info-col">
	                                	<div class="ea-single-contact-info">
		                                	<?php if( $item['icon_type'] == 'general' ) : ?>
		                                	    <i class="<?php echo wp_kses_post( $item['single_contact_icon1'] ); ?>"></i>
		                                	<?php else: 
		                                		endad_render_icon( $item, 'icon', 'single_contact_icon2' ); 
		                                	endif; ?>
		                                    <span><?php echo esc_html__($item['single_contact_title']); ?></span>
		                                    <?php echo wp_kses_post($item['single_contact_content']); ?>
	                                    </div>
	                                </div>
                                <?php endforeach; ?>
	                        </div>
		                </div>
		            </div>
		        </section>
		        <!-- End Contact Form Design Four Area -->
			<?php elseif( $settings['select_contact_style'] == 'style-05' ) : ?>
				<!-- Start Contact Form Design Five Area -->
		        <section class="ea-contact-form-area ptb-100">
		            <div class="container">
		                <div class="section-title">
		                    <h2><?php echo esc_html__($settings['contact_title']); ?></h2>
		                    <p><?php echo wp_kses_post($settings['contact_desc']); ?></p>
		                </div>
		                <div class="row align-items-center">
		                	<div class="col-lg-6">
		                        <div class="ea-map">
		                        	<?php echo __($settings['contact_google_map_code']); ?>
		                        </div>
		                    </div>
		                    <div class="col-lg-6">
		                        <div class="ea-contact-form style-five ea-mt-30">
		                            <h3><?php echo esc_html__($settings['contact_form_title']); ?></h3>
                                    <?php if($settings['contact_form_type'] == 'dropdown' && !empty($settings['select_contact_form'])) :
	                                        echo do_shortcode('[contact-form-7 id="' . $settings['select_contact_form'] . '" ]');
	                                else:
                                        echo do_shortcode($settings['contact_form_shortcode']); 
                                    endif; ?>
		                        </div>
		                    </div>
		                </div>
		            </div>
		        </section>
		        <!-- End Contact Form Design Five Area -->
			<?php elseif( $settings['select_contact_style'] == 'style-06' ) : ?>
				<!-- Start Contact Form Design Six Area -->
		        <section class="ea-contact-form-area style-six pt-100">
		            <div class="container">
		                <div class="section-title">
		                    <h2><?php echo esc_html__($settings['contact_title']); ?></h2>
		                    <p><?php echo wp_kses_post($settings['contact_desc']); ?></p>
		                </div>
		                <div class="row align-items-end">
		                    <div class="col-lg-6">
		                        <div class="ea-contact-form style-six pb-70">
		                            <h3><?php echo esc_html__($settings['contact_form_title']); ?></h3>
                                    <?php if($settings['contact_form_type'] == 'dropdown' && !empty($settings['select_contact_form'])) :
	                                        echo do_shortcode('[contact-form-7 id="' . $settings['select_contact_form'] . '" ]');
	                                else:
                                        echo do_shortcode($settings['contact_form_shortcode']); 
                                    endif; ?>
		                        </div>
		                    </div>
		                    <div class="col-lg-6">
		                    	<?php if( ! $settings['contact_featured_img']['url'] == '' ) : ?>
			                        <div class="ea-contact-img ea-elementor-floating">
			                            <img src="<?php echo esc_url( $settings['contact_featured_img']['url'] ); ?>" alt="image">
			                        </div>
		                        <?php endif; ?>
		                    </div>
		                </div>
		            </div>
		        </section>
		        <!-- End Contact Form Design Six Area -->
			<?php elseif( $settings['select_contact_style'] == 'style-07' ) : ?>
				<!-- Start Contact Form Design Seven Area -->
		        <section class="ea-contact-form-area style-seven bg-shape pt-100">
		            <div class="container">
		                <div class="section-title">
		                    <h2><?php echo esc_html__($settings['contact_title']); ?></h2>
		                    <p><?php echo wp_kses_post($settings['contact_desc']); ?></p>
		                </div>
		                <div class="ea-contact-bg">
			                <div class="row align-items-center">
			                	<div class="col-lg-6">
			                        <div class="ea-img-two ea-elementor-floating">
			                        	<?php if( ! $settings['contact_featured_img']['url'] == '' ) : ?>
			                                <img src="<?php echo esc_url( $settings['contact_featured_img']['url'] ); ?>" alt="image">
		                                <?php endif; ?>
			                        </div>
			                    </div>
			                    <div class="col-lg-6">
			                        <div class="ea-contact-form style-seven">
			                            <h3><?php echo esc_html__($settings['contact_form_title']); ?></h3>
	                                    <?php if($settings['contact_form_type'] == 'dropdown' && !empty($settings['select_contact_form'])) :
	                                        echo do_shortcode('[contact-form-7 id="' . $settings['select_contact_form'] . '" ]');
		                                else:
	                                        echo do_shortcode($settings['contact_form_shortcode']); 
	                                    endif; ?>
			                        </div>
			                    </div>
			                </div>
			            </div>
		            </div>
		        </section>
		        <!-- End Contact Form Design Seven Area -->
			<?php endif;

        endif;

    }

}
