<?php

namespace Bookingor\Routes;

use Bookingor\Frontend\Controller\Category\CategoryControlFront;
use Bookingor\Frontend\Controller\Service\ServiceControlFront;
use Bookingor\Frontend\Controller\Staff\StaffControlFront;
use Bookingor\Frontend\Controller\Location\LocationControlFront;



class PublicRoute
{

	public $get_view;

	/**
	 * The name of the plugin.
	 *
	 * @since 1.0.0
	 * @access private
	 * @var string $plugin_name The name of the plugin.
	 */
	private $plugin_name;

	/**
	 * The service configuration.
	 *
	 * @since 1.0.0
	 * @access public
	 * @var mixed $f_service The service configuration.
	 */
	public $f_service;

	/**
	 * The extra configuration.
	 *
	 * @since 1.0.0
	 * @access public
	 * @var mixed $f_extra The extra configuration.
	 */
	public $f_extra;

	/**
	 * The all services configuration.
	 *
	 * @since 1.0.0
	 * @access public
	 * @var mixed $f_service_all The all services configuration.
	 */
	public $f_service_all;

	/**
	 * The staff configuration.
	 *
	 * @since 1.0.0
	 * @access public
	 * @var mixed $f_staff The staff configuration.
	 */
	public $f_staff;

	/**
	 * The staff assignment configuration.
	 *
	 * @since 1.0.0
	 * @access public
	 * @var mixed $f_staff_assign The staff assignment configuration.
	 */
	public $f_staff_assign;

	/**
	 * The final staff assignment configuration.
	 *
	 * @since 1.0.0
	 * @access public
	 * @var mixed $final_staff_assign The final staff assignment configuration.
	 */
	public $final_staff_assign;

	/**
	 * The location configuration.
	 *
	 * @since 1.0.0
	 * @access public
	 * @var mixed $f_location The location configuration.
	 */
	public $f_location;

	/**
	 * The service duration configuration.
	 *
	 * @since 1.0.0
	 * @access public
	 * @var mixed $f_service_duration The service duration configuration.
	 */
	public $f_service_duration;

	/**
	 * The daily time configuration.
	 *
	 * @since 1.0.0
	 * @access public
	 * @var mixed $f_daily_time The daily time configuration.
	 */
	public $f_daily_time;

	/**
	 * The currency symbol configuration.
	 *
	 * @since 1.0.0
	 * @access public
	 * @var mixed $f_currency_symbol The currency symbol configuration.
	 */
	public $f_currency_symbol;

	/**
	 * The select daily time configuration.
	 *
	 * @since 1.0.0
	 * @access public
	 * @var mixed $f_select_daily_time The select daily time configuration.
	 */
	public $f_select_daily_time;

	/**
	 * The start time even configuration.
	 *
	 * @since 1.0.0
	 * @access public
	 * @var mixed $start_time_even The start time even configuration.
	 */
	public $start_time_even;

	/**
	 * The PayPal image configuration.
	 *
	 * @since 1.0.0
	 * @access public
	 * @var mixed $f_image_paypal The PayPal image configuration.
	 */
	public $f_image_paypal;

	/**
	 * The default image configuration.
	 *
	 * @since 1.0.0
	 * @access public
	 * @var mixed $f_image_default The default image configuration.
	 */
	public $f_image_default;

