PluginProbe ʕ •ᴥ•ʔ
LatePoint – Calendar Booking Plugin for Appointments and Events / 5.4.2
LatePoint – Calendar Booking Plugin for Appointments and Events v5.4.2
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 9 months ago _service_index_item.php 9 months ago edit_form.php 1 year ago index.php 9 months ago new_form.php 1 year ago
_form.php
380 lines
1 <?php
2 /* @var $service OsServiceModel */
3
4 if ( ! defined( 'ABSPATH' ) ) {
5 exit; // Exit if accessed directly
6 }
7 ?>
8 <form action="" data-os-success-action="redirect" data-os-redirect-to="<?php echo esc_url( OsRouterHelper::build_link( OsRouterHelper::build_route_name( 'services', 'index' ) ) ); ?>"
9 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' ) ); ?>">
10 <div class="latepoint-page-with-side-nav">
11 <div class="os-form-w">
12
13 <div class="white-box section-anchor" id="stickySectionGeneral">
14 <div class="white-box-header">
15 <div class="os-form-sub-header">
16 <h3><?php esc_html_e( 'General', 'latepoint' ); ?></h3>
17 <?php if ( ! $service->is_new_record() ) { ?>
18 <div class="os-form-sub-header-actions os-highlight"><?php echo sprintf( esc_html__( 'Service ID: %d', 'latepoint' ), esc_html( $service->id ) ); ?></div>
19 <?php } ?>
20 </div>
21 </div>
22 <div class="white-box-content">
23 <div class="os-row">
24 <div class="os-col-lg-6">
25 <?php echo OsFormHelper::text_field( 'service[name]', __( 'Service Name', 'latepoint' ), $service->name, [ 'theme' => 'simple' ] ); ?>
26 <?php echo OsFormHelper::service_selector_adder_field( 'service[category_id]', __( 'Category', 'latepoint' ), __( 'Add Category', 'latepoint' ), $service_categories_for_select, $service->category_id ); ?>
27 <?php echo OsFormHelper::color_picker( 'service[bg_color]', __( 'Background Color', 'latepoint' ), $service->bg_color ); ?>
28 </div>
29 <div class="os-col-lg-6">
30 <?php echo OsFormHelper::textarea_field( 'service[short_description]', __( 'Short Description', 'latepoint' ), $service->short_description, array(
31 'rows' => 1,
32 'theme' => 'simple'
33 ) ); ?>
34 <?php echo OsFormHelper::select_field( 'service[status]', __( 'Status', 'latepoint' ), array(
35 LATEPOINT_SERVICE_STATUS_ACTIVE => __( 'Active', 'latepoint' ),
36 LATEPOINT_SERVICE_STATUS_DISABLED => __( 'Disabled', 'latepoint' )
37 ), $service->status ); ?>
38 <?php echo OsFormHelper::select_field( 'service[visibility]', __( 'Visibility', 'latepoint' ), array(
39 LATEPOINT_SERVICE_VISIBILITY_VISIBLE => __( 'Visible to everyone', 'latepoint' ),
40 LATEPOINT_SERVICE_VISIBILITY_HIDDEN => __( 'Visible only to admins and agents', 'latepoint' )
41 ), $service->visibility ); ?>
42 </div>
43 </div>
44 </div>
45 </div>
46
47
48 <div class="white-box section-anchor" id="stickySectionMedia">
49 <div class="white-box-header">
50 <div class="os-form-sub-header"><h3><?php esc_html_e( 'Media', 'latepoint' ); ?></h3></div>
51 </div>
52 <div class="white-box-content">
53
54 <div class="os-row">
55 <div class="os-col-lg-6">
56 <div class="label-with-description">
57 <h3><?php esc_html_e( 'Selection Image', 'latepoint' ); ?></h3>
58 <div class="label-desc"><?php esc_html_e( 'This image is used on a service selection step in the booking form.', 'latepoint' ); ?></div>
59 </div>
60 <?php echo OsFormHelper::media_uploader_field( 'service[selection_image_id]', 0, __( 'Step Image', 'latepoint' ), __( 'Remove Image', 'latepoint' ), $service->selection_image_id ); ?>
61 </div>
62 <div class="os-col-lg-6">
63 <div class="label-with-description">
64 <h3><?php esc_html_e( 'Service Tile Image', 'latepoint' ); ?></h3>
65 <div class="label-desc"><?php esc_html_e( 'This image is used when service is listed in [latepoint_resources] shortcode.', 'latepoint' ); ?></div>
66 </div>
67 <?php echo OsFormHelper::media_uploader_field( 'service[description_image_id]', 0, __( 'Step Image', 'latepoint' ), __( 'Remove Image', 'latepoint' ), $service->description_image_id ); ?>
68 </div>
69 </div>
70 </div>
71 </div>
72 <div class="white-box section-anchor" id="stickySectionDurations">
73 <div class="white-box-header">
74 <div class="os-form-sub-header"><h3><?php esc_html_e( 'Durations and Price', 'latepoint' ); ?></h3></div>
75 </div>
76 <div class="white-box-content">
77 <div class="service-duration-box">
78 <div class="os-row">
79 <div class="os-col-lg-3">
80 <?php echo OsFormHelper::text_field( 'service[duration_name]', __( 'Duration Name (optional)', 'latepoint' ), $service->duration_name, [ 'theme' => 'simple' ] ); ?>
81 </div>
82 <div class="os-col-lg-3">
83 <?php echo OsFormHelper::text_field( 'service[duration]', __( 'Duration', 'latepoint' ), $service->duration, [ 'class' => 'os-mask-minutes', 'theme' => 'simple' ] ); ?>
84 </div>
85 <div class="os-col-lg-3">
86 <?php echo OsFormHelper::money_field( 'service[charge_amount]', __( 'Charge Amount', 'latepoint' ), $service->charge_amount, [ 'theme' => 'simple' ] ); ?>
87 </div>
88 <div class="os-col-lg-3">
89 <?php echo OsFormHelper::money_field( 'service[deposit_amount]', __( 'Deposit Amount', 'latepoint' ), $service->deposit_amount, [ 'theme' => 'simple' ] ); ?>
90 </div>
91 </div>
92 </div>
93 <?php do_action( 'latepoint_service_edit_durations', $service ); ?>
94 </div>
95 </div>
96 <div class="white-box section-anchor" id="stickySectionDisplayPrice">
97 <div class="white-box-header">
98 <div class="os-form-sub-header"><h3><?php esc_html_e( 'Display Price', 'latepoint' ); ?></h3></div>
99 </div>
100 <div class="white-box-content">
101 <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>
102 <div class="os-row">
103 <div class="os-col-lg-3">
104 <?php echo OsFormHelper::money_field( 'service[price_min]', __( 'Minimum Price', 'latepoint' ), $service->price_min, [ 'theme' => 'simple' ] ); ?>
105 </div>
106 <div class="os-col-lg-3">
107 <?php echo OsFormHelper::money_field( 'service[price_max]', __( 'Maximum Price', 'latepoint' ), $service->price_max, [ 'theme' => 'simple' ] ); ?>
108 </div>
109 </div>
110 </div>
111 </div>
112
113 <?php if ( OsRolesHelper::can_user( 'connection__edit' ) ) { ?>
114 <div class="white-box section-anchor" id="stickySectionAgents">
115 <div class="white-box-header">
116 <div class="os-form-sub-header">
117 <h3><?php esc_html_e( 'Agents Who Offer This Service', 'latepoint' ); ?></h3>
118 <div class="os-form-sub-header-actions">
119 <?php echo OsFormHelper::checkbox_field( 'select_all_agents', __( 'Select All', 'latepoint' ), 'off', false, [ 'class' => 'os-select-all-toggler' ] ); ?>
120 </div>
121 </div>
122 </div>
123 <div class="white-box-content">
124
125 <div class="os-complex-connections-selector">
126 <?php if ( $agents ) {
127 foreach ( $agents as $agent ) {
128 $is_connected = $service->is_new_record() ? true : $service->has_agent( $agent->id );
129 $is_connected_value = $is_connected ? 'yes' : 'no';
130 if ( $locations ) {
131 if ( count( $locations ) > 1 ) {
132 // multiple locations
133 $locations_count = $service->count_number_of_connected_locations( $agent->id );
134 if ( $locations_count == count( $locations ) ) {
135 $locations_count_string = __( 'All', 'latepoint' );
136 } else {
137 $locations_count_string = $service->is_new_record() ? __( 'All', 'latepoint' ) : $locations_count . '/' . count( $locations );
138 } ?>
139 <div class="connection <?php echo $is_connected ? 'active' : ''; ?>">
140 <div class="connection-i selector-trigger">
141 <div class="connection-avatar"><img src="<?php echo esc_url( $agent->get_avatar_url() ); ?>"/></div>
142 <h3 class="connection-name"><?php echo esc_html( $agent->full_name ); ?></h3>
143 <div class="selected-connections" data-all-text="<?php echo esc_attr__( 'All', 'latepoint' ); ?>">
144 <strong><?php echo esc_html( $locations_count_string ); ?></strong>
145 <span><?php echo esc_html__( 'Locations Selected', 'latepoint' ); ?></span>
146 </div>
147 <a href="#" class="customize-connection-btn"><i
148 class="latepoint-icon latepoint-icon-ui-46"></i><span><?php echo esc_html__( 'Customize', 'latepoint' ); ?></span></a>
149 </div><?php
150 if ( $locations ) { ?>
151 <div class="connection-children-list-w">
152 <h4>
153 <?php
154 // translators: %s is the name of an agent
155 echo esc_html( sprintf( __( 'Select locations where %s will be offering this service:', 'latepoint' ), $agent->first_name ) ); ?></h4>
156 <ul class="connection-children-list"><?php
157 foreach ( $locations as $location ) {
158 $is_connected = $service->is_new_record() ? true : $location->has_agent_and_service( $agent->id, $service->id );
159 $is_connected_value = $is_connected ? 'yes' : 'no'; ?>
160 <li class="<?php echo $is_connected ? 'active' : ''; ?>">
161 <?php echo OsFormHelper::hidden_field( 'service[agents][agent_' . $agent->id . '][location_' . $location->id . '][connected]', $is_connected_value, array( 'class' => 'connection-child-is-connected' ) ); ?>
162 <?php echo esc_html( $location->name ); ?>
163 </li>
164 <?php } ?>
165 </ul>
166 </div><?php
167 } ?>
168 </div><?php
169 } else {
170 // one location
171 $location = $locations[0];
172 $is_connected = $service->is_new_record() ? true : $location->has_agent_and_service( $agent->id, $service->id );
173 $is_connected_value = $is_connected ? 'yes' : 'no';
174 ?>
175 <div class="connection <?php echo $is_connected ? 'active' : ''; ?>">
176 <div class="connection-i selector-trigger">
177 <div class="connection-avatar"><img src="<?php echo esc_url( $agent->get_avatar_url() ); ?>"/></div>
178 <h3 class="connection-name"><?php echo esc_html( $agent->full_name ); ?></h3>
179 <?php echo OsFormHelper::hidden_field( 'service[agents][agent_' . $agent->id . '][location_' . $location->id . '][connected]', $is_connected_value, array( 'class' => 'connection-child-is-connected' ) ); ?>
180 </div>
181 </div>
182 <?php
183 }
184 }
185 }
186 } else { ?>
187 <div class="no-results-w">
188 <div class="icon-w"><i class="latepoint-icon latepoint-icon-users"></i></div>
189 <h2><?php esc_html_e( 'No Existing Agents Found', 'latepoint' ); ?></h2>
190 <a href="<?php echo esc_url( OsRouterHelper::build_link( [ 'agents', 'new_form' ] ) ); ?>" class="latepoint-btn"><i
191 class="latepoint-icon latepoint-icon-plus"></i><span><?php esc_html_e( 'Add First Agent', 'latepoint' ); ?></span></a>
192 </div> <?php
193 }
194 ?>
195 </div>
196 </div>
197 </div>
198 <?php } ?>
199
200 <div class="white-box section-anchor" id="stickySectionRestrictions">
201 <div class="white-box-header">
202 <div class="os-form-sub-header">
203 <h3><?php esc_html_e( 'Booking Restrictions', 'latepoint' ); ?></h3>
204 </div>
205 </div>
206 <div class="white-box-content">
207 <div class="sub-section-content">
208 <div class="latepoint-message latepoint-message-subtle"><?php esc_html_e( 'You can set restrictions on earliest/latest dates in the future when your customer can place an appointment. You can either use a relative values like for example "+1 month", "+2 weeks", "+5 days", "+3 hours", "+30 minutes" (entered without quotes), or you can use a fixed date in format YYYY-MM-DD. Leave blank and it will use default restrictions set in general settings.', 'latepoint' ); ?></div>
209 <div class="os-row">
210 <div class="os-col-lg-6">
211 <?php echo OsFormHelper::text_field( 'service[earliest_possible_booking]', __( 'Earliest Possible Booking', 'latepoint' ), $service->earliest_possible_booking, [ 'theme' => 'simple' ] ); ?>
212 </div>
213 <div class="os-col-lg-6">
214 <?php echo OsFormHelper::text_field( 'service[latest_possible_booking]', __( 'Latest Possible Booking', 'latepoint' ), $service->latest_possible_booking, [ 'theme' => 'simple' ] ); ?>
215 </div>
216 </div>
217 </div>
218 </div>
219 </div>
220 <?php if ( OsRolesHelper::can_user( 'resource_schedule__edit' ) ) { ?>
221 <div class="white-box section-anchor" id="stickySectionSchedule">
222 <div class="white-box-header">
223 <div class="os-form-sub-header">
224 <h3><?php esc_html_e( 'Service Schedule', 'latepoint' ); ?></h3>
225 <div class="os-form-sub-header-actions">
226 <?php echo OsFormHelper::checkbox_field( 'is_custom_schedule', __( 'Set Custom Schedule', 'latepoint' ), 'on', $is_custom_schedule, array( 'data-toggle-element' => '.custom-schedule-wrapper' ) ); ?>
227 </div>
228 </div>
229 </div>
230 <div class="white-box-content">
231 <div class="custom-schedule-wrapper" style="<?php if ( ! $is_custom_schedule ) {
232 echo 'display: none;';
233 } ?>">
234 <?php
235 $filter = new \LatePoint\Misc\Filter();
236 if ( ! $service->is_new_record() ) {
237 $filter->service_id = $service->id;
238 } ?>
239 <?php OsWorkPeriodsHelper::generate_work_periods( $custom_work_periods, $filter, $service->is_new_record() ); ?>
240 </div>
241 <div class="custom-schedule-wrapper" style="<?php if ( $is_custom_schedule ) {
242 echo 'display: none;';
243 } ?>">
244 <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>
245 </div>
246 </div>
247 </div>
248
249 <?php if ( ! $service->is_new_record() ) { ?>
250
251
252 <div class="white-box section-anchor" id="stickySectionCustomDays">
253 <div class="white-box-header">
254 <div class="os-form-sub-header"><h3><?php esc_html_e( 'Days With Custom Schedules', 'latepoint' ); ?></h3></div>
255 </div>
256 <div class="white-box-content">
257 <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>
258 <?php OsWorkPeriodsHelper::generate_days_with_custom_schedule( [ 'service_id' => $service->id ] ); ?>
259 </div>
260 </div>
261 <div class="white-box section-anchor" id="stickySectionHolidays">
262 <div class="white-box-header">
263 <div class="os-form-sub-header"><h3><?php esc_html_e( 'Holidays & Days Off', 'latepoint' ); ?></h3></div>
264 </div>
265 <div class="white-box-content">
266 <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>
267 <?php OsWorkPeriodsHelper::generate_off_days( [ 'service_id' => $service->id ] ); ?>
268 </div>
269 </div>
270 <?php } ?>
271 <?php } ?>
272
273 <div class="white-box section-anchor" id="stickySectionOther">
274 <div class="white-box-header">
275 <div class="os-form-sub-header"><h3><?php esc_html_e( 'Other Settings', 'latepoint' ); ?></h3></div>
276 </div>
277 <div class="white-box-content">
278 <div class="os-row">
279 <div class="os-col-lg-3">
280 <?php echo OsFormHelper::text_field( 'service[buffer_before]', __( 'Buffer Before', 'latepoint' ), $service->buffer_before, [
281 'class' => 'os-mask-minutes',
282 'theme' => 'simple'
283 ] ); ?>
284 </div>
285 <div class="os-col-lg-3">
286 <?php echo OsFormHelper::text_field( 'service[buffer_after]', __( 'Buffer After', 'latepoint' ), $service->buffer_after, [
287 'class' => 'os-mask-minutes',
288 'theme' => 'simple'
289 ] ); ?>
290 </div>
291 <div class="os-col-lg-3">
292 <?php echo OsFormHelper::text_field( 'service[timeblock_interval]', __( 'Override Time Intervals', 'latepoint' ), $service->timeblock_interval, [
293 'class' => 'os-mask-minutes',
294 'theme' => 'simple'
295 ] ); ?>
296 </div>
297 <div class="os-col-lg-3">
298 <?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 ); ?>
299 </div>
300 </div>
301 </div>
302 </div>
303 <?php do_action( 'latepoint_service_form_after', $service ); ?>
304 <div class="os-form-buttons os-flex hidden-with-side-nav">
305 <?php
306 $extra_actions_html = '';
307 if ( $service->is_new_record() ) {
308 echo OsFormHelper::hidden_field( 'service[id]', '' );
309 echo OsFormHelper::button( 'submit', __( 'Add Service', 'latepoint' ), 'submit', [ 'class' => 'latepoint-btn' ] );
310 } else {
311 echo OsFormHelper::hidden_field( 'service[id]', $service->id );
312
313 if ( OsRolesHelper::can_user( 'service__delete' ) || OsRolesHelper::can_user( 'service__edit' ) ) {
314 $extra_actions_html.= '<div class="os-trigger-dots"><div class="os-trigger-dots-context">';
315 if ( OsRolesHelper::can_user( 'service__delete' ) ) {
316 $extra_actions_html .= '<div class="os-context-item os-danger" 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' ) . '"
317 data-os-redirect-to="' . esc_url( OsRouterHelper::build_link( OsRouterHelper::build_route_name( 'services', 'index' ) ) ) . '"
318 data-os-params="' . esc_attr( OsUtilHelper::build_os_params( [ 'id' => $service->id ], 'destroy_service_' . $service->id ) ) . '"
319 data-os-success-action="redirect"
320 data-os-action="' . esc_attr( OsRouterHelper::build_route_name( 'services', 'destroy' ) ) . '"><i class="latepoint-icon latepoint-icon-trash-2"></i><span>' . esc_html__( 'Delete', 'latepoint' ) . '</span></div>';
321 }
322 if ( OsRolesHelper::can_user( 'service__edit' ) ) {
323 $extra_actions_html .= '<div class="os-context-item" data-os-prompt="' . __( 'Are you sure you want to duplicate this service?', 'latepoint' ) . '"
324 data-os-success-action="redirect"
325 data-os-params="' . OsUtilHelper::build_os_params( [ 'id' => $service->id ], 'duplicate_service_' . $service->id ) . '"
326 data-os-action="' . OsRouterHelper::build_route_name( 'services', 'duplicate' ) . '"><i class="latepoint-icon latepoint-icon-copy"></i><span>' . esc_html__( 'Duplicate', 'latepoint' ) . '</span></div>';
327 }
328 $extra_actions_html .= '</div><i class="latepoint-icon latepoint-icon-more-horizontal"></i></div>';
329 echo $extra_actions_html;
330 if ( OsRolesHelper::can_user( 'service__edit' ) ) {
331 echo OsFormHelper::button( 'submit', __( 'Save Changes', 'latepoint' ), 'submit', [ 'class' => 'latepoint-btn' ] );
332 }
333 }
334 }
335
336 ?>
337 </div>
338 <?php wp_nonce_field( $service->is_new_record() ? 'new_service' : 'edit_service_' . $service->id ); ?>
339 </div>
340
341 <div class="latepoint-page-side-nav">
342 <?php if ( OsRolesHelper::can_user( 'service__edit' ) ) { ?>
343 <div class="side-nav-actions">
344 <?php echo $extra_actions_html; ?>
345 <button type="submit" class="latepoint-btn latepoint-btn-block"><i class="latepoint-icon latepoint-icon-check"></i><span><?php _e( 'Save Changes', 'latepoint' ); ?></span></button>
346 </div>
347 <?php } ?>
348 <div class="side-nav-body">
349 <div><a href="#stickySectionGeneral" class="is-active"><?php esc_html_e( 'General', 'latepoint' ); ?></a></div>
350 <div><a href="#stickySectionMedia"><?php esc_html_e( 'Media', 'latepoint' ); ?></a></div>
351 <div><a href="#stickySectionDurations"><?php esc_html_e( 'Durations and Price', 'latepoint' ); ?></a></div>
352 <div><a href="#stickySectionDisplayPrice"><?php esc_html_e( 'Display Price', 'latepoint' ); ?></a></div>
353 <div><a href="#stickySectionAgents"><?php esc_html_e( 'Agents', 'latepoint' ); ?></a></div>
354 <div><a href="#stickySectionRestrictions"><?php esc_html_e( 'Restrictions', 'latepoint' ); ?></a></div>
355 <div><a href="#stickySectionSchedule"><?php esc_html_e( 'Schedule', 'latepoint' ); ?></a></div>
356 <div><a href="#stickySectionCustomDays"><?php esc_html_e( 'Days with Custom Schedule', 'latepoint' ); ?></a></div>
357 <div><a href="#stickySectionHolidays"><?php esc_html_e( 'Holidays & Days Off', 'latepoint' ); ?></a></div>
358 <div><a href="#stickySectionOther"><?php esc_html_e( 'Other Settings', 'latepoint' ); ?></a></div>
359 <?php
360
361 /**
362 * Sticky menu items links for the service edit form
363 *
364 * @param {array} $sticky_menu_items items that go into sticky menu on the right of settings, in format ['href' => '', 'label' => '']
365 * @returns {array} The filtered array of sticky menu items
366 *
367 * @since 5.1.94
368 * @hook latepoint_service_edit_form_sticky_section_items
369 *
370 */
371 $before_other_items = apply_filters( 'latepoint_service_edit_form_sticky_section_items', [] );
372 foreach ( $before_other_items as $item ) {
373 echo '<div><a href="#' . esc_attr( $item['href'] ) . '">' . esc_html( $item['label'] ) . '</a></div>';
374 }
375 ?>
376 </div>
377 </div>
378 </div>
379 </form>
380