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 / services / _form.php
latepoint / lib / views / services Last commit date
_form.php 1 year ago _service_index_item.php 1 year ago edit_form.php 1 year ago index.php 1 year ago new_form.php 1 year ago
_form.php
276 lines
1 <?php
2 if ( ! defined( 'ABSPATH' ) ) {
3 exit; // Exit if accessed directly
4 }
5 ?>
6 <div class="os-form-w">
7 <form action="" data-os-success-action="redirect" data-os-redirect-to="<?php echo esc_url(OsRouterHelper::build_link(OsRouterHelper::build_route_name('services', 'index'))); ?>" data-os-action="<?php echo $service->is_new_record() ? esc_attr(OsRouterHelper::build_route_name('services', 'create')) : esc_attr(OsRouterHelper::build_route_name('services', 'update')); ?>">
8
9 <div class="white-box">
10 <div class="white-box-header">
11 <div class="os-form-sub-header">
12 <h3><?php esc_html_e('General Information', 'latepoint'); ?></h3>
13 <?php if(!$service->is_new_record()){ ?>
14 <div class="os-form-sub-header-actions"><?php echo esc_html__('Service ID:', 'latepoint').esc_html($service->id); ?></div>
15 <?php } ?>
16 </div>
17 </div>
18 <div class="white-box-content">
19 <div class="os-row">
20 <div class="os-col-lg-6">
21 <?php echo OsFormHelper::text_field('service[name]', __('Service Name', 'latepoint'), $service->name, ['theme' => 'simple']); ?>
22 <?php echo OsFormHelper::service_selector_adder_field('service[category_id]', __('Category', 'latepoint'), __('Add Category', 'latepoint'), $service_categories_for_select, $service->category_id); ?>
23 <?php echo OsFormHelper::color_picker('service[bg_color]', __('Background Color', 'latepoint'), $service->bg_color); ?>
24 </div>
25 <div class="os-col-lg-6">
26 <?php echo OsFormHelper::textarea_field('service[short_description]', __('Short Description', 'latepoint'), $service->short_description, array('rows' => 1, 'theme' => 'simple')); ?>
27 <?php echo OsFormHelper::select_field('service[status]', __('Status', 'latepoint'), array(LATEPOINT_SERVICE_STATUS_ACTIVE => __('Active', 'latepoint'), LATEPOINT_SERVICE_STATUS_DISABLED => __('Disabled', 'latepoint')), $service->status); ?>
28 <?php echo OsFormHelper::select_field('service[visibility]', __('Visibility', 'latepoint'), array(LATEPOINT_SERVICE_VISIBILITY_VISIBLE => __('Visible to everyone', 'latepoint'), LATEPOINT_SERVICE_VISIBILITY_HIDDEN => __('Visible only to admins and agents', 'latepoint')), $service->visibility); ?>
29 </div>
30 </div>
31 </div>
32 </div>
33
34
35 <div class="white-box">
36 <div class="white-box-header">
37 <div class="os-form-sub-header"><h3><?php esc_html_e('Media', 'latepoint'); ?></h3></div>
38 </div>
39 <div class="white-box-content">
40
41 <div class="os-row">
42 <div class="os-col-lg-6">
43 <div class="label-with-description">
44 <h3><?php esc_html_e('Selection Image', 'latepoint'); ?></h3>
45 <div class="label-desc"><?php esc_html_e('This image is used on a service selection step in the booking form.', 'latepoint'); ?></div>
46 </div>
47 <?php echo OsFormHelper::media_uploader_field('service[selection_image_id]', 0, __('Step Image', 'latepoint'), __('Remove Image', 'latepoint'), $service->selection_image_id); ?>
48 </div>
49 <div class="os-col-lg-6">
50 <div class="label-with-description">
51 <h3><?php esc_html_e('Service Tile Image', 'latepoint'); ?></h3>
52 <div class="label-desc"><?php esc_html_e('This image is used when service is listed in [latepoint_resources] shortcode.', 'latepoint'); ?></div>
53 </div>
54 <?php echo OsFormHelper::media_uploader_field('service[description_image_id]', 0, __('Step Image', 'latepoint'), __('Remove Image', 'latepoint'), $service->description_image_id); ?>
55 </div>
56 </div>
57 </div>
58 </div>
59 <div class="white-box">
60 <div class="white-box-header">
61 <div class="os-form-sub-header"><h3><?php esc_html_e('Service Duration and Price', 'latepoint'); ?></h3></div>
62 </div>
63 <div class="white-box-content">
64 <div class="service-duration-box">
65 <div class="os-row">
66 <div class="os-col-lg-3">
67 <?php echo OsFormHelper::text_field('service[duration_name]', __('Optional Duration Name', 'latepoint'), $service->duration_name, ['theme' => 'simple']); ?>
68 </div>
69 <div class="os-col-lg-3">
70 <?php echo OsFormHelper::text_field('service[duration]', __('Duration (minutes)', 'latepoint'), $service->duration, ['class' => 'os-mask-minutes', 'theme' => 'simple']); ?>
71 </div>
72 <div class="os-col-lg-3">
73 <?php echo OsFormHelper::money_field('service[charge_amount]', __('Charge Amount', 'latepoint'), $service->charge_amount, ['theme' => 'simple']); ?>
74 </div>
75 <div class="os-col-lg-3">
76 <?php echo OsFormHelper::money_field('service[deposit_amount]', __('Deposit Amount', 'latepoint'), $service->deposit_amount, ['theme' => 'simple']); ?>
77 </div>
78 </div>
79 </div>
80 <?php do_action('latepoint_service_edit_durations', $service); ?>
81 </div>
82 </div>
83 <div class="white-box">
84 <div class="white-box-header">
85 <div class="os-form-sub-header"><h3><?php esc_html_e('Display Price', 'latepoint'); ?></h3></div>
86 </div>
87 <div class="white-box-content">
88 <div class="latepoint-message latepoint-message-subtle"><?php esc_html_e('This price is for display purposes only, it is not the price that the customer will be charged. The Charge Amount field above controls the amount that customer will be charged for. Setting both minimum and maximum price, will show a price range on the service selection step.', 'latepoint'); ?></div>
89 <div class="os-row">
90 <div class="os-col-lg-3">
91 <?php echo OsFormHelper::money_field('service[price_min]', __('Minimum Price', 'latepoint'), $service->price_min, ['theme' => 'simple']); ?>
92 </div>
93 <div class="os-col-lg-3">
94 <?php echo OsFormHelper::money_field('service[price_max]', __('Maximum Price', 'latepoint'), $service->price_max, ['theme' => 'simple']); ?>
95 </div>
96 </div>
97 </div>
98 </div>
99 <div class="white-box">
100 <div class="white-box-header">
101 <div class="os-form-sub-header"><h3><?php esc_html_e('Other Settings', 'latepoint'); ?></h3></div>
102 </div>
103 <div class="white-box-content">
104 <div class="os-row">
105 <div class="os-col-lg-3">
106 <?php echo OsFormHelper::text_field('service[buffer_before]', __('Buffer Before', 'latepoint'), $service->buffer_before, ['class' => 'os-mask-minutes', 'theme' => 'simple']); ?>
107 </div>
108 <div class="os-col-lg-3">
109 <?php echo OsFormHelper::text_field('service[buffer_after]', __('Buffer After', 'latepoint'), $service->buffer_after, ['class' => 'os-mask-minutes', 'theme' => 'simple']); ?>
110 </div>
111 <div class="os-col-lg-3">
112 <?php echo OsFormHelper::text_field('service[timeblock_interval]', __('Override Time Intervals', 'latepoint'), $service->timeblock_interval, ['class' => 'os-mask-minutes', 'theme' => 'simple']); ?>
113 </div>
114 <div class="os-col-lg-3">
115 <?php echo OsFormHelper::select_field('service[override_default_booking_status]', __('Override status for bookings', 'latepoint'), array_merge(['' => __('Use from general settings', 'latepoint')], OsBookingHelper::get_statuses_list()), $service->override_default_booking_status); ?>
116 </div>
117 </div>
118 </div>
119 </div>
120
121 <?php if(OsRolesHelper::can_user('connection__edit')){ ?>
122 <div class="white-box">
123 <div class="white-box-header">
124 <div class="os-form-sub-header">
125 <h3><?php esc_html_e('Agents Who Offer This Service', 'latepoint'); ?></h3>
126 <div class="os-form-sub-header-actions">
127 <?php echo OsFormHelper::checkbox_field('select_all_agents', __('Select All', 'latepoint'), 'off', false, ['class' => 'os-select-all-toggler']); ?>
128 </div>
129 </div>
130 </div>
131 <div class="white-box-content">
132
133 <div class="os-complex-connections-selector">
134 <?php if($agents){
135 foreach($agents as $agent){
136 $is_connected = $service->is_new_record() ? true : $service->has_agent($agent->id);
137 $is_connected_value = $is_connected ? 'yes' : 'no';
138 if($locations){
139 if(count($locations) > 1){
140 // multiple locations
141 $locations_count = $service->count_number_of_connected_locations($agent->id);
142 if($locations_count == count($locations)){
143 $locations_count_string = __('All', 'latepoint');
144 }else{
145 $locations_count_string = $service->is_new_record() ? __('All', 'latepoint') : $locations_count.'/'.count($locations);
146 } ?>
147 <div class="connection <?php echo $is_connected ? 'active' : ''; ?>">
148 <div class="connection-i selector-trigger">
149 <div class="connection-avatar"><img src="<?php echo esc_url($agent->get_avatar_url()); ?>"/></div>
150 <h3 class="connection-name"><?php echo esc_html($agent->full_name); ?></h3>
151 <div class="selected-connections" data-all-text="<?php echo esc_attr__('All', 'latepoint'); ?>">
152 <strong><?php echo esc_html($locations_count_string); ?></strong>
153 <span><?php echo esc_html__('Locations Selected', 'latepoint'); ?></span>
154 </div>
155 <a href="#" class="customize-connection-btn"><i class="latepoint-icon latepoint-icon-ui-46"></i><span><?php echo esc_html__('Customize', 'latepoint'); ?></span></a>
156 </div><?php
157 if($locations){ ?>
158 <div class="connection-children-list-w">
159 <h4>
160 <?php
161 // translators: %s is the name of an agent
162 echo esc_html(sprintf(__('Select locations where %s will be offering this service:', 'latepoint'), $agent->first_name)); ?></h4>
163 <ul class="connection-children-list"><?php
164 foreach($locations as $location){
165 $is_connected = $service->is_new_record() ? true : $location->has_agent_and_service($agent->id, $service->id);
166 $is_connected_value = $is_connected ? 'yes' : 'no'; ?>
167 <li class="<?php echo $is_connected ? 'active' : ''; ?>">
168 <?php echo OsFormHelper::hidden_field('service[agents][agent_'.$agent->id.'][location_'.$location->id.'][connected]', $is_connected_value, array('class' => 'connection-child-is-connected'));?>
169 <?php echo esc_html($location->name); ?>
170 </li>
171 <?php } ?>
172 </ul>
173 </div><?php
174 } ?>
175 </div><?php
176 }else{
177 // one location
178 $location = $locations[0];
179 $is_connected = $service->is_new_record() ? true : $location->has_agent_and_service($agent->id, $service->id);
180 $is_connected_value = $is_connected ? 'yes' : 'no';
181 ?>
182 <div class="connection <?php echo $is_connected ? 'active' : ''; ?>">
183 <div class="connection-i selector-trigger">
184 <div class="connection-avatar"><img src="<?php echo esc_url($agent->get_avatar_url()); ?>"/></div>
185 <h3 class="connection-name"><?php echo esc_html($agent->full_name); ?></h3>
186 <?php echo OsFormHelper::hidden_field('service[agents][agent_'.$agent->id.'][location_'.$location->id.'][connected]', $is_connected_value, array('class' => 'connection-child-is-connected'));?>
187 </div>
188 </div>
189 <?php
190 }
191 }
192 }
193 }else{ ?>
194 <div class="no-results-w">
195 <div class="icon-w"><i class="latepoint-icon latepoint-icon-users"></i></div>
196 <h2><?php esc_html_e('No Existing Agents Found', 'latepoint'); ?></h2>
197 <a href="<?php echo esc_url(OsRouterHelper::build_link(['agents', 'new_form'] )); ?>" class="latepoint-btn"><i class="latepoint-icon latepoint-icon-plus"></i><span><?php esc_html_e('Add First Agent', 'latepoint'); ?></span></a>
198 </div> <?php
199 }
200 ?>
201 </div>
202 </div>
203 </div>
204 <?php } ?>
205 <?php if(OsRolesHelper::can_user('resource_schedule__edit')){ ?>
206 <div class="white-box">
207 <div class="white-box-header">
208 <div class="os-form-sub-header">
209 <h3><?php esc_html_e('Service Schedule', 'latepoint'); ?></h3>
210 <div class="os-form-sub-header-actions">
211 <?php echo OsFormHelper::checkbox_field('is_custom_schedule', __('Set Custom Schedule', 'latepoint'), 'on', $is_custom_schedule, array('data-toggle-element' => '.custom-schedule-wrapper')); ?>
212 </div>
213 </div>
214 </div>
215 <div class="white-box-content">
216 <div class="custom-schedule-wrapper" style="<?php if(!$is_custom_schedule) echo 'display: none;'; ?>">
217 <?php
218 $filter = new \LatePoint\Misc\Filter();
219 if(!$service->is_new_record()) $filter->service_id = $service->id; ?>
220 <?php OsWorkPeriodsHelper::generate_work_periods($custom_work_periods, $filter, $service->is_new_record()); ?>
221 </div>
222 <div class="custom-schedule-wrapper" style="<?php if($is_custom_schedule) echo 'display: none;'; ?>">
223 <div class="latepoint-message latepoint-message-subtle"><?php esc_html_e('This service is using general schedule which is set in main settings', 'latepoint'); ?></div>
224 </div>
225 </div>
226 </div>
227
228 <?php if(!$service->is_new_record()){ ?>
229
230
231 <div class="white-box">
232 <div class="white-box-header">
233 <div class="os-form-sub-header"><h3><?php esc_html_e('Days With Custom Schedules', 'latepoint'); ?></h3></div>
234 </div>
235 <div class="white-box-content">
236 <div class="latepoint-message latepoint-message-subtle"><?php esc_html_e('Service shares custom daily schedules that you set in general settings for your company, however you can add additional days with custom hours which will be specific to this service only.', 'latepoint'); ?></div>
237 <?php OsWorkPeriodsHelper::generate_days_with_custom_schedule(['service_id' => $service->id]); ?>
238 </div>
239 </div>
240 <div class="white-box">
241 <div class="white-box-header">
242 <div class="os-form-sub-header"><h3><?php esc_html_e('Holidays & Days Off', 'latepoint'); ?></h3></div>
243 </div>
244 <div class="white-box-content">
245 <div class="latepoint-message latepoint-message-subtle"><?php esc_html_e('Service uses the same holidays you set in general settings for your company, however you can add additional holidays for this service here.', 'latepoint'); ?></div>
246 <?php OsWorkPeriodsHelper::generate_off_days(['service_id' => $service->id]); ?>
247 </div>
248 </div>
249 <?php } ?>
250 <?php } ?>
251 <?php do_action('latepoint_service_form_after', $service); ?>
252 <div class="os-form-buttons os-flex">
253 <?php
254 if($service->is_new_record()){
255 echo OsFormHelper::hidden_field('service[id]', '');
256 echo OsFormHelper::button('submit', __('Add Service', 'latepoint'), 'submit', ['class' => 'latepoint-btn']);
257 }else{
258 echo OsFormHelper::hidden_field('service[id]', $service->id);
259 if(OsRolesHelper::can_user('service__edit')) {
260 echo OsFormHelper::button('submit', __('Save Changes', 'latepoint'), 'submit', ['class' => 'latepoint-btn']);
261 }
262 if(OsRolesHelper::can_user('service__delete')) {
263 echo '<a href="#" class="latepoint-btn latepoint-btn-danger remove-service-btn" style="margin-left: auto;"
264 data-os-prompt="' . esc_attr__('Are you sure you want to remove this service? It will remove all appointments associated with it. You can also change status to disabled if you want to temprorary disable it instead.', 'latepoint') . '"
265 data-os-redirect-to="' . esc_url(OsRouterHelper::build_link(OsRouterHelper::build_route_name('services', 'index'))) . '"
266 data-os-params="' . esc_attr(OsUtilHelper::build_os_params(['id' => $service->id], 'destroy_service_'.$service->id)) . '"
267 data-os-success-action="redirect"
268 data-os-action="' . esc_attr(OsRouterHelper::build_route_name('services', 'destroy')) . '">' . esc_html__('Delete Service', 'latepoint') . '</a>';
269 }
270 }
271
272 ?>
273 </div>
274 <?php wp_nonce_field($service->is_new_record() ? 'new_service' : 'edit_service_'.$service->id); ?>
275 </form>
276 </div>