PluginProbe ʕ •ᴥ•ʔ
LatePoint – Calendar Booking Plugin for Appointments and Events / 5.6.6
LatePoint – Calendar Booking Plugin for Appointments and Events v5.6.6
5.6.7 5.6.6 5.6.5 5.6.4 5.6.3 5.6.2 5.6.1 5.6.0 5.5.2 5.5.1 5.5.0 5.4.2 trunk 5.1.0 5.1.1 5.1.2 5.1.3 5.1.4 5.1.5 5.1.6 5.1.7 5.1.8 5.1.9 5.1.91 5.1.92 5.1.93 5.1.94 5.2.0 5.2.1 5.2.10 5.2.11 5.2.2 5.2.3 5.2.4 5.2.5 5.2.6 5.2.7 5.2.8 5.2.9 5.3.0 5.3.1 5.3.2 5.4.0 5.4.1
latepoint / lib / views / calendars / scopes / _week.php
latepoint / lib / views / calendars / scopes Last commit date
_booking_box_on_calendar.php 1 year ago _day.php 9 months ago _list.php 1 year ago _month.php 2 months ago _shared.php 1 year ago _week.php 9 months ago
_week.php
129 lines
1 <?php
2 /**
3 * @var $target_date OsWpDateTime
4 * @var $today_date OsWpDateTime
5 * @var $calendar_start OsWpDateTime
6 * @var $calendar_end OsWpDateTime
7 * @var $booking_request \LatePoint\Misc\BookingRequest
8 * @var $calendar_settings array
9 * @var $agents OsAgentModel[]
10 */
11
12
13 if ( ! defined( 'ABSPATH' ) ) {
14 exit; // Exit if accessed directly
15 }
16 ?>
17
18 <?php
19 if(count($agents) > 1){
20 echo '<div class="weekly-calendar-agents-list">';
21 foreach($agents as $agent){
22 echo '<div data-agent-id="'.esc_attr($agent->id).'" class="weekly-calendar-agent-selector '.($calendar_settings['selected_agent_id'] == $agent->id ? 'selected' : '').'">';
23 echo '<div class="agent-avatar" style="background-image: url('.esc_url($agent->avatar_url).')"></div>';
24 echo '<div class="agent-name">'.esc_html($agent->full_name).'</div>';
25 echo '</div>';
26 }
27 echo '</div>';
28 }
29 ?>
30 <div class="calendar-week-agent-w">
31 <div class="calendar-self-w">
32 <?php if(($work_boundaries->start_time < $work_boundaries->end_time) && ($timeblock_interval > 0)){
33 $total_periods = floor(($work_boundaries->end_time - $work_boundaries->start_time) / $timeblock_interval) + 1;
34 $period_height = floor(OsSettingsHelper::get_day_calendar_min_height() / $total_periods);
35 $period_css = (($total_periods * 20) < OsSettingsHelper::get_day_calendar_min_height()) ? "height: {$period_height}px;" : '';
36 foreach($agents as $agent){ ?>
37 <div class="agent-weekly-calendar <?php echo ($agent->id == $calendar_settings['selected_agent_id']) ? 'selected' : ''; ?>" data-agent-id="<?php echo esc_attr($agent->id); ?>">
38 <div class="calendar-hours">
39 <div class="ch-hours">
40 <div class="ch-info">
41 <span><?php esc_html_e('Date', 'latepoint'); ?></span>
42 <span><?php esc_html_e('Time', 'latepoint'); ?></span>
43 </div>
44 <?php for($minutes = $work_boundaries->start_time; $minutes <= $work_boundaries->end_time; $minutes+= $timeblock_interval){ ?>
45 <?php
46 $period_class = 'chh-period';
47 $period_class.= (($minutes == $work_boundaries->end_time) || (($minutes + $timeblock_interval) > $work_boundaries->end_time)) ? ' last-period' : '';
48 $period_class.= (($minutes % 60) == 0) ? ' chh-period-hour' : ' chh-period-minutes';
49 echo '<div class="'.esc_attr($period_class).'" style="'.esc_attr($period_css).'"><span>'.esc_html(OsTimeHelper::minutes_to_hours_and_minutes($minutes, false, true, true)).'</span></div>';
50 ?>
51 <?php } ?>
52 </div>
53 <div class="ch-day-periods-w">
54 <?php
55 for($day_date=clone $calendar_start; $day_date<=$calendar_end; $day_date->modify('+1 day')) {
56 $day_off_class = empty($work_time_periods_grouped_by_date_and_agent[$day_date->format('Y-m-d')][$agent->id]) ? 'agent-has-day-off' : '';
57 ?>
58 <div class="ch-day-periods-i <?php echo esc_attr($day_off_class); ?>">
59 <div class="ch-day ch-day-<?php echo esc_attr(strtolower($day_date->format('N'))); ?> <?php if($today_date == $day_date) echo 'is-today'; ?>">
60 <span><?php echo esc_html(OsUtilHelper::get_weekday_name_by_number($day_date->format('N'), true)); ?></span>
61 <strong><?php echo esc_html($day_date->format('j')); ?></strong>
62 <?php echo OsCalendarHelper::generate_calendar_quick_actions_link($day_date, ['agent_id' => $agent->id, 'start_time' => $work_boundaries->start_time]); ?>
63 </div>
64 <div class="ch-day-periods ch-day-<?php echo esc_attr(strtolower($day_date->format('N')));?> <?php echo esc_attr($day_off_class); ?>">
65 <?php
66 if ( $day_date->format( 'Y-m-d' ) == $today_date->format( 'Y-m-d' ) ) {
67 $time_now = OsTimeHelper::now_datetime_object();
68 $time_now_in_minutes = OsTimeHelper::convert_datetime_to_minutes( $time_now );
69
70 if(($time_now_in_minutes<=$work_boundaries->end_time && $time_now_in_minutes>=$work_boundaries->start_time) && $work_total_minutes) {
71 // agents row with avatars and margin below - offset that needs to be accounted for when calculating "time now" indicator position
72 $time_now_indicator_top_offset = ( $time_now_in_minutes - $work_boundaries->start_time ) / $work_total_minutes * 100;
73 echo '<div class="current-time-indicator" style="top: '.esc_attr($time_now_indicator_top_offset).'%"></div>';
74 }
75 }
76 ?>
77 <?php for($minutes = $work_boundaries->start_time; $minutes <= $work_boundaries->end_time; $minutes+= $timeblock_interval){ ?>
78 <?php
79 $period_class = 'chd-period';
80 if(!OsBookingHelper::is_minute_in_work_periods($minutes, $work_time_periods_grouped_by_date_and_agent[$day_date->format('Y-m-d')][$agent->id])) $period_class.= ' chd-period-off ';
81 $period_class.= (($minutes == $work_boundaries->end_time) || (($minutes + $timeblock_interval) > $work_boundaries->end_time)) ? ' last-period' : '';
82 $period_class.= (($minutes % 60) == 0) ? ' chd-period-hour' : ' chd-period-minutes';
83 $btn_params = OsOrdersHelper::quick_order_btn_html(false, ['start_time'=> $minutes, 'agent_id' => $agent->id, 'start_date' => $day_date->format('Y-m-d'), 'location_id' => $booking_request->location_id, 'service_id' => $booking_request->service_id]);
84 echo '<div class="'.esc_attr($period_class).'" '.$btn_params.' style="'.esc_attr($period_css).'"><div class="chd-period-minutes-value">'.esc_html(OsTimeHelper::minutes_to_hours_and_minutes($minutes)).'</div></div>';
85 ?>
86 <?php } ?>
87
88 <?php
89 if($bookings_grouped_by_date_and_agent[$day_date->format('Y-m-d')][$agent->id]){
90 $overlaps_count = 1;
91 $total_attendees_in_group = 0;
92 $total_bookings_in_group = 0;
93 $total_bookings = count($bookings_grouped_by_date_and_agent[$day_date->format('Y-m-d')][$agent->id]);
94 foreach($bookings_grouped_by_date_and_agent[$day_date->format('Y-m-d')][$agent->id] as $index => $booking){
95 $next_booking = (($index + 1) < $total_bookings) ? $bookings_grouped_by_date_and_agent[$day_date->format('Y-m-d')][$agent->id][$index + 1] : false;
96
97 if(OsBookingHelper::check_if_group_bookings($booking, $next_booking)){
98 // skip this output because multiple bookings in the same slot because next booking has the same start and end time
99 $total_attendees_in_group+= $booking->total_attendees;
100 $total_bookings_in_group++;
101 continue;
102 }else{
103 include('_booking_box_on_calendar.php');
104 // time overlaps
105 $overlaps_count = ($next_booking && ($next_booking->start_time < $booking->end_time)) ? $overlaps_count + 1 : 1;
106 // reset
107 $total_attendees_in_group = 0;
108 }
109 }
110 }
111 do_action('latepoint_calendar_daily_timeline', $day_date, ['agent_id' => $agent->id, 'work_start_minutes' => $work_boundaries->start_time, 'work_end_minutes' => $work_boundaries->end_time, 'work_total_minutes' => $work_total_minutes, 'location_id' => $booking_request->location_id, 'service_id' => $booking_request->service_id]);
112 ?>
113 </div>
114 </div>
115 <?php } ?>
116 </div>
117 </div>
118 </div>
119 <?php } ?>
120 <?php }else{ ?>
121 <div class="no-results-w">
122 <div class="icon-w"><i class="latepoint-icon latepoint-icon-calendar"></i></div>
123 <h2><?php esc_html_e('Looks like you have not set your working hours yet, or the agent you selected does not offer this service.', 'latepoint'); ?></h2>
124 <a href="<?php echo esc_url(OsRouterHelper::build_link(OsRouterHelper::build_route_name('settings', 'general'))); ?>" class="latepoint-btn"><i class="latepoint-icon latepoint-icon-settings"></i><span><?php esc_html_e('Edit Work Hours', 'latepoint'); ?></span></a>
125 </div>
126 <?php } ?>
127 </div>
128 </div>
129 <?php include('_shared.php'); ?>