	/**
	 * The default staff image configuration.
	 *
	 * @since 1.0.0
	 * @access public
	 * @var mixed $f_default_staff_img The default staff image configuration.
	 */
	public $f_default_staff_img;
	/**
	 * The version of this plugin.
	 *
	 * @since    1.0.0
	 * @access   private
	 * @var      string    $version    The current version of this plugin.
	 */
	private $version;
	/**
	 * Initialize the class and set its properties.
	 *
	 * @since    1.0.0
	 * @param      string    $plugin_name       The name of the plugin.
	 * @param      string    $version    The version of this plugin.
	 */
	public function __construct($plugin_name, $version)
	{
		$this->plugin_name = $plugin_name;
		$this->version = $version;
	}
	/**
	 * Register the stylesheets for the public-facing side of the site.
	 *
	 * @since    1.0.0
	 */
	public function enqueue_styles()
	{
		/**
		 * This function is provided for demonstration purposes only.
		 *
		 * An instance of this class should be passed to the run() function
		 * defined in Bookingor_Loader as all of the hooks are defined
		 * in that particular class.
		 *
		 * The Bookingor_Loader will then create the relationship
		 * between the defined hooks and the functions defined in this
		 * class.
		 */

		if ($this->has_bookingor_asset('BOOKINGOR_DESIGN_1', 'design_one')) {
			wp_enqueue_style($this->plugin_name . '-design-1', plugin_dir_url(dirname(__FILE__)) . 'Frontend/assets/css/design-1/design-1.css', [], $this->version, "all");
			wp_enqueue_style($this->plugin_name . '-bootstrap', plugin_dir_url(dirname(__FILE__)) . 'includes/bootstrap/bootstrap.min.css', [], '5.3.3', 'all');
			wp_enqueue_style('jquery-ui-slider', plugin_dir_url(dirname(__FILE__)) . 'includes/jquery/jquery-ui.css', [], '1.12.1', 'all');
		}
		if ($this->has_bookingor_asset('BOOKINGOR_DESIGN_2', 'design_two')) {
			wp_enqueue_style($this->plugin_name . '-design-2', plugin_dir_url(dirname(__FILE__)) . 'Frontend/assets/css/design-2/design-2.css', [], $this->version, "all");
			wp_enqueue_style($this->plugin_name . '-bootstrap', plugin_dir_url(dirname(__FILE__)) . 'includes/bootstrap/bootstrap.min.css', [], '5.3.3', 'all');
			wp_enqueue_style('jquery-ui-slider', plugin_dir_url(dirname(__FILE__)) . 'includes/jquery/jquery-ui.css', [], '1.12.1', 'all');
		}
		if ($this->has_bookingor_asset('BOOKINGOR_DESIGN_3', 'design_three')) {
			wp_enqueue_style($this->plugin_name . '-design-3', plugin_dir_url(dirname(__FILE__)) . 'Frontend/assets/css/design-3/design-3.css', [], $this->version, "all");
			wp_enqueue_style($this->plugin_name . '-bootstrap', plugin_dir_url(dirname(__FILE__)) . 'includes/bootstrap/bootstrap.min.css', [], '5.3.3', 'all');
			wp_enqueue_style('jquery-ui-slider', plugin_dir_url(dirname(__FILE__)) . 'includes/jquery/jquery-ui.css', [], '1.12.1', 'all');
		}
		if ($this->has_bookingor_asset('BOOKINGOR_DESIGN_4', 'design_four')) {
			wp_enqueue_style($this->plugin_name . '-bootstraps', plugin_dir_url(dirname(__FILE__)) . 'includes/bootstrap/bootstrap.min.css', [], '5.3.3', 'all');
			wp_enqueue_style($this->plugin_name . '-design-4', plugin_dir_url(dirname(__FILE__)) . 'Frontend/assets/css/design-4/design-4.css', [], $this->version, "all");
			wp_enqueue_style('jquery-ui-slider', plugin_dir_url(dirname(__FILE__)) . 'includes/jquery/jquery-ui.css', [], '1.12.1', 'all');
		}
		if ($this->has_bookingor_asset('BOOKINGOR_DESIGN_5', 'design_five')) {
			wp_enqueue_style($this->plugin_name . '-design-5', plugin_dir_url(dirname(__FILE__)) . 'Frontend/assets/css/design-5/design-5.css', [], $this->version, "all");
			wp_enqueue_style($this->plugin_name . '-bootstrap', plugin_dir_url(dirname(__FILE__)) . 'includes/bootstrap/bootstrap.min.css', [], '5.3.3', 'all');
			wp_enqueue_style('jquery-ui-slider', plugin_dir_url(dirname(__FILE__)) . 'includes/jquery/jquery-ui.css', [], '1.12.1', 'all');
		}
		if ($this->has_bookingor_asset('BOOKINGOR_DESIGN_6', 'design_six')) {
			wp_enqueue_style($this->plugin_name . '-design-6', plugin_dir_url(dirname(__FILE__)) . 'Frontend/assets/css/design-6/design-6.css', [], $this->version, "all");
			wp_enqueue_style($this->plugin_name . '-bootstrap', plugin_dir_url(dirname(__FILE__)) . 'includes/bootstrap/bootstrap.min.css', [], '5.3.3', 'all');
			wp_enqueue_style('jquery-ui-slider', plugin_dir_url(dirname(__FILE__)) . 'includes/jquery/jquery-ui.css', [], '1.12.1', 'all');
		}

		if ($this->has_bookingor_asset('BOOKINGOR_STARTER', 'design_starter') || $this->has_bookingor_asset('BOOKINGOR_START_SERVICE', 'design_service') || $this->has_bookingor_asset('BOOKINGOR_STARTER', 'design_service') || $this->has_bookingor_asset('BOOKINGOR_STARTER', 'design_staff')) {
			wp_enqueue_style($this->plugin_name . '-design-start-service', plugin_dir_url(dirname(__FILE__)) . 'Frontend/assets/css/design-start/design-service.css', [], $this->version, "all");
			wp_enqueue_style($this->plugin_name . '-bootstrap', plugin_dir_url(dirname(__FILE__)) . 'includes/bootstrap/bootstrap.min.css', [], '5.3.3', 'all');
			wp_enqueue_style($this->plugin_name . '-design-2', plugin_dir_url(dirname(__FILE__)) . 'Frontend/assets/css/design-2/design-2.css', [], $this->version, "all");

			wp_enqueue_style('jquery-ui-slider', plugin_dir_url(dirname(__FILE__)) . 'includes/jquery/jquery-ui.css', [], '1.12.1', 'all');
		}
		if ($this->has_bookingor_asset('BOOKINGOR_START_CATEGORY', 'design_category')) {

			wp_enqueue_style($this->plugin_name . '-design-start-category', plugin_dir_url(dirname(__FILE__)) . 'Frontend/assets/css/design-start/design-category.css', [], $this->version, "all");
			wp_enqueue_style($this->plugin_name . '-bootstrap', plugin_dir_url(dirname(__FILE__)) . 'includes/bootstrap/bootstrap.min.css', [], '5.3.3', 'all');
			wp_enqueue_style('jquery-ui-slider', plugin_dir_url(dirname(__FILE__)) . 'includes/jquery/jquery-ui.css', [], '1.12.1', 'all');
		}

		if ($this->has_bookingor_asset('BOOKINGOR_START_STAFF', 'design_staff')) {
			wp_enqueue_style($this->plugin_name . '-design-start-staff', plugin_dir_url(dirname(__FILE__)) . 'Frontend/assets/css/design-start/design-staff.css', [], $this->version, "all");
			wp_enqueue_style($this->plugin_name . '-bootstrap', plugin_dir_url(dirname(__FILE__)) . 'includes/bootstrap/bootstrap.min.css', [], '5.3.3', 'all');
			wp_enqueue_style($this->plugin_name . '-design-2', plugin_dir_url(dirname(__FILE__)) . 'Frontend/assets/css/design-2/design-2.css', [], $this->version, "all");
			wp_enqueue_style('jquery-ui-slider', plugin_dir_url(dirname(__FILE__)) . 'includes/jquery/jquery-ui.css', [], '1.12.1', 'all');
		}
	}
	/**
	 * Register the JavaScript for the public-facing side of the site.
	 *
	 * @since    1.0.0
	 */
	public function enqueue_scripts()
	{
		/**
		 * This function is provided for demonstration purposes only.
		 *
		 * An instance of this class should be passed to the run() function
		 * defined in Bookingor_Loader as all of the hooks are defined
		 * in that particular class.
		 *
		 * The Bookingor_Loader will then create the relationship
		 * between the defined hooks and the functions defined in this
		 * class.
		 */


		wp_enqueue_script('jquery');
		wp_enqueue_script('jquery-ui-slider');
		$ajax_nonce = wp_create_nonce('bookingor_ajax_nonce');
		wp_localize_script('jquery', 'TCN_BIND_FRONT', array(
			'GET_URL' => admin_url('admin-ajax.php'),
			'nonce' => $ajax_nonce
		));




		if ($this->has_bookingor_asset('BOOKINGOR_DESIGN_1', 'design_one')) {

			wp_enqueue_script($this->plugin_name . '-bootstrap', plugin_dir_url(dirname(__FILE__)) . 'includes/bootstrap/bootstrap.bundle.min.js', ['jquery'], '5.3.3', true);
			wp_enqueue_script($this->plugin_name . '-design-1', plugin_dir_url(dirname(__FILE__)) . 'Frontend/assets/js/design-1/design-1.js', ['jquery'], $this->version, true);
		}
		if ($this->has_bookingor_asset('BOOKINGOR_DESIGN_2', 'design_two')) {
			wp_enqueue_script($this->plugin_name . '-design-2-js', plugin_dir_url(dirname(__FILE__)) . 'Frontend/assets/js/design-2/design-2.js', ['jquery'], $this->version, true);

			wp_enqueue_script($this->plugin_name . '-bootstrap', plugin_dir_url(dirname(__FILE__)) . 'includes/bootstrap/bootstrap.bundle.min.js', ['jquery'], '5.3.3', true);
		}
		if ($this->has_bookingor_asset('BOOKINGOR_DESIGN_3', 'design_three')) {
			wp_enqueue_script($this->plugin_name . '-design-3', plugin_dir_url(dirname(__FILE__)) . 'Frontend/assets/js/design-3/design-3.js', ['jquery'], $this->version, true);

			wp_enqueue_script($this->plugin_name . '-bootstrap', plugin_dir_url(dirname(__FILE__)) . 'includes/bootstrap/bootstrap.bundle.min.js', ['jquery'], '5.3.3', true);
		}

		if ($this->has_bookingor_asset('BOOKINGOR_DESIGN_4', 'design_four')) {
			wp_enqueue_script($this->plugin_name . '-design-4', plugin_dir_url(dirname(__FILE__)) . 'Frontend/assets/js/design-4/design-4.js', ['jquery'], $this->version, true);
			wp_localize_script($this->plugin_name . '-design-4', 'TCN_BIND_FRONT', array('GET_URL' => admin_url('admin-ajax.php')));
			wp_enqueue_script($this->plugin_name . '-bootstrap', plugin_dir_url(dirname(__FILE__)) . 'includes/bootstrap/bootstrap.bundle.min.js', ['jquery'], '5.3.3', true);
		}
		if ($this->has_bookingor_asset('BOOKINGOR_DESIGN_5', 'design_five')) {
			wp_enqueue_script($this->plugin_name . '-slick', plugin_dir_url(dirname(__FILE__)) . 'includes/slick/slick.js', ['jquery'], $this->version, true);
			wp_enqueue_script($this->plugin_name . '-bootstrap', plugin_dir_url(dirname(__FILE__)) . 'includes/bootstrap/bootstrap.bundle.min.js', ['jquery'], '5.3.3', true);
		}

		if ($this->has_bookingor_asset('BOOKINGOR_DESIGN_6', 'design_six')) {
			wp_enqueue_script($this->plugin_name . '-design-6', plugin_dir_url(dirname(__FILE__)) . 'Frontend/assets/js/design-6/design-6.js', ['jquery'], $this->version, true);

			wp_enqueue_script($this->plugin_name . '-bootstrap', plugin_dir_url(dirname(__FILE__)) . 'includes/bootstrap/bootstrap.bundle.min.js', ['jquery'], '5.3.3', true);
		}
		if ($this->has_bookingor_asset('BOOKINGOR_STARTER', 'design_starter') || $this->has_bookingor_asset('BOOKINGOR_START_SERVICE', 'design_service') || $this->has_bookingor_asset('BOOKINGOR_STARTER', 'design_service') || $this->has_bookingor_asset('BOOKINGOR_STARTER', 'design_staff')) {
			wp_enqueue_script($this->plugin_name . '-design-service', plugin_dir_url(dirname(__FILE__)) . 'Frontend/assets/js/design-service/design-service-homepage.js', ['jquery'], $this->version, true);

			wp_enqueue_script($this->plugin_name . '-bootstrap', plugin_dir_url(dirname(__FILE__)) . 'includes/bootstrap/bootstrap.bundle.min.js', ['jquery'], '5.3.3', true);
		}

		if ($this->has_bookingor_asset('BOOKINGOR_START_CATEGORY', 'design_category')) {
			wp_enqueue_script($this->plugin_name . '-design-category', plugin_dir_url(dirname(__FILE__)) . 'Frontend/assets/js/design-category/design-category.js', ['jquery'], $this->version, true);
			wp_enqueue_script($this->plugin_name . '-bootstrap', plugin_dir_url(dirname(__FILE__)) . 'includes/bootstrap/bootstrap.bundle.min.js', ['jquery'], '5.3.3', true);
		}

		if ($this->has_bookingor_asset('BOOKINGOR_START_STAFF', 'design_staff')) {
			wp_enqueue_script($this->plugin_name . '-design-start-staff', plugin_dir_url(dirname(__FILE__)) . 'Frontend/assets/js/design-staff/design-start-staff.js', ['jquery'], $this->version, true);
			$ajax_nonce = wp_create_nonce('bookingor_ajax_nonce');
			wp_localize_script($this->plugin_name . '-design-start-staff', 'TCN_BIND_FRONT', array('GET_URL' => admin_url('admin-ajax.php'), 'nonce' => $ajax_nonce));
			wp_enqueue_script($this->plugin_name . '-bootstrap', plugin_dir_url(dirname(__FILE__)) . 'includes/bootstrap/bootstrap.bundle.min.js', ['jquery'], '5.3.3', true);
		}


		if ($this->has_bookingor_asset('')) {


			if (function_exists('is_wc_endpoint_url')) {
				if (is_wc_endpoint_url('order-received')) {
					$ajax_nonce = wp_create_nonce('bookingor_ajax_nonce');
					wp_localize_script('jquery', 'TCN_BIND_FRONT', array('GET_URL' => admin_url('admin-ajax.php'), 'nonce' => $ajax_nonce));
				}
			}
		}
	}
	/**
	 * Booking form design 1
	 *
	 * @param array $atts {
	 *     @type string $service
	 * }
	 *
	 * @return string
	 */
	public function bp_booking_design_one($atts)
	{
		$atts = shortcode_atts(array(
			'service' => ''
		), $atts);
		$service_get_id = $atts['service'];

		ServiceControlFront::bp_front_services_view($service_get_id);
		ob_start();
		wp_enqueue_script('jquery');
		wp_enqueue_script('tcn_admin_jquery_ajx', plugin_dir_url(dirname(__FILE__)) . 'Frontend/assets/js/design-ajax-load.js', ['jquery'], $this->version, true);
		wp_enqueue_script($this->plugin_name . '-validate-d-1', plugin_dir_url(dirname(__FILE__)) . 'Frontend/assets/js/customer/customer-validate.js', ['jquery'], $this->version, true);
		wp_enqueue_script($this->plugin_name . '-datepicker', plugin_dir_url(dirname(__FILE__)) . 'includes/datepicker/js/bootstrap-datepicker.js', ['jquery'], '1.10.0', true);
		// inter tel

		// letter avatar
		wp_enqueue_script($this->plugin_name . '-letter-avatr', plugin_dir_url(dirname(__FILE__)) . 'includes/letter-avatar/letter.js', [], '1.0.0', false);
		// calendar
		wp_enqueue_script($this->plugin_name . '-calendar-full', plugin_dir_url(dirname(__FILE__)) . 'includes/calendars/calendar-full.js', ['jquery'], $this->version, true);
		$this->f_image_default = plugin_dir_url(dirname(__FILE__)) .  'Backend/assets/images/cate-serv.jpg';
		$this->f_default_staff_img = plugin_dir_url(dirname(__FILE__)) .  'Backend/assets/images/staff-icon.jpg';
		$get_design_id = 1;
		include_once plugin_dir_path(dirname(__FILE__)) . 'Frontend/View/Templates/design-1.php';
		$ajax_nonce = wp_create_nonce('bookingor_ajax_nonce');

		wp_localize_script('tcn_admin_jquery_ajx', 'TCN_BIND_FRONT', ['GET_URL' => admin_url('admin-ajax.php'), 'nonce' => $ajax_nonce]);
		return ob_get_clean();
	}
	/**
	 * Booking form design 2
	 *
	 * @param array $atts {
	 *     @type string $service
	 * }
	 *
	 * @return string
	 */
	public function bp_booking_design_two($atts)
	{
		$atts = shortcode_atts(array(
			'category' => '',
			'service' => '',
		), $atts);
		$service_get_id = $atts['service'];
		$category_get_id = $atts['category'];
		ServiceControlFront::bp_front_services_view($service_get_id, $category_get_id);
		CategoryControlFront::bp_font_category_view($category_get_id);
		CategoryControlFront::bp_font_widget_category_view($category_get_id);
		$get_design_id = 2;
		// ob_start();

		// datepicker
		wp_enqueue_style($this->plugin_name . '-datepicker', plugin_dir_url(dirname(__FILE__)) . 'includes/datepicker/css/bootstrap-datepicker.css', '1.0', 'all');
		ob_start();
		wp_enqueue_script('jquery');
		wp_enqueue_script('tcn_admin_jquery_ajx', plugin_dir_url(dirname(__FILE__)) . 'Frontend/assets/js/design-ajax-load.js', ['jquery'], $this->version, true);
		wp_enqueue_script($this->plugin_name . '-validate-d-2', plugin_dir_url(dirname(__FILE__)) . 'Frontend/assets/js/customer/customer-validate.js', ['jquery'], $this->version, true);
		// datepicker
		wp_enqueue_script($this->plugin_name . '-datepicker', plugin_dir_url(dirname(__FILE__)) . 'includes/datepicker/js/bootstrap-datepicker.js', ['jquery'], '1.0.0', true);
		// inter tel

		// letter avatar
		wp_enqueue_script($this->plugin_name . '-letter-avatr', plugin_dir_url(dirname(__FILE__)) . 'includes/letter-avatar/letter.js', [], '1.0.0', false);
		// calendar
		wp_enqueue_script($this->plugin_name . '-calendar-full', plugin_dir_url(dirname(__FILE__)) . 'includes/calendars/calendar-full.js', ['jquery'], $this->version, true);
		$this->f_image_default = plugin_dir_url(dirname(__FILE__)) .  'Backend/assets/images/cate-serv.jpg';
		$this->f_default_staff_img = plugin_dir_url(dirname(__FILE__)) .  'Backend/assets/images/staff-icon.jpg';
		include_once plugin_dir_path(dirname(__FILE__)) . 'Frontend/View/Templates/design-2.php';
		$ajax_nonce = wp_create_nonce('bookingor_ajax_nonce');

		wp_localize_script('tcn_admin_jquery_ajx', 'TCN_BIND_FRONT', ['GET_URL' => admin_url('admin-ajax.php'), 'nonce' => $ajax_nonce]);
		return ob_get_clean();
	}
	/**
	 * Booking form design 4
	 *
	 * @param array $atts {
	 *     @type string $service
	 *     @type string $category
	 * }
	 *
	 * @return string
	 */
	public function bp_booking_design_four($atts)
	{
		ob_start();
		$atts = shortcode_atts(array(
			'service' => '',
			'staff' => '',
			'category' => '',
			'location' => '',
		), $atts);
		$service_get_id = $atts['service'];
		$staff_get_id = $atts['staff'];
		$category_get_id = $atts['category'];
		$location_get_id = $atts['location'];
		ServiceControlFront::bp_front_services_view($service_get_id, $category_get_id);
		StaffControlFront::bp_front_staff_view($staff_get_id);
		LocationControlFront::bp_front_location_view($location_get_id);

		// print_r($staff_get_id);
		// datepicker
		wp_enqueue_style($this->plugin_name . '-datepicker', plugin_dir_url(dirname(__FILE__)) . 'includes/datepicker/css/bootstrap-datepicker.css', '1.0', 'all');
		wp_enqueue_script('jquery');
		wp_enqueue_script('tcn_admin_jquery_ajx', plugin_dir_url(dirname(__FILE__)) . 'Frontend/assets/js/design-ajax-load.js', ['jquery'], $this->version, true);
		wp_enqueue_script($this->plugin_name . '-validate-d-2', plugin_dir_url(dirname(__FILE__)) . 'Frontend/assets/js/customer/customer-validate.js', ['jquery'], $this->version, true);
		// datepicker
		wp_enqueue_script($this->plugin_name . '-datepicker', plugin_dir_url(dirname(__FILE__)) . 'includes/datepicker/js/bootstrap-datepicker.js', ['jquery'], '1.0.0', true);
		// inter tel

		// letter avatar
		wp_enqueue_script($this->plugin_name . '-letter-avatr', plugin_dir_url(dirname(__FILE__)) . 'includes/letter-avatar/letter.js', [], '1.0.0', false);
		// calendar
		wp_enqueue_script($this->plugin_name . '-calendar-full', plugin_dir_url(dirname(__FILE__)) . 'includes/calendars/calendar-full.js', ['jquery'], $this->version, true);
		$this->f_image_default = plugin_dir_url(dirname(__FILE__)) .  'Backend/assets/images/cate-serv.jpg';
		$this->f_default_staff_img = plugin_dir_url(dirname(__FILE__)) .  'Backend/assets/images/staff-icon.jpg';
		$get_design_id = 6;
		include_once plugin_dir_path(dirname(__FILE__)) . 'Frontend/View/Templates/design-6.php';
		$ajax_nonce = wp_create_nonce('bookingor_ajax_nonce');

		wp_localize_script('tcn_admin_jquery_ajx', 'TCN_BIND_FRONT', ['GET_URL' => admin_url('admin-ajax.php'), 'nonce' => $ajax_nonce]);
		return ob_get_clean();
	}
	/**
	 * Booking form design 6
	 *
	 * @param array $atts {
	 *     @type string $service
	 * }
	 *
	 * @return string
	 */
	public function bp_booking_design_six($atts)
	{
		$atts = shortcode_atts(array(
			'service' => '',
			'staff' => '',
		), $atts);
		$service_get_id = $atts['service'];
		$staff_get_id = $atts['staff'];

		ServiceControlFront::bp_front_services_view($service_get_id);
		StaffControlFront::bp_front_staff_view($staff_get_id);
		// print_r($staff_get_id);
		//select2
		wp_enqueue_style($this->plugin_name . '-select2', plugin_dir_url(dirname(__FILE__)) . 'includes/select2/css/select2.css', array(), '1.0', 'all');
		// datepicker
		wp_enqueue_style($this->plugin_name . '-datepicker', plugin_dir_url(dirname(__FILE__)) . 'includes/datepicker/css/bootstrap-datepicker.css', '1.0', 'all');
		wp_enqueue_script('jquery');
		wp_enqueue_script('tcn_admin_jquery_ajx', plugin_dir_url(dirname(__FILE__)) . 'Frontend/assets/js/design-ajax-load.js', ['jquery'], $this->version, true);
		wp_enqueue_script($this->plugin_name . '-validate-d-2', plugin_dir_url(dirname(__FILE__)) . 'Frontend/assets/js/customer/customer-validate.js', ['jquery'], $this->version, true);
		// datepicker
		wp_enqueue_script($this->plugin_name . '-datepicker', plugin_dir_url(dirname(__FILE__)) . 'includes/datepicker/js/bootstrap-datepicker.js', ['jquery'], '1.0.0', true);
		// inter tel

		// letter avatar
		wp_enqueue_script($this->plugin_name . '-letter-avatr', plugin_dir_url(dirname(__FILE__)) . 'includes/letter-avatar/letter.js', [], '1.0.0', false);
		// select2
		wp_enqueue_script($this->plugin_name . '-select2', plugin_dir_url(dirname(__FILE__)) . 'includes/select2/js/select2.full.js', array('jquery'), '5.0.2', true);
		// calendar
		wp_enqueue_script($this->plugin_name . '-calendar-full', plugin_dir_url(dirname(__FILE__)) . 'includes/calendars/calendar-full.js', ['jquery'], $this->version, true);
		$this->f_image_default = plugin_dir_url(dirname(__FILE__)) .  'Backend/assets/images/cate-serv.jpg';
		$this->f_default_staff_img = plugin_dir_url(dirname(__FILE__)) .  'Backend/assets/images/staff-icon.jpg';
		ob_start();
		$get_design_id = 3;
		include_once plugin_dir_path(dirname(__FILE__)) . 'Frontend/View/Templates/design-3.php';
		$ajax_nonce = wp_create_nonce('bookingor_ajax_nonce');

		wp_localize_script('tcn_admin_jquery_ajx', 'TCN_BIND_FRONT', ['GET_URL' => admin_url('admin-ajax.php'), 'nonce' => $ajax_nonce]);
		return ob_get_clean();
	}
	/**
	 * Booking form design 7
	 *
	 * @param array $atts {
	 *     @type string $service
	 * }
	 *
	 * @return string
	 */
	public function bp_booking_design_seven($atts)
	{
		ob_start();
		$atts = shortcode_atts(array(
			'service' => '',
		), $atts);
		$service_get_id = $atts['service'];

		wp_enqueue_script('jquery');
		ServiceControlFront::bp_front_services_view($service_get_id);
		// datepicker
		wp_enqueue_style($this->plugin_name . '-datepicker', plugin_dir_url(dirname(__FILE__)) . 'includes/datepicker/css/bootstrap-datepicker.css', '1.0', 'all');
		wp_enqueue_script($this->plugin_name . '-validate-d-2', plugin_dir_url(dirname(__FILE__)) . 'Frontend/assets/js/customer/customer-validate.js', ['jquery'], $this->version, true);
		// datepicker
		wp_enqueue_script($this->plugin_name . '-datepicker', plugin_dir_url(dirname(__FILE__)) . 'includes/datepicker/js/bootstrap-datepicker.js', ['jquery'], '1.10.0', true);
		// inter tel

		// letter avatar
		wp_enqueue_script($this->plugin_name . '-letter-avatr', plugin_dir_url(dirname(__FILE__)) . 'includes/letter-avatar/letter.js', [], '1.0.0', false);
		// calendar
		wp_enqueue_script($this->plugin_name . '-calendar-full', plugin_dir_url(dirname(__FILE__)) . 'includes/calendars/calendar-full.js', ['jquery'], $this->version, true);
		wp_enqueue_script('bookingor-ajax', plugin_dir_url(dirname(__FILE__)) . 'Frontend/assets/js/design-ajax-load.js', ['jquery'], $this->version, true);
		$this->f_image_default = plugin_dir_url(dirname(__FILE__)) .  'Backend/assets/images/cate-serv.jpg';
		$this->f_default_staff_img = plugin_dir_url(dirname(__FILE__)) .  'Backend/assets/images/staff-icon.jpg';
		$get_design_id = 4;
		include_once plugin_dir_path(dirname(__FILE__)) . 'Frontend/View/Templates/design-4.php';

		$ajax_nonce = wp_create_nonce('bookingor_ajax_nonce');

		wp_localize_script('bookingor-ajax', 'TCN_BIND_FRONT', ['GET_URL' => admin_url('admin-ajax.php'), 'nonce' => $ajax_nonce]);
		return ob_get_clean();
	}
	/**
	 * Booking widget design 8
	 *
	 * @param array $atts {
	 *     @type string $service
	 * }
	 *
	 * @return string
	 */
	public function bookingor_booking_widget($atts)
	{
		$atts = shortcode_atts(array(
			'service' => '',
		), $atts);
		$service_get_id = $atts['service'];
		// css
		wp_enqueue_style($this->plugin_name . '-style', plugin_dir_url(dirname(__FILE__)) . 'Frontend/assets/css/design-5/design-5.css', [], $this->version, 'all');
		ob_start();
		wp_enqueue_script('jquery');

		wp_enqueue_script('moment');

		// inter tel

		wp_enqueue_script($this->plugin_name . '-widget-calendar', plugin_dir_url(dirname(__FILE__)) . 'includes/calendars/widget-calendar-final.js', ['jquery'], $this->version, true);

		// calendar
		wp_enqueue_script($this->plugin_name . '-widget-script', plugin_dir_url(dirname(__FILE__)) . 'Frontend/assets/js/design-5/design-5.js', ['jquery'], $this->version, true);

		//common js
		wp_enqueue_script('bookingor-ajax-widget', plugin_dir_url(dirname(__FILE__)) . 'Frontend/assets/js/design-ajax-widget.js', ['jquery'], $this->version, true);
		wp_enqueue_script($this->plugin_name . '-widget-validates', plugin_dir_url(dirname(__FILE__)) . 'Frontend/assets/js/design-5/widget-validate.js', ['jquery'], $this->version, true);
		wp_enqueue_script($this->plugin_name . '-widget-modal', plugin_dir_url(dirname(__FILE__)) . 'Frontend/assets/js/design-5/widget-validate-modal.js', ['jquery'], $this->version, true);
		wp_enqueue_script($this->plugin_name . '-validate-customer-2', plugin_dir_url(dirname(__FILE__)) . 'Frontend/assets/js/customer/customer-validate.js', ['jquery'], $this->version, true);
		$get_design_id = 5;
		include_once plugin_dir_path(dirname(__FILE__)) . 'Frontend/View/Templates/design-5.php';
		$ajax_nonce = wp_create_nonce('bookingor_ajax_nonce');

		wp_localize_script('bookingor-ajax-widget', 'TCN_BIND_FRONT', ['GET_URL' => admin_url('admin-ajax.php'), 'nonce' => $ajax_nonce]);
		return ob_get_clean();
	}


