<?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\Group_Control_Background;
use Elementor\Plugin;

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

class insurance_appoinment 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 'insurance-appoinment';
	}

	/**
	 * Get widget title.
	 *
	 * Retrieve Elementor widget title.
	 *
	 * @since 1.0.0
	 * @access public
	 *
	 * @return string Widget title.
	 */
	public function get_title() {
		return esc_html__( 'Insurance Appoinment', '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(
            'ins_ct_opt',
            [
                'label' => __( 'Insurance Appoinment', 'ximsa' ),
                'tab' => Controls_Manager::TAB_CONTENT,
            ]
        );
               
        $this->add_control(
			'form_shortcode',
			[
				'label' => esc_html__( 'Form Shortcode', 'ximsa' ),
				'type' => Controls_Manager::TEXTAREA,
                'label_block' => true,
			]
		);
        
        
		$this->end_controls_section();

        $this->start_controls_section(
            'step_opt_style',
            [
                'label' => __( 'Step Style Settings', 'ximsa' ),
                'tab' => Controls_Manager::TAB_STYLE,
            ]
        );
        $this->add_control(
			'margin-top',
			[
				'label' => esc_html__( 'Top Spacing', 'plugin-name' ),
				'type' => \Elementor\Controls_Manager::SLIDER,
				'size_units' => [ 'px', '%' ],
				'range' => [
					'px' => [
						'min' => 0,
						'max' => 2000,
						'step' => 1,
					],
					'%' => [
						'min' => 0,
						'max' => 100,
					],
				],
				
				'selectors' => [
					'{{WRAPPER}} .select-insurance-section .inner-container' => 'margin-top: {{SIZE}}{{UNIT}};',
				],
			]
		);
        $this->add_control(
            'label_st',
            [
                'type'      => Controls_Manager::HEADING,
                'label'     => esc_html__( 'Label Style', 'ximsa' ),
                'separator' => 'before',
            ]
        );
        
        $this->add_control(
            'label_style_cl',
            [
                'label'     => esc_html__( 'Label Styletle Color', 'ximsa' ),
                'type'      => Controls_Manager::COLOR,
                'selectors' => [
                    '{{WRAPPER}} .insurance-form .form-group label' => 'color: {{VALUE}} ',
                ],
            ]
        );
        $this->add_group_control(
            Group_Control_Typography::get_type(),
            [
                'name'           => 'label__typography',
                'label'          => esc_html__( 'Typography', 'ximsa' ),
                'selector'       => '{{WRAPPER}} .insurance-form .form-group label',
                'fields_options' => [
                    'typography' => [
                        'default' => 'custom',
                    ],
                ],
            ]
        );
        $this->add_control(
            'btn_style',
            [
                'type'      => Controls_Manager::HEADING,
                'label'     => esc_html__( 'Button Style', 'ximsa' ),
                'separator' => 'before',
            ]
        );
        
        $this->add_control(
            'btn_color',
            [
                'label'     => esc_html__( 'Button Color', 'ximsa' ),
                'type'      => Controls_Manager::COLOR,
                'selectors' => [
                    '{{WRAPPER}} .insurance-form .quote-btn' => 'color: {{VALUE}} ',
                ],
            ]
        );
        $this->add_control(
            'btn_bg_cl',
            [
                'label'     => esc_html__( 'Button BG Color', 'ximsa' ),
                'type'      => Controls_Manager::COLOR,
                'selectors' => [
                    '{{WRAPPER}} .insurance-form .quote-btn' => 'background-color: {{VALUE}} ',
                ],
            ]
        );
        $this->add_control(
            'btn_bg_hv_cl',
            [
                'label'     => esc_html__( 'Button BG Hover Color', 'ximsa' ),
                'type'      => Controls_Manager::COLOR,
                'selectors' => [
                    '{{WRAPPER}} .insurance-form .quote-btn:hover' => 'background-color: {{VALUE}} ',
                ],
            ]
        );
        $this->add_group_control(
            Group_Control_Typography::get_type(),
            [
                'name'           => 'btn_text_typography',
                'label'          => esc_html__( 'Typography', 'ximsa' ),
                'selector'       => '{{WRAPPER}} .insurance-form .quote-btn',
                'fields_options' => [
                    'typography' => [
                        'default' => 'custom',
                    ],
                ],
            ]
        );
        $this->add_control(
            'shape_style',
            [
                'type'      => Controls_Manager::HEADING,
                'label'     => esc_html__( 'Shape Style', 'ximsa' ),
                'separator' => 'before',
            ]
        );
        
        $this->add_control(
            'shape_bg_cl',
            [
                'label'     => esc_html__( 'Shape BG Color', 'ximsa' ),
                'type'      => Controls_Manager::COLOR,
                'selectors' => [
                    '{{WRAPPER}} .select-insurance-section .inner-container' => 'background: {{VALUE}} ',
                ],
            ]
        );
        
        $this->add_control(
            'shape_tw_bg',
            [
                'label'     => esc_html__( 'Shape BG 2 Color', 'ximsa' ),
                'type'      => Controls_Manager::COLOR,
                'selectors' => [
                    '{{WRAPPER}} .select-insurance-section .inner-container .color-one' => 'background: {{VALUE}} ',
                ],
            ]
        );
        

        
		$this->end_controls_section();
	}
		


	protected function render() {	
	$settings = $this->get_settings_for_display();?>        
	<!-- Select Insurance Section -->
	<section class="select-insurance-section">
		<div class="auto-container">
			<div class="inner-container">
				<div class="color-one"></div>
				<div class="color-two"></div>
				<!-- Insurance Form -->
				<div class="insurance-form">                
					<?php echo do_shortcode( $settings['form_shortcode'] );?>
				</div>
				<!-- End Insurance Form -->
				
			</div>
		</div>
	</section>
	<!-- End Select Insurance Section -->
    <?php  
    }
	
}

