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

	/**
	 * Get widget name.
	 *
	 * Retrieve Ninja Form widget name.
	 *
	 * @since 1.0.5
	 * @access public
	 *
	 * @return string Widget name.
	 */
	public function get_name() {
		return 'ninja-form';
	}

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

	/**
	 * Get widget icon.
	 *
	 * Retrieve Ninja Form 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 Ninja Form widget belongs to.
	 *
	 * @since 1.0.5
	 * @access public
	 *
	 * @return array Widget categories.
	 */
	public function get_categories() {
		return [ 'endless-elements' ];
	}

	/**
	 * Register Ninja Form 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_ninja_form',
			[
				'label' => __( 'Show/Hide Ninja Form 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_ninja_form_style',
			[
				'label' => __( 'Select Ninja Form 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' )
				],
				'default' => 'style-01'
			]
		);

		$this->end_controls_section();

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

		$this->add_control(
			'section_title',
			[
				'label' => __( 'Section Title', 'endless-addons' ),
				'type' => \Elementor\Controls_Manager::TEXT,
				'input_type' => 'text',
				'placeholder' => __( 'Title', 'endless-addons' ),
				'default'  => __( 'Contact Form 01', 'endless-addons' )
			]
		);

		$this->add_control(
			'section_desc',
			[
				'label' => __( 'Section 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-ninja-form-area',
			]
		);

		$this->end_controls_section();

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

		$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'  => __( 'Our Contact Information', 'endless-addons' )
			]
		);

		$repeater = new \Elementor\Repeater();

		$repeater->add_control(
			'ninja_form_contact_info_img',
			[
				'label' => __( 'Contact Info Image', 'endless-addons' ),
				'type' => \Elementor\Controls_Manager::MEDIA,
				'show_label' => true
			]
		);

		$repeater->add_control(
			'single_contact_content', [
				'label' => __( 'Content', 'endless-addons' ),
				'type' => \Elementor\Controls_Manager::TEXTAREA,
				'input_type' => 'textarea',
				'placeholder' => __( 'Content', 'endless-addons' ),
				'default'  => __( 'Upper Level, Overseas Passenger Terminal, <br> The Rocks, Sydney 2000.', '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(
			'social_media_list',
			[
				'label' => __( 'Social Media List', 'endless-addons' ),
				'tab' => \Elementor\Controls_Manager::TAB_CONTENT,
				'condition' => [
                    'select_ninja_form_style' => 'style-01'
                ]
			]
		);

		$this->add_control(
			'social_media_title',
			[
				'label' => __( 'Social Media Title', 'endless-addons' ),
				'type' => \Elementor\Controls_Manager::TEXT,
				'input_type' => 'text',
				'placeholder' => __( 'Title', 'endless-addons' ),
				'default'  => __( 'Follow us on:', 'endless-addons' )
			]
		);

		$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(
			'social_media_icon1', 
			[
				'label' => __( 'Icon', 'endless-addons' ),
				'type' => \Elementor\Controls_Manager::ICON,
				'input_type' => 'icon',
				'default'  => 'bx bxl-facebook',
				'show_label' => true,
				'options' => endless_addons_icons(),
				'condition' => [
                    'icon_type' => 'general'
                ]
			]
		);

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

		$repeater->add_control(
			'social_media_link',
			[
				'label' => __( 'Link', 'endless-addons' ),
				'type' => \Elementor\Controls_Manager::URL,
				'input_type' => 'url',
				'default' => [
					'url' => '#',
					'is_external' => true,
					'nofollow' => true
				]
			]
		);

		$repeater->add_control(
			'social_media_color',
			[
				'label' => __( 'Color', 'endless-addons' ),
				'type' => \Elementor\Controls_Manager::COLOR
			]
		);

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

		$this->end_controls_section();

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

		$this->add_control(
			'ninja_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_ninja_form',
            [
                'label' => esc_html__('Select Form', 'endless-addons'),
                'type' => \Elementor\Controls_Manager::SELECT,
                'label_block' => true,
                'options' => endless_addons_get_ninjaforms_list(),
                'default' => '0',
                'condition' => [
                    'ninja_form_type' => 'dropdown'
                ]
            ]
        );

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

		$this->add_control(
            '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-ninja-contact-form .nf-error-wrap .nf-error-required-error' => 'display: {{VALUE}} !important;',
                ],
            ]
        );

        $this->add_control(
            '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-ninja-contact-form .nf-form-errors .nf-error-field-errors' => 'display: {{VALUE}} !important;',
                ],
            ]
        );

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

		$this->add_control(
			'ninja_form_shape_img1',
			[
				'label' => __( 'Shape Image 1', 'endless-addons' ),
				'type' => \Elementor\Controls_Manager::MEDIA,
				'show_label' => true,
				'condition' => [
                    'select_ninja_form_style' => array('style-02', 'style-04')
                ]
			]
		);

		$this->add_control(
			'ninja_form_shape_img2',
			[
				'label' => __( 'Shape Image 2', 'endless-addons' ),
				'type' => \Elementor\Controls_Manager::MEDIA,
				'show_label' => true,
				'condition' => [
                    'select_ninja_form_style' => 'style-02'
                ]
			]
		);

		$this->add_control(
			'ninja_form_shape_img3',
			[
				'label' => __( 'Shape Image 3', 'endless-addons' ),
				'type' => \Elementor\Controls_Manager::MEDIA,
				'show_label' => true,
				'condition' => [
                    'select_ninja_form_style' => 'style-02'
                ]
			]
		);

		$this->add_control(
			'ninja_form_shape_img4',
			[
				'label' => __( 'Shape Image 4', 'endless-addons' ),
				'type' => \Elementor\Controls_Manager::MEDIA,
				'show_label' => true,
				'condition' => [
                    'select_ninja_form_style' => 'style-02'
                ]
			]
		);

		$this->end_controls_section();

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

		$this->add_control(
			'section_title_color',
			[
				'label' => __( 'Section Title Color', 'endless-addons' ),
				'type' => \Elementor\Controls_Manager::COLOR,
				'selectors' => [
                    '{{WRAPPER}} .ea-ninja-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-ninja-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-ninja-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-ninja-form-area .section-title p'
            ]
        );

		$this->end_controls_section();

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

		$this->add_control(
            'ninja_form_padding',
            [
                'label'         => esc_html__( 'Form Field Padding', 'endless-addons' ),
                'type'          => \Elementor\Controls_Manager::DIMENSIONS,
                'size_units'    => [ 'px', '%', 'em' ],
                'selectors'     => [
                    '{{WRAPPER}} .ea-ninja-contact-form .nf-field-element .ninja-forms-field:not(input[type=checkbox]):not(input[type=submit]):not(input[type=button]):not(input[type=radio]):not(hr)' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
                ],
            ]
        );

        $this->add_control(
            'ninja_form_margin',
            [
                'label'         => esc_html__( 'Form Field Margin', 'endless-addons' ),
                'type'          => \Elementor\Controls_Manager::DIMENSIONS,
                'size_units'    => [ 'px', '%', 'em' ],
                'selectors'     => [
                    '{{WRAPPER}} .ea-ninja-contact-form .nf-field-element .ninja-forms-field:not(input[type=checkbox]):not(input[type=submit]):not(input[type=button]):not(input[type=radio]):not(hr)' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
                ],
            ]
        );

        $this->add_control(
			'ninja_form_btn_bg_color',
			[
				'label' => __( 'Button Background Color', 'endless-addons' ),
				'type' => \Elementor\Controls_Manager::COLOR,
				'selectors' => [
                    '{{WRAPPER}} .ea-ninja-contact-form .nf-field-element input[type=button]' => 'background-color: {{VALUE}}'
                ]
			]
		);

		$this->add_control(
			'ninja_form_btn_text_color',
			[
				'label' => __( 'Button Text Color', 'endless-addons' ),
				'type' => \Elementor\Controls_Manager::COLOR,
				'selectors' => [
                    '{{WRAPPER}} .ea-ninja-contact-form .nf-field-element input[type=button]' => 'color: {{VALUE}}'
                ]
			]
		);

		$this->add_control(
			'ninja_form_btn_border_color',
			[
				'label' => __( 'Button Border Color', 'endless-addons' ),
				'type' => \Elementor\Controls_Manager::COLOR,
				'selectors' => [
                    '{{WRAPPER}} .ea-ninja-contact-form .nf-field-element input[type=button]' => 'border-color: {{VALUE}}'
                ]
			]
		);

		$this->add_control(
			'ninja_form_btn_bg_hover_color',
			[
				'label' => __( 'Button Background Hover Color', 'endless-addons' ),
				'type' => \Elementor\Controls_Manager::COLOR,
				'selectors' => [
                    '{{WRAPPER}} .ea-ninja-contact-form .nf-field-element input[type=button]:hover' => 'background-color: {{VALUE}}'
                ]
			]
		);

		$this->add_control(
			'ninja_form_btn_text_hover_color',
			[
				'label' => __( 'Button Text Hover Color', 'endless-addons' ),
				'type' => \Elementor\Controls_Manager::COLOR,
				'selectors' => [
                    '{{WRAPPER}} .ea-ninja-contact-form .nf-field-element input[type=button]:hover' => 'color: {{VALUE}}'
                ]
			]
		);

		$this->add_control(
			'wp_form_btn_border_hover_color',
			[
				'label' => __( 'Button Border Hover Color', 'endless-addons' ),
				'type' => \Elementor\Controls_Manager::COLOR,
				'selectors' => [
                    '{{WRAPPER}} .ea-ninja-contact-form .nf-field-element input[type=button]:hover' => 'border-color: {{VALUE}}'
                ]
			]
		);

		$this->end_controls_section();

		$this->start_controls_section(
			'_section_overlay_style',
			[
				'label' => __('Background Overlay', 'endless-addons'),
				'tab' => \Elementor\Controls_Manager::TAB_STYLE
			]
		);

		$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-ninja-form-area.ea-style-one, .ea-ninja-form-area.ea-style-two, 
				.ea-ninja-form-area.ea-style-three, .ea-ninja-form-area.ea-style-four::before, .ea-ninja-contact-form.ea-style-five',
			]
		);

		$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-ninja-form-area.ea-style-one:hover, .ea-ninja-form-area.ea-style-two:hover, 
				.ea-ninja-form-area.ea-style-three:hover, .ea-ninja-form-area.ea-style-four:hover::before, .ea-ninja-contact-form.ea-style-five:hover',
			]
		);

		$this->end_controls_tab();

		$this->end_controls_tabs();

		$this->end_controls_section();

	}

	/**
	 * Render Ninja Form 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_ninja_form'] == 'show' ) :

			if( $settings['select_ninja_form_style'] == 'style-01' ) : ?>
				<!-- Start EA Ninja Form One Area -->
		        <section class="ea-ninja-form-area ea-style-one pb-70">
		            <div class="container">
		                <div class="section-title">
		                    <h2><?php echo esc_html($settings['section_title']); ?></h2>
		                    <p><?php echo wp_kses_post($settings['section_desc']); ?></p>
		                </div>
		                <div class="row">
		                    <div class="col-lg-6">
		                        <div class="ea-ninja-form-contact-info ea-mr-15">
		                            <h3><?php echo esc_html($settings['contact_info_title']); ?></h3>
		                            <ul class="ea-contact-info">
                                        <?php foreach ( $settings['single_contact_info'] as $item ) : ?>
			                                <li>
			                                	<?php if( ! $item['ninja_form_contact_info_img']['url'] == '' ) : ?>
			                                	    <img src="<?php echo esc_url( $item['ninja_form_contact_info_img']['url'] ); ?>" alt="image">
			                                	<?php endif; ?>
			                                    <?php echo wp_kses_post($item['single_contact_content']); ?>
			                                </li>
		                                <?php endforeach; ?>
		                            </ul>
		                            <ul class="ea-social">
		                            	<li>
		                                    <span><?php echo esc_html($settings['social_media_title']); ?></span>
		                                </li>
		                                <?php foreach ( $settings['single_social_media'] as $item ) :
		                            		$target = $item['social_media_link']['is_external'] ? ' target="_blank"' : '';
		                                    $nofollow = $item['social_media_link']['nofollow'] ? ' rel="nofollow"' : ''; ?>
		                            		<li class="ea-list-item">
		                                        <a href="<?php echo esc_url( $item['social_media_link']['url'] ); ?>" <?php echo wp_kses_post( $target ); ?> <?php echo wp_kses_post( $nofollow ); ?>>
		                                            <?php if( $item['icon_type'] == 'general' ) : ?>
					                            	    <i class="<?php echo wp_kses_post( $item['social_media_icon1'] ); ?>" style="color:<?php echo $item['social_media_color']; ?>"></i>
					                            	<?php else: 
					                            		endad_render_icon( $item, 'icon', 'social_media_icon2' ); 
					                            	endif; ?>
		                                        </a>
		                                    </li>
	                            	    <?php endforeach; ?>
		                            </ul>
		                        </div>
		                    </div>
		                    <div class="col-lg-6">
		                        <div class="ea-ninja-contact-form ea-ml-15">
		                        	<?php if($settings['ninja_form_type'] == 'dropdown' && !empty($settings['select_ninja_form'])) :
		                        		    echo Ninja_Forms()->display($settings['select_ninja_form']);
	                                        echo wpforms_display($settings['select_ninja_form']);
	                                else:
                                        echo do_shortcode($settings['ninja_form_shortcode']); 
                                    endif; ?>
		                        </div>
		                    </div>
		                </div>
		            </div>
		        </section>
		        <!-- End EA Ninja Form One Area -->
		    <?php elseif( $settings['select_ninja_form_style'] == 'style-02' ) : ?>
		    	<!-- Start EA Ninja Form Two Area -->
		        <section class="ea-ninja-form-area ea-style-two pt-100 pb-70">
		            <div class="container">
		                <div class="section-title">
		                    <h2><?php echo esc_html($settings['section_title']); ?></h2>
		                    <p><?php echo wp_kses_post($settings['section_desc']); ?></p>
		                </div>
		                <div class="row justify-content-center">
		                    <div class="col-lg-7">
		                        <div class="ea-ninja-contact-form">
                                    <?php if($settings['ninja_form_type'] == 'dropdown' && !empty($settings['select_ninja_form'])) :
		                        		    echo Ninja_Forms()->display($settings['select_ninja_form']);
	                                        echo wpforms_display($settings['select_ninja_form']);
	                                else:
                                        echo do_shortcode($settings['ninja_form_shortcode']); 
                                    endif; ?>
		                        </div>
		                    </div>
		                </div>
		            </div>
		            <?php if( ! $settings['ninja_form_shape_img1']['url'] == '' ) : ?>
			            <div class="ea-shape-1">
			                <img src="<?php echo esc_url( $settings['ninja_form_shape_img1']['url'] ); ?>" alt="Image">
			            </div>
		            <?php endif; ?>
		            <?php if( ! $settings['ninja_form_shape_img2']['url'] == '' ) : ?>
			            <div class="ea-shape-2">
			                <img src="<?php echo esc_url( $settings['ninja_form_shape_img2']['url'] ); ?>" alt="Image">
			            </div>
		            <?php endif; ?>
		            <?php if( ! $settings['ninja_form_shape_img3']['url'] == '' ) : ?>
			            <div class="ea-shape-3">
			                <img src="<?php echo esc_url( $settings['ninja_form_shape_img3']['url'] ); ?>" alt="Image">
			            </div>
		            <?php endif; ?>
		            <?php if( ! $settings['ninja_form_shape_img4']['url'] == '' ) : ?>
			            <div class="ea-shape-4">
			                <img src="<?php echo esc_url( $settings['ninja_form_shape_img4']['url'] ); ?>" alt="Image">
			            </div>
		            <?php endif; ?>
		        </section>
		        <!-- End EA Ninja Form Two Area -->
		    <?php elseif( $settings['select_ninja_form_style'] == 'style-03' ) : ?>
		    	<!-- Start EA Ninja Form Three Area -->
		        <section class="ea-ninja-form-area ea-style-three pt-100 pb-70">
		            <div class="container">
		                <div class="section-title">
		                    <h2><?php echo esc_html($settings['section_title']); ?></h2>
		                    <p><?php echo wp_kses_post($settings['section_desc']); ?></p>
		                </div>
		                <div class="row justify-content-center">
	                        <div class="ea-ninja-contact-form ea-style-three">
                                <?php if($settings['ninja_form_type'] == 'dropdown' && !empty($settings['select_ninja_form'])) :
	                        		    echo Ninja_Forms()->display($settings['select_ninja_form']);
                                        echo wpforms_display($settings['select_ninja_form']);
                                else:
                                    echo do_shortcode($settings['ninja_form_shortcode']); 
                                endif; ?>
	                        </div>
		                </div>
		            </div>
		        </section>
		        <!-- End EA Ninja Form Three Area -->
		    <?php elseif( $settings['select_ninja_form_style'] == 'style-04' ) : ?>
		    	<!-- Start EA Ninja Form Four Area -->
		        <section class="ea-ninja-form-area ea-style-four pt-100 pb-70">
		            <div class="container">
		                <div class="section-title">
		                    <h2><?php echo esc_html($settings['section_title']); ?></h2>
		                    <p><?php echo wp_kses_post($settings['section_desc']); ?></p>
		                </div>
		                <div class="row">
	                        <div class="ea-ninja-contact-form ea-style-four">
                                <?php if($settings['ninja_form_type'] == 'dropdown' && !empty($settings['select_ninja_form'])) :
	                        		    echo Ninja_Forms()->display($settings['select_ninja_form']);
                                        echo wpforms_display($settings['select_ninja_form']);
                                else:
                                    echo do_shortcode($settings['ninja_form_shortcode']); 
                                endif; ?>
	                        </div>
		                </div>
		            </div>
		            <?php if( ! $settings['ninja_form_shape_img1']['url'] == '' ) : ?>
			            <div class="ea-shape-5">
			                <img src="<?php echo esc_url( $settings['ninja_form_shape_img1']['url'] ); ?>" alt="Image">
			            </div>
		            <?php endif; ?>
		        </section>
		        <!-- End EA Ninja Form Four Area -->
		    <?php elseif( $settings['select_ninja_form_style'] == 'style-05' ) : ?>
		    	<!-- Start EA Ninja Form Five Area -->
		        <section class="ea-ninja-form-area ea-style-five bg-shape pb-70">
		            <div class="container">
		                <div class="row">
	                        <div class="ea-ninja-contact-form ea-style-five" style="background-image:url(<?php echo esc_url( $settings['form_bg_img']['url'] ); ?>);">
	                        	<div class="section-title">
				                    <h2><?php echo esc_html($settings['section_title']); ?></h2>
				                    <p><?php echo wp_kses_post($settings['section_desc']); ?></p>
				                </div>
                                <?php if($settings['ninja_form_type'] == 'dropdown' && !empty($settings['select_ninja_form'])) :
	                        		    echo Ninja_Forms()->display($settings['select_ninja_form']);
                                        echo wpforms_display($settings['select_ninja_form']);
                                else:
                                    echo do_shortcode($settings['ninja_form_shortcode']); 
                                endif; ?>
	                        </div>
		                </div>
		            </div>
		        </section>
		        <!-- End EA Ninja Form Five Area -->
            <?php endif;

        endif;
    
    }

}
