PluginProbe ʕ •ᴥ•ʔ
VikAppointments Services Booking Calendar / trunk
VikAppointments Services Booking Calendar vtrunk
trunk 1.2.17 1.2.18 1.2.19
vikappointments / admin / views / exportres / tmpl / default_params.php
vikappointments / admin / views / exportres / tmpl Last commit date
default.php 4 years ago default_details.php 2 years ago default_params.php 4 years ago index.html 7 years ago
default_params.php
80 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 ?>
17
18 <!-- PARAMETERS -->
19
20 <div class="vikpayparamdiv">
21 <?php echo $vik->alert(JText::translate('VAPMANAGEPAYMENT9')); ?>
22 </div>
23
24 <!-- CONNECTION ERROR -->
25
26 <div id="vikparamerr" style="display: none;">
27 <?php echo $vik->alert(JText::translate('VAP_AJAX_GENERIC_ERROR'), 'error'); ?>
28 </div>
29
30 <script>
31
32 jQuery(function($) {
33
34 $('#vap-driver-sel').on('change', function() {
35 // destroy select2
36 $('.vikpayparamdiv select').select2('destroy');
37 // unregister form fields
38 validator.unregisterFields('.vikpayparamdiv .required');
39
40 $('.vikpayparamdiv').html('');
41 $('#vikparamerr').hide();
42
43 // fetch driver form
44 UIAjax.do(
45 'index.php?option=com_vikappointments&task=exportres.getdriverformajax&tmpl=component',
46 {
47 driver: $(this).val(),
48 type: $('input[name="type"]').val(),
49 },
50 (resp) => {
51 $('.vikpayparamdiv').html(resp);
52
53 // render select
54 $('.vikpayparamdiv select').each(function() {
55 $(this).select2({
56 // disable search for select with 3 or lower options
57 minimumResultsForSearch: $(this).find('option').length > 3 ? 0 : -1,
58 allowClear: false,
59 width: '90%',
60 });
61 });
62
63 // register form fields for validation
64 validator.registerFields('.vikpayparamdiv .required');
65
66 // init helpers
67 $('.vikpayparamdiv .vap-quest-popover').popover({sanitize: false, container: 'body', trigger: 'hover', html: true});
68
69 $('.vikpayparamdiv').trigger('payment.load');
70 },
71 (error) => {
72 $('#vikparamerr').show();
73 }
74 );
75 });
76
77 });
78
79 </script>
80