<?php
namespace Elementor;

/**
 * Elementor Widget
 * @package Feron
 * @since 1.0.0
 */ 
 
class Day_Time extends Widget_Base {

	/**
	 * Get widget name.
	 * Retrieve button widget name.
	 *
	 * @since  1.0.0
	 * @access public
	 * @return string Widget name.
	 */
	public function get_name() {
		return 'feron-day-time-widget';
	}

	/**
	 * Get widget title.
	 * Retrieve button widget title.
	 *
	 * @since  1.0.0
	 * @access public
	 * @return string Widget title.
	 */
	public function get_title() {
		return esc_html__( 'Day Time', 'feron-core' );
	}

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

	/**
	 * Get widget categories.
	 * Retrieve the list of categories the button widget belongs to.
	 * Used to determine where to display the widget in the editor.
	 *
	 * @since  2.0.0
	 * @access public
	 * @return array Widget categories.
	 */
	public function get_categories()
    {
        return ['feron_widgets'];
    }
	
	/**
	 * Register button 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() {

		// Tab Start - 1

		$this->start_controls_section(
			'day_time_content',
			[
				'label' => esc_html__( 'Day Time', 'feron-core' ),
			]
		);		

		$this->add_control(
			'style',
			[
				'label' => esc_html__( 'Style', 'feron-core' ),
				'type' => Controls_Manager::SELECT,
				'default' => 'style1',
				'options' => [
					'style1' => esc_html__( 'Style 1', 'feron-core' ),
					'style2' => esc_html__( 'Style 2', 'feron-core' ),
				],
			]
		);

		$this->add_control('column_grid', [
            'label' => esc_html__('Column Grid', 'feron-core'),
            'type' => Controls_Manager::SELECT,
            'options' => array(
                'col-lg-2' => esc_html__('col-lg-2', 'feron-core'),
                'col-lg-3' => esc_html__('col-lg-3', 'feron-core'),
                'col-lg-4' => esc_html__('col-lg-4', 'feron-core'),
                'col-lg-6' => esc_html__('col-lg-6', 'feron-core'),
            ),
            'default' => 'col-lg-4',
            'description' => esc_html__('Select Service Grid', 'feron-core'),
        ]);


		$this->add_control(
			'button',
			[
				'label'       => __( 'Button', 'feron-core' ),
				'type'        => Controls_Manager::TEXT,
				'dynamic'     => [
					'active' => true,
				],
				'placeholder' => esc_html__( 'Enter your button text', 'feron-core' ),
				'default' => esc_html__('Read More', 'feron-core'),
			]
		);		

		$this->add_control(
			'button_link',
			[
			  'label' => __( 'Button Url', 'feron-core' ),
			  'type' => Controls_Manager::URL,
			  'placeholder' => __( 'https://your-link.com', 'feron-core' ),
			  'show_external' => true,
			  'default' => [
				'url' => '',
				'is_external' => true,
				'nofollow' => true,
			  ],
			
		   ]
		);	

		$this->add_control(
			'image',
			[
				'label' => esc_html__( 'Image', 'feron-core' ),
				'type' => Controls_Manager::MEDIA,
				'default' => [
					'url' => Utils::get_placeholder_image_src(),
				],
			]
		);

		$this->end_controls_section();

		// Tab Start - 2

		$this->start_controls_section(
			'content_section',
			[
				'label' => __( 'Block', 'feron-core' ),
				'tab' => \Elementor\Controls_Manager::TAB_CONTENT,
			]
		);
		$this->add_control(
		  'repeat', 
			[
				'type' => Controls_Manager::REPEATER,
				'separator' => 'before',
				'default' => 
					[
						['block_title' => esc_html__('Hello World', 'feron-core')],
					],
				'fields' => 
					[						

						'block_image' =>
						[
							'name' => 'block_image',
							'label' => __( 'Image', 'feron-core' ),
							'type' => Controls_Manager::MEDIA,
							'default' => ['url' => Utils::get_placeholder_image_src(),],
						],	

						'block_title' =>
						[
							'name' => 'block_title',
							'label' => esc_html__('Title', 'feron-core'),
							'type' => Controls_Manager::TEXTAREA,
							'default' => esc_html__('', 'feron-core')
						],

						
					],
				'title_field' => '{{block_title}}',
			 ]
	);
		
		
	$this->end_controls_section();	

	
		}

	/**
	 * Render button widget output on the frontend.
	 * Written in PHP and used to generate the final HTML.
	 *
	 * @since  1.0.0
	 * @access protected
	 */
	protected function render() {
		$settings = $this->get_settings_for_display();
		$allowed_tags = wp_kses_allowed_html('post');
		?>


	<div class="gt-team-details-wrapper m-0 p-0">
	<div class="gt-team-details-content m-0 p-0">
	<div class="gt-week-list-item border-0 m-0 p-0">
		<ul class="gt-week-list m-0 p-0">
			<li>
				Monday
				<span>: 10:00 AM - 11:00 PM</span>
			</li>
			<li>
				Tuesday
				<span>: 10:00 AM - 11:00 PM</span>
			</li>
			<li>
				Wednesday
				<span>: 10:00 AM - 11:00 PM</span>
			</li>
		</ul>
		<ul class="gt-week-list">
			<li>
				Thursday
				<span>: 10:00 AM - 11:00 PM</span>
			</li>
			<li>
				Friday
				<span>: 10:00 AM - 11:00 PM</span>
			</li>
			<li>
				Saturday
				<span>: 10:00 AM - 11:00 PM</span>
			</li>
		</ul>
	</div>
	</div>
	</div>

             
		<?php 
	}


}

Plugin::instance()->widgets_manager->register_widget_type(new Day_Time());