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