PluginProbe ʕ •ᴥ•ʔ
VikAppointments Services Booking Calendar / 1.2.20
VikAppointments Services Booking Calendar v1.2.20
1.2.21 1.2.20 trunk 1.2.17 1.2.18 1.2.19
vikappointments / admin / views / caldays / tmpl / default_modal.php
vikappointments / admin / views / caldays / tmpl Last commit date
default.php 1 month ago default_calendar.php 1 month ago default_create_modal.php 1 month ago default_day.php 1 month ago default_filterbar.php 1 month ago default_modal.php 1 month ago default_sidebar.php 1 month ago index.html 1 month ago
default_modal.php
110 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 $vik = VAPApplication::getInstance();
15
16 echo JHtml::fetch(
17 'bootstrap.renderModal',
18 'jmodal-purchinfo',
19 array(
20 'title' => JText::translate('VAPMANAGERESERVATIONTITLE1'),
21 'closeButton' => true,
22 'keyboard' => false,
23 'bodyHeight' => 80,
24 'url' => '', // it will be filled dinamically
25 'footer' => '<button type="button" class="btn btn-danger" data-role="reservation.delete" data-id="" style="float:left;">' . JText::translate('VAPDELETE') . '</button>'
26 . '<button type="button" class="btn btn-success" data-role="reservation.edit" data-id="">' . JText::translate('VAPEDIT') . '</button>',
27 )
28 );
29
30 JText::script('VAPRESERVATIONREMOVEMESSAGE');
31
32 ?>
33
34 <script>
35
36 jQuery(function($) {
37
38 var editButton = $('button[data-role="reservation.edit"]');
39 var deleteButton = $('button[data-role="reservation.delete"]');
40
41 $('div.time-starts').on('click', function() {
42 var ids = $(this).data('id');
43
44 if (isNaN(ids)) {
45 ids = ids.split(',');
46 } else {
47 ids = [ids];
48 }
49
50 url = 'index.php?option=com_vikappointments&view=orderinfo&tmpl=component';
51
52 for (var i = 0; i < ids.length; i++) {
53 url += '&cid[]=' + ids[i];
54 }
55
56 vapUpdateModalButtons(ids);
57
58 vapOpenJModal('purchinfo', url, true);
59 });
60
61 editButton.on('click', function() {
62 // get selected ID
63 var id = $(this).attr('data-id');
64
65 if (!id.length) {
66 return false;
67 }
68
69 // go to management page
70 document.location.href = 'index.php?option=com_vikappointments&task=reservation.edit&from=caldays&cid[]=' + id;
71 });
72
73 deleteButton.on('click', function() {
74 // get selected ID
75 var id = $(this).attr('data-id');
76
77 if (!id.length) {
78 return false;
79 }
80
81 // ask for confirmation before delete
82 var r = confirm(Joomla.JText._('VAPRESERVATIONREMOVEMESSAGE'));
83
84 if (r) {
85 // delete reservation
86 document.location.href = '<?php echo $vik->addUrlCSRF('index.php?option=com_vikappointments&task=reservation.delete&from=caldays'); ?>&cid[]=' + id;
87 }
88 });
89
90 });
91
92 function vapUpdateModalButtons(ids) {
93 if (ids && !Array.isArray(ids)) {
94 ids = [ids];
95 }
96
97 var editButton = jQuery('button[data-role="reservation.edit"]');
98 var deleteButton = jQuery('button[data-role="reservation.delete"]');
99
100 if (ids && ids.length == 1) {
101 deleteButton.attr('data-id', ids[0]).prop('disabled', false);
102 editButton.attr('data-id', ids[0]).prop('disabled', false);
103 } else {
104 deleteButton.attr('data-id', '').prop('disabled', true);
105 editButton.attr('data-id', '').prop('disabled', true);
106 }
107 }
108
109 </script>
110