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 / site / layouts / blocks / paymentmethods.php
vikappointments / site / layouts / blocks Last commit date
calendar 2 days ago login 2 days ago payment 2 days ago alert.php 2 days ago carttotals.php 2 days ago checkout.php 2 days ago couponform.php 2 days ago index.html 2 days ago login.php 2 days ago options.php 2 days ago paymentmethods.php 2 days ago quickcontact.php 2 days ago reviews.php 2 days ago timeline.php 2 days ago waitlist.php 2 days ago
paymentmethods.php
161 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 $payments = isset($displayData['payments']) ? $displayData['payments'] : array();
15 $showdesc = isset($displayData['showdesc']) ? $displayData['showdesc'] : true;
16 $id_payment = isset($displayData['id_payment']) ? $displayData['id_payment'] : null;
17
18 $payCount = count($payments);
19
20 ?>
21
22 <h3 class="vap-confirmapp-h3"><?php echo JText::translate('VAPMETHODOFPAYMENT'); ?></h3>
23
24 <div class="vap-payments-list">
25 <?php
26 foreach ($payments as $i => $p)
27 {
28 $cost_str = '';
29
30 if ($p['charge'] != 0)
31 {
32 $cost_str = (float) $p['charge'];
33
34 if ($cost_str > 0)
35 {
36 $cost_str = '+' . $cost_str;
37 }
38
39 $cost_str = VAPFactory::getCurrency()->format($cost_str);
40 }
41
42 if ($id_payment)
43 {
44 // select the specified payment gateway only
45 $selected = $p['id'] == $id_payment;
46 }
47 else
48 {
49 // auto-select the first one available
50 $selected = $i == 0;
51 }
52 ?>
53
54 <div class="vap-payment-wrapper vap-payment-block">
55
56 <div class="vap-payment-title">
57
58 <?php
59 if ($payCount > 1)
60 {
61 ?>
62 <input
63 type="radio"
64 name="id_payment"
65 value="<?php echo $p['id']; ?>"
66 id="vappayradio<?php echo $p['id']; ?>"
67 <?php echo $selected ? 'checked="checked"' : '' ?>
68 />
69 <?php
70 }
71 else
72 {
73 ?>
74 <input type="hidden" name="id_payment" value="<?php echo $p['id']; ?>" />
75 <?php
76 }
77 ?>
78
79 <label for="vappayradio<?php echo $p['id']; ?>" class="vap-payment-title-label">
80
81 <?php
82 if ($p['icontype'] == 1)
83 {
84 ?>
85 <i class="<?php echo $p['icon']; ?>"></i>&nbsp;
86 <?php
87 }
88 else if ($p['icontype'] == 2)
89 {
90 ?>
91 <img src="<?php echo JUri::root() . $p['icon']; ?>" alt="<?php echo $this->escape($p['name']); ?>" />&nbsp;
92 <?php
93 }
94 ?>
95
96 <span><?php echo $p['name'] . (strlen($cost_str) ? ' (' . $cost_str . ')' : ''); ?></span>
97
98 </label>
99
100 </div>
101
102 <?php
103 if (strlen($p['prenote']) && $showdesc)
104 {
105 ?>
106 <div class="vap-payment-description" id="vap-payment-description<?php echo $p['id']; ?>" style="<?php echo (!$selected ? 'display: none;' : ''); ?>">
107 <?php
108 /**
109 * Render HTML description to interpret attached plugins.
110 *
111 * @since 1.6.3
112 */
113 echo VikAppointments::renderHtmlDescription($p['prenote'], 'paymentconfirm');
114 ?>
115 </div>
116 <?php
117 }
118 ?>
119
120 </div>
121 <?php
122 }
123 ?>
124 </div>
125
126 <script>
127
128 jQuery(function($) {
129 $('.vap-payment-wrapper input[name="id_payment"]').on('change', function() {
130 $('.vap-payment-title-label').removeClass('vaprequired');
131
132 // get input parent
133 var block = $(this).closest('.vap-payment-block');
134 // get description block
135 var desc = $(block).find('.vap-payment-description');
136 // check if a description was visible
137 var was = $('.vap-payment-description:visible').length > 0;
138
139 if (desc.length == 0) {
140 // hide previous description with animation
141 // only if the selected payment doesn't
142 // have a description to display
143 $('.vap-payment-description').slideUp();
144 } else {
145 // otherwise hide as quick as possible
146 $('.vap-payment-description').hide();
147 }
148
149 if (was) {
150 // in case a description was already visible,
151 // show new description without animation
152 desc.show();
153 } else {
154 // animate in case there was no active payment
155 desc.slideDown();
156 }
157 });
158 });
159
160 </script>
161