<?php

namespace XIMSAPLUGIN\Element;

use Elementor\Controls_Manager;
use Elementor\Controls_Stack;
use Elementor\Group_Control_Typography;
use Elementor\Scheme_Typography;
use Elementor\Scheme_Color;
use Elementor\Group_Control_Border;
use Elementor\Repeater;
use Elementor\Widget_Base;
use Elementor\Utils;
use Elementor\Group_Control_Text_Shadow;
use Elementor\Plugin;

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

class banking_feature_content extends Widget_Base {

	/**
	 * Get widget name.
	 *
	 * Retrieve Elementor widget name.
	 *
	 * @since 1.0.0
	 * @access public
	 *
	 * @return string Widget name.
	 */
	public function get_name() {
		return 'banking-feature-content';
	}

	/**
	 * Get widget title.
	 *
	 * Retrieve Elementor widget title.
	 *
	 * @since 1.0.0
	 * @access public
	 *
	 * @return string Widget title.
	 */
	public function get_title() {
		return esc_html__( 'Banking Feature Content', 'ximsa' );
	}

	/**
	 * Get widget icon.
	 *
	 * Retrieve Elementor widget icon.
	 *
	 * @since 1.0.0
	 * @access public
	 *
	 * @return string Widget icon.
	 */
	public function get_icon() {
		return 'gl-custom-icon';
	}

	/**
	 * Get widget categories.
	 *
	 * Retrieve the list of categories the Elementor widget belongs to.
	 *
	 * @since 1.0.0
	 * @access public
	 *
	 * @return array Widget categories.
	 */
	public function get_categories() {
		return [ 'ximsa' ];
	}

	/**
	 * Register Elementor widget controls.
	 *
	 * Adds different input fields to allow the user to change and customize the widget settings.
	 *
	 * @since 1.0.0
	 * @access protected
	 */


