default.php
206 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 | ?> |
| 15 | |
| 16 | <div class="vap-allorders-userhead"> |
| 17 | <div class="vap-allorders-userleft"> |
| 18 | <h2><?php echo JText::sprintf('VAPALLORDERSTITLE', $this->user->name); ?></h2> |
| 19 | </div> |
| 20 | |
| 21 | <div class="vap-allorders-userright"> |
| 22 | <?php |
| 23 | if ($this->hasSubscriptions) |
| 24 | { |
| 25 | ?> |
| 26 | <a href="<?php echo JRoute::rewrite('index.php?option=com_vikappointments&view=subscrhistory' . ($this->itemid ? '&Itemid=' . $this->itemid : '')); ?>" class="vap-btn blue"> |
| 27 | <?php echo JText::translate('VAPALLORDERSSUBSCRBUTTON'); ?> |
| 28 | </a> |
| 29 | <?php |
| 30 | } |
| 31 | |
| 32 | if ($this->hasPackages) |
| 33 | { |
| 34 | ?> |
| 35 | <a href="<?php echo JRoute::rewrite('index.php?option=com_vikappointments&view=packorders' . ($this->itemid ? '&Itemid=' . $this->itemid : '')); ?>" class="vap-btn blue"> |
| 36 | <?php echo JText::translate('VAPALLORDERSPACKBUTTON'); ?> |
| 37 | </a> |
| 38 | <?php |
| 39 | } |
| 40 | ?> |
| 41 | |
| 42 | <a href="<?php echo JRoute::rewrite('index.php?option=com_vikappointments&view=userprofile' . ($this->itemid ? '&Itemid=' . $this->itemid : '')); ?>" class="vap-btn blue"> |
| 43 | <?php echo JText::translate('VAPALLORDERSPROFILEBUTTON'); ?> |
| 44 | </a> |
| 45 | |
| 46 | <a href="<?php echo JRoute::rewrite('index.php?option=com_vikappointments&task=userprofile.logout' . ($this->itemid ? '&Itemid=' . $this->itemid : '')); ?>" class="vap-btn"> |
| 47 | <?php echo JText::translate('VAPLOGOUTTITLE'); ?> |
| 48 | </a> |
| 49 | </div> |
| 50 | </div> |
| 51 | |
| 52 | <?php |
| 53 | if (!count($this->orders)) |
| 54 | { |
| 55 | ?> |
| 56 | <div class="vap-allorders-void"><?php echo JText::translate('VAPALLORDERSVOID'); ?></div> |
| 57 | <?php |
| 58 | } |
| 59 | else |
| 60 | { |
| 61 | $currency = VAPFactory::getCurrency(); |
| 62 | |
| 63 | ?> |
| 64 | <div class="vap-allorders-tinylist"> |
| 65 | <?php |
| 66 | foreach ($this->orders as $order) |
| 67 | { |
| 68 | $appCount = count($order->appointments); |
| 69 | |
| 70 | if ($appCount > 1) |
| 71 | { |
| 72 | // display parent record |
| 73 | ?> |
| 74 | <div class="list-order-bar"> |
| 75 | |
| 76 | <div class="order-oid"> |
| 77 | <?php echo substr($order->sid, 0, 2) . '#' . substr($order->sid, -2, 2); ?> |
| 78 | </div> |
| 79 | |
| 80 | <div class="order-summary"> |
| 81 | <div class="summary-status order-<?php echo strtolower($order->status); ?>"> |
| 82 | <?php echo JHtml::fetch('vaphtml.status.display', $order->status); ?> |
| 83 | </div> |
| 84 | |
| 85 | <div class="summary-service"> |
| 86 | <a href="javascript:void(0)" class="parent-order-link" data-id="<?php echo (int) $order->id; ?>"> |
| 87 | <?php echo JText::sprintf('VAP_N_APP_EXT', $appCount); ?> |
| 88 | </a> |
| 89 | </div> |
| 90 | </div> |
| 91 | |
| 92 | <div class="order-purchase"> |
| 93 | <div class="purchase-date"> |
| 94 | <?php echo JHtml::fetch('date', $order->createdon, JText::translate('DATE_FORMAT_LC2'), VikAppointments::getUserTimezone()->getName()); ?> |
| 95 | </div> |
| 96 | |
| 97 | <div class="purchase-price"> |
| 98 | <?php |
| 99 | if ($order->totals->gross > 0) |
| 100 | { |
| 101 | echo $currency->format($order->totals->gross); |
| 102 | } |
| 103 | ?> |
| 104 | </div> |
| 105 | </div> |
| 106 | |
| 107 | <div class="order-view-button"> |
| 108 | <a href="<?php echo JRoute::rewrite('index.php?option=com_vikappointments&view=order&ordnum=' . $order->id . '&ordkey=' . $order->sid . ($this->itemid ? '&Itemid=' . $this->itemid : '')); ?>"> |
| 109 | <?php echo JText::translate('VAPVIEWDETAILS'); ?> |
| 110 | </a> |
| 111 | </div> |
| 112 | |
| 113 | </div> |
| 114 | <?php |
| 115 | } |
| 116 | |
| 117 | foreach ($order->appointments as $app) |
| 118 | { |
| 119 | $child_class = $style = ''; |
| 120 | |
| 121 | if ($appCount > 1) |
| 122 | { |
| 123 | $child_class = ' vap-allord-child child-of-order' . $order->id; |
| 124 | $style = 'display:none;'; |
| 125 | } |
| 126 | ?> |
| 127 | <div class="list-order-bar<?php echo $child_class; ?>" style="<?php echo $style; ?>"> |
| 128 | |
| 129 | <div class="order-oid"> |
| 130 | <?php echo substr($order->sid, 0, 2) . '#' . substr($order->sid, -2, 2); ?> |
| 131 | </div> |
| 132 | |
| 133 | <div class="order-summary"> |
| 134 | <div class="summary-status order-<?php echo strtolower($order->status); ?>"> |
| 135 | <?php echo JHtml::fetch('vaphtml.status.display', $order->status); ?> |
| 136 | </div> |
| 137 | |
| 138 | <div class="summary-service"> |
| 139 | <?php |
| 140 | echo $app->service->name; |
| 141 | |
| 142 | if ($app->viewEmp) |
| 143 | { |
| 144 | echo ', ' . $app->employee->name; |
| 145 | } |
| 146 | ?> |
| 147 | </div> |
| 148 | </div> |
| 149 | |
| 150 | <div class="order-purchase"> |
| 151 | <div class="purchase-date"> |
| 152 | <?php echo $app->customerCheckin->lc2; ?> |
| 153 | </div> |
| 154 | |
| 155 | <div class="purchase-price"> |
| 156 | <?php |
| 157 | if ($app->totals->gross > 0) |
| 158 | { |
| 159 | echo $currency->format($app->totals->gross); |
| 160 | } |
| 161 | ?> |
| 162 | </div> |
| 163 | </div> |
| 164 | |
| 165 | <div class="order-view-button"> |
| 166 | <a href="<?php echo JRoute::rewrite('index.php?option=com_vikappointments&view=order&ordnum=' . $order->id . '&ordkey=' . $order->sid . ($this->itemid ? '&Itemid=' . $this->itemid : '')); ?>"> |
| 167 | <?php echo JText::translate('VAPVIEWDETAILS'); ?> |
| 168 | </a> |
| 169 | </div> |
| 170 | |
| 171 | </div> |
| 172 | <?php |
| 173 | } |
| 174 | } |
| 175 | ?> |
| 176 | </div> |
| 177 | |
| 178 | <form action="<?php echo JRoute::rewrite('index.php?option=com_vikappointments&view=allorders' . ($this->itemid ? '&Itemid=' . $this->itemid : '')); ?>" method="post"> |
| 179 | <?php echo JHtml::fetch('form.token'); ?> |
| 180 | <div class="vap-list-pagination"><?php echo $this->navbut; ?></div> |
| 181 | <input type="hidden" name="option" value="com_vikappointments" /> |
| 182 | <input type="hidden" name="view" value="allorders" /> |
| 183 | </form> |
| 184 | |
| 185 | <script> |
| 186 | |
| 187 | (function($) { |
| 188 | 'use strict'; |
| 189 | |
| 190 | $('.parent-order-link').on('click', function() { |
| 191 | const id = $(this).data('id'); |
| 192 | |
| 193 | if ($('.child-of-order' + id).first().is(':visible')) { |
| 194 | $('.child-of-order' + id).slideUp(); |
| 195 | } else { |
| 196 | $('.child-of-order' + id).slideDown(); |
| 197 | } |
| 198 | }) |
| 199 | })(jQuery); |
| 200 | |
| 201 | </script> |
| 202 | |
| 203 | <?php |
| 204 | } |
| 205 | ?> |
| 206 |