default.php
2 days ago
default.xml
2 days ago
default_appointment.php
2 days ago
default_attendees.php
2 days ago
default_backbutton.php
2 days ago
default_countdown.php
2 days ago
default_locations.php
2 days ago
default_orderdetails.php
2 days ago
default_service.php
2 days ago
default_usernote.php
2 days ago
default_usernote_block.php
2 days ago
index.html
2 days ago
track.php
2 days ago
default_appointment.php
278 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 | // we are inside a foreach, extract the current element of the cycle |
| 15 | $appointment = $this->appointment; |
| 16 | |
| 17 | $config = VAPFactory::getConfig(); |
| 18 | $currency = VAPFactory::getCurrency(); |
| 19 | |
| 20 | $dispatcher = VAPFactory::getEventDispatcher(); |
| 21 | |
| 22 | $forms = array(); |
| 23 | |
| 24 | foreach (array('before', 'top', 'appointment', 'options', 'notes', 'bottom', 'after') as $location) |
| 25 | { |
| 26 | /** |
| 27 | * Trigger event to let the plugins add custom HTML contents within the block of |
| 28 | * the booked service. |
| 29 | * |
| 30 | * @param string $location The HTML will be always placed after the specified location (@since 1.7). |
| 31 | * @param object $event The appointment details (changed from array @since 1.7). |
| 32 | * @param object $order The purchased order (changed from array @since 1.7). |
| 33 | * |
| 34 | * @return string The HTML to display. |
| 35 | * |
| 36 | * @since 1.6.6 |
| 37 | */ |
| 38 | $html = array_filter($dispatcher->trigger('onDisplayOrderServiceSummary', array($location, $appointment, $this->order))); |
| 39 | |
| 40 | // display all returned blocks, separated by a new line |
| 41 | $forms[$location] = implode("\n", $html); |
| 42 | } |
| 43 | |
| 44 | ?> |
| 45 | |
| 46 | <!-- Define role to detect the supported hook --> |
| 47 | <!-- {"rule":"customizer","event":"onDisplayOrderServiceSummary","type":"sitepage","key":"before"} --> |
| 48 | |
| 49 | <?php |
| 50 | // display custom HTML before the summary block |
| 51 | echo $forms['before']; |
| 52 | ?> |
| 53 | |
| 54 | <!-- CONTENT --> |
| 55 | |
| 56 | <div class="vaporderdetailsbox"> |
| 57 | |
| 58 | <!-- Define role to detect the supported hook --> |
| 59 | <!-- {"rule":"customizer","event":"onDisplayOrderServiceSummary","type":"sitepage","key":"top"} --> |
| 60 | |
| 61 | <?php |
| 62 | // display custom HTML at the beginning of the appointment |
| 63 | echo $forms['top']; |
| 64 | ?> |
| 65 | |
| 66 | <!-- APPOINTMENT --> |
| 67 | |
| 68 | <div class="vapordercontentinfoleft"> |
| 69 | |
| 70 | <h3 class="vaporderheader"><?php echo JText::translate('VAPORDERTITLE2'); ?></h3> |
| 71 | |
| 72 | <div class="vapordercontentinfo"> |
| 73 | <div class="vaporderinfo"> |
| 74 | <span class="vaporderinfo-lbl"><?php echo JText::translate('VAPORDERBEGINDATETIME'); ?></span> |
| 75 | <span class="vaporderinfo-value"> |
| 76 | <?php |
| 77 | echo $appointment->customerCheckin->lc2; |
| 78 | |
| 79 | if ($config->getBool('multitimezone') && $appointment->customerCheckin->timezone) |
| 80 | { |
| 81 | if (preg_match("/^(europe|africa|asia)/i", $appointment->customerCheckin->timezone, $match)) |
| 82 | { |
| 83 | // fetch the globe face matching the selected timezone |
| 84 | $icon = 'globe-' . strtolower(end($match)); |
| 85 | } |
| 86 | else |
| 87 | { |
| 88 | // fallback to americas side |
| 89 | $icon = 'globe-americas'; |
| 90 | } |
| 91 | |
| 92 | ?> |
| 93 | <i class="fas fa-<?php echo $icon; ?> hasTooltip" title="<?php echo $this->escape($appointment->customerCheckin->timezone); ?>"></i> |
| 94 | <?php |
| 95 | } |
| 96 | ?> |
| 97 | </span> |
| 98 | </div> |
| 99 | |
| 100 | <div class="vaporderinfo"> |
| 101 | <span class="vaporderinfo-lbl"><?php echo JText::translate('VAPORDERENDDATETIME'); ?></span> |
| 102 | <span class="vaporderinfo-value"><?php echo $appointment->customerCheckout->lc2; ?></span> |
| 103 | </div> |
| 104 | |
| 105 | <?php |
| 106 | if ($appointment->viewEmp) |
| 107 | { |
| 108 | ?> |
| 109 | <div class="vaporderinfo"> |
| 110 | <span class="vaporderinfo-lbl"><?php echo JText::translate('VAPORDEREMPLOYEE'); ?></span> |
| 111 | <span class="vaporderinfo-value"><?php echo $appointment->employee->name; ?></span> |
| 112 | </div> |
| 113 | <?php |
| 114 | } |
| 115 | ?> |
| 116 | |
| 117 | <div class="vaporderinfo"> |
| 118 | <span class="vaporderinfo-lbl"><?php echo JText::translate('VAPORDERSERVICE'); ?></span> |
| 119 | <span class="vaporderinfo-value"> |
| 120 | <?php |
| 121 | echo $appointment->service->name; |
| 122 | |
| 123 | if ($appointment->totals->gross > 0) |
| 124 | { |
| 125 | // display service total gross next to the name |
| 126 | echo ' ' . $currency->format($appointment->totals->gross); |
| 127 | } |
| 128 | |
| 129 | // then display the appointment duration |
| 130 | echo ' (' . VikAppointments::formatMinutesToTime($appointment->duration) . ')'; |
| 131 | ?> |
| 132 | </span> |
| 133 | </div> |
| 134 | |
| 135 | <?php |
| 136 | if ($appointment->people > 1) |
| 137 | { |
| 138 | ?> |
| 139 | <div class="vaporderinfo"> |
| 140 | <span class="vaporderinfo-lbl"><?php echo JText::translate('VAPSUMMARYPEOPLE'); ?></span> |
| 141 | <span class="vaporderinfo-value"><?php echo $appointment->people; ?></span> |
| 142 | </div> |
| 143 | <?php |
| 144 | } |
| 145 | ?> |
| 146 | |
| 147 | <!-- Define role to detect the supported hook --> |
| 148 | <!-- {"rule":"customizer","event":"onDisplayOrderServiceSummary","type":"sitepage","key":"appointment"} --> |
| 149 | |
| 150 | <?php |
| 151 | // display custom HTML within the appointment details block |
| 152 | echo $forms['appointment']; |
| 153 | ?> |
| 154 | </div> |
| 155 | |
| 156 | </div> |
| 157 | |
| 158 | <!-- OPTIONS --> |
| 159 | |
| 160 | <?php |
| 161 | if ($appointment->options) |
| 162 | { |
| 163 | ?> |
| 164 | <div class="vapordercontentinforight"> |
| 165 | |
| 166 | <h3 class="vaporderheader"><?php echo JText::translate('VAPORDERTITLE3'); ?></h3> |
| 167 | |
| 168 | <div class="vapordercontentinfo"> |
| 169 | <?php foreach ($appointment->options as $opt): ?> |
| 170 | <div class="vaporderinfo"> |
| 171 | <?php if ($opt->duration): ?> |
| 172 | <small class="option-quantity"> |
| 173 | <?php echo '+' . $opt->duration->extraTotal . ' ' . JText::translate('VAPSHORTCUTMINUTE'); ?> |
| 174 | </small> |
| 175 | <?php elseif ($opt->multiple): ?> |
| 176 | <small class="option-quantity"> |
| 177 | <?php echo $opt->quantity . 'x '; ?> |
| 178 | </small> |
| 179 | <?php endif; ?> |
| 180 | |
| 181 | <b class="option-name"> |
| 182 | <?php echo $opt->fullName; ?> |
| 183 | </b> |
| 184 | |
| 185 | <?php if ($opt->price != 0): ?> |
| 186 | <span class="option-price"> |
| 187 | <?php echo $currency->format($opt->price); ?> |
| 188 | </span> |
| 189 | <?php endif; ?> |
| 190 | </div> |
| 191 | <?php endforeach; ?> |
| 192 | |
| 193 | <!-- Define role to detect the supported hook --> |
| 194 | <!-- {"rule":"customizer","event":"onDisplayOrderServiceSummary","type":"sitepage","key":"options"} --> |
| 195 | |
| 196 | <?php |
| 197 | // display custom HTML within the options details block |
| 198 | echo $forms['options']; |
| 199 | ?> |
| 200 | </div> |
| 201 | |
| 202 | </div> |
| 203 | <?php |
| 204 | } |
| 205 | ?> |
| 206 | |
| 207 | <!-- CANCELLATION --> |
| 208 | |
| 209 | <?php |
| 210 | // Display the cancellation button of this single appointment only in case we are not |
| 211 | // visiting a multi-order page. |
| 212 | if (count($this->order->appointments) > 1) |
| 213 | { |
| 214 | // make sure this appointment can be cancelled |
| 215 | if ($appointment->canUserCancel) |
| 216 | { |
| 217 | // create cancellation URI |
| 218 | $cancel_uri = JRoute::rewrite("index.php?option=com_vikappointments&task=order.cancel&id={$appointment->id}&sid={$appointment->sid}&parent={$this->order->id}&Itemid={$this->itemid}", false); |
| 219 | ?> |
| 220 | <div class="vapordercancdiv"> |
| 221 | <button type="button" class="vap-btn red" onClick="vapCancelButtonPressed('<?php echo $cancel_uri; ?>');"> |
| 222 | <i class="far fa-calendar-times"></i> |
| 223 | <?php echo JText::translate('VAPORDERCANCBUTTON'); ?> |
| 224 | </button> |
| 225 | </div> |
| 226 | <?php |
| 227 | } |
| 228 | } |
| 229 | ?> |
| 230 | |
| 231 | <!-- Define role to detect the supported hook --> |
| 232 | <!-- {"rule":"customizer","event":"onDisplayOrderServiceSummary","type":"sitepage","key":"notes"} --> |
| 233 | |
| 234 | <?Php |
| 235 | // display custom HTML before the user notes |
| 236 | echo $forms['notes']; |
| 237 | ?> |
| 238 | |
| 239 | <!-- USER NOTES --> |
| 240 | |
| 241 | <?php |
| 242 | // do not display notes in case of order with a single appointments, because |
| 243 | // in this case the notes are displayed at the end of the box |
| 244 | if (count($this->order->appointments) > 1) |
| 245 | { |
| 246 | // get all the user notes assigned to this appointment |
| 247 | $notes = $this->order->getUserNotes($appointment->id); |
| 248 | |
| 249 | // iterate all notes, if any |
| 250 | foreach ($notes as $note) |
| 251 | { |
| 252 | // keep track of the current note |
| 253 | $this->itemNote = $note; |
| 254 | |
| 255 | // display the user notes block through an apposite template |
| 256 | // to take advantage of reusability |
| 257 | echo $this->loadTemplate('usernote_block'); |
| 258 | } |
| 259 | } |
| 260 | ?> |
| 261 | |
| 262 | <!-- Define role to detect the supported hook --> |
| 263 | <!-- {"rule":"customizer","event":"onDisplayOrderServiceSummary","type":"sitepage","key":"bottom"} --> |
| 264 | |
| 265 | <?Php |
| 266 | // display custom HTML at the end of the appointment |
| 267 | echo $forms['bottom']; |
| 268 | ?> |
| 269 | |
| 270 | </div> |
| 271 | |
| 272 | <!-- Define role to detect the supported hook --> |
| 273 | <!-- {"rule":"customizer","event":"onDisplayOrderServiceSummary","type":"sitepage","key":"after"} --> |
| 274 | |
| 275 | <?php |
| 276 | // display custom HTML after the summary block |
| 277 | echo $forms['after']; |
| 278 |