<?php

use Elementor\Widget_Base;
use Elementor\Controls_Manager;

if (!defined('ABSPATH')) exit; // Exit if accessed directly


class Customerreviewlkaveh extends Widget_Base{

  public function get_name(){
    return 'customerreviewlkaveh';
  }

  public function get_title(){
    return esc_html__( 'Customer Reviews Carousel', 'kavehTheme' );
  }

  public function get_icon(){
    return 'eicon-archive-posts';
  }

  public function get_categories(){
    return ['kavehelements'];
  }

  protected function register_controls(){
    
    $this->start_controls_section(
        'contentcustomerreviewlkaveh',
        [
          'label' => esc_html__( 'Element Content', 'kavehTheme' ),
                  'tab' => \Elementor\Controls_Manager::TAB_CONTENT,
        ]
      );
      $this->add_control(
        'titlecustomerreviewlkaveh',
        [
          'label' => esc_html__( 'Title', 'kavehTheme' ),
          'type' => \Elementor\Controls_Manager::TEXT,
          'default' => esc_html__('New Reviews', 'kavehTheme'),
  
        ]
      ); 
      $this->add_control(
        'tagheadingtacustomerreviewlkaveh',
        [
          'label' => esc_html__( 'Title Tag', 'kavehTheme' ),
          'type' => \Elementor\Controls_Manager::SELECT,
          'default' => 'H5',
          'options' => [
            'H1'  => esc_html__( 'H1', 'kavehTheme' ),
            'H2' => esc_html__( 'H2', 'kavehTheme' ),
            'H3' => esc_html__( 'H3', 'kavehTheme' ),
            'H4' => esc_html__( 'H4', 'kavehTheme' ),
            'H5' => esc_html__( 'H5', 'kavehTheme' ),
            'H6' => esc_html__( 'H6', 'kavehTheme' ),
            'p' => esc_html__( 'p', 'kavehTheme' ),
            'div' => esc_html__( 'div', 'kavehTheme' ),
            'span' => esc_html__( 'span', 'kavehTheme' ),
          ],
        ]
      );
      $repeater = new \Elementor\Repeater();
      $repeater->add_control(
      'title1customerreviewlkaveh',
      [
        'label' => esc_html__( 'Customer Name', 'kavehTheme' ),
        'type' => \Elementor\Controls_Manager::TEXT,
        'default' => esc_html__('Ahmad Yousefvand', 'kavehTheme'),

      ]
    );
    $repeater->add_control(
      'title2customerreviewlkaveh',
      [
        'label' => esc_html__( 'Position Title', 'kavehTheme' ),
        'type' => \Elementor\Controls_Manager::TEXT,
        'default' => esc_html__('Job Title', 'kavehTheme'),

      ]
    ); 
    $repeater->add_control(
      'title3customerreviewlkaveh',
      [
        'label' => esc_html__( 'Position', 'kavehTheme' ),
        'type' => \Elementor\Controls_Manager::TEXT,
        'default' => esc_html__('Graphic Designer', 'kavehTheme'),

      ]
    );
    $repeater->add_control(
      'datecustomerreviewlkaveh',
      [
        'label' => esc_html__( 'Date', 'kavehTheme' ),
        'type' => \Elementor\Controls_Manager::TEXT,
        'default' => esc_html__('2021/08/31', 'kavehTheme'),

      ]
    );
    $repeater->add_control(
      'desccustomerreviewlkaveh',
      [
        'label' => esc_html__( 'Review', 'kavehTheme' ),
        'type' => \Elementor\Controls_Manager::TEXTAREA,
        'default' => esc_html__('This collection supplies its goods directly and without intermediaries from the main manufacturers of hardware wallets and also provides authenticity and health guarantees to all customers.', 'kavehTheme'),
      ]
    );
    $this->add_control(
      'listcustomerreviewlkaveh',
      [
        'label' => esc_html__( 'Customer Reviews', 'kavehTheme' ),
        'type' => \Elementor\Controls_Manager::REPEATER,
        'fields' => $repeater->get_controls(),
        'default' => [
          [
            'title1customerreviewlkaveh' => esc_html__( 'Ahmad Yousefvand', 'kavehTheme' ),
            'title2customerreviewlkaveh' => esc_html__( 'Job Title', 'kavehTheme' ),
            'title3customerreviewlkaveh' => esc_html__( 'Graphic Designer', 'kavehTheme' ),
            'datecustomerreviewlkaveh' => esc_html__( '2021/08/31', 'kavehTheme' ),
            'desccustomerreviewlkaveh' => esc_html__( 'This collection supplies its goods directly and without intermediaries from the main manufacturers of hardware wallets and also provides authenticity and health guarantees to all customers.', 'kavehTheme' ),
          ],
      ]
      ]
    
    );
       $this->end_controls_section();
       $this->start_controls_section(
        'style1_customerreviewlkaveh',
        [
          'label' => esc_html__( 'Title Style', 'kavehTheme' ),
          'tab' => \Elementor\Controls_Manager::TAB_STYLE,
        ]
      );
      $this->add_control(
        'titlestcustomerreviewlkaveh',
        [
          'label' => esc_html__( 'Title Color', 'kavehTheme' ),
          'type' => \Elementor\Controls_Manager::COLOR,
          'selectors' => [
            '{{WRAPPER}} .new-comments-title' => 'color: {{VALUE}}',
          ],
        ]
      );
      $this->add_group_control(
        \Elementor\Group_Control_Typography::get_type(),
        [
          'name' => 'title_customerreviewlkaveh',
          'label' => esc_html__( 'Title Typography', 'kavehTheme' ),
          'selector' => '{{WRAPPER}} .new-comments-title',
        ]
      );

      $this->end_controls_section();
      $this->start_controls_section(
        'style2_customerreviewlkaveh',
        [
          'label' => esc_html__( 'Review Style', 'kavehTheme' ),
          'tab' => \Elementor\Controls_Manager::TAB_STYLE,
        ]
      );
      $this->add_control(
        'title1stcustomerreviewlkaveh',
        [
          'label' => esc_html__( 'Customer Name Color', 'kavehTheme' ),
          'type' => \Elementor\Controls_Manager::COLOR,
          'selectors' => [
            '{{WRAPPER}} .new-comments-item .name' => 'color: {{VALUE}}',
          ],
        ]
      );
      $this->add_group_control(
        \Elementor\Group_Control_Typography::get_type(),
        [
          'name' => 'title1_customerreviewlkaveh',
          'label' => esc_html__( 'Customer Name Typography', 'kavehTheme' ),
          'selector' => '{{WRAPPER}} .new-comments-item .name',
        ]
      );
      $this->add_control(
        'title2stcustomerreviewlkaveh',
        [
          'label' => esc_html__( 'Position Title Color', 'kavehTheme' ),
          'type' => \Elementor\Controls_Manager::COLOR,
          'selectors' => [
            '{{WRAPPER}} .new-comments-item .position ' => 'color: {{VALUE}}',
          ],
        ]
      );
      $this->add_group_control(
        \Elementor\Group_Control_Typography::get_type(),
        [
          'name' => 'title2_customerreviewlkaveh',
          'label' => esc_html__( 'Position Title Typography', 'kavehTheme' ),
          'selector' => '{{WRAPPER}} .new-comments-item .position ',
        ]
      );
      $this->add_control(
        'title3stcustomerreviewlkaveh',
        [
          'label' => esc_html__( 'Position Color', 'kavehTheme' ),
          'type' => \Elementor\Controls_Manager::COLOR,
          'selectors' => [
            '{{WRAPPER}} .new-comments-item .position b i' => 'color: {{VALUE}}',
          ],
        ]
      );
      $this->add_group_control(
        \Elementor\Group_Control_Typography::get_type(),
        [
          'name' => 'title3_customerreviewlkaveh',
          'label' => esc_html__( 'Position Typography', 'kavehTheme' ),
          'selector' => '{{WRAPPER}} .new-comments-item .position b i',
        ]
      );
      $this->add_control(
        'title4stcustomerreviewlkaveh',
        [
          'label' => esc_html__( 'Date Color', 'kavehTheme' ),
          'type' => \Elementor\Controls_Manager::COLOR,
          'selectors' => [
            '{{WRAPPER}} .new-comments-item .time' => 'color: {{VALUE}}',
          ],
        ]
      );
      $this->add_group_control(
        \Elementor\Group_Control_Typography::get_type(),
        [
          'name' => 'title4_customerreviewlkaveh',
          'label' => esc_html__( 'Date Typography', 'kavehTheme' ),
          'selector' => '{{WRAPPER}} .new-comments-item .time',
        ]
      );
      $this->add_control(
        'datewidthcustomerreviewlkaveh',
        [
          'label' => esc_html__( 'Button Width', 'kavehTheme' ),
          'type' => \Elementor\Controls_Manager::SLIDER,
          'size_units' => [ 'px', '%' ],
          'range' => [
            'px' => [
              'min' => 0,
              'max' => 480,
              'step' => 1,
            ],
            '%' => [
              'min' => 0,
              'max' => 100,
            ],
          ],
          'selectors' => [
            '{{WRAPPER}} .new-comments-item .time' => 'width: {{SIZE}}{{UNIT}};',
          ],
        ]
      );
      $this->add_control(
        'buttonpaddingtcustomerreviewlkaveh',
        [
          'label' => esc_html__( 'Padding', 'kavehTheme' ),
          'type' => \Elementor\Controls_Manager::DIMENSIONS,
          'size_units' => [ 'px' ],
          'selectors' => [
            '{{WRAPPER}} .new-comments-item .time' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
          ],
        ]
      );
      $this->add_control(
        'buttonradiustcustomerreviewlkaveh',
        [
          'label' => esc_html__( 'Border Radius', 'kavehTheme' ),
          'type' => \Elementor\Controls_Manager::DIMENSIONS,
          'size_units' => [ 'px' ],
          'selectors' => [
            '{{WRAPPER}} .new-comments-item .time' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
          ],
        ]
      );
      $this->add_control(
        'bgcolortcustomerreviewlkaveh',
        [
          'label' => esc_html__( 'Background Color', 'kavehTheme' ),
          'type' => \Elementor\Controls_Manager::COLOR,
          'selectors' => [
            '{{WRAPPER}} .new-comments-item .time' => 'background-color: {{VALUE}}',
          ],
        ]
      ); 
      $this->add_control(
        'title5stcustomerreviewlkaveh',
        [
          'label' => esc_html__( 'Message Color', 'kavehTheme' ),
          'type' => \Elementor\Controls_Manager::COLOR,
          'selectors' => [
            '{{WRAPPER}} .new-comments-item p' => 'color: {{VALUE}}',
          ],
        ]
      );
      $this->add_group_control(
        \Elementor\Group_Control_Typography::get_type(),
        [
          'name' => 'title5_customerreviewlkaveh',
          'label' => esc_html__( 'Message Typography', 'kavehTheme' ),
          'selector' => '{{WRAPPER}} .new-comments-item p',
        ]
      );
      $this->add_control(
        'bgcolort2customerreviewlkaveh',
        [
          'label' => esc_html__( 'Main Box Background Color', 'kavehTheme' ),
          'type' => \Elementor\Controls_Manager::COLOR,
          'selectors' => [
            '{{WRAPPER}} .new-comments' => 'background-color: {{VALUE}}',
          ],
        ]
      ); 
      $this->add_control(
        'buttonpadding2tcustomerreviewlkaveh',
        [
          
          'type' => \Elementor\Controls_Manager::DIMENSIONS,
          'size_units' => [ 'px' ],
          'selectors' => [
            '{{WRAPPER}} .new-comments' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
          ],
        ]
      );
      $this->end_controls_section();

          
        }


