_booking_box_on_calendar.php
1 year ago
_day.php
10 months ago
_list.php
1 year ago
_month.php
3 months ago
_shared.php
1 year ago
_week.php
10 months ago
_booking_box_on_calendar.php
47 lines
| 1 | <?php |
| 2 | /* |
| 3 | * Copyright (c) 2023 LatePoint LLC. All rights reserved. |
| 4 | */ |
| 5 | |
| 6 | if ( ! defined( 'ABSPATH' ) ) { |
| 7 | exit; // Exit if accessed directly |
| 8 | } |
| 9 | |
| 10 | $booking_duration = $booking->get_total_duration(true); |
| 11 | if($booking_duration <= 0) $booking_duration = ($booking->service->duration > 0) ? $booking->service->duration : 60; |
| 12 | $booking_start_percent = ($booking->start_time - $work_boundaries->start_time) / ($work_boundaries->end_time - $work_boundaries->start_time) * 100; |
| 13 | $booking_duration_percent = min($booking_duration / $work_total_minutes * 100, 100 - $booking_start_percent); |
| 14 | if($booking_start_percent < 0) $booking_start_percent = 0; |
| 15 | $buffer_before_height_percent = (($booking->start_time - $booking->buffer_before) >= $work_boundaries->start_time) ? ($booking->buffer_before / $booking_duration * 100) : 0; |
| 16 | $buffer_after_height_percent = (($booking->end_time + $booking->buffer_after) <= $work_boundaries->end_time) ? ($booking->buffer_after / $booking_duration * 100) : 0; |
| 17 | $left = (isset($overlaps_count) && $overlaps_count > 1) ? 'left:'.(100 - round(150 / $overlaps_count)).'%' : ''; |
| 18 | |
| 19 | $max_capacity = OsServiceHelper::get_max_capacity($booking->service); |
| 20 | if($max_capacity > 1){ |
| 21 | $action_html = OsBookingHelper::group_booking_btn_html($booking->id); |
| 22 | }else{ |
| 23 | $action_html = OsBookingHelper::quick_booking_btn_html($booking->id); |
| 24 | } |
| 25 | $css = 'top: '.$booking_start_percent.'%; height: '.$booking_duration_percent.'%; background-color: '.esc_attr($booking->service->bg_color).'; '.$left; |
| 26 | ?> |
| 27 | <div class="ch-day-booking status-<?php echo esc_attr($booking->status); ?>" <?php echo $action_html; ?> style="<?php echo esc_attr($css); ?>"> |
| 28 | <?php if($buffer_before_height_percent) echo '<div class="ch-day-buffer-before" style="height: '.esc_attr($buffer_before_height_percent).'%;"></div>'; ?> |
| 29 | <div class="ch-day-booking-i"> |
| 30 | <div class="booking-service-name"><?php echo wp_kses_post(OsReplacerHelper::replace_all_vars(OsSettingsHelper::get_booking_template_for_calendar(), array('customer' => $booking->customer, 'agent' => $booking->agent, 'booking' => $booking, 'order' => $booking->get_order()))); ?></div> |
| 31 | <div class="booking-time"><?php echo esc_html(OsTimeHelper::minutes_to_hours_and_minutes($booking->start_time)); ?> - <?php echo esc_html(OsTimeHelper::minutes_to_hours_and_minutes($booking->end_time)); ?></div> |
| 32 | <?php if($max_capacity > 1){ |
| 33 | $total_attendees_in_group = $total_attendees_in_group + $booking->total_attendees; ?> |
| 34 | <div class="booking-attendees"> |
| 35 | <div> |
| 36 | <?php |
| 37 | // translators: %1$d is number of booked attendees |
| 38 | // translators: %2$d is capacity |
| 39 | echo esc_html__('Booked:', 'latepoint'). ' <span>'.esc_html(sprintf(__('%1$d of %2$d', 'latepoint'), $total_attendees_in_group, $booking->service->capacity_max)).'</span>'; ?></div> |
| 40 | <div class="booked-percentage"> |
| 41 | <div class="booked-bar" style="width: <?php echo esc_attr(OsServiceHelper::get_percent_of_capacity_booked($booking->service, $total_attendees_in_group)); ?>%;"></div> |
| 42 | </div> |
| 43 | </div> |
| 44 | <?php } ?> |
| 45 | </div> |
| 46 | <?php if($buffer_after_height_percent) echo '<div class="ch-day-buffer-after" style="height: '.esc_attr($buffer_after_height_percent).'%;"></div>'; ?> |
| 47 | </div> |