| @@ -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,52 +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 a booking that has an Appointment | |
| 236 | - * snapshot in its parsed listing fields. | |
| 237 | - * | |
| 238 | - * @return void | |
| 239 | - */ | |
| 240 | -function wpbc_template__booking_listing_row__section_col__appointment_details() { | |
| 241 | - ?> | |
| 242 | - <# if ( undefined != data.parsed_fields.appointment_service_title && '' != data.parsed_fields.appointment_service_title ) { #> | |
| 243 | - <div class="wpbc_a_row wpbc_a_row__appointment"> | |
| 244 | - <div class="wpbc_a_col"> | |
| 245 | - <div class="wpbc_listing_col wpbc_col_appointment_details"> | |
| 246 | - <div class="content_text"> | |
| 247 | - <div class="wpbc_appointment_booking_details"> | |
| 248 | - <strong><?php echo esc_js( __( 'Appointment details', 'booking' ) ); ?></strong> | |
| 249 | - <span><?php echo esc_js( __( 'Service', 'booking' ) ); ?>: <strong>{{data.parsed_fields.appointment_service_title}}</strong></span> | |
| 250 | - <span><?php echo esc_js( __( 'Provider', 'booking' ) ); ?>: <strong>{{data.parsed_fields.appointment_provider_title}}</strong></span> | |
| 251 | - <# if ( undefined != data.parsed_fields.appointment_service_cost_formatted && '' != data.parsed_fields.appointment_service_cost_formatted ) { #> | |
| 252 | - <span><?php echo esc_js( __( 'Service price', 'booking' ) ); ?>: <strong>{{data.parsed_fields.appointment_service_cost_formatted}}</strong></span> | |
| 253 | - <# } #> | |
| 254 | - <# if ( undefined != data.parsed_fields.appointment_time_label ) { #> | |
| 255 | - <span><?php echo esc_js( __( 'Appointment time', 'booking' ) ); ?>: <strong>{{data.parsed_fields.appointment_time_label}}</strong></span> | |
| 256 | - <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> | |
| 257 | - <span><?php echo esc_js( __( 'Provider reserved', 'booking' ) ); ?>: <strong>{{data.parsed_fields.appointment_reserved_time_label}}</strong></span> | |
| 258 | - <# } #> | |
| 259 | - </div> | |
| 260 | - </div> | |
| 261 | - </div> | |
| 262 | - </div> | |
| 263 | - </div> | |
| 264 | - <# } #> | |
| 265 | - <?php | |
| 266 | -} | |
| 267 | - | |
| 268 | -function wpbc_template__booking_listing_row__section_col__labels(){ | |
| 239 | + <?php | |
| 240 | +} | |
| 269 | 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 | + | |
| 270 | 331 | ?> |
| 271 | 332 | <div class="wpbc_listing_col wpbc_col_booking_labels wpbc_col_labels"> |
| 272 | 333 | <div class="content_text"> |
| 273 | 334 | <span class="wpbc_label wpbc_label_booking_id"><span class="label_sup">ID:</span>{{data['parsed_fields']['booking_id']}}</span><?php |
| @@ -287,20 +348,20 @@ | ||
| 287 | 348 | onclick="wpbc_boo_listing__click__change_booking_resource( {{data['parsed_fields']['booking_id']}}, {{resource_id_listing}} );"> |
| 288 | 349 | <span class="wpbc_label wpbc_label_resource">{{{resource_title_listing}}}</span></a><# |
| 289 | 350 | } |
| 290 | 351 | |
| 291 | - if ( '' != data.templates.payment_label_template ) { | |
| 352 | + if ( '' != data.templates.payment_label_template ) { | |
| 292 | 353 | #><a href="javascript:void(0)" class="wpbc_label_link " title='<?php echo esc_attr( __( 'Update payment status', 'booking' ) ); ?>' |
| 293 | 354 | onclick="javascript:wpbc_boo_listing__click__set_payment_status( {{data.parsed_fields.booking_id}}, '{{data.parsed_fields.pay_status}}' );"> |
| 294 | 355 | {{{data.templates.payment_label_template}}} |
| 295 | 356 | </a><# |
| 296 | - } | |
| 297 | - | |
| 298 | - if ( undefined != data.parsed_fields.appointment_service_title && '' != data.parsed_fields.appointment_service_title ) { | |
| 299 | - #><span class="wpbc_label wpbc_label_appointment_service">{{data.parsed_fields.appointment_service_title}} <span aria-hidden="true">·</span> {{data.parsed_fields.appointment_duration_minutes}} <?php echo esc_js( __( 'min', 'booking' ) ); ?></span><# | |
| 300 | - } | |
| 301 | - | |
| 302 | - 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">·</span> {{data.parsed_fields.appointment_duration_minutes}} <?php echo esc_js( __( 'min', 'booking' ) ); ?></span><# | |
| 361 | + } | |
| 362 | + | |
| 363 | + if ( '' != data.parsed_fields.sync_gid ) { | |
| 303 | 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><# |
| 304 | 365 | } |
| 305 | 366 | |
| 306 | 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><# |
| @@ -408,18 +469,18 @@ | ||
| 408 | 469 | <div class="wpbc_listing_col wpbc_col_sys_info"> |
| 409 | 470 | <div class="content_text"> |
| 410 | 471 | <div class="wpbc_actions_sysinfo"> |
| 411 | 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> |
| 412 | - <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> | |
| 413 | - <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> | |
| 414 | - <# if ( | |
| 415 | - undefined != data.parsed_fields.appointment_reserved_time_label | |
| 416 | - && ( Number( data.parsed_fields.appointment_buffer_before_minutes || 0 ) > 0 || Number( data.parsed_fields.appointment_buffer_after_minutes || 0 ) > 0 ) | |
| 417 | - ) { #> | |
| 418 | - <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> | |
| 419 | - <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> | |
| 420 | - <# } #> | |
| 421 | - <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> | |
| 422 | 483 | <span class="sysinfo_sync_id"><?php echo esc_js(__( 'Sync ID', 'booking' )); ?>: <strong>{{data['parsed_fields']['sync_id']}}</strong></span> |
| 423 | 484 | </div> |
| 424 | 485 | </div> |
| 425 | 486 | </div> |
| @@ -589,8 +650,9 @@ | ||
| 589 | 650 | if ( ! wpbc_is_user_can( $booking_action, wpbc_get_current_user_id() ) ) { |
| 590 | 651 | return false; |
| 591 | 652 | } |
| 592 | 653 | |
| 654 | + $edit_booking_url = 'javascript:void(0)'; | |
| 593 | 655 | $edit_booking_onclick = "if ( '' == '{{data.parsed_fields.hash}}' ) { return false; }" |
| 594 | 656 | . " wpbc_boo_listing__click__add_booking_modal_from_row(" |
| 595 | 657 | . " '{{data.parsed_fields.booking_id}}'," |
| 596 | 658 | . " '{{data.parsed_fields.resource_id}}'," |
| @@ -596,11 +658,16 @@ | ||
| 596 | 658 | . " '{{data.parsed_fields.resource_id}}'," |
| 597 | 659 | . " '{{data.parsed_fields.hash}}'," |
| 598 | 660 | . " '{{data.parsed_fields.wpbc_custom_booking_form}}'" |
| 599 | 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 | + } | |
| 600 | 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. |
| 601 | 668 | |
| 602 | - $html_for_drop_down_option = "<a href='javascript:void(0)' | |
| 669 | + $html_for_drop_down_option = "<a href='" . $edit_booking_url . "' | |
| 603 | 670 | onclick=\"" . $edit_booking_onclick . "\" |
| 604 | 671 | class=\"ul_dropdown_menu_li_action ul_dropdown_menu_li_action_" . $booking_action . |
| 605 | 672 | " <# if ( '' == data['parsed_fields']['hash']) { #>wpbc_field_disabled<# } #>\" >" . |
| 606 | 673 | esc_js( __( 'Edit booking', 'booking' ) ) . |