	public function bookingor_start_category_booking($atts)
	{
		$atts = shortcode_atts(array(
			'service' => '',
			'column'  => '',
			'category' => '',
			'staff'   => '',
			'location' => '',
		), $atts);
		$service_get_id  = $atts['service'];
		$column          = $atts['column'];
		$category_get_id = $atts['category'];
		$staff_get_id    = $atts['staff'];
		$location_get_id = $atts['location'];
		ServiceControlFront::bp_front_services_view($service_get_id);
		CategoryControlFront::bp_font_category_view($category_get_id);
		CategoryControlFront::bp_font_widget_category_view($category_get_id);
		StaffControlFront::bp_front_staff_view($staff_get_id);
		LocationControlFront::bp_front_location_view($location_get_id);

		wp_enqueue_style($this->plugin_name . '-design-start-category', plugin_dir_url(dirname(__FILE__)) . 'Frontend/assets/css/design-start/design-category.css', [], $this->version, "all");
		wp_enqueue_style($this->plugin_name . '-bootstrap', plugin_dir_url(dirname(__FILE__)) . 'includes/bootstrap/bootstrap.min.css', [], '5.3.3', 'all');
		wp_enqueue_style('jquery-ui-slider', plugin_dir_url(dirname(__FILE__)) . 'includes/jquery/jquery-ui.css', [], '1.12.1', 'all');
		// datepicker
		wp_enqueue_style($this->plugin_name . '-datepicker', plugin_dir_url(dirname(__FILE__)) . 'includes/datepicker/css/bootstrap-datepicker.css', '1.0', 'all');

		ob_start();
		wp_enqueue_script('jquery');
		wp_enqueue_script('jquery-ui-slider');
		wp_enqueue_script($this->plugin_name . '-design-category', plugin_dir_url(dirname(__FILE__)) . 'Frontend/assets/js/design-category/design-category.js', ['jquery'], $this->version, true);
		wp_enqueue_script($this->plugin_name . '-bootstrap', plugin_dir_url(dirname(__FILE__)) . 'includes/bootstrap/bootstrap.bundle.min.js', ['jquery'], '5.3.3', true);
		wp_enqueue_script('tcn_admin_jquery_ajx', plugin_dir_url(dirname(__FILE__)) . 'Frontend/assets/js/design-ajax-load.js', ['jquery'], $this->version, true);
		wp_enqueue_script($this->plugin_name . '-validate-d-2', plugin_dir_url(dirname(__FILE__)) . 'Frontend/assets/js/customer/customer-validate.js', ['jquery'], $this->version, true);
		wp_enqueue_script($this->plugin_name . '-design-4', plugin_dir_url(dirname(__FILE__)) . 'Frontend/assets/js/design-4/design-4.js', ['jquery'], $this->version, true);
		// datepicker
		wp_enqueue_script($this->plugin_name . '-datepicker', plugin_dir_url(dirname(__FILE__)) . 'includes/datepicker/js/bootstrap-datepicker.js', ['jquery'], '1.0.0', true);
		// inter tel

		// letter avatar
		wp_enqueue_script($this->plugin_name . '-letter-avatr', plugin_dir_url(dirname(__FILE__)) . 'includes/letter-avatar/letter.js', [], '1.0.0', false);
		// calendar
		wp_enqueue_script($this->plugin_name . '-calendar-full', plugin_dir_url(dirname(__FILE__)) . 'includes/calendars/calendar-full.js', ['jquery'], $this->version, true);
		$get_design_id = 8;
		$this->f_image_default = plugin_dir_url(dirname(__FILE__)) .  'Backend/assets/images/cate-serv.jpg';
		$this->f_default_staff_img = plugin_dir_url(dirname(__FILE__)) .  'Backend/assets/images/staff-icon.jpg';
		include_once plugin_dir_path(dirname(__FILE__)) . 'Frontend/View/Templates/design-category.php';
		$ajax_nonce = wp_create_nonce('bookingor_ajax_nonce');

		wp_localize_script('tcn_admin_jquery_ajx', 'TCN_BIND_FRONT', ['GET_URL' => admin_url('admin-ajax.php'), 'nonce' => $ajax_nonce]);
		wp_localize_script($this->plugin_name . '-design-category', 'TCN_BIND_FRONT', ['GET_URL' => admin_url('admin-ajax.php'), 'nonce' => $ajax_nonce]);
		return ob_get_clean();
	}


