| @@ -1,29 +1,36 @@ | ||
| 1 | 1 | <?php |
| 2 | +defined( 'ABSPATH' ) || exit; | |
| 2 | 3 | |
| 3 | 4 | use Timetics\Core\Appointments\Appointment as Appointment; |
| 4 | 5 | use Timetics\Core\Staffs\Staff; |
| 5 | 6 | |
| 6 | -$meetings = Appointment::all([ | |
| 7 | - 'posts_per_page' => $limit | |
| 8 | -]); | |
| 7 | +$timetics_args = [ | |
| 8 | + 'posts_per_page' => $timetics_limit | |
| 9 | +]; | |
| 9 | 10 | |
| 10 | -$staffs = Staff::all(); | |
| 11 | -$terms = get_terms( [ | |
| 11 | +if ( ! current_user_can( 'manage_options' ) ) { | |
| 12 | + $timetics_args['visibility'] = 'enabled'; | |
| 13 | +} | |
| 14 | + | |
| 15 | +$timetics_meetings = Appointment::all($timetics_args); | |
| 16 | + | |
| 17 | +$timetics_staffs = Staff::all(); | |
| 18 | +$timetics_terms = get_terms( [ | |
| 12 | 19 | 'taxonomy' => 'timetics-meeting-category', |
| 13 | 20 | 'hide_empty' => false, |
| 14 | 21 | ] ); |
| 15 | 22 | |
| 16 | 23 | ?> |
| 17 | -<?php if ( $show_filter ) : ?> | |
| 24 | +<?php if ( $timetics_show_filter ) : ?> | |
| 18 | 25 | <div class="timetics-meeting-filter timetics-input"> |
| 19 | 26 | <div class="timetics-select-wrapper ant-select"> |
| 20 | 27 | <!-- Category List --> |
| 21 | 28 | <select type="select" id="timetics-filter-category" class="timetics-select ant-select-selector"> |
| 22 | 29 | <option value=""><?php esc_html_e( 'All Department', 'timetics' ); ?></option> |
| 23 | - <?php if ( $terms ): ?> | |
| 24 | - <?php foreach( $terms as $term ): ?> | |
| 25 | - <option value="<?php echo esc_attr( $term->term_id ); ?>"><?php echo esc_html( $term->name ); ?></option> | |
| 30 | + <?php if ( $timetics_terms ): ?> | |
| 31 | + <?php foreach( $timetics_terms as $timetics_term ): ?> | |
| 32 | + <option value="<?php echo esc_attr( $timetics_term->term_id ); ?>"><?php echo esc_html( $timetics_term->name ); ?></option> | |
| 26 | 33 | <?php endforeach; ?> |
| 27 | 34 | <?php endif; ?> |
| 28 | 35 | </select> |
| 29 | 36 | <!-- End Category List --> |
| @@ -29,15 +36,15 @@ | ||
| 29 | 36 | <!-- End Category List --> |
| 30 | 37 | |
| 31 | 38 | <!-- Staff List --> |
| 32 | 39 | <select type="select" id="timetics-filter-staff"class="timetics-select ant-select-selector"> |
| 33 | - <option value=""><?php esc_html_e( 'All Staff', 'timetics' ); ?></option> | |
| 34 | - <?php if ( $staffs ): ?> | |
| 35 | - <?php foreach( $staffs['items'] as $staff ): ?> | |
| 40 | + <option value=""><?php esc_html_e( 'All Organizers', 'timetics' ); ?></option> | |
| 41 | + <?php if ( $timetics_staffs ): ?> | |
| 42 | + <?php foreach( $timetics_staffs['items'] as $timetics_staff ): ?> | |
| 36 | 43 | <?php |
| 37 | - $staff = new Staff( $staff->ID ); | |
| 44 | + $timetics_staff = new Staff( $timetics_staff->ID ); | |
| 38 | 45 | ?> |
| 39 | - <option value="<?php echo esc_attr( $staff->get_id() ); ?>"><?php echo $staff->get_display_name(); ?></option> | |
| 46 | + <option value="<?php echo esc_attr( $timetics_staff->get_id() ); ?>"><?php echo esc_attr( $timetics_staff->get_full_name() ); ?></option> | |
| 40 | 47 | <?php endforeach; ?> |
| 41 | 48 | <?php endif; ?> |
| 42 | 49 | </select> |
| 43 | 50 | </div> |
| @@ -45,35 +52,35 @@ | ||
| 45 | 52 | </div> |
| 46 | 53 | <?php endif; ?> |
| 47 | 54 | |
| 48 | 55 | <div class="tt-meeting-list-wrapper toplevel_page_timetics"> |
| 49 | - <?php if(!empty($meetings['items'])) : ?> | |
| 56 | + <?php if(!empty($timetics_meetings['items'])) : ?> | |
| 50 | 57 | <?php |
| 51 | - foreach ($meetings['items'] as $item) { | |
| 52 | - $meeting = new Appointment($item->ID); | |
| 53 | - $staffs = $meeting->get_staff(); | |
| 54 | - $locations = $meeting->get_locations(); | |
| 55 | - $id = $meeting->get_id(); | |
| 56 | - $prices = $meeting->get_price(); | |
| 58 | + foreach ($timetics_meetings['items'] as $timetics_item) { | |
| 59 | + $timetics_meeting = new Appointment($timetics_item->ID); | |
| 60 | + $timetics_staffs = $timetics_meeting->get_staff(); | |
| 61 | + $timetics_locations = $timetics_meeting->get_locations(); | |
| 62 | + $timetics_id = $timetics_meeting->get_id(); | |
| 63 | + $timetics_prices = $timetics_meeting->get_price(); | |
| 57 | 64 | ?> |
| 58 | 65 | <div class="tt-meeting-list-item"> |
| 59 | 66 | <!-- meeting description --> |
| 60 | 67 | <div class="tt-meeting-information"> |
| 61 | 68 | <?php |
| 62 | - if (!empty($staffs)) { | |
| 69 | + if (!empty($timetics_staffs)) { | |
| 63 | 70 | |
| 64 | 71 | // Display both image and full name if there are two or fewer staff members |
| 65 | 72 | ?> |
| 66 | 73 | <ul class="tt-author"> |
| 67 | 74 | <?php |
| 68 | - foreach ($staffs as $key => $staff) { | |
| 75 | + foreach ($timetics_staffs as $timetics_key => $timetics_staff) { | |
| 69 | 76 | ?> |
| 70 | 77 | <li> |
| 71 | - <?php if ($staff['image']) { | |
| 78 | + <?php if ($timetics_staff['image']) { | |
| 72 | 79 | ?> |
| 73 | - <img src="<?php echo esc_url($staff['image']); ?>" alt="<?php echo esc_attr($staff['full_name']); ?>" /> | |
| 80 | + <img src="<?php echo esc_url($timetics_staff['image']); ?>" alt="<?php echo esc_attr($timetics_staff['full_name']); ?>" /> | |
| 74 | 81 | <?php } ?> |
| 75 | - <span><?php echo esc_html($staff['full_name']); ?></span> | |
| 82 | + <span><?php echo esc_html($timetics_staff['full_name']); ?></span> | |
| 76 | 83 | </li> |
| 77 | 84 | <?php |
| 78 | 85 | } |
| 79 | 86 | ?> |
| @@ -84,15 +91,15 @@ | ||
| 84 | 91 | ?> |
| 85 | 92 | </ul> |
| 86 | 93 | <h3 class="tt-title"> |
| 87 | 94 | <?php |
| 88 | - echo esc_html($meeting->get_name()); | |
| 95 | + echo esc_html($timetics_meeting->get_name()); | |
| 89 | 96 | ?> |
| 90 | 97 | </h3> |
| 91 | 98 | <?php |
| 92 | - if($meeting->get_description()) { | |
| 99 | + if($timetics_meeting->get_description()) { | |
| 93 | 100 | ?> |
| 94 | - <p><?php echo esc_html($meeting->get_description()); ?></p> | |
| 101 | + <p><?php echo esc_html($timetics_meeting->get_description()); ?></p> | |
| 95 | 102 | <?php |
| 96 | 103 | } |
| 97 | 104 | ?> |
| 98 | 105 | </div> |
| @@ -99,21 +106,21 @@ | ||
| 99 | 106 | <div class="tt-meeting-action"> |
| 100 | 107 | <!-- meeting info --> |
| 101 | 108 | <ul class="meeting-info-list"> |
| 102 | 109 | <!-- meeting duration --> |
| 103 | - <?php if (!empty($meeting->get_duration())) : ?> | |
| 110 | + <?php if (!empty($timetics_meeting->get_duration())) : ?> | |
| 104 | 111 | <li> |
| 105 | - <svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg"> | |
| 112 | + <svg width="20" height="20" viewBox="0 0 20 20" fill="CurrentColor" xmlns="http://www.w3.org/2000/svg"> | |
| 106 | 113 | <path fill-rule="evenodd" clip-rule="evenodd" d="M10 2C5.58172 2 2 5.58172 2 10C2 14.4183 5.58172 18 10 18C14.4183 18 18 14.4183 18 10C18 5.58172 14.4183 2 10 2ZM0 10C0 4.47715 4.47715 0 10 0C15.5228 0 20 4.47715 20 10C20 15.5228 15.5228 20 10 20C4.47715 20 0 15.5228 0 10ZM10 3.6C10.5523 3.6 11 4.04772 11 4.6V9.38197L14.0472 10.9056C14.5412 11.1526 14.7414 11.7532 14.4944 12.2472C14.2474 12.7412 13.6468 12.9414 13.1528 12.6944L9.55279 10.8944C9.214 10.725 9 10.3788 9 10V4.6C9 4.04772 9.44771 3.6 10 3.6Z"/> |
| 107 | 114 | </svg> |
| 108 | - <?php echo esc_html($meeting->get_duration()); ?> | |
| 115 | + <?php echo esc_html($timetics_meeting->get_duration()); ?> | |
| 109 | 116 | </li> |
| 110 | 117 | <?php endif; ?> |
| 111 | 118 | <!-- meeting price --> |
| 112 | 119 | |
| 113 | 120 | </ul> |
| 114 | - <button class="ant-btn ant-btn-primary ant-btn-block" data-id="<?php echo esc_attr($id); ?>"> | |
| 115 | - <?php echo esc_html__("Book Appointment", "timetics"); ?> | |
| 121 | + <button class="ant-btn ant-btn-primary ant-btn-block" data-id="<?php echo esc_attr($timetics_id); ?>"> | |
| 122 | + <?php echo esc_html__("Book Now", "timetics"); ?> | |
| 116 | 123 | </button> |
| 117 | 124 | </div> |
| 118 | 125 | </div> |
| 119 | 126 | <?php |