| @@ -95,8 +95,10 @@ | ||
| 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 | 97 | <div class="wpbc_a_col wpbc_a_col__action"><?php wpbc_template__booking_listing_row__section_col__action_button(); ?></div> |
| 98 | 98 | </div> |
| 99 | + <?php wpbc_template__booking_listing_row__section_col__appointment_details(); ?> | |
| 100 | + <?php wpbc_template__booking_listing_row__section_col__resource_allocation(); ?> | |
| 99 | 101 | <div class="wpbc_a_row wpbc_a_row__notes"> |
| 100 | 102 | <div class="wpbc_a_col"><?php wpbc_template__booking_listing_row__section_col__note_readonly(); ?></div> |
| 101 | 103 | </div> |
| 102 | 104 | <div class="wpbc_a_row wpbc_a_row__system"> |
| @@ -181,8 +183,16 @@ | ||
| 181 | 183 | |
| 182 | 184 | function wpbc_template__booking_listing_row__section_col__dates() { |
| 183 | 185 | |
| 184 | 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 { #> | |
| 185 | 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;<# } */ #>" > |
| 186 | 196 | <div class="content_text">{{{data.templates.short_dates_content}}}</div> |
| 187 | 197 | </div> |
| 188 | 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;<# } */ #>" > |
| @@ -187,8 +197,9 @@ | ||
| 187 | 197 | </div> |
| 188 | 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;<# } */ #>" > |
| 189 | 199 | <div class="content_text">{{{data.templates.wide_dates_content}}}</div> |
| 190 | 200 | </div> |
| 201 | + <# } #> | |
| 191 | 202 | <div class="wpbc_btn_expand_down"> |
| 192 | 203 | <a class="wpbc_btn_expand_down_a" |
| 193 | 204 | href="javascript:void(0)" |
| 194 | 205 | onclick="javascript:jQuery(this).parents('.wpbc_row_wrap').toggleClass('max_height_a');jQuery( this ).find('.menu_icon').toggle();"> |
| @@ -227,8 +238,95 @@ | ||
| 227 | 238 | </div> |
| 228 | 239 | <?php |
| 229 | 240 | } |
| 230 | 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 | + | |
| 231 | 329 | function wpbc_template__booking_listing_row__section_col__labels(){ |
| 232 | 330 | |
| 233 | 331 | ?> |
| 234 | 332 | <div class="wpbc_listing_col wpbc_col_booking_labels wpbc_col_labels"> |
| @@ -257,8 +355,12 @@ | ||
| 257 | 355 | {{{data.templates.payment_label_template}}} |
| 258 | 356 | </a><# |
| 259 | 357 | } |
| 260 | 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 | + | |
| 261 | 363 | if ( '' != data.parsed_fields.sync_gid ) { |
| 262 | 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><# |
| 263 | 365 | } |
| 264 | 366 | |
| @@ -369,8 +471,15 @@ | ||
| 369 | 471 | <div class="wpbc_actions_sysinfo"> |
| 370 | 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> |
| 371 | 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> |
| 372 | 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 | + <# } #> | |
| 373 | 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> |
| 374 | 483 | <span class="sysinfo_sync_id"><?php echo esc_js(__( 'Sync ID', 'booking' )); ?>: <strong>{{data['parsed_fields']['sync_id']}}</strong></span> |
| 375 | 484 | </div> |
| 376 | 485 | </div> |
| @@ -541,8 +650,9 @@ | ||
| 541 | 650 | if ( ! wpbc_is_user_can( $booking_action, wpbc_get_current_user_id() ) ) { |
| 542 | 651 | return false; |
| 543 | 652 | } |
| 544 | 653 | |
| 654 | + $edit_booking_url = 'javascript:void(0)'; | |
| 545 | 655 | $edit_booking_onclick = "if ( '' == '{{data.parsed_fields.hash}}' ) { return false; }" |
| 546 | 656 | . " wpbc_boo_listing__click__add_booking_modal_from_row(" |
| 547 | 657 | . " '{{data.parsed_fields.booking_id}}'," |
| 548 | 658 | . " '{{data.parsed_fields.resource_id}}'," |
| @@ -548,11 +658,16 @@ | ||
| 548 | 658 | . " '{{data.parsed_fields.resource_id}}'," |
| 549 | 659 | . " '{{data.parsed_fields.hash}}'," |
| 550 | 660 | . " '{{data.parsed_fields.wpbc_custom_booking_form}}'" |
| 551 | 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 | + } | |
| 552 | 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. |
| 553 | 668 | |
| 554 | - $html_for_drop_down_option = "<a href='javascript:void(0)' | |
| 669 | + $html_for_drop_down_option = "<a href='" . $edit_booking_url . "' | |
| 555 | 670 | onclick=\"" . $edit_booking_onclick . "\" |
| 556 | 671 | class=\"ul_dropdown_menu_li_action ul_dropdown_menu_li_action_" . $booking_action . |
| 557 | 672 | " <# if ( '' == data['parsed_fields']['hash']) { #>wpbc_field_disabled<# } #>\" >" . |
| 558 | 673 | esc_js( __( 'Edit booking', 'booking' ) ) . |