PluginProbe ʕ •ᴥ•ʔ
VikAppointments Services Booking Calendar / 1.2.21
VikAppointments Services Booking Calendar v1.2.21
1.2.21 1.2.20 trunk 1.2.17 1.2.18 1.2.19
vikappointments / admin / views / findreservation / tmpl / default.php
vikappointments / admin / views / findreservation / tmpl Last commit date
default.php 4 days ago default_calendar.php 4 days ago default_filters.php 4 days ago default_timeline.php 4 days ago index.html 4 days ago
default.php
145 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 JHtml::fetch('bootstrap.tooltip', '.hasTooltip');
15 JHtml::fetch('vaphtml.assets.fontawesome');
16 JHtml::fetch('vaphtml.assets.select2');
17
18 $vik = VAPApplication::getInstance();
19
20 ?>
21
22 <form name="adminForm" action="index.php" method="post" id="adminForm">
23
24 <?php echo $vik->openCard(); ?>
25
26 <!-- SEARCH FILTERS -->
27
28 <?php echo $this->loadTemplate('filters'); ?>
29
30 <!-- CALENDAR -->
31
32 <?php echo $this->loadTemplate('calendar'); ?>
33
34 <!-- TIMELINE -->
35
36 <?php echo $this->loadTemplate('timeline'); ?>
37
38 <?php echo $vik->closeCard(); ?>
39
40 <?php echo JHtml::fetch('form.token'); ?>
41
42 <input type="hidden" name="day" value="<?php echo $this->filters['day']; ?>" id="vapdayselected" />
43 <input type="hidden" name="id_res" value="<?php echo $this->filters['id_res']; ?>" />
44 <input type="hidden" name="cid[]" value="<?php echo $this->filters['id_res']; ?>" />
45
46 <input type="hidden" name="hour" value="" />
47 <input type="hidden" name="min" value="" />
48
49 <input type="hidden" name="option" value="com_vikappointments" />
50 <input type="hidden" name="task" value="" />
51 <input type="hidden" name="view" value="findreservation" />
52 </form>
53
54 <?php
55 echo JHtml::fetch(
56 'bootstrap.renderModal',
57 'jmodal-respinfo',
58 array(
59 'title' => JText::translate('VAPMANAGERESERVATIONTITLE1'),
60 'closeButton' => true,
61 'keyboard' => false,
62 'bodyHeight' => 80,
63 'url' => '',
64 'footer' => '<button type="button" class="btn btn-danger" data-role="reservation.delete" data-id="" style="float:left;">' . JText::translate('VAPDELETE') . '</button>'
65 . '<button type="button" class="btn btn-success" data-role="reservation.edit" data-id="">' . JText::translate('VAPEDIT') . '</button>',
66 )
67 );
68
69 JText::script('VAPRESERVATIONREMOVEMESSAGE');
70 ?>
71
72 <script>
73
74 jQuery(function($) {
75 var editButton = $('button[data-role="reservation.edit"]');
76 var deleteButton = $('button[data-role="reservation.delete"]');
77
78 editButton.on('click', function() {
79 // get selected ID
80 var id = $(this).attr('data-id');
81
82 if (!id.length) {
83 return false;
84 }
85
86 // go to management page
87 document.location.href = 'index.php?option=com_vikappointments&task=reservation.edit&from=findreservation&cid[]=' + id;
88 });
89
90 deleteButton.on('click', function() {
91 // get selected ID
92 var id = $(this).attr('data-id');
93
94 if (!id.length) {
95 return false;
96 }
97
98 // ask for confirmation before delete
99 var r = confirm(Joomla.JText._('VAPRESERVATIONREMOVEMESSAGE'));
100
101 if (r) {
102 // delete reservation
103 document.location.href = '<?php echo $vik->addUrlCSRF('index.php?option=com_vikappointments&task=reservation.delete&from=findreservation'); ?>&cid[]=' + id;
104 }
105 });
106 });
107
108 function displayDetailsView(ids) {
109 // build iframe URL
110 let url = 'index.php?option=com_vikappointments&view=orderinfo&tmpl=component';
111
112 ids.forEach((id) => {
113 url += '&cid[]=' + id;
114 });
115
116 // update modal buttons
117 vapUpdateModalButtons(ids);
118
119 // fade modal
120 vapOpenJModal('respinfo', url, true);
121 }
122
123 function vapUpdateModalButtons(ids) {
124 if (ids && !Array.isArray(ids)) {
125 ids = [ids];
126 }
127
128 var editButton = jQuery('button[data-role="reservation.edit"]');
129 var deleteButton = jQuery('button[data-role="reservation.delete"]');
130
131 if (ids && ids.length == 1) {
132 deleteButton.attr('data-id', ids[0]).prop('disabled', false);
133 editButton.attr('data-id', ids[0]).prop('disabled', false);
134 } else {
135 deleteButton.attr('data-id', '').prop('disabled', true);
136 editButton.attr('data-id', '').prop('disabled', true);
137 }
138 }
139
140 function vapOpenJModal(id, url, jqmodal) {
141 <?php echo $vik->bootOpenModalJS(); ?>
142 }
143
144 </script>
145