| 1 |
<?php |
| 2 |
/** |
| 3 |
* @package VikBooking |
| 4 |
* @subpackage com_vikbooking |
| 5 |
* @author Alessio Gaggii - e4j - Extensionsforjoomla.com |
| 6 |
* @copyright Copyright (C) 2018 e4j - Extensionsforjoomla.com. All rights reserved. |
| 7 |
* @license GNU General Public License version 2 or later; see LICENSE |
| 8 |
* @link https://vikwp.com |
| 9 |
*/ |
| 10 |
|
| 11 |
defined('ABSPATH') or die('No script kiddies please!'); |
| 12 |
|
| 13 |
// check session values for meta search channels |
| 14 |
$session = JFactory::getSession(); |
| 15 |
$channel_disclaimer = false; |
| 16 |
$vcmchanneldata = $session->get('vcmChannelData', ''); |
| 17 |
if (!empty($vcmchanneldata) && is_array($vcmchanneldata) && count($vcmchanneldata) > 0) { |
| 18 |
if (array_key_exists('disclaimer', $vcmchanneldata) && !empty($vcmchanneldata['disclaimer'])) { |
| 19 |
$channel_disclaimer = true; |
| 20 |
} |
| 21 |
} |
| 22 |
|
| 23 |
$rooms = $this->rooms; |
| 24 |
$roomsnum = $this->roomsnum; |
| 25 |
$tars = $this->tars; |
| 26 |
$prices = $this->prices; |
| 27 |
$arrpeople = $this->arrpeople; |
| 28 |
$selopt = $this->selopt; |
| 29 |
$days = $this->days; |
| 30 |
$coupon = $this->coupon; |
| 31 |
$first = $this->first; |
| 32 |
$second = $this->second; |
| 33 |
$payments = $this->payments; |
| 34 |
$cfields = $this->cfields; |
| 35 |
$customer_details = $this->customer_details; |
| 36 |
$countries = $this->countries; |
| 37 |
$pkg = $this->pkg; |
| 38 |
$vbo_tn = $this->vbo_tn; |
| 39 |
|
| 40 |
/** |
| 41 |
* Custom listing check-in and check-out times. |
| 42 |
* |
| 43 |
* @since 1.18.3 (J) - 1.8.3 (WP) |
| 44 |
*/ |
| 45 |
$listing_custom_checkin = ''; |
| 46 |
$listing_custom_checkout = ''; |
| 47 |
if ($roomsnum == 1) { |
| 48 |
$listing_custom_checkin = VikBooking::getRoomParam('checkin', ($rooms[(key($rooms))]['params'] ?? '')); |
| 49 |
$listing_custom_checkout = VikBooking::getRoomParam('checkout', ($rooms[(key($rooms))]['params'] ?? '')); |
| 50 |
} |
| 51 |
|
| 52 |
// JS lang def |
| 53 |
JText::script('VBO_RM_COUPON_CONFIRM'); |
| 54 |
|
| 55 |
$vbo_app = VikBooking::getVboApplication(); |
| 56 |
$showchildren = VikBooking::showChildrenFront(); |
| 57 |
$totadults = 0; |
| 58 |
$totchildren = 0; |
| 59 |
$is_package = is_array($pkg) && count($pkg) > 0 ? true : false; |
| 60 |
$pitemid = VikRequest::getInt('Itemid', '', 'request'); |
| 61 |
// single category filter |
| 62 |
$pcategories = VikRequest::getString('categories', '', 'request'); |
| 63 |
// multiple category filters |
| 64 |
$pcategory_ids = VikRequest::getVar('category_ids', array()); |
| 65 |
|
| 66 |
$wdays_map = array( |
| 67 |
JText::translate('VBWEEKDAYZERO'), |
| 68 |
JText::translate('VBWEEKDAYONE'), |
| 69 |
JText::translate('VBWEEKDAYTWO'), |
| 70 |
JText::translate('VBWEEKDAYTHREE'), |
| 71 |
JText::translate('VBWEEKDAYFOUR'), |
| 72 |
JText::translate('VBWEEKDAYFIVE'), |
| 73 |
JText::translate('VBWEEKDAYSIX') |
| 74 |
); |
| 75 |
|
| 76 |
if (VikBooking::tokenForm()) { |
| 77 |
$vikt = uniqid(rand(17, 1717), true); |
| 78 |
$session->set('vikbtoken', $vikt); |
| 79 |
$tok = "<input type=\"hidden\" name=\"viktoken\" value=\"" . $vikt . "\"/>\n"; |
| 80 |
} else { |
| 81 |
$tok = ""; |
| 82 |
} |
| 83 |
|
| 84 |
$document = JFactory::getDocument(); |
| 85 |
if (VikBooking::loadJquery()) { |
| 86 |
JHtml::fetch('jquery.framework', true, true); |
| 87 |
} |
| 88 |
$document->addStyleSheet(VBO_SITE_URI.'resources/jquery-ui.min.css'); |
| 89 |
$document->addStyleSheet(VBO_SITE_URI.'resources/jquery.fancybox.css'); |
| 90 |
JHtml::fetch('script', VBO_SITE_URI.'resources/jquery-ui.min.js'); |
| 91 |
JHtml::fetch('script', VBO_SITE_URI.'resources/jquery.fancybox.js'); |
| 92 |
|
| 93 |
foreach ($cfields as $cf) { |
| 94 |
if (!empty($cf['poplink'])) { |
| 95 |
?> |
| 96 |
<script type="text/javascript"> |
| 97 |
jQuery.noConflict(); |
| 98 |
jQuery(function() { |
| 99 |
jQuery(".vbmodal").fancybox({ |
| 100 |
"helpers": { |
| 101 |
"overlay": { |
| 102 |
"locked": false |
| 103 |
} |
| 104 |
}, |
| 105 |
"width": "70%", |
| 106 |
"height": "75%", |
| 107 |
"autoScale": false, |
| 108 |
"transitionIn": "none", |
| 109 |
"transitionOut": "none", |
| 110 |
"padding": 0, |
| 111 |
"type": "iframe" |
| 112 |
}); |
| 113 |
}); |
| 114 |
</script> |
| 115 |
<?php |
| 116 |
break; |
| 117 |
} |
| 118 |
} |
| 119 |
|
| 120 |
$currencysymb = VikBooking::getCurrencySymb(); |
| 121 |
$nowdf = VikBooking::getDateFormat(); |
| 122 |
if ($nowdf == "%d/%m/%Y") { |
| 123 |
$df = 'd/m/Y'; |
| 124 |
} elseif ($nowdf == "%m/%d/%Y") { |
| 125 |
$df = 'm/d/Y'; |
| 126 |
} else { |
| 127 |
$df = 'Y/m/d'; |
| 128 |
} |
| 129 |
$datesep = VikBooking::getDateSeparator(); |
| 130 |
$checkinforlink = date($df, $first); |
| 131 |
$checkoutforlink = date($df, $second); |
| 132 |
$in_info = getdate($first); |
| 133 |
$out_info = getdate($second); |
| 134 |
|
| 135 |
$no_taxes = VikBooking::noTaxRates(); |
| 136 |
$hide_tax_class = $no_taxes ? ' vbo-hide-tax' : ''; |
| 137 |
|
| 138 |
$peopleforlink = ''; |
| 139 |
foreach ($arrpeople as $aduchild) { |
| 140 |
$totadults += $aduchild['adults']; |
| 141 |
$totchildren += $aduchild['children']; |
| 142 |
$peopleforlink .= '&adults[]='.$aduchild['adults'].'&children[]='.$aduchild['children']; |
| 143 |
} |
| 144 |
if (!empty($pcategories)) { |
| 145 |
$peopleforlink .= '&categories=' . $pcategories; |
| 146 |
} |
| 147 |
if (is_array($pcategory_ids) && count($pcategory_ids)) { |
| 148 |
foreach ($pcategory_ids as $pcid) { |
| 149 |
$peopleforlink .= '&category_ids[]=' . $pcid; |
| 150 |
} |
| 151 |
} |
| 152 |
|
| 153 |
$roomoptforlink = ''; |
| 154 |
foreach ($rooms as $r) { |
| 155 |
$roomoptforlink .= '&roomopt[]=' . $r['id']; |
| 156 |
} |
| 157 |
|
| 158 |
$roomindexlink = ''; |
| 159 |
foreach ($this->roomindex as $rindex) { |
| 160 |
$roomindexlink .= '&roomindex[]=' . $rindex; |
| 161 |
} |
| 162 |
|
| 163 |
if (count($this->mod_booking)) { |
| 164 |
//booking modification |
| 165 |
?> |
| 166 |
<div class="vbo-booking-modification-helper"> |
| 167 |
<div class="vbo-booking-modification-helper-inner"> |
| 168 |
<div class="vbo-booking-modification-msg"> |
| 169 |
<span><?php echo JText::translate('VBOMODBOOKHELPOCONF'); ?></span> |
| 170 |
</div> |
| 171 |
<div class="vbo-booking-modification-canc"> |
| 172 |
<a href="<?php echo JRoute::rewrite('index.php?option=com_vikbooking&task=cancelmodification&sid='.$this->mod_booking['sid'].'&id='.$this->mod_booking['id'].(!empty($pitemid) ? '&Itemid='.$pitemid : '')); ?>"> |
| 173 |
<?php VikBookingIcons::e('times-circle'); ?> |
| 174 |
<?php echo JText::translate('VBOMODBOOKCANCMOD'); ?> |
| 175 |
</a> |
| 176 |
</div> |
| 177 |
</div> |
| 178 |
</div> |
| 179 |
<?php |
| 180 |
} |
| 181 |
|
| 182 |
?> |
| 183 |
<div class="vbstepsbarcont"> |
| 184 |
<ol class="vbo-stepbar" data-vbosteps="4"> |
| 185 |
<?php |
| 186 |
if ($is_package === true) { |
| 187 |
?> |
| 188 |
<li class="vbo-step vbo-step-complete"><a href="<?php echo JRoute::rewrite('index.php?option=com_vikbooking&view=packageslist'.(!empty($pitemid) ? '&Itemid='.$pitemid : '')); ?>"><?php echo JText::translate('VBOPKGLINK'); ?></a></li> |
| 189 |
<li class="vbo-step vbo-step-complete"><a href="<?php echo JRoute::rewrite('index.php?option=com_vikbooking&view=packagedetails&pkgid='.$pkg['id'].(!empty($pitemid) ? '&Itemid='.$pitemid : ''), false); ?>"><?php echo JText::translate('VBSTEPROOMSELECTION'); ?></a></li> |
| 190 |
<li class="vbo-step vbo-step-complete"><a href="<?php echo JRoute::rewrite('index.php?option=com_vikbooking&task=showprc&checkin='.$first.'&checkout='.$second.'&roomsnum='.$roomsnum.'&days='.$days.'&pkg_id='.$pkg['id'].$peopleforlink.$roomoptforlink.$roomindexlink.(!empty($pitemid) ? '&Itemid='.$pitemid : ''), false); ?>"><?php echo JText::translate('VBSTEPOPTIONS'); ?></a></li> |
| 191 |
<?php |
| 192 |
} else { |
| 193 |
$rq_split_stay = VikRequest::getVar('split_stay', array()); |
| 194 |
if ($this->roomsnum < 2 && (int) $session->get('vboSearchRoomId', 0) == (int) $this->rooms[1]['id']) { |
| 195 |
// we started the search from the room details page, so the dates link should point there |
| 196 |
$dateslink = JRoute::rewrite('index.php?option=com_vikbooking&view=roomdetails&roomid='.$this->rooms[1]['id'].'&checkin='.$first.'&checkout='.$second.(!empty($pitemid) ? '&Itemid='.$pitemid : '')); |
| 197 |
} else { |
| 198 |
// link to general search form |
| 199 |
$dateslink = JRoute::rewrite('index.php?option=com_vikbooking&view=vikbooking&checkin='.$first.'&checkout='.$second.(!empty($pitemid) ? '&Itemid='.$pitemid : '')); |
| 200 |
} |
| 201 |
?> |
| 202 |
<li class="vbo-step vbo-step-complete"><a href="<?php echo $dateslink; ?>"><?php echo JText::translate('VBSTEPDATES'); ?></a></li> |
| 203 |
<li class="vbo-step vbo-step-complete"><a href="<?php echo JRoute::rewrite('index.php?option=com_vikbooking&task=search&checkindate='.urlencode($checkinforlink).'&checkoutdate='.urlencode($checkoutforlink).'&roomsnum='.$roomsnum.$peopleforlink.(!empty($pitemid) ? '&Itemid='.$pitemid : ''), false); ?>"><?php echo JText::translate('VBSTEPROOMSELECTION'); ?></a></li> |
| 204 |
<li class="vbo-step vbo-step-complete"><a href="<?php echo JRoute::rewrite('index.php?option=com_vikbooking&task=showprc&checkin='.$first.'&checkout='.$second.'&roomsnum='.$roomsnum.'&days='.$days.$peopleforlink.$roomoptforlink.$roomindexlink.(!empty($this->split_stay) && !empty($rq_split_stay) ? '&' . http_build_query(['split_stay' => $rq_split_stay]) : '').(!empty($pitemid) ? '&Itemid='.$pitemid : ''), false); ?>"><?php echo JText::translate('VBSTEPOPTIONS'); ?></a></li> |
| 205 |
<?php |
| 206 |
} |
| 207 |
?> |
| 208 |
<li class="vbo-step vbo-step-current"><span><?php echo JText::translate('VBSTEPCONFIRM'); ?></span></li> |
| 209 |
</ol> |
| 210 |
</div> |
| 211 |
|
| 212 |
<div class="vbo-oconfirm-wrapper"> |
| 213 |
<div class="vbo-results-head vbo-results-head-oconfirm"> |
| 214 |
<div class="vbo-results-nights"> |
| 215 |
<?php VikBookingIcons::e((!empty($this->split_stay) ? 'random' : 'calendar'), 'vbo-pref-color-text'); ?> |
| 216 |
<div class="vbo-results-head-det"> |
| 217 |
<span class="vbo-results-head-det-lbl"><?php echo ($days == 1 ? JText::translate('VBSEARCHRESNIGHT') : JText::translate('VBSEARCHRESNIGHTS')); ?></span> |
| 218 |
<span class="vbo-results-head-det-val"><?php echo $days; ?></span> |
| 219 |
</div> |
| 220 |
</div> |
| 221 |
<div class="vbo-results-numadults"> |
| 222 |
<?php VikBookingIcons::e('male', 'vbo-pref-color-text'); ?> |
| 223 |
<div class="vbo-results-head-det"> |
| 224 |
<span class="vbo-results-head-det-lbl"><?php echo ($totadults == 1 ? JText::translate('VBSEARCHRESADULT') : JText::translate('VBSEARCHRESADULTS')); ?></span> |
| 225 |
<span class="vbo-results-head-det-val"><?php echo $totadults; ?></span> |
| 226 |
</div> |
| 227 |
</div> |
| 228 |
<?php |
| 229 |
if ($showchildren && $totchildren > 0) { |
| 230 |
?> |
| 231 |
<div class="vbo-results-numchildren"> |
| 232 |
<?php VikBookingIcons::e('child', 'vbo-pref-color-text'); ?> |
| 233 |
<div class="vbo-results-head-det"> |
| 234 |
<span class="vbo-results-head-det-lbl"><?php echo $totchildren == 1 ? JText::translate('VBSEARCHRESCHILD') : JText::translate('VBSEARCHRESCHILDREN'); ?></span> |
| 235 |
<span class="vbo-results-head-det-val"><?php echo $totchildren; ?></span> |
| 236 |
</div> |
| 237 |
</div> |
| 238 |
<?php |
| 239 |
} |
| 240 |
?> |
| 241 |
<div class="vbo-summary-date"> |
| 242 |
<?php VikBookingIcons::e('plane-arrival', 'vbo-pref-color-text'); ?> |
| 243 |
<div class="vbo-results-head-det"> |
| 244 |
<span class="vbo-results-head-det-lbl"><?php echo JText::translate('VBPICKUP'); ?></span> |
| 245 |
<span class="vbo-results-head-det-val"><?php |
| 246 |
if ($listing_custom_checkin) { |
| 247 |
echo $wdays_map[$in_info['wday']] . ', ' . date(str_replace("/", $datesep, $df), $first) . ' ' . $listing_custom_checkin; |
| 248 |
} else { |
| 249 |
echo $wdays_map[$in_info['wday']] . ', ' . date(str_replace("/", $datesep, $df) . ' H:i', $first); |
| 250 |
} |
| 251 |
?></span> |
| 252 |
</div> |
| 253 |
</div> |
| 254 |
<div class="vbo-summary-date"> |
| 255 |
<?php VikBookingIcons::e('plane-departure', 'vbo-pref-color-text'); ?> |
| 256 |
<div class="vbo-results-head-det"> |
| 257 |
<span class="vbo-results-head-det-lbl"><?php echo JText::translate('VBRETURN'); ?></span> |
| 258 |
<span class="vbo-results-head-det-val"><?php |
| 259 |
if ($listing_custom_checkout) { |
| 260 |
echo $wdays_map[$out_info['wday']] . ', ' . date(str_replace("/", $datesep, $df), $second) . ' ' . $listing_custom_checkout; |
| 261 |
} else { |
| 262 |
echo $wdays_map[$out_info['wday']] . ', ' . date(str_replace("/", $datesep, $df) . ' H:i', $second); |
| 263 |
} |
| 264 |
?></span> |
| 265 |
</div> |
| 266 |
</div> |
| 267 |
</div> |
| 268 |
|
| 269 |
<div class="vbo-oconfirm-summary-container"> |
| 270 |
<?php |
| 271 |
$imp = 0; |
| 272 |
$totdue = 0; |
| 273 |
$saywithout = 0; |
| 274 |
$saywith = 0; |
| 275 |
$tot_taxes = 0; |
| 276 |
$tot_city_taxes = 0; |
| 277 |
$tot_fees = 0; |
| 278 |
$wop = ""; |
| 279 |
foreach ($rooms as $num => $r) { |
| 280 |
$ind = $num - 1; |
| 281 |
|
| 282 |
// determine values to be considered |
| 283 |
$room_nights = $this->days; |
| 284 |
$room_checkin = $this->first; |
| 285 |
$room_checkout = $this->second; |
| 286 |
$is_split_room = false; |
| 287 |
if (!empty($this->split_stay) && isset($this->split_stay[$ind]) && $this->split_stay[$ind]['idroom'] == $r['id']) { |
| 288 |
$room_nights = $this->split_stay[$ind]['nights']; |
| 289 |
$room_checkin = $this->split_stay[$ind]['checkin_ts']; |
| 290 |
$room_checkout = $this->split_stay[$ind]['checkout_ts']; |
| 291 |
$is_split_room = true; |
| 292 |
} |
| 293 |
|
| 294 |
if ($is_package === true) { |
| 295 |
$pkg_cost = $pkg['pernight_total'] == 1 ? ($pkg['cost'] * $days) : $pkg['cost']; |
| 296 |
$pkg_cost = $pkg['perperson'] == 1 ? ($pkg_cost * ($arrpeople[$num]['adults'] > 0 ? $arrpeople[$num]['adults'] : 1)) : $pkg_cost; |
| 297 |
$tmpimp = VikBooking::sayPackageMinusIva($pkg_cost, $pkg['idiva']); |
| 298 |
$tmptotdue = VikBooking::sayPackagePlusIva($pkg_cost, $pkg['idiva']); |
| 299 |
$base_cost = $pkg_cost; |
| 300 |
} else { |
| 301 |
$tmpimp = VikBooking::sayCostMinusIva($tars[$num][0]['cost'], $tars[$num][0]['idprice']); |
| 302 |
$tmptotdue = VikBooking::sayCostPlusIva($tars[$num][0]['cost'], $tars[$num][0]['idprice']); |
| 303 |
$base_cost = $tars[$num][0]['cost']; |
| 304 |
} |
| 305 |
$imp += $tmpimp; |
| 306 |
$totdue += $tmptotdue; |
| 307 |
if ($tmptotdue == $base_cost) { |
| 308 |
$tot_taxes += ($base_cost - $tmpimp); |
| 309 |
} else { |
| 310 |
$tot_taxes += ($tmptotdue - $base_cost); |
| 311 |
} |
| 312 |
$saywithout = $tmpimp; |
| 313 |
$saywith = $tmptotdue; |
| 314 |
if (isset($selopt[$num]) && is_array($selopt[$num])) { |
| 315 |
foreach ($selopt[$num] as $selo) { |
| 316 |
$wop .= $num . "_" . $selo['id'] . ":" . $selo['quan'] . (array_key_exists('chageintv', $selo) ? '-'.$selo['chageintv'] : '') . ";"; |
| 317 |
$realcost = (intval($selo['perday']) == 1 ? ($selo['cost'] * $room_nights * $selo['quan']) : ($selo['cost'] * $selo['quan'])); |
| 318 |
if (!empty ($selo['maxprice']) && $selo['maxprice'] > 0 && $realcost > $selo['maxprice']) { |
| 319 |
$realcost = $selo['maxprice']; |
| 320 |
if (intval($selo['hmany']) == 1 && intval($selo['quan']) > 1) { |
| 321 |
$realcost = $selo['maxprice'] * $selo['quan']; |
| 322 |
} |
| 323 |
} |
| 324 |
if ($selo['perperson'] == 1) { |
| 325 |
$realcost = $realcost * $arrpeople[$num]['adults']; |
| 326 |
} |
| 327 |
|
| 328 |
/** |
| 329 |
* Trigger event to allow third party plugins to apply a custom calculation for the option/extra fee or tax. |
| 330 |
* |
| 331 |
* @since 1.17.7 (J) - 1.7.7 (WP) |
| 332 |
*/ |
| 333 |
$custom_calc_booking = ['days' => $room_nights]; |
| 334 |
$custom_calc_booking_room = array_merge(($arrpeople[$num] ?? []), ['room_cost' => $base_cost]); |
| 335 |
$custom_calculation = VBOFactory::getPlatform()->getDispatcher()->filter('onCalculateBookingOptionFeeCost', [$realcost, &$selo, $custom_calc_booking, $custom_calc_booking_room]); |
| 336 |
if ($custom_calculation) { |
| 337 |
$realcost = (float) $custom_calculation[0]; |
| 338 |
} |
| 339 |
|
| 340 |
$optbeforetax = VikBooking::sayOptionalsMinusIva($realcost, $selo['idiva']); |
| 341 |
$imp += $optbeforetax; |
| 342 |
$tmpopr = VikBooking::sayOptionalsPlusIva($realcost, $selo['idiva']); |
| 343 |
$totdue += $tmpopr; |
| 344 |
if ($selo['is_citytax'] == 1) { |
| 345 |
$tot_city_taxes += $optbeforetax; |
| 346 |
} elseif ($selo['is_fee'] == 1) { |
| 347 |
$tot_fees += $optbeforetax; |
| 348 |
} |
| 349 |
// VBO 1.11 - always calculate the amount of tax no matter if this is already a tax or a fee |
| 350 |
if ($tmpopr == $realcost) { |
| 351 |
$tot_taxes += ($realcost - $optbeforetax); |
| 352 |
} else { |
| 353 |
$tot_taxes += ($tmpopr - $realcost); |
| 354 |
} |
| 355 |
// |
| 356 |
} |
| 357 |
} |
| 358 |
?> |
| 359 |
<div class="vbo-oconfirm-summary-room-wrapper<?php echo $no_taxes ? ' vbo-oconfirm-summary-room-wrapper-notaxes' : ''; ?>"> |
| 360 |
|
| 361 |
<div class="vbo-oconfirm-summary-room-head"> |
| 362 |
<div class="vbo-oconfirm-summary-room-head-cell vbo-oconfirm-summary-room-cell-descr"> |
| 363 |
<span></span> |
| 364 |
</div> |
| 365 |
<div class="vbo-oconfirm-summary-room-head-cell vbo-oconfirm-summary-room-cell-guests"> |
| 366 |
<span><?php echo JText::translate('VBOINVTOTGUESTS'); ?></span> |
| 367 |
</div> |
| 368 |
<div class="vbo-oconfirm-summary-room-head-cell vbo-oconfirm-summary-room-cell-nights"> |
| 369 |
<span><?php echo JText::translate('ORDDD'); ?></span> |
| 370 |
</div> |
| 371 |
<div class="vbo-oconfirm-summary-room-head-cell vbo-oconfirm-summary-room-cell-net<?php echo $hide_tax_class; ?>"> |
| 372 |
<span><?php echo JText::translate('ORDNOTAX'); ?></span> |
| 373 |
</div> |
| 374 |
<div class="vbo-oconfirm-summary-room-head-cell vbo-oconfirm-summary-room-cell-tax<?php echo $hide_tax_class; ?>"> |
| 375 |
<span><?php echo JText::translate('ORDTAX'); ?></span> |
| 376 |
</div> |
| 377 |
<div class="vbo-oconfirm-summary-room-head-cell vbo-oconfirm-summary-room-cell-tot"> |
| 378 |
<span><?php echo JText::translate('ORDWITHTAX'); ?></span> |
| 379 |
</div> |
| 380 |
</div> |
| 381 |
|
| 382 |
<div class="vbo-oconfirm-summary-room-row"> |
| 383 |
<div class="vbo-oconfirm-summary-room-cell-descr"> |
| 384 |
<div class="vbo-oconfirm-roomname vbo-pref-color-text"><?php echo $r['name']; ?></div> |
| 385 |
<?php |
| 386 |
// check if a sub-unit was requested |
| 387 |
if (count($this->roomindex) && !empty($this->roomindex[($num - 1)])) { |
| 388 |
$room_feature = VikBooking::getRoomUnitDistinctiveFeature($r['params'], $this->roomindex[($num - 1)]); |
| 389 |
if ($room_feature !== false) { |
| 390 |
?> |
| 391 |
<div class="vbo-oconfirm-priceinfo vbo-oconfirm-roomdistfeature"> |
| 392 |
<span><?php echo $room_feature[0] . ' ' . $room_feature[1]; ?></span> |
| 393 |
</div> |
| 394 |
<?php |
| 395 |
} |
| 396 |
} |
| 397 |
?> |
| 398 |
<div class="vbo-oconfirm-priceinfo"> |
| 399 |
<?php |
| 400 |
if ($is_package === true) { |
| 401 |
echo $pkg['name']; |
| 402 |
} else { |
| 403 |
echo VikBooking::getPriceName($tars[$num][0]['idprice'], $vbo_tn).(!empty($tars[$num][0]['attrdata']) ? "<br/>".VikBooking::getPriceAttr($tars[$num][0]['idprice'], $vbo_tn).": ".$tars[$num][0]['attrdata'] : ""); |
| 404 |
} |
| 405 |
?> |
| 406 |
</div> |
| 407 |
<?php |
| 408 |
// print split stay information, if available |
| 409 |
if ($is_split_room) { |
| 410 |
?> |
| 411 |
<div class="vbo-oconfirm-priceinfo vbo-oconfirm-splitstay-dates"> |
| 412 |
<span class="vbo-oconfirm-splitstay-checkin"><?php VikBookingIcons::e('sign-in', 'vbo-pref-color-text'); ?> <?php echo date(str_replace("/", $datesep, $df), $room_checkin); ?></span> |
| 413 |
<span class="vbo-oconfirm-splitstay-checkout"><?php VikBookingIcons::e('sign-out', 'vbo-pref-color-text'); ?> <?php echo date(str_replace("/", $datesep, $df), $room_checkout); ?></span> |
| 414 |
</div> |
| 415 |
<?php |
| 416 |
} |
| 417 |
?> |
| 418 |
</div> |
| 419 |
<div class="vbo-oconfirm-summary-room-cell-guests"> |
| 420 |
<span><?php echo $arrpeople[$num]['adults']; ?> <?php echo ($arrpeople[$num]['adults'] == 1 ? JText::translate('VBSEARCHRESADULT') : JText::translate('VBSEARCHRESADULTS')); ?><?php echo ($showchildren && $arrpeople[$num]['children'] > 0 ? ", ".$arrpeople[$num]['children']." ".($arrpeople[$num]['children'] == 1 ? JText::translate('VBSEARCHRESCHILD') : JText::translate('VBSEARCHRESCHILDREN')) : ""); ?></span> |
| 421 |
</div> |
| 422 |
<div class="vbo-oconfirm-summary-room-cell-nights"> |
| 423 |
<div class="vbo-oconfirm-summary-room-head-cell vbo-oconfirm-summary-room-head-cell-responsive"> |
| 424 |
<span><?php echo JText::translate('ORDDD'); ?></span> |
| 425 |
</div> |
| 426 |
<span><?php echo $room_nights; ?></span> |
| 427 |
</div> |
| 428 |
<div class="vbo-oconfirm-summary-room-cell-net<?php echo $hide_tax_class; ?>"> |
| 429 |
<div class="vbo-oconfirm-summary-room-head-cell vbo-oconfirm-summary-room-head-cell-responsive"> |
| 430 |
<span><?php echo JText::translate('ORDNOTAX'); ?></span> |
| 431 |
</div> |
| 432 |
<?php echo VikBooking::formatCurrencyNumber(VikBooking::numberFormat($saywithout), $currencysymb, ['<span class="vbcurrency"><span class="vbo_currency">%s</span></span>', '<span class="vbprice"><span class="vbo_price">%s</span></span>']); ?> |
| 433 |
</div> |
| 434 |
<div class="vbo-oconfirm-summary-room-cell-tax<?php echo $hide_tax_class; ?>"> |
| 435 |
<div class="vbo-oconfirm-summary-room-head-cell vbo-oconfirm-summary-room-head-cell-responsive"> |
| 436 |
<span><?php echo JText::translate('ORDTAX'); ?></span> |
| 437 |
</div> |
| 438 |
<?php echo VikBooking::formatCurrencyNumber(VikBooking::numberFormat($saywith - $saywithout), $currencysymb, ['<span class="vbcurrency"><span class="vbo_currency">%s</span></span>', '<span class="vbprice"><span class="vbo_price">%s</span></span>']); ?> |
| 439 |
</div> |
| 440 |
<div class="vbo-oconfirm-summary-room-cell-tot"> |
| 441 |
<div class="vbo-oconfirm-summary-room-head-cell vbo-oconfirm-summary-room-head-cell-responsive"> |
| 442 |
<span><?php echo JText::translate('ORDWITHTAX'); ?></span> |
| 443 |
</div> |
| 444 |
<?php echo VikBooking::formatCurrencyNumber(VikBooking::numberFormat($saywith), $currencysymb, ['<span class="vbcurrency"><span class="vbo_currency">%s</span></span>', '<span class="vbprice"><span class="vbo_price">%s</span></span>']); ?> |
| 445 |
</div> |
| 446 |
</div> |
| 447 |
<?php |
| 448 |
//write options |
| 449 |
$sf = 2; |
| 450 |
if (isset($selopt[$num]) && is_array($selopt[$num])) { |
| 451 |
foreach ($selopt[$num] as $aop) { |
| 452 |
if (intval($aop['perday']) == 1) { |
| 453 |
$thisoptcost = ($aop['cost'] * $aop['quan']) * $room_nights; |
| 454 |
} else { |
| 455 |
$thisoptcost = $aop['cost'] * $aop['quan']; |
| 456 |
} |
| 457 |
if (!empty ($aop['maxprice']) && $aop['maxprice'] > 0 && $thisoptcost > $aop['maxprice']) { |
| 458 |
$thisoptcost = $aop['maxprice']; |
| 459 |
if (intval($aop['hmany']) == 1 && intval($aop['quan']) > 1) { |
| 460 |
$thisoptcost = $aop['maxprice'] * $aop['quan']; |
| 461 |
} |
| 462 |
} |
| 463 |
if ($aop['perperson'] == 1) { |
| 464 |
$thisoptcost = $thisoptcost * $arrpeople[$num]['adults']; |
| 465 |
} |
| 466 |
|
| 467 |
/** |
| 468 |
* Trigger event to allow third party plugins to apply a custom calculation for the option/extra fee or tax. |
| 469 |
* |
| 470 |
* @since 1.17.7 (J) - 1.7.7 (WP) |
| 471 |
*/ |
| 472 |
$custom_calc_booking = ['days' => $room_nights]; |
| 473 |
$custom_calc_booking_room = array_merge(($arrpeople[$num] ?? []), ['room_cost' => ($base_cost ?? 0)]); |
| 474 |
$custom_calculation = VBOFactory::getPlatform()->getDispatcher()->filter('onCalculateBookingOptionFeeCost', [$thisoptcost, &$aop, $custom_calc_booking, $custom_calc_booking_room]); |
| 475 |
if ($custom_calculation) { |
| 476 |
$thisoptcost = (float) $custom_calculation[0]; |
| 477 |
} |
| 478 |
|
| 479 |
$optwithout = VikBooking::sayOptionalsMinusIva($thisoptcost, $aop['idiva']); |
| 480 |
$optwith = VikBooking::sayOptionalsPlusIva($thisoptcost, $aop['idiva']); |
| 481 |
$opttax = ($optwith - $optwithout); |
| 482 |
?> |
| 483 |
<div class="vbo-oconfirm-summary-room-row vbo-oconfirm-summary-option-row"> |
| 484 |
<div class="vbo-oconfirm-summary-room-cell-descr"> |
| 485 |
<div class="vbo-oconfirm-optname"><?php echo $aop['name'].($aop['quan'] > 1 ? " <small>(x ".$aop['quan'].")</small>" : ""); ?></div> |
| 486 |
</div> |
| 487 |
<div class="vbo-oconfirm-summary-room-cell-guests"> |
| 488 |
<span></span> |
| 489 |
</div> |
| 490 |
<div class="vbo-oconfirm-summary-room-cell-nights"> |
| 491 |
<span></span> |
| 492 |
</div> |
| 493 |
<div class="vbo-oconfirm-summary-room-cell-net<?php echo $hide_tax_class; ?>"> |
| 494 |
<div class="vbo-oconfirm-summary-room-head-cell vbo-oconfirm-summary-room-head-cell-responsive"> |
| 495 |
<span><?php echo JText::translate('ORDNOTAX'); ?></span> |
| 496 |
</div> |
| 497 |
<?php echo VikBooking::formatCurrencyNumber(VikBooking::numberFormat($optwithout), $currencysymb, ['<span class="vbcurrency"><span class="vbo_currency">%s</span></span>', '<span class="vbprice"><span class="vbo_price">%s</span></span>']); ?> |
| 498 |
</div> |
| 499 |
<div class="vbo-oconfirm-summary-room-cell-tax<?php echo $hide_tax_class; ?>"> |
| 500 |
<div class="vbo-oconfirm-summary-room-head-cell vbo-oconfirm-summary-room-head-cell-responsive"> |
| 501 |
<span><?php echo JText::translate('ORDTAX'); ?></span> |
| 502 |
</div> |
| 503 |
<?php echo VikBooking::formatCurrencyNumber(VikBooking::numberFormat($opttax), $currencysymb, ['<span class="vbcurrency"><span class="vbo_currency">%s</span></span>', '<span class="vbprice"><span class="vbo_price">%s</span></span>']); ?> |
| 504 |
</div> |
| 505 |
<div class="vbo-oconfirm-summary-room-cell-tot"> |
| 506 |
<div class="vbo-oconfirm-summary-room-head-cell vbo-oconfirm-summary-room-head-cell-responsive"> |
| 507 |
<span><?php echo JText::translate('ORDWITHTAX'); ?></span> |
| 508 |
</div> |
| 509 |
<?php echo VikBooking::formatCurrencyNumber(VikBooking::numberFormat($optwith), $currencysymb, ['<span class="vbcurrency"><span class="vbo_currency">%s</span></span>', '<span class="vbprice"><span class="vbo_price">%s</span></span>']); ?> |
| 510 |
</div> |
| 511 |
</div> |
| 512 |
<?php |
| 513 |
$sf++; |
| 514 |
} |
| 515 |
} |
| 516 |
//end write options |
| 517 |
|
| 518 |
// end room wrapper |
| 519 |
?> |
| 520 |
</div> |
| 521 |
<?php |
| 522 |
// |
| 523 |
|
| 524 |
if ($roomsnum > 1 && $num < $roomsnum) { |
| 525 |
// we no longer need a separator between the rooms containers |
| 526 |
} |
| 527 |
} |
| 528 |
|
| 529 |
// store Order Total in session for modules |
| 530 |
$session->set('vikbooking_ordertotal', $totdue); |
| 531 |
|
| 532 |
// coupon code |
| 533 |
$origtotdue = $totdue; |
| 534 |
$usedcoupon = false; |
| 535 |
if (!empty($coupon)) { |
| 536 |
// check min tot ord |
| 537 |
$coupontotok = true; |
| 538 |
if (strlen((string)$coupon['mintotord'])) { |
| 539 |
if ($totdue < $coupon['mintotord']) { |
| 540 |
$coupontotok = false; |
| 541 |
} |
| 542 |
} |
| 543 |
if ($coupon['maxtotord'] > 0 && $totdue > $coupon['maxtotord']) { |
| 544 |
$coupontotok = false; |
| 545 |
} |
| 546 |
if ($coupontotok) { |
| 547 |
$usedcoupon = true; |
| 548 |
if ($coupon['percentot'] == 1) { |
| 549 |
// percent value |
| 550 |
$minuscoupon = 100 - $coupon['value']; |
| 551 |
/** |
| 552 |
* We allow coupon codes to be applied on the entire reservation or as always just on the total minus mandatory taxes. |
| 553 |
* |
| 554 |
* @since 1.13.5 (J) - 1.3.5 (WP) |
| 555 |
* @since 1.14.3 (J) - 1.4.3 (WP) we also exclude the amount of taxes beside the mandatory fees. |
| 556 |
* @since 1.16.0 (J) - 1.6.0 (WP) taxes are proportionally calculated when coupon before tax. |
| 557 |
* @since 1.16.8 (J) - 1.6.8 (WP) with coupon before taxes, discounted amount calculation is an equal subtration. |
| 558 |
*/ |
| 559 |
$prev_totdue = $totdue; |
| 560 |
$tot_net = ($totdue - $tot_taxes - $tot_city_taxes - $tot_fees); |
| 561 |
$couponsave = ($coupon['excludetaxes'] ? $tot_net : $totdue) * $coupon['value'] / 100; |
| 562 |
$totdue = ($coupon['excludetaxes'] ? $tot_net : $totdue) * $minuscoupon / 100; |
| 563 |
$tot_taxes = $coupon['excludetaxes'] ? ($tot_taxes * ($tot_net - $couponsave) / $tot_net) : ($tot_taxes * $minuscoupon / 100); |
| 564 |
$totdue += $coupon['excludetaxes'] ? ($tot_taxes + $tot_city_taxes + $tot_fees) : 0; |
| 565 |
$couponsave = abs($prev_totdue - $totdue); |
| 566 |
} else { |
| 567 |
// total value |
| 568 |
$couponsave = $coupon['value']; |
| 569 |
$tax_prop = $tot_taxes * $coupon['value'] / $totdue; |
| 570 |
$tot_taxes -= $tax_prop; |
| 571 |
$tot_taxes = $tot_taxes < 0 ? 0 : $tot_taxes; |
| 572 |
$totdue -= $coupon['value']; |
| 573 |
$totdue = $totdue < 0 ? 0 : $totdue; |
| 574 |
} |
| 575 |
} else { |
| 576 |
if ($coupon['maxtotord'] > 0 && $totdue > $coupon['maxtotord']) { |
| 577 |
VikError::raiseWarning('', JText::translate('VBCOUPONINVMAXTOTORD')); |
| 578 |
} else { |
| 579 |
VikError::raiseWarning('', JText::translate('VBCOUPONINVMINTOTORD')); |
| 580 |
} |
| 581 |
} |
| 582 |
|
| 583 |
if (!$usedcoupon) { |
| 584 |
// reset the coupon value to allow again to submit a new coupon code |
| 585 |
$coupon = []; |
| 586 |
} |
| 587 |
} |
| 588 |
|
| 589 |
// inject extra information for tracker |
| 590 |
VikBooking::getTracker() |
| 591 |
->setExtraInfo('total', $totdue); |
| 592 |
|
| 593 |
?> |
| 594 |
<div class="vbo-oconfirm-summary-total-wrapper<?php echo $no_taxes ? ' vbo-oconfirm-summary-total-wrapper-notaxes' : ''; ?>"> |
| 595 |
|
| 596 |
<div class="vbo-oconfirm-summary-room-row vbo-oconfirm-summary-total-row"> |
| 597 |
<div class="vbo-oconfirm-summary-room-cell-descr"> |
| 598 |
<div class="vbo-oconfirm-total-block"><?php echo JText::translate('VBTOTAL'); ?></div> |
| 599 |
</div> |
| 600 |
<div class="vbo-oconfirm-summary-room-cell-guests"> |
| 601 |
<span></span> |
| 602 |
</div> |
| 603 |
<div class="vbo-oconfirm-summary-room-cell-nights"> |
| 604 |
<span></span> |
| 605 |
</div> |
| 606 |
<div class="vbo-oconfirm-summary-room-cell-net<?php echo $hide_tax_class; ?>"> |
| 607 |
<div class="vbo-oconfirm-summary-room-head-cell vbo-oconfirm-summary-room-cell-net"> |
| 608 |
<span><?php echo JText::translate('ORDNOTAX'); ?></span> |
| 609 |
</div> |
| 610 |
<?php echo VikBooking::formatCurrencyNumber(VikBooking::numberFormat($imp), $currencysymb, ['<span class="vbcurrency"><span class="vbo_currency">%s</span></span>', '<span class="vbprice"><span class="vbo_price">%s</span></span>']); ?> |
| 611 |
</div> |
| 612 |
<div class="vbo-oconfirm-summary-room-cell-tax<?php echo $hide_tax_class; ?>"> |
| 613 |
<div class="vbo-oconfirm-summary-room-head-cell vbo-oconfirm-summary-room-cell-tax"> |
| 614 |
<span><?php echo JText::translate('ORDTAX'); ?></span> |
| 615 |
</div> |
| 616 |
<?php echo VikBooking::formatCurrencyNumber(VikBooking::numberFormat($origtotdue - $imp), $currencysymb, ['<span class="vbcurrency"><span class="vbo_currency">%s</span></span>', '<span class="vbprice"><span class="vbo_price">%s</span></span>']); ?> |
| 617 |
</div> |
| 618 |
<div class="vbo-oconfirm-summary-room-cell-tot"> |
| 619 |
<div class="vbo-oconfirm-summary-room-head-cell vbo-oconfirm-summary-room-cell-tot"> |
| 620 |
<span><?php echo JText::translate('ORDWITHTAX'); ?></span> |
| 621 |
</div> |
| 622 |
<?php echo VikBooking::formatCurrencyNumber(VikBooking::numberFormat($origtotdue), $currencysymb, ['<span class="vbcurrency"><span class="vbo_currency">%s</span></span>', '<span class="vbprice"><span class="vbo_price">%s</span></span>']); ?> |
| 623 |
</div> |
| 624 |
</div> |
| 625 |
|
| 626 |
<?php |
| 627 |
if ($usedcoupon == true && !empty($coupon)) { |
| 628 |
// build link to remove the coupon |
| 629 |
$coupon_res_vals = [ |
| 630 |
'option' => 'com_vikbooking', |
| 631 |
'task' => 'oconfirm', |
| 632 |
'Itemid' => (!empty($pitemid) ? $pitemid : null), |
| 633 |
]; |
| 634 |
$coupon_rq_vals = JFactory::getApplication()->input->getArray(); |
| 635 |
foreach ($coupon_rq_vals as $rq_key => $rq_val) { |
| 636 |
if ($rq_key == 'couponcode' || $rq_key == 'applyacoupon') { |
| 637 |
continue; |
| 638 |
} |
| 639 |
if (!isset($coupon_res_vals[$rq_key])) { |
| 640 |
$coupon_res_vals[$rq_key] = $rq_val; |
| 641 |
} |
| 642 |
} |
| 643 |
$coupon_rm_link = JRoute::rewrite('index.php?' . http_build_query($coupon_res_vals), true); |
| 644 |
?> |
| 645 |
<div class="vbo-oconfirm-summary-room-row vbo-oconfirm-summary-total-row vbo-oconfirm-summary-coupon-row"> |
| 646 |
<div class="vbo-oconfirm-summary-room-cell-descr"> |
| 647 |
<span><?php echo JText::translate('VBCOUPON'); ?> <?php echo $coupon['code']; ?><a class="vbo-remove-coupon" href="<?php echo $coupon_rm_link; ?>" onclick="return confirm(Joomla.JText._('VBO_RM_COUPON_CONFIRM'));"><?php VikBookingIcons::e('times-circle'); ?></a></span> |
| 648 |
</div> |
| 649 |
<div class="vbo-oconfirm-summary-room-cell-guests"> |
| 650 |
<span></span> |
| 651 |
</div> |
| 652 |
<div class="vbo-oconfirm-summary-room-cell-nights"> |
| 653 |
<span></span> |
| 654 |
</div> |
| 655 |
<div class="vbo-oconfirm-summary-room-cell-net<?php echo $hide_tax_class; ?>"> |
| 656 |
<span></span> |
| 657 |
</div> |
| 658 |
<div class="vbo-oconfirm-summary-room-cell-tax<?php echo $hide_tax_class; ?>"> |
| 659 |
<span></span> |
| 660 |
</div> |
| 661 |
<div class="vbo-oconfirm-summary-room-cell-tot"> |
| 662 |
<?php echo VikBooking::formatCurrencyNumber(VikBooking::numberFormat($couponsave), $currencysymb, ['<span class="vbcurrency">- <span class="vbo_currency">%s</span></span>', '<span class="vbprice"><span class="vbo_price">%s</span></span>']); ?> |
| 663 |
</div> |
| 664 |
</div> |
| 665 |
|
| 666 |
<div class="vbo-oconfirm-summary-room-row vbo-oconfirm-summary-total-row vbo-oconfirm-summary-coupon-newtot-row"> |
| 667 |
<div class="vbo-oconfirm-summary-room-cell-descr"> |
| 668 |
<div class="vbo-oconfirm-total-block"><?php echo JText::translate('VBNEWTOTAL'); ?></div> |
| 669 |
</div> |
| 670 |
<div class="vbo-oconfirm-summary-room-cell-guests"> |
| 671 |
<span></span> |
| 672 |
</div> |
| 673 |
<div class="vbo-oconfirm-summary-room-cell-nights"> |
| 674 |
<span></span> |
| 675 |
</div> |
| 676 |
<div class="vbo-oconfirm-summary-room-cell-net<?php echo $hide_tax_class; ?>"> |
| 677 |
<span></span> |
| 678 |
</div> |
| 679 |
<div class="vbo-oconfirm-summary-room-cell-tax<?php echo $hide_tax_class; ?>"> |
| 680 |
<span></span> |
| 681 |
</div> |
| 682 |
<div class="vbo-oconfirm-summary-room-cell-tot"> |
| 683 |
<?php echo VikBooking::formatCurrencyNumber(VikBooking::numberFormat($totdue), $currencysymb, ['<span class="vbcurrency"><span class="vbo_currency">%s</span></span>', '<span class="vbprice"><span class="vbo_price">%s</span></span>']); ?> |
| 684 |
</div> |
| 685 |
</div> |
| 686 |
<?php |
| 687 |
} |
| 688 |
|
| 689 |
if (count($this->mod_booking) && $this->mod_booking['total'] > 0) { |
| 690 |
//booking modification |
| 691 |
$modbook_tot_diff = abs($this->mod_booking['total'] - $totdue); |
| 692 |
$modbook_diff_op = $this->mod_booking['total'] <= $totdue ? '+' : '-'; |
| 693 |
?> |
| 694 |
<div class="vbo-oconfirm-summary-room-row vbo-oconfirm-summary-total-row vbordrowtotal-prevtot"> |
| 695 |
<div class="vbo-oconfirm-summary-room-cell-descr"> |
| 696 |
<div class="vbo-oconfirm-total-block vbo-oconfirm-previoustotal-block"><?php echo JText::translate('VBOMODBOOKPREVTOT'); ?></div> |
| 697 |
</div> |
| 698 |
<div class="vbo-oconfirm-summary-room-cell-guests"> |
| 699 |
<span></span> |
| 700 |
</div> |
| 701 |
<div class="vbo-oconfirm-summary-room-cell-nights"> |
| 702 |
<span></span> |
| 703 |
</div> |
| 704 |
<div class="vbo-oconfirm-summary-room-cell-net<?php echo $hide_tax_class; ?>"> |
| 705 |
<span></span> |
| 706 |
</div> |
| 707 |
<div class="vbo-oconfirm-summary-room-cell-tax<?php echo $hide_tax_class; ?>"> |
| 708 |
<span></span> |
| 709 |
</div> |
| 710 |
<div class="vbo-oconfirm-summary-room-cell-tot"> |
| 711 |
<?php echo VikBooking::formatCurrencyNumber(VikBooking::numberFormat($this->mod_booking['total']), $currencysymb, ['<span class="vbcurrency"><span class="vbo_currency">%s</span></span>', '<span class="vbprice"><span class="vbo_price">%s</span></span>']); ?> |
| 712 |
</div> |
| 713 |
</div> |
| 714 |
|
| 715 |
<div class="vbo-oconfirm-summary-room-row vbo-oconfirm-summary-total-row <?php echo $modbook_diff_op == '+' ? 'vbordrowtotal-negative' : 'vbordrowtotal-positive'; ?>"> |
| 716 |
<div class="vbo-oconfirm-summary-room-cell-descr"> |
| 717 |
<div class="vbo-oconfirm-total-block vbo-oconfirm-diffmod-block"><?php echo JText::translate('VBOMODBOOKDIFFTOT'); ?></div> |
| 718 |
</div> |
| 719 |
<div class="vbo-oconfirm-summary-room-cell-guests"> |
| 720 |
<span></span> |
| 721 |
</div> |
| 722 |
<div class="vbo-oconfirm-summary-room-cell-nights"> |
| 723 |
<span></span> |
| 724 |
</div> |
| 725 |
<div class="vbo-oconfirm-summary-room-cell-net<?php echo $hide_tax_class; ?>"> |
| 726 |
<span></span> |
| 727 |
</div> |
| 728 |
<div class="vbo-oconfirm-summary-room-cell-tax<?php echo $hide_tax_class; ?>"> |
| 729 |
<span></span> |
| 730 |
</div> |
| 731 |
<div class="vbo-oconfirm-summary-room-cell-tot"> |
| 732 |
<!-- <span class="vbo-modbook-diffop"><?php echo $modbook_diff_op; ?></span> --> |
| 733 |
<?php echo VikBooking::formatCurrencyNumber(VikBooking::numberFormat($modbook_tot_diff), $currencysymb, ['<span class="vbcurrency"><span class="vbo_currency">%s</span></span>', '<span class="vbprice"><span class="vbo_price">%s</span></span>']); ?> |
| 734 |
</div> |
| 735 |
</div> |
| 736 |
<?php |
| 737 |
} |
| 738 |
?> |
| 739 |
</div> |
| 740 |
|
| 741 |
</div> |
| 742 |
</div> |
| 743 |
|
| 744 |
<div class="vbo-oconfirm-middlep"> |
| 745 |
<?php |
| 746 |
// enter coupon form |
| 747 |
if (VikBooking::couponsEnabled() && empty($coupon) && $is_package !== true && !$this->mod_booking) { |
| 748 |
?> |
| 749 |
<div class="vbo-coupon-outer"> |
| 750 |
<form action="<?php echo JRoute::rewrite('index.php?option=com_vikbooking'.(!empty($pitemid) ? '&Itemid='.$pitemid : '')); ?>" method="post" class="vbo-coupon-form"> |
| 751 |
<div class="vbentercoupon"> |
| 752 |
<span class="vbhaveacoupon"><?php echo JText::translate('VBHAVEACOUPON'); ?></span> |
| 753 |
<div class="vbentercoupon-inner"> |
| 754 |
<input type="text" name="couponcode" value="" size="20" class="vbinputcoupon"/> |
| 755 |
<input type="submit" class="btn vbsubmitcoupon vbo-pref-color-btn" name="applyacoupon" value="<?php echo JText::translate('VBSUBMITCOUPON'); ?>"/> |
| 756 |
</div> |
| 757 |
</div> |
| 758 |
<input type="hidden" name="task" value="oconfirm"/> |
| 759 |
<input type="hidden" name="days" value="<?php echo $days; ?>"/> |
| 760 |
<input type="hidden" name="roomsnum" value="<?php echo $roomsnum; ?>"/> |
| 761 |
<input type="hidden" name="checkin" value="<?php echo $first; ?>"/> |
| 762 |
<input type="hidden" name="checkout" value="<?php echo $second; ?>"/> |
| 763 |
<?php |
| 764 |
if (!empty($pitemid)) { |
| 765 |
?> |
| 766 |
<input type="hidden" name="Itemid" value="<?php echo $pitemid; ?>"/> |
| 767 |
<?php |
| 768 |
} |
| 769 |
foreach($rooms as $num => $r) { |
| 770 |
echo '<input type="hidden" name="priceid'.$num.'" value="'.$prices[$num].'"/>'."\n"; |
| 771 |
echo '<input type="hidden" name="roomid[]" value="'.$r['id'].'"/>'."\n"; |
| 772 |
echo '<input type="hidden" name="adults[]" value="'.$arrpeople[$num]['adults'].'"/>'."\n"; |
| 773 |
echo '<input type="hidden" name="children[]" value="'.$arrpeople[$num]['children'].'"/>'."\n"; |
| 774 |
if (isset($selopt[$num]) && is_array($selopt[$num])) { |
| 775 |
foreach ($selopt[$num] as $aop) { |
| 776 |
echo '<input type="hidden" name="optid'.$num.$aop['id'].(!empty($aop['ageintervals']) && array_key_exists('chageintv', $aop) ? '[]' : '').'" value="'.(!empty($aop['ageintervals']) && array_key_exists('chageintv', $aop) ? $aop['chageintv'] : $aop['quan']).'"/>'."\n"; |
| 777 |
} |
| 778 |
} |
| 779 |
} |
| 780 |
?> |
| 781 |
</form> |
| 782 |
</div> |
| 783 |
<?php |
| 784 |
} |
| 785 |
//Customers PIN |
| 786 |
if (VikBooking::customersPinEnabled() && !VikBooking::userIsLogged() && !(count($customer_details) > 0)) { |
| 787 |
?> |
| 788 |
<div class="vbo-enterpin-block"> |
| 789 |
<div class="vbo-enterpin-top"> |
| 790 |
<h4><?php echo JText::translate('VBRETURNINGCUSTOMER'); ?></h4> |
| 791 |
<div class="vbo-enterpin-inner"> |
| 792 |
<span><?php echo JText::translate('VBENTERPINCODE'); ?></span> |
| 793 |
<div class="vbo-enterpin-btns"> |
| 794 |
<input type="text" id="vbo-pincode-inp" value="" size="6"/> |
| 795 |
<button type="button" class="btn vbo-pincode-sbmt vbo-pref-color-btn"><?php echo JText::translate('VBAPPLYPINCODE'); ?></button> |
| 796 |
</div> |
| 797 |
</div> |
| 798 |
</div> |
| 799 |
<div class="vbo-enterpin-response"></div> |
| 800 |
</div> |
| 801 |
|
| 802 |
<script> |
| 803 |
jQuery(function() { |
| 804 |
jQuery(".vbo-pincode-sbmt").click(function() { |
| 805 |
var pin_code = jQuery("#vbo-pincode-inp").val(); |
| 806 |
jQuery(this).prop('disabled', true); |
| 807 |
jQuery(".vbo-enterpin-response").hide(); |
| 808 |
jQuery.ajax({ |
| 809 |
type: "POST", |
| 810 |
url: "<?php echo VikBooking::ajaxUrl(JRoute::rewrite('index.php?option=com_vikbooking&task=validatepin&tmpl=component'.(!empty($pitemid) ? '&Itemid='.$pitemid : ''), false)); ?>", |
| 811 |
data: { |
| 812 |
pin: pin_code |
| 813 |
} |
| 814 |
}).done(function(res) { |
| 815 |
var pinobj = typeof res === 'string' ? JSON.parse(res) : res; |
| 816 |
if (pinobj.hasOwnProperty('success')) { |
| 817 |
jQuery(".vbo-enterpin-top").hide(); |
| 818 |
jQuery(".vbo-enterpin-response").removeClass("vbo-enterpin-error").addClass("vbo-enterpin-success").html("<span class=\"vbo-enterpin-welcome\"><?php echo addslashes(JText::translate('VBWELCOMEBACK')); ?></span><span class=\"vbo-enterpin-customer\">"+pinobj.first_name+" "+pinobj.last_name+"</span>").fadeIn(); |
| 819 |
jQuery.each(pinobj.cfields, function(k, v) { |
| 820 |
if (jQuery("#vbf-inp"+k).length) { |
| 821 |
jQuery("#vbf-inp"+k).val(v); |
| 822 |
} |
| 823 |
}); |
| 824 |
var user_country = pinobj.country; |
| 825 |
if (jQuery(".vbf-countryinp").length && user_country.length) { |
| 826 |
jQuery(".vbf-countryinp option").each(function(i) { |
| 827 |
var opt_country = jQuery(this).val(); |
| 828 |
if (opt_country.substring(0, 3) == user_country) { |
| 829 |
jQuery(this).prop("selected", true); |
| 830 |
jQuery('select.vbf-countryinp').trigger('change'); |
| 831 |
return false; |
| 832 |
} |
| 833 |
}); |
| 834 |
} |
| 835 |
if (pinobj.hasOwnProperty('has_discounts') && pinobj['has_discounts'] && jQuery('.vbo-coupon-form').length) { |
| 836 |
jQuery('.vbo-coupon-form').submit(); |
| 837 |
} |
| 838 |
} else { |
| 839 |
jQuery(".vbo-enterpin-response").addClass("vbo-enterpin-error").html("<p><?php echo addslashes(JText::translate('VBINVALIDPINCODE')); ?></p>").fadeIn(); |
| 840 |
jQuery(".vbo-pincode-sbmt").prop('disabled', false); |
| 841 |
} |
| 842 |
}).fail(function() { |
| 843 |
alert('Error validating the PIN. Request failed.'); |
| 844 |
jQuery(".vbo-pincode-sbmt").prop('disabled', false); |
| 845 |
}); |
| 846 |
}); |
| 847 |
}); |
| 848 |
</script> |
| 849 |
<?php |
| 850 |
} |
| 851 |
?> |
| 852 |
</div> |
| 853 |
|
| 854 |
<script type="text/javascript"> |
| 855 |
function checkvbFields() { |
| 856 |
var vbvar = document.vb; |
| 857 |
<?php |
| 858 |
foreach ($cfields as $cf) { |
| 859 |
if (intval($cf['required']) == 1) { |
| 860 |
if ($cf['type'] == "text" || $cf['type'] == "textarea" || $cf['type'] == "date" || $cf['type'] == "country" || $cf['type'] == "select") { |
| 861 |
?> |
| 862 |
if (!vbvar.vbf<?php echo $cf['id']; ?>.value.match(/\S/)) { |
| 863 |
document.getElementById('vbf<?php echo $cf['id']; ?>').style.color='#ff0000'; |
| 864 |
return false; |
| 865 |
} else { |
| 866 |
document.getElementById('vbf<?php echo $cf['id']; ?>').style.color=''; |
| 867 |
} |
| 868 |
<?php |
| 869 |
} elseif ($cf['type'] == "state") { |
| 870 |
?> |
| 871 |
if (!vbvar.vbf<?php echo $cf['id']; ?>.value.match(/\S/) && jQuery('.vbf-stateinp[name="vbf<?php echo $cf['id']; ?>"]').find('option').length > 1) { |
| 872 |
document.getElementById('vbf<?php echo $cf['id']; ?>').style.color='#ff0000'; |
| 873 |
return false; |
| 874 |
} else { |
| 875 |
document.getElementById('vbf<?php echo $cf['id']; ?>').style.color=''; |
| 876 |
} |
| 877 |
<?php |
| 878 |
} elseif ($cf['type'] == "checkbox") { |
| 879 |
//checkbox |
| 880 |
?> |
| 881 |
if (vbvar.vbf<?php echo $cf['id']; ?>.checked) { |
| 882 |
document.getElementById('vbf<?php echo $cf['id']; ?>').style.color=''; |
| 883 |
} else { |
| 884 |
document.getElementById('vbf<?php echo $cf['id']; ?>').style.color='#ff0000'; |
| 885 |
return false; |
| 886 |
} |
| 887 |
<?php |
| 888 |
} |
| 889 |
} |
| 890 |
} |
| 891 |
?> |
| 892 |
return true; |
| 893 |
} |
| 894 |
|
| 895 |
function validateVbSubmit() { |
| 896 |
if (!checkvbFields()) { |
| 897 |
var vbalert_cont = document.getElementById('vbo-alert-container-confirm'); |
| 898 |
if (vbalert_cont !== null) { |
| 899 |
vbalert_cont.style.display = 'block'; |
| 900 |
vbalert_cont.style.opacity = '1'; |
| 901 |
setTimeout(vbHideAlertFillin, 10000); |
| 902 |
} |
| 903 |
return false; |
| 904 |
} |
| 905 |
// disable submit button to avoid multiple submissions |
| 906 |
var subm_btn = document.querySelector('input[name="saveorder"]'); |
| 907 |
if (subm_btn) { |
| 908 |
subm_btn.disabled = true; |
| 909 |
} |
| 910 |
|
| 911 |
return true; |
| 912 |
} |
| 913 |
|
| 914 |
function vbHideAlertFillin() { |
| 915 |
var vbalert_cont = document.getElementById('vbo-alert-container-confirm'); |
| 916 |
if (vbalert_cont !== null) { |
| 917 |
vbalert_cont.style.opacity = '0'; |
| 918 |
setTimeout(function() { |
| 919 |
vbalert_cont.style.display = 'none'; |
| 920 |
}, 600); |
| 921 |
} |
| 922 |
} |
| 923 |
|
| 924 |
function vboReloadStates(country_3_code) { |
| 925 |
var states_elem = jQuery('select.vbf-stateinp'); |
| 926 |
|
| 927 |
if (!states_elem.length) { |
| 928 |
return; |
| 929 |
} |
| 930 |
|
| 931 |
// get the current state, if any |
| 932 |
var current_state = states_elem.first().attr('data-stateset'); |
| 933 |
|
| 934 |
// unset the current states/provinces |
| 935 |
states_elem.html(''); |
| 936 |
|
| 937 |
if (!country_3_code || !country_3_code.length) { |
| 938 |
return; |
| 939 |
} |
| 940 |
|
| 941 |
// make a request to load the states/provinces of the selected country |
| 942 |
jQuery.ajax({ |
| 943 |
type: "POST", |
| 944 |
url: "<?php echo VikBooking::ajaxUrl(JRoute::rewrite('index.php?option=com_vikbooking&task=states_load_from_country'.(!empty($pitemid) ? '&Itemid='.$pitemid : ''), false)); ?>", |
| 945 |
data: { |
| 946 |
country_3_code: country_3_code, |
| 947 |
tmpl: "component" |
| 948 |
} |
| 949 |
}).done(function(response) { |
| 950 |
try { |
| 951 |
var obj_res = typeof response === 'string' ? JSON.parse(response) : response; |
| 952 |
if (!obj_res) { |
| 953 |
console.error('Unexpected JSON response', obj_res); |
| 954 |
return false; |
| 955 |
} |
| 956 |
|
| 957 |
// append empty value |
| 958 |
states_elem.append('<option value="">-----</option>'); |
| 959 |
|
| 960 |
for (var ind = 0; ind < obj_res.length; ind++) { |
| 961 |
// append state |
| 962 |
states_elem.append('<option value="' + obj_res[ind]['state_2_code'] + '">' + obj_res[ind]['state_name'] + '</option>'); |
| 963 |
} |
| 964 |
|
| 965 |
if (current_state.length && states_elem.find('option[value="' + current_state + '"]').length) { |
| 966 |
// set the current value |
| 967 |
states_elem.val(current_state); |
| 968 |
} |
| 969 |
} catch(err) { |
| 970 |
console.error('could not parse JSON response', err, response); |
| 971 |
} |
| 972 |
}).fail(function(error) { |
| 973 |
console.error(error); |
| 974 |
}); |
| 975 |
} |
| 976 |
|
| 977 |
jQuery(function() { |
| 978 |
// country selection |
| 979 |
jQuery('select.vbf-countryinp').on('change', function() { |
| 980 |
// trigger event for phone number |
| 981 |
jQuery('input.vbf-phoneinp').trigger('vboupdatephonenumber', jQuery(this).find('option:selected').attr('data-c2code')); |
| 982 |
// reload state/province |
| 983 |
vboReloadStates(jQuery(this).find('option:selected').attr('data-threecode')); |
| 984 |
}); |
| 985 |
|
| 986 |
// check if a value is populated when page loads |
| 987 |
if (jQuery('select.vbf-countryinp').length && jQuery('select.vbf-countryinp').first().val().length) { |
| 988 |
jQuery('select.vbf-countryinp').trigger('change'); |
| 989 |
} |
| 990 |
}); |
| 991 |
</script> |
| 992 |
|
| 993 |
<form action="<?php echo JRoute::rewrite('index.php?option=com_vikbooking'.(!empty($pitemid) ? '&Itemid='.$pitemid : '')); ?>" name="vb" method="post" onsubmit="javascript: return validateVbSubmit();"> |
| 994 |
<?php |
| 995 |
|
| 996 |
if (count($cfields)) { |
| 997 |
?> |
| 998 |
<div class="vbcustomfields"> |
| 999 |
<?php |
| 1000 |
$currentUser = JFactory::getUser(); |
| 1001 |
$useremail = !empty($currentUser->email) ? $currentUser->email : ""; |
| 1002 |
$useremail = array_key_exists('email', $customer_details) ? $customer_details['email'] : $useremail; |
| 1003 |
$nominatives = array(); |
| 1004 |
if (count($customer_details) > 0) { |
| 1005 |
$nominatives[] = $customer_details['first_name']; |
| 1006 |
$nominatives[] = $customer_details['last_name']; |
| 1007 |
} |
| 1008 |
foreach ($cfields as $cf) { |
| 1009 |
if (intval($cf['required']) == 1) { |
| 1010 |
$isreq = "<span class=\"vbrequired\"><sup>*</sup></span> "; |
| 1011 |
} else { |
| 1012 |
$isreq = ""; |
| 1013 |
} |
| 1014 |
if (!empty ($cf['poplink'])) { |
| 1015 |
$fname = "<a href=\"" . $cf['poplink'] . "\" id=\"vbf" . $cf['id'] . "\" target=\"_blank\" class=\"vbmodal\">" . JText::translate($cf['name']) . "</a>"; |
| 1016 |
} else { |
| 1017 |
$fname = "<label id=\"vbf" . $cf['id'] . "\" for=\"vbf-inp" . $cf['id'] . "\">" . JText::translate($cf['name']) . "</label>"; |
| 1018 |
} |
| 1019 |
if ($cf['type'] == "text") { |
| 1020 |
$def_textval = ''; |
| 1021 |
if ($cf['isemail'] == 1) { |
| 1022 |
$def_textval = $useremail; |
| 1023 |
} elseif ($cf['isphone'] == 1) { |
| 1024 |
if (array_key_exists('phone', $customer_details)) { |
| 1025 |
$def_textval = $customer_details['phone']; |
| 1026 |
} |
| 1027 |
} elseif ($cf['isnominative'] == 1) { |
| 1028 |
if (count($nominatives) > 0) { |
| 1029 |
$def_textval = array_shift($nominatives); |
| 1030 |
} |
| 1031 |
} elseif (array_key_exists('cfields', $customer_details)) { |
| 1032 |
if (array_key_exists($cf['id'], $customer_details['cfields'])) { |
| 1033 |
$def_textval = $customer_details['cfields'][$cf['id']]; |
| 1034 |
} |
| 1035 |
} |
| 1036 |
?> |
| 1037 |
<div class="vbo-oconfirm-cfield-entry"> |
| 1038 |
<div class="vbo-oconfirm-cfield-label"> |
| 1039 |
<?php echo $isreq; ?> |
| 1040 |
<?php echo $fname; ?> |
| 1041 |
</div> |
| 1042 |
<div class="vbo-oconfirm-cfield-input"> |
| 1043 |
<?php |
| 1044 |
if ($cf['isphone'] == 1) { |
| 1045 |
echo $vbo_app->printPhoneInputField(array('name' => 'vbf' . $cf['id'], 'id' => 'vbf-inp' . $cf['id'], 'value' => JHtml::fetch('esc_attr', $def_textval), 'class' => 'vbinput vbf-phoneinp', 'size' => '40')); |
| 1046 |
} else { |
| 1047 |
$input_type = $cf['isemail'] == 1 ? 'email' : 'text'; |
| 1048 |
?> |
| 1049 |
<input type="<?php echo $input_type; ?>" name="vbf<?php echo $cf['id']; ?>" id="vbf-inp<?php echo $cf['id']; ?>" value="<?php echo JHtml::fetch('esc_attr', $def_textval); ?>" size="40" class="vbinput"/> |
| 1050 |
<?php |
| 1051 |
} |
| 1052 |
?> |
| 1053 |
</div> |
| 1054 |
</div> |
| 1055 |
<?php |
| 1056 |
} elseif ($cf['type'] == "textarea") { |
| 1057 |
$def_textval = ''; |
| 1058 |
if (isset($customer_details['cfields']) && array_key_exists($cf['id'], $customer_details['cfields'])) { |
| 1059 |
$def_textval = $customer_details['cfields'][$cf['id']]; |
| 1060 |
} |
| 1061 |
?> |
| 1062 |
<div class="vbo-oconfirm-cfield-entry vbo-oconfirm-cfield-entry-textarea"> |
| 1063 |
<div class="vbo-oconfirm-cfield-label"> |
| 1064 |
<?php echo $isreq; ?> |
| 1065 |
<?php echo $fname; ?> |
| 1066 |
</div> |
| 1067 |
<div class="vbo-oconfirm-cfield-input"> |
| 1068 |
<textarea name="vbf<?php echo $cf['id']; ?>" id="vbf-inp<?php echo $cf['id']; ?>" rows="5" cols="30" class="vbtextarea"><?php echo JHtml::fetch('esc_textarea', $def_textval); ?></textarea> |
| 1069 |
</div> |
| 1070 |
</div> |
| 1071 |
<?php |
| 1072 |
} elseif ($cf['type'] == "date") { |
| 1073 |
?> |
| 1074 |
<div class="vbo-oconfirm-cfield-entry"> |
| 1075 |
<div class="vbo-oconfirm-cfield-label"> |
| 1076 |
<?php echo $isreq; ?> |
| 1077 |
<?php echo $fname; ?> |
| 1078 |
</div> |
| 1079 |
<div class="vbo-oconfirm-cfield-input"> |
| 1080 |
<?php echo $vbo_app->getCalendar('', 'vbf'.$cf['id'], 'vbf-inp'.$cf['id'], VikBooking::getDateFormat(), array('class'=>'vbinput', 'size'=>'10', 'maxlength'=>'19')); ?> |
| 1081 |
</div> |
| 1082 |
</div> |
| 1083 |
<?php |
| 1084 |
} elseif ($cf['type'] == "country" && is_array($countries)) { |
| 1085 |
$usercountry = ''; |
| 1086 |
if (array_key_exists('country', $customer_details)) { |
| 1087 |
$usercountry = !empty($customer_details['country']) ? substr($customer_details['country'], 0, 3) : ''; |
| 1088 |
} |
| 1089 |
$countries_sel = '<select name="vbf'.$cf['id'].'" class="vbf-countryinp"><option value=""></option>'."\n"; |
| 1090 |
foreach ($countries as $country) { |
| 1091 |
$countries_sel .= '<option data-threecode="' . $country['country_3_code'] . '" data-c2code="' . $country['country_2_code'] . '" value="' . $country['country_3_code'] . '::' . $country['country_name'] . '"' . ($country['country_3_code'] == $usercountry || $cf['defvalue'] == $country['country_3_code'] ? ' selected="selected"' : '') . '>' . $country['country_name'] . '</option>' . "\n"; |
| 1092 |
} |
| 1093 |
$countries_sel .= '</select>'; |
| 1094 |
?> |
| 1095 |
<div class="vbo-oconfirm-cfield-entry"> |
| 1096 |
<div class="vbo-oconfirm-cfield-label"> |
| 1097 |
<?php echo $isreq; ?> |
| 1098 |
<?php echo $fname; ?> |
| 1099 |
</div> |
| 1100 |
<div class="vbo-oconfirm-cfield-input"> |
| 1101 |
<?php echo $countries_sel; ?> |
| 1102 |
</div> |
| 1103 |
</div> |
| 1104 |
<?php |
| 1105 |
} elseif ($cf['type'] == 'state') { |
| 1106 |
?> |
| 1107 |
<div class="vbo-oconfirm-cfield-entry"> |
| 1108 |
<div class="vbo-oconfirm-cfield-label"> |
| 1109 |
<?php echo $isreq; ?> |
| 1110 |
<?php echo $fname; ?> |
| 1111 |
</div> |
| 1112 |
<div class="vbo-oconfirm-cfield-input"> |
| 1113 |
<select name="vbf<?php echo $cf['id']; ?>" class="vbf-stateinp" data-stateset="<?php echo !empty($customer_details['state']) ? htmlspecialchars($customer_details['state']) : ''; ?>"> |
| 1114 |
<option value="">-----</option> |
| 1115 |
</select> |
| 1116 |
</div> |
| 1117 |
</div> |
| 1118 |
<?php |
| 1119 |
} elseif ($cf['type'] == "select") { |
| 1120 |
$answ = explode(";;__;;", $cf['choose']); |
| 1121 |
$wcfsel = "<select name=\"vbf" . $cf['id'] . "\">\n"; |
| 1122 |
foreach ($answ as $aw) { |
| 1123 |
if (!empty ($aw)) { |
| 1124 |
$wcfsel .= "<option value=\"" . $aw . "\">" . $aw . "</option>\n"; |
| 1125 |
} |
| 1126 |
} |
| 1127 |
$wcfsel .= "</select>\n"; |
| 1128 |
?> |
| 1129 |
<div class="vbo-oconfirm-cfield-entry"> |
| 1130 |
<div class="vbo-oconfirm-cfield-label"> |
| 1131 |
<?php echo $isreq; ?> |
| 1132 |
<?php echo $fname; ?> |
| 1133 |
</div> |
| 1134 |
<div class="vbo-oconfirm-cfield-input"> |
| 1135 |
<?php echo $wcfsel; ?> |
| 1136 |
</div> |
| 1137 |
</div> |
| 1138 |
<?php |
| 1139 |
} elseif ($cf['type'] == "separator") { |
| 1140 |
$cfsepclass = strlen(JText::translate($cf['name'])) > 30 ? "vbseparatorcflong" : "vbseparatorcf"; |
| 1141 |
?> |
| 1142 |
<div class="vbo-oconfirm-cfield-entry vbo-oconfirm-cfield-entry-separator"> |
| 1143 |
<div class="vbo-oconfirm-cfield-separator <?php echo $cfsepclass; ?>"> |
| 1144 |
<h4><?php echo JText::translate($cf['name']); ?></h4> |
| 1145 |
</div> |
| 1146 |
</div> |
| 1147 |
<?php |
| 1148 |
} else { |
| 1149 |
?> |
| 1150 |
<div class="vbo-oconfirm-cfield-entry vbo-oconfirm-cfield-entry-checkbox"> |
| 1151 |
<div class="vbo-oconfirm-cfield-label"> |
| 1152 |
<?php echo $isreq; ?> |
| 1153 |
<?php echo $fname; ?> |
| 1154 |
</div> |
| 1155 |
<div class="vbo-oconfirm-cfield-input"> |
| 1156 |
<input type="checkbox" name="vbf<?php echo $cf['id']; ?>" id="vbf-inp<?php echo $cf['id']; ?>" value="<?php echo JText::translate('VBYES'); ?>" <?php echo !(bool)$cf['required'] && isset($customer_details['cfields']) && isset($customer_details['cfields'][$cf['id']]) ? 'checked="checked"' : ''; ?>/> |
| 1157 |
</div> |
| 1158 |
</div> |
| 1159 |
<?php |
| 1160 |
} |
| 1161 |
} |
| 1162 |
?> |
| 1163 |
</div> |
| 1164 |
<?php |
| 1165 |
} |
| 1166 |
?> |
| 1167 |
<input type="hidden" name="days" value="<?php echo $days; ?>"/> |
| 1168 |
<input type="hidden" name="roomsnum" value="<?php echo $roomsnum; ?>"/> |
| 1169 |
<input type="hidden" name="checkin" value="<?php echo $first; ?>"/> |
| 1170 |
<input type="hidden" name="checkout" value="<?php echo $second; ?>"/> |
| 1171 |
<input type="hidden" name="totdue" value="<?php echo $totdue; ?>"/> |
| 1172 |
<?php |
| 1173 |
if ($is_package === true) { |
| 1174 |
echo '<input type="hidden" name="pkg_id" value="'.$pkg['id'].'"/>'."\n"; |
| 1175 |
} |
| 1176 |
|
| 1177 |
foreach ($rooms as $num => $r) { |
| 1178 |
if ($is_package !== true) { |
| 1179 |
echo '<input type="hidden" name="prtar[]" value="'.$tars[$num][0]['id'].'"/>'."\n"; |
| 1180 |
} |
| 1181 |
echo '<input type="hidden" name="priceid[]" value="'.$prices[$num].'"/>'."\n"; |
| 1182 |
echo '<input type="hidden" name="rooms[]" value="'.$r['id'].'"/>'."\n"; |
| 1183 |
echo '<input type="hidden" name="adults[]" value="'.$arrpeople[$num]['adults'].'"/>'."\n"; |
| 1184 |
echo '<input type="hidden" name="children[]" value="'.$arrpeople[$num]['children'].'"/>'."\n"; |
| 1185 |
} |
| 1186 |
|
| 1187 |
if (!empty($this->split_stay)) { |
| 1188 |
// add hidden fields for the split stay booking |
| 1189 |
foreach ($this->split_stay as $spsk => $sps_room) { |
| 1190 |
foreach ($sps_room as $sps_room_k => $sps_room_v) { |
| 1191 |
if ($sps_room_k == 'checkin_ts' || $sps_room_k == 'checkout_ts') { |
| 1192 |
// these values are better to be re-calculated |
| 1193 |
continue; |
| 1194 |
} |
| 1195 |
?> |
| 1196 |
<input type="hidden" name="split_stay[<?php echo $spsk; ?>][<?php echo $sps_room_k; ?>]" value="<?php echo JHtml::fetch('esc_attr', $sps_room_v); ?>" /> |
| 1197 |
<?php |
| 1198 |
} |
| 1199 |
} |
| 1200 |
} |
| 1201 |
?> |
| 1202 |
|
| 1203 |
<input type="hidden" name="optionals" value="<?php echo $wop; ?>"/> |
| 1204 |
|
| 1205 |
<?php |
| 1206 |
if ($usedcoupon == true && !empty($coupon) && $is_package !== true) { |
| 1207 |
?> |
| 1208 |
<input type="hidden" name="couponcode" value="<?php echo $coupon['code']; ?>"/> |
| 1209 |
<?php |
| 1210 |
} |
| 1211 |
?> |
| 1212 |
<?php echo !empty($tok) ? $tok . JHtml::fetch('form.token') : ''; ?> |
| 1213 |
<input type="hidden" name="task" value="saveorder"/> |
| 1214 |
<?php |
| 1215 |
|
| 1216 |
if (!empty($payments) && !count($this->mod_booking)) { |
| 1217 |
?> |
| 1218 |
<script type="text/javascript"> |
| 1219 |
function vboToggleActivePaymethod(elem) { |
| 1220 |
jQuery('.vbo-oconfirm-paymethod-item').removeClass('vbo-oconfirm-paymethod-item-active'); |
| 1221 |
jQuery(elem).parent('.vbo-oconfirm-paymethod-item').addClass('vbo-oconfirm-paymethod-item-active'); |
| 1222 |
} |
| 1223 |
</script> |
| 1224 |
|
| 1225 |
<div class="vbo-oconfirm-paymentopts"> |
| 1226 |
<h4><?php echo JText::translate('VBCHOOSEPAYMENT'); ?></h4> |
| 1227 |
<ul class="vbo-oconfirm-paymethods-list"> |
| 1228 |
<?php |
| 1229 |
$non_ref_rates_found = VikBooking::findNonRefundableRates($tars); |
| 1230 |
foreach ($payments as $pk => $pay) { |
| 1231 |
if ($pay['hidenonrefund'] > 0 && $non_ref_rates_found) { |
| 1232 |
continue; |
| 1233 |
} |
| 1234 |
if ($pay['onlynonrefund'] > 0 && !$non_ref_rates_found) { |
| 1235 |
continue; |
| 1236 |
} |
| 1237 |
$rcheck = $pk == 0 ? " checked=\"checked\"" : ""; |
| 1238 |
$saypcharge = ''; |
| 1239 |
if ($pay['charge'] > 0.00) { |
| 1240 |
$decimals = $pay['charge'] - (int)$pay['charge']; |
| 1241 |
if ($decimals > 0.00) { |
| 1242 |
$okchargedisc = VikBooking::numberFormat($pay['charge']); |
| 1243 |
} else { |
| 1244 |
$okchargedisc = number_format($pay['charge'], 0); |
| 1245 |
} |
| 1246 |
$saypcharge .= ' (' . ($pay['ch_disc'] == 1 ? '+' : '-'); |
| 1247 |
if ($pay['val_pcent'] == 1) { |
| 1248 |
$saypcharge .= VikBooking::formatCurrencyNumber($okchargedisc, $currencysymb, ['<span class="vbcurrency">%s</span>', '<span class="vbprice">%s</span>']); |
| 1249 |
} else { |
| 1250 |
$saypcharge .= "<span class=\"vbprice\">" . $okchargedisc . "</span> <span class=\"vbcurrency\">%</span>"; |
| 1251 |
} |
| 1252 |
$saypcharge .= ')'; |
| 1253 |
} |
| 1254 |
?> |
| 1255 |
<li class="vbo-oconfirm-paymethod-item<?php echo $pk == 0 ? ' vbo-oconfirm-paymethod-item-active' : ''; ?>"> |
| 1256 |
<input type="radio" name="gpayid" value="<?php echo $pay['id']; ?>" onclick="vboToggleActivePaymethod(this);" id="gpay<?php echo $pay['id']; ?>"<?php echo $rcheck; ?>/> |
| 1257 |
<label for="gpay<?php echo $pay['id']; ?>"> |
| 1258 |
<span class="vbo-paymeth-info"><?php echo $pay['name'] . $saypcharge; ?></span> |
| 1259 |
</label> |
| 1260 |
<?php |
| 1261 |
$pay_img_name = ''; |
| 1262 |
if (strpos($pay['file'], '.') !== false) { |
| 1263 |
$fparts = explode('.', $pay['file']); |
| 1264 |
$pay_img_name = array_shift($fparts); |
| 1265 |
} |
| 1266 |
|
| 1267 |
if (VBOPlatformDetection::isWordPress()) { |
| 1268 |
/** |
| 1269 |
* @wponly Since the payments may be loaded from external plugins, |
| 1270 |
* the logos MUST be retrieved using an apposite filter. |
| 1271 |
* |
| 1272 |
* @since 1.0.5 |
| 1273 |
*/ |
| 1274 |
$logo = array( |
| 1275 |
'name' => $pay_img_name, |
| 1276 |
'path' => VBO_ADMIN_PATH . DIRECTORY_SEPARATOR . 'payments' . DIRECTORY_SEPARATOR . $pay_img_name . '.png', |
| 1277 |
'uri' => VBO_ADMIN_URI . 'payments/' . $pay_img_name . '.png', |
| 1278 |
); |
| 1279 |
|
| 1280 |
/** |
| 1281 |
* Hook used to filter the array containing the logo's information. |
| 1282 |
* By default, the array contains the standard path and URI, related |
| 1283 |
* to the payment folder of the plugin. |
| 1284 |
* |
| 1285 |
* Plugins attached to this hook are able to filter the payment logo in case |
| 1286 |
* the image is stored somewhere else. |
| 1287 |
* |
| 1288 |
* @param array An array containing the following keys: |
| 1289 |
* - name the payment name; |
| 1290 |
* - path the payment logo absolute path; |
| 1291 |
* - uri the payment logo image URI. |
| 1292 |
* |
| 1293 |
* @since 1.0.5 |
| 1294 |
*/ |
| 1295 |
$logo = apply_filters('vikbooking_oconfirm_payment_logo', $logo); |
| 1296 |
} |
| 1297 |
|
| 1298 |
if (!empty($pay['logo'])) { |
| 1299 |
/** |
| 1300 |
* Payment methods can have their own custom logo. |
| 1301 |
* |
| 1302 |
* @since 1.14 (J) - 1.4.0 (WP) |
| 1303 |
*/ |
| 1304 |
$pay['logo'] = strpos($pay['logo'], 'http') === false ? JUri::root() . $pay['logo'] : $pay['logo']; |
| 1305 |
?> |
| 1306 |
<span class="vbo-payment-image"> |
| 1307 |
<label for="gpay<?php echo $pay['id']; ?>"> |
| 1308 |
<img src="<?php echo $pay['logo']; ?>" alt="<?php echo htmlspecialchars($pay['name']); ?>"/> |
| 1309 |
</label> |
| 1310 |
</span> |
| 1311 |
<?php |
| 1312 |
} elseif (VBOPlatformDetection::isWordPress() && !empty($pay_img_name) && file_exists($logo['path'])) { |
| 1313 |
?> |
| 1314 |
<span class="vbo-payment-image"> |
| 1315 |
<label for="gpay<?php echo $pay['id']; ?>"> |
| 1316 |
<img src="<?php echo $logo['uri']; ?>" alt="<?php echo htmlspecialchars($pay['name']); ?>"/> |
| 1317 |
</label> |
| 1318 |
</span> |
| 1319 |
<?php |
| 1320 |
} elseif (defined('_JEXEC') && !empty($pay_img_name) && file_exists(VBO_ADMIN_PATH . DIRECTORY_SEPARATOR . 'payments' . DIRECTORY_SEPARATOR . $pay_img_name . '.png')) { |
| 1321 |
?> |
| 1322 |
<span class="vbo-payment-image"> |
| 1323 |
<label for="gpay<?php echo $pay['id']; ?>"> |
| 1324 |
<img src="<?php echo VBO_ADMIN_URI; ?>payments/<?php echo $pay_img_name; ?>.png" alt="<?php echo htmlspecialchars($pay['name']); ?>"/> |
| 1325 |
</label> |
| 1326 |
</span> |
| 1327 |
<?php |
| 1328 |
} |
| 1329 |
?> |
| 1330 |
</li> |
| 1331 |
<?php |
| 1332 |
} |
| 1333 |
?> |
| 1334 |
</ul> |
| 1335 |
<?php |
| 1336 |
//choose deposit (Pay Entire Amount = OFF, Deposit Booking Days in Advance <= Days within Checkin, Customer Choice of Deposit = ON, Deposit Amount > 0, Deposit Non-Refundable=true, Deposit < 100 if %) |
| 1337 |
//deposit is always disabled for booking modification |
| 1338 |
$dep_amount = VikBooking::getAccPerCent(); |
| 1339 |
$dep_amount = VikBooking::calcDepositOverride($dep_amount, $days); |
| 1340 |
$dep_type = VikBooking::getTypeDeposit(); |
| 1341 |
$dep_nonrefund_allowed = VikBooking::allowDepositFromRates($tars); |
| 1342 |
if (!(count($this->mod_booking) > 0) && !VikBooking::payTotal() && VikBooking::depositAllowedDaysAdv($first) && VikBooking::depositCustomerChoice() && $dep_amount > 0 && $dep_nonrefund_allowed && ($dep_type == "fixed" || ($dep_type != "fixed" && $dep_amount < 100))) { |
| 1343 |
$dep_amount = ($dep_amount - abs($dep_amount)) > 0.00 ? VikBooking::numberFormat($dep_amount) : $dep_amount; |
| 1344 |
$dep_string = $dep_type == "fixed" ? VikBooking::formatCurrencyNumber($dep_amount, $currencysymb) : $dep_amount . '%'; |
| 1345 |
?> |
| 1346 |
<div class="vbo-oconfirm-choosedeposit"> |
| 1347 |
<h4><?php echo JText::translate('VBCHOOSEDEPOSIT'); ?></h4> |
| 1348 |
<div class="vbo-oconfirm-choosedeposit-inner"> |
| 1349 |
<div class="vbo-oconfirm-choosedeposit-block vbo-oconfirm-choosedeposit-payfull"> |
| 1350 |
<input type="radio" name="nodep" value="1" id="nodepone" checked="checked" /> |
| 1351 |
<label for="nodepone"><?php echo JText::translate('VBCHOOSEDEPOSITPAYFULL'); ?></label> |
| 1352 |
</div> |
| 1353 |
<div class="vbo-oconfirm-choosedeposit-block vbo-oconfirm-choosedeposit-paydeposit"> |
| 1354 |
<input type="radio" name="nodep" value="0" id="nodeptwo" /> |
| 1355 |
<div class="vbo-oconfirm-choosedeposit-paydeposit-inner"> |
| 1356 |
<label for="nodeptwo"><?php echo JText::sprintf('VBCHOOSEDEPOSITPAYDEPOF', $dep_string); ?></label> |
| 1357 |
<?php |
| 1358 |
$pay_balance_days_adv = VBOFactory::getConfig()->get('depbalancedays'); |
| 1359 |
if (is_numeric($pay_balance_days_adv)) { |
| 1360 |
?> |
| 1361 |
<div class="vbo-oconfirm-choosedeposit-paydeposit-balance"> |
| 1362 |
<span><?php echo !intval($pay_balance_days_adv) ? JText::translate('VBO_PAY_BALANCE_ONARRIVAL') : JText::sprintf('VBO_PAY_BALANCE_NDAYS', (int) $pay_balance_days_adv); ?></span> |
| 1363 |
</div> |
| 1364 |
<?php |
| 1365 |
} |
| 1366 |
?> |
| 1367 |
</div> |
| 1368 |
</div> |
| 1369 |
</div> |
| 1370 |
</div> |
| 1371 |
<?php |
| 1372 |
} |
| 1373 |
?> |
| 1374 |
</div> |
| 1375 |
<?php |
| 1376 |
} |
| 1377 |
?> |
| 1378 |
<div class="vboconfirmbottom"> |
| 1379 |
<input type="submit" name="saveorder" value="<?php echo count($this->mod_booking) ? JText::translate('VBOMODBOOKCONFIRMBTN') : JText::translate('VBORDCONFIRM'); ?>" class="btn booknow vbo-pref-color-btn"/> |
| 1380 |
<div class="goback"> |
| 1381 |
<a class="vbo-goback-link vbo-pref-color-btn-secondary" href="<?php echo JRoute::rewrite('index.php?option=com_vikbooking&task=showprc&checkin='.$first.'&checkout='.$second.'&roomsnum='.$roomsnum.'&days='.$days.($is_package === true ? '&pkg_id='.$pkg['id'] : '').$peopleforlink.$roomoptforlink.(!empty($pitemid) ? '&Itemid='.$pitemid : ''), false); ?>"><?php echo JText::translate('VBBACK'); ?></a> |
| 1382 |
</div> |
| 1383 |
</div> |
| 1384 |
|
| 1385 |
<?php |
| 1386 |
if (!empty ($pitemid)) { |
| 1387 |
?> |
| 1388 |
<input type="hidden" name="Itemid" value="<?php echo $pitemid; ?>"/> |
| 1389 |
<?php |
| 1390 |
} |
| 1391 |
/** |
| 1392 |
* Keep any previously selected room index through the interactive geomap, if any. |
| 1393 |
*/ |
| 1394 |
foreach ($this->roomindex as $rindex) { |
| 1395 |
?> |
| 1396 |
<input type="hidden" name="roomindex[]" value="<?php echo $rindex; ?>"/> |
| 1397 |
<?php |
| 1398 |
} |
| 1399 |
?> |
| 1400 |
</form> |
| 1401 |
|
| 1402 |
<div class="vbo-alert-container-confirm" id="vbo-alert-container-confirm" style="display: none;"> |
| 1403 |
<span class="vbo-alert-close" onclick="vbHideAlertFillin();">×</span><?php echo JText::translate('VBOALERTFILLINALLF'); ?> |
| 1404 |
</div> |
| 1405 |
|
| 1406 |
<?php |
| 1407 |
if ($channel_disclaimer === true) { |
| 1408 |
?> |
| 1409 |
<script type="text/javascript"> |
| 1410 |
function vbCloseDisclaimerBox() { |
| 1411 |
return (elem=document.getElementById("vb_ch_disclaimer_box")).parentNode.removeChild(elem); |
| 1412 |
} |
| 1413 |
</script> |
| 1414 |
<div class="vb_ch_disclaimer_box" id="vb_ch_disclaimer_box"> |
| 1415 |
<div class="vb_ch_disclaimer_box_inner"> |
| 1416 |
<div class="vb_ch_disclaimer_text"> |
| 1417 |
<?php echo JText::translate($vcmchanneldata['disclaimer']); ?> |
| 1418 |
</div> |
| 1419 |
<div class="vb_ch_disclaimer_closebtn"> |
| 1420 |
<a href="javascript: void(0);" onclick="vbCloseDisclaimerBox();"><?php echo JText::translate('VBOKDISCLAIMER'); ?></a> |
| 1421 |
</div> |
| 1422 |
</div> |
| 1423 |
</div> |
| 1424 |
<?php |
| 1425 |
} |
| 1426 |
|