dayorders.php
210 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 | $auth = isset($displayData['auth']) ? $displayData['auth'] : VAPEmployeeAuth::getInstance(); |
| 15 | $has_cap = isset($displayData['has_capacity']) ? $displayData['has_capacity'] : false; |
| 16 | $orders = isset($displayData['orders']) ? $displayData['orders'] : array(); |
| 17 | $itemid = isset($displayData['itemid']) ? $displayData['itemid'] : null; |
| 18 | |
| 19 | if (is_null($itemid)) |
| 20 | { |
| 21 | // extract menu item from request when not specified |
| 22 | $itemid = JFactory::getApplication()->input->getUint('Itemid'); |
| 23 | } |
| 24 | |
| 25 | $vik = VAPApplication::getInstance(); |
| 26 | |
| 27 | $config = VAPFactory::getConfig(); |
| 28 | |
| 29 | $canEdit = $auth->manageReservation(); |
| 30 | $canRemove = $auth->removeReservation(); |
| 31 | |
| 32 | ?> |
| 33 | |
| 34 | <div class="vapempserlistcont"> |
| 35 | |
| 36 | <div class="vap-allorders-singlerow vap-allorders-row head" style="text-align: center;"> |
| 37 | |
| 38 | <!-- ID --> |
| 39 | |
| 40 | <span class="vap-allorders-column" style="width: 5%;"><?php echo JText::translate('VAPMANAGERESERVATION0'); ?></span> |
| 41 | |
| 42 | <!-- START --> |
| 43 | |
| 44 | <span class="vap-allorders-column" style="width: 10%;"><?php echo JText::translate('VAPMANAGERESERVATION5'); ?></span> |
| 45 | |
| 46 | <!-- END --> |
| 47 | |
| 48 | <span class="vap-allorders-column" style="width: 10%;"><?php echo JText::translate('VAPMANAGERESERVATION6'); ?></span> |
| 49 | |
| 50 | <!-- SERVICE --> |
| 51 | |
| 52 | <span class="vap-allorders-column" style="width: 15%;"><?php echo JText::translate('VAPMANAGERESERVATION4'); ?></span> |
| 53 | |
| 54 | <!-- PEOPLE --> |
| 55 | |
| 56 | <?php |
| 57 | if ($has_cap) |
| 58 | { |
| 59 | // the employee may be interested in knowing the number of guests |
| 60 | ?> |
| 61 | <span class="vap-allorders-column" style="width: 7%;"><?php echo JText::translate('VAPMANAGERESERVATION25'); ?></span> |
| 62 | <?php |
| 63 | } |
| 64 | ?> |
| 65 | |
| 66 | <!-- CUSTOMER --> |
| 67 | |
| 68 | <span class="vap-allorders-column" style="width: 20%;"><?php echo JText::translate('VAPMANAGERESERVATION38'); ?></span> |
| 69 | |
| 70 | <!-- TOTAL --> |
| 71 | |
| 72 | <?php |
| 73 | if (!$has_cap) |
| 74 | { |
| 75 | // no capacity, display a different info (such as the total cost) |
| 76 | ?> |
| 77 | <span class="vap-allorders-column" style="width: 7%;"><?php echo JText::translate('VAPMANAGERESERVATION9'); ?></span> |
| 78 | <?php |
| 79 | } |
| 80 | ?> |
| 81 | |
| 82 | <!-- STATUS --> |
| 83 | |
| 84 | <span class="vap-allorders-column" style="width: 20%;"><?php echo JText::translate('VAPMANAGERESERVATION12'); ?></span> |
| 85 | |
| 86 | <!-- ACTIONS --> |
| 87 | |
| 88 | <?php |
| 89 | if ($canEdit || $canRemove) |
| 90 | { |
| 91 | ?> |
| 92 | <span class="vap-allorders-column" style="width: 5%;"> </span> |
| 93 | <?php |
| 94 | } |
| 95 | ?> |
| 96 | |
| 97 | </div> |
| 98 | |
| 99 | <?php |
| 100 | foreach ($orders as $row) |
| 101 | { |
| 102 | $checkout = VikAppointments::getCheckout($row->checkin_ts, $row->duration); |
| 103 | |
| 104 | $edit_uri = JRoute::rewrite('index.php?option=com_vikappointments&task=empmanres.edit&cid[]=' . $row->id . ($itemid ? '&Itemid=' . $itemid : ''), false); |
| 105 | $del_uri = JRoute::rewrite('index.php?option=com_vikappointments&task=empmanres.delete&cid[]=' . $row->id . ($itemid ? '&Itemid=' . $itemid : ''), false); |
| 106 | ?> |
| 107 | <div class="vap-allorders-singlerow vap-allorders-row vapemprestr" id="vaptabrow<?php echo $row->id; ?>" style="text-align: center;"> |
| 108 | |
| 109 | <!-- ID --> |
| 110 | |
| 111 | <span class="vap-allorders-column order-id" style="width: 5%;"> |
| 112 | <?php echo $row->id; ?> |
| 113 | </span> |
| 114 | |
| 115 | <!-- START --> |
| 116 | |
| 117 | <span class="vap-allorders-column order-checkin" style="width: 10%;"> |
| 118 | <?php echo JHtml::fetch('date', $row->checkin_ts, $config->get('timeformat'), $auth->timezone ? $auth->timezone : null); ?> |
| 119 | </span> |
| 120 | |
| 121 | <!-- END --> |
| 122 | |
| 123 | <span class="vap-allorders-column order-checkout" style="width: 10%;"> |
| 124 | <?php echo JHtml::fetch('date', $checkout, $config->get('timeformat'), $auth->timezone ? $auth->timezone : null); ?> |
| 125 | </span> |
| 126 | |
| 127 | <!-- SERVICE --> |
| 128 | |
| 129 | <span class="vap-allorders-column order-service" style="width: 15%;"> |
| 130 | <?php echo $row->service_name; ?> |
| 131 | </span> |
| 132 | |
| 133 | <!-- PEOPLE --> |
| 134 | |
| 135 | <?php |
| 136 | if ($has_cap) |
| 137 | { |
| 138 | // the employee may be interested in knowing the number of guests |
| 139 | ?> |
| 140 | <span class="vap-allorders-column order-people" style="width: 7%;"> |
| 141 | <?php echo $row->people; ?> |
| 142 | </span> |
| 143 | <?php |
| 144 | } |
| 145 | ?> |
| 146 | |
| 147 | <!-- CUSTOMER --> |
| 148 | |
| 149 | <span class="vap-allorders-column order-customer" style="width: 20%;"> |
| 150 | <?php echo $row->purchaser_nominative; ?> |
| 151 | </span> |
| 152 | |
| 153 | <!-- TOTAL --> |
| 154 | |
| 155 | <?php |
| 156 | if (!$has_cap) |
| 157 | { |
| 158 | // no capacity, display a different info (such as the total cost) |
| 159 | ?> |
| 160 | <span class="vap-allorders-column order-total" style="width: 7%;"> |
| 161 | <?php echo VAPFactory::getCurrency()->format($row->total_cost); ?> |
| 162 | </span> |
| 163 | <?php |
| 164 | } |
| 165 | ?> |
| 166 | |
| 167 | <!-- STATUS --> |
| 168 | |
| 169 | <span class="vap-allorders-column order-status" style="width: 20%;"> |
| 170 | <?php echo JHtml::fetch('vaphtml.status.display', $row->status); ?> |
| 171 | </span> |
| 172 | |
| 173 | <!-- ACTIONS --> |
| 174 | |
| 175 | <?php |
| 176 | if ($canEdit || $canRemove) |
| 177 | { |
| 178 | ?> |
| 179 | <span class="vap-allorders-column order-actions" style="width: 5%;"> |
| 180 | <?php |
| 181 | if ($canEdit) |
| 182 | { |
| 183 | ?> |
| 184 | <a href="<?php echo $edit_uri; ?>" style="margin: 0 2px;"> |
| 185 | <i class="fas fa-edit big"></i> |
| 186 | </a> |
| 187 | <?php |
| 188 | } |
| 189 | |
| 190 | if ($canRemove) |
| 191 | { |
| 192 | ?> |
| 193 | <a href="<?php echo $vik->addUrlCSRF($del_uri); ?>" onclick="return confirm('<?php echo addslashes(JText::translate('VAPCONFDIALOGMSG')); ?>');" style="margin: 0 2px;"> |
| 194 | <i class="fas fa-trash big"></i> |
| 195 | </a> |
| 196 | <?php |
| 197 | } |
| 198 | ?> |
| 199 | </span> |
| 200 | <?php |
| 201 | } |
| 202 | ?> |
| 203 | |
| 204 | </div> |
| 205 | <?php |
| 206 | } |
| 207 | ?> |
| 208 | |
| 209 | </div> |
| 210 |