| @@ -1,4 +1,4 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | 3 | * Add Booking modal for Booking Listing and Timeline. |
| 4 | 4 | * |
| @@ -86,12 +86,13 @@ | ||
| 86 | 86 | <div id="wpbc_modal__add_booking__body" class="wpbc_modal__add_booking__body"> |
| 87 | 87 | <?php self::print_loading_spinner(); ?> |
| 88 | 88 | </div> |
| 89 | 89 | </div> |
| 90 | - <div class="modal-footer"> | |
| 91 | - <div class="wpbc_modal__add_booking__footer_time_override" data-wpbc-add-booking-time-override-footer="1"></div> | |
| 92 | - <?php self::print_modal_send_emails_toggle(); ?> | |
| 93 | - <a href="javascript:void(0)" id="wpbc_modal__add_booking__button_send" class="button button-primary" onclick="wpbc_boo_listing__submit__add_booking_modal();"> | |
| 90 | + <div class="modal-footer"> | |
| 91 | + <div class="wpbc_modal__add_booking__footer_time_override" data-wpbc-add-booking-time-override-footer="1"></div> | |
| 92 | + <?php self::print_modal_send_emails_toggle(); ?> | |
| 93 | + <?php self::print_add_appointment_entry(); ?> | |
| 94 | + <a href="javascript:void(0)" id="wpbc_modal__add_booking__button_send" class="button button-primary" onclick="wpbc_boo_listing__submit__add_booking_modal();"> | |
| 94 | 95 | <?php esc_html_e( 'Add booking', 'booking' ); ?> |
| 95 | 96 | </a> |
| 96 | 97 | <a href="javascript:void(0)" class="button button-secondary" data-dismiss="modal"> |
| 97 | 98 | <?php esc_html_e( 'Close', 'booking' ); ?> |
| @@ -101,9 +102,37 @@ | ||
| 101 | 102 | </div><!-- /.modal-dialog --> |
| 102 | 103 | </div><!-- /.modal --> |
| 103 | 104 | </span> |
| 104 | 105 | <?php |
| 105 | - } | |
| 106 | + } | |
| 107 | + | |
| 108 | + | |
| 109 | + /** | |
| 110 | + * Print the released route to the Service-first administrator workflow. | |
| 111 | + * | |
| 112 | + * The standard Add Booking form remains the popup's primary action. This | |
| 113 | + * secondary route is hidden by the modal client whenever an existing booking | |
| 114 | + * is being edited. | |
| 115 | + * | |
| 116 | + * @return void | |
| 117 | + */ | |
| 118 | + private static function print_add_appointment_entry() { | |
| 119 | + if ( | |
| 120 | + ! function_exists( 'wpbc_add_appointment_page_get_url' ) | |
| 121 | + || ! WPBC_Add_Booking_Component::current_user_can_add_booking() | |
| 122 | + ) { | |
| 123 | + return; | |
| 124 | + } | |
| 125 | + ?> | |
| 126 | + <a href="<?php echo esc_url( wpbc_add_appointment_page_get_url() ); ?>" | |
| 127 | + class="button button-secondary wpbc_modal__add_booking__appointment_entry" | |
| 128 | + data-wpbc-add-appointment-entry="1" | |
| 129 | + title="<?php esc_attr_e( 'Choose a Service and Provider before creating the booking', 'booking' ); ?>"> | |
| 130 | + <i class="menu_icon icon-1x wpbc-bi-calendar-plus" aria-hidden="true"></i> | |
| 131 | + <?php esc_html_e( 'Add Appointment', 'booking' ); ?> | |
| 132 | + </a> | |
| 133 | + <?php | |
| 134 | + } | |
| 106 | 135 | |
| 107 | 136 | |
| 108 | 137 | /** |
| 109 | 138 | * Print modal-scoped email notification toggle. |