PluginProbe ʕ •ᴥ•ʔ
Appointment Booking Plugin – LatePoint | Calendar & Scheduling for WordPress / 5.6.8
Appointment Booking Plugin – LatePoint | Calendar & Scheduling for WordPress v5.6.8
5.6.8 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 / _day.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
_day.php
159 lines
1 <?php
2 /**
3 * @var $booking_request \LatePoint\Misc\BookingRequest
4 * @var $target_date OsWpDateTime
5 * @var $today_date OsWpDateTime
6 * @var $calendar_start OsWpDateTime
7 * @var $calendar_end OsWpDateTime
8 * @var $agents OsAgentModel[]
9 */
10
11 if ( ! defined( 'ABSPATH' ) ) {
12 exit; // Exit if accessed directly
13 }
14 ?>
15 <div class="daily-availability-calendar-wrapper">
16 <a href="#" data-target-date="<?php echo esc_attr((clone $target_date)->modify('last day of previous month')->format('Y-m-d')); ?>" class="daily-calendar-action-navigation-btn"><i class="latepoint-icon latepoint-icon-chevron-left"></i></a>
17 <div class="daily-availability-calendar horizontal-calendar">
18 <?php
19 $settings_for_single_month = [
20 'active' => true,
21 'layout' => 'horizontal',
22 'accessed_from_backend' => true,
23 'highlight_target_date' => true,
24 'output_target_date_in_header' => true
25 ];
26 OsCalendarHelper::generate_single_month($booking_request, $target_date, $settings_for_single_month);
27 ?>
28 </div>
29 <a href="#" data-target-date="<?php echo esc_attr((clone $target_date)->modify('first day of next month')->format('Y-m-d')); ?>" class="daily-calendar-action-navigation-btn"><i class="latepoint-icon latepoint-icon-chevron-right"></i></a>
30 </div>
31 <?php for($day_date=clone $calendar_start; $day_date<=$calendar_end; $day_date->modify('+1 day')){
32
33
34 $show_today_indicator = false;
35 if(($work_boundaries->start_time < $work_boundaries->end_time) && ($timeblock_interval > 0)) {
36 $valid_work_hours = true;
37 $total_periods = floor(($work_boundaries->end_time - $work_boundaries->start_time) / $timeblock_interval) + 1;
38
39 // if standard height of 20px per period is not enought to fill the minimum calendar height use calculated height
40 $default_period_height = 20;
41 $period_height = (($total_periods * $default_period_height) < $day_view_calendar_min_height) ? ceil($day_view_calendar_min_height / $total_periods) : $default_period_height;
42 $period_css = ($period_height != $default_period_height) ? "height: {$period_height}px;" : '';
43
44 // decide if we need to show today indicator
45 if($target_date->format('Y-m-d') == $today_date->format('Y-m-d')){
46 $time_now = OsTimeHelper::now_datetime_object();
47 $time_now_in_minutes = OsTimeHelper::convert_datetime_to_minutes($time_now);
48 if(($time_now_in_minutes<=$work_boundaries->end_time && $time_now_in_minutes>=$work_boundaries->start_time)){
49 $time_now_label = $time_now->format(OsTimeHelper::get_time_format());
50 // agents row with avatars and margin below - offset that needs to be accounted for when calculating "time now" indicator position
51 $agents_row_height = 70;
52 $time_now_indicator_top_offset = ($period_height * ($total_periods - 1)) * (($time_now_in_minutes - $work_boundaries->start_time) / $work_total_minutes * 100) / 100 + $agents_row_height;
53 $show_today_indicator = true;
54 }
55 }
56 }else{
57 $valid_work_hours = false;
58 }
59 ?>
60 <div class="daily-agent-calendar-w <?php if(count($agents) > 5) echo 'make-scrollable'; ?>">
61 <?php if($show_today_indicator) echo '<div class="current-time-indicator" style="top: '.esc_attr($time_now_indicator_top_offset).'px"><span>'.esc_html($time_now_label).'</span></div>'; ?>
62 <div class="calendar-daily-agent-w">
63 <?php if($valid_work_hours){ ?>
64
65 <div class="calendar-hours">
66 <div class="ch-hours">
67 <div class="ch-filter">
68 <span><?php esc_html_e('Agent', 'latepoint'); ?></span>
69 <span><?php esc_html_e('Time', 'latepoint'); ?></span>
70 </div>
71 <?php for($minutes = $work_boundaries->start_time; $minutes <= $work_boundaries->end_time; $minutes+= $timeblock_interval){ ?>
72 <?php
73 $period_class = 'chh-period';
74 $period_class.= (($minutes == $work_boundaries->end_time) || (($minutes + $timeblock_interval) > $work_boundaries->end_time)) ? ' last-period' : '';
75 $period_class.= (($minutes % 60) == 0) ? ' chh-period-hour' : ' chh-period-minutes';
76 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>';
77 ?>
78 <?php } ?>
79 </div>
80 <div class="ch-agents">
81 <div class="da-head-agents">
82 <?php foreach($agents as $agent){ ?>
83 <div class="da-head-agent">
84 <div class="da-head-agent-avatar" style="background-image: url(<?php echo esc_url($agent->get_avatar_url()); ?>)"></div>
85 <a href="<?php echo esc_url(OsRouterHelper::build_link(['agents', 'edit_form'], ['id' => $agent->id])); ?>" class="da-head-agent-name"><?php echo esc_html($agent->full_name); ?></a>
86 </div>
87 <?php } ?>
88 </div>
89 <div class="da-agents-bookings">
90 <?php foreach($agents as $agent){
91 $day_off_class = empty($work_time_periods_grouped_by_date_and_agent[$day_date->format('Y-m-d')][$agent->id]) ? 'agent-has-day-off' : ''; ?>
92 <div class="da-agent-bookings-and-periods">
93 <?php echo OsCalendarHelper::generate_calendar_quick_actions_link($day_date, ['agent_id' => $agent->id, 'start_time' => $work_boundaries->start_time]); ?>
94 <div class="ch-day-periods ch-day-<?php echo esc_attr(strtolower($target_date->format('N'))); ?>">
95
96 <?php for($minutes = $work_boundaries->start_time; $minutes <= $work_boundaries->end_time; $minutes+= $timeblock_interval){ ?>
97 <?php
98 $period_class = 'chd-period';
99 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 ';
100 $period_class.= (($minutes == $work_boundaries->end_time) || (($minutes + $timeblock_interval) > $work_boundaries->end_time)) ? ' last-period' : '';
101 $period_class.= (($minutes % 60) == 0) ? ' chd-period-hour' : ' chd-period-minutes';
102 $btn_data = [ 'start_time'=> $minutes,
103 'start_date' => $target_date->format('Y-m-d'),
104 'agent_id' => $agent->id,
105 'location_id' => is_array($booking_request->location_id) ? $booking_request->location_id[0] : $booking_request->location_id,
106 'service_id' => is_array($booking_request->service_id) ? $booking_request->service_id[0] : $booking_request->service_id ];
107 $btn_params = OsOrdersHelper::quick_order_btn_html(false, $btn_data);
108 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>';
109 ?>
110 <?php } ?>
111
112 </div>
113 <div class="da-agent-bookings">
114 <?php
115 if(isset($bookings_grouped_by_date_and_agent[$day_date->format('Y-m-d')][$agent->id]) && !empty($bookings_grouped_by_date_and_agent[$day_date->format('Y-m-d')][$agent->id])){
116 $overlaps_count = 1;
117 $total_attendees_in_group = 0;
118 $total_bookings_in_group = 0;
119 $total_bookings = count($bookings_grouped_by_date_and_agent[$day_date->format('Y-m-d')][$agent->id]);
120 foreach($bookings_grouped_by_date_and_agent[$day_date->format('Y-m-d')][$agent->id] as $index => $booking){
121 $next_booking = (($index + 1) < $total_bookings) ? $bookings_grouped_by_date_and_agent[$day_date->format('Y-m-d')][$agent->id][$index + 1] : false;
122
123 if(OsBookingHelper::check_if_group_bookings($booking, $next_booking)){
124 // skip this output because multiple bookings in the same slot because next booking has the same start and end time
125 $total_attendees_in_group+= $booking->total_attendees;
126 $total_bookings_in_group++;
127 continue;
128 }else{
129 include('_booking_box_on_calendar.php');
130 // time overlaps
131 $overlaps_count = ($next_booking && ($next_booking->start_time < $booking->end_time)) ? $overlaps_count + 1 : 1;
132 // reset
133 $total_attendees_in_group = 0;
134 }
135 }
136 }
137 do_action('latepoint_calendar_daily_timeline', $target_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]);
138 ?>
139 </div>
140 </div>
141 <?php } ?>
142 </div>
143 </div>
144 </div>
145 <?php }else{ ?>
146 <div class="no-results-w">
147 <div class="icon-w"><i class="latepoint-icon latepoint-icon-calendar"></i></div>
148 <h2><?php esc_html_e('You have not set any working hours for this day.', 'latepoint'); ?></h2>
149 <?php if(OsAuthHelper::is_agent_logged_in()){ ?>
150 <a href="<?php echo esc_url(OsRouterHelper::build_link(['agents', 'edit_form'], ['id' => OsAuthHelper::get_logged_in_agent_id()])); ?>" class="latepoint-btn"><i class="latepoint-icon latepoint-icon-edit-2"></i><span><?php esc_html_e('Edit Working Hours', 'latepoint'); ?></span></a>
151 <?php }elseif(OsRolesHelper::can_user('settings__edit')){ ?>
152 <a href="<?php echo esc_url(OsRouterHelper::build_link(['settings', 'work_periods'])); ?>" class="latepoint-btn"><i class="latepoint-icon latepoint-icon-edit-2"></i><span><?php esc_html_e('Edit Working Hours', 'latepoint'); ?></span></a>
153 <?php } ?>
154 </div>
155 <?php } ?>
156 </div>
157 </div>
158 <?php } ?>
159 <?php include('_shared.php'); ?>