_booking_box_on_calendar.php
1 year ago
_day.php
9 months ago
_list.php
1 year ago
_month.php
9 months ago
_shared.php
1 year ago
_week.php
9 months ago
_list.php
120 lines
| 1 | <?php |
| 2 | /** |
| 3 | * @var $bookings OsBookingModel[] |
| 4 | * @var $calendar_start OsWpDateTime |
| 5 | */ |
| 6 | |
| 7 | |
| 8 | if ( ! defined( 'ABSPATH' ) ) { |
| 9 | exit; // Exit if accessed directly |
| 10 | } |
| 11 | ?> |
| 12 | |
| 13 | <?php if(!empty($bookings)){ |
| 14 | $loop_year = $calendar_start->format('Y'); |
| 15 | $loop_month = $calendar_start->format('n'); |
| 16 | $loop_day = false; |
| 17 | $total_locations = OsLocationHelper::count_locations(true); |
| 18 | ?> |
| 19 | <div class="list-upcoming-bookings-w"> |
| 20 | <?php |
| 21 | $first_booking_start_datetime = $bookings[0]->get_start_datetime_object(); |
| 22 | if($first_booking_start_datetime->format('Y-n') != $loop_year.'-'.$loop_month) echo '<div class="no-upcoming-bookings">'.esc_html__('No bookings', 'latepoint').'</div>'; |
| 23 | ?> |
| 24 | <?php foreach($bookings as $booking){ ?> |
| 25 | <?php |
| 26 | $booking_start_datetime = $booking->get_start_datetime_object(); |
| 27 | if($loop_day != $booking_start_datetime->format('d')){ |
| 28 | $loop_day = $booking_start_datetime->format('d'); |
| 29 | $is_new_day = true; |
| 30 | }else{ |
| 31 | $is_new_day = false; |
| 32 | } |
| 33 | if($booking_start_datetime->format('Y') > $loop_year){ |
| 34 | for($m = $loop_month+1; $m < 12; $m++){ |
| 35 | echo '<div class="upcoming-bookings-month">'.esc_html(OsUtilHelper::get_month_name_by_number($m)).'</div>'; |
| 36 | echo '<div class="no-upcoming-bookings">'.esc_html__('No bookings', 'latepoint').'</div>'; |
| 37 | } |
| 38 | $loop_month = 1; |
| 39 | for($y = $loop_year + 1; $y < $booking_start_datetime->format('Y'); $y++){ |
| 40 | echo '<div class="upcoming-bookings-year">'.esc_html($y).'</div>'; |
| 41 | // loop months |
| 42 | for($m=$loop_month+1;$m<=12;$m++){ |
| 43 | echo '<div class="upcoming-bookings-month">'.esc_html(OsUtilHelper::get_month_name_by_number($m)).'</div>'; |
| 44 | echo '<div class="no-upcoming-bookings">'.esc_html__('No bookings', 'latepoint').'</div>'; |
| 45 | } |
| 46 | $loop_month = 1; |
| 47 | } |
| 48 | $loop_year = $booking_start_datetime->format('Y'); |
| 49 | echo '<div class="upcoming-bookings-year">'.esc_html($loop_year).'</div>'; |
| 50 | } |
| 51 | if($booking_start_datetime->format('n') > $loop_month){ |
| 52 | for($m = $loop_month + 1; $m < $booking_start_datetime->format('n'); $m++){ |
| 53 | echo '<div class="upcoming-bookings-month">'.esc_html(OsUtilHelper::get_month_name_by_number($m)).'</div>'; |
| 54 | echo '<div class="no-upcoming-bookings">'.esc_html__('No bookings', 'latepoint').'</div>'; |
| 55 | } |
| 56 | $loop_month = $booking_start_datetime->format('n'); |
| 57 | echo '<div class="upcoming-bookings-month">'.esc_html(OsUtilHelper::get_month_name_by_number($loop_month)).'</div>'; |
| 58 | } |
| 59 | ?> |
| 60 | <?php $max_capacity = OsServiceHelper::get_max_capacity($booking->service); ?> |
| 61 | <div class="upcoming-booking <?php echo ($is_new_day) ? 'is-new-day' : ''; ?>" <?php echo ($max_capacity > 1) ? OsBookingHelper::group_booking_btn_html($booking->id) : OsBookingHelper::quick_booking_btn_html($booking->id); ?>> |
| 62 | <div class="booking-main-info"> |
| 63 | <div class="booking-color-elem" style="background-color: <?php echo esc_attr($booking->service->bg_color); ?>"></div> |
| 64 | <div class="booking-fancy-date"> |
| 65 | <div class="fancy-day"><?php echo esc_html($booking_start_datetime->format('d')); ?></div> |
| 66 | <div class="fancy-month"><?php echo esc_html(OsUtilHelper::get_month_name_by_number($booking_start_datetime->format('n'),true)); ?></div> |
| 67 | </div> |
| 68 | <div class="booking-main-info-i"> |
| 69 | <div class="avatar-w" style="background-image: url(<?php echo esc_url($booking->agent->get_avatar_url()); ?>);"> |
| 70 | <div class="agent-info-tooltip"><?php echo esc_html($booking->agent->full_name); ?></div> |
| 71 | </div> |
| 72 | <div class="booking-date-w"> |
| 73 | <div class="booking-service-name"><?php echo esc_html($booking->service->name); ?></div> |
| 74 | <div class="booking-date-i"> |
| 75 | <div class="booking-date"><?php echo esc_html($booking->get_nice_start_date(true)).', '; ?></div> |
| 76 | <div class="booking-time"><?php echo esc_html($booking->get_nice_start_time()); ?>,</div> |
| 77 | <div class="booking-time-left"> |
| 78 | <?php |
| 79 | // translators: %s is time left |
| 80 | echo sprintf(esc_html__('in %s', 'latepoint'), $booking->time_left); ?> |
| 81 | </div> |
| 82 | <?php if($total_locations > 1) echo '<div class="booking-location">'.esc_html($booking->location->name).'</div>'; ?> |
| 83 | <div class="booking-attendees"> |
| 84 | <?php |
| 85 | if($max_capacity > 1) { |
| 86 | $total_attendees = $booking->total_attendees; |
| 87 | // translators: %1$d is number of booked appointments |
| 88 | // translators: %2$d is total available |
| 89 | echo '<div class="booked-count-label">'.esc_html(sprintf(__('Booked %1$d of %2$d', 'latepoint'), $total_attendees, $max_capacity)).'</div>'; |
| 90 | echo '<div class="booked-percentage"> |
| 91 | <div class="booked-bar" style="width: '.esc_attr(min(100, round($total_attendees / $max_capacity * 100))).'%;"></div> |
| 92 | </div>'; |
| 93 | }else{ |
| 94 | echo '<div class="booking-attendee">'; |
| 95 | echo '<div class="avatar-w" style="background-image: url('.esc_url($booking->customer->get_avatar_url()).');"></div>'; |
| 96 | echo '<div class="customer-name">'.esc_html($booking->customer->full_name).'</div>'; |
| 97 | echo '</div>'; |
| 98 | } |
| 99 | ?> |
| 100 | </div> |
| 101 | </div> |
| 102 | </div> |
| 103 | </div> |
| 104 | <div class="booking-link"> |
| 105 | <i class="latepoint-icon latepoint-icon-arrow-right"></i> |
| 106 | </div> |
| 107 | </div> |
| 108 | </div> |
| 109 | <?php } ?> |
| 110 | </div> |
| 111 | <?php }else{ ?> |
| 112 | <div class="no-results-w"> |
| 113 | <div class="icon-w"><i class="latepoint-icon latepoint-icon-book"></i></div> |
| 114 | <h2><?php esc_html_e('No Upcoming Appointments', 'latepoint'); ?></h2> |
| 115 | <a href="#" <?php echo OsOrdersHelper::quick_order_btn_html(); ?> class="latepoint-btn"> |
| 116 | <i class="latepoint-icon latepoint-icon-plus-square"></i> |
| 117 | <span><?php esc_html_e('Create Appointment', 'latepoint'); ?></span> |
| 118 | </a> |
| 119 | </div> |
| 120 | <?php } ?> |