PluginProbe
Booking Calendar / 11.9
Booking Calendar v11.9
11.9 11.8.4 11.8.3 11.8.2 11.8.1 11.8 11.7 11.6.1 11.6 11.5 11.4.3 11.4.2 11.4.1 11.4 11.3 11.2.1 11.2 11.1 11.0 10.15.7 10.15.6 10.1.3 10.10 10.10.1 10.10.2 All 205 releases
← All changes | includes/page-bookings/booking_listing_row.php +132 -72 11.5 → 11.9 View file →
@@ -1,4 +1,4 @@
1 1 <?php
2 2 /**
3 3 * Booking Listing Template - Booking Row
4 4 *
@@ -93,12 +93,13 @@
93 93 <div class="wpbc_a_col"><?php wpbc_template__booking_listing_row__section_col__labels(); ?></div>
94 94 </div>
95 95 </div>
96 96 <div class="wpbc_a_col wpbc_a_col__cost"><?php wpbc_template__booking_listing_row__section_col__cost(); ?></div>
97 - <div class="wpbc_a_col wpbc_a_col__action"><?php wpbc_template__booking_listing_row__section_col__action_button(); ?></div>
98 - </div>
99 - <?php wpbc_template__booking_listing_row__section_col__appointment_details(); ?>
100 - <div class="wpbc_a_row wpbc_a_row__notes">
97 + <div class="wpbc_a_col wpbc_a_col__action"><?php wpbc_template__booking_listing_row__section_col__action_button(); ?></div>
98 + </div>
99 + <?php wpbc_template__booking_listing_row__section_col__appointment_details(); ?>
100 + <?php wpbc_template__booking_listing_row__section_col__resource_allocation(); ?>
101 + <div class="wpbc_a_row wpbc_a_row__notes">
101 102 <div class="wpbc_a_col"><?php wpbc_template__booking_listing_row__section_col__note_readonly(); ?></div>
102 103 </div>
103 104 <div class="wpbc_a_row wpbc_a_row__system">
104 105 <div class="wpbc_a_col"><?php wpbc_template__booking_listing_row__section_col__sys_info(); ?></div>
@@ -182,8 +183,16 @@
182 183
183 184 function wpbc_template__booking_listing_row__section_col__dates() {
184 185
185 186 ?>
187 + <# if ( undefined !== data.resource_allocation && data.resource_allocation.is_multiple_resources ) { #>
188 + <div class="booking_dates_resource_allocation_summary booking_dates_expand_section">
189 + <div class="content_text">
190 + <span class="wpbc_label wpbc_label_booking_dates">{{data.resource_allocation.date_summary_label}}</span>
191 + <span class="wpbc_booking_resource_count">{{data.resource_allocation.resource_count_label}}</span>
192 + </div>
193 + </div>
194 + <# } else { #>
186 195 <div class="booking_dates_small booking_dates_expand_section" style="<# /* if ( 'short' !== wpbc_ajx_booking_listing.search_get_param('ui_usr__dates_short_wide') ) { #>display: none;<# } */ #>" >
187 196 <div class="content_text">{{{data.templates.short_dates_content}}}</div>
188 197 </div>
189 198 <div class="booking_dates_full booking_dates_expand_section" style="<# /* if ( 'wide' !== wpbc_ajx_booking_listing.search_get_param('ui_usr__dates_short_wide') ) { #>display: none;<# } */ #>" >
@@ -188,8 +197,9 @@
188 197 </div>
189 198 <div class="booking_dates_full booking_dates_expand_section" style="<# /* if ( 'wide' !== wpbc_ajx_booking_listing.search_get_param('ui_usr__dates_short_wide') ) { #>display: none;<# } */ #>" >
190 199 <div class="content_text">{{{data.templates.wide_dates_content}}}</div>
191 200 </div>
201 + <# } #>
192 202 <div class="wpbc_btn_expand_down">
193 203 <a class="wpbc_btn_expand_down_a"
194 204 href="javascript:void(0)"
195 205 onclick="javascript:jQuery(this).parents('.wpbc_row_wrap').toggleClass('max_height_a');jQuery( this ).find('.menu_icon').toggle();">
@@ -199,9 +209,9 @@
199 209 </div>
200 210 <?php
201 211 }
202 212
203 -function wpbc_template__booking_listing_row__section_col__booking_data(){
213 +function wpbc_template__booking_listing_row__section_col__booking_data(){
204 214
205 215 ?>
206 216 <div class="wpbc_listing_col wpbc_col_data">
207 217 <div class="content_text">
@@ -222,55 +232,103 @@
222 232 href="javascript:void(0)"
223 233 onclick="javascript:jQuery(this).parents('.wpbc_row_wrap').toggleClass('max_height_a');jQuery(this).parents('.wpbc_row_wrap').find('.wpbc_btn_expand_down_a .menu_icon').toggle();"
224 234 <?php // FixIn: 10.11.3.2 */ ?>
225 235 class="booking_details_simple__expand"
226 - ><div class="booking_details_full">{{{booking_details}}}</div></span>
236 + ><div class="booking_details_full">{{{booking_details}}}</div></span>
227 237 </div>
228 238 </div>
229 - <?php
230 -}
231 -
232 -/**
233 - * Render immutable Appointment information in the expanded Booking row.
234 - *
235 - * The complete row is emitted only for the 11.5 feature set and only for a
236 - * booking that has an Appointment snapshot in its parsed listing fields.
237 - *
238 - * @return void
239 - */
240 -function wpbc_template__booking_listing_row__section_col__appointment_details() {
241 - if ( ! function_exists( 'wpbc_is_11_5_features_enabled' ) || ! wpbc_is_11_5_features_enabled() ) {
242 - return;
243 - }
244 - ?>
245 - <# if ( undefined != data.parsed_fields.appointment_service_title && '' != data.parsed_fields.appointment_service_title ) { #>
246 - <div class="wpbc_a_row wpbc_a_row__appointment">
247 - <div class="wpbc_a_col">
248 - <div class="wpbc_listing_col wpbc_col_appointment_details">
249 - <div class="content_text">
250 - <div class="wpbc_appointment_booking_details">
251 - <strong><?php echo esc_js( __( 'Appointment details', 'booking' ) ); ?></strong>
252 - <span><?php echo esc_js( __( 'Service', 'booking' ) ); ?>: <strong>{{data.parsed_fields.appointment_service_title}}</strong></span>
253 - <span><?php echo esc_js( __( 'Provider', 'booking' ) ); ?>: <strong>{{data.parsed_fields.appointment_provider_title}}</strong></span>
254 - <# if ( undefined != data.parsed_fields.appointment_service_cost_formatted && '' != data.parsed_fields.appointment_service_cost_formatted ) { #>
255 - <span><?php echo esc_js( __( 'Service price', 'booking' ) ); ?>: <strong>{{data.parsed_fields.appointment_service_cost_formatted}}</strong></span>
256 - <# } #>
257 - <# if ( undefined != data.parsed_fields.appointment_time_label ) { #>
258 - <span><?php echo esc_js( __( 'Appointment time', 'booking' ) ); ?>: <strong>{{data.parsed_fields.appointment_time_label}}</strong></span>
259 - <span><?php echo esc_js( __( 'Buffer before / after', 'booking' ) ); ?>: <strong>{{data.parsed_fields.appointment_buffer_before_minutes}} / {{data.parsed_fields.appointment_buffer_after_minutes}} <?php echo esc_js( __( 'min', 'booking' ) ); ?></strong></span>
260 - <span><?php echo esc_js( __( 'Provider reserved', 'booking' ) ); ?>: <strong>{{data.parsed_fields.appointment_reserved_time_label}}</strong></span>
261 - <# } #>
262 - </div>
263 - </div>
264 - </div>
265 - </div>
266 - </div>
267 - <# } #>
268 - <?php
269 -}
270 -
271 -function wpbc_template__booking_listing_row__section_col__labels(){
239 + <?php
240 +}
272 241
242 +/**
243 + * Render immutable Appointment information in the expanded Booking row.
244 + *
245 + * The complete row is emitted only for a booking that has an Appointment
246 + * snapshot in its parsed listing fields.
247 + *
248 + * @return void
249 + */
250 +function wpbc_template__booking_listing_row__section_col__appointment_details() {
251 + ?>
252 + <# if ( undefined != data.parsed_fields.appointment_service_title && '' != data.parsed_fields.appointment_service_title ) { #>
253 + <div class="wpbc_a_row wpbc_a_row__appointment">
254 + <div class="wpbc_a_col">
255 + <div class="wpbc_listing_col wpbc_col_appointment_details">
256 + <div class="content_text">
257 + <div class="wpbc_appointment_booking_details">
258 + <strong><?php echo esc_js( __( 'Appointment details', 'booking' ) ); ?></strong>
259 + <span><?php echo esc_js( __( 'Service', 'booking' ) ); ?>: <strong>{{data.parsed_fields.appointment_service_title}}</strong></span>
260 + <span><?php echo esc_js( __( 'Provider', 'booking' ) ); ?>: <strong>{{data.parsed_fields.appointment_provider_title}}</strong></span>
261 + <# if ( undefined != data.parsed_fields.appointment_service_cost_formatted && '' != data.parsed_fields.appointment_service_cost_formatted ) { #>
262 + <span><?php echo esc_js( __( 'Service price', 'booking' ) ); ?>: <strong>{{data.parsed_fields.appointment_service_cost_formatted}}</strong></span>
263 + <# } #>
264 + <# if ( undefined != data.parsed_fields.appointment_time_label ) { #>
265 + <span><?php echo esc_js( __( 'Appointment time', 'booking' ) ); ?>: <strong>{{data.parsed_fields.appointment_time_label}}</strong></span>
266 + <span><?php echo esc_js( __( 'Buffer before / after', 'booking' ) ); ?>: <strong>{{data.parsed_fields.appointment_buffer_before_minutes}} / {{data.parsed_fields.appointment_buffer_after_minutes}} <?php echo esc_js( __( 'min', 'booking' ) ); ?></strong></span>
267 + <span><?php echo esc_js( __( 'Provider reserved', 'booking' ) ); ?>: <strong>{{data.parsed_fields.appointment_reserved_time_label}}</strong></span>
268 + <# } #>
269 + </div>
270 + </div>
271 + </div>
272 + </div>
273 + </div>
274 + <# } #>
275 + <?php
276 +}
277 +
278 +/**
279 + * Render date-to-Resource allocation details in an expanded Booking row.
280 + *
281 + * The normalized DTO is produced from the saved booking-date rows. This
282 + * template owns presentation only and remains hidden for bookings that use one
283 + * Resource, preserving the familiar compact layout for the common case.
284 + *
285 + * @return void
286 + */
287 +function wpbc_template__booking_listing_row__section_col__resource_allocation() {
288 + ?>
289 + <#
290 + if (
291 + undefined !== data.resource_allocation
292 + && data.resource_allocation.is_multiple_resources
293 + && data.resource_allocation.segments.length
294 + ) {
295 + #>
296 + <div class="wpbc_a_row wpbc_a_row__resource_allocation">
297 + <div class="wpbc_a_col">
298 + <div class="wpbc_listing_col wpbc_col_resource_allocation">
299 + <div
300 + class="wpbc_resource_allocation"
301 + role="group"
302 + aria-label="<?php echo esc_attr( __( 'Resource allocation', 'booking' ) ); ?>"
303 + >
304 + <div class="wpbc_resource_allocation__header">
305 + <strong><?php esc_html_e( 'Resource allocation', 'booking' ); ?></strong>
306 + <span class="wpbc_resource_allocation__count">{{data.resource_allocation.resource_count_label}}</span>
307 + </div>
308 + <div class="wpbc_resource_allocation__segments">
309 + <# _.each( data.resource_allocation.segments, function( allocation_segment ) { #>
310 + <div class="wpbc_resource_allocation__segment">
311 + <span class="wpbc_resource_allocation__period">{{allocation_segment.period_label}}</span>
312 + <span class="wpbc_resource_allocation__arrow" aria-hidden="true"><i class="menu_icon icon-1x wpbc_icn_arrow_forward"></i></span>
313 + <span class="wpbc_resource_allocation__resources">
314 + <# _.each( allocation_segment.resources, function( allocation_resource ) { #>
315 + <span class="wpbc_label wpbc_label_resource<# if ( allocation_resource.is_missing ) { #> wpbc_label_deleted_resource<# } #>">{{allocation_resource.resource_title}}</span>
316 + <# } ); #>
317 + </span>
318 + </div>
319 + <# } ); #>
320 + </div>
321 + </div>
322 + </div>
323 + </div>
324 + </div>
325 + <# } #>
326 + <?php
327 +}
328 +
329 +function wpbc_template__booking_listing_row__section_col__labels(){
330 +
273 331 ?>
274 332 <div class="wpbc_listing_col wpbc_col_booking_labels wpbc_col_labels">
275 333 <div class="content_text">
276 334 <span class="wpbc_label wpbc_label_booking_id"><span class="label_sup">ID:</span>{{data['parsed_fields']['booking_id']}}</span><?php
@@ -290,22 +348,20 @@
290 348 onclick="wpbc_boo_listing__click__change_booking_resource( {{data['parsed_fields']['booking_id']}}, {{resource_id_listing}} );">
291 349 <span class="wpbc_label wpbc_label_resource">{{{resource_title_listing}}}</span></a><#
292 350 }
293 351
294 - if ( '' != data.templates.payment_label_template ) {
352 + if ( '' != data.templates.payment_label_template ) {
295 353 #><a href="javascript:void(0)" class="wpbc_label_link " title='<?php echo esc_attr( __( 'Update payment status', 'booking' ) ); ?>'
296 354 onclick="javascript:wpbc_boo_listing__click__set_payment_status( {{data.parsed_fields.booking_id}}, '{{data.parsed_fields.pay_status}}' );">
297 355 {{{data.templates.payment_label_template}}}
298 356 </a><#
299 - }
300 -
301 - <?php if ( function_exists( 'wpbc_is_11_5_features_enabled' ) && wpbc_is_11_5_features_enabled() ) { ?>
302 - if ( undefined != data.parsed_fields.appointment_service_title && '' != data.parsed_fields.appointment_service_title ) {
303 - #><span class="wpbc_label wpbc_label_appointment_service">{{data.parsed_fields.appointment_service_title}} <span aria-hidden="true">&middot;</span> {{data.parsed_fields.appointment_duration_minutes}} <?php echo esc_js( __( 'min', 'booking' ) ); ?></span><#
304 - }
305 - <?php } ?>
306 -
307 - if ( '' != data.parsed_fields.sync_gid ) {
357 + }
358 +
359 + if ( undefined != data.parsed_fields.appointment_service_title && '' != data.parsed_fields.appointment_service_title ) {
360 + #><span class="wpbc_label wpbc_label_appointment_service">{{data.parsed_fields.appointment_service_title}} <span aria-hidden="true">&middot;</span> {{data.parsed_fields.appointment_duration_minutes}} <?php echo esc_js( __( 'min', 'booking' ) ); ?></span><#
361 + }
362 +
363 + if ( '' != data.parsed_fields.sync_gid ) {
308 364 #><span class="wpbc_label wpbc_label_imported"><i class="menu_icon icon-1x wpbc_icn_cloud_download system_update_alt"></i><?php echo esc_js(__( 'Imported', 'booking' )); ?></span><#
309 365 }
310 366
311 367 #><span class="wpbc_label wpbc_label_trash<# if ( '1' != data.parsed_fields.trash ) { #> hidden_items <# } #>"><i style="color: #f6efe8;" class="menu_icon icon-1x wpbc_icn_delete_forever"></i><?php echo esc_js(__( 'In Trash', 'booking' )); ?></span><#
@@ -413,20 +469,18 @@
413 469 <div class="wpbc_listing_col wpbc_col_sys_info">
414 470 <div class="content_text">
415 471 <div class="wpbc_actions_sysinfo">
416 472 <span class="sysinfo_id"><?php echo esc_js(__( 'Booking ID', 'booking' )); ?>: <strong>{{data['parsed_fields']['booking_id']}}</strong></span><div class="wpbc_ui_el__vetical_line sysinfo_id"></div>
417 - <span class="sysinfo_edited"><?php echo esc_js(__( 'Edited', 'booking' )); ?>: <strong>{{data['parsed_fields']['modification_date']}}</strong></span><div class="wpbc_ui_el__vetical_line sysinfo_edited"></div>
418 - <span class="sysinfo_created"><?php echo esc_js(__( 'Created', 'booking' )); ?>: <strong>{{data['parsed_fields']['creation_date']}}</strong></span><div class="wpbc_ui_el__vetical_line sysinfo_created"></div>
419 - <?php if ( function_exists( 'wpbc_is_11_5_features_enabled' ) && wpbc_is_11_5_features_enabled() ) { ?>
420 - <# if (
421 - undefined != data.parsed_fields.appointment_reserved_time_label
422 - && ( Number( data.parsed_fields.appointment_buffer_before_minutes || 0 ) > 0 || Number( data.parsed_fields.appointment_buffer_after_minutes || 0 ) > 0 )
423 - ) { #>
424 - <span class="sysinfo_appointment_buffer"><?php echo esc_js( __( 'Buffer', 'booking' ) ); ?>: <strong>{{data.parsed_fields.appointment_buffer_before_minutes}} / {{data.parsed_fields.appointment_buffer_after_minutes}} <?php echo esc_js( __( 'min', 'booking' ) ); ?></strong></span><div class="wpbc_ui_el__vetical_line sysinfo_appointment_buffer"></div>
425 - <span class="sysinfo_appointment_reserved"><?php echo esc_js( __( 'Blocked', 'booking' ) ); ?>: <strong>{{data.parsed_fields.appointment_reserved_time_label}}</strong></span><div class="wpbc_ui_el__vetical_line sysinfo_appointment_reserved"></div>
426 - <# } #>
427 - <?php } ?>
428 - <span class="sysinfo_hash"><?php echo esc_js(__( 'Hash', 'booking' )); ?>: <strong>{{data['parsed_fields']['hash']}}</strong></span><div class="wpbc_ui_el__vetical_line sysinfo_hash"></div>
473 + <span class="sysinfo_edited"><?php echo esc_js(__( 'Edited', 'booking' )); ?>: <strong>{{data['parsed_fields']['modification_date']}}</strong></span><div class="wpbc_ui_el__vetical_line sysinfo_edited"></div>
474 + <span class="sysinfo_created"><?php echo esc_js(__( 'Created', 'booking' )); ?>: <strong>{{data['parsed_fields']['creation_date']}}</strong></span><div class="wpbc_ui_el__vetical_line sysinfo_created"></div>
475 + <# if (
476 + undefined != data.parsed_fields.appointment_reserved_time_label
477 + && ( Number( data.parsed_fields.appointment_buffer_before_minutes || 0 ) > 0 || Number( data.parsed_fields.appointment_buffer_after_minutes || 0 ) > 0 )
478 + ) { #>
479 + <span class="sysinfo_appointment_buffer"><?php echo esc_js( __( 'Buffer', 'booking' ) ); ?>: <strong>{{data.parsed_fields.appointment_buffer_before_minutes}} / {{data.parsed_fields.appointment_buffer_after_minutes}} <?php echo esc_js( __( 'min', 'booking' ) ); ?></strong></span><div class="wpbc_ui_el__vetical_line sysinfo_appointment_buffer"></div>
480 + <span class="sysinfo_appointment_reserved"><?php echo esc_js( __( 'Blocked', 'booking' ) ); ?>: <strong>{{data.parsed_fields.appointment_reserved_time_label}}</strong></span><div class="wpbc_ui_el__vetical_line sysinfo_appointment_reserved"></div>
481 + <# } #>
482 + <span class="sysinfo_hash"><?php echo esc_js(__( 'Hash', 'booking' )); ?>: <strong>{{data['parsed_fields']['hash']}}</strong></span><div class="wpbc_ui_el__vetical_line sysinfo_hash"></div>
429 483 <span class="sysinfo_sync_id"><?php echo esc_js(__( 'Sync ID', 'booking' )); ?>: <strong>{{data['parsed_fields']['sync_id']}}</strong></span>
430 484 </div>
431 485 </div>
432 486 </div>
@@ -596,8 +650,9 @@
596 650 if ( ! wpbc_is_user_can( $booking_action, wpbc_get_current_user_id() ) ) {
597 651 return false;
598 652 }
599 653
654 + $edit_booking_url = 'javascript:void(0)';
600 655 $edit_booking_onclick = "if ( '' == '{{data.parsed_fields.hash}}' ) { return false; }"
601 656 . " wpbc_boo_listing__click__add_booking_modal_from_row("
602 657 . " '{{data.parsed_fields.booking_id}}',"
603 658 . " '{{data.parsed_fields.resource_id}}',"
@@ -603,11 +658,16 @@
603 658 . " '{{data.parsed_fields.resource_id}}',"
604 659 . " '{{data.parsed_fields.hash}}',"
605 660 . " '{{data.parsed_fields.wpbc_custom_booking_form}}'"
606 661 . ' );';
662 +
663 + if ( wpbc_is_booking_admin_edit_page_enabled() ) {
664 + $edit_booking_url = '{{{data.parsed_fields.admin_edit_url}}}';
665 + $edit_booking_onclick = "if ( '' == '{{data.parsed_fields.hash}}' ) { return false; }";
666 + }
607 667 // FixIn: 10.10.1.2 $edit_booking_url .= ( 'Off' !== get_bk_option( 'booking_is_resource_no_update__during_editing' ) ) ? '&resource_no_update=1' : ''; // FixIn: 9.4.2.3.
608 668
609 - $html_for_drop_down_option = "<a href='javascript:void(0)'
669 + $html_for_drop_down_option = "<a href='" . $edit_booking_url . "'
610 670 onclick=\"" . $edit_booking_onclick . "\"
611 671 class=\"ul_dropdown_menu_li_action ul_dropdown_menu_li_action_" . $booking_action .
612 672 " <# if ( '' == data['parsed_fields']['hash']) { #>wpbc_field_disabled<# } #>\" >" .
613 673 esc_js( __( 'Edit booking', 'booking' ) ) .