_booking_data.php
1 year ago
_full_summary.php
1 year ago
_table_body.php
1 year ago
customize_table.php
4 months ago
grouped_bookings_quick_view.php
1 year ago
index.php
1 year ago
pending_approval.php
1 year ago
quick_availability.php
1 year ago
view_booking_log.php
1 year ago
index.php
159 lines
| 1 | <?php |
| 2 | /* |
| 3 | * Copyright (c) 2022 LatePoint LLC. All rights reserved. |
| 4 | */ |
| 5 | ?> |
| 6 | <?php |
| 7 | /* @var $bookings OsBookingModel[] */ |
| 8 | /* @var $showing_from int */ |
| 9 | /* @var $showing_to int */ |
| 10 | /* @var $total_records int */ |
| 11 | /* @var $per_page int */ |
| 12 | /* @var $total_pages int */ |
| 13 | /* @var $current_page_number int */ |
| 14 | /* @var $records_ordered_by_key string */ |
| 15 | /* @var $records_ordered_by_direction string */ |
| 16 | /* @var $agents_list array */ |
| 17 | /* @var $services_list array */ |
| 18 | /* @var $locations_list array */ |
| 19 | /* @var $selected_columns array */ |
| 20 | |
| 21 | if ( ! defined( 'ABSPATH' ) ) { |
| 22 | exit; // Exit if accessed directly |
| 23 | } |
| 24 | ?> |
| 25 | <?php if($bookings){ ?> |
| 26 | <div class="table-with-pagination-w has-scrollable-table"> |
| 27 | <div class="os-pagination-w with-actions"> |
| 28 | <div class="table-heading-w"> |
| 29 | <h2 class="table-heading"><?php esc_html_e('Appointments', 'latepoint'); ?></h2> |
| 30 | <div class="pagination-info"><?php echo esc_html__('Showing', 'latepoint'). ' <span class="os-pagination-from">'. esc_html($showing_from) . '</span>-<span class="os-pagination-to">'. esc_html($showing_to) .'</span> '.esc_html__('of', 'latepoint').' <span class="os-pagination-total">'. esc_html($total_records). '</span>'; ?></div> |
| 31 | </div> |
| 32 | <div class="mobile-table-actions-trigger"><i class="latepoint-icon latepoint-icon-more-horizontal"></i></div> |
| 33 | <div class="table-actions"> |
| 34 | <a data-os-lightbox-classes="width-700" data-os-action="<?php echo esc_attr(OsRouterHelper::build_route_name('bookings', 'customize_table')); ?>" href="#" data-os-output-target="lightbox" class="latepoint-btn latepoint-btn-grey latepoint-btn-outline download-csv-with-filters"><i class="latepoint-icon latepoint-icon-sliders"></i><span><?php esc_html_e('Table Settings', 'latepoint'); ?></span></a> |
| 35 | <?php if (OsSettingsHelper::can_download_records_as_csv()) { ?> |
| 36 | <a href="<?php echo esc_url(OsRouterHelper::build_admin_post_link(['bookings', 'index'])); ?>" target="_blank" class="latepoint-btn latepoint-btn-grey latepoint-btn-outline download-csv-with-filters"><i class="latepoint-icon latepoint-icon-download"></i><span><?php esc_html_e('Download .csv', 'latepoint'); ?></span></a> |
| 37 | <?php } ?> |
| 38 | </div> |
| 39 | </div> |
| 40 | <div class="os-bookings-list"> |
| 41 | <div class="os-scrollable-table-w"> |
| 42 | <div class="os-table-w os-table-compact"> |
| 43 | <table class="os-table os-reload-on-booking-update os-scrollable-table" data-route="<?php echo esc_attr(OsRouterHelper::build_route_name('bookings', 'index')); ?>"> |
| 44 | <?php echo OsFormHelper::hidden_field('filter[records_ordered_by_key]', $records_ordered_by_key, ['class' => 'records-ordered-by-key os-table-filter']); ?> |
| 45 | <?php echo OsFormHelper::hidden_field('filter[records_ordered_by_direction]', $records_ordered_by_direction, ['class' => 'records-ordered-by-direction os-table-filter']); ?> |
| 46 | <thead> |
| 47 | <tr> |
| 48 | <th class="os-sortable-column <?php if($records_ordered_by_key == 'booking_id') echo 'ordered-'.esc_attr($records_ordered_by_direction); ?>" data-order-key="booking_id"><?php esc_html_e('ID', 'latepoint'); ?></th> |
| 49 | <?php if(count($services_list) > 1) echo '<th>'.esc_html__('Service', 'latepoint').'</th>'; ?> |
| 50 | <th class="os-sortable-column <?php if($records_ordered_by_key == 'booking_start_datetime') echo 'ordered-'.esc_attr($records_ordered_by_direction); ?>" data-order-key="booking_start_datetime"><?php esc_html_e('Date/Time', 'latepoint'); ?></th> |
| 51 | <th class="os-sortable-column <?php if($records_ordered_by_key == 'booking_time_left') echo 'ordered-'.esc_attr($records_ordered_by_direction); ?>" data-order-key="booking_time_left"><?php esc_html_e('Time Left', 'latepoint'); ?></th> |
| 52 | <?php if(count($agents_list) > 1) echo '<th>'.esc_html__('Agent', 'latepoint').'</th>'; ?> |
| 53 | <?php if(count($locations_list) > 1) echo '<th>'.esc_html__('Location', 'latepoint').'</th>'; ?> |
| 54 | <th><?php esc_html_e('Customer', 'latepoint'); ?></th> |
| 55 | <th><?php esc_html_e('Status', 'latepoint'); ?></th> |
| 56 | <th><?php esc_html_e('Payment Status', 'latepoint'); ?></th> |
| 57 | <th class="os-sortable-column <?php if($records_ordered_by_key == 'booking_created_on') echo 'ordered-'.esc_attr($records_ordered_by_direction); ?>" data-order-key="booking_created_on"><?php esc_html_e('Created On', 'latepoint'); ?></th> |
| 58 | <?php |
| 59 | foreach($selected_columns as $column_type => $columns){ |
| 60 | foreach($columns as $column_key){ |
| 61 | if(isset($available_columns[$column_type][$column_key])) echo '<th>'.esc_html($available_columns[$column_type][$column_key]).'</th>'; |
| 62 | } |
| 63 | } ?> |
| 64 | </tr> |
| 65 | <tr> |
| 66 | <th><?php echo OsFormHelper::text_field('filter[id]', false, '', ['placeholder' => __('ID', 'latepoint'), 'theme' => 'bordered', 'style' => 'width: 60px;', 'class' => 'os-table-filter']); ?></th> |
| 67 | <?php if(count($services_list) > 1) echo '<th>'.OsFormHelper::select_field('filter[service_id]', false, $services_list, '', ['placeholder' => __('All Services', 'latepoint'), 'class' => 'os-table-filter']).'</th>'; ?> |
| 68 | <th> |
| 69 | <div class="os-form-group"> |
| 70 | <div class="os-date-range-picker os-table-filter-datepicker" data-can-be-cleared="yes" data-no-value-label="<?php esc_html_e('Search by Appointment Date', 'latepoint'); ?>" data-clear-btn-label="<?php esc_html_e('Reset Date Search', 'latepoint'); ?>"> |
| 71 | <span class="range-picker-value"><?php esc_html_e('Filter Date', 'latepoint'); ?></span> |
| 72 | <i class="latepoint-icon latepoint-icon-chevron-down"></i> |
| 73 | <input type="hidden" class="os-table-filter os-datepicker-date-from" name="filter[booking_date_from]" value=""/> |
| 74 | <input type="hidden" class="os-table-filter os-datepicker-date-to" name="filter[booking_date_to]" value=""/> |
| 75 | </div> |
| 76 | </div> |
| 77 | </th> |
| 78 | <th><?php echo OsFormHelper::select_field('filter[time_status]', false, ['upcoming' => __('Upcoming', 'latepoint'), 'past' => __('Past', 'latepoint'), 'now' => __('Happening Now', 'latepoint')], '', ['placeholder' => __('Show All', 'latepoint'), 'class' => 'os-table-filter']); ?></th> |
| 79 | <?php if(count($agents_list) > 1) echo '<th>'.OsFormHelper::select_field('filter[agent_id]', false, $agents_list, '', ['placeholder' => __('All Agents', 'latepoint'), 'class' => 'os-table-filter']).'</th>'; ?> |
| 80 | <?php if(count($locations_list) > 1) echo '<th>'.OsFormHelper::select_field('filter[location_id]', false, $locations_list, '', ['placeholder' => __('All Locations', 'latepoint'), 'class' => 'os-table-filter']).'</th>'; ?> |
| 81 | <th><?php echo OsFormHelper::text_field('filter[customer][full_name]', false, '', ['class' => 'os-table-filter', 'theme' => 'bordered', 'placeholder' => __('Search by Customer', 'latepoint')]); ?></th> |
| 82 | <th><?php echo OsFormHelper::select_field('filter[status]', false, OsBookingHelper::get_statuses_list(), '', ['placeholder' => __('Show All', 'latepoint'), 'class' => 'os-table-filter']); ?></th> |
| 83 | <th><?php echo OsFormHelper::select_field('filter[order][payment_status]', false, OsOrdersHelper::get_order_payment_statuses_list(), '', ['placeholder' => __('Show All', 'latepoint'), 'class' => 'os-table-filter']); ?></th> |
| 84 | <th> |
| 85 | <div class="os-form-group"> |
| 86 | <div class="os-date-range-picker os-table-filter-datepicker" data-can-be-cleared="yes" data-no-value-label="<?php esc_attr_e('Filter Date', 'latepoint'); ?>" data-clear-btn-label="<?php esc_attr_e('Reset Date Search', 'latepoint'); ?>"> |
| 87 | <span class="range-picker-value"><?php esc_html_e('Filter Date', 'latepoint'); ?></span> |
| 88 | <i class="latepoint-icon latepoint-icon-chevron-down"></i> |
| 89 | <input type="hidden" class="os-table-filter os-datepicker-date-from" name="filter[created_date_from]" value=""/> |
| 90 | <input type="hidden" class="os-table-filter os-datepicker-date-to" name="filter[created_date_to]" value=""/> |
| 91 | </div> |
| 92 | </div> |
| 93 | </th> |
| 94 | <?php |
| 95 | foreach($selected_columns as $column_type => $columns){ |
| 96 | foreach($columns as $column_key){ |
| 97 | if(!isset($available_columns[$column_type][$column_key])) continue; |
| 98 | // if column belongs to non booking object (customer, transaction, agent etc... build appropriate name for filter var) |
| 99 | $field_name = ($column_type != 'booking') ? 'filter['.$column_type.']['.$column_key.']' : 'filter['.$column_key.']'; |
| 100 | // skip the search box if the property is "magic" (accessed via __get), because we can't query DB with that |
| 101 | if($column_type == 'booking' && !property_exists('OsBookingModel', $column_key)){ |
| 102 | $filter_input = ''; |
| 103 | }else{ |
| 104 | $filter_input = OsFormHelper::text_field($field_name, false, '', ['class' => 'os-table-filter', 'theme' => 'bordered', 'placeholder' => $available_columns[$column_type][$column_key]]); |
| 105 | } |
| 106 | echo '<th>'.$filter_input.'</th>'; |
| 107 | } |
| 108 | } ?> |
| 109 | </tr> |
| 110 | </thead> |
| 111 | <tbody> |
| 112 | <?php include('_table_body.php'); ?> |
| 113 | </tbody> |
| 114 | <tfoot> |
| 115 | <tr> |
| 116 | <th><?php esc_html_e('ID', 'latepoint'); ?></th> |
| 117 | <?php if(count($services_list) > 1) echo '<th>'.esc_html__('Service', 'latepoint').'</th>'; ?> |
| 118 | <th><?php esc_html_e('Date/Time', 'latepoint'); ?></th> |
| 119 | <th><?php esc_html_e('Time Left', 'latepoint'); ?></th> |
| 120 | <?php if(count($agents_list) > 1) echo '<th>'.esc_html__('Agent', 'latepoint').'</th>'; ?> |
| 121 | <?php if(count($locations_list) > 1) echo '<th>'.esc_html__('Location', 'latepoint').'</th>'; ?> |
| 122 | <th><?php esc_html_e('Customer', 'latepoint'); ?></th> |
| 123 | <th><?php esc_html_e('Status', 'latepoint'); ?></th> |
| 124 | <th><?php esc_html_e('Payment Status', 'latepoint'); ?></th> |
| 125 | <th><?php esc_html_e('Created On', 'latepoint'); ?></th> |
| 126 | <?php |
| 127 | foreach($selected_columns as $column_type => $columns){ |
| 128 | foreach($columns as $column_key){ |
| 129 | if(isset($available_columns[$column_type][$column_key])) echo '<th>'.esc_html($available_columns[$column_type][$column_key]).'</th>'; |
| 130 | } |
| 131 | } ?> |
| 132 | </tr> |
| 133 | </tfoot> |
| 134 | </table> |
| 135 | </div> |
| 136 | </div> |
| 137 | </div> |
| 138 | <div class="os-pagination-w"> |
| 139 | <div class="pagination-info"><?php echo esc_html('Showing', 'latepoint'). ' <span class="os-pagination-from">'. esc_html($showing_from) . '</span>-<span class="os-pagination-to">'. esc_html($showing_to) .'</span> '.esc_html__('of', 'latepoint').' <span class="os-pagination-total">'. esc_html($total_records). '</span>'; ?></div> |
| 140 | <div class="pagination-page-select-w"> |
| 141 | <label for="tablePaginationPageSelector"><?php esc_html_e('Page:', 'latepoint'); ?></label> |
| 142 | <select id="tablePaginationPageSelector" name="page" class="pagination-page-select"> |
| 143 | <?php |
| 144 | for($i = 1; $i <= $total_pages; $i++){ |
| 145 | $selected = ($current_page_number == $i) ? 'selected' : ''; |
| 146 | echo '<option '.$selected.'>'.esc_html($i).'</option>'; |
| 147 | } ?> |
| 148 | </select> |
| 149 | </div> |
| 150 | </div> |
| 151 | </div> |
| 152 | |
| 153 | <?php }else{ ?> |
| 154 | <div class="no-results-w"> |
| 155 | <div class="icon-w"><i class="latepoint-icon latepoint-icon-book"></i></div> |
| 156 | <h2><?php esc_html_e('No Existing Appointments Found', 'latepoint'); ?></h2> |
| 157 | <a href="#" <?php echo OsOrdersHelper::quick_order_btn_html(); ?> class="latepoint-btn"><i class="latepoint-icon latepoint-icon-plus"></i><span><?php esc_html_e('Add First Appointment', 'latepoint'); ?></span></a> |
| 158 | </div> |
| 159 | <?php } ?> |