	public function bookingor_starter($atts)
	{

		$atts = shortcode_atts(array(
			'service' => '',
			'staff' => '',
			'view' => '',
			'columns' => '',
			'category' => '',
			'location' => '',
		), $atts);

		$service_get_id = $atts['service'];
		$staff_get_id = $atts['staff'];
		$columns = $atts['columns'];
		$category_get_id = $atts['category'];
		$location_get_id = $atts['location'];
		ServiceControlFront::bp_front_services_view($service_get_id);
		StaffControlFront::bp_front_staff_view($staff_get_id);
		LocationControlFront::bp_front_location_view($location_get_id);
		CategoryControlFront::bp_font_category_view($category_get_id);
		// ob_start();

		// datepicker
		wp_enqueue_style($this->plugin_name . '-datepicker', plugin_dir_url(dirname(__FILE__)) . 'includes/datepicker/css/bootstrap-datepicker.css', '1.0', 'all');
		wp_enqueue_style($this->plugin_name . '-design-start-service', plugin_dir_url(dirname(__FILE__)) . 'Frontend/assets/css/design-start/design-service.css', [], $this->version, "all");
		wp_enqueue_style($this->plugin_name . '-bootstrap', plugin_dir_url(dirname(__FILE__)) . 'includes/bootstrap/bootstrap.min.css', [], '5.3.3', 'all');
		wp_enqueue_style($this->plugin_name . '-design-2', plugin_dir_url(dirname(__FILE__)) . 'Frontend/assets/css/design-2/design-2.css', [], $this->version, "all");
		wp_enqueue_style('jquery-ui-slider', plugin_dir_url(dirname(__FILE__)) . 'includes/jquery/jquery-ui.css', [], '1.12.1', 'all');

		ob_start();
		wp_enqueue_script('jquery');
		wp_enqueue_script('jquery-ui-slider');
		wp_enqueue_script($this->plugin_name . '-design-service', plugin_dir_url(dirname(__FILE__)) . 'Frontend/assets/js/design-service/design-service-homepage.js', ['jquery'], $this->version, true);
		wp_enqueue_script($this->plugin_name . '-bootstrap', plugin_dir_url(dirname(__FILE__)) . 'includes/bootstrap/bootstrap.bundle.min.js', ['jquery'], '5.3.3', true);
		wp_enqueue_script('tcn_admin_jquery_ajx', plugin_dir_url(dirname(__FILE__)) . 'Frontend/assets/js/design-ajax-load.js', ['jquery'], $this->version, true);
		wp_enqueue_script($this->plugin_name . '-validate-d-2', plugin_dir_url(dirname(__FILE__)) . 'Frontend/assets/js/customer/customer-validate.js', ['jquery'], $this->version, true);
		// datepicker
		wp_enqueue_script($this->plugin_name . '-datepicker', plugin_dir_url(dirname(__FILE__)) . 'includes/datepicker/js/bootstrap-datepicker.js', ['jquery'], '1.0.0', true);
		// inter tel

		// letter avatar
		wp_enqueue_script($this->plugin_name . '-letter-avatr', plugin_dir_url(dirname(__FILE__)) . 'includes/letter-avatar/letter.js', [], '1.0.0', false);
		// calendar
		wp_enqueue_script($this->plugin_name . '-calendar-full', plugin_dir_url(dirname(__FILE__)) . 'includes/calendars/calendar-full.js', ['jquery'], $this->version, true);
		$this->f_image_default = plugin_dir_url(dirname(__FILE__)) .  'Backend/assets/images/cate-serv.jpg';
		$this->f_default_staff_img = plugin_dir_url(dirname(__FILE__)) .  'Backend/assets/images/staff-icon.jpg';
		$get_design_id = 9;
		include_once plugin_dir_path(dirname(__FILE__)) . 'Frontend/View/Templates/design-service.php';
		$ajax_nonce = wp_create_nonce('bookingor_ajax_nonce');

		wp_localize_script('tcn_admin_jquery_ajx', 'TCN_BIND_FRONT', ['GET_URL' => admin_url('admin-ajax.php'), 'nonce' => $ajax_nonce]);
		return ob_get_clean();
	}


