| @@ -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 ) : ?> | |
| 18 | -<div class="timetics-meeting-filter ant-row timetics-input"> | |
| 24 | +<?php if ( $timetics_show_filter ) : ?> | |
| 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> |
| @@ -44,48 +51,36 @@ | ||
| 44 | 51 | <!-- Staff List End --> |
| 45 | 52 | </div> |
| 46 | 53 | <?php endif; ?> |
| 47 | 54 | |
| 48 | -<div class="tt-meeting-list-wrapper toplevel_page_timetics ant-row"> | |
| 49 | - <?php if(!empty($meetings['items'])) : ?> | |
| 55 | +<div class="tt-meeting-list-wrapper toplevel_page_timetics"> | |
| 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 | - <div class="ant-col-8 ant-col-xs-24 ant-col-md-8"> | |
| 59 | - <div class="tt-meeting-list-item"> | |
| 65 | + <div class="tt-meeting-list-item"> | |
| 66 | + <!-- meeting description --> | |
| 67 | + <div class="tt-meeting-information"> | |
| 60 | 68 | <?php |
| 61 | - if (!empty($staffs)) { | |
| 62 | - if (count($staffs) > 2) { | |
| 63 | - // Display only image for staff members if there are more than two | |
| 64 | - ?> | |
| 65 | - <ul class="tt-author tt-author-avatar-list"> | |
| 66 | - <?php | |
| 67 | - foreach ($staffs as $key => $staff) { | |
| 68 | - ?> | |
| 69 | - <li class="tt-single-host"> | |
| 70 | - <img src="<?php echo esc_url($staff['image']); ?>" alt="<?php echo esc_attr($staff['full_name']); ?>" /> | |
| 71 | - <div class="tt-tooltip-text"><?php echo esc_html($staff['full_name']); ?></div> | |
| 72 | - </li> | |
| 73 | - <?php | |
| 74 | - } | |
| 75 | - ?> | |
| 76 | - </ul> | |
| 77 | - <?php | |
| 78 | - } else { | |
| 69 | + if (!empty($timetics_staffs)) { | |
| 70 | + | |
| 79 | 71 | // Display both image and full name if there are two or fewer staff members |
| 80 | 72 | ?> |
| 81 | 73 | <ul class="tt-author"> |
| 82 | 74 | <?php |
| 83 | - foreach ($staffs as $key => $staff) { | |
| 75 | + foreach ($timetics_staffs as $timetics_key => $timetics_staff) { | |
| 84 | 76 | ?> |
| 85 | 77 | <li> |
| 86 | - <img src="<?php echo esc_url($staff['image']); ?>" alt="<?php echo esc_attr($staff['full_name']); ?>" /> | |
| 87 | - <span><?php echo esc_html($staff['full_name']); ?></span> | |
| 78 | + <?php if ($timetics_staff['image']) { | |
| 79 | + ?> | |
| 80 | + <img src="<?php echo esc_url($timetics_staff['image']); ?>" alt="<?php echo esc_attr($timetics_staff['full_name']); ?>" /> | |
| 81 | + <?php } ?> | |
| 82 | + <span><?php echo esc_html($timetics_staff['full_name']); ?></span> | |
| 88 | 83 | </li> |
| 89 | 84 | <?php |
| 90 | 85 | } |
| 91 | 86 | ?> |
| @@ -90,39 +85,43 @@ | ||
| 90 | 85 | } |
| 91 | 86 | ?> |
| 92 | 87 | </ul> |
| 93 | 88 | <?php |
| 94 | - } | |
| 89 | + | |
| 95 | 90 | } |
| 96 | 91 | ?> |
| 97 | 92 | </ul> |
| 98 | 93 | <h3 class="tt-title"> |
| 99 | 94 | <?php |
| 100 | - echo esc_html($meeting->get_name()); | |
| 95 | + echo esc_html($timetics_meeting->get_name()); | |
| 101 | 96 | ?> |
| 102 | 97 | </h3> |
| 103 | - <!-- meeting description --> | |
| 104 | - <p><?php echo esc_html($meeting->get_description()); ?></p> | |
| 105 | - | |
| 98 | + <?php | |
| 99 | + if($timetics_meeting->get_description()) { | |
| 100 | + ?> | |
| 101 | + <p><?php echo esc_html($timetics_meeting->get_description()); ?></p> | |
| 102 | + <?php | |
| 103 | + } | |
| 104 | + ?> | |
| 105 | + </div> | |
| 106 | + <div class="tt-meeting-action"> | |
| 106 | 107 | <!-- meeting info --> |
| 107 | 108 | <ul class="meeting-info-list"> |
| 108 | 109 | <!-- meeting duration --> |
| 109 | - <?php if (!empty($meeting->get_duration())) : ?> | |
| 110 | + <?php if (!empty($timetics_meeting->get_duration())) : ?> | |
| 110 | 111 | <li> |
| 111 | - <svg fill="#3263F8" width="18" height="18" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"> | |
| 112 | - <path d="M256 512C114.6 512 0 397.4 0 256S114.6 0 256 0S512 114.6 512 256s-114.6 256-256 256zM232 120V256c0 8 4 15.5 10.7 20l96 64c11 7.4 25.9 4.4 33.3-6.7s4.4-25.9-6.7-33.3L280 243.2V120c0-13.3-10.7-24-24-24s-24 10.7-24 24z" /> | |
| 113 | - </svg> | |
| 114 | - <?php echo esc_html($meeting->get_duration()); ?> | |
| 112 | + <svg width="20" height="20" viewBox="0 0 20 20" fill="CurrentColor" xmlns="http://www.w3.org/2000/svg"> | |
| 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"/> | |
| 114 | + </svg> | |
| 115 | + <?php echo esc_html($timetics_meeting->get_duration()); ?> | |
| 115 | 116 | </li> |
| 116 | 117 | <?php endif; ?> |
| 117 | 118 | <!-- meeting price --> |
| 118 | 119 | |
| 119 | 120 | </ul> |
| 120 | - <button class="ant-btn ant-btn-primary ant-btn-block" data-id="<?php echo esc_attr($id); ?>"> | |
| 121 | - <?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"); ?> | |
| 122 | 123 | </button> |
| 123 | - | |
| 124 | - <div class="timetics-booking-modal"></div> | |
| 125 | 124 | </div> |
| 126 | 125 | </div> |
| 127 | 126 | <?php |
| 128 | 127 | } |
| @@ -129,5 +128,6 @@ | ||
| 129 | 128 | ?> |
| 130 | 129 | <?php else: ?> |
| 131 | 130 | <p><?php echo esc_html__("No meetings found", "timetics")?></p> |
| 132 | 131 | <?php endif ;?> |
| 132 | + <div class="timetics-booking-modal"></div> | |
| 133 | 133 | </div> |