default.php
3 days ago
default_appointments.php
3 days ago
default_billing.php
3 days ago
default_draft.php
3 days ago
default_notes.php
3 days ago
default_packages.php
3 days ago
index.html
3 days ago
default_packages.php
316 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 | $config = VAPFactory::getConfig(); |
| 17 | $currency = VAPFactory::getCurrency(); |
| 18 | |
| 19 | ?> |
| 20 | |
| 21 | <!-- Define role to detect the supported hook --> |
| 22 | <!-- {"rule":"customizer","event":"onDisplayViewCustomerinfo","key":"packages.start","type":"field"} --> |
| 23 | |
| 24 | <?php |
| 25 | // plugins can use the "packages.start" key to introduce custom |
| 26 | // HTML before the packages list |
| 27 | if (isset($this->addons['packages.start'])) |
| 28 | { |
| 29 | echo $this->addons['packages.start']; |
| 30 | |
| 31 | // unset details form to avoid displaying it twice |
| 32 | unset($this->addons['packages.start']); |
| 33 | } |
| 34 | ?> |
| 35 | |
| 36 | <table class="order-status-table"> |
| 37 | |
| 38 | <thead> |
| 39 | <tr> |
| 40 | |
| 41 | <!-- Order Number --> |
| 42 | |
| 43 | <th width="20%" style="text-align: left;"> |
| 44 | <?php echo JText::translate('VAPMANAGERESERVATION1'); ?> |
| 45 | </th> |
| 46 | |
| 47 | <!-- Used App. --> |
| 48 | |
| 49 | <th width="10%" style="text-align: left;"> |
| 50 | <?php echo JText::translate('VAPMANAGEPACKORDER16'); ?> |
| 51 | </th> |
| 52 | |
| 53 | <!-- Order Total --> |
| 54 | |
| 55 | <th width="10%" style="text-align: left;"> |
| 56 | <?php echo JText::translate('VAPMANAGERESERVATION9'); ?> |
| 57 | </th> |
| 58 | |
| 59 | <!-- Status --> |
| 60 | |
| 61 | <th width="10%" style="text-align: left;"> |
| 62 | <?php echo JText::translate('VAPMANAGERESERVATION12'); ?> |
| 63 | </th> |
| 64 | |
| 65 | <!-- Toggle --> |
| 66 | |
| 67 | <th width="2%" style="text-align: right;"> |
| 68 | <a href="javascript:void(0);" id="packages-toggle-all"> |
| 69 | <i class="fas fa-toggle-off medium-big"></i> |
| 70 | </a> |
| 71 | </th> |
| 72 | |
| 73 | </tr> |
| 74 | </thead> |
| 75 | |
| 76 | <tbody> |
| 77 | |
| 78 | <?php |
| 79 | foreach ($this->packages as $order) |
| 80 | { |
| 81 | ?> |
| 82 | <tr> |
| 83 | |
| 84 | <!-- Order Number, Creation Date --> |
| 85 | |
| 86 | <td> |
| 87 | <div class="td-primary"> |
| 88 | <?php echo $order->id . '-' . $order->sid; ?> |
| 89 | </div> |
| 90 | |
| 91 | <div class="td-secondary"> |
| 92 | <?php echo JHtml::fetch('date', $order->createdon, JText::translate('DATE_FORMAT_LC1') . ' ' . $config->get('timeformat')); ?> |
| 93 | </div> |
| 94 | </td> |
| 95 | |
| 96 | <!-- Used Appointments --> |
| 97 | |
| 98 | <td> |
| 99 | <div class="td-primary"> |
| 100 | <?php echo $order->usedApp . '/' . $order->totalApp; ?> |
| 101 | </div> |
| 102 | </td> |
| 103 | |
| 104 | <!-- Total --> |
| 105 | |
| 106 | <td> |
| 107 | <div class="td-primary"> |
| 108 | <?php echo $currency->format($order->totals->gross); ?> |
| 109 | </div> |
| 110 | |
| 111 | <div class="td-secondary"> |
| 112 | <?php |
| 113 | if ($order->totals->due) |
| 114 | { |
| 115 | // display remaining balance |
| 116 | echo JText::translate('VAPORDERDUE') . ': ' . $currency->format($order->totals->due); |
| 117 | } |
| 118 | ?> |
| 119 | </div> |
| 120 | </td> |
| 121 | |
| 122 | <!-- Status --> |
| 123 | |
| 124 | <td> |
| 125 | <?php echo JHtml::fetch('vaphtml.status.display', $order->status); ?> |
| 126 | </td> |
| 127 | |
| 128 | <!-- Toggle --> |
| 129 | |
| 130 | <td style="text-align: right;"> |
| 131 | <a href="javascript:void(0);" class="packages-res-toggle" data-id="<?php echo $order->id; ?>"> |
| 132 | <i class="fas fa-chevron-right medium-big"></i> |
| 133 | </a> |
| 134 | </td> |
| 135 | |
| 136 | </tr> |
| 137 | |
| 138 | <tr class="track-comment" id="pack-order-details-<?php echo $order->id; ?>" style="display:none;"> |
| 139 | |
| 140 | <!-- Packages --> |
| 141 | |
| 142 | <td colspan="5"> |
| 143 | |
| 144 | <?php |
| 145 | if ($order->packages) |
| 146 | { |
| 147 | ?> |
| 148 | <ul class="items-list"> |
| 149 | <?php |
| 150 | foreach ($order->packages as $pack) |
| 151 | { |
| 152 | ?> |
| 153 | <li class="item-row"> |
| 154 | |
| 155 | <div class="item-row-details"> |
| 156 | |
| 157 | <div class="item-name"><?php echo $pack->name; ?></div> |
| 158 | |
| 159 | <div class="item-redeemed"><?php echo JText::sprintf('VAPREDEEMEDPACKAGES', $pack->usedApp, $pack->totalApp); ?></div> |
| 160 | |
| 161 | <div class="item-quantity">x<?php echo $pack->quantity; ?></div> |
| 162 | |
| 163 | <div class="item-price"><?php echo $currency->format($pack->totals->gross); ?></div> |
| 164 | |
| 165 | </div> |
| 166 | |
| 167 | </li> |
| 168 | <?php |
| 169 | } |
| 170 | ?> |
| 171 | </ul> |
| 172 | <?php |
| 173 | } |
| 174 | else |
| 175 | { |
| 176 | echo $vik->alert(JText::translate('VAPRESNOEXTRAOPTIONS')); |
| 177 | } |
| 178 | ?> |
| 179 | |
| 180 | </td> |
| 181 | |
| 182 | </tr> |
| 183 | <?php |
| 184 | } |
| 185 | ?> |
| 186 | |
| 187 | </tbody> |
| 188 | |
| 189 | <?php |
| 190 | if ($this->packCount > 1) |
| 191 | { |
| 192 | ?> |
| 193 | <tfoot> |
| 194 | <tr> |
| 195 | <td> |
| 196 | <b><?php echo JText::plural('VAP_N_PACKAGES', $this->packCount); ?></b> |
| 197 | </td> |
| 198 | |
| 199 | <td style="text-align: right;"> |
| 200 | <?php echo JText::translate('VAPMANAGERESERVATION9'); ?> |
| 201 | </td> |
| 202 | |
| 203 | <td> |
| 204 | <b style="font-size: larger;"><?php echo $currency->format($this->packTotal); ?></b> |
| 205 | </td> |
| 206 | |
| 207 | <td> </td> |
| 208 | |
| 209 | <td> </td> |
| 210 | </tr> |
| 211 | </tfoot> |
| 212 | <?php |
| 213 | } |
| 214 | ?> |
| 215 | |
| 216 | </table> |
| 217 | |
| 218 | <!-- Define role to detect the supported hook --> |
| 219 | <!-- {"rule":"customizer","event":"onDisplayViewCustomerinfo","key":"packages.nav","type":"field"} --> |
| 220 | |
| 221 | <?php |
| 222 | // plugins can use the "packages.nav" key to introduce custom |
| 223 | // HTML between the packages list and the pagination |
| 224 | if (isset($this->addons['packages.nav'])) |
| 225 | { |
| 226 | echo $this->addons['packages.nav']; |
| 227 | |
| 228 | // unset details form to avoid displaying it twice |
| 229 | unset($this->addons['packages.nav']); |
| 230 | } |
| 231 | ?> |
| 232 | |
| 233 | <?php |
| 234 | if ($this->packNav) |
| 235 | { |
| 236 | echo '<br />' . $this->packNav; |
| 237 | } |
| 238 | ?> |
| 239 | |
| 240 | <!-- Define role to detect the supported hook --> |
| 241 | <!-- {"rule":"customizer","event":"onDisplayViewCustomerinfo","key":"packages.end","type":"field"} --> |
| 242 | |
| 243 | <?php |
| 244 | // plugins can use the "packages.end" key to introduce custom |
| 245 | // HTML after the packages list |
| 246 | if (isset($this->addons['packages.end'])) |
| 247 | { |
| 248 | echo $this->addons['packages.end']; |
| 249 | |
| 250 | // unset details form to avoid displaying it twice |
| 251 | unset($this->addons['packages.end']); |
| 252 | } |
| 253 | ?> |
| 254 | |
| 255 | <script> |
| 256 | |
| 257 | jQuery(function($) { |
| 258 | const toggleAll = (link, status) => { |
| 259 | var toggle = 0; |
| 260 | |
| 261 | if ($(link).find('i').hasClass('fa-toggle-off') || status == 1) { |
| 262 | // open |
| 263 | $(link).find('i').removeClass('fa-toggle-off').addClass('fa-toggle-on'); |
| 264 | |
| 265 | toggle = 1; |
| 266 | } else { |
| 267 | // close |
| 268 | $(link).find('i').removeClass('fa-toggle-on').addClass('fa-toggle-off'); |
| 269 | } |
| 270 | |
| 271 | if (status == undefined) { |
| 272 | $('.packages-res-toggle').each(function() { |
| 273 | toggleDetails(this, toggle); |
| 274 | }); |
| 275 | } |
| 276 | } |
| 277 | |
| 278 | const toggleDetails = (link, status) => { |
| 279 | var id = $(link).data('id'); |
| 280 | |
| 281 | if (($(link).find('i').hasClass('fa-chevron-right') && status !== 0) || status == 1) { |
| 282 | // open |
| 283 | $(link).find('i').removeClass('fa-chevron-right').addClass('fa-chevron-down'); |
| 284 | |
| 285 | $('#pack-order-details-' + id).show(); |
| 286 | } else { |
| 287 | // close |
| 288 | $(link).find('i').removeClass('fa-chevron-down').addClass('fa-chevron-right'); |
| 289 | |
| 290 | $('#pack-order-details-' + id).hide(); |
| 291 | } |
| 292 | |
| 293 | if (status == undefined) { |
| 294 | var open = $('.packages-res-toggle i.fa-chevron-down').length; |
| 295 | |
| 296 | if (open > 0) { |
| 297 | // at least a record open |
| 298 | toggleAll($('#packages-toggle-all')[0], 1); |
| 299 | } else { |
| 300 | // all records closed |
| 301 | toggleAll($('#packages-toggle-all')[0], 0); |
| 302 | } |
| 303 | } |
| 304 | } |
| 305 | |
| 306 | $('#packages-toggle-all').on('click', function() { |
| 307 | toggleAll(this); |
| 308 | }); |
| 309 | |
| 310 | $('.packages-res-toggle').on('click', function() { |
| 311 | toggleDetails(this); |
| 312 | }); |
| 313 | }); |
| 314 | |
| 315 | </script> |
| 316 |