	public function bookingor_start_staff_booking($atts)
	{
		$atts = shortcode_atts(array(
			'service' => '',
			'staff' => '',
			'category' => '',
			'location' => '',
		), $atts);
		$service_get_id = $atts['service'];
		$staff_get_id = $atts['staff'];
		$category_get_id = $atts['category'];
		$location_get_id = $atts['location'];

		wp_enqueue_style($this->plugin_name . '-design-start-staff', plugin_dir_url(dirname(__FILE__)) . 'Frontend/assets/css/design-start/design-staff.css', [], $this->version, "all");
		wp_enqueue_style($this->plugin_name . '-bootstrap', plugin_dir_url(dirname(__FILE__)) . 'includes/bootstrap/bootstrap.min.css', [], '5.3.3', 'all');
		wp_enqueue_style($this->plugin_name . '-design-2', plugin_dir_url(dirname(__FILE__)) . 'Frontend/assets/css/design-2/design-2.css', [], $this->version, "all");
		wp_enqueue_style('jquery-ui-slider', plugin_dir_url(dirname(__FILE__)) . 'includes/jquery/jquery-ui.css', [], '1.12.1', 'all');
		// datepicker
		wp_enqueue_style($this->plugin_name . '-datepicker', plugin_dir_url(dirname(__FILE__)) . 'includes/datepicker/css/bootstrap-datepicker.css', '1.0', 'all');

		ob_start();
		wp_enqueue_script('jquery');
		wp_enqueue_script('jquery-ui-slider');
		wp_enqueue_script($this->plugin_name . '-design-start-staff', plugin_dir_url(dirname(__FILE__)) . 'Frontend/assets/js/design-staff/design-start-staff.js', ['jquery'], $this->version, true);
		wp_enqueue_script($this->plugin_name . '-bootstrap', plugin_dir_url(dirname(__FILE__)) . 'includes/bootstrap/bootstrap.bundle.min.js', ['jquery'], '5.3.3', true);

		ServiceControlFront::bp_front_services_view($service_get_id);
		StaffControlFront::bp_front_staff_view($staff_get_id);
		LocationControlFront::bp_front_location_view($location_get_id);
		CategoryControlFront::bp_font_category_view($category_get_id);

		wp_enqueue_script($this->plugin_name . '-validate-d-2', plugin_dir_url(dirname(__FILE__)) . 'Frontend/assets/js/customer/customer-validate.js', ['jquery'], $this->version, true);
		// datepicker
		wp_enqueue_script($this->plugin_name . '-datepicker', plugin_dir_url(dirname(__FILE__)) . 'includes/datepicker/js/bootstrap-datepicker.js', ['jquery'], '1.10.0', true);
		// inter tel

		// letter avatar
		wp_enqueue_script($this->plugin_name . '-letter-avatr', plugin_dir_url(dirname(__FILE__)) . 'includes/letter-avatar/letter.js', [], '1.0.0', false);
		// calendar
		wp_enqueue_script($this->plugin_name . '-calendar-full', plugin_dir_url(dirname(__FILE__)) . 'includes/calendars/calendar-full.js', ['jquery'], $this->version, true);
		wp_enqueue_script('bookingor-ajax', plugin_dir_url(dirname(__FILE__)) . 'Frontend/assets/js/design-ajax-load.js', ['jquery'], $this->version, true);
		$this->f_image_default = plugin_dir_url(dirname(__FILE__)) .  'Backend/assets/images/cate-serv.jpg';
		$this->f_default_staff_img = plugin_dir_url(dirname(__FILE__)) .  'Backend/assets/images/staff-icon.jpg';
		$get_design_id = 10;
		include_once plugin_dir_path(dirname(__FILE__)) . 'Frontend/View/Templates/design-staff.php';

		$ajax_nonce = wp_create_nonce('bookingor_ajax_nonce');

		wp_localize_script('bookingor-ajax', 'TCN_BIND_FRONT', ['GET_URL' => admin_url('admin-ajax.php'), 'nonce' => $ajax_nonce]);
		wp_localize_script($this->plugin_name . '-design-start-staff', 'TCN_BIND_FRONT', ['GET_URL' => admin_url('admin-ajax.php'), 'nonce' => $ajax_nonce]);
		return ob_get_clean();
	}

