_booking_data.php
1 year ago
_full_summary.php
1 year ago
_table_body.php
2 months ago
customize_table.php
2 months ago
grouped_bookings_quick_view.php
1 year ago
index.php
2 months ago
pending_approval.php
1 year ago
quick_availability.php
1 year ago
view_booking_log.php
1 year ago
_booking_data.php
220 lines
| 1 | <?php |
| 2 | /* @var $booking OsBookingModel */ |
| 3 | /* @var $services OsServiceModel[] */ |
| 4 | /* @var $agents OsAgentModel[] */ |
| 5 | /* @var $order_item_id string */ |
| 6 | |
| 7 | if ( ! defined( 'ABSPATH' ) ) { |
| 8 | exit; // Exit if accessed directly |
| 9 | } |
| 10 | ?> |
| 11 | <?php if ( ! $booking->is_new_record() ) { ?> |
| 12 | <div class="quick-booking-info"> |
| 13 | <?php echo '<span>' . esc_html__( 'ID:', 'latepoint' ) . '</span><strong>' . esc_html($booking->id) . '</strong>'; ?> |
| 14 | <?php echo '<span>' . esc_html__( 'Code:', 'latepoint' ) . '</span><strong>' . esc_html($booking->booking_code) . '</strong>'; ?> |
| 15 | <?php echo '<a target="_blank" href="'.$booking->manage_by_key_url('customer').'"><i class="latepoint-icon latepoint-icon-link-2"></i>'.esc_html__('Share', 'latepoint').'</a>'; ?> |
| 16 | <?php if ( OsAuthHelper::get_current_user()->has_capability( 'activity__view' ) ) { |
| 17 | echo '<a href="#" data-booking-id="' . esc_attr($booking->id) . '" data-route="' . esc_attr(OsRouterHelper::build_route_name( 'bookings', 'view_booking_log' )) . '" class="quick-booking-form-view-log-btn"><i class="latepoint-icon latepoint-icon-clock"></i>' . esc_html__( 'History', 'latepoint' ) . '</a>'; |
| 18 | } ?> |
| 19 | </div> |
| 20 | <?php } ?> |
| 21 | <?php |
| 22 | |
| 23 | ?> |
| 24 | <?php if ( $booking->is_part_of_bundle() && ! empty( $booking->service_id ) ) { |
| 25 | echo '<div class="quick-booking-preselected-service-info">' . esc_html__( 'Bundled Service: ', 'latepoint' ) . '<span>' . esc_html($booking->service->name) . '</span></div>'; |
| 26 | } elseif ( $services ) { ?> |
| 27 | <div class="os-form-group os-form-group-transparent os-form-select-group os-booking-data-service-selector-wrapper"> |
| 28 | <label for=""><?php esc_html_e( 'Service', 'latepoint' ); ?></label> |
| 29 | <div class="os-services-select-field-w"> |
| 30 | <div class="services-options-list"> |
| 31 | <?php if ( count( $services ) > 7 ) { ?> |
| 32 | <div class="service-options-filter-input-w"><input class="service-options-filter-input" type="text" |
| 33 | placeholder="<?php esc_attr_e( 'Start typing to filter...', 'latepoint' ); ?>"> |
| 34 | </div> |
| 35 | <?php } ?> |
| 36 | <?php |
| 37 | $service_categories = []; |
| 38 | foreach ( $services as $service ) { |
| 39 | $service_categories[ 'cat_' . $service->category_id ][] = $service; |
| 40 | } |
| 41 | if ( $service_categories ) { |
| 42 | foreach ( $service_categories as $key => $service_category_services ) { |
| 43 | $category_id = str_replace( 'cat_', '', $key ); |
| 44 | if ( $category_id == '0' || ! $category_id ) { |
| 45 | $category_name = __( 'Uncategorized', 'latepoint' ); |
| 46 | } else { |
| 47 | $category = new OsServiceCategoryModel( $category_id ); |
| 48 | $category_name = ( $category ) ? $category->name : __( 'Uncategorized', 'latepoint' ); |
| 49 | } |
| 50 | echo '<div class="os-option-group">' . esc_html($category_name) . '</div>'; |
| 51 | foreach ( $service_category_services as $service ) { |
| 52 | $selected = ( $booking->service_id == $service->id ) ? true : false; |
| 53 | OsServiceHelper::service_option_html_for_select( $service, $selected ); |
| 54 | } |
| 55 | } |
| 56 | } |
| 57 | ?> |
| 58 | </div> |
| 59 | <?php if ( $booking->service_id ) { ?> |
| 60 | <div class="service-option-selected" |
| 61 | data-id="<?php echo esc_attr($booking->service->id); ?>" |
| 62 | data-buffer-before="<?php echo esc_attr($booking->service->buffer_before); ?>" |
| 63 | data-buffer-after="<?php echo esc_attr($booking->service->buffer_after); ?>" |
| 64 | data-capacity-min="<?php echo esc_attr($booking->service->capacity_min); ?>" |
| 65 | data-capacity-max="<?php echo esc_attr($booking->service->capacity_max); ?>" |
| 66 | data-duration-name="<?php echo esc_attr($booking->service->duration_name); ?>" |
| 67 | data-duration="<?php echo esc_attr($booking->service->duration); ?>"> |
| 68 | <div class="service-color" |
| 69 | style="background-color: <?php echo esc_attr($booking->service->bg_color); ?>"></div> |
| 70 | <span><?php echo esc_html($booking->service->name) ?></span> |
| 71 | </div> |
| 72 | <?php } else { ?> |
| 73 | <div class="service-option-selected"> |
| 74 | <div class="service-color"></div> |
| 75 | <span><?php esc_html_e( 'Select Service', 'latepoint' ); ?></span> |
| 76 | </div> |
| 77 | <?php } ?> |
| 78 | </div> |
| 79 | </div> <?php |
| 80 | } else { |
| 81 | echo '<div class="latepoint-message latepoint-message-error">' . esc_html__( 'No Active Services Found.', 'latepoint' ) . '</div>'; |
| 82 | } ?> |
| 83 | <div class="os-service-durations" |
| 84 | style="<?php echo ( $booking->service_id && count( $booking->service->get_all_durations_arr() ) > 1 ) ? '' : 'display: none;'; ?>"> |
| 85 | <div class="os-form-group os-form-select-group os-form-group-transparent"> |
| 86 | <label for=""><?php esc_html_e( 'Duration', 'latepoint' ); ?></label> |
| 87 | <select class="os-form-control os-affects-duration os-affects-price" |
| 88 | name="order_items[<?php echo esc_attr($order_item_id); ?>][bookings][<?php echo esc_attr($booking->get_form_id()); ?>][duration]" |
| 89 | id=""> |
| 90 | <?php if ( $booking->service_id ) { |
| 91 | foreach ( $booking->service->get_all_durations_arr() as $extra_duration ) { |
| 92 | $selected = ( $extra_duration['duration'] == $booking->duration ) ? 'selected' : ''; |
| 93 | // translators: %d is number of minutes |
| 94 | $custom_name = empty( $extra_duration['name'] ) ? sprintf( __( '%d minutes', 'latepoint' ), $extra_duration['duration'] ) : $extra_duration['name']; |
| 95 | echo '<option value="' . esc_attr($extra_duration['duration']) . '" ' . $selected . '>' . esc_html($custom_name) . '</option>'; |
| 96 | } |
| 97 | } ?> |
| 98 | </select> |
| 99 | </div> |
| 100 | </div> |
| 101 | <?php |
| 102 | /** |
| 103 | * Output right after a service selector on a booking data form on the order edit form |
| 104 | * |
| 105 | * @param {OsBookingModel} $booking instance of a booking model |
| 106 | * @param {string} $order_item_id ID of an order item for this booking |
| 107 | * |
| 108 | * @since 5.0.0 |
| 109 | * @hook latepoint_booking_data_form_after_service |
| 110 | * |
| 111 | */ |
| 112 | do_action( 'latepoint_booking_data_form_after_service', $booking, $order_item_id ); ?> |
| 113 | <?php if ( OsLocationHelper::count_locations( true ) > 1 ) { ?> |
| 114 | <div class="os-row"> |
| 115 | <div class="os-col-12"> |
| 116 | <?php echo OsFormHelper::select_field( 'order_items[' . $order_item_id . '][bookings][' . $booking->get_form_id() . '][location_id]', __( 'Location', 'latepoint' ), OsLocationHelper::get_locations_list( true ), $booking->location_id, [ 'class' => 'location_id_holder location-selector' ] ); ?> |
| 117 | </div> |
| 118 | </div> |
| 119 | <?php |
| 120 | } else { |
| 121 | // single location exist in database - assign it automatically |
| 122 | echo OsFormHelper::hidden_field( 'order_items[' . $order_item_id . '][bookings][' . $booking->get_form_id() . '][location_id]', OsLocationHelper::get_default_location_id( true ), [ 'class' => 'location_id_holder location-selector' ] ); |
| 123 | } ?> |
| 124 | |
| 125 | <div class="os-row"> |
| 126 | <?php |
| 127 | if ( OsAgentHelper::count_agents( true ) == 1 ) { |
| 128 | echo OsFormHelper::hidden_field( 'order_items[' . $order_item_id . '][bookings][' . $booking->get_form_id() . '][agent_id]', $booking->agent_id, [ 'class' => 'agent-selector' ] ); |
| 129 | $status_field_size = 'os-col-12'; |
| 130 | } else { |
| 131 | $status_field_size = 'os-col-6'; |
| 132 | ?> |
| 133 | <div class="os-col-6"> |
| 134 | <div class="agent-info-w <?php echo ( $booking->agent_id ) ? 'selected' : 'selecting'; ?>"> |
| 135 | <div class="agents-selector-w"> |
| 136 | <div class="os-form-group os-form-select-group os-form-group-transparent"> |
| 137 | <label for=""><?php esc_html_e( 'Agent', 'latepoint' ); ?></label> |
| 138 | <select name="order_items[<?php echo esc_attr($order_item_id); ?>][bookings][<?php echo esc_attr($booking->get_form_id()); ?>][agent_id]" |
| 139 | class="os-form-control agent-selector"> |
| 140 | <?php foreach ( $agents as $agent ) { ?> |
| 141 | <option |
| 142 | value="<?php echo esc_attr($agent->id); ?>" <?php if ( $agent->id == $booking->agent_id ) { |
| 143 | echo 'selected'; |
| 144 | } ?>><?php echo esc_html($agent->get_full_name()); ?></option> |
| 145 | <?php } ?> |
| 146 | </select> |
| 147 | </div> |
| 148 | </div> |
| 149 | </div> |
| 150 | </div> |
| 151 | <?php |
| 152 | } |
| 153 | ?> |
| 154 | <div class="<?php echo esc_attr($status_field_size); ?>"> |
| 155 | <?php echo OsFormHelper::select_field( 'order_items[' . $order_item_id . '][bookings][' . $booking->get_form_id() . '][status]', __( 'Status', 'latepoint' ), OsBookingHelper::get_statuses_list(), $booking->status, array( 'placeholder' => __( 'Set Status', 'latepoint' ) ) ); ?> |
| 156 | </div> |
| 157 | </div> |
| 158 | <div class="os-row"> |
| 159 | <div class="os-col-6"> |
| 160 | <?php echo OsFormHelper::text_field( 'order_items[' . $order_item_id . '][bookings][' . $booking->get_form_id() . '][start_date_formatted]', __( 'Start Date', 'latepoint' ), $booking->format_start_date(), array( |
| 161 | 'class' => 'os-mask-date', |
| 162 | 'theme' => 'simple', |
| 163 | 'data-route' => OsRouterHelper::build_route_name( 'bookings', 'quick_availability' ) |
| 164 | ) ); ?> |
| 165 | </div> |
| 166 | <div class="os-col-6"> |
| 167 | <a href="#" data-route="<?php echo esc_attr(OsRouterHelper::build_route_name( 'bookings', 'quick_availability' )); ?>" |
| 168 | class="latepoint-btn latepoint-btn-white open-quick-availability-btn trigger-quick-availability"> |
| 169 | <span><?php esc_html_e( 'Availability', 'latepoint' ); ?></span> |
| 170 | <i class="latepoint-icon latepoint-icon-arrow-right"></i> |
| 171 | </a> |
| 172 | </div> |
| 173 | </div> |
| 174 | <div class="os-row"> |
| 175 | <div class="os-col-6"> |
| 176 | <div class="quick-start-time-w"> |
| 177 | <?php echo OsFormHelper::time_field( 'order_items[' . $order_item_id . '][bookings][' . $booking->get_form_id() . '][start_time]', __( 'Start Time', 'latepoint' ), $booking->start_time, true ); ?> |
| 178 | </div> |
| 179 | </div> |
| 180 | <div class="os-col-6"> |
| 181 | <div |
| 182 | class="quick-end-time-w <?php if ( $booking->end_time && ( $booking->end_time <= $booking->start_time ) ) |
| 183 | echo 'ending-next-day' ?>"> |
| 184 | <?php echo OsFormHelper::time_field( 'order_items[' . $order_item_id . '][bookings][' . $booking->get_form_id() . '][end_time]', __( 'End Time', 'latepoint' ), $booking->end_time, true ); ?> |
| 185 | <div class="plus-day-label"><?php esc_html_e( '+1 day', 'latepoint' ); ?></div> |
| 186 | </div> |
| 187 | </div> |
| 188 | </div> |
| 189 | <div class="os-row"> |
| 190 | <div class="os-col-6"> |
| 191 | <?php echo OsFormHelper::text_field( 'order_items[' . $order_item_id . '][bookings][' . $booking->get_form_id() . '][buffer_before]', __( 'Buffer Before', 'latepoint' ), $booking->buffer_before, [ |
| 192 | 'theme' => 'simple', |
| 193 | 'class' => 'os-mask-minutes' |
| 194 | ] ); ?> |
| 195 | </div> |
| 196 | <div class="os-col-6"> |
| 197 | <?php echo OsFormHelper::text_field( 'order_items[' . $order_item_id . '][bookings][' . $booking->get_form_id() . '][buffer_after]', __( 'Buffer After', 'latepoint' ), $booking->buffer_after, [ |
| 198 | 'theme' => 'simple', |
| 199 | 'class' => 'os-mask-minutes' |
| 200 | ] ); ?> |
| 201 | </div> |
| 202 | </div> |
| 203 | |
| 204 | <?php |
| 205 | /** |
| 206 | * Output right after a booking data form on the order edit form |
| 207 | * |
| 208 | * @param {OsBookingModel} $booking instance of a booking model |
| 209 | * |
| 210 | * @since 5.0.0 |
| 211 | * @hook latepoint_booking_data_form_after |
| 212 | * |
| 213 | */ |
| 214 | do_action( 'latepoint_booking_data_form_after', $booking, $order_item_id ); ?> |
| 215 | <?php |
| 216 | echo OsFormHelper::hidden_field( 'order_items[' . $order_item_id . '][bookings][' . $booking->get_form_id() . '][order_item_id]', $booking->order_item_id ); |
| 217 | echo OsFormHelper::hidden_field( 'order_items[' . $order_item_id . '][bookings][' . $booking->get_form_id() . '][id]', $booking->id ); |
| 218 | echo OsFormHelper::hidden_field( 'order_items[' . $order_item_id . '][bookings][' . $booking->get_form_id() . '][service_id]', $booking->service_id, [ 'class' => 'os-affects-service-extras os-affects-price service-selector os-affects-custom-fields' ] ); |
| 219 | echo OsFormHelper::hidden_field( 'order_items[' . $order_item_id . '][bookings][' . $booking->get_form_id() . '][form_id]', $booking->get_form_id() ); |
| 220 | ?> |