Learn more  » Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Bower components Debian packages RPM packages NuGet packages

jsarnowski / jsarnowski/jet-booking   php

Repository URL to install this package:

/ elementor-integration / widgets / calendar.php

<?php
namespace JET_ABAF\Elementor_Integration\Widgets;

use JET_ABAF\Render\Calendar as Calendar_Renderer;

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

class Calendar extends \Elementor\Widget_Base {

	public function get_name() {
		return 'jet-booking-calendar';
	}

	public function get_title() {
		return __( 'Booking Availability Calendar', 'jet-engine' );
	}

	public function get_icon() {
		return 'jet-engine-icon-listing-calendar';
	}

	public function get_categories() {
		return array( 'jet-listing-elements' );
	}

	public function get_help_url() {
		return 'https://crocoblock.com/knowledge-base/article-category/jetbooking/';
	}

	protected function _register_controls() {

		$this->start_controls_section(
			'section_general',
			array(
				'label' => __( 'Content', 'jet-engine' ),
			)
		);

		$this->add_control(
			'select_dates',
			array(
				'label'       => esc_html__( 'Allow to select dates', 'jet-engine' ),
				'description' => esc_html__( 'Find booking form on the page and set selected dates into check in/out field(s)', 'jet-engine' ),
				'type'        => \Elementor\Controls_Manager::SWITCHER,
				'default'     => 'yes',
			)
		);

		$this->add_control(
			'scroll_to_form',
			array(
				'label'       => esc_html__( 'Scroll to the form', 'jet-engine' ),
				'description' => esc_html__( 'Scroll page to the start of the booking form on dates select', 'jet-engine' ),
				'type'        => \Elementor\Controls_Manager::SWITCHER,
				'default'     => '',
			)
		);

		$this->end_controls_section();

		$this->start_controls_section(
			'section_calendar_style',
			array(
				'label'      => __( 'General', 'jet-engine' ),
				'tab'        => \Elementor\Controls_Manager::TAB_STYLE,
				'show_label' => false,
			)
		);

		$this->add_responsive_control(
			'container_padding',
			array(
				'label'      => __( 'Months container padding', 'jet-engine' ),
				'type'       => \Elementor\Controls_Manager::DIMENSIONS,
				'size_units' => array( 'px', '%', 'em' ),
				'selectors'  => array(
					$this->css_selector( ' .date-picker-wrapper' ) => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;',
				),
			)
		);

		$this->add_control(
			'container_bg_color',
			array(
				'label' => __( 'Months container background', 'jet-engine' ),
				'type' => \Elementor\Controls_Manager::COLOR,
				'selectors' => array(
					$this->css_selector( ' .date-picker-wrapper' ) => 'background-color: {{VALUE}}',
				),
			)
		);

		$this->add_control(
			'gap_color',
			array(
				'label' => __( 'Months gap line color', 'jet-engine' ),
				'type' => \Elementor\Controls_Manager::COLOR,
				'default' => '#C9C9C9',
				'selectors' => array(
					$this->css_selector( ' .date-picker-wrapper .gap:before' ) => 'border-left-color: {{VALUE}};',
				),
			)
		);

		$this->add_control(
			'month_tables_heading',
			array(
				'label' => __( 'Month tables', 'jet-engine' ),
				'type' => \Elementor\Controls_Manager::HEADING,
				'separator' => 'before',
			)
		);

		$this->add_responsive_control(
			'table_padding',
			array(
				'label'      => __( 'Month table padding', 'jet-engine' ),
				'type'       => \Elementor\Controls_Manager::DIMENSIONS,
				'size_units' => array( 'px', '%', 'em' ),
				'selectors'  => array(
					$this->css_selector( ' .month1' ) => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
					$this->css_selector( ' .month2' ) => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
				),
			)
		);

		$this->add_control(
			'table_bg_color',
			array(
				'label' => __( 'Month table background', 'jet-engine' ),
				'type' => \Elementor\Controls_Manager::COLOR,
				'selectors' => array(
					$this->css_selector( ' .month1' ) => 'background-color: {{VALUE}}',
					$this->css_selector( ' .month2' ) => 'background-color: {{VALUE}}',
				),
			)
		);

		$this->add_group_control(
			\Elementor\Group_Control_Border::get_type(),
			array(
				'name'           => 'table_border',
				'label'          => __( 'Border', 'jet-engine' ),
				'placeholder'    => '1px',
				'selector'       => $this->css_selector( ' .month1' ) . ', ' . $this->css_selector( ' .month2' ),
			)
		);

		$this->add_responsive_control(
			'table_border_radius',
			array(
				'label'      => __( 'Border Radius', 'jet-engine' ),
				'type'       => \Elementor\Controls_Manager::DIMENSIONS,
				'size_units' => array( 'px', '%' ),
				'selectors'  => array(
					$this->css_selector( ' .month1' ) => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
					$this->css_selector( ' .month2' ) => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
				),
			)
		);

		$this->add_group_control(
			\Elementor\Group_Control_Box_Shadow::get_type(),
			array(
				'name'     => 'table_box_shadow',
				'selector' =>  $this->css_selector( ' .month1' ) . ', ' . $this->css_selector( ' .month2' ),
			)
		);

		$this->end_controls_section();

		$this->start_controls_section(
			'section_heading_style',
			array(
				'label'      => __( 'Headers', 'jet-engine' ),
				'tab'        => \Elementor\Controls_Manager::TAB_STYLE,
				'show_label' => false,
			)
		);

		$this->add_control(
			'month_names_heading',
			array(
				'label' => __( 'Month names', 'jet-engine' ),
				'type' => \Elementor\Controls_Manager::HEADING,
				'separator' => 'before',
			)
		);

		$this->add_group_control(
			\Elementor\Group_Control_Typography::get_type(),
			array(
				'name'     => 'month_names_typography',
				'selector' => '{{WRAPPER}} thead .caption .month-name .month-element, {{WRAPPER}} thead .caption .month-name .month-element',
			)
		);

		$this->add_control(
			'month_names_color',
			array(
				'label' => __( 'Color', 'jet-engine' ),
				'type' => \Elementor\Controls_Manager::COLOR,
				'selectors' => array(
					$this->css_selector( ' thead .caption .month-name' ) => 'color: {{VALUE}}',
				),
			)
		);

		$this->add_control(
			'month_names_bg_color',
			array(
				'label' => __( 'Background', 'jet-engine' ),
				'type' => \Elementor\Controls_Manager::COLOR,
				'selectors' => array(
					$this->css_selector( '  thead .caption .month-name' ) => 'background-color: {{VALUE}}',
				),
			)
		);

		$this->add_responsive_control(
			'month_names_padding',
			array(
				'label'      => __( 'Cells Padding', 'jet-engine' ),
				'type'       => \Elementor\Controls_Manager::DIMENSIONS,
				'size_units' => array( 'px', '%', 'em' ),
				'selectors'  => array(
					$this->css_selector( ' thead .caption .month-name' ) => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
				),
			)
		);

		$this->add_group_control(
			\Elementor\Group_Control_Border::get_type(),
			array(
				'name'           => 'month_names_border',
				'label'          => __( 'Border', 'jet-engine' ),
				'placeholder'    => '1px',
				'selector'       => $this->css_selector( ' thead .caption .month-name' ),
			)
		);

		$this->add_control(
			'month_switcher_heading',
			array(
				'label' => __( 'Month switcher', 'jet-engine' ),
				'type' => \Elementor\Controls_Manager::HEADING,
				'separator' => 'before',
			)
		);

		$this->start_controls_tabs( 'tabs_month_switcher_style' );

		$this->start_controls_tab(
			'month_switcher_normal',
			array(
				'label' => __( 'Normal', 'jet-engine' ),
			)
		);

		$this->add_control(
			'month_switcher_color',
			array(
				'label'  => __( 'Text Color', 'jet-engine' ),
				'type'   => \Elementor\Controls_Manager::COLOR,
				'selectors' => array(
					$this->css_selector( ' thead .caption .prev' ) => 'color: {{VALUE}}',
					$this->css_selector( ' thead .caption .next' ) => 'color: {{VALUE}}',
				),
			)
		);

		$this->add_control(
			'month_switcher_bg_color',
			array(
				'label'  => __( 'Background', 'jet-engine' ),
				'type'   => \Elementor\Controls_Manager::COLOR,
				'selectors' => array(
					$this->css_selector( ' thead .caption .prev' ) => 'background-color: {{VALUE}}',
					$this->css_selector( ' thead .caption .next' ) => 'background-color: {{VALUE}}',
				),
			)
		);

		$this->add_responsive_control(
			'month_switcher_font_size',
			array(
				'label'      => __( 'Font size', 'jet-engine' ),
				'type'       => \Elementor\Controls_Manager::SLIDER,
				'size_units' => array( 'px' ),
				'range'      => array(
					'px' => array(
						'min' => 30,
						'max' => 200,
					),
				),
				'selectors'  => array(
					$this->css_selector( ' thead .caption .prev' ) => 'font-size: {{SIZE}}{{UNIT}}',
					$this->css_selector( ' thead .caption .next' ) => 'font-size: {{SIZE}}{{UNIT}}',
				),
			)
		);

		$this->add_responsive_control(
			'month_switcher_size',
			array(
				'label'      => __( 'Box size', 'jet-engine' ),
				'type'       => \Elementor\Controls_Manager::SLIDER,
				'size_units' => array( 'px' ),
				'range'      => array(
					'px' => array(
						'min' => 30,
						'max' => 200,
					),
				),
				'selectors'  => array(
					$this->css_selector( ' thead .caption .prev' ) => 'width: {{SIZE}}{{UNIT}}; height: {{SIZE}}{{UNIT}};',
					$this->css_selector( ' thead .caption .next' ) => 'width: {{SIZE}}{{UNIT}}; height: {{SIZE}}{{UNIT}};',
					$this->css_selector( ' thead .caption > div:first-child' ) => 'flex: 0 0 {{SIZE}}{{UNIT}}',
					$this->css_selector( ' thead .caption > div:last-child' ) => 'flex: 0 0 {{SIZE}}{{UNIT}}',
				),
			)
		);

		$this->add_group_control(
			\Elementor\Group_Control_Border::get_type(),
			array(
				'name'           => 'month_switcher_border',
				'label'          => __( 'Border', 'jet-engine' ),
				'placeholder'    => '1px',
				'selector'       => $this->css_selector( ' thead .caption .prev' ) . ', ' . $this->css_selector( ' thead .caption .next' ),
			)
		);

		$this->add_responsive_control(
			'month_switcher_border_radius',
			array(
				'label'      => __( 'Border Radius', 'jet-engine' ),
				'type'       => \Elementor\Controls_Manager::DIMENSIONS,
				'size_units' => array( 'px', '%' ),
				'selectors'  => array(
					$this->css_selector( ' thead .caption .prev' ) => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
					$this->css_selector( ' thead .caption .next' ) => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
				),
			)
		);
Loading ...