	/**
	 * Check if a Bookingor design or shortcode is active on the current page.
	 *
	 * @param string $shortcode The shortcode name (e.g. 'BOOKINGOR_DESIGN_1')
	 * @param string $design_key Optional design key (e.g. 'design_one')
	 * @return bool
	 */
	private function has_bookingor_asset($shortcode, $design_key = '')
	{
		if (empty($shortcode)) {
			return has_shortcode(get_the_content(), '');
		}

		// 1. Check in post content (published/standard page)
		if (has_shortcode(get_the_content(), $shortcode)) {
			return true;
		}

		// 2. Check in queried post ID
		$post_id = get_the_ID();
		if (!$post_id && is_singular()) {
			$post_id = get_queried_object_id();
		}

		if ($post_id) {
			$post = get_post($post_id);
			if ($post && has_shortcode($post->post_content, $shortcode)) {
				return true;
			}

			// 3. Check in Elementor data post meta (for widgets/saved drafts)
			$elementor_data = get_post_meta($post_id, '_elementor_data', true);
			if (!empty($elementor_data)) {
				$data_str = is_string($elementor_data) ? $elementor_data : wp_json_encode($elementor_data);
				if (strpos($data_str, $shortcode) !== false || (!empty($design_key) && strpos($data_str, $design_key) !== false)) {
					return true;
				}
			}
		}

		// 4. Check if we are currently in Elementor editor or preview mode
		if (class_exists('\Elementor\Plugin')) {
			if (\Elementor\Plugin::$instance->editor->is_edit_mode() || \Elementor\Plugin::$instance->preview->is_preview_mode()) {
				if (isset($_GET['action']) && $_GET['action'] === 'elementor') {
					return true;
				}
				if (isset($_POST['actions'])) {
					$actions = $_POST['actions'];
					$actions_str = is_string($actions) ? $actions : wp_json_encode($actions);
					if (strpos($actions_str, $shortcode) !== false || (!empty($design_key) && strpos($actions_str, $design_key) !== false)) {
						return true;
					}
				}
			}
		}

		return false;
	}
}
