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.php
188 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.fontawesome'); |
| 16 | |
| 17 | $order = $this->order; |
| 18 | |
| 19 | // create global cancellation URI |
| 20 | $this->cancelURI = JRoute::rewrite("index.php?option=com_vikappointments&task=order.cancel&id={$this->order->id}&sid={$this->order->sid}&Itemid={$this->itemid}", false); |
| 21 | |
| 22 | ?> |
| 23 | |
| 24 | <!-- Define role to detect the supported hook --> |
| 25 | <!-- {"rule":"customizer","event":"onDisplayOrderSummaryHead","type":"sitepage"} --> |
| 26 | |
| 27 | <?php |
| 28 | $dispatcher = VAPFactory::getEventDispatcher(); |
| 29 | |
| 30 | /** |
| 31 | * Trigger event to let the plugins add custom HTML contents before |
| 32 | * the order summary. In case more than one plugin returned a string, |
| 33 | * they will be displayed in different blocks. |
| 34 | * |
| 35 | * @param object $order The object holding the order details. |
| 36 | * |
| 37 | * @return string The HTML to display. |
| 38 | * |
| 39 | * @since 1.7.9 |
| 40 | */ |
| 41 | $blocks = array_filter($dispatcher->trigger('onDisplayOrderSummaryHead', [$order])); |
| 42 | |
| 43 | if ($blocks): ?> |
| 44 | <div class="vap-summary-plugins-container"> |
| 45 | <?php foreach ($blocks as $block): ?> |
| 46 | <div class="vap-summary-plugin"><?php echo $block; ?></div> |
| 47 | <?php endforeach; ?> |
| 48 | </div> |
| 49 | <?php endif; |
| 50 | |
| 51 | // In case of logged-in user, display a button to access the profile page of the user, |
| 52 | // which contains all the appointments that have been booked. |
| 53 | // If you wish to avoid displaying that button, just comment the line below. |
| 54 | echo $this->loadTemplate('backbutton'); |
| 55 | |
| 56 | // Check whether to display the payment form within the top position of this view. |
| 57 | // The payment will be displayed here only in case the position match one of these: |
| 58 | // top-left, top-center, top-right. |
| 59 | echo $this->displayPayment('top'); |
| 60 | |
| 61 | ?> |
| 62 | |
| 63 | <form action="<?php echo JRoute::rewrite('index.php?option=com_vikappointments&view=order' . ($this->itemid ? '&Itemid=' . $this->itemid : '')); ?>" name="orderform" id="orderform" method="get"> |
| 64 | |
| 65 | <div class="vaporderpagediv"> |
| 66 | |
| 67 | <?php |
| 68 | // Display the block containing the order details, such the order number, |
| 69 | // the order status, the customer details, etc... |
| 70 | echo $this->loadTemplate('orderdetails'); |
| 71 | |
| 72 | if ($order->attendees) |
| 73 | { |
| 74 | // Display the block containing the custom fields of any other |
| 75 | // attendee of the appointments. |
| 76 | echo $this->loadTemplate('attendees'); |
| 77 | } |
| 78 | |
| 79 | // Counter used to track all the appointments that can be cancelled. |
| 80 | $this->count = 0; |
| 81 | |
| 82 | // In case of multiple appointments booked within the same order, the system |
| 83 | // groups by default the same services under them same block. |
| 84 | foreach ($this->services as $id_service => $list) |
| 85 | { |
| 86 | // keep track of the current service |
| 87 | $this->groupServices = $list; |
| 88 | |
| 89 | // display all the appointments that belong to this service |
| 90 | echo $this->loadTemplate('service'); |
| 91 | } |
| 92 | |
| 93 | // Check whether there's at least a public note to display to the user. |
| 94 | if ($order->getUserNotes($this->order->id)) |
| 95 | { |
| 96 | // display all the notes assigned to this order |
| 97 | echo $this->loadTemplate('usernote'); |
| 98 | } |
| 99 | ?> |
| 100 | |
| 101 | </div> |
| 102 | |
| 103 | <input type="hidden" name="ordnum" value="<?php echo $order->id; ?>" /> |
| 104 | <input type="hidden" name="ordkey" value="<?php echo $order->sid; ?>" /> |
| 105 | <input type="hidden" name="option" value="com_vikappointments" /> |
| 106 | <input type="hidden" name="view" value="order" /> |
| 107 | <input type="hidden" name="task" value="" /> |
| 108 | |
| 109 | <?php |
| 110 | // use token to prevent brute force attacks |
| 111 | echo JHtml::fetch('form.token'); |
| 112 | ?> |
| 113 | |
| 114 | </form> |
| 115 | |
| 116 | <!-- Define role to detect the supported hook --> |
| 117 | <!-- {"rule":"customizer","event":"onDisplayOrderSummary","type":"sitepage"} --> |
| 118 | |
| 119 | <?php |
| 120 | $dispatcher = VAPFactory::getEventDispatcher(); |
| 121 | |
| 122 | /** |
| 123 | * Trigger event to let the plugins add custom HTML contents below |
| 124 | * the order summary. In case more than one plugin returned a string, |
| 125 | * they will be displayed in different blocks. |
| 126 | * |
| 127 | * @param object $order The object holding the order details (changed from array @since 1.7). |
| 128 | * |
| 129 | * @return string The HTML to display. |
| 130 | * |
| 131 | * @since 1.6.6 |
| 132 | */ |
| 133 | $blocks = array_filter($dispatcher->trigger('onDisplayOrderSummary', array($order))); |
| 134 | |
| 135 | if ($blocks) |
| 136 | { |
| 137 | ?> |
| 138 | <div class="vap-summary-plugins-container"> |
| 139 | <?php |
| 140 | foreach ($blocks as $block) |
| 141 | { |
| 142 | ?> |
| 143 | <div class="vap-summary-plugin"><?php echo $block; ?></div> |
| 144 | <?php |
| 145 | } |
| 146 | ?> |
| 147 | </div> |
| 148 | <?php |
| 149 | } |
| 150 | |
| 151 | // Check whether to display the payment form within the bottom position of this view. |
| 152 | // The payment will be displayed here only in case the position match one of these: |
| 153 | // bottom-left, bottom-center, bottom-right (or not specified). |
| 154 | echo $this->displayPayment('bottom'); |
| 155 | |
| 156 | // In case one or more appointments have been assigned to a location, display the map |
| 157 | // (provided by Google) containing all the venues. |
| 158 | if (!empty($this->locations)) |
| 159 | { |
| 160 | echo $this->loadTemplate('locations'); |
| 161 | } |
| 162 | |
| 163 | // load script translations |
| 164 | JText::script('VAPCANCELORDERMESSAGE'); |
| 165 | ?> |
| 166 | |
| 167 | <script> |
| 168 | |
| 169 | // CANCELLATION SCRIPTS |
| 170 | |
| 171 | jQuery(function($) { |
| 172 | if (window.location.hash === '#cancel') { |
| 173 | // auto-prompt the cancellation with a short delay |
| 174 | setTimeout(() => { |
| 175 | vapCancelButtonPressed('<?php echo $this->cancelURI; ?>'); |
| 176 | }, 500); |
| 177 | } |
| 178 | }); |
| 179 | |
| 180 | function vapCancelButtonPressed(uri) { |
| 181 | // ask confirmation before to proceed with the cancellation |
| 182 | if (confirm(Joomla.JText._('VAPCANCELORDERMESSAGE'))) { |
| 183 | // confirmed, reach cancellation URL |
| 184 | document.location.href = uri; |
| 185 | } |
| 186 | } |
| 187 | </script> |
| 188 |