| 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 |
$row = $this->row; |
| 14 |
$rooms = $this->rooms; |
| 15 |
$busy = $this->busy; |
| 16 |
$customer = $this->customer; |
| 17 |
$payments = $this->payments; |
| 18 |
|
| 19 |
$history_obj = VikBooking::getBookingHistoryInstance($row['id']); |
| 20 |
|
| 21 |
// availability helper |
| 22 |
$av_helper = VikBooking::getAvailabilityInstance(); |
| 23 |
|
| 24 |
// load datepicker for all CMS compatibility |
| 25 |
JHtml::fetch('stylesheet', VBO_SITE_URI.'resources/jquery-ui.min.css'); |
| 26 |
JHtml::fetch('jquery.framework', true, true); |
| 27 |
JHtml::fetch('script', VBO_SITE_URI.'resources/jquery-ui.min.js'); |
| 28 |
|
| 29 |
// js lang def |
| 30 |
JText::script('VBO_CONV_RES_OTA_CURRENCY_APPLY'); |
| 31 |
JText::script('VBDELCONFIRM'); |
| 32 |
JText::script('VBSENDCANCORDEMAIL'); |
| 33 |
JText::script('VBO_SET_STANDBY'); |
| 34 |
JText::script('VBO_CONF_RM_OVERBOOKING_FLAG'); |
| 35 |
JText::script('VBO_NEW_PAYSCHEDULE'); |
| 36 |
JText::script('VBANNULLA'); |
| 37 |
JText::script('VBSAVE'); |
| 38 |
JText::script('VBELIMINA'); |
| 39 |
JText::script('VBO_REG_NEW_PAYMENT'); |
| 40 |
JText::script('VBO_UPDATE_PAYMENT'); |
| 41 |
JText::script('VBO_AI_AUTO_GUEST_REV_EXCLUDE'); |
| 42 |
JText::script('VBO_AI_AUTO_GUEST_REV_INCLUDE'); |
| 43 |
|
| 44 |
$dbo = JFactory::getDbo(); |
| 45 |
|
| 46 |
$vbo_app = VikBooking::getVboApplication(); |
| 47 |
$vbo_app->loadVisualEditorAssets(); |
| 48 |
|
| 49 |
/** |
| 50 |
* This View can render within a modal the "bookingcheckin" View, and with WP |
| 51 |
* this is loaded via AJAX. In order to not interfere or reset the contextual menu, |
| 52 |
* we load the assets from the parent View. Context menu may also be used in this View. |
| 53 |
* |
| 54 |
* @since 1.16.0 (J) - 1.6.0 (WP) |
| 55 |
*/ |
| 56 |
$vbo_app->loadContextMenuAssets(); |
| 57 |
if (VBOPlatformDetection::isWordPress()) { |
| 58 |
JText::script('VBRENTALORD'); |
| 59 |
JText::script('VBPVIEWORDERSPEOPLE'); |
| 60 |
} |
| 61 |
|
| 62 |
$canDo = JFactory::getUser(); |
| 63 |
$vbo_auth_bookings = $canDo->authorise('core.vbo.bookings', 'com_vikbooking'); |
| 64 |
|
| 65 |
$currencyname = VikBooking::getCurrencyName(); |
| 66 |
$currencysymb = VikBooking::getCurrencySymb(); |
| 67 |
$after_tax = VikBooking::ivaInclusa(); |
| 68 |
$nowdf = VikBooking::getDateFormat(true); |
| 69 |
if ($nowdf == "%d/%m/%Y") { |
| 70 |
$df = 'd/m/Y'; |
| 71 |
} elseif ($nowdf == "%m/%d/%Y") { |
| 72 |
$df = 'm/d/Y'; |
| 73 |
} else { |
| 74 |
$df = 'Y/m/d'; |
| 75 |
} |
| 76 |
$datesep = VikBooking::getDateSeparator(true); |
| 77 |
$vbo_modals_html = array(); |
| 78 |
$payment = VikBooking::getPayment($row['idpayment']); |
| 79 |
$pactive_tab = VikRequest::getString('vbo_active_tab', 'vbo-tab-details', 'request'); |
| 80 |
$printreceipt = VikRequest::getInt('print', 0, 'request'); |
| 81 |
$printreceipt = ($printreceipt > 0); |
| 82 |
if ($printreceipt) { |
| 83 |
//we set a different page title when printing the receipt for the "PDF Printer" to give the file a good name. |
| 84 |
JFactory::getDocument()->setTitle(VikBooking::getFrontTitle()." - ".JText::translate('VBOFISCRECEIPT')." #".$row['id']); |
| 85 |
} |
| 86 |
$gotouri = 'index.php?option=com_vikbooking&task=editorder&cid[]='.$row['id']; |
| 87 |
|
| 88 |
if ($row['status'] == "confirmed") { |
| 89 |
$use_js_bid = $row['id']; |
| 90 |
JFactory::getDocument()->addScriptDeclaration( |
| 91 |
<<<JS |
| 92 |
window["vbo_current_bid"] = $use_js_bid; |
| 93 |
JS |
| 94 |
); |
| 95 |
} |
| 96 |
|
| 97 |
$tars = array(); |
| 98 |
$arrpeople = array(); |
| 99 |
$is_package = !empty($row['pkg']) ? true : false; |
| 100 |
$is_cust_cost = false; |
| 101 |
foreach ($rooms as $ind => $or) { |
| 102 |
$num = $ind + 1; |
| 103 |
$arrpeople[$num]['adults'] = $or['adults']; |
| 104 |
$arrpeople[$num]['children'] = $or['children']; |
| 105 |
$arrpeople[$num]['children_age'] = $or['childrenage']; |
| 106 |
$arrpeople[$num]['t_first_name'] = $or['t_first_name']; |
| 107 |
$arrpeople[$num]['t_last_name'] = $or['t_last_name']; |
| 108 |
$arrpeople[$num]['pets'] = $or['pets']; |
| 109 |
if ($is_package === true || (!empty($or['cust_cost']) && $or['cust_cost'] > 0.00)) { |
| 110 |
//package or custom cost set from the back-end |
| 111 |
$is_cust_cost = true; |
| 112 |
continue; |
| 113 |
} |
| 114 |
$q = "SELECT * FROM `#__vikbooking_dispcost` WHERE `id`=".(int)$or['idtar'].";"; |
| 115 |
$dbo->setQuery($q); |
| 116 |
$tar = $dbo->loadAssocList(); |
| 117 |
$tar = VikBooking::applySeasonsRoom($tar, $row['checkin'], $row['checkout']); |
| 118 |
|
| 119 |
// apply OBP rules |
| 120 |
$tar = VBORoomHelper::getInstance()->applyOBPRules($tar, $or, $or['adults']); |
| 121 |
|
| 122 |
$tars[$num] = $tar; |
| 123 |
} |
| 124 |
$pcheckin = $row['checkin']; |
| 125 |
$pcheckout = $row['checkout']; |
| 126 |
$secdiff = $pcheckout - $pcheckin; |
| 127 |
$daysdiff = $secdiff / 86400; |
| 128 |
if (is_int($daysdiff)) { |
| 129 |
if ($daysdiff < 1) { |
| 130 |
$daysdiff = 1; |
| 131 |
} |
| 132 |
} else { |
| 133 |
if ($daysdiff < 1) { |
| 134 |
$daysdiff = 1; |
| 135 |
} else { |
| 136 |
$sum = floor($daysdiff) * 86400; |
| 137 |
$newdiff = $secdiff - $sum; |
| 138 |
$maxhmore = VikBooking::getHoursMoreRb() * 3600; |
| 139 |
if ($maxhmore >= $newdiff) { |
| 140 |
$daysdiff = floor($daysdiff); |
| 141 |
} else { |
| 142 |
$daysdiff = ceil($daysdiff); |
| 143 |
} |
| 144 |
} |
| 145 |
} |
| 146 |
$otachannel = ''; |
| 147 |
$otachannel_name = ''; |
| 148 |
$otachannel_bid = ''; |
| 149 |
$otacurrency = ''; |
| 150 |
if (!empty($row['channel'])) { |
| 151 |
$channelparts = explode('_', $row['channel']); |
| 152 |
$otachannel = array_key_exists(1, $channelparts) && strlen($channelparts[1]) > 0 ? $channelparts[1] : ucwords($channelparts[0]); |
| 153 |
$otachannel_name = $otachannel; |
| 154 |
$otachannel_bid = $otachannel.(!empty($row['idorderota']) ? ' - Booking ID: '.$row['idorderota'] : ''); |
| 155 |
if (strstr($otachannel, '.') !== false) { |
| 156 |
$otaccparts = explode('.', $otachannel); |
| 157 |
$otachannel = $otaccparts[0]; |
| 158 |
} |
| 159 |
$otacurrency = strlen($row['chcurrency']) > 0 ? $row['chcurrency'] : ''; |
| 160 |
} |
| 161 |
|
| 162 |
$status_type = ''; |
| 163 |
if (!empty($row['type'])) { |
| 164 |
$status_type = JText::translate('VBO_BTYPE_' . strtoupper($row['type'])); |
| 165 |
if (!strcasecmp($row['type'], 'overbooking')) { |
| 166 |
$status_type = '<span class="label label-error vbo-label-nested vbo-label-overbooking">' . $status_type . '</span>'; |
| 167 |
} |
| 168 |
$status_type .= ' / '; |
| 169 |
} |
| 170 |
$extra_status = $row['refund'] > 0 ? ' / ' . JText::translate('VBO_STATUS_REFUNDED') : ''; |
| 171 |
if ($row['status'] == "confirmed") { |
| 172 |
$saystaus = '<span class="label label-success">' . $status_type . JText::translate('VBCONFIRMED') . $extra_status . '</span>'; |
| 173 |
} elseif ($row['status'] == "standby") { |
| 174 |
$saystaus = '<span class="label label-warning">' . $status_type . JText::translate('VBSTANDBY') . $extra_status . '</span>'; |
| 175 |
} else { |
| 176 |
$saystaus = '<span class="label label-error">' . $status_type . JText::translate('VBCANCELLED') . $extra_status . '</span>'; |
| 177 |
} |
| 178 |
|
| 179 |
// extend booking details main panel |
| 180 |
$bookingPanelForms = $this->onDisplayView(); |
| 181 |
|
| 182 |
// extend booking details sidebar |
| 183 |
$bookingSidebarForms = $this->onDisplayView('Sidebar'); |
| 184 |
|
| 185 |
// extend administration main panel |
| 186 |
$adminFormsSetup = new stdClass; |
| 187 |
$adminFormsSetup->icons = []; |
| 188 |
$adminPanelForms = $this->onDisplayView('Administration', $adminFormsSetup); |
| 189 |
|
| 190 |
// extend administration sidebar |
| 191 |
$adminSidebarForms = $this->onDisplayView('AdministrationSidebar'); |
| 192 |
|
| 193 |
//Prepare modal (used for the Registration and for reconstructing the credit card details through the channel manager) |
| 194 |
echo $vbo_app->getJmodalScript(); |
| 195 |
//end Prepare modal |
| 196 |
?> |
| 197 |
<script type="text/javascript"> |
| 198 |
function changePayment() { |
| 199 |
var newpayment = document.getElementById('newpayment').value; |
| 200 |
if (newpayment != '') { |
| 201 |
var paymentname = document.getElementById('newpayment').options[document.getElementById('newpayment').selectedIndex].text; |
| 202 |
if (confirm('<?php echo addslashes(JText::translate('VBCHANGEPAYCONFIRM')); ?>' + paymentname + '?')) { |
| 203 |
document.adminForm.submit(); |
| 204 |
} else { |
| 205 |
document.getElementById('newpayment').selectedIndex = 0; |
| 206 |
} |
| 207 |
} |
| 208 |
} |
| 209 |
function vbToggleLog(elem) { |
| 210 |
vbToggleDynamicPanel(elem, '#vbpaymentlogdiv'); |
| 211 |
} |
| 212 |
function vbToggleNotes(elem) { |
| 213 |
vbToggleDynamicPanel(elem, '#vbadminnotesdiv'); |
| 214 |
} |
| 215 |
function vbToggleHistory(elem) { |
| 216 |
vbToggleDynamicPanel(elem, '#vbhistorydiv'); |
| 217 |
} |
| 218 |
function vbToggleInvNotes(elem) { |
| 219 |
vbToggleDynamicPanel(elem, '#vbinvnotesdiv'); |
| 220 |
} |
| 221 |
function vbToggleMessaging(elem) { |
| 222 |
vbToggleDynamicPanel(elem, '#vbmessagingdiv'); |
| 223 |
if (typeof VCMChat !== 'undefined') { |
| 224 |
VCMChat.getInstance().scrollToBottom(); |
| 225 |
} |
| 226 |
} |
| 227 |
function vbToggleDynamicPanel(elem, target) { |
| 228 |
if (jQuery(target).is(':visible')) { |
| 229 |
return; |
| 230 |
} |
| 231 |
|
| 232 |
jQuery(".vbo-bookingdet-noteslogs-btn-active").removeClass("vbo-bookingdet-noteslogs-btn-active"); |
| 233 |
|
| 234 |
jQuery('.vbo-extra-panel').hide(); |
| 235 |
jQuery(target).show(); |
| 236 |
|
| 237 |
jQuery(elem).parent(".vbo-bookingdet-noteslogs-btn").addClass("vbo-bookingdet-noteslogs-btn-active"); |
| 238 |
|
| 239 |
if (typeof sessionStorage !== 'undefined') { |
| 240 |
sessionStorage.setItem('vboEditOrderTab<?php echo $row['id']; ?>', jQuery(elem).parent().data('id')); |
| 241 |
} |
| 242 |
} |
| 243 |
function toggleDiscount(elem) { |
| 244 |
var discsp = document.getElementById('vbdiscenter').style.display; |
| 245 |
if (discsp == 'block') { |
| 246 |
document.getElementById('vbdiscenter').style.display = 'none'; |
| 247 |
jQuery(elem).find('i').attr('class', '<?php echo VikBookingIcons::i('chevron-down'); ?>'); |
| 248 |
} else { |
| 249 |
document.getElementById('vbdiscenter').style.display = 'block'; |
| 250 |
jQuery(elem).find('i').attr('class', '<?php echo VikBookingIcons::i('chevron-up'); ?>'); |
| 251 |
} |
| 252 |
} |
| 253 |
</script> |
| 254 |
|
| 255 |
<div class="vbo-bookingdet-topcontainer"> |
| 256 |
<form name="adminForm" id="adminForm" action="<?php echo VBOPlatformDetection::isWordPress() ? 'admin.php' : 'index.php'; ?>?option=com_vikbooking&task=editorder&cid[]=<?php echo $row['id']; ?>" method="post"> |
| 257 |
<?php |
| 258 |
if ($printreceipt) { |
| 259 |
//print the company details |
| 260 |
$companylogo = VikBooking::getSiteLogo(); |
| 261 |
$next_receipt = VikBooking::getNextReceiptNumber($row['id']); |
| 262 |
?> |
| 263 |
<div class="vbo-receipt-company-block-outer"> |
| 264 |
<div class="vbo-receipt-company-block"> |
| 265 |
<?php |
| 266 |
if (!empty($companylogo)) { |
| 267 |
?> |
| 268 |
<div class="vbo-receipt-company-logo"><img src="<?php echo VBO_ADMIN_URI.'resources/'.$companylogo; ?>" /></div> |
| 269 |
<?php |
| 270 |
} |
| 271 |
?> |
| 272 |
<div class="vbo-receipt-company-info"><?php echo VikBooking::getInvoiceCompanyInfo(); ?></div> |
| 273 |
</div> |
| 274 |
<div class="vbo-receipt-numdate-block"> |
| 275 |
<div class="vbo-receipt-numdate-inner"> |
| 276 |
<div class="vbo-receipt-numdate-title"> |
| 277 |
<span><?php echo JText::translate('VBOFISCRECEIPT'); ?></span> |
| 278 |
<span style="float: right; cursor: pointer; color: #ff0000;" onclick="vboMakePrintOnly();"><?php VikBookingIcons::e('times-circle'); ?></span> |
| 279 |
</div> |
| 280 |
<div class="vbo-receipt-numdate-num"> |
| 281 |
<span class="vbo-receipt-numdate-num-lbl"><?php echo JText::translate('VBOFISCRECEIPTNUM'); ?></span> |
| 282 |
<span class="vbo-receipt-numdate-num-val"> |
| 283 |
<span class="vbo-showin-print" id="vbo-receipt-num"><?php echo $next_receipt; ?></span> |
| 284 |
<input class="vbo-hidein-print" id="vbo-receipt-num-inp" type="number" min="0" value="<?php echo $next_receipt; ?>" onchange="document.getElementById('vbo-receipt-num').innerText = this.value;" /> |
| 285 |
</span> |
| 286 |
</div> |
| 287 |
<div class="vbo-receipt-numdate-date"> |
| 288 |
<span class="vbo-receipt-numdate-date-lbl"><?php echo JText::translate('VBOFISCRECEIPTDATE'); ?></span> |
| 289 |
<span class="vbo-receipt-numdate-date-val"><?php echo date(str_replace("/", $datesep, $df)); ?></span> |
| 290 |
</div> |
| 291 |
</div> |
| 292 |
</div> |
| 293 |
<div class="vbo-receipt-print-confirm vbo-hidein-print"> |
| 294 |
<div class="vbo-receipt-print-btn"> |
| 295 |
<span onclick="vboLaunchPrintReceipt();"> |
| 296 |
<?php VikBookingIcons::e('print'); ?> |
| 297 |
<span id="vbo-receipt-print-btn-name"><?php echo JText::translate('VBOPRINTRECEIPT'); ?></span> |
| 298 |
</span> |
| 299 |
</div> |
| 300 |
</div> |
| 301 |
</div> |
| 302 |
<?php |
| 303 |
} |
| 304 |
?> |
| 305 |
|
| 306 |
<div class="vbo-bookdet-container"> |
| 307 |
<div class="vbo-bookdet-wrap"> |
| 308 |
<div class="vbo-bookdet-head"> |
| 309 |
<span>ID</span> |
| 310 |
</div> |
| 311 |
<div class="vbo-bookdet-foot"> |
| 312 |
<span><?php echo $row['id']; ?></span> |
| 313 |
</div> |
| 314 |
</div> |
| 315 |
<div class="vbo-bookdet-wrap"> |
| 316 |
<div class="vbo-bookdet-head"> |
| 317 |
<span><?php echo JText::translate('VBEDITORDERONE'); ?></span> |
| 318 |
</div> |
| 319 |
<div class="vbo-bookdet-foot"> |
| 320 |
<span><?php echo date(str_replace("/", $datesep, $df).' H:i', $row['ts']); ?></span> |
| 321 |
</div> |
| 322 |
</div> |
| 323 |
<?php |
| 324 |
if (!$printreceipt && count($customer)) { |
| 325 |
?> |
| 326 |
<div class="vbo-bookdet-wrap"> |
| 327 |
<div class="vbo-bookdet-head"> |
| 328 |
<span><?php echo JText::translate('VBCUSTOMERNOMINATIVE'); ?></span> |
| 329 |
</div> |
| 330 |
<div class="vbo-bookdet-foot"> |
| 331 |
<div class="vbo-customer-info-box"> |
| 332 |
<div class="vbo-customer-info-box-name"> |
| 333 |
<?php echo (isset($customer['country_img']) ? $customer['country_img'] . ' ' : ''); ?> |
| 334 |
|
| 335 |
<?php if ($canDo->authorise('core.edit', 'com_vikbooking') && $canDo->authorise('core.vbo.management', 'com_vikbooking')): ?> |
| 336 |
<a href="index.php?option=com_vikbooking&task=editcustomer&cid[]=<?php echo $customer['id']; ?>&goto=<?php echo base64_encode($gotouri); ?>"><?php echo ltrim($customer['first_name'] . ' ' . $customer['last_name']); ?></a> |
| 337 |
<?php else: ?> |
| 338 |
<?php echo ltrim($customer['first_name'] . ' ' . $customer['last_name']); ?> |
| 339 |
<?php endif; ?> |
| 340 |
</div> |
| 341 |
<?php |
| 342 |
if (!empty($customer['pic'])) { |
| 343 |
$avatar_caption = ltrim($customer['first_name'] . ' ' . $customer['last_name']); |
| 344 |
?> |
| 345 |
<div class="vbo-customer-info-box-avatar vbo-customer-avatar-small"> |
| 346 |
<span> |
| 347 |
<img src="<?php echo strpos($customer['pic'], 'http') === 0 ? $customer['pic'] : VBO_SITE_URI . 'resources/uploads/' . $customer['pic']; ?>" data-caption="<?php echo htmlspecialchars($avatar_caption); ?>" /> |
| 348 |
</span> |
| 349 |
</div> |
| 350 |
<?php |
| 351 |
} |
| 352 |
?> |
| 353 |
</div> |
| 354 |
</div> |
| 355 |
</div> |
| 356 |
<?php |
| 357 |
} |
| 358 |
if (!$printreceipt) { |
| 359 |
?> |
| 360 |
<div class="vbo-bookdet-wrap"> |
| 361 |
<div class="vbo-bookdet-head"> |
| 362 |
<span><?php echo JText::translate('VBEDITORDERROOMSNUM'); ?></span> |
| 363 |
</div> |
| 364 |
<div class="vbo-bookdet-foot"> |
| 365 |
<?php echo $row['roomsnum']; ?> |
| 366 |
</div> |
| 367 |
</div> |
| 368 |
<?php |
| 369 |
} |
| 370 |
?> |
| 371 |
<div class="vbo-bookdet-wrap"> |
| 372 |
<div class="vbo-bookdet-head"> |
| 373 |
<span><?php echo JText::translate('VBEDITORDERFOUR'); ?></span> |
| 374 |
</div> |
| 375 |
<div class="vbo-bookdet-foot"> |
| 376 |
<span><?php echo $row['days']; ?></span> |
| 377 |
<?php |
| 378 |
if ($row['split_stay']) { |
| 379 |
?> |
| 380 |
<span class="hasTooltip" title="<?php echo JHtml::fetch('esc_attr', JText::translate('VBO_SPLIT_STAY')); ?>"><?php VikBookingIcons::e('random'); ?></span> |
| 381 |
<?php |
| 382 |
} |
| 383 |
?> |
| 384 |
</div> |
| 385 |
</div> |
| 386 |
<div class="vbo-bookdet-wrap"> |
| 387 |
<div class="vbo-bookdet-head"> |
| 388 |
<span><?php echo JText::translate('VBEDITORDERFIVE'); ?></span> |
| 389 |
</div> |
| 390 |
<div class="vbo-bookdet-foot"> |
| 391 |
<?php |
| 392 |
$checkin_info = getdate($row['checkin']); |
| 393 |
$short_wday = JText::translate('VB'.strtoupper(substr($checkin_info['weekday'], 0, 3))); |
| 394 |
?> |
| 395 |
<?php echo $short_wday.', '.date(str_replace("/", $datesep, $df).' H:i', $row['checkin']); ?> |
| 396 |
</div> |
| 397 |
</div> |
| 398 |
<div class="vbo-bookdet-wrap"> |
| 399 |
<div class="vbo-bookdet-head"> |
| 400 |
<span><?php echo JText::translate('VBEDITORDERSIX'); ?></span> |
| 401 |
</div> |
| 402 |
<div class="vbo-bookdet-foot"> |
| 403 |
<?php |
| 404 |
$checkout_info = getdate($row['checkout']); |
| 405 |
$short_wday = JText::translate('VB'.strtoupper(substr($checkout_info['weekday'], 0, 3))); |
| 406 |
?> |
| 407 |
<?php echo $short_wday.', '.date(str_replace("/", $datesep, $df).' H:i', $row['checkout']); ?> |
| 408 |
</div> |
| 409 |
</div> |
| 410 |
<?php |
| 411 |
if (!$printreceipt && $vbo_auth_bookings && $row['closure'] != 1 && $row['status'] == 'confirmed') { |
| 412 |
// we don't need to check in the IF above "&& $row['checked'] != 0" because the registration is useful for all bookings. |
| 413 |
$checked_btn = 'btn-primary'; |
| 414 |
switch ($row['checked']) { |
| 415 |
case -1: |
| 416 |
$checked_status = JText::translate('VBOCHECKEDSTATUSNOS'); |
| 417 |
$checked_btn = 'btn-danger'; |
| 418 |
break; |
| 419 |
case 1: |
| 420 |
$checked_status = JText::translate('VBOCHECKEDSTATUSIN'); |
| 421 |
$checked_btn = 'btn-success'; |
| 422 |
break; |
| 423 |
case 2: |
| 424 |
$checked_status = JText::translate('VBOCHECKEDSTATUSOUT'); |
| 425 |
$checked_btn = 'btn-warning'; |
| 426 |
break; |
| 427 |
default: |
| 428 |
$checked_status = JText::translate('VBOCHECKEDSTATUSZERO'); |
| 429 |
if (count($customer) && isset($customer['pax_data']) && !empty($customer['pax_data'])) { |
| 430 |
// pre check-in performed via front-end |
| 431 |
$checked_status = JText::translate('VBOCHECKEDSTATUSPRECHECKIN'); |
| 432 |
} |
| 433 |
break; |
| 434 |
} |
| 435 |
?> |
| 436 |
<div class="vbo-bookdet-wrap pro-feature"> |
| 437 |
<div class="vbo-bookdet-head"> |
| 438 |
<span><?php echo JText::translate('VBOCHECKEDSTATUS'); ?></span> |
| 439 |
</div> |
| 440 |
<div class="vbo-bookdet-foot"> |
| 441 |
<button type="button" class="btn btn-small <?php echo $checked_btn; ?>" onclick="vboOpenJModal('vbo-checkin-booking', 'index.php?option=com_vikbooking&task=bookingcheckin&cid[]=<?php echo $row['id']; ?>&tmpl=component');"> |
| 442 |
<?php echo $checked_status; ?> |
| 443 |
</button> |
| 444 |
</div> |
| 445 |
</div> |
| 446 |
<?php |
| 447 |
//Prepare modal (Registration) |
| 448 |
array_push($vbo_modals_html, $vbo_app->getJmodalHtml('vbo-checkin-booking', JText::translate('VBOMANAGECHECKSINOUT'))); |
| 449 |
//end Prepare modal |
| 450 |
} |
| 451 |
|
| 452 |
/** |
| 453 |
* Check whether the booking can be refunded. |
| 454 |
* |
| 455 |
* @since 1.14 (J) - 1.4.0 (WP) |
| 456 |
*/ |
| 457 |
|
| 458 |
// refundable up to 7 days after check-out day |
| 459 |
$max_refund_ts = mktime(23, 59, 59, $checkout_info['mon'], ($checkout_info['mday'] + 7), $checkout_info['year']); |
| 460 |
// current payment driver must be set |
| 461 |
$tn_driver = is_array($payment) ? $payment['file'] : null; |
| 462 |
// transaction data validation callback |
| 463 |
$tn_data_callback = function($data) use ($tn_driver) { |
| 464 |
return (is_object($data) && isset($data->driver) && basename($data->driver, '.php') == basename($tn_driver, '.php')); |
| 465 |
}; |
| 466 |
$prev_tn_data = $history_obj->getEventsWithData(array('P0', 'PN'), $tn_data_callback); |
| 467 |
$refundable = ($row['status'] != 'standby' && $max_refund_ts >= time() && is_array($prev_tn_data) && count($prev_tn_data)); |
| 468 |
if ($refundable) { |
| 469 |
// prepare modal (refundtn) with a custom function to trigger the opening |
| 470 |
array_push($vbo_modals_html, $vbo_app->getJmodalHtml('vbo-refund-tn', JText::translate('VBO_ISSUE_REFUND'))); |
| 471 |
echo $vbo_app->getJmodalScript('Refund', 'vboDetectRefundChanges();'); |
| 472 |
// count the number of refunds made |
| 473 |
$refunds = $history_obj->getEventsWithData('RF', null, false); |
| 474 |
$refunds = !is_array($refunds) ? array() : $refunds; |
| 475 |
?> |
| 476 |
<script type="text/javascript"> |
| 477 |
var vbo_refund_performed = false; |
| 478 |
function vboDetectRefundChanges() { |
| 479 |
if (vbo_refund_performed === true) { |
| 480 |
location.reload(); |
| 481 |
} |
| 482 |
} |
| 483 |
</script> |
| 484 |
|
| 485 |
<div class="vbo-bookdet-wrap"> |
| 486 |
<div class="vbo-bookdet-head"> |
| 487 |
<span><?php echo JText::translate('VBO_ISSUE_REFUND'); ?></span> |
| 488 |
</div> |
| 489 |
<div class="vbo-bookdet-foot"> |
| 490 |
<button type="button" class="btn btn-small btn-danger vbo-dorefund-btn"<?php echo count($refunds) ? ' data-totrefunds="' . count($refunds) . '"' : ''; ?> onclick="vboOpenJModalRefund('vbo-refund-tn', 'index.php?option=com_vikbooking&task=refundtn&cid[]=<?php echo $row['id']; ?>&tmpl=component');"> |
| 491 |
<?php echo JText::translate('VBO_REFUND'); ?> |
| 492 |
</button> |
| 493 |
</div> |
| 494 |
</div> |
| 495 |
<?php |
| 496 |
} |
| 497 |
// |
| 498 |
|
| 499 |
if (!$printreceipt && !empty($row['channel'])) { |
| 500 |
$ota_logo_img = VikBooking::getVcmChannelsLogo($row['channel']); |
| 501 |
if ($ota_logo_img === false) { |
| 502 |
$ota_logo_img = $otachannel_name; |
| 503 |
} else { |
| 504 |
$ota_logo_img = '<img src="'.$ota_logo_img.'" class="vbo-channelimg-medium"/>'; |
| 505 |
} |
| 506 |
?> |
| 507 |
<div class="vbo-bookdet-wrap"> |
| 508 |
<div class="vbo-bookdet-head"> |
| 509 |
<span><?php echo JText::translate('VBPVIEWORDERCHANNEL'); ?></span> |
| 510 |
</div> |
| 511 |
<div class="vbo-bookdet-foot"> |
| 512 |
<span><?php echo $ota_logo_img; ?></span> |
| 513 |
</div> |
| 514 |
</div> |
| 515 |
<?php |
| 516 |
} elseif (!$printreceipt && class_exists('VCMOtaBooking')) { |
| 517 |
/** |
| 518 |
* Vik Channel Manager booking assignable channels. |
| 519 |
* |
| 520 |
* @since 1.16.3 (J) - 1.6.3 (WP) |
| 521 |
*/ |
| 522 |
$assignable_channels = VCMOtaBooking::getInstance($row, true)->getChannelsAssignable(); |
| 523 |
if ($assignable_channels) { |
| 524 |
JText::script('VBO_ASSIGN_BOOKING_TO_OTA_CONFIRM'); |
| 525 |
JFactory::getDocument()->addScriptDeclaration( |
| 526 |
<<<JS |
| 527 |
function vboConfirmAssignChannel(ch_key, ch_name) { |
| 528 |
if (!ch_key || !ch_name) { |
| 529 |
return true; |
| 530 |
} |
| 531 |
if (confirm(Joomla.JText._('VBO_ASSIGN_BOOKING_TO_OTA_CONFIRM').replace('%s', ch_name))) { |
| 532 |
document.adminForm.submit(); |
| 533 |
return true; |
| 534 |
} else { |
| 535 |
return false; |
| 536 |
} |
| 537 |
} |
| 538 |
JS |
| 539 |
); |
| 540 |
?> |
| 541 |
<div class="vbo-bookdet-wrap"> |
| 542 |
<div class="vbo-bookdet-head"> |
| 543 |
<span><?php echo JText::translate('VBPVIEWORDERCHANNEL'); ?></span> |
| 544 |
</div> |
| 545 |
<div class="vbo-bookdet-foot"> |
| 546 |
<select name="vcm_assign_channel" class="vbo-select-small" onchange="return vboConfirmAssignChannel(this.value, this.options[this.selectedIndex].text);"> |
| 547 |
<option value=""><?php echo JText::translate('VBORDFROMSITE'); ?></option> |
| 548 |
<?php |
| 549 |
foreach ($assignable_channels as $assign_ch_key => $assign_ch_name) { |
| 550 |
?> |
| 551 |
<option value="<?php echo JHtml::fetch('esc_attr', $assign_ch_key); ?>"><?php echo $assign_ch_name; ?></option> |
| 552 |
<?php |
| 553 |
} |
| 554 |
?> |
| 555 |
</select> |
| 556 |
</div> |
| 557 |
</div> |
| 558 |
<?php |
| 559 |
} |
| 560 |
} |
| 561 |
if (!$printreceipt) { |
| 562 |
?> |
| 563 |
<div class="vbo-bookdet-wrap"> |
| 564 |
<div class="vbo-bookdet-head"> |
| 565 |
<span><?php echo JText::translate('VBSTATUS'); ?></span> |
| 566 |
</div> |
| 567 |
<div class="vbo-bookdet-foot"> |
| 568 |
<span><?php echo $saystaus; ?></span> |
| 569 |
</div> |
| 570 |
</div> |
| 571 |
<?php |
| 572 |
if (is_array($this->vcm_pre_approval)) { |
| 573 |
?> |
| 574 |
<div class="vbo-bookdet-wrap"> |
| 575 |
<div class="vbo-bookdet-head"> |
| 576 |
<span><?php echo $this->vcm_pre_approval[1]; ?></span> |
| 577 |
</div> |
| 578 |
<div class="vbo-bookdet-foot"> |
| 579 |
<span> |
| 580 |
<?php |
| 581 |
if (empty($this->vcm_pre_approval[2]) || !empty($this->vcm_pre_approval[3])) { |
| 582 |
// no pre-approvals before, or withdrawn before |
| 583 |
?> |
| 584 |
<a href="index.php?option=com_vikchannelmanager&task=sendSpecialOffer&vbo_oid=<?php echo $row['id']; ?>&spo_type=preapproval&spo_action=send&ota_thread_id=<?php echo $this->vcm_pre_approval[0]; ?>" class="btn btn-small btn-primary vcm-btn-channel-<?php echo strtolower($this->vcm_pre_approval[1]); ?>"><?php VikBookingIcons::e('thumbs-up'); ?> <?php echo JText::translate('VBO_PREAPPROVE_INQUIRY'); ?></a> |
| 585 |
<?php |
| 586 |
} else { |
| 587 |
// pre-approved before, pass the ID |
| 588 |
?> |
| 589 |
<a href="index.php?option=com_vikchannelmanager&task=sendSpecialOffer&vbo_oid=<?php echo $row['id']; ?>&spo_type=preapproval&spo_action=withdraw&ota_thread_id=<?php echo $this->vcm_pre_approval[0]; ?>&spo_id=<?php echo $this->vcm_pre_approval[2]; ?>" class="btn btn-small btn-danger"><?php VikBookingIcons::e('thumbs-down'); ?> <?php echo JText::translate('VBO_WITHDRAW_PREAPPROVAL'); ?></a> |
| 590 |
<?php |
| 591 |
} |
| 592 |
?> |
| 593 |
</span> |
| 594 |
</div> |
| 595 |
</div> |
| 596 |
<?php |
| 597 |
} |
| 598 |
if (!empty($row['channel']) && stripos($row['channel'], 'booking.com') !== false && $row['checkin'] <= time() && strtotime('+ 7 days', $row['checkout']) >= time()) { |
| 599 |
/** |
| 600 |
* Guest misconduct reporting API for Booking.com. |
| 601 |
* Only after reservation check-in date and no later than 7 days after check-out date. |
| 602 |
* |
| 603 |
* @since 1.13.5 - VCM 1.7.2 |
| 604 |
*/ |
| 605 |
$misconduct_reported = $history_obj->hasEvent('GM'); |
| 606 |
?> |
| 607 |
<div class="vbo-bookdet-wrap"> |
| 608 |
<div class="vbo-bookdet-head"> |
| 609 |
<span><?php echo JText::translate('VBOGUESTMISCONDUCT'); ?></span> |
| 610 |
</div> |
| 611 |
<div class="vbo-bookdet-foot"> |
| 612 |
<?php |
| 613 |
if ($misconduct_reported === false) { |
| 614 |
// allow to report the guest misconduct |
| 615 |
?> |
| 616 |
<button type="button" class="btn btn-small btn-danger" onclick="vboRenderGuestMisconduct();"><?php VikBookingIcons::e('user-slash'); ?> <?php echo JText::translate('VBOREPORTMISCONDUCT'); ?></button> |
| 617 |
<?php |
| 618 |
} else { |
| 619 |
// guest misconduct already reported |
| 620 |
?> |
| 621 |
<button type="button" class="btn btn-small btn-warning" onclick="vboShowGuestMisconductReported();"><?php VikBookingIcons::e('user-slash'); ?> <?php echo $misconduct_reported; ?></button> |
| 622 |
<?php |
| 623 |
} |
| 624 |
?> |
| 625 |
<a id="vbo-gm-reloadlink" style="display: none;" href="index.php?option=com_vikbooking&task=editorder&cid[]=<?php echo $row['id']; ?>"></a> |
| 626 |
</div> |
| 627 |
|
| 628 |
<div class="vbo-modal-overlay-block vbo-modal-overlay-block-guestmisconduct"> |
| 629 |
<a class="vbo-modal-overlay-close" href="javascript: void(0);"></a> |
| 630 |
<div class="vbo-modal-overlay-content vbo-modal-overlay-content-guestmisconduct"> |
| 631 |
<div class="vbo-modal-overlay-content-head vbo-modal-overlay-content-head-guestmisconduct"> |
| 632 |
<h3><?php VikBookingIcons::e('exclamation-circle'); ?> <?php echo JText::sprintf('VBOREPGUESTMISCONDUCTTO', 'Booking.com'); ?> <span class="vbo-modal-overlay-close-times" onclick="hideVboDialogGuestMisconduct();">×</span></h3> |
| 633 |
</div> |
| 634 |
<div class="vbo-modal-overlay-content-body"> |
| 635 |
<div class="vbo-modal-guestmisconduct-addnew" data-bid="<?php echo $row['id']; ?>" data-otabid="<?php echo $row['idorderota']; ?>"> |
| 636 |
<div class="vbo-modal-guestmisconduct-report-elems"></div> |
| 637 |
<div class="vbo-modal-guestmisconduct-addnew-save"> |
| 638 |
<button type="button" id="vbo-guest-misconduct-submit-btn" class="btn btn-success" onclick="vboSubmitGuestMisconduct();" style="display: none;"><?php echo JText::translate('VBCHANNELMANAGERSENDRQ'); ?></button> |
| 639 |
<button type="button" class="btn btn-secondary" onclick="hideVboDialogGuestMisconduct();"><?php echo JText::translate('VBOCLOSE'); ?></button> |
| 640 |
</div> |
| 641 |
</div> |
| 642 |
</div> |
| 643 |
</div> |
| 644 |
</div> |
| 645 |
|
| 646 |
<script type="text/javascript"> |
| 647 |
var vbodialogguestmisconduct_on = false; |
| 648 |
var vbo_guest_misconduct_fields = new Array; |
| 649 |
|
| 650 |
function vboShowGuestMisconductReported() { |
| 651 |
// this is like simulating the navigation to the booking history tab |
| 652 |
jQuery(".vbo-bookingdet-tab[data-vbotab='vbo-tab-admin']").trigger('click'); |
| 653 |
vbToggleHistory(document.getElementById('vbo-trig-bookhistory')); |
| 654 |
} |
| 655 |
|
| 656 |
function vboRenderGuestMisconduct() { |
| 657 |
// empty content |
| 658 |
jQuery('.vbo-modal-guestmisconduct-report-elems').html('<?php echo $this->escape(JText::translate('VIKLOADING') . '...'); ?>'); |
| 659 |
vbo_guest_misconduct_fields = new Array; |
| 660 |
|
| 661 |
// display modal |
| 662 |
jQuery('.vbo-modal-overlay-block-guestmisconduct').fadeIn(); |
| 663 |
vbodialogguestmisconduct_on = true; |
| 664 |
|
| 665 |
// make AJAX request to VCM to always reload the form fields |
| 666 |
VBOCore.doAjax( |
| 667 |
"<?php echo VikBooking::ajaxUrl('index.php?option=com_vikchannelmanager&task=get_bcom_misconduct_categories'); ?>", |
| 668 |
{ |
| 669 |
tmpl: "component" |
| 670 |
}, |
| 671 |
(res) => { |
| 672 |
// parse the JSON response that contains the categories object with all fields for the reporting |
| 673 |
try { |
| 674 |
var misconduct_fields_rs = JSON.parse(res); |
| 675 |
|
| 676 |
// make sure the request was successful |
| 677 |
if (!misconduct_fields_rs.status) { |
| 678 |
alert(misconduct_fields_rs.error); |
| 679 |
hideVboDialogGuestMisconduct(); |
| 680 |
return false; |
| 681 |
} |
| 682 |
|
| 683 |
// render form from response obtained |
| 684 |
var misconduct_html = ''; |
| 685 |
var misconduct_fields = misconduct_fields_rs.data; |
| 686 |
if (!misconduct_fields.hasOwnProperty('categories') || !misconduct_fields.hasOwnProperty('fields')) { |
| 687 |
alert('Unexptected response. Vik Channel Manager needs to be installed, configured and updated to the latest version.'); |
| 688 |
hideVboDialogGuestMisconduct(); |
| 689 |
return false; |
| 690 |
} |
| 691 |
|
| 692 |
// main category of misconduct |
| 693 |
misconduct_html += '<div class="vbo-modal-form-addnew-elem vbo-modal-guestmisconduct-addnew-elem">' + "\n"; |
| 694 |
misconduct_html += '<label for="vbo-gm-category">' + misconduct_fields['labels']['category'] + '</label>'; |
| 695 |
misconduct_html += '<select id="vbo-gm-category" data-gmname="category_id" onchange="vboGuestMisconductChangeCategory(this.value);">' + "\n"; |
| 696 |
for (var category in misconduct_fields['categories']) { |
| 697 |
if (!misconduct_fields['categories'].hasOwnProperty(category)) { |
| 698 |
continue; |
| 699 |
} |
| 700 |
misconduct_html += '<option value="' + misconduct_fields['categories'][category]['id'] + '">' + misconduct_fields['categories'][category]['title'] + '</option>' + "\n"; |
| 701 |
} |
| 702 |
misconduct_html += '</select>' + "\n"; |
| 703 |
misconduct_html += '</div>' + "\n"; |
| 704 |
// push category field in fields list for later submit |
| 705 |
vbo_guest_misconduct_fields.push('vbo-gm-category'); |
| 706 |
|
| 707 |
// sub-categories or additional fields of misconduct categories |
| 708 |
for (var category in misconduct_fields['categories']) { |
| 709 |
if (!misconduct_fields['categories'].hasOwnProperty(category)) { |
| 710 |
continue; |
| 711 |
} |
| 712 |
if (!misconduct_fields['categories'][category].hasOwnProperty('subcategories') && !misconduct_fields['categories'][category].hasOwnProperty('additional_fields')) { |
| 713 |
// at least one of these two properties must be set |
| 714 |
continue; |
| 715 |
} |
| 716 |
if (misconduct_fields['categories'][category].hasOwnProperty('subcategories') && misconduct_fields['categories'][category]['subcategories'].length) { |
| 717 |
// sub-categories in drop down |
| 718 |
var subcat_field_id = 'vbo-gm-subcategory' + misconduct_fields['categories'][category]['id']; |
| 719 |
misconduct_html += '<div class="vbo-modal-form-addnew-elem vbo-modal-guestmisconduct-addnew-elem vbo-modal-guestmisconduct-addnew-cond" data-gmcid="' + misconduct_fields['categories'][category]['id'] + '" style="display: none;">' + "\n"; |
| 720 |
misconduct_html += '<label for="' + subcat_field_id + '">' + misconduct_fields['labels']['subcategory'] + '</label>'; |
| 721 |
misconduct_html += '<select id="' + subcat_field_id + '" data-gmname="subcategory_id">' + "\n"; |
| 722 |
for (var subcategory in misconduct_fields['categories'][category]['subcategories']) { |
| 723 |
if (!misconduct_fields['categories'][category]['subcategories'].hasOwnProperty(subcategory)) { |
| 724 |
continue; |
| 725 |
} |
| 726 |
misconduct_html += '<option value="' + misconduct_fields['categories'][category]['subcategories'][subcategory]['id'] + '">' + misconduct_fields['categories'][category]['subcategories'][subcategory]['title'] + '</option>' + "\n"; |
| 727 |
} |
| 728 |
misconduct_html += '</select>' + "\n"; |
| 729 |
misconduct_html += '</div>' + "\n"; |
| 730 |
// push sub-category field in fields list for later submit |
| 731 |
if (vbo_guest_misconduct_fields.indexOf(subcat_field_id) < 0) { |
| 732 |
vbo_guest_misconduct_fields.push(subcat_field_id); |
| 733 |
} |
| 734 |
} else if (misconduct_fields['categories'][category].hasOwnProperty('additional_fields') && misconduct_fields['categories'][category]['additional_fields'].length) { |
| 735 |
// additional fields |
| 736 |
for (var extra_field in misconduct_fields['categories'][category]['additional_fields']) { |
| 737 |
if (!misconduct_fields['categories'][category]['additional_fields'].hasOwnProperty(extra_field)) { |
| 738 |
continue; |
| 739 |
} |
| 740 |
var field_id = 'vbo-gm-extrafield-' + misconduct_fields['categories'][category]['additional_fields'][extra_field]['name']; |
| 741 |
var field_name = misconduct_fields['categories'][category]['additional_fields'][extra_field]['name']; |
| 742 |
misconduct_html += '<div class="vbo-modal-form-addnew-elem vbo-modal-guestmisconduct-addnew-elem vbo-modal-guestmisconduct-addnew-cond" data-gmcid="' + misconduct_fields['categories'][category]['id'] + '" style="display: none;">' + "\n"; |
| 743 |
misconduct_html += '<label for="' + field_id + '">' + misconduct_fields['categories'][category]['additional_fields'][extra_field]['label'] + '</label>'; |
| 744 |
if (misconduct_fields['categories'][category]['additional_fields'][extra_field]['type'] == 'number') { |
| 745 |
misconduct_html += '<input data-gmname="' + field_name + '" type="number" id="' + field_id + '" value="" step="any" min="0" />'; |
| 746 |
} else if (misconduct_fields['categories'][category]['additional_fields'][extra_field]['type'] == 'text') { |
| 747 |
misconduct_html += '<input data-gmname="' + field_name + '" type="text" id="' + field_id + '" value="" />'; |
| 748 |
} else if (misconduct_fields['categories'][category]['additional_fields'][extra_field]['type'] == 'text') { |
| 749 |
misconduct_html += '<input data-gmname="' + field_name + '" type="text" id="' + field_id + '" value="" />'; |
| 750 |
} else if (misconduct_fields['categories'][category]['additional_fields'][extra_field]['type'] == 'textarea') { |
| 751 |
misconduct_html += '<textarea data-gmname="' + field_name + '" id="' + field_id + '" rows="5" cols="50" maxlength="240"></textarea>'; |
| 752 |
} else if (misconduct_fields['categories'][category]['additional_fields'][extra_field]['type'] == 'select') { |
| 753 |
misconduct_html += '<select data-gmname="' + field_name + '" id="' + field_id + '">'; |
| 754 |
for (var choicekey in misconduct_fields['categories'][category]['additional_fields'][extra_field]['choices']) { |
| 755 |
// this is either an array when keys are numeric from 0, or an object when keys start from like 1, but with choicekey we take the proper key in the object |
| 756 |
if (!misconduct_fields['categories'][category]['additional_fields'][extra_field]['choices'].hasOwnProperty(choicekey)) { |
| 757 |
continue; |
| 758 |
} |
| 759 |
misconduct_html += '<option value="' + choicekey + '">' + misconduct_fields['categories'][category]['additional_fields'][extra_field]['choices'][choicekey] + '</option>'; |
| 760 |
} |
| 761 |
misconduct_html += '</select>'; |
| 762 |
} |
| 763 |
misconduct_html += '</div>' + "\n"; |
| 764 |
// push additional field in fields list for later submit |
| 765 |
vbo_guest_misconduct_fields.push(field_id); |
| 766 |
} |
| 767 |
} |
| 768 |
} |
| 769 |
|
| 770 |
// mandatory fields for all categories of guest misconduct reporting |
| 771 |
for (var mandfield in misconduct_fields['fields']) { |
| 772 |
if (!misconduct_fields['fields'].hasOwnProperty(mandfield)) { |
| 773 |
continue; |
| 774 |
} |
| 775 |
var field_id = 'vbo-gm-mandfield-' + misconduct_fields['fields'][mandfield]['name']; |
| 776 |
var field_name = misconduct_fields['fields'][mandfield]['name']; |
| 777 |
misconduct_html += '<div class="vbo-modal-form-addnew-elem vbo-modal-guestmisconduct-addnew-elem">' + "\n"; |
| 778 |
misconduct_html += '<label for="' + field_id + '">' + misconduct_fields['fields'][mandfield]['label'] + '</label>'; |
| 779 |
if (misconduct_fields['fields'][mandfield]['type'] == 'number') { |
| 780 |
misconduct_html += '<input data-gmname="' + field_name + '" type="number" id="' + field_id + '" value="" step="any" min="0" />'; |
| 781 |
} else if (misconduct_fields['fields'][mandfield]['type'] == 'text') { |
| 782 |
misconduct_html += '<input data-gmname="' + field_name + '" type="text" id="' + field_id + '" value="" />'; |
| 783 |
} else if (misconduct_fields['fields'][mandfield]['type'] == 'text') { |
| 784 |
misconduct_html += '<input data-gmname="' + field_name + '" type="text" id="' + field_id + '" value="" />'; |
| 785 |
} else if (misconduct_fields['fields'][mandfield]['type'] == 'textarea') { |
| 786 |
misconduct_html += '<textarea data-gmname="' + field_name + '" id="' + field_id + '" rows="5" cols="50" maxlength="240"></textarea>'; |
| 787 |
} else if (misconduct_fields['fields'][mandfield]['type'] == 'select') { |
| 788 |
misconduct_html += '<select data-gmname="' + field_name + '" id="' + field_id + '">'; |
| 789 |
for (var choicekey in misconduct_fields['fields'][mandfield]['choices']) { |
| 790 |
if (!misconduct_fields['fields'][mandfield]['choices'].hasOwnProperty(choicekey)) { |
| 791 |
continue; |
| 792 |
} |
| 793 |
misconduct_html += '<option value="' + choicekey + '">' + misconduct_fields['fields'][mandfield]['choices'][choicekey] + '</option>'; |
| 794 |
} |
| 795 |
misconduct_html += '</select>'; |
| 796 |
} |
| 797 |
misconduct_html += '</div>' + "\n"; |
| 798 |
// push mandatory field in fields list for later submit |
| 799 |
vbo_guest_misconduct_fields.push(field_id); |
| 800 |
} |
| 801 |
|
| 802 |
// display HTML content and submit button |
| 803 |
jQuery('.vbo-modal-guestmisconduct-report-elems').html(misconduct_html); |
| 804 |
jQuery('#vbo-guest-misconduct-submit-btn').show(); |
| 805 |
// trigger change of main category drop down |
| 806 |
jQuery('#vbo-gm-category').trigger('change'); |
| 807 |
} catch (e) { |
| 808 |
console.log(res); |
| 809 |
alert('Invalid response. Vik Channel Manager needs to be installed, configured and updated to the latest version.'); |
| 810 |
hideVboDialogGuestMisconduct(); |
| 811 |
return false; |
| 812 |
} |
| 813 |
}, |
| 814 |
(err) => { |
| 815 |
hideVboDialogGuestMisconduct(); |
| 816 |
alert('Request failed. Vik Channel Manager needs to be installed, configured and updated to the latest version.'); |
| 817 |
} |
| 818 |
); |
| 819 |
} |
| 820 |
|
| 821 |
function vboSubmitGuestMisconduct() { |
| 822 |
if (!vbo_guest_misconduct_fields.length) { |
| 823 |
alert('Empty data to submit. Vik Channel Manager needs to be installed, configured and updated to the latest version.'); |
| 824 |
return false; |
| 825 |
} |
| 826 |
|
| 827 |
// prevent double submissions |
| 828 |
vboGuestMisconductDisableSubmit(); |
| 829 |
// |
| 830 |
|
| 831 |
var submit_fields = { |
| 832 |
tmpl: "component", |
| 833 |
bid: jQuery('.vbo-modal-guestmisconduct-addnew').attr('data-bid'), |
| 834 |
otabid: jQuery('.vbo-modal-guestmisconduct-addnew').attr('data-otabid'), |
| 835 |
bcom_keys: new Array |
| 836 |
}; |
| 837 |
for (var elemid in vbo_guest_misconduct_fields) { |
| 838 |
if (!vbo_guest_misconduct_fields.hasOwnProperty(elemid)) { |
| 839 |
continue; |
| 840 |
} |
| 841 |
if (!jQuery('#' + vbo_guest_misconduct_fields[elemid]).length || !jQuery('#' + vbo_guest_misconduct_fields[elemid]).closest('.vbo-modal-guestmisconduct-addnew-elem').length) { |
| 842 |
// form element not found, or parent container not found |
| 843 |
continue; |
| 844 |
} |
| 845 |
if (jQuery('#' + vbo_guest_misconduct_fields[elemid]).closest('.vbo-modal-guestmisconduct-addnew-elem').is(':visible')) { |
| 846 |
// we include this value in the AJAX request |
| 847 |
var field_name = jQuery('#' + vbo_guest_misconduct_fields[elemid]).attr('data-gmname'); |
| 848 |
var submit_key = 'bcom_' + field_name; |
| 849 |
submit_fields[submit_key] = jQuery('#' + vbo_guest_misconduct_fields[elemid]).val(); |
| 850 |
submit_fields['bcom_keys'].push(submit_key); |
| 851 |
} |
| 852 |
} |
| 853 |
|
| 854 |
// make the AJAX request to VCM |
| 855 |
var jqxhr = jQuery.ajax({ |
| 856 |
type: "POST", |
| 857 |
url: "<?php echo VikBooking::ajaxUrl('index.php?option=com_vikchannelmanager&task=submit_bcom_guestmisconduct'); ?>", |
| 858 |
data: submit_fields |
| 859 |
}).done(function(res) { |
| 860 |
try { |
| 861 |
var misconduct_rs = JSON.parse(res); |
| 862 |
console.log(submit_fields, misconduct_rs); |
| 863 |
|
| 864 |
// make sure the request was successful |
| 865 |
if (!misconduct_rs.status) { |
| 866 |
alert(misconduct_rs.error); |
| 867 |
vboGuestMisconductEnableSubmit(); |
| 868 |
return false; |
| 869 |
} |
| 870 |
|
| 871 |
// make another AJAX request (now on VBO) to update the booking history |
| 872 |
var event_descr = jQuery('#vbo-gm-mandfield-details_text').length ? jQuery('#vbo-gm-mandfield-details_text').val() : ''; |
| 873 |
jQuery.ajax({ |
| 874 |
type: "POST", |
| 875 |
url: "<?php echo VikBooking::ajaxUrl('index.php?option=com_vikbooking&task=store_booking_history_event'); ?>", |
| 876 |
data: { |
| 877 |
tmpl: "component", |
| 878 |
bid: jQuery('.vbo-modal-guestmisconduct-addnew').attr('data-bid'), |
| 879 |
event: 'GM', |
| 880 |
descr: event_descr |
| 881 |
} |
| 882 |
}).done(function(res) { |
| 883 |
// just reload the page in case of success |
| 884 |
document.location.href = jQuery('#vbo-gm-reloadlink').attr('href'); |
| 885 |
}).fail(function() { |
| 886 |
// we reload the page even in case of failure |
| 887 |
document.location.href = jQuery('#vbo-gm-reloadlink').attr('href'); |
| 888 |
}); |
| 889 |
} catch (e) { |
| 890 |
console.log(res); |
| 891 |
alert('Invalid update response. Vik Channel Manager needs to be installed, configured and updated to the latest version.'); |
| 892 |
vboGuestMisconductEnableSubmit(); |
| 893 |
hideVboDialogGuestMisconduct(); |
| 894 |
return false; |
| 895 |
} |
| 896 |
}).fail(function() { |
| 897 |
alert('Update Request failed. Vik Channel Manager needs to be installed, configured and updated to the latest version.'); |
| 898 |
vboGuestMisconductEnableSubmit(); |
| 899 |
return false; |
| 900 |
}); |
| 901 |
} |
| 902 |
|
| 903 |
function hideVboDialogGuestMisconduct() { |
| 904 |
if (vbodialogguestmisconduct_on === true) { |
| 905 |
jQuery(".vbo-modal-overlay-block-guestmisconduct").fadeOut(400, function () { |
| 906 |
jQuery(".vbo-modal-overlay-content-guestmisconduct").show(); |
| 907 |
}); |
| 908 |
// turn flag off |
| 909 |
vbodialogguestmisconduct_on = false; |
| 910 |
} |
| 911 |
} |
| 912 |
|
| 913 |
function vboGuestMisconductChangeCategory(gmcid) { |
| 914 |
jQuery('.vbo-modal-guestmisconduct-addnew-cond').each(function() { |
| 915 |
if (jQuery(this).attr('data-gmcid') == gmcid) { |
| 916 |
jQuery(this).show(); |
| 917 |
} else { |
| 918 |
jQuery(this).hide(); |
| 919 |
} |
| 920 |
}); |
| 921 |
} |
| 922 |
|
| 923 |
function vboGuestMisconductDisableSubmit() { |
| 924 |
jQuery('#vbo-guest-misconduct-submit-btn').prepend('<i class="<?php echo VikBookingIcons::i('refresh', 'fa-spin fa-fw'); ?>"></i> ').prop('disabled', true); |
| 925 |
} |
| 926 |
|
| 927 |
function vboGuestMisconductEnableSubmit() { |
| 928 |
jQuery('#vbo-guest-misconduct-submit-btn').prop('disabled', false).find('i').remove(); |
| 929 |
} |
| 930 |
</script> |
| 931 |
|
| 932 |
</div> |
| 933 |
<?php |
| 934 |
} |
| 935 |
if ($this->vcm_host_to_guest_review) { |
| 936 |
?> |
| 937 |
<div class="vbo-bookdet-wrap"> |
| 938 |
<div class="vbo-bookdet-head"> |
| 939 |
<span><?php echo JText::translate('VBO_REVIEW_YOUR_GUEST'); ?></span> |
| 940 |
</div> |
| 941 |
<div class="vbo-bookdet-foot"> |
| 942 |
<button type="button" class="btn btn-small btn-primary vcm-btn-channel-airbnbapi" onclick="vboOpenJModal('vbo-vcm-host-to-guest-review', 'index.php?option=com_vikchannelmanager&task=hostguestreview&cid[]=<?php echo $row['id']; ?>&tmpl=component');"> |
| 943 |
<?php VikBookingIcons::e('smile'); ?> |
| 944 |
<?php echo JText::translate('VBO_WRITE_REVIEW'); ?> |
| 945 |
</button> |
| 946 |
</div> |
| 947 |
</div> |
| 948 |
<?php |
| 949 |
// prepare modal (host-to-guest review) |
| 950 |
array_push($vbo_modals_html, $vbo_app->getJmodalHtml('vbo-vcm-host-to-guest-review', JText::translate('VBO_REVIEW_YOUR_GUEST'))); |
| 951 |
|
| 952 |
// check if a notification was clicked |
| 953 |
if (VikRequest::getString('notif_action', '', 'request') == 'airbnb_host_guest_review') { |
| 954 |
JFactory::getDocument()->addScriptDeclaration( |
| 955 |
<<<JS |
| 956 |
jQuery(function() { |
| 957 |
setTimeout(() => { |
| 958 |
jQuery('.vcm-btn-channel-airbnbapi').trigger('click'); |
| 959 |
}, 500); |
| 960 |
}); |
| 961 |
JS |
| 962 |
); |
| 963 |
} |
| 964 |
} |
| 965 |
} |
| 966 |
?> |
| 967 |
</div> |
| 968 |
|
| 969 |
<?php |
| 970 |
if (!$printreceipt && $this->allows_conversion !== false) { |
| 971 |
?> |
| 972 |
<div class="vbo-bookdet-container vbo-bookdet-conv-currency"> |
| 973 |
<div class="vbo-bookdet-conv-currency-inner"> |
| 974 |
<div class="vbo-bookdet-conv-currency-info"> |
| 975 |
<span><?php echo JText::sprintf('VBO_CONV_RES_OTA_CURRENCY', $this->conv_from_currency, $this->conv_to_currency); ?></span> |
| 976 |
<span><?php echo JText::sprintf('VBO_CONV_RES_OTA_CURRENCY_EXC', ($this->conv_from_currency . ' ' . VikBooking::numberFormat($row['total'])), ($this->conv_to_currency . ' ' . VikBooking::numberFormat($this->allows_conversion))); ?></span> |
| 977 |
</div> |
| 978 |
<div class="vbo-bookdet-conv-currency-apply"> |
| 979 |
<a class="btn vbo-config-btn" onclick="return confirm(Joomla.JText._('VBO_CONV_RES_OTA_CURRENCY_APPLY') + '?');" href="index.php?option=com_vikbooking&task=editorder&cid[]=<?php echo $row['id']; ?>&do_ota_curr_conv=1"><?php VikBookingIcons::e('exchange-alt'); ?> <?php echo JText::translate('VBO_CONV_RES_OTA_CURRENCY_APPLY'); ?></a> |
| 980 |
</div> |
| 981 |
</div> |
| 982 |
</div> |
| 983 |
<?php |
| 984 |
} |
| 985 |
|
| 986 |
if (!$printreceipt && $row['status'] == "standby" && empty($row['idorderota']) && !strcasecmp((string)$row['type'], 'Inquiry')) { |
| 987 |
// website pending reservation inquiry |
| 988 |
$ir_data_callback = function($data) { |
| 989 |
return (is_object($data) && !empty($data->av_type)); |
| 990 |
}; |
| 991 |
$prev_ir_data = $history_obj->getEventsWithData('IR', $ir_data_callback, true); |
| 992 |
if (is_array($prev_ir_data) && count($prev_ir_data)) { |
| 993 |
// display a message about the availability type at the time of creation of the inquiry reservation |
| 994 |
|
| 995 |
// parse original stay dates into DateTime objects |
| 996 |
$orig_checkin_dt_obj = new JDate($prev_ir_data[0]->checkin_date); |
| 997 |
$orig_checkout_dt_obj = new JDate($prev_ir_data[0]->checkout_date); |
| 998 |
?> |
| 999 |
<div class="vbo-bookdet-container vbo-bookdet-inquiry-alert"> |
| 1000 |
<div class="vbo-bookdet-inquiry-alert-dismiss"> |
| 1001 |
<button type="button" class="btn btn-warning" onclick="jQuery('.vbo-bookdet-inquiry-alert').remove();"><?php VikBookingIcons::e('times-circle'); ?> <?php echo JText::translate('VBOBTNKEEPREMIND'); ?></button> |
| 1002 |
</div> |
| 1003 |
<div class="vbo-bookdet-inquiry-alert-message"> |
| 1004 |
<div class="vbo-bookdet-inquiry-alert-top"> |
| 1005 |
<span><?php echo JText::translate('VBO_WEB_INQUIRY_ALERT'); ?></span> |
| 1006 |
</div> |
| 1007 |
<div class="vbo-bookdet-inquiry-alert-avtype"> |
| 1008 |
<span class="vbo-bookdet-inquiry-alert-mess-avtype"><?php |
| 1009 |
// explain what was the availability at the time of inquiry |
| 1010 |
if ($prev_ir_data[0]->av_type === 1) { |
| 1011 |
echo JText::translate('VBO_WEB_INQUIRY_AVTYPE_1'); |
| 1012 |
} elseif ($prev_ir_data[0]->av_type === 2) { |
| 1013 |
echo JText::translate('VBO_WEB_INQUIRY_AVTYPE_2'); |
| 1014 |
} elseif ($prev_ir_data[0]->av_type === 3) { |
| 1015 |
echo JText::translate('VBO_WEB_INQUIRY_AVTYPE_3'); |
| 1016 |
} else { |
| 1017 |
echo JText::translate('VBO_WEB_INQUIRY_AVTYPE_4'); |
| 1018 |
} |
| 1019 |
?></span> |
| 1020 |
<span class="vbo-bookdet-inquiry-alert-mess-origrq"> |
| 1021 |
<strong><?php echo JText::translate('VBO_WEB_INQUIRY_ORIGRQ') . ':'; ?></strong> |
| 1022 |
<span class="badge"><?php echo JText::translate('VBPICKUPAT') . ': ' . $orig_checkin_dt_obj->format('D, d M Y', true); ?></span> |
| 1023 |
<span class="badge"><?php echo JText::translate('VBRELEASEAT') . ': ' . $orig_checkout_dt_obj->format('D, d M Y', true); ?></span> |
| 1024 |
<span class="badge"><?php echo JText::translate('VBEDITORDERADULTS') . ': ' . $prev_ir_data[0]->adults; ?></span> |
| 1025 |
<?php |
| 1026 |
if (!empty($prev_ir_data[0]->children)) { |
| 1027 |
?> |
| 1028 |
<span class="badge"><?php echo JText::translate('VBEDITORDERCHILDREN') . ': ' . $prev_ir_data[0]->children; ?></span> |
| 1029 |
<?php |
| 1030 |
} |
| 1031 |
?> |
| 1032 |
</span> |
| 1033 |
</div> |
| 1034 |
<div class="vbo-bookdet-inquiry-alert-bottom"> |
| 1035 |
<span><?php echo JText::translate('VBO_WEB_INQUIRY_SUGG'); ?></span> |
| 1036 |
</div> |
| 1037 |
</div> |
| 1038 |
</div> |
| 1039 |
<?php |
| 1040 |
} |
| 1041 |
} |
| 1042 |
?> |
| 1043 |
|
| 1044 |
<div class="vbo-bookingdet-innertop"> |
| 1045 |
<div class="vbo-bookingdet-commands"> |
| 1046 |
<?php |
| 1047 |
if ($busy || $row['status'] == "standby") { |
| 1048 |
?> |
| 1049 |
<div class="vbo-bookingdet-command"> |
| 1050 |
<button onclick="document.location.href='index.php?option=com_vikbooking&task=editbusy&cid[]=<?php echo $row['id']; ?>';" class="btn vbo-config-btn" type="button"><i class="icon-pencil"></i> <?php echo JText::translate('VBMODRES'); ?></button> |
| 1051 |
</div> |
| 1052 |
<?php |
| 1053 |
} |
| 1054 |
if ((array_key_exists(1, $tars) && count($tars[1]) > 0) || ($is_package || $is_cust_cost)) { |
| 1055 |
|
| 1056 |
if (VBOPlatformDetection::isWordPress()) { |
| 1057 |
/** |
| 1058 |
* @wponly display warning message if no valid Shortcodes found |
| 1059 |
*/ |
| 1060 |
$model = JModel::getInstance('vikbooking', 'shortcodes'); |
| 1061 |
$itemid = $model->best('booking'); |
| 1062 |
if (!$itemid) { |
| 1063 |
VikError::raiseWarning('', 'No Shortcodes found, or no Shortcodes being used in Pages/Posts.'); |
| 1064 |
} |
| 1065 |
} |
| 1066 |
|
| 1067 |
?> |
| 1068 |
<div class="vbo-bookingdet-command"> |
| 1069 |
<button onclick="window.open('<?php echo VikBooking::externalroute('index.php?option=com_vikbooking&view=booking&sid='.(!empty($row['sid']) ? $row['sid'] : $row['idorderota']).'&ts='.$row['ts'], false); ?>', '_blank');" type="button" class="btn vbo-config-btn"><?php VikBookingIcons::e('external-link'); ?> <?php echo JText::translate('VBVIEWORDFRONT'); ?></button> |
| 1070 |
</div> |
| 1071 |
<?php |
| 1072 |
} |
| 1073 |
if (($row['status'] == "confirmed" || ($row['status'] == "standby" && !empty($row['custmail']))) && ((array_key_exists(1, $tars) && count($tars[1]) > 0) || ($is_package || $is_cust_cost))) { |
| 1074 |
?> |
| 1075 |
<div class="vbo-bookingdet-command"> |
| 1076 |
<button class="btn vbo-config-btn" type="button" onclick="document.location.href='index.php?option=com_vikbooking&task=resendordemail&cid[]=<?php echo $row['id']; ?>';"><?php VikBookingIcons::e('envelope'); ?> <?php echo JText::translate('VBRESENDORDEMAIL'); ?></button> |
| 1077 |
</div> |
| 1078 |
<?php |
| 1079 |
} |
| 1080 |
if (is_array($this->vcm_special_offer)) { |
| 1081 |
if (empty($this->vcm_special_offer[3]) || !empty($this->vcm_special_offer[4])) { |
| 1082 |
// no special offer sent before, or withdrawn |
| 1083 |
?> |
| 1084 |
<div class="vbo-bookingdet-command"> |
| 1085 |
<button type="button" class="btn btn-primary vcm-btn-channel-<?php echo strtolower($this->vcm_special_offer[2]); ?>" onclick="vboOpenJModal('vbo-vcm-special-offer', 'index.php?option=com_vikchannelmanager&task=specialoffer&bid=<?php echo $row['id']; ?>&listing_id=<?php echo $this->vcm_special_offer[0]; ?>&ota_thread_id=<?php echo $this->vcm_special_offer[1]; ?>&tmpl=component');"><?php VikBookingIcons::e('certificate'); ?> <?php echo JText::sprintf('VBO_VCM_SPECIAL_OFFER', $this->vcm_special_offer[2]); ?></button> |
| 1086 |
</div> |
| 1087 |
<?php |
| 1088 |
// prepare modal (VCM prepare special offer) |
| 1089 |
array_push($vbo_modals_html, $vbo_app->getJmodalHtml('vbo-vcm-special-offer', JText::sprintf('VBO_VCM_SPECIAL_OFFER', $this->vcm_special_offer[2]))); |
| 1090 |
// end prepare modal |
| 1091 |
} else { |
| 1092 |
// special offer sent before, link to withdraw it |
| 1093 |
?> |
| 1094 |
<div class="vbo-bookingdet-command"> |
| 1095 |
<a href="index.php?option=com_vikchannelmanager&task=sendSpecialOffer&vbo_oid=<?php echo $row['id']; ?>&spo_type=special_offer&spo_action=withdraw&ota_thread_id=<?php echo $this->vcm_special_offer[1]; ?>&spo_id=<?php echo $this->vcm_special_offer[3]; ?>" class="btn btn-danger"><?php VikBookingIcons::e('ban'); ?> <?php echo JText::translate('VBO_WITHDRAW_SPOFFER'); ?></a> |
| 1096 |
</div> |
| 1097 |
<?php |
| 1098 |
} |
| 1099 |
} |
| 1100 |
if ($row['status'] == "standby" || ($row['status'] == "cancelled" && $row['checkout'] >= time())) { |
| 1101 |
?> |
| 1102 |
<div class="vbo-bookingdet-command"> |
| 1103 |
<button class="btn btn-success" type="button" onclick="if (confirm('<?php echo htmlspecialchars(JText::translate('VBSETORDCONFIRMED')); ?> ?')) {document.location.href='index.php?option=com_vikbooking&task=setordconfirmed&cid[]=<?php echo $row['id'] . ($row['status'] == "cancelled" ? '&skip_notification=1' : ''); ?>';}"><?php VikBookingIcons::e('check'); ?> <?php echo JText::translate('VBSETORDCONFIRMED'); ?></button> |
| 1104 |
</div> |
| 1105 |
<?php |
| 1106 |
} |
| 1107 |
if ($row['status'] == "cancelled" && !$row['closure']) { |
| 1108 |
?> |
| 1109 |
<div class="vbo-bookingdet-command"> |
| 1110 |
<button type="button" class="btn btn-warning vbo-context-menu-btn vbo-context-menu-actionscanc"> |
| 1111 |
<span class="vbo-context-menu-lbl"><?php echo JText::translate('VBCRONACTIONS'); ?></span> |
| 1112 |
<span class="vbo-context-menu-ico"><?php VikBookingIcons::e('sort-down'); ?></span> |
| 1113 |
</button> |
| 1114 |
</div> |
| 1115 |
|
| 1116 |
<script type="text/javascript"> |
| 1117 |
jQuery(function() { |
| 1118 |
jQuery('.vbo-context-menu-actionscanc').vboContextMenu({ |
| 1119 |
placement: 'bottom-right', |
| 1120 |
buttons: [ |
| 1121 |
<?php |
| 1122 |
if (!empty($row['custmail'])) : |
| 1123 |
?> |
| 1124 |
{ |
| 1125 |
icon: '<?php echo VikBookingIcons::i('envelope'); ?>', |
| 1126 |
text: Joomla.JText._('VBSENDCANCORDEMAIL'), |
| 1127 |
class: 'vbo-context-menu-entry-danger', |
| 1128 |
separator: true, |
| 1129 |
action: (root, config) => { |
| 1130 |
document.location.href = 'index.php?option=com_vikbooking&task=sendcancordemail&cid[]=<?php echo $row['id']; ?>'; |
| 1131 |
}, |
| 1132 |
}, |
| 1133 |
<?php |
| 1134 |
endif; |
| 1135 |
?> |
| 1136 |
{ |
| 1137 |
icon: '<?php echo VikBookingIcons::i('hourglass-half'); ?>', |
| 1138 |
text: Joomla.JText._('VBO_SET_STANDBY'), |
| 1139 |
class: 'vbo-context-menu-entry-warning', |
| 1140 |
separator: false, |
| 1141 |
action: (root, config) => { |
| 1142 |
document.location.href = '<?php echo VBOFactory::getPlatform()->getUri()->addCSRF('index.php?option=com_vikbooking&task=bookings.set_to_pending&bid=' . $row['id']); ?>'; |
| 1143 |
}, |
| 1144 |
}, |
| 1145 |
], |
| 1146 |
}); |
| 1147 |
}); |
| 1148 |
</script> |
| 1149 |
<?php |
| 1150 |
} |
| 1151 |
if ($row['status'] == 'confirmed' && $row['closure'] < 1) { |
| 1152 |
?> |
| 1153 |
<div class="vbo-bookingdet-command pro-feature"> |
| 1154 |
<button type="button" class="btn vbo-config-btn" onclick="document.getElementById('invnotes-hid').value=document.getElementById('invnotes').value;document.getElementById('vbo-gen-invoice').submit();"><?php VikBookingIcons::e('file-text-o'); ?> <?php echo JText::translate('VBOGENBOOKINGINVOICE'); ?></button> |
| 1155 |
</div> |
| 1156 |
<?php |
| 1157 |
} |
| 1158 |
if ($row['status'] == 'confirmed' && $row['closure'] < 1) { |
| 1159 |
?> |
| 1160 |
<div class="vbo-bookingdet-command pro-feature"> |
| 1161 |
<button type="button" class="btn vbo-config-btn" onclick="window.open('index.php?option=com_vikbooking&task=editorder&cid[]=<?php echo $row['id']; ?>&print=1&tmpl=component', '_blank');"><?php VikBookingIcons::e('print'); ?> <?php echo JText::translate('VBOPRINTRECEIPT'); ?></button> |
| 1162 |
</div> |
| 1163 |
<?php |
| 1164 |
} |
| 1165 |
if ($row['status'] != 'confirmed' || $row['closure'] > 0 || $this->vcm_cancel_active_res) { |
| 1166 |
if ($this->vcm_decline_actions) { |
| 1167 |
// this booking requires some decline actions before being removed |
| 1168 |
?> |
| 1169 |
<div class="vbo-bookingdet-command"> |
| 1170 |
<button type="button" class="btn btn-danger" onclick="vboOpenJModal('vbo-vcm-decline-booking', 'index.php?option=com_vikchannelmanager&task=declinebooking&cid[]=<?php echo $row['id']; ?>&tmpl=component');"><?php VikBookingIcons::e('trash'); ?> <?php echo JText::translate('VBMAINEBUSYDEL'); ?></button> |
| 1171 |
</div> |
| 1172 |
<?php |
| 1173 |
// prepare modal (VCM decline booking) |
| 1174 |
array_push($vbo_modals_html, $vbo_app->getJmodalHtml('vbo-vcm-decline-booking', JText::translate('VBMAINEBUSYDEL'))); |
| 1175 |
// end prepare modal |
| 1176 |
} elseif ($this->vcm_cancel_active_res) { |
| 1177 |
// the active OTA booking can be cancelled |
| 1178 |
?> |
| 1179 |
<div class="vbo-bookingdet-command"> |
| 1180 |
<button type="button" class="btn btn-danger" onclick="vboOpenJModal('vbo-vcm-cancel-reservation', 'index.php?option=com_vikchannelmanager&task=cancelreservation&vbo_oid=<?php echo $row['id']; ?>&tmpl=component');"><?php VikBookingIcons::e('trash'); ?> <?php echo JText::translate('VBMAINEBUSYDEL'); ?></button> |
| 1181 |
</div> |
| 1182 |
<?php |
| 1183 |
// prepare modal (VCM cancel reservation) |
| 1184 |
array_push($vbo_modals_html, $vbo_app->getJmodalHtml('vbo-vcm-cancel-reservation', JText::translate('VBMAINEBUSYDEL'))); |
| 1185 |
// end prepare modal |
| 1186 |
} else { |
| 1187 |
// regular remove button with confirmation |
| 1188 |
?> |
| 1189 |
<div class="vbo-bookingdet-command"> |
| 1190 |
<button type="button" class="btn btn-danger" onclick="if (confirm(Joomla.JText._('VBDELCONFIRM'))){document.location.href='index.php?option=com_vikbooking&task=removeorders&cid[]=<?php echo $row['id']; ?>&goto=<?php echo $row['id']; ?>';}"><?php VikBookingIcons::e('trash'); ?> <?php echo $row['status'] == 'cancelled' ? JText::translate('VBO_PURGERM_RESERVATION') : JText::translate('VBMAINEBUSYDEL'); ?></button> |
| 1191 |
</div> |
| 1192 |
<?php |
| 1193 |
} |
| 1194 |
} |
| 1195 |
?> |
| 1196 |
|
| 1197 |
<!-- Define role to detect the supported hook --> |
| 1198 |
<!-- {"rule":"customizer","event":"onDisplayViewVikBookingEditorder","key":"buttons","type":"field"} --> |
| 1199 |
|
| 1200 |
<?php |
| 1201 |
if (isset($bookingPanelForms['buttons'])) |
| 1202 |
{ |
| 1203 |
echo $bookingPanelForms['buttons']; |
| 1204 |
} |
| 1205 |
?> |
| 1206 |
</div> |
| 1207 |
|
| 1208 |
<div class="vbo-bookingdet-tabs"> |
| 1209 |
<div class="vbo-bookingdet-tab vbo-bookingdet-tab-active" data-vbotab="vbo-tab-details"><?php echo JText::translate('VBOBOOKDETTABDETAILS'); ?></div> |
| 1210 |
<div class="vbo-bookingdet-tab" data-vbotab="vbo-tab-admin"><?php echo JText::translate('VBOBOOKDETTABADMIN'); ?></div> |
| 1211 |
</div> |
| 1212 |
</div> |
| 1213 |
|
| 1214 |
<div class="vbo-bookingdet-tab-cont" id="vbo-tab-details" style="display: block;"> |
| 1215 |
<div class="vbo-bookingdet-innercontainer"> |
| 1216 |
<div class="vbo-bookingdet-customer"> |
| 1217 |
<div class="vbo-bookingdet-detcont<?php echo $row['closure'] > 0 ? ' vbo-bookingdet-closure' : ''; ?>"> |
| 1218 |
<?php |
| 1219 |
$custdata_parts = explode("\n", $row['custdata']); |
| 1220 |
if (count($custdata_parts) > 2 && strpos($custdata_parts[0], ':') !== false && strpos($custdata_parts[1], ':') !== false) { |
| 1221 |
//attempt to format labels and values |
| 1222 |
foreach ($custdata_parts as $custdet) { |
| 1223 |
if (strlen($custdet) < 1) { |
| 1224 |
continue; |
| 1225 |
} |
| 1226 |
$custdet_parts = explode(':', $custdet); |
| 1227 |
$custd_lbl = ''; |
| 1228 |
$custd_val = ''; |
| 1229 |
if (count($custdet_parts) < 2) { |
| 1230 |
$custd_val = $custdet; |
| 1231 |
} else { |
| 1232 |
$custd_lbl = $custdet_parts[0]; |
| 1233 |
if ($custd_lbl == 'http' || $custd_lbl == 'https') { |
| 1234 |
// shift values |
| 1235 |
$custdet_parts[2] = $custdet_parts[1]; |
| 1236 |
$custdet_parts[1] = $custdet_parts[0]; |
| 1237 |
$custd_lbl = ''; |
| 1238 |
} |
| 1239 |
unset($custdet_parts[0]); |
| 1240 |
if ((!strcasecmp(trim($custdet_parts[1]), 'http') || !strcasecmp(trim($custdet_parts[1]), 'https')) && !empty($custdet_parts[2]) && strpos($custdet_parts[2], '//') !== false) { |
| 1241 |
// this is a URI |
| 1242 |
$custd_val = '<a href="' . trim(implode(':', $custdet_parts)) . '" target="_blank"><i class="' . VikBookingIcons::i('external-link') . '"></i></a>'; |
| 1243 |
} else { |
| 1244 |
$custd_val = trim(implode(':', $custdet_parts)); |
| 1245 |
} |
| 1246 |
} |
| 1247 |
?> |
| 1248 |
<div class="vbo-bookingdet-userdetail"> |
| 1249 |
<?php |
| 1250 |
if (strlen($custd_lbl)) { |
| 1251 |
?> |
| 1252 |
<span class="vbo-bookingdet-userdetail-lbl"><?php echo VikBooking::tnCustomerRawDataLabel($custd_lbl); ?></span> |
| 1253 |
<?php |
| 1254 |
} |
| 1255 |
if (strlen($custd_val)) { |
| 1256 |
?> |
| 1257 |
<span class="vbo-bookingdet-userdetail-val"><?php echo $custd_val; ?></span> |
| 1258 |
<?php |
| 1259 |
} |
| 1260 |
?> |
| 1261 |
</div> |
| 1262 |
<?php |
| 1263 |
} |
| 1264 |
} else { |
| 1265 |
if ($row['closure'] > 0) { |
| 1266 |
?> |
| 1267 |
<div class="vbo-bookingdet-userdetail"> |
| 1268 |
<span class="vbo-bookingdet-userdetail-val"><?php echo nl2br($row['custdata']); ?></span> |
| 1269 |
</div> |
| 1270 |
<?php |
| 1271 |
} else { |
| 1272 |
echo nl2br($row['custdata']); |
| 1273 |
?> |
| 1274 |
<div class="vbo-bookingdet-userdetail"> |
| 1275 |
<span class="vbo-bookingdet-userdetail-val"> </span> |
| 1276 |
</div> |
| 1277 |
<?php |
| 1278 |
} |
| 1279 |
} |
| 1280 |
if (!empty($row['ujid'])) { |
| 1281 |
$orig_user = JFactory::getUser($row['ujid']); |
| 1282 |
$author_name = is_object($orig_user) && property_exists($orig_user, 'name') && !empty($orig_user->name) ? $orig_user->name : ''; |
| 1283 |
?> |
| 1284 |
<div class="vbo-bookingdet-userdetail"> |
| 1285 |
<span class="vbo-bookingdet-userdetail-val"><?php echo JText::sprintf('VBOBOOKINGCREATEDBY', $row['ujid'].(!empty($author_name) ? ' ('.$author_name.')' : '')); ?></span> |
| 1286 |
</div> |
| 1287 |
<?php |
| 1288 |
} |
| 1289 |
?> |
| 1290 |
|
| 1291 |
<!-- Define role to detect the supported hook --> |
| 1292 |
<!-- {"rule":"customizer","event":"onDisplayViewVikBookingEditorderSidebar","key":"userdetails","type":"field"} --> |
| 1293 |
|
| 1294 |
<?php |
| 1295 |
if (isset($bookingSidebarForms['userdetails'])) |
| 1296 |
{ |
| 1297 |
echo $bookingSidebarForms['userdetails']; |
| 1298 |
} |
| 1299 |
?> |
| 1300 |
|
| 1301 |
</div> |
| 1302 |
|
| 1303 |
<?php |
| 1304 |
// build the proper invoice SID for bc |
| 1305 |
$inv_sid = $row['sid'] ?: $row['idorderota'] ?: ''; |
| 1306 |
if (empty($row['sid']) && is_file(implode(DIRECTORY_SEPARATOR, [VBO_SITE_PATH, 'helpers', 'invoices', 'generated', "{$row['id']}_{$row['sid']}.pdf"]))) { |
| 1307 |
// use the old file name signature for OTA bookings |
| 1308 |
$inv_sid = $row['sid']; |
| 1309 |
} |
| 1310 |
|
| 1311 |
// build list of invoice details (path/uri & label/button), one by default |
| 1312 |
$invoice_details = [ |
| 1313 |
[ |
| 1314 |
'path' => implode(DIRECTORY_SEPARATOR, [VBO_SITE_PATH, 'helpers', 'invoices', 'generated', "{$row['id']}_{$inv_sid}.pdf"]), |
| 1315 |
'uri' => VBO_SITE_URI . 'helpers/invoices/generated/' . "{$row['id']}_{$inv_sid}.pdf", |
| 1316 |
'label' => JText::translate('VBOCOLORTAGRULEINVONE'), |
| 1317 |
'btn' => JText::translate('VBOINVDOWNLOAD'), |
| 1318 |
] |
| 1319 |
]; |
| 1320 |
|
| 1321 |
/** |
| 1322 |
* Merge the additional invoices generated by the e-invoicing drivers for this booking. |
| 1323 |
* |
| 1324 |
* @since 1.16.7 (J) - 1.6.7 (WP) |
| 1325 |
*/ |
| 1326 |
$invoice_details = array_merge($invoice_details, VBOEinvoicingFactory::getInstance()->getBookingExtraInvoices($row['id'])); |
| 1327 |
|
| 1328 |
/** |
| 1329 |
* Trigger event to allow third-party plugins to define additional invoices or paths/urls. |
| 1330 |
* |
| 1331 |
* @since 1.16.7 (J) - 1.6.7 (WP) |
| 1332 |
*/ |
| 1333 |
VBOFactory::getPlatform()->getDispatcher()->trigger('onBeforeListInvoices', [$row, &$invoice_details]); |
| 1334 |
|
| 1335 |
// check if an invoice exists |
| 1336 |
$invoiced = false; |
| 1337 |
foreach ((array) $invoice_details as $invoice_detail) { |
| 1338 |
$invoiced = $invoiced || is_file($invoice_detail['path']); |
| 1339 |
} |
| 1340 |
|
| 1341 |
// extra booking details |
| 1342 |
if (!$printreceipt && ((!empty($row['channel']) && !empty($row['idorderota'])) || strlen((string)$row['confirmnumber']) || $invoiced)) { |
| 1343 |
?> |
| 1344 |
<div class="vbo-bookingdet-detcont vbo-bookingdet-detcont-labels-wrap vbo-hidein-print"> |
| 1345 |
<?php |
| 1346 |
if (!empty($row['channel']) && !empty($row['idorderota'])) { |
| 1347 |
$tiny_logo_url = ''; |
| 1348 |
$channelparts = explode('_', $row['channel']); |
| 1349 |
if ($ch_logo = VikBooking::getVcmChannelsLogo($row['channel'], true)) { |
| 1350 |
$tiny_logo_url = $ch_logo->getTinyLogoURL(); |
| 1351 |
} |
| 1352 |
?> |
| 1353 |
<div class="vbo-bookingdet-detcont-label vbo-bookingdet-detcont-label-idorderota <?php echo strtolower(preg_replace('/[^a-z0-9]/i', '', $channelparts[0])); ?>"> |
| 1354 |
<span class="label label-info"> |
| 1355 |
<span class="vbo-bookingdet-ota-details"> |
| 1356 |
<?php |
| 1357 |
if ($tiny_logo_url) { |
| 1358 |
?> |
| 1359 |
<span class="vbo-bookingdet-ota-logo"><img src="<?php echo $tiny_logo_url; ?>" /></span> |
| 1360 |
<?php |
| 1361 |
} |
| 1362 |
?> |
| 1363 |
<span class="vbo-bookingdet-ota-name"><?php echo $otachannel_name . ' ID'; ?></span> |
| 1364 |
</span> |
| 1365 |
<span class="badge"><?php echo !strcasecmp((string)$row['type'], 'Inquiry') && $row['status'] == 'standby' ? '-----' : $row['idorderota']; ?></span> |
| 1366 |
</span> |
| 1367 |
</div> |
| 1368 |
<?php |
| 1369 |
} |
| 1370 |
if (strlen((string)$row['confirmnumber'])) { |
| 1371 |
?> |
| 1372 |
<div class="vbo-bookingdet-detcont-label vbo-bookingdet-detcont-label-confirmnumber"> |
| 1373 |
<span class="label label-success"> |
| 1374 |
<span><?php echo JText::translate('VBCONFIRMNUMB'); ?></span> |
| 1375 |
<span class="badge"><?php echo $row['confirmnumber']; ?></span> |
| 1376 |
</span> |
| 1377 |
</div> |
| 1378 |
<?php |
| 1379 |
} |
| 1380 |
|
| 1381 |
/** |
| 1382 |
* Check for AI automated host-to-guest reviews. |
| 1383 |
* |
| 1384 |
* @since 1.16.10 (J) - 1.6.10 (WP) |
| 1385 |
*/ |
| 1386 |
if (class_exists('VikChannelManager') && VikChannelManager::hostToGuestReviewSupported($row, $willbe = true)) { |
| 1387 |
if (class_exists('VCMAiModelSettings') && (new VCMAiModelSettings)->isGuestReviewAutoResponderEnabled()) { |
| 1388 |
// host-to-guest review will be supported and AI auto-guest-review is enabled |
| 1389 |
$ai_auto_guest_review_opt = (array) VBOFactory::getConfig()->getArray('ai_auto_guest_review_opt_' . $row['id'], []); |
| 1390 |
?> |
| 1391 |
<div class="vbo-bookingdet-detcont-ai-info"> |
| 1392 |
<p class="vbo-bookingdet-detcont-ai-info-status"> |
| 1393 |
<span class="vbo-bookingdet-detcont-ai-info-status-on" style="<?php echo ($ai_auto_guest_review_opt['ignore'] ?? 0) ? 'display: none;' : ''; ?>"><?php VikBookingIcons::e('check-circle'); ?> <span><?php echo JText::translate('VBO_AI_AUTO_GUEST_REV_WILLRUN'); ?></span></span> |
| 1394 |
<span class="vbo-bookingdet-detcont-ai-info-status-off" style="<?php echo !($ai_auto_guest_review_opt['ignore'] ?? 0) ? 'display: none;' : ''; ?>"><?php VikBookingIcons::e('ban'); ?> <span><?php echo JText::translate('VBO_AI_AUTO_GUEST_REV_RESIGNORE'); ?></span></span> |
| 1395 |
</p> |
| 1396 |
<button type="button" class="btn btn-small btn-primary vbo-context-menu-btn vbo-context-menu-ai-autoreview"> |
| 1397 |
<span class="vbo-context-menu-lbl"><?php echo JText::translate('VBCRONACTIONS'); ?></span> |
| 1398 |
<span class="vbo-context-menu-ico"><?php VikBookingIcons::e('sort-down'); ?></span> |
| 1399 |
</button> |
| 1400 |
</div> |
| 1401 |
|
| 1402 |
<script type="text/javascript"> |
| 1403 |
// build context menu |
| 1404 |
jQuery(function() { |
| 1405 |
|
| 1406 |
// toggle ignore AI auto-review guest function |
| 1407 |
let vbo_action_ignore_ai_autorg = (now_ignore) => { |
| 1408 |
if (confirm(Joomla.JText._((now_ignore ? 'VBO_AI_AUTO_GUEST_REV_INCLUDE' : 'VBO_AI_AUTO_GUEST_REV_EXCLUDE')))) { |
| 1409 |
// update the auto-review ignore status for this booking |
| 1410 |
VBOCore.doAjax( |
| 1411 |
"<?php echo VikBooking::ajaxUrl('index.php?option=com_vikbooking&task=bookings.set_ai_auto_guest_review_opt'); ?>", |
| 1412 |
{ |
| 1413 |
bid: '<?php echo $row['id']; ?>', |
| 1414 |
opt: { |
| 1415 |
ignore: (now_ignore ? 0 : 1), |
| 1416 |
}, |
| 1417 |
}, |
| 1418 |
(opt) => { |
| 1419 |
// populate the new buttons |
| 1420 |
let new_auto_review_opt = []; |
| 1421 |
new_auto_review_opt.push({ |
| 1422 |
icon: ((opt.ignore || 0) ? '<?php echo VikBookingIcons::i('check-circle'); ?>' : '<?php echo VikBookingIcons::i('ban'); ?>'), |
| 1423 |
text: Joomla.JText._((opt?.ignore ? 'VBO_AI_AUTO_GUEST_REV_INCLUDE' : 'VBO_AI_AUTO_GUEST_REV_EXCLUDE')), |
| 1424 |
class: (opt?.ignore ? 'vbo-context-menu-entry-success' : 'vbo-context-menu-entry-danger'), |
| 1425 |
separator: true, |
| 1426 |
action: (root, config) => { |
| 1427 |
// register callback |
| 1428 |
vbo_action_ignore_ai_autorg(opt.ignore || 0); |
| 1429 |
}, |
| 1430 |
}); |
| 1431 |
|
| 1432 |
// set new buttons in context menu |
| 1433 |
jQuery('.vbo-context-menu-ai-autoreview').vboContextMenu('buttons', new_auto_review_opt); |
| 1434 |
|
| 1435 |
// display the proper status label |
| 1436 |
if (opt?.ignore) { |
| 1437 |
jQuery('.vbo-bookingdet-detcont-ai-info-status-on').hide(); |
| 1438 |
jQuery('.vbo-bookingdet-detcont-ai-info-status-off').show(); |
| 1439 |
} else { |
| 1440 |
jQuery('.vbo-bookingdet-detcont-ai-info-status-off').hide(); |
| 1441 |
jQuery('.vbo-bookingdet-detcont-ai-info-status-on').show(); |
| 1442 |
} |
| 1443 |
}, |
| 1444 |
(error) => { |
| 1445 |
// display error message |
| 1446 |
alert(error.responseText); |
| 1447 |
} |
| 1448 |
); |
| 1449 |
} |
| 1450 |
}; |
| 1451 |
|
| 1452 |
// render context menu |
| 1453 |
jQuery('.vbo-context-menu-ai-autoreview').vboContextMenu({ |
| 1454 |
placement: 'bottom-left', |
| 1455 |
buttons: [ |
| 1456 |
{ |
| 1457 |
icon: '<?php echo VikBookingIcons::i(($ai_auto_guest_review_opt['ignore'] ?? 0) ? 'check-circle' : 'ban'); ?>', |
| 1458 |
text: Joomla.JText._('<?php echo ($ai_auto_guest_review_opt['ignore'] ?? 0) ? 'VBO_AI_AUTO_GUEST_REV_INCLUDE' : 'VBO_AI_AUTO_GUEST_REV_EXCLUDE'; ?>'), |
| 1459 |
class: '<?php echo ($ai_auto_guest_review_opt['ignore'] ?? 0) ? 'vbo-context-menu-entry-success' : 'vbo-context-menu-entry-danger'; ?>', |
| 1460 |
separator: true, |
| 1461 |
action: (root, config) => { |
| 1462 |
// register callback |
| 1463 |
vbo_action_ignore_ai_autorg(<?php echo ($ai_auto_guest_review_opt['ignore'] ?? 0); ?>); |
| 1464 |
}, |
| 1465 |
} |
| 1466 |
], |
| 1467 |
}); |
| 1468 |
|
| 1469 |
}); |
| 1470 |
</script> |
| 1471 |
<?php |
| 1472 |
} |
| 1473 |
} |
| 1474 |
|
| 1475 |
if ($invoiced) { |
| 1476 |
foreach ($invoice_details as $invoice_detail) { |
| 1477 |
?> |
| 1478 |
<div class="vbo-bookingdet-detcont-label vbo-bookingdet-detcont-label-invoice"> |
| 1479 |
<span class="label label-success"> |
| 1480 |
<span><?php echo $invoice_detail['label'] ?? JText::translate('VBOCOLORTAGRULEINVONE'); ?></span> |
| 1481 |
<span class="badge"><a href="<?php echo $invoice_detail['uri'] . (strpos($invoice_detail['uri'], '?') === false ? '?' . rand() . '=1' : ''); ?>" target="_blank"><?php VikBookingIcons::e('download'); ?> <?php echo $invoice_detail['btn'] ?? JText::translate('VBOINVDOWNLOAD'); ?></a></span> |
| 1482 |
</span> |
| 1483 |
</div> |
| 1484 |
<?php |
| 1485 |
} |
| 1486 |
} |
| 1487 |
if ($this->vcm_review) { |
| 1488 |
?> |
| 1489 |
<div class="vbo-bookingdet-detcont-label vbo-bookingdet-detcont-label-review"> |
| 1490 |
<span class="label label-warning" onclick="VBOCore.handleDisplayWidgetNotification({widget_id: 'guest_reviews'}, {review_id: '<?php echo $this->vcm_review['id']; ?>'});"> |
| 1491 |
<a href="javascript: void(0);" style="color: #fff;"><i class="vboicn-star-full"></i> <?php echo JText::translate('VBOSEEGUESTREVIEW'); ?></a> |
| 1492 |
</span> |
| 1493 |
</div> |
| 1494 |
<?php |
| 1495 |
// check if a notification was clicked |
| 1496 |
if (VikRequest::getString('notif_action', '', 'request') == 'see_guest_review') { |
| 1497 |
$vcm_review_link = VBOFactory::getPlatform()->getUri()->admin('index.php?option=com_vikchannelmanager&task=reviews&revid=' . $this->vcm_review['id'], false); |
| 1498 |
$vcm_review_id = $this->vcm_review['id']; |
| 1499 |
JFactory::getDocument()->addScriptDeclaration( |
| 1500 |
<<<JS |
| 1501 |
jQuery(function() { |
| 1502 |
setTimeout(() => { |
| 1503 |
// document.location.href = '$vcm_review_link'; |
| 1504 |
VBOCore.handleDisplayWidgetNotification({widget_id: 'guest_reviews'}, {review_id: '$vcm_review_id'}); |
| 1505 |
}, 200); |
| 1506 |
}); |
| 1507 |
JS |
| 1508 |
); |
| 1509 |
} |
| 1510 |
} |
| 1511 |
?> |
| 1512 |
|
| 1513 |
<!-- Define role to detect the supported hook --> |
| 1514 |
<!-- {"rule":"customizer","event":"onDisplayViewVikBookingEditorderSidebar","key":"invoice","type":"field"} --> |
| 1515 |
|
| 1516 |
<?php |
| 1517 |
if (isset($bookingSidebarForms['invoice'])) |
| 1518 |
{ |
| 1519 |
echo $bookingSidebarForms['invoice']; |
| 1520 |
} |
| 1521 |
?> |
| 1522 |
|
| 1523 |
</div> |
| 1524 |
<?php |
| 1525 |
} |
| 1526 |
if (!$printreceipt && $row['closure'] < 1) { |
| 1527 |
?> |
| 1528 |
<div class="vbo-bookingdet-detcont vbo-hidein-print"> |
| 1529 |
<div class="vbo-bookingdet-lblcont"> |
| 1530 |
<label for="custmail"><?php echo JText::translate('VBCUSTEMAIL'); ?></label> |
| 1531 |
</div> |
| 1532 |
<div class="vbo-bookingdet-inpwrap"> |
| 1533 |
<div class="vbo-bookingdet-inpcont"> |
| 1534 |
<input type="text" name="custmail" id="custmail" value="<?php echo $this->escape($row['custmail']); ?>" size="25" onkeyup="vboKeyupEmail(event);"/> |
| 1535 |
<div class="vbo-bookingdet-btncont vbo-bookingdet-save-email" style="display: none;"> |
| 1536 |
<button type="button" class="btn btn-success" onclick="document.adminForm.submit();"><?php VikBookingIcons::e('save'); ?> <?php echo JText::translate('VBSAVE'); ?></button> |
| 1537 |
</div> |
| 1538 |
</div> |
| 1539 |
<?php if (!empty($row['custmail'])) : ?> |
| 1540 |
<div class="vbo-bookingdet-btncont"> |
| 1541 |
<button type="button" class="btn vbo-config-btn" onclick="vboToggleSendEmail();" style="vertical-align: top;"><?php VikBookingIcons::e('envelope'); ?> <?php echo JText::translate('VBSENDEMAILACTION'); ?></button> |
| 1542 |
</div> |
| 1543 |
<?php endif; ?> |
| 1544 |
</div> |
| 1545 |
|
| 1546 |
<!-- Define role to detect the supported hook --> |
| 1547 |
<!-- {"rule":"customizer","event":"onDisplayViewVikBookingEditorderSidebar","key":"email","type":"field"} --> |
| 1548 |
|
| 1549 |
<?php |
| 1550 |
if (isset($bookingSidebarForms['email'])) |
| 1551 |
{ |
| 1552 |
echo $bookingSidebarForms['email']; |
| 1553 |
} |
| 1554 |
?> |
| 1555 |
|
| 1556 |
</div> |
| 1557 |
<div class="vbo-bookingdet-detcont vbo-hidein-print"> |
| 1558 |
<div class="vbo-bookingdet-lblcont"> |
| 1559 |
<label for="custphone"><?php echo JText::translate('VBCUSTOMERPHONE'); ?></label> |
| 1560 |
</div> |
| 1561 |
<div class="vbo-bookingdet-inpwrap"> |
| 1562 |
<div class="vbo-bookingdet-inpcont"> |
| 1563 |
<?php echo $vbo_app->printPhoneInputField(array('name' => 'custphone', 'id' => 'custphone', 'value' => $this->escape($row['phone'])), array('nationalMode' => false, 'fullNumberOnBlur' => true)); ?> |
| 1564 |
</div> |
| 1565 |
<?php if (!empty($row['phone'])) : ?> |
| 1566 |
<div class="vbo-bookingdet-btncont"> |
| 1567 |
<button type="button" class="btn vbo-config-btn" onclick="vboToggleSendSMS();" style="vertical-align: top;"><?php VikBookingIcons::e('comment-dots'); ?> <?php echo JText::translate('VBSENDSMSACTION'); ?></button> |
| 1568 |
</div> |
| 1569 |
<?php endif; ?> |
| 1570 |
</div> |
| 1571 |
|
| 1572 |
<!-- Define role to detect the supported hook --> |
| 1573 |
<!-- {"rule":"customizer","event":"onDisplayViewVikBookingEditorderSidebar","key":"phone","type":"field"} --> |
| 1574 |
|
| 1575 |
<?php |
| 1576 |
if (isset($bookingSidebarForms['phone'])) |
| 1577 |
{ |
| 1578 |
echo $bookingSidebarForms['phone']; |
| 1579 |
} |
| 1580 |
?> |
| 1581 |
|
| 1582 |
</div> |
| 1583 |
|
| 1584 |
<!-- Define role to detect the supported hook --> |
| 1585 |
<!-- {"rule":"customizer","event":"onDisplayViewVikBookingEditorderSidebar","type":"fieldset"} --> |
| 1586 |
|
| 1587 |
<?php |
| 1588 |
foreach ($bookingSidebarForms as $legend => $form) |
| 1589 |
{ |
| 1590 |
if (in_array($legend, ['userdetails', 'invoice', 'email', 'phone'])) |
| 1591 |
{ |
| 1592 |
// skip default forms |
| 1593 |
continue; |
| 1594 |
} |
| 1595 |
?> |
| 1596 |
<div class="vbo-bookingdet-detcont vbo-hidein-print"> |
| 1597 |
<h3><?php echo JText::translate($legend); ?></h3> |
| 1598 |
|
| 1599 |
<?php echo $form; ?> |
| 1600 |
</div> |
| 1601 |
<?php |
| 1602 |
} |
| 1603 |
?> |
| 1604 |
|
| 1605 |
<?php |
| 1606 |
} |
| 1607 |
?> |
| 1608 |
</div> |
| 1609 |
|
| 1610 |
<?php |
| 1611 |
$all_id_prices = array(); |
| 1612 |
$used_indexes_map = array(); |
| 1613 |
?> |
| 1614 |
<div class="vbo-bookingdet-summary"> |
| 1615 |
<div class="table-responsive"> |
| 1616 |
<table class="table"> |
| 1617 |
<?php |
| 1618 |
// room stay dates in case of split stay (or modified room nights) |
| 1619 |
$room_stay_dates = []; |
| 1620 |
$room_stay_records = []; |
| 1621 |
if ($row['split_stay']) { |
| 1622 |
if ($row['status'] == 'confirmed') { |
| 1623 |
$room_stay_dates = $av_helper->loadSplitStayBusyRecords($row['id']); |
| 1624 |
} else { |
| 1625 |
$room_stay_dates = VBOFactory::getConfig()->getArray('split_stay_' . $row['id'], []); |
| 1626 |
} |
| 1627 |
} elseif (!$row['split_stay'] && $row['roomsnum'] > 1 && $row['days'] > 1 && $row['status'] == 'confirmed') { |
| 1628 |
// load the occupied stay dates for each room in case they were modified |
| 1629 |
$room_stay_records = $av_helper->loadSplitStayBusyRecords($row['id']); |
| 1630 |
} |
| 1631 |
|
| 1632 |
// parse all rooms booked |
| 1633 |
foreach ($rooms as $ind => $or) { |
| 1634 |
$num = $ind + 1; |
| 1635 |
$room_icon = $row['split_stay'] && $ind > 0 ? 'random' : 'bed'; |
| 1636 |
$room_stay_nights = $row['days']; |
| 1637 |
?> |
| 1638 |
<tr class="vbo-bookingdet-summary-room"> |
| 1639 |
<td class="vbo-bookingdet-summary-room-firstcell"> |
| 1640 |
<div class="vbo-bookingdet-summary-room-wrap"> |
| 1641 |
<div class="vbo-bookingdet-summary-roomnum"><?php VikBookingIcons::e($room_icon); ?> <?php echo JText::translate('VBEDITORDERTHREE').' '.$num; ?></div> |
| 1642 |
<?php |
| 1643 |
//Room Specific Unit |
| 1644 |
if (!$row['closure'] && $row['status'] == "confirmed" && !empty($or['params'])) { |
| 1645 |
$room_params = json_decode($or['params'], true); |
| 1646 |
$arr_features = array(); |
| 1647 |
$unavailable_indexes = VikBooking::getRoomUnitNumsUnavailable($row, $or['idroom']); |
| 1648 |
if (is_array($room_params) && array_key_exists('features', $room_params) && !empty($room_params['features'])) { |
| 1649 |
foreach ($room_params['features'] as $rind => $rfeatures) { |
| 1650 |
if (in_array($rind, $unavailable_indexes) || (isset($used_indexes_map[$or['idroom']]) && in_array($rind, $used_indexes_map[$or['idroom']]))) { |
| 1651 |
continue; |
| 1652 |
} |
| 1653 |
foreach ($rfeatures as $fname => $fval) { |
| 1654 |
if (strlen($fval)) { |
| 1655 |
$arr_features[$rind] = '#'.$rind.' - '.JText::translate($fname).': '.$fval; |
| 1656 |
break; |
| 1657 |
} |
| 1658 |
} |
| 1659 |
} |
| 1660 |
} |
| 1661 |
if (count($arr_features)) { |
| 1662 |
// $or['id'] equals to the ID of each matching record in _ordersrooms |
| 1663 |
?> |
| 1664 |
<div class="vbo-bookingdet-summary-roomnum-chunit"> |
| 1665 |
<?php echo !$printreceipt ? $vbo_app->getNiceSelect($arr_features, $or['roomindex'], 'roomindex['.$or['id'].']', JText::translate('VBOFEATASSIGNUNIT'), JText::translate('VBOFEATASSIGNUNITEMPTY'), '', 'document.adminForm.submit();', $or['id']) : (!empty($or['roomindex']) && isset($arr_features[$or['roomindex']]) ? $arr_features[$or['roomindex']] : ''); ?> |
| 1666 |
</div> |
| 1667 |
<?php |
| 1668 |
if (!empty($or['idroom']) && !empty($or['roomindex'])) { |
| 1669 |
if (!array_key_exists($or['idroom'], $used_indexes_map)) { |
| 1670 |
$used_indexes_map[$or['idroom']] = array(); |
| 1671 |
} |
| 1672 |
$used_indexes_map[$or['idroom']][] = $or['roomindex']; |
| 1673 |
} |
| 1674 |
} |
| 1675 |
} |
| 1676 |
// |
| 1677 |
?> |
| 1678 |
</div> |
| 1679 |
<div class="vbo-bookingdet-summary-roomguests"> |
| 1680 |
<?php VikBookingIcons::e('male'); ?> |
| 1681 |
<div class="vbo-bookingdet-summary-roomadults"> |
| 1682 |
<span><?php echo JText::translate('VBEDITORDERADULTS'); ?>:</span> <?php echo $arrpeople[$num]['adults']; ?> |
| 1683 |
</div> |
| 1684 |
<?php |
| 1685 |
if ($arrpeople[$num]['children'] > 0) { |
| 1686 |
$age_str = ''; |
| 1687 |
if (!empty($arrpeople[$num]['children_age'])) { |
| 1688 |
$json_child = json_decode($arrpeople[$num]['children_age'], true); |
| 1689 |
if (is_array($json_child) && isset($json_child['age']) && is_array($json_child['age']) && count($json_child['age'])) { |
| 1690 |
$age_str = ' '.JText::sprintf('VBORDERCHILDAGES', implode(', ', $json_child['age'])); |
| 1691 |
} |
| 1692 |
} |
| 1693 |
?> |
| 1694 |
<div class="vbo-bookingdet-summary-roomchildren"> |
| 1695 |
<span><?php echo JText::translate('VBEDITORDERCHILDREN'); ?>:</span> <?php echo $arrpeople[$num]['children'].$age_str; ?> |
| 1696 |
</div> |
| 1697 |
<?php |
| 1698 |
} |
| 1699 |
if ($arrpeople[$num]['pets'] > 0) { |
| 1700 |
?> |
| 1701 |
<div class="vbo-bookingdet-summary-roompets"> |
| 1702 |
<span><?php VikBookingIcons::e('dog'); ?> <?php echo JText::translate('VBO_PETS'); ?>:</span> <?php echo $arrpeople[$num]['pets']; ?> |
| 1703 |
</div> |
| 1704 |
<?php |
| 1705 |
} |
| 1706 |
?> |
| 1707 |
</div> |
| 1708 |
<?php |
| 1709 |
if (!empty($arrpeople[$num]['t_first_name'])) { |
| 1710 |
?> |
| 1711 |
<div class="vbo-bookingdet-summary-guestname"> |
| 1712 |
<span><?php echo $arrpeople[$num]['t_first_name'].' '.$arrpeople[$num]['t_last_name']; ?></span> |
| 1713 |
</div> |
| 1714 |
<?php |
| 1715 |
} |
| 1716 |
?> |
| 1717 |
</td> |
| 1718 |
<td> |
| 1719 |
<div class="vbo-bookingdet-summary-roomname"><?php echo $or['name']; ?></div> |
| 1720 |
<div class="vbo-bookingdet-summary-roomrate"> |
| 1721 |
<?php |
| 1722 |
$active_rplan_id = 0; |
| 1723 |
if ($is_package === true || (!empty($or['cust_cost']) && $or['cust_cost'] > 0.00)) { |
| 1724 |
if (!empty($or['pkg_name'])) { |
| 1725 |
//package |
| 1726 |
echo $or['pkg_name']; |
| 1727 |
} else { |
| 1728 |
//custom cost can have an OTA Rate Plan name |
| 1729 |
if (!empty($or['otarplan'])) { |
| 1730 |
echo ucwords($or['otarplan']); |
| 1731 |
} else { |
| 1732 |
echo JText::translate('VBOROOMCUSTRATEPLAN'); |
| 1733 |
} |
| 1734 |
} |
| 1735 |
} elseif (!empty($tars[$num]) && !empty($tars[$num][0]['idprice'])) { |
| 1736 |
$active_rplan_id = $tars[$num][0]['idprice']; |
| 1737 |
$all_id_prices[] = $tars[$num][0]['idprice']; |
| 1738 |
echo VikBooking::getPriceName($tars[$num][0]['idprice']); |
| 1739 |
if (!empty($tars[$num][0]['attrdata'])) { |
| 1740 |
?> |
| 1741 |
<div> |
| 1742 |
<?php echo VikBooking::getPriceAttr($tars[$num][0]['idprice']).": ".$tars[$num][0]['attrdata']; ?> |
| 1743 |
</div> |
| 1744 |
<?php |
| 1745 |
} |
| 1746 |
} elseif (!empty($or['otarplan'])) { |
| 1747 |
echo ucwords($or['otarplan']); |
| 1748 |
} elseif ($row['closure'] < 1) { |
| 1749 |
echo JText::translate('VBOROOMNORATE'); |
| 1750 |
} |
| 1751 |
?> |
| 1752 |
</div> |
| 1753 |
<?php |
| 1754 |
// meals included in the room rate |
| 1755 |
if (!empty($or['meals'])) { |
| 1756 |
// display included meals defined at room-reservation record |
| 1757 |
$included_meals = VBOMealplanManager::getInstance()->roomRateIncludedMeals($or); |
| 1758 |
} else { |
| 1759 |
// fetch default included meals in the selected rate plan |
| 1760 |
$included_meals = $active_rplan_id ? VBOMealplanManager::getInstance()->ratePlanIncludedMeals($active_rplan_id) : []; |
| 1761 |
} |
| 1762 |
if (!$included_meals && empty($or['meals']) && !empty($row['idorderota']) && !empty($row['channel']) && !empty($row['custdata'])) { |
| 1763 |
// attempt to fetch the included meal plans from the raw customer data or OTA reservation and room |
| 1764 |
$included_meals = VBOMealplanManager::getInstance()->otaDataIncludedMeals($row, $or); |
| 1765 |
} |
| 1766 |
if ($included_meals) { |
| 1767 |
?> |
| 1768 |
<div class="vbo-bookingdet-summary-roomrate vbo-bookingdet-summary-roommeals vbo-wider-badges-wrap"> |
| 1769 |
<?php |
| 1770 |
foreach ($included_meals as $included_meal) { |
| 1771 |
?> |
| 1772 |
<span class="badge badge-info"><?php echo $included_meal; ?></span> |
| 1773 |
<?php |
| 1774 |
} |
| 1775 |
?> |
| 1776 |
</div> |
| 1777 |
<?php |
| 1778 |
} |
| 1779 |
|
| 1780 |
if ($row['split_stay'] && count($room_stay_dates) && isset($room_stay_dates[$ind]) && $room_stay_dates[$ind]['idroom'] == $or['idroom']) { |
| 1781 |
// print split stay information for this room |
| 1782 |
$room_stay_checkin = !empty($room_stay_dates[$ind]['checkin_ts']) ? $room_stay_dates[$ind]['checkin_ts'] : $room_stay_dates[$ind]['checkin']; |
| 1783 |
$room_stay_checkout = !empty($room_stay_dates[$ind]['checkout_ts']) ? $room_stay_dates[$ind]['checkout_ts'] : $room_stay_dates[$ind]['checkout']; |
| 1784 |
$room_stay_nights = $av_helper->countNightsOfStay($room_stay_checkin, $room_stay_checkout); |
| 1785 |
?> |
| 1786 |
<div class="vbo-cal-splitstay-details vbo-bookdet-splitstay-details"> |
| 1787 |
<div class="vbo-cal-splitstay-dates"> |
| 1788 |
<span class="vbo-cal-splitstay-room-nights"><?php VikBookingIcons::e('moon'); ?> <?php echo $room_stay_nights . ' ' . ($room_stay_nights > 1 ? JText::translate('VBDAYS') : JText::translate('VBDAY')); ?></span> |
| 1789 |
<span class="vbo-cal-splitstay-dates-in" title="<?php echo date('H:i', $room_stay_checkin); ?>"><?php VikBookingIcons::e('plane-arrival'); ?> <?php echo date(str_replace("/", $datesep, $df), $room_stay_checkin); ?></span> |
| 1790 |
<span class="vbo-cal-splitstay-dates-out" title="<?php echo date('H:i', $room_stay_checkout); ?>"><?php VikBookingIcons::e('plane-departure'); ?> <?php echo date(str_replace("/", $datesep, $df), $room_stay_checkout); ?></span> |
| 1791 |
</div> |
| 1792 |
</div> |
| 1793 |
<?php |
| 1794 |
} elseif (!$row['split_stay'] && count($room_stay_records) && isset($room_stay_records[$ind]) && $room_stay_records[$ind]['idroom'] == $or['idroom']) { |
| 1795 |
// print modified stay dates information for this room |
| 1796 |
$room_stay_checkin = $room_stay_records[$ind]['checkin']; |
| 1797 |
$room_stay_checkout = $room_stay_records[$ind]['checkout']; |
| 1798 |
$room_stay_nights = $av_helper->countNightsOfStay($room_stay_checkin, $room_stay_checkout); |
| 1799 |
if ($room_stay_checkin != $row['checkin'] || $room_stay_checkout != $row['checkout']) { |
| 1800 |
?> |
| 1801 |
<div class="vbo-cal-splitstay-details vbo-bookdet-splitstay-details vbo-bookdet-roomdatesmod-details"> |
| 1802 |
<div class="vbo-cal-splitstay-dates"> |
| 1803 |
<span class="vbo-cal-splitstay-room-nights"><?php VikBookingIcons::e('moon'); ?> <?php echo $room_stay_nights . ' ' . ($room_stay_nights > 1 ? JText::translate('VBDAYS') : JText::translate('VBDAY')); ?></span> |
| 1804 |
<span class="vbo-cal-splitstay-dates-in" title="<?php echo date('H:i', $room_stay_checkin); ?>"><?php VikBookingIcons::e('plane-arrival'); ?> <?php echo date(str_replace("/", $datesep, $df), $room_stay_checkin); ?></span> |
| 1805 |
<span class="vbo-cal-splitstay-dates-out" title="<?php echo date('H:i', $room_stay_checkout); ?>"><?php VikBookingIcons::e('plane-departure'); ?> <?php echo date(str_replace("/", $datesep, $df), $room_stay_checkout); ?></span> |
| 1806 |
</div> |
| 1807 |
</div> |
| 1808 |
<?php |
| 1809 |
} |
| 1810 |
} |
| 1811 |
?> |
| 1812 |
</td> |
| 1813 |
<td> |
| 1814 |
<div class="vbo-bookingdet-summary-price"> |
| 1815 |
<?php |
| 1816 |
if ($is_package === true || (!empty($or['cust_cost']) && $or['cust_cost'] > 0.00)) { |
| 1817 |
echo $currencyname.' '.VikBooking::numberFormat($or['cust_cost']); |
| 1818 |
} elseif (!empty($tars[$num]) && !empty($tars[$num][0]['idprice'])) { |
| 1819 |
$display_rate = !empty($or['room_cost']) ? $or['room_cost'] : $tars[$num][0]['cost']; |
| 1820 |
echo $currencyname.' '.VikBooking::numberFormat(($after_tax ? VikBooking::sayCostPlusIva($display_rate, $tars[$num][0]['idprice']) : $display_rate)); |
| 1821 |
} |
| 1822 |
?> |
| 1823 |
</div> |
| 1824 |
</td> |
| 1825 |
</tr> |
| 1826 |
<?php |
| 1827 |
//Options |
| 1828 |
if (!empty($or['optionals'])) { |
| 1829 |
$stepo = explode(";", $or['optionals']); |
| 1830 |
$counter = 0; |
| 1831 |
foreach ($stepo as $roptkey => $oo) { |
| 1832 |
if (empty($oo)) { |
| 1833 |
continue; |
| 1834 |
} |
| 1835 |
$stept = explode(":", $oo); |
| 1836 |
$q = "SELECT * FROM `#__vikbooking_optionals` WHERE `id`=".(int)$stept[0].";"; |
| 1837 |
$dbo->setQuery($q); |
| 1838 |
$actopt = $dbo->loadAssocList(); |
| 1839 |
if (!$actopt) { |
| 1840 |
continue; |
| 1841 |
} |
| 1842 |
$counter++; |
| 1843 |
$chvar = ''; |
| 1844 |
if (!empty($actopt[0]['ageintervals']) && $or['children'] > 0 && strstr($stept[1], '-') != false) { |
| 1845 |
$optagenames = VikBooking::getOptionIntervalsAges($actopt[0]['ageintervals']); |
| 1846 |
$optagepcent = VikBooking::getOptionIntervalsPercentage($actopt[0]['ageintervals']); |
| 1847 |
$optageovrct = VikBooking::getOptionIntervalChildOverrides($actopt[0], $or['adults'], $or['children']); |
| 1848 |
$child_num = VikBooking::getRoomOptionChildNumber($or['optionals'], $actopt[0]['id'], $roptkey, $or['children']); |
| 1849 |
$optagecosts = VikBooking::getOptionIntervalsCosts(isset($optageovrct['ageintervals_child' . ($child_num + 1)]) ? $optageovrct['ageintervals_child' . ($child_num + 1)] : $actopt[0]['ageintervals']); |
| 1850 |
$agestept = explode('-', $stept[1]); |
| 1851 |
$stept[1] = $agestept[0]; |
| 1852 |
$chvar = $agestept[1]; |
| 1853 |
if (array_key_exists(($chvar - 1), $optagepcent) && $optagepcent[($chvar - 1)] == 1) { |
| 1854 |
//percentage value of the adults tariff |
| 1855 |
if ($is_package === true || (!empty($or['cust_cost']) && $or['cust_cost'] > 0.00)) { |
| 1856 |
$optagecosts[($chvar - 1)] = $or['cust_cost'] * $optagecosts[($chvar - 1)] / 100; |
| 1857 |
} else { |
| 1858 |
$display_rate = !empty($or['room_cost']) ? $or['room_cost'] : $tars[$num][0]['cost']; |
| 1859 |
$optagecosts[($chvar - 1)] = $display_rate * $optagecosts[($chvar - 1)] / 100; |
| 1860 |
} |
| 1861 |
} elseif (array_key_exists(($chvar - 1), $optagepcent) && $optagepcent[($chvar - 1)] == 2) { |
| 1862 |
//VBO 1.10 - percentage value of room base cost |
| 1863 |
if ($is_package === true || (!empty($or['cust_cost']) && $or['cust_cost'] > 0.00)) { |
| 1864 |
$optagecosts[($chvar - 1)] = $or['cust_cost'] * $optagecosts[($chvar - 1)] / 100; |
| 1865 |
} else { |
| 1866 |
$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']); |
| 1867 |
$optagecosts[($chvar - 1)] = $display_rate * $optagecosts[($chvar - 1)] / 100; |
| 1868 |
} |
| 1869 |
} |
| 1870 |
if (!isset($optagenames[($chvar - 1)])) { |
| 1871 |
$optagenames[($chvar - 1)] = ''; |
| 1872 |
} |
| 1873 |
if (!isset($optagecosts[($chvar - 1)])) { |
| 1874 |
$optagecosts[($chvar - 1)] = 0; |
| 1875 |
} |
| 1876 |
$actopt[0]['chageintv'] = $chvar; |
| 1877 |
$actopt[0]['name'] .= ' ('.$optagenames[($chvar - 1)].')'; |
| 1878 |
$realcost = (intval($actopt[0]['perday']) == 1 ? (floatval($optagecosts[($chvar - 1)]) * $room_stay_nights * $stept[1]) : (floatval($optagecosts[($chvar - 1)]) * $stept[1])); |
| 1879 |
} else { |
| 1880 |
// VBO 1.11 - options percentage cost of the room total fee |
| 1881 |
if ($is_package === true || (!empty($or['cust_cost']) && $or['cust_cost'] > 0.00)) { |
| 1882 |
$deftar_basecosts = $or['cust_cost']; |
| 1883 |
} else { |
| 1884 |
$use_def_tar = isset($tars[$num]) && isset($tars[$num][0]) ? $tars[$num][0]['cost'] : 0; |
| 1885 |
$deftar_basecosts = !empty($or['room_cost']) ? $or['room_cost'] : $use_def_tar; |
| 1886 |
} |
| 1887 |
$actopt[0]['cost'] = (int)$actopt[0]['pcentroom'] ? ($deftar_basecosts * $actopt[0]['cost'] / 100) : $actopt[0]['cost']; |
| 1888 |
// |
| 1889 |
$realcost = (intval($actopt[0]['perday']) == 1 ? ($actopt[0]['cost'] * $room_stay_nights * $stept[1]) : ($actopt[0]['cost'] * $stept[1])); |
| 1890 |
} |
| 1891 |
if ($actopt[0]['maxprice'] > 0 && $realcost > $actopt[0]['maxprice']) { |
| 1892 |
$realcost = $actopt[0]['maxprice']; |
| 1893 |
if (intval($actopt[0]['hmany']) == 1 && intval($stept[1]) > 1) { |
| 1894 |
$realcost = $actopt[0]['maxprice'] * $stept[1]; |
| 1895 |
} |
| 1896 |
} |
| 1897 |
$realcost = $actopt[0]['perperson'] == 1 ? ($realcost * $arrpeople[$num]['adults']) : $realcost; |
| 1898 |
$tmpopr = VikBooking::sayOptionalsPlusIva($realcost, $actopt[0]['idiva']); |
| 1899 |
?> |
| 1900 |
<tr class="vbo-bookingdet-summary-options"> |
| 1901 |
<td class="vbo-bookingdet-summary-options-title"><?php echo $counter == 1 ? JText::translate('VBEDITORDEREIGHT') : ' '; ?></td> |
| 1902 |
<td> |
| 1903 |
<span class="vbo-bookingdet-summary-lbl"><?php echo ($stept[1] > 1 ? $stept[1]." " : "").$actopt[0]['name']; ?></span> |
| 1904 |
</td> |
| 1905 |
<td> |
| 1906 |
<span class="vbo-bookingdet-summary-cost"><?php echo $currencyname." ".VikBooking::numberFormat(($after_tax ? $tmpopr : $realcost)); ?></span> |
| 1907 |
</td> |
| 1908 |
</tr> |
| 1909 |
<?php |
| 1910 |
} |
| 1911 |
} |
| 1912 |
//Custom extra costs |
| 1913 |
if (!empty($or['extracosts'])) { |
| 1914 |
$counter = 0; |
| 1915 |
$cur_extra_costs = json_decode($or['extracosts'], true); |
| 1916 |
foreach ($cur_extra_costs as $eck => $ecv) { |
| 1917 |
$counter++; |
| 1918 |
$ecv['idtax'] = isset($ecv['idtax']) ? $ecv['idtax'] : 0; |
| 1919 |
?> |
| 1920 |
<tr class="vbo-bookingdet-summary-custcosts"> |
| 1921 |
<td class="vbo-bookingdet-summary-custcosts-title"><?php echo $counter == 1 ? JText::translate('VBPEDITBUSYEXTRACOSTS') : ' '; ?></td> |
| 1922 |
<td> |
| 1923 |
<?php |
| 1924 |
if (!empty($ecv['type'])) { |
| 1925 |
?> |
| 1926 |
<span class="vbo-tooltip vbo-tooltip-top" data-tooltiptext="<?php echo JHtml::fetch('esc_attr', JText::translate('VBPSHOWSEASONSTHREE') . ': ' . $ecv['type']); ?>"> |
| 1927 |
<span class="vbo-bookingdet-summary-lbl"><?php echo $ecv['name']; ?></span> |
| 1928 |
</span> |
| 1929 |
<?php |
| 1930 |
} else { |
| 1931 |
?> |
| 1932 |
<span class="vbo-bookingdet-summary-lbl"><?php echo $ecv['name']; ?></span> |
| 1933 |
<?php |
| 1934 |
} |
| 1935 |
?> |
| 1936 |
</td> |
| 1937 |
<td> |
| 1938 |
<span class="vbo-bookingdet-summary-cost"><?php echo $currencyname." ".VikBooking::numberFormat(($after_tax ? VikBooking::sayOptionalsPlusIva($ecv['cost'], $ecv['idtax']) : $ecv['cost'])); ?></span> |
| 1939 |
</td> |
| 1940 |
</tr> |
| 1941 |
<?php |
| 1942 |
} |
| 1943 |
} |
| 1944 |
} |
| 1945 |
//vikbooking 1.1 coupon |
| 1946 |
if (strlen((string)$row['coupon']) > 0) { |
| 1947 |
$expcoupon = explode(";", $row['coupon']); |
| 1948 |
?> |
| 1949 |
<tr class="vbo-bookingdet-summary-coupon"> |
| 1950 |
<td><?php echo JText::translate('VBCOUPON'); ?></td> |
| 1951 |
<td> |
| 1952 |
<span class="vbo-bookingdet-summary-lbl"><?php echo $expcoupon[2]; ?></span> |
| 1953 |
</td> |
| 1954 |
<td> |
| 1955 |
<span class="vbo-bookingdet-summary-cost">- <?php echo $currencyname; ?> <?php echo VikBooking::numberFormat($expcoupon[1]); ?></span> |
| 1956 |
</td> |
| 1957 |
</tr> |
| 1958 |
<?php |
| 1959 |
} |
| 1960 |
if ($row['refund'] > 0) { |
| 1961 |
?> |
| 1962 |
<tr class="vbo-bookingdet-summary-totpaid vbo-bookingdet-summary-totrefunded"> |
| 1963 |
<td> |
| 1964 |
<strong><?php echo JText::translate('VBOBOOKHISTORYTRF'); ?></strong> |
| 1965 |
</td> |
| 1966 |
<td> |
| 1967 |
<span class="vbo-amount-refunded-lbl"><?php echo JText::translate('VBO_AMOUNT_REFUNDED'); ?></span> |
| 1968 |
</td> |
| 1969 |
<td> |
| 1970 |
<div id="vbo-amountrefunded-cont"> |
| 1971 |
<span id="vbo-amountrefunded-current"><?php echo $currencyname.' '.VikBooking::numberFormat($row['refund']); ?></span> |
| 1972 |
<span id="vbo-amountrefunded-edit" style="margin-left: 5px; cursor: pointer;"><?php VikBookingIcons::e('edit'); ?></span> |
| 1973 |
</div> |
| 1974 |
<div id="vbo-amountrefunded-modcont" style="display: none;"> |
| 1975 |
<span id="vbo-amountrefunded-cancedit" style="margin-right: 5px; cursor: pointer;"><?php VikBookingIcons::e('times'); ?></span> |
| 1976 |
<span id="vbo-amountrefunded-new"><input type="number" step="any" name="newamountrefunded" value="" min="0" style="margin: 0;" placeholder="<?php echo $row['refund']; ?>" disabled /></span> |
| 1977 |
<span id="vbo-amountrefunded-save"><button type="submit" class="btn btn-success"><?php echo JText::translate('VBAPPLYDISCOUNTSAVE'); ?></button></span> |
| 1978 |
</div> |
| 1979 |
</td> |
| 1980 |
</tr> |
| 1981 |
<?php |
| 1982 |
} |
| 1983 |
//Reservation Total |
| 1984 |
//Taxes Breakdown (only if tot_taxes is greater than 0) |
| 1985 |
$tax_breakdown = array(); |
| 1986 |
$base_aliq = 0; |
| 1987 |
if (count($all_id_prices) > 0 && $row['tot_taxes'] > 0) { |
| 1988 |
//only last type of price assuming that the tax breakdown is equivalent in case of different rates |
| 1989 |
$q = "SELECT `p`.`id`,`p`.`name`,`p`.`idiva`,`t`.`aliq`,`t`.`breakdown` FROM `#__vikbooking_prices` AS `p` LEFT JOIN `#__vikbooking_iva` `t` ON `p`.`idiva`=`t`.`id` WHERE `p`.`id`=".intval(array_pop($all_id_prices))." LIMIT 1;"; |
| 1990 |
$dbo->setQuery($q); |
| 1991 |
$breakdown_info = $dbo->loadAssoc(); |
| 1992 |
if ($breakdown_info) { |
| 1993 |
if (!empty($breakdown_info['breakdown']) && !empty($breakdown_info['aliq'])) { |
| 1994 |
$tax_breakdown = json_decode($breakdown_info['breakdown'], true); |
| 1995 |
$tax_breakdown = is_array($tax_breakdown) && count($tax_breakdown) > 0 ? $tax_breakdown : array(); |
| 1996 |
$base_aliq = $breakdown_info['aliq']; |
| 1997 |
} |
| 1998 |
} |
| 1999 |
} |
| 2000 |
// |
| 2001 |
if ($printreceipt && $row['tot_taxes'] > 0) { |
| 2002 |
// only when printing the receipt we display an additional row for the total amount of tax |
| 2003 |
?> |
| 2004 |
<tr class="vbo-bookingdet-summary-total vbo-bookingdet-summary-totaltax"> |
| 2005 |
<td> |
| 2006 |
|
| 2007 |
</td> |
| 2008 |
<td> |
| 2009 |
<span class="vbo-bookingdet-summary-lbl"><?php echo JText::translate('VBTOTALVAT'); ?></span> |
| 2010 |
</td> |
| 2011 |
<td> |
| 2012 |
<span class="vbo-bookingdet-summary-cost"><?php echo $currencyname; ?> <?php echo VikBooking::numberFormat($row['tot_taxes']); ?></span> |
| 2013 |
</td> |
| 2014 |
</tr> |
| 2015 |
<?php |
| 2016 |
} |
| 2017 |
?> |
| 2018 |
<tr class="vbo-bookingdet-summary-total"> |
| 2019 |
<td> |
| 2020 |
<?php |
| 2021 |
if (!$printreceipt) { |
| 2022 |
?> |
| 2023 |
<span class="vbapplydiscsp" onclick="toggleDiscount(this);"> |
| 2024 |
<i class="<?php echo VikBookingIcons::i('chevron-down'); ?>" title="<?php echo htmlspecialchars(JText::translate('VBAPPLYDISCOUNT')); ?>"></i> |
| 2025 |
</span> |
| 2026 |
<?php |
| 2027 |
} |
| 2028 |
?> |
| 2029 |
</td> |
| 2030 |
<td> |
| 2031 |
<span class="vbo-bookingdet-summary-lbl"><?php echo JText::translate('VBEDITORDERNINE'); ?></span> |
| 2032 |
|
| 2033 |
<div class="vbdiscenter" id="vbdiscenter" style="display: none;"> |
| 2034 |
<div class="vbdiscenter-entry"> |
| 2035 |
<span class="vbdiscenter-label"><?php echo JText::translate('VBTOTALVAT'); ?>:</span><span class="vbdiscenter-value"><?php echo $currencyname; ?> <input type="number" step="any" name="tot_taxes" value="<?php echo $row['tot_taxes']; ?>" size="4"/></span> |
| 2036 |
</div> |
| 2037 |
<?php |
| 2038 |
if (count($tax_breakdown)) { |
| 2039 |
foreach ($tax_breakdown as $tbkk => $tbkv) { |
| 2040 |
$tax_break_cost = $row['tot_taxes'] * floatval($tbkv['aliq']) / $base_aliq; |
| 2041 |
?> |
| 2042 |
<div class="vbdiscenter-entry vbdiscenter-entry-breakdown"> |
| 2043 |
<span class="vbdiscenter-label"><?php echo $tbkv['name']; ?>:</span><span class="vbdiscenter-value"><?php echo $currencyname; ?> <?php echo VikBooking::numberFormat($tax_break_cost); ?></span> |
| 2044 |
</div> |
| 2045 |
<?php |
| 2046 |
} |
| 2047 |
} |
| 2048 |
?> |
| 2049 |
<div class="vbdiscenter-entry"> |
| 2050 |
<span class="vbdiscenter-label"><?php echo JText::translate('VBTOTALCITYTAX'); ?>:</span><span class="vbdiscenter-value"><?php echo $currencyname; ?> <input type="number" step="any" name="tot_city_taxes" value="<?php echo $row['tot_city_taxes']; ?>" size="4"/></span> |
| 2051 |
</div> |
| 2052 |
<div class="vbdiscenter-entry"> |
| 2053 |
<span class="vbdiscenter-label"><?php echo JText::translate('VBTOTALFEES'); ?>:</span><span class="vbdiscenter-value"><?php echo $currencyname; ?> <input type="number" step="any" name="tot_fees" value="<?php echo $row['tot_fees']; ?>" size="4"/></span> |
| 2054 |
</div> |
| 2055 |
<div class="vbdiscenter-entry"> |
| 2056 |
<span class="vbdiscenter-label hasTooltip"<?php echo !empty($otachannel_name) ? ' title="'.$otachannel_name.'"' : ''; ?>><?php echo JText::translate('VBTOTALCOMMISSIONS'); ?>:</span><span class="vbdiscenter-value"><?php echo $currencyname; ?> <input type="number" step="any" name="cmms" value="<?php echo $row['cmms']; ?>" size="4"/></span> |
| 2057 |
</div> |
| 2058 |
<div class="vbdiscenter-entry"> |
| 2059 |
<span class="vbdiscenter-label"><?php echo JText::translate('VBAPPLYDISCOUNT'); ?>:</span><span class="vbdiscenter-value"><?php echo $currencyname; ?> <input type="number" step="any" name="admindisc" value="<?php echo isset($expcoupon) ? (float)$expcoupon[1] : ''; ?>" size="4"/></span> |
| 2060 |
</div> |
| 2061 |
<div class="vbdiscenter-entrycentered"> |
| 2062 |
<button type="submit" class="btn btn-success"><?php echo JText::translate('VBAPPLYDISCOUNTSAVE'); ?></button> |
| 2063 |
</div> |
| 2064 |
</div> |
| 2065 |
</td> |
| 2066 |
<td> |
| 2067 |
<span class="vbo-bookingdet-summary-cost"><?php echo (strlen($otacurrency) > 0 ? '('.$otacurrency.') '.$currencyname : $currencyname); ?> <?php echo VikBooking::numberFormat($row['total']); ?></span> |
| 2068 |
</td> |
| 2069 |
</tr> |
| 2070 |
<?php |
| 2071 |
if ($row['total'] > 0 && !$row['closure']) { |
| 2072 |
$has_paid = ($row['totpaid'] > 0); |
| 2073 |
$diff_to_pay = $has_paid ? ($row['total'] - $row['totpaid']) : 0; |
| 2074 |
if ($has_paid || $row['status'] != 'standby') { |
| 2075 |
?> |
| 2076 |
<tr class="vbo-bookingdet-summary-totpaid"> |
| 2077 |
<td> </td> |
| 2078 |
<td><?php echo JText::translate('VBAMOUNTPAID'); ?></td> |
| 2079 |
<td> |
| 2080 |
<div id="vbo-amountpaid-cont"> |
| 2081 |
<span id="vbo-amountpaid-current"><?php echo $has_paid ? ($currencyname . ' ' . VikBooking::numberFormat($row['totpaid'])) : ''; ?></span> |
| 2082 |
<span id="vbo-amountpaid-edit" style="margin-left: 5px; cursor: pointer;"><?php VikBookingIcons::e('edit'); ?></span> |
| 2083 |
</div> |
| 2084 |
<div id="vbo-amountpaid-modcont" style="display: none;"> |
| 2085 |
<span id="vbo-amountpaid-cancedit" style="margin-right: 5px; cursor: pointer;"><?php VikBookingIcons::e('times'); ?></span> |
| 2086 |
<span id="vbo-amountpaid-new"><input type="number" step="any" name="newamountpaid" value="" min="0" style="margin: 0;" placeholder="<?php echo $has_paid ? $row['totpaid'] : ''; ?>" disabled /></span> |
| 2087 |
<?php |
| 2088 |
if ($payments) { |
| 2089 |
?> |
| 2090 |
<span id="vbo-amountpaid-paymeth" style="margin: 0 5px; max-width: 160px;"> |
| 2091 |
<select name="newamountpaymeth" style="margin: 0;"> |
| 2092 |
<option value=""><?php echo JText::translate('VBPAYMENTMETHOD'); ?></option> |
| 2093 |
<?php |
| 2094 |
foreach ($payments as $pay) { |
| 2095 |
?> |
| 2096 |
<option value="<?php echo JHtml::fetch('esc_attr', $pay['id'] . '_' . $pay['name']); ?>"><?php echo $pay['name']; ?></option> |
| 2097 |
<?php |
| 2098 |
} |
| 2099 |
?> |
| 2100 |
</select> |
| 2101 |
</span> |
| 2102 |
<?php |
| 2103 |
} |
| 2104 |
?> |
| 2105 |
<span id="vbo-amountpaid-save"><button type="submit" class="btn btn-success"><?php echo JText::translate('VBAPPLYDISCOUNTSAVE'); ?></button></span> |
| 2106 |
</div> |
| 2107 |
</td> |
| 2108 |
</tr> |
| 2109 |
<?php |
| 2110 |
} |
| 2111 |
if ($diff_to_pay > 1 && $row['status'] != 'cancelled') { |
| 2112 |
?> |
| 2113 |
<tr class="vbo-bookingdet-summary-totpaid vbo-bookingdet-summary-totremaining"> |
| 2114 |
<td> </td> |
| 2115 |
<td> |
| 2116 |
<div><?php echo JText::translate('VBTOTALREMAINING'); ?></div> |
| 2117 |
<?php |
| 2118 |
// enable second payment |
| 2119 |
if (!$printreceipt && $row['status'] == 'confirmed' && !($row['paymcount'] > 0) && VikBooking::multiplePayments() && is_array($payment) && !empty($payment['id'])) { |
| 2120 |
?> |
| 2121 |
<div style="margin-top: 5px;"> |
| 2122 |
<a href="index.php?option=com_vikbooking&task=editorder&makepay=1&cid[]=<?php echo $row['id']; ?>" class="vbo-makepayable-link"><?php VikBookingIcons::e('credit-card'); ?> <?php echo JText::translate('VBMAKEORDERPAYABLE'); ?></a> |
| 2123 |
</div> |
| 2124 |
<?php |
| 2125 |
} |
| 2126 |
?> |
| 2127 |
</td> |
| 2128 |
<td><?php echo $currencyname . ' ' . VikBooking::numberFormat($diff_to_pay); ?></td> |
| 2129 |
</tr> |
| 2130 |
<?php |
| 2131 |
} |
| 2132 |
} |
| 2133 |
if (!$printreceipt && $row['status'] == 'confirmed' && VikBooking::multiplePayments() && is_array($payment) && !empty($payment['id']) && $row['checkout'] > time()) { |
| 2134 |
/** |
| 2135 |
* The amount payable can be modified by the admin. |
| 2136 |
* |
| 2137 |
* @since 1.14 (J) - 1.4.0 (WP) |
| 2138 |
*/ |
| 2139 |
?> |
| 2140 |
<tr class="vbo-bookingdet-summary-totpaid vbo-bookingdet-summary-totpayable"> |
| 2141 |
<td> </td> |
| 2142 |
<td> |
| 2143 |
<span class="vbo-amount-payable-lbl<?php echo $row['payable'] > 0 ? ' vbo-amount-payable-lbl-requested' : ''; ?>"><?php echo $row['payable'] > 0 ? JText::translate('VBO_AMOUNT_PAYABLE') : JText::translate('VBO_AMOUNT_PAYABLE_RQ'); ?></span> |
| 2144 |
</td> |
| 2145 |
<td> |
| 2146 |
<div id="vbo-amountpayable-cont"> |
| 2147 |
<?php |
| 2148 |
if ($row['payable'] > 0) { |
| 2149 |
?> |
| 2150 |
<span id="vbo-amountpayable-current"><?php echo $currencyname . ' ' . VikBooking::numberFormat($row['payable']); ?></span> |
| 2151 |
<?php |
| 2152 |
} |
| 2153 |
?> |
| 2154 |
<span id="vbo-amountpayable-edit" style="margin-left: 5px; cursor: pointer;"><?php VikBookingIcons::e('edit'); ?></span> |
| 2155 |
</div> |
| 2156 |
<div id="vbo-amountpayable-modcont" style="display: none;"> |
| 2157 |
<span id="vbo-amountpayable-cancedit" style="margin-right: 5px; cursor: pointer;"><?php VikBookingIcons::e('times'); ?></span> |
| 2158 |
<span id="vbo-amountpayable-new"><input type="number" step="any" name="newamountpayable" value="" min="0" style="margin: 0;" placeholder="<?php echo $row['payable']; ?>" disabled /></span> |
| 2159 |
<span id="vbo-amountpayable-save"><button type="submit" class="btn btn-success"><?php echo JText::translate('VBAPPLYDISCOUNTSAVE'); ?></button></span> |
| 2160 |
</div> |
| 2161 |
</td> |
| 2162 |
</tr> |
| 2163 |
<?php |
| 2164 |
} |
| 2165 |
|
| 2166 |
/** |
| 2167 |
* Cancellation fee for cancelled bookings after the deadline. |
| 2168 |
* |
| 2169 |
* @since 1.16.0 (J) - 1.6.0 (WP) |
| 2170 |
*/ |
| 2171 |
if ($row['status'] == 'cancelled' && !$row['closure'] && $row['total'] > 0) { |
| 2172 |
?> |
| 2173 |
<tr class="vbo-bookingdet-summary-cancfee"> |
| 2174 |
<td> </td> |
| 2175 |
<td><?php echo JText::translate('VBO_CANC_FEE'); ?></td> |
| 2176 |
<td> |
| 2177 |
<div id="vbo-cancfee-cont"> |
| 2178 |
<span id="vbo-cancfee-current"><?php echo $currencyname.' '.VikBooking::numberFormat($row['canc_fee']); ?></span> |
| 2179 |
<span id="vbo-cancfee-edit" style="margin-left: 5px; cursor: pointer;"><?php VikBookingIcons::e('edit'); ?></span> |
| 2180 |
</div> |
| 2181 |
<div id="vbo-cancfee-modcont" style="display: none;"> |
| 2182 |
<span id="vbo-cancfee-cancedit" style="margin-right: 5px; cursor: pointer;"><?php VikBookingIcons::e('times'); ?></span> |
| 2183 |
<span id="vbo-cancfee-new"><input type="number" step="any" name="newcancfee" value="" min="0" style="margin: 0;" placeholder="<?php echo $row['canc_fee']; ?>" disabled /></span> |
| 2184 |
<span id="vbo-cancfee-save"><button type="submit" class="btn btn-success"><?php echo JText::translate('VBAPPLYDISCOUNTSAVE'); ?></button></span> |
| 2185 |
</div> |
| 2186 |
</td> |
| 2187 |
</tr> |
| 2188 |
<?php |
| 2189 |
} |
| 2190 |
?> |
| 2191 |
</table> |
| 2192 |
</div> |
| 2193 |
|
| 2194 |
<!-- Define role to detect the supported hook --> |
| 2195 |
<!-- {"rule":"customizer","event":"onDisplayViewVikBookingEditorder","type":"fieldset"} --> |
| 2196 |
|
| 2197 |
<?php |
| 2198 |
foreach ($bookingPanelForms as $legend => $form) |
| 2199 |
{ |
| 2200 |
if (in_array($legend, ['buttons'])) |
| 2201 |
{ |
| 2202 |
// skip default forms |
| 2203 |
continue; |
| 2204 |
} |
| 2205 |
?> |
| 2206 |
<div class="table-responsive"> |
| 2207 |
<h3><?php echo JText::translate($legend); ?></h3> |
| 2208 |
|
| 2209 |
<?php echo $form; ?> |
| 2210 |
</div> |
| 2211 |
<?php |
| 2212 |
} |
| 2213 |
?> |
| 2214 |
|
| 2215 |
</div> |
| 2216 |
</div> |
| 2217 |
<?php |
| 2218 |
if ($printreceipt) { |
| 2219 |
$receipt_notes = VikBooking::getReceiptNotes(); |
| 2220 |
?> |
| 2221 |
<div class="vbo-receipt-notes-container"> |
| 2222 |
<div class="vbo-receipt-notes-inner"> |
| 2223 |
<div class="vbo-receipt-notes-val vbo-showin-print" id="vbo-receipt-notes-val"><?php echo $receipt_notes; ?></div> |
| 2224 |
<div class="vbo-receipt-notes-tarea vbo-hidein-print"> |
| 2225 |
<textarea id="vbo-receipt-notes" placeholder="<?php echo JText::translate('VBORECEIPTNOTESDEF'); ?>"><?php echo htmlspecialchars($receipt_notes); ?></textarea> |
| 2226 |
</div> |
| 2227 |
</div> |
| 2228 |
</div> |
| 2229 |
<?php |
| 2230 |
} |
| 2231 |
?> |
| 2232 |
</div> |
| 2233 |
|
| 2234 |
<div class="vbo-bookingdet-tab-cont" id="vbo-tab-admin" style="display: none;"> |
| 2235 |
<div class="vbo-bookingdet-innercontainer"> |
| 2236 |
<div class="vbo-bookingdet-admindata"> |
| 2237 |
<?php |
| 2238 |
if (!$row['closure']) { |
| 2239 |
?> |
| 2240 |
<div class="vbo-bookingdet-admin-entry"> |
| 2241 |
<label for="vbo-searchcust"><?php echo JText::translate(count($customer) ? 'VBOASSIGNNEWCUST' : 'VBFILLCUSTFIELDS'); ?></label> |
| 2242 |
<span style="display: block;"><?php echo JText::translate('VBOSEARCHEXISTCUST'); ?></span> |
| 2243 |
<span class="vbo-eorder-assigncust" style="margin-bottom: 1px;"> |
| 2244 |
<input type="text" id="vbo-searchcust" autocomplete="off" value="" placeholder="<?php echo JText::translate('VBOSEARCHCUSTBY'); ?>" size="30" style="margin-bottom: 0;" /> |
| 2245 |
</span> |
| 2246 |
<span id="vbo-searchcust-loading"> |
| 2247 |
<?php VikBookingIcons::e('hourglass-half'); ?> |
| 2248 |
</span> |
| 2249 |
<input type="hidden" name="newcustid" id="newcustid" value="" /> |
| 2250 |
<div id="vbo-searchcust-res" style="position: absolute; background-color: #fff;"></div> |
| 2251 |
<span class="vbo-eorder-assignnewcust" style="display: block; margin-top: 10px;"> |
| 2252 |
<a class="vbo-assign-customer" href="index.php?option=com_vikbooking&task=newcustomer&bid=<?php echo $row['id']; ?>&goto=<?php echo base64_encode($gotouri.'#tab-admin'); ?>"> |
| 2253 |
<?php VikBookingIcons::e('user-circle'); ?> |
| 2254 |
<span><?php echo JText::translate('VBOCREATENEWCUST'); ?></span> |
| 2255 |
</a> |
| 2256 |
</span> |
| 2257 |
|
| 2258 |
<?php |
| 2259 |
if (isset($adminSidebarForms['customer'])) |
| 2260 |
{ |
| 2261 |
echo $adminSidebarForms['customer']; |
| 2262 |
} |
| 2263 |
?> |
| 2264 |
|
| 2265 |
</div> |
| 2266 |
<?php |
| 2267 |
} |
| 2268 |
?> |
| 2269 |
<div class="vbo-bookingdet-admin-entry"> |
| 2270 |
<label for="newpayment"><?php echo JText::translate('VBPAYMENTMETHOD'); ?></label> |
| 2271 |
<?php |
| 2272 |
if (is_array($payment)) { |
| 2273 |
?> |
| 2274 |
<span><?php echo $payment['name']; ?></span> |
| 2275 |
<?php |
| 2276 |
} |
| 2277 |
$chpayment = ''; |
| 2278 |
if ($payments) { |
| 2279 |
$chpayment = '<div><select name="newpayment" id="newpayment" onchange="changePayment();"><option value="">'.JText::translate('VBCHANGEPAYLABEL').'</option>'; |
| 2280 |
foreach ($payments as $pay) { |
| 2281 |
$chpayment .= '<option value="'.$pay['id'].'">'.(is_array($payment) && $payment['id'] == $pay['id'] ? ' ::' : '').$pay['name'].'</option>'; |
| 2282 |
} |
| 2283 |
$chpayment .= '</select></div>'; |
| 2284 |
} |
| 2285 |
echo $chpayment; |
| 2286 |
?> |
| 2287 |
|
| 2288 |
<!-- Define role to detect the supported hook --> |
| 2289 |
<!-- {"rule":"customizer","event":"onDisplayViewVikBookingEditorderAdministrationSidebar","key":"payment","type":"field"} --> |
| 2290 |
|
| 2291 |
<?php |
| 2292 |
if (isset($adminSidebarForms['payment'])) |
| 2293 |
{ |
| 2294 |
echo $adminSidebarForms['payment']; |
| 2295 |
} |
| 2296 |
?> |
| 2297 |
|
| 2298 |
</div> |
| 2299 |
<?php |
| 2300 |
$tn = VikBooking::getTranslator(); |
| 2301 |
$all_langs = $tn->getLanguagesList(); |
| 2302 |
if (count($all_langs) > 1) { |
| 2303 |
?> |
| 2304 |
<div class="vbo-bookingdet-admin-entry"> |
| 2305 |
<label for="newlang"><?php echo JText::translate('VBOBOOKINGLANG'); ?></label> |
| 2306 |
<select name="newlang" id="newlang" onchange="document.adminForm.submit();"> |
| 2307 |
<?php |
| 2308 |
foreach ($all_langs as $lk => $lv) { |
| 2309 |
?> |
| 2310 |
<option value="<?php echo $lk; ?>"<?php echo $row['lang'] == $lk ? ' selected="selected"' : ''; ?>><?php echo isset($lv['nativeName']) ? $lv['nativeName'] : $lv['name']; ?></option> |
| 2311 |
<?php |
| 2312 |
} |
| 2313 |
?> |
| 2314 |
</select> |
| 2315 |
|
| 2316 |
<!-- Define role to detect the supported hook --> |
| 2317 |
<!-- {"rule":"customizer","event":"onDisplayViewVikBookingEditorderAdministrationSidebar","key":"language","type":"field"} --> |
| 2318 |
|
| 2319 |
<?php |
| 2320 |
if (isset($adminSidebarForms['language'])) |
| 2321 |
{ |
| 2322 |
echo $adminSidebarForms['language']; |
| 2323 |
} |
| 2324 |
?> |
| 2325 |
</div> |
| 2326 |
<?php |
| 2327 |
} |
| 2328 |
?> |
| 2329 |
|
| 2330 |
<!-- Define role to detect the supported hook --> |
| 2331 |
<!-- {"rule":"customizer","event":"onDisplayViewVikBookingEditorderAdministrationSidebar","type":"fieldset"} --> |
| 2332 |
|
| 2333 |
<?php |
| 2334 |
foreach ($adminSidebarForms as $legend => $form) |
| 2335 |
{ |
| 2336 |
if (in_array($legend, ['customer', 'payment', 'language'])) |
| 2337 |
{ |
| 2338 |
// skip default forms |
| 2339 |
continue; |
| 2340 |
} |
| 2341 |
?> |
| 2342 |
<div class="vbo-bookingdet-admin-entry"> |
| 2343 |
<h3><?php echo JText::translate($legend); ?></h3> |
| 2344 |
|
| 2345 |
<?php echo $form; ?> |
| 2346 |
</div> |
| 2347 |
<?php |
| 2348 |
} |
| 2349 |
?> |
| 2350 |
|
| 2351 |
</div> |
| 2352 |
<div class="vbo-bookingdet-noteslogs"> |
| 2353 |
<?php |
| 2354 |
$history = $history_obj->loadHistory(); |
| 2355 |
?> |
| 2356 |
<div class="vbo-bookingdet-noteslogs-btns"> |
| 2357 |
<div class="vbo-bookingdet-noteslogs-btn vbo-bookingdet-noteslogs-btn-active" data-id="notes"> |
| 2358 |
<a href="javascript: void(0);" id="vbo-trig-notes" onclick="javascript: vbToggleNotes(this);"> |
| 2359 |
<?php VikBookingIcons::e('user-lock'); ?> |
| 2360 |
<span class="vbo-bookingdet-admintab-lbl"><?php echo JText::translate('VBADMINNOTESTOGGLE'); ?></span> |
| 2361 |
</a> |
| 2362 |
</div> |
| 2363 |
<?php |
| 2364 |
/** |
| 2365 |
* Initialize chat instance by getting the proper channel name |
| 2366 |
* |
| 2367 |
* @since 1.12 |
| 2368 |
*/ |
| 2369 |
if (empty($row['channel'])) { |
| 2370 |
// front-end reservation chat handler |
| 2371 |
$chat_channel = 'vikbooking'; |
| 2372 |
} else { |
| 2373 |
$channelparts = explode('_', $row['channel']); |
| 2374 |
// check if this is a meta search channel |
| 2375 |
$is_meta_search = false; |
| 2376 |
if (preg_match("/(customer).*[0-9]$/", $channelparts[0]) || !strcasecmp($channelparts[0], 'googlehotel') || !strcasecmp($channelparts[0], 'trivago')) { |
| 2377 |
$is_meta_search = empty($row['idorderota']); |
| 2378 |
} |
| 2379 |
if ($is_meta_search) { |
| 2380 |
// customer of type sales channel should use front-end reservation chat handler |
| 2381 |
$chat_channel = 'vikbooking'; |
| 2382 |
} else { |
| 2383 |
// let the getInstance method validate the channel chat handler |
| 2384 |
$chat_channel = $row['channel']; |
| 2385 |
} |
| 2386 |
} |
| 2387 |
$messaging = VikBooking::getVcmChatInstance($row['id'], $chat_channel); |
| 2388 |
// |
| 2389 |
if (!$printreceipt && !is_null($messaging)) { |
| 2390 |
?> |
| 2391 |
<div class="vbo-bookingdet-noteslogs-btn" data-id="messaging"> |
| 2392 |
<a name="messaging" href="javascript: void(0);" id="vbo-trig-messaging" onclick="javascript: vbToggleMessaging(this);"> |
| 2393 |
<?php VikBookingIcons::e('comment-dots'); ?> |
| 2394 |
<span class="vbo-bookingdet-admintab-lbl"><?php echo JText::translate('VBO_GUEST_MESSAGING'); ?></span> |
| 2395 |
</a> |
| 2396 |
</div> |
| 2397 |
<?php |
| 2398 |
} |
| 2399 |
|
| 2400 |
/** |
| 2401 |
* Build up a tab to summarize the "takings" for this sole booking in case of relevant events. |
| 2402 |
* |
| 2403 |
* @since 1.16.9 (J) - 1.6.9 (WP) |
| 2404 |
*/ |
| 2405 |
$takings = []; |
| 2406 |
if ($history) { |
| 2407 |
// payment related events |
| 2408 |
$h_payment_group = $history_obj->getTypeGroups($group = 'GPM'); |
| 2409 |
|
| 2410 |
// merge default types with 'PU' for the manually set "new amount paid" and with 'RU' (refunded amount updated) |
| 2411 |
$takings_events = array_unique(array_merge(($h_payment_group['types'] ?? []), ['PU', 'RU'])); |
| 2412 |
|
| 2413 |
// load the relevant events with data |
| 2414 |
$takings = $history_obj->getEventsWithData($takings_events, null, false); |
| 2415 |
|
| 2416 |
if ($takings) { |
| 2417 |
?> |
| 2418 |
<div class="vbo-bookingdet-noteslogs-btn pro-feature" data-id="takings"> |
| 2419 |
<a href="javascript: void(0);" id="vbo-trig-bookhistory" onclick="javascript: vbToggleDynamicPanel(this, '#vboextrapanel-takings');"> |
| 2420 |
<?php VikBookingIcons::e('wallet'); ?> |
| 2421 |
<span class="vbo-bookingdet-admintab-lbl"><?php echo JText::translate('VBO_TAKINGS'); ?></span> |
| 2422 |
</a> |
| 2423 |
</div> |
| 2424 |
<?php |
| 2425 |
} |
| 2426 |
} |
| 2427 |
|
| 2428 |
if ($history) { |
| 2429 |
?> |
| 2430 |
<div class="vbo-bookingdet-noteslogs-btn" data-id="history"> |
| 2431 |
<a href="javascript: void(0);" id="vbo-trig-bookhistory" onclick="javascript: vbToggleHistory(this);"> |
| 2432 |
<?php VikBookingIcons::e('history'); ?> |
| 2433 |
<span class="vbo-bookingdet-admintab-lbl"><?php echo JText::translate('VBOBOOKHISTORYTAB'); ?></span> |
| 2434 |
</a> |
| 2435 |
</div> |
| 2436 |
<script type="text/javascript"> |
| 2437 |
if (window.location.hash == '#bookhistory') { |
| 2438 |
setTimeout(function() { |
| 2439 |
jQuery(".vbo-bookingdet-tab[data-vbotab='vbo-tab-admin']").trigger('click'); |
| 2440 |
vbToggleHistory(document.getElementById('vbo-trig-bookhistory')); |
| 2441 |
}, 500); |
| 2442 |
} |
| 2443 |
</script> |
| 2444 |
<?php |
| 2445 |
} |
| 2446 |
?> |
| 2447 |
<div class="vbo-bookingdet-noteslogs-btn pro-feature" data-id="invnotes"> |
| 2448 |
<a href="javascript: void(0);" class="hasTooltip" id="vbo-trig-invnotes" onclick="javascript: vbToggleInvNotes(this);" title="<?php echo addslashes(JText::translate('VBBOOKINGINVNOTESHELP')); ?>"> |
| 2449 |
<?php VikBookingIcons::e('file-invoice'); ?> |
| 2450 |
<span class="vbo-bookingdet-admintab-lbl"><?php echo JText::translate('VBBOOKINGINVNOTES'); ?></span> |
| 2451 |
</a> |
| 2452 |
</div> |
| 2453 |
|
| 2454 |
<!-- Define role to detect the supported hook --> |
| 2455 |
<!-- {"rule":"customizer","event":"onDisplayViewVikBookingEditorderAdministration","type":"fieldset"} --> |
| 2456 |
|
| 2457 |
<?php |
| 2458 |
foreach ($adminPanelForms as $legend => $form) |
| 2459 |
{ |
| 2460 |
$legendId = preg_replace("/[^a-zA-Z0-9_\-]+/", '', $legend); |
| 2461 |
?> |
| 2462 |
<div class="vbo-bookingdet-noteslogs-btn" data-id="<?php echo $legendId; ?>"> |
| 2463 |
<a href="javascript: void(0);" class="hasTooltip" id="vbo-trig-<?php echo $legendId; ?>" onclick="javascript: vbToggleDynamicPanel(this, '#vboextrapanel-<?php echo $legendId; ?>');"> |
| 2464 |
<?php VikBookingIcons::e(!empty($adminFormsSetup->icons[$legend]) ? $adminFormsSetup->icons[$legend] : 'plug'); ?> |
| 2465 |
<span class="vbo-bookingdet-admintab-lbl"><?php echo JText::translate($legend); ?></span> |
| 2466 |
</a> |
| 2467 |
</div> |
| 2468 |
<?php |
| 2469 |
} |
| 2470 |
|
| 2471 |
if (!empty($row['paymentlog'])) { |
| 2472 |
$paylogs_lbl = JText::translate('VBPAYMENTLOGTOGGLE'); |
| 2473 |
if (stripos($row['paymentlog'], 'card number') !== false && strpos($row['paymentlog'], '****') !== false) { |
| 2474 |
$paylogs_lbl = JText::translate('VBO_CREDIT_CARD'); |
| 2475 |
} |
| 2476 |
?> |
| 2477 |
<div class="vbo-bookingdet-noteslogs-btn" data-id="paylogs"> |
| 2478 |
<a href="javascript: void(0);" id="vbo-trig-paylogs" onclick="javascript: vbToggleLog(this);"> |
| 2479 |
<?php VikBookingIcons::e('credit-card'); ?> |
| 2480 |
<span class="vbo-bookingdet-admintab-lbl"><?php echo $paylogs_lbl; ?></span> |
| 2481 |
</a> |
| 2482 |
<a name="paymentlog" href="javascript: void(0);"></a> |
| 2483 |
</div> |
| 2484 |
<?php |
| 2485 |
} |
| 2486 |
?> |
| 2487 |
</div> |
| 2488 |
<div class="vbo-bookingdet-noteslogs-cont"> |
| 2489 |
<div id="vbadminnotesdiv" class="vbo-extra-panel" style="display: block;"> |
| 2490 |
<textarea name="adminnotes" class="vbadminnotestarea"><?php echo strip_tags((string)$row['adminnotes']); ?></textarea> |
| 2491 |
<input type="submit" name="updadmnotes" value="<?php echo JText::translate('VBADMINNOTESUPD'); ?>" class="btn btn-success" /> |
| 2492 |
</div> |
| 2493 |
<?php |
| 2494 |
if ($takings) { |
| 2495 |
?> |
| 2496 |
<div class="vbo-extra-panel" id="vboextrapanel-takings" style="display: none;"> |
| 2497 |
<div class="vbo-booking-takings-container table-responsive"> |
| 2498 |
<table class="table"> |
| 2499 |
<thead> |
| 2500 |
<tr class="vbo-booking-takings-firstrow"> |
| 2501 |
<td class="vbo-booking-takings-td-totpaid"><?php echo JText::translate('VBO_TAKINGS'); ?></td> |
| 2502 |
<td class="vbo-booking-takings-td-date"><?php echo JText::translate('VBOBOOKHISTORYLBLDATE'); ?></td> |
| 2503 |
<td class="vbo-booking-takings-td-type"><?php echo JText::translate('VBOBOOKHISTORYLBLTYPE'); ?></td> |
| 2504 |
<td class="vbo-booking-takings-td-fees"><?php echo JText::translate('VBO_PROCESSING_FEES'); ?></td> |
| 2505 |
<td class="vbo-booking-takings-td-descr"><?php echo JText::translate('VBOBOOKHISTORYLBLDESC'); ?></td> |
| 2506 |
</tr> |
| 2507 |
</thead> |
| 2508 |
<tbody> |
| 2509 |
<?php |
| 2510 |
$booking_total_taking = 0; |
| 2511 |
$booking_total_prfees = 0; |
| 2512 |
foreach (array_reverse($takings) as $hist) { |
| 2513 |
// calculate amount paid and description |
| 2514 |
$tn_amount_paid = 0; |
| 2515 |
$tn_amount_fees = 0; |
| 2516 |
$tn_description = strpos((string) $hist['descr'], '<') !== false ? $hist['descr'] : preg_replace("/\R/", ' - ', (string) $hist['descr']); |
| 2517 |
if (is_object($hist['data'])) { |
| 2518 |
// calculate amount paid or amount refunded |
| 2519 |
if (($hist['data']->amount_paid ?? 0)) { |
| 2520 |
$tn_amount_paid = $hist['data']->amount_paid; |
| 2521 |
if (in_array($hist['type'], ['RF', 'RU'])) { |
| 2522 |
// turn the amount paid to negative |
| 2523 |
$tn_amount_paid = $tn_amount_paid < 0 ? $tn_amount_paid : ($tn_amount_paid - ($tn_amount_paid * 2)); |
| 2524 |
if ($hist['type'] === 'RU' && $hist['data']->amount_paid < 0) { |
| 2525 |
// this indicates a lower amount refunded, so we double it to make it positive |
| 2526 |
$tn_amount_paid = abs($hist['data']->amount_paid); |
| 2527 |
} |
| 2528 |
} |
| 2529 |
} |
| 2530 |
|
| 2531 |
// calculate processing fees, if set and if any |
| 2532 |
if (($hist['data']->processing_fees ?? 0)) { |
| 2533 |
$tn_amount_fees += $hist['data']->processing_fees; |
| 2534 |
} |
| 2535 |
|
| 2536 |
// build the event description |
| 2537 |
if (($hist['data']->payment_method ?? '')) { |
| 2538 |
$tn_description = ucwords($hist['data']->payment_method); |
| 2539 |
} elseif (($hist['data']->driver ?? '')) { |
| 2540 |
$tn_description = ucwords(str_replace('_', ' ', basename($hist['data']->driver, '.php'))); |
| 2541 |
} |
| 2542 |
} |
| 2543 |
|
| 2544 |
// increase (or decrease) booking total takings and processing fees amounts |
| 2545 |
$booking_total_taking += $tn_amount_paid; |
| 2546 |
$booking_total_prfees += $tn_amount_fees; |
| 2547 |
?> |
| 2548 |
<tr class="vbo-booking-takings-row"> |
| 2549 |
<td> |
| 2550 |
<?php |
| 2551 |
echo $currencysymb . ' ' . VikBooking::numberFormat($tn_amount_paid); |
| 2552 |
if (!strcasecmp($hist['type'], 'PU')) { |
| 2553 |
/** |
| 2554 |
* Allow to edit or delete the history record. |
| 2555 |
* |
| 2556 |
* @since 1.16.10 (J) - 1.6.10 (WP) |
| 2557 |
*/ |
| 2558 |
?> |
| 2559 |
<div class="vbo-booking-taking-cmds"> |
| 2560 |
<button type="button" class="btn btn-small btn-primary vbo-booking-taking-edit vbo-tooltip vbo-tooltip-top" data-tooltiptext="<?php echo $this->escape(JText::translate('VBMAINPAYMENTSEDIT')); ?>" data-historyid="<?php echo $hist['id']; ?>" data-amount="<?php echo $tn_amount_paid; ?>"><?php VikBookingIcons::e('edit'); ?></button> |
| 2561 |
<button type="button" class="btn btn-small btn-danger vbo-booking-taking-delete vbo-tooltip vbo-tooltip-top" data-tooltiptext="<?php echo $this->escape(JText::translate('VBELIMINA')); ?>" data-historyid="<?php echo $hist['id']; ?>"><?php VikBookingIcons::e('times-circle'); ?></button> |
| 2562 |
</div> |
| 2563 |
<?php |
| 2564 |
} |
| 2565 |
?> |
| 2566 |
</td> |
| 2567 |
<td><?php echo JHtml::fetch('date', $hist['dt'], 'Y-m-d H:i:s'); ?></td> |
| 2568 |
<td><?php echo $history_obj->validType($hist['type'], true); ?></td> |
| 2569 |
<td><?php echo $currencysymb . ' ' . VikBooking::numberFormat($tn_amount_fees); ?></td> |
| 2570 |
<td><?php echo $tn_description; ?></td> |
| 2571 |
</tr> |
| 2572 |
<?php |
| 2573 |
} |
| 2574 |
?> |
| 2575 |
</tbody> |
| 2576 |
<tfoot> |
| 2577 |
<tr> |
| 2578 |
<td colspan="2"> |
| 2579 |
<span><?php echo $currencysymb . ' ' . VikBooking::numberFormat($booking_total_taking); ?></span> |
| 2580 |
</td> |
| 2581 |
<td></td> |
| 2582 |
<td> |
| 2583 |
<span><?php echo $currencysymb . ' ' . VikBooking::numberFormat($booking_total_prfees); ?></span> |
| 2584 |
</td> |
| 2585 |
<td> |
| 2586 |
<button type="button" class="btn btn-small btn-success vbo-takings-addnew"><?php VikBookingIcons::e('plus-circle'); ?> <?php echo JText::translate('VBO_REG_NEW_PAYMENT'); ?></button> |
| 2587 |
</td> |
| 2588 |
</tr> |
| 2589 |
</tfoot> |
| 2590 |
</table> |
| 2591 |
</div> |
| 2592 |
|
| 2593 |
<div class="vbo-eorder-newtaking-helper-wrap" style="display: none;"> |
| 2594 |
<div class="vbo-eorder-newtaking-helper-cont"> |
| 2595 |
<div class="vbo-admin-container vbo-admin-container-full vbo-admin-container-compact"> |
| 2596 |
<div class="vbo-params-wrap"> |
| 2597 |
<div class="vbo-params-container"> |
| 2598 |
<div class="vbo-params-block"> |
| 2599 |
<div class="vbo-param-container"> |
| 2600 |
<div class="vbo-param-label"> |
| 2601 |
<label for="new_taking_amount"><?php echo JText::translate('VBO_CC_AMOUNT'); ?></label> |
| 2602 |
</div> |
| 2603 |
<div class="vbo-param-setting"> |
| 2604 |
<div class="vbo-input-currency-wrap"> |
| 2605 |
<span><?php echo $currencysymb; ?></span> |
| 2606 |
<input type="number" id="new_taking_amount" value="" min="0" max="<?php echo $row['total']; ?>" step="any" /> |
| 2607 |
</div> |
| 2608 |
<span class="vbo-param-setting-comment"> |
| 2609 |
<?php echo JText::translate('VBOCUSTOMERCMMSONTOTAL') . ' ' . $currencysymb . ' ' . VikBooking::numberFormat($row['total']) . ' - ' . JText::translate('VBAMOUNTPAID') . ' ' . $currencysymb . ' ' . VikBooking::numberFormat($row['totpaid']); ?> |
| 2610 |
</span> |
| 2611 |
</div> |
| 2612 |
</div> |
| 2613 |
<div class="vbo-param-container"> |
| 2614 |
<div class="vbo-param-label"> |
| 2615 |
<label for="new_taking_descr"><?php echo JText::translate('VBLIBPAYNAME'); ?></label> |
| 2616 |
</div> |
| 2617 |
<div class="vbo-param-setting"> |
| 2618 |
<select id="new_taking_payid"> |
| 2619 |
<option value=""> </option> |
| 2620 |
<?php |
| 2621 |
foreach ($this->payments as $paymeth) { |
| 2622 |
?> |
| 2623 |
<option value="<?php echo $paymeth['id']; ?>"><?php echo $paymeth['name']; ?></option> |
| 2624 |
<?php |
| 2625 |
} |
| 2626 |
?> |
| 2627 |
</select> |
| 2628 |
</div> |
| 2629 |
</div> |
| 2630 |
<div class="vbo-param-container vbo-param-nested" id="vbo-new-taking-custom-wrap"> |
| 2631 |
<div class="vbo-param-label"> </div> |
| 2632 |
<div class="vbo-param-setting"> |
| 2633 |
<input id="new_taking_descr" type="text" value="" maxlength="200" placeholder="<?php echo $this->escape(JText::translate('VBPVIEWOPTIONALSTWO')); ?>" /> |
| 2634 |
</div> |
| 2635 |
</div> |
| 2636 |
</div> |
| 2637 |
</div> |
| 2638 |
</div> |
| 2639 |
</div> |
| 2640 |
</div> |
| 2641 |
</div> |
| 2642 |
|
| 2643 |
</div> |
| 2644 |
|
| 2645 |
<script type="text/javascript"> |
| 2646 |
jQuery(function() { |
| 2647 |
|
| 2648 |
jQuery('#new_taking_payid').on('change', function() { |
| 2649 |
if (jQuery(this).val()) { |
| 2650 |
jQuery('#vbo-new-taking-custom-wrap').hide(); |
| 2651 |
jQuery('#new_taking_descr').val(''); |
| 2652 |
} else { |
| 2653 |
jQuery('#vbo-new-taking-custom-wrap').show(); |
| 2654 |
} |
| 2655 |
}); |
| 2656 |
|
| 2657 |
jQuery('.vbo-takings-addnew').on('click', function() { |
| 2658 |
// build modal buttons |
| 2659 |
let footer_left = jQuery('<button></button>'); |
| 2660 |
footer_left.addClass('btn'); |
| 2661 |
footer_left.attr('type', 'button'); |
| 2662 |
footer_left.text(Joomla.JText._('VBANNULLA')); |
| 2663 |
footer_left.on('click', function() { |
| 2664 |
// dismiss the modal |
| 2665 |
VBOCore.emitEvent('vbo-eorder-new-taking-dismiss'); |
| 2666 |
}); |
| 2667 |
|
| 2668 |
let footer_right = jQuery('<button></button>'); |
| 2669 |
footer_right.addClass('btn btn-success'); |
| 2670 |
footer_right.attr('type', 'button'); |
| 2671 |
footer_right.text(Joomla.JText._('VBSAVE')); |
| 2672 |
footer_right.on('click', function() { |
| 2673 |
// disable button to prevent double submissions |
| 2674 |
let submit_btn = jQuery(this); |
| 2675 |
submit_btn.prop('disabled', true); |
| 2676 |
// make the request |
| 2677 |
VBOCore.doAjax( |
| 2678 |
"<?php echo VikBooking::ajaxUrl('index.php?option=com_vikbooking&task=bookings.add_taking'); ?>", |
| 2679 |
{ |
| 2680 |
bid: '<?php echo $row['id']; ?>', |
| 2681 |
amount: jQuery('#new_taking_amount').val(), |
| 2682 |
payid: jQuery('#new_taking_payid').val(), |
| 2683 |
descr: jQuery('#new_taking_descr').val(), |
| 2684 |
}, |
| 2685 |
(success) => { |
| 2686 |
// dismiss the modal |
| 2687 |
VBOCore.emitEvent('vbo-eorder-new-taking-dismiss'); |
| 2688 |
// reload the page by following the response URL |
| 2689 |
document.location.href = success.url; |
| 2690 |
}, |
| 2691 |
(error) => { |
| 2692 |
// re-enable submit button |
| 2693 |
submit_btn.prop('disabled', false); |
| 2694 |
// display error message |
| 2695 |
alert(error.responseText); |
| 2696 |
} |
| 2697 |
); |
| 2698 |
}); |
| 2699 |
|
| 2700 |
// display modal |
| 2701 |
let modal_body = VBOCore.displayModal({ |
| 2702 |
suffix: 'vbo-new-taking', |
| 2703 |
extra_class: 'vbo-modal-rounded vbo-modal-dialog', |
| 2704 |
title: Joomla.JText._('VBO_REG_NEW_PAYMENT'), |
| 2705 |
body: '', |
| 2706 |
body_prepend: true, |
| 2707 |
footer_left: footer_left, |
| 2708 |
footer_right: footer_right, |
| 2709 |
draggable: true, |
| 2710 |
dismiss_event: 'vbo-eorder-new-taking-dismiss', |
| 2711 |
onDismiss: () => { |
| 2712 |
jQuery('.vbo-eorder-newtaking-helper-cont').appendTo( |
| 2713 |
jQuery('.vbo-eorder-newtaking-helper-wrap') |
| 2714 |
); |
| 2715 |
}, |
| 2716 |
}); |
| 2717 |
|
| 2718 |
// reset helper input values |
| 2719 |
jQuery('#new_taking_amount').val(''); |
| 2720 |
jQuery('#new_taking_payid').prop('disabled', false).val('').trigger('change'); |
| 2721 |
jQuery('#new_taking_descr').val(''); |
| 2722 |
|
| 2723 |
// append modal body |
| 2724 |
jQuery('.vbo-eorder-newtaking-helper-cont').appendTo(modal_body); |
| 2725 |
}); |
| 2726 |
|
| 2727 |
jQuery('.vbo-booking-taking-edit').on('click', function() { |
| 2728 |
let edit_btn = jQuery(this); |
| 2729 |
let history_id = edit_btn.attr('data-historyid'); |
| 2730 |
let curr_amount_paid = edit_btn.attr('data-amount'); |
| 2731 |
let curr_pay_descr = edit_btn.closest('tr.vbo-booking-takings-row').find('td').last().text(); |
| 2732 |
|
| 2733 |
// build modal buttons |
| 2734 |
let footer_left = jQuery('<button></button>'); |
| 2735 |
footer_left.addClass('btn'); |
| 2736 |
footer_left.attr('type', 'button'); |
| 2737 |
footer_left.text(Joomla.JText._('VBANNULLA')); |
| 2738 |
footer_left.on('click', function() { |
| 2739 |
// dismiss the modal |
| 2740 |
VBOCore.emitEvent('vbo-eorder-edit-taking-dismiss'); |
| 2741 |
}); |
| 2742 |
|
| 2743 |
let footer_right = jQuery('<button></button>'); |
| 2744 |
footer_right.addClass('btn btn-success'); |
| 2745 |
footer_right.attr('type', 'button'); |
| 2746 |
footer_right.text(Joomla.JText._('VBO_UPDATE_PAYMENT')); |
| 2747 |
footer_right.on('click', function() { |
| 2748 |
// disable button to prevent double submissions |
| 2749 |
let submit_btn = jQuery(this); |
| 2750 |
submit_btn.prop('disabled', true); |
| 2751 |
// make the request |
| 2752 |
VBOCore.doAjax( |
| 2753 |
"<?php echo VikBooking::ajaxUrl('index.php?option=com_vikbooking&task=bookings.update_taking'); ?>", |
| 2754 |
{ |
| 2755 |
bid: '<?php echo $row['id']; ?>', |
| 2756 |
hid: history_id, |
| 2757 |
amount: jQuery('#new_taking_amount').val(), |
| 2758 |
descr: jQuery('#new_taking_descr').val(), |
| 2759 |
htype: 'PU', |
| 2760 |
}, |
| 2761 |
(success) => { |
| 2762 |
// dismiss the modal |
| 2763 |
VBOCore.emitEvent('vbo-eorder-edit-taking-dismiss'); |
| 2764 |
// reload the page by following the response URL |
| 2765 |
document.location.href = success.url; |
| 2766 |
}, |
| 2767 |
(error) => { |
| 2768 |
// re-enable submit button |
| 2769 |
submit_btn.prop('disabled', false); |
| 2770 |
// display error message |
| 2771 |
alert(error.responseText); |
| 2772 |
} |
| 2773 |
); |
| 2774 |
}); |
| 2775 |
|
| 2776 |
// display modal |
| 2777 |
let modal_body = VBOCore.displayModal({ |
| 2778 |
suffix: 'vbo-edit-taking', |
| 2779 |
extra_class: 'vbo-modal-rounded vbo-modal-dialog', |
| 2780 |
title: Joomla.JText._('VBO_UPDATE_PAYMENT'), |
| 2781 |
body: '', |
| 2782 |
body_prepend: true, |
| 2783 |
footer_left: footer_left, |
| 2784 |
footer_right: footer_right, |
| 2785 |
draggable: true, |
| 2786 |
dismiss_event: 'vbo-eorder-edit-taking-dismiss', |
| 2787 |
onDismiss: () => { |
| 2788 |
jQuery('.vbo-eorder-newtaking-helper-cont').appendTo( |
| 2789 |
jQuery('.vbo-eorder-newtaking-helper-wrap') |
| 2790 |
); |
| 2791 |
}, |
| 2792 |
}); |
| 2793 |
|
| 2794 |
// populate helper input values |
| 2795 |
jQuery('#new_taking_amount').val(curr_amount_paid); |
| 2796 |
jQuery('#new_taking_payid').val('').trigger('change').prop('disabled', true); |
| 2797 |
jQuery('#new_taking_descr').val(curr_pay_descr); |
| 2798 |
|
| 2799 |
// append modal body |
| 2800 |
jQuery('.vbo-eorder-newtaking-helper-cont').appendTo(modal_body); |
| 2801 |
}); |
| 2802 |
|
| 2803 |
jQuery('.vbo-booking-taking-delete').on('click', function() { |
| 2804 |
if (!confirm(Joomla.JText._('VBDELCONFIRM'))) { |
| 2805 |
return false; |
| 2806 |
} |
| 2807 |
let del_btn = jQuery(this); |
| 2808 |
del_btn.prop('disabled', true); |
| 2809 |
let history_id = del_btn.attr('data-historyid'); |
| 2810 |
// make the request |
| 2811 |
VBOCore.doAjax( |
| 2812 |
"<?php echo VikBooking::ajaxUrl('index.php?option=com_vikbooking&task=bookings.delete_history_record'); ?>", |
| 2813 |
{ |
| 2814 |
bid: '<?php echo $row['id']; ?>', |
| 2815 |
hid: history_id, |
| 2816 |
htype: 'PU', |
| 2817 |
}, |
| 2818 |
(success) => { |
| 2819 |
// reload the page by following the response URL |
| 2820 |
document.location.href = success.url; |
| 2821 |
}, |
| 2822 |
(error) => { |
| 2823 |
// re-enable delete button |
| 2824 |
del_btn.prop('disabled', false); |
| 2825 |
// display error message |
| 2826 |
alert(error.responseText); |
| 2827 |
} |
| 2828 |
); |
| 2829 |
}); |
| 2830 |
|
| 2831 |
}); |
| 2832 |
</script> |
| 2833 |
<?php |
| 2834 |
} |
| 2835 |
if ($history) { |
| 2836 |
?> |
| 2837 |
<div id="vbhistorydiv" class="vbo-extra-panel" style="display: none;"> |
| 2838 |
<div class="vbo-booking-history-container table-responsive"> |
| 2839 |
<table class="table"> |
| 2840 |
<thead> |
| 2841 |
<tr class="vbo-booking-history-firstrow"> |
| 2842 |
<td class="vbo-booking-history-td-type"><?php echo JText::translate('VBOBOOKHISTORYLBLTYPE'); ?></td> |
| 2843 |
<td class="vbo-booking-history-td-date"><?php echo JText::translate('VBOBOOKHISTORYLBLDATE'); ?></td> |
| 2844 |
<td class="vbo-booking-history-td-descr"><?php echo JText::translate('VBOBOOKHISTORYLBLDESC'); ?></td> |
| 2845 |
<td class="vbo-booking-history-td-totpaid"><?php echo JText::translate('VBOBOOKHISTORYLBLTPAID'); ?></td> |
| 2846 |
<td class="vbo-booking-history-td-tot"><?php echo JText::translate('VBOBOOKHISTORYLBLTOT'); ?></td> |
| 2847 |
</tr> |
| 2848 |
</thead> |
| 2849 |
<tbody> |
| 2850 |
<?php |
| 2851 |
foreach ($history as $hist) { |
| 2852 |
$hdescr = strpos((string) $hist['descr'], '<') !== false ? $hist['descr'] : nl2br((string) $hist['descr']); |
| 2853 |
?> |
| 2854 |
<tr class="vbo-booking-history-row"> |
| 2855 |
<td><?php echo $history_obj->validType($hist['type'], true); ?></td> |
| 2856 |
<td><?php echo JHtml::fetch('date', $hist['dt'], 'Y-m-d H:i:s'); ?></td> |
| 2857 |
<td><?php echo $hdescr; ?></td> |
| 2858 |
<td><?php echo $currencyname.' '.VikBooking::numberFormat($hist['totpaid']); ?></td> |
| 2859 |
<td><?php echo $currencyname.' '.VikBooking::numberFormat($hist['total']); ?></td> |
| 2860 |
</tr> |
| 2861 |
<?php |
| 2862 |
} |
| 2863 |
?> |
| 2864 |
</tbody> |
| 2865 |
</table> |
| 2866 |
</div> |
| 2867 |
</div> |
| 2868 |
<?php |
| 2869 |
} |
| 2870 |
?> |
| 2871 |
<div id="vbinvnotesdiv" class="vbo-extra-panel" style="display: none;"> |
| 2872 |
<textarea name="invnotes" id="invnotes" class="vbadminnotestarea"><?php echo $row['inv_notes']; ?></textarea> |
| 2873 |
<input type="submit" name="updinvnotes" value="<?php echo JText::translate('VBADMINNOTESUPD'); ?>" class="btn btn-success" /> |
| 2874 |
<button type="button" class="btn vbo-config-btn btn-secondary pull-right" onclick="document.getElementById('invnotes-hid').value=document.getElementById('invnotes').value;document.getElementById('vbo-gen-invoice').submit();"><?php VikBookingIcons::e('file-invoice'); ?> <?php echo JText::translate('VBOGENBOOKINGINVOICE'); ?></button> |
| 2875 |
</div> |
| 2876 |
<?php |
| 2877 |
if (!empty($row['paymentlog'])) { |
| 2878 |
?> |
| 2879 |
<div id="vbpaymentlogdiv" class="vbo-extra-panel" style="display: none;"> |
| 2880 |
<div class="vbo-eorder-paymentlog-buttons"> |
| 2881 |
<?php |
| 2882 |
// PCI Data Retrieval |
| 2883 |
$cc_acl_denied = false; |
| 2884 |
if (!empty($row['idorderota']) && !empty($row['channel'])) { |
| 2885 |
$channel_source = $row['channel']; |
| 2886 |
if (strpos($row['channel'], '_') !== false) { |
| 2887 |
$channelparts = explode('_', $row['channel']); |
| 2888 |
$channel_source = $channelparts[0]; |
| 2889 |
} |
| 2890 |
$checkout_info = getdate($row['checkout']); |
| 2891 |
|
| 2892 |
// validate ACL for credit card details |
| 2893 |
if (!$canDo->authorise('core.admin', 'com_vikchannelmanager')) { |
| 2894 |
// permissions to access VCM are required |
| 2895 |
$cc_acl_denied = true; |
| 2896 |
?> |
| 2897 |
<p class="err"><?php echo JText::translate('JERROR_ALERTNOAUTHOR'); ?></p> |
| 2898 |
<?php |
| 2899 |
} else { |
| 2900 |
/** |
| 2901 |
* Limit for accessing the credit card details has been changed to check-out |
| 2902 |
* day at 23:59:59 + 10 extra days. It used to be at 23:59:59 on check-out day. |
| 2903 |
* |
| 2904 |
* @since 1.13 |
| 2905 |
*/ |
| 2906 |
$cardlimit = mktime(23, 59, 59, $checkout_info['mon'], ($checkout_info['mday'] + 10), $checkout_info['year']); |
| 2907 |
$plain_log = htmlspecialchars($row['paymentlog']); |
| 2908 |
if (time() < $cardlimit && stripos($plain_log, 'card number') !== false && strpos($plain_log, '****') !== false) { |
| 2909 |
// log contains credit card details |
| 2910 |
// prepare modal (Credit Card Details) |
| 2911 |
array_push($vbo_modals_html, $vbo_app->getJmodalHtml('vbo-vcm-pcid', JText::translate('GETFULLCARDDETAILS'), '', 'width: 80%; height: 60%; margin-left: -40%; top: 20% !important;')); |
| 2912 |
?> |
| 2913 |
<div class="vcm-notif-pcidrq-container"> |
| 2914 |
<button type="button" class="btn vbo-config-btn vcm-pcid-launch" onclick="vboOpenJModal('vbo-vcm-pcid', 'index.php?option=com_vikchannelmanager&task=execpcid&channel_source=<?php echo $channel_source; ?>&otaid=<?php echo $row['idorderota']; ?>&tmpl=component');"><?php VikBookingIcons::e('credit-card'); ?> <?php echo JText::translate('GETFULLCARDDETAILS'); ?></button> |
| 2915 |
</div> |
| 2916 |
<?php |
| 2917 |
/** |
| 2918 |
* Check for automatic payment schedules support when an active CC/VCC is available. |
| 2919 |
* |
| 2920 |
* @since 1.16.10 (J) - 1.6.10 (WP) |
| 2921 |
*/ |
| 2922 |
$can_payschedule = false; |
| 2923 |
$active_payschedules = []; |
| 2924 |
try { |
| 2925 |
$processor = VBOModelReservation::getInstance($row, true)->getPaymentProcessor(); |
| 2926 |
if (method_exists($processor, 'isDirectChargeSupported') && $processor->isDirectChargeSupported()) { |
| 2927 |
// turn flag on |
| 2928 |
$can_payschedule = true; |
| 2929 |
// load current schedules |
| 2930 |
$active_payschedules = VBOModelPayschedules::getInstance()->getItems([ |
| 2931 |
'idorder' => [ |
| 2932 |
'value' => $row['id'], |
| 2933 |
], |
| 2934 |
]); |
| 2935 |
} |
| 2936 |
} catch (Exception $e) { |
| 2937 |
// do nothing |
| 2938 |
} |
| 2939 |
|
| 2940 |
if ($can_payschedule) { |
| 2941 |
// calculate the total amount scheduled |
| 2942 |
$tot_scheduled = 0; |
| 2943 |
foreach ($active_payschedules as $active_payschedule) { |
| 2944 |
if (!$active_payschedule->status) { |
| 2945 |
$tot_scheduled += $active_payschedule->amount; |
| 2946 |
} |
| 2947 |
} |
| 2948 |
|
| 2949 |
// display action buttons for payment schedules |
| 2950 |
?> |
| 2951 |
<div class="vbo-eorder-payschedules-wrap"> |
| 2952 |
<button type="button" class="btn btn-<?php echo $active_payschedules ? 'success' : 'primary'; ?> vbo-context-menu-btn vbo-context-menu-payschedules"> |
| 2953 |
<span class="vbo-context-menu-lbl"><?php echo JText::translate('VBO_AUTOPAY_SCHEDULED'); ?></span> |
| 2954 |
<span class="vbo-context-menu-ico"><?php VikBookingIcons::e('sort-down'); ?></span> |
| 2955 |
</button> |
| 2956 |
</div> |
| 2957 |
|
| 2958 |
<div class="vbo-eorder-newpayschedule-helper-wrap" style="display: none;"> |
| 2959 |
<div class="vbo-eorder-newpayschedule-helper-cont"> |
| 2960 |
<div class="vbo-admin-container vbo-admin-container-full vbo-admin-container-compact"> |
| 2961 |
<div class="vbo-params-wrap"> |
| 2962 |
<div class="vbo-params-container"> |
| 2963 |
<div class="vbo-params-block"> |
| 2964 |
<div class="vbo-param-container"> |
| 2965 |
<div class="vbo-param-label"> |
| 2966 |
<label for="new_payschedule_amount"><?php echo JText::translate('VBO_CC_AMOUNT'); ?></label> |
| 2967 |
</div> |
| 2968 |
<div class="vbo-param-setting"> |
| 2969 |
<div class="vbo-input-currency-wrap"> |
| 2970 |
<span><?php echo $currencysymb; ?></span> |
| 2971 |
<input type="number" id="new_payschedule_amount" value="<?php echo $tot_scheduled < $row['total'] ? ($row['total'] - $tot_scheduled) : 0; ?>" min="0" step="any" /> |
| 2972 |
</div> |
| 2973 |
<span class="vbo-param-setting-comment"><?php echo JText::translate('VBEDITORDERNINE') . ' ' . $currencysymb . ' ' . VikBooking::numberFormat($row['total']); ?></span> |
| 2974 |
</div> |
| 2975 |
</div> |
| 2976 |
<div class="vbo-param-container"> |
| 2977 |
<div class="vbo-param-label"> |
| 2978 |
<label for="new_payschedule_fordt"><?php echo JText::translate('VBPVIEWORDERSONE'); ?></label> |
| 2979 |
</div> |
| 2980 |
<div class="vbo-param-setting"> |
| 2981 |
<?php echo $vbo_app->getCalendar(date($df, $row['checkin']), 'new_payschedule_fordt', 'new_payschedule_fordt', $nowdf, array('class'=>'', 'size'=>'10', 'maxlength'=>'19', 'todayBtn' => 'true')); ?> |
| 2982 |
</div> |
| 2983 |
</div> |
| 2984 |
<div class="vbo-param-container"> |
| 2985 |
<div class="vbo-param-label"> |
| 2986 |
<label for="new_payschedule_fordtime"><?php echo JText::translate('VBO_REMINDER_TIME'); ?></label> |
| 2987 |
</div> |
| 2988 |
<div class="vbo-param-setting"> |
| 2989 |
<select id="new_payschedule_fordtime"> |
| 2990 |
<?php |
| 2991 |
for ($h = 0; $h < 24; $h++) { |
| 2992 |
$say_htime = ($h < 10 ? '0' : '') . $h; |
| 2993 |
?> |
| 2994 |
<option value="<?php echo $say_htime; ?>:00"><?php echo $say_htime; ?>:00</option> |
| 2995 |
<option value="<?php echo $say_htime; ?>:30"><?php echo $say_htime; ?>:30</option> |
| 2996 |
<?php |
| 2997 |
} |
| 2998 |
?> |
| 2999 |
</select> |
| 3000 |
</div> |
| 3001 |
</div> |
| 3002 |
</div> |
| 3003 |
</div> |
| 3004 |
</div> |
| 3005 |
</div> |
| 3006 |
</div> |
| 3007 |
</div> |
| 3008 |
|
| 3009 |
<script type="text/javascript"> |
| 3010 |
|
| 3011 |
// build base buttons list for context menu |
| 3012 |
var vbo_payschedule_btns = [ |
| 3013 |
// add new payment schedule button |
| 3014 |
{ |
| 3015 |
icon: '<?php echo VikBookingIcons::i('plus-circle'); ?>', |
| 3016 |
text: Joomla.JText._('VBO_NEW_PAYSCHEDULE'), |
| 3017 |
separator: true, |
| 3018 |
action: (root, config) => { |
| 3019 |
// build modal buttons |
| 3020 |
let footer_left = jQuery('<button></button>'); |
| 3021 |
footer_left.addClass('btn'); |
| 3022 |
footer_left.attr('type', 'button'); |
| 3023 |
footer_left.text(Joomla.JText._('VBANNULLA')); |
| 3024 |
footer_left.on('click', function() { |
| 3025 |
// dismiss the modal |
| 3026 |
VBOCore.emitEvent('vbo-eorder-new-payschedule-dismiss'); |
| 3027 |
}); |
| 3028 |
|
| 3029 |
let footer_right = jQuery('<button></button>'); |
| 3030 |
footer_right.addClass('btn btn-success'); |
| 3031 |
footer_right.attr('type', 'button'); |
| 3032 |
footer_right.text(Joomla.JText._('VBSAVE')); |
| 3033 |
footer_right.on('click', function() { |
| 3034 |
// disable button to prevent double submissions |
| 3035 |
let submit_btn = jQuery(this); |
| 3036 |
submit_btn.prop('disabled', true); |
| 3037 |
// make the request |
| 3038 |
VBOCore.doAjax( |
| 3039 |
"<?php echo VikBooking::ajaxUrl('index.php?option=com_vikbooking&task=payschedules.save'); ?>", |
| 3040 |
{ |
| 3041 |
bid: '<?php echo $row['id']; ?>', |
| 3042 |
amount: jQuery('#new_payschedule_amount').val(), |
| 3043 |
dt: jQuery('#new_payschedule_fordt').val(), |
| 3044 |
time: jQuery('#new_payschedule_fordtime').val(), |
| 3045 |
}, |
| 3046 |
(new_pay_schedules) => { |
| 3047 |
// re-enable submit button |
| 3048 |
submit_btn.prop('disabled', false); |
| 3049 |
// dismiss the modal |
| 3050 |
VBOCore.emitEvent('vbo-eorder-new-payschedule-dismiss'); |
| 3051 |
// populate the new schedule buttons |
| 3052 |
let new_pay_schedule_btns = []; |
| 3053 |
// push the button to add a new schedule |
| 3054 |
new_pay_schedule_btns.push(vbo_payschedule_btns[0]); |
| 3055 |
// push all active schedules |
| 3056 |
new_pay_schedules.forEach((payschedule) => { |
| 3057 |
new_pay_schedule_btns.push( |
| 3058 |
vboBuildPayScheduleBtn(payschedule) |
| 3059 |
); |
| 3060 |
}); |
| 3061 |
// update trigger button class |
| 3062 |
if (new_pay_schedules.length) { |
| 3063 |
jQuery('.vbo-context-menu-payschedules').removeClass('btn-primary').addClass('btn-success'); |
| 3064 |
} else { |
| 3065 |
jQuery('.vbo-context-menu-payschedules').removeClass('btn-success').addClass('btn-primary'); |
| 3066 |
} |
| 3067 |
// set new buttons in context menu |
| 3068 |
jQuery('.vbo-context-menu-payschedules').vboContextMenu('buttons', new_pay_schedule_btns); |
| 3069 |
}, |
| 3070 |
(error) => { |
| 3071 |
// re-enable submit button |
| 3072 |
submit_btn.prop('disabled', false); |
| 3073 |
// display error message |
| 3074 |
alert(error.responseText); |
| 3075 |
} |
| 3076 |
); |
| 3077 |
}); |
| 3078 |
|
| 3079 |
// display modal |
| 3080 |
let modal_body = VBOCore.displayModal({ |
| 3081 |
suffix: 'vbo-new-pay-schedule', |
| 3082 |
extra_class: 'vbo-modal-rounded vbo-modal-dialog', |
| 3083 |
title: Joomla.JText._('VBO_NEW_PAYSCHEDULE'), |
| 3084 |
body: '', |
| 3085 |
body_prepend: true, |
| 3086 |
footer_left: footer_left, |
| 3087 |
footer_right: footer_right, |
| 3088 |
draggable: true, |
| 3089 |
dismiss_event: 'vbo-eorder-new-payschedule-dismiss', |
| 3090 |
onDismiss: () => { |
| 3091 |
jQuery('.vbo-eorder-newpayschedule-helper-cont').appendTo( |
| 3092 |
jQuery('.vbo-eorder-newpayschedule-helper-wrap') |
| 3093 |
); |
| 3094 |
}, |
| 3095 |
}); |
| 3096 |
|
| 3097 |
// append modal body |
| 3098 |
jQuery('.vbo-eorder-newpayschedule-helper-cont').appendTo(modal_body); |
| 3099 |
}, |
| 3100 |
} |
| 3101 |
]; |
| 3102 |
|
| 3103 |
/** |
| 3104 |
* Builds a button object for the context menu from the given payment schedule object. |
| 3105 |
*/ |
| 3106 |
function vboBuildPayScheduleBtn(payschedule) { |
| 3107 |
let icn_to_process = '<?php echo VikBookingIcons::i('clock'); ?>'; |
| 3108 |
let icn_processed = '<?php echo VikBookingIcons::i('check-circle'); ?>'; |
| 3109 |
let icn_error = '<?php echo VikBookingIcons::i('exclamation-triangle'); ?>'; |
| 3110 |
let dt_unit = (payschedule.dt_diff.days || payschedule.dt_diff.weeks || payschedule.dt_diff.months || payschedule.dt_diff.years || 0); |
| 3111 |
let say_dt = !payschedule.dt_diff.past && dt_unit > 0 ? payschedule.dt_diff.relative : payschedule?.fordt; |
| 3112 |
if (!payschedule.dt_diff.past && (payschedule.dt_diff.sameday || payschedule.dt_diff.today)) { |
| 3113 |
say_dt = payschedule.dt_diff.relative + ' (' + payschedule.time_hm + ')'; |
| 3114 |
} else if (!payschedule.dt_diff.past && payschedule.dt_diff.tomorrow) { |
| 3115 |
say_dt = payschedule.dt_diff.relative + ' (' + payschedule.time_hm + ')'; |
| 3116 |
} |
| 3117 |
|
| 3118 |
return { |
| 3119 |
icon: ((payschedule.status || 0) > 0 ? (payschedule.status == 1 ? icn_processed : icn_error) : icn_to_process), |
| 3120 |
text: '<?php echo $currencysymb . ' '; ?>' + payschedule?.amount + ' - ' + say_dt, |
| 3121 |
class: ((payschedule.status || 0) == 1 ? 'vbo-context-menu-entry-success' : ((payschedule.status || 0) == 2 ? 'vbo-context-menu-entry-warning' : 'vbo-context-menu-entry-danger')), |
| 3122 |
separator: false, |
| 3123 |
action: (root, config) => { |
| 3124 |
if (payschedule.status == 0 || !payschedule.logs) { |
| 3125 |
// confirm deletion without displaying anything |
| 3126 |
if (confirm(Joomla.JText._('VBDELCONFIRM'))) { |
| 3127 |
// make the request |
| 3128 |
VBOCore.doAjax( |
| 3129 |
"<?php echo VikBooking::ajaxUrl('index.php?option=com_vikbooking&task=payschedules.delete'); ?>", |
| 3130 |
{ |
| 3131 |
bid: payschedule.idorder, |
| 3132 |
schedule_id: payschedule.id, |
| 3133 |
}, |
| 3134 |
(new_pay_schedules) => { |
| 3135 |
// populate the new schedule buttons |
| 3136 |
let new_pay_schedule_btns = []; |
| 3137 |
// push the button to add a new schedule |
| 3138 |
new_pay_schedule_btns.push(vbo_payschedule_btns[0]); |
| 3139 |
// push all active schedules |
| 3140 |
new_pay_schedules.forEach((payschedule) => { |
| 3141 |
new_pay_schedule_btns.push( |
| 3142 |
vboBuildPayScheduleBtn(payschedule) |
| 3143 |
); |
| 3144 |
}); |
| 3145 |
// update trigger button class |
| 3146 |
if (new_pay_schedules.length) { |
| 3147 |
jQuery('.vbo-context-menu-payschedules').removeClass('btn-primary').addClass('btn-success'); |
| 3148 |
} else { |
| 3149 |
jQuery('.vbo-context-menu-payschedules').removeClass('btn-success').addClass('btn-primary'); |
| 3150 |
} |
| 3151 |
// set new buttons in context menu |
| 3152 |
jQuery('.vbo-context-menu-payschedules').vboContextMenu('buttons', new_pay_schedule_btns); |
| 3153 |
}, |
| 3154 |
(error) => { |
| 3155 |
// display error message |
| 3156 |
alert(error.responseText); |
| 3157 |
} |
| 3158 |
); |
| 3159 |
} |
| 3160 |
} else { |
| 3161 |
// display modal on click with the execution logs |
| 3162 |
|
| 3163 |
// build modal buttons |
| 3164 |
let footer_left = jQuery('<button></button>'); |
| 3165 |
footer_left.addClass('btn'); |
| 3166 |
footer_left.attr('type', 'button'); |
| 3167 |
footer_left.text(Joomla.JText._('VBANNULLA')); |
| 3168 |
footer_left.on('click', function() { |
| 3169 |
// dismiss the modal |
| 3170 |
VBOCore.emitEvent('vbo-eorder-payschedule-logs-dismiss'); |
| 3171 |
}); |
| 3172 |
|
| 3173 |
let footer_right = jQuery('<button></button>'); |
| 3174 |
footer_right.addClass('btn btn-danger'); |
| 3175 |
footer_right.attr('type', 'button'); |
| 3176 |
footer_right.text(Joomla.JText._('VBELIMINA')); |
| 3177 |
footer_right.on('click', function() { |
| 3178 |
// confirm record deletion |
| 3179 |
if (confirm(Joomla.JText._('VBDELCONFIRM'))) { |
| 3180 |
// make the request |
| 3181 |
VBOCore.doAjax( |
| 3182 |
"<?php echo VikBooking::ajaxUrl('index.php?option=com_vikbooking&task=payschedules.delete'); ?>", |
| 3183 |
{ |
| 3184 |
bid: payschedule.idorder, |
| 3185 |
schedule_id: payschedule.id, |
| 3186 |
}, |
| 3187 |
(new_pay_schedules) => { |
| 3188 |
// dismiss the modal |
| 3189 |
VBOCore.emitEvent('vbo-eorder-payschedule-logs-dismiss'); |
| 3190 |
// populate the new schedule buttons |
| 3191 |
let new_pay_schedule_btns = []; |
| 3192 |
// push the button to add a new schedule |
| 3193 |
new_pay_schedule_btns.push(vbo_payschedule_btns[0]); |
| 3194 |
// push all active schedules |
| 3195 |
new_pay_schedules.forEach((payschedule) => { |
| 3196 |
new_pay_schedule_btns.push( |
| 3197 |
vboBuildPayScheduleBtn(payschedule) |
| 3198 |
); |
| 3199 |
}); |
| 3200 |
// update trigger button class |
| 3201 |
if (new_pay_schedules.length) { |
| 3202 |
jQuery('.vbo-context-menu-payschedules').removeClass('btn-primary').addClass('btn-success'); |
| 3203 |
} else { |
| 3204 |
jQuery('.vbo-context-menu-payschedules').removeClass('btn-success').addClass('btn-primary'); |
| 3205 |
} |
| 3206 |
// set new buttons in context menu |
| 3207 |
jQuery('.vbo-context-menu-payschedules').vboContextMenu('buttons', new_pay_schedule_btns); |
| 3208 |
}, |
| 3209 |
(error) => { |
| 3210 |
// display error message |
| 3211 |
alert(error.responseText); |
| 3212 |
} |
| 3213 |
); |
| 3214 |
} |
| 3215 |
}); |
| 3216 |
|
| 3217 |
// display modal |
| 3218 |
let modal_body = VBOCore.displayModal({ |
| 3219 |
suffix: 'vbo-pay-schedule-logs', |
| 3220 |
extra_class: 'vbo-modal-rounded vbo-modal-dialog', |
| 3221 |
title: payschedule.fordt, |
| 3222 |
body: '<pre>' + payschedule.logs + '</pre>', |
| 3223 |
footer_left: footer_left, |
| 3224 |
footer_right: footer_right, |
| 3225 |
draggable: true, |
| 3226 |
dismiss_event: 'vbo-eorder-payschedule-logs-dismiss', |
| 3227 |
}); |
| 3228 |
} |
| 3229 |
}, |
| 3230 |
}; |
| 3231 |
} |
| 3232 |
|
| 3233 |
// build context menu |
| 3234 |
jQuery(function() { |
| 3235 |
|
| 3236 |
// append active payment schedule buttons |
| 3237 |
let active_payschedules = <?php echo json_encode($active_payschedules); ?>; |
| 3238 |
active_payschedules.forEach((payschedule) => { |
| 3239 |
vbo_payschedule_btns.push( |
| 3240 |
vboBuildPayScheduleBtn(payschedule) |
| 3241 |
); |
| 3242 |
}); |
| 3243 |
|
| 3244 |
// render context menu |
| 3245 |
jQuery('.vbo-context-menu-payschedules').vboContextMenu({ |
| 3246 |
placement: 'bottom-left', |
| 3247 |
buttons: vbo_payschedule_btns, |
| 3248 |
}); |
| 3249 |
|
| 3250 |
}); |
| 3251 |
</script> |
| 3252 |
<?php |
| 3253 |
} |
| 3254 |
// end automatic payment schedules |
| 3255 |
} |
| 3256 |
} |
| 3257 |
} elseif (empty($row['idorderota']) && !empty($row['paymentlog']) && $row['status'] == 'standby') { |
| 3258 |
?> |
| 3259 |
<div class="vbo-eorder-emptyccdata"> |
| 3260 |
<a class="btn btn-warning" href="index.php?option=com_vikbooking&task=editorder&cid[]=<?php echo $row['id']; ?>&unset_cc=1" onclick="return confirm(Joomla.JText._('VBDELCONFIRM'));"><?php VikBookingIcons::e('broom'); ?> <?php echo JText::translate('VBO_EMPTY_DATA'); ?></a> |
| 3261 |
</div> |
| 3262 |
<?php |
| 3263 |
} |
| 3264 |
|
| 3265 |
/** |
| 3266 |
* Attempt to display the reporting invalid credit card layout from VCM. |
| 3267 |
* |
| 3268 |
* @requires VCM >= 1.8.27 |
| 3269 |
* |
| 3270 |
* @since 1.16.9 (J) - 1.6.9 (WP) |
| 3271 |
*/ |
| 3272 |
try { |
| 3273 |
// prepare the layout data array |
| 3274 |
$layout_data = [ |
| 3275 |
'caller' => 'vikbooking', |
| 3276 |
'booking' => $row, |
| 3277 |
]; |
| 3278 |
|
| 3279 |
?> |
| 3280 |
<div class="vbo-eorder-vcm-reporting-invalidcc"> |
| 3281 |
<?php |
| 3282 |
// render the reporting-invalidcc layout |
| 3283 |
echo JLayoutHelper::render('reporting.invalidcc', $layout_data, null, [ |
| 3284 |
'component' => 'com_vikchannelmanager', |
| 3285 |
'client' => 'administrator', |
| 3286 |
]); |
| 3287 |
?> |
| 3288 |
</div> |
| 3289 |
<?php |
| 3290 |
} catch(Throwable $e) { |
| 3291 |
// do nothing |
| 3292 |
} |
| 3293 |
|
| 3294 |
?> |
| 3295 |
</div> |
| 3296 |
<?php |
| 3297 |
|
| 3298 |
if (!$cc_acl_denied) { |
| 3299 |
?> |
| 3300 |
<pre><?php echo htmlspecialchars($row['paymentlog']); ?></pre> |
| 3301 |
<?php |
| 3302 |
} |
| 3303 |
?> |
| 3304 |
</div> |
| 3305 |
|
| 3306 |
<script type="text/javascript"> |
| 3307 |
if (window.location.hash == '#paymentlog') { |
| 3308 |
setTimeout(function() { |
| 3309 |
jQuery(".vbo-bookingdet-tab[data-vbotab='vbo-tab-admin']").trigger('click'); |
| 3310 |
vbToggleLog(document.getElementById('vbo-trig-paylogs')); |
| 3311 |
}, 500); |
| 3312 |
} |
| 3313 |
</script> |
| 3314 |
<?php |
| 3315 |
} |
| 3316 |
if (!$printreceipt && !is_null($messaging)) { |
| 3317 |
?> |
| 3318 |
<div id="vbmessagingdiv" class="vbo-extra-panel" style="display: none;"> |
| 3319 |
<?php echo $messaging->renderChat(); ?> |
| 3320 |
</div> |
| 3321 |
<script type="text/javascript"> |
| 3322 |
jQuery(function() { |
| 3323 |
if (window.location.hash == '#messaging') { |
| 3324 |
setTimeout(function() { |
| 3325 |
jQuery(".vbo-bookingdet-tab[data-vbotab='vbo-tab-admin']").trigger('click'); |
| 3326 |
vbToggleMessaging(document.getElementById('vbo-trig-messaging')); |
| 3327 |
}, 100); |
| 3328 |
} |
| 3329 |
}); |
| 3330 |
</script> |
| 3331 |
<?php |
| 3332 |
} |
| 3333 |
|
| 3334 |
foreach ($adminPanelForms as $legend => $form) |
| 3335 |
{ |
| 3336 |
$legendId = preg_replace("/[^a-zA-Z0-9_\-]+/", '', $legend); |
| 3337 |
?> |
| 3338 |
<div class="vbo-extra-panel" id="vboextrapanel-<?php echo $legendId; ?>" style="display: none;"> |
| 3339 |
<?php echo $form; ?> |
| 3340 |
</div> |
| 3341 |
<?php |
| 3342 |
} |
| 3343 |
?> |
| 3344 |
</div> |
| 3345 |
</div> |
| 3346 |
</div> |
| 3347 |
</div> |
| 3348 |
|
| 3349 |
<input type="hidden" name="task" value="editorder"> |
| 3350 |
<input type="hidden" name="vbo_active_tab" id="vbo_active_tab" value=""> |
| 3351 |
<input type="hidden" name="whereup" value="<?php echo $row['id']; ?>"> |
| 3352 |
<input type="hidden" name="cid[]" value="<?php echo $row['id']; ?>"> |
| 3353 |
<input type="hidden" name="option" value="com_vikbooking"> |
| 3354 |
<?php |
| 3355 |
$tmpl = VikRequest::getVar('tmpl'); |
| 3356 |
if ($tmpl == 'component') { |
| 3357 |
echo '<input type="hidden" name="tmpl" value="component" />'; |
| 3358 |
} |
| 3359 |
$pgoto = VikRequest::getString('goto', '', 'request'); |
| 3360 |
if (in_array($pgoto, ['overv', 'ratesoverv'])) { |
| 3361 |
echo '<input type="hidden" name="goto" value="' . $pgoto . '" />'; |
| 3362 |
} |
| 3363 |
?> |
| 3364 |
</form> |
| 3365 |
</div> |
| 3366 |
<?php |
| 3367 |
foreach ($vbo_modals_html as $modalhtml) { |
| 3368 |
echo $modalhtml; |
| 3369 |
} |
| 3370 |
?> |
| 3371 |
<form action="index.php?option=com_vikbooking&task=orders" method="post" id="vbo-gen-invoice"> |
| 3372 |
<input type="hidden" name="option" value="com_vikbooking" /> |
| 3373 |
<input type="hidden" name="task" value="orders" /> |
| 3374 |
<input type="hidden" name="cid[]" value="<?php echo $row['id']; ?>" /> |
| 3375 |
<input type="hidden" name="invnotes" id="invnotes-hid" value="" /> |
| 3376 |
</form> |
| 3377 |
|
| 3378 |
<div class="vbo-modal-overlay-block vbo-modal-overlay-block-sms-email"> |
| 3379 |
<a class="vbo-modal-overlay-close" href="javascript: void(0);"></a> |
| 3380 |
<div class="vbo-modal-overlay-content vbo-modal-overlay-content-large vbo-modal-overlay-content-sms-email"> |
| 3381 |
|
| 3382 |
<div class="vbo-modal-overlay-content-head vbo-modal-overlay-content-sms-email-head"> |
| 3383 |
<h3> |
| 3384 |
<span></span> |
| 3385 |
<span class="vbo-modal-overlay-close-times" onclick="vboToggleSendEmail();">×</span> |
| 3386 |
</h3> |
| 3387 |
</div> |
| 3388 |
|
| 3389 |
<div class="vbo-modal-overlay-content-body vbo-modal-overlay-content-body-scroll"> |
| 3390 |
|
| 3391 |
<div id="vbo-overlay-sms-cont" style="display: none;"> |
| 3392 |
<h4 style="display: none;"><?php echo JText::translate('VBSENDSMSACTION'); ?>: <span id="smstophone-lbl"><?php echo $row['phone']; ?></span></h4> |
| 3393 |
<form action="index.php?option=com_vikbooking" method="post" id="vbo-modal-form-sms"> |
| 3394 |
<div class="vbo-calendar-cfield-entry"> |
| 3395 |
<label for="smscont"><?php echo JText::translate('VBSENDSMSCUSTCONT'); ?></label> |
| 3396 |
<span><textarea name="smscont" id="smscont" style="width: 99%; min-width: 99%;max-width: 99%; height: 120px;"></textarea></span> |
| 3397 |
</div> |
| 3398 |
<input type="hidden" name="phone" id="smstophone" value="<?php echo $row['phone']; ?>" /> |
| 3399 |
<input type="hidden" name="goto" value="<?php echo urlencode('index.php?option=com_vikbooking&task=editorder&cid[]='.$row['id']); ?>" /> |
| 3400 |
<input type="hidden" name="task" value="sendcustomsms" /> |
| 3401 |
</form> |
| 3402 |
</div> |
| 3403 |
|
| 3404 |
<div id="vbo-overlay-email-cont" style="display: none;"> |
| 3405 |
<h4 style="display: none;"><?php echo JText::translate('VBSENDEMAILACTION'); ?>: <span id="emailto-lbl"><?php echo $row['custmail']; ?></span></h4> |
| 3406 |
<form action="index.php?option=com_vikbooking" method="post" enctype="multipart/form-data" id="vbo-modal-form-email"> |
| 3407 |
<input type="hidden" name="bid" value="<?php echo $row['id']; ?>" /> |
| 3408 |
<?php |
| 3409 |
$q = "SELECT `setting` FROM `#__vikbooking_config` WHERE `param`='customemailtpls';"; |
| 3410 |
$dbo->setQuery($q); |
| 3411 |
$cur_emtpl = $dbo->loadResult(); |
| 3412 |
|
| 3413 |
$cur_emtpl = empty($cur_emtpl) ? array() : json_decode($cur_emtpl, true); |
| 3414 |
$cur_emtpl = is_array($cur_emtpl) ? $cur_emtpl : array(); |
| 3415 |
|
| 3416 |
if ($cur_emtpl) { |
| 3417 |
?> |
| 3418 |
<div class="vbo-calendar-custmail-tpls-wrap"> |
| 3419 |
<select id="emtpl-customemail" onchange="vboLoadEmailTpl(this.value);"> |
| 3420 |
<option value=""><?php echo JText::translate('VBEMAILCUSTFROMTPL'); ?></option> |
| 3421 |
<?php |
| 3422 |
foreach ($cur_emtpl as $emk => $emv) { |
| 3423 |
?> |
| 3424 |
<optgroup label="<?php echo $emv['emailsubj']; ?>"> |
| 3425 |
<option value="<?php echo $emk; ?>"><?php echo JText::translate('VBEMAILCUSTFROMTPLUSE'); ?></option> |
| 3426 |
<option value="rm<?php echo $emk; ?>"><?php echo JText::translate('VBEMAILCUSTFROMTPLRM'); ?></option> |
| 3427 |
</optgroup> |
| 3428 |
<?php |
| 3429 |
} |
| 3430 |
?> |
| 3431 |
</select> |
| 3432 |
</div> |
| 3433 |
<?php |
| 3434 |
} |
| 3435 |
|
| 3436 |
/** |
| 3437 |
* Load all conditional text special tags. |
| 3438 |
* |
| 3439 |
* @since 1.14 (J) - 1.4.0 (WP) |
| 3440 |
*/ |
| 3441 |
$extra_btns = array(); |
| 3442 |
$condtext_tags = VikBooking::getConditionalRulesInstance()->getSpecialTags(); |
| 3443 |
if ($condtext_tags) { |
| 3444 |
$condtext_tags = array_keys($condtext_tags); |
| 3445 |
foreach ($condtext_tags as $tag) { |
| 3446 |
array_push($extra_btns, '<button type="button" class="btn btn-secondary btn-small vbo-condtext-specialtag-btn" onclick="setSpecialTplTag(\'emailcont\', \'' . $tag . '\');">' . $tag . '</button>'); |
| 3447 |
} |
| 3448 |
} |
| 3449 |
// |
| 3450 |
?> |
| 3451 |
<div class="vbo-calendar-cfields-wrap"> |
| 3452 |
<div class="vbo-calendar-cfield-entry"> |
| 3453 |
<label for="emailsubj"><?php echo JText::translate('VBSENDEMAILCUSTSUBJ'); ?></label> |
| 3454 |
<span><input type="text" name="emailsubj" id="emailsubj" value="" size="30" /></span> |
| 3455 |
</div> |
| 3456 |
<div class="vbo-calendar-cfield-entry"> |
| 3457 |
<label for="emailcont"><?php echo JText::translate('VBSENDEMAILCUSTCONT'); ?></label> |
| 3458 |
<?php |
| 3459 |
$special_tags_base = array( |
| 3460 |
'{customer_name}', |
| 3461 |
'{booking_id}', |
| 3462 |
'{checkin_date}', |
| 3463 |
'{checkout_date}', |
| 3464 |
'{num_nights}', |
| 3465 |
'{rooms_booked}', |
| 3466 |
'{rooms_names}', |
| 3467 |
'{tot_adults}', |
| 3468 |
'{tot_children}', |
| 3469 |
'{tot_guests}', |
| 3470 |
'{total}', |
| 3471 |
'{total_paid}', |
| 3472 |
'{remaining_balance}', |
| 3473 |
'{booking_link}', |
| 3474 |
); |
| 3475 |
|
| 3476 |
$special_tags_base_html = ''; |
| 3477 |
foreach ($special_tags_base as $sp_tag) { |
| 3478 |
$special_tags_base_html .= '<button type="button" class="btn btn-secondary btn-small" onclick="setSpecialTplTag(\'emailcont\', \'' . $sp_tag . '\');">' . $sp_tag . '</button>' . "\n"; |
| 3479 |
} |
| 3480 |
|
| 3481 |
/** |
| 3482 |
* Use the rich text editor (visual editor) to build custom email messages. |
| 3483 |
* |
| 3484 |
* @since 1.15.0 (J) - 1.5.0 (WP) |
| 3485 |
*/ |
| 3486 |
$tarea_attr = array( |
| 3487 |
'id' => 'emailcont', |
| 3488 |
'rows' => '7', |
| 3489 |
'cols' => '170', |
| 3490 |
'style' => 'width: 99%; min-width: 99%; max-width: 99%; height: 120px; margin-bottom: 1px;', |
| 3491 |
); |
| 3492 |
$editor_opts = array( |
| 3493 |
'modes' => array( |
| 3494 |
'text', |
| 3495 |
'visual', |
| 3496 |
), |
| 3497 |
); |
| 3498 |
$editor_btns = $special_tags_base; |
| 3499 |
if ($condtext_tags) { |
| 3500 |
$editor_btns = array_merge($editor_btns, $condtext_tags); |
| 3501 |
} |
| 3502 |
|
| 3503 |
/** |
| 3504 |
* Trigger event to allow third-party plugins to add custom special tags. |
| 3505 |
* |
| 3506 |
* @since 1.16.10 (J) - 1.6.10 (WP) |
| 3507 |
*/ |
| 3508 |
$custom_btns = VBOFactory::getPlatform()->getDispatcher()->filter('onRenderCustomEmailSpecialTags', [$row, $editor_btns]); |
| 3509 |
foreach ($custom_btns as $custom_btn) { |
| 3510 |
// merge custom buttons |
| 3511 |
$editor_btns = array_merge($editor_btns, (array) $custom_btn); |
| 3512 |
} |
| 3513 |
|
| 3514 |
// make sure to filter empty buttons |
| 3515 |
$editor_btns = array_filter($editor_btns); |
| 3516 |
|
| 3517 |
// render visual editor |
| 3518 |
echo $vbo_app->renderVisualEditor('emailcont', '', $tarea_attr, $editor_opts, $editor_btns); |
| 3519 |
?> |
| 3520 |
<div class="btn-group pull-left vbo-smstpl-bgroup vbo-custmail-bgroup vik-contentbuilder-textmode-sptags"> |
| 3521 |
<?php echo $special_tags_base_html . "\n" . implode("\n", $extra_btns); ?> |
| 3522 |
</div> |
| 3523 |
</div> |
| 3524 |
<div class="vbo-calendar-cfield-entry"> |
| 3525 |
<label for="emailattch"><?php echo JText::translate('VBSENDEMAILCUSTATTCH'); ?></label> |
| 3526 |
<span><input type="file" name="emailattch" id="emailattch" /></span> |
| 3527 |
</div> |
| 3528 |
<div class="vbo-calendar-cfield-entry"> |
| 3529 |
<label for="emailfrom"><?php echo JText::translate('VBSENDEMAILCUSTFROM'); ?></label> |
| 3530 |
<span><input type="text" name="emailfrom" id="emailfrom" value="<?php echo VikBooking::getSenderMail(); ?>" size="30" /></span> |
| 3531 |
</div> |
| 3532 |
</div> |
| 3533 |
<input type="hidden" name="email" id="emailto" value="<?php echo $row['custmail']; ?>" /> |
| 3534 |
<input type="hidden" name="goto" value="<?php echo urlencode('index.php?option=com_vikbooking&task=editorder&cid[]='.$row['id']); ?>" /> |
| 3535 |
<input type="hidden" name="task" value="sendcustomemail" /> |
| 3536 |
</form> |
| 3537 |
</div> |
| 3538 |
|
| 3539 |
</div> |
| 3540 |
|
| 3541 |
<div class="vbo-modal-overlay-content-footer"> |
| 3542 |
<div class="vbo-modal-overlay-content-footer-right"> |
| 3543 |
<div id="vbo-modal-footer-sms" style="display: none;"> |
| 3544 |
<button type="submit" class="btn vbo-config-btn" onclick="document.getElementById('vbo-modal-form-sms').submit();"><?php VikBookingIcons::e('comment'); ?> <?php echo JText::translate('VBSENDSMSACTION'); ?></button> |
| 3545 |
</div> |
| 3546 |
<div id="vbo-modal-footer-email" style="display: none;"> |
| 3547 |
<button type="submit" class="btn vbo-config-btn" onclick="document.getElementById('vbo-modal-form-email').submit();"><?php VikBookingIcons::e('envelope'); ?> <?php echo JText::translate('VBSENDEMAILACTION'); ?></button> |
| 3548 |
</div> |
| 3549 |
</div> |
| 3550 |
</div> |
| 3551 |
|
| 3552 |
</div> |
| 3553 |
</div> |
| 3554 |
|
| 3555 |
<script type="text/javascript"> |
| 3556 |
var vbo_overlay_on = false; |
| 3557 |
var vbo_print_only = false; |
| 3558 |
if (jQuery.isFunction(jQuery.fn.tooltip)) { |
| 3559 |
jQuery(".hasTooltip").tooltip(); |
| 3560 |
} |
| 3561 |
function vboToggleSendSMS() { |
| 3562 |
var cur_phone = jQuery("#smstophone").val(); |
| 3563 |
var phone_set = jQuery("#custphone").trigger('vboupdatephonenumber').val(); |
| 3564 |
if (phone_set.length && phone_set != cur_phone) { |
| 3565 |
jQuery("#smstophone").val(phone_set); |
| 3566 |
jQuery("#smstophone-lbl").text(phone_set); |
| 3567 |
} |
| 3568 |
|
| 3569 |
// toggle email/sms contents |
| 3570 |
jQuery("#vbo-overlay-email-cont, #vbo-modal-footer-email").hide(); |
| 3571 |
jQuery("#vbo-overlay-sms-cont, #vbo-modal-footer-sms").show(); |
| 3572 |
var use_modal_title = jQuery("#vbo-overlay-sms-cont").find('h4').first().html(); |
| 3573 |
jQuery('.vbo-modal-overlay-content-sms-email-head').find('h3').find('span').first().html(use_modal_title); |
| 3574 |
|
| 3575 |
jQuery(".vbo-modal-overlay-block-sms-email").fadeToggle(400, function() { |
| 3576 |
if (jQuery(".vbo-modal-overlay-block-sms-email").is(":visible")) { |
| 3577 |
vbo_overlay_on = true; |
| 3578 |
} else { |
| 3579 |
vbo_overlay_on = false; |
| 3580 |
} |
| 3581 |
}); |
| 3582 |
} |
| 3583 |
function vboToggleSendEmail() { |
| 3584 |
var cur_email = jQuery("#emailto").val(); |
| 3585 |
var email_set = jQuery("#custmail").val(); |
| 3586 |
if (email_set.length && email_set != cur_email) { |
| 3587 |
jQuery("#emailto").val(email_set); |
| 3588 |
jQuery("#emailto-lbl").text(email_set); |
| 3589 |
} |
| 3590 |
|
| 3591 |
// toggle email/sms contents |
| 3592 |
jQuery("#vbo-overlay-sms-cont, #vbo-modal-footer-sms").hide(); |
| 3593 |
jQuery("#vbo-overlay-email-cont, #vbo-modal-footer-email").show(); |
| 3594 |
var use_modal_title = jQuery("#vbo-overlay-email-cont").find('h4').first().html(); |
| 3595 |
jQuery('.vbo-modal-overlay-content-sms-email-head').find('h3').find('span').first().html(use_modal_title); |
| 3596 |
|
| 3597 |
jQuery(".vbo-modal-overlay-block-sms-email").fadeToggle(400, function() { |
| 3598 |
if (jQuery(".vbo-modal-overlay-block-sms-email").is(":visible")) { |
| 3599 |
vbo_overlay_on = true; |
| 3600 |
} else { |
| 3601 |
vbo_overlay_on = false; |
| 3602 |
} |
| 3603 |
}); |
| 3604 |
} |
| 3605 |
function vboKeyupEmail(event) { |
| 3606 |
if (event.key && event.key == 'Enter') { |
| 3607 |
event.preventDefault(); |
| 3608 |
document.adminForm.submit(); |
| 3609 |
return; |
| 3610 |
} |
| 3611 |
jQuery('.vbo-bookingdet-save-email').show(); |
| 3612 |
} |
| 3613 |
function setSpecialTplTag(taid, tpltag) { |
| 3614 |
var tplobj = document.getElementById(taid); |
| 3615 |
if (tplobj != null) { |
| 3616 |
var start = tplobj.selectionStart; |
| 3617 |
var end = tplobj.selectionEnd; |
| 3618 |
tplobj.value = tplobj.value.substring(0, start) + tpltag + tplobj.value.substring(end); |
| 3619 |
tplobj.selectionStart = tplobj.selectionEnd = start + tpltag.length; |
| 3620 |
tplobj.focus(); |
| 3621 |
} |
| 3622 |
} |
| 3623 |
jQuery(function() { |
| 3624 |
// register to the event emitted when a new payment is made through the virtual terminal widget |
| 3625 |
document.addEventListener('vbo_new_payment_transaction', (e) => { |
| 3626 |
if (!e || !e.detail || !e.detail.hasOwnProperty('tn') || !e.detail['tn']) { |
| 3627 |
// do nothing |
| 3628 |
return; |
| 3629 |
} |
| 3630 |
// reload the page to display the updated information |
| 3631 |
location.reload(); |
| 3632 |
}); |
| 3633 |
// register to the event emitted when a booking is modified through an admin widget |
| 3634 |
document.addEventListener('vbo_booking_modified', (e) => { |
| 3635 |
if (!e || !e.detail || !e.detail.hasOwnProperty('bid') || !e.detail['bid']) { |
| 3636 |
// do nothing |
| 3637 |
return; |
| 3638 |
} |
| 3639 |
// reload the page to display the new information about the booking just modified |
| 3640 |
location.reload(); |
| 3641 |
}); |
| 3642 |
// remove overbooking flag |
| 3643 |
jQuery('.vbo-label-overbooking').on('click', function() { |
| 3644 |
if (confirm(Joomla.JText._('VBO_CONF_RM_OVERBOOKING_FLAG'))) { |
| 3645 |
VBOCore.doAjax( |
| 3646 |
"<?php echo VikBooking::ajaxUrl('index.php?option=com_vikbooking&task=bookings.delete_type_flag'); ?>", |
| 3647 |
{ |
| 3648 |
bid: '<?php echo $row['id']; ?>', |
| 3649 |
flag: 'overbooking', |
| 3650 |
}, |
| 3651 |
(success) => { |
| 3652 |
// remove "overbooking" label |
| 3653 |
let parent_label = jQuery('.vbo-bookdet-container').find('.vbo-label-overbooking').parent('.label'); |
| 3654 |
jQuery('.vbo-bookdet-container').find('.vbo-label-overbooking').remove(); |
| 3655 |
parent_label.text(parent_label.text().replace(' / ', '')); |
| 3656 |
}, |
| 3657 |
(error) => { |
| 3658 |
alert(error.responseText); |
| 3659 |
} |
| 3660 |
); |
| 3661 |
} |
| 3662 |
}); |
| 3663 |
// sessionStorage for current tab |
| 3664 |
if (typeof sessionStorage !== 'undefined' && !window.location.hash && <?php echo $printreceipt ? 'false' : 'true'; ?>) { |
| 3665 |
var curtab = sessionStorage.getItem('vboEditOrderTab<?php echo $row['id']; ?>'); |
| 3666 |
|
| 3667 |
setTimeout(() => { |
| 3668 |
let link = jQuery('.vbo-bookingdet-noteslogs-btn[data-id="' + curtab + '"] a'); |
| 3669 |
|
| 3670 |
if (link.length) { |
| 3671 |
jQuery(".vbo-bookingdet-tab[data-vbotab='vbo-tab-admin']").trigger('click'); |
| 3672 |
link.trigger('click'); |
| 3673 |
} |
| 3674 |
}, 128); |
| 3675 |
} |
| 3676 |
if (window.location.hash == '#tab-admin') { |
| 3677 |
setTimeout(function() { |
| 3678 |
jQuery(".vbo-bookingdet-tab[data-vbotab='vbo-tab-admin']").trigger('click'); |
| 3679 |
}, 100); |
| 3680 |
} |
| 3681 |
// Search customer - Start |
| 3682 |
var vbocustsdelay = (function() { |
| 3683 |
var timer = 0; |
| 3684 |
return function(callback, ms) { |
| 3685 |
clearTimeout(timer); |
| 3686 |
timer = setTimeout(callback, ms); |
| 3687 |
}; |
| 3688 |
})(); |
| 3689 |
function vboCustomerSearch(words) { |
| 3690 |
jQuery("#vbo-searchcust-res").hide().html(""); |
| 3691 |
jQuery("#vbo-searchcust-loading").show(); |
| 3692 |
var jqxhr = jQuery.ajax({ |
| 3693 |
type: "POST", |
| 3694 |
url: "<?php echo VikBooking::ajaxUrl('index.php?option=com_vikbooking&task=searchcustomer'); ?>", |
| 3695 |
data: { |
| 3696 |
kw: words, |
| 3697 |
tmpl: "component" |
| 3698 |
} |
| 3699 |
}).done(function(cont) { |
| 3700 |
if (cont) { |
| 3701 |
var obj_res = typeof cont === 'string' ? JSON.parse(cont) : cont; |
| 3702 |
customers_search_vals = obj_res[0]; |
| 3703 |
jQuery("#vbo-searchcust-res").html(obj_res[1]); |
| 3704 |
} else { |
| 3705 |
customers_search_vals = ""; |
| 3706 |
jQuery("#vbo-searchcust-res").html("----"); |
| 3707 |
} |
| 3708 |
jQuery("#vbo-searchcust-res").show(); |
| 3709 |
jQuery("#vbo-searchcust-loading").hide(); |
| 3710 |
}).fail(function() { |
| 3711 |
jQuery("#vbo-searchcust-loading").hide(); |
| 3712 |
alert("Error Searching."); |
| 3713 |
}); |
| 3714 |
} |
| 3715 |
jQuery("#vbo-searchcust").keyup(function(event) { |
| 3716 |
vbocustsdelay(function() { |
| 3717 |
var keywords = jQuery("#vbo-searchcust").val(); |
| 3718 |
var chars = keywords.length; |
| 3719 |
if (chars > 1) { |
| 3720 |
if ((event.which > 96 && event.which < 123) || (event.which > 64 && event.which < 91) || event.which == 13) { |
| 3721 |
vboCustomerSearch(keywords); |
| 3722 |
} |
| 3723 |
} else { |
| 3724 |
if (jQuery("#vbo-searchcust-res").is(":visible")) { |
| 3725 |
jQuery("#vbo-searchcust-res").hide(); |
| 3726 |
} |
| 3727 |
} |
| 3728 |
}, 600); |
| 3729 |
}); |
| 3730 |
jQuery("body").on("click", ".vbo-custsearchres-entry", function() { |
| 3731 |
var custid = jQuery(this).attr("data-custid"); |
| 3732 |
if (confirm('<?php echo addslashes(JText::translate('VBOASSIGNNEWCUSTCONF')); ?>')) { |
| 3733 |
jQuery('#newcustid').val(custid); |
| 3734 |
document.adminForm.submit(); |
| 3735 |
return; |
| 3736 |
} |
| 3737 |
}); |
| 3738 |
// Search customer - End |
| 3739 |
jQuery(document).mouseup(function(e) { |
| 3740 |
if (!vbo_overlay_on) { |
| 3741 |
return false; |
| 3742 |
} |
| 3743 |
var vbo_overlay_cont = jQuery(".vbo-modal-overlay-content-sms-email"); |
| 3744 |
if (!vbo_overlay_cont.is(e.target) && vbo_overlay_cont.has(e.target).length === 0 && !jQuery(e.target).is('svg')) { |
| 3745 |
jQuery(".vbo-modal-overlay-block-sms-email").fadeOut(); |
| 3746 |
vbo_overlay_on = false; |
| 3747 |
} |
| 3748 |
}); |
| 3749 |
jQuery(document).keyup(function(e) { |
| 3750 |
if (e.keyCode == 27 && vbo_overlay_on) { |
| 3751 |
jQuery(".vbo-modal-overlay-block-sms-email").fadeOut(); |
| 3752 |
vbo_overlay_on = false; |
| 3753 |
} |
| 3754 |
}); |
| 3755 |
jQuery(".vbo-bookingdet-tab").click(function() { |
| 3756 |
var newtabrel = jQuery(this).attr('data-vbotab'); |
| 3757 |
var oldtabrel = jQuery(".vbo-bookingdet-tab-active").attr('data-vbotab'); |
| 3758 |
if (newtabrel == oldtabrel) { |
| 3759 |
return; |
| 3760 |
} |
| 3761 |
if (newtabrel == 'vbo-tab-details' && typeof sessionStorage !== 'undefined') { |
| 3762 |
sessionStorage.setItem('vboEditOrderTab<?php echo $row['id']; ?>', 'details'); |
| 3763 |
} |
| 3764 |
jQuery(".vbo-bookingdet-tab").removeClass("vbo-bookingdet-tab-active"); |
| 3765 |
jQuery(this).addClass("vbo-bookingdet-tab-active"); |
| 3766 |
jQuery("#"+oldtabrel).hide(); |
| 3767 |
jQuery("#"+newtabrel).fadeIn(); |
| 3768 |
jQuery("#vbo_active_tab").val(newtabrel); |
| 3769 |
}); |
| 3770 |
jQuery(".vbo-bookingdet-tab[data-vbotab='<?php echo $pactive_tab; ?>']").trigger('click'); |
| 3771 |
// edit amount paid |
| 3772 |
jQuery('#vbo-amountpaid-edit').click(function() { |
| 3773 |
jQuery('#vbo-amountpaid-cont').hide(); |
| 3774 |
jQuery('#vbo-amountpaid-modcont').show(); |
| 3775 |
jQuery('input[name="newamountpaid"]').prop('disabled', false); |
| 3776 |
if (jQuery('input[name="newamountrefunded"]').length) { |
| 3777 |
jQuery('input[name="newamountrefunded"]').val(''); |
| 3778 |
} |
| 3779 |
}); |
| 3780 |
jQuery('#vbo-amountpaid-cancedit').click(function() { |
| 3781 |
jQuery('#vbo-amountpaid-modcont').hide(); |
| 3782 |
jQuery('#vbo-amountpaid-cont').show(); |
| 3783 |
}); |
| 3784 |
// edit amount refunded |
| 3785 |
jQuery('#vbo-amountrefunded-edit').click(function() { |
| 3786 |
jQuery('#vbo-amountrefunded-cont').hide(); |
| 3787 |
jQuery('#vbo-amountrefunded-modcont').show(); |
| 3788 |
jQuery('input[name="newamountrefunded"]').prop('disabled', false); |
| 3789 |
if (jQuery('input[name="newamountpaid"]').length) { |
| 3790 |
jQuery('input[name="newamountpaid"]').val(''); |
| 3791 |
} |
| 3792 |
}); |
| 3793 |
jQuery('#vbo-amountrefunded-cancedit').click(function() { |
| 3794 |
jQuery('#vbo-amountrefunded-modcont').hide(); |
| 3795 |
jQuery('#vbo-amountrefunded-cont').show(); |
| 3796 |
}); |
| 3797 |
// edit amount payable |
| 3798 |
jQuery('#vbo-amountpayable-edit').click(function() { |
| 3799 |
jQuery('#vbo-amountpayable-cont').hide(); |
| 3800 |
jQuery('#vbo-amountpayable-modcont').show(); |
| 3801 |
jQuery('input[name="newamountpayable"]').prop('disabled', false); |
| 3802 |
}); |
| 3803 |
jQuery('#vbo-amountpayable-cancedit').click(function() { |
| 3804 |
jQuery('#vbo-amountpayable-modcont').hide(); |
| 3805 |
jQuery('#vbo-amountpayable-cont').show(); |
| 3806 |
}); |
| 3807 |
// edit cancellation fee |
| 3808 |
jQuery('#vbo-cancfee-edit').click(function() { |
| 3809 |
jQuery('#vbo-cancfee-cont').hide(); |
| 3810 |
jQuery('#vbo-cancfee-modcont').show(); |
| 3811 |
jQuery('input[name="newcancfee"]').prop('disabled', false); |
| 3812 |
}); |
| 3813 |
jQuery('#vbo-cancfee-cancedit').click(function() { |
| 3814 |
jQuery('#vbo-cancfee-modcont').hide(); |
| 3815 |
jQuery('#vbo-cancfee-cont').show(); |
| 3816 |
}); |
| 3817 |
// chat listener |
| 3818 |
if (typeof VCMChat !== 'undefined') { |
| 3819 |
jQuery(window).on('chatsync', function(e) { |
| 3820 |
if (!jQuery("#vcm-chat-audio-notification").length) { |
| 3821 |
jQuery("body").append("<audio id=\"vcm-audio-notification\" preload=\"auto\"><source type=\"audio/mp3\" src=\"<?php echo VCM_ADMIN_URI; ?>assets/css/audio/new_chat_message.mp3\"></source></audio>"); |
| 3822 |
} |
| 3823 |
try { |
| 3824 |
var promise = document.getElementById('vcm-audio-notification').play(); |
| 3825 |
console.log(promise); |
| 3826 |
} catch (err) { |
| 3827 |
console.warn('Could not play sound', err); |
| 3828 |
} |
| 3829 |
}); |
| 3830 |
} |
| 3831 |
|
| 3832 |
// zoom-able avatars |
| 3833 |
jQuery('.vbo-customer-info-box-avatar').each(function() { |
| 3834 |
var img = jQuery(this).find('img'); |
| 3835 |
if (!img.length) { |
| 3836 |
return; |
| 3837 |
} |
| 3838 |
// register click listener |
| 3839 |
img.on('click', function(e) { |
| 3840 |
// stop events propagation |
| 3841 |
e.preventDefault(); |
| 3842 |
e.stopPropagation(); |
| 3843 |
|
| 3844 |
// check for caption |
| 3845 |
var caption = jQuery(this).attr('data-caption'); |
| 3846 |
|
| 3847 |
// build modal content |
| 3848 |
var zoom_modal = jQuery('<div></div>').addClass('vbo-modal-overlay-block vbo-modal-overlay-zoom-image').css('display', 'block'); |
| 3849 |
var zoom_dismiss = jQuery('<a></a>').addClass('vbo-modal-overlay-close'); |
| 3850 |
zoom_dismiss.on('click', function() { |
| 3851 |
jQuery('.vbo-modal-overlay-zoom-image').fadeOut(); |
| 3852 |
}); |
| 3853 |
zoom_modal.append(zoom_dismiss); |
| 3854 |
var zoom_content = jQuery('<div></div>').addClass('vbo-modal-overlay-content vbo-modal-overlay-content-zoom-image'); |
| 3855 |
var zoom_head = jQuery('<div></div>').addClass('vbo-modal-overlay-content-head'); |
| 3856 |
var zoom_head_title = jQuery('<span></span>'); |
| 3857 |
if (caption) { |
| 3858 |
zoom_head_title.text(caption); |
| 3859 |
} |
| 3860 |
var zoom_head_close = jQuery('<span></span>').addClass('vbo-modal-overlay-close-times').html('×'); |
| 3861 |
zoom_head_close.on('click', function() { |
| 3862 |
jQuery('.vbo-modal-overlay-zoom-image').fadeOut(); |
| 3863 |
}); |
| 3864 |
zoom_head.append(zoom_head_title).append(zoom_head_close); |
| 3865 |
var zoom_body = jQuery('<div></div>').addClass('vbo-modal-overlay-content-body vbo-modal-overlay-content-body-scroll'); |
| 3866 |
var zoom_image = jQuery('<div></div>').addClass('vbo-modal-zoom-image-wrap'); |
| 3867 |
zoom_image.append(jQuery(this).clone()); |
| 3868 |
zoom_body.append(zoom_image); |
| 3869 |
zoom_content.append(zoom_head).append(zoom_body); |
| 3870 |
zoom_modal.append(zoom_content); |
| 3871 |
// append modal to body |
| 3872 |
if (jQuery('.vbo-modal-overlay-zoom-image').length) { |
| 3873 |
jQuery('.vbo-modal-overlay-zoom-image').remove(); |
| 3874 |
} |
| 3875 |
jQuery('body').append(zoom_modal); |
| 3876 |
}); |
| 3877 |
}); |
| 3878 |
|
| 3879 |
// emit the event to read all notifications in the current context |
| 3880 |
VBOCore.emitEvent('vbo-nc-read-notifications', { |
| 3881 |
criteria: { |
| 3882 |
group: '<?php echo !empty($row['idorderota']) && !empty($row['channel']) ? 'otas' : 'website'; ?>', |
| 3883 |
idorder: '<?php echo $row['id']; ?>', |
| 3884 |
} |
| 3885 |
}); |
| 3886 |
|
| 3887 |
}); |
| 3888 |
var cur_emtpl = <?php echo json_encode($cur_emtpl); ?>; |
| 3889 |
function vboLoadEmailTpl(tplind) { |
| 3890 |
if (!(tplind.length > 0)) { |
| 3891 |
jQuery('#emailsubj').val(''); |
| 3892 |
jQuery('#emailcont').val('').trigger('change'); |
| 3893 |
return true; |
| 3894 |
} |
| 3895 |
if (tplind.substr(0, 2) == 'rm') { |
| 3896 |
if (confirm(Joomla.JText._('VBDELCONFIRM'))) { |
| 3897 |
document.location.href = 'index.php?option=com_vikbooking&task=rmcustomemailtpl&cid[]=<?php echo $row['id']; ?>&tplind='+tplind.substr(2); |
| 3898 |
} |
| 3899 |
return false; |
| 3900 |
} |
| 3901 |
if (!cur_emtpl.hasOwnProperty(tplind)) { |
| 3902 |
jQuery('#emailsubj').val(''); |
| 3903 |
jQuery('#emailcont').val('').trigger('change'); |
| 3904 |
return true; |
| 3905 |
} |
| 3906 |
jQuery('#emailsubj').val(cur_emtpl[tplind]['emailsubj']); |
| 3907 |
jQuery('#emailcont').val(cur_emtpl[tplind]['emailcont']).trigger('change'); |
| 3908 |
jQuery('#emailfrom').val(cur_emtpl[tplind]['emailfrom']); |
| 3909 |
return true; |
| 3910 |
} |
| 3911 |
<?php |
| 3912 |
$pcustomemail = VikRequest::getInt('customemail', '', 'request'); |
| 3913 |
if ($pcustomemail > 0) { |
| 3914 |
?> |
| 3915 |
vboToggleSendEmail(); |
| 3916 |
<?php |
| 3917 |
} |
| 3918 |
if ($printreceipt) { |
| 3919 |
?> |
| 3920 |
jQuery(function() { |
| 3921 |
jQuery('button, .vbo-bookingdet-innertop').hide(); |
| 3922 |
jQuery('body').find('a').each(function(k, v) { |
| 3923 |
jQuery(this).replaceWith(jQuery(this).html()); |
| 3924 |
}); |
| 3925 |
jQuery('body').find("input[type='text']").each(function(k, v) { |
| 3926 |
jQuery(this).replaceWith(jQuery(this).val()); |
| 3927 |
}); |
| 3928 |
}); |
| 3929 |
function vboMakePrintOnly() { |
| 3930 |
vbo_print_only = true; |
| 3931 |
jQuery(".vbo-receipt-numdate-block").remove(); |
| 3932 |
jQuery("#vbo-receipt-print-btn-name").text("<?php echo addslashes(JText::translate('VBOPRINT')); ?>"); |
| 3933 |
} |
| 3934 |
function vboLaunchPrintReceipt() { |
| 3935 |
var rcnotes = jQuery('#vbo-receipt-notes').val(); |
| 3936 |
var rnewnum = jQuery('#vbo-receipt-num-inp').val(); |
| 3937 |
if (rcnotes.length) { |
| 3938 |
if (rcnotes.indexOf('<') < 0) { |
| 3939 |
rcnotes = rcnotes.replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g, '$1<br />$2'); |
| 3940 |
} |
| 3941 |
jQuery('#vbo-receipt-notes-val').html(rcnotes); |
| 3942 |
} else { |
| 3943 |
jQuery('.vbo-receipt-notes-container').remove(); |
| 3944 |
} |
| 3945 |
if (vbo_print_only === true) { |
| 3946 |
window.print(); |
| 3947 |
return; |
| 3948 |
} |
| 3949 |
jQuery.ajax({ |
| 3950 |
type: "POST", |
| 3951 |
url: "<?php echo VikBooking::ajaxUrl('index.php?option=com_vikbooking&task=updatereceiptnum'); ?>", |
| 3952 |
data: { |
| 3953 |
newnum: rnewnum, |
| 3954 |
newnotes: rcnotes, |
| 3955 |
oid: "<?php echo $row['id']; ?>" |
| 3956 |
} |
| 3957 |
}).done(function(res) { |
| 3958 |
window.print(); |
| 3959 |
}).fail(function() { |
| 3960 |
alert('Could not update the next receipt number.') |
| 3961 |
window.print(); |
| 3962 |
}); |
| 3963 |
} |
| 3964 |
<?php |
| 3965 |
} |
| 3966 |
?> |
| 3967 |
</script> |
| 3968 |
|