query_results.php
72 lines
| 1 | <?php |
| 2 | /* @var $bookings OsBookingModel[] */ |
| 3 | /* @var $services OsServiceModel[] */ |
| 4 | /* @var $agents OsAgentModel[] */ |
| 5 | |
| 6 | if ( ! defined( 'ABSPATH' ) ) { |
| 7 | exit; // Exit if accessed directly |
| 8 | } |
| 9 | |
| 10 | |
| 11 | ?> |
| 12 | <div class="latepoint-top-search-results"> |
| 13 | |
| 14 | <h3><i class="latepoint-icon latepoint-icon-calendar"></i><span><?php esc_html_e('Appointments', 'latepoint'); ?></span></h3> |
| 15 | <?php if(!empty($bookings)){ ?> |
| 16 | <div class="latepoint-search-results-tiles-w"> |
| 17 | <?php foreach($bookings as $booking){ ?> |
| 18 | <a href="#" <?php echo OsBookingHelper::quick_booking_btn_html($booking->id); ?> class="booking-result latepoint-search-result"> |
| 19 | <div class="avatar" style="background-image: url(<?php echo esc_url($booking->service->selection_image_url); ?>)"></div> |
| 20 | <div class="name"><?php echo preg_replace("/($query)/i", "<strong>$1</strong>", esc_html($booking->booking_code)); ?></div> |
| 21 | </a> |
| 22 | <?php } ?> |
| 23 | </div> |
| 24 | <?php }else{ |
| 25 | echo '<div class="search-no-results">'.esc_html__('No Matched Appointments found.', 'latepoint').' <a href="#" '.OsOrdersHelper::quick_order_btn_html().'>'.esc_html__('Add Appointment', 'latepoint').'</a></div>'; |
| 26 | } ?> |
| 27 | <h3><i class="latepoint-icon latepoint-icon-users"></i><span><?php esc_html_e('Customers', 'latepoint'); ?></span></h3> |
| 28 | <?php if(!empty($customers)){ ?> |
| 29 | <div class="latepoint-search-results-tiles-w"> |
| 30 | <?php foreach($customers as $customer){ ?> |
| 31 | <a href="#" <?php echo OsCustomerHelper::quick_customer_btn_html($customer->id); ?> class="customer-result latepoint-search-result"> |
| 32 | <div class="avatar" style="background-image: url(<?php echo esc_url($customer->avatar_url); ?>)"></div> |
| 33 | <div class="name"><?php echo preg_replace("/($query)/i", "<strong>$1</strong>", esc_html($customer->full_name)); ?></div> |
| 34 | </a> |
| 35 | <?php } ?> |
| 36 | </div> |
| 37 | <?php }else{ |
| 38 | echo '<div class="search-no-results">'.esc_html__('No Matched Customers found.', 'latepoint').' <a href="#" '.OsCustomerHelper::quick_customer_btn_html().'>'.esc_html__('Add Customer', 'latepoint').'</a></div>'; |
| 39 | } ?> |
| 40 | <?php if(OsRolesHelper::can_user('agent__view')){ |
| 41 | // This results are only for admins |
| 42 | ?> |
| 43 | <h3><i class="latepoint-icon latepoint-icon-briefcase"></i><span><?php esc_html_e('Agents', 'latepoint'); ?></span></h3> |
| 44 | <?php if(!empty($agents)){ ?> |
| 45 | <div class="latepoint-search-results-tiles-w"> |
| 46 | <?php foreach($agents as $agent){ ?> |
| 47 | <a href="<?php echo esc_url(OsRouterHelper::build_link(OsRouterHelper::build_route_name('agents', 'edit_form'), array('id' => $agent->id) )); ?>" class="agent-result latepoint-search-result"> |
| 48 | <div class="avatar" style="background-image: url(<?php echo esc_url($agent->avatar_url); ?>)"></div> |
| 49 | <div class="name"><?php echo preg_replace("/($query)/i", "<strong>$1</strong>", esc_html($agent->full_name)); ?></div> |
| 50 | </a> |
| 51 | <?php } ?> |
| 52 | </div> |
| 53 | <?php }else{ |
| 54 | echo '<div class="search-no-results">'.esc_html__('No Matched Agents found.', 'latepoint').' <a href="'.esc_url(OsRouterHelper::build_link(OsRouterHelper::build_route_name('agents', 'create'))).'">'.esc_html__('Add Agent', 'latepoint').'</a></div>'; |
| 55 | } ?> |
| 56 | <?php } ?> |
| 57 | <?php if(OsRolesHelper::can_user('service__view')){ ?> |
| 58 | <h3><i class="latepoint-icon latepoint-icon-shopping-bag"></i><span><?php esc_html_e('Services', 'latepoint'); ?></span></h3> |
| 59 | <?php if(!empty($services)){ ?> |
| 60 | <div class="latepoint-search-results-tiles-w"> |
| 61 | <?php foreach($services as $service){ ?> |
| 62 | <a href="<?php echo esc_url(OsRouterHelper::build_link(OsRouterHelper::build_route_name('services', 'edit_form'), array('id' => $service->id) )); ?>" class="service-result latepoint-search-result"> |
| 63 | <div class="avatar" style="background-image: url(<?php echo esc_url($service->selection_image_url); ?>)"></div> |
| 64 | <div class="name"><?php echo preg_replace("/($query)/i", "<strong>$1</strong>", esc_html($service->name)); ?></div> |
| 65 | </a> |
| 66 | <?php } ?> |
| 67 | </div> |
| 68 | <?php }else{ |
| 69 | echo '<div class="search-no-results">'.esc_html__('No Matched Services found.', 'latepoint').' <a href="'.esc_url(OsRouterHelper::build_link(OsRouterHelper::build_route_name('services', 'create'))).'">'.esc_html__('Add Service', 'latepoint').'</a></div>'; |
| 70 | } ?> |
| 71 | <?php } ?> |
| 72 | </div> |