<?php
/*
 * Elementor eCommerce Addon Offer Widget
 * Author & Copyright: NicheAddon
*/

namespace Elementor;

if (!isset(get_option( 'naeca_bw_settings' )['naeca_offer'])) { // enable & disable

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

class eCommerce_Elementor_Addon_Offer extends Widget_Base{

	/**
	 * Retrieve the widget name.
	*/
	public function get_name(){
		return 'naecommerce_basic_offer';
	}

	/**
	 * Retrieve the widget title.
	*/
	public function get_title(){
		return esc_html__( 'Offer', 'ecommerce-addon' );
	}

	/**
	 * Retrieve the widget icon.
	*/
	public function get_icon() {
		return 'eicon-product-stock';
	}

	/**
	 * Retrieve the list of categories the widget belongs to.
	*/
	public function get_categories() {
		return ['naecommerce-basic-category'];
	}

	/**
	 * Register eCommerce Addon Offer widget controls.
	 * Adds different input fields to allow the user to change and customize the widget settings.
	*/
	protected function register_controls(){

		$this->start_controls_section(
			'section_offer',
			[
				'label' => __( 'Offer Item', 'ecommerce-addon' ),
			]
		);
		$this->add_control(
			'offer_style',
			[
				'label' => esc_html__( 'Offer Style', 'ecommerce-addon' ),
				'type' => Controls_Manager::SELECT,
				'options' => [
					'one' => esc_html__( 'Style One', 'ecommerce-addon' ),
					'two' => esc_html__( 'Style Two', 'ecommerce-addon' ),
				],
				'default' => 'one',
				'description' => esc_html__( 'Select your style.', 'ecommerce-addon' ),
			]
		);
		$this->add_control(
			'align_style_two',
			[
				'label' => esc_html__( 'Align Style', 'ecommerce-addon' ),
				'type' => Controls_Manager::SELECT,
				'options' => [
					'one' => esc_html__( 'Style One', 'ecommerce-addon' ),
					'two' => esc_html__( 'Style Two', 'ecommerce-addon' ),
					'three' => esc_html__( 'Style Three', 'ecommerce-addon' ),
					'four' => esc_html__( 'Style Four', 'ecommerce-addon' ),
					'five' => esc_html__( 'Style Five', 'ecommerce-addon' ),
				],
				'default' => 'one',
				'description' => esc_html__( 'Select your style.', 'ecommerce-addon' ),
				'condition' => [
					'offer_style' => 'two',
				],
			]
		);
		$this->add_control(
			'align_style',
			[
				'label' => esc_html__( 'Align Style', 'ecommerce-addon' ),
				'type' => Controls_Manager::SELECT,
				'options' => [
					'one' => esc_html__( 'Style One', 'ecommerce-addon' ),
					'two' => esc_html__( 'Style Two', 'ecommerce-addon' ),
					'three' => esc_html__( 'Style Three', 'ecommerce-addon' ),
					'four' => esc_html__( 'Style Four', 'ecommerce-addon' ),
					'five' => esc_html__( 'Style Five', 'ecommerce-addon' ),
					'six' => esc_html__( 'Style Six', 'ecommerce-addon' ),
					'seven' => esc_html__( 'Style Seven', 'ecommerce-addon' ),
					'eight' => esc_html__( 'Style Eight', 'ecommerce-addon' ),
				],
				'default' => 'one',
				'description' => esc_html__( 'Select your style.', 'ecommerce-addon' ),
				'condition' => [
					'offer_style' => 'one',
				],
			]
		);
		$this->start_controls_tabs( 'offer_images' );
			$this->start_controls_tab(
				'cnt_image',
				[
					'label' => esc_html__( 'Image', 'ecommerce-addon' ),
				]
			);
			$this->add_control(
				'offer_image',
				[
					'label' => esc_html__( 'Upload Image', 'ecommerce-addon' ),
					'type' => Controls_Manager::MEDIA,
					'frontend_available' => true,
					'default' => [
						'url' => Utils::get_placeholder_image_src(),
					],
					'description' => esc_html__( 'Set your image.', 'ecommerce-addon'),
				]
			);
			$this->add_control(
				'image_link',
				[
					'label' => esc_html__( 'Image Link', 'ecommerce-addon' ),
					'type' => Controls_Manager::URL,
					'placeholder' => 'https://your-link.com',
					'default' => [
						'url' => '',
					],
					'label_block' => true,
					'separator' => 'before',
					'condition' => [
						'offer_style' => 'one',
					],
				]
			);
			$this->add_control(
				'anim_style',
				[
					'label' => esc_html__( 'Animation Style', 'ecommerce-addon' ),
					'type' => Controls_Manager::SELECT,
					'options' => [
						'fade' 						=> esc_html__( 'Fade', 'ecommerce-addon' ),
						'fade-up' 				=> esc_html__( 'Fade Up', 'ecommerce-addon' ),
						'fade-down' 			=> esc_html__( 'Fade Down', 'ecommerce-addon' ),
						'fade-left' 			=> esc_html__( 'Fade Left', 'ecommerce-addon' ),
						'fade-right' 			=> esc_html__( 'Fade Right', 'ecommerce-addon' ),
						'fade-up-right' 	=> esc_html__( 'Fade Up Right', 'ecommerce-addon' ),
						'fade-up-left' 		=> esc_html__( 'Fade Up Left', 'ecommerce-addon' ),
						'fade-down-right' => esc_html__( 'Fade Down Right', 'ecommerce-addon' ),
						'fade-down-left' 	=> esc_html__( 'Fade Down Left', 'ecommerce-addon' ),
						'flip-up' 				=> esc_html__( 'Flip Up', 'ecommerce-addon' ),
						'flip-down' 			=> esc_html__( 'Flip Down', 'ecommerce-addon' ),
						'flip-left' 			=> esc_html__( 'Flip Left', 'ecommerce-addon' ),
						'flip-right' 			=> esc_html__( 'Flip Right', 'ecommerce-addon' ),
						'slide-up' 				=> esc_html__( 'Slide Up', 'ecommerce-addon' ),
						'slide-down' 			=> esc_html__( 'Slide Down', 'ecommerce-addon' ),
						'slide-left' 			=> esc_html__( 'Slide Left', 'ecommerce-addon' ),
						'slide-right' 		=> esc_html__( 'Slide Right', 'ecommerce-addon' ),
						'zoom-in' 				=> esc_html__( 'Zoom In', 'ecommerce-addon' ),
						'zoom-in-up' 			=> esc_html__( 'Zoom In Up', 'ecommerce-addon' ),
						'zoom-in-down' 		=> esc_html__( 'Zoom In Down', 'ecommerce-addon' ),
						'zoom-in-left' 		=> esc_html__( 'Zoom In Left', 'ecommerce-addon' ),
						'zoom-in-right' 	=> esc_html__( 'Zoom In Right', 'ecommerce-addon' ),
						'zoom-out' 				=> esc_html__( 'Zoom Out', 'ecommerce-addon' ),
						'zoom-out-up' 		=> esc_html__( 'Zoom Out Up', 'ecommerce-addon' ),
						'zoom-out-down' 	=> esc_html__( 'Zoom Out Down', 'ecommerce-addon' ),
						'zoom-out-left' 	=> esc_html__( 'Zoom Out Left', 'ecommerce-addon' ),
						'zoom-out-right' 	=> esc_html__( 'Zoom Out Right', 'ecommerce-addon' ),
					],
					'default' => 'fade-up',
					'description' => esc_html__( 'Select your style.', 'ecommerce-addon' ),
					'condition' => [
						'offer_style' => 'one',
					],
				]
			);
			$this->add_responsive_control(
				'anim_delay',
				[
					'label' => esc_html__( 'Animation Delay', 'ecommerce-addon' ),
					'type' => Controls_Manager::NUMBER,
					'min' => 1,
					'max' => 5000,
					'step' => 1,
					'default' => 250,
					'description' => esc_html__( 'Set animation delay.', 'ecommerce-addon' ),
					'condition' => [
						'offer_style' => 'one',
					],
				]
			);
			$this->add_responsive_control(
				'anim_duration',
				[
					'label' => esc_html__( 'Animation Duration', 'ecommerce-addon' ),
					'type' => Controls_Manager::NUMBER,
					'min' => 1,
					'max' => 5000,
					'step' => 1,
					'default' => 500,
					'description' => esc_html__( 'Set animation duration.', 'ecommerce-addon' ),
					'condition' => [
						'offer_style' => 'one',
					],
				]
			);
			$this->end_controls_tab();  // end:Normal tab
			$this->start_controls_tab(
				'cnt_bg',
				[
					'label' => esc_html__( 'Background', 'ecommerce-addon' ),
					'condition' => [
						'offer_style' => 'one',
					],
				]
			);
			$this->add_control(
				'bg_image',
				[
					'label' => esc_html__( 'Upload Image', 'ecommerce-addon' ),
					'type' => Controls_Manager::MEDIA,
					'frontend_available' => true,
					'default' => [
						'url' => Utils::get_placeholder_image_src(),
					],
					'description' => esc_html__( 'Set your image.', 'ecommerce-addon'),
				]
			);
			$this->add_control(
				'bg_anim_style',
				[
					'label' => esc_html__( 'Animation Style', 'ecommerce-addon' ),
					'type' => Controls_Manager::SELECT,
					'options' => [
						'fade' 						=> esc_html__( 'Fade', 'ecommerce-addon' ),
						'fade-up' 				=> esc_html__( 'Fade Up', 'ecommerce-addon' ),
						'fade-down' 			=> esc_html__( 'Fade Down', 'ecommerce-addon' ),
						'fade-left' 			=> esc_html__( 'Fade Left', 'ecommerce-addon' ),
						'fade-right' 			=> esc_html__( 'Fade Right', 'ecommerce-addon' ),
						'fade-up-right' 	=> esc_html__( 'Fade Up Right', 'ecommerce-addon' ),
						'fade-up-left' 		=> esc_html__( 'Fade Up Left', 'ecommerce-addon' ),
						'fade-down-right' => esc_html__( 'Fade Down Right', 'ecommerce-addon' ),
						'fade-down-left' 	=> esc_html__( 'Fade Down Left', 'ecommerce-addon' ),
						'flip-up' 				=> esc_html__( 'Flip Up', 'ecommerce-addon' ),
						'flip-down' 			=> esc_html__( 'Flip Down', 'ecommerce-addon' ),
						'flip-left' 			=> esc_html__( 'Flip Left', 'ecommerce-addon' ),
						'flip-right' 			=> esc_html__( 'Flip Right', 'ecommerce-addon' ),
						'slide-up' 				=> esc_html__( 'Slide Up', 'ecommerce-addon' ),
						'slide-down' 			=> esc_html__( 'Slide Down', 'ecommerce-addon' ),
						'slide-left' 			=> esc_html__( 'Slide Left', 'ecommerce-addon' ),
						'slide-right' 		=> esc_html__( 'Slide Right', 'ecommerce-addon' ),
						'zoom-in' 				=> esc_html__( 'Zoom In', 'ecommerce-addon' ),
						'zoom-in-up' 			=> esc_html__( 'Zoom In Up', 'ecommerce-addon' ),
						'zoom-in-down' 		=> esc_html__( 'Zoom In Down', 'ecommerce-addon' ),
						'zoom-in-left' 		=> esc_html__( 'Zoom In Left', 'ecommerce-addon' ),
						'zoom-in-right' 	=> esc_html__( 'Zoom In Right', 'ecommerce-addon' ),
						'zoom-out' 				=> esc_html__( 'Zoom Out', 'ecommerce-addon' ),
						'zoom-out-up' 		=> esc_html__( 'Zoom Out Up', 'ecommerce-addon' ),
						'zoom-out-down' 	=> esc_html__( 'Zoom Out Down', 'ecommerce-addon' ),
						'zoom-out-left' 	=> esc_html__( 'Zoom Out Left', 'ecommerce-addon' ),
						'zoom-out-right' 	=> esc_html__( 'Zoom Out Right', 'ecommerce-addon' ),
					],
					'default' => 'fade-up',
					'description' => esc_html__( 'Select your style.', 'ecommerce-addon' ),
					'condition' => [
						'offer_style' => 'one',
					],
				]
			);
			$this->add_responsive_control(
				'bg_anim_delay',
				[
					'label' => esc_html__( 'Animation Delay', 'ecommerce-addon' ),
					'type' => Controls_Manager::NUMBER,
					'min' => 1,
					'max' => 5000,
					'step' => 1,
					'default' => 250,
					'description' => esc_html__( 'Set animation delay.', 'ecommerce-addon' ),
					'condition' => [
						'offer_style' => 'one',
					],
				]
			);
			$this->add_responsive_control(
				'bg_anim_duration',
				[
					'label' => esc_html__( 'Animation Duration', 'ecommerce-addon' ),
					'type' => Controls_Manager::NUMBER,
					'min' => 1,
					'max' => 5000,
					'step' => 1,
					'default' => 500,
					'description' => esc_html__( 'Set animation duration.', 'ecommerce-addon' ),
					'condition' => [
						'offer_style' => 'one',
					],
				]
			);
			$this->end_controls_tab();  // end:Hover tab
			$this->start_controls_tab(
				'cnt_anim',
				[
					'label' => esc_html__( 'Content', 'ecommerce-addon' ),
					'condition' => [
						'offer_style' => 'one',
					],
				]
			);
			$this->add_control(
				'cnt_anim_style',
				[
					'label' => esc_html__( 'Animation Style', 'ecommerce-addon' ),
					'type' => Controls_Manager::SELECT,
					'options' => [
						'fade' 						=> esc_html__( 'Fade', 'ecommerce-addon' ),
						'fade-up' 				=> esc_html__( 'Fade Up', 'ecommerce-addon' ),
						'fade-down' 			=> esc_html__( 'Fade Down', 'ecommerce-addon' ),
						'fade-left' 			=> esc_html__( 'Fade Left', 'ecommerce-addon' ),
						'fade-right' 			=> esc_html__( 'Fade Right', 'ecommerce-addon' ),
						'fade-up-right' 	=> esc_html__( 'Fade Up Right', 'ecommerce-addon' ),
						'fade-up-left' 		=> esc_html__( 'Fade Up Left', 'ecommerce-addon' ),
						'fade-down-right' => esc_html__( 'Fade Down Right', 'ecommerce-addon' ),
						'fade-down-left' 	=> esc_html__( 'Fade Down Left', 'ecommerce-addon' ),
						'flip-up' 				=> esc_html__( 'Flip Up', 'ecommerce-addon' ),
						'flip-down' 			=> esc_html__( 'Flip Down', 'ecommerce-addon' ),
						'flip-left' 			=> esc_html__( 'Flip Left', 'ecommerce-addon' ),
						'flip-right' 			=> esc_html__( 'Flip Right', 'ecommerce-addon' ),
						'slide-up' 				=> esc_html__( 'Slide Up', 'ecommerce-addon' ),
						'slide-down' 			=> esc_html__( 'Slide Down', 'ecommerce-addon' ),
						'slide-left' 			=> esc_html__( 'Slide Left', 'ecommerce-addon' ),
						'slide-right' 		=> esc_html__( 'Slide Right', 'ecommerce-addon' ),
						'zoom-in' 				=> esc_html__( 'Zoom In', 'ecommerce-addon' ),
						'zoom-in-up' 			=> esc_html__( 'Zoom In Up', 'ecommerce-addon' ),
						'zoom-in-down' 		=> esc_html__( 'Zoom In Down', 'ecommerce-addon' ),
						'zoom-in-left' 		=> esc_html__( 'Zoom In Left', 'ecommerce-addon' ),
						'zoom-in-right' 	=> esc_html__( 'Zoom In Right', 'ecommerce-addon' ),
						'zoom-out' 				=> esc_html__( 'Zoom Out', 'ecommerce-addon' ),
						'zoom-out-up' 		=> esc_html__( 'Zoom Out Up', 'ecommerce-addon' ),
						'zoom-out-down' 	=> esc_html__( 'Zoom Out Down', 'ecommerce-addon' ),
						'zoom-out-left' 	=> esc_html__( 'Zoom Out Left', 'ecommerce-addon' ),
						'zoom-out-right' 	=> esc_html__( 'Zoom Out Right', 'ecommerce-addon' ),
					],
					'default' => 'fade-up',
					'description' => esc_html__( 'Select your style.', 'ecommerce-addon' ),
					'condition' => [
						'offer_style' => 'one',
					],
				]
			);
			$this->add_responsive_control(
				'cnt_anim_delay',
				[
					'label' => esc_html__( 'Animation Delay', 'ecommerce-addon' ),
					'type' => Controls_Manager::NUMBER,
					'min' => 1,
					'max' => 5000,
					'step' => 1,
					'default' => 250,
					'description' => esc_html__( 'Set animation delay.', 'ecommerce-addon' ),
					'condition' => [
						'offer_style' => 'one',
					],
				]
			);
			$this->add_responsive_control(
				'cnt_anim_duration',
				[
					'label' => esc_html__( 'Animation Duration', 'ecommerce-addon' ),
					'type' => Controls_Manager::NUMBER,
					'min' => 1,
					'max' => 5000,
					'step' => 1,
					'default' => 500,
					'description' => esc_html__( 'Set animation duration.', 'ecommerce-addon' ),
					'condition' => [
						'offer_style' => 'one',
					],
				]
			);
			$this->end_controls_tab();  // end:Hover tab
		$this->end_controls_tabs(); // end tabs
		$this->add_control(
			'offer_title',
			[
				'label' => esc_html__( 'Title', 'ecommerce-addon' ),
				'type' => Controls_Manager::TEXT,
				'default' => esc_html__( 'Save Big Sale', 'ecommerce-addon' ),
				'placeholder' => esc_html__( 'Type title text here', 'ecommerce-addon' ),
				'label_block' => true,
			]
		);
		$this->add_control(
			'title_link',
			[
				'label' => esc_html__( 'Title Link', 'ecommerce-addon' ),
				'type' => Controls_Manager::URL,
				'placeholder' => 'https://your-link.com',
				'default' => [
					'url' => '',
				],
				'label_block' => true,
				'separator' => 'before',
			]
		);
		$this->add_control(
			'price_before',
			[
				'label' => esc_html__( 'Price Before', 'ecommerce-addon' ),
				'type' => Controls_Manager::TEXT,
				'default' => esc_html__( 'Up to', 'ecommerce-addon' ),
				'placeholder' => esc_html__( 'Type title text here', 'ecommerce-addon' ),
				'label_block' => true,
				'condition' => [
					'align_style' => array('two','five','eight'),
					'offer_style' => 'one',
				],
			]
		);
		$this->add_control(
			'offer_price',
			[
				'label' => esc_html__( 'Price Title', 'ecommerce-addon' ),
				'type' => Controls_Manager::TEXT,
				'default' => esc_html__( '50', 'ecommerce-addon' ),
				'placeholder' => esc_html__( 'Type title text here', 'ecommerce-addon' ),
				'label_block' => true,
			]
		);
		$this->add_control(
			'price_unit',
			[
				'label' => esc_html__( 'Price Unit', 'ecommerce-addon' ),
				'type' => Controls_Manager::TEXT,
				'default' => esc_html__( '%', 'ecommerce-addon' ),
				'placeholder' => esc_html__( 'Type title text here', 'ecommerce-addon' ),
				'label_block' => true,
				'condition' => [
					'align_style' => array('five','eight'),
					'offer_style' => 'one',
				],
			]
		);
		$this->add_control(
			'price_unit_two',
			[
				'label' => esc_html__( 'Price Unit', 'ecommerce-addon' ),
				'type' => Controls_Manager::TEXT,
				'default' => esc_html__( '%', 'ecommerce-addon' ),
				'placeholder' => esc_html__( 'Type title text here', 'ecommerce-addon' ),
				'label_block' => true,
				'condition' => [
					'offer_style' => 'two',
				],
			]
		);
		$this->add_control(
			'price_after',
			[
				'label' => esc_html__( 'Price After', 'ecommerce-addon' ),
				'type' => Controls_Manager::TEXT,
				'default' => esc_html__( 'Off', 'ecommerce-addon' ),
				'placeholder' => esc_html__( 'Type title text here', 'ecommerce-addon' ),
				'label_block' => true,
				'condition' => [
					'align_style' => array('one','five','eight','seven'),
					'offer_style' => 'one',
				],
			]
		);
		$this->add_control(
			'offer_content',
			[
				'label' => esc_html__( 'Content', 'ecommerce-addon' ),
				'placeholder' => esc_html__( 'Type your content here', 'ecommerce-addon' ),
				'type' => Controls_Manager::TEXTAREA,
				'label_block' => true,
				'separator' => 'before',
				'condition' => [
					'align_style' => 'four',
					'offer_style' => 'one',
				],
			]
		);		
		$this->add_control(
			'btn_text',
			[
				'label' => esc_html__( 'Link Text', 'ecommerce-addon' ),
				'type' => Controls_Manager::TEXT,
				'default' => esc_html__( 'Shop Now', 'ecommerce-addon' ),
				'placeholder' => esc_html__( 'Type title text here', 'ecommerce-addon' ),
				'label_block' => true,
				'separator' => 'before',
			]
		);
		$this->add_control(
			'btn_link',
			[
				'label' => esc_html__( 'Text Link', 'ecommerce-addon' ),
				'type' => Controls_Manager::URL,
				'placeholder' => 'https://your-link.com',
				'default' => [
					'url' => '',
				],
				'label_block' => true,
				'separator' => 'before',
			]
		);
		$this->add_responsive_control(
			'content_alignment',
			[
				'label' => esc_html__( 'Tab Alignment', 'ecommerce-addon' ),
				'type' => Controls_Manager::CHOOSE,
				'options' => [
					'left' => [
						'title' => esc_html__( 'Left', 'ecommerce-addon' ),
						'icon' => 'fa fa-align-left',
					],
					'center' => [
						'title' => esc_html__( 'Center', 'ecommerce-addon' ),
						'icon' => 'fa fa-align-center',
					],
					'right' => [
						'title' => esc_html__( 'Right', 'ecommerce-addon' ),
						'icon' => 'fa fa-align-right',
					],
				],
				'default' => 'center',
				'condition' => [
					'align_style' => 'eight',
					'offer_style' => 'one',
				],
			]
		);
		$this->add_control(
			'toggle',
			[
				'label' => esc_html__( 'Toggle?', 'ecommerce-addon' ),
				'type' => Controls_Manager::SWITCHER,
				'label_on' => esc_html__( 'Yes', 'ecommerce-addon' ),
				'label_off' => esc_html__( 'No', 'ecommerce-addon' ),
				'return_value' => 'true',
			]
		);
		$this->add_control(
			'need_count',
			[
				'label' => esc_html__( 'Need Countdown?', 'ecommerce-addon' ),
				'type' => Controls_Manager::SWITCHER,
				'label_on' => esc_html__( 'Yes', 'ecommerce-addon' ),
				'label_off' => esc_html__( 'No', 'ecommerce-addon' ),
				'return_value' => 'true',
			]
		);
		$this->add_control(
			'count_type',
			[
				'label' => __( 'Countdown Type', 'ecommerce-addon' ),
				'type' => Controls_Manager::SELECT,
				'options' => [
					'static' => esc_html__( 'Static Date', 'ecommerce-addon' ),
					'fake'    => esc_html__('Fake Date', 'ecommerce-addon'),
				],
				'default' => 'static',
				'description' => esc_html__( 'Select your countdown date type.', 'ecommerce-addon' ),
				'condition' => [
					'need_count' => 'true',
				],
			]
		);
		$this->add_control(
			'count_date_static',
			[
				'label' => esc_html__( 'Date & Time', 'ecommerce-addon' ),
				'type' => Controls_Manager::DATE_TIME,
				'picker_options' => [
					'dateFormat' => 'm/d/Y G:i:S',
					'enableTime' => 'true',
					'enableSeconds' => 'true',
				],
				'placeholder' => esc_html__( 'mm/dd/yyyy hh:mm:ss', 'ecommerce-addon' ),
				'label_block' => true,
				'condition' => [
					'count_type' => 'static',
					'need_count' => 'true',
				],
			]
		);
		$this->add_control(
			'fake_date',
			[
				'label' => esc_html__( 'Fake Date', 'ecommerce-addon' ),
				'type' => Controls_Manager::TEXT,
				'label_block' => true,
				'default' => esc_html__( '3', 'ecommerce-addon' ),
				'description' => esc_html__( 'Enter your fake day count here. Ex: 2 or 3(in days)', 'ecommerce-addon' ),
				'condition' => [
					'count_type' => 'fake',
					'need_count' => 'true',
				],
			]
		);
		$this->add_control(
			'countdown_format',
			[
				'label' => esc_html__( 'Countdown Format', 'ecommerce-addon' ),
				'type' => Controls_Manager::TEXT,
				'label_block' => true,
				'default' => esc_html__( 'dHMS', 'ecommerce-addon' ),
				'description' => __( '<b>For Countdown Format Reference : <a href="http://keith-wood.name/countdown.html" target="_blank">Click Here</a></b>.', 'ecommerce-addon' ),
				'condition' => [
					'need_count' => 'true',
				],
			]
		);
		$this->add_control(
			'need_separator',
			[
				'label' => esc_html__( 'Need Separator?', 'ecommerce-addon' ),
				'type' => Controls_Manager::SWITCHER,
				'label_on' => esc_html__( 'Yes', 'ecommerce-addon' ),
				'label_off' => esc_html__( 'No', 'ecommerce-addon' ),
				'return_value' => 'true',
				'condition' => [
					'need_count' => 'true',
				],
			]
		);
		$this->end_controls_section();// end: Section

		// Countdown Labels
			$this->start_controls_section(
				'countdown_labels',
				[
					'label' => esc_html__( 'Countdown Labels', 'ecommerce-addon' ),
					'condition' => [
						'need_count' => 'true',
					],
				]
			);
			$this->add_control(
				'plural_labels',
				[
					'type' => Controls_Manager::RAW_HTML,
					'raw' => '<div class="elementor-control-raw-html elementor-panel-alert elementor-panel-alert-warning"><b>Plural Labels</b></div>',
				]
			);
			$this->add_control(
				'label_years',
				[
					'label' => esc_html__( 'Years Text', 'ecommerce-addon' ),
					'type' => Controls_Manager::TEXT,
					'label_block' => true,
					'default' => esc_html__( 'years', 'ecommerce-addon' ),
				]
			);
			$this->add_control(
				'label_months',
				[
					'label' => esc_html__( 'Months Text', 'ecommerce-addon' ),
					'type' => Controls_Manager::TEXT,
					'label_block' => true,
					'default' => esc_html__( 'months', 'ecommerce-addon' ),
				]
			);
			$this->add_control(
				'label_weeks',
				[
					'label' => esc_html__( 'Weeks Text', 'ecommerce-addon' ),
					'type' => Controls_Manager::TEXT,
					'label_block' => true,
					'default' => esc_html__( 'weeks', 'ecommerce-addon' ),
				]
			);
			$this->add_control(
				'label_days',
				[
					'label' => esc_html__( 'Days Text', 'ecommerce-addon' ),
					'type' => Controls_Manager::TEXT,
					'label_block' => true,
					'default' => esc_html__( 'days', 'ecommerce-addon' ),
				]
			);
			$this->add_control(
				'label_hours',
				[
					'label' => esc_html__( 'Hours Text', 'ecommerce-addon' ),
					'type' => Controls_Manager::TEXT,
					'label_block' => true,
					'default' => esc_html__( 'hours', 'ecommerce-addon' ),
				]
			);
			$this->add_control(
				'label_minutes',
				[
					'label' => esc_html__( 'Minutes Text', 'ecommerce-addon' ),
					'type' => Controls_Manager::TEXT,
					'label_block' => true,
					'default' => esc_html__( 'minutes', 'ecommerce-addon' ),
				]
			);
			$this->add_control(
				'label_seconds',
				[
					'label' => esc_html__( 'Seconds Text', 'ecommerce-addon' ),
					'type' => Controls_Manager::TEXT,
					'label_block' => true,
					'default' => esc_html__( 'seconds', 'ecommerce-addon' ),
				]
			);
			$this->add_control(
				'singular_label',
				[
					'type' => Controls_Manager::RAW_HTML,
					'raw' => '<div class="elementor-control-raw-html elementor-panel-alert elementor-panel-alert-warning"><b>Singular Labels</b></div>',
				]
			);
			$this->add_control(
				'label_year',
				[
					'label' => esc_html__( 'Year Text', 'ecommerce-addon' ),
					'type' => Controls_Manager::TEXT,
					'label_block' => true,
					'default' => esc_html__( 'year', 'ecommerce-addon' ),
				]
			);
			$this->add_control(
				'label_month',
				[
					'label' => esc_html__( 'Month Text', 'ecommerce-addon' ),
					'type' => Controls_Manager::TEXT,
					'label_block' => true,
					'default' => esc_html__( 'month', 'ecommerce-addon' ),
				]
			);
			$this->add_control(
				'label_week',
				[
					'label' => esc_html__( 'Week Text', 'ecommerce-addon' ),
					'type' => Controls_Manager::TEXT,
					'label_block' => true,
					'default' => esc_html__( 'week', 'ecommerce-addon' ),
				]
			);
			$this->add_control(
				'label_day',
				[
					'label' => esc_html__( 'Day Text', 'ecommerce-addon' ),
					'type' => Controls_Manager::TEXT,
					'label_block' => true,
					'default' => esc_html__( 'day', 'ecommerce-addon' ),
				]
			);
			$this->add_control(
				'label_hour',
				[
					'label' => esc_html__( 'Hour Text', 'ecommerce-addon' ),
					'type' => Controls_Manager::TEXT,
					'label_block' => true,
					'default' => esc_html__( 'hour', 'ecommerce-addon' ),
				]
			);
			$this->add_control(
				'label_minute',
				[
					'label' => esc_html__( 'Minute Text', 'ecommerce-addon' ),
					'type' => Controls_Manager::TEXT,
					'label_block' => true,
					'default' => esc_html__( 'minute', 'ecommerce-addon' ),
				]
			);
			$this->add_control(
				'label_second',
				[
					'label' => esc_html__( 'Second Text', 'ecommerce-addon' ),
					'type' => Controls_Manager::TEXT,
					'label_block' => true,
					'default' => esc_html__( 'second', 'ecommerce-addon' ),
				]
			);
			$this->end_controls_section();// end: Section

		// Section
			$this->start_controls_section(
				'sectn_style',
				[
					'label' => esc_html__( 'Section', 'ecommerce-addon' ),
					'tab' => Controls_Manager::TAB_STYLE,
				]
			);
			$this->add_responsive_control(
				'section_padding',
				[
					'label' => __( 'Padding', 'ecommerce-addon' ),
					'type' => Controls_Manager::DIMENSIONS,
					'size_units' => [ 'px', '%', 'em' ],
					'selectors' => [
						'{{WRAPPER}} .naeca-offer figure' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
					],
				]
			);
			$this->add_responsive_control(
				'section_margin',
				[
					'label' => __( 'Margin', 'ecommerce-addon' ),
					'type' => Controls_Manager::DIMENSIONS,
					'size_units' => [ 'px', '%', 'em' ],
					'selectors' => [
						'{{WRAPPER}} .naeca-offer figure' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
					],
				]
			);
			$this->add_group_control(
				Group_Control_Background::get_type(),
				[
					'name' => 'secn_bg_color',
					'label' => __( 'Background Color', 'ecommerce-addon' ),
					'types' => [ 'classic', 'gradient' ],
					'selector' => '{{WRAPPER}} .naeca-offer figure figcaption',
				]
			);
			$this->add_responsive_control(
				'cont_in_padding',
				[
					'label' => __( 'Content Padding', 'ecommerce-addon' ),
					'type' => Controls_Manager::DIMENSIONS,
					'size_units' => [ 'px', '%', 'em' ],
					'selectors' => [
						'{{WRAPPER}} .naeca-offer figure figcaption' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
					],
				]
			);
			$this->add_control(
				'border_radius',
				[
					'label' => __( 'Border Radius', 'ecommerce-addon' ),
					'type' => Controls_Manager::DIMENSIONS,
					'size_units' => [ 'px', '%', 'em' ],
					'selectors' => [
						'{{WRAPPER}} .naeca-offer figure' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
					],
				]
			);
			$this->add_group_control(
				Group_Control_Border::get_type(),
				[
					'name' => 'secn_border',
					'label' => esc_html__( 'Border', 'ecommerce-addon' ),
					'selector' => '{{WRAPPER}} .naeca-offer figure',
				]
			);
			$this->add_group_control(
				Group_Control_Box_Shadow::get_type(),
				[
					'name' => 'secn_box_shadow',
					'label' => esc_html__( 'Section Box Shadow', 'ecommerce-addon' ),
					'selector' => '{{WRAPPER}} .naeca-offer figure',
				]
			);
			$this->end_controls_section();// end: Section

		// Value
			$this->start_controls_section(
				'count_section_value_style',
				[
					'label' => esc_html__( 'Countdown Value', 'ecommerce-addon' ),
					'tab' => Controls_Manager::TAB_STYLE,
				]
			);
			$this->add_responsive_control(
				'count_min_width',
				[
					'label' => esc_html__( 'Width', 'ecommerce-addon' ),
					'type' => Controls_Manager::SLIDER,
					'range' => [
						'px' => [
							'min' => 50,
							'max' => 1000,
							'step' => 1,
						],
					],
					'size_units' => [ 'px' ],
					'selectors' => [
						'{{WRAPPER}} .naeca-countdown-wrap .countdown_section' => 'min-width: {{SIZE}}{{UNIT}};',
					],
				]
			);
			$this->add_group_control(
				Group_Control_Typography::get_type(),
				[
					'name' => 'count_value_typography',
					'selector' => '{{WRAPPER}} .naeca-countdown-wrap .countdown_section .countdown_amount',
				]
			);
			$this->add_control(
				'count_value_color',
				[
					'label' => esc_html__( 'Value Color', 'ecommerce-addon' ),
					'type' => Controls_Manager::COLOR,
					'selectors' => [
						'{{WRAPPER}} .naeca-countdown-wrap .countdown_section .countdown_amount' => 'color: {{VALUE}};',
					],
				]
			);
			$this->add_control(
				'count_value_bg_color',
				[
					'label' => esc_html__( 'Value Background Color', 'ecommerce-addon' ),
					'type' => Controls_Manager::COLOR,
					'selectors' => [
						'{{WRAPPER}} .naeca-countdown-wrap .countdown_section' => 'background: {{VALUE}};',
					],
				]
			);
			$this->add_group_control(
				Group_Control_Border::get_type(),
				[
					'name' => 'count_value_box_border',
					'label' => esc_html__( 'Border', 'ecommerce-addon' ),
					'selector' => '{{WRAPPER}} .naeca-countdown-wrap .countdown_section',
				]
			);
			$this->add_group_control(
				Group_Control_Box_Shadow::get_type(),
				[
					'name' => 'count_value_box_shadow',
					'label' => esc_html__( 'Image Box Shadow', 'ecommerce-addon' ),
					'selector' => '{{WRAPPER}} .naeca-countdown-wrap .countdown_section',
				]
			);
			$this->add_control(
				'count_value_border_radius',
				[
					'label' => __( 'Border Radius', 'ecommerce-addon' ),
					'type' => Controls_Manager::DIMENSIONS,
					'size_units' => [ 'px', '%', 'em' ],
					'selectors' => [
						'{{WRAPPER}} .naeca-countdown-wrap .countdown_section' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
					],
				]
			);
			$this->end_controls_section();// end: Section

		// Separator
			$this->start_controls_section(
				'count_section_value_sep_style',
				[
					'label' => esc_html__( 'Countdown Separator', 'ecommerce-addon' ),
					'tab' => Controls_Manager::TAB_STYLE,
				]
			);
			$this->add_group_control(
				Group_Control_Typography::get_type(),
				[
					'name' => 'count_value_sep_typography',
					'selector' => '{{WRAPPER}} .countdown_section:after',
				]
			);
			$this->add_control(
				'count_value_sep_color',
				[
					'label' => esc_html__( 'Separator Color', 'ecommerce-addon' ),
					'type' => Controls_Manager::COLOR,
					'selectors' => [
						'{{WRAPPER}} .countdown_section:after' => 'color: {{VALUE}};',
					],
				]
			);
			$this->end_controls_section();// end: Section

		// Countdown Title
			$this->start_controls_section(
				'count_section_title_style',
				[
					'label' => esc_html__( 'Countdown Title', 'ecommerce-addon' ),
					'tab' => Controls_Manager::TAB_STYLE,
				]
			);
			$this->add_group_control(
				Group_Control_Typography::get_type(),
				[
					'name' => 'count_title_typography',
					'selector' => '{{WRAPPER}} .naeca-countdown-wrap .countdown_section',
				]
			);
			$this->add_control(
				'count_title_color',
				[
					'label' => esc_html__( 'Color', 'ecommerce-addon' ),
					'type' => Controls_Manager::COLOR,
					'selectors' => [
						'{{WRAPPER}} .naeca-countdown-wrap .countdown_section' => 'color: {{VALUE}};',
					],
				]
			);
			$this->end_controls_section();// end: Section

		// Title
			$this->start_controls_section(
				'section_title_style',
				[
					'label' => esc_html__( 'Title', 'ecommerce-addon' ),
					'tab' => Controls_Manager::TAB_STYLE,
				]
			);
			$this->add_responsive_control(
				'title_padding',
				[
					'label' => __( 'Title Padding', 'ecommerce-addon' ),
					'type' => Controls_Manager::DIMENSIONS,
					'size_units' => [ 'px', '%', 'em' ],
					'selectors' => [
						'{{WRAPPER}} .naeca-offer figure h3, {{WRAPPER}} .offer-style-two figure h4' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
					],
				]
			);
			$this->add_group_control(
				Group_Control_Typography::get_type(),
				[
					'label' => esc_html__( 'Typography', 'ecommerce-addon' ),
					'name' => 'sasoffer_title_typography',
					'selector' => '{{WRAPPER}} .naeca-offer figure h3, {{WRAPPER}} .offer-style-two figure h4',
				]
			);
			$this->add_control(
				'title_color',
				[
					'label' => esc_html__( 'Color', 'ecommerce-addon' ),
					'type' => Controls_Manager::COLOR,
					'selectors' => [
						'{{WRAPPER}} .naeca-offer figure h3, {{WRAPPER}} .offer-style-two figure h4' => 'color: {{VALUE}};',
					],
				]
			);
			$this->end_controls_section();// end: Section

		// Price
			$this->start_controls_section(
				'section_price_two_style',
				[
					'label' => esc_html__( 'Price', 'ecommerce-addon' ),
					'tab' => Controls_Manager::TAB_STYLE,
					'condition' => [
						'offer_style' => 'two',
					],
				]
			);
			$this->add_responsive_control(
				'price_two_padding',
				[
					'label' => __( 'Price Padding', 'ecommerce-addon' ),
					'type' => Controls_Manager::DIMENSIONS,
					'size_units' => [ 'px', '%', 'em' ],
					'selectors' => [
						'{{WRAPPER}} .offer-value' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
					],
				]
			);
			$this->add_group_control(
				Group_Control_Typography::get_type(),
				[
					'label' => esc_html__( 'Typography', 'ecommerce-addon' ),
					'name' => 'price_two_typography',
					'selector' => '{{WRAPPER}} .offer-value',
				]
			);
			$this->add_control(
				'price_two_color',
				[
					'label' => esc_html__( 'Color', 'ecommerce-addon' ),
					'type' => Controls_Manager::COLOR,
					'selectors' => [
						'{{WRAPPER}} .offer-value' => 'color: {{VALUE}};',
					],
				]
			);
			$this->add_group_control(
				Group_Control_Background::get_type(),
				[
					'name' => 'price_two_bg_color',
					'label' => __( 'Background Color', 'ecommerce-addon' ),
					'types' => [ 'classic', 'gradient' ],
					'selector' => '{{WRAPPER}} .offer-value',
				]
			);
			$this->add_control(
				'price_two_border_radius',
				[
					'label' => __( 'Border Radius', 'ecommerce-addon' ),
					'type' => Controls_Manager::DIMENSIONS,
					'size_units' => [ 'px', '%', 'em' ],
					'selectors' => [
						'{{WRAPPER}} .offer-value' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
					],
				]
			);
			$this->add_group_control(
				Group_Control_Border::get_type(),
				[
					'name' => 'price_two_border',
					'label' => esc_html__( 'Border', 'ecommerce-addon' ),
					'selector' => '{{WRAPPER}} .offer-value',
				]
			);
			$this->add_group_control(
				Group_Control_Box_Shadow::get_type(),
				[
					'name' => 'price_two_box_shadow',
					'label' => esc_html__( 'Section Box Shadow', 'ecommerce-addon' ),
					'selector' => '{{WRAPPER}} .offer-value',
				]
			);
			$this->end_controls_section();// end: Section

		// Price
			$this->start_controls_section(
				'section_price_style',
				[
					'label' => esc_html__( 'Price', 'ecommerce-addon' ),
					'tab' => Controls_Manager::TAB_STYLE,
					'condition' => [
						'offer_style' => 'one',
					],
				]
			);
			$this->add_responsive_control(
				'price_padding',
				[
					'label' => __( 'Price Padding', 'ecommerce-addon' ),
					'type' => Controls_Manager::DIMENSIONS,
					'size_units' => [ 'px', '%', 'em' ],
					'selectors' => [
						'{{WRAPPER}} .naeca-offer figure h4' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
					],
				]
			);
			$this->add_group_control(
				Group_Control_Typography::get_type(),
				[
					'label' => esc_html__( 'Typography', 'ecommerce-addon' ),
					'name' => 'price_typography',
					'selector' => '{{WRAPPER}} .naeca-offer figure h4',
				]
			);
			$this->add_control(
				'price_color',
				[
					'label' => esc_html__( 'Color', 'ecommerce-addon' ),
					'type' => Controls_Manager::COLOR,
					'selectors' => [
						'{{WRAPPER}} .naeca-offer figure h4' => 'color: {{VALUE}};',
					],
				]
			);
			$this->add_control(
				'price_pos',
				[
					'label' => esc_html__( 'Price Text Position', 'ecommerce-addon' ),
					'type' => Controls_Manager::SLIDER,
					'range' => [
						'px' => [
							'min' => -200,
							'max' => 200,
							'step' => 1,
						],
					],
					'size_units' => [ 'px' ],
					'selectors' => [
						'{{WRAPPER}} .naeca-offer figure h4' => 'left: {{SIZE}}{{UNIT}};',
					],
				]
			);
			$this->end_controls_section();// end: Section

		// Price Before
			$this->start_controls_section(
				'section_price_ba_style',
				[
					'label' => esc_html__( 'Price Before / After', 'ecommerce-addon' ),
					'tab' => Controls_Manager::TAB_STYLE,
					'condition' => [
						'offer_style' => 'one',
					],
				]
			);
			$this->add_responsive_control(
				'price_ba_padding',
				[
					'label' => __( 'Padding', 'ecommerce-addon' ),
					'type' => Controls_Manager::DIMENSIONS,
					'size_units' => [ 'px', '%', 'em' ],
					'selectors' => [
						'{{WRAPPER}} .naeca-offer figure h4 small, {{WRAPPER}} .naeca-offer figure h4 sub' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
					],
				]
			);
			$this->add_group_control(
				Group_Control_Typography::get_type(),
				[
					'label' => esc_html__( 'Typography', 'ecommerce-addon' ),
					'name' => 'price_ba_typography',
					'selector' => '{{WRAPPER}} .naeca-offer figure h4 small, {{WRAPPER}} .naeca-offer figure h4 sub',
				]
			);
			$this->add_group_control(
				Group_Control_Typography::get_type(),
				[
					'label' => esc_html__( 'Unit Typography', 'ecommerce-addon' ),
					'name' => 'price_unit_ba_typography',
					'selector' => '{{WRAPPER}} .naeca-offer figure h4 sup',
				]
			);
			$this->add_control(
				'price_ba_color',
				[
					'label' => esc_html__( 'Color', 'ecommerce-addon' ),
					'type' => Controls_Manager::COLOR,
					'selectors' => [
						'{{WRAPPER}} .naeca-offer figure h4 small, {{WRAPPER}} .naeca-offer figure h4 sub, {{WRAPPER}} .naeca-offer figure h4 sup' => 'color: {{VALUE}};',
					],
				]
			);
			$this->add_control(
				'be_pos',
				[
					'label' => esc_html__( 'Before Text Position', 'ecommerce-addon' ),
					'type' => Controls_Manager::SLIDER,
					'range' => [
						'px' => [
							'min' => -200,
							'max' => 200,
							'step' => 1,
						],
					],
					'size_units' => [ 'px' ],
					'selectors' => [
						'{{WRAPPER}} .naeca-offer figure h4 small' => 'top: {{SIZE}}{{UNIT}};',
					],
				]
			);
			$this->add_control(
				'unit_pos',
				[
					'label' => esc_html__( 'Unit Text Position', 'ecommerce-addon' ),
					'type' => Controls_Manager::SLIDER,
					'range' => [
						'px' => [
							'min' => -200,
							'max' => 200,
							'step' => 1,
						],
					],
					'size_units' => [ 'px' ],
					'selectors' => [
						'{{WRAPPER}} .naeca-offer figure h4 sup' => 'top: {{SIZE}}{{UNIT}};',
					],
				]
			);
			$this->add_control(
				'af_pos',
				[
					'label' => esc_html__( 'After Text Position', 'ecommerce-addon' ),
					'type' => Controls_Manager::SLIDER,
					'range' => [
						'px' => [
							'min' => -200,
							'max' => 200,
							'step' => 1,
						],
					],
					'size_units' => [ 'px' ],
					'selectors' => [
						'{{WRAPPER}} .naeca-offer figure h4 sub' => 'right: {{SIZE}}{{UNIT}};',
					],
				]
			);
			$this->end_controls_section();// end: Section

		// Content
			$this->start_controls_section(
				'section_content_style',
				[
					'label' => esc_html__( 'Content', 'ecommerce-addon' ),
					'tab' => Controls_Manager::TAB_STYLE,
				]
			);
			$this->add_responsive_control(
				'cont_padding',
				[
					'label' => __( 'Content Padding', 'ecommerce-addon' ),
					'type' => Controls_Manager::DIMENSIONS,
					'size_units' => [ 'px', '%', 'em' ],
					'selectors' => [
						'{{WRAPPER}} .naeca-offer figure p' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
					],
				]
			);
			$this->add_group_control(
				Group_Control_Typography::get_type(),
				[
					'label' => esc_html__( 'Typography', 'ecommerce-addon' ),
					'name' => 'content_typography',
					'selector' => '{{WRAPPER}} .naeca-offer figure p',
				]
			);
			$this->add_control(
				'content_color',
				[
					'label' => esc_html__( 'Color', 'ecommerce-addon' ),
					'type' => Controls_Manager::COLOR,
					'selectors' => [
						'{{WRAPPER}} .naeca-offer figure p' => 'color: {{VALUE}};',
					],
				]
			);
			$this->end_controls_section();// end: Section

		// Link
			$this->start_controls_section(
				'section_link_style',
				[
					'label' => esc_html__( 'Link', 'ecommerce-addon' ),
					'tab' => Controls_Manager::TAB_STYLE,					
				]
			);
			$this->add_control(
				'link_out_margin',
				[
					'label' => __( 'Margin', 'ecommerce-addon' ),
					'type' => Controls_Manager::DIMENSIONS,
					'size_units' => [ 'px', '%', 'em' ],
					'selectors' => [
						'{{WRAPPER}} .naeca-link' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
					],
				]
			);
			$this->add_group_control(
				Group_Control_Typography::get_type(),
				[
					'label' => esc_html__( 'Typography', 'ecommerce-addon' ),
					'name' => 'link_typography',
					'selector' => '{{WRAPPER}} .naeca-link',
				]
			);
			$this->start_controls_tabs( 'link_style' );
				$this->start_controls_tab(
					'link_normal',
					[
						'label' => esc_html__( 'Normal', 'ecommerce-addon' ),
					]
				);
				$this->add_control(
					'link_color',
					[
						'label' => esc_html__( 'Color', 'ecommerce-addon' ),
						'type' => Controls_Manager::COLOR,
						'selectors' => [
							'{{WRAPPER}} .naeca-link' => 'color: {{VALUE}};',
						],
					]
				);
				$this->add_control(
					'link_bg_color',
					[
						'label' => esc_html__( 'Background Color', 'ecommerce-addon' ),
						'type' => Controls_Manager::COLOR,
						'selectors' => [
							'{{WRAPPER}} .naeca-link' => 'background-color: {{VALUE}};',
						],
					]
				);
				$this->end_controls_tab();  // end:Normal tab
				$this->start_controls_tab(
					'link_hover',
					[
						'label' => esc_html__( 'Hover', 'ecommerce-addon' ),
					]
				);
				$this->add_control(
					'link_hover_color',
					[
						'label' => esc_html__( 'Color', 'ecommerce-addon' ),
						'type' => Controls_Manager::COLOR,
						'selectors' => [
							'{{WRAPPER}} .naeca-link:hover' => 'color: {{VALUE}};',
						],
					]
				);
				$this->add_control(
					'link_bg_hover_color',
					[
						'label' => esc_html__( 'Background Color', 'ecommerce-addon' ),
						'type' => Controls_Manager::COLOR,
						'selectors' => [
							'{{WRAPPER}} .naeca-link:hover' => 'background-color: {{VALUE}};',
						],
					]
				);
				$this->end_controls_tab();  // end:Hover tab
			$this->end_controls_tabs(); // end tabs
			$this->end_controls_section();// end: Section

	}

	/**
	 * Render Offer widget output on the frontend.
	 * Written in PHP and used to generate the final HTML.
	*/
	protected function render() {
		// Offer query
		$settings = $this->get_settings_for_display();
		$offer_style = !empty( $settings['offer_style'] ) ? $settings['offer_style'] : '';
		$align_style = !empty( $settings['align_style'] ) ? $settings['align_style'] : '';
		$align_style_two = !empty( $settings['align_style_two'] ) ? $settings['align_style_two'] : '';
		$offer_image = !empty( $settings['offer_image']['id'] ) ? $settings['offer_image']['id'] : '';
		$image_link = !empty( $settings['image_link']['url'] ) ? $settings['image_link']['url'] : '';
		$image_link_external = !empty( $settings['image_link']['is_external'] ) ? 'target="_blank"' : '';
		$image_link_nofollow = !empty( $settings['image_link']['nofollow'] ) ? 'rel="nofollow"' : '';
		$image_link_attr = !empty( $image_link ) ?  $image_link_external.' '.$image_link_nofollow : '';
		$bg_image = !empty( $settings['bg_image']['id'] ) ? $settings['bg_image']['id'] : '';
		$offer_title = !empty( $settings['offer_title'] ) ? $settings['offer_title'] : '';
		$title_link = !empty( $settings['title_link']['url'] ) ? $settings['title_link']['url'] : '';
		$title_link_external = !empty( $settings['title_link']['is_external'] ) ? 'target="_blank"' : '';
		$title_link_nofollow = !empty( $settings['title_link']['nofollow'] ) ? 'rel="nofollow"' : '';
		$title_link_attr = !empty( $title_link ) ?  $title_link_external.' '.$title_link_nofollow : '';
		$price_before = !empty( $settings['price_before'] ) ? $settings['price_before'] : '';
		$offer_price = !empty( $settings['offer_price'] ) ? $settings['offer_price'] : '';
		$price_unit = !empty( $settings['price_unit'] ) ? $settings['price_unit'] : '';
		$price_unit_two = !empty( $settings['price_unit_two'] ) ? $settings['price_unit_two'] : '';
		$price_after = !empty( $settings['price_after'] ) ? $settings['price_after'] : '';
		$offer_content = !empty( $settings['offer_content'] ) ? $settings['offer_content'] : '';
		$content_alignment = !empty( $settings['content_alignment'] ) ? $settings['content_alignment'] : '';
		$toggle = !empty( $settings['toggle'] ) ? $settings['toggle'] : '';
		$need_count = !empty( $settings['need_count'] ) ? $settings['need_count'] : '';

		$count_type = !empty( $settings['count_type'] ) ? $settings['count_type'] : '';
		$count_date_static = !empty( $settings['count_date_static'] ) ? $settings['count_date_static'] : '';
		$fake_date = !empty( $settings['fake_date'] ) ? $settings['fake_date'] : '';
		$countdown_format = !empty( $settings['countdown_format'] ) ? $settings['countdown_format'] : '';
		$need_separator = !empty( $settings['need_separator'] ) ? $settings['need_separator'] : '';

		$anim_style = !empty( $settings['anim_style'] ) ? $settings['anim_style'] : '';
		$anim_delay = !empty( $settings['anim_delay'] ) ? $settings['anim_delay'] : '';
		$anim_duration = !empty( $settings['anim_duration'] ) ? $settings['anim_duration'] : '';

		$anim_style = $anim_style ? ' data-aos="'.$anim_style.'"' : ' data-aos="fade-up"';		
		$anim_delay = $anim_delay ? ' data-aos-delay="'.$anim_delay.'"' : ' data-aos-delay="250"';
		$anim_duration = $anim_duration ? ' data-aos-duration="'.$anim_duration.'"' : ' data-aos-duration="500"';

		$bg_anim_style = !empty( $settings['bg_anim_style'] ) ? $settings['bg_anim_style'] : '';
		$bg_anim_delay = !empty( $settings['bg_anim_delay'] ) ? $settings['bg_anim_delay'] : '';
		$bg_anim_duration = !empty( $settings['bg_anim_duration'] ) ? $settings['bg_anim_duration'] : '';

		$bg_anim_style = $bg_anim_style ? ' data-aos="'.$bg_anim_style.'"' : ' data-aos="fade-up"';		
		$bg_anim_delay = $bg_anim_delay ? ' data-aos-delay="'.$bg_anim_delay.'"' : ' data-aos-delay="250"';
		$bg_anim_duration = $bg_anim_duration ? ' data-aos-duration="'.$bg_anim_duration.'"' : ' data-aos-duration="500"';

		$cnt_anim_style = !empty( $settings['cnt_anim_style'] ) ? $settings['cnt_anim_style'] : '';
		$cnt_anim_delay = !empty( $settings['cnt_anim_delay'] ) ? $settings['cnt_anim_delay'] : '';
		$cnt_anim_duration = !empty( $settings['cnt_anim_duration'] ) ? $settings['cnt_anim_duration'] : '';

		$cnt_anim_style = $cnt_anim_style ? ' data-aos="'.$cnt_anim_style.'"' : ' data-aos="fade-up"';		
		$cnt_anim_delay = $cnt_anim_delay ? ' data-aos-delay="'.$cnt_anim_delay.'"' : ' data-aos-delay="250"';
		$cnt_anim_duration = $cnt_anim_duration ? ' data-aos-duration="'.$cnt_anim_duration.'"' : ' data-aos-duration="500"';

		// Labels Plural
			$label_years = !empty( $settings['label_years'] ) ? $settings['label_years'] : '';
			$label_months = !empty( $settings['label_months'] ) ? $settings['label_months'] : '';
			$label_weeks = !empty( $settings['label_weeks'] ) ? $settings['label_weeks'] : '';
			$label_days = !empty( $settings['label_days'] ) ? $settings['label_days'] : '';
			$label_hours = !empty( $settings['label_hours'] ) ? $settings['label_hours'] : '';
			$label_minutes = !empty( $settings['label_minutes'] ) ? $settings['label_minutes'] : '';
			$label_seconds = !empty( $settings['label_seconds'] ) ? $settings['label_seconds'] : '';

			$label_years = $label_years ? esc_html($label_years) : esc_html__('Years','ecommerce-addon');
			$label_months = $label_months ? esc_html($label_months) : esc_html__('Months','ecommerce-addon');
			$label_weeks = $label_weeks ? esc_html($label_weeks) : esc_html__('Weeks','ecommerce-addon');
			$label_days = $label_days ? esc_html($label_days) : esc_html__('Days','ecommerce-addon');
			$label_hours = $label_hours ? esc_html($label_hours) : esc_html__('Hours','ecommerce-addon');
			$label_minutes = $label_minutes ? esc_html($label_minutes) : esc_html__('Mins','ecommerce-addon');
			$label_seconds = $label_seconds ? esc_html($label_seconds) : esc_html__('Secs','ecommerce-addon');

		// Labels Singular
			$label_year = !empty( $settings['label_year'] ) ? $settings['label_year'] : '';
			$label_month = !empty( $settings['label_month'] ) ? $settings['label_month'] : '';
			$label_week = !empty( $settings['label_week'] ) ? $settings['label_week'] : '';
			$label_day = !empty( $settings['label_day'] ) ? $settings['label_day'] : '';
			$label_hour = !empty( $settings['label_hour'] ) ? $settings['label_hour'] : '';
			$label_minute = !empty( $settings['label_minute'] ) ? $settings['label_minute'] : '';
			$label_second = !empty( $settings['label_second'] ) ? $settings['label_second'] : '';

			$label_year = $label_year ? esc_html($label_year) : esc_html__('Year','ecommerce-addon');
			$label_month = $label_month ? esc_html($label_month) : esc_html__('Month','ecommerce-addon');
			$label_week = $label_week ? esc_html($label_week) : esc_html__('Week','ecommerce-addon');
			$label_day = $label_day ? esc_html($label_day) : esc_html__('Day','ecommerce-addon');
			$label_hour = $label_hour ? esc_html($label_hour) : esc_html__('Hour','ecommerce-addon');
			$label_minute = $label_minute ? esc_html($label_minute) : esc_html__('Min','ecommerce-addon');
			$label_second = $label_second ? esc_html($label_second) : esc_html__('Sec','ecommerce-addon');

		$countdown_format = $countdown_format ? $countdown_format : '';

		if ($count_type === 'fake') {
			$count_date_actual = $fake_date;
		} else {
			$count_date_actual = $count_date_static;
		}

		if ($need_separator) {
			$sep_class = ' need-separator';
		} else {
			$sep_class = '';
		}

		$btn_text = !empty( $settings['btn_text'] ) ? $settings['btn_text'] : '';
		$btn_link = !empty( $settings['btn_link']['url'] ) ? esc_url($settings['btn_link']['url']) : '';
		$btn_link_external = !empty( $btn_link['is_external'] ) ? 'target="_blank"' : '';
		$btn_link_nofollow = !empty( $btn_link['nofollow'] ) ? 'rel="nofollow"' : '';
		$btn_link_attr = !empty( $btn_link['url'] ) ?  $btn_link_external.' '.$btn_link_nofollow : '';

		$image_url = wp_get_attachment_url( $offer_image );
		$image_link = $image_link ? '<a href="'.esc_url($image_link).'" '.$image_link_attr.'><img src="'.esc_url($image_url).'" alt="'.esc_attr($offer_title).'"></a>' : '<img src="'.esc_url($image_url).'" alt="'.esc_attr($offer_title).'">';
		$image = $image_url ? '<div class="offer-image">'.$image_link.'</div>' : '';
		$image_two = $image_url ? '<img src="'.esc_url($image_url).'" alt="'.esc_attr($offer_title).'">' : '';

		$bg_image_url = wp_get_attachment_url( $bg_image );
		$offer_bg_image = $bg_image_url ? '<div class="offer-bg"><img src="'.esc_url($bg_image_url).'" alt="'.esc_attr($offer_title).'"></div>' : '';

		$offer_link = $title_link ? '<a href="'.esc_url($title_link).'" '.$title_link_attr.'>'. esc_html($offer_title) .'</a>' : esc_html($offer_title);

		$title = $offer_title ? '<h3>'.$offer_title.'</h3>' : '';
		$title_two = $offer_title ? '<h4>'.$offer_link.'</h4>' : '';

		$p_before = $price_before ? '<small>'.$price_before.'</small>' : '';
		$p_unit = $price_unit ? '<sup>'.$price_unit.'</sup>' : '';
		$p_unit_two = $price_unit_two ? '<sup>'.$price_unit_two.'</sup>' : '';
		$p_after = $price_after ? '<small>'.$price_after.'</small>' : '';
		$p_after_two = $price_after ? '<sub>'.$price_after.'</sub>' : '';

		if ($align_style === 'five' || $align_style === 'eight') {
			$price = $offer_price ? '<h4>'.$p_before.$offer_price.$p_unit.$p_after_two.'</h4>' : '';
		} else {
			$price = $offer_price ? '<h4>'.$p_before.$offer_price.$p_after.'</h4>' : '';
		}
		$title_one = $title_link ? '<a href="'.esc_url($title_link).'" '.$title_link_attr.'>'.$title.$price.'</a>' : $title.$price;

		$price_two = $offer_price ? '<span class="offer-value">'.$offer_price.$p_unit_two.'</span>' : '';

		$content = $offer_content ? '<p>'.esc_html($offer_content).'</p>' : '';
		$link = $btn_link ? '<a href="'.esc_url($btn_link).'" class="naeca-link" '.$btn_link_attr.'>'.esc_html($btn_text).'</a>' : '';

		if ($offer_style === 'two') {
			$style_cls = ' offer-style-two';
		} else {
			$style_cls = '';
		}

		if ($align_style === 'eight') {
			if ($content_alignment === 'left') {
				$alignment = ' offer-left';
			} elseif ($content_alignment === 'right') {
				$alignment = ' offer-right';
			} else {
				$alignment = ' offer-center';
			}
		} else {
			$alignment = '';
		}

		if ($align_style === 'eight') {
			if ($toggle) {
				$toggle_cls = ' toggle';
			} else {
				$toggle_cls = '';
			}
		} else {
			$toggle_cls = '';
		}

		if ($align_style === 'two') {
			$align_cls = ' class="offer-two"';
		} elseif ($align_style === 'three') {
			$align_cls = ' class="offer-three"';
		} elseif ($align_style === 'four') {
			$align_cls = ' class="offer-four"';
		} elseif ($align_style === 'five') {
			$align_cls = ' class="offer-two offer-five"';
		} elseif ($align_style === 'six') {
			$align_cls = ' class="offer-three offer-six"';
		} elseif ($align_style === 'seven') {
			$align_cls = ' class="offer-seven"';
		} elseif ($align_style === 'eight') {
			$align_cls = ' class="offer-two offer-five offer-eight'.$alignment.$toggle_cls.'"';
		} else {
			$align_cls = '';
		}

		if ($align_style_two === 'two') {
			$align_cls_two = ' class="offer-two"';
		} elseif ($align_style_two === 'three') {
			$align_cls_two = ' class="offer-three"';
		} elseif ($align_style_two === 'four') {
			$align_cls_two = ' class="offer-four"';
		} elseif ($align_style_two === 'five') {
			$align_cls_two = ' class="offer-seven"';
		} else {
			$align_cls_two = '';
		}

		$output = '<div class="naeca-offer'.$style_cls.'">';
		if ($offer_style === 'two') {
			$output .= '<figure'.$align_cls_two.'>
			              '.$image_two.'
			              <figcaption>'.$title_two.$link.$price_two.'</figcaption>
			            </figure>';
		} else {
			$output .= '<figure'.$align_cls.'>
			              '.$offer_bg_image.$image.'
			              <figcaption>';
			              if ($need_count) {
				              $output .= '<div class="naeca-countdown-wrap'.$sep_class.'">
													          <div class="naeca-countdown '.esc_attr($count_type).'" data-date="'.esc_attr($count_date_actual).'" data-years="'.esc_attr($label_years).'" data-months="'.esc_attr($label_months).'" data-weeks="'.esc_attr($label_weeks).'" data-days="'.esc_attr($label_days).'" data-hours="'.esc_attr($label_hours).'" data-minutes="'.esc_attr($label_minutes).'" data-seconds="'.esc_attr($label_seconds).'" data-year="'.esc_attr($label_year).'" data-month="'.esc_attr($label_month).'" data-week="'.esc_attr($label_week).'" data-day="'.esc_attr($label_day).'" data-hour="'.esc_attr($label_hour).'" data-minute="'.esc_attr($label_minute).'" data-second="'.esc_attr($label_second).'" data-format="'.esc_attr($countdown_format).'"><div class="clearfix"></div>
													          </div>
													        </div>';
			              }
		        $output .= $title_one.$content.$link.'
							      </figcaption>
			            </figure>';
		}
		$output .= '</div>';

		echo $output;

	}

}
Plugin::instance()->widgets_manager->register_widget_type( new eCommerce_Elementor_Addon_Offer() );

} // enable & disable
