<?php
/**
 * Elementor Review Widget.
 *
 * Elementor widget that inserts an embbedable content into the page, from any given URL.
 *
 * @since 1.0.5
 */

use \Elementor\Plugin;

class Elementor_Review_Widget extends \Elementor\Widget_Base {

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

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

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

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

	/**
	 * Register Review 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_review',
			[
				'label' => __( 'Show/Hide Review 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(
			'review_style_select',
			[
				'label' => __( 'Select Review 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' )
				],
				'default' => 'style-01'
			]
		);

		$this->end_controls_section();

		$this->start_controls_section(
			'review_section',
			[
				'label' => __( 'Review 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'  => __( 'Design 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-review-design-area',
			]
		);

		$this->end_controls_section();

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

		$this->add_control(
			'review_item_column',
			[
				'label' => __( 'Review Column', 'endless-addons' ),
				'type' => \Elementor\Controls_Manager::SELECT,
				'input_type' => 'SELECT',
				'options' => [
					'columns-2' => __( '2', 'endless-addons' ),
					'columns-3' => __( '3', 'endless-addons' ),
					'columns-4' => __( '4', 'endless-addons' )
				],
				'default' => 'columns-3',
				'condition' => [
                    'review_style_select' => 'style-01'
                ]
			]
		);

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

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

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

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

		$this->add_control(
            'review_img_h_alignment',
            [
                'label' => esc_html__('Image Horizontal Alignment', 'endless-addons'),
                'type' => \Elementor\Controls_Manager::CHOOSE,
                'label_block' => true,
                'options' => [
                    'left' => [
                        'title' => esc_html__('Left', 'endless-addons'),
                        'icon' => 'fa fa-align-left',
                    ],
                    'center' => [
                        'title' => esc_html__('Center', 'endless-addons'),
                        'icon' => 'fa fa-align-center',
                    ],
                    'right' => [
                        'title' => esc_html__('Right', 'endless-addons'),
                        'icon' => 'fa fa-align-right',
                    ],
                ],
                'condition' => [
                    'review_style_select' => array('style-01', 'style-02', 'style-03', 'style-05', 'style-06')
                ]
            ]
        );

        $this->add_control(
            'review_content_h_alignment',
            [
                'label' => esc_html__('Content Horizontal Alignment', 'endless-addons'),
                'type' => \Elementor\Controls_Manager::CHOOSE,
                'label_block' => true,
                'options' => [
                    'left' => [
                        'title' => esc_html__('Left', 'endless-addons'),
                        'icon' => 'fa fa-align-left',
                    ],
                    'center' => [
                        'title' => esc_html__('Center', 'endless-addons'),
                        'icon' => 'fa fa-align-center',
                    ],
                    'right' => [
                        'title' => esc_html__('Right', 'endless-addons'),
                        'icon' => 'fa fa-align-right',
                    ],
                ],
                'condition' => [
                    'review_style_select' => array('style-01', 'style-02', 'style-03', 'style-05', 'style-06')
                ]
            ]
        );

		$repeater = new \Elementor\Repeater();	

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

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

		$repeater->add_control(
			'single_review_position', [
				'label' => __( 'Designation', 'endless-addons' ),
				'type' => \Elementor\Controls_Manager::TEXT,
				'input_type' => 'text',
				'placeholder' => __( 'Designation', 'endless-addons' ),
				'default'  => __( 'Graphic Designer', 'endless-addons' )
			]
		);

		$repeater->add_control(
			'single_review_rating1', [
				'label' => __( 'Rating', 'endless-addons' ),
				'type' => \Elementor\Controls_Manager::TEXT,
				'input_type' => 'text',
				'default'  => __( '5', 'endless-addons' ),
				'description' => 'Used only for style-01'
			]
		);

		$repeater->add_control(
			'single_review_rating2', [
				'label' => __( 'Rating', 'endless-addons' ),
				'type' => \Elementor\Controls_Manager::SELECT,
				'input_type' => 'SELECT',
				'options' => [
					'1' => __( '1', 'endless-addons' ),
					'2' => __( '2', 'endless-addons' ),
					'3' => __( '3', 'endless-addons' ),
					'4' => __( '4', 'endless-addons' ),
					'5' => __( '5', 'endless-addons' )
				],
				'default' => '5',
				'description' => 'Used for style-02, style-03, style-04, style-05, style-06'
			]
		);

		$repeater->add_control(
            'ea_content_text_type',
            [
                'label' => __('Content Type', 'endless-addons'),
                'type' => \Elementor\Controls_Manager::SELECT,
                'options' => [
                    'content' => __('Content', 'endless-addons'),
                    'template' => __('Saved Templates', 'endless-addons'),
                ],
                'default' => 'content',
            ]
        );

		$repeater->add_control(
			'single_review_comment',
			[
				'label' => __( 'Review Comment', 'endless-addons' ),
				'type' => \Elementor\Controls_Manager::WYSIWYG,
				'input_type' => 'WYSIWYG',
				'placeholder' => __( 'Comment', 'endless-addons' ),
				'default' => __( 'Here I focus on a range of items and features that we use in elementor for our client web project without giving them a second thought.', 'endless-addons'),
				'condition' => [
                    'ea_content_text_type' => 'content'
                ]
			]
		);

		$repeater->add_control(
            'ea_content_templates',
            [
                'label' => __('Choose Template', 'endless-addons'),
                'type' => \Elementor\Controls_Manager::SELECT,
                'options' => ea_get_elementor_templates(),
                'condition' => [
                    'ea_content_text_type' => 'template',
                ],
            ]
        );

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

		$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-review-design-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-review-design-area .section-title h2'
            ]
        );

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

		$this->end_controls_section();

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

		$this->add_control(
			'review_comment_color',
			[
				'label' => __( 'Reviewer Comment Color', 'endless-addons' ),
				'type' => \Elementor\Controls_Manager::COLOR,
				'selectors' => [
                    '{{WRAPPER}} .ea-review-wrapper p' => 'color: {{VALUE}}'
                ]
			]
		);

		$this->add_group_control(
            \Elementor\Group_Control_Typography::get_type(),
            [
                'name' => 'review_comment_typography',
                'label' => __( 'Reviewer Comment Typography', 'endless-addons' ),
                'scheme' => \Elementor\Core\Schemes\Typography::TYPOGRAPHY_1,
                'selector' => '{{WRAPPER}} .ea-review-wrapper p'
            ],
        );

        $this->add_control(
			'review_name_color',
			[
				'label' => __( 'Reviewer Name Color', 'endless-addons' ),
				'type' => \Elementor\Controls_Manager::COLOR,
				'selectors' => [
                    '{{WRAPPER}} .ea-review-wrapper h3' => 'color: {{VALUE}}'
                ]
			]
		);

		$this->add_group_control(
            \Elementor\Group_Control_Typography::get_type(),
            [
                'name' => 'review_name_typography',
                'label' => __( 'Reviewer Name Typography', 'endless-addons' ),
                'scheme' => \Elementor\Core\Schemes\Typography::TYPOGRAPHY_1,
                'selector' => '{{WRAPPER}} .ea-review-wrapper h3'
            ],
        );

        $this->add_control(
			'review_designation_color',
			[
				'label' => __( 'Reviewer Designation Color', 'endless-addons' ),
				'type' => \Elementor\Controls_Manager::COLOR,
				'selectors' => [
                    '{{WRAPPER}} .ea-review-wrapper span.ea-profession' => 'color: {{VALUE}}'
                ]
			]
		);

		$this->add_group_control(
            \Elementor\Group_Control_Typography::get_type(),
            [
                'name' => 'review_designation_typography',
                'label' => __( 'Reviewer Designation Typography', 'endless-addons' ),
                'scheme' => \Elementor\Core\Schemes\Typography::TYPOGRAPHY_1,
                'selector' => '{{WRAPPER}} .ea-review-wrapper span.ea-profession'
            ],
        );

        $this->add_control(
			'review_rating_color',
			[
				'label' => __( 'Reviewer Rating Color', 'endless-addons' ),
				'type' => \Elementor\Controls_Manager::COLOR,
				'selectors' => [
                    '{{WRAPPER}} .ea-review-wrapper ul li i, .single-review-card .ea-review-rating i' => 'color: {{VALUE}}'
                ]
			]
		);

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

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

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

		$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-review-design-area',
			]
		);

		$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-review-design-area:hover',
			]
		);

		$this->end_controls_tab();

		$this->end_controls_tabs();

		$this->end_controls_section();

	}

	/**
	 * Render Review 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['review_img_h_alignment'] == 'left' ) : 
		    $this->add_render_attribute('review_img_align', 'class', 'review-align is-img-left');
		elseif( $settings['review_img_h_alignment'] == 'center' ) :
            $this->add_render_attribute('review_img_align', 'class', 'review-align is-img-center');
		elseif( $settings['review_img_h_alignment'] == 'right' ) :
            $this->add_render_attribute('review_img_align', 'class', 'review-align is-img-right');
        endif;

        if( $settings['review_content_h_alignment'] == 'left' ) : 
		    $this->add_render_attribute('review_content_align', 'class', 'review-align is-content-left');
		elseif( $settings['review_content_h_alignment'] == 'center' ) :
            $this->add_render_attribute('review_content_align', 'class', 'review-align is-content-center');
		elseif( $settings['review_content_h_alignment'] == 'right' ) :
            $this->add_render_attribute('review_content_align', 'class', 'review-align is-content-right');
        endif; ?>

		<!-- Review Column Style -->
	    <?php if( $settings['review_item_column'] == 'columns-2' ) :
			$review_column = 'col-lg-6 col-md-6 col-sm-6';
		elseif( $settings['review_item_column'] == 'columns-3' ) :
			$review_column = 'col-lg-4 col-md-6 col-sm-6';
		elseif( $settings['review_item_column'] == 'columns-4' ) :
			$review_column = 'col-lg-3 col-md-6 col-sm-6';
		endif; ?>

        <!-- Start Review Area -->
        <?php if( $settings['show_review'] == 'show' ) :

	        if( $settings['review_style_select'] == 'style-01' ) : ?>
		        <section class="ea-review-design-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 justify-content-center ea-review-wrapper">
		                    <?php foreach ( $settings['single_review'] as $item ) : ?>
			                	<div class="review-col <?php echo esc_attr( $review_column ); ?>">
			                		<div class="single-review-card">
			                			<div <?php echo $this->get_render_attribute_string('review_img_align'); ?>>
				                            <div class="ea-review-img">
				                                <?php if( ! $item['single_review_img']['url'] == '' ) : ?>
					                                <img src="<?php echo esc_url( $item['single_review_img']['url'] ); ?>" alt="image">
				                                <?php endif; ?>
				                                <i class='bx bxs-quote-alt-right'></i>
				                            </div>
				                        </div>
				                        <div <?php echo $this->get_render_attribute_string('review_content_align'); ?>>
				                            <div class="review-content">
				                                <?php if($item['ea_content_text_type'] == 'content') : ?>
					                                <p><?php echo wp_kses_post($item['single_review_comment']); ?></p>
					                            <?php elseif($item['ea_content_text_type'] == 'template') : ?>
					                            	<p>
					                            		<?php if (!empty($item['ea_content_templates'])) {
											                echo Plugin::$instance->frontend->get_builder_content($item['ea_content_templates'], true);
											            } ?>
					                            	</p>
					                            <?php endif; ?>
				                                <div class="ea-review-rating">
				                                    <i class='bx bxs-star'></i>
				                                    <span class="ea-rating-point"><?php echo esc_html($item['single_review_rating1']); ?></span>
				                                </div>
				                                <h3><?php echo esc_html($item['single_review_name']); ?></h3>
				                                <span class="ea-profession"><?php echo esc_html($item['single_review_position']); ?></span>
				                            </div>
				                        </div>
			                        </div>
			                	</div>
		                    <?php endforeach; ?>
				        </div>
				    </div>
			        <div class="ea-reviews-shape-1">
		                <?php if( ! $settings['review_shape_img1']['url'] == '' ) : ?>
		                    <img src="<?php echo esc_url( $settings['review_shape_img1']['url'] ); ?>" alt="image">
		                <?php endif; ?>
		            </div>
		            <div class="ea-reviews-shape-2">
		                <?php if( ! $settings['review_shape_img2']['url'] == '' ) : ?>
		                    <img src="<?php echo esc_url( $settings['review_shape_img2']['url'] ); ?>" alt="image">
		                <?php endif; ?>
		            </div>
		        </section>
		    <?php elseif( $settings['review_style_select'] == 'style-02' ) : ?>
		    	<section class="ea-review-design-area ea-style-two pt-100 pb-100">
		            <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="ea-review-slider-wrap">
			            	<div class="owl-carousel owl-theme ea-review-slider-1 ea-review-wrapper">
		                        <?php foreach ( $settings['single_review'] as $item ) : ?>
		                        	<div class="ea-review-single-silder">
		                        		<div <?php echo $this->get_render_attribute_string('review_content_align'); ?>>
				                        	<p>
				                                <i class="bx bxs-quote-alt-left"></i>
				                                <?php if($item['ea_content_text_type'] == 'content') : ?>
					                                <?php echo wp_kses_post($item['single_review_comment']); ?>
					                            <?php elseif($item['ea_content_text_type'] == 'template') : ?>
				                            		<?php if (!empty($item['ea_content_templates'])) {
										                echo Plugin::$instance->frontend->get_builder_content($item['ea_content_templates'], true);
										            } ?>
					                            <?php endif; ?>
				                            </p>
				                        </div>
			                            <?php if( ! $item['single_review_img']['url'] == '' ) : ?>
			                            	<div <?php echo $this->get_render_attribute_string('review_img_align'); ?>>
					                            <div class="ea-review-img">
					                                <img src="<?php echo esc_url( $item['single_review_img']['url'] ); ?>" alt="image">
					                            </div>
					                        </div><br/>
			                            <?php endif; ?>
			                            <div <?php echo $this->get_render_attribute_string('review_content_align'); ?>>
				                            <h3><?php echo esc_html($item['single_review_name']); ?></h3>
				                            <span class="ea-profession"><?php echo esc_html($item['single_review_position']); ?></span>
				                            <ul>
				                            	<?php if($item['single_review_rating2'] == '1') : ?>
					                                <li>
					                                    <i class="bx bxs-star"></i>
					                                </li>
					                            <?php elseif($item['single_review_rating2'] == '2') : ?>
					                                <li>
					                                    <i class="bx bxs-star"></i>
					                                </li>
					                                <li>
					                                    <i class="bx bxs-star"></i>
					                                </li>
					                            <?php elseif($item['single_review_rating2'] == '3') : ?>
					                                <li>
					                                    <i class="bx bxs-star"></i>
					                                </li>
					                                <li>
					                                    <i class="bx bxs-star"></i>
					                                </li>
					                                <li>
					                                    <i class="bx bxs-star"></i>
					                                </li>
					                            <?php elseif($item['single_review_rating2'] == '4') : ?>
					                                <li>
					                                    <i class="bx bxs-star"></i>
					                                </li>
					                                <li>
					                                    <i class="bx bxs-star"></i>
					                                </li>
					                                <li>
					                                    <i class="bx bxs-star"></i>
					                                </li>
					                                <li>
					                                    <i class="bx bxs-star"></i>
					                                </li>
					                            <?php elseif($item['single_review_rating2'] == '5') : ?>
					                                <li>
					                                    <i class="bx bxs-star"></i>
					                                </li>
					                                <li>
					                                    <i class="bx bxs-star"></i>
					                                </li>
					                                <li>
					                                    <i class="bx bxs-star"></i>
					                                </li>
					                                <li>
					                                    <i class="bx bxs-star"></i>
					                                </li>
					                                <li>
					                                    <i class="bx bxs-star"></i>
					                                </li>
					                            <?php endif; ?>
				                            </ul>
				                        </div>
			                        </div>
		                        <?php endforeach; ?>
		                    </div>
		                    <div class="ea-shape-1">
				                <?php if( ! $settings['review_shape_img1']['url'] == '' ) : ?>
				                    <img src="<?php echo esc_url( $settings['review_shape_img1']['url'] ); ?>" alt="image">
				                <?php endif; ?>
				            </div>
				            <div class="ea-shape-2">
				                <?php if( ! $settings['review_shape_img2']['url'] == '' ) : ?>
				                    <img src="<?php echo esc_url( $settings['review_shape_img2']['url'] ); ?>" alt="image">
				                <?php endif; ?>
				            </div>
				            <div class="ea-shape-3">
				                <?php if( ! $settings['review_shape_img3']['url'] == '' ) : ?>
				                    <img src="<?php echo esc_url( $settings['review_shape_img3']['url'] ); ?>" alt="image">
				                <?php endif; ?>
				            </div>
				            <div class="ea-shape-4">
				                <?php if( ! $settings['review_shape_img4']['url'] == '' ) : ?>
				                    <img src="<?php echo esc_url( $settings['review_shape_img4']['url'] ); ?>" alt="image">
				                <?php endif; ?>
				            </div>
				        </div>
				    </div>
		        </section>
		    <?php elseif( $settings['review_style_select'] == 'style-03' ) : ?>
		    	<section class="ea-review-design-area ea-style-three pt-100 pb-100">
		            <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="owl-carousel owl-theme ea-review-slider-2 ea-review-wrapper">
	                        <?php foreach ( $settings['single_review'] as $item ) : ?>
	                        	<div class="row align-items-center">
	                        		<div class="col-lg-6">
	                        			<div <?php echo $this->get_render_attribute_string('review_img_align'); ?>>
		                        			<?php if( ! $item['single_review_img']['url'] == '' ) : ?>
				                                <img src="<?php echo esc_url( $item['single_review_img']['url'] ); ?>" alt="image">
			                                <?php endif; ?>
			                            </div>
	                        		</div>
	                        		<div class="col-lg-6">
	                        			<div class="ea-review-single-silder style-three">
	                        				<div <?php echo $this->get_render_attribute_string('review_content_align'); ?>>
		                        				<p>
					                                <i class="bx bxs-quote-alt-left"></i>
					                                <?php if($item['ea_content_text_type'] == 'content') : ?>
						                                <?php echo wp_kses_post($item['single_review_comment']); ?>
						                            <?php elseif($item['ea_content_text_type'] == 'template') : ?>
					                            		<?php if (!empty($item['ea_content_templates'])) {
											                echo Plugin::$instance->frontend->get_builder_content($item['ea_content_templates'], true);
											            } ?>
						                            <?php endif; ?>
					                            </p>
					                            <ul>
					                            	<?php if($item['single_review_rating2'] == '1') : ?>
						                                <li>
						                                    <i class="bx bxs-star"></i>
						                                </li>
						                                <li>
					                                        <span><?php echo esc_html('(1.0)'); ?></span>
					                                    </li>
						                            <?php elseif($item['single_review_rating2'] == '2') : ?>
						                                <li>
						                                    <i class="bx bxs-star"></i>
						                                </li>
						                                <li>
						                                    <i class="bx bxs-star"></i>
						                                </li>
						                                <li>
					                                        <span><?php echo esc_html('(2.0)'); ?></span>
					                                    </li>
						                            <?php elseif($item['single_review_rating2'] == '3') : ?>
						                                <li>
						                                    <i class="bx bxs-star"></i>
						                                </li>
						                                <li>
						                                    <i class="bx bxs-star"></i>
						                                </li>
						                                <li>
						                                    <i class="bx bxs-star"></i>
						                                </li>
						                                <li>
					                                        <span><?php echo esc_html('(3.0)'); ?></span>
					                                    </li>
						                            <?php elseif($item['single_review_rating2'] == '4') : ?>
						                                <li>
						                                    <i class="bx bxs-star"></i>
						                                </li>
						                                <li>
						                                    <i class="bx bxs-star"></i>
						                                </li>
						                                <li>
						                                    <i class="bx bxs-star"></i>
						                                </li>
						                                <li>
						                                    <i class="bx bxs-star"></i>
						                                </li>
						                                <li>
					                                        <span><?php echo esc_html('(4.0)'); ?></span>
					                                    </li>
						                            <?php elseif($item['single_review_rating2'] == '5') : ?>
						                                <li>
						                                    <i class="bx bxs-star"></i>
						                                </li>
						                                <li>
						                                    <i class="bx bxs-star"></i>
						                                </li>
						                                <li>
						                                    <i class="bx bxs-star"></i>
						                                </li>
						                                <li>
						                                    <i class="bx bxs-star"></i>
						                                </li>
						                                <li>
					                                        <span><?php echo esc_html('(5.0)'); ?></span>
					                                    </li>
						                            <?php endif; ?>
					                            </ul>
					                            <h3><?php echo esc_html($item['single_review_name']); ?></h3>
					                            <span class="mb-0 ea-profession"><?php echo esc_html($item['single_review_position']); ?></span>
					                        </div>
	                        			</div>
	                        		</div>
		                        </div>
	                        <?php endforeach; ?>
				        </div>
				    </div>
				    <div class="ea-shape-3">
		                <?php if( ! $settings['review_shape_img1']['url'] == '' ) : ?>
		                    <img src="<?php echo esc_url( $settings['review_shape_img1']['url'] ); ?>" alt="image">
		                <?php endif; ?>
		            </div>
		        </section>
		    <?php elseif( $settings['review_style_select'] == 'style-04' ) : ?>
		    	<section class="ea-review-design-area ea-style-four pb-100">
		            <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="ea-slider-wrap-bg">
		                	<div class="owl-carousel owl-theme ea-review-slider-3 ea-review-wrapper">
		                        <?php foreach ( $settings['single_review'] as $item ) : ?>
		                        	<div class="ea-review-single-silder style-four">
			                        	<p>
			                                <i class="bx bxs-quote-alt-left"></i>
			                                <?php if($item['ea_content_text_type'] == 'content') : ?>
				                                <?php echo wp_kses_post($item['single_review_comment']); ?>
				                            <?php elseif($item['ea_content_text_type'] == 'template') : ?>
			                            		<?php if (!empty($item['ea_content_templates'])) {
									                echo Plugin::$instance->frontend->get_builder_content($item['ea_content_templates'], true);
									            } ?>
				                            <?php endif; ?>
			                            </p>
			                        	<div class="row">
			                        		<div class="col-lg-6">	
					                            <ul>
					                            	<?php if($item['single_review_rating2'] == '1') : ?>
						                                <li>
						                                    <i class="bx bxs-star"></i>
						                                </li>
						                                <li>
					                                        <span><?php echo esc_html('(1.0)'); ?></span>
					                                    </li>
						                            <?php elseif($item['single_review_rating2'] == '2') : ?>
						                                <li>
						                                    <i class="bx bxs-star"></i>
						                                </li>
						                                <li>
						                                    <i class="bx bxs-star"></i>
						                                </li>
						                                <li>
					                                        <span><?php echo esc_html('(2.0)'); ?></span>
					                                    </li>
						                            <?php elseif($item['single_review_rating2'] == '3') : ?>
						                                <li>
						                                    <i class="bx bxs-star"></i>
						                                </li>
						                                <li>
						                                    <i class="bx bxs-star"></i>
						                                </li>
						                                <li>
						                                    <i class="bx bxs-star"></i>
						                                </li>
						                                <li>
					                                        <span><?php echo esc_html('(3.0)'); ?></span>
					                                    </li>
						                            <?php elseif($item['single_review_rating2'] == '4') : ?>
						                                <li>
						                                    <i class="bx bxs-star"></i>
						                                </li>
						                                <li>
						                                    <i class="bx bxs-star"></i>
						                                </li>
						                                <li>
						                                    <i class="bx bxs-star"></i>
						                                </li>
						                                <li>
						                                    <i class="bx bxs-star"></i>
						                                </li>
						                                <li>
					                                        <span><?php echo esc_html('(4.0)'); ?></span>
					                                    </li>
						                            <?php elseif($item['single_review_rating2'] == '5') : ?>
						                                <li>
						                                    <i class="bx bxs-star"></i>
						                                </li>
						                                <li>
						                                    <i class="bx bxs-star"></i>
						                                </li>
						                                <li>
						                                    <i class="bx bxs-star"></i>
						                                </li>
						                                <li>
						                                    <i class="bx bxs-star"></i>
						                                </li>
						                                <li>
					                                        <span><?php echo esc_html('(5.0)'); ?></span>
					                                    </li>
						                            <?php endif; ?>
					                            </ul>
			                        		</div>
			                        		<div class="col-lg-6">
			                        			<div class="ea-review-avater">
				                        			<?php if( ! $item['single_review_img']['url'] == '' ) : ?>
						                                <img src="<?php echo esc_url( $item['single_review_img']['url'] ); ?>" alt="image">
					                                <?php endif; ?>
					                                <h3><?php echo esc_html($item['single_review_name']); ?></h3>
						                            <span class="ea-profession mb-0"><?php echo esc_html($item['single_review_position']); ?></span>
					                            </div>
			                        		</div>
				                        </div>
				                    </div>
		                        <?php endforeach; ?>
					        </div>
					    </div>
				    </div>
		        </section>
		    <?php elseif( $settings['review_style_select'] == 'style-05' ) : ?>
		    	<section class="ea-review-design-area ea-style-five pt-100 pb-100">
		            <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="owl-carousel owl-theme ea-review-slider-4 ea-review-wrapper">
	                        <?php foreach ( $settings['single_review'] as $item ) : ?>
	                        	<div class="ea-review-single-silder style-five">
	                        		<div <?php echo $this->get_render_attribute_string('review_content_align'); ?>>
			                        	<p>
			                                <i class="bx bxs-quote-alt-left"></i>
			                                <?php if($item['ea_content_text_type'] == 'content') : ?>
				                                <?php echo wp_kses_post($item['single_review_comment']); ?>
				                            <?php elseif($item['ea_content_text_type'] == 'template') : ?>
			                            		<?php if (!empty($item['ea_content_templates'])) {
									                echo Plugin::$instance->frontend->get_builder_content($item['ea_content_templates'], true);
									            } ?>
				                            <?php endif; ?>
			                            </p>
			                        </div>
		                            <div class="ea-review-avater">
		                            	<div <?php echo $this->get_render_attribute_string('review_img_align'); ?>>
		                        			<?php if( ! $item['single_review_img']['url'] == '' ) : ?>
				                                <img src="<?php echo esc_url( $item['single_review_img']['url'] ); ?>" alt="image"><br/>
			                                <?php endif; ?>
			                            </div>
			                            <div <?php echo $this->get_render_attribute_string('review_content_align'); ?>>
			                                <h3><?php echo esc_html($item['single_review_name']); ?></h3>
				                            <span class="ea-profession mb-0"><?php echo esc_html($item['single_review_position']); ?></span>
				                        </div>
		                            </div>
		                            <div <?php echo $this->get_render_attribute_string('review_content_align'); ?>>
			                            <ul>
			                            	<?php if($item['single_review_rating2'] == '1') : ?>
				                                <li>
				                                    <i class="bx bxs-star"></i>
				                                </li>
				                                <li>
			                                        <span><?php echo esc_html('(1.0)'); ?></span>
			                                    </li>
				                            <?php elseif($item['single_review_rating2'] == '2') : ?>
				                                <li>
				                                    <i class="bx bxs-star"></i>
				                                </li>
				                                <li>
				                                    <i class="bx bxs-star"></i>
				                                </li>
				                                <li>
			                                        <span><?php echo esc_html('(2.0)'); ?></span>
			                                    </li>
				                            <?php elseif($item['single_review_rating2'] == '3') : ?>
				                                <li>
				                                    <i class="bx bxs-star"></i>
				                                </li>
				                                <li>
				                                    <i class="bx bxs-star"></i>
				                                </li>
				                                <li>
				                                    <i class="bx bxs-star"></i>
				                                </li>
				                                <li>
			                                        <span><?php echo esc_html('(3.0)'); ?></span>
			                                    </li>
				                            <?php elseif($item['single_review_rating2'] == '4') : ?>
				                                <li>
				                                    <i class="bx bxs-star"></i>
				                                </li>
				                                <li>
				                                    <i class="bx bxs-star"></i>
				                                </li>
				                                <li>
				                                    <i class="bx bxs-star"></i>
				                                </li>
				                                <li>
				                                    <i class="bx bxs-star"></i>
				                                </li>
				                                <li>
			                                        <span><?php echo esc_html('(4.0)'); ?></span>
			                                    </li>
				                            <?php elseif($item['single_review_rating2'] == '5') : ?>
				                                <li>
				                                    <i class="bx bxs-star"></i>
				                                </li>
				                                <li>
				                                    <i class="bx bxs-star"></i>
				                                </li>
				                                <li>
				                                    <i class="bx bxs-star"></i>
				                                </li>
				                                <li>
				                                    <i class="bx bxs-star"></i>
				                                </li>
				                                <li>
			                                        <span><?php echo esc_html('(5.0)'); ?></span>
			                                    </li>
				                            <?php endif; ?>
			                            </ul>	
			                        </div>
			                    </div>
	                        <?php endforeach; ?>
					    </div>
				    </div>
				    <div class="ea-shape-4">
		                <?php if( ! $settings['review_shape_img1']['url'] == '' ) : ?>
		                    <img src="<?php echo esc_url( $settings['review_shape_img1']['url'] ); ?>" alt="image">
		                <?php endif; ?>
		            </div>
		        </section>
	        <?php elseif( $settings['review_style_select'] == 'style-06' ) : ?>
	        	<section class="ea-review-design-area ea-style-six bg-shape pt-100 pb-100">
		            <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="owl-carousel owl-theme ea-review-slider-5 ea-review-wrapper">
	                        <?php foreach ( $settings['single_review'] as $item ) : ?>
	                        	<div class="ea-review-single-silder style-six">
	                        		<div class="ea-content-bg">
	                        			<ul>
			                            	<?php if($item['single_review_rating2'] == '1') : ?>
				                                <li>
				                                    <i class="bx bxs-star"></i>
				                                </li>
				                                <li>
			                                        <span><?php echo esc_html('(1.0)'); ?></span>
			                                    </li>
				                            <?php elseif($item['single_review_rating2'] == '2') : ?>
				                                <li>
				                                    <i class="bx bxs-star"></i>
				                                </li>
				                                <li>
				                                    <i class="bx bxs-star"></i>
				                                </li>
				                                <li>
			                                        <span><?php echo esc_html('(2.0)'); ?></span>
			                                    </li>
				                            <?php elseif($item['single_review_rating2'] == '3') : ?>
				                                <li>
				                                    <i class="bx bxs-star"></i>
				                                </li>
				                                <li>
				                                    <i class="bx bxs-star"></i>
				                                </li>
				                                <li>
				                                    <i class="bx bxs-star"></i>
				                                </li>
				                                <li>
			                                        <span><?php echo esc_html('(3.0)'); ?></span>
			                                    </li>
				                            <?php elseif($item['single_review_rating2'] == '4') : ?>
				                                <li>
				                                    <i class="bx bxs-star"></i>
				                                </li>
				                                <li>
				                                    <i class="bx bxs-star"></i>
				                                </li>
				                                <li>
				                                    <i class="bx bxs-star"></i>
				                                </li>
				                                <li>
				                                    <i class="bx bxs-star"></i>
				                                </li>
				                                <li>
			                                        <span><?php echo esc_html('(4.0)'); ?></span>
			                                    </li>
				                            <?php elseif($item['single_review_rating2'] == '5') : ?>
				                                <li>
				                                    <i class="bx bxs-star"></i>
				                                </li>
				                                <li>
				                                    <i class="bx bxs-star"></i>
				                                </li>
				                                <li>
				                                    <i class="bx bxs-star"></i>
				                                </li>
				                                <li>
				                                    <i class="bx bxs-star"></i>
				                                </li>
				                                <li>
			                                        <span><?php echo esc_html('(5.0)'); ?></span>
			                                    </li>
				                            <?php endif; ?>
			                            </ul>
			                            <div <?php echo $this->get_render_attribute_string('review_content_align'); ?>>
				                            <p>
				                                <i class="bx bxs-quote-alt-left"></i>
				                                <?php if($item['ea_content_text_type'] == 'content') : ?>
					                                <?php echo wp_kses_post($item['single_review_comment']); ?>
					                            <?php elseif($item['ea_content_text_type'] == 'template') : ?>
				                            		<?php if (!empty($item['ea_content_templates'])) {
										                echo Plugin::$instance->frontend->get_builder_content($item['ea_content_templates'], true);
										            } ?>
					                            <?php endif; ?>
				                            </p>
				                        </div>
			                        </div>
		                            <div class="ea-review-avater">
		                            	<div <?php echo $this->get_render_attribute_string('review_img_align'); ?>>
		                        			<?php if( ! $item['single_review_img']['url'] == '' ) : ?>
				                                <img src="<?php echo esc_url( $item['single_review_img']['url'] ); ?>" alt="image">
			                                <?php endif; ?>
			                            </div>
			                            <div <?php echo $this->get_render_attribute_string('review_content_align'); ?>>
			                                <h3><?php echo esc_html($item['single_review_name']); ?></h3>
				                            <span class="ea-profession mb-0"><?php echo esc_html($item['single_review_position']); ?></span>
				                        </div>
		                            </div>	
			                    </div>
	                        <?php endforeach; ?>
					    </div>
				    </div>
		        </section>
		    <?php endif;

	    endif; ?>
	    <!-- End Review Area -->

    <?php

    }

}
