table.php
65 lines
| 1 | <?php |
| 2 | /** |
| 3 | * @package VikAppointments |
| 4 | * @subpackage core |
| 5 | * @author E4J s.r.l. |
| 6 | * @copyright Copyright (C) 2021 E4J s.r.l. All Rights Reserved. |
| 7 | * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL |
| 8 | * @link https://vikwp.com |
| 9 | */ |
| 10 | |
| 11 | // No direct access |
| 12 | defined('ABSPATH') or die('No script kiddies please!'); |
| 13 | |
| 14 | extract($displayData); |
| 15 | |
| 16 | /** |
| 17 | * Layout variables |
| 18 | * ----------------- |
| 19 | * @var string $url The URL used to load the time table via AJAX. |
| 20 | */ |
| 21 | |
| 22 | JText::script('VAPWAITLISTADDED0'); |
| 23 | |
| 24 | $loading_img = VAPASSETS_URI . 'css/images/loading.gif'; |
| 25 | |
| 26 | echo |
| 27 | <<<JS |
| 28 | function loadEmployeeAvailTable(id) { |
| 29 | UIAjax.do( |
| 30 | '$url', |
| 31 | { |
| 32 | id_emp: id, |
| 33 | id_ser: jQuery('#vapempblock' + id).data('service'), |
| 34 | date: jQuery('#vapempblock' + id).attr('data-day'), |
| 35 | }, |
| 36 | function(resp) { |
| 37 | jQuery('#vapempblock' + id).find('.emp-search-box-right').html(resp.html); |
| 38 | }, |
| 39 | function(err) { |
| 40 | jQuery('#vapempblock' + id).find('.emp-search-box-right').html( |
| 41 | '<div class="emp-search-error">' + (err.responseText || Joomla.JText._('VAPWAITLISTADDED0')) + '</div>' |
| 42 | ); |
| 43 | } |
| 44 | ); |
| 45 | } |
| 46 | |
| 47 | function showMoreTimesFromTable(id, btn) { |
| 48 | // display hidden times |
| 49 | jQuery('#avail-tbody' + id).find('.timetable-slot.hidden').removeClass('hidden').addClass('visible'); |
| 50 | // hide "show more" button |
| 51 | jQuery(btn).closest('.avail-table-footer').hide(); |
| 52 | } |
| 53 | |
| 54 | function loadOtherTableTimes(id, day) { |
| 55 | jQuery('#vapempblock' + id).find('.emp-search-box-right').html( |
| 56 | '<div class="emp-search-loading"><img src="$loading_img" /></div>' |
| 57 | ); |
| 58 | |
| 59 | jQuery('#vapempblock' + id).attr('data-day', day); |
| 60 | |
| 61 | loadEmployeeAvailTable(id); |
| 62 | } |
| 63 | JS |
| 64 | ; |
| 65 |