  protected function render(){
    $settings = $this->get_settings_for_display();
    $clsid = $this->get_id();
    ?>
<section class="new-comments position-relative">
    <div class="container">
      <<?php echo  esc_html($settings['tagheadingtacustomerreviewlkaveh']); ?> class="new-comments-title mx-auto position-relative"> <?php echo  esc_html($settings['titlecustomerreviewlkaveh']); ?> </<?php echo  esc_html($settings['tagheadingtacustomerreviewlkaveh']); ?>>
      <div class="swiper swiper-new-comments overflow-hidden" data-swiper='{"slidesPerView":1,"spaceBetween":0,"autoplay":{"delay":5000,"disableOnInteraction":false,"pauseOnMouseEnter":true},"loop":true}'>
        <div class="swiper-wrapper">
            <?php
            if ( $settings['listcustomerreviewlkaveh'] ) {
            foreach (  $settings['listcustomerreviewlkaveh'] as $item ) {
            ?>
          <div class="swiper-slide">
            <div class="new-comments-item">
              <i class="icon-user"></i>
              <div class="name"> <?php echo  esc_html($item['title1customerreviewlkaveh']); ?> </div>
              <div class="position">
                <b>
                    <?php echo  esc_html($item['title2customerreviewlkaveh']); ?>
                  <i>  <?php echo  esc_html($item['title3customerreviewlkaveh']); ?> </i>
                </b>
              </div>
              <div class="time"> <?php echo  esc_html($item['datecustomerreviewlkaveh']); ?> </div>
              <p> <?php echo  esc_html($item['desccustomerreviewlkaveh']); ?></p>
            </div>
          </div>
          <?php 
        }
          }
        ?>
        </div>
      </div>
    </div>
  </section>
         
    <?php
  }


}
