| @@ -1,85 +1,133 @@ | ||
| 1 | 1 | <?php |
| 2 | +defined( 'ABSPATH' ) || exit; | |
| 2 | 3 | |
| 3 | 4 | use Timetics\Core\Appointments\Appointment as Appointment; |
| 5 | +use Timetics\Core\Staffs\Staff; | |
| 4 | 6 | |
| 5 | -$meetings = Appointment::all(); | |
| 7 | +$timetics_args = [ | |
| 8 | + 'posts_per_page' => $timetics_limit | |
| 9 | +]; | |
| 6 | 10 | |
| 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( [ | |
| 19 | + 'taxonomy' => 'timetics-meeting-category', | |
| 20 | + 'hide_empty' => false, | |
| 21 | +] ); | |
| 22 | + | |
| 7 | 23 | ?> |
| 24 | +<?php if ( $timetics_show_filter ) : ?> | |
| 25 | +<div class="timetics-meeting-filter timetics-input"> | |
| 26 | + <div class="timetics-select-wrapper ant-select"> | |
| 27 | + <!-- Category List --> | |
| 28 | + <select type="select" id="timetics-filter-category" class="timetics-select ant-select-selector"> | |
| 29 | + <option value=""><?php esc_html_e( 'All Department', 'timetics' ); ?></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> | |
| 33 | + <?php endforeach; ?> | |
| 34 | + <?php endif; ?> | |
| 35 | + </select> | |
| 36 | + <!-- End Category List --> | |
| 8 | 37 | |
| 9 | -<div class="tt-meeting-list-wrapper ant-row"> | |
| 10 | - <?php | |
| 11 | - foreach ($meetings['items'] as $item) { | |
| 12 | - $meeting = new Appointment($item->ID); | |
| 13 | - $staffs = $meeting->get_staff(); | |
| 14 | - $locations = $meeting->get_locations(); | |
| 15 | - $id = $meeting->get_id(); | |
| 16 | - $prices = $meeting->get_price(); | |
| 17 | - ?> | |
| 18 | - <div class="ant-col-8 ant-col-xs-24 ant-col-md-8"> | |
| 19 | - <div class="tt-meeting-list-item"> | |
| 20 | - <ul class="tt-author"> | |
| 38 | + <!-- Staff List --> | |
| 39 | + <select type="select" id="timetics-filter-staff"class="timetics-select ant-select-selector"> | |
| 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 ): ?> | |
| 21 | 43 | <?php |
| 22 | - if (!empty($staffs)) { | |
| 23 | - foreach ($staffs as $key => $staff) { | |
| 44 | + $timetics_staff = new Staff( $timetics_staff->ID ); | |
| 24 | 45 | ?> |
| 25 | - <li> | |
| 26 | - <img src="<?php echo esc_url($staff['image']); ?>" alt="<?php echo esc_attr($staff['full_name']); ?>" /> | |
| 27 | - <span><?php echo esc_html($staff['full_name']); ?></span> | |
| 28 | - </li> | |
| 29 | - <?php | |
| 46 | + <option value="<?php echo esc_attr( $timetics_staff->get_id() ); ?>"><?php echo esc_attr( $timetics_staff->get_full_name() ); ?></option> | |
| 47 | + <?php endforeach; ?> | |
| 48 | + <?php endif; ?> | |
| 49 | + </select> | |
| 50 | + </div> | |
| 51 | + <!-- Staff List End --> | |
| 52 | +</div> | |
| 53 | +<?php endif; ?> | |
| 30 | 54 | |
| 31 | - } | |
| 32 | - } | |
| 33 | - ?> | |
| 34 | - </ul> | |
| 35 | - <h3 class="tt-title"> | |
| 55 | +<div class="tt-meeting-list-wrapper toplevel_page_timetics"> | |
| 56 | + <?php if(!empty($timetics_meetings['items'])) : ?> | |
| 57 | + <?php | |
| 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(); | |
| 64 | + ?> | |
| 65 | + <div class="tt-meeting-list-item"> | |
| 66 | + <!-- meeting description --> | |
| 67 | + <div class="tt-meeting-information"> | |
| 36 | 68 | <?php |
| 37 | - echo esc_html($meeting->get_name()); | |
| 38 | - ?> | |
| 39 | - </h3> | |
| 40 | - <!-- meeting description --> | |
| 41 | - <p><?php echo esc_html($meeting->get_description()); ?></p> | |
| 69 | + if (!empty($timetics_staffs)) { | |
| 42 | 70 | |
| 43 | - <!-- meeting info --> | |
| 44 | - <ul class="meeting-info-list"> | |
| 45 | - <!-- meeting duration --> | |
| 46 | - <?php if (!empty($meeting->get_duration())) : ?> | |
| 47 | - <li> | |
| 48 | - <svg fill="#3263F8" width="18" height="18" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"> | |
| 49 | - <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" /> | |
| 50 | - </svg> | |
| 51 | - <?php echo esc_html($meeting->get_duration()); ?> | |
| 52 | - </li> | |
| 53 | - <?php endif; ?> | |
| 54 | - <!-- meeting price --> | |
| 71 | + // Display both image and full name if there are two or fewer staff members | |
| 72 | + ?> | |
| 73 | + <ul class="tt-author"> | |
| 74 | + <?php | |
| 75 | + foreach ($timetics_staffs as $timetics_key => $timetics_staff) { | |
| 76 | + ?> | |
| 77 | + <li> | |
| 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> | |
| 83 | + </li> | |
| 84 | + <?php | |
| 85 | + } | |
| 86 | + ?> | |
| 87 | + </ul> | |
| 88 | + <?php | |
| 55 | 89 | |
| 90 | + } | |
| 91 | + ?> | |
| 92 | + </ul> | |
| 93 | + <h3 class="tt-title"> | |
| 94 | + <?php | |
| 95 | + echo esc_html($timetics_meeting->get_name()); | |
| 96 | + ?> | |
| 97 | + </h3> | |
| 56 | 98 | <?php |
| 57 | - if (!empty($prices)) { | |
| 58 | - foreach ($prices as $key => $item) { | |
| 59 | - ?> | |
| 60 | - <?php if (!empty($meeting->get_price())) : ?> | |
| 61 | - <li> | |
| 62 | - <svg width="20" height="20" fill=#3161F1 viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"> | |
| 63 | - <path d="M17 3.5H7C4 3.5 2 5 2 8.5V15.5C2 19 4 20.5 7 20.5H17C20 20.5 22 19 22 15.5V8.5C22 5 20 3.5 17 3.5ZM6.25 14.5C6.25 14.91 5.91 15.25 5.5 15.25C5.09 15.25 4.75 14.91 4.75 14.5V9.5C4.75 9.09 5.09 8.75 5.5 8.75C5.91 8.75 6.25 9.09 6.25 9.5V14.5ZM12 15C10.34 15 9 13.66 9 12C9 10.34 10.34 9 12 9C13.66 9 15 10.34 15 12C15 13.66 13.66 15 12 15ZM19.25 14.5C19.25 14.91 18.91 15.25 18.5 15.25C18.09 15.25 17.75 14.91 17.75 14.5V9.5C17.75 9.09 18.09 8.75 18.5 8.75C18.91 8.75 19.25 9.09 19.25 9.5V14.5Z" /> | |
| 64 | - </svg> | |
| 65 | - <?php echo timetics_get_option('currency', 'USD') . " " . esc_html($item['ticket_price']); ?> | |
| 66 | - </li> | |
| 67 | - <?php endif; ?> | |
| 68 | - <?php | |
| 99 | + if($timetics_meeting->get_description()) { | |
| 100 | + ?> | |
| 101 | + <p><?php echo esc_html($timetics_meeting->get_description()); ?></p> | |
| 102 | + <?php | |
| 69 | 103 | } |
| 70 | - } | |
| 71 | 104 | ?> |
| 105 | + </div> | |
| 106 | + <div class="tt-meeting-action"> | |
| 107 | + <!-- meeting info --> | |
| 108 | + <ul class="meeting-info-list"> | |
| 109 | + <!-- meeting duration --> | |
| 110 | + <?php if (!empty($timetics_meeting->get_duration())) : ?> | |
| 111 | + <li> | |
| 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()); ?> | |
| 116 | + </li> | |
| 117 | + <?php endif; ?> | |
| 118 | + <!-- meeting price --> | |
| 72 | 119 | |
| 73 | - | |
| 74 | - </ul> | |
| 75 | - <button class="ant-btn ant-btn-primary ant-btn-block" data-id="<?php echo esc_attr($id); ?>"> | |
| 76 | - <?php echo esc_html__("Book Appointment", "timetics"); ?> | |
| 77 | - </button> | |
| 78 | - | |
| 79 | - <div class="timetics-booking-modal"></div> | |
| 120 | + </ul> | |
| 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"); ?> | |
| 123 | + </button> | |
| 124 | + </div> | |
| 80 | 125 | </div> |
| 81 | - </div> | |
| 82 | - <?php | |
| 83 | - } | |
| 84 | - ?> | |
| 126 | + <?php | |
| 127 | + } | |
| 128 | + ?> | |
| 129 | + <?php else: ?> | |
| 130 | + <p><?php echo esc_html__("No meetings found", "timetics")?></p> | |
| 131 | + <?php endif ;?> | |
| 132 | + <div class="timetics-booking-modal"></div> | |
| 85 | 133 | </div> |