	protected function register_controls() {
        $this->start_controls_section(
            'feature_content_options',
            [
                'label' => __( 'feature Content Options', 'ximsa' ),
                'tab' => Controls_Manager::TAB_CONTENT,
            ]
        );
        $this->add_control(
			'circle_sec_shape',
			[
				'label' => esc_html__( 'Section Circle Shape', 'ximsa' ),
				'type' => Controls_Manager::MEDIA,
                'label_block' => true,
			]
		);
        $this->add_control(
			'fs_sub_title',
			[
				'label' => esc_html__( 'Feature Sub Title', 'ximsa' ),
				'type' => Controls_Manager::TEXTAREA,
                'label_block' => true,
                'default' => esc_html__( 'Instant Bank Payment', 'ximsa' ),
				'placeholder' => esc_html__( 'Type feature Sub Title Here', 'ximsa' ),
			]
		);
        $this->add_control(
			'fs_title',
			[
				'label' => esc_html__( 'Feature Title', 'ximsa' ),
				'type' => Controls_Manager::TEXTAREA,
                'label_block' => true,
                'default' => esc_html__( 'Faster payments, lower fees', 'ximsa' ),
				'placeholder' => esc_html__( 'Type feature Title Here', 'ximsa' ),
			]
		);
        $this->add_control(
			'fs_txt',
			[
				'label' => esc_html__( 'Feature Description', 'ximsa' ),
				'type' => Controls_Manager::TEXTAREA,
                'label_block' => true,
			]
		);

        $repeater = new \Elementor\Repeater();

        $repeater->add_control(
			'title',
			[
				'label' => esc_html__( 'Title', 'ximsa' ),
				'type' => Controls_Manager::TEXT,
				'default' => esc_html__( 'Business is the Best Plan', 'ximsa' ),
				'placeholder' => esc_html__( 'Type List Item Here', 'ximsa' ),
                'label_block' => true,
			]
		);

        $this->add_control(
			'listitems',
			[
				'label' => esc_html__( 'feature List Item', 'ximsa' ),
				'type' => Controls_Manager::REPEATER,
				'fields' => $repeater->get_controls(),
				'title_field' => '{{{ title }}}',
			]
		);
        $this->add_control(
            'app_store_control',
            [
                'type'      => Controls_Manager::HEADING,
                'label'     => esc_html__( 'App Store Info', 'ximsa' ),
                'separator' => 'before',
            ]
        );
        $this->add_control(
			'app_store_btn',
			[
				'label' => esc_html__( 'App Store Button', 'ximsa' ),
				'type' => Controls_Manager::MEDIA,
                'label_block' => true,
			]
		);

        $this->add_control(
			'app_link',
			[
				'label' => esc_html__( 'App Link', 'ximsa' ),
				'type' => Controls_Manager::URL,
                'label_block' => true,
			]
		);
        $this->add_control(
            'play_store_control',
            [
                'type'      => Controls_Manager::HEADING,
                'label'     => esc_html__( 'Play Store Info', 'ximsa' ),
                'separator' => 'before',
            ]
        );
        $this->add_control(
			'play_store_btn',
			[
				'label' => esc_html__( 'Play Store Button', 'ximsa' ),
				'type' => Controls_Manager::MEDIA,
                'label_block' => true,
			]
		);

        $this->add_control(
			'play_link',
			[
				'label' => esc_html__( 'Play Link', 'ximsa' ),
				'type' => Controls_Manager::URL,
                'label_block' => true,
			]
		);

		$this->end_controls_section();

		$this->start_controls_section(
            'feature_options',
            [
                'label' => __( 'Feature Image Options', 'ximsa' ),
                'tab' => Controls_Manager::TAB_CONTENT,
            ]
        );
        $this->add_control(
			'circle_shape',
			[
				'label' => esc_html__( 'Circle Shape Image', 'ximsa' ),
				'type' => Controls_Manager::MEDIA,
                'label_block' => true,
			]
		);
        $this->add_control(
			'mobile_mockup',
			[
				'label' => esc_html__( 'Mobile Screen', 'ximsa' ),
				'type' => Controls_Manager::MEDIA,
                'label_block' => true,
			]
		);
        $this->add_control(
			'payment_img',
			[
				'label' => esc_html__( 'Payment Screen', 'ximsa' ),
				'type' => Controls_Manager::MEDIA,
                'label_block' => true,
			]
		);
        $this->add_control(
			'msg_img',
			[
				'label' => esc_html__( 'Message Screen', 'ximsa' ),
				'type' => Controls_Manager::MEDIA,
                'label_block' => true,
			]
		);

        $this->end_controls_section();

        $this->start_controls_section(
            'feature_settings_style',
            [
                'label' => __( 'feature Settings', 'ximsa' ),
                'tab' => Controls_Manager::TAB_STYLE,
            ]
        );

        $this->add_control(
            'feature_sub_title',
            [
                'type'      => Controls_Manager::HEADING,
                'label'     => esc_html__( 'Sub Title Style', 'ximsa' ),
                'separator' => 'before',
            ]
        );
        $this->add_control(
            'sb_title_color',
            [
                'label'     => esc_html__( 'Title Color', 'ximsa' ),
                'type'      => Controls_Manager::COLOR,
                'selectors' => [
                    '{{WRAPPER}} .xis-section-title span' => 'color: {{VALUE}} ',
                ],
            ]
        );

        $this->add_group_control(
            Group_Control_Typography::get_type(),
            [
                'name'           => 'sb_title_typography',
                'label'          => esc_html__( 'Typography', 'ximsa' ),
                'selector'       => '{{WRAPPER}} .xis-section-title span',
                'fields_options' => [
                    'typography' => [
                        'default' => 'custom',
                    ],
                ],
            ]
        );
        $this->add_control(
            'feature_title',
            [
                'type'      => Controls_Manager::HEADING,
                'label'     => esc_html__( 'Title Style', 'ximsa' ),
                'separator' => 'before',
            ]
        );
        $this->add_control(
            'fs_title_color',
            [
                'label'     => esc_html__( 'Title Color', 'ximsa' ),
                'type'      => Controls_Manager::COLOR,
                'selectors' => [
                    '{{WRAPPER}} .xis-section-title h2' => 'color: {{VALUE}} ',
                ],
            ]
        );

        $this->add_group_control(
            Group_Control_Typography::get_type(),
            [
                'name'           => 'fs_title_typography',
                'label'          => esc_html__( 'Typography', 'ximsa' ),
                'selector'       => '{{WRAPPER}} .xis-section-title h2',
                'fields_options' => [
                    'typography' => [
                        'default' => 'custom',
                    ],
                ],
            ]
        );
        $this->add_control(
            'feature_desc',
            [
                'type'      => Controls_Manager::HEADING,
                'label'     => esc_html__( 'Description Style', 'ximsa' ),
                'separator' => 'before',
            ]
        );
        $this->add_control(
            'sl_desc_color',
            [
                'label'     => esc_html__( 'Description Color', 'ximsa' ),
                'type'      => Controls_Manager::COLOR,
                'selectors' => [
                    '{{WRAPPER}} .pera-content p' => 'color: {{VALUE}} ',
                ],
            ]
        );
        $this->add_group_control(
            Group_Control_Typography::get_type(),
            [
                'name'           => 'ab_desc_typography',
                'label'          => esc_html__( 'Typography', 'ximsa' ),
                'selector'       => '{{WRAPPER}} .pera-content p',
                'fields_options' => [
                    'typography' => [
                        'default' => 'custom',
                    ],
                ],
            ]
        );

        $this->add_control(
            'fs_list_style',
            [
                'type'      => Controls_Manager::HEADING,
                'label'     => esc_html__( 'feature List Style', 'ximsa' ),
                'separator' => 'before',
            ]
        );
        $this->add_control(
            'fs_list_cl',
            [
                'label'     => esc_html__( 'List Txt Color', 'ximsa' ),
                'type'      => Controls_Manager::COLOR,
                'selectors' => [
                    '{{WRAPPER}} .xis-feature-list-item li' => 'color: {{VALUE}} ',
                ],
            ]
        );
        $this->add_control(
            'ab_list_bg',
            [
                'label'     => esc_html__( 'List Dot BG Color', 'ximsa' ),
                'type'      => Controls_Manager::COLOR,
                'selectors' => [
                    '{{WRAPPER}} .xis-feature-list-item li:before' => 'background-color: {{VALUE}} ',
                ],
            ]
        );
        $this->add_group_control(
            Group_Control_Typography::get_type(),
            [
                'name'           => 'ab_list_typography',
                'label'          => esc_html__( 'Typography', 'ximsa' ),
                'selector'       => '{{WRAPPER}} .xis-feature-list-item li',
                'fields_options' => [
                    'typography' => [
                        'default' => 'custom',
                    ],
                ],
            ]
        );
		$this->end_controls_section();
	}



