PluginProbe ʕ •ᴥ•ʔ
Appointment Booking Plugin – LatePoint | Calendar & Scheduling for WordPress / 5.1.2
Appointment Booking Plugin – LatePoint | Calendar & Scheduling for WordPress v5.1.2
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 1 year ago _list.php 1 year ago _month.php 1 year ago _shared.php 1 year ago _week.php 1 year ago
_day.php
157 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' => false, // we don't want it to filter based on access, since we already filtered that internally in booking request
23 'highlight_target_date' => true
24 ];
25 OsCalendarHelper::generate_single_month($booking_request, $target_date, $settings_for_single_month);
26 ?>
27 </div>
28 <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>
29 </div>
30 <?php for($day_date=clone $calendar_start; $day_date<=$calendar_end; $day_date->modify('+1 day')){
31
32
33 $show_today_indicator = false;
34 if(($work_boundaries->start_time < $work_boundaries->end_time) && ($timeblock_interval > 0)) {
35 $valid_work_hours = true;
36 $total_periods = floor(($work_boundaries->end_time - $work_boundaries->start_time) / $timeblock_interval) + 1;
37
38 // if standard height of 20px per period is not enought to fill the minimum calendar height use calculated height
39 $default_period_height = 20;
40 $period_height = (($total_periods * $default_period_height) < $day_view_calendar_min_height) ? ceil($day_view_calendar_min_height / $total_periods) : $default_period_height;
41 $period_css = ($period_height != $default_period_height) ? "height: {$period_height}px;" : '';
42
43 // decide if we need to show today indicator
44 if($target_date->format('Y-m-d') == $today_date->format('Y-m-d')){
45 $time_now = OsTimeHelper::now_datetime_object();
46 $time_now_in_minutes = OsTimeHelper::convert_datetime_to_minutes($time_now);
47 if(($time_now_in_minutes<=$work_boundaries->end_time && $time_now_in_minutes>=$work_boundaries->start_time)){
48 $time_now_label = $time_now->format(OsTimeHelper::get_time_format());
49 // agents row with avatars and margin below - offset that needs to be accounted for when calculating "time now" indicator position
50 $agents_row_height = 70;
51 $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;
52 $show_today_indicator = true;
53 }
54 }
55 }else{
56 $valid_work_hours = false;
57 }
58 ?>
59 <div class="daily-agent-calendar-w <?php if(count($agents) > 5) echo 'make-scrollable'; ?>">
60 <?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>'; ?>
61 <div class="calendar-daily-agent-w">
62 <?php if($valid_work_hours){ ?>
63
64 <div class="calendar-hours">
65 <div class="ch-hours">
66 <div class="ch-filter">
67 <span><?php esc_html_e('Agent', 'latepoint'); ?></span>
68 <span><?php esc_html_e('Time', 'latepoint'); ?></span>
69 </div>
70 <?php for($minutes = $work_boundaries->start_time; $minutes <= $work_boundaries->end_time; $minutes+= $timeblock_interval){ ?>
71 <?php
72 $period_class = 'chh-period';
73 $period_class.= (($minutes == $work_boundaries->end_time) || (($minutes + $timeblock_interval) > $work_boundaries->end_time)) ? ' last-period' : '';
74 $period_class.= (($minutes % 60) == 0) ? ' chh-period-hour' : ' chh-period-minutes';
75 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>';
76 ?>
77 <?php } ?>
78 </div>
79 <div class="ch-agents">
80 <div class="da-head-agents">
81 <?php foreach($agents as $agent){ ?>
82 <div class="da-head-agent">
83 <div class="da-head-agent-avatar" style="background-image: url(<?php echo esc_url($agent->get_avatar_url()); ?>)"></div>
84 <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>
85 </div>
86 <?php } ?>
87 </div>
88 <div class="da-agents-bookings">
89 <?php foreach($agents as $agent){
90 $day_off_class = empty($work_time_periods_grouped_by_date_and_agent[$day_date->format('Y-m-d')][$agent->id]) ? 'agent-has-day-off' : ''; ?>
91 <div class="da-agent-bookings-and-periods">
92 <div class="ch-day-periods ch-day-<?php echo esc_attr(strtolower($target_date->format('N'))); ?>">
93
94 <?php for($minutes = $work_boundaries->start_time; $minutes <= $work_boundaries->end_time; $minutes+= $timeblock_interval){ ?>
95 <?php
96 $period_class = 'chd-period';
97 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 ';
98 $period_class.= (($minutes == $work_boundaries->end_time) || (($minutes + $timeblock_interval) > $work_boundaries->end_time)) ? ' last-period' : '';
99 $period_class.= (($minutes % 60) == 0) ? ' chd-period-hour' : ' chd-period-minutes';
100 $btn_data = [ 'start_time'=> $minutes,
101 'start_date' => $target_date->format('Y-m-d'),
102 'agent_id' => $agent->id,
103 'location_id' => is_array($booking_request->location_id) ? $booking_request->location_id[0] : $booking_request->location_id,
104 'service_id' => is_array($booking_request->service_id) ? $booking_request->service_id[0] : $booking_request->service_id ];
105 $btn_params = OsOrdersHelper::quick_order_btn_html(false, $btn_data);
106 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>';
107 ?>
108 <?php } ?>
109
110 </div>
111 <div class="da-agent-bookings">
112 <?php
113 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])){
114 $overlaps_count = 1;
115 $total_attendees_in_group = 0;
116 $total_bookings_in_group = 0;
117 $total_bookings = count($bookings_grouped_by_date_and_agent[$day_date->format('Y-m-d')][$agent->id]);
118 foreach($bookings_grouped_by_date_and_agent[$day_date->format('Y-m-d')][$agent->id] as $index => $booking){
119 $next_booking = (($index + 1) < $total_bookings) ? $bookings_grouped_by_date_and_agent[$day_date->format('Y-m-d')][$agent->id][$index + 1] : false;
120
121 if(OsBookingHelper::check_if_group_bookings($booking, $next_booking)){
122 // skip this output because multiple bookings in the same slot because next booking has the same start and end time
123 $total_attendees_in_group+= $booking->total_attendees;
124 $total_bookings_in_group++;
125 continue;
126 }else{
127 include('_booking_box_on_calendar.php');
128 // time overlaps
129 $overlaps_count = ($next_booking && ($next_booking->start_time < $booking->end_time)) ? $overlaps_count + 1 : 1;
130 // reset
131 $total_attendees_in_group = 0;
132 }
133 }
134 }
135 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]);
136 ?>
137 </div>
138 </div>
139 <?php } ?>
140 </div>
141 </div>
142 </div>
143 <?php }else{ ?>
144 <div class="no-results-w">
145 <div class="icon-w"><i class="latepoint-icon latepoint-icon-calendar"></i></div>
146 <h2><?php esc_html_e('You have not set any working hours for this day.', 'latepoint'); ?></h2>
147 <?php if(OsAuthHelper::is_agent_logged_in()){ ?>
148 <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>
149 <?php }elseif(OsRolesHelper::can_user('settings__edit')){ ?>
150 <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>
151 <?php } ?>
152 </div>
153 <?php } ?>
154 </div>
155 </div>
156 <?php } ?>
157 <?php include('_shared.php'); ?>