PluginProbe ʕ •ᴥ•ʔ
LatePoint – Calendar Booking Plugin for Appointments and Events / 5.1.3
LatePoint – Calendar Booking Plugin for Appointments and Events v5.1.3
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 / view.php
latepoint / lib / views / calendars Last commit date
scopes 1 year ago load_monthly_calendar_days_only.php 1 year ago missing_resources.php 1 year ago view.php 1 year ago
view.php
189 lines
1 <?php
2 /*
3 * Copyright (c) 2023 LatePoint LLC. All rights reserved.
4 */
5
6 /**
7 *
8 * @var $target_date OsWpDateTime
9 * @var $today_date OsWpDateTime
10 * @var $calendar_settings array
11 * @var $locations OsLocationModel[]
12 * @var $services OsServiceModel[]
13 * @var $agents OsAgentModel[]
14 * @var $categorized_services_list array
15 */
16
17
18 if ( ! defined( 'ABSPATH' ) ) {
19 exit; // Exit if accessed directly
20 }
21
22 if(!empty($services) && !empty($agents)){ ?>
23 <div class="calendar-wrapper" data-view="<?php echo esc_attr($calendar_settings['view']); ?>">
24 <form class="os-calendar-settings-form" action="">
25 <div class="os-calendar-settings-main">
26 <div class="os-current-month-label-w calendar-mobile-controls">
27 <div class="os-current-month-label">
28 <div class="current-month">
29 <?php echo esc_html($top_date_label); ?>
30 </div>
31 <div class="current-year"><?php echo esc_html($target_date->format('Y')); ?></div>
32 </div>
33 <div class="cc-actions">
34
35 <a href="#" class="cc-action-today os-calendar-today-btn calendar-load-target-date" data-target-date="<?php echo esc_attr($today_date->format('Y-m-d')); ?>">
36 <span><?php esc_html_e('Today', 'latepoint'); ?></span>
37 </a>
38 <div class="cc-navigate-arrows">
39 <a href="#" class="cc-action-prev os-calendar-prev-btn"><i class="latepoint-icon latepoint-icon-arrow-left"></i></a>
40 <a href="#" class="cc-action-next os-calendar-next-btn"><i class="latepoint-icon latepoint-icon-arrow-right"></i></a>
41 </div>
42 </div>
43 <div class="cc-view">
44 <?php
45 $views = ['day' => __('Day', 'latepoint'), 'week' => __('Week', 'latepoint'), 'month' => __('Month', 'latepoint'), 'list' => __('List', 'latepoint')];
46 echo OsFormHelper::select_field('calendar_settings[view]', false, $views, $calendar_settings['view']); ?>
47 </div>
48 <?php if(count($services) > 1 || count($agents) > 1 || count($locations) > 1){ ?>
49 <div class="os-calendar-settings-toggler-wrapper">
50 <a href="#" class="calendar-settings-toggler"><i class="latepoint-icon latepoint-icon-more-horizontal"></i></a>
51 </div>
52 <?php } ?>
53 </div>
54 </div>
55 <div class="os-calendar-settings-extra">
56 <?php if(count($services) > 1){ ?>
57 <div class="cc-availability-toggler-w">
58 <div class="cc-availability-toggler"><?php echo OsFormHelper::toggler_field('calendar_settings[overlay_service_availability]', __('Overlay service hours', 'latepoint'), ($calendar_settings['availability_service_id'] ? true : false), 'cc-service-availability-selector'); ?></div>
59 <div class="cc-service-availability-selector" id="cc-service-availability-selector">
60 <?php echo OsFormHelper::select_field('calendar_settings[availability_service_id]', __('For:', 'latepoint'), OsUtilHelper::models_to_select_options($services, 'id', 'name'), $calendar_settings['availability_service_id']); ?>
61 </div>
62 </div>
63 <?php } ?>
64 <div class="resource-filters-wrapper">
65 <?php if(count($services) > 1){ ?>
66 <div class="latecheckbox-w">
67 <a href="#" class="latecheckbox">
68 <div class="filter-label"><?php esc_html_e('Services:', 'latepoint'); ?></div>
69 <div class="filter-value"><?php esc_html_e('All', 'latepoint'); ?></div>
70 </a>
71 <div class="latecheckbox-options-w">
72 <?php if(count($services) >= 5){ ?>
73 <div class="latecheckbox-filter-input-w">
74 <input class="latecheckbox-all-check" type="checkbox" checked/>
75 <input class="latecheckbox-filter-input" type="text" placeholder="<?php esc_attr_e('Type to filter...', 'latepoint'); ?>"/>
76 </div>
77 <?php } ?>
78 <div class="latecheckbox-options">
79 <?php if(!empty($categorized_services_list)){
80 foreach($categorized_services_list as $category){
81 if(empty($category['items'])) continue;
82 echo '<div class="latecheckbox-group">';
83 echo '<div class="latecheckbox-group-heading"><label><input type="checkbox" class="latecheckbox-group-check" checked/><span>'.esc_html($category['name']).'</span></label></div>';
84 echo '<div class="latecheckbox-group-options">';
85 foreach($category['items'] as $service){
86 echo '<div class="latecheckbox-option">';
87 echo '<label>';
88 echo '<input name="calendar_settings[show_service_ids][]" type="checkbox" checked value="'.esc_attr($service->id).'"/>';
89 echo '<span>'.esc_html($service->name).'</span>';
90 echo '</label>';
91 echo '</div>';
92 }
93 echo '</div>';
94 echo '</div>';
95 }
96 }else{
97 foreach($services as $service) {
98 echo '<div class="latecheckbox-option">';
99 echo '<label>';
100 echo '<input name="calendar_settings[show_service_ids][]" type="checkbox" checked value="' . esc_attr($service->id) . '"/>';
101 echo '<span class="late-label">' . esc_html($service->name) . '</span>';
102 echo '</label>';
103 echo '</div>';
104 }
105 }
106 ?>
107 </div>
108 </div>
109 </div>
110 <?php } ?>
111 <?php if(count($locations) > 1){ ?>
112 <div class="latecheckbox-w">
113 <a href="#" class="latecheckbox">
114 <div class="filter-label"><?php esc_html_e('Locations:', 'latepoint'); ?></div>
115 <div class="filter-value"><?php esc_html_e('All', 'latepoint'); ?></div>
116 </a>
117 <div class="latecheckbox-options-w">
118 <?php if(count($locations) >= 5){ ?>
119 <div class="latecheckbox-filter-input-w">
120 <input class="latecheckbox-all-check" type="checkbox" checked/>
121 <input class="latecheckbox-filter-input" type="text" placeholder="<?php esc_attr_e('Type to filter...', 'latepoint'); ?>"/>
122 </div>
123 <?php } ?>
124 <div class="latecheckbox-options">
125 <?php foreach($locations as $location){
126 echo '<div class="latecheckbox-option">';
127 echo '<label>';
128 echo '<input name="calendar_settings[show_location_ids][]" type="checkbox" checked value="'.esc_attr($location->id).'"/>';
129 echo '<span class="late-label">'.esc_html($location->name).'</span>';
130 echo '</label>';
131 echo '</div>';
132 }
133 ?>
134 </div>
135 </div>
136 </div>
137
138 <?php } ?>
139 <?php if(count($agents) > 1){ ?>
140 <div class="latecheckbox-w">
141 <a href="#" class="latecheckbox">
142 <div class="filter-label"><?php esc_html_e('Agents:', 'latepoint'); ?></div>
143 <div class="filter-value"><?php esc_html_e('All', 'latepoint'); ?></div>
144 </a>
145 <div class="latecheckbox-options-w">
146 <?php if(count($agents) >= 5){ ?>
147 <div class="latecheckbox-filter-input-w">
148 <input class="latecheckbox-all-check" type="checkbox" checked/>
149 <input class="latecheckbox-filter-input" type="text" placeholder="<?php esc_attr_e('Type to filter...', 'latepoint'); ?>"/>
150 </div>
151 <?php } ?>
152 <div class="latecheckbox-options">
153 <?php foreach($agents as $agent){
154 echo '<div class="latecheckbox-option">';
155 echo '<label>';
156 echo '<input name="calendar_settings[show_agent_ids][]" type="checkbox" checked value="'.esc_attr($agent->id).'"/>';
157 echo '<span class="late-avatar" style="background-image: url('.esc_url($agent->get_avatar_url()).')"></span>';
158 echo '<span class="late-label">'.esc_html($agent->full_name).'</span>';
159 echo '</label>';
160 echo '</div>';
161 }
162 ?>
163 </div>
164 </div>
165 </div>
166 <?php } ?>
167 </div>
168 <?php
169 echo OsFormHelper::hidden_field('calendar_settings[target_date_string]', $target_date->format('Y-m-d'));
170 echo OsFormHelper::hidden_field('calendar_settings[selected_agent_id]', $calendar_settings['selected_agent_id']);
171 ?>
172 </div>
173 </form>
174 <div class="calendar-view-wrapper" data-route="<?php echo esc_attr(OsRouterHelper::build_route_name('calendars', 'view')); ?>">
175 <?php include_once('scopes/_'.$calendar_settings['view'].'.php'); ?>
176 </div>
177 </div>
178 <?php
179 }else{ ?>
180 <div class="no-results-w">
181 <div class="icon-w"><i class="latepoint-icon latepoint-icon-grid"></i></div>
182 <h2><?php esc_html_e('No Agents or Services Created', 'latepoint'); ?></h2>
183 <?php if(OsAuthHelper::is_admin_logged_in()){ ?>
184 <a href="<?php echo esc_url(OsRouterHelper::build_link(['agents', 'new_form'] )); ?>" class="latepoint-btn"><i class="latepoint-icon latepoint-icon-plus-square"></i><span><?php esc_html_e('Create Agent', 'latepoint'); ?></span></a>
185 <a href="<?php echo esc_url(OsRouterHelper::build_link(['services', 'new_form'] )); ?>" class="latepoint-btn"><i class="latepoint-icon latepoint-icon-plus-square"></i><span><?php esc_html_e('Create Service', 'latepoint'); ?></span></a>
186 <?php } ?>
187 </div>
188 <?php
189 }