| @@ -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"> |
| @@ -235,14 +333,21 @@ | ||
| 235 | 333 | <div class="content_text"> |
| 236 | 334 | <span class="wpbc_label wpbc_label_booking_id"><span class="label_sup">ID:</span>{{data['parsed_fields']['booking_id']}}</span><?php |
| 237 | 335 | ?> |
| 238 | 336 | <# |
| 239 | - if ( '<?php echo esc_js(__( 'Resource not exist', 'booking' )); ?>' == data.parsed_fields.resource_title ) { | |
| 240 | - #><span class="wpbc_label wpbc_label_resource wpbc_label_deleted_resource">{{{data.parsed_fields.resource_title}}}</span><# | |
| 241 | - } else if ( '' != data.parsed_fields.resource_title ) { | |
| 337 | + var resource_title_listing = ( undefined != data.parsed_fields.resource_title_listing && '' != data.parsed_fields.resource_title_listing ) | |
| 338 | + ? data.parsed_fields.resource_title_listing | |
| 339 | + : data.parsed_fields.resource_title; | |
| 340 | + var resource_id_listing = ( undefined != data.parsed_fields.resource_id_listing && '' != data.parsed_fields.resource_id_listing ) | |
| 341 | + ? data.parsed_fields.resource_id_listing | |
| 342 | + : data.parsed_fields.resource_id; | |
| 343 | + | |
| 344 | + if ( '<?php echo esc_js(__( 'Resource not exist', 'booking' )); ?>' == resource_title_listing ) { | |
| 345 | + #><span class="wpbc_label wpbc_label_resource wpbc_label_deleted_resource">{{{resource_title_listing}}}</span><# | |
| 346 | + } else if ( '' != resource_title_listing ) { | |
| 242 | 347 | #><a href="javascript:void(0)" class="wpbc_label_link " title='<?php echo esc_attr( __( 'Change resource', 'booking' ) ); ?>' |
| 243 | - onclick="wpbc_boo_listing__click__change_booking_resource( {{data['parsed_fields']['booking_id']}}, {{data['parsed_fields']['resource_id']}} );"> | |
| 244 | - <span class="wpbc_label wpbc_label_resource">{{{data.parsed_fields.resource_title}}}</span></a><# | |
| 348 | + onclick="wpbc_boo_listing__click__change_booking_resource( {{data['parsed_fields']['booking_id']}}, {{resource_id_listing}} );"> | |
| 349 | + <span class="wpbc_label wpbc_label_resource">{{{resource_title_listing}}}</span></a><# | |
| 245 | 350 | } |
| 246 | 351 | |
| 247 | 352 | if ( '' != data.templates.payment_label_template ) { |
| 248 | 353 | #><a href="javascript:void(0)" class="wpbc_label_link " title='<?php echo esc_attr( __( 'Update payment status', 'booking' ) ); ?>' |
| @@ -250,8 +355,12 @@ | ||
| 250 | 355 | {{{data.templates.payment_label_template}}} |
| 251 | 356 | </a><# |
| 252 | 357 | } |
| 253 | 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 | + | |
| 254 | 363 | if ( '' != data.parsed_fields.sync_gid ) { |
| 255 | 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><# |
| 256 | 365 | } |
| 257 | 366 | |
| @@ -362,8 +471,15 @@ | ||
| 362 | 471 | <div class="wpbc_actions_sysinfo"> |
| 363 | 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> |
| 364 | 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> |
| 365 | 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 | + <# } #> | |
| 366 | 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> |
| 367 | 483 | <span class="sysinfo_sync_id"><?php echo esc_js(__( 'Sync ID', 'booking' )); ?>: <strong>{{data['parsed_fields']['sync_id']}}</strong></span> |
| 368 | 484 | </div> |
| 369 | 485 | </div> |
| @@ -534,15 +650,25 @@ | ||
| 534 | 650 | if ( ! wpbc_is_user_can( $booking_action, wpbc_get_current_user_id() ) ) { |
| 535 | 651 | return false; |
| 536 | 652 | } |
| 537 | 653 | |
| 538 | - $edit_booking_url = 'admin.php?page=' . wpbc_get_new_booking_url( false, false ); | |
| 539 | - $edit_booking_url .= '&booking_type={{data.parsed_fields.resource_id}}&booking_hash={{data.parsed_fields.hash}}&parent_res=1'; | |
| 540 | - $edit_booking_url .= '&booking_form={{data.parsed_fields.wpbc_custom_booking_form}}'; // FixIn: 9.4.3.12. | |
| 541 | - $edit_booking_url .= '&is_show_payment_form=Off'; // FixIn: 9.9.0.38. | |
| 654 | + $edit_booking_url = 'javascript:void(0)'; | |
| 655 | + $edit_booking_onclick = "if ( '' == '{{data.parsed_fields.hash}}' ) { return false; }" | |
| 656 | + . " wpbc_boo_listing__click__add_booking_modal_from_row(" | |
| 657 | + . " '{{data.parsed_fields.booking_id}}'," | |
| 658 | + . " '{{data.parsed_fields.resource_id}}'," | |
| 659 | + . " '{{data.parsed_fields.hash}}'," | |
| 660 | + . " '{{data.parsed_fields.wpbc_custom_booking_form}}'" | |
| 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 | + } | |
| 542 | 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. |
| 543 | 668 | |
| 544 | 669 | $html_for_drop_down_option = "<a href='" . $edit_booking_url . "' |
| 670 | + onclick=\"" . $edit_booking_onclick . "\" | |
| 545 | 671 | class=\"ul_dropdown_menu_li_action ul_dropdown_menu_li_action_" . $booking_action . |
| 546 | 672 | " <# if ( '' == data['parsed_fields']['hash']) { #>wpbc_field_disabled<# } #>\" >" . |
| 547 | 673 | esc_js( __( 'Edit booking', 'booking' ) ) . |
| 548 | 674 | "<i class='menu_icon icon-1x wpbc_icn_draw'></i>" . |