default.php
5 days ago
default_rules.php
5 days ago
default_rules_modal.php
5 days ago
default_tax.php
5 days ago
index.html
5 days ago
default.php
203 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.select2'); |
| 16 | JHtml::fetch('vaphtml.assets.fontawesome'); |
| 17 | |
| 18 | $tax = $this->tax; |
| 19 | |
| 20 | $vik = VAPApplication::getInstance(); |
| 21 | |
| 22 | /** |
| 23 | * Trigger event to display custom HTML. |
| 24 | * In case it is needed to include any additional fields, |
| 25 | * it is possible to create a plugin and attach it to an event |
| 26 | * called "onDisplayViewTax". The event method receives the |
| 27 | * view instance as argument. |
| 28 | * |
| 29 | * @since 1.7 |
| 30 | */ |
| 31 | $forms = $this->onDisplayView(); |
| 32 | |
| 33 | ?> |
| 34 | |
| 35 | <form name="adminForm" action="index.php" method="post" id="adminForm"> |
| 36 | |
| 37 | <?php echo $vik->openCard(); ?> |
| 38 | |
| 39 | <!-- MAIN --> |
| 40 | |
| 41 | <div class="span8"> |
| 42 | |
| 43 | <!-- TAX --> |
| 44 | |
| 45 | <div class="row-fluid"> |
| 46 | <div class="span12"> |
| 47 | <?php |
| 48 | echo $vik->openFieldset(JText::translate('VAPMANAGECOUPONFIELDSET1')); |
| 49 | echo $this->loadTemplate('tax'); |
| 50 | ?> |
| 51 | |
| 52 | <!-- Define role to detect the supported hook --> |
| 53 | <!-- {"rule":"customizer","event":"onDisplayViewTax","key":"tax","type":"field"} --> |
| 54 | |
| 55 | <?php |
| 56 | /** |
| 57 | * Look for any additional fields to be pushed within |
| 58 | * the "Details" fieldset (left-side). |
| 59 | * |
| 60 | * @since 1.7 |
| 61 | */ |
| 62 | if (isset($forms['tax'])) |
| 63 | { |
| 64 | echo $forms['tax']; |
| 65 | |
| 66 | // unset details form to avoid displaying it twice |
| 67 | unset($forms['tax']); |
| 68 | } |
| 69 | |
| 70 | echo $vik->closeFieldset(); |
| 71 | ?> |
| 72 | </div> |
| 73 | </div> |
| 74 | |
| 75 | <!-- DESCRIPTION --> |
| 76 | |
| 77 | <div class="row-fluid"> |
| 78 | <div class="span12"> |
| 79 | <?php echo $vik->openFieldset(JText::translate('VAPMANAGEOPTION3')); ?> |
| 80 | |
| 81 | <textarea name="description" class="full-width" style="height: 160px; resize: vertical;"><?php echo $tax->description; ?></textarea> |
| 82 | |
| 83 | <!-- Define role to detect the supported hook --> |
| 84 | <!-- {"rule":"customizer","event":"onDisplayViewTax","key":"description","type":"field"} --> |
| 85 | |
| 86 | <?php |
| 87 | /** |
| 88 | * Look for any additional fields to be pushed within |
| 89 | * the "Description" fieldset (left-side). |
| 90 | * |
| 91 | * @since 1.7 |
| 92 | */ |
| 93 | if (isset($forms['description'])) |
| 94 | { |
| 95 | echo $forms['description']; |
| 96 | |
| 97 | // unset details form to avoid displaying it twice |
| 98 | unset($forms['description']); |
| 99 | } |
| 100 | |
| 101 | echo $vik->closeFieldset(); |
| 102 | ?> |
| 103 | </div> |
| 104 | </div> |
| 105 | |
| 106 | </div> |
| 107 | |
| 108 | <!-- SIDEBAR --> |
| 109 | |
| 110 | <div class="span4"> |
| 111 | |
| 112 | <!-- Define role to detect the supported hook --> |
| 113 | <!-- {"rule":"customizer","event":"onDisplayViewTax","type":"fieldset"} --> |
| 114 | |
| 115 | <?php |
| 116 | /** |
| 117 | * Iterate remaining forms to be displayed within |
| 118 | * the sidebar (above "Rules" fieldset). |
| 119 | * |
| 120 | * @since 1.7 |
| 121 | */ |
| 122 | foreach ($forms as $formName => $formHtml) |
| 123 | { |
| 124 | $title = JText::translate($formName); |
| 125 | ?> |
| 126 | <div class="row-fluid"> |
| 127 | <div class="span12"> |
| 128 | <?php |
| 129 | echo $vik->openFieldset($title); |
| 130 | echo $formHtml; |
| 131 | echo $vik->closeFieldset(); |
| 132 | ?> |
| 133 | </div> |
| 134 | </div> |
| 135 | <?php |
| 136 | } |
| 137 | ?> |
| 138 | |
| 139 | <!-- RULES --> |
| 140 | |
| 141 | <div class="row-fluid"> |
| 142 | <div class="span12"> |
| 143 | <?php |
| 144 | $help = $vik->createPopover(array( |
| 145 | 'title' => JText::translate('VAPTAXRULEFIELDSET'), |
| 146 | 'content' => JText::translate('VAP_EDIT_SORT_DRAG_DROP'), |
| 147 | )); |
| 148 | |
| 149 | echo $vik->openFieldset(JText::translate('VAPTAXRULEFIELDSET') . $help); |
| 150 | echo $this->loadTemplate('rules'); |
| 151 | echo $vik->closeFieldset(); |
| 152 | ?> |
| 153 | </div> |
| 154 | </div> |
| 155 | |
| 156 | </div> |
| 157 | |
| 158 | <?php echo $vik->closeCard(); ?> |
| 159 | |
| 160 | <?php echo JHtml::fetch('form.token'); ?> |
| 161 | |
| 162 | <input type="hidden" name="id" value="<?php echo $tax->id; ?>" /> |
| 163 | <input type="hidden" name="task" value="" /> |
| 164 | <input type="hidden" name="option" value="com_vikappointments" /> |
| 165 | </form> |
| 166 | |
| 167 | <?php |
| 168 | $footer = '<button type="button" class="btn btn-success" data-role="save">' . JText::translate('JAPPLY') . '</button>'; |
| 169 | $footer .= '<button type="button" class="btn btn-danger" data-role="delete" style="float:right;">' . JText::translate('VAPDELETE') . '</button>'; |
| 170 | |
| 171 | // render inspector to manage tax rules |
| 172 | echo JHtml::fetch( |
| 173 | 'vaphtml.inspector.render', |
| 174 | 'tax-rule-inspector', |
| 175 | array( |
| 176 | 'title' => JText::translate('VAPMANAGECUSTOMF12'), |
| 177 | 'closeButton' => true, |
| 178 | 'keyboard' => true, |
| 179 | 'footer' => $footer, |
| 180 | 'width' => 400, |
| 181 | ), |
| 182 | $this->loadTemplate('rules_modal') |
| 183 | ); |
| 184 | ?> |
| 185 | |
| 186 | <script> |
| 187 | |
| 188 | // validate |
| 189 | |
| 190 | var validator = new VikFormValidator('#adminForm'); |
| 191 | |
| 192 | Joomla.submitbutton = function(task) { |
| 193 | if (task.indexOf('save') !== -1) { |
| 194 | if (validator.validate()) { |
| 195 | Joomla.submitform(task, document.adminForm); |
| 196 | } |
| 197 | } else { |
| 198 | Joomla.submitform(task, document.adminForm); |
| 199 | } |
| 200 | } |
| 201 | |
| 202 | </script> |
| 203 |