quick.php
110 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 | $rates = isset($this->trace['rates']) ? $this->trace['rates'] : array(); |
| 17 | |
| 18 | $currency = VAPFactory::getCurrency(); |
| 19 | |
| 20 | ?> |
| 21 | |
| 22 | <div class="ratestest" style="padding: 10px;"> |
| 23 | <?php echo $vik->openEmptyFieldset(); ?> |
| 24 | |
| 25 | <table class="rates-table table" id="rates-table"> |
| 26 | <thead> |
| 27 | <tr> |
| 28 | <th><?php echo JText::translate('JGRID_HEADING_ID'); ?></th> |
| 29 | <th><?php echo JText::translate('JDETAILS'); ?></th> |
| 30 | <th style="text-align:center;"><?php echo JText::translate('VAPCHDISC'); ?></th> |
| 31 | </tr> |
| 32 | </thead> |
| 33 | |
| 34 | <tbody> |
| 35 | |
| 36 | <tr> |
| 37 | <td class="rate-id"></td> |
| 38 | <td class="rate-details"><?php echo JText::translate('VAPBASECOST'); ?></td> |
| 39 | <td class="rate-price"><?php echo $currency->format($this->trace['basecost']); ?></td> |
| 40 | </tr> |
| 41 | |
| 42 | <?php |
| 43 | foreach ($rates as $rate) |
| 44 | { |
| 45 | ?> |
| 46 | <tr class="rate-child"> |
| 47 | <td class="rate-id"><?php echo $rate->id; ?></td> |
| 48 | <td class="rate-details"> |
| 49 | <?php |
| 50 | echo $rate->name; |
| 51 | |
| 52 | if ($rate->description) |
| 53 | { |
| 54 | ?> |
| 55 | <div><small><?php echo $rate->description; ?></small></div> |
| 56 | <?php |
| 57 | } |
| 58 | ?> |
| 59 | </td> |
| 60 | <td class="rate-price"><?php echo $currency->format($rate->charge); ?></td> |
| 61 | </tr> |
| 62 | <?php |
| 63 | } |
| 64 | ?> |
| 65 | |
| 66 | </tbody> |
| 67 | |
| 68 | <tfoot> |
| 69 | |
| 70 | <?php |
| 71 | if ($this->finalCost != $this->rate) |
| 72 | { |
| 73 | // the final cost has been multiplied by the number of guests |
| 74 | ?> |
| 75 | <tr> |
| 76 | <td class="rate-id"></td> |
| 77 | <td class="rate-details"><?php echo JText::translate('VAPCOSTPP'); ?></td> |
| 78 | <td class="rate-price"><?php echo $currency->format($this->rate); ?></td> |
| 79 | </tr> |
| 80 | <?php |
| 81 | } |
| 82 | ?> |
| 83 | |
| 84 | <tr> |
| 85 | <td class="rate-id"></td> |
| 86 | <td class="rate-details"><?php echo JText::translate('VAPFINALCOST'); ?></td> |
| 87 | <td class="rate-price"><?php echo $currency->format($this->finalCost); ?></td> |
| 88 | </tr> |
| 89 | |
| 90 | </tfoot> |
| 91 | </table> |
| 92 | |
| 93 | <?php echo $vik->closeEmptyFieldset(); ?> |
| 94 | </div> |
| 95 | |
| 96 | <script> |
| 97 | |
| 98 | /** |
| 99 | * Register trace within the parent window so that the caller |
| 100 | * is able to access and use the fetched price. |
| 101 | * |
| 102 | * @since 1.7 |
| 103 | */ |
| 104 | window.parent.vapRatesTestTrace = <?php echo json_encode($this->trace); ?>; |
| 105 | |
| 106 | // for debug purposes |
| 107 | console.log(window.parent.vapRatesTestTrace); |
| 108 | |
| 109 | </script> |
| 110 |