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 / _week.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
_week.php
118 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 ?>
57 <div class="ch-day-periods-i">
58 <div class="ch-day ch-day-<?php echo esc_attr(strtolower($day_date->format('N'))); ?> <?php if($today_date == $day_date) echo 'is-today'; ?>">
59 <span><?php echo esc_html(OsUtilHelper::get_weekday_name_by_number($day_date->format('N'), true)); ?></span>
60 <strong><?php echo esc_html($day_date->format('j')); ?></strong>
61 </div>
62 <?php
63 $day_off_class = empty($work_time_periods_grouped_by_date_and_agent[$day_date->format('Y-m-d')][$agent->id]) ? 'agent-has-day-off' : ''; ?>
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
66 <?php for($minutes = $work_boundaries->start_time; $minutes <= $work_boundaries->end_time; $minutes+= $timeblock_interval){ ?>
67 <?php
68 $period_class = 'chd-period';
69 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 ';
70 $period_class.= (($minutes == $work_boundaries->end_time) || (($minutes + $timeblock_interval) > $work_boundaries->end_time)) ? ' last-period' : '';
71 $period_class.= (($minutes % 60) == 0) ? ' chd-period-hour' : ' chd-period-minutes';
72 $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]);
73 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>';
74 ?>
75 <?php } ?>
76
77 <?php
78 if($bookings_grouped_by_date_and_agent[$day_date->format('Y-m-d')][$agent->id]){
79 $overlaps_count = 1;
80 $total_attendees_in_group = 0;
81 $total_bookings_in_group = 0;
82 $total_bookings = count($bookings_grouped_by_date_and_agent[$day_date->format('Y-m-d')][$agent->id]);
83 foreach($bookings_grouped_by_date_and_agent[$day_date->format('Y-m-d')][$agent->id] as $index => $booking){
84 $next_booking = (($index + 1) < $total_bookings) ? $bookings_grouped_by_date_and_agent[$day_date->format('Y-m-d')][$agent->id][$index + 1] : false;
85
86 if(OsBookingHelper::check_if_group_bookings($booking, $next_booking)){
87 // skip this output because multiple bookings in the same slot because next booking has the same start and end time
88 $total_attendees_in_group+= $booking->total_attendees;
89 $total_bookings_in_group++;
90 continue;
91 }else{
92 include('_booking_box_on_calendar.php');
93 // time overlaps
94 $overlaps_count = ($next_booking && ($next_booking->start_time < $booking->end_time)) ? $overlaps_count + 1 : 1;
95 // reset
96 $total_attendees_in_group = 0;
97 }
98 }
99 }
100 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]);
101 ?>
102 </div>
103 </div>
104 <?php } ?>
105 </div>
106 </div>
107 </div>
108 <?php } ?>
109 <?php }else{ ?>
110 <div class="no-results-w">
111 <div class="icon-w"><i class="latepoint-icon latepoint-icon-calendar"></i></div>
112 <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>
113 <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>
114 </div>
115 <?php } ?>
116 </div>
117 </div>
118 <?php include('_shared.php'); ?>