<?php

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

// Exit if accessed directly
if (! defined('ABSPATH')) exit; ?>
<div class="bookingor" id="bookingor-design-5" data-design-id="<?php echo isset($get_design_id) ? esc_attr($get_design_id) : ''; ?>">
  <div id="bookingor-design-eight">
    <div class="bookingor-loader-container ">
      <div class="bookingor-d-flex align-items-center justify-content-center pt-3 pb-3">
        <div class="bookingor-loader">
          <div class="bookingor-loader-wheel"></div>
          <div class="bookingor-loader-text bookingor-d-flex"></div>
        </div>
      </div>
    </div>
    <form id="bookingor-widget-design-8" class="bookingor-v-none">
      <input type="hidden" id="get-design-type" name="get_design_type" value="5">
      <div class="ma-container">
        <?php if (get_option("bookingor_settings_business_details_active") === "on") { ?>
          <div class="bookingor-flex">
            <div class="bookingor-f-business-all bookingor-gap-10">
              <?php if (get_option("bookingor_settings_business_phone_required") === "on") { ?>
                <div class="bookingor-f-business-logo">
                  <img src="<?php echo esc_attr(wp_get_attachment_url(get_option('bookingor_business_logo'))); ?>" alt="">
                </div>
              <?php } ?>
              <div>
                <?php if (get_option("bookingor_settings_business_name_required") === "on") { ?>
                  <div class="bookingor-f-business-name">
                    <?php echo esc_html(get_option('bookingor_business_name')); ?>
                  </div>
                <?php }
                if (get_option("bookingor_settings_business_phone_required") === "on") { ?>
                  <div class="bookingor-flex bookingor-gap-5">
                    <div class="bookingor-flex">
                      <svg xmlns="http://www.w3.org/2000/svg" class="bookingor-flex bookingor-svgs" viewBox="0 0 24 24">
                        <path fill="none" d="M16.585,19.999l2.006-2.005l-2.586-2.586l-1.293,1.293c-0.238,0.239-0.579,0.342-0.912,0.271 c-0.115-0.024-2.842-0.611-4.502-2.271s-2.247-4.387-2.271-4.502c-0.069-0.33,0.032-0.674,0.271-0.912l1.293-1.293L6.005,5.408 L4,7.413c0.02,1.223,0.346,5.508,3.712,8.874C11.067,19.643,15.337,19.978,16.585,19.999z" />
                        <path d="M16.566 21.999c.005 0 .023 0 .028 0 .528 0 1.027-.208 1.405-.586l2.712-2.712c.391-.391.391-1.023 0-1.414l-4-4c-.391-.391-1.023-.391-1.414 0l-1.594 1.594c-.739-.22-2.118-.72-2.992-1.594s-1.374-2.253-1.594-2.992l1.594-1.594c.391-.391.391-1.023 0-1.414l-4-4c-.375-.375-1.039-.375-1.414 0L2.586 5.999C2.206 6.379 1.992 6.901 2 7.434c.023 1.424.4 6.37 4.298 10.268S15.142 21.976 16.566 21.999zM6.005 5.408l2.586 2.586L7.298 9.287c-.239.238-.341.582-.271.912.024.115.611 2.842 2.271 4.502s4.387 2.247 4.502 2.271c.333.07.674-.032.912-.271l1.293-1.293 2.586 2.586-2.006 2.005c-1.248-.021-5.518-.356-8.873-3.712C4.346 12.921 4.02 8.636 4 7.413L6.005 5.408zM19.999 10.999h2c0-5.13-3.873-8.999-9.01-8.999v2C17.051 4 19.999 6.943 19.999 10.999z" />
                        <path d="M12.999,8c2.103,0,3,0.897,3,3h2c0-3.225-1.775-5-5-5V8z" />
                      </svg>
                    </div>
                    <div class="bookingor-f-business-phone"><?php echo esc_html(get_option('bookingor_business_phone')); ?></div>
                  </div>
                <?php }
                if (get_option("bookingor_settings_business_email_required") === "on") { ?>
                  <div class="bookingor-flex bookingor-gap-5">
                    <div class="bookingor-flex">
                      <svg xmlns="http://www.w3.org/2000/svg" class="bookingor-flex bookingor-svgs" viewBox="0 0 24 24">
                        <path d="M20,4H4C2.897,4,2,4.897,2,6v12c0,1.103,0.897,2,2,2h16c1.103,0,2-0.897,2-2V6C22,4.897,21.103,4,20,4z M20,6v0.511 l-8,6.223L4,6.512V6H20z M4,18V9.044l7.386,5.745C11.566,14.93,11.783,15,12,15s0.434-0.07,0.614-0.211L20,9.044L20.002,18H4z" />
                      </svg>
                    </div>
                    <div class="bookingor-f-business-email"><?php echo esc_html(get_option('bookingor_business_email')); ?></div>
                  </div>
                <?php } ?>
              </div>
            </div>
          </div>
        <?php } ?>
        <div id="cal-valid">
          <div id="widget-calendar-final" class="acti"></div>
          <span class="cs-cal-vali"></span>
        </div>
        <?php if (get_option("bookingor_settings_location_active") === "on") {  ?>
          <div id="bookingor-location" class="b_kings_pro">
            <div class="mt-3">
              <label class="wid-lbl bookingor-f-14 bookingor-location-heading"><?php echo esc_html(get_option('bookingor_settings_location_name')); ?></label>
              <select name="select_location" class="bd form-control form-select" id="bookingor-location-design-8" required="true">
                <option value=""><?php esc_html_e("Select ", "bookingor-pro"); ?><?php echo esc_html(get_option('bookingor_settings_location_name')); ?></option>
                <?php foreach (LocationControlFront::$f_location_assign as $key => $value) {
                ?>
                  <option data-get-service-id="<?php echo esc_attr($value->service_get_id); ?>" data-location-id="<?php echo esc_attr($value->location_id); ?>" data-get-staff-id="<?php echo esc_attr($value->staff_get_id); ?>"><?php echo esc_html($value->location_address); ?></option>
                <?php } ?>
              </select>
              <span class="cs-vali-location bookingor-d-none"><?php esc_html_e("Must Select ", "bookingor-pro"); ?><?php echo esc_html(get_option('bookingor_settings_location_name')); ?></span>
            </div>
          </div>
        <?php }
        if (get_option("bookingor_settings_category_active") === "on") {  ?>
          <div id="bookingor-category" class="b_kings_pro">
            <div class="mt-3">
              <label class="wid-lbl bookingor-f-14 bookingor-category-heading"><?php echo esc_html(get_option('bookingor_settings_category_name')); ?></label>
              <select name="select_category" class="bd form-control form-select" id="boookingor-category-design-8">
                <option value="all"><?php esc_html_e("Select ", "bookingor-pro"); ?><?php echo esc_html(get_option('bookingor_settings_category_name')); ?></option>
                <?php foreach (CategoryControlFront::bp_font_category_view() as $key => $value) {
                ?>
                  <option data-category-id="<?php echo esc_attr($value->category_id); ?>" value="<?php echo esc_attr($value->category_name); ?>"><?php echo esc_html($value->category_name); ?></option>
                <?php } ?>
              </select>
              <span class="cs-vali-category bookingor-d-none"><?php esc_html_e("Must Select ", "bookingor-pro"); ?><?php echo esc_html(get_option('bookingor_settings_category_name')); ?></span>
            </div>
          </div>
        <?php }
        if (get_option("bookingor_settings_woocommcerce_payment_active") === "on") {
          include plugin_dir_path(__FILE__) . 'Services/woocommerce-service-5.php';
        } else { ?>
          <div id="bookingor-service" class="b_kings_pro">
            <div class="mt-3">
              <label class="wid-lbl bookingor-f-14 bookingor-service-heading"><?php echo esc_html(get_option('bookingor_settings_service_name')); ?></label>
              <select name="select_service" class="bd form-control form-select" id="front-get-category-for-services">
                <option value=""><?php esc_html_e("Select ", "bookingor-pro"); ?><?php echo esc_html(get_option('bookingor_settings_service_name')); ?></option>
                <?php foreach (ServiceControlFront::bp_front_services_view() as $key => $value) { ?>
                  <option data-staff-get-id="<?php echo esc_attr($value->staff_get_id); ?>" data-location-get-id="<?php echo esc_attr($value->location_get_id); ?>" data-service-id="<?php echo esc_attr($value->service_id); ?>" data-category-get-id="<?php echo esc_attr($value->category_get_id); ?>" value="<?php echo esc_attr($value->service_name); ?>"><?php echo esc_html($value->service_name); ?><?php if (get_option('bookingor_settings_service_price_show') === 'on') { ?>
                    ( <?php echo esc_html(get_option('bookingor_settings_currency_symbol')); ?>
                    <?php echo esc_html(HelperControl::priceDecimal($value->service_cost)) . ($value->service_duration_type === 'hour-period' ? ' /hr' : ''); ?> )
                  <?php } ?>
                  <?php if (get_option('bookingor_settings_service_duration_show') === 'on' && $value->service_duration_type !== 'hour-period') { ?>
                    ( <?php echo esc_html(HelperControl::convert_duration($value->service_duration)); ?> )
                  <?php } ?>
                  </option>
                <?php }  ?>
              </select>
              <span class="cs-vali-service bookingor-d-none"><?php esc_html_e("Must Select ", "bookingor-pro"); ?><?php echo esc_html(get_option('bookingor_settings_service_name')); ?></span>
            </div>
          </div>
        <?php }
        if (get_option("bookingor_settings_staff_active") === "on") {  ?>
          <div id="bookingor-staff" class="b_kings_pro">
            <div class="mt-3">
              <label class="wid-lbl bookingor-f-14 bookingor-staff-heading"><?php echo esc_html(get_option('bookingor_settings_staff_name')); ?></label>
              <select name="select_employee" class="bd  form-control form-select" id="front-select-staffs">
                <option value="" data-staff-id="" data-get-service-id=""><?php esc_html_e("Select ", "bookingor-pro"); ?><?php echo esc_html(get_option('bookingor_settings_staff_name')); ?></option>
                <?php foreach (StaffControlFront::bp_front_staff_view() as $key => $value) { ?>
                  <option data-staff-id="<?php echo esc_attr($value->staff_id); ?>" data-get-service-id="<?php echo esc_attr($value->service_get_id); ?>" data-get-location-id="<?php echo esc_attr($value->location_get_id); ?>" value="<?php echo esc_attr($value->staff_first_name . " " . $value->staff_last_name); ?>"><?php echo esc_html($value->staff_first_name . " " . $value->staff_last_name); ?></option>
                <?php } ?>
              </select>
              <span class="cs-vali-staff bookingor-d-none"><?php esc_html_e("Must Select ", "bookingor-pro"); ?><?php echo esc_html(get_option('bookingor_settings_staff_name')); ?></span>
            </div>
          </div>
        <?php } ?>
        <div id="bookingor-time" class="b_kings_pro">
          <div class="mt-3">
            <div>
              <div class="wid-lbl bookingor-f-14 bookingor-time-heading" id="wdgt-head"><?php echo esc_html(get_option('bookingor_settings_time_name')); ?></div>
              <span class="cs-vali-timing bookingor-d-none"><?php esc_html_e("Must Select ", "bookingor-pro"); ?><?php echo esc_html(get_option('bookingor_settings_time_name')); ?></span>
            </div>
            <div class="b_kings_pro mt-1" id="bookingor-time-show-five">
              <!-- <div class="loader-wheel"></div> -->
              <ul class="no-pd bookingor-flex row bookingor-g-0" id="bookingor-all-time-show">
              </ul>
            </div>
          </div>
        </div>
        <div class="b_kings_pro">
          <div class="mt-3  ">
            <button type="button" class="btn bt js-open-popup bookingor-cont-btn" data-target="custom-popup" id="chk-validation"><?php esc_html_e("Book", "bookingor-pro"); ?></button>
          </div>
        </div>
      </div>
      <!-- Modal -->
      <div class="custom-popup js-custom-popup bookingor-d-none" id="custom-popup" data-popup="custom-popup">
        <div class="custom-popup__holder js-custom-popup-holder bookingor-d-flex">
          <div class="bookingor-my-model">
            <div class="custom-popup__close js-close-popup mb-2 bookingor-d-none"></div>
            <?php include plugin_dir_path(__FILE__) . 'tabs/customer-book.php'; ?>
            <?php include plugin_dir_path(__FILE__) . 'tabs/customer-payment.php'; ?>
            <?php include plugin_dir_path(__FILE__) . 'tabs/customer-thankyou.php'; ?>
          </div>
        </div>
      </div>
    </form>
  </div>

</div>