	protected function render() {


		$settings = $this->get_settings_for_display(); ?>
		<!-- Start of Feature section
        ============================================= -->
        <section id="xis-feature-2" class="xis-feature-section-2 position-relative">
            <span class="xis-feature-shape1 position-absolute" data-parallax='{"y" : -100, "rotateY":100}'><img src="<?php echo esc_url($settings['circle_sec_shape']['url']);?>" alt=""></span>
            <div class="container">
                <div class="xis-feature-content-2">
                    <div class="row">
                        <div class="col-lg-6">
                            <div class="xis-feature-text-wrapper">
                                <div class="xis-section-title headline pera-content wow fadeInUp" data-wow-delay="0ms" data-wow-duration="1500ms">
                                    <span><?php echo __($settings['fs_sub_title']);?></span>
                                    <h2><?php echo __($settings['fs_title']);?></h2>
                                    <p><?php echo __($settings['fs_txt']);?></p>
                                </div>
                                <div class="xis-feature-list-item ul-li-block wow fadeInUp" data-wow-delay="300ms" data-wow-duration="1500ms">
                                    <ul>
                                        <?php foreach($settings['listitems'] as $list):?>
                                            <li><?php echo esc_html($list['title']);?></li>
                                        <?php endforeach;?>
                                    </ul>
                                </div>
                                <div class="xis-ft-download-btn wow fadeInUp" data-wow-delay="500ms" data-wow-duration="1500ms">
                                    <?php if(!empty($settings['app_store_btn']['url'])):?>
                                        <a
                                        href="<?php echo esc_url($settings['app_link']['url']);?>"
                                        target="<?php echo esc_attr($settings['app_link']['is_external'] ? '_blank' : '_self');?>"
                                        rel="<?php echo esc_attr($settings['app_link']['nofollow'] ? 'nofollow' : '');?>"
                                        >
                                        <img src="<?php echo esc_url($settings['app_store_btn']['url']);?>" alt=""></a>
                                    <?php endif;?>

                                    <?php if(!empty($settings['play_store_btn']['url'])):?>
                                        <a
                                        href="<?php echo esc_url($settings['play_link']['url']);?>"
                                        target="<?php echo esc_attr($settings['play_link']['is_external'] ? '_blank' : '_self');?>"
                                        rel="<?php echo esc_attr($settings['play_link']['nofollow'] ? 'nofollow' : '');?>"
                                        >
                                        <img src="<?php echo esc_url($settings['play_store_btn']['url']);?>" alt=""></a>
                                    <?php endif;?>

                                </div>
                            </div>
                        </div>
                        <div class="col-lg-6">
                            <div class="xis-feature-img-wrapper d-flex justify-content-end position-relative">

                                <div class="xis-feature-circle-img wow zoomIn" data-wow-delay="100ms" data-wow-duration="1500ms">
                                    <img src="<?php echo esc_url($settings['circle_shape']['url']);?>" alt="">
                                </div>

                                <div class="xis-feature-img1 position-absolute wow fadeInUp" data-wow-delay="500ms" data-wow-duration="1500ms">
                                    <img src="<?php echo esc_url($settings['mobile_mockup']['url']);?>" alt="">
                                </div>

                                <div class="xis-feature-img2 position-absolute wow fadeInLeft" data-wow-delay="700ms" data-wow-duration="1500ms">
                                    <img src="<?php echo esc_url($settings['payment_img']['url']);?>" alt="">
                                </div>

                                <div class="xis-feature-img3 position-absolute wow fadeInRight" data-wow-delay="800ms" data-wow-duration="1500ms">
                                    <img src="<?php echo esc_url($settings['msg_img']['url']);?>" alt="">
                                </div>

                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </section>
    <!-- End of Feature section
        ============================================= -->
		<?php
      }



}
