| 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 |
$order = $this->row; |
| 14 |
$rooms = $this->rooms; |
| 15 |
$customer = $this->customer; |
| 16 |
|
| 17 |
$dbo = JFactory::getDbo(); |
| 18 |
|
| 19 |
$vbo_app = VikBooking::getVboApplication(); |
| 20 |
|
| 21 |
/** |
| 22 |
* This view is usually rendered within a modal window, and with WordPress |
| 23 |
* the modal window is loaded through AJAX by the "editorder" View. For this |
| 24 |
* reason, with WP we should not load the JS assets for the contextual menu, |
| 25 |
* or we would reset the default setup of the library. We load the assets in |
| 26 |
* the parent View "editorder" to avoid issues of any kind. |
| 27 |
* |
| 28 |
* @since 1.16.0 (J) - 1.6.0 (WP) |
| 29 |
*/ |
| 30 |
if ((VBOPlatformDetection::isJoomla()) || (VBOPlatformDetection::isWordPress() && !wp_doing_ajax())) { |
| 31 |
$vbo_app->loadContextMenuAssets(); |
| 32 |
JText::script('VBRENTALORD'); |
| 33 |
JText::script('VBPVIEWORDERSPEOPLE'); |
| 34 |
} |
| 35 |
|
| 36 |
$currencysymb = VikBooking::getCurrencySymb(); |
| 37 |
$nowdf = VikBooking::getDateFormat(true); |
| 38 |
if ($nowdf == "%d/%m/%Y") { |
| 39 |
$df = 'd/m/Y'; |
| 40 |
} elseif ($nowdf == "%m/%d/%Y") { |
| 41 |
$df = 'm/d/Y'; |
| 42 |
} else { |
| 43 |
$df = 'Y/m/d'; |
| 44 |
} |
| 45 |
$datesep = VikBooking::getDateSeparator(true); |
| 46 |
$pchanged = VikRequest::getInt('changed', '', 'request'); |
| 47 |
$tmpl = VikRequest::getVar('tmpl'); |
| 48 |
$set_parent_status = ''; |
| 49 |
$now_info = getdate(); |
| 50 |
$today_midnight = mktime(0, 0, 0, $now_info['mon'], $now_info['mday'], $now_info['year']); |
| 51 |
$colortags = VikBooking::loadBookingsColorTags(); |
| 52 |
$otachannel = ''; |
| 53 |
$otachannel_name = ''; |
| 54 |
$otachannel_bid = ''; |
| 55 |
$otacurrency = ''; |
| 56 |
if (!empty($order['channel'])) { |
| 57 |
$channelparts = explode('_', $order['channel']); |
| 58 |
$otachannel = array_key_exists(1, $channelparts) && strlen($channelparts[1]) > 0 ? $channelparts[1] : ucwords($channelparts[0]); |
| 59 |
$otachannel_name = $otachannel; |
| 60 |
$otachannel_bid = $order['idorderota']; |
| 61 |
if (strstr($otachannel, '.') !== false) { |
| 62 |
$otaccparts = explode('.', $otachannel); |
| 63 |
$otachannel = $otaccparts[0]; |
| 64 |
} |
| 65 |
$otacurrency = strlen($order['chcurrency']) > 0 ? $order['chcurrency'] : ''; |
| 66 |
} |
| 67 |
$sensible_k = array('first_name', 'last_name', 'country', 'gender', 'bdate', 'pbirth'); |
| 68 |
$missing_customer_det = false; |
| 69 |
foreach ($customer as $ck => $cv) { |
| 70 |
if ((!isset($customer[$ck]) || empty($customer[$ck])) && in_array($ck, $sensible_k)) { |
| 71 |
$missing_customer_det = true; |
| 72 |
} |
| 73 |
} |
| 74 |
|
| 75 |
/** |
| 76 |
* Back-end guests registration now relies on dynamic drivers within Vik Booking. |
| 77 |
* |
| 78 |
* @since 1.15.0 (J) - 1.5.0 (WP) |
| 79 |
*/ |
| 80 |
|
| 81 |
// get the list of back-end pax fields according to settings |
| 82 |
list($pax_fields, $pax_fields_attributes) = VikBooking::getPaxFields(); |
| 83 |
|
| 84 |
// grab also the fields for front-end pre check-in |
| 85 |
list($pre_pax_fields, $pre_pax_fields_attributes) = VikBooking::getPaxFields(true); |
| 86 |
|
| 87 |
// once the pax fields have been prepared, get the active driver instance |
| 88 |
$pax_fields_obj = VBOCheckinPax::getInstance(); |
| 89 |
|
| 90 |
// load any previous checkin information from this customer |
| 91 |
$previous_checkins = VBOCheckinPax::getCustomerAllPaxData($order['id']); |
| 92 |
|
| 93 |
?> |
| 94 |
<div class="vbo-info-overlay-block"> |
| 95 |
<a class="vbo-info-overlay-close" href="javascript: void(0);"></a> |
| 96 |
<div class="vbo-info-overlay-content"> |
| 97 |
<h3 id="vbo-overlay-title"> |
| 98 |
<span class="vbo-info-overlay-title-close"> |
| 99 |
<span onclick="vboOpenModal();"><?php VikBookingIcons::e('times-circle'); ?></span> |
| 100 |
</span> |
| 101 |
</h3> |
| 102 |
<div class="vbo-overlay-checkin-body"></div> |
| 103 |
</div> |
| 104 |
</div> |
| 105 |
|
| 106 |
<form action="index.php?option=com_vikbooking" method="post" name="adminForm" id="adminForm"> |
| 107 |
<div class="vbo-bookdet-container"> |
| 108 |
<div class="vbo-bookdet-wrap"> |
| 109 |
<div class="vbo-bookdet-head"> |
| 110 |
<span>ID</span> |
| 111 |
<?php |
| 112 |
if (!empty($order['adminnotes'])) { |
| 113 |
?> |
| 114 |
<i class="vboicn-info icn-bigger icn-nomargin icn-float-left icn-clickable" onclick="vboUpdateModal('<?php echo addslashes(JText::translate('VBADMINNOTESTOGGLE')); ?>', '.adminnotes', true);"></i> |
| 115 |
<?php |
| 116 |
} |
| 117 |
?> |
| 118 |
</div> |
| 119 |
<div class="vbo-bookdet-foot"> |
| 120 |
<span><a href="index.php?option=com_vikbooking&task=editorder&cid[]=<?php echo $order['id']; ?>" target="_blank"><?php echo $order['id']; ?></a></span> |
| 121 |
</div> |
| 122 |
</div> |
| 123 |
<?php |
| 124 |
if (!empty($order['channel'])) { |
| 125 |
?> |
| 126 |
<div class="vbo-bookdet-wrap"> |
| 127 |
<div class="vbo-bookdet-head"> |
| 128 |
<?php echo $otachannel; ?> |
| 129 |
</div> |
| 130 |
<div class="vbo-bookdet-foot"> |
| 131 |
<span>ID <?php echo $otachannel_bid; ?></span> |
| 132 |
</div> |
| 133 |
</div> |
| 134 |
<?php |
| 135 |
} |
| 136 |
?> |
| 137 |
<div class="vbo-bookdet-wrap"> |
| 138 |
<div class="vbo-bookdet-head"> |
| 139 |
<span><?php echo JText::translate('VBEDITORDERONE'); ?></span> |
| 140 |
</div> |
| 141 |
<div class="vbo-bookdet-foot"> |
| 142 |
<?php echo date(str_replace("/", $datesep, $df).' H:i', $order['ts']); ?> |
| 143 |
</div> |
| 144 |
</div> |
| 145 |
<?php |
| 146 |
if (count($customer)) { |
| 147 |
?> |
| 148 |
<div class="vbo-bookdet-wrap"> |
| 149 |
<div class="vbo-bookdet-head"> |
| 150 |
<span><?php echo JText::translate('VBCUSTOMERNOMINATIVE'); ?></span> |
| 151 |
<?php |
| 152 |
if ($missing_customer_det) { |
| 153 |
echo $vbo_app->createPopover(array('title' => JText::translate('VBCUSTOMERMISSIMPDET'), 'content' => JText::translate('VBCUSTOMERMISSIMPDETHELP'), 'icon_class' => VikBookingIcons::i('exclamation-triangle'), 'placement' => 'bottom')); |
| 154 |
} elseif (!empty($customer['notes'])) { |
| 155 |
?> |
| 156 |
<i class="vboicn-info icn-bigger icn-nomargin icn-float-left icn-clickable" onclick="vboUpdateModal('<?php echo addslashes(JText::translate('VBCUSTOMERNOTES')); ?>', '.customer_notes', true);"></i> |
| 157 |
<?php |
| 158 |
} |
| 159 |
?> |
| 160 |
</div> |
| 161 |
<div class="vbo-bookdet-foot"> |
| 162 |
<?php echo (isset($customer['country_img']) ? $customer['country_img'].' ' : '').'<a href="javascript: void(0);" onclick="vboUpdateModal(\''.addslashes(JText::translate('VBCUSTINFO')).'\', \'.customer_info\', true);">'.ltrim($customer['first_name'].' '.$customer['last_name']).'</a>'; ?> |
| 163 |
</div> |
| 164 |
</div> |
| 165 |
<?php |
| 166 |
} |
| 167 |
?> |
| 168 |
<div class="vbo-bookdet-wrap"> |
| 169 |
<div class="vbo-bookdet-head"> |
| 170 |
<span><?php echo JText::translate('VBEDITORDERROOMSNUM'); ?></span> |
| 171 |
</div> |
| 172 |
<div class="vbo-bookdet-foot"> |
| 173 |
<?php echo $order['roomsnum']; ?> |
| 174 |
</div> |
| 175 |
</div> |
| 176 |
<div class="vbo-bookdet-wrap"> |
| 177 |
<div class="vbo-bookdet-head"> |
| 178 |
<span><?php echo JText::translate('VBEDITORDERFOUR'); ?></span> |
| 179 |
</div> |
| 180 |
<div class="vbo-bookdet-foot"> |
| 181 |
<?php echo $order['days']; ?> |
| 182 |
</div> |
| 183 |
</div> |
| 184 |
<div class="vbo-bookdet-wrap"> |
| 185 |
<div class="vbo-bookdet-head"> |
| 186 |
<span><?php echo JText::translate('VBEDITORDERFIVE'); ?></span> |
| 187 |
</div> |
| 188 |
<div class="vbo-bookdet-foot"> |
| 189 |
<?php |
| 190 |
$checkin_info = getdate($order['checkin']); |
| 191 |
$short_wday = JText::translate('VB'.strtoupper(substr($checkin_info['weekday'], 0, 3))); |
| 192 |
?> |
| 193 |
<?php echo $short_wday.', '.date(str_replace("/", $datesep, $df).' H:i', $order['checkin']); ?> |
| 194 |
</div> |
| 195 |
</div> |
| 196 |
<div class="vbo-bookdet-wrap"> |
| 197 |
<div class="vbo-bookdet-head"> |
| 198 |
<span><?php echo JText::translate('VBEDITORDERSIX'); ?></span> |
| 199 |
</div> |
| 200 |
<div class="vbo-bookdet-foot"> |
| 201 |
<?php |
| 202 |
$checkout_info = getdate($order['checkout']); |
| 203 |
$short_wday = JText::translate('VB'.strtoupper(substr($checkout_info['weekday'], 0, 3))); |
| 204 |
?> |
| 205 |
<?php echo $short_wday.', '.date(str_replace("/", $datesep, $df).' H:i', $order['checkout']); ?> |
| 206 |
</div> |
| 207 |
</div> |
| 208 |
<div class="vbo-bookdet-wrap vbo-bookdet-wrap-special"> |
| 209 |
<div class="vbo-bookdet-head"> |
| 210 |
<span><?php echo JText::translate('VBOCHECKEDSTATUS'); ?></span> |
| 211 |
</div> |
| 212 |
<div class="vbo-bookdet-foot"> |
| 213 |
<?php |
| 214 |
if ($order['checked'] < 0) { |
| 215 |
//no show |
| 216 |
$checked_status = '<span class="label label-error">'.JText::translate('VBOCHECKEDSTATUSNOS').'</span>'; |
| 217 |
$set_parent_status = $pchanged > 0 ? '<span style="font-weight: bold; color: red;">'.strtoupper(JText::translate('VBOCHECKEDSTATUSNOS')).'</span>' : $set_parent_status; |
| 218 |
} elseif ($order['checked'] == 1) { |
| 219 |
//checked in |
| 220 |
$checked_status = '<span class="label label-success">'.JText::translate('VBOCHECKEDSTATUSIN').'</span>'; |
| 221 |
$set_parent_status = $pchanged > 0 ? '<span style="font-weight: bold; color: green;">'.strtoupper(JText::translate('VBOCHECKEDSTATUSIN')).'</span>' : $set_parent_status; |
| 222 |
} elseif ($order['checked'] == 2) { |
| 223 |
//checked out |
| 224 |
$checked_status = '<span class="label label-info">'.JText::translate('VBOCHECKEDSTATUSOUT').'</span>'; |
| 225 |
$set_parent_status = $pchanged > 0 ? '<span style="font-weight: bold; color: green;">'.strtoupper(JText::translate('VBOCHECKEDSTATUSOUT')).'</span>' : $set_parent_status; |
| 226 |
} else { |
| 227 |
//none (0) |
| 228 |
$checked_status = '<span class="label">'.JText::translate('VBOCHECKEDSTATUSZERO').'</span>'; |
| 229 |
$set_parent_status = $pchanged > 0 ? '<span style="font-weight: bold; color: green;">'.strtoupper(JText::translate('VBCONFIRMED')).'</span>' : $set_parent_status; |
| 230 |
} |
| 231 |
?> |
| 232 |
<?php echo $checked_status; ?> |
| 233 |
</div> |
| 234 |
</div> |
| 235 |
<?php |
| 236 |
if (is_array($previous_checkins) && count($previous_checkins) && $order['checked'] < 1) { |
| 237 |
foreach ($previous_checkins as $k => $prev_checkin) { |
| 238 |
$previous_checkins[$k]['checkin_dt'] = date(str_replace("/", $datesep, $df), $prev_checkin['checkin']); |
| 239 |
$previous_checkins[$k]['checkout_dt'] = date(str_replace("/", $datesep, $df), $prev_checkin['checkout']); |
| 240 |
$previous_checkins[$k]['ts_dt'] = date(str_replace("/", $datesep, $df), $prev_checkin['ts']); |
| 241 |
$book_tot_guests = 0; |
| 242 |
$prev_checkin['pax_data'] = empty($prev_checkin['pax_data']) || !is_array($prev_checkin['pax_data']) ? [] : $prev_checkin['pax_data']; |
| 243 |
foreach ($prev_checkin['pax_data'] as $rnum => $room_pax) { |
| 244 |
foreach ($room_pax as $guest_num => $guest_data) { |
| 245 |
$book_tot_guests++; |
| 246 |
} |
| 247 |
} |
| 248 |
$previous_checkins[$k]['tot_guests'] = $book_tot_guests; |
| 249 |
} |
| 250 |
?> |
| 251 |
<div class="vbo-bookdet-wrap"> |
| 252 |
<div class="vbo-bookdet-head"> |
| 253 |
<span><?php echo JText::translate('VBO_PREVIOUS_CHECKINS'); ?></span> |
| 254 |
</div> |
| 255 |
<div class="vbo-bookdet-foot"> |
| 256 |
<button type="button" class="btn btn-small btn-primary vbo-context-menu-btn vbo-context-menu-prevchkins"> |
| 257 |
<span class="vbo-context-menu-lbl"><?php echo JText::translate('VBO_SELECT'); ?></span> |
| 258 |
<span class="vbo-context-menu-ico"><?php VikBookingIcons::e('sort-down'); ?></span> |
| 259 |
</button> |
| 260 |
</div> |
| 261 |
</div> |
| 262 |
|
| 263 |
<script type="text/javascript"> |
| 264 |
var prev_checkins = <?php echo json_encode($previous_checkins); ?>; |
| 265 |
var prev_checkins_btns = []; |
| 266 |
|
| 267 |
function populatePreviousCheckin(pax_data) { |
| 268 |
if (!pax_data || !pax_data.length) { |
| 269 |
alert('Invalid previous check-in information'); |
| 270 |
return false; |
| 271 |
} |
| 272 |
|
| 273 |
var room_num = 0, |
| 274 |
guest_num = 1, |
| 275 |
guests_found = 0; |
| 276 |
|
| 277 |
pax_data.forEach((room_pax, room_index) => { |
| 278 |
for (let guest_num in room_pax) { |
| 279 |
if (!room_pax.hasOwnProperty(guest_num)) { |
| 280 |
continue; |
| 281 |
} |
| 282 |
if (jQuery('.vbo-roomdet-wrapper[data-roomnum="' + room_num + '"]').length && !jQuery('.vbo-roomdet-guest-details[data-guestnum="' + guest_num + '"]').length) { |
| 283 |
// try to go to the first guest of the next room |
| 284 |
room_num++; |
| 285 |
guest_num = 1; |
| 286 |
} |
| 287 |
let guest_found = false; |
| 288 |
for (let prop_name in room_pax[guest_num]) { |
| 289 |
if (!room_pax[guest_num].hasOwnProperty(prop_name)) { |
| 290 |
continue; |
| 291 |
} |
| 292 |
let field_name = 'guests[' + room_num + '][' + guest_num + '][' + prop_name + ']'; |
| 293 |
if (jQuery('[name="' + field_name + '"]').length) { |
| 294 |
jQuery('[name="' + field_name + '"]').val(room_pax[guest_num][prop_name]).trigger('change'); |
| 295 |
if (!guest_found) { |
| 296 |
guests_found++; |
| 297 |
guest_found = true; |
| 298 |
} |
| 299 |
} |
| 300 |
} |
| 301 |
guest_num++; |
| 302 |
if (jQuery('#vbo-roomdet-guests-details-' + room_num).length && !jQuery('#vbo-roomdet-guests-details-' + room_num).is(':visible')) { |
| 303 |
jQuery('#vbo-roomdet-guests-details-' + room_num).slideDown(); |
| 304 |
} |
| 305 |
} |
| 306 |
}); |
| 307 |
|
| 308 |
return guests_found; |
| 309 |
} |
| 310 |
|
| 311 |
prev_checkins.forEach((prev_checkin, index) => { |
| 312 |
prev_checkins_btns.push({ |
| 313 |
icon: '<?php echo VikBookingIcons::i('calendar-check'); ?>', |
| 314 |
text: Joomla.JText._('VBRENTALORD') + ' #' + prev_checkin['idorder'] + ' - ' + Joomla.JText._('VBPVIEWORDERSPEOPLE') + ': ' + prev_checkin['tot_guests'], |
| 315 |
separator: (index === prev_checkins.length - 1), |
| 316 |
action: (root, config) => { |
| 317 |
var guests_populated = populatePreviousCheckin(prev_checkins[index]['pax_data']); |
| 318 |
console.log('guests_populated: ' + guests_populated); |
| 319 |
}, |
| 320 |
}); |
| 321 |
}); |
| 322 |
|
| 323 |
jQuery(function() { |
| 324 |
jQuery('.vbo-context-menu-prevchkins').vboContextMenu({ |
| 325 |
placement: 'bottom-left', |
| 326 |
buttons: prev_checkins_btns, |
| 327 |
}); |
| 328 |
}); |
| 329 |
</script> |
| 330 |
<?php |
| 331 |
} |
| 332 |
?> |
| 333 |
</div> |
| 334 |
<?php |
| 335 |
//rooms details and total information |
| 336 |
?> |
| 337 |
<div class="vbo-checkin-main-block"> |
| 338 |
<div class="vbo-roomsdet-container"> |
| 339 |
<?php |
| 340 |
$tars = array(); |
| 341 |
$arrpeople = array(); |
| 342 |
$is_package = (!empty($order['pkg'])); |
| 343 |
$is_cust_cost = false; |
| 344 |
foreach ($rooms as $ind => $or) { |
| 345 |
$num = $ind + 1; |
| 346 |
$arrpeople[$num]['adults'] = $or['adults']; |
| 347 |
$arrpeople[$num]['children'] = $or['children']; |
| 348 |
$arrpeople[$num]['children_age'] = $or['childrenage']; |
| 349 |
$arrpeople[$num]['t_first_name'] = $or['t_first_name']; |
| 350 |
$arrpeople[$num]['t_last_name'] = $or['t_last_name']; |
| 351 |
if ($is_package === true || (!empty($or['cust_cost']) && $or['cust_cost'] > 0.00)) { |
| 352 |
//package or custom cost set from the back-end |
| 353 |
$is_cust_cost = true; |
| 354 |
continue; |
| 355 |
} |
| 356 |
$q = "SELECT * FROM `#__vikbooking_dispcost` WHERE `id`=".(int)$or['idtar'].";"; |
| 357 |
$dbo->setQuery($q); |
| 358 |
$dbo->execute(); |
| 359 |
$tar = $dbo->loadAssocList(); |
| 360 |
$tars[$num] = $tar; |
| 361 |
} |
| 362 |
//compose the calculation for pax_data |
| 363 |
$pax_data = array(); |
| 364 |
$count_pax_data = 0; |
| 365 |
if (count($customer) > 0) { |
| 366 |
$count_pax_data = 1; |
| 367 |
if (!empty($customer['pax_data'])) { |
| 368 |
$pax_data = json_decode($customer['pax_data'], true); |
| 369 |
$pax_data = !is_array($pax_data) ? array() : $pax_data; |
| 370 |
} |
| 371 |
} |
| 372 |
$all_countries = VikBooking::getCountriesArray(); |
| 373 |
// |
| 374 |
foreach ($rooms as $ind => $or) { |
| 375 |
$num = $ind + 1; |
| 376 |
//total guests details available |
| 377 |
$count_pax_data = $num < 2 ? $count_pax_data : 0; |
| 378 |
if (isset($pax_data[$ind])) { |
| 379 |
$count_pax_data = count($pax_data[$ind]); |
| 380 |
} |
| 381 |
|
| 382 |
//Room Specific Unit |
| 383 |
$spec_unit = ''; |
| 384 |
if (!empty($or['params'])) { |
| 385 |
$room_params = json_decode($or['params'], true); |
| 386 |
$arr_features = array(); |
| 387 |
if (is_array($room_params) && array_key_exists('features', $room_params) && @count($room_params['features']) > 0) { |
| 388 |
foreach ($room_params['features'] as $rind => $rfeatures) { |
| 389 |
foreach ($rfeatures as $fname => $fval) { |
| 390 |
if (strlen($fval)) { |
| 391 |
$arr_features[$rind] = '#'.$rind.' - '.JText::translate($fname).': '.$fval; |
| 392 |
break; |
| 393 |
} |
| 394 |
} |
| 395 |
} |
| 396 |
} |
| 397 |
if (isset($arr_features[$or['roomindex']])) { |
| 398 |
$spec_unit = $arr_features[$or['roomindex']]; |
| 399 |
} |
| 400 |
} |
| 401 |
|
| 402 |
// calculate the number of guests to register depending on settings |
| 403 |
$guests_to_register = $pax_fields_obj->registerChildren() ? ($arrpeople[$num]['adults'] + $arrpeople[$num]['children']) : $arrpeople[$num]['adults']; |
| 404 |
?> |
| 405 |
<div class="vbo-roomdet-wrapper" data-roomnum="<?php echo $ind; ?>"> |
| 406 |
<div class="vbo-roomdet-wrap"> |
| 407 |
<div class="vbo-roomdet-entry"> |
| 408 |
<div class="vbo-roomdet-head"> |
| 409 |
<span><?php echo $or['room_name']; ?></span> |
| 410 |
</div> |
| 411 |
<div class="vbo-roomdet-foot"> |
| 412 |
<?php |
| 413 |
if (!empty($spec_unit)) { |
| 414 |
?> |
| 415 |
<span><?php echo $spec_unit; ?></span> |
| 416 |
<?php |
| 417 |
} |
| 418 |
?> |
| 419 |
<div class="vbo-roomdet-guests-toggle-cont"> |
| 420 |
<span tabindex="0" class="vbo-roomdet-guests-toggle <?php echo $count_pax_data >= $guests_to_register ? 'vbo-guestscount-complete' : 'vbo-guestscount-incomplete'; ?>" data-roomind="<?php echo $ind; ?>"> |
| 421 |
<i class="vboicn-user-plus"></i> |
| 422 |
<span class="vbo-roomdet-guests-toggleword"><?php echo JText::translate('VBOGUESTSDETAILS'); ?> (<span id="vbo-guestscount-<?php echo $ind; ?>"><?php echo $count_pax_data; ?></span>/<?php echo $guests_to_register; ?>)</span> |
| 423 |
</span> |
| 424 |
</div> |
| 425 |
</div> |
| 426 |
</div> |
| 427 |
<div class="vbo-roomdet-entry"> |
| 428 |
<div class="vbo-roomdet-head"> |
| 429 |
<span><?php echo JText::translate('VBEDITORDERADULTS'); ?></span> |
| 430 |
</div> |
| 431 |
<div class="vbo-roomdet-foot"> |
| 432 |
<span><?php echo $arrpeople[$num]['adults']; ?></span> |
| 433 |
</div> |
| 434 |
</div> |
| 435 |
<?php |
| 436 |
$age_str = ''; |
| 437 |
if ($arrpeople[$num]['children'] > 0) { |
| 438 |
if (!empty($arrpeople[$num]['children_age'])) { |
| 439 |
$json_child = json_decode($arrpeople[$num]['children_age'], true); |
| 440 |
if (is_array($json_child['age']) && count($json_child['age']) > 0) { |
| 441 |
$age_str = ' '.JText::sprintf('VBORDERCHILDAGES', implode(', ', $json_child['age'])); |
| 442 |
} |
| 443 |
} |
| 444 |
} |
| 445 |
?> |
| 446 |
<div class="vbo-roomdet-entry"> |
| 447 |
<div class="vbo-roomdet-head"> |
| 448 |
<span><?php echo JText::translate('VBEDITORDERCHILDREN'); ?></span> |
| 449 |
</div> |
| 450 |
<div class="vbo-roomdet-foot"> |
| 451 |
<span><?php echo $arrpeople[$num]['children'].$age_str; ?></span> |
| 452 |
</div> |
| 453 |
</div> |
| 454 |
<div class="vbo-roomdet-entry"> |
| 455 |
<div class="vbo-roomdet-head"> |
| 456 |
<span><?php echo JText::translate('VBEDITORDERSEVEN'); ?></span> |
| 457 |
</div> |
| 458 |
<div class="vbo-roomdet-foot"> |
| 459 |
<?php |
| 460 |
if ($is_package === true || (!empty($or['cust_cost']) && $or['cust_cost'] > 0.00)) { |
| 461 |
?> |
| 462 |
<span> |
| 463 |
<?php |
| 464 |
if (!empty($or['pkg_name'])) { |
| 465 |
//package |
| 466 |
echo $or['pkg_name']; |
| 467 |
} else { |
| 468 |
//custom cost can have an OTA Rate Plan name |
| 469 |
if (!empty($or['otarplan'])) { |
| 470 |
echo ucwords($or['otarplan']); |
| 471 |
} else { |
| 472 |
echo JText::translate('VBOROOMCUSTRATEPLAN'); |
| 473 |
} |
| 474 |
} |
| 475 |
?> |
| 476 |
<?php echo $currencysymb; ?> <?php echo VikBooking::numberFormat($or['cust_cost']); ?> |
| 477 |
</span> |
| 478 |
<?php |
| 479 |
} elseif (array_key_exists($num, $tars) && !empty($tars[$num][0]['idprice'])) { |
| 480 |
$display_rate = !empty($or['room_cost']) ? $or['room_cost'] : $tars[$num][0]['cost']; |
| 481 |
?> |
| 482 |
<span> |
| 483 |
<?php echo VikBooking::getPriceName($tars[$num][0]['idprice']); ?> |
| 484 |
<?php |
| 485 |
if (!empty($or['room_cost'])) { |
| 486 |
echo $currencysymb.' '.VikBooking::numberFormat(VikBooking::sayCostPlusIva($display_rate, $tars[$num][0]['idprice'])); |
| 487 |
} |
| 488 |
?> |
| 489 |
</span> |
| 490 |
<?php |
| 491 |
} elseif (!empty($or['otarplan'])) { |
| 492 |
?> |
| 493 |
<span><?php echo ucwords($or['otarplan']); ?></span> |
| 494 |
<?php |
| 495 |
} elseif ($this->row['closure'] < 1) { |
| 496 |
?> |
| 497 |
<span><?php echo JText::translate('VBOROOMNORATE'); ?></span> |
| 498 |
<?php |
| 499 |
} else { |
| 500 |
?> |
| 501 |
<span>-----</span> |
| 502 |
<?php |
| 503 |
} |
| 504 |
?> |
| 505 |
</div> |
| 506 |
</div> |
| 507 |
<div class="vbo-roomdet-entry"> |
| 508 |
<div class="vbo-roomdet-head"> |
| 509 |
<span><?php echo JText::translate('VBEDITORDEREIGHT'); ?></span> |
| 510 |
</div> |
| 511 |
<div class="vbo-roomdet-foot"> |
| 512 |
<?php |
| 513 |
if (!empty($or['optionals'])) { |
| 514 |
$stepo = explode(";", $or['optionals']); |
| 515 |
foreach ($stepo as $roptkey => $oo) { |
| 516 |
if (empty($oo)) { |
| 517 |
continue; |
| 518 |
} |
| 519 |
$hide_price = false; |
| 520 |
$stept = explode(":", $oo); |
| 521 |
$actopt = VikBooking::getSingleOption($stept[0]); |
| 522 |
if (!$actopt) { |
| 523 |
continue; |
| 524 |
} |
| 525 |
$chvar = ''; |
| 526 |
if (!empty($actopt['ageintervals']) && $or['children'] > 0 && strstr($stept[1], '-') != false) { |
| 527 |
$optagenames = VikBooking::getOptionIntervalsAges($actopt['ageintervals']); |
| 528 |
$optagepcent = VikBooking::getOptionIntervalsPercentage($actopt['ageintervals']); |
| 529 |
$optageovrct = VikBooking::getOptionIntervalChildOverrides($actopt, $or['adults'], $or['children']); |
| 530 |
$child_num = VikBooking::getRoomOptionChildNumber($or['optionals'], $actopt['id'], $roptkey, $or['children']); |
| 531 |
$optagecosts = VikBooking::getOptionIntervalsCosts(isset($optageovrct['ageintervals_child' . ($child_num + 1)]) ? $optageovrct['ageintervals_child' . ($child_num + 1)] : $actopt['ageintervals']); |
| 532 |
$agestept = explode('-', $stept[1]); |
| 533 |
$stept[1] = $agestept[0]; |
| 534 |
$chvar = $agestept[1]; |
| 535 |
if (array_key_exists(($chvar - 1), $optagepcent) && $optagepcent[($chvar - 1)] == 1) { |
| 536 |
//percentage value of the adults tariff |
| 537 |
if ($is_package === true || (!empty($or['cust_cost']) && $or['cust_cost'] > 0.00)) { |
| 538 |
$optagecosts[($chvar - 1)] = $or['cust_cost'] * $optagecosts[($chvar - 1)] / 100; |
| 539 |
} else { |
| 540 |
$display_rate = !empty($or['room_cost']) ? $or['room_cost'] : $tars[$num][0]['cost']; |
| 541 |
$hide_price = empty($or['room_cost']) ? true : $hide_price; |
| 542 |
$optagecosts[($chvar - 1)] = $display_rate * $optagecosts[($chvar - 1)] / 100; |
| 543 |
} |
| 544 |
} elseif (array_key_exists(($chvar - 1), $optagepcent) && $optagepcent[($chvar - 1)] == 2) { |
| 545 |
//VBO 1.10 - percentage value of room base cost |
| 546 |
if ($is_package === true || (!empty($or['cust_cost']) && $or['cust_cost'] > 0.00)) { |
| 547 |
$optagecosts[($chvar - 1)] = $or['cust_cost'] * $optagecosts[($chvar - 1)] / 100; |
| 548 |
} else { |
| 549 |
$display_rate = isset($tars[$num][0]['room_base_cost']) ? $tars[$num][0]['room_base_cost'] : (!empty($or['room_cost']) ? $or['room_cost'] : $tars[$num][0]['cost']); |
| 550 |
$hide_price = empty($or['room_cost']) ? true : $hide_price; |
| 551 |
$optagecosts[($chvar - 1)] = $display_rate * $optagecosts[($chvar - 1)] / 100; |
| 552 |
} |
| 553 |
} |
| 554 |
$actopt['chageintv'] = $chvar; |
| 555 |
$actopt['name'] .= ' ('.$optagenames[($chvar - 1)].')'; |
| 556 |
$realcost = (intval($actopt['perday']) == 1 ? (floatval($optagecosts[($chvar - 1)]) * $order['days'] * $stept[1]) : (floatval($optagecosts[($chvar - 1)]) * $stept[1])); |
| 557 |
} else { |
| 558 |
// VBO 1.11 - options percentage cost of the room total fee |
| 559 |
if ($is_package === true || (!empty($or['cust_cost']) && $or['cust_cost'] > 0.00)) { |
| 560 |
$deftar_basecosts = $or['cust_cost']; |
| 561 |
} else { |
| 562 |
$deftar_basecosts = !empty($or['room_cost']) ? $or['room_cost'] : $tars[$num][0]['cost']; |
| 563 |
} |
| 564 |
$actopt['cost'] = (int)$actopt['pcentroom'] ? ($deftar_basecosts * $actopt['cost'] / 100) : $actopt['cost']; |
| 565 |
// |
| 566 |
$realcost = (intval($actopt['perday']) == 1 ? ($actopt['cost'] * $order['days'] * $stept[1]) : ($actopt['cost'] * $stept[1])); |
| 567 |
} |
| 568 |
if ($actopt['maxprice'] > 0 && $realcost > $actopt['maxprice']) { |
| 569 |
$realcost = $actopt['maxprice']; |
| 570 |
if (intval($actopt['hmany']) == 1 && intval($stept[1]) > 1) { |
| 571 |
$realcost = $actopt['maxprice'] * $stept[1]; |
| 572 |
} |
| 573 |
} |
| 574 |
$realcost = $actopt['perperson'] == 1 ? ($realcost * $arrpeople[$num]['adults']) : $realcost; |
| 575 |
$tmpopr = VikBooking::sayOptionalsPlusIva($realcost, $actopt['idiva']); |
| 576 |
?> |
| 577 |
<div class="vbo-roomdet-foot-options"> |
| 578 |
<?php echo ($stept[1] > 1 ? $stept[1]." " : "").$actopt['name'].(!$hide_price ? " ".$currencysymb." ".VikBooking::numberFormat($tmpopr) : ''); ?> |
| 579 |
</div> |
| 580 |
<?php |
| 581 |
} |
| 582 |
} |
| 583 |
?> |
| 584 |
</div> |
| 585 |
</div> |
| 586 |
<div class="vbo-roomdet-entry"> |
| 587 |
<div class="vbo-roomdet-head"> |
| 588 |
<span><?php echo JText::translate('VBPEDITBUSYEXTRACOSTS'); ?></span> |
| 589 |
</div> |
| 590 |
<div class="vbo-roomdet-foot"> |
| 591 |
<?php |
| 592 |
if (!empty($or['extracosts'])) { |
| 593 |
$cur_extra_costs = json_decode($or['extracosts'], true); |
| 594 |
foreach ($cur_extra_costs as $eck => $ecv) { |
| 595 |
?> |
| 596 |
<div class="vbo-roomdet-foot-extras"> |
| 597 |
<?php echo $ecv['name']." ".$currencysymb." ".VikBooking::numberFormat(VikBooking::sayOptionalsPlusIva($ecv['cost'], $ecv['idtax'])); ?> |
| 598 |
</div> |
| 599 |
<?php |
| 600 |
} |
| 601 |
} |
| 602 |
?> |
| 603 |
</div> |
| 604 |
</div> |
| 605 |
</div> |
| 606 |
<?php |
| 607 |
if ($arrpeople[$num]['adults'] > 0) { |
| 608 |
?> |
| 609 |
<div class="vbo-roomdet-guests-details" id="vbo-roomdet-guests-details-<?php echo $ind; ?>"> |
| 610 |
<?php |
| 611 |
/** |
| 612 |
* Back-end guests registration now relies on dynamic drivers within Vik Booking. |
| 613 |
* |
| 614 |
* @since 1.15.0 (J) - 1.5.0 (WP) |
| 615 |
*/ |
| 616 |
|
| 617 |
// loop through all guests that should be registered within this room-party |
| 618 |
for ($g = 1; $g <= $guests_to_register; $g++) { |
| 619 |
$current_guest = array(); |
| 620 |
if (count($pax_data) && isset($pax_data[$ind]) && isset($pax_data[$ind][$g])) { |
| 621 |
$current_guest = $pax_data[$ind][$g]; |
| 622 |
} elseif ($ind < 1 && $g == 1 && count($customer)) { |
| 623 |
$current_guest = $customer; |
| 624 |
} |
| 625 |
?> |
| 626 |
<div class="vbo-roomdet-guest-details" data-roomind="<?php echo $ind; ?>" data-guestnum="<?php echo $g; ?>" data-totguests="<?php echo $guests_to_register; ?>"> |
| 627 |
<div class="vbo-roomdet-guest-detail vbo-roomdet-guest-detail-num"> |
| 628 |
<span><?php echo JText::sprintf('VBOGUESTNUM', $g); ?></span> |
| 629 |
</div> |
| 630 |
<?php |
| 631 |
$pax_field_ind = 1; |
| 632 |
foreach ($pax_fields as $paxk => $paxv) { |
| 633 |
// get an instance of the VBOCheckinPaxfield object |
| 634 |
$pax_field_obj = $pax_fields_obj->getField($paxk); |
| 635 |
|
| 636 |
// detect the current type of guest |
| 637 |
$guest_type = $g > $arrpeople[$num]['adults'] ? 'child' : 'adult'; |
| 638 |
|
| 639 |
// set object data |
| 640 |
$pax_field_obj->setGuestType($guest_type) |
| 641 |
->setFieldNumber($pax_field_ind) |
| 642 |
->setGuestNumber($g) |
| 643 |
->setGuestData($current_guest) |
| 644 |
->setRoomIndex($ind) |
| 645 |
->setRoomGuests($arrpeople[$num]['adults'], $arrpeople[$num]['children']) |
| 646 |
->setTotalRooms(count($arrpeople)); |
| 647 |
|
| 648 |
// render input field |
| 649 |
$pax_field_html = $pax_fields_obj->render($pax_field_obj); |
| 650 |
if (empty($pax_field_html)) { |
| 651 |
// nothing to display, increase the counter and continue |
| 652 |
$pax_field_ind++; |
| 653 |
continue; |
| 654 |
} |
| 655 |
|
| 656 |
// access the implementor object |
| 657 |
$implementor = $pax_fields_obj->getFieldTypeImplementor($pax_field_obj); |
| 658 |
|
| 659 |
// check if a particular CSS class has been defined |
| 660 |
$field_container_class = $implementor->getContainerClassAttr(); |
| 661 |
$field_container_class = !empty($field_container_class) ? " $field_container_class" : ''; |
| 662 |
|
| 663 |
?> |
| 664 |
<div class="vbo-roomdet-guest-detail<?php echo $field_container_class; ?>"> |
| 665 |
<div class="vbo-roomdet-guest-detail-lbl"> |
| 666 |
<label for="<?php echo $implementor->getFieldIdAttr(); ?>"><?php echo $paxv; ?></label> |
| 667 |
</div> |
| 668 |
<div class="vbo-roomdet-guest-detail-val"> |
| 669 |
<?php echo $pax_field_html; ?> |
| 670 |
</div> |
| 671 |
</div> |
| 672 |
<?php |
| 673 |
$pax_field_ind++; |
| 674 |
} |
| 675 |
// display any other information collected through the pre check-in |
| 676 |
if (count($pax_data) && isset($pax_data[$ind]) && isset($pax_data[$ind][$g])) { |
| 677 |
foreach ($pax_data[$ind][$g] as $extrak => $extrav) { |
| 678 |
if (isset($pax_fields[$extrak]) || (is_scalar($extrav) && !strlen($extrav))) { |
| 679 |
// this is a default pax field, we skip it |
| 680 |
continue; |
| 681 |
} |
| 682 |
$precheckin_field_lbl = isset($pre_pax_fields[$extrak]) ? $pre_pax_fields[$extrak] : $extrak; |
| 683 |
$precheckin_field_typ = isset($pre_pax_fields_attributes[$extrak]) && $pre_pax_fields_attributes[$extrak] == 'file' ? 'file' : 'text'; |
| 684 |
?> |
| 685 |
<div class="vbo-roomdet-guest-detail vbo-roomdet-guest-detail-precheckin"> |
| 686 |
<div class="vbo-roomdet-guest-detail-lbl"> |
| 687 |
<span><?php echo $precheckin_field_lbl; ?></span> |
| 688 |
</div> |
| 689 |
<div class="vbo-roomdet-guest-detail-val"> |
| 690 |
<?php |
| 691 |
if ($precheckin_field_typ == 'file') { |
| 692 |
// documents uploaded by the customer during pre-checkin |
| 693 |
$guest_files = explode('|', $extrav); |
| 694 |
foreach ($guest_files as $gfk => $guest_file) { |
| 695 |
if (empty($guest_file) || strpos($guest_file, 'http') !== 0) { |
| 696 |
continue; |
| 697 |
} |
| 698 |
$furl_segments = explode('/', $guest_file); |
| 699 |
$guest_fname = $furl_segments[(count($furl_segments) - 1)]; |
| 700 |
$read_fname = substr($guest_fname, (strpos($guest_fname, '_') + 1)); |
| 701 |
?> |
| 702 |
<div class="vbo-paxfield-file-uploaded"> |
| 703 |
<a href="<?php echo $guest_file; ?>" target="_blank"> |
| 704 |
<?php VikBookingIcons::e('image'); ?> |
| 705 |
<span><?php echo $read_fname; ?></span> |
| 706 |
</a> |
| 707 |
</div> |
| 708 |
<?php |
| 709 |
} |
| 710 |
?> |
| 711 |
<input type="hidden" data-gind="<?php echo $g; ?>" name="guests[<?php echo $ind; ?>][<?php echo $g; ?>][<?php echo $extrak; ?>]" value="<?php echo $extrav; ?>" /> |
| 712 |
<?php |
| 713 |
} else { |
| 714 |
?> |
| 715 |
<input type="text" data-gind="<?php echo $g; ?>" class="vbo-paxfield" name="guests[<?php echo $ind; ?>][<?php echo $g; ?>][<?php echo $extrak; ?>]" value="<?php echo htmlspecialchars($extrav); ?>" /> |
| 716 |
<?php |
| 717 |
} |
| 718 |
?> |
| 719 |
</div> |
| 720 |
</div> |
| 721 |
<?php |
| 722 |
} |
| 723 |
} |
| 724 |
?> |
| 725 |
</div> |
| 726 |
<?php |
| 727 |
} |
| 728 |
?> |
| 729 |
</div> |
| 730 |
</div> |
| 731 |
<?php |
| 732 |
} |
| 733 |
} |
| 734 |
?> |
| 735 |
</div> |
| 736 |
|
| 737 |
<div class="vbo-checkin-payment-container"> |
| 738 |
<div class="vbo-checkin-payment-detail"> |
| 739 |
<?php |
| 740 |
$bcolortag = VikBooking::applyBookingColorTag($order, $colortags); |
| 741 |
$usectag = ''; |
| 742 |
if (count($bcolortag) > 0) { |
| 743 |
$bcolortag['name'] = JText::translate($bcolortag['name']); |
| 744 |
$usectag = '<span class="vbo-colortag-circle hasTooltip" style="background-color: '.$bcolortag['color'].';" title="'.htmlspecialchars($bcolortag['name']).'"></span> '; |
| 745 |
} |
| 746 |
?> |
| 747 |
<span class="vbo-checkin-payment-detail-lbl"><?php echo $usectag; ?><strong><?php echo JText::translate('VBEDITORDERNINE'); ?></strong></span> |
| 748 |
<span class="vbo-checkin-payment-detail-v"><?php echo (strlen($otacurrency) > 0 ? '('.$otacurrency.') '.$currencysymb : $currencysymb); ?> <?php echo VikBooking::numberFormat($order['total']); ?></span> |
| 749 |
</div> |
| 750 |
<?php |
| 751 |
if (!empty($order['totpaid']) && $order['totpaid'] > 0) { |
| 752 |
$diff_to_pay = $order['total'] - $order['totpaid']; |
| 753 |
?> |
| 754 |
<div class="vbo-checkin-payment-detail"> |
| 755 |
<span class="vbo-checkin-payment-detail-lbl"><?php echo JText::translate('VBAMOUNTPAID'); ?></span> |
| 756 |
<span class="vbo-checkin-payment-detail-v"><?php echo $currencysymb; ?> <?php echo VikBooking::numberFormat($order['totpaid']); ?></span> |
| 757 |
</div> |
| 758 |
<?php |
| 759 |
if ($diff_to_pay > 0) { |
| 760 |
?> |
| 761 |
<div class="vbo-checkin-payment-detail"> |
| 762 |
<span class="vbo-checkin-payment-detail-lbl"><?php echo JText::translate('VBTOTALREMAINING'); ?></span> |
| 763 |
<span class="vbo-checkin-payment-detail-v"><?php echo $currencysymb; ?> <span id="vbo-checkin-remaining"><?php echo VikBooking::numberFormat($diff_to_pay); ?></span></span> |
| 764 |
</div> |
| 765 |
<div class="vbo-checkin-payment-detail"> |
| 766 |
<span class="vbo-checkin-payment-detail-lbl"><?php echo JText::translate('VBONEWAMOUNTPAID'); ?></span> |
| 767 |
<span class="vbo-checkin-payment-detail-v"><?php echo $currencysymb; ?> <input name="newtotpaid" id="newtotpaid" value="" min="0" type="number" step="any" style="margin: 0;"></span> |
| 768 |
</div> |
| 769 |
<?php |
| 770 |
} |
| 771 |
} else { |
| 772 |
// print the new amount paid anyway to let it update |
| 773 |
?> |
| 774 |
<div class="vbo-checkin-payment-detail"> |
| 775 |
<span class="vbo-checkin-payment-detail-lbl"><?php echo JText::translate('VBONEWAMOUNTPAID'); ?></span> |
| 776 |
<span class="vbo-checkin-payment-detail-v"><?php echo $currencysymb; ?> <input name="newtotpaid" id="newtotpaid" value="" min="0" type="number" step="any" style="margin: 0;"></span> |
| 777 |
</div> |
| 778 |
<?php |
| 779 |
} |
| 780 |
$payment = VikBooking::getPayment($order['idpayment']); |
| 781 |
if (is_array($payment)) { |
| 782 |
?> |
| 783 |
<div class="vbo-checkin-payment-detail"> |
| 784 |
<span class="vbo-checkin-payment-detail-lbl"><?php echo JText::translate('VBPAYMENTMETHOD'); ?></span> |
| 785 |
<span class="vbo-checkin-payment-detail-v"><?php echo $payment['name']; ?></span> |
| 786 |
</div> |
| 787 |
<?php |
| 788 |
} |
| 789 |
if (!empty($order['paymentlog'])) { |
| 790 |
?> |
| 791 |
<div class="vbo-checkin-payment-detail"> |
| 792 |
<span class="vbo-checkin-payment-detail-lbl vbo-checkin-payment-detail-click" onclick="vboUpdateModal('<?php echo addslashes(JText::translate('VBPAYMENTLOGTOGGLE')); ?>', '.paymentlog', true);"> |
| 793 |
<i class="vboicn-credit-card"></i> <?php echo JText::translate('VBPAYMENTLOGTOGGLE'); ?> |
| 794 |
</span> |
| 795 |
</div> |
| 796 |
<?php |
| 797 |
} |
| 798 |
?> |
| 799 |
</div> |
| 800 |
</div> |
| 801 |
|
| 802 |
<div class="vbo-checkin-notes-wrap"> |
| 803 |
<div class="vbo-checkin-notes-inner"> |
| 804 |
<div class="vbo-checkin-notes-trig"> |
| 805 |
<span onclick="vboToggleCheckinNotes();"><i class="<?php echo count($customer) && !empty($customer['comments']) ? 'vboicn-bubbles2' : 'vboicn-bubble2'; ?>"></i> <?php echo JText::translate('VBOTOGGLECHECKINNOTES'); ?></span> |
| 806 |
</div> |
| 807 |
<div class="vbo-checkin-notes-cont"> |
| 808 |
<textarea name="comments"><?php echo count($customer) && isset($customer['comments']) ? htmlspecialchars($customer['comments']) : ''; ?></textarea> |
| 809 |
</div> |
| 810 |
</div> |
| 811 |
</div> |
| 812 |
|
| 813 |
<div class="vbo-checkin-update-wrap"> |
| 814 |
<div class="vbo-checkin-update-inner"> |
| 815 |
<div> |
| 816 |
<button type="button" class="btn btn-primary" onclick="jQuery('#adminForm').submit();"><i class="vboicn-checkmark"></i> <?php echo JText::translate('VBOCHECKINUPDATEBTN'); ?></button> |
| 817 |
</div> |
| 818 |
</div> |
| 819 |
</div> |
| 820 |
|
| 821 |
<div class="vbo-checkin-commands-wrap"> |
| 822 |
<div class="vbo-checkin-commands-inner"> |
| 823 |
<?php |
| 824 |
if ($today_midnight < $order['checkout']) { |
| 825 |
$allowed_btns = array(); |
| 826 |
if ($order['checked'] <= 0) { |
| 827 |
//check-in btn only for no-status or no-show |
| 828 |
$allowed_btns[] = 1; |
| 829 |
} |
| 830 |
if ($order['checked'] < 0 && !empty($order['channel']) && strpos($order['channel'], 'booking.com') !== false && VikBooking::vcmBcomReportingSupported($order)) { |
| 831 |
//report no show to Booking.com btn only for no-status |
| 832 |
$allowed_btns[] = -11; |
| 833 |
} |
| 834 |
if ($order['checked'] == 0) { |
| 835 |
//no-show button only if no-status |
| 836 |
$allowed_btns[] = -1; |
| 837 |
} |
| 838 |
if ($order['checked'] == 1 && (count($customer) && empty($customer['checkindoc']))) { |
| 839 |
//generate check-in doc button only for checked-in and no check-in doc |
| 840 |
$allowed_btns[] = 11; |
| 841 |
} elseif ($order['checked'] > 0 && (count($customer) && !empty($customer['checkindoc']))) { |
| 842 |
//download check-in doc button only for checked-in||out and check-in doc |
| 843 |
$allowed_btns[] = 12; |
| 844 |
//add also the possibility of re-creating the document |
| 845 |
$allowed_btns[] = 11; |
| 846 |
} |
| 847 |
if ($order['checked'] == 1 && $today_midnight > $order['checkin']) { |
| 848 |
//check-out button only for checked-in and after the check-in day |
| 849 |
$allowed_btns[] = 2; |
| 850 |
} |
| 851 |
if ($order['checked'] != 0) { |
| 852 |
//cancel button only if not no-status |
| 853 |
$allowed_btns[] = 0; |
| 854 |
} |
| 855 |
//print buttons |
| 856 |
foreach ($allowed_btns as $chstatus) { |
| 857 |
switch ($chstatus) { |
| 858 |
case -1: |
| 859 |
?> |
| 860 |
<div class="vbo-checkin-commands-btn"> |
| 861 |
<button type="button" onclick="vboSetCheckinAction(-1);" class="btn btn-large btn-danger"><i class="vboicn-blocked"></i> <?php echo JText::translate('VBOSETCHECKEDSTATUSNOS'); ?></button> |
| 862 |
</div> |
| 863 |
<?php |
| 864 |
break; |
| 865 |
case 0: |
| 866 |
?> |
| 867 |
<div class="vbo-checkin-commands-btn"> |
| 868 |
<button type="button" onclick="vboSetCheckinAction(0);" class="btn btn-large btn-secondary"><i class="vboicn-cancel-circle"></i> <?php echo JText::translate('VBOSETCHECKEDSTATUSZERO'); ?></button> |
| 869 |
</div> |
| 870 |
<?php |
| 871 |
break; |
| 872 |
case 1: |
| 873 |
?> |
| 874 |
<div class="vbo-checkin-commands-btn"> |
| 875 |
<button type="button" onclick="vboSetCheckinAction(1);" class="btn btn-large btn-success"><i class="vboicn-checkmark"></i> <?php echo JText::translate('VBOSETCHECKEDSTATUSIN'); ?></button> |
| 876 |
</div> |
| 877 |
<?php |
| 878 |
break; |
| 879 |
case 2: |
| 880 |
?> |
| 881 |
<div class="vbo-checkin-commands-btn"> |
| 882 |
<button type="button" onclick="vboSetCheckinAction(2);" class="btn btn-large btn-success"><i class="vboicn-exit"></i> <?php echo JText::translate('VBOSETCHECKEDSTATUSOUT'); ?></button> |
| 883 |
</div> |
| 884 |
<?php |
| 885 |
break; |
| 886 |
case 11: |
| 887 |
?> |
| 888 |
<div class="vbo-checkin-commands-btn"> |
| 889 |
<a href="index.php?option=com_vikbooking&task=gencheckindoc&cid[]=<?php echo $order['id'].($tmpl == 'component' ? '&tmpl=component' : ''); ?>" class="btn btn-large btn-success"><i class="vboicn-profile"></i> <?php echo JText::translate('VBOGENCHECKINDOC'); ?></a> |
| 890 |
</div> |
| 891 |
<?php |
| 892 |
break; |
| 893 |
case 12: |
| 894 |
?> |
| 895 |
<div class="vbo-checkin-commands-btn"> |
| 896 |
<button type="button" onclick="window.open('<?php echo VBO_SITE_URI.'helpers/checkins/generated/'.$customer['checkindoc']; ?>', '_blank');" class="btn btn-large btn-success"><i class="vboicn-download"></i> <?php echo JText::translate('VBODWNLCHECKINDOC'); ?></button> |
| 897 |
</div> |
| 898 |
<?php |
| 899 |
break; |
| 900 |
case -11: |
| 901 |
/** |
| 902 |
* Build the contextual menu buttons to report the no-show to the OTA through AJAX requests. |
| 903 |
* |
| 904 |
* @since 1.16.8 (J) - 1.6.8 (WP) |
| 905 |
* |
| 906 |
* @requires VCM >= 1.8.24 |
| 907 |
*/ |
| 908 |
?> |
| 909 |
<div class="vbo-checkin-commands-btn"> |
| 910 |
<button type="button" class="btn btn-large btn-danger vbo-context-menu-btn vbo-context-menu-otanoshow"> |
| 911 |
<span class="vbo-context-menu-lbl"><?php VikBookingIcons::e('ban'); ?> <?php echo JText::translate('VBOBCOMREPORTNOSHOW'); ?></span> |
| 912 |
<span class="vbo-context-menu-ico"><?php VikBookingIcons::e('sort-down'); ?></span> |
| 913 |
</button> |
| 914 |
</div> |
| 915 |
|
| 916 |
<script type="text/javascript"> |
| 917 |
jQuery(function() { |
| 918 |
|
| 919 |
// callback constant will receive this.waived_fees (do not use an arrow function) |
| 920 |
const notify_noshow = function() { |
| 921 |
if (confirm('<?php echo addslashes(JText::translate('VBOBCOMREPORTNOSHOWCONF')); ?>')) { |
| 922 |
// show inner modal |
| 923 |
VBOCore.displayModal({ |
| 924 |
title: '.....', |
| 925 |
dismiss_event: 'vbo-bookingcheckin-ajax-dismiss', |
| 926 |
loading_event: 'vbo-bookingcheckin-ajax-loading', |
| 927 |
loading_body: '<?php VikBookingIcons::e('circle-notch', 'fa-spin fa-fw'); ?>', |
| 928 |
}); |
| 929 |
|
| 930 |
// start loading |
| 931 |
VBOCore.emitEvent('vbo-bookingcheckin-ajax-loading'); |
| 932 |
|
| 933 |
// perform the request |
| 934 |
VBOCore.doAjax( |
| 935 |
"<?php echo VikBooking::ajaxUrl('index.php?option=com_vikchannelmanager&task=breporting.no_show'); ?>", |
| 936 |
{ |
| 937 |
otaid: '<?php echo $order['idorderota']; ?>', |
| 938 |
waived_fees: this.waived_fees, |
| 939 |
}, |
| 940 |
(success) => { |
| 941 |
// remove inner modal |
| 942 |
VBOCore.emitEvent('vbo-bookingcheckin-ajax-dismiss'); |
| 943 |
|
| 944 |
// hide main modal |
| 945 |
try { |
| 946 |
jQuery('#jmodal-vbo-checkin-booking').modal('hide'); |
| 947 |
} catch(e) { |
| 948 |
// do nothing |
| 949 |
} |
| 950 |
|
| 951 |
// reload (parent/current) window |
| 952 |
(window.parent || window).location.reload(); |
| 953 |
}, |
| 954 |
(error) => { |
| 955 |
// remove inner modal |
| 956 |
VBOCore.emitEvent('vbo-bookingcheckin-ajax-dismiss'); |
| 957 |
|
| 958 |
// log and display the error |
| 959 |
console.error(error); |
| 960 |
alert(error.responseText); |
| 961 |
} |
| 962 |
); |
| 963 |
} |
| 964 |
}; |
| 965 |
|
| 966 |
jQuery('.vbo-context-menu-otanoshow').vboContextMenu({ |
| 967 |
placement: 'bottom-right', |
| 968 |
buttons: [ |
| 969 |
{ |
| 970 |
icon: '<?php echo VikBookingIcons::i('ban'); ?>', |
| 971 |
text: '<?php echo addslashes(JText::translate('VBO_DONT_WAIVE_FEES')); ?>', |
| 972 |
class: 'vbo-context-menu-entry-warning', |
| 973 |
separator: true, |
| 974 |
waived_fees: 0, |
| 975 |
action: notify_noshow, |
| 976 |
}, |
| 977 |
{ |
| 978 |
icon: '<?php echo VikBookingIcons::i('ban'); ?>', |
| 979 |
text: '<?php echo addslashes(JText::translate('VBO_DO_WAIVE_FEES')); ?>', |
| 980 |
class: 'vbo-context-menu-entry-danger', |
| 981 |
separator: false, |
| 982 |
waived_fees: 1, |
| 983 |
action: notify_noshow, |
| 984 |
}, |
| 985 |
], |
| 986 |
}); |
| 987 |
}); |
| 988 |
</script> |
| 989 |
<?php |
| 990 |
break; |
| 991 |
default: |
| 992 |
break; |
| 993 |
} |
| 994 |
} |
| 995 |
} else { |
| 996 |
?> |
| 997 |
<p class="warn"><?php echo JText::translate('VBOCHECKINTIMEOVER'); ?></p> |
| 998 |
<?php |
| 999 |
//if the document exists, print the download button even if the check-out date is in the past |
| 1000 |
if ($order['checked'] != 0 && (count($customer) && !empty($customer['checkindoc']))) { |
| 1001 |
//download check-in doc button only for checked-in||out and check-in doc |
| 1002 |
?> |
| 1003 |
<div class="vbo-checkin-commands-btn"> |
| 1004 |
<button type="button" onclick="window.open('<?php echo VBO_SITE_URI.'helpers/checkins/generated/'.$customer['checkindoc']; ?>', '_blank');" class="btn btn-large btn-success"><i class="vboicn-download"></i> <?php echo JText::translate('VBODWNLCHECKINDOC'); ?></button> |
| 1005 |
</div> |
| 1006 |
<?php |
| 1007 |
} |
| 1008 |
} |
| 1009 |
?> |
| 1010 |
</div> |
| 1011 |
</div> |
| 1012 |
<input type="hidden" name="cid[]" value="<?php echo $order['id']; ?>"> |
| 1013 |
<input type="hidden" name="checkin_action" id="vbo-checkin-action" value="<?php echo $order['checked']; ?>"> |
| 1014 |
<input type="hidden" name="task" value="updatebookingcheckin" /> |
| 1015 |
<input type="hidden" name="option" value="com_vikbooking" /> |
| 1016 |
<?php |
| 1017 |
if ($tmpl == 'component') { |
| 1018 |
?> |
| 1019 |
<input type="hidden" name="tmpl" value="component" /> |
| 1020 |
<?php |
| 1021 |
} |
| 1022 |
?> |
| 1023 |
</form> |
| 1024 |
<?php |
| 1025 |
// |
| 1026 |
?> |
| 1027 |
<script type="text/javascript"> |
| 1028 |
var vbo_overlay_data = {}; |
| 1029 |
<?php |
| 1030 |
if (!empty($order['adminnotes'])) { |
| 1031 |
$order['adminnotes'] = VikBooking::strTrimLiteral(nl2br(htmlspecialchars($order['adminnotes']))); |
| 1032 |
?> |
| 1033 |
vbo_overlay_data['adminnotes'] = '<pre><?php echo addslashes($order['adminnotes']); ?></pre>'; |
| 1034 |
<?php |
| 1035 |
} |
| 1036 |
if (!empty($order['paymentlog'])) { |
| 1037 |
$plain_log = htmlspecialchars($order['paymentlog']); |
| 1038 |
$order['paymentlog'] = VikBooking::strTrimLiteral(nl2br(htmlspecialchars($order['paymentlog']))); |
| 1039 |
?> |
| 1040 |
vbo_overlay_data['paymentlog'] = '<pre><?php echo addslashes($order['paymentlog']); ?></pre>'; |
| 1041 |
<?php |
| 1042 |
//PCI Data Retrieval |
| 1043 |
if (!empty($order['idorderota']) && !empty($order['channel'])) { |
| 1044 |
$channel_source = $order['channel']; |
| 1045 |
if (strpos($order['channel'], '_') !== false) { |
| 1046 |
$channelparts = explode('_', $order['channel']); |
| 1047 |
$channel_source = $channelparts[0]; |
| 1048 |
} |
| 1049 |
//Limit set to Check-out date at 29:59:59 |
| 1050 |
$checkout_info = getdate($order['checkout']); |
| 1051 |
$checkout_midnight = mktime(23, 59, 59, $checkout_info['mon'], $checkout_info['mday'], $checkout_info['year']); |
| 1052 |
if (time() < $checkout_midnight) { |
| 1053 |
if (stripos($plain_log, 'card number') !== false && strpos($plain_log, '****') !== false) { |
| 1054 |
/* |
| 1055 |
* Log contains credit card details. |
| 1056 |
* Build the URI for the administrator section of VCM according to the platform. |
| 1057 |
*/ |
| 1058 |
$exec_pcid_uri = VBOFactory::getPlatform()->getUri()->admin('index.php?option=com_vikchannelmanager&task=execpcid&channel_source=' . $channel_source . '&otaid=' . $order['idorderota'] . '&tmpl=component', false); |
| 1059 |
?> |
| 1060 |
var pci_vcm_frame = '<iframe src="<?php echo $exec_pcid_uri; ?>"></iframe>'; |
| 1061 |
vbo_overlay_data['paymentlog'] = '<div class="vcm-notif-pcidrq-container">'+ |
| 1062 |
'<button type="button" class="btn vbo-config-btn vcm-pcid-launch" onclick="vboUpdateModal(\'<?php echo addslashes(JText::translate('VBPAYMENTLOGTOGGLE')); ?>\', pci_vcm_frame, false);">'+ |
| 1063 |
'<?php VikBookingIcons::e('credit-card'); ?>'+ |
| 1064 |
'<?php echo addslashes(JText::translate('GETFULLCARDDETAILS')); ?>'+ |
| 1065 |
'</button>'+ |
| 1066 |
'</div>'+ |
| 1067 |
vbo_overlay_data['paymentlog']; |
| 1068 |
<?php |
| 1069 |
} |
| 1070 |
} |
| 1071 |
} |
| 1072 |
// |
| 1073 |
} |
| 1074 |
if (count($customer) && !empty($customer['notes'])) { |
| 1075 |
$customer['notes'] = VikBooking::strTrimLiteral(nl2br(htmlspecialchars($customer['notes']))); |
| 1076 |
?> |
| 1077 |
vbo_overlay_data['customer_notes'] = '<pre><?php echo addslashes($customer['notes']); ?></pre>'; |
| 1078 |
<?php |
| 1079 |
} |
| 1080 |
if (count($customer)) { |
| 1081 |
$displayable_fields = array( |
| 1082 |
'first_name' => JText::translate('VBCUSTOMERFIRSTNAME'), |
| 1083 |
'last_name' => JText::translate('VBCUSTOMERLASTNAME'), |
| 1084 |
'company' => JText::translate('VBCUSTOMERCOMPANY'), |
| 1085 |
'vat' => JText::translate('VBCUSTOMERCOMPANYVAT'), |
| 1086 |
'email' => JText::translate('VBCUSTOMEREMAIL'), |
| 1087 |
'phone' => JText::translate('VBCUSTOMERPHONE'), |
| 1088 |
'address' => JText::translate('VBCUSTOMERADDRESS'), |
| 1089 |
'city' => JText::translate('VBCUSTOMERCITY'), |
| 1090 |
'zip' => JText::translate('VBCUSTOMERZIP'), |
| 1091 |
'country' => JText::translate('VBCUSTOMERCOUNTRY'), |
| 1092 |
'gender' => JText::translate('VBCUSTOMERGENDER'), |
| 1093 |
'bdate' => JText::translate('VBCUSTOMERBDATE'), |
| 1094 |
'pbirth' => JText::translate('VBCUSTOMERPBIRTH'), |
| 1095 |
'doctype' => JText::translate('VBCUSTOMERDOCTYPE'), |
| 1096 |
'docnum' => JText::translate('VBCUSTOMERDOCNUM') |
| 1097 |
); |
| 1098 |
/** |
| 1099 |
* We use a link rather than a button to support the |
| 1100 |
* modal navigation through AJAX on both J and WP. |
| 1101 |
*/ |
| 1102 |
?> |
| 1103 |
vbo_overlay_data['customer_info'] = '<a class="btn btn-primary pull-right" href="index.php?option=com_vikbooking&task=editcustomer&cid[]=<?php echo $customer['id'].'&checkin=1&bid='.$order['id'].($tmpl == 'component' ? '&tmpl=component' : ''); ?>"><i class="vboicn-profile"></i> <?php echo addslashes(JText::translate('VBMAINCUSTOMEREDIT')); ?></a>'+ |
| 1104 |
'<div class="vbo-checkin-custdet-cont">'+ |
| 1105 |
<?php |
| 1106 |
foreach ($displayable_fields as $k => $v) { |
| 1107 |
$customer_val = isset($customer[$k]) && !empty($customer[$k]) ? addslashes(VikBooking::strTrimLiteral(nl2br(htmlspecialchars($customer[$k])))) : '---'; |
| 1108 |
?> |
| 1109 |
'<div class="vbo-checkin-custdet-entry">'+ |
| 1110 |
'<span class="vbo-checkin-custdet-key<?php echo (!isset($customer[$k]) || empty($customer[$k])) && in_array($k, $sensible_k) ? ' vbo-checkin-custdet-key-warn' : ''; ?>"><?php echo addslashes(JText::translate($v)); ?></span>'+ |
| 1111 |
'<span class="vbo-checkin-custdet-value"><?php echo $customer_val; ?></span>'+ |
| 1112 |
'</div>'+ |
| 1113 |
<?php |
| 1114 |
} |
| 1115 |
?> |
| 1116 |
'</div>'; |
| 1117 |
<?php |
| 1118 |
} |
| 1119 |
if (!empty($set_parent_status)) { |
| 1120 |
/** |
| 1121 |
* This function supports the admin widgets arriving today and departing today. |
| 1122 |
*/ |
| 1123 |
?> |
| 1124 |
if (jQuery('[data-status="<?php echo $order['id']; ?>"]', window.parent.document).length) { |
| 1125 |
jQuery('[data-status="<?php echo $order['id']; ?>"]', window.parent.document).html('<?php echo str_replace("'", "", $set_parent_status); ?>'); |
| 1126 |
} |
| 1127 |
<?php |
| 1128 |
} |
| 1129 |
?> |
| 1130 |
</script> |
| 1131 |
<script type="text/javascript"> |
| 1132 |
/* Global Variables and Functions */ |
| 1133 |
var vbo_overlay_on = false; |
| 1134 |
var booking_total = <?php echo (float)$order['total']; ?>; |
| 1135 |
var tot_rooms = <?php echo (int)$order['roomsnum']; ?>; |
| 1136 |
var current_checked = <?php echo (int)$order['checked']; ?>; |
| 1137 |
|
| 1138 |
function vboOpenModal() { |
| 1139 |
<?php |
| 1140 |
if (VBOPlatformDetection::isWordPress()) { |
| 1141 |
?> |
| 1142 |
/** |
| 1143 |
* @wponly - we are inside the same parent page as the modal is loaded via Ajax. |
| 1144 |
* We need to select the values from the modal container. |
| 1145 |
*/ |
| 1146 |
jQuery('.modal-body').find(".vbo-info-overlay-block").fadeToggle(400, function() { |
| 1147 |
if (jQuery('.modal-body').find(".vbo-info-overlay-block").is(":visible")) { |
| 1148 |
vbo_overlay_on = true; |
| 1149 |
} else { |
| 1150 |
vbo_overlay_on = false; |
| 1151 |
jQuery('.modal-body').find('.vbo-overlay-checkin-body').html(''); |
| 1152 |
} |
| 1153 |
}); |
| 1154 |
<?php |
| 1155 |
} else { |
| 1156 |
?> |
| 1157 |
jQuery(".vbo-info-overlay-block").fadeToggle(400, function() { |
| 1158 |
if (jQuery(".vbo-info-overlay-block").is(":visible")) { |
| 1159 |
vbo_overlay_on = true; |
| 1160 |
} else { |
| 1161 |
vbo_overlay_on = false; |
| 1162 |
jQuery('.vbo-overlay-checkin-body').html(''); |
| 1163 |
} |
| 1164 |
}); |
| 1165 |
<?php |
| 1166 |
} |
| 1167 |
?> |
| 1168 |
} |
| 1169 |
|
| 1170 |
function vboUpdateModal(title, body, call_toggle) { |
| 1171 |
<?php |
| 1172 |
if (VBOPlatformDetection::isWordPress()) { |
| 1173 |
?> |
| 1174 |
/** |
| 1175 |
* @wponly - we are inside the same parent page as the modal is loaded via Ajax. |
| 1176 |
* We need to select the values from the modal container. |
| 1177 |
*/ |
| 1178 |
var keep_closing_btn = jQuery('.modal-body').find('#vbo-overlay-title').find('.vbo-info-overlay-title-close').html(); |
| 1179 |
jQuery('.modal-body').find('#vbo-overlay-title').html(title + '<span class="vbo-info-overlay-title-close">' + keep_closing_btn + '</span>'); |
| 1180 |
if (body.substr(0, 1) == '.') { |
| 1181 |
//look for this value inside the global array |
| 1182 |
body = body.substr(1, (body.length - 1)); |
| 1183 |
if (vbo_overlay_data.hasOwnProperty(body)) { |
| 1184 |
body = vbo_overlay_data[body]; |
| 1185 |
} |
| 1186 |
} |
| 1187 |
jQuery('.modal-body').find('.vbo-overlay-checkin-body').html(body); |
| 1188 |
if (call_toggle) { |
| 1189 |
vboOpenModal(); |
| 1190 |
} |
| 1191 |
/** |
| 1192 |
* @wponly - the customer_info 'body' has a link to another page, which must be manually |
| 1193 |
* registered for preventing the browser to follow it and make the Ajax request instead. |
| 1194 |
*/ |
| 1195 |
var parent_modal_id = jQuery('.modal-body').find('.vbo-overlay-checkin-body').closest('.modal').attr('id'); |
| 1196 |
ajaxPreventFormSubmit(parent_modal_id); |
| 1197 |
<?php |
| 1198 |
} else { |
| 1199 |
?> |
| 1200 |
var keep_closing_btn = jQuery('#vbo-overlay-title').find('.vbo-info-overlay-title-close').html(); |
| 1201 |
jQuery('#vbo-overlay-title').html(title + '<span class="vbo-info-overlay-title-close">' + keep_closing_btn + '</span>'); |
| 1202 |
if (body.substr(0, 1) == '.') { |
| 1203 |
//look for this value inside the global array |
| 1204 |
body = body.substr(1, (body.length - 1)); |
| 1205 |
if (vbo_overlay_data.hasOwnProperty(body)) { |
| 1206 |
body = vbo_overlay_data[body]; |
| 1207 |
} |
| 1208 |
} |
| 1209 |
jQuery('.vbo-overlay-checkin-body').html(body); |
| 1210 |
if (call_toggle) { |
| 1211 |
vboOpenModal(); |
| 1212 |
} |
| 1213 |
<?php |
| 1214 |
} |
| 1215 |
?> |
| 1216 |
} |
| 1217 |
|
| 1218 |
function vboToggleCheckinNotes() { |
| 1219 |
jQuery('.vbo-checkin-notes-cont').toggle(); |
| 1220 |
} |
| 1221 |
|
| 1222 |
function vboSetCheckinAction(action) { |
| 1223 |
jQuery('#vbo-checkin-action').val(action); |
| 1224 |
if (action > 0) { |
| 1225 |
//check if guests details were filled in for check-in/out actions |
| 1226 |
var guests_filled = true; |
| 1227 |
for (var i = 0; i < tot_rooms; i++) { |
| 1228 |
var elem = jQuery(".vbo-roomdet-guests-toggle[data-roomind='"+i+"']"); |
| 1229 |
if (elem.length && elem.hasClass('vbo-guestscount-incomplete')) { |
| 1230 |
guests_filled = false; |
| 1231 |
break; |
| 1232 |
} |
| 1233 |
} |
| 1234 |
if (!guests_filled) { |
| 1235 |
if (confirm('<?php echo addslashes(JText::translate('VBOCHECKINACTCONFGUESTS')) ?>')) { |
| 1236 |
jQuery('#adminForm').submit(); |
| 1237 |
} |
| 1238 |
return true; |
| 1239 |
} |
| 1240 |
} |
| 1241 |
jQuery('#adminForm').submit(); |
| 1242 |
} |
| 1243 |
|
| 1244 |
if (jQuery.isFunction(jQuery.fn.tooltip)) { |
| 1245 |
jQuery(".hasTooltip").tooltip(); |
| 1246 |
} else { |
| 1247 |
jQuery.fn.tooltip = function(){}; |
| 1248 |
} |
| 1249 |
|
| 1250 |
jQuery(function() { |
| 1251 |
/* Guests Details events - Start */ |
| 1252 |
var focused = null; |
| 1253 |
jQuery('.vbo-roomdet-guests-toggle').focus(function(e) { |
| 1254 |
// focus event will be fired before the click event |
| 1255 |
focused = null; |
| 1256 |
e.stopPropagation(); |
| 1257 |
e.preventDefault(); |
| 1258 |
var roomind = jQuery(this).attr('data-roomind'); |
| 1259 |
var elem = jQuery('#vbo-roomdet-guests-details-'+roomind); |
| 1260 |
if (elem.length && elem.is(':hidden')) { |
| 1261 |
focused = '#vbo-roomdet-guests-details-'+roomind; |
| 1262 |
elem.slideDown(); |
| 1263 |
} |
| 1264 |
}); |
| 1265 |
jQuery('.vbo-roomdet-guests-toggle').click(function(e) { |
| 1266 |
// click event will be fired after the focus event |
| 1267 |
var roomind = jQuery(this).attr('data-roomind'); |
| 1268 |
var elem = jQuery('#vbo-roomdet-guests-details-'+roomind); |
| 1269 |
if (!elem.length || focused == '#vbo-roomdet-guests-details-'+roomind) { |
| 1270 |
// focus event has already displayed the content |
| 1271 |
focused = null; |
| 1272 |
return; |
| 1273 |
} |
| 1274 |
elem.slideToggle(); |
| 1275 |
}); |
| 1276 |
jQuery('.vbo-paxfield').keyup(function() { |
| 1277 |
var cur_gind = jQuery(this).attr('data-gind'); |
| 1278 |
var roomind = jQuery(this).closest('.vbo-roomdet-guest-details').attr('data-roomind'); |
| 1279 |
var tot_room_guests = parseInt(jQuery(this).closest('.vbo-roomdet-guest-details').attr('data-totguests')); |
| 1280 |
if (!cur_gind.length || isNaN(tot_room_guests) || !jQuery(this).hasClass('vbo-paxfield-'+roomind)) { |
| 1281 |
return true; |
| 1282 |
} |
| 1283 |
var cur_val = jQuery(this).val(); |
| 1284 |
var tot_full_guests = 0; |
| 1285 |
for (var i = 1; i <= tot_room_guests; i++) { |
| 1286 |
var fullfilled = true; |
| 1287 |
jQuery(".vbo-paxfield-"+roomind+"[data-gind='"+i+"']").each(function(k, v) { |
| 1288 |
if (!jQuery(this).val().length) { |
| 1289 |
fullfilled = false; |
| 1290 |
} |
| 1291 |
}); |
| 1292 |
if (fullfilled) { |
| 1293 |
tot_full_guests++; |
| 1294 |
} |
| 1295 |
} |
| 1296 |
if (tot_full_guests >= tot_room_guests) { |
| 1297 |
var add_class = 'vbo-guestscount-complete'; |
| 1298 |
var rm_class = 'vbo-guestscount-incomplete'; |
| 1299 |
var ico_add_class = 'vboicn-user-check'; |
| 1300 |
var ico_rm_class = 'vboicn-user-plus'; |
| 1301 |
} else { |
| 1302 |
var add_class = 'vbo-guestscount-incomplete'; |
| 1303 |
var rm_class = 'vbo-guestscount-complete'; |
| 1304 |
var ico_add_class = 'vboicn-user-plus'; |
| 1305 |
var ico_rm_class = 'vboicn-user-check'; |
| 1306 |
} |
| 1307 |
jQuery('#vbo-guestscount-'+roomind).text(tot_full_guests).closest('.vbo-roomdet-guests-toggle').addClass(add_class).removeClass(rm_class).find('i').addClass(ico_add_class).removeClass(ico_rm_class); |
| 1308 |
}); |
| 1309 |
/* Guests Details events - End */ |
| 1310 |
/* Overlay for Customer Notes, Booking Notes, Payment Logs - Start */ |
| 1311 |
jQuery(document).mouseup(function(e) { |
| 1312 |
if (!vbo_overlay_on) { |
| 1313 |
return false; |
| 1314 |
} |
| 1315 |
var vbo_overlay_cont = jQuery(".vbo-info-overlay-content"); |
| 1316 |
if (!vbo_overlay_cont.is(e.target) && vbo_overlay_cont.has(e.target).length === 0) { |
| 1317 |
jQuery(".vbo-info-overlay-block").fadeOut(); |
| 1318 |
vbo_overlay_on = false; |
| 1319 |
} |
| 1320 |
}); |
| 1321 |
jQuery(document).keyup(function(e) { |
| 1322 |
if (e.keyCode == 27 && vbo_overlay_on) { |
| 1323 |
jQuery(".vbo-info-overlay-block").fadeOut(); |
| 1324 |
vbo_overlay_on = false; |
| 1325 |
} |
| 1326 |
}); |
| 1327 |
/* Overlay for Customer Notes, Booking Notes, Payment Logs - End */ |
| 1328 |
/* Update amount paid and remaining balance */ |
| 1329 |
jQuery('#newtotpaid').change(function() { |
| 1330 |
if (!jQuery('#vbo-checkin-remaining').length) { |
| 1331 |
return true; |
| 1332 |
} |
| 1333 |
var cur_val = parseFloat(jQuery(this).val()); |
| 1334 |
if (!(cur_val > 0)) { |
| 1335 |
return true; |
| 1336 |
} |
| 1337 |
var new_val = booking_total - cur_val; |
| 1338 |
jQuery('#vbo-checkin-remaining').text(new_val.toFixed(2)); |
| 1339 |
}); |
| 1340 |
}); |
| 1341 |
</script> |
| 1342 |
|