1function minProp(n, t) { 2 var i = n.map(function (n) { 3 return ko.unwrap(n[t]); 4 }); 5 return Math.min.apply(Math, i); 6} 7function isDateActive(n, t) { 8 var i = IBE.Utils.dateIsoFormat(t), 9 r = ko.utils.unwrapObservable(n.hotel); 10 if (!r.availability.hasOwnProperty(i)) return !1; 11 switch (r.availability[i]) { 12 case -1: 13 return !1; 14 case 0: 15 return IBE.Config.displayResults[displayNotAvailable] !== 0; 16 default: 17 return !0; 18 } 19} 20function getLanguage(n) { 21 var t = navigator.language || navigator.userLanguage; 22 return (lang = $.datepick.regionalOptions.hasOwnProperty(t) 23 ? t 24 : $.datepick.regionalOptions.hasOwnProperty(n) 25 ? n 26 : IBE.Config.lang); 27} 28function localizeDatepicker(n, t, i) { 29 t.length > 2 && t !== "en-US" && (t = t.substr(0, 2)); 30 n.datepick("option").lang !== t && 31 $.datepick.regionalOptions.hasOwnProperty(t) && 32 (i == "cinamon" 33 ? (($.datepick.regionalOptions[t].prevText = '<span class="material-icons"></span>'), 34 ($.datepick.regionalOptions[t].nextText = '<span class="material-icons"></span>')) 35 : (($.datepick.regionalOptions[t].prevText = '<span class="fa fa-chevron-left" />'), 36 ($.datepick.regionalOptions[t].nextText = '<span class="fa fa-chevron-right" />')), 37 n.datepick("option", $.datepick.regionalOptions[t]), 38 n.datepick("option", { lang: t })); 39} 40function sameRule(n) { 41 for (var i, r = [], u = {}, t = 0, f = n.length; t < f; t++) 42 ((i = JSON.stringify(n[t].ruleType)), u[i]) || (r.push(n[t]), (u[i] = !0)); 43 return r; 44} 45var IBE = { 46 Models: {}, 47 ViewModels: {}, 48 Data: { 49 HotelInfo: [], 50 RoomInfo: null, 51 RatePlanInfo: [], 52 ExchangeRates: null, 53 Countries: null, 54 HotelRates: {}, 55 RoomAvailability: {}, 56 }, 57 Translations: {}, 58 Utils: {}, 59 Config: {}, 60 Templates: {}, 61 }, 62 Cache, 63 MD5, 64 selectedDatepicker, 65 displayNotAvailable, 66 pauseOnSelectEvent, 67 pauseMultiple; 68IBE.Config = { 69 useCache: !0, 70 defaultCache: "sessionStorage", 71 cacheLevel: 1, 72 maxStay: 90, 73 minStay: 1, 74 lang: "en-US", 75 languages: [], 76 localizationUrl: "https://app.bookwize.com/api/v1.3/system/resources/?apikey=", 77 currency: "EUR", 78 googleAnalyticsId: null, 79 googleAnalyticsIdGA4: null, 80 googleAnalyticsEnabled: !0, 81 insightParticipantId: "", 82 rsId: 0, 83 roomBackgroundImage: "", 84 ibeShowCVC: !0, 85 ibeShowNotes: !0, 86 ibeEnforceMLOS: !1, 87 ibeFlightInfo: !1, 88 ibeArrivalTime: !1, 89 ibeIATAFields: !1, 90 ibeTimePolicy: !1, 91 groupText: "", 92 closeDatesClickable: !0, 93 boardType: { Unknown: 0, RoomRate: 1, BedAndBreakfast: 2, HalfBoard: 4, FullBoard: 8, AllInclusive: 16 }, 94 guestType: { Adult: "Adult", Children: "Children", Infant: "Infant" }, 95 userCookieAcceptance: !1, 96 imageTypes: { 97 offers: { imageTypeKey: "SpecialOffer", imageTransformationKey: "big" }, 98 rooms: { imageTypeKey: "Rooms_PopUp", imageTransformationKey: "bigger" }, 99 hotel: { imageTypeKey: "MainPhoto", imageTransformationKey: "original" }, 100 }, 101 supplementPricingType: { PerReservation: 0, PerRoom: 1, PerGuest: 2 }, 102 supplementTimePricingUnit: { Daily: 0, Hourly: 1, OneOff: 2 }, 103 supplementTimePricingType: { Stay: 0, CheckIn: 1, CheckOut: 2 }, 104 roomAvailability: { 105 Available: 1, 106 NoAvailability: 0, 107 AllotmentOrDatesMissing: -1, 108 HotelIsClosed: -2, 109 AvailabilityRestriction: -3, 110 CannotHost: -4, 111 NoPrices: -5, 112 UponRequest: -6, 113 }, 114 hotelAvailability: { AvailableOnline: 1, AvailableOnRequest: 2, HotelIsClosed: 3, CannotHost: 4, Unknown: 0 }, 115 idDocumentType: { Unknown: 0, IdentityCard: 1, Passport: 2, DrivingLicense: 3 }, 116 gender: { Unknown: 0, Male: 1, Female: 2 }, 117 titles: { Unknown: 0, Mr: 1, Mrs: 2, Miss: 3, Ms: 4, Dr: 5 }, 118 sortRoomsBy: ["availability.desc", "price.asc"], 119 displayResults: { Hide: 0, Show: 1, OnRequest: 2, Online: 3 }, 120 reservationStatus: { 121 UnsavedReservation: 0, 122 NewReservationPaymentPending: 2, 123 CancelledReservationPaymentExpired: 9, 124 ConfirmedReservation: 1, 125 NewRequest: 3, 126 AcceptedRequest: 4, 127 DeclinedRequest: 5, 128 CancelledReservation: 6, 129 CancelledRequest: 7,
130 AlternativeProposed: 8, 131 HoldRooms: 10, 132 AcceptedRequestForced: 11, 133 }, 134 paymentGatewayType: { 135 None: 0, 136 JccRedirect: 1, 137 Braintree: 2, 138 AlphaBankRedirect: 3, 139 PayPal: 4, 140 Omise: 5, 141 AuthorizeNet: 6, 142 Six: 7, 143 Stripe: 13, 144 Selfbook: 15, 145 }, 146 paymentGatewayCapabilities: { 147 Unknown: 0, 148 RequireCreditCard: 1, 149 FuturePayments: 2, 150 PreAuthorizedFuturePayments: 4, 151 NoFuturePayments: 8, 152 CreditCardRetrieval: 16, 153 }, 154 ajaxConfig: { 155 async: !0, 156 cache: !0, 157 dataType: "json", 158 contentType: "application/json", 159 beforeSend: function (n) { 160 n.setRequestHeader("Accept-Language", "en-US"); 161 n.setRequestHeader("Authorization", IBE.Utils.authenticationCookie()); 162 }, 163 }, 164 sojernConversionId: "", 165 sojernProductId: "", 166 sojernSearchId: "", 167 sojernCartId: "", 168 tripteaseHotelId: "", 169 tripteaseClientKey: "", 170 tripteaseWidgetClosed: "", 171 ibeShowBoard: !0, 172 ibeMealplansView: !1, 173 showOfferBrokenRuleMessage: !1, 174}; 175IBE.Config.defaultLang = IBE.Config.lang; 176IBE.Config.defaultLocalizationUrl = IBE.Config.localizationUrl; 177IBE.Config = $.extend(IBE.Config, IBEConfig); 178IBE.Config.defaultLocalizationUrl = IBE.Config.baseUrl + IBE.Config.defaultLocalizationUrl; 179IBE.Config.localizationUrl.substring(0, 4) !== "http" && 180 (IBE.Config.localizationUrl = IBE.Config.baseUrl + IBE.Config.localizationUrl); 181IBE.Config.ajaxConfig = $.extend(IBE.Config.ajaxConfig, { 182 crossDomain: !0, 183 cache: IBE.Config.useCache, 184 beforeSend: function (n) { 185 n.setRequestHeader("Accept-Language", IBE.Config.lang || "en-US"); 186 }, 187}); 188$.support.cors = !0; 189$.ajaxSetup(IBE.Config.ajaxConfig), 190 (function (n) { 191 n.whenAll = function (t) { 192 if (t && t.length) { 193 var i = n.Deferred(), 194 e = t.length, 195 r = !1, 196 u, 197 f; 198 return ( 199 (f = function () { 200 --e || i[r ? "reject" : "resolve"](); 201 }), 202 (u = function () { 203 r = !0; 204 }), 205 t.forEach(function (n) { 206 n.fail(u).always(f); 207 }), 208 i 209 ); 210 } 211 return n.Deferred().resolve(); 212 }; 213 })(jQuery); 214String.prototype.format || 215 (String.prototype.format = function () { 216 var n = arguments, 217 t = function (t, i) { 218 return i in n ? n[i] : t; 219 }; 220 return this.replace(/\{(\d+)\}/g, t); 221 }); 222Cache = { 223 prefix: "IBE_", 224 memory: [], 225 supportLocalStorage: function () { 226 if (!IBE.Config.useCache) return !1; 227 try { 228 return typeof Storage != "undefined" ? !0 : !1; 229 } catch (n) { 230 return !1; 231 } 232 }, 233 write: function (n, t, i, r) { 234 n = Cache.prefix + n; 235 typeof i == "undefined" && (i = 60); 236 var f = i * 6e4, 237 u = { value: JSON.stringify(t), timestamp: new Date().getTime() + f }; 238 if (!Cache.supportLocalStorage()) return (Cache.memory[n] = JSON.stringify(u)), t; 239 typeof r == "undefined" && (r = IBE.Config.defaultCache); 240 try { 241 r.toLowerCase() === "localstorage" 242 ? localStorage.setItem(n, JSON.stringify(u)) 243 : sessionStorage.setItem(n, JSON.stringify(u)); 244 } catch (e) {} 245 return t; 246 }, 247 read: function (n, t) { 248 n = Cache.prefix + n; 249 var i; 250 typeof t == "undefined" && 251 (t = Cache.supportLocalStorage() ? IBE.Config.defaultCache || "sessionStorage" : "memory"); 252 switch (t.toLowerCase()) { 253 case "localstorage": 254 i = JSON.parse(localStorage.getItem(n)); 255 break; 256 case "sessionstorage": 257 i = JSON.parse(sessionStorage.getItem(n)); 258 break; 259 default: 260 Cache.memory[n] !== undefined && (i = JSON.parse(Cache.memory[n])
260); 261 } 262 return typeof i == "undefined" || i == null || !i.value 263 ? !1 264 : new Date().getTime() < i.timestamp && JSON.parse(i.value); 265 }, 266 clear: function (n) { 267 if (typeof n != "undefined") { 268 n = Cache.prefix + n; 269 var t = Cache.memory.indexOf(n); 270 t >= 0 && Cache.memory.splice(t, 1); 271 localStorage.removeItem(n); 272 sessionStorage.removeItem(n); 273 } else localStorage.clear(), sessionStorage.clear(), (Cache.memory.length = 0); 274 }, 275}; 276MD5 = function (n) { 277 function a(n, t) { 278 return (n << t) | (n >>> (32 - t)); 279 } 280 function o(n, t) { 281 var f, e, r, u, i; 282 return ((r = n & 2147483648), 283 (u = t & 2147483648), 284 (f = n & 1073741824), 285 (e = t & 1073741824), 286 (i = (n & 1073741823) + (t & 1073741823)), 287 f & e) 288 ? i ^ 2147483648 ^ r ^ u 289 : f | e 290 ? i & 1073741824 291 ? i ^ 3221225472 ^ r ^ u 292 : i ^ 1073741824 ^ r ^ u 293 : i ^ r ^ u; 294 } 295 function yt(n, t, i) { 296 return (n & t) | (~n & i); 297 } 298 function pt(n, t, i) { 299 return (n & i) | (t & ~i); 300 } 301 function wt(n, t, i) { 302 return n ^ t ^ i; 303 } 304 function bt(n, t, i) { 305 return t ^ (n | ~i); 306 } 307 function s(n, t, i, r, u, f, e) { 308 return (n = o(n, o(o(yt(t, i, r), u), e))), o(a(n, f), t); 309 } 310 function h(n, t, i, r, u, f, e) { 311 return (n = o(n, o(o(pt(t, i, r), u), e))), o(a(n, f), t); 312 } 313 function c(n, t, i, r, u, f, e) { 314 return (n = o(n, o(o(wt(t, i, r), u), e))), o(a(n, f), t); 315 } 316 function l(n, t, i, r, u, f, e) { 317 return (n = o(n, o(o(bt(t, i, r), u), e))), o(a(n, f), t); 318 } 319 function kt(n) { 320 for ( 321 var r, u = n.length, o = u + 8, s = (o - (o % 64)) / 64, e = (s + 1) * 16, i = Array(e - 1), f = 0, t = 0; 322 t < u; 323 324 ) 325 (r = (t - (t % 4)) / 4), (f = (t % 4) * 8), (i[r] = i[r] | (n.charCodeAt(t) << f)), t++; 326 return ( 327 (r = (t - (t % 4)) / 4), 328 (f = (t % 4) * 8), 329 (i[r] = i[r] | (128 << f)), 330 (i[e - 2] = u << 3), 331 (i[e - 1] = u >>> 29), 332 i 333 ); 334 } 335 function v(n) { 336 for (var i = "", r = "", u, t = 0; t <= 3; t++) 337 (u = (n >>> (t * 8)) & 255), (r = "0" + u.toString(16)), (i = i + r.substr(r.length - 2, 2)); 338 return i; 339 } 340 function dt(n) { 341 var i, r, t; 342 for (n = n.replace(/\r\n/g, "\n"), i = "", r = 0; r < n.length; r++) 343 (t = n.charCodeAt(r)), 344 t < 128 345 ? (i += String.fromCharCode(t)) 346 : t > 127 && t < 2048 347 ? ((i += String.fromCharCode((t >> 6) | 192)), (i += String.fromCharCode((t & 63) | 128))) 348 : ((i += String.fromCharCode((t >> 12) | 224)), 349 (i += String.fromCharCode(((t >> 6) & 63) | 128)), 350 (i += String.fromCharCode((t & 63) | 128))); 351 return i; 352 } 353 var e = Array(), 354 f, 355 ht, 356 ct, 357 lt, 358 at, 359 t, 360 i, 361 r, 362 u, 363 y = 7, 364 p = 12, 365 w = 17, 366 b = 22, 367 k = 5, 368 d = 9, 369 g = 14, 370 nt = 20, 371 tt = 4, 372 it = 11, 373 rt = 16, 374 ut = 23, 375 ft = 6, 376 et = 10, 377 ot = 15, 378 st = 21, 379 vt; 380 for ( 381 n = dt(n), e = kt(n), t = 1732584193, i = 4023233417, r = 2562383102, u = 271733878, f = 0; 382 f < e.length; 383 f += 16 384 ) 385 (ht = t), 386 (ct = i), 387 (lt = r), 388 (at = u), 389 (t = s(t, i, r, u, e[f + 0], y, 3614090360)), 390 (u = s(u, t, i, r, e[f + 1], p, 3905402710)), 391 (r = s(r, u, t, i, e[f + 2], w, 606105819)), 392 (i = s(i, r, u, t, e[f + 3], b, 3250441966)), 393 (t = s(t, i, r, u, e[f + 4], y, 4118548399)), 394 (u = s(u, t, i, r, e[f + 5], p, 1200080426)), 395 (r = s(r, u, t, i, e[f + 6], w, 2821735955)), 396 (i = s(i, r, u, t, e[f + 7], b, 4249261313)), 397 (t = s(t, i, r, u, e[f + 8], y, 1770035416)), 398 (u = s(u, t, i, r, e[f + 9], p, 2336552879)), 399 (r = s(r, u, t, i, e[f + 10], w, 4294925233)), 400 (i = s(i, r, u, t, e[f + 11], b, 2304563134)), 401 (t = s(t, i, r, u, e[f + 12], y, 1804603682)), 402 (u = s(u, t, i, r, e[f + 13], p, 4254626195)), 403 (r = s(r, u, t, i, e[f + 14], w, 2792965006)), 404 (i = s(i, r, u, t, e[f + 15], b, 1236535329)), 405 (t = h(t, i, r, u, e[f + 1], k, 4129170786)), 406 (u = h(u, t, i, r, e[f + 6], d, 3225465664)), 407 (r = h(r, u, t, i, e[f + 11], g, 643717713)), 408 (i = h(i, r, u, t, e[f + 0], nt, 3921069994)), 409 (t = h(t, i, r, u, e[f + 5], k, 3593408605)), 410 (u = h(u, t, i, r, e[f + 10], d, 38016083)), 411 (r = h(r, u, t, i, e[f + 15], g, 3634488961)), 412 (i = h(i, r, u, t, e[f + 4], nt, 3889429448)), 413 (t = h(t, i, r, u, e[f + 9], k, 568446438)), 414 (u = h(u, t, i, r, e[f + 14], d, 3275163606)), 415 (r = h(r, u, t, i, e[f + 3], g, 4107603335)), 416 (i = h(i, r, u, t, e[f + 8], nt, 1163531501)), 417 (t = h(t, i, r, u, e[f + 13], k, 2850285829)), 418 (u = h(u, t, i, r, e[f + 2], d, 4243563512)), 419 (r = h(r, u, t, i, e[f + 7], g, 1735328473)), 420 (i = h(i, r, u, t, e[f + 12], nt, 2368359562)), 421 (t = c(t, i, r, u, e[f + 5], tt, 4294588738)), 422 (u = c(u, t, i, r, e[f + 8], it, 2272392833)), 423 (r = c(r, u, t, i, e[f + 11], rt, 1839030562)), 424 (i = c(i, r, u, t, e[f + 14], ut, 4259657740)), 425 (t = c(t, i, r, u, e[f + 1], tt, 2763975236)), 426 (u = c(u, t, i, r, e[f + 4], it, 1272893353)), 427 (r = c(r, u, t, i, e[f + 7], rt, 4139469664)), 428 (i = c(i, r, u, t, e[f + 10], ut, 3200236656)), 429 (t = c(t, i, r, u, e[f + 13], tt, 681279174)), 430 (u = c(u, t, i, r, e[f + 0], it, 3936430074)), 431 (r = c(r, u, t, i, e[f + 3], rt, 3572445317)), 432 (i = c(i, r, u, t, e[f + 6], ut, 76029189)), 433 (t = c(t, i, r, u, e[f + 9], tt, 3654602809)), 434 (u = c(u, t, i, r, e[f + 12], it, 3873151461)), 435 (r = c(r, u, t, i, e[f + 15], rt, 530742520)), 436 (i = c(i, r, u, t, e[f + 2], ut, 3299628645)), 437 (t = l(t, i, r, u, e[f + 0], ft, 4096336452)),
438 (u = l(u, t, i, r, e[f + 7], et, 1126891415)), 439 (r = l(r, u, t, i, e[f + 14], ot, 2878612391)), 440 (i = l(i, r, u, t, e[f + 5], st, 4237533241)), 441 (t = l(t, i, r, u, e[f + 12], ft, 1700485571)), 442 (u = l(u, t, i, r, e[f + 3], et, 2399980690)), 443 (r = l(r, u, t, i, e[f + 10], ot, 4293915773)), 444 (i = l(i, r, u, t, e[f + 1], st, 2240044497)), 445 (t = l(t, i, r, u, e[f + 8], ft, 1873313359)), 446 (u = l(u, t, i, r, e[f + 15], et, 4264355552)), 447 (r = l(r, u, t, i, e[f + 6], ot, 2734768916)), 448 (i = l(i, r, u, t, e[f + 13], st, 1309151649)), 449 (t = l(t, i, r, u, e[f + 4], ft, 4149444226)), 450 (u = l(u, t, i, r, e[f + 11], et, 3174756917)), 451 (r = l(r, u, t, i, e[f + 2], ot, 718787259)), 452 (i = l(i, r, u, t, e[f + 9], st, 3951481745)), 453 (t = o(t, ht)), 454 (i = o(i, ct)), 455 (r = o(r, lt)), 456 (u = o(u, at)); 457 return (vt = v(t) + v(i) + v(r) + v(u)), vt.toLowerCase(); 458}; 459jQuery.base64 = (function () { 460 function t(t, i) { 461 var r = n.indexOf(t.charAt(i)); 462 if (r === -1) throw "Cannot decode base64"; 463 return r; 464 } 465 function u(n) { 466 var o = 0, 467 i, 468 u, 469 f = n.length, 470 e = []; 471 if (((n = String(n)), f === 0)) return n; 472 if (f % 4 != 0) throw "Cannot decode base64"; 473 for (n.charAt(f - 1) === r && ((o = 1), n.charAt(f - 2) === r && (o = 2), (f -= 4)), i = 0; i < f; i += 4) 474 (u = (t(n, i) << 18) | (t(n, i + 1) << 12) | (t(n, i + 2) << 6) | t(n, i + 3)), 475 e.push(String.fromCharCode(u >> 16, (u >> 8) & 255, u & 255)); 476 switch (o) { 477 case 1: 478 u = (t(n, i) << 18) | (t(n, i + 1) << 12) | (t(n, i + 2) << 6); 479 e.push(String.fromCharCode(u >> 16, (u >> 8) & 255)); 480 break; 481 case 2: 482 u = (t(n, i) << 18) | (t(n, i + 1) << 12); 483 e.push(String.fromCharCode(u >> 16)); 484 } 485 return e.join(""); 486 } 487 function i(n, t) { 488 var i = n.charCodeAt(t); 489 if (i > 255) throw "INVALID_CHARACTER_ERR: DOM Exception 5"; 490 return i; 491 } 492 function f(t) { 493 if (arguments.length !== 1) throw "SyntaxError: exactly one argument required"; 494 t = String(t); 495 var f, 496 u, 497 e = [], 498 o = t.length - (t.length % 3); 499 if (t.length === 0) return t; 500 for (f = 0; f < o; f += 3) 501 (u = (i(t, f) << 16) | (i(t, f + 1) << 8) | i(t, f + 2)), 502 e.push(n.charAt(u >> 18)), 503 e.push(n.charAt((u >> 12) & 63)), 504 e.push(n.charAt((u >> 6) & 63)), 505 e.push(n.charAt(u & 63)); 506 switch (t.length - o) { 507 case 1: 508 u = i(t, f) << 16; 509 e.push(n.charAt(u >> 18) + n.charAt((u >> 12) & 63) + r + r); 510 break; 511 case 2: 512 u = (i(t, f) << 16) | (i(t, f + 1) << 8); 513 e.push(n.charAt(u >> 18) + n.charAt((u >> 12) & 63) + n.charAt((u >> 6) & 63) + r); 514 } 515 return e.join(""); 516 } 517 var r = "=", 518 n = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; 519 return { decode: u, encode: f, VERSION: "1.0" }; 520})(jQuery); 521window.onerror = function (n, t, i) { 522 if (!(n.indexOf("Script error.") > -1)) { 523 var u = t + " (line: " + i + ")\n" + n, 524 r = {}; 525 return ( 526 (r.message = u), 527 (r.hotelId = IBE.Config.hotelId), 528 (r.severity = ""), 529 n.indexOf("Unable to process binding") > 0 && 530 ((r.severity = "critical"), 531 typeof loader != "undefined" && 532 (loader.title("Failed to initialize booking engine :("), loader.message(r), loader.visible(!0))), 533 IBE.Utils.logEvent(r), 534 !0 535 ); 536 } 537}; 538IBE.Utils.request = function (n) { 539 var u, t, i, r; 540 if (n.url) 541 return (n.url.indexOf(".html") !== -1 542 ? (n.beforeSend = function (n) { 543 n.setRequestHeader("Content-Type", "text/html"); 544 }) 545 : IBE.Utils.haveAuthenticationCookie() && 546 (n.beforeSend = function (n) { 547 n.setRequestHeader("Authorization", IBE.Utils.authenticationCookie()); 548 }), 549 (u = { dataType: "json", type: "GET", crossDomain: !0, headers: {} }), 550 (n = $.extend(!0, u, n)), 551 (n.headers = n.headers || {}), 552 n.headers.hasOwnProperty("Accept-Language") || (n.headers["Accept-Language"] = IBE.Config.lang || "en-US"),
553 IBE.Config.insightParticipantId == "" && (IBE.Config.insightParticipantId = IBE.Utils.generateGuid()), 554 n.headers.hasOwnProperty("Insights-ParticipantId") || 555 IBE.Config.insightParticipantId == "" || 556 (n.headers["Insights-ParticipantId"] = IBE.Config.insightParticipantId), 557 (t = $.Deferred()), 558 IBE.Config.cacheLevel === 2 && 559 n.type.toLowerCase() !== "post" && 560 ((i = "ibe_" + MD5(ko.toJSON(n))), (r = Cache.read(i)), r !== !1)) 561 ? (t.resolve(r), t.promise()) 562 : ($.ajax(n) 563 .done(function (n) { 564 IBE.Config.cacheLevel === 2 && Cache.write(i, n); 565 t.resolve(n); 566 }) 567 .fail(function (n) { 568 t.reject(n); 569 }), 570 t.promise()); 571}; 572IBE.Utils.bindTemplate = function (n, t, i, r) { 573 function u() { 574 IBE.Utils.consoleLog("<ibe/template> Binding Template " + i + " for " + typeof t + " in " + n); 575 var u = document.getElementById(n), 576 e = ko.contextFor(u); 577 e && ko.cleanNode(u); 578 try { 579 typeof r != "undefined" && typeof r.beforeRender == "function" && r.beforeRender(); 580 ko.applyBindings(t, u); 581 typeof r != "undefined" && typeof r.afterRender == "function" && r.afterRender(); 582 } catch (o) { 583 IBE.Utils.logEvent(o); 584 } 585 f.resolve(i); 586 } 587 typeof i == "undefined" && (i = $("#" + n).data("template")); 588 i.indexOf("http") < 0 && (i = IBE.Config.baseUrl + i); 589 var f = $.Deferred(); 590 return ( 591 IBE.Utils.request({ url: i, cache: IBE.Config.useCache, dataType: "html", async: !1 }).always(function (t) { 592 var i, r; 593 if (($("#" + n).html(t), (i = $("#" + n).find('script[type="text/html"]')), i.length === 0)) { 594 u(); 595 return; 596 } 597 r = []; 598 i.each(function (n, t) { 599 var u = $(t), 600 i = u.attr("src"); 601 typeof i != "undefined" && 602 (i.indexOf("http") < 0 && (i = IBE.Config.baseUrl + i), 603 $(u.data("target")).html() == "" && 604 r.push( 605 IBE.Utils.request({ 606 url: i, 607 cache: IBE.Config.useCache, 608 dataType: "html", 609 async: !1, 610 headers: { "Accept-Language": lang }, 611 }).always(function (n) { 612 $(u.data("target")).html(n); 613 }) 614 )); 615 }); 616 $.when(r).then(function () { 617 u(); 618 }); 619 }), 620 f.promise() 621 ); 622}; 623IBE.Utils.processingRequests = {}; 624IBE.Utils.addProcessingRequest = function (n, t, i) { 625 t = t || function () {}; 626 typeof IBE.Utils.processingRequests[n].callbacks == "undefined" && (IBE.Utils.processingRequests[n].callbacks = []); 627 typeof i != "undefined" && IBE.Utils.processingRequests[n].callbacks.unshift(t); 628 IBE.Utils.processingRequests[n].callbacks.push(t); 629}; 630IBE.Utils.processingRequestsCallbacks = function (n, t) { 631 if (typeof IBE.Utils.processingRequests[n] != "undefined") { 632 if (typeof IBE.Utils.processingRequests[n].callbacks != "undefined") 633 while (IBE.Utils.processingRequests[n].callbacks.length > 0) { 634 var i = IBE.Utils.processingRequests[n].callbacks.pop(); 635 typeof i == "function" && i(t); 636 } 637 delete IBE.Utils.processingRequests[n]; 638 } 639}; 640IBE.Utils.loadCountries = function () { 641 var n = $.Deferred(), 642 t = "Countries"; 643 return (IBE.Data.Countries == null && Cache.read(t) !== !1 && (IBE.Data.Countries = Cache.read(t)), 644 IBE.Data.Countries) 645 ? (n.resolve(IBE.Data.Countries), n.promise()) 646 : (IBE.Utils.request({ 647 dataType: "json", 648 url: IBE.Config.apiBaseUrl + "/countries/?apikey=" + IBE.Config.apiKey, 649 }).done(function (i) { 650 IBE.Data.Countries = i; 651 Cache.write(t, IBE.Data.Countries); 652 n.resolve(i); 653 }), 654 n.promise()); 655}; 656IBE.Utils.loadHotelInfo = function (n, t) { 657 IBE.Data.HotelInfo || (IBE.Data.HotelInfo = []); 658 var i = ko.utils.extend( 659 { apiKey: IBE.Config.apiKey, hotelId: parseInt(IBE.Config.hotelId), lang: IBE.Config.lang }, 660 t 661 ), 662 r = $.Deferred(), 663 f, 664 e = IBE.Utils.queryString(ko.utils.extend({ apikey: i.apiKey, lang: i.lang })), 665 o = IBE.Config.apiBaseUrl + "/hotels/info/" + i.hotelId + "/?" + e, 666 u = "HotelInfo_" + i.hotelId + "_" + i.lang; 667 if ((IBE.Data.Lang !== IBE.Config.lang && (IBE.Data.HotelInfo[i.hotelId] = null), IBE.Data.HotelInfo[i.hotelId])) 668 return r.resolve(IBE.Data.HotelInfo[i.hotelId]), r.promise(); 669 if ((f = Cache.read(u)) !== !1) 670 return ( 671 (IBE.Data.HotelInfo[i.hotelId] = f), 672 (IBE.Data.Lang = IBE.Config.lang), 673 IBE.Utils.LoadAdditionalSettings(i), 674 IBE.Utils.consoleLog("<ibe/cache> HotelInfo loaded from " + IBE.Config.defaultCache), 675 r.resolve(IBE.Data.HotelInfo[i.hotelId]), 676 r.promise() 677 ); 678 if (typeof IBE.Utils.processingRequests[u] == "undefined") 679 return ( 680 (IBE.Utils.processingRequests[u] = { processing: !0 }), 681 IBE.Utils.request({ url: o }) 682 .done(function (n) { 683 IBE.Data.HotelInfo[i.hotelId] = n; 684 IBE.Data.Lang = IBE.Config.lang; 685 IBE.Utils.LoadAdditionalSettings(i); 686 Cache.write(u, IBE.Data.HotelInfo[i.hotelId]); 687 r.resolve(IBE.Data.HotelInfo[i.hotelId]); 688 IBE.Utils.processingRequestsCallbacks(u, IBE.Data.HotelInfo[i.hotelId]); 689 }) 690 .fail(function (n) { 691 r.reject(n); 692 }), 693 r.promise() 694 ); 695 IBE.Utils.addProcessingRequest(u, n); 696}; 697IBE.Utils.LoadAdditionalSettings = function (n) { 698 if ( 699 (IBE.Data.HotelInfo[n.hotelId].settings.ibeFlightInfo && 700 ((IBE.Config.ibeFlightInfo = IBE.Data.HotelInfo[n.hotelId].settings.ibeFlightInfo), 701 (IBE.Config.ibeFlightInfo = IBE.Config.ibeFlightInfo === "False" ? !1 : !0)), 702 IBE.Data.HotelInfo[n.hotelId].settings.ibeShowBoard && 703 ((IBE.Config.ibeShowBoard = IBE.Data.HotelInfo[n.hotelId].settings.ibeShowBoard), 704 (IBE.Config.ibeShowBoard = IBE.Config.ibeShowBoard === "False" ? !1 : !0)), 705 IBE.Data.HotelInfo[n.hotelId].settings.ibeArrivalTime && 706 ((IBE.Config.ibeArrivalTime = IBE.Data.HotelInfo[n.hotelId].settings.ibeArrivalTime), 707 (IBE.Config.ibeArrivalTime = IBE.Config.ibeArrivalTime === "False" ? !1 : !0)), 708 IBE.Data.HotelInfo[n.hotelId].settings.ibeIATAFields && 709 ((IBE.Config.ibeIATAFields = IBE.Data.HotelInfo[n.hotelId].settings.ibeIATAFields), 710 (IBE.Config.ibeIATAFields = IBE.Config.ibeIATAFields === "False" ? !1 : !0)), 711 IBE.Data.HotelInfo[n.hotelId].settings.ibeTimePolicy && 712 ((IBE.Config.ibeTimePolicy = IBE.Data.HotelInfo[n.hotelId].settings.ibeTimePolicy), 713 (IBE.Config.ibeTimePolicy = IBE.Config.ibeTimePolicy === "False" ? !1 : !0)), 714 IBE.Data.HotelInfo[n.hotelId].settings.closeDatesNotClickable) 715 ) { 716 var t = IBE.Data.HotelInfo[n.hotelId].settings.closeDatesNotClickable;
717 IBE.Config.closeDatesClickable = t === "False" ? !0 : !1; 718 } 719 IBE.Data.HotelInfo[n.hotelId].settings.ibeMealplansView && 720 ((IBE.Config.ibeMealplansView = IBE.Data.HotelInfo[n.hotelId].settings.ibeMealplansView), 721 (IBE.Config.ibeMealplansView = IBE.Config.ibeMealplansView === "False" ? !1 : !0)); 722 IBE.Data.HotelInfo[n.hotelId].settings.ibeShowCVC && 723 ((IBE.Config.ibeShowCVC = IBE.Data.HotelInfo[n.hotelId].settings.ibeShowCVC), 724 (IBE.Config.ibeShowCVC = IBE.Config.ibeShowCVC === "False" ? !1 : !0)); 725 IBE.Data.HotelInfo[n.hotelId].settings.ibeEnforceMLOS && 726 ((IBE.Config.ibeEnforceMLOS = IBE.Data.HotelInfo[n.hotelId].settings.ibeEnforceMLOS), 727 (IBE.Config.ibeEnforceMLOS = IBE.Config.ibeEnforceMLOS === "False" ? !1 : !0)); 728 IBE.Data.HotelInfo[n.hotelId].settings.ibeShowNotes && 729 ((IBE.Config.ibeShowNotes = IBE.Data.HotelInfo[n.hotelId].settings.ibeShowNotes), 730 (IBE.Config.ibeShowNotes = IBE.Config.ibeShowNotes === "False" ? !1 : !0)); 731 IBE.Config.externalPaymentGateway = IBE.Data.HotelInfo[n.hotelId].settings.externalPaymentGateway 732 ? IBE.Data.HotelInfo[n.hotelId].settings.externalPaymentGateway 733 : "0"; 734 IBE.Data.HotelInfo[n.hotelId].settings.webCheckIn && 735 ((IBE.Config.webCheckIn = IBE.Data.HotelInfo[n.hotelId].settings.webCheckIn), 736 (IBE.Config.webCheckIn = IBE.Config.webCheckIn === "False" ? !1 : !0)); 737 IBE.Config.memberships = []; 738 IBE.Data.HotelInfo[n.hotelId].memberships && (IBE.Config.memberships = IBE.Data.HotelInfo[n.hotelId].memberships); 739 IBE.Config.trivagoId = []; 740 IBE.Data.HotelInfo[n.hotelId].settings.trivagoId && 741 (IBE.Config.trivagoId = IBE.Data.HotelInfo[n.hotelId].settings.trivagoId); 742 IBE.Config.googleAnalyticsId = []; 743 IBE.Data.HotelInfo[n.hotelId].settings.googleAnalyticsKey && 744 (IBE.Config.googleAnalyticsId = IBE.Data.HotelInfo[n.hotelId].settings.googleAnalyticsKey); 745 IBE.Config.googleAnalyticsIdGA4 = []; 746 IBE.Data.HotelInfo[n.hotelId].settings.googleAnalyticsKeyGA4 && 747 (IBE.Config.googleAnalyticsIdGA4 = IBE.Data.HotelInfo[n.hotelId].settings.googleAnalyticsKeyGA4); 748 IBE.Data.HotelInfo[n.hotelId].settings.moneyFormat && 749 (IBE.Config.moneyFormat = IBE.Data.HotelInfo[n.hotelId].settings.moneyFormat); 750 IBE.Data.HotelInfo[n.hotelId].settings.group && 751 (IBE.Config.groupText = IBE.Data.HotelInfo[n.hotelId].settings.group); 752 IBE.Data.HotelInfo[n.hotelId].settings.showCurrencyCode && 753 ((IBE.Config.showCurrencyCode = IBE.Data.HotelInfo[n.hotelId].settings.showCurrencyCode), 754 (IBE.Config.showCurrencyCode = IBE.Config.showCurrencyCode === "False" ? !1 : !0)); 755 IBE.Data.HotelInfo[n.hotelId].settings.hideStandardRatePlanForBookingEngine && 756 ((IBE.Config.hideStandardRatePlanForBookingEngine = 757 IBE.Data.HotelInfo[n.hotelId].settings.hideStandardRatePlanForBookingEngine), 758 (IBE.Config.hideStandardRatePlanForBookingEngine = 759 IBE.Config.hideStandardRatePlanForBookingEngine === "False" ? !1 : !0)); 760 IBE.Data.HotelInfo[n.hotelId].settings.splitMultiRoomReservations && 761 ((IBE.Config.splitMultiRoomReservations = IBE.Data.HotelInfo[n.hotelId].settings.splitMultiRoomReservations), 762 (IBE.Config.splitMultiRoomReservations = IBE.Config.splitMultiRoomReservations === "False" ? !1 : !0)); 763 IBE.Data.HotelInfo[n.hotelId].settings.showOfferBrokenRuleMessage && 764 ((IBE.Config.showOfferBrokenRuleMessage = IBE.Data.HotelInfo[n.hotelId].settings.showOfferBrokenRuleMessage),
765 (IBE.Config.showOfferBrokenRuleMessage = IBE.Config.showOfferBrokenRuleMessage === "False" ? !1 : !0)); 766 IBE.Data.HotelInfo[n.hotelId].settings.roomImagesLightboxModeCrop && 767 ((IBE.Config.showCurrencyCode = IBE.Data.HotelInfo[n.hotelId].settings.roomImagesLightboxModeCrop), 768 (IBE.Config.roomImagesLightboxModeCrop = IBE.Config.roomImagesLightboxModeCrop === "False" ? !1 : !0)); 769 IBE.Data.HotelInfo[n.hotelId].settings.roomImagesLightboxModeCrop 770 ? ((IBE.Config.roomImagesLightboxModeCrop = IBE.Data.HotelInfo[n.hotelId].settings.roomImagesLightboxModeCrop), 771 (IBE.Config.roomImagesLightboxModeCrop = IBE.Config.roomImagesLightboxModeCrop === "False" ? !1 : !0)) 772 : (IBE.Config.roomImagesLightboxModeCrop = !0); 773 IBE.Config.roomImagesLightboxWidth = 774 typeof IBE.Data.HotelInfo[n.hotelId].settings.roomImagesLightboxWidth != "undefined" 775 ? IBE.Data.HotelInfo[n.hotelId].settings.roomImagesLightboxWidth 776 : ""; 777 IBE.Config.roomImagesLightboxHeight = 778 typeof IBE.Data.HotelInfo[n.hotelId].settings.roomImagesLightboxHeight != "undefined" 779 ? IBE.Data.HotelInfo[n.hotelId].settings.roomImagesLightboxHeight 780 : "800"; 781}; 782IBE.Utils.loadExchangeRates = function (n, t) { 783 var u = ko.utils.extend( 784 { apiKey: IBE.Config.apiKey, hotelId: parseInt(IBE.Config.hotelId), lang: IBE.Config.lang }, 785 t 786 ), 787 r = $.Deferred(), 788 i = "ExchangeRates"; 789 if ( 790 (IBE.Data.ExchangeRates == null && Cache.read(i) !== !1 && (IBE.Data.ExchangeRates = Cache.read(i)), 791 IBE.Data.ExchangeRates) 792 ) 793 return ( 794 IBE.Utils.consoleLog("<ibe/cache> ExchangeRates loaded from " + IBE.Config.defaultCache), 795 r.resolve(IBE.Data.ExchangeRates), 796 r.promise() 797 ); 798 if (typeof IBE.Utils.processingRequests[i] == "undefined") 799 return ( 800 (IBE.Utils.processingRequests[i] = { processing: !0 }), 801 IBE.Utils.request({ url: IBE.Config.apiBaseUrl + "/exchangeRates/?apikey=" + u.apiKey }) 802 .done(function (n) { 803 IBE.Data.ExchangeRates = n; 804 Cache.write(i, IBE.Data.ExchangeRates, 60); 805 r.resolve(IBE.Data.ExchangeRates); 806 IBE.Utils.processingRequestsCallbacks(i, IBE.Data.ExchangeRates); 807 }) 808 .fail(function (n) { 809 var t = {}; 810 t.Message = ko.toJSON(n); 811 t.hotelId = parseInt(IBE.Config.hotelId); 812 t.Severity = "critical"; 813 IBE.Utils.logEvent(t); 814 }), 815 r.promise() 816 ); 817 IBE.Utils.addProcessingRequest(i, n); 818}; 819IBE.Utils.translate = function (n) { 820 try { 821 if (IBE.Translations.hasOwnProperty(n)) return IBE.Translations[n]; 822 } catch (t) { 823 IBE.Utils.logEvent({ 824 Message: "IBE.Translation failed for key: " + n + ". Exception: " + t.toJSON(), 825 HotelId: parseInt(IBE.Config.hotelId), 826 Severity: "warn", 827 }); 828 } 829 return n; 830}; 831IBE.Utils.translationsLoaded = {}; 832IBE.Utils.loadTranslations = function (n, t) { 833 var u; 834 if (typeof n != "undefined") { 835 var f = n.substring(0, 2), 836 r = $.Deferred(), 837 i = "resources_" + IBE.Config.rsId + "_" + f; 838 if (Cache.read(i) !== !1) 839 return ( 840 (IBE.Config.lang = n), 841 (IBE.Translations = Cache.read(i)), 842 (IBE.Utils.translationsLoaded[n] = !0), 843 IBE.Utils.consoleLog( 844 "<ibe/cache> Changed language to " + n + " and fetched resources from " + IBE.Config.defaultCache 845 ), 846 typeof t == "function" && t(n), 847 r.resolve(IBE.Config.lang), 848 r.promise() 849 ); 850 if ( 851 ((u = IBE.Config.localizationUrl), 852 (u += u.indexOf("?") == -1 ? "?lang=" + f : "&lang=" + f), 853 typeof IBE.Utils.processingRequests[i] == "undefined") 854 ) 855 return ( 856 (IBE.Utils.processingRequests[i] = { processing: !0 }), 857 IBE.Utils.request({ url: u, dataType: "text", async: !1, headers: { "Accept-Language": n } }) 858 .done(function (u) {
859 IBE.Config.lang = n; 860 IBE.Translations = $.parseJSON(u); 861 IBE.Utils.translationsLoaded[n] = !0; 862 IBE.Utils.consoleLog( 863 "Changed language to " + 864 n + 865 " and fetched resources from " + 866 IBE.Config.localizationUrl.format(n) + 867 "&lang=" + 868 n.substring(0, 2) 869 ); 870 Cache.write(i, IBE.Translations, 3600); 871 console.log(new Date() + "Processing lang callbacks"); 872 IBE.Utils.processingRequestsCallbacks(i, IBE.Config.lang); 873 r.resolve(IBE.Config.lang); 874 typeof t == "function" && t(n); 875 }) 876 .fail(function () { 877 IBE.Utils.consoleLog("Language " + n + " not found. Trying for default language"); 878 IBE.Utils.request({ 879 url: IBE.Config.localizationUrl.format(IBE.Config.lang), 880 dataType: "text", 881 async: !1, 882 }).done(function (u) { 883 IBE.Translations = $.parseJSON(u); 884 IBE.Utils.translationsLoaded[n] = !0; 885 IBE.Utils.consoleLog( 886 "Changed language to " + 887 IBE.Config.lang + 888 " and fetched resources from " + 889 IBE.Config.localizationUrl.format(IBE.Config.lang) 890 ); 891 Cache.write(i, IBE.Translations, 3600); 892 IBE.Utils.processingRequestsCallbacks(i, IBE.Config.lang); 893 r.resolve(IBE.Config.lang); 894 typeof t == "function" && t(IBE.Config.lang); 895 }); 896 }), 897 r.promise() 898 ); 899 console.log(new Date() + "Add new lang callback " + i); 900 IBE.Utils.addProcessingRequest(i); 901 } 902}; 903IBE.Utils.findTranslation = function (n) { 904 return IBE.Translations.hasOwnProperty(n) ? IBE.Translations[n] : n; 905}; 906IBE.Utils.consoleLog = function (n) { 907 if (IBE.Config.debug) 908 try { 909 if (typeof n == "object") { 910 console.log(n); 911 return; 912 } 913 var t = ""; 914 n.indexOf("cache") > -1 && (t = "color: #db7c07;"); 915 n.indexOf("template") > -1 && (t = "color: #364280;"); 916 n.indexOf("Google") > -1 && (t = "color: #25ab26 ;"); 917 n.indexOf("error") > -1 && (t = "background: #b81414; color: #fff"); 918 n = "%c" + n; 919 console.log(n, t); 920 } catch (i) {} 921}; 922IBE.Utils.lookupCountry = function () { 923 var n = $.Deferred(); 924 return ( 925 IBE.Utils.request({ 926 url: IBE.Config.apiBaseUrl + "/system/countrylookup/?apikey=" + IBE.Config.apiKey, 927 dataType: "json", 928 contentType: "application/json", 929 }) 930 .done(function (t) { 931 n.resolve(t); 932 }) 933 .fail(function (n) { 934 IBE.Utils.consoleLog("Country Lookup failed"); 935 var t = {}; 936 t.Message = n.toJSON(); 937 t.hotelId = parseInt(IBE.Config.hotelId); 938 t.Severity = "Warning"; 939 IBE.Utils.logEvent(t); 940 }), 941 n.promise() 942 ); 943}; 944IBE.Utils.populatePhotos = function (n) { 945 var t = []; 946 return typeof n == "undefined" 947 ? t 948 : (ko.utils.arrayMap(n, function (n) { 949 var i = new IBE.Models.Photo(n); 950 i.url() != "" && t.push(i); 951 }), 952 t); 953}; 954IBE.Utils.populateGuestTypes = function (n) { 955 if (typeof n == "undefined") return []; 956 var t = []; 957 return ( 958 $.each(n, function (n, i) { 959 var r = new IBE.Models.GuestType(i); 960 t.push(r); 961 }), 962 t 963 ); 964}; 965IBE.Utils.populateSettings = function (n) { 966 var t, e, o, u, i, s, f, r, h; 967 if (typeof n == "undefined") return []; 968 for (t in n) 969 if (n.hasOwnProperty(t)) 970 switch (t) { 971 case "maxAdults": 972 case "maxChildren": 973 case "maxRooms": 974 n[t] = parseInt(n[t]); 975 break; 976 case "ibeRoomSorting": 977 e = n[t]; 978 o = e.replace("availability.", "availabilitySorting."); 979 n[t] = o; 980 break; 981 case "sojern": 982 u = JSON.parse(n[t]); 983 for (i in u) 984 u.hasOwnProperty(i) && 985 ((s = i.toString().charAt(0).toLowerCase() + i.toString().slice(1)), 986 (IBE.Config[s] = u[i])); 987 break; 988 case "triptease": 989 f = JSON.parse(n[t]); 990 for (r in f) 991 f.hasOwnProperty(r) && 992 ((h = r.toString().charAt(0).toLowerCase() + r.toString().slice(1)), 993 (IBE.Config[h] = f[r])); 994 } 995 return n; 996}; 997IBE.Utils.populateBoardTypes = function (n) { 998 if (typeof n == "undefined") return []; 999 var t = []; 1000 return ( 1001 $.each(n, function (n, i) { 1002 var r = new IBE.Models.BoardType(i); 1003 t.push(r); 1004 }), 1005 t 1006 ); 1007}; 1008IBE.Utils.weekdayRates = function (n) { 1009 var i, t, u; 1010 if (!n || n.length == 0) return []; 1011 var e = [], 1012 r = [], 1013 f = moment(n[0].date()), 1014 o = moment(n[n.length - 1].date()), 1015 s = moment(f).isoWeekday(1), 1016 h = moment(o).isoWeekday(7), 1017 c = h.diff(s, "days"), 1018 l = f.diff(s, "days"); 1019 for (i = 0; i <= c; i++) 1020 (t = new IBE.Models.Daily({})), 1021 (t.status = "stay"), 1022 (t.price = 0), 1023 (t.priceWithoutDiscount = 0), 1024 (u = i - l), 1025 u >= 0 && 1026 u < n.length &&
1027 ((t.price = n[u].price()), (t.priceWithoutDiscount = n[u].priceWithoutDiscount())), 1028 (t.date = s.clone().add(i, "d")), 1029 t.date == f && (t.status = "checkIn"), 1030 t.date == o && (t.status = "checkOut"), 1031 t.date < f && (t.status = "inactive"), 1032 t.date > o && (t.status = "inactive"), 1033 r.push(t), 1034 (i + 1) % 7 == 0 && (e.push(r), (r = [])); 1035 return r.length > 0 && e.push(r), e; 1036}; 1037IBE.Utils.calculateRoomBoard = function (n) { 1038 var t = n.preferredBoard(); 1039 ko.utils.arrayForEach(n.hotelResults(), function (i) { 1040 ko.utils.arrayForEach(i.requestedRooms(), function (i) { 1041 ko.utils.arrayForEach(i.roomResults(), function (i) { 1042 for ( 1043 var r, 1044 s = IBE.Config.boardType[t], 1045 e = 0, 1046 u = i.supportedBoards.replace(/,/g, "").split(" "), 1047 o = u.length, 1048 f = 0; 1049 f < o; 1050 f++ 1051 ) 1052 e += IBE.Config.boardType[u[f]]; 1053 r = ""; 1054 r = e & s ? n.preferredBoard() : o > 0 ? u[0] : IBE.Config.defaultBoardType; 1055 ko.utils.arrayForEach(i.rateplans(), function (n) { 1056 ko.utils.arrayForEach(n.roomBoards(), function (n) { 1057 n.isSelected(n.boardType() == r); 1058 r == t ? n.insteadOfBoard(n.boardType()) : n.insteadOfBoard(t); 1059 }); 1060 }); 1061 }); 1062 }); 1063 }); 1064}; 1065IBE.Utils.claculateRateplanId = function (n, t) { 1066 ko.utils.arrayForEach(n.hotelResults(), function (n) { 1067 ko.utils.arrayForEach(n.requestedRooms(), function (n) { 1068 ko.utils.arrayForEach(n.roomResults(), function (n) { 1069 var i = [], 1070 u, 1071 r; 1072 ko.utils.arrayForEach(n.rateplans(), function (n) { 1073 var r = ko.utils.arrayFirst(n.roomBoards(), function (n) { 1074 return n.boardType() === t && n.averageDailyRate() > 0; 1075 }); 1076 r != null && i.push(r); 1077 }); 1078 u = minProp(i, "price"); 1079 r = ko.utils.arrayFilter(i, function (n) { 1080 return n.price() === u; 1081 }); 1082 r.length > 0 && n.ratePlanId(r[0].ratePlanId); 1083 }); 1084 }); 1085 }); 1086}; 1087IBE.Utils.parseDeepLinking = function (n, t) { 1088 function u() { 1089 var u, n, f, e, r, o; 1090 if (i.rooms.length > 0) { 1091 for (t.requestedRooms.removeAll(), u = [], n = 0; n < i.rooms.length; n++) { 1092 for (f = new IBE.Models.RequestedRoom(n + 1), e = [], r = 0; r < i.rooms[n].length; r++) 1093 (o = new IBE.Models.RequestedRoomGuestType(i.rooms[n][r])), e.push(o); 1094 f.guests = e; 1095 u.push(f); 1096 } 1097 t.requestedRooms(u); 1098 } 1099 } 1100 if (typeof n == "undefined" || n.length === 0 || typeof t == "undefined") return !1; 1101 var i = { 1102 checkIn: "", 1103 checkOut: "", 1104 rooms: [], 1105 couponCode: "", 1106 board: t.hotel().info.defaultBoardType(), 1107 rateplan: 0, 1108 lang: IBE.Config.defaultLang, 1109 currency: IBE.Config.currency, 1110 roomId: 0, 1111 ref: new IBE.Models.Referrer(), 1112 }, 1113 r = n.replace("?", "").split("&"); 1114 return r.length < 1 1115 ? !1 1116 : (ko.utils.arrayForEach(r, function (n) { 1117 var u = n.split("="), 1118 a = moment(), 1119 e, 1120 f = new IBE.Models.Referrer(), 1121 o = null, 1122 c, 1123 l, 1124 s, 1125 h, 1126 v; 1127 (u[0] === "ref" && 1128 typeof u[1] != "undefined" && 1129 u[1].toLowerCase() == "googlehotelads" && 1130 ((f.name = "GoogleHotelAds"), 1131 (o = r.find(function (n) { 1132 var t = n.split("="); 1133 return t[0].toLowerCase() === "campaignid" && typeof t[1] != "undefined"; 1134 })), 1135 o && (f.campaign = o.split("=")[1]), 1136 Cache.write("ref", f, 43200, "localstorage"), 1137 (i.ref = f), 1138 t.referrer(f)), 1139 u[0] === "ref" && 1140 typeof u[1] != "undefined" && 1141 (i.ref === "" || (typeof i == "object" && i.ref.name == "")) && 1142 ((f.name = u[1]), Cache.write("ref", f, 43200, "localstorage"), (i.ref = f), t.referrer(f)), 1143 (u[0] === "sig" || u[0] === "cig") && 1144 typeof u[1] != "undefined" && 1145 ((f = new IBE.Models.Referrer()), 1146 (f.name = "AdWords"), 1147 (o = r.find(function (n) { 1148 var t = n.split("="); 1149 return t[0] === "_campaign" && typeof t[1] != "undefined"; 1150 })), 1151 o && (f.campaign = o.split("=")[1]), 1152 Cache.write("ref", f, 43200, "localstorage"), 1153 (i.ref = f), 1154 t.referrer(f)), 1155 u[0] === "trv_reference" && 1156 typeof u[1] != "undefined" && 1157 ((f = new IBE.Models.Referrer()), 1158 (f.name = "Trivago"),
1159 (f.params = { trv_reference: u[1] }), 1160 Cache.write("ref", f, 43200, "localstorage"), 1161 (i.ref = f), 1162 t.referrer(f)), 1163 (u[0] === "ci" || u[0] === "checkIn") && 1164 typeof u[1] != "undefined" && 1165 ((e = moment(u[1])), 1166 e.isValid() 1167 ? ((i.checkIn = moment(u[1]).format("YYYY-MM-DD")), 1168 e.diff(a, "days") < 0 1169 ? (i.checkIn = moment(t.minCheckInDate()).format("YYYY-MM-DD")) 1170 : t.checkIn(new Date(i.checkIn))) 1171 : (i = !1)), 1172 (u[0] === "co" || u[0] === "checkOut") && 1173 typeof u[1] != "undefined" && 1174 ((e = moment(u[1])), 1175 e.isValid() 1176 ? ((i.checkOut = moment(u[1]).format("YYYY-MM-DD")), 1177 e.diff(a, "days") < 0 && (i.checkOut = moment(t.minCheckOutDate()).format("YYYY-MM-DD"))) 1178 : (i = !1)), 1179 i !== !1) && 1180 (u[0] === "couponCode" && 1181 u[1] !== "couponCode" && 1182 ((i.couponCode = u[1]), t.couponCode(i.couponCode)), 1183 u[0] === "board" && 1184 u[1] !== "board" && 1185 u[1] !== "undefined" && 1186 ((c = ko.utils.arrayFirst(t.boardTypes(), function (n) { 1187 return n.boardType === u[1] || n.boardType.toLowerCase() === u[1]; 1188 })), 1189 c != null && ((i.board = u[1]), t.boardType(c.boardType))), 1190 u[0] === "lang" && 1191 typeof u[1] != "lang" && 1192 u[1] != "" && 1193 ((l = u[1].toLowerCase().replace("_", "-")), 1194 (s = ko.utils.arrayFirst(t.languages(), function (n) { 1195 return n.locale === l || n.culture.toLowerCase() === l; 1196 })), 1197 s != null && ((i.lang = s.culture), t.lang(s.culture))), 1198 u[0] === "cur" && 1199 typeof u[1] != "cur" && 1200 u[1] !== "undefined" && 1201 (t.currencies().length > 0 1202 ? ((h = ko.utils.arrayFirst(t.currencies().rates, function (n) { 1203 return n.code == u[1] || n.code.toLowerCase() == u[1]; 1204 })), 1205 h != null && ((i.currency = h.code), t.currency(h.code))) 1206 : ((i.currency = u[1].toUpperCase()), t.currency(u[1].toUpperCase()))), 1207 u[0] === "rp" && typeof u[1] != "undefined" && ((i.rateplan = u[1]), (t.rateplan = i.rateplan)), 1208 u[0] === "roomId" && typeof u[1] != "undefined" && (i.roomId = parseInt(u[1])), 1209 u[0] === "r" && 1210 typeof u[1] != "undefined" && 1211 ((u[1] = decodeURIComponent(u[1])), 1212 (v = u[1].split("^")), 1213 ko.utils.arrayForEach(v, function (n) { 1214 var e, r, f, o, u; 1215 if (n != "") { 1216 e = n.split("/"); 1217 r = []; 1218 try { 1219 ko.utils.arrayForEach(t.hotel().info.guestTypes, function (n) { 1220 r.push({ 1221 ageCategory: n.ageCategory, 1222 fromAge: n.fromAge, 1223 toAge: n.toAge, 1224 pax: 0, 1225 }); 1226 }); 1227 r = t.hotel().info.guestTypes; 1228 } catch (s) { 1229 r = [ 1230 { ageCategory: "Adult", fromAge: 13, toAge: 99, pax: 0 }, 1231 { ageCategory: "Children", fromAge: 3, toAge: 12, pax: 0 }, 1232 { ageCategory: "Infant", fromAge: 0, toAge: 2, pax: 0 }, 1233 ]; 1234 } 1235 for (f = 0; f < e.length; f++) 1236 if (f == 0) r[0].pax(parseInt(e[f])); 1237 else 1238 for (o = parseInt(e[f]), u = 0; u < r.length; u++) 1239 if (r[u].fromAge <= o && r[u].toAge >= o) { 1240 r[u].pax(r[u].pax() + 1); 1241 break; 1242 } 1243 i.rooms.push(ko.toJS(r)); 1244 } 1245 }))); 1246 }), 1247 i.checkIn == "" || i.checkOut == "") 1248 ? !1 1249 : (t.checkOut(moment(i.checkOut)), 1250 t.checkIn(moment(i.checkIn)), 1251 i != !1 && 1252 (moment(i.checkIn).diff(moment(t.hotel().conditions.minCheckInDate), "days") < 0 && 1253 (t.checkIn(t.hotel().conditions.minCheckInDate), (i = !1)), 1254 moment(i.checkOut).diff(i.checkIn, "days") > t.hotel().conditions.maxStay && (i = !1)), 1255 typeof i.rooms != "undefined" && i.rooms.length == 0 && (i = !1), 1256 i !== !1 && u(), 1257 i); 1258}; 1259IBE.Utils.parseOfferRules = function (n, t) { 1260 var r, i; 1261 if (typeof n == "undefined" || typeof n.rules == "undefined" || n.rules.length == "undefined") return !1; 1262 r = moment(); 1263 t.checkIn(r); 1264 i = n.rules.minStay; 1265 moment(t.checkIn()).diff(moment(n.rules.checkInMin), "days") < 0 && t.checkIn(n.rules.checkInMin); 1266 moment(t.checkIn()).diff(moment(t.hotel().conditions.minCheckInDate), "days") < 0 && 1267 t.checkIn(t.hotel().conditions.minCheckInDate); 1268 i === "undefined" && t.checkOut(moment(t.checkIn).add(i, "days")); 1269}; 1270IBE.Utils.destroyView = function () { 1271 var i; 1272 try { 1273 for (i = 0; i < arguments.length; i++) 1274 typeof eval(arguments[i].toLowerCase()) != "undefined" && 1275 (ko.cleanNode($("#" + arguments[i])[0]), eval(arguments[i].toLowerCase()).clearMessage()); 1276 } catch (e) {} 1277 for (i = 0; i < arguments.length; i++) $("#" + arguments[i]).html(""), $("#" + arguments[i] + " *").unbind(); 1278}; 1279IBE.Utils.prepareView = function (route) { 1280 var i; 1281 try { 1282 for (i in routes) 1283 i != route && 1284 typeof routes[i] != "undefined" && 1285 typeof eval(routes[i].toLowerCase()) != "undefined" && 1286 (ko.cleanNode($("#" + arguments[i])[0]), eval(routes[i].toLowerCase()).clearMessage()); 1287 } catch (e) {} 1288 for (i in routes) i != route && ($("#" + routes[i]).html(""), $("#" + routes[i] + " *").unbind()); 1289}; 1290IBE.Utils.prepareMobileView = function (route) { 1291 var i; 1292 try { 1293 for (i in routes) 1294 i != route && 1295 typeof routes[i] != "undefined" && 1296 (ko.cleanNode($("#" + routes[i].id)[0]), eval(routes[i].id.toLowerCase()).clearMessage()); 1297 } catch (e) {} 1298 for (i in routes) i != route && ($("#" + routes[i].id).html(""), $("#" + routes[i].id + " *").unbind()); 1299}; 1300IBE.Utils.logEvent = function (n) {
1301 if (((n.hotelId = n.hotelId || 0), IBE.Config.debug === !0)) { 1302 IBE.Utils.consoleLog(n); 1303 return; 1304 } 1305 typeof gtag == "function" && 1306 gtag("send", "exception", { 1307 exDescription: n.message, 1308 exFatal: !0, 1309 appName: "IBE [hotel: " + n.hotelId + "]", 1310 appVersion: "5.0.5", 1311 }); 1312 var t = JSON.stringify(n); 1313 return ( 1314 IBE.Utils.consoleLog(n), 1315 IBE.Utils.request({ 1316 type: "POST", 1317 url: IBE.Config.apiBaseUrl + "/errors/logevent/?apikey=" + IBE.Config.apiKey, 1318 data: t, 1319 contentType: "application/json", 1320 dataType: "json", 1321 }) 1322 .done(function (n) { 1323 IBE.Utils.consoleLog("error logged: " + n); 1324 }) 1325 .fail(function (n, t) { 1326 IBE.Utils.consoleLog(t); 1327 }), 1328 0 1329 ); 1330}; 1331IBE.Utils.dateIsoFormat = function (n) { 1332 return moment.isMoment(n) 1333 ? n.format("YYYY-MM-DD") 1334 : n.getFullYear() + "-" + ("0" + (n.getMonth() + 1)).slice(-2) + "-" + ("0" + n.getDate()).slice(-2); 1335}; 1336IBE.Utils.queryString = function (n) { 1337 var t = ""; 1338 for (var i in n) t += i + "=" + n[i] + "&"; 1339 return t.substring(0, t.length - 1); 1340}; 1341IBE.Utils.dateDiff = function (n, t) { 1342 return Math.floor((n.getTime() - t.getTime()) / 864e5); 1343}; 1344IBE.Utils.getReservationSetting = function (n, t) { 1345 return typeof n == "undefined" 1346 ? "" 1347 : typeof t == "undefined" || typeof n.reservationSettings == "undefined" 1348 ? !1 1349 : n.reservationSettings.items.hasOwnProperty(t) 1350 ? n.reservationSettings.items[t] 1351 : ""; 1352}; 1353IBE.Utils.money = function (n, t) { 1354 var i = ko.unwrap(t.currency() || "EUR"), 1355 u = t.calculateRate(t.currency(), n), 1356 r = ko.utils.arrayFirst(t.currencies().rates, function (n) { 1357 return n.code == i; 1358 }); 1359 if ( 1360 (options || 1361 (options = 1362 i === "CZK" 1363 ? { precision: 2, symbol: i, thousand: " ", decimal: ",", format: "%v %s" } 1364 : { precision: 2, symbol: i, format: "%v %s" }), 1365 typeof r != "undefined" && u > 0) 1366 ) { 1367 options.symbol = r.symbol || r.code; 1368 switch (r.positivePattern) { 1369 case "SymbolAlignLeft": 1370 options.pattern = "%s%v"; 1371 break; 1372 case "SymbolAlignRight": 1373 options.pattern = "%v%s"; 1374 break; 1375 case "SymbolAlignLeftWithSpace": 1376 options.pattern = "%s %v"; 1377 break; 1378 case "SymbolAlignRightWithSpace": 1379 options.pattern = "%v %s"; 1380 break; 1381 default: 1382 options.pattern = "%s%v"; 1383 } 1384 } 1385 return accounting.formatMoney(u, options); 1386}; 1387IBE.Utils.getParam = function (n, t) { 1388 typeof t == "undefined" && ((t = n), (n = window.location.search)); 1389 t = t.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]"); 1390 var r = new RegExp("[\\?&]" + t + "=([^&#]*)"), 1391 i = r.exec(n); 1392 return i == null ? "" : decodeURIComponent(i[1].replace(/\+/g, " ")); 1393}; 1394IBE.Utils.stripTags = function (n) { 1395 return n.replace(/<\/?[^>]+(>|$)/g, ""); 1396}; 1397IBE.Utils.gaTrack = function (n) { 1398 IBE.Config.googleAnalyticsEnabled !== !1 && 1399 IBE.Config.googleAnalyticsId !== null && 1400 (IBE.Utils.consoleLog("Google Analytics: " + ko.toJSON(n)), 1401 typeof gtag == "function" && 1402 gtag("config", IBE.Config.googleAnalyticsId, { page_title: n.title, page_path: n.path })); 1403}; 1404IBE.Utils.gaRemarketingTrack = function (n) { 1405 if ( 1406 (IBE.Config.debug && console.log("IBE: In debug mode remarketing tracking is disabled"), 1407 (google_conversion_id = n || 0), 1408 (google_custom_params = window.google_tag_params), 1409 (google_remarketing_only = !0), 1410 google_conversion_id == 0) 1411 ) { 1412 console.log("IBE: google_conversion_id is not valid"); 1413 return; 1414 } 1415 var t = document.write; 1416 document.write = function (n) { 1417 $("body").append(n); 1418 }; 1419 $.getScript("//www.googleadservices.com/pagead/conversion.js", function () { 1420 setTimeout(function () { 1421 document.write = t; 1422 }, 100); 1423 }); 1424}; 1425IBE.Utils.authenticationHeader = function (n, t) { 1426 if (n !== "" && t !== "" && typeof n != "undefined" && typeof t != "undefined") { 1427 var i = "Basic " + $.base64.encode(n + ":" + t); 1428 return (document.cookie = "Authorization= " + i + ";path=/"), i; 1429 } 1430}; 1431IBE.Utils.authenticationCredentialsFromCookie = function () { 1432 var r = document.cookie.indexOf("Authorization="), 1433 n, 1434 t, 1435 i; 1436 return r !== -1 && 1437 ((n = document.cookie.indexOf(";", r + 1)), 1438 n === -1 && (n = document.cookie.length), 1439 (t = $.base64.decode(document.cookie.substring(0, n))), 1440 (i = t.indexOf(":")), 1441 i > 0) 1442 ? { username: t.substring(0, i), password: t.substring(i + 1) } 1443 : null; 1444}; 1445IBE.Utils.passwordStrength = function (n) { 1446 var i = 0, 1447 r, 1448 t, 1449 u, 1450 f, 1451 e; 1452 if (!n) return i; 1453 for (r = {}, t = 0; t < n.length; t++) (r[n[t]] = (r[n[t]] || 0) + 1), (i += 5 / r[n[t]]); 1454 u = { digits: /\d/.test(n), lower: /[a-z]/.test(n), upper: /[A-Z]/.test(n), nonWords: /\W/.test(n) }; 1455 f = 0; 1456 for (e in u) f += u[e] === !0 ? 1 : 0; 1457 return (i += (f - 1) * 10), parseInt(i); 1458}; 1459IBE.Utils.haveAuthenticationCookie = function () { 1460 var n = document.cookie.indexOf("Authorization="); 1461 return n !== -1 ? !0 : !1; 1462}; 1463IBE.Utils.authenticationCookie = function (n, t) { 1464 var u = "Authorization=", 1465 r = document.cookie.indexOf(u), 1466 i; 1467 return r !== -1 1468 ? ((i = document.cookie.indexOf(";", r + 1)), 1469 i === -1 && (i = document.cookie.length), 1470 unescape(document.cookie.substring(r + u.length, i))) 1471 : IBE.Utils.authenticationHeader(n, t); 1472}; 1473IBE.Utils.deleteAuthenticationCookie = function () { 1474 var n = document.cookie.indexOf("Authorization="); 1475 return n !== -1 ? ((document.cookie = "Authorization=; expires=Thu, 01 Jan 1970 00:00:00 GMT;path=/"), !0) : !1; 1476}; 1477IBE.Utils.convertCountries = function (n) { 1478 var i = Cache.read("Countries"), 1479 t; 1480 if ( 1481 i !== !1 && 1482 ((t = ko.utils.arrayFirst(i, function (t) { 1483 return t.code === n; 1484 })), 1485 t != null) 1486 ) 1487 return t.name; 1488}; 1489IBE.Utils.getEnumerationKey = function (n, t, i) { 1490 for (var r in n) if (n.hasOwnProperty(r) && n[r] === t) return i ? r.charAt(0).toLowerCase() + r.slice(1) : r; 1491 return ""; 1492}; 1493IBE.Utils.createFormAlphaBankRedirect = function (n, t) { 1494 var s = n.redirectPaymentGatewayData, 1495 i = JSON.parse(s), 1496 e = i.PaymentRedirectUrl, 1497 o = "0", 1498 h = new Date(), 1499 u, 1500 f, 1501 r; 1502 Array.isArray(n.payments) && 1503 n.payments.length > 0 && 1504 moment(h).format("YYYY-MM-DD") === moment(n.payments[0].dateToPay).format("YYYY-MM-DD") && 1505 (o = (Math.round(n.payments[0].amount * 100) / 100).toFixed(2)); 1506 u = 1507 '<form id="shopform1" method="POST" action="' + 1508 i.PaymentUrl + 1509 '" accept-charset="UTF-8" ><input type="hidden" name = "mid" value = "' + 1510 i.MerchantId + 1511 '" /><input type="hidden" name="lang" value="' + 1512 t.lang().substr(0, 2) + 1513 '" />
1513<input type="hidden" name="deviceCategory" value="0"/><input type="hidden" name="orderid" value="' + 1514 n.id + 1515 '" /><input type="hidden" name="orderDesc" value="' + 1516 n.hotelName + 1517 '" /><input type="hidden" name="orderAmount" value="' + 1518 o + 1519 '" /><input type="hidden" name="currency" value="' + 1520 n.currencyCode + 1521 '" /><input type="hidden" name="payerEmail" value="' + 1522 n.customer.email + 1523 '" /><input type="hidden" name="billCountry" value="' + 1524 n.customer.country + 1525 '" /><input type="hidden" name="billZip" value="' + 1526 n.customer.zip + 1527 '" /><input type="hidden" name="billCity" value="' + 1528 n.customer.city + 1529 '" /><input type="hidden" name="billAddress" value="' + 1530 n.customer.address + 1531 '" /><input type="hidden" name="payMethod" value="' + 1532 n.externalPaymentGatewayData + 1533 '"/><input type="hidden" name="confirmUrl" value="' + 1534 e + 1535 '" /><input type="hidden" name="cancelUrl" value="' + 1536 e + 1537 '" /><input type="hidden" name="digest" value="' + 1538 i.Digest + 1539 '" /></form >'; 1540 f = $(u); 1541 $("body").append(f); 1542 r = { message: n, severity: "info", hotelId: 0 }; 1543 IBE.Utils.logEvent(r); 1544 r = { message: u, severity: "info", hotelId: 0 }; 1545 IBE.Utils.logEvent(r); 1546 $(f).submit(); 1547}; 1548IBE.Utils.selfbookRedirect = function (n, t) { 1549 var i = n.redirectPaymentGatewayData, 1550 r = t.lang().substr(0, 2); 1551 $.ajax({ 1552 url: i + "/payment/SelfBookRedirection?lang=" + r, 1553 type: "POST", 1554 dataType: "text", 1555 success: function (n) { 1556 window.location.href = n; 1557 }, 1558 error: function (n) { 1559 var i, r; 1560 t.ready(!0); 1561 t.clearMessage(); 1562 i = "critical"; 1563 (n.status === 400 || n.status === 500) && (i = "error"); 1564 r = { id: n.status, severity: i, text: n.responseText }; 1565 t.events.notifySubscribers(r, "error"); 1566 }, 1567 }); 1568}; 1569IBE.Utils.stripeConfirmPayment = function (n, t) { 1570 var i = n.redirectPaymentGatewayData.split(","), 1571 r = t.lang().substr(0, 2), 1572 f = Stripe(i[2], { locale: r }), 1573 u = ""; 1574 f.confirmCardPayment(i[1], { payment_method: i[0], setup_future_usage: "off_session" }).then(function (f) { 1575 f.error 1576 ? ((u = f.error.message), 1577 $.ajax({ 1578 url: 1579 i[3] + 1580 "/payment/stripeResponse?status=failed&reservationId=" + 1581 n.id + 1582 "&errorMesssage=" + 1583 u + 1584 "&paymentMethod=" + 1585 i[0] + 1586 "&lang=" + 1587 r + 1588 "&paymentId=" + 1589 f.error.payment_intent.id, 1590 type: "POST", 1591 dataType: "text", 1592 success: function (n) { 1593 window.location.href = n; 1594 }, 1595 error: function (n) { 1596 var i, r; 1597 t.ready(!0); 1598 t.clearMessage(); 1599 i = "critical"; 1600 (n.status === 400 || n.status === 500) && (i = "error"); 1601 r = { id: n.status, severity: i, text: n.responseText }; 1602 t.events.notifySubscribers(r, "error"); 1603 }, 1604 })) 1605 : (f.paymentIntent.status === "succeeded" || f.paymentIntent.status === "requires_capture") && 1606 $.ajax({ 1607 url: 1608 i[3] + 1609 "/payment/stripeResponse?status=success&reservationId=" + 1610 n.id + 1611 "&paymentMethod=" + 1612 i[0] + 1613 "&lang=" + 1614 r + 1615 "&paymentId=" + 1616 f.paymentIntent.id, 1617 type: "POST", 1618 dataType: "text", 1619 success: function (n) { 1620 window.location.href = n; 1621 }, 1622 error: function (n) { 1623 var i, r; 1624 t.ready(!0); 1625 t.clearMessage(); 1626 i = "critical"; 1627 (n.status === 400 || n.status === 500) && (i = "error"); 1628 r = { id: n.status, severity: i, text: n.responseText }; 1629 t.events.notifySubscribers(r, "error"); 1630 }, 1631 }); 1632 }); 1633}; 1634IBE.Utils.generateGuid = function () { 1635 return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function (n) { 1636 var t = (Math.random() * 16) | 0, 1637 i = n == "x" ? t : (t & 3) | 8; 1638 return i.toString(16); 1639 }); 1640};
1641ko.validation.configure({ 1642 registerExtenders: !0, 1643 messagesOnModified: !0, 1644 insertMessages: !0, 1645 parseInputAttributes: !0, 1646 messageTemplate: null, 1647}); 1648ko.validation.rules.creditCard = { 1649 getValue: function (n) { 1650 return typeof n == "function" ? n() : n; 1651 }, 1652 validator: function (n) { 1653 var t = new RegExp( 1654 "^(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|62[0-9]{14,17}|8171[0-9]{12,15}|6(?:011|5[0-9][0-9])[0-9]{12}|3[47][0-9]{13}|3(?:0[0-5]|[68][0-9])[0-9]{11}|(?:2131|1800|35\\d{3})\\d{11})$" 1655 ); 1656 return t.test(n); 1657 }, 1658 message: IBE.Utils.translate("validation.creditCard"), 1659}; 1660ko.validation.rules.checkbox = { 1661 validator: function (n) { 1662 return n; 1663 }, 1664 message: IBE.Utils.translate("validation.acceptTerms"), 1665}; 1666ko.validation.rules.phone = { 1667 validator: function (n) { 1668 if (typeof n != "undefined") { 1669 var t = n.match(/\d+/g); 1670 return t !== null && t[0].length > 0; 1671 } 1672 }, 1673 message: IBE.Utils.translate("validation.required"), 1674}; 1675ko.validation.registerExtenders(); 1676ko.utils.clone = function (n) { 1677 return ko.mapping.fromJS(ko.toJS(n)); 1678}; 1679ko.utils.isBound = function (n) { 1680 return !!ko.dataFor(document.getElementById(n)); 1681}; 1682ko.numericObservable = function (n) { 1683 var t = ko.observable(n); 1684 return ko.dependentObservable({ 1685 read: function () { 1686 return t(); 1687 }, 1688 write: function (n) { 1689 var i = parseInt(n); 1690 t(isNaN(i) ? n : i); 1691 }, 1692 }); 1693}; 1694ko.assignObservable = function (n, t) { 1695 return ko.isObservable(n) ? n : ko.observable(n || t); 1696}; 1697ko.assignObservableArray = function (n) { 1698 return ko.isObservable(n) ? n : ko.observableArray(n); 1699}; 1700ko.observableArray.fn.filterByProperty = function (n, t) { 1701 return ko.computed(function () { 1702 for (var r, u = this(), f = [], i = 0; i < u.length; i++) 1703 (r = u[i]), ko.unwrap(r[n]) === ko.unwrap(t) && f.push(r); 1704 return f; 1705 }, this); 1706}; 1707ko.extenders.format = function (n, t) { 1708 return ( 1709 (n.format = ko.computed(function () { 1710 return n() ? moment(n()).format(t) : ""; 1711 })), 1712 n 1713 ); 1714}; 1715ko.observableArray.fn.sortByProperty = function (n) { 1716 this.sort(function (t, i) { 1717 var r = [], 1718 u; 1719 for (r[0] = 0, r[1] = 0, u = 0; u < n.length; u++) { 1720 var f = Math.pow(10, n.length - u), 1721 s = n[u][0], 1722 h = n[u][1], 1723 e = ko.unwrap(t[s]), 1724 o = ko.unwrap(i[s]); 1725 e === o 1726 ? ((r[0] += f), (r[1] += f)) 1727 : h.toLowerCase() === "asc" 1728 ? ((r[0] += e > o ? 0 : f), (r[1] += e > o ? f : 0)) 1729 : ((r[1] += e < o ? f : 0), (r[0] += e < o ? 0 : f)); 1730 } 1731 return r[0] === r[1] ? 0 : r[0] > r[1] ? -1 : r[0] < r[1] ? 1 : void 0; 1732 }); 1733}; 1734ko.dependentObservable.fn.trackReevaluations = function () { 1735 return ( 1736 (this.reevaluationCount = ko.observable(0)), 1737 this.subscribe(function () { 1738 this.reevaluationCount(this.reevaluationCount() + 1); 1739 }, this), 1740 this 1741 ); 1742}; 1743ko.bindingHandlers.stopBindings = { 1744 init: function () { 1745 return { controlsDescendantBindings: !0 }; 1746 }, 1747}; 1748ko.bindingHandlers.gaqPush = { 1749 init: function (n, t) { 1750 var i = t(), 1751 r = typeof i == "object" && !(i instanceof Array), 1752 u = r ? i.track : i, 1753 f = r ? i.eventName : "click", 1754 e = function () { 1755 var n = {}; 1756 return ( 1757 (n[f] = function () { 1758 IBE.Utils.consoleLog("GoogleAnalytics: " + u); 1759 gtag(u); 1760 }), 1761 n 1762 ); 1763 }; 1764 }, 1765}; 1766ko.bindingHandlers.gaTrack = { 1767 init: function (n, t) { 1768 if (IBE.Config.googleAnalyticsEnabled !== !1 && IBE.Config.googleAnalyticsId !== null) { 1769 var i = t(), 1770 r = typeof i == "object" && !(i instanceof Array); 1771 typeof gtag == "function" && 1772 (IBE.Utils.consoleLog("Google Analytics UA: " + ko.toJSON(i)), 1773 gtag("config", IBE.Config.googleAnalyticsId, { page_title: i.title, page_path: i.path }));
1774 IBE.Config.googleAnalyticsIdGA4 && 1775 (IBE.Utils.consoleLog("Google Analytics GA4: " + ko.toJSON(i)), 1776 typeof gtag == "function" && 1777 gtag("config", IBE.Config.googleAnalyticsIdGA4, { page_title: i.title, page_path: i.path })); 1778 } 1779 }, 1780}; 1781ko.bindingHandlers.backgroundImage = { 1782 update: function (n, t, i) { 1783 var u = i().backgroundImageOptions || {}, 1784 f = ko.utils.unwrapObservable(t()), 1785 r = "", 1786 e; 1787 f !== "" && 1788 (typeof u.width != "undefined" && (r += "width=" + ko.utils.unwrapObservable(u.width)), 1789 typeof u.height != "undefined" && 1790 (r !== "" && (r += "&"), (r += "height=" + ko.utils.unwrapObservable(u.height))), 1791 typeof u.mode != "undefined" && 1792 (r !== "" && (r += "&"), (r += "mode=" + ko.utils.unwrapObservable(u.mode))), 1793 (e = f), 1794 r !== "" && (e = f + "?" + r), 1795 $(n).css({ backgroundImage: "url(" + e + ")" })); 1796 }, 1797}; 1798ko.bindingHandlers.href = { 1799 update: function (n, t) { 1800 ko.bindingHandlers.attr.update(n, function () { 1801 return { href: t() }; 1802 }); 1803 }, 1804}; 1805ko.bindingHandlers.src = { 1806 update: function (n, t) { 1807 ko.bindingHandlers.attr.update(n, function () { 1808 return { src: t() }; 1809 }); 1810 }, 1811}; 1812pauseOnSelectEvent = !1; 1813pauseMultiple = !1; 1814ko.bindingHandlers.multiDatepicker = { 1815 init: function (n, t, i, r) { 1816 var f, u; 1817 n = $(n); 1818 f = i().datepickerOptions || {}; 1819 displayNotAvailable = IBE.Utils.getReservationSetting(r, "displayNotAvailable"); 1820 n.datepick({ 1821 rangeSelect: !0, 1822 monthsToShow: [1, 2], 1823 firstDay: 1, 1824 changeMonth: !1, 1825 maxDate: "+1y", 1826 dateFormat: "dd/mm/yyyy", 1827 defaultDate: r.minCheckInDate(), 1828 todayText: "", 1829 onSelect: function (n) { 1830 if (n.length !== 0 && !pauseMultiple) { 1831 var t = n[0], 1832 i = n[1]; 1833 if (t - r.checkIn() != 0 || i - r.checkOut() != 0) { 1834 if (selectedDatepicker === "MultiCalendar") { 1835 if (t - i == 0) { 1836 selectedDatepicker = ""; 1837 return; 1838 } 1839 pauseOnSelectEvent = !0; 1840 r.checkIn(moment(t).startOf("day")); 1841 r.checkOut(moment(i).startOf("day")); 1842 pauseOnSelectEvent = !1; 1843 } 1844 ko.bindingHandlers.multiDatepicker.styleSelectedDates(); 1845 } 1846 } 1847 }, 1848 onChangeMonthYear: function () { 1849 ko.bindingHandlers.multiDatepicker.styleSelectedDates(); 1850 }, 1851 onDate: function (n) { 1852 return isDateActive(r, new Date(n)) ? {} : { dateClass: "not-available", selectable: !1 }; 1853 }, 1854 }); 1855 u = ko.unwrap(i().lang); 1856 $.datepick.regionalOptions.hasOwnProperty(u) && 1857 (($.datepick.regionalOptions[u].prevText = '<span class="fa fa-chevron-left" />'), 1858 ($.datepick.regionalOptions[u].nextText = '<span class="fa fa-chevron-right" />'), 1859 n.datepick("option", $.datepick.regionalOptions[u]), 1860 n.datepick("option", { lang: u })); 1861 ko.utils.registerEventHandler(n, "click", function (t) { 1862 t.cancelBubble = !0; 1863 t.stopImmediatePropagation(); 1864 selectedDatepicker = n.attr("id"); 1865 }); 1866 ko.utils.domNodeDisposal.addDisposeCallback(n, function () { 1867 n.datepick("destroy"); 1868 }); 1869 }, 1870 update: function (n, t, i) { 1871 var r; 1872 n = $(n); 1873 var u = ko.utils.unwrapObservable(t()), 1874 f = u[0](), 1875 e = u[1](); 1876 pauseOnSelectEvent || n.datepick("setDate", f, e); 1877 r = ko.unwrap(i().lang); 1878 r && localizeDatepicker(n, r); 1879 }, 1880 styleSelectedDates: function () { 1881 window.setTimeout(function () { 1882 var n = $("#MultiCalendar .datepick"), 1883 t; 1884 n.find(".datepick-selected").eq(0).parent().addClass("first-selected"); 1885 t = n.find(".datepick-selected").length; 1886 t > 1 && 1887 n 1888 .find(".datepick-selected") 1889 .eq(t - 1) 1890 .parent() 1891 .addClass("last-selected"); 1892 }, 20); 1893 }, 1894}; 1895ko.bindingHandlers.datepicker = { 1896 init: function (n, t, i, r) { 1897 var o, u, f, e; 1898 n = $(n); 1899 o = i().datepickerOptions || {}; 1900 displayNotAvailable = IBE.Utils.getReservationSetting(r, "dis
1900playNotAvailable"); 1901 u = ko.utils.unwrapObservable(r.hotel); 1902 f = IBE.Config.closeDatesClickable; 1903 n.datepick({ 1904 firstDay: 1, 1905 changeMonth: !1, 1906 yearRange: "c-0:c+2", 1907 monthsToShow: 1, 1908 showTrigger: "#CalendarTrigger", 1909 todayText: "", 1910 clearText: "", 1911 closeText: "", 1912 defaultDate: r.minCheckInDate(), 1913 onSelect: function (n) { 1914 if (typeof n != "undefined") { 1915 var i = t(); 1916 i(moment(n[0])); 1917 } 1918 }, 1919 onDate: function (n) { 1920 var t, 1921 i = {}; 1922 try { 1923 t = 1924 n.getFullYear() + 1925 "-" + 1926 ("0" + (n.getMonth() + 1)).slice(-2) + 1927 "-" + 1928 ("0" + n.getDate()).slice(-2); 1929 } catch (r) { 1930 return !0; 1931 } 1932 if (!u.availability.hasOwnProperty(t)) return !1; 1933 switch (u.availability[t]) { 1934 case -1: 1935 i = { dateClass: "not-available", selectable: f }; 1936 break; 1937 case 0: 1938 i = { 1939 dateClass: "not-available", 1940 selectable: IBE.Config.displayResults[displayNotAvailable] != 0, 1941 }; 1942 break; 1943 default: 1944 return !0; 1945 } 1946 return i; 1947 }, 1948 }); 1949 ko.utils.registerEventHandler(n, "mousedown", function () { 1950 selectedDatepicker = n.attr("id"); 1951 }); 1952 ko.utils.domNodeDisposal.addDisposeCallback(n, function () { 1953 n.datepick("destroy"); 1954 }); 1955 e = ko.unwrap(i().lang) || IBE.Config.lang; 1956 ko.bindingHandlers.datepicker.changeLanguage(n, e, ko.unwrap(i().theme), ko.unwrap(i().theme)); 1957 }, 1958 update: function (n, t, i) { 1959 n = $(n); 1960 ko.bindingHandlers.datepicker.changeLanguage(n, ko.unwrap(i().lang), ko.unwrap(i().theme)); 1961 var r = ko.utils.unwrapObservable(t()); 1962 if (typeof r == "undefined") { 1963 IBE.Utils.consoleLog("date undefined"); 1964 return; 1965 } 1966 String(r).indexOf("/Date(") === 0 && (r = new Date(parseInt(r.replace(/\/Date\((.*?)\)\//gi, "$1")))); 1967 n.datepick("setDate", new Date(r)); 1968 }, 1969 changeLanguage: function (n, t, i) { 1970 t && localizeDatepicker(n, t, i); 1971 }, 1972 displayNotAvailable: "", 1973}; 1974ko.bindingHandlers.multiPropertyDatepicker = { 1975 init: function (n, t, i, r) { 1976 var f, u; 1977 n = $(n); 1978 f = i().datepickerOptions || {}; 1979 displayNotAvailable = IBE.Utils.getReservationSetting(r, "displayNotAvailable"); 1980 n.datepick({ 1981 firstDay: 1, 1982 changeMonth: !1, 1983 yearRange: "c-0:c+2", 1984 monthsToShow: 1, 1985 showTrigger: "#CalendarTrigger", 1986 todayText: "", 1987 clearText: "", 1988 closeText: "", 1989 defaultDate: r.minCheckInDate(), 1990 onSelect: function (n) { 1991 if (typeof n != "undefined") { 1992 var i = t(); 1993 i(moment(n[0])); 1994 } 1995 }, 1996 }); 1997 ko.utils.registerEventHandler(n, "mousedown", function () { 1998 selectedDatepicker = n.attr("id"); 1999 }); 2000 ko.utils.domNodeDisposal.addDisposeCallback(n, function () { 2001 n.datepick("destroy"); 2002 }); 2003 u = ko.unwrap(i().lang) || IBE.Config.lang; 2004 ko.bindingHandlers.multiPropertyDatepicker.changeLanguage(n, u, ko.unwrap(i().theme)); 2005 }, 2006 update: function (n, t, i) { 2007 var u, r; 2008 if ( 2009 ((n = $(n)), 2010 (u = ko.unwrap(i().lang) || IBE.Config.lang), 2011 ko.bindingHandlers.multiPropertyDatepicker.changeLanguage(n, u, ko.unwrap(i().theme)), 2012 (r = ko.utils.unwrapObservable(t())), 2013 typeof r == "undefined") 2014 ) { 2015 IBE.Utils.consoleLog("date undefined"); 2016 return; 2017 } 2018 String(r).indexOf("/Date(") == 0 && (r = new Date(parseInt(r.replace(/\/Date\((.*?)\)\//gi, "$1")))); 2019 n.datepick("setDate", new Date(r)); 2020 }, 2021 changeLanguage: function (n, t, i) { 2022 t && localizeDatepicker(n, t, i); 2023 }, 2024 displayNotAvailable: "", 2025}; 2026ko.bindingHandlers.availabilityCalendar = { 2027 update: function (n, t, i) { 2028 function f() {
2029 n.find("tr td a, tr td span").off("click"); 2030 } 2031 function f() { 2032 n.find("tr td a, tr td span").off("click"); 2033 } 2034 var s, u; 2035 n = $(n); 2036 var c = i().datepickerOptions || {}, 2037 r = i().availability, 2038 e = ko.unwrap(t())[0], 2039 o = ko.unwrap(t())[1], 2040 h = IBE.Config.closeDatesClickable; 2041 displayNotAvailable = i().displayNotAvailable; 2042 n.datepick({ 2043 rangeSelect: !0, 2044 firstDay: 1, 2045 changeMonth: !1, 2046 monthsToShow: 2, 2047 maxDate: "+2y", 2048 todayClass: "", 2049 dateFormat: "YYYY-MM-DD", 2050 prevText: '<span class="fa fa-chevron-left" />', 2051 nextText: '<span class="fa fa-chevron-right" />', 2052 todayText: "", 2053 onDate: function (n) { 2054 var t = {}, 2055 i = IBE.Utils.dateIsoFormat(n); 2056 if (r.hasOwnProperty(i)) 2057 switch (r[i]) { 2058 case 0: 2059 t = 2060 IBE.Config.displayResults[displayNotAvailable] === 0 2061 ? { dateClass: "not-available", selectable: !1 } 2062 : { dateClass: "not-available", selectable: !0 }; 2063 break; 2064 case 1: 2065 t = { 2066 dateClass: "last-room", 2067 selectable: !1, 2068 title: "Last Room", 2069 content: '<span class="last-room-content">' + moment(n).format("D") + "</span>", 2070 }; 2071 break; 2072 case -1: 2073 t = { dateClass: "not-available", selectable: h }; 2074 break; 2075 case -100: 2076 t = { dateClass: "not-available", selectable: !1 }; 2077 break; 2078 default: 2079 r[i] < 0 2080 ? ((t.dateClass = "not-available"), (t.title = "Not available")) 2081 : moment(i).isBetween(e.format("YYYY-MM-DD"), o.format("YYYY-MM-DD")) === !1 && 2082 ((t.dateClass = "available"), (t.title = "Available")); 2083 } 2084 else t = { dateClass: "not-available", selectable: !1 }; 2085 return t; 2086 }, 2087 onChangeMonthYear: function () { 2088 window.setTimeout(function () { 2089 f(); 2090 }, 20); 2091 }, 2092 }); 2093 n.datepick("setDate", new Date(e.format("YYYY-MM-DD")), new Date(o.format("YYYY-MM-DD"))); 2094 f(); 2095 s = ko.unwrap(i().theme); 2096 u = ko.unwrap(i().lang); 2097 u && localizeDatepicker(n, u, s); 2098 ko.utils.domNodeDisposal.addDisposeCallback(n, function () { 2099 n.datepick("destroy"); 2100 }); 2101 }, 2102}; 2103ko.bindingHandlers.datepickerWithRange = { 2104 init: function (n, t, i, r) { 2105 var u, f, e; 2106 n = $(n); 2107 u = i().datepickerOptions || {}; 2108 f = IBE.Config.closeDatesClickable; 2109 displayNotAvailable = IBE.Utils.getReservationSetting(r, "displayNotAvailable"); 2110 n.datepick({ 2111 firstDay: 1, 2112 changeMonth: !1, 2113 yearRange: "c-0:c+2", 2114 monthsToShow: u.monthsToShow || 1, 2115 showTrigger: '<span class="material-icons icon-date"></span>', 2116 dateFormat: "yyyy-mm-dd", 2117 pickerClass: u.pickerClass || "", 2118 rangeSelect: !1, 2119 todayText: "", 2120 clearText: "", 2121 closeText: "", 2122 defaultDate: r.minCheckInDate(), 2123 onSelect: function (n) { 2124 if (typeof n != "undefined") { 2125 var i = $("#CheckIn").datepick("getDate"), 2126 r = $("#CheckOut").datepick("getDate"), 2127 u = t(); 2128 u(moment(n[0])); 2129 $("#datepickerOpened").datepick("setDate", i, r); 2130 } 2131 }, 2132 onDate: function (n) { 2133 var r, 2134 t = {}, 2135 u, 2136 e; 2137 try { 2138 r = 2139 n.getFullYear() + 2140 "-" + 2141 ("0" + (n.getMonth() + 1)).slice(-2) + 2142 "-" + 2143 ("0" + n.getDate()).slice(-2); 2144 } catch (o) { 2145 return !0; 2146 } 2147 if (!i().availability.hasOwnProperty(r)) return !1; 2148 u = new Date($("#CheckIn").datepick("getDate")); 2149 e = new Date($("#CheckOut").datepick("getDate")); 2150 switch (i().availability[r]) { 2151 case 0: 2152 t =
2153 IBE.Config.displayResults[displayNotAvailable] === 0 2154 ? { dateClass: "not-available", selectable: !0 } 2155 : { dateClass: "not-available", selectable: !0 }; 2156 break; 2157 case -100: 2158 t = { dateClass: "not-available", selectable: !0 }; 2159 break; 2160 case -1: 2161 t = { dateClass: "not-available", selectable: f }; 2162 break; 2163 default: 2164 return n >= u && n <= e 2165 ? n.toString() == u.toString() 2166 ? { content: n.getUTCDate(), dateClass: "dateRangeFirst" } 2167 : n.toString() == e.toString() 2168 ? { content: n.getUTCDate(), dateClass: "dateRangeLast" } 2169 : { content: n.getUTCDate(), dateClass: "dateRange" } 2170 : !0; 2171 } 2172 return t; 2173 }, 2174 }); 2175 ko.utils.registerEventHandler(n, "mousedown", function () { 2176 selectedDatepicker = n.attr("id"); 2177 }); 2178 ko.utils.domNodeDisposal.addDisposeCallback(n, function () { 2179 n.datepick("destroy"); 2180 }); 2181 e = ko.unwrap(i().lang) || IBE.Config.lang; 2182 ko.bindingHandlers.datepicker.changeLanguage(n, e, ko.unwrap(i().theme), ko.unwrap(i().theme)); 2183 }, 2184 update: function (n, t, i) { 2185 n = $(n); 2186 ko.bindingHandlers.datepicker.changeLanguage(n, ko.unwrap(i().lang), ko.unwrap(i().theme)); 2187 var r = ko.utils.unwrapObservable(t()); 2188 if (typeof r == "undefined") { 2189 IBE.Utils.consoleLog("date undefined"); 2190 return; 2191 } 2192 String(r).indexOf("/Date(") === 0 && (r = new Date(parseInt(r.replace(/\/Date\((.*?)\)\//gi, "$1")))); 2193 n.datepick("setDate", new Date(r)); 2194 }, 2195 changeLanguage: function (n, t, i) { 2196 t && localizeDatepicker(n, t, i); 2197 }, 2198 displayNotAvailable: "", 2199}; 2200ko.bindingHandlers.datepickerWithRangeOpend = { 2201 init: function (n, t, i, r) { 2202 n = $(n); 2203 var u = i().datepickerOptions || {}, 2204 f = IBE.Config.closeDatesClickable; 2205 displayNotAvailable = IBE.Utils.getReservationSetting(r, "displayNotAvailable"); 2206 n.datepick({ 2207 firstDay: 1, 2208 startDate: "0d", 2209 minDate: new Date(i().minDate), 2210 changeMonth: !1, 2211 yearRange: "c-0:c+2", 2212 monthsToShow: u.monthsToShow || 1, 2213 showTrigger: ".icon-date", 2214 dateFormat: "yyyy-mm-dd", 2215 pickerClass: u.pickerClass || "", 2216 rangeSelect: u.rangeSelect || !1, 2217 defaultDate: new Date(2017, 4, 25), 2218 todayText: "", 2219 clearText: "", 2220 closeText: "", 2221 onSelect: function (n) { 2222 if (typeof n != "undefined" && moment(n[0]).diff(moment(n[1]), "days") !== 0) { 2223 var t = r.checkIn, 2224 i = r.checkOut; 2225 t(n[0]); 2226 i(n[1]); 2227 } 2228 }, 2229 onDate: function (n) { 2230 var t = {}, 2231 u = IBE.Utils.dateIsoFormat(n); 2232 try { 2233 u = 2234 n.getFullYear() + 2235 "-" + 2236 ("0" + (n.getMonth() + 1)).slice(-2) + 2237 "-" + 2238 ("0" + n.getDate()).slice(-2); 2239 } catch (c) { 2240 return !0; 2241 } 2242 if (!i().availability.hasOwnProperty(u)) return !1; 2243 var s = r.checkIn, 2244 h = r.checkOut, 2245 e = moment(s()).startOf("day"), 2246 o = moment(h()).startOf("day"); 2247 n = moment(n).startOf("day"); 2248 switch (i().availability[u]) { 2249 case 0: 2250 t =
2251 IBE.Config.displayResults[displayNotAvailable] === 0 2252 ? { dateClass: "not-available", selectable: !0 } 2253 : { dateClass: "not-available", selectable: !0 }; 2254 break; 2255 case -100: 2256 t = { dateClass: "not-available", selectable: !0 }; 2257 break; 2258 case -1: 2259 t = { dateClass: "not-available", selectable: f }; 2260 break; 2261 default: 2262 return n >= e && n <= o 2263 ? n.diff(e, "days") === 0 2264 ? { content: n.format("D"), dateClass: "dateRangeFirst" } 2265 : n.diff(o.utc(), "days") === 0 2266 ? { content: n.format("D"), dateClass: "dateRangeLast" } 2267 : { content: n.format("D"), dateClass: "dateRange" } 2268 : !0; 2269 } 2270 return t; 2271 }, 2272 }); 2273 ko.utils.registerEventHandler(n, "mousedown", function () { 2274 selectedDatepicker = n.attr("id"); 2275 }); 2276 ko.utils.domNodeDisposal.addDisposeCallback(n, function () { 2277 n.datepick("destroy"); 2278 }); 2279 }, 2280 update: function (n, t, i) { 2281 n = $(n); 2282 ko.bindingHandlers.datepicker.changeLanguage(n, ko.unwrap(i().lang), ko.unwrap(i().theme)); 2283 var r = ko.utils.unwrapObservable(t()); 2284 if (typeof r == "undefined") { 2285 IBE.Utils.consoleLog("date undefined"); 2286 return; 2287 } 2288 String(r).indexOf("/Date(") === 0 && (r = new Date(parseInt(r.replace(/\/Date\((.*?)\)\//gi, "$1")))); 2289 n.datepick("setDate", new Date(r)); 2290 }, 2291 changeLanguage: function (n, t, i) { 2292 t && localizeDatepicker(n, t, i); 2293 }, 2294}; 2295ko.bindingHandlers.bindMinDate = { 2296 update: function (n, t) { 2297 n = $(n); 2298 var i = ko.utils.unwrapObservable(t()); 2299 n.datepick("option", "minDate", new Date(i)); 2300 }, 2301}; 2302ko.bindingHandlers.roomSelectionTabs = { 2303 total: 0, 2304 getDisabled: function (n) { 2305 for (var i = [], t = n + 1; t <= ko.bindingHandlers.roomSelectionTabs.total - 1; t++) i.push(t); 2306 return i; 2307 }, 2308 init: function (n, t, i) { 2309 var u = $(n), 2310 r = i().tabOptions || {}, 2311 f = r.active; 2312 ko.bindingHandlers.roomSelectionTabs.total = u.find(t() + " li").length; 2313 r.disabled = ko.bindingHandlers.roomSelectionTabs.getDisabled(f); 2314 u.tabs(r); 2315 }, 2316 update: function (n, t, i, r) { 2317 var u = $(n), 2318 e = ko.utils.unwrapObservable(i().tabOptions), 2319 f = r.activeTabIndex(), 2320 o = u.tabs("option", "active"); 2321 u.tabs({ disabled: ko.bindingHandlers.roomSelectionTabs.getDisabled(f) }); 2322 u.tabs("enable", f); 2323 u.tabs("option", "active", f); 2324 r.activeRoomIndex(f + 1); 2325 }, 2326}; 2327ko.bindingHandlers.stopBinding = { 2328 init: function () { 2329 return { controlsDescendantBindings: !0 }; 2330 }, 2331}; 2332ko.bindingHandlers.translate = { 2333 update: function (n, t, i, r, u) { 2334 var f, o, e, s, h; 2335 try { 2336 if (((f = ko.utils.unwrapObservable(t())), (o = ko.unwrap(u.$root.lang()) || ""), typeof f == "object")) 2337 for (attr in f) n.setAttribute(attr, IBE.Utils.findTranslation(f[attr])); 2338 else 2339 (e = IBE.Utils.findTranslation(f)), 2340 i().hasOwnProperty("formatData") && (e = e.format(ko.unwrap(i().formatData[0]))), 2341 (n.innerHTML = e); 2342 n.setAttribute("lang", o.substring(0, 2)); 2343 s = n.style.display; 2344 n.style.display = "none"; 2345 h = n.offsetHeight; 2346 n.style.display = s; 2347 } catch (c) {} 2348 }, 2349}; 2350ko.bindingHandlers.stripTags = { 2351 update: function (n, t, i, r, u) { 2352 var f = u.$root.lang(); 2353 return ko.bindingHandlers.text.update(n, function () { 2354 return IBE.Utils.stripTags(ko.utils.unwrapObservable(t())); 2355 }); 2356 }, 2357}; 2358ko.bindingHandlers.date = { 2359 update: function (n, t, i) { 2360 var u = i.get("dateFormat") || "YYYY-MM-DD", 2361 f = moment(ko.unwrap(t())), 2362 r; 2363 f.isValid() 2364 ? (n.innerHTML = moment(ko.unwrap(t())).format(u)) 2365 : ((r = i().emptyDate), (n.innerHTML = r ? r : moment().format(u))); 2366 }, 2367}; 2368ko.bindingHandlers.money = { 2369 update: function (n, t, i, r, u) { 2370 var f = r, 2371 h = !1, 2372 e, 2373 c, 2374 a, 2375 y, 2376 o; 2377 if ( 2378 (f.hasOwnProperty("currency") 2379 ? (h = !0) 2380 : ko.utils.arrayForEach(u.$parents, function (n) { 2381 h || (n.hasOwnProperty("currency") && n.hasOwnProperty("currencies") && ((h = !0), (f = n))); 2382 }),
2383 (e = i.get("format") || IBE.Config.moneyFormat || ""), 2384 (c = !1), 2385 e !== "" ? (c = !0) : (e = "%v %s"), 2386 !h || typeof ko.unwrap(f.currencies).rates == "undefined") 2387 ) { 2388 a = ko.unwrap(r.currency) || ""; 2389 n.innerHTML = accounting.formatMoney(ko.unwrap(t()), { precision: 2, symbol: a, format: e }); 2390 return; 2391 } 2392 var l = ko.unwrap(i.get("currency") || f.currency() || "EUR"), 2393 v = f.calculateRate(f.currency(), ko.unwrap(t())), 2394 s = ko.utils.arrayFirst(f.currencies().rates, function (n) { 2395 return n.code == l; 2396 }); 2397 if ( 2398 ((options = 2399 l === "CZK" 2400 ? { precision: 2, symbol: l, thousand: " ", decimal: ",", format: "%v %s" } 2401 : { precision: 2, symbol: l, thousand: ",", decimal: ".", format: e }), 2402 typeof s != "undefined" && v > 0) 2403 ) 2404 if (IBE.Config.showCurrencyCode) 2405 if (c) options.format = e; 2406 else 2407 switch (s.positivePattern) { 2408 case "SymbolAlignLeft": 2409 case "SymbolAlignLeftWithSpace": 2410 options.format = "%s %v"; 2411 break; 2412 case "SymbolAlignRight": 2413 case "SymbolAlignRightWithSpace": 2414 options.format = "%v %s"; 2415 break; 2416 default: 2417 options.format = "%s %v"; 2418 } 2419 else if (((options.symbol = s.symbol || s.code), c)) options.format = e; 2420 else 2421 switch (s.positivePattern) { 2422 case "SymbolAlignLeft": 2423 options.format = "%s%v"; 2424 break; 2425 case "SymbolAlignRight": 2426 options.format = "%v%s"; 2427 break; 2428 case "SymbolAlignLeftWithSpace": 2429 options.format = "%s %v"; 2430 break; 2431 case "SymbolAlignRightWithSpace": 2432 options.format = "%v %s"; 2433 break; 2434 default: 2435 options.format = "%s%v"; 2436 } 2437 if (typeof f.lang != "undefined" && f.lang !== "") { 2438 y = Intl.NumberFormat(f.lang()); 2439 options.decimal = y.formatToParts 2440 ? Intl.NumberFormat(f.lang()) 2441 .formatToParts(1.1) 2442 .find((n) => n.type === "decimal").value 2443 : (1.1).toLocaleString(f.lang()).replace(/1/g, ""); 2444 switch (options.decimal) { 2445 case ".": 2446 options.thousand = ","; 2447 break; 2448 case ",": 2449 options.thousand = "."; 2450 break; 2451 default: 2452 options.thousand = ","; 2453 } 2454 f.currency() === "CZK" && ((options.thousand = " "), (options.decimal = ",")); 2455 } 2456 if (((o = accounting.formatMoney(v, options)), o.toString().length > 14)) { 2457 n.innerHTML = "<span class='smaller'>" + o + "</span>"; 2458 return; 2459 } 2460 if (o.toString().length > 10) { 2461 n.innerHTML = "<span class='small'>" + o + "</span>"; 2462 return; 2463 } 2464 n.innerHTML = o; 2465 }, 2466}; 2467ko.bindingHandlers.numeric = { 2468 init: function (n, t) { 2469 $(n).numeric({ negative: !1 }); 2470 ko.utils.registerEventHandler(n, "change", function () { 2471 var i = t(); 2472 i(parseInt($(n).val())); 2473 }); 2474 }, 2475 update: function (n, t) { 2476 ko.bindingHandlers.value.update(n, t); 2477 }, 2478}; 2479ko.bindingHandlers.dailyRateBreakDown = { 2480 init: function (n, t, i, r) { 2481 if (r.rateBreakDown()) { 2482 var o = ko.unwrap(t()), 2483 e = o.weeks(), 2484 f = "", 2485 u = ""; 2486 u += '<tr><th class="week"></th>'; 2487 ko.utils.arrayForEach(e[0], function (n) { 2488 u += "<th>" + n.date.format("ddd") + "</th>"; 2489 }); 2490 u += "</tr>"; 2491 f += "<thead>" + u + "</thead>"; 2492 u = ""; 2493 ko.utils.arrayForEach(e, function (n) { 2494 u += "<tr>"; 2495 ko.utils.arrayForEach(n, function (n) { 2496 u += "<td>" + n.date.format("DD") + "</td>"; 2497 }); 2498 u += "</tr>"; 2499 }); 2500 f += "<tbody>" + u + "</tbody>"; 2501 $(n).append(f); 2502 } 2503 }, 2504}; 2505ko.bindingHandlers.preventBubble = { 2506 init: function (n, t) { 2507 var i = ko.utils.unwrapObservable(t()); 2508 ko.utils.registerEventHandler(n, i, function (n) { 2509 n.cancelBubble = !0; 2510 n.stopPropagation && n.stopPropagation(); 2511 }); 2512 }, 2513}; 2514ko.bindingHandlers.map = { 2515 init: function (n, t) { 2516 var i = ko.utils.unwrapObservable(t()), 2517 u = new google.maps.LatLng(ko.utils.unwrapObservable(i.latitude), ko.utils.unwrapObservable(i.longitude)), 2518 r, 2519 f; 2520 i.map = new google.maps.Map(n, { 2521 center: u, 2522 zoom: i.zoom, 2523 scrollwheel: !1, 2524 mapTypeId: google.maps.MapTypeId.ROADMAP, 2525 }); 2526 r = new google.maps.Marker({ map: i.map, position: u, title: i.marker().title }); 2527 f = new google.maps.InfoWindow({ 2528 content: "<p>" + i.marker().title + "<br /><small>" + i.marker().street + "</small></p>", 2529 }); 2530 google.maps.event.addListener(r, "click", function () { 2531 f.open(i.map, r); 2532 }); 2533 }, 2534}; 2535ko.bindingHandlers.directionsMap = { 2536 init: function (n, t) { 2537 function e(n) { 2538 var t = { 2539 origin: n.coords ? new google.maps.LatLng(n.lat, n.lng) : n.address, 2540 destination: u, 2541 travelMode: google.maps.DirectionsTravelMode.DRIVING, 2542 }, 2543 e = { center: u, zoom: i.zoom, mapTypeId: google.maps.MapTypeId.ROADMAP }, 2544 o = new google.maps.Map(document.getElementById("map"), e); 2545 r.setMap(o); 2546 r.setPanel(document.getElementById("map-directions")); 2547 f.route(t, function (n, t) { 2548 t === google.maps.DirectionsStatus.OK && r.setDirections(n); 2549 }); 2550 } 2551 var i = ko.utils.unwrapObservable(t()), 2552 u = new google.maps.LatLng(ko.utils.unwrapObservable(i.latitude), ko.utils.unwrapObservable(i.longitude)), 2553 f = new google.maps.DirectionsService(), 2554 r = new google.maps.DirectionsRenderer(); 2555 navigator.geolocation && 2556 navigator.geolocation.getCurrentPosition(function (n) { 2557 e({ coords: !0, lat: n.coords.latitude, lng: n.coords.longitude }); 2558 }); 2559 }, 2560}; 2561ko.bindingHandlers.reservationStatus = { 2562 update: function (n, t) { 2563 var i = ko.utils.unwrapObservable(t()), 2564 r = ""; 2565 switch (IBE.Config.reservationStatus[i]) { 2566 case 1: 2567 r += " success " + i.toLowerCase(); 2568 break; 2569 case 2: 2570 case 6: 2571 r += " error " + i.toLowerCase(); 2572 break; 2573 case 4: 2574 r += " notice " + i.toLowerCase(); 2575 } 2576 $(n).addClass(r); 2577 }, 2578}; 2579ko.bindingHandlers.popover = { 2580 update: function (n, t) { 2581 var i = ko.utils.unwrapObservable(t()); 2582 i = $.extend(!0, {}, { placement: "bottom", toggle: "popover", trigger: "focus", html: !0, exclusive: !1 }, i); 2583 i.title = function () { 2584 return t().title; 2585 }; 2586 i.content = function () { 2587 return t().content; 2588 }; 2589 $(n).popover(i); 2590 }, 2591}; 2592ko.bindingHandlers.toJSON = { 2593 update: function (n, t) { 2594 return ko.bindingHandlers.text.update(n, function () { 2595 return ko.toJSON(t(), null, 2); 2596 }); 2597 }, 2598}; 2599ko.bindingHandlers.logger = { 2600 update: function (n, t, i) { 2601 var r = ko.utils.domData.get(n, "_ko_logger") || 0, 2602 u = ko.toJS(t() || i()); 2603 ko.utils.domData.set(n, "_ko_logger", ++r); 2604 window.console && console.log && console.log(r, n, u); 2605 }, 2606}; 2607ko.bindingHandlers.magnificPopUpGallery = { 2608 update: function (n) { 2609 var t = $(n); 2610 t.magnificPopup({ type: "image", delegate: "a", gallery: { enabled: !0 } }); 2611 }, 2612}; 2613ko.bindingHandlers.magnificPopUpItems = { 2614 update: function (n, t, i) { 2615 var o = $(n), 2616 f = [], 2617 r = i.get("galleryItems"); 2618 if (typeof r != "undefined" && Array.isArray(r)) { 2619 var e = "", 2620 s = { 2621 mode: IBE.Config.roomImagesLightboxModeCrop ? "crop" : "", 2622 height: IBE.Config.roomImagesLightboxHeight, 2623 width: IBE.Config.roomImagesLightboxWidth, 2624 }, 2625 u = ko.utils.extend(s, ko.unwrap(t())); 2626 e = Object.keys(u) 2627 .map(function (n) { 2628 return u[n] !== "" ? encodeURIComponent(n) + "=" + encodeURIComponent(u[n]) : ""; 2629 }) 2630 .join("&"); 2631 ko.utils.arrayForEach(r, function (n) { 2632 f.push({ src: n.url() + "?" + e }); 2633 }); 2634 options = { 2635 items: f, 2636 type: "image", 2637 tLoading: "", 2638 preload: [0, 2], 2639 gallery: { enabled: !0, tCounter: '<span class="mfp-counter">%curr% / %total%</span>' }, 2640 }; 2641 o.magnificPopup(options); 2642 } 2643 }, 2644}; 2645ko.bindingHandlers.cycle = { 2646 update: function (n, t) { 2647 var i = $(n), 2648 f = ko.unwrap(t()), 2649 r = {}, 2650 u = i.data(); 2651 for (key in u) key.indexOf("cycle") != -1 && (r[key] = u[key]); 2652 i.cycle(r); 2653 ko.bindingHandlers.cycle.hover(n); 2654 ko.utils.domNodeDisposal.addDisposeCallback(n, function () { 2655 i.cycle("destroy"); 2656 }); 2657 }, 2658 hover: function (n) { 2659 $(n).hover( 2660 function () { 2661 var n = $(this); 2662 $(document).keydown(function (t) { 2663 if (t.keyCode == 37) { 2664 n.cycle("prev"); 2665 return; 2666 } 2667 if (t.keyCode == 39) { 2668 n.cycle("next"); 2669 return; 2670 } 2671 }); 2672 }, 2673 function () {
2674 $(document).unbind("keydown"); 2675 } 2676 ); 2677 }, 2678}; 2679ko.bindingHandlers.modal = { 2680 init: function (n, t) { 2681 var r = $(n), 2682 u = ko.utils.extend({}, ko.unwrap(t())), 2683 i = $(u.target); 2684 i.on("show.bs.modal", function () { 2685 $("html").addClass("modal-open"); 2686 $(".modal-backdrop").height($(document).height()); 2687 }); 2688 i.on("shown.bs.modal", function () { 2689 $("html").addClass("modal-open"); 2690 $(".modal-backdrop").height($(document).height()); 2691 }); 2692 i.on("hidden.bs.modal", function () { 2693 i.data("modal", null); 2694 }); 2695 r.on("click", function () { 2696 i.modal({ show: !0 }); 2697 }); 2698 ko.utils.domNodeDisposal.addDisposeCallback(n, function () { 2699 i.data("modal", null); 2700 }); 2701 }, 2702 update: function () {}, 2703}; 2704ko.bindingHandlers.readMore = { 2705 init: function (n, t, i) { 2706 var r = i().readmoreOptions; 2707 $(n).html(t()); 2708 window.setTimeout(function () { 2709 $(n).readmore({ 2710 speed: 75, 2711 moreLink: '<div class="readmore-js-toggle">' + IBE.Utils.translate("readMore") + "</div>", 2712 lessLink: '<div class="readmore-js-toggle">' + IBE.Utils.translate("close") + "</div>", 2713 }); 2714 }, 50); 2715 ko.utils.domNodeDisposal.addDisposeCallback(n, function () { 2716 $(n).readmore("destroy"); 2717 }); 2718 }, 2719}; 2720ko.bindingHandlers.slick = { 2721 init: function (n) { 2722 var t = $(n); 2723 window.setTimeout(function () { 2724 t.slick({ 2725 infinite: !1, 2726 dots: !1, 2727 arrows: !0, 2728 speed: 277, 2729 swipe: !0, 2730 slidesToShow: 1, 2731 draggable: !0, 2732 fade: !0, 2733 cssEase: "linear", 2734 accessibility: !0, 2735 }); 2736 }, 50); 2737 }, 2738}; 2739ko.bindingHandlers.select2 = { 2740 init: function (n, t, i) { 2741 var r = {}, 2742 f = i.get("data"), 2743 u; 2744 typeof f != "undefined" && (r.data = f); 2745 r.minimumInputLength = i.get("minimumInputLength") || 0; 2746 var h = i.get("showSearch") ? 1 : -1, 2747 e = i.get("width"), 2748 o = i.get("selectTemplate"), 2749 s = i.get("optionTemplateFunction"), 2750 c = $(n).siblings("#option").html(); 2751 if ( 2752 ((r.minimumResultsForSearch = h), 2753 s && 2754 (r.formatResult = function (n) { 2755 return s.call(n, c); 2756 }), 2757 o && (r.formatSelection = o), 2758 e && (r.width = e), 2759 (u = $(n)), 2760 u.select2(r), 2761 i.get("textNval") === !0) 2762 ) 2763 u.on("change", function (n) { 2764 var i = t(); 2765 i(n.added); 2766 }); 2767 ko.utils.domNodeDisposal.addDisposeCallback(n, function () { 2768 $(n).select2("destroy"); 2769 }); 2770 }, 2771 update: function (n, t, i) { 2772 var r = i.get("data"); 2773 typeof r != "undefined" && $(n).select2({ data: r }); 2774 }, 2775}; 2776ko.bindingHandlers.hidden = function () { 2777 function n(n, t) { 2778 var i = ko.unwrap(t()); 2779 $(n).css("visibility", i ? "hidden" : "visible"); 2780 } 2781 return { init: n, update: n }; 2782}; 2783ko.components.register("passwordstrength-widget", { 2784 viewModel: function (n) { 2785 this.password = ko.observable((n && n.value) || ""); 2786 self.validatePasswordStrength = ko.computed(function () { 2787 return IBE.Utils.passwordStrength(n.value); 2788 }); 2789 }, 2790 template: 2791 '<div class="password-strength" data-bind="visible: password"><span data-bind="value:validatePasswordStrength()"></span> <div class="background" data-bind="css: { success: validatePasswordStrength() > 60, error : validatePasswordStrength() <= 60}, style: { width: validatePasswordStrength()+ \'%\'}"> </div> </div>', 2792}); 2793ko.bindingHandlers.singleDatepicker = { 2794 init: function (n, t, i) { 2795 var r, u; 2796 n = $(n); 2797 r = i().datepickerOptions || {}; 2798 n.datepick({ 2799 firstDay: 1, 2800 changeMonth: !0, 2801 yearRange: "-100:+0", 2802 defaultDate: null, 2803 monthsToShow: r.monthsToShow || 1, 2804 showTrigger: '<span class="material-icons icon-date"></span>', 2805 dateFormat: "yyyy-mm-dd", 2806 pickerClass: r.pickerClass || "", 2807 rangeSelect: !1, 2808 todayText: "", 2809 clearText: "", 2810 closeText: "", 2811 onSelect: function (n) { 2812 if (typeof n != "undefined") { 2813 var i = t(); 2814 i(moment(n[0])); 2815 } 2816 }, 2817 }); 2818 ko.utils.registerEventHandler(n, "mousedown", function () { 2819 selectedDatepicker = n.attr("id"); 2820 }); 2821 ko.utils.domNodeDisposal.addDisposeCallback(n, function () { 2822 n.datepick("destroy"); 2823 });
2824 u = ko.unwrap(i().lang) || IBE.Config.lang; 2825 ko.bindingHandlers.datepicker.changeLanguage(n, u); 2826 }, 2827 changeLanguage: function (n, t) { 2828 t && 2829 (t.length > 2 && t !== "en-US" && (t = t.substring(0, 2)), 2830 n.datepick("option").lang !== t && 2831 $.datepick.regionalOptions.hasOwnProperty(t) && 2832 (($.datepick.regionalOptions[t].prevText = '<span class="material-icons"></span>'), 2833 ($.datepick.regionalOptions[t].nextText = '<span class="material-icons"></span>'), 2834 n.datepick("option", $.datepick.regionalOptions[t]), 2835 n.datepick("option", { lang: t }))); 2836 }, 2837 displayNotAvailable: "", 2838}; 2839ko.bindingHandlers.timePicker = { 2840 init: function (n, t, i) { 2841 var r = i().timepickerOptions || {}; 2842 $(n).timepicker(r); 2843 ko.utils.registerEventHandler(n, "change", function () { 2844 var i = t(); 2845 i($(n).timepicker("getTime")); 2846 }); 2847 }, 2848 update: function (n, t) { 2849 var i = ko.utils.unwrapObservable(t()), 2850 r = $(n).timepicker("getTime"); 2851 i - r != 0 && $(n).timepicker("setTime", i); 2852 }, 2853}; 2854ko.bindingHandlers.modifyRoomSelectionTabs = { 2855 total: 0, 2856 getDisabled: function (n) { 2857 for (var i = [], t = n + 1; t <= ko.bindingHandlers.roomSelectionTabs.total - 1; t++) i.push(t); 2858 return i; 2859 }, 2860 init: function (n, t, i) { 2861 var u = $(n), 2862 r = i().tabOptions || {}, 2863 f = r.active; 2864 ko.bindingHandlers.roomSelectionTabs.total = u.find(t() + " li").length; 2865 r.disabled = ko.bindingHandlers.roomSelectionTabs.getDisabled(f); 2866 u.tabs(r); 2867 }, 2868 update: function (n, t, i) { 2869 var r = $(n), 2870 e = ko.utils.unwrapObservable(i().tabOptions), 2871 f = e.viewmodel, 2872 u = f.activeTabIndex(), 2873 o = r.tabs("option", "active"); 2874 r.tabs({ disabled: ko.bindingHandlers.roomSelectionTabs.getDisabled(u) }); 2875 r.tabs("enable", u); 2876 r.tabs("option", "active", u); 2877 f.activeRoomIndex(u + 1); 2878 }, 2879}; 2880ko.bindingHandlers.addFiledsAuthorizeNet = function () { 2881 $("#CustomerCardHolder").after('<input type="hidden" name="dataValue" id="dataValue" />'); 2882 $("#CustomerCardHolder").after('<input type="hidden" name="dataDescriptor" id="dataDescriptor" />'); 2883}; 2884IBE.Models.Language = function (n) { 2885 var t = this; 2886 n = n || {}; 2887 t.country = n.country; 2888 t.culture = n.culture || ""; 2889 t.description = n.description; 2890 t.locale = n.locale; 2891}; 2892IBE.Models.Hotel = function (n) { 2893 var t = this; 2894 t.info = n.info || {}; 2895 t.availability = n.availability || {}; 2896 t.settings = n.settings || {}; 2897 t.offers = n.offers || []; 2898 t.conditions = n.conditions || {}; 2899 t.defaults = n.defaults || {}; 2900 t.memberships = []; 2901 typeof n.memberships != "undefined" && 2902 n.memberships != null && 2903 ko.utils.arrayForEach(n.memberships, function (n) { 2904 t.memberships.push(new IBE.Models.Membership(n)); 2905 }); 2906 t.hasMembership = t.memberships.length > 0; 2907 t.visibleOffers = ko.computed(function () { 2908 return ko.utils.arrayFilter(t.offers, function (n) { 2909 return n.showOffer; 2910 }); 2911 }); 2912 IBE.Data.Settings = IBE.Utils.populateSettings(t.settings); 2913 t.customerRegistrationMode = parseInt(t.settings.customerRegistrationMode); 2914}; 2915IBE.Models.RequestedRoom = function (n) { 2916 var t = this; 2917 t.guests = ko.observableArray([]); 2918 t.roomResults = ko.observableArray([]); 2919 t.roomIndex = ko.observable(n || 1); 2920 t.rank = 0; 2921 t.isBestValue = ko.computed({ 2922 read: function () { 2923 var n = {}, 2924 i = [], 2925 r = 1e15; 2926 return ( 2927 ko.utils.arrayForEach(t.roomResults(), function (n) { 2928 n.minPrice() > 0 && i.push({ id: n.roomId(), minPrice: n.minPrice() }); 2929 }), 2930 ko.utils.arrayForEach(i, function (t) { 2931 t.minPrice <= r && ((n = t), (r = t.minPrice)); 2932 }), 2933 n 2934 ); 2935 }, 2936 deferEvaluation: !0, 2937 }); 2938 t.preferredBoard = ko.observable(""); 2939 t.orderedRoomsPrices = function () { 2940 var n = []; 2941 return ( 2942 ko.utils.arrayForEach(t.roomResults(), function (t) { 2943 var i = t.minPrice(); 2944 i > 0 && 2945 n.push({ 2946 availability: t.availability, 2947 roomId: t.roomId(), 2948 price: i, 2949 averageDailyRate: t.averageDailyRate(), 2950 name: t.info().name, 2951 }); 2952 }), 2953 n.sort(function (n, t) { 2954 return n.price - t.price; 2955 }), 2956 n 2957 ); 2958 }; 2959 t.isVisible = ko.computed({ 2960 read: function () { 2961 var n = !1; 2962 return ( 2963 ko.utils.arrayForEach(t.roomResults(), function (t) { 2964 if (t.isVisible()) { 2965 n = !0; 2966 return; 2967 } 2968 }), 2969 n 2970 ); 2971 }, 2972 deferEvaluation: !0, 2973 }); 2974 t.sortRoomResults = function (n) { 2975 for (var r = [], i = 0; i < n.length;
2975 i++) r.push(n[i].split(".")); 2976 t.roomResults.sortByProperty(r); 2977 }; 2978 t.canAddGuest = function (n) { 2979 var i = 0; 2980 return ( 2981 ko.utils.arrayForEach(t.guests, function (n) { 2982 if (n.ageCategory() !== IBE.Config.guestType.Infant) { 2983 var t = ko.utils.unwrapObservable(n.pax); 2984 isNaN(parseInt(t)) || (i += parseInt(t)); 2985 } 2986 }), 2987 i < n 2988 ); 2989 }; 2990}; 2991IBE.Models.GuestType = function (n) { 2992 var t = this; 2993 n = n || {}; 2994 t.ageCategory = n.ageCategory || ""; 2995 t.fromAge = n.fromAge || ""; 2996 t.toAge = n.toAge || ""; 2997 t.max = n.max || ""; 2998 t.min = n.min || ""; 2999 t.pax = ko.observable(n.pax || 0); 3000}; 3001IBE.Models.Photo = function (n) { 3002 var t = this; 3003 t.id = n.id; 3004 t.type = n.imageType; 3005 t.description = n.description; 3006 t.title = n.title; 3007 t.rank = n.rank; 3008 t.url = ko.computed({ 3009 read: function () { 3010 var t = ko.utils.arrayFilter(n.transformations, function (n) { 3011 return n.key.toLocaleLowerCase().indexOf("original") > -1; 3012 }); 3013 return t.length === 1 ? t[0].url : ""; 3014 }, 3015 deferEvaluation: !0, 3016 }); 3017 t.valid = ko.computed({ 3018 read: function () { 3019 var t = ko.utils.arrayFilter(n.transformations, function (n) { 3020 return n.key.toLocaleLowerCase().indexOf("original") > 0; 3021 }); 3022 return t.length === 1; 3023 }, 3024 deferEvaluation: !0, 3025 }); 3026}; 3027IBE.Models.Offer = function (n, t) { 3028 var i = this, 3029 r; 3030 i.id = n.id; 3031 i.hotelId = n.hotelId; 3032 i.name = n.name; 3033 i.abstract = n.abstract; 3034 i.description = n.description; 3035 i.rules = n.rules; 3036 i.photos = IBE.Utils.populatePhotos(n.photos); 3037 i.showOffer = n.showOffer || !1; 3038 i.minStay = 1; 3039 i.cancellationPolicy = n.cancellationRules; 3040 i.paymentRules = n.paymentRules; 3041 i.havePhoto = ko.computed(function () { 3042 return i.photos.length > 0; 3043 }); 3044 i.info = ko.computed({ 3045 read: function () { 3046 var n = [], 3047 r; 3048 if (typeof t == "undefined" || typeof t.offers == "undefined") 3049 if (IBE.Data.HotelInfo[i.hotelId]) n = IBE.Data.HotelInfo[i.hotelId].offers; 3050 else return {}; 3051 else n = t.offers(); 3052 return ( 3053 (r = ko.utils.arrayFirst(n, function (n) { 3054 return i.offerId === n.id; 3055 })), 3056 r || {} 3057 ); 3058 }, 3059 deferEvaluation: !0, 3060 }); 3061 r = []; 3062 n.membershipLevels && n.membershipLevels.length > 0 && (r = n.membershipLevels); 3063 i.membershipLevels = ko.observableArray(r); 3064}; 3065IBE.Models.ReservationSettings = function (n) { 3066 var t = this; 3067 t.items = n || {}; 3068}; 3069IBE.Models.RequestedRoomGuestType = function (n) { 3070 var t = this; 3071 n = n || {}; 3072 t.ages = ko.observableArray(n.ages); 3073 t.ageCategory = ko.observable(n.ageCategory); 3074 n.fromAge === "" && (n.fromAge = 0); 3075 n.min === "" && (n.min = 0); 3076 t.fromAge = ko.observable(n.fromAge); 3077 t.toAge = ko.observable(n.toAge); 3078 t.pax = ko.observable(ko.unwrap(n.pax)); 3079 t.minValue = ko.observable(n.min); 3080 t.maxValue = ko.observable(n.max); 3081 t.label = ko.computed(function () { 3082 return t.ageCategory() === IBE.Config.guestType.Adult ? "" : t.fromAge() + "-" + t.toAge(); 3083 }); 3084 t.options = ko.computed(function () { 3085 for (var i = [], n = t.minValue(); n <= t.maxValue(); n++) i.push(n); 3086 return i; 3087 }); 3088 t.increase = function () { 3089 t.pax() != t.maxValue() && t.pax(t.pax() + 1); 3090 }; 3091 t.decrease = function () { 3092 t.pax() != t.minValue() && t.pax(t.pax() - 1); 3093 }; 3094}; 3095IBE.Models.HotelInfo = function (n) { 3096 var t = this; 3097 n = n || {}; 3098 t.hotelId = n.id || n.hotelId || 0; 3099 t.name = n.name; 3100 t.hotelType = n.hotelType; 3101 t.email = n.email; 3102 n.website && n.website.indexOf("http") === -1 && (n.website = "http://" + n.website); 3103 t.website = n.website; 3104 t.abstract = n.abstract; 3105 t.cancellationPolicy = n.cancellationPolicy; 3106 t.paymentPolicy = n.paymentPolicy; 3107 t.stars = n.stars; 3108 t.address = new IBE.Models.HotelAddress(n.address); 3109 t.prn = n.prn; 3110 t.gcn = n.gcn; 3111 t.notificationNumber = n.notificationNumber; 3112 t.logo = n.logo; 3113 t.termsConditions = n.termsConditions; 3114 typeof n.acceptedCards != "undefined" && 3115 (t.acceptedCards = 3116 n.acceptedCards === "All" && IBEConfig.allCreditCards 3117 ? IBEConfig.allCreditCards.split(",") 3118 : n.acceptedCards.split(", ")); 3119 t.photos = IBE.Utils.populatePhotos(n.photos); 3120 t.guestTypes = IBE.Utils.populateGuestTypes(n.guestTypes); 3121 t.boardTypes = IBE.Utils.populateBoardTypes(n.boardTypes); 3122 t.defaultBoardType = ko.computed({ 3123 read: function () { 3124 return ko.utils.arrayFirst(t.boardTypes, function (n) { 3125 return n.isDefault; 3126 }).boardType; 3127 }, 3128 deferEvaluation: !0, 3129 }); 3130 t.closedDates = []; 3131 typeof n.closedDates != "undefined" && 3132 ko.utils.arrayForEach(n.closedDates, function (n) { 3133 t.closedDates.push({ from: new Date(n.closedFrom), to: new Date(n.closedTo) }); 3134 }); 3135}; 3136IBE.Models.Terms = function (n) { 3137 var t = this; 3138 t.id = n.id || -1; 3139 t.terms = n.terms || ""; 3140 t.privacy = n.privacyPolicy || ""; 3141 t.value = ko.observable(!1).extend({ checkbox: { message: IBE.Utils.translate("acceptTerms") } }); 3142}; 3143IBE.Models.Consents = function (n) { 3144 var t = this; 3145 t.id = n.id || -1; 3146 t.title = n.title || ""; 3147 t.value = ko.observable(!1); 3148}; 3149IBE.Models.Membership = function (n) { 3150 var t = this; 3151 t.name = n.name || ""; 3152 t.id = n.id || 0; 3153 t.termsAndConditions = n.termsAndConditions || ""; 3154}; 3155IBE.Models.HotelAddress = function (n) { 3156 var t = this; 3157 t.latitude = n.latitude; 3158 t.longitude = n.longitude; 3159 t.street = n.street; 3160 t.region = n.region; 3161 t.city = n.city; 3162 t.country = n.country; 3163 t.countryCode = ""; 3164 t.phone = n.phone; 3165 t.timezone = n.timezone; 3166 t.email = n.email; 3167}; 3168IBE.Models.BoardType = function (n) { 3169 var t = this; 3170 t.name = n.name === "" ? IBE.Utils.translate(n.boardType) : n.name; 3171 t.boardType = n.boardType; 3172 t.description = n.description; 3173 t.isDefault = n.isDefault; 3174}; 3175IBE.Models.OfferInfo = function (n) { 3176 var t = this; 3177 t.id = n.id; 3178 t.name = n.name; 3179 t.hotelId = n.hotelId; 3180 t.abstract = n.abstract; 3181 t.description = n.description; 3182 t.showOffer = n.showOffer; 3183 t.paymentRules = n.paymentRules || {};
3184 t.photos = n.photos || []; 3185}; 3186IBE.Models.RatePlanInfo = function (n, t) { 3187 var i = this, 3188 r; 3189 if ( 3190 ((i.id = n.id), 3191 (i.defaultName = n.name), 3192 (i.description = n.description), 3193 (i.abstract = n.abstract), 3194 (i.paymentPocily = n.paymentPolicy), 3195 (i.hideStandardRate = n.hideStandardRate), 3196 (i.paymentRules = n.paymentRules || {}), 3197 (i.cancellationRules = ko.utils.arrayMap(n.cancellationRules, function (n) { 3198 return new IBE.Models.CancellationRule(n); 3199 })), 3200 (r = -1), 3201 (i.paymentRules = ko.utils.arrayMap(n.paymentRules, function (n) { 3202 return (r += 1), (n.Index = r), new IBE.Models.PaymentRule(n, t); 3203 })), 3204 i.paymentRules.length === 0) 3205 ) { 3206 if (!IBE.Data.HotelInfo[n.hotelId]) return; 3207 i.paymentRules.push({ text: IBE.Data.HotelInfo[n.hotelId].info.paymentPolicy }); 3208 } 3209 i.isFreeCancellation = ko.computed({ 3210 read: function () { 3211 var n = !0; 3212 return ( 3213 ko.utils.arrayForEach(i.cancellationRules, function (t) { 3214 (t.penalty > 0 || t.minimumPenalty > 0) && 3215 (t.daysBeforeCheckIn >= 0 || t.daysBeforeCheckIn === -1) && 3216 (n = !1); 3217 }), 3218 n 3219 ); 3220 }, 3221 deferEvaluation: !0, 3222 }); 3223 i.name = ko.computed({ 3224 write: function (n) { 3225 i.defaultName(n); 3226 }, 3227 read: function () { 3228 return i.id === 0 ? IBE.Utils.translate("standardRate") : i.defaultName; 3229 }, 3230 deferEvaluation: !0, 3231 }); 3232 i.photos = n.photos; 3233}; 3234IBE.Models.RoomInfo = function (n) { 3235 var t = this; 3236 t.id = n.id; 3237 t.name = n.name; 3238 t.description = n.description; 3239 t.alwaysOnRequest = n.alwaysOnRequest; 3240 t.availability = n.availability; 3241 t.minGuests = n.minGuests; 3242 t.maxGuests = n.maxGuests; 3243 t.bedrooms = n.bedrooms; 3244 t.photos = IBE.Utils.populatePhotos(n.photos); 3245 t.facilities = ko.utils.arrayMap(n.facilities, function (n) { 3246 return new IBE.Models.Facility(n); 3247 }); 3248 t.attributes = ko.utils.arrayMap(n.attributes, function (n) { 3249 return new IBE.Models.Attribute(n); 3250 }); 3251}; 3252IBE.Models.Request = function () { 3253 var n = this; 3254 n.hotelResults = ko.observableArray([]); 3255 n.checkIn = ko.observable(); 3256 n.checkOut = ko.observable(); 3257 n.couponCode = ko.observable(""); 3258 n.travelAgencyID = ko.observable(""); 3259 n.travelAgencyName = ko.observable(""); 3260 n.preferredBoard = ko.observable(); 3261 n.ratePlanId = ko.observable(0); 3262 n.nights = ko.pureComputed({ 3263 read: function () { 3264 return moment(n.checkOut()).diff(moment(n.checkIn()), "days"); 3265 }, 3266 deferEvaluation: !0, 3267 }); 3268 n.preferredBoard.subscribe(function (t) { 3269 IBE.Utils.calculateRoomBoard(n); 3270 IBE.Utils.claculateRateplanId(n, t); 3271 }, n); 3272}; 3273IBE.Models.AvailabilityRestriction = function (n) { 3274 var t = this; 3275 t.id = n.id; 3276 t.rules = []; 3277 t.text = [];
3278 n.rules = sameRule(n.rules); 3279 ko.utils.arrayForEach(n.rules, function (n) { 3280 switch (n.ruleType) { 3281 case "ReservationDaysMoreThanX": 3282 t.text.push(IBE.Utils.translate("restriction.ReservationDaysMoreThanX").format(n.value)); 3283 reservationDaysMoreThanX = "The maximum stay is {0} nights."; 3284 break; 3285 case "DayMinStayThrough": 3286 t.text.push(IBE.Utils.translate("restriction.RoomNightsLessThanX").format(n.value)); 3287 roomNightsLessThanX = "A minimum stay of {0} nights is required."; 3288 break; 3289 case "ReservationDaysLessThanX": 3290 t.text.push(IBE.Utils.translate("restriction.ReservationDaysLessThanX").format(n.value + 1)); 3291 reservationDaysLessThanX = "A minimum stay of {0} nights is required."; 3292 break; 3293 case "RoomNightsMoreThanX": 3294 t.text.push(IBE.Utils.translate("restriction.RoomNightsMoreThanX").format(n.value)); 3295 roomNightsMoreThanX = "The maximum stay is {0} nights."; 3296 break; 3297 case "RoomNightsLessThanX": 3298 t.text.push(IBE.Utils.translate("restriction.RoomNightsLessThanX").format(n.value + 1)); 3299 roomNightsLessThanX = "A minimum stay of {0} nights is required."; 3300 break; 3301 case "RoomsMoreThanX": 3302 t.text.push(IBE.Utils.translate("restriction.RoomsMoreThanX").format(n.value)); 3303 roomsMoreThanX = "The maximum number of rooms allowed is {0} ."; 3304 break; 3305 case "RoomsLessThanX": 3306 t.text.push(IBE.Utils.translate("restriction.RoomsLessThanX").format(n.value + 1)); 3307 roomsLessThanX = "The minimum number of rooms is {0} ."; 3308 break; 3309 case "RequestedLessThanXDaysBeforeCheckIn": 3310 t.text.push(IBE.Utils.translate("restriction.RequestedLessThanX").format(n.value + 1)); 3311 requestedLessThanX = "You can only make a reservation at least {0} days prior check-in date."; 3312 break; 3313 case "DayClosedDeparture": 3314 t.text.push(IBE.Utils.translate("restriction.DayClosedDeparture")); 3315 break; 3316 case "DayClosedArrival": 3317 t.text.push(IBE.Utils.translate("restriction.DayClosedArrival")); 3318 break; 3319 case "DayClosed": 3320 t.text.push(IBE.Utils.translate("restriction.DayClosed")); 3321 } 3322 }); 3323}; 3324IBE.Models.RoomResult = function (n) { 3325 var t = this, 3326 r = []; 3327 t.rateplans = ko.computed({ 3328 write: function (n) { 3329 r(n); 3330 }, 3331 read: function () { 3332 return r.sort(function (n, t) { 3333 return n.price() > t.price(); 3334 }); 3335 }, 3336 deferEvaluation: !0, 3337 }); 3338 t.roomId = ko.observable(0); 3339 t.hotelId = ko.observable(0); 3340 t.roomIndex = ko.observable(1); 3341 t.availability = 0; 3342 t.availabilityStatus = ""; 3343 t.availabilityRestrictions = []; 3344 t.uniqueRestrictionMessages = []; 3345 t.viewAvailability = ko.observable(!1); 3346 t.isFiltered = ko.observable(!1); 3347 t.availableRooms = 0; 3348 t.supportedBoards = 0; 3349 t.alternativeBoard = ko.computed({ 3350 read: function () { 3351 return t.boardType() === "" ? !1 : t.boardType() !== n.request().preferredBoard(); 3352 }, 3353 deferEvaluation: !0, 3354 }); 3355 t.availabilitySorting = ko.computed({ 3356 read: function () { 3357 switch (t.availability) { 3358 case -3: 3359 return 0.3; 3360 default: 3361 return t.availability; 3362 } 3363 }, 3364 deferEvaluation: !0, 3365 }); 3366 t.rateplanOffersPrices = ko.computed({ 3367 read: function () { 3368 return ( 3369 (t.rateplanOffersPricesList = ko.observableArray([])), 3370 ko.utils.arrayForEach(t.rateplans(), function (n) { 3371 t.rateplanOffersPricesList.push({ id: n.ratePlanId(), price: n.price() }); 3372 }), 3373 t.rateplanOffersPricesList 3374 ); 3375 }, 3376 deferEvaluation: !0, 3377 }); 3378 t.hideRateplanBrokenRestrictionMessageThemeF = ko.computed({ 3379 read: function () { 3380 var r = !1, 3381 n, 3382 i; 3383 if ( 3384 (ko.utils.arrayForEach(t.rateplans(), function (n) { 3385 ko.utils.arrayForEach(n.roomBoards(), function (t) { 3386 t.showPrices() && n.isVisible() && (r = !0); 3387 }); 3388 }), 3389 r || 3390 ((n = ko.utils.arrayFirst(t.rateplans(), function (n) { 3391 var t = null; 3392 return ( 3393 ko.utils.arrayForEach(n.roomBoards(), function (i) { 3394 i.showPrices() && 3395 n.ratePlanId() !== 0 && 3396 n.showRatePlanBrokenRestrictionMessage() && 3397 n.hideRatePlanReasonResource() === "hideRateplanForMinStayThrough" && 3398 (t = n.ratePlanId()); 3399 }), 3400 n.ratePlanId() === t 3401 ); 3402 })), 3403 (typeof n == "undefined" || n === null) && 3404 (n = ko.utils.arrayFirst(t.rateplans(), function (n) { 3405 var t = null; 3406 return ( 3407 ko.utils.arrayForEach(n.roomBoards(), function (i) { 3408 i.showPrices() && 3409 n.ratePlanId() !== 0 && 3410 n.showRatePlanBrokenRestrictionMessage() && 3411 (t = n.ratePlanId()); 3412 }), 3413 n.ratePlanId() === t 3414 ); 3415 }))), 3416 typeof n == "undefined" || n === null) 3417 ) { 3418 if (r) return ""; 3419 if (IBE.Config.hideStandardRatePlanForBookingEngine) 3420 return IBE.Utils.translate("notAvailableRoomMe
3420ssage"); 3421 if ( 3422 ((n = ko.utils.arrayFirst(t.rateplans(), function (n) { 3423 var t = null; 3424 return ( 3425 ko.utils.arrayForEach(n.roomBoards(), function (i) { 3426 i.showPrices() && 3427 n.ratePlanId() === 0 && 3428 n.showRatePlanBrokenRestrictionMessage() && 3429 (t = n.ratePlanId()); 3430 }), 3431 n.ratePlanId() === t 3432 ); 3433 })), 3434 typeof n == "undefined" || n === null) 3435 ) 3436 return ""; 3437 switch (n.hideRatePlanReasonResource()) { 3438 case "hideRateplanForClosedArrival": 3439 return IBE.Utils.translate(n.hideRatePlanReasonResource()).format( 3440 moment(n.hideRatePlanReasonValue()).format("DD/MM/YYYY") 3441 ); 3442 case "hideRateplanForClosedDeparture": 3443 return IBE.Utils.translate(n.hideRatePlanReasonResource()).format( 3444 moment(n.hideRatePlanReasonValue()).format("DD/MM/YYYY") 3445 ); 3446 case "hideRateplanForClosed": 3447 return IBE.Utils.translate(n.hideRatePlanReasonResource()).format( 3448 moment(n.hideRatePlanReasonValue()).format("DD/MM/YYYY") 3449 ); 3450 default: 3451 return IBE.Utils.translate(n.hideRatePlanReasonResource()).format(n.hideRatePlanReasonValue()); 3452 } 3453 } else 3454 switch (n.hideRatePlanReasonResource()) { 3455 case "hideRateplanForClosedArrival": 3456 return IBE.Utils.translate(n.hideRatePlanReasonResource()).format( 3457 moment(n.hideRatePlanReasonValue()).format("DD/MM/YYYY") 3458 ); 3459 case "hideRateplanForClosedDeparture": 3460 return IBE.Utils.translate(n.hideRatePlanReasonResource()).format( 3461 moment(n.hideRatePlanReasonValue()).format("DD/MM/YYYY") 3462 ); 3463 case "hideRateplanForClosed": 3464 return IBE.Utils.translate(n.hideRatePlanReasonResource()).format( 3465 moment(n.hideRatePlanReasonValue()).format("DD/MM/YYYY") 3466 ); 3467 default: 3468 return ( 3469 (i = null), 3470 ko.utils.arrayForEach(t.rateplans(), function (t) { 3471 ko.utils.arrayForEach(t.roomBoards(), function (r) { 3472 if ( 3473 r.showPrices() && 3474 t.ratePlanId() !== 0 && 3475 t.ratePlanId() !== n.ratePlanId() && 3476 t.showRatePlanBrokenRestrictionMessage() && 3477 t.hideRatePlanReasonResource() === n.hideRatePlanReasonResource() 3478 ) 3479 switch (t.hideRatePlanReasonResource()) { 3480 case "hideRateplanForMinStayThrough": 3481 t.hideRatePlanReasonValue() < n.hideRatePlanReasonValue() && 3482 (i === null 3483 ? (i = t) 3484 : t.hideRatePlanReasonValue() < i.hideRatePlanReasonValue() && 3485 (i = t)); 3486 break; 3487 case "hideRateplanForMinStayArrival": 3488 t.hideRatePlanReasonValue() < n.hideRatePlanReasonValue() && 3489 (i === null 3490 ? (i = t) 3491 : t.hideRatePlanReasonValue() < i.hideRatePlanReasonValue() && 3492 (i = t)); 3493 break; 3494 case "hideRateplanForMaxStayThrough": 3495 t.hideRatePlanReasonValue() > n.hideRatePlanReasonValue() && 3496 (i === null 3497 ? (i = t) 3498 : t.hideRatePlanReasonValue() > i.hideRatePlanReasonValue() && 3499 (i = t)); 3500 break; 3501 case "hideRateplanForMaxStayArrival": 3502 t.hideRatePlanReasonValue() > n.hideRatePlanReasonValue() && 3503 (i === null 3504 ? (i = t) 3505 : t.hideRatePlanReasonValue() > i.hideRatePlanReasonValue() && 3506 (i = t)); 3507 } 3508 }); 3509 }), 3510 i !== null 3511 ? IBE.Utils.translate(i.hideRatePlanReasonResource()).format( 3512 i.hideRatePlanReasonValue() 3513 ) 3514 : IBE.Utils.translate(n.hideRatePlanReasonResource()).format( 3515 n.hideRatePlanReasonValue() 3516 ) 3517 ); 3518 } 3519 }, 3520 deferEvaluation: !0, 3521 }); 3522 t.hideRateplanBrokenRestrictionMessage = ko.computed({ 3523 read: function () { 3524 var i = !1, 3525 n; 3526 if ( 3527 (ko.utils.arrayForEach(t.rateplans(), function (n) { 3528 ko.utils.arrayForEach(n.roomBoards(), function (t) { 3529 t.isSelected() && t.showPrices() && n.isVisible() && (i = !0); 3530 }); 3531 }), 3532 i || 3533 (n = ko.utils.arrayFirst(t.rateplans(), function (n) { 3534 var t = null; 3535 return ( 3536 ko.utils.arrayForEach(n.roomBoards(), function (i) { 3537 i.isSelected() && 3538 i.showPrices() && 3539 n.ratePlanId() !== 0 && 3540 n.showRatePlanBrokenRestrictionMessage() && 3541 (t = n.ratePlanId()); 3542 }), 3543 n.ratePlanId() === t 3544 ); 3545 })), 3546 typeof n == "undefined" || n === null) 3547 ) { 3548 if (i) return ""; 3549 if (IBE.Config.hideStandardRatePlanForBookingEngine) 3550 return IBE.Utils.translate("notAvailableRoomMe
3550ssage"); 3551 if ( 3552 ((n = ko.utils.arrayFirst(t.rateplans(), function (n) { 3553 var t = null; 3554 return ( 3555 ko.utils.arrayForEach(n.roomBoards(), function (i) { 3556 i.isSelected() && 3557 i.showPrices() && 3558 n.ratePlanId() === 0 && 3559 n.showRatePlanBrokenRestrictionMessage() && 3560 (t = n.ratePlanId()); 3561 }), 3562 n.ratePlanId() === t 3563 ); 3564 })), 3565 typeof n == "undefined" || n === null) 3566 ) 3567 return ""; 3568 switch (n.hideRatePlanReasonResource()) { 3569 case "hideRateplanForClosedArrival": 3570 return IBE.Utils.translate(n.hideRatePlanReasonResource()).format( 3571 moment(n.hideRatePlanReasonValue()).format("DD/MM/YYYY") 3572 ); 3573 case "hideRateplanForClosedDeparture": 3574 return IBE.Utils.translate(n.hideRatePlanReasonResource()).format( 3575 moment(n.hideRatePlanReasonValue()).format("DD/MM/YYYY") 3576 ); 3577 case "hideRateplanForClosed": 3578 return IBE.Utils.translate(n.hideRatePlanReasonResource()).format( 3579 moment(n.hideRatePlanReasonValue()).format("DD/MM/YYYY") 3580 ); 3581 default: 3582 return IBE.Utils.translate(n.hideRatePlanReasonResource()).format(n.hideRatePlanReasonValue()); 3583 } 3584 } else 3585 switch (n.hideRatePlanReasonResource()) { 3586 case "hideRateplanForClosedArrival": 3587 return IBE.Utils.translate(n.hideRatePlanReasonResource()).format( 3588 moment(n.hideRatePlanReasonValue()).format("DD/MM/YYYY") 3589 ); 3590 case "hideRateplanForClosedDeparture": 3591 return IBE.Utils.translate(n.hideRatePlanReasonResource()).format( 3592 moment(n.hideRatePlanReasonValue()).format("DD/MM/YYYY") 3593 ); 3594 case "hideRateplanForClosed": 3595 return IBE.Utils.translate(n.hideRatePlanReasonResource()).format( 3596 moment(n.hideRatePlanReasonValue()).format("DD/MM/YYYY") 3597 ); 3598 default: 3599 return IBE.Utils.translate(n.hideRatePlanReasonResource()).format(n.hideRatePlanReasonValue()); 3600 } 3601 }, 3602 deferEvaluation: !0, 3603 }); 3604 t.minPrice = ko.computed({ 3605 read: function () { 3606 var n = 1e13; 3607 return (ko.utils.arrayForEach(t.rateplans(), function (t) { 3608 t.price() <= n && t.price() > 0 && (n = t.price()); 3609 }), 3610 n === 1e13) 3611 ? null 3612 : n; 3613 }, 3614 deferEvaluation: !0, 3615 }); 3616 t.info = ko.computed({ 3617 read: function () { 3618 var i = ko.utils.arrayFilter(n.rooms(), function (n) { 3619 return t.roomId() === n.id; 3620 }); 3621 if (i.length === 1) return i[0]; 3622 }, 3623 deferEvaluation: !0, 3624 }); 3625 t.defaultPriceAction = IBE.Config.displayResults[IBE.Utils.getReservationSetting(n, "displayWithoutPrices")]; 3626 t.isVisible = ko.computed( 3627 { 3628 read: function () { 3629 var i = !0, 3630 r = 0, 3631 u = 0; 3632 if ( 3633 t.rateplans().length === 0 && 3634 IBE.Config.displayResults[IBE.Utils.getReservationSetting(n, "displayWithoutPrices")] !== 0 3635 ) 3636 return !0; 3637 if ( 3638 (ko.utils.arrayForEach(t.rateplans(), function (t) { 3639 ko.utils.arrayForEach(t.roomBoards(), function (t) { 3640 u += t.bookingAction(); 3641 t.insteadOfBoard() === n.request().preferredBoard() && t.price() > 0 && (r += t.price()); 3642 }); 3643 }), 3644 u === 0) 3645 ) 3646 return !1; 3647 if (r <= 0) 3648 switch (t.defaultPriceAction) { 3649 case 0: 3650 i = !1; 3651 break; 3652 case 1: 3653 i = !0; 3654 } 3655 return i; 3656 }, 3657 deferEvaluation: !0, 3658 }, 3659 this 3660 ); 3661 t.ratePlanId = ko.observable(0); 3662 t.setRatePlanId = function (n) { 3663 t.ratePlanId(n.ratePlanId()); 3664 }; 3665 t.selectedBoardType = ko.observable(!1); 3666 t.setRoomRatePlanBoardType = function (n) { 3667 t.ratePlanId(n.ratePlanId); 3668 t.selectedBoardType(n.boardType()); 3669 }; 3670 t.minAverageDailyRate = ko.computed( 3671 { 3672 read: function () { 3673 var n = ko.utils.arrayFilter(t.rateplans(), function (n) { 3674 return t.bestRatePlanId() === n.ratePlanId(); 3675 }); 3676 return n.length === 1 ? n[0].averageDailyRate() : 0; 3677 }, 3678 deferEvaluation: !0, 3679 }, 3680 this 3681 ); 3682 t.averageDailyRate = ko.computed( 3683 { 3684 read: function () { 3685 var n = ko.utils.arrayFilter(t.rateplans(), function (n) { 3686 return t.ratePlanId() === n.ratePlanId(); 3687 }); 3688 return n.length === 1 ? n[0].averageDailyRate() : 0; 3689 }, 3690 deferEvaluation: !0, 3691 }, 3692 this 3693 ); 3694 t.showPrices = ko.computed({ 3695 read: function () { 3696 return !(t.availabilityStatus.toLowerCase() === "noprices"); 3697 }, 3698 deferEvaluation: !0, 3699 }); 3700 t.price = ko.computed( 3701 { 3702 read: function () { 3703 var n = ko.utils.arrayFilter(t.rateplans(), function (n) { 3704 return t.ratePlanId() === n.ratePlanId(); 3705 }), 3706 i; 3707 return n.length === 1 3708 ? t.selectedBoardType() 3709 ? ((i = ko.utils.arrayFirst(n[0].roomBoards(), function (n) { 3710 return t.selectedBoardType() === n.boardType(); 3711 })), 3712 i !== null ? i.price() : 0) 3713 : n[0].price() 3714 : 0; 3715 }, 3716 deferEvaluation: !0, 3717 }, 3718 this 3719 ); 3720 t.bookingAction = ko.computed( 3721 { 3722 read: function () { 3723 var n = 0; 3724 return ( 3725 $.each(t.rateplans(), function (t, i) { 3726 if (i.bookingAction() !== 0) { 3727 n = i.bookingAction(); 3728 return; 3729 } 3730 }), 3731 n 3732 ); 3733 }, 3734 deferEvaluation: !0, 3735 }, 3736 this 3737 ); 3738 t.hidePrices = ko.computed({ 3739 read: function () { 3740 return ( 3741 IBE.Utils.getReservationSetting(n, "displayNotAvailable") === "HideRoomRates" && t.bookingAction() !== 3 3742 ); 3743 }, 3744 deferEvaluation: !0, 3745 }); 3746 t.boardType = ko.computed( 3747 { 3748 read: function () { 3749 var n = ko.utils.arrayFilter(t.rateplans(), function (n) { 3750 return t.ratePlanId() === n.ratePlanId(); 3751 }); 3752 return n.length === 1 ? n[0].boardType() : ""; 3753 }, 3754 deferEvaluation: !0, 3755 }, 3756 this 3757 ); 3758 t.boardName = ko.computed({ 3759 read: function () { 3760 var i = ko.utils.arrayFirst(n.hotelInfo().boardTypes, function (n) { 3761 return t.boardType() === n.boardType; 3762 }); 3763 return i != null ? i.name : t.boardType(); 3764 }, 3765 deferEvaluation: !0, 3766 }); 3767 t.bestRatePlanId = ko.computed( 3768 { 3769 read: function () { 3770 function u(n, t) { 3771 var i = n.map(function (n) { 3772 return ko.unwrap(n[t]); 3773 }); 3774 return Math.min.apply(Math, i); 3775 } 3776 var f = t.rateplans(), 3777 n = [], 3778 r, 3779 i; 3780 return (ko.utils.arrayForEach(f, function (i) { 3781 if (i.isVisible()) 3782 var r = ko.utils.arrayFirst(i.roomBoards(), function (n) { 3783 return n.boardType() === t.boardType() && n.averageDailyRate() > 0; 3784 }); 3785 r != null && n.push(r); 3786 }), 3787 (r = u(n, "price")), 3788 (i = ko.utils.arrayFilter(n, function (n) { 3789 return n.price() === r; 3790 })), 3791 i.length > 0) 3792 ? i[0].ratePlanId 3793 : 0; 3794 }, 3795 deferEvaluation: !0, 3796 }, 3797 this 3798 ); 3799 t.upsales = ko.computed({ 3800 read: function () { 3801 var r = !1; 3802 return ( 3803 ko.utils.arrayForEach(n.roomsPrices(), function (u, f) { 3804 var e, o, s; 3805 if (u.roomId === t.roomId()) { 3806 if (f === n.roomsPrices().length - 1) return; 3807 if ( 3808 ((e = n.roomsPrices()[f].averageDailyRate - t.averageDailyRate()), 3809 (r = n.roomsPrices()[f]), 3810 (r.diffAmount = n.roomsPrices()[f].averageDailyRate - t.averageDailyRate()), 3811 e <= 0) 3812 ) 3813 for (o = f + 1, s = n.roomsPrices().length, i = o; i < s; i++) 3814 if (n.roomsPrices()[i].averageDailyRate - t.averageDailyRate() > 0) { 3815 r = n.roomsPrices()[i]; 3816 r.diffAmount = n.roomsPrices()[i].averageDailyRate - t.averageDailyRate(); 3817 return; 3818 } 3819 } 3820 }), 3821 r 3822 ); 3823 }, 3824 deferEvaluation: !0, 3825 }); 3826 t.downsale = ko.computed({ 3827 read: function () { 3828 var r = !1, 3829 u = !1, 3830 i = []; 3831 return ( 3832 ko.utils.arrayForEach(n.request().hotelResults()[0].requestedRooms()[0].roomResults(), function (n) { 3833 u || 3834 (n.roomId() !== t.roomId() && 3835 n.minPrice() < t.minPrice() && 3836 n.availability == IBE.Config.roomAvailability.Available 3837 ? i.push(n) 3838 : (u = !0)); 3839 }), 3840 i.length > 0 && (r = i[i.length - 1]), 3841 r 3842 ); 3843 }, 3844 deferEvaluation: !0, 3845 }); 3846 t.discountPercent = ko.computed( 3847 { 3848 read: function () { 3849 var n = ko.utils.arrayFilter(t.rateplans(), function (n) { 3850 return t.ratePlanId() === n.ratePlanId(); 3851 }); 3852 return n.length === 1 ? n[0].discountPercent() : 0; 3853 }, 3854 deferEvaluation: !0, 3855 }, 3856 this 3857 ); 3858}; 3859IBE.Models.RatePlan = function (n) { 3860 var t = this; 3861 t.roomBoards = ko.observableArray([]); 3862 t.ratePlanId = ko.observable(0); 3863 t.showRatePlan = ko.observable(!0); 3864 t.availability = ko.observable(0); 3865 t.hideRatePlanReasonResource = ko.observable(""); 3866 t.hideRatePlanReasonValue = ko.observable(""); 3867 t.showRatePlanBrokenRestrictionMessage = ko.observable(!1); 3868 t.info = ko.computed({ 3869 read: function () { 3870 var i = ko.utils.arrayFilter(n.rateplans(), function (n) { 3871 return t.ratePlanId() === n.id; 3872 }); 3873 return i.length === 1 ? i[0] : {}; 3874 }, 3875 deferEvaluation: !0, 3876 }); 3877 t.defaultPriceAction = IBE.Config.displayResults[IBE.Utils.getReservationSetting(n, "displayWithoutPrices")]; 3878 t.isVisible = ko.computed({ 3879 read: function () { 3880 var r = ko.utils.arrayFirst(t.roomBoards(), function (n) { 3881 return n.price() > 0; 3882 }), 3883 i, 3884 u, 3885 f; 3886 if (r == null) 3887 switch (t.defaultPriceAction) { 3888 case 0: 3889 return !1; 3890 case 1: 3891 return !0; 3892 } 3893 return ((i = ko.utils.arrayFirst( 3894 n.request().hotelResults()[0].requestedRooms()[0].roomResults(), 3895 function (n) { 3896 return n.roomId() == r.roomId; 3897 } 3898 )), 3899 (u = !1), 3900 i != null && 3901 ko.utils.arrayForEach(i.rateplans(), function (n) { 3902 if (ko.unwrap(n.ratePlanId()) === t.ratePlanId() && !ko.unwrap(n.showRatePlan())) { 3903 u = !0; 3904 return; 3905 } 3906 }), 3907 u) 3908 ? !1 3909 : r.ratePlanId == 0 && 3910 (IBE.Config.hideStandardRatePlanForBookingEngine || 3911 ((f = !1), 3912 i != null && 3913 ko.utils.arrayForEach(i.rateplans(), function (n) { 3914 ko.utils.arrayForEach(n.roomBoards(), function (t) { 3915 if ( 3916 t.isSelected() && 3917 t.showPrices() && 3918 n.info().hideStandardRate && 3919 ko.unwrap(n.showRatePlan()) 3920 ) { 3921 f = !0; 3922 return; 3923 } 3924 }); 3925 }), 3926 f)) 3927 ? !1 3928 : !0; 3929 }, 3930 deferEvaluation: !0, 3931 }); 3932 t.isVisibleThemeF = ko.computed({ 3933 read: function () { 3934 var r = ko.utils.arrayFirst(t.roomBoards(), function (n) { 3935 return n.price() > 0; 3936 }), 3937 i, 3938 u, 3939 f; 3940 if (r == null) 3941 switch (t.defaultPriceAction) { 3942 case 0: 3943 return !1; 3944 case 1: 3945 return !0; 3946 } 3947 return ((i = ko.utils.arrayFirst( 3948 n.request().hotelResults()[0].requestedRooms()[0].roomResults(), 3949 function (n) { 3950 return n.roomId() == r.roomId; 3951 } 3952 )), 3953 (u = !1), 3954 i != null && 3955 ko.utils.arrayForEach(i.rateplans(), function (n) { 3956 if (ko.unwrap(n.ratePlanId()) === t.ratePlanId() && !ko.unwrap(n.showRatePlan())) { 3957 u = !0; 3958 return; 3959 } 3960 }), 3961 u) 3962 ? !1 3963 : r.ratePlanId == 0 && 3964 (IBE.Config.hideStandardRatePlanForBookingEngine || 3965 ((f = !1), 3966 i != null && 3967 ko.utils.arrayForEach(i.rateplans(), function (n) { 3968 ko.utils.arrayForEach(n.roomBoards(), function (t) { 3969 if (t.showPrices() && n.info().hideStandardRate && ko.unwrap(n.showRatePlan())) { 3970 f = !0; 3971 return; 3972 } 3973 }); 3974 }), 3975
3975 f)) 3976 ? !1 3977 : !0; 3978 }, 3979 deferEvaluation: !0, 3980 }); 3981 t.showPrices = ko.computed({ 3982 read: function () { 3983 var t = IBE.Utils.getReservationSetting(n, "hideRatePlanPrice"); 3984 return (t = t === "True" ? !0 : !1), !t; 3985 }, 3986 }); 3987 t.averageDailyRate = ko.computed( 3988 { 3989 read: function () { 3990 var i = 0; 3991 return ( 3992 ko.utils.arrayForEach(t.roomBoards(), function (t) { 3993 if (t.insteadOfBoard() === n.request().preferredBoard()) { 3994 i = t.price() / n.request().nights(); 3995 return; 3996 } 3997 }), 3998 i 3999 ); 4000 }, 4001 deferEvaluation: !0, 4002 }, 4003 this 4004 ); 4005 t.price = ko.computed( 4006 { 4007 read: function () { 4008 var i = ko.utils.arrayFirst(t.roomBoards(), function (t) { 4009 return t.insteadOfBoard() === n.request().preferredBoard() && t.price() > 0; 4010 }); 4011 return i != null ? i.price() : 0; 4012 }, 4013 deferEvaluation: !0, 4014 }, 4015 this 4016 ); 4017 t.priceWithoutDiscount = ko.computed( 4018 { 4019 read: function () { 4020 var i = ko.utils.arrayFirst(t.roomBoards(), function (t) { 4021 return t.insteadOfBoard() === n.request().preferredBoard() && t.priceWithoutDiscount() > 0; 4022 }); 4023 return i != null ? i.priceWithoutDiscount() : 0; 4024 }, 4025 deferEvaluation: !0, 4026 }, 4027 this 4028 ); 4029 t.bookingAction = ko.computed( 4030 { 4031 read: function () { 4032 var i = 0; 4033 return ( 4034 $.each(t.roomBoards(), function (t, r) { 4035 if (r.insteadOfBoard() === n.request().preferredBoard()) { 4036 i = r.bookingAction(); 4037 return; 4038 } 4039 }), 4040 i 4041 ); 4042 }, 4043 deferEvaluation: !0, 4044 }, 4045 this 4046 ); 4047 t.boardType = ko.computed( 4048 { 4049 read: function () { 4050 var i = ""; 4051 return ( 4052 $.each(t.roomBoards(), function (t, r) { 4053 if (r.insteadOfBoard() === n.request().preferredBoard() && r.price() > 0) { 4054 i = r.boardType(); 4055 return; 4056 } 4057 }), 4058 i 4059 ); 4060 }, 4061 deferEvaluation: !0, 4062 }, 4063 this 4064 ); 4065 t.rateBreakDown = ko.computed({ 4066 read: function () { 4067 var i = ko.utils.arrayFirst( 4068 t.roomBoards(), 4069 function (t) { 4070 return t.insteadOfBoard() === n.request().preferredBoard(); 4071 }, 4072 this 4073 ); 4074 return i ? i.rateBreakDown() : {}; 4075 }, 4076 deferEvaluation: !0, 4077 }); 4078 t.advancePayment = ko.computed({ 4079 read: function () { 4080 var r = ko.utils.arrayFirst(n.rateplans(), function (n) { 4081 return t.ratePlanId() === n.id; 4082 }); 4083 if (!r) return !0; 4084 var f = moment(), 4085 e = moment(n.bookingProcess().checkIn()), 4086 u = f.diff(e, "days", !0), 4087 i = 0; 4088 return (ko.utils.arrayForEach(ko.utils.unwrapObservable(r.paymentRules), function (n) { 4089 n.daysUntilCheckInMax >= u && 4090 n.daysUntilCheckInMin < u && 4091 ((i = n.charge), n.minimumCharge > i && (i = n.minimumCharge)); 4092 }), 4093 i === 0) 4094 ? !1 4095 : !0; 4096 }, 4097 deferEvaluation: !0, 4098 }); 4099 t.discountPercent = ko.computed( 4100 { 4101 read: function () { 4102 var i = ko.utils.arrayFirst(t.roomBoards(), function (t) { 4103 return t.insteadOfBoard() === n.request().preferredBoard() && t.discountPercent() > 0; 4104 }); 4105 return i != null ? i.discountPercent() : 0; 4106 }, 4107 deferEvaluation: !0, 4108 }, 4109 this 4110 ); 4111}; 4112IBE.Models.RoomBoard = function (n) { 4113 var t = this; 4114 t.rateBreakDown = ko.observable(new IBE.Models.RateBreakDown()); 4115 t.roomIndex = n.activeRoomIndex(); 4116 t.roomId = 0; 4117 t.ratePlanId = ko.observable(0); 4118 t.availability = 0; 4119 t.boardType = ko.observable(""); 4120 t.insteadOfBoard = ko.observable(""); 4121 t.price = ko.observable(0); 4122 t.priceWithoutDiscount = ko.observable(0); 4123 t.isSelected = ko.observable(!1); 4124 t.discountPercent = ko.computed({ 4125 read: function () { 4126 return (100 * (t.priceWithoutDiscount() - t.price())) / t.priceWithoutDiscount(); 4127 }, 4128 deferEvaluation: !0, 4129 }); 4130 t.discount = ko.computed({ 4131 read: function () { 4132 return t.priceWithoutDiscount() - t.price(); 4133 }, 4134 deferEvaluation: !0, 4135 }); 4136 t.showPrices = ko.computed({ 4137 write: function (n) { 4138 t.priceWithoutDiscount(n); 4139 }, 4140 read: function () { 4141 return t.price() < 0 ? !1 : !0; 4142 }, 4143 deferEvaluation: !0, 4144 }); 4145 t.notAvailableAction = ko.observable(
4146 IBE.Config.displayResults[IBE.Utils.getReservationSetting(n, "displayNotAvailable")] 4147 ); 4148 t.bookingAction = ko.computed( 4149 { 4150 read: function () { 4151 var i = this, 4152 r, 4153 u; 4154 return i.roomIndex !== n.activeRoomIndex() 4155 ? IBE.Config.displayResults.Hide 4156 : i.price() <= 0 4157 ? IBE.Utils.getReservationSetting(n, "displayWithoutPrices") == "Show" 4158 ? t.notAvailableAction() 4159 : IBE.Config.displayResults.Hide 4160 : i.availability === "AvailabilityRestriction" 4161 ? t.notAvailableAction() 4162 : ((r = []), 4163 ko.utils.arrayForEach(n.request().hotelResults(), function (n) { 4164 r = n.alternatives; 4165 return; 4166 }), 4167 (u = !1), 4168 ko.utils.arrayForEach(r, function (r) { 4169 var e = 0, 4170 f; 4171 if (n.selectedRooms().length > 0) 4172 for (f = 0; f < t.roomIndex - 1; f++) 4173 typeof n.selectedRooms()[f] != "undefined" && 4174 r[f] === ko.utils.unwrapObservable(n.selectedRooms()[f].roomId) && 4175 e++; 4176 if ((r[t.roomIndex - 1] === i.roomId && e++, e === t.roomIndex)) { 4177 u = !0; 4178 return; 4179 } 4180 }), 4181 u ? IBE.Config.displayResults.Online : t.notAvailableAction()); 4182 }, 4183 deferEvaluation: !0, 4184 }, 4185 this 4186 ); 4187 t.info = ko.computed({ 4188 read: function () { 4189 return ko.utils.arrayFirst(n.boards(), function (n) { 4190 return t.boardType() === n.boardType; 4191 }); 4192 }, 4193 deferEvaluation: !0, 4194 }); 4195 t._offerIds = []; 4196 t.offers = ko.computed({ 4197 read: function () { 4198 return t.ratePlanId === 0 4199 ? ko.utils.arrayFilter(n.offers(), function (n) { 4200 return t._offerIds.indexOf(n.id) !== -1; 4201 }) 4202 : []; 4203 }, 4204 write: function (n) { 4205 t.ratePlanId === 0 && (t._offerIds = ko.unwrap(n)); 4206 }, 4207 deferEvaluation: !0, 4208 }); 4209 t.averageDailyRate = ko.computed( 4210 { 4211 read: function () { 4212 return t.price() / n.request().nights(); 4213 }, 4214 deferEvaluation: !0, 4215 }, 4216 this 4217 ); 4218}; 4219IBE.Models.Daily = function (n) { 4220 var t = this; 4221 t.date = ko.observable(n.date); 4222 t.status = ko.observable(n.status || ""); 4223 t.price = ko.observable(n.price); 4224 t.priceWithoutDiscount = ko.observable(n.priceWithoutDiscount); 4225}; 4226IBE.Models.RateBreakDown = function (n) { 4227 var t = this; 4228 t.daily = ko.observableArray([]); 4229 n && 4230 t.daily( 4231 ko.utils.arrayMap(n, function (n) { 4232 return new IBE.Models.Daily(n); 4233 }) 4234 ); 4235 t.weeks = ko.computed({ 4236 read: function () { 4237 return IBE.Utils.weekdayRates(t.daily()); 4238 }, 4239 deferEvaluation: !0, 4240 }); 4241}; 4242IBE.Models.SelectedRoom = function () { 4243 var n = this; 4244 n.roomIndex = ko.observable(1); 4245 n.roomId = ko.observable(0); 4246 n.ratePlanId = ko.observable(0); 4247 n.boardType = ko.observable(""); 4248 n.board = ko.observable(); 4249 n.availability = ko.observable(""); 4250 n.guestTypes = ko.observableArray([]); 4251 n.roomInfo = ko.observable(); 4252 n.cost = ko.observable(); 4253 n.costWithoutDiscount = ko.observable(); 4254 n.ratePlan = ko.computed({ 4255 read: function () { 4256 return ko.utils.arrayFirst(IBE.Data.RatePlanInfo, function (t) { 4257 return t.id === n.ratePlanId(); 4258 }); 4259 }, 4260 deferEvaluation: !0, 4261 }); 4262 n.discountPercent = ko.computed({ 4263 read: function () { 4264 return (100 * (n.costWithoutDiscount() - n.cost())) / n.costWithoutDiscount(); 4265 }, 4266 deferEvaluation: !0, 4267 }); 4268 n.discount = ko.computed({ 4269 read: function () { 4270 return n.costWithoutDiscount() - n.cost(); 4271 }, 4272 deferEvaluation: !0, 4273 }); 4274}; 4275IBE.Models.BookingRoom = function () { 4276 var n = this; 4277 n.roomIndex = 1; 4278 n.roomId = 1; 4279 n.ratePlanId = 0; 4280 n.boardType = ""; 4281 n.guestTypes = ko.observableArray([]); 4282}; 4283IBE.Models.Transformation = function (n) { 4284 var t = this; 4285 t.width = n.width; 4286 t.height = n.height; 4287 t.url = n.url; 4288 t.key = n.key; 4289}; 4290IBE.Models.Facility = function (n) { 4291 var t = this; 4292 t.id = n.id; 4293 t.name = n.name; 4294 t.url = n.url; 4295}; 4296IBE.Models.Attribute = function (n) { 4297 var t = this; 4298 t.code = n.code; 4299 t.value = n.value; 4300}; 4301IBE.Models.Supplement = function (n) { 4302 var t = this; 4303 n = n || {}; 4304 t.supplementId = ko.observable(n.id || 0); 4305 t.category = n.category || ""; 4306 t.name = n.name || ""; 4307 t.description = n.description || ""; 4308 t.units = ko.observable(0);
4309 t.isUnique = ko.observable(n.isUnique || 0); 4310 t.isMandatory = n.isMandatory; 4311 t.isVisible = n.isVisible; 4312 t.isSurcharge = n.isSurcharge; 4313 t.excludedRooms = n.excludedRooms || []; 4314 t.ratePlanId = ko.observable(0); 4315 t.setRatePlanId = function (n) { 4316 t.ratePlanId(n); 4317 }; 4318 t.rateplans = ko.observableArray( 4319 ko.utils.arrayMap(n.ratePlans, function (n) { 4320 return new IBE.Models.SupplementRatePlan(n, t.isMandatory); 4321 }) 4322 ); 4323 t.prices = ko.computed( 4324 { 4325 read: function () { 4326 var i = ko.utils.arrayFilter(t.rateplans(), function (n) { 4327 return t.ratePlanId() == n.ratePlanId; 4328 }), 4329 n; 4330 return i.length == 1 4331 ? i[0].prices() 4332 : ((n = ko.utils.arrayFilter(t.rateplans(), function (n) { 4333 return n.ratePlanId == 0; 4334 })), 4335 n.length == 1 ? n[0].prices() : []); 4336 }, 4337 deferEvaluation: !0, 4338 }, 4339 this 4340 ); 4341 t.isFree = ko 4342 .computed({ 4343 read: function () { 4344 var n = 0, 4345 i = 0; 4346 return ( 4347 ko.utils.arrayForEach(t.prices(), function (t) { 4348 n += t.price; 4349 i += t.quantity(); 4350 }), 4351 n === 0 && i > 0 4352 ); 4353 }, 4354 deferEvaluation: !0, 4355 }) 4356 .extend({ notify: "always" }); 4357 t.photos = ko.utils.arrayMap(n.photos, function (n) { 4358 return new IBE.Models.Photo(n); 4359 }); 4360 t.visible = ko.computed({ 4361 read: function () { 4362 return t.prices().length > 0 && t.isVisible; 4363 }, 4364 deferEvaluation: !0, 4365 }); 4366 t.pricingType = ko.observable(n.pricingType); 4367 t.timePricingType = ko.observable(n.timePricingType); 4368 t.timePricingUnit = ko.observable(n.timePricingUnit); 4369 t.roomIndex = ko 4370 .computed({ 4371 read: function () { 4372 return IBE.Config.supplementPricingType[t.pricingType()] == 4373 IBE.Config.supplementPricingType.PerReservation 4374 ? 0 4375 : 1; 4376 }, 4377 deferEvaluation: !0, 4378 }) 4379 .extend({ notify: "always" }); 4380 t.totalPrice = ko 4381 .computed({ 4382 read: function () { 4383 var n = 0; 4384 return ( 4385 ko.utils.arrayForEach(t.prices(), function (t) { 4386 n += t.price * t.quantity(); 4387 }), 4388 n 4389 ); 4390 }, 4391 deferEvaluation: !0, 4392 }) 4393 .extend({ notify: "always" }); 4394 t.totalPriceWithoutDiscount = ko 4395 .computed({ 4396 read: function () { 4397 var n = 0; 4398 return ( 4399 ko.utils.arrayForEach(t.prices(), function (t) { 4400 n += t.priceWithoutDiscount * t.quantity(); 4401 }), 4402 n 4403 ); 4404 }, 4405 deferEvaluation: !0, 4406 }) 4407 .extend({ notify: "always" }); 4408 t.quantity = ko.computed({ 4409 read: function () { 4410 var n = 0; 4411 return ( 4412 ko.utils.arrayForEach(t.prices(), function (t) { 4413 n += t.quantity(); 4414 }), 4415 n 4416 ); 4417 }, 4418 deferEvaluation: !0, 4419 }); 4420 t.discountAppliedRooms = ko.utils.arrayMap(n.discountAppliedRooms, function (n) { 4421 return new IBE.Models.SupplementDiscountAppliedRooms(n); 4422 }); 4423 t.getSupplementAppliedRoomName = function (n) { 4424 if ( 4425 ((excludedRooms = t.excludedRooms), 4426 (appliedRooms = []), 4427 ko.utils.arrayForEach(n, function (n) { 4428 excludedRooms.indexOf(n.roomId()) < 0 && appliedRooms.push(n); 4429 }), 4430 appliedRooms.length === n.length || !appliedRooms.length) 4431 ) 4432 return ""; 4433 switch (appliedRooms.length) { 4434 case 1: 4435 return IBE.Utils.translate("appliesToRoom") + " " + appliedRooms[0].roomInfo().name; 4436 case 2: 4437 case 3: 4438 return ( 4439 (appliedRoomIds = []), 4440 (appliedRoomNames = ""), 4441 ko.utils.arrayForEach(appliedRooms, function (n, t) { 4442 appliedRoomIds.indexOf(n.roomId()) < 0 && 4443 (appliedRoomIds.push(n.roomId()), 4444 t 4445 ? (appliedRoomNames += ", " + n.roomInfo().name) 4446 : (appliedRoomNames = n.roomInfo().name)); 4447 }), 4448 IBE.Utils.translate("appliesToRooms") + " " + appliedRoomNames 4449 ); 4450 } 4451 }; 4452 t.canBeApplied = function (n) { 4453 var i = 0; 4454 return (ko.utils.arrayForEach(n, function (n) { 4455 t.excludedRooms.indexOf(n.roomId()) >= 0 && i++; 4456 }), 4457 n.length === i) 4458 ? !1 4459 : !0; 4460 }; 4461}; 4462IBE.Models.SupplementRatePlan = function (n, t) { 4463 var i = this; 4464 n = n || {}; 4465 i.ratePlanId = n.ratePlanId || 0; 4466 i.prices = ko.observableArray( 4467 ko.utils.arrayMap(n.prices, function (n) { 4468 return new IBE.Models.SupplementPrice(n, t); 4469 }) 4470 ); 4471}; 4472IBE.Models.SupplementPrice = function (n, t) { 4473 var i = this; 4474 n = n || {}; 4475 i.isMandatory = t; 4476 i.isVisible = n.isVisible || !0; 4477 i.quantity = ko.observable(n.quantity || 0); 4478 i.price = n.price || 0; 4479 i.priceWithoutDiscount = n.priceWithoutDiscount || 0; 4480 i.guestType = n.guestType != null ? new IBE.Models.GuestType(n.guestType) : {}; 4481 i.minQuantity = ko.observable(0); 4482 ko.unwrap(i.isMandatory) && 4483 (n.guestType != null 4484 ? (i.minQuantity(n.quantity || n.guestType.pax), i.quantity(i.minQuantity())) 4485 : (i.minQuantity(n.quantity || 1), i.quantity(i.minQuantity()))); 4486 i.maxQuantity = 10; 4487 i.isSelected = ko 4488 .computed({ 4489 read: function () { 4490 return i.quantity() > 0; 4491 }, 4492 write: function (n) { 4493 n || i.isMandatory ? i.quantity(1) : i.quantity(0); 4494 }, 4495 }) 4496 .extend({ notify: "always" }); 4497 i.addSupplement = function () { 4498 i.quantity() >= i.maxQuantity || i.quantity(parseInt(i.quantity()) + 1); 4499 }; 4500 i.removeSupplement = function () { 4501 i.quantity() > i.minQuantity() && i.quantity(parseInt(i.quantity()) - 1); 4502 }; 4503}; 4504IBE.Models.SupplementDiscountAppliedRooms = function (n) { 4505 var t = this; 4506 n = n || {}; 4507 t.ratePlanId = n.rateplanId || 0; 4508 t.roomIds = n.roomIds; 4509}; 4510IBE.Models.BookingSupplement = function () { 4511 var n = this; 4512 n.supplementId = 0; 4513 n.guestType = {}; 4514 n.quantity = 0; 4515 n.roomIndex = 0; 4516 n.categoryName = ""; 4517 n.ratePlanId = 0; 4518 n.info = {}; 4519}; 4520IBE.Models.Currencies = function () { 4521 var n = this; 4522 n.base = ""; 4523 n.rates = []; 4524}; 4525IBE.Models.CurrencyRate = function (n) { 4526 var t = this; 4527 t.code = n.code; 4528 t.rate = n.rate; 4529 t.name = n.name; 4530 t.positivePattern = n.positivePattern; 4531 t.symbol = n.symbol || n.code; 4532}; 4533IBE.Models.HotelResult = function () { 4534 var n = this; 4535 n.requestedRooms = ko.observableArray([]); 4536 n.hotelId = ko.observable(parseInt(IBE.Config.hotelId)); 4537 n.availability = ko.observable(); 4538 n.selectedSupplements = ko.observableArray([]); 4539 n.supplements = {}; 4540}; 4541IBE.Models.Country = function (n) { 4542 var t = this; 4543 t.code = ko.observable(n.code); 4544 t.name = ko.observable(n.name); 4545}; 4546IBE.Models.CreditCard = function () { 4547 function i(n) { 4548 var t = { 4549 visa: /^4/, 4550 mastercard: /^5[1-5][0-9]/, 4551 amex: /^3[47][0-9]/, 4552 diners: /^3(?:0[0-5]|[68][0-9])[0-9]/, 4553 discover: /^6(?:011|5[0-9]{2})[0-9]/,
4554 jcb: /^(?:2131|1800|35\d{3})\d/, 4555 unionpay: /^62|^8171/, 4556 }; 4557 return t.visa.test(n) 4558 ? "visa" 4559 : t.mastercard.test(n) 4560 ? "mastercard" 4561 : t.amex.test(n) 4562 ? "amex" 4563 : t.diners.test(n) 4564 ? "dinersclub" 4565 : t.discover.test(n) 4566 ? "discover" 4567 : t.jcb.test(n) 4568 ? "jcb" 4569 : t.unionpay.test(n) 4570 ? "unionpay" 4571 : void 0; 4572 } 4573 var n = this, 4574 t; 4575 n.acceptedCards = ko.observableArray(); 4576 t = function () { 4577 $.when(IBE.Utils.loadHotelInfo()).then(function (t) { 4578 t.info.acceptedCards === "All" 4579 ? n.acceptedCards(IBEConfig.allCreditCards.split(",")) 4580 : n.acceptedCards(t.info.acceptedCards.replace(/,/g, "").split(" ")); 4581 }); 4582 }; 4583 t(); 4584 n.id = ko.observable(0); 4585 n.cardHolder = ko.observable("").extend({ required: { message: IBE.Utils.translate("requiredCardHolder") } }); 4586 n.cardNumber = ko 4587 .observable("") 4588 .extend({ 4589 required: { message: IBE.Utils.translate("requiredCardNumber") }, 4590 creditCard: { message: IBE.Utils.translate("validation.invalidCreditCard") }, 4591 }); 4592 n.cardExpirationYear = ko.observable(""); 4593 n.cardExpirationMonth = ko.observable(""); 4594 n.monthOptions = ko.computed(function () { 4595 for (var t = [], n = 1; n <= 12; n++) t.push(("0" + n).slice(-2)); 4596 return t; 4597 }); 4598 n.yearOptions = ko.computed(function () { 4599 for (var r = new Date(), t = r.getFullYear(), i = [], n = t; n <= t + 15; n++) i.push(n); 4600 return i; 4601 }); 4602 n.cardVerification = ko 4603 .observable("") 4604 .extend({ required: { message: IBE.Utils.translate("requiredCardVerification") }, number: !0 }); 4605 n.cardType = ko.observable(""); 4606 n.getCardType = ko.computed({ 4607 write: function () { 4608 n.cardType(i(n.cardNumber())); 4609 }, 4610 read: function () { 4611 return n.cardType(i(n.cardNumber())), n.cardType(); 4612 }, 4613 deferEvaluation: !0, 4614 }); 4615}; 4616IBE.Models.Company = function () { 4617 var n = this; 4618 n.name = ko.observable(""); 4619 n.vatNumber = ko.observable(""); 4620 n.industry = ko.observable(""); 4621 n.country = ko.observable(""); 4622 n.city = ko.observable(""); 4623 n.address = ko.observable(""); 4624 n.zipCode = ko.observable(""); 4625 n.phone = ko.observable(""); 4626}; 4627IBE.Models.Customer = function (n) { 4628 var t = this, 4629 i, 4630 r, 4631 u; 4632 if ( 4633 ((n = n || {}), 4634 (t.customerMandatoryFields = ko.observable()), 4635 t.customerMandatoryFields.subscribe(function (n) { 4636 jQuery.isEmptyObject(n) || 4637 ((n = JSON.parse(n)), 4638 t.mandatoryAddress(n.MandatoryAddress), 4639 t.mandatoryZip(n.MandatoryZip), 4640 t.mandatoryPhone(n.MandatoryPhone), 4641 t.mandatoryTitle(n.MandatoryTitle), 4642 t.mandatoryPhone(n.MandatoryTelephone), 4643 t.mandatoryCity(n.MandatoryCity)); 4644 }), 4645 (t.mandatoryAddress = ko.observable()), 4646 (t.mandatoryZip = ko.observable()), 4647 (t.mandatoryPhone = ko.observable()), 4648 (t.mandatoryTitle = ko.observable()), 4649 (t.mandatoryCity = ko.observable()), 4650 (t.consents = ko.observableArray([])), 4651 (t.titleOptions = [ 4652 { key: "Mr", text: IBE.Utils.translate("title-mr") }, 4653 { key: "Mrs", text: IBE.Utils.translate("title-mrs") }, 4654 { key: "Miss", text: IBE.Utils.translate("title-miss") }, 4655 { key: "Ms", text: IBE.Utils.translate("title-ms") }, 4656 { key: "Dr", text: IBE.Utils.translate("title-dr") }, 4657 ]), 4658 (t.title = ko.observable(n.title)), 4659 (t.firstName = ko 4660 .observable(n.firstName) 4661 .extend({ required: { message: IBE.Utils.translate("requiredFirstName") } })), 4662 (t.lastName = ko 4663 .observable(n.lastName) 4664 .extend({ required: { message: IBE.Utils.translate("requiredLastName") } })), 4665 (t.fullName = ko.computed(function () { 4666 return t.firstName() + " " + t.lastName(); 4667 })), 4668 (t.email = ko 4669 .observable(n.email) 4670 .extend({ required: { message: IBE.Utils.translate("requiredEmail") }, email: !0 })), 4671 (t.country = ko 4672 .observable(n.country) 4673 .extend({ required: { message: IBE.Utils.translate("requiredCountry") } })), 4674 (t.region = ko.observable(n.region)), 4675 (t.city = ko.observable(n.city).extend({ 4676 required: { 4677 message: IBE.Utils.translate("requiredCity"), 4678 onlyIf: function () { 4679 return t.mandatoryCity() === !0; 4680 }, 4681 }, 4682 })), 4683 (t.address = ko.observable(n.address).extend({ 4684 required: { 4685 message: IBE.Utils.translate("requiredAddress"), 4686 onlyIf: function () { 4687 return t.mandatoryAddress() === !0; 4688 }, 4689 }, 4690 })), 4691 (t.zip = ko.observable(n.zip).extend({ 4692 required: { 4693 message: IBE.Utils.translate("requiredZip"), 4694 onlyIf: function () { 4695 return t.mandatoryZip() === !0; 4696 }, 4697 }, 4698 })), 4699 (t.fax = ko.observable(n.fax)), 4700 (t.mobile = ko.observable(n.mobilePhone)), 4701 (t.birthdate = ko.observable(n.birthdate)),
4702 (t.phone = ko.observable(n.telephones).extend({ 4703 required: { 4704 message: IBE.Utils.translate("requiredTelephone"), 4705 onlyIf: function () { 4706 return t.mandatoryPhone() === !0; 4707 }, 4708 }, 4709 })), 4710 (t.acceptNewsletter = ko.observable(n.acceptNewsletter || !1)), 4711 (t.id = ko.observable(n.customerId || 0)), 4712 (t.resetHash = n.resetHash || ""), 4713 (t.reservations = ko.observableArray([])), 4714 n.reservations) 4715 ) { 4716 for (r = [], i = 0; i < n.reservations.length; i++) r.push(new IBE.Models.Reservation(n.reservations[i])); 4717 t.reservations(r); 4718 } 4719 if (((t.offers = ko.observableArray([])), n.offers)) { 4720 for (u = [], i = 0; i < n.offers.length; i++) u.push(new IBE.Models.Offer(n.offers[i])); 4721 t.offers(u); 4722 } 4723 t._data = n; 4724 t.toJSON = function () { 4725 var n = {}; 4726 return ( 4727 (n.customerId = t.id()), 4728 (n.firstName = t.firstName()), 4729 (n.lastName = t.lastName()), 4730 (n.title = t.title()), 4731 (n.email = t.email()), 4732 (n.country = t.country()), 4733 (n.region = t.region()), 4734 (n.city = t.city()), 4735 (n.address = t.address()), 4736 (n.zip = t.zip()), 4737 (n.fax = t.fax()), 4738 (n.mobilePhone = t.mobile()), 4739 (n.telephones = t.phone()), 4740 (n.birthdate = t.birthdate()), 4741 (n.acceptNewsletter = t.acceptNewsletter()), 4742 (n.consents = t.consents()), 4743 ko.toJSON(n) 4744 ); 4745 }; 4746}; 4747IBE.Models.Reservation = function (n) { 4748 var t = this, 4749 i, 4750 r, 4751 u; 4752 ko.utils.extend(t, new IBE.ViewModels.Taxes(t)); 4753 typeof n == "undefined" && (n = {}); 4754 t.id = n.id || 0; 4755 t.code = n.code || ""; 4756 t.orderId = n.orderId || ""; 4757 t.currencyCode = n.currencyCode || ""; 4758 t.status = ko.observable(n.status || ""); 4759 t.hotelId = n.hotelId || 0; 4760 t.hotelName = n.hotelName || ""; 4761 t.checkIn = n.checkIn || ""; 4762 t.checkOut = n.checkOut || ""; 4763 t.couponCode = n.couponCode || ""; 4764 t.created = n.created || ""; 4765 t.cancelled = n.cancellationDate || ""; 4766 t.lastModified = n.modified || ""; 4767 t.notes = ko.observable(n.notes || ""); 4768 t.arrivalNotes = ko.observable(n.arrivalNotes || ""); 4769 t.totalCost = ko.observable(n.totalCost || ""); 4770 t.totalCostWithoutDiscount = ko.observable(n.totalCostWithoutDiscount || ""); 4771 t.advancePayment = ko.observable(n.advancePayment || ""); 4772 t.reservationTerms = n.reservationTerms || ""; 4773 t.allowCancellation = ko.observable(n.allowCancellation || !1); 4774 t.allowModification = ko.observable(n.allowModification || !1); 4775 t.reservationType = n.reservationType || ""; 4776 t.sourceName = n.sourceName || ""; 4777 t.sourceType = n.sourceType || ""; 4778 t.webCheckIn = ko.observable(n.webCheckIn || !1); 4779 t.webCheckInDate = ko.observable(moment(n.webCheckInDate) || null); 4780 t.webCheckInActive = ko.observable(n.webCheckInActive || !1); 4781 t.payments = ko.observable(n.payments || []); 4782 t.cancellationPoliciesText = ko.observable(n.cancellationPoliciesText || ""); 4783 t.paymentText = ko.observable(n.paymentText || ""); 4784 t.creditCardLastDigits = n.creditCardLastDigits || ""; 4785 t.isTracked = n.isTracked || !1; 4786 t.cancellationNotes = ko.observable(""); 4787 t.pmsOwner = n.pmsOnwer || !1; 4788 t.pmsCode = n.pmsCode || ""; 4789 t.headerText = ko.computed({ 4790 read: function () { 4791 switch (t.status()) { 4792 case "ConfirmedReservation": 4793 return IBE.Utils.translate("reservationSuccessful"); 4794 case "NewRequest": 4795 return IBE.Utils.translate("requestSuccessful"); 4796 default: 4797 return ""; 4798 } 4799 }, 4800 deferEvaluation: !0, 4801 }); 4802 t.availableActions = ko.observableArray([]); 4803 typeof n.availableActions != "undefined" && 4804 ko.utils.arrayForEach(n.availableActions, function (n) { 4805 switch (n) { 4806 case "ConfirmedReservation": 4807 case "CancelledReservation": 4808 case "CancelledRequest": 4809 t.availableActions().push(n); 4810 } 4811 }); 4812 t.rooms = 4813 ko.utils.arrayMap(n.rooms, function (n) { 4814 return new IBE.Models.ReservationRoom(n); 4815 }) || []; 4816 t.supplements = 4817 ko.utils.arrayMap(n.supplements, function (n) { 4818 return new IBE.Models.ReservationSupplement(n); 4819 }) || []; 4820 t.cancellationRules = 4821 ko.utils.arrayMap(n.cancellationRules, function (n) { 4822 return new IBE.Models.CancellationRule(n); 4823 }) || []; 4824 t.customer = new IBE.Models.Customer(n.customer); 4825 t.cancellationCost = ko.computed(function () { 4826 var i = moment(), 4827 n = ko.utils.arrayFirst(t.cancellationRules, function (n) { 4828 return IBE.Utils.dateIsoFormat(moment()) <= n.cancelBefore; 4829 }); 4830 return n != null ? n.cancelAmount : 0; 4831 }); 4832 t.guests = ko.observableArray([]); 4833 n.guests = n.guests || []; 4834 ko.utils.arrayForEach(n.guests, function (n) { 4835 t.guests.push(new IBE.Models.ReservationGuest(n)); 4836 }); 4837 r = 0; 4838 n.guests.length === 0 && 4839 ((u = t.rooms.sort(function (n, t) { 4840 return n.roomIndex > t.roomIndex ? 1 : -1; 4841 })), 4842 ko.utils.arrayForEach(u, function (u, f) { 4843 var e = 0; 4844 for ( 4845 f !== 0 || 4846 n.webCheckIn || 4847 ((n.customer.index = r++), 4848 (n.customer.roomIndex = u.roomIndex), 4849 t.guests.push(new IBE.Models.ReservationGuest(n.customer)), 4850 (e = 1)), 4851 i = e; 4852 i < u.adults; 4853 i++ 4854 ) 4855 (u.index = r++), t.guests.push(new IBE.Models.ReservationGuest(u)); 4856 for (i = 0; i < u.children; i++) (u.index = r++), t.guests.push(new IBE.Models.ReservationGuest(u)); 4857 for (i = 0; i < u.infants; i++) (u.index = r++), t.guests.push(new IBE.Models.ReservationGuest(u)); 4858 })); 4859 t.canUpdateReservation = function () { 4860 return t.status() !== "ConfirmedReservation" 4861 ? !1 4862 : t.sourceName !== "Direct" 4863 ? !1 4864 : moment(t.checkIn).endOf("day").diff(moment().endOf("day"), "days") <= 0 4865 ? !1 4866 : !0; 4867 }; 4868 t.canModifyReservation = function () { 4869 return t.status() !== "ConfirmedReservation" 4870 ? !1 4871 : t.sourceName !== "Direct" 4872 ? !1 4873 : moment(t.checkIn).endOf("day").diff(moment().endOf("day"), "days") <= 0 4874 ? !1 4875 : t.availableActions().length 4876 ? !0 4877 : !1; 4878 }; 4879 t.cancelationFeePaid = ko.computed(function () { 4880 var n = ko.utils.arrayFirst(t.payments(), function (n) { 4881 return "Paid" === n.status; 4882 }); 4883 return n || !1; 4884 }); 4885 t.refresh = function (n) { 4886 t.id = n.id || 0; 4887 t.code = n.code || ""; 4888 t.orderId = n.orderId || ""; 4889 t.currencyCode = n.currencyCode || ""; 4890 t.status(n.status); 4891 t.hotelId = n.hotelId || 0; 4892 t.hotelName = n.hotelName || ""; 4893 t.checkIn = n.checkIn || ""; 4894 t.checkOut = n.checkOut || ""; 4895 t.couponCode = n.couponCode || ""; 4896 t.created = n.created || ""; 4897 t.cancelled = n.cancellationDate || ""; 4898 t.lastModified = n.modified || ""; 4899 t.notes(n.notes); 4900 t.arrivalNotes(n.arrivalNotes); 4901 t.totalCost(n.totalCost); 4902 t.totalCostWithoutDiscount(n.totalCostWithoutDiscount); 4903 t.advancePayment(n.advancePayment); 4904 t.sourceName = n.sourceName || ""; 4905 t.sourceType = n.sourceType || ""; 4906 t.availableActions(n.availableActions); 4907 }; 4908}; 4909IBE.Models.ReservationGuest = function (n) { 4910 var t = this; 4911 n = n || {}; 4912 t.index = ko.observable(n.index); 4913 t.customerId = n.customerId || null; 4914 t.providerId = n.providerId || null; 4915 t.roomIndex = ko.observable(n.roomIndex); 4916 t.guestType = n.guestType; 4917 t.firstName = ko.observable(n.firstName); 4918 t.lastName = ko.observable(n.lastName); 4919 t.birthday = ko.observable(n.birthday); 4920 t.telephone = ko
4921 .observable(n.telephone) 4922 .extend({ required: { message: IBE.Utils.translate("requiredTelephone") } }); 4923 t.address = ko.observable(n.address); 4924 t.citizenshipCountry = ko.observable(n.citizenshipCountry); 4925 t.email = ko.observable(n.email); 4926 t.idNumber = ko.observable(n.idNumber); 4927 t.documentNumber = ko.observable(n.documentNumber); 4928 t.documentType = ko.observable(n.documentType); 4929 t.title = ko.observable(n.title); 4930 t.gender = ko.observable(n.gender); 4931 t.occupation = ko.observable(n.occupation); 4932}; 4933IBE.Models.ReservationRoom = function (n) { 4934 var t = this; 4935 t.id = n.id || n.roomId || 0; 4936 t.roomIndex = n.roomIndex; 4937 t.adults = n.adults; 4938 t.children = n.children; 4939 t.infants = n.infants; 4940 t.childrenAges = []; 4941 n.roomGuests && 4942 ko.utils.arrayForEach(n.roomGuests, function (n) { 4943 if (n.ageCategory === IBE.Config.guestType.Children) 4944 for (var i = 0; i < n.ages.length; i++) t.childrenAges.push(n.ages[i]); 4945 }); 4946 t.name = n.name; 4947 t.board = { 4948 name: n.boardName, 4949 type: n.boardType, 4950 price: n.boardCost, 4951 priceBeforeDiscount: n.boardCostBeforeDiscount, 4952 }; 4953 t.ratePlanId = n.ratePlanId; 4954 t.ratePlanName = n.ratePlanName; 4955 t.totalCost = n.totalCost; 4956 t.totalCostBeforeDiscount = n.totalCostBeforeDiscount; 4957 t.roomCost = n.roomCost; 4958 t.roomCostBeforeDiscount = n.roomCostBeforeDiscount; 4959 t.payments = ko.utils.arrayMap(n.payments, function (n) { 4960 return new IBE.Models.Payment(n); 4961 }); 4962 t.roomPhoto = n.roomPhoto || "https://app.bookwize.com/admin/PHOTOS/no-image-466-275.png"; 4963}; 4964IBE.Models.Payment = function (n) { 4965 var t = this; 4966 t.amount = n.amount; 4967 t.datePaid = n.datePaid; 4968 t.dateToPay = n.dateToPay; 4969 t.id = n.id; 4970 t.paymentType = n.paymentType; 4971 t.status = n.status; 4972 t.transactionId = n.transactionId; 4973}; 4974IBE.Models.CancellationRule = function (n) { 4975 var t = this; 4976 n = n || {}; 4977 t.daysBeforeCheckIn = n.daysBeforeCheckIn || 0; 4978 t.cancelBefore = n.cancelBefore || null; 4979 t.cancelAmount = n.cancelAmount || 0; 4980 t.minimumPenalty = n.minimumPenalty || 0; 4981 t.minimumPenaltyType = n.minimumPenaltyType || ""; 4982 t.penalty = n.penalty || 0; 4983 t.penaltyType = n.penaltyType || ""; 4984 t.text = n.text; 4985}; 4986IBE.Models.PaymentRule = function (n, t) { 4987 var i = this; 4988 n = n || {}; 4989 i.index = n.index || 0; 4990 i.charge = n.charge || 0; 4991 i.chargeType = n.chargeType || ""; 4992 i.daysUntilCheckInMax = n.daysUntilCheckInMax || 0; 4993 i.daysUntilCheckInMin = n.daysUntilCheckInMin || 0; 4994 i.minimumCharge = n.minimumCharge || 0; 4995 i.minimumChargeType = n.minimumChargeType || ""; 4996 i.ruleType = n.ruleType || ""; 4997 i.text = ko.computed(function () { 4998 var n = "", 4999 f = "", 5000 r = "", 5001 u; 5002 switch (i.chargeType) { 5003 case "Percentage": 5004 n = "%"; 5005 break; 5006 case "FixedPrice": 5007 n = ""; 5008 break; 5009 case "RoomNight": 5010 i.charge > t && (i.charge = t); 5011 n = i.charge > 1 ? IBE.Utils.translate("roomNights") : IBE.Utils.translate("roomNight"); 5012 } 5013 switch (i.minimumChargeType) { 5014 case "Percentage": 5015 f = "%"; 5016 break; 5017 case "FixedPrice": 5018 f = ""; 5019 break; 5020 case "RoomNight": 5021 i.minimumCharge > t && (i.minimumCharge = t); 5022 f = i.minimumCharge > 1 ? IBE.Utils.translate("roomNights") : IBE.Utils.translate("roomNight"); 5023 } 5024 if ( 5025 ((u = ""), 5026 (i.minimumChargeType != i.chargeType || i.minimumCharge > i.charge) && 5027 i.minimumCharge > 0 && 5028 (u = "(" + i.minimumCharge + " " + f + " " + IBE.Utils.translate("minimum") + ") "), 5029 i.charge == 0) 5030 ) 5031 r = IBE.Utils.translate("noAdvancePayment"); 5032 else if (i.charge == 100 && i.chargeType == 0) r = IBE.Utils.translate("fullPrepaymentRequired"); 5033 else 5034 switch (i.ruleType) { 5035 case "OnRequest": 5036 r = IBE.Utils.translate("advancePaymentRequiredReservationPlacement").format(i.charge, n, u); 5037 break; 5038 case "PriorToArrival": 5039 r = 5040 i.index === 0 5041 ? IBE.Utils.translate("advancePaymentRequiredDaysBeforeArrivalSingle").format( 5042 i.charge, 5043 n, 5044 u, 5045 i.daysUntilCheckInMin 5046 ) 5047 : IBE.Utils.translate("advancePaymentRequiredDaysBeforeArrival").format( 5048 i.charge, 5049 n, 5050 u, 5051 i.daysUntilCheckInMin 5052 ); 5053 break; 5054 case "FromRequestUntilCheckIn": 5055 r = IBE.Utils.translate("advancePaymentRequiredDaysAfterRequest").format( 5056 i.charge, 5057 n, 5058 u, 5059 i.daysUntilCheckInMin 5060 ); 5061 break; 5062 case "OnCheckOut": 5063 r = IBE.Utils.translate("advancePaymentRequiredDaysAfterRequest").format( 5064 i.charge, 5065 n, 5066 u, 5067 i.daysUntilCheckInMin 5068 ); 5069 } 5070 return r; 5071 }); 5072}; 5073IBE.Models.ReservationSupplement = function (n) { 5074 var t = this; 5075 n = n || {}; 5076 t.supplementId = ko.observable(n.id || 0); 5077 t.category = n.category || ""; 5078 t.name = n.name || ""; 5079 t.description = n.description || ""; 5080 t.quantity = ko.observable(n.quantity || 0); 5081 t.isUnique = ko.observable(n.isUnique || !1); 5082 t.pricingType = ko.observable(n.pricingType || ""); 5083 t.timePricingType = ko.observable(n.timePricingType || ""); 5084 t.timePricingUnit = ko.observable(n.timePricingUnit || ""); 5085 t.isMandatory = ko.observable(n.isMandatory || !1); 5086 t.roomIndex = ko.observable(n.roomIndex || 0); 5087 t.guestTypeId = ko.observable(n.guestTypeId || 0); 5088 t.guestType = ko.observable(n.guestType || ""); 5089 t.unitCost = ko.observable(n.unitCost || 0); 5090 t.unitCostBeforeDiscount = ko.observable(n.unitCostBeforeDiscount || 0); 5091 t.totalPrice = ko.computed(function () { 5092 return t.quantity() * t.unitCost(); 5093 }); 5094 t.totalPriceBeforeDiscount = ko.computed(function () { 5095 return t.quantity() & t.unitCostBeforeDiscount(); 5096 }); 5097 t.photos = IBE.Utils.populatePhotos(n.photos); 5098}; 5099IBE.Models.RoomGuest = function () { 5100 var n = this; 5101 ko.utils.extend(n, IBE.Models.RequestedRoomGuestType); 5102 n.ages = ko.observableArray([]); 5103}; 5104IBE.Models.GoogleMap = function (n) { 5105 var t = this; 5106 t.zoom = n.address.zoom || 10; 5107 t.latitude = ko.observable(n.address.latitude); 5108 t.longitude = ko.observable(n.address.longitude); 5109 t.marker = ko.observable({ title: n.name, street: n.address.street }); 5110}; 5111IBE.Models.Message = function (n) { 5112 var t = this; 5113 n = n || {}; 5114 t.id = ko.observable(n.id || 0); 5115 t.severity = ko.observable(n.severity || ""); 5116 t.text = ko.observable(n.text || ""); 5117}; 5118IBE.Models.Contact = function () { 5119 var n = this; 5120 n.firstName = ko.observable("").extend({ required: { message: IBE.Utils.translate("validation.required") } }); 5121 n.lastName = ko.observable("").extend({ required: { message: IBE.Utils.translate("validation.required") } }); 5122 n.email = ko.observable("").extend({ required: { message: IBE.Utils.translate("validation.required") } }); 5123 n.subject = ko.observable("").extend({ required: { message: IBE.Utils.translate("validation.required") } }); 5124 n.text = ko.observable("").extend({ required: { message: IBE.Utils.translate("validation.required") } }); 5125};
5126IBE.ViewModels.Message = function () { 5127 var n = this; 5128 n._msg = ko.observable(new IBE.Models.Message()); 5129 n.message = ko.computed({ 5130 write: function (t) { 5131 n._msg(new IBE.Models.Message(t)); 5132 }, 5133 read: function () { 5134 return n._msg(); 5135 }, 5136 deferEvaluation: !0, 5137 }); 5138 n.clearMessage = function () { 5139 n.message({ id: 0, severity: "", text: "" }); 5140 }; 5141 n.hasMessage = function () { 5142 return n.message().text() !== ""; 5143 }; 5144}; 5145IBE.Models.Hop = function (n) { 5146 var t = this; 5147 n = n || {}; 5148 t.checkIn = ko.observable(n.checkIn || ""); 5149 t.checkOut = ko.observable(n.checkOut || ""); 5150 t.couponCode = ko.observable(n.couponCode || ""); 5151 t.minCheckInDate = ko.observable(n.minCheckInDate || ""); 5152 t.guests = n.guests || []; 5153 t.destination = n.destination || null; 5154 t.current = ko.observable(n.current || !1); 5155}; 5156(IBE.Models.Referrer = function (n) { 5157 var t = this; 5158 n = n || {}; 5159 t.name = n.name || ""; 5160 t.campaign = n.campaign; 5161 t.params = n.params || {}; 5162}), 5163 (function (n) { 5164 n.datepick.regionalOptions.da = { 5165 monthNames: [ 5166 "Januar", 5167 "Februar", 5168 "Marts", 5169 "April", 5170 "Maj", 5171 "Juni", 5172 "Juli", 5173 "August", 5174 "September", 5175 "Oktober", 5176 "November", 5177 "December", 5178 ], 5179 monthNamesShort: ["Jan", "Feb", "Mar", "Apr", "Maj", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Dec"], 5180 dayNames: ["Søndag", "Mandag", "Tirsdag", "Onsdag", "Torsdag", "Fredag", "Lørdag"], 5181 dayNamesShort: ["Søn", "Man", "Tir", "Ons", "Tor", "Fre", "Lør"], 5182 dayNamesMin: ["Sø", "Ma", "Ti", "On", "To", "Fr", "Lø"], 5183 dateFormat: "dd-mm-yyyy", 5184 firstDay: 0, 5185 renderer: n.datepick.defaultRenderer, 5186 prevText: "<Forrige", 5187 prevStatus: "Vis forrige mÃ¥ned", 5188 prevJumpText: "<<", 5189 prevJumpStatus: "", 5190 nextText: "Næste>", 5191 nextStatus: "Vis næste mÃ¥ned", 5192 nextJumpText: ">>", 5193 nextJumpStatus: "", 5194 currentText: "Idag", 5195 currentStatus: "Vis aktuel mÃ¥ned", 5196 todayText: "Idag", 5197 todayStatus: "Vis aktuel mÃ¥ned", 5198 clearText: "Nulstil", 5199 clearStatus: "Nulstil den aktuelle dato", 5200 closeText: "Luk", 5201 closeStatus: "Luk uden ændringer", 5202 yearStatus: "Vis et andet Ã¥r", 5203 monthStatus: "Vis en anden mÃ¥ned", 5204 weekText: "Uge", 5205 weekStatus: "à rets uge", 5206 dayStatus: "Vælg D, M d", 5207 defaultStatus: "Vælg en dato", 5208 isRTL: !1, 5209 }; 5210 n.datepick.setDefaults(n.datepick.regionalOptions.da); 5211 })(jQuery), 5212 (function (n) { 5213 n.datepick.regionalOptions.cs = { 5214 monthNames: [ 5215 "leden", 5216 "únor", 5217 "bÅezen", 5218 "duben", 5219 "kvÄten", 5220 "Äerven", 5221 "Äervenec", 5222 "srpen", 5223 "záÅÃ", 5224 "ÅÃjen", 5225 "listopad", 5226 "prosinec", 5227 ], 5228 monthNamesShort: ["led", "úno", "bÅe", "dub", "kvÄ", "Äer", "Ävc", "srp", "záÅ", "ÅÃj", "lis", "pro"], 5229 dayNames: ["nedÄle", "pondÄlÃ", "úterý", "stÅeda", "Ätvrtek", "pátek", "sobota"], 5230 dayNamesShort: ["ne", "po", "út", "st", "Ät", "pá", "so"], 5231 dayNamesMin: ["ne", "po", "út", "st", "Ät", "pá", "so"], 5232 dateFormat: "dd.mm.yyyy", 5233 firstDay: 1, 5234 renderer: n.datepick.defaultRenderer, 5235 prevText: "<DÅÃve", 5236 prevStatus: "PÅejÃt na pÅedchozà mÄsÃ", 5237 prevJumpText: "<<", 5238 prevJumpStatus: "", 5239 nextText: "PozdÄji>", 5240 nextStatus: "PÅejÃt na dalšà mÄsÃc", 5241 nextJumpText: ">>", 5242 nextJumpStatus: "", 5243 currentText: "NynÃ", 5244 currentStatus: "PÅejde na aktuálnà mÄsÃc", 5245 todayText: "NynÃ", 5246 todayStatus: "PÅejde na aktuálnà mÄsÃc", 5247 clearText: "Vymazat", 5248 clearStatus: "Vymaže zadané datum", 5249 closeText: "ZavÅÃt", 5250 closeStatus: "ZavÅe kalendáŠbeze zmÄny", 5251 yearStatus: "PÅejÃt na jiný rok", 5252 monthStatus: "PÅejÃt na jiný mÄsÃc", 5253 weekText: "Týd", 5254 weekStatus: "Týden v roce", 5255 dayStatus: "'Vyber' DD, M d", 5256 defaultStatus: "Vyberte datum", 5257 isRTL: !1, 5258 }; 5259 n.datepick.setDefaults(n.datepick.regionalOptions.cs); 5260 })(jQuery), 5261 (function (n) { 5262 n.datepick.regionalOptions.de = { 5263 monthNames: [ 5264 "Januar", 5265 "Februar", 5266 "März", 5267 "April", 5268 "Mai", 5269 "Juni", 5270 "Juli", 5271 "August", 5272 "September", 5273 "Oktober", 5274 "November", 5275 "Dezember", 5276 ], 5277 monthNamesShort: ["Jan", "Feb", "Mär", "Apr", "Mai", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Dez"], 5278 dayNames: ["Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag"], 5279 dayNamesShort: ["So", "Mo", "Di", "Mi", "Do", "Fr", "Sa"], 5280 dayNamesMin: ["So", "Mo", "Di", "Mi", "Do", "Fr", "Sa"], 5281 dateFormat: "dd.mm.yyyy", 5282 firstDay: 1, 5283 renderer: n.datepick.defaultRenderer, 5284 prevText: "<zurück", 5285 prevStatus: "letzten Monat zeigen", 5286 prevJumpText: "<<", 5287 prevJumpStatus: "", 5288 nextText: "Vor>",
5289 nextStatus: "nächsten Monat zeigen", 5290 nextJumpText: ">>", 5291 nextJumpStatus: "", 5292 currentText: "heute", 5293 currentStatus: "", 5294 todayText: "heute", 5295 todayStatus: "", 5296 clearText: "löschen", 5297 clearStatus: "aktuelles Datum löschen", 5298 closeText: "schlieÃen", 5299 closeStatus: "ohne Ãnderungen schlieÃen", 5300 yearStatus: "anderes Jahr anzeigen", 5301 monthStatus: "anderen Monat anzeigen", 5302 weekText: "Wo", 5303 weekStatus: "Woche des Monats", 5304 dayStatus: "Wähle D, M d", 5305 defaultStatus: "Wähle ein Datum", 5306 isRTL: !1, 5307 }; 5308 n.datepick.setDefaults(n.datepick.regionalOptions.de); 5309 })(jQuery), 5310 (function (n) { 5311 n.datepick.regionalOptions["el-GR"] = { 5312 monthNames: [ 5313 "ÎÎ±Î½Î¿Ï Î±ÏιοÏ", 5314 "ΦεβÏÎ¿Ï Î±ÏιοÏ", 5315 "ÎαÏÏιοÏ", 5316 "ÎÏÏιλιοÏ", 5317 "ÎαιοÏ", 5318 "ÎÎ¿Ï Î½Î¹Î¿Ï", 5319 "ÎÎ¿Ï Î»Î¹Î¿Ï", 5320 "ÎÏ Î³Î¿Ï ÏÏοÏ", 5321 "ΣεÏÏεμβÏιοÏ", 5322 "ÎκÏÏβÏιοÏ", 5323 "ÎοεμβÏιοÏ", 5324 "ÎεκεμβÏιοÏ", 5325 ], 5326 monthNamesShort: ["Îαν", "Φεβ", "ÎαÏ", "ÎÏÏ", "Îαι", "ÎÎ¿Ï Î½", "ÎÎ¿Ï Î»", "ÎÏ Î³", "ΣεÏ", "ÎκÏ", "Îοε", "Îεκ"], 5327 dayNames: ["ÎÏ Ïιακή", "ÎÎµÏ ÏÎÏα", "ΤÏίÏη", "ΤεÏάÏÏη", "Î ÎμÏÏη", "ΠαÏαÏÎºÎµÏ Î®", "ΣάββαÏο"], 5328 dayNamesShort: ["ÎÏ Ï", "ÎÎµÏ ", "ΤÏι", "ΤεÏ", "Πεμ", "ΠαÏ", "Σαβ"], 5329 dayNamesMin: ["ÎÏ ", "Îε", "ΤÏ", "Τε", "Πε", "Πα", "Σα"], 5330 dateFormat: "dd/mm/yyyy", 5331 firstDay: 1, 5332 renderer: n.datepick.defaultRenderer, 5333 prevText: "Î ÏοηγοÏμενοÏ", 5334 prevStatus: "ÎÏιÏκÏÏηÏη ÏÏοηγοÏÎ¼ÎµÎ½Î¿Ï Î¼Î®Î½Î±", 5335 prevJumpText: "<<", 5336 prevJumpStatus: "", 5337 nextText: "ÎÏÏμενοÏ", 5338 nextStatus: "ÎÏιÏκÏÏηÏη εÏÏÎ¼ÎµÎ½Î¿Ï Î¼Î®Î½Î±", 5339 nextJumpText: ">>", 5340 nextJumpStatus: "", 5341 currentText: "ΤÏÎÏÏν ÎήναÏ", 5342 currentStatus: "ÎÏιÏκÏÏηÏη ÏÏÎÏονÏÎ¿Ï Î¼Î®Î½Î±", 5343 todayText: "ΤÏÎÏÏν ÎήναÏ", 5344 todayStatus: "ÎÏιÏκÏÏηÏη ÏÏÎÏονÏÎ¿Ï Î¼Î®Î½Î±", 5345 clearText: "ΣβήÏιμο", 5346 clearStatus: "ΣβήÏιμο ÏÎ·Ï ÎµÏιλεγμÎÎ½Î·Ï Î·Î¼ÎµÏομηνίαÏ", 5347 closeText: "ÎλείÏιμο", 5348 closeStatus: "ÎλείÏιμο ÏÏÏÎ¯Ï Î±Î»Î»Î±Î³Î®", 5349 yearStatus: "ÎÏιÏκÏÏηÏη Î¬Î»Î»Î¿Ï ÎÏÎ¿Ï Ï", 5350 monthStatus: "ÎÏιÏκÏÏηÏη Î¬Î»Î»Î¿Ï Î¼Î®Î½Î±", 5351 weekText: "Îβδ", 5352 weekStatus: "", 5353 dayStatus: "ÎÏιλογή DD d MM", 5354 defaultStatus: "ÎÏιλÎξÏε μια ημεÏομηνία", 5355 isRTL: !1, 5356 }; 5357 n.datepick.setDefaults(n.datepick.regionalOptions["el-GR"]); 5358 })(jQuery), 5359 (function (n) { 5360 n.datepick.regionalOptions.el = { 5361 monthNames: [ 5362 "ÎÎ±Î½Î¿Ï Î±ÏιοÏ", 5363 "ΦεβÏÎ¿Ï Î±ÏιοÏ", 5364 "ÎαÏÏιοÏ", 5365 "ÎÏÏιλιοÏ", 5366 "ÎαιοÏ", 5367 "ÎÎ¿Ï Î½Î¹Î¿Ï", 5368 "ÎÎ¿Ï Î»Î¹Î¿Ï", 5369 "ÎÏ Î³Î¿Ï ÏÏοÏ", 5370 "ΣεÏÏεμβÏιοÏ", 5371 "ÎκÏÏβÏιοÏ", 5372 "ÎοεμβÏιοÏ", 5373 "ÎεκεμβÏιοÏ", 5374 ], 5375 monthNamesShort: ["Îαν", "Φεβ", "ÎαÏ", "ÎÏÏ", "Îαι", "ÎÎ¿Ï Î½", "ÎÎ¿Ï Î»", "ÎÏ Î³", "ΣεÏ", "ÎκÏ", "Îοε", "Îεκ"], 5376 dayNames: ["ÎÏ Ïιακή", "ÎÎµÏ ÏÎÏα", "ΤÏίÏη", "ΤεÏάÏÏη", "Î ÎμÏÏη", "ΠαÏαÏÎºÎµÏ Î®", "ΣάββαÏο"], 5377 dayNamesShort: ["ÎÏ Ï", "ÎÎµÏ ", "ΤÏι", "ΤεÏ", "Πεμ", "ΠαÏ", "Σαβ"], 5378 dayNamesMin: ["ÎÏ ", "Îε", "ΤÏ", "Τε", "Πε", "Πα", "Σα"], 5379 dateFormat: "dd/mm/yyyy", 5380 firstDay: 1, 5381 renderer: n.datepick.defaultRenderer, 5382 prevText: "Î ÏοηγοÏμενοÏ", 5383 prevStatus: "ÎÏιÏκÏÏηÏη ÏÏοηγοÏÎ¼ÎµÎ½Î¿Ï Î¼Î®Î½Î±", 5384 prevJumpText: "<<", 5385 prevJumpStatus: "", 5386 nextText: "ÎÏÏμενοÏ", 5387 nextStatus: "ÎÏιÏκÏÏηÏη εÏÏÎ¼ÎµÎ½Î¿Ï Î¼Î®Î½Î±", 5388 nextJumpText: ">>", 5389 nextJumpStatus: "", 5390 currentText: "ΤÏÎÏÏν ÎήναÏ", 5391 currentStatus: "ÎÏιÏκÏÏηÏη ÏÏÎÏονÏÎ¿Ï Î¼Î®Î½Î±", 5392 todayText: "ΤÏÎÏÏν ÎήναÏ", 5393 todayStatus: "ÎÏιÏκÏÏηÏη ÏÏÎÏονÏÎ¿Ï Î¼Î®Î½Î±", 5394 clearText: "ΣβήÏιμο", 5395 clearStatus: "ΣβήÏιμο ÏÎ·Ï ÎµÏιλεγμÎÎ½Î·Ï Î·Î¼ÎµÏομηνίαÏ", 5396 closeText: "ÎλείÏιμο", 5397 closeStatus: "ÎλείÏιμο ÏÏÏÎ¯Ï Î±Î»Î»Î±Î³Î®", 5398 yearStatus: "ÎÏιÏκÏÏηÏη Î¬Î»Î»Î¿Ï ÎÏÎ¿Ï Ï", 5399 monthStatus: "ÎÏιÏκÏÏηÏη Î¬Î»Î»Î¿Ï Î¼Î®Î½Î±", 5400 weekText: "Îβδ", 5401 weekStatus: "", 5402 dayStatus: "ÎÏιλογή DD d MM", 5403 defaultStatus: "ÎÏιλÎξÏε μια ημεÏομηνία", 5404 isRTL: !1, 5405 }; 5406 n.datepick.setDefaults(n.datepick.regionalOptions.el); 5407 })(jQuery), 5408 (function (n) { 5409 n.datepick.regionalOptions.es = { 5410 monthNames: [ 5411 "Enero", 5412 "Febrero", 5413 "Marzo", 5414 "Abril", 5415 "Mayo", 5416 "Junio", 5417 "Julio", 5418 "Agosto", 5419 "Septiembre", 5420 "Octubre", 5421 "Noviembre", 5422 "Diciembre", 5423 ], 5424 monthNamesShort: ["Ene", "Feb", "Mar", "Abr", "May", "Jun", "Jul", "Ago", "Sep", "Oct", "Nov", "Dic"], 5425 dayNames: ["Domingo", "Lunes", "Martes", "Miércoles", "Jueves", "Viernes", "Sábado"], 5426 dayNamesShort: ["Dom", "Lun", "Mar", "Mié", "Juv", "Vie", "Sáb"], 5427 dayNamesMin: ["Do", "Lu", "Ma", "Mi", "Ju", "Vi", "SÃ
5427¡"], 5428 dateFormat: "dd/mm/yyyy", 5429 firstDay: 1, 5430 renderer: n.datepick.defaultRenderer, 5431 prevText: "<Ant", 5432 prevStatus: "", 5433 prevJumpText: "<<", 5434 prevJumpStatus: "", 5435 nextText: "Sig>", 5436 nextStatus: "", 5437 nextJumpText: ">>", 5438 nextJumpStatus: "", 5439 currentText: "Hoy", 5440 currentStatus: "", 5441 todayText: "Hoy", 5442 todayStatus: "", 5443 clearText: "Limpiar", 5444 clearStatus: "", 5445 closeText: "Cerrar", 5446 closeStatus: "", 5447 yearStatus: "", 5448 monthStatus: "", 5449 weekText: "Sm", 5450 weekStatus: "", 5451 dayStatus: "D, M d", 5452 defaultStatus: "", 5453 isRTL: !1, 5454 }; 5455 n.datepick.setDefaults(n.datepick.regionalOptions.es); 5456 })(jQuery), 5457 (function (n) { 5458 n.datepick.regionalOptions.fi = { 5459 monthNames: [ 5460 "Tammikuu", 5461 "Helmikuu", 5462 "Maaliskuu", 5463 "Huhtikuu", 5464 "Toukokuu", 5465 "Kesäkuu", 5466 "Heinäkuu", 5467 "Elokuu", 5468 "Syyskuu", 5469 "Lokakuu", 5470 "Marraskuu", 5471 "Joulukuu", 5472 ], 5473 monthNamesShort: [ 5474 "Tammi", 5475 "Helmi", 5476 "Maalis", 5477 "Huhti", 5478 "Touko", 5479 "Kesä", 5480 "Heinä", 5481 "Elo", 5482 "Syys", 5483 "Loka", 5484 "Marras", 5485 "Joulu", 5486 ], 5487 dayNamesShort: ["Su", "Ma", "Ti", "Ke", "To", "Pe", "Su"], 5488 dayNames: ["Sunnuntai", "Maanantai", "Tiistai", "Keskiviikko", "Torstai", "Perjantai", "Lauantai"], 5489 dayNamesMin: ["Su", "Ma", "Ti", "Ke", "To", "Pe", "La"], 5490 dateFormat: "dd.mm.yyyy", 5491 firstDay: 1, 5492 renderer: n.datepick.defaultRenderer, 5493 prevText: "«Edellinen", 5494 prevStatus: "", 5495 prevJumpText: "<<", 5496 prevJumpStatus: "", 5497 nextText: "Seuraava»", 5498 nextStatus: "", 5499 nextJumpText: ">>", 5500 nextJumpStatus: "", 5501 currentText: "Tänään", 5502 currentStatus: "", 5503 todayText: "Tänään", 5504 todayStatus: "", 5505 clearText: "Tyhjennä", 5506 clearStatus: "", 5507 closeText: "Sulje", 5508 closeStatus: "", 5509 yearStatus: "", 5510 monthStatus: "", 5511 weekText: "Vk", 5512 weekStatus: "", 5513 dayStatus: "D, M d", 5514 defaultStatus: "", 5515 isRTL: !1, 5516 }; 5517 n.datepick.setDefaults(n.datepick.regionalOptions.fi); 5518 })(jQuery), 5519 (function (n) { 5520 n.datepick.regionalOptions.fr = { 5521 monthNames: [ 5522 "Janvier", 5523 "Février", 5524 "Mars", 5525 "Avril", 5526 "Mai", 5527 "Juin", 5528 "Juillet", 5529 "Août", 5530 "Septembre", 5531 "Octobre", 5532 "Novembre", 5533 "Décembre", 5534 ], 5535 monthNamesShort: ["Jan", "Fév", "Mar", "Avr", "Mai", "Jun", "Jul", "Aoû", "Sep", "Oct", "Nov", "Déc"], 5536 dayNames: ["Dimanche", "Lundi", "Mardi", "Mercredi", "Jeudi", "Vendredi", "Samedi"], 5537 dayNamesShort: ["Dim", "Lun", "Mar", "Mer", "Jeu", "Ven", "Sam"], 5538 dayNamesMin: ["Di", "Lu", "Ma", "Me", "Je", "Ve", "Sa"], 5539 dateFormat: "dd/mm/yyyy", 5540 firstDay: 1, 5541 renderer: n.datepick.defaultRenderer, 5542 prevText: "<Préc", 5543 prevStatus: "Voir le mois précédent", 5544 prevJumpText: "<<", 5545 prevJumpStatus: "Voir l'année précédent", 5546 nextText: "Suiv>", 5547 nextStatus: "Voir le mois suivant", 5548 nextJumpText: ">>", 5549 nextJumpStatus: "Voir l'année suivant", 5550 currentText: "Courant", 5551 currentStatus: "Voir le mois courant", 5552 todayText: "Aujourd'hui", 5553 todayStatus: "Voir aujourd'hui", 5554 clearText: "Effacer", 5555 clearStatus: "Effacer la date sélectionnée", 5556 closeText: "Fermer", 5557 closeStatus: "Fermer sans modifier", 5558 yearStatus: "Voir une autre année", 5559 monthStatus: "Voir un autre mois", 5560 weekText: "Sm", 5561 weekStatus: "Semaine de l'année", 5562 dayStatus: "'Choisir' le DD d MM", 5563 defaultStatus: "Choisir la date", 5564 isRTL: !1, 5565 }; 5566 n.datepick.setDefaults(n.datepick.regionalOptions.fr); 5567 })(jQuery), 5568 (function (n) { 5569 n.datepick.regionalOptions.it = { 5570 monthNames: [ 5571 "Gennaio", 5572 "Febbraio", 5573 "Marzo", 5574 "Aprile", 5575 "Maggio", 5576 "Giugno", 5577 "Luglio", 5578 "Agosto", 5579 "Settembre", 5580 "Ottobre", 5581 "Novembre", 5582 "Dicembre", 5583 ], 5584 monthNamesShort: ["Gen", "Feb", "Mar", "Apr", "Mag", "Giu", "Lug", "Ago", "Set", "Ott", "Nov", "Dic"], 5585 dayNames: ["Domenica", "Lunedì", "Martedì", "Mercoledì", "Giovedì", "Venerdì", "Sabato"], 5586 dayNamesShort: ["Dom", "Lun", "Mar", "Mer", "Gio", "Ven", "Sab"], 5587 dayNamesMin: ["Do", "Lu", "Ma", "Me", "Gi", "Ve", "Sa"], 5588 dateFormat: "dd/mm/yyyy", 5589 firstDay: 1, 5590 renderer: n.datepick.defaultRenderer, 5591 prevText: "<Prec", 5592 prevStatus: "Mese precedente", 5593 prevJumpText: "<<", 5594 prevJumpStatus: "Mostra l'anno precedente", 5595 nextText: "Succ>", 5596 nextStatus: "Mese successivo", 5597 nextJumpText: ">>", 5598 nextJumpStatus: "Mostra l'anno successivo", 5599 currentText: "Oggi", 5600 currentStatus: "Mese corrente", 5601 todayText: "Oggi", 5602 todayStatus: "Mese corrente", 5603 clearText: "Svuota", 5604 clearStatus: "Annulla", 5605 closeText: "Chiudi", 5606 closeStatus: "Chiudere senza modificare", 5607 yearStatus: "Seleziona un altro anno", 5608 monthStatus: "Seleziona un altro mese", 5609 weekText: "Sm", 5610 weekStatus: "Settimana dell'anno", 5611 dayStatus: "'Seleziona' D, M d", 5612 defaultStatus: "Scegliere una data", 5613 isRTL: !1, 5614 }; 5615 n.datepick.setDefaults(n.datepick.regionalOptions.it); 5616 })(jQuery), 5617 (function (n) { 5618 n.datepick.regionalOptions.pl = { 5619 monthNames: [ 5620 "StyczeÅ", 5621 "Luty", 5622 "Marzec",
5623 "KwiecieÅ", 5624 "Maj", 5625 "Czerwiec", 5626 "Lipiec", 5627 "SierpieÅ", 5628 "WrzesieÅ", 5629 "Październik", 5630 "Listopad", 5631 "GrudzieÅ", 5632 ], 5633 monthNamesShort: ["Sty", "Lu", "Mar", "Kw", "Maj", "Cze", "Lip", "Sie", "Wrz", "Pa", "Lis", "Gru"], 5634 dayNames: ["Niedziela", "Poniedzialek", "Wtorek", "Åroda", "Czwartek", "PiÄ tek", "Sobota"], 5635 dayNamesShort: ["Nie", "Pn", "Wt", "År", "Czw", "Pt", "So"], 5636 dayNamesMin: ["N", "Pn", "Wt", "År", "Cz", "Pt", "So"], 5637 dateFormat: "yyyy-mm-dd", 5638 firstDay: 1, 5639 renderer: n.datepick.defaultRenderer, 5640 prevText: "<Poprzedni", 5641 prevStatus: "Pokaż poprzedni miesiÄ c", 5642 prevJumpText: "<<", 5643 prevJumpStatus: "", 5644 nextText: "NastÄpny>", 5645 nextStatus: "Pokaż nastÄpny miesiÄ c", 5646 nextJumpText: ">>", 5647 nextJumpStatus: "", 5648 currentText: "DziÅ", 5649 currentStatus: "Pokaż aktualny miesiÄ c", 5650 todayText: "DziÅ", 5651 todayStatus: "Pokaż aktualny miesiÄ c", 5652 clearText: "WyczyÅÄ", 5653 clearStatus: "WyczyÅÄ obecnÄ datÄ", 5654 closeText: "Zamknij", 5655 closeStatus: "Zamknij bez zapisywania", 5656 yearStatus: "Pokaż inny rok", 5657 monthStatus: "Pokaż inny miesiÄ c", 5658 weekText: "Tydz", 5659 weekStatus: "TydzieÅ roku", 5660 dayStatus: "'Wybierz' D, M d", 5661 defaultStatus: "Wybierz datÄ", 5662 isRTL: !1, 5663 }; 5664 n.datepick.setDefaults(n.datepick.regionalOptions.pl); 5665 })(jQuery), 5666 (function (n) { 5667 n.datepick.regionalOptions.pt = { 5668 monthNames: [ 5669 "Janeiro", 5670 "Fevereiro", 5671 "Março", 5672 "Abril", 5673 "Maio", 5674 "Junho", 5675 "Julho", 5676 "Agosto", 5677 "Setembro", 5678 "Outubro", 5679 "Novembro", 5680 "Dezembro", 5681 ], 5682 monthNamesShort: ["Jan", "Fev", "Mar", "Abr", "Mai", "Jun", "Jul", "Ago", "Set", "Out", "Nov", "Dez"], 5683 dayNames: [ 5684 "Domingo", 5685 "Segunda-feira", 5686 "Terça-feira", 5687 "Quarta-feira", 5688 "Quinta-feira", 5689 "Sexta-feira", 5690 "Sábado", 5691 ], 5692 dayNamesShort: ["Dom", "Seg", "Ter", "Qua", "Qui", "Sex", "Sáb"], 5693 dayNamesMin: ["D", "S", "T", "Q", "Q", "S", "S"], 5694 dateFormat: "dd/mm/yyyy", 5695 firstDay: 0, 5696 renderer: n.datepick.defaultRenderer, 5697 prevText: "<Anterior", 5698 prevStatus: "Mês anterior", 5699 prevJumpText: "<<", 5700 prevJumpStatus: "Ano anterior", 5701 nextText: "Próximo>", 5702 nextStatus: "Próximo mês", 5703 nextJumpText: ">>", 5704 nextJumpStatus: "Próximo ano", 5705 currentText: "Atual", 5706 currentStatus: "Mês atual", 5707 todayText: "Hoje", 5708 todayStatus: "Hoje", 5709 clearText: "Limpar", 5710 clearStatus: "Limpar data", 5711 closeText: "Fechar", 5712 closeStatus: "Fechar o calendário", 5713 yearStatus: "Selecionar ano", 5714 monthStatus: "Selecionar mês", 5715 weekText: "s", 5716 weekStatus: "Semana do ano", 5717 dayStatus: "DD, d 'de' M 'de' yyyy", 5718 defaultStatus: "Selecione um dia", 5719 isRTL: !1, 5720 }; 5721 n.datepick.setDefaults(n.datepick.regionalOptions.pt); 5722 })(jQuery), 5723 (function (n) { 5724 n.datepick.regionalOptions.ru = { 5725 monthNames: [ 5726 "ЯнваÑÑ", 5727 "ФевÑалÑ", 5728 "ÐаÑÑ", 5729 "ÐпÑелÑ", 5730 "Ðай", 5731 "ÐÑнÑ", 5732 "ÐÑлÑ", 5733 "ÐвгÑÑÑ", 5734 "СенÑÑбÑÑ", 5735 "ÐкÑÑбÑÑ", 5736 "ÐоÑбÑÑ", 5737 "ÐекабÑÑ", 5738 ], 5739 monthNamesShort: ["Янв", "Фев", "ÐаÑ", "ÐпÑ", "Ðай", "ÐÑн", "ÐÑл", "Ðвг", "Сен", "ÐкÑ", "ÐоÑ", "Ðек"], 5740 dayNames: ["воÑкÑеÑенÑе", "понеделÑник", "вÑоÑник", "ÑÑеда", "ÑеÑвеÑг", "пÑÑниÑа", "ÑÑббоÑа"], 5741 dayNamesShort: ["вÑк", "пнд", "вÑÑ", "ÑÑд", "ÑÑв", "пÑн", "ÑбÑ"], 5742 dayNamesMin: ["ÐÑ", "Ðн", "ÐÑ", "СÑ", "ЧÑ", "ÐÑ", "Сб"], 5743 dateFormat: "dd.mm.yyyy", 5744 firstDay: 1, 5745 renderer: n.datepick.defaultRenderer, 5746 prevText: "<ÐÑед", 5747 prevStatus: "", 5748 prevJumpText: "<<", 5749 prevJumpStatus: "", 5750 nextText: "След>", 5751 nextStatus: "", 5752 nextJumpText: ">>", 5753 nextJumpStatus: "", 5754 currentText: "СегоднÑ", 5755 currentStatus: "", 5756 todayText: "СегоднÑ", 5757 todayStatus: "", 5758 clearText: "ÐÑиÑÑиÑÑ", 5759 clearStatus: "", 5760 closeText: "ÐакÑÑÑÑ", 5761 closeStatus: "", 5762 yearStatus: "", 5763 monthStatus: "", 5764 weekText: "Ðе", 5765 weekStatus: "", 5766 dayStatus: "D, M d", 5767 defaultStatus: "", 5768 isRTL: !1, 5769 }; 5770 n.datepick.setDefaults(n.datepick.regionalOptions.ru); 5771 })(jQuery), 5772 (function (n) { 5773 n.datepick.regionalOptions.sk = { 5774 monthNames: [ 5775 "Január", 5776 "Február", 5777 "Marec", 5778 "AprÃl", 5779 "Máj", 5780 "Jún", 5781 "Júl", 5782 "August", 5783 "September", 5784 "Október", 5785 "November", 5786 "December", 5787 ], 5788 monthNamesShort: ["Jan", "Feb", "Mar", "Apr", "Máj", "Jún", "Júl", "Aug", "Sep", "Okt", "Nov", "Dec"], 5789 dayNames: ["Nedel'a", "Pondelok", "Utorok", "Streda", "Å tvrtok", "Piatok", "Sobota"], 5790 dayNamesShort: ["Ned", "Pon", "Uto", "Str", "Å tv", "Pia", "Sob"], 5791 dayNamesMin: ["Ne", "Po", "Ut", "St", "Å t", "Pia", "So"], 5792 dateFormat: "dd.mm.yyyy", 5793 firstDay: 0, 5794 renderer: n.datepick.defaultRenderer, 5795 prevText: "<Predchádzajúci", 5796 prevStatus: "", 5797 prevJumpText: "<<", 5798 prevJumpStatus: "", 5799 nextText: "Nasledujúci>", 5800 nextStatus: "", 5801 nextJumpText: ">>", 5802 nextJumpStatus: "", 5803 currentText: "Dnes", 5804 currentStatus: "", 5805 todayText: "Dnes", 5806 todayStatus: "", 5807 clearText: "ZmazaÅ¥", 5808 clearStatus: "", 5809 closeText: "ZavrieÅ¥", 5810 closeStatus: "", 5811 yearStatus: "", 5812 monthStatus: "", 5813 weekText: "Ty", 5814 weekStatus: "", 5815 dayStatus: "D, M d", 5816 defaultStatus: "", 5817 isRTL: !1, 5818 }; 5819 n.datepick.setDefaults(n.datepick.regionalOptions.sk); 5820 })(jQuery), 5821 (function (n) { 5822 n.datepick.regionalOptions.sq = { 5823 monthNames: [ 5824 "Janar", 5825 "Shkurt", 5826 "Mars", 5827 "Prill", 5828 "Maj", 5829 "Qershor", 5830 "Korrik", 5831 "Gusht", 5832 "Shtator", 5833 "Tetor", 5834 "Nëntor", 5835 "Dhjetor", 5836 ], 5837 monthNamesShort: ["Jan", "Shk", "Mar", "Pri", "Maj", "Qer", "Kor", "Gus", "Sht", "Tet", "Nën", "Dhj"], 5838 dayNames: ["E Diel", "E Hënë", "E Martë", "E Mërkurë", "E Enjte", "E Premte", "E Shtune"], 5839 dayNamesShort: ["Di", "Hë", "Ma", "Më", "En", "Pr", "Sh"], 5840 dayNamesMin: ["Di", "Hë", "Ma", "Më", "En", "Pr", "Sh"], 5841 dateFormat: "dd.mm.yyyy", 5842 firstDay: 1, 5843 renderer: n.datepick.defaultRenderer, 5844 prevText: "<mbrapa", 5845 prevStatus: "trego muajin e fundit", 5846 prevJumpText: "<<", 5847 prevJumpStatus: "", 5848 nextText: "Përpara>", 5849 nextStatus: "trego muajin tjetër", 5850 nextJumpText: ">>", 5851 nextJumpStatus: "", 5852 currentText: "sot", 5853 currentStatus: "", 5854 todayText: "sot", 5855 todayStatus: "", 5856 clearText: "fshije", 5857 clearStatus: "fshije datën aktuale", 5858 closeText: "mbylle", 5859 closeStatus: "mbylle pa ndryshime", 5860 yearStatus: "trego tjetër vit", 5861 monthStatus: "trego muajin tjetër", 5862 weekText: "Ja", 5863 weekStatus: "Java e muajit", 5864 dayStatus: "'Zgjedh' D, M d", 5865 defaultStatus: "Zgjedhe një datë", 5866 isRTL: !1, 5867 }; 5868 n.datepick.setDefaults(n.datepick.regionalOptions.sq); 5869 })(jQuery), 5870 (function (n) { 5871 n.datepick.regionalOptions.nl = { 5872 monthNames: [ 5873 "januari", 5874 "februari", 5875 "maart", 5876 "april", 5877 "mei", 5878 "juni", 5879 "juli", 5880 "augustus", 5881 "september", 5882 "oktober", 5883 "november", 5884 "december", 5885 ], 5886 monthNamesShort: ["jan", "feb", "maa", "apr", "mei", "jun", "jul", "aug", "sep", "okt", "nov", "dec"], 5887 dayNames: ["zondag", "maandag", "dinsdag", "woensdag", "donderdag", "vrijdag", "zaterdag"], 5888 dayNamesShort: ["zon", "maa", "din", "woe", "don", "vri", "zat"], 5889 dayNamesMin: ["zo", "ma", "di", "wo", "do", "vr", "za"], 5890 dateFormat: "dd-mm-yyyy", 5891 firstDay: 1, 5892 renderer: n.datepick.defaultRenderer, 5893 prevText: "â", 5894 prevStatus: "Bekijk de vorige maand", 5895 prevJumpText: "«", 5896 prevJumpStatus: "Bekijk het vorige jaar", 5897 nextText: "â", 5898 nextStatus: "Bekijk de volgende maand", 5899 nextJumpText: "»", 5900 nextJumpStatus: "Bekijk het volgende jaar", 5901 currentText: "Vandaag", 5902 currentStatus: "Bekijk de huidige maand", 5903 todayText: "Vandaag", 5904 todayStatus: "Bekijk de huidige maand", 5905 clearText: "Wissen", 5906 clearStatus: "Wis de huidige datum", 5907 closeText: "Sluiten", 5908 closeStatus: "Sluit zonder verandering", 5909 yearStatus: "Bekijk een ander jaar", 5910 monthStatus: "Bekijk een andere maand", 5911 weekText: "Wk", 5912 weekStatus: "Week van het jaar", 5913 dayStatus: "dd-mm-yyyy", 5914 defaultStatus: "Kies een datum", 5915 isRTL: !1, 5916 }; 5917 n.datepick.setDefaults(n.datepick.regionalOptions.nl); 5918 })(jQuery), 5919 (function (n) { 5920 n.datepick.regionalOptions.no = { 5921 monthNames: [ 5922 "Januar", 5923 "Februar", 5924 "Mars", 5925 "April", 5926 "Mai", 5927 "Juni", 5928 "Juli", 5929 "August", 5930 "September", 5931 "Oktober", 5932 "November", 5933 "Desember", 5934 ], 5935 monthNamesShort: ["Jan", "Feb", "Mar", "Apr", "Mai", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "De
5935s"], 5936 dayNamesShort: ["Søn", "Man", "Tir", "Ons", "Tor", "Fre", "Lør"], 5937 dayNames: ["Søndag", "Mandag", "Tirsdag", "Onsdag", "Torsdag", "Fredag", "Lørdag"], 5938 dayNamesMin: ["Sø", "Ma", "Ti", "On", "To", "Fr", "Lø"], 5939 dateFormat: "dd.mm.yyyy", 5940 firstDay: 1, 5941 renderer: n.datepick.defaultRenderer, 5942 prevText: "«Forrige", 5943 prevStatus: "", 5944 prevJumpText: "<<", 5945 prevJumpStatus: "", 5946 nextText: "Neste»", 5947 nextStatus: "", 5948 nextJumpText: ">>", 5949 nextJumpStatus: "", 5950 currentText: "I dag", 5951 currentStatus: "", 5952 todayText: "I dag", 5953 todayStatus: "", 5954 clearText: "Tøm", 5955 clearStatus: "", 5956 closeText: "Lukk", 5957 closeStatus: "", 5958 yearStatus: "", 5959 monthStatus: "", 5960 weekText: "Uke", 5961 weekStatus: "", 5962 dayStatus: "D, M d", 5963 defaultStatus: "", 5964 isRTL: !1, 5965 }; 5966 n.datepick.setDefaults(n.datepick.regionalOptions.no); 5967 })(jQuery), 5968 (function (n) { 5969 n.datepick.regionalOptions.sv = { 5970 monthNames: [ 5971 "Januari", 5972 "Februari", 5973 "Mars", 5974 "April", 5975 "Maj", 5976 "Juni", 5977 "Juli", 5978 "Augusti", 5979 "September", 5980 "Oktober", 5981 "November", 5982 "December", 5983 ], 5984 monthNamesShort: ["Jan", "Feb", "Mar", "Apr", "Maj", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Dec"], 5985 dayNames: ["Söndag", "MÃ¥ndag", "Tisdag", "Onsdag", "Torsdag", "Fredag", "Lördag"], 5986 dayNamesShort: ["Sön", "MÃ¥n", "Tis", "Ons", "Tor", "Fre", "Lör"], 5987 dayNamesMin: ["Sö", "MÃ¥", "Ti", "On", "To", "Fr", "Lö"], 5988 dateFormat: "yyyy-mm-dd", 5989 firstDay: 1, 5990 renderer: n.datepick.defaultRenderer, 5991 prevText: "«Förra", 5992 prevStatus: "", 5993 prevJumpText: "<<", 5994 prevJumpStatus: "", 5995 nextText: "Nästa»", 5996 nextStatus: "", 5997 nextJumpText: ">>", 5998 nextJumpStatus: "", 5999 currentText: "Idag", 6000 currentStatus: "", 6001 todayText: "Idag", 6002 todayStatus: "", 6003 clearText: "Rensa", 6004 clearStatus: "", 6005 closeText: "Stäng", 6006 closeStatus: "", 6007 yearStatus: "", 6008 monthStatus: "", 6009 weekText: "Ve", 6010 weekStatus: "", 6011 dayStatus: "D, M d", 6012 defaultStatus: "", 6013 isRTL: !1, 6014 }; 6015 n.datepick.setDefaults(n.datepick.regionalOptions.sv); 6016 })(jQuery), 6017 (function (n) { 6018 n.datepick.regionalOptions.en = { 6019 monthNames: [ 6020 "January", 6021 "February", 6022 "March", 6023 "April", 6024 "May", 6025 "June", 6026 "July", 6027 "August", 6028 "September", 6029 "October", 6030 "November", 6031 "December", 6032 ], 6033 monthNamesShort: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], 6034 dayNames: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], 6035 dayNamesShort: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], 6036 dayNamesMin: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"], 6037 dateFormat: "dd/mm/yyyy", 6038 firstDay: 1, 6039 renderer: n.datepick.defaultRenderer, 6040 prevText: "Prev", 6041 prevStatus: "Show the previous month", 6042 prevJumpText: "<<", 6043 prevJumpStatus: "Show the previous year", 6044 nextText: "Next", 6045 nextStatus: "Show the next month", 6046 nextJumpText: ">>", 6047 nextJumpStatus: "Show the next year", 6048 currentText: "Current", 6049 currentStatus: "Show the current month", 6050 todayText: "Today", 6051 todayStatus: "Show today's month", 6052 clearText: "Clear", 6053 clearStatus: "Erase the current date", 6054 closeText: "Done", 6055 closeStatus: "Close without change", 6056 yearStatus: "Show a different year", 6057 monthStatus: "Show a different month", 6058 weekText: "Wk", 6059 weekStatus: "Week of the year", 6060 dayStatus: "Select DD, M d", 6061 defaultStatus: "Select a date", 6062 isRTL: !1, 6063 }; 6064 n.datepick.setDefaults(n.datepick.regionalOptions["en-GB"]); 6065 })(jQuery), 6066 (function (n) { 6067 n.datepick.regionalOptions["en-US"] = { 6068 monthNames: [ 6069 "January", 6070 "February", 6071 "March", 6072 "April", 6073 "May", 6074 "June", 6075 "July", 6076 "August", 6077 "September", 6078 "October", 6079 "November", 6080 "December", 6081 ], 6082 monthNamesShort: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], 6083 dayNames: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], 6084 dayNamesShort: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], 6085 dayNamesMin: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"], 6086 dateFormat: "dd MM yyyy", 6087 firstDay: 1, 6088 renderer: n.datepick.defaultRenderer, 6089 prevText: "Prev", 6090 prevStatus: "Show the previous month", 6091 prevJumpText: "<<", 6092 prevJumpStatus: "Show the previous year", 6093 nextText: "Next", 6094 nextStatus: "Show the next month", 6095 nextJumpText: ">>", 6096 nextJumpStatus: "Show the next year", 6097 currentText: "Current", 6098 currentStatus: "Show the current month", 6099 todayText: "Today", 6100 todayStatus: "Show today's month", 6101 clearText: "Clear", 6102 clearStatus: "Erase the current date", 6103 closeText: "Done", 6104 closeStatus: "Close without change", 6105 yearStatus: "Show a different year", 6106 monthStatus: "Show a different month", 6107 weekText: "Wk", 6108 weekStatus: "Week of the year", 6109 dayStatus: "Select DD, M d", 6110 defaultStatus: "Select a date", 6111 isRTL: !1, 6112 }; 6113 n.datepick.setDefaults(n.datepick.regionalOptions["en-US"]); 6114 })(jQuery); 6115IBE.Models.BookingProcess = function (n) { 6116 var t = this; 6117 ko.utils.extend(t, new IBE.ViewModels.CurrenciesPartialViewModel(t)); 6118 ko.utils.extend(t, new IBE.ViewModels.Taxes(t)); 6119 (typeof n == "undefined" || n == null) && (n = {}); 6120 t.checkIn = ko.assignObservable(n.checkIn); 6121 t.checkOut = ko.assignObservable(n.checkOut); 6122 t.couponCode = ko.assignObservable(n.couponCode, ""); 6123 t.travelAgencyID = ko.assignObservable(n.travelAgencyID, ""); 6124 t.travelAgencyName = ko.assignObservable(n.travelAgencyName, ""); 6125 t.rooms = ko.assignObservableArray(n.rooms); 6126 t.supplements = ko.observableArray([]); 6127 n.supplements && ko.utils.arrayPushAll(t.supplements, n.supplements); 6128 t.cost = ko.assignObservable(n.cost, 0); 6129 t.costWithoutDiscount = ko.assignObservable(n.costWithoutDiscount, 0); 6130 t.advancePayment = ko.assignObservable(n.advancePayment, 0); 6131 t.tax = ko.assignObservable(n.tax); 6132 t.reservationStatus = ko.assignObservable(n.reservationStatus); 6133 t.currency = ko.assignObservable(n.currency); 6134 t.id = ko.assignObservable(n.Id, ""); 6135 t.isOnline = ko.assignObservable(n.isOnline, !1); 6136 t.cancellationPolicy = ko.assignObservable(n.cancellationPolicy, ""); 6137 t.reservationCancellationRules = ko.observableArray(n.reservationCancellationRules || []); 6138 t.paymentPolicy = ko.assignObservable(n.paymentPolicy, ""); 6139 t.paymentPolicyHotelTextOption = ko.assignObservable(n.paymentPolicyHotelTextOption, "Unknown"); 6140 t.payments = ko.observableArray(); 6141 t.timePolicy = ko.assignObservableArray(n.timePolicy, ""); 6142 t.customer = ko.assignObservable(n.customer); 6143 t.nights = ko.computed({ 6144 read: function () { 6145 return t.checkOut().diff(t.checkIn(), "days"); 6146 }, 6147 deferEvaluation: !0, 6148 }); 6149 t.totalGuests = ko.observable(n.totalGuests || 0); 6150 t.lang = ko.assignObservable(n.lang); 6151 t.roomsCost = ko.computed({ 6152 read: function () { 6153 var n = 0; 6154 return ( 6155 ko.utils.arrayForEach(t.rooms(), function (t) { 6156 n += t.cost(); 6157 }), 6158 n 6159 ); 6160 }, 6161 deferEvaluation: !0, 6162 }); 6163 t.supplementsCost = ko.computed({ 6164 read: function () { 6165 var n = 0; 6166 return ( 6167 ko.utils.arrayForEach(t.supplements(), function (t) { 6168 t.isSurcharge || (n += t.totalPrice()); 6169 }), 6170 n 6171 ); 6172 }, 6173 deferEvaluation: !0, 6174 }); 6175 t.totalCost = ko.computed({ 6176 read: function () { 6177 var n = 0; 6178 return (n += t.roomsCost()), n + t.supplementsCost(); 6179 }, 6180 deferEvaluation: !0, 6181 }); 6182 t.roomsCostWithoutDiscount = ko.computed({ 6183 read: function () { 6184 var n = 0; 6185 return ( 6186 ko.utils.arrayForEach(t.rooms(), function (t) { 6187 n += t.costWithoutDiscount(); 6188 }), 6189 n 6190 ); 6191 }, 6192 deferEvaluation: !0, 6193 }); 6194 t.supplementsCostWithoutDiscount = ko.computed({ 6195 read: function () { 6196 var n = 0; 6197 return ( 6198 ko.utils.arrayForEach(t.supplements(), function (t) { 6199 t.isSurcharge || (n += t.totalPriceWithoutDiscount()); 6200 }), 6201 n 6202 ); 6203 }, 6204 deferEvaluation: !0, 6205 }); 6206 t.paymentMethodType = ko.observable(n.paymentMethod); 6207 t.totalCostWithoutDiscount = ko.computed({ 6208 read: function () { 6209 var n = 0; 6210 return (n += t.roomsCostWithoutDiscount()), n + t.supplementsCostWithoutDiscount(); 6211 }, 6212 deferEvaluation: !0, 6213 }); 6214 t.paymentRules = ko.computed({ 6215 read: function () { 6216 var n = [], 6217 s, 6218 e, 6219 a, 6220 v, 6221 h, 6222 u, 6223 c; 6224 if (t.payments().length === 0) return n; 6225 var i = 0, 6226 o = t.checkIn(), 6227 l = t.checkOut(), 6228 f = moment().startOf("day"), 6229 r = t.totalCost(); 6230 if ( 6231 (options || 6232 (options = 6233 t.currency() === "CZK" 6234 ? { precision: 2, symbol: t.currency(), thousand: " ", decimal
6234: ",", format: "%v %s" } 6235 : { precision: 2, symbol: t.currency(), thousand: ",", decimal: ".", format: "%v %s" }), 6236 typeof t.lang != "undefined" && t.lang !== "") 6237 ) { 6238 s = Intl.NumberFormat(t.lang(), { style: "currency", currency: t.currency(), currencyDisplay: "code" }); 6239 s.formatToParts 6240 ? ((e = s.formatToParts(1.1)), 6241 typeof e.find((n) => n.type === "decimal") != "undefined" && 6242 e.find((n) => n.type === "decimal") !== null && 6243 (options.decimal = e.find((n) => n.type === "decimal").value)) 6244 : (options.decimal = (1.1).toLocaleString(t.lang()).replace(/1/g, "")); 6245 switch (options.decimal) { 6246 case ".": 6247 options.thousand = ","; 6248 break; 6249 case ",": 6250 options.thousand = "."; 6251 break; 6252 default: 6253 options.thousand = ","; 6254 } 6255 t.currency() === "CZK" && ((options.thousand = " "), (options.decimal = ",")); 6256 a = ko.utils.arrayFirst(t.currencies().rates, function (n) { 6257 return n.code == t.currency(); 6258 }); 6259 switch (a.positivePattern) { 6260 case "SymbolAlignLeft": 6261 options.format = "%s%v"; 6262 break; 6263 case "SymbolAlignRight": 6264 options.format = "%v%s"; 6265 break; 6266 case "SymbolAlignLeftWithSpace": 6267 options.format = "%s %v"; 6268 break; 6269 case "SymbolAlignRightWithSpace": 6270 options.format = "%v %s"; 6271 break; 6272 default: 6273 options.format = "%s%v"; 6274 } 6275 } 6276 if ( 6277 (ko.utils.arrayForEach(t.payments(), function (i) { 6278 var u = ko.toJS(i); 6279 u.amountCurrency = t.getRateText(u.amount, t.currency(), options); 6280 n.push(u); 6281 r -= i.amount; 6282 }), 6283 (v = { day: "numeric", month: "long", year: "numeric" }), 6284 r > 0) 6285 ) { 6286 for ( 6287 i = n.length - 1, 6288 n[i].paymentDate === o.format("YYYY-MM-DD") || n[i].paymentDate === l.format("YYYY-MM-DD") 6289 ? ((n[i].amount += r), 6290 (n[i].amountCurrency = t.getRateText(n[i].amount, t.currency(), options))) 6291 : n.push({ 6292 amount: r, 6293 paymentDate: o.format("YYYY-MM-DD"), 6294 amountCurrency: t.getRateText(r, t.currency(), options), 6295 }), 6296 h = !1, 6297 i = 0; 6298 i < n.length; 6299 i++ 6300 ) 6301 if (f.diff(n[i].paymentDate, "days") === 0) { 6302 h = !0; 6303 break; 6304 } 6305 h || 6306 n.unshift({ 6307 paymentDate: f.format("YYYY-MM-DD"), 6308 amount: 0, 6309 amountCurrency: t.getRateText(0, t.currency(), options), 6310 text: IBE.Utils.translate("noAdvancePayment"), 6311 }); 6312 } 6313 return ( 6314 (u = ko.utils.arrayFirst(t.reservationCancellationRules(), function (n) { 6315 return IBE.Utils.dateIsoFormat(f) <= n.cancelBefore; 6316 })), 6317 (c = 0), 6318 ko.utils.arrayForEach(n, function (n) { 6319 var e = moment(n.paymentDate), 6320 r = IBE.Utils.dateIsoFormat(e), 6321 i = n.amount; 6322 if (IBE.Utils.dateIsoFormat(f) === r && c === 0) { 6323 i > 0 6324 ? ((n.text = IBE.Utils.translate("paymentRuleAdvancePayment").format(n.amountCurrency)), 6325 (c = i), 6326 u !== null && 6327 u.cancelAmount !== 0 && 6328 (n.text = 6329 u.cancelAmount >= i 6330 ? n.text + " " + IBE.Utils.translate("cancellationRuleNonRefundable") 6331 : n.text + 6332 " " + 6333 IBE.Utils.translate("cancellationRuleNonRefundableWithAmount").format( 6334 t.getRateText(u.cancelAmount, t.currency(), options) 6335 ))) 6336 : (n.text = IBE.Utils.translate("noAdvancePayment")); 6337 return; 6338 } 6339 if (IBE.Utils.dateIsoFormat(o) === r && i > 0) { 6340 n.text = IBE.Utils.translate("paymentRulePayUponCheckIn").format(n.amountCurrency); 6341 return; 6342 } 6343 if (IBE.Utils.dateIsoFormat(l) === r && i > 0) { 6344 n.text = IBE.Utils.translate("paymentRulePayUponCheckOut").format(n.amountCurrency); 6345 return; 6346 } 6347 if (i > 0) { 6348 n.text = IBE.Utils.translate("paymentRulePayOnDate").format( 6349 n.amountCurrency, 6350 e.toDate().toLocaleDateString(t.lang(), v) 6351 ); 6352 return; 6353 } 6354 }), 6355 n 6356 ); 6357 }, 6358 deferEvaluation: !0, 6359 }); 6360 t.paymentText = ko.computed({ 6361 read: function () { 6362 var n = ""; 6363 ko.utils.arrayForEach(t.paymentRules(), function (t) { 6364 t.text && t.text !== "" && (n += "<li>" + t.text + "</li>"); 6365 }); 6366 switch (t.paymentPolicyHotelTextOption()) { 6367 case "Append": 6368 return n + "<p>" + t.paymentPolicy() + "</p>"; 6369 case "Replace": 6370 return t.paymentPolicy(); 6371 default: 6372 return n; 6373 } 6374 }, 6375 deferEvaluation: !0, 6376 }); 6377 t.timePolicyText = ko.computed({ 6378 read: function () { 6379 var n = ""; 6380 return IBE.Config.ibeTimePolicy 6381 ? (ko.utils.arrayForEach(t.timePolicy(), function (t) { 6382 t && t !== "" && (n += "<li>" + t + "</li>"); 6383 }), 6384 (n = n.replace("Check-In", IBE.Utils.translate("checkIn"))), 6385 (n = n.replace("Check-Out", IBE.Utils.translate("checkOut"))), 6386 (n = n.replace("From", IBE.Utils.translate("from"))), 6387 (n = n.replace("From", IBE.Utils.translate("from"))), 6388 (n = n.replace("to", IBE.Utils.translate("to"))), 6389 (n = n.replace("to", IBE.Utils.translate("to")))) 6390 : n; 6391 }, 6392 deferEvaluation: !0, 6393 }); 6394 t.isValidStay = ko.pureComputed({ 6395 read: function () { 6396 return isNaN(t.nights()) || t.nights() <= 0 ? !1 : !0; 6397 }, 6398 }); 6399 t.bookingProcessPostData = function () { 6400 var n = { 6401 checkIn: t.checkIn().format("YYYY-MM-DD"), 6402 checkOut: t.checkOut().format("YYYY-MM-DD"), 6403 couponCode: t.couponCode(), 6404 travelAgencyID: t.travelAgencyID(), 6405 travelAgencyName: t.travelAgencyName(), 6406 ipAddress: null, 6407 notes: "", 6408 customer: t.customer(), 6409 rooms: [], 6410 supplements: [], 6411 referrer: new IBE.Models.Referrer(), 6412 }; 6413 return ( 6414 Cache.read("ref", "localstorage") && (n.referrer = Cache.read("ref", "localstorage")), 6415 typeof t.customer() != "undefined" && (n.notes = t.customer().notes()), 6416 ko.utils.arrayForEach(t.rooms(), function (t) { 6417 var i = { 6418 availability: ko.unwrap(t.availability), 6419 boardType: ko.unwrap(t.boardType), 6420 ratePlanId: ko.unwrap(t.ratePlanId), 6421 roomId: ko.unwrap(t.roomId), 6422 roomIndex: ko.unwrap(t.roomIndex), 6423 guestTypes: [], 6424 }; 6425 ko.utils.arrayForEach(ko.unwrap(t.guestTypes), function (n) { 6426 i.guestTypes.push({ 6427 ageCategory: ko.unwrap(n.ageCategory), 6428 fromAge: ko.unwrap(n.fromAge), 6429 pax: ko.unwrap(n.pax), 6430 }); 6431 }); 6432 n.rooms.push(i); 6433 }), 6434 ko.utils.arrayForEach(t.supplements(), function (t) { 6435 ko.utils.arrayForEach(t.prices(), function (i) { 6436 if (i.quantity() > 0) {
6437 IBE.Config.supplementPricingType[t.pricingType()] !== 6438 IBE.Config.supplementPricingType.PerGuest && (i.guestType = 0); 6439 var r = { 6440 roomIndex: t.roomIndex(), 6441 supplementId: t.supplementId(), 6442 quantity: i.quantity(), 6443 isMandatory: t.isMandatory, 6444 isSurcharge: t.isSurcharge, 6445 pricingType: t.supplementPricingType, 6446 guestType: i.guestType, 6447 ratePlanId: t.ratePlanId(), 6448 }; 6449 n.supplements.push(r); 6450 } 6451 }); 6452 }), 6453 n 6454 ); 6455 }; 6456 $.when(t.currenciesPartialInit()).then(function () {}); 6457}; 6458IBE.ViewModels.Contact = function () { 6459 var n = this; 6460 n.events = new ko.subscribable(); 6461 n.ready = ko.observable(!1); 6462 ko.utils.extend(n, new IBE.ViewModels.LanguagePartialViewModel(n)); 6463 ko.utils.extend(n, new IBE.ViewModels.CurrenciesPartialViewModel(n)); 6464 ko.utils.extend(n, new IBE.ViewModels.Message()); 6465 ko.utils.extend(n, new IBE.Models.Contact()); 6466 n.errors = ko.validation.group(n); 6467 n.submit = function () { 6468 if ((n.clearMessage(), n.errors().length > 0)) return n.errors.showAllMessages(), !1; 6469 n.ready(!1); 6470 n.events.notifySubscribers(!1, "ready"); 6471 var t = { 6472 message: 6473 "Sender: " + 6474 n.firstName() + 6475 " " + 6476 n.lastName() + 6477 ", <em>" + 6478 n.email() + 6479 "</em><br /><p>" + 6480 n.text() + 6481 "</p>", 6482 subject: n.subject(), 6483 }; 6484 $.ajax({ 6485 type: "POST", 6486 data: t, 6487 url: IBE.Config.apiBaseUrl + "/system/sendmail/?apikey=" + IBE.Config.apiKey, 6488 success: function () { 6489 n.clearMessage(); 6490 var t = { id: 200, severity: "success", text: IBE.Utils.translate("contactSendSuccess") }; 6491 n.message(t); 6492 ko.utils.extend(n, new IBE.Models.Contact()); 6493 n.ready(!0); 6494 n.events.notifySubscribers(!0, "ready"); 6495 }, 6496 error: function (t) { 6497 n.clearMessage(); 6498 var i = { id: t.status, severity: "error", text: IBE.Utils.translate("contactSendFailed") }; 6499 n.message(i); 6500 n.ready(!0); 6501 n.events.notifySubscribers(!0, "ready"); 6502 }, 6503 }); 6504 }; 6505 n.init = function () { 6506 n.clearMessage(); 6507 n.ready(!0); 6508 n.events.notifySubscribers(!0, "ready"); 6509 }; 6510}; 6511IBE.ViewModels.CurrenciesPartialViewModel = function (n) { 6512 function t(t) { 6513 if (t.length === 0) return !1; 6514 var i = new IBE.Models.Currencies(); 6515 return ( 6516 (i.base = t[0].base), 6517 ko.utils.arrayForEach(t, function (n) { 6518 n.Name !== "ERR" && i.rates.push(new IBE.Models.CurrencyRate(n)); 6519 }), 6520 n.currencies(i), 6521 typeof n.currency() == "undefined" && n.currency(n.baseCurrency), 6522 !0 6523 ); 6524 } 6525 n.baseCurrency = IBE.Config.currency; 6526 n.currency = ko.observable(); 6527 n.currencies = ko.observableArray([]); 6528 n.isDifferentCurrency = ko 6529 .computed({ 6530 read: function () { 6531 return !(n.currency() === n.baseCurrency); 6532 }, 6533 deferEvaluation: !0, 6534 }) 6535 .extend({ notify: "always" }); 6536 n.calculateRate = function (t, i) { 6537 var r, u; 6538 if (n.currencies().length === 0) return !1; 6539 r = 1; 6540 try { 6541 n.currencies().base !== n.baseCurrency && 6542 (r = ko.utils.arrayFirst(n.currencies().rates, function (t) { 6543 return t.code == n.baseCurrency; 6544 }).rate); 6545 } catch (f) { 6546 r = 1; 6547 } 6548 u = 1; 6549 try { 6550 u = ko.utils.arrayFirst(n.currencies().rates, function (n) { 6551 return n.code == t; 6552 }).rate; 6553 } catch (f) { 6554 u = 1; 6555 } 6556 return r == 1 && u == 1 ? (n.currency(n.baseCurrency), i) : (u / r) * i; 6557 }; 6558 n.getRateText = function (t, i, r) { 6559 var u = i, 6560 f; 6561 return (
6562 n.currencies().rates.forEach(function (n) { 6563 if (n.code == i) { 6564 u = n.symbol; 6565 return; 6566 } 6567 }), 6568 (f = r), 6569 r || 6570 (f = 6571 u === "CZK" 6572 ? { precision: 2, symbol: u, thousand: " ", decimal: ",", format: "%v %s" } 6573 : { precision: 2, symbol: u, format: "%v %s" }), 6574 accounting.formatMoney(n.calculateRate(i, t), f) 6575 ); 6576 }; 6577 n.currenciesPartialInit = function () { 6578 return ( 6579 $.when(IBE.Utils.loadExchangeRates()).then(function (n) { 6580 n && t(n); 6581 }), 6582 $.when(IBE.Utils.loadExchangeRates()) 6583 ); 6584 }; 6585 var i = function (n) { 6586 n && t(n); 6587 }; 6588 $.when(IBE.Utils.loadExchangeRates()).then(i); 6589}; 6590IBE.ViewModels.CustomerPartialViewModel = function (n) { 6591 var t = this; 6592 ko.utils.extend(t, new IBE.Models.Customer(n)); 6593 t.paymentReceipt = ko.observable(""); 6594 t.paymentReceiptOptions = ko.observableArray([ 6595 { name: "personalInvoice", text: IBE.Utils.translate("personalInvoice") }, 6596 { name: "companyInvoice", text: IBE.Utils.translate("companyInvoice") }, 6597 ]); 6598 t.notes = ko.observable(""); 6599 t.flightNumber = ko.observable(""); 6600 t.arrivalTime = ko.observable(""); 6601 t.travelAgencyID = ko.observable(""); 6602 t.travelAgencyName = ko.observable(""); 6603 t.arrivalTimeOptions = ko.computed(function () { 6604 for (var i, t, r, u = [{ name: "", value: "" }], n = 0; n < 24; n++) 6605 for (i = n, n < 10 && (i = "0" + n), t = 0; t < 2; t++) 6606 (r = t === 0 ? "0" + t : "30"), u.push({ name: i + ":" + r, value: i + ":" + r }); 6607 return u; 6608 }); 6609 t.creditCard = ko.observable(new IBE.Models.CreditCard()); 6610 t.company = ko.observable(new IBE.Models.Company()); 6611 t.errors = ko.observable({ customer: ko.validation.group(t), creditCard: ko.validation.group(t.creditCard) }); 6612}; 6613IBE.ViewModels.ExternalPaymentGateway = function (n, t, i) { 6614 var r = this; 6615 r.hostInstance = ""; 6616 r.stripeInstance = ""; 6617 r.stripeCard = ""; 6618 r.stripeClientSecret = ""; 6619 r.events = new ko.subscribable(); 6620 ko.utils.extend(r, new IBE.ViewModels.Message()); 6621 r.ready = ko.observable(!1); 6622 r.gateway = ko.observable(""); 6623 r.paymentToken = ko.observable(""); 6624 r.externalPaymentGatewayData = ko.observable(""); 6625 r.redirectPaymentGatewayData = ko.observableArray([]); 6626 r.externalPaymentGatewayMessage = ko.observable(""); 6627 r.externalPaymentGatewayErrors = ko.observable(!1); 6628 r.notStoreCreditCard = ko.observable(!1); 6629 r.sixSelectedPaymentMeans = ko.observable("PaymentPage"); 6630 r.sixAcceptedCardsForFields = ko.observableArray([]); 6631 r.sixPaymentChoices = ko.observableArray([]); 6632 r.paymentMethod = ko.observable(""); 6633 r.paymentMethod.subscribe(function (n) { 6634 r.externalPaymentGatewayData(n); 6635 }); 6636 r.init = function () { 6637 r.gateway(t); 6638 switch (t) { 6639 case "Braintree": 6640 if (i === "" || typeof i == "undefined") return; 6641 r.paymentToken(i); 6642 break; 6643 case "AlphaBankRedirect": 6644 break; 6645 case "Omise": 6646 if (typeof Omise == "undefined") return; 6647 Omise.setPublicKey(i); 6648 break; 6649 case "AuthorizeNet": 6650 if (i === "" || typeof i == "undefined") return; 6651 r.paymentToken(i); 6652 break; 6653 case "Stripe": 6654 if (i === "" || typeof i == "undefined") return; 6655 r.paymentToken(i); 6656 r.initStripe(); 6657 break; 6658 case "Six": 6659 if (i === "" || typeof i == "undefined") return; 6660 r.sixAcceptedCardsForFields(r.getSixAcceptedCards(n.externalPaymentGatewaySupportedPaymentMethods())); 6661 r.externalPaymentGatewayData(i); 6662 break; 6663 case "Payout": 6664 if (i === "" || typeof i == "undefined") return; 6665 r.externalPaymentGatewayData(i); 6666 break; 6667 case "Selfbook": 6668 if (i === "" || typeof i == "undefined") return; 6669 r.externalPaymentGatewayData(i); 6670 r.initSelfbook(); 6671 break; 6672 default: 6673 return; 6674 } 6675 }; 6676 r.paymentToken.subscribe(function (n) { 6677 n && r.paymentToken && r.initBraintree(); 6678 }); 6679 r.initBraintree = function () { 6680 var n = r.paymentToken(); 6681 typeof braintree != "undefined" && 6682 braintree.client.create({ authorization: n, threeDSecure: !0 }, function (n, t) { 6683 n || 6684 (braintree.hostedFields.create( 6685 { 6686 client: t, 6687 styles: { "input.invalid": { color: "red" }, "input.valid": { color: "green" } }, 6688 fields: { 6689 number: { selector: "#card-number", placeholder: "4111 1111 1111 1111" }, 6690 cvv: { selector: "#cvv", placeholder: "123" }, 6691 expirationDate: { 6692 selector: "#expiration-date", 6693 placeholder: moment(new Date()).format("MM/YY"), 6694 }, 6695 }, 6696 }, 6697 function (n, t) { 6698 if (((r.hostInstance = t), n)) { 6699 r.externalPaymentGatewayErrors(!0); 6700 r.events.notifySubscribers( 6701 IBE.Utils.translate("correctCreditCard"), 6702 "externalPaymentValidation" 6703 ); 6704 return; 6705 }
6706 t.on("validityChange", function () { 6707 r.externalPaymentGatewayErrors(!1); 6708 }); 6709 r.ready(!0); 6710 } 6711 ), 6712 braintree.threeDSecure.create({ version: 2, client: t }, function (n, t) { 6713 n || (threeDSecure = t); 6714 })); 6715 }); 6716 }; 6717 r.showBookwizeCreditCardForm = function () { 6718 n.forceShowCreditCardDetailsForm(!0); 6719 }; 6720 r.hideBookwizeCreditCardForm = function () { 6721 n.forceShowCreditCardDetailsForm(!1); 6722 }; 6723 r.payWithSixPaymentPage = function () { 6724 r.externalPaymentGatewayErrors(!1); 6725 r.sixPaymentChoices([]); 6726 r.sixSelectedPaymentMeans("PaymentPage"); 6727 r.beforeSubmit(); 6728 }; 6729 r.showSixCreditCardForm = function () { 6730 if (!n.terms.value() && n.terms.id !== -1) { 6731 n.customer().errors().customer.showAllMessages(); 6732 n.terms.value.notifySubscribers(); 6733 return; 6734 } 6735 r.sixSelectedPaymentMeans("PaymentPage"); 6736 r.sixSelectedPaymentMeans("SaferPayFields"); 6737 r.initSix(); 6738 }; 6739 r.hideSixCreditCardForm = function () { 6740 r.externalPaymentGatewayErrors(!1); 6741 r.sixSelectedPaymentMeans("PaymentPage"); 6742 }; 6743 r.initSelfbook = function () { 6744 $("#selfbook-tag").append( 6745 "<sb-express api-key=" + 6746 r.externalPaymentGatewayData() + 6747 " hotel-id = " + 6748 IBE.Config.hotelId + 6749 "></sb-express>" 6750 ); 6751 $("#selfbook-tag").append( 6752 "<script async type=text/javascript src=https://integrations.selfbook.com/" + 6753 IBE.Config.hotelId + 6754 "/selfbook.js></script>" 6755 ); 6756 SbExpress.setTotalPrice(n.bookingProcess().totalCost()); 6757 SbExpress.setCurrencyCode(n.bookingProcess().currency()); 6758 SbExpress.setLineItems([{ label: "Room", amount: n.bookingProcess().totalCost(), type: "final" }]); 6759 SbExpress.getExpressEl().addEventListener( 6760 "sb-express-token-success", 6761 function ({ detail: { customer: t, expressToken: u, expressPaymentType: i, userAgent: f } }) { 6762 var o = { 6763 address: t.address, 6764 city: t.city, 6765 country_code: t.country_code, 6766 email: t.email, 6767 firstName: t.first_name, 6768 iataCode: t.iata_code, 6769 lastName: t.last_name, 6770 phone: t.phone, 6771 state: t.state, 6772 zipCode: t.zip_code, 6773 expressToken: u, 6774 expressPaymentType: i, 6775 userAgent: f, 6776 }, 6777 e; 6778 n.customer().firstName(t.first_name); 6779 n.customer().lastName(t.last_name); 6780 n.customer().phone(t.phone); 6781 n.customer().address(t.address); 6782 n.customer().email(t.email); 6783 n.customer().city(t.city); 6784 n.customer().zip(t.zip_code); 6785 e = ko.utils.arrayFirst(n.countries(), function (n) { 6786 return n.code() === t.country_code; 6787 }); 6788 e != null 6789 ? n.customer().country(e) 6790 : ((e = ko.utils.arrayFirst(n.countries(), function (n) { 6791 return n.code() === "XX"; 6792 })), 6793 n.customer().country(e)); 6794 r.externalPaymentGatewayData(ko.toJSON(o));
6795 r.notStoreCreditCard(!0); 6796 SbExpress.setIsSubmitting(!1); 6797 n.forceShowCreditCardDetailsForm(!1); 6798 n.makeReservation(); 6799 } 6800 ); 6801 SbExpress.getExpressEl().addEventListener("sb-express-error", function ({ detail: n }) { 6802 console.log(n.errorMessage); 6803 }); 6804 }; 6805 r.initStripe = function () { 6806 var n, t, i; 6807 ((data = JSON.parse(r.paymentToken())), 6808 (n = data.publicKey), 6809 (r.stripeClientSecret = data.clientSecret), 6810 typeof Stripe != "undefined") && 6811 ((r.stripeInstance = Stripe(n, { locale: IBE.Config.lang.split("-", 1)[0] })), 6812 (t = r.stripeInstance.elements()), 6813 (i = { 6814 base: { 6815 color: "#333333", 6816 fontFamily: '"ProximaNova-Regular", Helvetica, sans-serif', 6817 fontSmoothing: "antialiased", 6818 fontSize: "16px", 6819 "::placeholder": { color: "#999999" }, 6820 }, 6821 invalid: { color: "#cd4c2b", iconColor: "#fa755a" }, 6822 }), 6823 (r.stripeCard = t.create("card", { style: i })), 6824 r.stripeCard.mount("#stripe-card"), 6825 r.stripeCard.addEventListener("change", function (n) { 6826 var t = document.getElementById("card-errors"); 6827 t.textContent = n.error ? n.error.message : ""; 6828 })); 6829 }; 6830 r.getSixAcceptedCards = function (n) { 6831 var t = []; 6832 return ( 6833 typeof n != "undefined" && 6834 n !== "" && 6835 n !== null && 6836 n.length !== 0 && 6837 ko.utils.arrayForEach(n, function (n) { 6838 switch (n.paymentMethod) { 6839 case "MASTERCARD": 6840 r.sixPaymentChoices.push( 6841 new IBE.ViewModels.PaymentMethodsAndWallets(n.paymentMethod, n.logoUrl) 6842 ); 6843 t.push(n.paymentMethod.toLowerCase()); 6844 break; 6845 case "VISA": 6846 r.sixPaymentChoices.push( 6847 new IBE.ViewModels.PaymentMethodsAndWallets(n.paymentMethod, n.logoUrl) 6848 ); 6849 t.push(n.paymentMethod.toLowerCase()); 6850 break; 6851 case "AMEX": 6852 r.sixPaymentChoices.push( 6853 new IBE.ViewModels.PaymentMethodsAndWallets(n.paymentMethod, n.logoUrl) 6854 ); 6855 t.push(n.paymentMethod.toLowerCase()); 6856 break; 6857 case "DINERS": 6858 r.sixPaymentChoices.push( 6859 new IBE.ViewModels.PaymentMethodsAndWallets(n.paymentMethod, n.logoUrl) 6860 ); 6861 t.push(n.paymentMethod.toLowerCase()); 6862 break; 6863 case "JCB": 6864 r.sixPaymentChoices.push( 6865 new IBE.ViewModels.PaymentMethodsAndWallets(n.paymentMethod, n.logoUrl) 6866 ); 6867 t.push(n.paymentMethod.toLowerCase()); 6868 break; 6869 case "MAESTRO": 6870 r.sixPaymentChoices.push( 6871 new IBE.ViewModels.PaymentMethodsAndWallets(n.paymentMethod, n.logoUrl) 6872 ); 6873 t.push(n.paymentMethod.toLowerCase()); 6874 break; 6875 case "BANCONTACT": 6876 r.sixPaymentChoices.push( 6877 new IBE.ViewModels.PaymentMethodsAndWallets(n.paymentMethod, n.logoUrl) 6878 ); 6879 t.push(n.paymentMethod.toLowerCase()); 6880 break; 6881 case "DIRECTDEBIT": 6882 r.sixPaymentChoices.push( 6883 new IBE.ViewModels.PaymentMethodsAndWallets(n.paymentMethod, n.logoUrl) 6884 ); 6885 t.push(n.paymentMethod.toLowerCase()); 6886 } 6887 }), 6888 t 6889 ); 6890 }; 6891 r.initSix = function () { 6892 var t = r.externalPaymentGatewayData().split(","), 6893 f = t[0], 6894 i = "", 6895 u = ""; 6896 t.length > 3 && ((i = t[2]), (u = t[3])); 6897 t.length > 4 && ((i = t[3]), (u = t[4])); 6898 IBEConfig.deviceType === "Mobile" 6899 ? SaferpayFields.init({ 6900 accessToken: i, 6901 url: u + "/Fields/" + f, 6902 paymentMethods: r.sixAcceptedCardsForFields(), 6903 onSuccess: function () {}, 6904 onError: function (t) { 6905 console.log("Error in init: " + t.message + ". Fallback to credit storage"); 6906 n.typePaymentGateway("None"); 6907 r.gateway("None"); 6908 }, 6909 onBlur: function () {}, 6910 onValidated: function (n) { 6911 if (n.id !== "fields-cvc") 6912 if (n.isValid) $("#" + n.id).attr("data-isvalid", "true"), r.externalPaymentGatewayErrors(!1); 6913 else { 6914 var t = ""; 6915 switch (n.reason) { 6916 case "unsupported":
6917 t = "creditCardUnsupported"; 6918 break; 6919 case "invalid": 6920 t = n.id; 6921 break; 6922 case "expired": 6923 t = "creditCardExpired"; 6924 break; 6925 case "empty": 6926 t = "saferPayFieldIsEmpty"; 6927 } 6928 $("#" + n.id).attr("data-isvalid", "false"); 6929 r.externalPaymentGatewayErrors(!0); 6930 r.externalPaymentGatewayMessage(IBE.Utils.translate(t)); 6931 } 6932 }, 6933 onFocus: function () {}, 6934 }) 6935 : SaferpayFields.init({ 6936 accessToken: i, 6937 url: u + "/Fields/" + f, 6938 paymentMethods: r.sixAcceptedCardsForFields(), 6939 style: { 6940 ".element-warning": "position: absolute; right: 0px; height: 30px;", 6941 ".input-expiry.form-control, .input-cardnumber.form-control": 6942 "width: 100%; height: 100%; display: block; margin: 0 auto; border: none; vertical-align: middle; top:15px; position: absolute;", 6943 ".input-holdername.form-control, .input-verificationcode.form-control": 6944 "width: 100%; height: 100%; display: block; margin: 0 auto; border: none; vertical-align: middle;", 6945 ".is-focused": "border: none !important;", 6946 ".form-control:focus": "outline: none !important; border: none !important;", 6947 ".cardnumber__logos": 6948 "position: absolute;right: 0;top: 0;z-index: 2;display: flex;overflow: visible !important;", 6949 ".logo": "right: 0;top: 0;position: fixed;", 6950 ".logo-container.dualbrand-selection .logo": "position: unset !important;", 6951 }, 6952 onSuccess: function () {}, 6953 onError: function (t) { 6954 console.log("Error in init: " + t.message + ". Fallback to credit storage"); 6955 n.typePaymentGateway("None"); 6956 r.gateway("None"); 6957 }, 6958 onBlur: function () {}, 6959 onValidated: function (n) { 6960 if (n.id !== "fields-cvc") 6961 if (n.isValid) $("#" + n.id).attr("data-isvalid", "true"), r.externalPaymentGatewayErrors(!1); 6962 else { 6963 var t = ""; 6964 switch (n.reason) { 6965 case "unsupported": 6966 t = "creditCardUnsupported"; 6967 break; 6968 case "invalid": 6969 t = n.id; 6970 break; 6971 case "expired": 6972 t = "creditCardExpired"; 6973 break; 6974 case "empty": 6975 t = "saferPayFieldIsEmpty"; 6976 } 6977 $("#" + n.id).attr("data-isvalid", "false"); 6978 r.externalPaymentGatewayErrors(!0); 6979 r.externalPaymentGatewayMessage(IBE.Utils.translate(t)); 6980 } 6981 }, 6982 onFocus: function () {}, 6983 }); 6984 }; 6985 r.externalPaymentGatewayErrors.subscribe(function (n) { 6986 n && r.externalPaymentGatewayMessage(""); 6987 }); 6988 r.beforeSubmit = function () { 6989 var e, u, t, i, f; 6990 if ( 6991 (typeof braintree != "undefined" && 6992 r.hostInstance !== "" && 6993 r.hostInstance.tokenize({ cardholderName: $("#cardholder-name").val() }, function (t, i) { 6994 if (t) { 6995 r.externalPaymentGatewayErrors(!0); 6996 r.externalPaymentGatewayMessage(IBE.Utils.translate("correctCreditCard")); 6997 return; 6998 } 6999 threeDSecureParameters = r.create3DSobject(i); 7000 threeDSecure.verifyCard(threeDSecureParameters, function (t, i) { 7001 if (t) { 7002 r.externalPaymentGatewayErrors(!0); 7003 return; 7004 } 7005 r.externalPaymentGatewayErrors(!1); 7006 r.externalPaymentGatewayData(i.nonce);
7007 r.notStoreCreditCard(!0); 7008 n.makeReservation(); 7009 }); 7010 }), 7011 typeof Omise != "undefined" && 7012 ((e = { 7013 name: $("#CustomerCardHolder").val(), 7014 number: $("#CustomerNumber").val(), 7015 expiration_month: $("#CardExpirationMonth").val(), 7016 expiration_year: $("#CardExpirationYear").val(), 7017 security_code: $("#CardVerification").val(), 7018 }), 7019 Omise.createToken("card", e, function (t, i) { 7020 t == 200 7021 ? (r.externalPaymentGatewayErrors(!1), 7022 r.externalPaymentGatewayData(i.id), 7023 r.notStoreCreditCard(!0), 7024 n.makeReservation()) 7025 : (r.externalPaymentGatewayErrors(!0), r.externalPaymentGatewayMessage(i.message)); 7026 })), 7027 typeof Accept != "undefined") 7028 ) { 7029 if ( 7030 ((u = {}), 7031 (t = r.paymentToken().split("-")), 7032 t[0] === "undefined" || t[1] === "undefined" || t[0] === "" || t[1] === "") 7033 ) { 7034 n.makeReservation(); 7035 return; 7036 } 7037 ko.bindingHandlers.addFiledsAuthorizeNet(); 7038 u.clientKey = t[1]; 7039 u.apiLoginID = t[0]; 7040 i = {}; 7041 i.cardNumber = n.customer().creditCard().cardNumber(); 7042 i.month = n.customer().creditCard().cardExpirationMonth(); 7043 i.year = n.customer().creditCard().cardExpirationYear(); 7044 i.cardCode = n.customer().creditCard().cardVerification(); 7045 f = {}; 7046 f.authData = u; 7047 f.cardData = i; 7048 Accept.dispatchData(f, e); 7049 function e(n) { 7050 var i = [], 7051 t; 7052 if (n.messages.resultCode === "Error") { 7053 for (t = 0; t < n.messages.message.length; ) i.push(n.messages.message[t].text), (t = t + 1); 7054 r.externalPaymentGatewayErrors(!0); 7055 r.externalPaymentGatewayMessage(i); 7056 } else o(n.opaqueData); 7057 } 7058 function o(t) { 7059 document.getElementById("dataDescriptor").value = t.dataDescriptor; 7060 document.getElementById("dataValue").value = t.dataValue; 7061 r.externalPaymentGatewayErrors(!1); 7062 r.externalPaymentGatewayData(t.dataDescriptor + "," + t.dataValue);
7063 r.notStoreCreditCard(!0); 7064 n.makeReservation(); 7065 } 7066 } 7067 if ( 7068 (r.gateway() === "AlphaBankRedirect" && 7069 (n.bookingProcess().advancePayment() > 0 && r.notStoreCreditCard(!0), n.makeReservation()), 7070 typeof Stripe != "undefined" && 7071 r.stripeInstance !== "" && 7072 (r.externalPaymentGatewayData() == "" 7073 ? r.stripeInstance 7074 .confirmCardSetup(r.stripeClientSecret, { payment_method: { card: r.stripeCard } }) 7075 .then(function (t) { 7076 if (t.error) { 7077 r.externalPaymentGatewayErrors(!0); 7078 switch (t.error.code) { 7079 case "card_declined": 7080 r.externalPaymentGatewayMessage( 7081 IBE.Utils.translate("cc_" + t.error.code + "_" + t.error.decline_code) 7082 ); 7083 break; 7084 case "expired_card": 7085 case "incorrect_cvc": 7086 case "processing_error": 7087 case "incorrect_number": 7088 case "incorrect_zip": 7089 case "invalid_card_type": 7090 case "invalid_cvc": 7091 case "invalid_expiry_month": 7092 case "invalid_expiry_year": 7093 case "invalid_number": 7094 case "setup_intent_authentication_failure": 7095 r.externalPaymentGatewayMessage(IBE.Utils.translate("cc_" + t.error.code)); 7096 break; 7097 default: 7098 r.externalPaymentGatewayMessage(IBE.Utils.translate("correctCreditCard")); 7099 } 7100 return; 7101 } 7102 r.externalPaymentGatewayErrors(!1); 7103 r.externalPaymentGatewayData(t.setupIntent.payment_method);
7104 r.notStoreCreditCard(!0); 7105 n.makeReservation(); 7106 }) 7107 : n.makeReservation()), 7108 r.gateway() === "Six" && r.sixSelectedPaymentMeans() === "PaymentPage") 7109 ) 7110 r.externalPaymentGatewayErrors(!1), 7111 r.externalPaymentGatewayData("PaymentPage"), 7112 r.notStoreCreditCard(!0), 7113 n.makeReservation(); 7114 else if (typeof SaferpayFields != "undefined" && r.gateway() !== "None") 7115 if ( 7116 (n.customer().errors().customer().length === 0 || n.customer().errors().customer()[0] === null) && 7117 n.terms.value() 7118 ) { 7119 var o = $("#fields-card-number").attr("data-isvalid"), 7120 s = $("#fields-holder-name").attr("data-isvalid"), 7121 h = $("#fields-expiration").attr("data-isvalid"); 7122 o !== "true" || s !== "true" || h !== "true" || n.disableButton() 7123 ? (r.externalPaymentGatewayErrors(!0), 7124 r.externalPaymentGatewayMessage(IBE.Utils.translate("correctCreditCard")), 7125 n.disableButton(!1)) 7126 : (n.disableButton(!0), 7127 SaferpayFields.submit({ 7128 onSuccess: function (t) { 7129 r.externalPaymentGatewayErrors(!1); 7130 r.externalPaymentGatewayData(t.token);
7131 r.notStoreCreditCard(!0); 7132 n.makeReservation(); 7133 }, 7134 onError: function () { 7135 r.externalPaymentGatewayErrors(!0); 7136 r.externalPaymentGatewayMessage(IBE.Utils.translate("correctCreditCard")); 7137 n.disableButton(!1); 7138 }, 7139 })); 7140 } else 7141 n.customer().errors().customer.showAllMessages(), n.terms.value() || n.terms.value.notifySubscribers(); 7142 r.gateway() === "Payout" && 7143 (n.bookingProcess().advancePayment() > 0 && r.notStoreCreditCard(!0), n.makeReservation()); 7144 typeof r.gateway() != "undefined" && 7145 r.gateway() !== "0" && 7146 r.gateway() !== "Braintree" && 7147 r.gateway() !== "AlphaBankRedirect" && 7148 r.gateway() !== "Omise" && 7149 r.gateway() !== "AuthorizeNet" && 7150 r.gateway() !== "Stripe" && 7151 r.gateway() !== "Payout" && 7152 r.gateway() !== "Six" && 7153 r.gateway() !== "Selfbook" && 7154 n.makeReservation(); 7155 }; 7156 r.create3DSobject = function (t) { 7157 return { 7158 amount: n.bookingProcess().totalCost(), 7159 nonce: t.nonce, 7160 bin: t.bin, 7161 email: n.customer().email(), 7162 billingAddress: { 7163 givenName: n.customer().firstName(), 7164 surname: n.customer().lastName(), 7165 phoneNumber: n.customer().phone(), 7166 streetAddress: n.customer().address(), 7167 locality: n.customer().country().name(), 7168 region: n.customer().city(), 7169 postalCode: n.customer().zip(), 7170 countryCodeAlpha2: n.customer().country().code(), 7171 }, 7172 additionalInformation: { 7173 workPhoneNumber: n.customer().phone(), 7174 shippingGivenName: n.customer().firstName(), 7175 shippingSurname: n.customer().lastName(), 7176 shippingPhone: n.customer().phone(), 7177 shippingAddress: { 7178 streetAddress: n.customer().address(), 7179 locality: n.customer().country().name(), 7180 region: n.customer().city(), 7181 postalCode: n.customer().zip(), 7182 countryCodeAlpha2: n.customer().country().code(), 7183 }, 7184 }, 7185 onLookupComplete: function (n, t) { 7186 t(); 7187 }, 7188 }; 7189 }; 7190}; 7191IBE.ViewModels.PaymentMethodsAndWallets = function (n, t) { 7192 var i = this; 7193 i.methodName = ""; 7194 i.methodLogo = ""; 7195 i.init = function () { 7196 i.methodName = n; 7197 i.methodLogo = t; 7198 }; 7199 i.init(); 7200}; 7201IBE.ViewModels.PaymentDeclined = function () { 7202 var n = this; 7203 n.events = new ko.subscribable(); 7204 n.ready = ko.observable(!1); 7205 ko.utils.extend(n, new IBE.ViewModels.LanguagePartialViewModel(n)); 7206 ko.utils.extend(n, new IBE.ViewModels.CurrenciesPartialViewModel(n)); 7207 ko.utils.extend(n, new IBE.ViewModels.Message()); 7208 n.init = function () { 7209 n.clearMessage(); 7210 $.when(n.languagePartialInit(), n.currenciesPartialInit()).then(function () { 7211 n.ready(!0); 7212 n.events.notifySubscribers(!0, "ready"); 7213 }); 7214 }; 7215}; 7216IBE.ViewModels.FooterViewModel = function () { 7217 function i(t) { 7218 n.name(t.info.name); 7219 n.logo(t.info.logo); 7220 n.address(new IBE.Models.HotelAddress(t.info.address)); 7221 n.prn(t.info.prn); 7222 n.gcn(t.info.gcn); 7223 n.notificationNumber(t.info.notificationNumber); 7224 var i = new IBE.Models.Terms(t.info.termsAndPrivacy); 7225 n.privacy(i.privacy || ""); 7226 t.settings.adwordsConversionId && 7227 n.cookieUsed.push( 7228 '<a href="https://policies.google.com/technologies/cookies" target="_blank"> Adwords </span>' 7229 ); 7230 t.settings.facebook_TrackId && 7231 n.cookieUsed.push('<a href="https://www.facebook.com/policies/cookie
7231s/" target="_blank"> Facebook </span>'); 7232 t.settings.bingCode && n.cookieUsed.push('<a href="https://www.bink.com/terms/" target="_blank"> Bing </span>'); 7233 t.settings.triptease && 7234 n.cookieUsed.push( 7235 '<a href="https://www.triptease.com/en/cookie-policy/" target="_blank"> Triptease </span>' 7236 ); 7237 t.settings.sojern && 7238 n.cookieUsed.push( 7239 '<a href="https://www.sojern.com/privacy/product-privacy-policy/" target="_blank"> Sojern </span>' 7240 ); 7241 t.settings.trivagoId && 7242 n.cookieUsed.push('<a href="https://www.trivago.com/privacy-policy" target="_blank"> Trivago </span>'); 7243 n.ready(!0); 7244 n.events.notifySubscribers(!0, "ready"); 7245 } 7246 var n = this, 7247 t; 7248 n.events = new ko.subscribable(); 7249 n.ready = ko.observable(!1); 7250 ko.utils.extend(n, new IBE.ViewModels.LanguagePartialViewModel(n)); 7251 ko.utils.extend(n, new IBE.ViewModels.CurrenciesPartialViewModel(n)); 7252 n.name = ko.observable(""); 7253 n.logo = ko.observable(""); 7254 n.address = ko.observable(); 7255 n.prn = ko.observable(); 7256 n.gcn = ko.observable(); 7257 n.notificationNumber = ko.observable(); 7258 n.privacy = ko.observable(); 7259 n.cookieUsed = ko.observableArray([]); 7260 n.showLogo = ko.computed(function () { 7261 return n.logo().length !== 0; 7262 }); 7263 n.acceptTracking = ko.observable(!1); 7264 n.acceptTrackingCookies = ko.observable(!IBE.Config.showCookieAcceptance); 7265 n.allowAllCookies = function () { 7266 n.acceptTrackingCookies(!0); 7267 n.acceptTracking(!0); 7268 }; 7269 n.saveSetting = function () {}; 7270 t = []; 7271 t.push( 7272 n.lang.subscribe(function () { 7273 n.init(); 7274 }, n) 7275 ); 7276 n.dispose = function () { 7277 for (var n in t) t[n].dispose(); 7278 }; 7279 n.init = function () { 7280 $.when(n.languagePartialInit(), n.currenciesPartialInit()).then(function () { 7281 var t = function (t) { 7282 if (t) { 7283 if ((i(t), IBE.Config.paymentGatewayType[t.settings.externalPaymentGateway] === 3)) { 7284 var u = document.getElementById("Cookie"), 7285 r = document.createElement("IMG"); 7286 r.setAttribute( 7287 "src", 7288 "https://bookwizecdn.azureedge.net/images/Horizontal_Banner_White_trans.png" 7289 ); 7290 r.setAttribute("class", "bookwize-alphabank-image"); 7291 u.after(r); 7292 } 7293 n.acceptTrackingCookies.valueHasMutated(); 7294 } 7295 }; 7296 $.when(IBE.Utils.loadHotelInfo(t)).then(t); 7297 }); 7298 }; 7299}; 7300IBE.ViewModels.HeaderViewModel = function () { 7301 function i(t) { 7302 n.name(t.info.name); 7303 n.logo(t.info.logo); 7304 n.hotel(new IBE.Models.HotelInfo(t.info)); 7305 n.website(n.hotel().website);
7306 typeof t.settings.ibeBackgroundImage != "undefined" && n.backgroundImage(t.settings.ibeBackgroundImage); 7307 n.ready(!0); 7308 n.events.notifySubscribers(!0, "ready"); 7309 } 7310 var n = this, 7311 t; 7312 n.view = ko.observable(); 7313 n.events = new ko.subscribable(); 7314 n.ready = ko.observable(!1); 7315 ko.utils.extend(n, new IBE.ViewModels.LanguagePartialViewModel(n)); 7316 ko.utils.extend(n, new IBE.ViewModels.CurrenciesPartialViewModel(n)); 7317 n.name = ko.observable(""); 7318 n.logo = ko.observable(""); 7319 n.website = ko.observable(""); 7320 n.backgroundImage = ko.observable(""); 7321 n.hotel = ko.observable(); 7322 n.showLogo = ko.computed(function () { 7323 return n.logo().length !== 0; 7324 }); 7325 t = []; 7326 t.push( 7327 n.lang.subscribe(function () { 7328 n.init(); 7329 }, n) 7330 ); 7331 n.dispose = function () { 7332 for (var n in t) t[n].dispose(); 7333 }; 7334 n.init = function () { 7335 $.when(n.languagePartialInit(), n.currenciesPartialInit()).then(function () { 7336 var n = function (n) { 7337 n && typeof n != "undefined" && i(n); 7338 }; 7339 $.when(IBE.Utils.loadHotelInfo(n)).then(n); 7340 }); 7341 }; 7342 n.openInNewTab = function () { 7343 window.open(n.hotel().website, "_blank"); 7344 }; 7345}; 7346IBE.ViewModels.LanguagePartialViewModel = function (n) { 7347 function t(t) { 7348 var i, r; 7349 t.languages && 7350 (n.languages().length > 0 || 7351 ((i = []), 7352 typeof IBE.Config.languages == "undefined" && (IBE.Config.languages = []), 7353 (r = []), 7354 typeof IBE.Data.HotelInfo[t.id] != "undefined" && 7355 IBE.Data.HotelInfo[t.id] != null && 7356 typeof IBE.Data.HotelInfo[t.id].settings.languages != "undefined" && 7357 (r = IBE.Data.HotelInfo[t.id].settings.languages.split(",")), 7358 ko.utils.arrayForEach(t.languages, function (n) {
7359 (IBE.Config.languages.length === 0 || IBE.Config.languages.indexOf(n.culture) !== -1) && 7360 (r.length > 0 7361 ? r.indexOf(n.locale) >= 0 && i.push(new IBE.Models.Language(n)) 7362 : i.push(new IBE.Models.Language(n))); 7363 }), 7364 i.length === 0 && i.push(new IBE.Models.Language({ locale: IBE.Config.lang })), 7365 i.sort(function (n, t) { 7366 return n.description == t.description ? 0 : n.description < t.description ? -1 : 1; 7367 }), 7368 n.languages(i))); 7369 } 7370 n.languages = ko.observableArray([]); 7371 n._lang = ko.observable(); 7372 n.lang = ko.computed({ 7373 read: function () { 7374 return n._lang(); 7375 }, 7376 write: function (t) { 7377 if (typeof t != "undefined") { 7378 var i = function (i) { 7379 typeof i != "undefined" && 7380 ((IBE.Config.ajaxConfig = $.extend(IBE.Config.ajaxConfig, { 7381 beforeSend: function (n) { 7382 n.setRequestHeader("Accept-Language", i); 7383 }, 7384 })), 7385 $.ajaxSetup(IBE.Config.ajaxConfig), 7386 moment.locale(t), 7387 n._lang(i), 7388 n.events.notifySubscribers(t, "loadTranslations")); 7389 }; 7390 $.when(IBE.Utils.loadTranslations(t, i)).then(i); 7391 } 7392 }, 7393 deferEvaluation: !0, 7394 }); 7395 n.lang(IBE.Config.lang); 7396 n.languagePartialInit = function (n) { 7397 var i = $.Deferred(), 7398 r = function (n) { 7399 n && typeof n != "undefined" && (t(n), i.resolve(n)); 7400 }; 7401 return $.when(IBE.Utils.loadHotelInfo(r, n)).then(r), i.promise(); 7402 }; 7403}; 7404IBE.ViewModels.Map = function () { 7405 function t(t) { 7406 n.googleMap(new IBE.Models.GoogleMap(t.info)); 7407 n.clearMessage(); 7408 n.ready(!0); 7409 n.events.notifySubscribers(!0, "ready"); 7410 } 7411 var n = this; 7412 n.events = new ko.subscribable(); 7413 n.ready = ko.observable(!1); 7414 n.googleMap = ko.observable(); 7415 ko.utils.extend(n, new IBE.ViewModels.LanguagePartialViewModel(n)); 7416 ko.utils.extend(n, new IBE.ViewModels.CurrenciesPartialViewModel(n)); 7417 ko.utils.extend(n, new IBE.ViewModels.Message()); 7418 n.init = function () { 7419 var n = function (n) { 7420 n && t(n); 7421 }; 7422 $.when(IBE.Utils.loadHotelInfo()).then(n); 7423 }; 7424}; 7425IBE.ViewModels.PartialMemberViewModel = function (n, t) { 7426 typeof n.events == "undefined" && (n.events = new ko.subscribable()); 7427 typeof n.message == "undefined" && ko.utils.extend(n, new IBE.ViewModels.Message()); 7428 ko.utils.extend(n, new IBE.ViewModels.PartialAuthenticateMembership(n)); 7429 t && n.customer(new IBE.Models.Customer(t)); 7430 n.logout = function () { 7431 n.username(""); 7432 n.password(""); 7433 n.customer(null); 7434 IBE.Utils.deleteAuthenticationCookie(); 7435 n.clearMessage(); 7436 n.events.notifySubscribers({ success: !0 }, "logout"); 7437 }; 7438 n.login = function () { 7439 var t = $.Deferred(); 7440 return ( 7441 n.username() === "" || n.password() === "" 7442 ? t.resolve() 7443 : $.ajax({ 7444 type: "GET", 7445 url: IBE.Config.apiBaseUrl + "/members/member/?apikey=" + IBE.Config.apiKey, 7446 beforeSend: function (t) { 7447 t.setRequestHeader( 7448 "Authorization", 7449 IBE.Utils.authenticationCookie(n.username(), n.password()) 7450 ); 7451 t.setRequestHeader("Accept-Language", IBE.Config.lang || "en-US"); 7452 }, 7453 success: function (i) { 7454 n.customer(new IBE.Models.Customer(i)); 7455 t.resolve(i); 7456 n.events.notifySubscribers({ success: !0 }, "login"); 7457 }, 7458 error: function (i) { 7459 var r = { id: i.status, severity: "error", text: i.responseText }; 7460 i.status === 401 7461 ? ((r.text = "Wrong email or password."), 7462 IBE.Utils.deleteAuthenticationCookie(), 7463 n.customer(null)) 7464 : (r.text = "An error occurred."); 7465 n.message(r); 7466 t.resolve(i); 7467 }, 7468 }), 7469 t.promise() 7470 ); 7471 }; 7472 n.isAuthenticated = ko 7473 .computed(function () { 7474 return n.customer() != null; 7475 }) 7476 .extend({ notify: "always" }); 7477 n.customerAuthenticate = function () { 7478 var t = $.Deferred(); 7479 return ( 7480 IBE.Utils.haveAuthenticationCookie() 7481 ? $.ajax({ 7482 type: "GET", 7483 url: IBE.Config.apiBaseUrl + "/members/member/?apikey=" + IBE.Config.apiKey, 7484 beforeSend: function (n) { 7485 n.setRequestHeader("Authorization", IBE.Utils.authenticationCookie()); 7486 n.setRequestHeader("Accept-Language", IBE.Config.lang || "en-US"); 7487 }, 7488 success: function (i) { 7489 n.customer(new IBE.ViewModels.CustomerPartialViewModel(i)); 7490 t.resolve(i); 7491 }, 7492 error: function (i) { 7493 IBE.Utils.deleteAuthenticationCookie(); 7494 n.customer(null); 7495 t.resolve(i); 7496 }, 7497 }) 7498 : t.resolve(), 7499 t.promise() 7500 ); 7501 }; 7502};
7503IBE.ViewModels.PartialAuthenticateMembership = function (n, t) { 7504 n.customer = ko.observable(null); 7505 n.username = ko.observable(""); 7506 n.password = ko.observable(""); 7507 typeof t != "undefined" && 7508 t != null && 7509 t.email !== "" && 7510 t.code !== "" && 7511 (n.username(t.email), n.password(t.code)); 7512 n.consents = ko.observableArray([]); 7513 n.customerConsents = ko.observableArray([]); 7514 n.isAuthenticated = ko.computed(function () { 7515 return n.customer() != null; 7516 }); 7517 n.customerConsents = ko.computed({ 7518 read: function () { 7519 return n.customer() == null 7520 ? [] 7521 : (ko.utils.arrayForEach(n.consents(), function (t) { 7522 var i = ko.utils.arrayFirst(n.customer().consents(), function (n) { 7523 return t.id === n.id; 7524 }); 7525 i && t.value(!0); 7526 }), 7527 n.consents()); 7528 }, 7529 deferEvaluation: !0, 7530 }); 7531 n.createRecoveryLink = function () { 7532 if ((n.clearMessage(), n.username() === "")) { 7533 var t = { id: 501, severity: "error", text: IBE.Utils.translate("customerUsernameIsEmpty") }; 7534 return n.message(t), !1; 7535 } 7536 return ( 7537 $.ajax({ 7538 type: "POST", 7539 url: IBE.Config.apiBaseUrl + "/members/createRecoveryLink/?apikey=" + IBE.Config.apiKey, 7540 data: ko.toJSON({ username: n.username() }), 7541 beforeSend: function () { 7542 n.ready(!1); 7543 }, 7544 success: function () { 7545 var t = { id: 200, severity: "success", text: IBE.Utils.translate("recoveryLinkSuccessfullySent") }; 7546 n.message(t); 7547 n.events.notifySubscribers(t, "hash-sent"); 7548 }, 7549 error: function (t) { 7550 n.events.notifySubscribers(!0, "ready"); 7551 var i = { id: t.status, severity: "error", text: t.responseText }; 7552 i.text = t.status === 404 ? "Wrong email." : "An error occurred."; 7553 n.message(i); 7554 n.events.notifySubscribers(i, "error"); 7555 }, 7556 complete: function () { 7557 n.ready(!0); 7558 }, 7559 }), 7560 !0 7561 ); 7562 }; 7563}; 7564IBE.ViewModels.Membership = function () { 7565 function i(t) { 7566 var i = $.Deferred(); 7567 return ( 7568 t || i.resolve(0), 7569 $.ajax({ 7570 type: "GET", 7571 url: "{0}/members/exist?apikey={1}&email={2}".format(IBE.Config.apiBaseUrl, IBE.Config.apiKey, t), 7572 beforeSend: function () { 7573 n.ready(!1); 7574 }, 7575 success: function (n) { 7576 i.resolve(n); 7577 }, 7578 error: function () { 7579 i.resolve(!1); 7580 }, 7581 complete: function () { 7582 n.events.notifySubscribers(!0, "ready"); 7583 n.ready(!0); 7584 }, 7585 }), 7586 i.promise() 7587 ); 7588 } 7589 var n = this, 7590 t; 7591 n.events = new ko.subscribable(); 7592 n.ready = ko.observable(!1); 7593 ko.utils.extend(n, new IBE.ViewModels.LanguagePartialViewModel(n)); 7594 ko.utils.extend(n, new IBE.ViewModels.CurrenciesPartialViewModel(n)); 7595 ko.utils.extend(n, new IBE.ViewModels.Message()); 7596 ko.utils.extend(n, new IBE.ViewModels.PartialAuthenticateMembership(n)); 7597 n.countries = ko.observableArray([]); 7598 n.claimMembership = new IBE.ViewModels.ClaimMembership(); 7599 n.termsVisible = ko.observable(!0); 7600 n.acceptTerms = ko.observable(!1).extend({ checkbox: { message: IBE.Utils.translate("acceptTerms") } }); 7601 n.loyaltyTermsVisible = ko.observable(!1); 7602 n.loyaltyAcceptTerms = ko 7603 .observable(!1) 7604 .extend({ checkbox: { message: IBE.Utils.translate("acceptLoyaltyTerms") } }); 7605 n.loyaltyTerms = ko.observable(); 7606 n.memberBenefits = ko.computed(function () { 7607 if (n.customer() == null) return []; 7608 var t = ko.utils.arrayFilter(n.customer().offers(), function (n) { 7609 return n.membershipLevels().length > 0; 7610 }); 7611 return t || []; 7612 }); 7613 t = []; 7614 n.dispose = function () { 7615 for (var n in t) t[n].dispose(); 7616 }; 7617 n.edit = ko.observable(!1); 7618 n._customerData = null; 7619 n.startEdit = function () { 7620 n._customerData = ko.toJS(n.customer()); 7621 n.edit(!0); 7622 }; 7623 n.cancelEdit = function () { 7624 n.customer(new IBE.Models.Customer(n._customerData)); 7625 n._customerData = null; 7626 n.edit(!1); 7627 }; 7628 n.save = function () { 7629 var i = ko.utils.arrayFilter(n.customerConsents(), function (n) {
7630 return n.value(); 7631 }), 7632 t; 7633 n.customer().consents(i); 7634 t = n.customer().toJSON(); 7635 n.ready(!1); 7636 $.ajax({ 7637 type: "POST", 7638 data: t, 7639 url: 7640 IBE.Config.apiBaseUrl + 7641 "/members/member/?apikey=" + 7642 IBE.Config.apiKey + 7643 "&hotelId=" + 7644 IBE.Config.hotelId, 7645 beforeSend: function (t) { 7646 t.setRequestHeader("Authorization", IBE.Utils.authenticationCookie(n.username(), n.password())); 7647 t.setRequestHeader("Accept-Language", IBE.Config.lang || "en-US"); 7648 }, 7649 success: function () { 7650 n.edit(!1); 7651 n.clearMessage(); 7652 var t = { id: 200, severity: "success", text: IBE.Utils.translate("customerEditSuccess") }; 7653 n.message(t); 7654 n.ready(!0); 7655 n.events.notifySubscribers(!0, "ready"); 7656 }, 7657 error: function (t) { 7658 n.clearMessage(); 7659 var i = { id: t.status, severity: "error", text: IBE.Utils.translate("customerEditFailed") }; 7660 n.message(i); 7661 n.events.notifySubscribers(i, "error"); 7662 n.ready(!0); 7663 n.events.notifySubscribers(!0, "ready"); 7664 }, 7665 }); 7666 }; 7667 n.passwordErrors = { 7668 hasNumber: ko.observable(!1), 7669 hasUpperCase: ko.observable(!1), 7670 hasLowerCase: ko.observable(!1), 7671 aboveMin: ko.observable(!1), 7672 }; 7673 n.passwordRequirements = ko.observable(null); 7674 n.clearPasswordErrors = function () { 7675 n.passwordErrors.hasNumber(!1); 7676 n.passwordErrors.hasUpperCase(!1); 7677 n.passwordErrors.hasLowerCase(!1); 7678 n.passwordErrors.aboveMin(!1); 7679 }; 7680 n.oldPassword = ko.observable(null).extend({ required: { message: IBE.Utils.translate("validation.required") } }); 7681 n.newPassword = ko.observable(null).extend({ required: { message: IBE.Utils.translate("validation.required") } }); 7682 n.newPassword.subscribe(function (t) { 7683 n.clearPasswordErrors(); 7684 n.passwordRequirements(n.getPasswordRequirements(t)); 7685 }); 7686 n.getPasswordRequirements = function (n) { 7687 var i = { hasNumber: !1, hasUpperCase: !1, hasLowerCase: !1, aboveMin: n == null || n.length < 8 ? !1 : !0 }, 7688 r, 7689 t; 7690 if (n == null) return i; 7691 for (r = 0, t = ""; r <= n.length - 1; ) 7692 (t = n.charAt(r)), 7693 isNaN(t * 1) 7694 ? (t == t.toUpperCase() && (i.hasUpperCase = !0), t == t.toLowerCase() && (i.hasLowerCase = !0)) 7695 : (i.hasNumber = !0), 7696 r++; 7697 return i; 7698 }; 7699 n.skipMembershipRegistration = function () { 7700 $(".membership-registration").slideUp("slow"); 7701 }; 7702 n.retypePassword = ko 7703 .observable(null) 7704 .extend({ required: { message: IBE.Utils.translate("validation.required") } }); 7705 n.validatePasswordStrength = ko.computed(function () { 7706 return IBE.Utils.passwordStrength(n.newPassword()); 7707 }); 7708 n.isPasswordValid = ko.computed(function () { 7709 var t = n.getPasswordRequirements(n.newPassword()); 7710 return ( 7711 n.newPassword() != null && 7712 n.newPassword() == n.retypePassword() && 7713 t.hasNumber && 7714 t.hasUpperCase && 7715 t.hasLowerCase && 7716 t.aboveMin 7717 ); 7718 }); 7719 n.passwordMessage = ko.computed(function () { 7720 var t = []; 7721 return ( 7722 IBE.Utils.passwordStrength(n.newPassword()) < 60 && t.push("weakPassword"), 7723 n.newPassword() != n.retypePassword() && t.push("customerPasswordMismatch"), 7724 t 7725 ); 7726 }); 7727 n.changePassword = function () { 7728 var t, i; 7729 if (n.newPassword() !== n.retypePassword() || n.newPassword() === "") 7730 return ( 7731 n.clearMessage(), 7732 (t = { id: 501, severity: "error", text: IBE.Utils.translate("customerPasswordMismatch") }), 7733 n.message(t), 7734 !1 7735 ); 7736 if (IBE.Utils.passwordStrength(n.newPassword() < 60)) 7737 return ( 7738 n.clearMessage(), 7739 (t = { id: 502, severity: "error", text: IBE.Utils.translate("weakPassword") }), 7740 n.message(t), 7741 !1 7742 ); 7743 i = { oldPassword: n.oldPassword(), newPassword: n.newPassword() }; 7744 n.ready(!1); 7745 $.ajax({ 7746 type: "POST", 7747 data: ko.toJSON(i), 7748 url: IBE.Config.apiBaseUrl + "/members/changepassword?apikey=" + IBE.Config.apiKey, 7749 beforeSend: function (t) { 7750 t.setRequestHeader("Authorization", IBE.Utils.authenticationCookie(n.username(), n.password())); 7751 }, 7752 success: function () { 7753 n.clearMessage(); 7754 var t = { id: 200, severity: "success", text: IBE.Utils.translate("customerPasswordChangeSuccess") }; 7755 n.message(t); 7756 n.ready(!0); 7757 n.events.notifySubscribers(!0, "ready"); 7758 n.events.notifySubscribers(t, "password-change-success"); 7759 }, 7760 error: function (t) { 7761 n.clearMessage(); 7762 var i = { id: t.status, severity: "error", text: IBE.Utils.translate("customerPasswordChangeFailure") }; 7763 n.message(i); 7764 n.events.notifySubscribers(i, "error"); 7765 n.ready(!0); 7766 n.events.notifySubscribers(!0, "ready"); 7767 }, 7768 }); 7769 }; 7770 n.show = ko.observable(!1); 7771 n.toggleChangePassword = ko.observable(); 7772 n.toggleChangePassword = function () { 7773 n.show(!n.show()); 7774 }; 7775 n.resetpasswordShow = ko.observable(!1); 7776 n.resetPasswordDisplay = function () { 7777 n.resetpasswordShow(!0); 7778 }; 7779 n.creditCard = ko.observable(null); 7780 n.errors = ko.observable({
7781 customer: ko.validation.group(n.customer), 7782 password: ko.validation.group(n), 7783 creditCard: ko.validation.group(n.creditCard), 7784 }); 7785 n.login = function () { 7786 if ((n.ready(!1), n.clearMessage(), n.errors().length > 0 && IBE.Utils.haveAuthenticationCookie() === !1)) 7787 return ( 7788 n.errors.showAllMessages(), 7789 n.events.notifySubscribers({ id: 401, severity: "error", text: "Wrong email or password." }, "error"), 7790 n.ready(!0), 7791 !1 7792 ); 7793 $.ajax({ 7794 type: "GET", 7795 url: IBE.Config.apiBaseUrl + "/members/member/?apikey=" + IBE.Config.apiKey, 7796 beforeSend: function (t) { 7797 t.setRequestHeader("Authorization", IBE.Utils.authenticationCookie(n.username(), n.password())); 7798 t.setRequestHeader("Accept-Language", IBE.Config.lang || "en-US"); 7799 n.ready(!1); 7800 }, 7801 success: function (t) { 7802 n.customer(new IBE.Models.Customer(t)); 7803 n.initCustomerData(); 7804 t.consents && 7805 ko.utils.arrayForEach(t.consents, function (t) { 7806 n.customer().consents.push(new IBE.Models.Consents(t)); 7807 }); 7808 n.ready(!0); 7809 IBE.Utils.authenticationHeader(n.username(), n.password()); 7810 n.events.notifySubscribers({ success: !0, email: n.username(), code: n.password() }, "login"); 7811 n.events.notifySubscribers(!0, "ready"); 7812 n.ready(!0); 7813 }, 7814 error: function (t) { 7815 n.ready(!1); 7816 n.events.notifySubscribers(!0, "ready"); 7817 var i = { id: t.status, severity: "error", text: t.responseText }; 7818 i.text = t.status === 401 ? "Wrong email or password." : "An error occurred."; 7819 IBE.Utils.deleteAuthenticationCookie(); 7820 n.customer(null); 7821 n.message(i); 7822 n.events.notifySubscribers(i, "error"); 7823 n.ready(!0); 7824 }, 7825 }); 7826 }; 7827 n.logout = function () { 7828 n.ready(!1); 7829 n.username(""); 7830 n.password(""); 7831 n.customer(null); 7832 IBE.Utils.deleteAuthenticationCookie(); 7833 n.clearMessage(); 7834 n.events.notifySubscribers({ success: !0 }, "logout"); 7835 n.ready(!0); 7836 }; 7837 n.confirmAction = function (t, i) { 7838 var e = { 7839 id: n.currentReservation().reservation().id, 7840 newStatus: t, 7841 creditCard: {}, 7842 cancellationNotes: n.currentReservation().reservation().cancellationNotes(), 7843 notes: n.currentReservation().reservation().notes(), 7844 }, 7845 r = !1, 7846 f, 7847 u; 7848 switch (t) { 7849 case "CancelledReservation": 7850 case "CancelledRequest": 7851 n.cancelCode() != n.currentReservation().reservation().code && 7852 ((f = { id: 5001, severity: "error", text: IBE.Utils.translate("wrongReservationCode") }), 7853 n.message(f), 7854 n.events.notifySubscribers(f, "error"), 7855 (r = !0)); 7856 break; 7857 case "ConfirmedReservation": 7858 n.errors().creditCard().length > 0 && 7859 ((r = !0), 7860 n.events.notifySubscribers("", "error"), 7861 n.errors().creditCard().length == 1 && n.errors().creditCard()[0] == null 7862 ? (r = !1) 7863 : n.errors().creditCard.showAllMessages()); 7864 u = n.creditCard().cardExpirationYear() + ""; 7865 u = u.substring(2); 7866 e.creditCard = { 7867 holder: n.creditCard().cardHolder(), 7868 expireYear: u, 7869 expireMonth: n.creditCard().cardExpirationMonth(), 7870 number: n.creditCard().cardNumber(), 7871 verification: n.creditCard().cardVerification(), 7872 }; 7873 } 7874 if (r) return !1; 7875 n.clearMessage(); 7876 IBE.Utils.request({ 7877 type: "POST", 7878 data: ko.toJSON(e), 7879 url: IBE.Config.apiBaseUrl + "/hotels/reservation/update/?apikey=" + IBE.Config.apiKey, 7880 beforeSend: function (t) { 7881 t.setRequestHeader("Authorization", IBE.Utils.authenticationCookie(n.username(), n.password())); 7882 }, 7883 }) 7884 .done(function (r) { 7885 if ( 7886 (n.cancelCode(""), 7887 n.currentReservation().reservation(new IBE.Models.Reservation(r)), 7888 n.customer(new IBE.ViewModels.CustomerPartialViewModel()), 7889 n.events.notifySubscribers(!0, t), 7890 n.events.notifySubscribers(!0, t), 7891 i === "UpdateCreditCard") 7892 ) { 7893 var u = { id: 200, severity: "success", text: IBE.Utils.translate("creditCardUpdated") }; 7894 n.message(u); 7895 } 7896 }) 7897 .fail(function () { 7898 var t = { id: 5002, severity: "error", text: IBE.Utils.translate("updateReservationFailed") }; 7899 n.message(t); 7900 n.events.notifySubscribers(t, "error"); 7901 }); 7902 }; 7903 n.resetPassword = function () { 7904 var i, t, r; 7905 return (n.clearMessage(), (i = IBE.Utils.getParam("hash")), !i) 7906 ? ((t = { id: 501, severity: "error", text: IBE.Utils.translate("invalidHash") }), n.message(t), !1) 7907 : n.newPassword() !== n.retypePassword() || n.newPassword() === "" 7908 ? ((t = { id: 501, severity: "error", text: IBE.Utils.translate("customerPasswordMismatch") }), 7909 n.message(t), 7910 !1) 7911 : ((r = { password: n.newPassword(), passwordConfirm: n.retypePassword(), hash: i }), 7912 $.ajax({ 7913 type: "POST", 7914 data: ko.toJSON(r), 7915 url: IBE.Config.apiBaseUrl + "/members/resetpassword?apikey=" + IBE.Config.apiKey, 7916 beforeSend: function () { 7917 n.ready(!1); 7918 }, 7919 success: function () { 7920 var t = { 7921 id: 200, 7922 severity: "success", 7923 text: IBE.Utils.translate("customerResetPasswordSuccess"), 7924 }; 7925 n.message(t); 7926 n.events.notifySubscribers(t, "password-changed"); 7927 }, 7928 error: function (t) { 7929 var i = { 7930 id: t.status, 7931 severity: "error", 7932 text: IBE.Utils.translate("customerResetPasswordFailure"), 7933 }; 7934 n.message(i); 7935 n.events.notifySubscribers(i, "password-error"); 7936 }, 7937 complete: function () { 7938 n.events.notifySubscribers(!0, "ready"); 7939 n.ready(!0); 7940 }, 7941 }), 7942 !0); 7943 }; 7944 n.createPassword = function () { 7945 var t, i, r; 7946 return (n.clearMessage(), n.ready(!1), (i = n.customer().resetHash), !i) 7947 ? ((t = { id: 501, severity: "error", text: IBE.Utils.translate("invalidHash") }), n.message(t), !1) 7948 : n.newPassword() !== n.retypePassword() || n.newPassword() === "" 7949 ? ((t = { id: 501, severity: "error", text: IBE.Utils.translate("customerPasswordMismatch") }), 7950 n.message(t), 7951 !1) 7952 : n.loyaltyTermsVisible() && !n.loyaltyAcceptTerms() 7953 ? !1 7954 : ((r = { password: n.newPassword(), passwordConfirm: n.retypePassword(), hash: i }), 7955 $.ajax({ 7956 type: "POST", 7957 data: ko.toJSON(r), 7958 url: IBE.Config.apiBaseUrl + "/members/resetpassword?apikey=" + IBE.Config.apiKey, 7959 beforeSend: function () { 7960 n.ready(!1); 7961 }, 7962 success: function () { 7963 t = { 7964 id: 200, 7965 severity: "success", 7966 text: IBE.Utils.translate("customerCreatePasswordSuccess"), 7967 }; 7968 n.message(t); 7969 n.events.notifySubscribers(t, "password-created"); 7970 }, 7971 error: function (i) { 7972 t = { 7973 id: i.status, 7974 severity: "error", 7975 text: IBE.Utils.translate("customerCreatePasswordFailure"), 7976 }; 7977 n.message(t); 7978 n.events.notifySubscribers(t, "password-error"); 7979 }, 7980 complete: function () { 7981 n.events.notifySubscribers(!0, "ready"); 7982 n.ready(!0); 7983 }, 7984 }), 7985 !0); 7986 }; 7987 n.init = function () { 7988 n.ready(!1);
7989 $.when(n.languagePartialInit(), n.currenciesPartialInit(), IBE.Utils.loadCountries()).then(function (i, r, u) { 7990 var f, e, o; 7991 (n._populateCountries(u), 7992 n.dispose(), 7993 t.push( 7994 n.lang.subscribe(function () { 7995 n.init(); 7996 }) 7997 ), 7998 (f = i.info.id), 7999 f) && 8000 (n.consents([]), 8001 IBE.Data.HotelInfo[f].info.consents && 8002 ((e = IBE.Data.HotelInfo[f].info.consents), 8003 ko.utils.arrayForEach(e, function (t) { 8004 n.consents.push(new IBE.Models.Consents(t)); 8005 })), 8006 IBE.Data.HotelInfo[f].info.termsAndPrivacy && 8007 ((o = IBE.Data.HotelInfo[f].info.termsAndPrivacy), (n.terms = new IBE.Models.Terms(o))), 8008 n.clearMessage(), 8009 IBE.Utils.haveAuthenticationCookie() 8010 ? n.login() 8011 : n.username() === "" || n.password() === "" 8012 ? (n.customer(null), n.ready(!0), n.events.notifySubscribers(!0, "ready")) 8013 : n.login()); 8014 }); 8015 }; 8016 n.customerDataRequest = function (t) { 8017 var i = { hotelId: IBE.Config.hotelId, requestType: t }; 8018 $.ajax({ 8019 type: "POST", 8020 url: IBE.Config.apiBaseUrl + "/members/personalDataRequest/?apikey=" + IBE.Config.apiKey, 8021 data: ko.toJSON(i), 8022 beforeSend: function (n) { 8023 IBE.Utils.haveAuthenticationCookie() && 8024 n.setRequestHeader("Authorization", IBE.Utils.authenticationCookie()); 8025 }, 8026 success: function () { 8027 var t = { id: 200, severity: "success", text: IBE.Utils.translate("customerDataRequestSuccess") }; 8028 n.message(t); 8029 n.customerEdit(!1); 8030 n.ready(!0); 8031 }, 8032 error: function (t) { 8033 n.events.notifySubscribers(!0, "ready"); 8034 var i = { id: t.status, severity: "error", text: t.responseText }; 8035 i.text = t.text; 8036 n.message(i); 8037 n.events.notifySubscribers(i, "error"); 8038 n.ready(!0); 8039 }, 8040 complete: function () { 8041 n.ready(!0); 8042 }, 8043 }); 8044 }; 8045 n.customerDataRequest = function (t) { 8046 var i = { hotelId: IBE.Config.hotelId, requestType: t }; 8047 $.ajax({ 8048 type: "POST", 8049 url: IBE.Config.apiBaseUrl + "/members/personalDataRequest/?apikey=" + IBE.Config.apiKey, 8050 data: ko.toJSON(i), 8051 beforeSend: function (t) { 8052 IBE.Utils.haveAuthenticationCookie() && 8053 t.setRequestHeader("Authorization", IBE.Utils.authenticationCookie()); 8054 n.ready(!1); 8055 }, 8056 success: function () { 8057 var t = { id: 200, severity: "success", text: IBE.Utils.translate("customerDataRequestSuccess") }; 8058 n.message(t); 8059 }, 8060 error: function (t) { 8061 n.events.notifySubscribers(!0, "ready"); 8062 var i = { id: t.status, severity: "error", text: t.responseText }; 8063 i.text = t.text; 8064 n.message(i); 8065 n.events.notifySubscribers(i, "error"); 8066 }, 8067 complete: function () { 8068 n.ready(!0); 8069 }, 8070 }); 8071 }; 8072 n.isMember = ko.observable(0); 8073 n.memberEmailExists = function () { 8074 n.username() !== "" && 8075 i(n.username()).then(function (t) { 8076 n.isMember(t); 8077 t < 0 && n.events.notifySubscribers(!0, "memberNotExist"); 8078 }); 8079 }; 8080 n._populateCountries = function (t) { 8081 n.countries.removeAll(); 8082 t.sort(function (n, t) { 8083 return n.name > t.name ? 1 : -1; 8084 }); 8085 ko.utils.arrayPushAll( 8086 n.countries, 8087 ko.utils.arrayMap(t, function (n) { 8088 return new IBE.Models.Country(n); 8089 }) 8090 ); 8091 }; 8092 n._populateAcceptedCreditCards = function () {}; 8093 n.getCustomerCountry = function () { 8094 if (!n.countries().length) return ""; 8095 var t = ko.utils.arrayFirst(n.countries(), function (t) { 8096 if (n.customer()) return t.code() === n.customer().country(); 8097 }); 8098 return t === null ? "" : t.name(); 8099 }; 8100 n.showUpdateMessage = ko.observable(!1); 8101 n.currentReservation = ko.observable(null); 8102 n.currentReservation.subscribe(function (t) { 8103 t != null && 8104 (n.clearMessage(), 8105 t.events.subscribe( 8106 function (t) { 8107 n.message(t); 8108 n.events.notifySubscribers(t, "webcheckinSave"); 8109 }, 8110 this, 8111 "webcheckinSave" 8112 ), 8113 t.events.subscribe( 8114 function (t) { 8115 n.message(t); 8116 n.events.notifySubscribers(t, "reservationstatus"); 8117 n.showUpdateMessage(!0); 8118 }, 8119 this, 8120 "reservationstatus" 8121 ), 8122 t.events.subscribe( 8123 function (t) { 8124 n.message(t); 8125 n.events.notifySubscribers(t, "error"); 8126 }, 8127 this, 8128 "error" 8129 )); 8130 }); 8131 n.cancelCode = ko.observable(""); 8132 n.cancelCodeIsValid = ko.computed(function () { 8133 return n.currentReservation() == null ? !1 : n.cancelCode() === n.currentReservation().reservation().code; 8134 }); 8135 n.showCheckin = function (t) { 8136 n.currentReservation(new IBE.ViewModels.Reservation(t)); 8137 n.events.notifySubscribers(!0, "showCheckin"); 8138 }; 8139 n.showReservation = function (t) { 8140 n.currentReservation(new IBE.ViewModels.Reservation(t)); 8141 n.events.notifySubscribers(!0, "showReservation"); 8142 }; 8143 n.initCustomerData = function () { 8144 n.customer() 8145 .reservations() 8146 .sort(function (n, t) { 8147 return n.webCheckInActive() === t.webCheckInActive() ? 0 : n.webCheckInActive() ? -1 : 1; 8148 }); 8149 n.creditCard = ko.observable(new IBE.Models.CreditCard()); 8150 }; 8151 n.webCheckInIsActive = function () { 8152 var t = ko.utils.arrayFirst(n.customer().reservations(), function (n) { 8153 return n.webCheckInActive(); 8154 }); 8155 return t !== null; 8156 }; 8157 n.genders = [ 8158 { name: "", value: IBE.Config.gender.Unknown }, 8159 { name: "male", value: IBE.Config.gender.Male }, 8160 { name: "female", value: IBE.Config.gender.Female }, 8161 ]; 8162 n.idDocumentTypes = [ 8163 { name: "", value: IBE.Config.idDocumentType.Unknown }, 8164 { name: "identityCard", value: IBE.Config.idDocumentType.IdentityCard }, 8165 { name: "passport", value: IBE.Config.idDocumentType.Pass
8165port }, 8166 { name: "drivingLicense", value: IBE.Config.idDocumentType.DrivingLicense }, 8167 ]; 8168 n.titles = [ 8169 { name: "", value: IBE.Config.titles.Unknown }, 8170 { name: "mr", value: IBE.Config.titles.Mr }, 8171 { name: "mrs", value: IBE.Config.titles.Mrs }, 8172 { name: "miss", value: IBE.Config.titles.Miss }, 8173 { name: "ms", value: IBE.Config.titles.Ms }, 8174 { name: "dr", value: IBE.Config.titles.Dr }, 8175 ]; 8176}; 8177IBE.ViewModels.ClaimMembership = function () { 8178 var n = this; 8179 n.events = new ko.subscribable(); 8180 n.ready = ko.observable(!0); 8181 ko.utils.extend(n, new IBE.ViewModels.LanguagePartialViewModel(n)); 8182 ko.utils.extend(n, new IBE.ViewModels.CurrenciesPartialViewModel(n)); 8183 ko.utils.extend(n, new IBE.ViewModels.Message()); 8184 n.useNotesValidation = ko.observable(!1); 8185 n.firstName = ko.observable("").extend({ required: { message: IBE.Utils.translate("validation.required") } }); 8186 n.lastName = ko.observable("").extend({ required: { message: IBE.Utils.translate("validation.required") } }); 8187 n.email = ko.observable("").extend({ required: { message: IBE.Utils.translate("validation.required") } }); 8188 n.telephone = ko.observable("").extend({ required: { message: IBE.Utils.translate("validation.required") } }); 8189 n.notes = ko.observable("").extend({ 8190 required: { 8191 message: IBE.Utils.translate("validation.required"), 8192 onlyIf: function () { 8193 return n.useNotesValidation(); 8194 }, 8195 }, 8196 }); 8197 n.dateOfArrival = ko.observable(moment()); 8198 n.reservationCode = ko.observable(""); 8199 n.apiResponse = ko.observable(null); 8200 n.submit = function () { 8201 var t, i; 8202 if ((n.apiResponse(null), (t = ko.validation.group(n, { deep: !0 })), t().length)) { 8203 t.showAllMessages(!0); 8204 return; 8205 } 8206 i = { 8207 firstName: n.firstName(), 8208 lastName: n.lastName(), 8209 email: n.email(), 8210 telephone: n.telephone(), 8211 dateOfArrival: n.dateOfArrival() === "" ? null : IBE.Utils.dateIsoFormat(n.dateOfArrival()), 8212 reservationCode: n.reservationCode(), 8213 notes: n.notes(), 8214 }; 8215 $.ajax({ 8216 type: "POST", 8217 data: ko.toJSON(i), 8218 url: "{0}/members/claim?apikey={1}&hotelId={2}".format( 8219 IBE.Config.apiBaseUrl, 8220 IBE.Config.apiKey, 8221 IBE.Config.hotelId 8222 ), 8223 beforeSend: function () { 8224 n.ready(!1); 8225 }, 8226 success: function (t) { 8227 n.apiResponse(t); 8228 n.clearModel(); 8229 }, 8230 error: function (n) { 8231 IBE.Utils.consoleLog(n.responseJSON.message); 8232 }, 8233 complete: function () { 8234 n.ready(!0); 8235 }, 8236 }); 8237 }; 8238 n.clearModel = function () { 8239 n.firstName(""); 8240 n.lastName(""); 8241 n.email(""); 8242 n.telephone(""); 8243 n.dateOfArrival(""); 8244 n.reservationCode(""); 8245 n.firstName.clearError(); 8246 n.lastName.clearError(); 8247 n.email.clearError(); 8248 n.telephone.clearError(); 8249 n.dateOfArrival.clearError(); 8250 n.reservationCode.clearError(); 8251 }; 8252}; 8253IBE.ViewModels.ModifyReservation = function (n) { 8254 function f(n) { 8255 n && 8256 (t.ready(!1), 8257 (n.reservationId = t.reservation().id), 8258 (allowForward = !0), 8259 t.currentStep() === "Step1-Rooms" ? t.setStep("Step2-Rooms", n) : t.setStep("Step2-Dates", n)); 8260 } 8261 function r(n) { 8262 n && ((n.reservationId = t.reservation().id), (allowForward = !0), t.ready(!1), t.setStep("Step3", n)); 8263 } 8264 function u(n) { 8265 n && ((n.reservationId = t.reservation().id), (allowForward = !0), t.ready(!1), t.setStep("Step4", n)); 8266 } 8267 var t = this, 8268 i; 8269 t.events = new ko.subscribable(); 8270 t.ready = ko.observable(!1); 8271 t.ready.subscribe(function (n) { 8272 loader.visible(!n); 8273 }); 8274 t.tabsCount = 1; 8275 t.activeTabIndex = ko.observable(0); 8276 t.activeRoomIndex = ko.observable(1); 8277 t.activeRooms = ko.observableArray([]); 8278 t.modifiedRoomsNotAvailable = ko.observable(!1); 8279 t.reservation = ko.observable(n); 8280 t.reservation().customer = new IBE.ViewModels.CustomerPartialViewModel();
8281 ko.utils.extend(t, new IBE.ViewModels.LanguagePartialViewModel(t)); 8282 ko.utils.extend(t, new IBE.ViewModels.CurrenciesPartialViewModel(t)); 8283 ko.utils.extend(t, new IBE.ViewModels.Message()); 8284 ko.utils.extend(t, new IBE.ViewModels.PartialAuthenticateMembership(t)); 8285 t.reservationSupplements = ko.observableArray([]); 8286 t.totalCostDifference = ko.observable(0); 8287 t.countries = ko.observableArray([]); 8288 i = []; 8289 t.dispose = function () { 8290 for (var n in i) i[n].dispose(); 8291 }; 8292 t.init = function () { 8293 t.ready(!1); 8294 $.when(t.languagePartialInit(), t.currenciesPartialInit(), IBE.Utils.loadCountries()).then(function (n, r, u) { 8295 t.countries.removeAll(); 8296 ko.utils.arrayPushAll( 8297 t.countries, 8298 ko.utils.arrayMap(u, function (n) { 8299 return new IBE.Models.Country(n); 8300 }) 8301 ); 8302 t.dispose(); 8303 i.push( 8304 t.lang.subscribe(function () { 8305 t.init(); 8306 }) 8307 ); 8308 t.clearMessage(); 8309 IBE.Utils.haveAuthenticationCookie() 8310 ? (t.ready(!0), t.setStep("Wizard"), t.events.notifySubscribers(!0, "ready")) 8311 : t.ready(!1); 8312 }); 8313 }; 8314 t.step1 = new IBE.ViewModels.Step1ViewModel(); 8315 t.currentStep = ko.observable(""); 8316 t.setStep = function (n, i) { 8317 switch (n) { 8318 case "Wizard": 8319 IBE.Utils.destroyView("Step1-Dates"); 8320 IBE.Utils.destroyView("Step1-Rooms"); 8321 IBE.Utils.destroyView("Step2-Dates"); 8322 IBE.Utils.destroyView("Step2-Rooms"); 8323 IBE.Utils.destroyView("Step3-Modify"); 8324 IBE.Utils.destroyView("Step4-Modify"); 8325 IBE.Utils.destroyView("Cancel"); 8326 IBE.Utils.destroyView("Payment"); 8327 IBE.Utils.destroyView("Modify-Supplements"); 8328 t.currentStep("Wizard"); 8329 IBE.Utils.bindTemplate("Wizard", t); 8330 break; 8331 case "Step1-Dates": 8332 t.ready(!1); 8333 IBE.Utils.destroyView("Wizard"); 8334 IBE.Utils.destroyView("Step1-Rooms"); 8335 IBE.Utils.destroyView("Step2-Dates"); 8336 IBE.Utils.destroyView("Step2-Rooms"); 8337 IBE.Utils.destroyView("Step3-Modify"); 8338 IBE.Utils.destroyView("Step4-Modify"); 8339 IBE.Utils.destroyView("Payment"); 8340 IBE.Utils.destroyView("Cancel"); 8341 IBE.Utils.destroyView("Modify-Supplements"); 8342 t.currentStep("Step1-Dates"); 8343 t.initStep1(); 8344 break; 8345 case "Step1-Rooms": 8346 t.ready(!1); 8347 IBE.Utils.destroyView("Wizard"); 8348 IBE.Utils.destroyView("Step1-Dates"); 8349 IBE.Utils.destroyView("Step2-Dates"); 8350 IBE.Utils.destroyView("Step2-Rooms"); 8351 IBE.Utils.destroyView("Step3-Modify"); 8352 IBE.Utils.destroyView("Step4-Modify"); 8353 IBE.Utils.destroyView("Payment"); 8354 IBE.Utils.destroyView("Cancel"); 8355 IBE.Utils.destroyView("Modify-Supplements"); 8356 t.currentStep("Step1-Rooms"); 8357 t.initStep1(); 8358 break; 8359 case "Modify-Supplements": 8360 IBE.Utils.destroyView("Wizard"); 8361 IBE.Utils.destroyView("Step1-Dates"); 8362 IBE.Utils.destroyView("Step1-Rooms"); 8363 IBE.Utils.destroyView("Step2-Dates"); 8364 IBE.Utils.destroyView("Step2-Rooms"); 8365 IBE.Utils.destroyView("Step3-Modify"); 8366 IBE.Utils.destroyView("Step4-Modify"); 8367 IBE.Utils.destroyView("Cancel"); 8368 IBE.Utils.destroyView("Payment"); 8369 t.currentStep("Modify-Supplements"); 8370 t.initSupplements(); 8371 break; 8372 case "Step2-Rooms": 8373 t.ready(!1); 8374 IBE.Utils.destroyView("Wizard"); 8375 IBE.Utils.destroyView("Step1-Dates"); 8376 IBE.Utils.destroyView("Step1-Rooms"); 8377 IBE.Utils.destroyView("Step2-Dates"); 8378 IBE.Utils.destroyView("Step3-Modify"); 8379 IBE.Utils.destroyView("Payment"); 8380 IBE.Utils.destroyView("Cancel"); 8381 IBE.Utils.destroyView("Modify-Supplements"); 8382 t.currentStep("Step2-Rooms"); 8383 t.initStep2(i); 8384 break; 8385 case "Step2-Dates": 8386 t.ready(!1); 8387 IBE.Utils.destroyView("Wizard"); 8388 IBE.Utils.destroyView("Step1-Dates"); 8389 IBE.Utils.destroyView("Step1-Rooms"); 8390 IBE.Utils.destroyView("Step2-Rooms"); 8391 IBE.Utils.destroyView("Step3-Modify"); 8392 IBE.Utils.destroyView("Step4-Modify"); 8393 IBE.Utils.destroyView("Payment"); 8394 IBE.Utils.destroyView("Cancel"); 8395 IBE.Utils.destroyView("Step4-Modify"); 8396 IBE.Utils.destroyView("Modify-Supplements"); 8397 t.currentStep("Step2-Dates"); 8398 t.initStep2(i); 8399 break; 8400 case "Step3": 8401 IBE.Utils.destroyView("Wizard"); 8402 IBE.Utils.destroyView("Step1-Dates"); 8403 IBE.Utils.destroyView("Step1-Rooms"); 8404 IBE.Utils.destroyView("Step2-Dates"); 8405 IBE.Utils.destroyView("Step2-Rooms"); 8406 IBE.Utils.destroyView("Step4-Modify"); 8407 IBE.Utils.destroyView("Payment"); 8408 IBE.Utils.destroyView("Cancel"); 8409 IBE.Utils.destroyView("Modify-Supplements"); 8410 t.currentStep("Step3"); 8411 t.initStep3(i); 8412 break; 8413 case "Step4": 8414 IBE.Utils.destroyView("Wizard"); 8415 IBE.Utils.destroyView("Step1-Dates"); 8416 IBE.Utils.destroyView("Step1-Rooms"); 8417 IBE.Utils.destroyView("Step2-Dates"); 8418 IBE.Utils.destroyView("Step2-Rooms"); 8419 IBE.Utils.destroyView("Step3-Modify"); 8420 IBE.Utils.destroyView("Payment"); 8421 IBE.Utils.destroyView("Cancel"); 8422 IBE.Utils.destroyView("Modify-Supplements"); 8423 t.currentStep("Step4"); 8424 t.initStep4(i); 8425 break; 8426 case "cancelReservation": 8427 IBE.Utils.destroyView("Wizard"); 8428 IBE.Utils.destroyView("Step1-Dates"); 8429 IBE.Utils.destroyView("Step1-Rooms"); 8430 IBE.Utils.destroyView("Step2-Dates"); 8431 IBE.Utils.destroyView("Step2-Rooms"); 8432 IBE.Utils.destroyView("Step3-Modify"); 8433 IBE.Utils.destroyView("Step4-Modify"); 8434 IBE.Utils.destroyView("Payment"); 8435 IBE.Utils.destroyView("Modify-Supplements"); 8436 t.currentStep("Cancel"); 8437 t.initCancel(i); 8438 break; 8439 case "modifyPaymentMethod": 8440 IBE.Utils.destroyView("Wizard"); 8441 IBE.Utils.destroyView("Step1-Dates"); 8442 IBE.Utils.destroyView("Step1-Rooms"); 8443 IBE.Utils.destroyView("Step2-Dates"); 8444 IBE.Utils.destroyView("Step2-Rooms"); 8445 IBE.Utils.destroyView("Step3-Modify"); 8446 IBE.Utils.destroyView("Step4-Modify"); 8447 IBE.Utils.destroyView("Cancel"); 8448 IBE.Utils.destroyView("Modify-Supplements"); 8449 t.currentStep("Payment"); 8450 t.initModifyPayment(i); 8451 } 8452 }; 8453 t.initStep1 = function () { 8454 t.step1.init(); 8455 }; 8456 t.initStep2 = function (n) { 8457 if ( 8458 (typeof t.step2 == "undefined" && 8459 ((t.step2 = new IBE.ViewModels.Step2ViewModel()), 8460 t.step2.events.subscribe( 8461 function (n) { 8462 r(n); 8463 }, 8464 this, 8465 "call" 8466 ), 8467 t.step2.events.subscribe( 8468 function (n) { 8469 r(n); 8470 }, 8471 this, 8472 "submit" 8473 ), 8474 t.step2.events.subscribe( 8475 function () { 8476 t.currentStep() === "Step2-Rooms" 8477 ? $.when(IBE.Utils.bindTemplate("Step2-Rooms", t)).then(function () { 8478 t.ready(!0); 8479 }) 8480 : $.when(IBE.Utils.bindTemplate("Step2-Dates", t)).then(function () { 8481 t.ready(!0); 8482 }); 8483 }, 8484 this, 8485 "ready" 8486 ), 8487 t.step2.events.subscribe( 8488 function (n) { 8489 n.severity === "Forbidden" && t.ready(!1); 8490 loader.title("Failed to initialize booking engine :("); 8491 loader.message(n); 8492 IBE.Utils.logEvent(n); 8493 }, 8494 this, 8495 "error" 8496 )), 8497 (t.step2.lang = t.lang), 8498 (t.step2.currency = t.currency), 8499 typeof n != "undefined") 8500 ) 8501 try { 8502 t.step2.init(n); 8503 t.activeTabIndex(0); 8504 t.activeRoomIndex(1); 8505 t.activeRooms([]); 8506 t.step2.selectedRooms([]); 8507 t.modifiedRoomsNotAvailable(!1); 8508 } catch (i) { 8509 return t.step1.message(i.message), IBE.Utils.logEvent(i), t.ready(!0), !1; 8510 } 8511 return !0; 8512 }; 8513 t.initStep3 = function (n) { 8514 return ( 8515 typeof step3 == "undefined" &&
8516 ((t.step3 = new IBE.ViewModels.modifyStep3ViewModel()), 8517 t.step3.events.subscribe( 8518 function (n) { 8519 u(n); 8520 }, 8521 this, 8522 "submit" 8523 ), 8524 t.step3.events.subscribe( 8525 function () { 8526 IBE.Utils.bindTemplate("Step3-Modify", t); 8527 t.step3.paymentPolicyRules( 8528 t.getPaymentRulesText( 8529 n.bookingInfo.payments, 8530 n.bookingInfo.cost, 8531 n.bookingInfo.checkIn, 8532 n.bookingInfo.checkOut 8533 ) 8534 ); 8535 t.ready(!0); 8536 }, 8537 this, 8538 "ready" 8539 ), 8540 t.step3.events.subscribe( 8541 function (n) { 8542 loader.title("Failed to initialize booking engine :("); 8543 loader.message(n); 8544 loader.visible(!0); 8545 IBE.Utils.logEvent(n); 8546 }, 8547 this, 8548 "error" 8549 )), 8550 (t.step3.lang = t.lang), 8551 (t.step3.paymentPolicyRules = ko.observableArray([])), 8552 t.step3.init(n), 8553 (t.step3.currency = t.currency), 8554 !0 8555 ); 8556 }; 8557 t.initStep4 = function (n) { 8558 t.currentStep = 4; 8559 typeof t.step4 == "undefined" && 8560 ((t.step4 = new IBE.ViewModels.ModifyStep4ViewModel()), 8561 t.step4.events.subscribe( 8562 function (n) { 8563 u(n); 8564 }, 8565 this, 8566 "call" 8567 ), 8568 t.step4.events.subscribe( 8569 function (n) { 8570 u(n); 8571 }, 8572 this, 8573 "submit" 8574 ), 8575 t.step4.events.subscribe( 8576 function () { 8577 t.reservation(t.step4.reservation()); 8578 IBE.Utils.destroyView("Step3-Modify"); 8579 t.ready(!0); 8580 IBE.Utils.bindTemplate("Step4-Modify", t); 8581 }, 8582 this, 8583 "ready" 8584 ), 8585 t.step4.events.subscribe( 8586 function (n) { 8587 t.ready(!0); 8588 t.step3.clearMessage(); 8589 t.step3.message(n); 8590 n.severity == "critical" && 8591 (loader.title("Failed to submit booking :("), loader.message(n), loader.visible(!0)); 8592 IBE.Utils.logEvent(n); 8593 }, 8594 this, 8595 "error" 8596 )); 8597 t.step4.lang = t.lang; 8598 t.step4.currency = t.currency; 8599 try { 8600 t.step4.init(n); 8601 } catch (i) { 8602 t.step3.clearMessage(); 8603 var r = { id: "4001", severity: i.severity, text: i.text || i.message }; 8604 return t.step3.message(r), IBE.Utils.logEvent(r), t.ready(!0), !1; 8605 } 8606 return !0; 8607 }; 8608 t.initCancel = function () { 8609 IBE.Utils.bindTemplate("Cancel", t); 8610 }; 8611 t.initSupplements = function () { 8612 var i, r, u, f; 8613 t.ready(!1); 8614 i = parseInt(IBE.Config.hotelId); 8615 typeof t.supplements != "undefined" && t.supplements([]); 8616 r = []; 8617 ko.utils.arrayForEach(n.rooms, function (n) { 8618 var i = t.createGuestTypes(n); 8619 r.push(i); 8620 }); 8621 t.selectedRooms = []; 8622 ko.utils.arrayForEach(t.reservation().rooms, function (n) { 8623 var i = new IBE.Models.SelectedRoom(); 8624 i.roomIndex(n.roomIndex); 8625 i.roomId(n.id); 8626 i.ratePlanId(n.ratePlanId); 8627 i.boardType(n.board.type); 8628 i.board = n.board; 8629 i.guestTypes = t.createGuestTypes(n); 8630 i.cost(n.totalCost); 8631 i.costWithoutDiscount(n.roomCostBeforeDiscount); 8632 i.roomInfo = ko.observable(); 8633 i.roomInfo({ name: n.name }); 8634 t.selectedRooms.push(i); 8635 }); 8636 u = { 8637 checkIn: n.checkIn, 8638 checkOut: n.checkOut, 8639 rooms: r, 8640 ratePlan: 0, 8641 couponCode: n.couponCode, 8642 board: n.rooms[0].board.type, 8643 ipAddress: null,
8644 lang: t.lang() || IBE.Config.lang || IBE.Config.defaultLang, 8645 hotelId: i, 8646 reservationId: n.id || 0, 8647 device: IBE.Config.deviceType, 8648 }; 8649 f = ko.toJSON(u); 8650 IBE.Utils.request({ 8651 type: "POST", 8652 contentType: "application/json", 8653 url: IBE.Config.apiBaseUrl + "/hotels/rates/" + i + "/?apikey=" + IBE.Config.apiKey, 8654 data: f, 8655 }) 8656 .done(function (n) { 8657 n != null && 8658 n.request != null && 8659 n.request.hotelResults != null && 8660 ko.utils.arrayForEach(n.request.hotelResults, function (n) { 8661 ko.utils.extend(t, new IBE.ViewModels.SupplementPartialViewModel(n.supplements, 0)); 8662 }); 8663 var i = []; 8664 ko.utils.arrayForEach(t.reservation().supplements, function (n) { 8665 i.push(n); 8666 }); 8667 t.reservationSupplements(i); 8668 IBE.Utils.bindTemplate("Modify-Supplements", t); 8669 t.ready(!0); 8670 }) 8671 .fail(function (n) { 8672 t.ready(!0); 8673 var i = { id: n.status, severity: "critical", text: n.statusText + ": " + n.responseText }; 8674 return t.events.notifySubscribers(!1, "ready"), t.events.notifySubscribers(i, "error"), t.message(i), i; 8675 }); 8676 }; 8677 t.supplementIsMandatory = function (n) { 8678 var i = !1; 8679 return ( 8680 ko.utils.arrayForEach(t.supplements(), function (t) { 8681 ko.utils.arrayForEach(t.supplementResults(), function (t) { 8682 t.supplementId() === n && t.isMandatory && (i = !0); 8683 }); 8684 }), 8685 i 8686 ); 8687 }; 8688 t.uniqueAlreadyExist = function (n) { 8689 var i = ko.utils.arrayFirst(t.reservationSupplements(), function (t) { 8690 return t.supplementId() === n; 8691 }); 8692 return i != null && i.isUnique() ? !0 : !1; 8693 }; 8694 t.totalCostDifference = ko.computed({ 8695 read: function () { 8696 var n = 0, 8697 i = 0; 8698 return ( 8699 ko.utils.arrayForEach(t.reservationSupplements(), function (t) { 8700 n = n + t.totalPrice(); 8701 }), 8702 ko.utils.arrayForEach(t.supplements(), function (t) { 8703 ko.utils.arrayForEach(t.supplementResults(), function (t) { 8704 t.isMandatory || (n = n + t.totalPrice()); 8705 }); 8706 }), 8707 ko.utils.arrayForEach(t.reservation().rooms, function (n) { 8708 i = i + n.totalCost; 8709 }), 8710 i + n - t.reservation().totalCost() 8711 ); 8712 }, 8713 deferEvaluation: !0, 8714 }); 8715 t.deleteReservationSupplement = function (n, i, r) { 8716 var u = ko.utils.arrayFirst(t.reservationSupplements(), function (t) { 8717 return t.supplementId() === n && t.roomIndex() === i && t.guestTypeId() === r; 8718 }); 8719 u !== null && t.reservationSupplements.remove(u); 8720 }; 8721 t.submitSupplementChanges = function () { 8722 var i, r, u, f, e; 8723 t.ready(!1); 8724 i = []; 8725 ko.utils.arrayForEach(t.reservationSupplements(), function (n) { 8726 var t = { supplementId: n.supplementId(), roomIndex: n.roomIndex(), guestTypeId: n.guestTypeId() }; 8727 i.push(t); 8728 }); 8729 r = []; 8730 ko.utils.arrayForEach(n.rooms, function (n) { 8731 var i = t.createGuestTypes(n); 8732 r.push(i); 8733 }); 8734 u = []; 8735 ko.utils.arrayForEach(t.selectedSupplements(), function (n) { 8736 ko.utils.arrayForEach(n.prices(), function (t) { 8737 if (t.quantity() > 0) { 8738 var i = new IBE.Models.BookingSupplement(), 8739 f = ko.utils.unwrapObservable(n.roomIndex), 8740 r = t.guestType; 8741 switch (IBE.Config.supplementPricingType[n.pricingType()]) { 8742 case IBE.Config.supplementPricingType.PerReservation: 8743 r = 0; 8744 f = 0; 8745 break; 8746 case IBE.Config.supplementPricingType.PerRoom: 8747 r = 0; 8748 } 8749 i.roomIndex = f; 8750 i.supplementId = ko.utils.unwrapObservable(n.supplementId); 8751 i.quantity = ko.utils.unwrapObservable(t.quantity); 8752 i.guestType = r; 8753 i.categoryName = n.category; 8754 i.ratePlanId = ko.utils.unwrapObservable(n.ratePlanId); 8755 i.pricingType = IBE.Config.supplementPricingType[n.pricingType()]; 8756 i.isMandatory = n.isMandatory; 8757 u.push(i); 8758 } 8759 }); 8760 }); 8761 f = { reservationId: t.reservation().id, existingSupplements:
8761i, roomsGuest: r, newSupplements: u }; 8762 e = ko.toJSON(f); 8763 IBE.Utils.request({ 8764 type: "POST", 8765 contentType: "application/json", 8766 url: IBE.Config.apiBaseUrl + "/hotels/reservation/update/supplements/?apikey=" + IBE.Config.apiKey, 8767 data: e, 8768 }) 8769 .done(function () { 8770 t.ready(!0); 8771 var n = { id: 200, severity: "success", text: IBE.Utils.translate("supplementsUpdateSuccess") }; 8772 t.message(n); 8773 t.events.notifySubscribers(!0, "ready"); 8774 }) 8775 .fail(function (n) { 8776 t.ready(!0); 8777 var i = { id: n.status, severity: "critical", text: n.statusText + ": " + n.responseText }; 8778 return t.message(i), t.events.notifySubscribers(!1, "ready"), t.events.notifySubscribers(i, "error"), i; 8779 }); 8780 }; 8781 t.initModifyPayment = function () { 8782 IBE.Utils.bindTemplate("Payment", t); 8783 t.events.subscribe( 8784 function (n) { 8785 console.log(n); 8786 }, 8787 this, 8788 "reservationstatus" 8789 ); 8790 }; 8791 t.step1.ready.subscribe(function (n) { 8792 if (n) { 8793 t.ready(!1); 8794 t.step1.checkIn(moment(t.reservation().checkIn)); 8795 t.step1.checkOut(moment(t.reservation().checkOut)); 8796 t.step1.couponCode(t.reservation().couponCode); 8797 t.step1.boardType(t.reservation().rooms[0].board.type); 8798 t.reservation().rooms = t.reservation().rooms.sort(function (n, t) { 8799 return n > t ? 1 : 0; 8800 }); 8801 var i = [], 8802 r = 1; 8803 ko.utils.arrayForEach(t.reservation().rooms, function (n) { 8804 var u = new IBE.Models.RequestedRoom(r++); 8805 u.guests = t.createGuestTypes(n); 8806 i.push(u); 8807 }); 8808 t.step1.requestedRooms(i); 8809 ko.utils.arrayForEach(t.step1.requestedRooms(), function (n, i) { 8810 n.preferredBoard(t.reservation().rooms[i].board.type); 8811 }); 8812 t.currentStep() === "Step1-Rooms" 8813 ? $.when(IBE.Utils.bindTemplate("Step1-Rooms", t)).then(function () { 8814 t.ready(!0); 8815 }) 8816 : $.when(IBE.Utils.bindTemplate("Step1-Dates", t)).then(function () { 8817 t.ready(!0); 8818 }); 8819 } 8820 }); 8821 t.step1.events.subscribe( 8822 function (n) { 8823 n.success && f(n.success); 8824 n.failure && (IBE.Utils.consoleLog("Failed to submit step 1"), IBE.Utils.consoleLog(n.failure)); 8825 }, 8826 this, 8827 "submit" 8828 ); 8829 t.boardChanged = function (n, i) { 8830 var r = t.step2.selectedRooms()[i - 1]; 8831 }; 8832 t.checkRoomAvailability = function (n, i) { 8833 var r = { 8834 roomExist: !1, 8835 rooms: [], 8836 selectedRoom: ko.observable(null), 8837 selectedRoomResult: ko.observable(null), 8838 selectedRateplan: ko.observable(null), 8839 selectedBoard: ko.observable(null), 8840 selectedRoomRateplans: ko.observableArray([]), 8841 }, 8842 f, 8843 u; 8844 return (r.selectedRoom.subscribe(function (i) { 8845 if (i) { 8846 var u = t.constructSelectedRoom(i), 8847 e = !1, 8848 f = []; 8849 ko.utils.arrayForEach(i.rateplans(), function (n) { 8850 n.info().hideStandardRate && (e = !0); 8851 }); 8852 e 8853 ? ko.utils.arrayForEach(i.rateplans(), function (n) { 8854 n.ratePlanId() !== 0 && f.push(n); 8855 }) 8856 : (f = i.rateplans()); 8857 r.selectedRoomRateplans(f); 8858 r.selectedRoomResult(i); 8859 u.rateplans = i.rateplans; 8860 t.activeRooms()[n - 1] ? t.activeRooms.replace(t.activeRooms()[n - 1], u) : t.activeRooms.push(u); 8861 } 8862 }), 8863 r.selectedRateplan.subscribe(function (i) { 8864 var u = JSON.parse(JSON.stringify(ko.toJS(r.selectedRoom()))), 8865 f; 8866 u.ratePlanId = i; 8867 r.selectedBoard() !== null && (u.boardType = r.selectedBoard().boardType); 8868 f = t.constructSelectedRoom(u); 8869 f.rateplans = r.selectedRoomRateplans(); 8870 t.activeRooms.replace(t.activeRooms()[n - 1], f); 8871 }), 8872 r.selectedBoard.subscribe(function (i) { 8873 var u = JSON.parse(JSON.stringify(ko.toJS(r.selectedRoom()))), 8874 f; 8875 u.boardType = i.boardType; 8876 u.ratePlanId = r.selectedRateplan(); 8877 f = t.constructSelectedRoom(u); 8878 f.rateplans = r.selectedRoomRateplans(); 8879 t.activeRooms.replace(t.activeRooms()[n - 1], f); 8880 }), 8881 (f = ko.utils.arrayFirst(t.reservation().rooms, function (t) { 8882 return t.roomIndex === n; 8883 })), 8884 (u = ko.utils.arrayFilter(i, function (n) { 8885 return t.reservationRoomIsAvailable(n); 8886 })), 8887 !u.length) 8888 ? r 8889 : ((r.rooms = u), r); 8890 }; 8891 t.hasAvailabilty = function (n) { 8892 var i = [], 8893 r; 8894 return ( 8895 ko.utils.arrayForEach(n, function (n) { 8896 var r = !1; 8897 ko.utils.arrayForEach(n.roomResults(), function (n) { 8898 t.reservationRoomIsAvailable(n) && (r = !0); 8899 }); 8900 i.push(r); 8901 }), 8902 (r = ko.utils.arrayFirst(i, function (n) { 8903 return !n; 8904 })), 8905 r == null 8906 ); 8907 }; 8908 t.selectRoom = function () { 8909 t.modifiedRoomsNotAvailable(!1); 8910 t.pushToSelectedRooms(t.activeRooms()[t.activeRoomIndex() - 1]); 8911 var n = t.activeTabIndex() + 1, 8912 r = n + 1, 8913 i = !1; 8914 if ( 8915 (ko.utils.arrayForEach(t.step2.request().hotelResults(), function (n) { 8916 var t = ko.utils.arrayFilter(n.requestedRooms(), function (n) { 8917 return r == n.roomIndex(); 8918 }); 8919 t.length > 0 && (i = !0); 8920 }), 8921 i) 8922 ) 8923 return t.activeTabIndex(n), t.activeRoomIndex(t.activeRoomIndex() + 1), !0; 8924 t.modifiedRoomsAreAvailable() && t.step2Submit(); 8925 t.modifiedRoomsNotAvailable(!0); 8926 }; 8927 t.pushToSelectedRooms = function (n) { 8928 var i = t.constructSelectedRoom(n); 8929 t.step2.selectedRooms.push(i); 8930 }; 8931 t.constructSelectedRoom = function (n) { 8932 var i = new IBE.Models.SelectedRoom(), 8933 f, 8934 e, 8935 r, 8936 u; 8937 return ( 8938 i.roomIndex(ko.unwrap(n.roomIndex)), 8939 i.roomId(ko.unwrap(n.roomId)), 8940 i.ratePlanId(ko.unwrap(n.ratePlanId)), 8941 i.boardType(ko.unwrap(n.boardType)), 8942 (f = ko.utils.arrayFirst(t.step2.boards(), function (n) { 8943 return n.boardType === i.boardType(); 8944 })), 8945 i.board(f), 8946 i.availability(ko.unwrap(n.availability)), 8947 (i.guestTypes = ko.observableArray([])), 8948 ko.utils.arrayForEach(t.step2.request().hotelResults(), function (t) { 8949 ko.utils.arrayForEach(t.requestedRooms(), function (t) { 8950 if (ko.unwrap(n.roomIndex) === ko.unwrap(t.roomIndex)) { 8951 i.guestTypes(t.guests()); 8952 return; 8953 } 8954 }); 8955 }), 8956 (e = ko.utils.arrayFirst(ko.unwrap(n.rateplans), function (n) { 8957 return ko.unwrap(n.ratePlanId) === i.ratePlanId(); 8958 })), 8959 (r = ko.utils.arrayFirst(ko.unwrap(e.roomBoards), function (n) { 8960 return ko.unwrap(n.boardType) === i.boardType(); 8961 })), 8962 typeof r != "undefined" && 8963 r != null && 8964 (i.cost(ko.unwrap(r.price)), i.costWithoutDiscount(ko.unwrap(r.priceWithoutDiscount))), 8965 (i.roomInfo = ko.observable()), 8966 (u = t.step2.rooms.filterByProperty("id", ko.unwrap(n.roomId))), 8967 u().length > 0 && i.roomInfo(u()[0]), 8968 i 8969 ); 8970 }; 8971 t.reservationRoomIsAvailable = function (n) { 8972 return n.availability > 0 && n.availableRooms > 0; 8973 }; 8974 t.step2Submit = function () { 8975 t.step2.selectedRooms().length < t.step1.requestedRooms().length && 8976 ko.utils.arrayForEach(t.reservation().rooms, function (n) { 8977 ko.utils.arrayForEach(t.step2.selectedRooms(), function (i) { 8978 var r, f, u; 8979 n.roomIndex !== i.roomIndex() && 8980 ((r = new IBE.Models.SelectedRoom()), 8981 r.roomIndex(n.roomIndex), 8982 r.roomId(n.id), 8983 r.ratePlanId(n.ratePlanId), 8984 r.boardType(n.board.type), 8985 (f = ko.utils.arrayFirst(t.step2.boards(), function (n) { 8986 return n.boardType === r.boardType(); 8987 })), 8988 r.board(f), 8989 (r.guestTypes = t.createGuestTypes(n)), 8990 r.cost(n.totalCost), 8991 r.costWithoutDiscount(n.roomCostBeforeDiscount), 8992 (r.roomInfo = ko.observable()), 8993 (u = t.step2.rooms.filterByProperty("id", ko.unwrap(n.id))), 8994 u().length > 0 && r.roomInfo(u()[0]), 8995 t.step2.selectedRooms.push(r)); 8996 }); 8997 }); 8998 var n = {}; 8999 n.bookingInfo = { 9000 checkIn: moment(t.step2.request().checkIn()).format("YYYY-MM-DD"), 9001 checkOut: moment(t.step2.request().checkOut()).format("YYYY-MM-DD"), 9002 rooms: t.step2.selectedRooms(), 9003 reservationId: t.reservation().id, 9004 }; 9005 r(n); 9006 }; 9007 t.createGuestTypes = function (n) { 9008 var t; 9009 if (!n) return []; 9010 var f = IBE.Data.HotelInfo[IBEConfig.hotelId].info.guestTypes, 9011 u = [], 9012 r = ko.utils.arrayFirst(f, function (n) { 9013 return n.ageCategory === IBE.Config.guestType.Adult; 9014 }), 9015 e = ko.utils.arrayFilter(f, function (n) { 9016 return n.ageCategory === IBE.Config.guestType.Children; 9017 }), 9018 i = ko.utils.arrayFirst(f, function (n) { 9019 return n.ageCategory === IBE.Config.guestType.Infant; 9020 }); 9021 return (
9022 IBE.Config.guestType.Adult && 9023 ((t = new IBE.Models.RequestedRoomGuestType()), 9024 t.pax(n.adults || 0), 9025 t.ageCategory(r.ageCategory), 9026 t.fromAge(r.fromAge), 9027 t.toAge(r.toAge), 9028 t.minValue(r.min), 9029 t.maxValue(r.max), 9030 u.push(t)), 9031 IBE.Config.guestType.Children && 9032 e && 9033 ko.utils.arrayForEach(e, function (t) { 9034 var i = new IBE.Models.RequestedRoomGuestType(); 9035 i.ageCategory(IBE.Config.guestType.Children); 9036 i.fromAge(t.fromAge); 9037 i.toAge(t.toAge); 9038 i.minValue(t.min); 9039 i.maxValue(t.max); 9040 i.pax(0); 9041 n.childrenAges && 9042 t.fromAge <= n.childrenAges[0] && 9043 t.toAge >= n.childrenAges[0] && 9044 i.pax(n.children); 9045 u.push(i); 9046 }), 9047 IBE.Config.guestType.Infant && 9048 i && 9049 ((t = new IBE.Models.RequestedRoomGuestType()), 9050 t.pax(n.infants || 0), 9051 t.ageCategory(i.ageCategory), 9052 t.fromAge(i.fromAge), 9053 t.toAge(i.toAge), 9054 t.minValue(i.min), 9055 t.maxValue(i.max), 9056 u.push(t)), 9057 u 9058 ); 9059 }; 9060 t.getPaymentRulesText = function (n, i, r, u) { 9061 var f = [], 9062 h; 9063 if (n.length === 0) return f; 9064 var e = 0, 9065 s = moment().startOf("day"), 9066 o = ko.unwrap(i); 9067 if ( 9068 (ko.utils.arrayForEach(n, function (n) { 9069 var i = ko.toJS(n); 9070 i.amountCurrency = t.getRateText(i.amount, t.currency()); 9071 f.push(i); 9072 o -= n.amount; 9073 }), 9074 o > 0) 9075 ) { 9076 for ( 9077 e = f.length - 1, 9078 f[e].paymentDate === r.format("YYYY-MM-DD") || f[e].paymentDate === u.format("YYYY-MM-DD") 9079 ? ((f[e].amount += o), (f[e].amountCurrency = t.getRateText(f[e].amount, t.currency()))) 9080 : f.push({ 9081 text: "", 9082 amount: o, 9083 paymentDate: r.format("YYYY-MM-DD"), 9084 amountCurrency: t.getRateText(o, t.currency()), 9085 }), 9086 h = !1, 9087 e = 0; 9088 e < f.length - 1; 9089 e++ 9090 ) 9091 if (s.diff(f[e].paymentDate, "days") === 0) { 9092 h = !0; 9093 break; 9094 } 9095 h || 9096 f.unshift({ 9097 paymentDate: s.format("YYYY-MM-DD"), 9098 amount: 0, 9099 amountCurrency: t.getRateText(0, t.currency()), 9100 text: IBE.Utils.translate("noAdvancePayment"), 9101 }); 9102 } 9103 return ( 9104 ko.utils.arrayForEach(f, function (n) { 9105 var t = moment(n.paymentDate), 9106 i = n.amount; 9107 if (s.diff(t, "days") === 0) { 9108 n.text = 9109 i > 0 9110 ? IBE.Utils.translate("paymentRuleAdvancePayment").format(n.amountCurrency) 9111 : IBE.Utils.translate("noAdvancePayment"); 9112 return; 9113 } 9114 if (r.diff(t, "days") === 0 && n.amount > 0) { 9115 n.text = IBE.Utils.translate("paymentRulePayUponCheckIn").format(n.amountCurrency); 9116 return; 9117 } 9118 if (u.diff(t, "days") === 0 && n.amount > 0) { 9119 n.text = IBE.Utils.translate("paymentRulePayUponCheckOut").format(n.amountCurrency); 9120 return; 9121 } 9122 if (i > 0) { 9123 n.text = IBE.Utils.translate("paymentRulePayOnDate").format( 9124 n.amountCurrency, 9125 moment(t).format("DD/MM/YYYY") 9126 ); 9127 return; 9128 } 9129 }), 9130 f 9131 ); 9132 }; 9133 t.getRoomsForChangeDates = function (n, i) { 9134 var r = ko.utils.arrayFirst(n, function (n) { 9135 return n.roomId() === i.id; 9136 }); 9137 return ( 9138 r != null && 9139 ko.utils.arrayForEach(r.rateplans(), function (n) { 9140 n.ratePlanId() === i.ratePlanId && r.ratePlanId(i.ratePlanId); 9141 }), 9142 r == null, 9143 r && !t.activeRooms()[i.roomIndex - 1] && t.activeRooms.push(r), 9144 r 9145 ); 9146 }; 9147 t.modifiedRoomsAreAvailable = function () { 9148 var i = !0, 9149 n = {}; 9150 return ( 9151 t 9152 .activeRooms() 9153 .map(function (n) { 9154 return n.roomId(); 9155 }) 9156 .forEach(function (t) { 9157 n[t] = (n[t] || 0) + 1; 9158 }), 9159 t.step2 9160 .request() 9161 .hotelResults()[0] 9162 .requestedRooms()[0] 9163 .roomResults() 9164 .map(function (n) { 9165 return { roomId: n.roomId(), availableRooms: n.availableRooms }; 9166 }) 9167 .forEach(function (t) { 9168 n[t.roomId] && (i &= n[t.roomId] <= t.availableRooms); 9169 }), 9170 i 9171 ); 9172 }; 9173};
9174IBE.ViewModels.modifyStep3ViewModel = function (n) { 9175 function r(n) { 9176 t.modifyProcess.id = n.id; 9177 t.modifyProcess.baseCurrency = n.currency; 9178 t.modifyProcess.checkIn = moment.utc(n.checkIn); 9179 t.modifyProcess.checkOut = moment.utc(n.checkOut); 9180 t.modifyProcess.advancePayment = n.advancePayment; 9181 t.modifyProcess.cancellationPolicy = n.cancellationPolicy; 9182 t.modifyProcess.paymentPolicy = n.paymentPolicy; 9183 t.modifyProcess.paymentPolicyHotelTextOption = n.paymentPolicyHotelTextOption; 9184 t.modifyProcess.payments = n.payments; 9185 t.modifyProcess.cost = ko.observable(n.totalAmount); 9186 t.modifyProcess.costWithoutDiscount = ko.observable(n.totalAmountBeforeDiscount); 9187 t.modifyProcess.lang = t.lang; 9188 IBE.Data.modifyProcess = t.modifyProcess; 9189 } 9190 var t = this, 9191 i; 9192 t.events = new ko.subscribable(); 9193 t.ready = ko.observable(!1); 9194 ko.utils.extend(t, new IBE.ViewModels.LanguagePartialViewModel(t)); 9195 ko.utils.extend(t, new IBE.ViewModels.CurrenciesPartialViewModel(t)); 9196 ko.utils.extend(t, new IBE.ViewModels.Message()); 9197 ko.utils.extend(t, new IBE.ViewModels.PartialMemberViewModel(t)); 9198 t.modifyProcess = ko.observable(); 9199 t.hotelInfo = ko.observable(); 9200 t.allowSubmit = ko.observable(!0); 9201 t.termsVisible = ko.observable(!0); 9202 i = []; 9203 t.dispose = function () { 9204 for (var n in i) i[n].dispose(); 9205 }; 9206 t.countries = ko.observableArray([]); 9207 t.makeReservation = function () { 9208 var n; 9209 return ( 9210 (n = {}), 9211 (n.checkIn = t.modifyProcess.checkIn), 9212 (n.checkOut = t.modifyProcess.checkOut), 9213 (n.customer = []), 9214 (n.rooms = ko.utils.arrayMap(t.modifyProcess.rooms, function (n) { 9215 return { 9216 boardType: n.boardType, 9217 ratePlanId: n.ratePlanId, 9218 roomIndex: n.roomIndex, 9219 roomId: n.roomId, 9220 guestTypes: n.guestTypes, 9221 }; 9222 })), 9223 (n.cost = t.modifyProcess.cost()), 9224 (n.advancePayment = t.modifyProcess.advancePayment), 9225 t.events.notifySubscribers(n, "submit"), 9226 !1 9227 ); 9228 }; 9229 t.init = function (u, f) { 9230 var e = ko.utils.extend( 9231 { apiKey: IBE.Config.apiKey, hotelId: parseInt(IBE.Config.hotelId), lang: IBE.Config.lang }, 9232 f 9233 ); 9234 $.when(t.languagePartialInit(e), t.currenciesPartialInit(e), t.customerAuthenticate()).then(function () { 9235 IBE.Data.Step3InitData = u; 9236 i.push( 9237 t.lang.subscribe(function () { 9238 t.init(IBE.Data.Step3InitData); 9239 }) 9240 ); 9241 var f = function (n) { 9242 n && t.hotelInfo(new IBE.Models.HotelInfo(n.info)); 9243 }; 9244 $.when(IBE.Utils.loadHotelInfo(f, e)).then(f); 9245 t.customer(new IBE.ViewModels.CustomerPartialViewModel(n)); 9246 $.when(IBE.Utils.lookupCountry()).then(function (n) { 9247 var i = ko.utils.arrayFirst(t.countries(), function (t) { 9248 return t.code() === n; 9249 }); 9250 i != null && t.customer().country(i); 9251 }); 9252 t.modifyProcess = u.bookingInfo; 9253 IBE.Utils.request({ 9254 type: "POST", 9255 url: IBE.Config.apiBaseUrl + "/hotels/BookingProcess/" + e.hotelId + "?apikey=" + e.apiKey, 9256 data: ko.toJSON(t.modifyProcess), 9257 headers: { "Content-Type": "application/json" }, 9258 }) 9259 .done(function (n) { 9260 if ((t.clearMessage(), n === !1)) { 9261 t.ready(!0); 9262 t.events.notifySubscribers(!0, "ready"); 9263 t.message({ id: 4001, severity: "error", text: "An error occured. Please try again" }); 9264 t.events.notifySubscribers(t.message(), "error"); 9265 return; 9266 } 9267 r(n); 9268 t.ready(!0); 9269 t.events.notifySubscribers(!0, "ready"); 9270 }) 9271 .fail(function (n) { 9272 t.ready(!0); 9273 t.clearMessage(); 9274 var i = { id: n.status, severity: "critical", text: n.statusText + ": " + n.responseText }; 9275 t.message(i); 9276 t.events.notifySubscribers(i, "error"); 9277 }); 9278 }); 9279 }; 9280};
9281IBE.ViewModels.ModifyStep4ViewModel = function () { 9282 function i(t) { 9283 n.reservation(new IBE.Models.Reservation(t)); 9284 n.membership.customer(n.reservation().customer); 9285 n.bookingProcess = IBE.Data.modifyProcess; 9286 n.ready(!0); 9287 n.events.notifySubscribers(!0, "ready"); 9288 } 9289 function r(t) { 9290 n.hotel(new IBE.Models.HotelInfo(t.info)); 9291 n.reservationSettings = new IBE.Models.ReservationSettings(t.settings); 9292 n.googleMap(new IBE.Models.GoogleMap(t.info)); 9293 } 9294 function u(t) { 9295 function u(n) { 9296 var t = "Basic " + $.base64.encode(n.username + ":" + n.password); 9297 return (document.cookie = "Authorization: " + t), t; 9298 } 9299 function f(n) { 9300 var r = "Authorization=", 9301 i = document.cookie.indexOf(r), 9302 t; 9303 return i !== -1 9304 ? ((t = document.cookie.indexOf(";", i + 1)), 9305 t === -1 && (t = document.cookie.length), 9306 unescape(document.cookie.substring(i + r.length, t))) 9307 : u(n); 9308 } 9309 var r = ko.utils.extend( 9310 { apiKey: IBE.Config.apiKey, hotelId: parseInt(IBE.Config.hotelId), lang: IBE.Config.lang }, 9311 n.options 9312 ); 9313 IBE.Utils.request({ 9314 url: IBE.Config.apiBaseUrl + "/hotels/reservation/?apikey=" + r.apiKey, 9315 beforeSend: function (n) { 9316 n.setRequestHeader("Authorization", f(t)); 9317 n.setRequestHeader("Accept-Language", IBE.Config.lang || "en-US"); 9318 }, 9319 }) 9320 .done(function (t) { 9321 n.clearMessage(); 9322 i(t); 9323 }) 9324 .fail(function (t) { 9325 var i, r; 9326 n.ready(!0); 9327 n.clearMessage(); 9328 i = "critical"; 9329 (t.status === 400 || t.status === 500) && (i = "error"); 9330 r = { id: t.status, severity: i, text: t.responseJSON.Message }; 9331 n.events.notifySubscribers(r, "error"); 9332 }); 9333 } 9334 function f(t) { 9335 var r = ko.utils.extend( 9336 { apiKey: IBE.Config.apiKey, hotelId: parseInt(IBE.Config.hotelId), lang: IBE.Config.lang }, 9337 n.options 9338 ); 9339 t.checkIn = moment(t.checkIn).format("YYYY-MM-DD"); 9340 t.checkOut = moment(t.checkOut).format("YYYY-MM-DD"); 9341 IBE.Utils.request({ 9342 type: "POST", 9343 url: IBE.Config.apiBaseUrl + "/hotels/amendreservation/" + r.hotelId + "?apikey=" + r.apiKey, 9344 data: ko.toJSON(t), 9345 headers: { "Content-Type": "application/json" }, 9346 }) 9347 .done(function (t) { 9348 if ((n.clearMessage(), t.error)) { 9349 var r = { id: t.statusCode(), severity: "error", text: t.responseJSON.message }; 9350 n.message(r); 9351 n.events.notifySubscribers(r, "error"); 9352 throw r; 9353 } 9354 i(t); 9355 }) 9356 .fail(function (t) { 9357 var i, r; 9358 n.ready(!0); 9359 n.clearMessage(); 9360 i = "critical"; 9361 (t.status == 400 || t.status == 500) && (i = "error"); 9362 r = { id: t.status, severity: i, text: t.responseJSON.message }; 9363 n.events.notifySubscribers(r, "error"); 9364 }); 9365 } 9366 var n = this, 9367 t; 9368 n.options = {}; 9369 n.events = new ko.subscribable(); 9370 n.reservation = ko.observable(); 9371 n.modifyProcess = ko.observable(); 9372 n.hotel = ko.observable(); 9373 n.googleMap = ko.observable(); 9374 n.ready = ko.observable(!1); 9375 n.customer = ko.observable(); 9376 n.membership = new IBE.ViewModels.Membership(); 9377 ko.utils.extend(n, new IBE.ViewModels.LanguagePartialViewModel(n)); 9378 ko.utils.extend(n, new IBE.ViewModels.CurrenciesPartialViewModel(n)); 9379 ko.utils.extend(n, new IBE.ViewModels.Message()); 9380 t = []; 9381 n.dispose = function () { 9382 for (var n in t) t[n].dispose(); 9383 }; 9384 n.ecommerce = ko.observable(!1); 9385 n.adWordsSent = ko.observable(!1); 9386 n.trackAdWords = function () { 9387 var i, t; 9388 if (!n.adWordsSent()) { 9389 if ( 9390 ((google_conversion_id = IBE.Utils.getReservationSetting(n, "adwordsConversionId")),
9391 IBE.Config.reservationStatus[n.reservation().status()] === 3 9392 ? ((i = IBE.Utils.getReservationSetting(n, "adwordsRequestLabel")), 9393 i !== "" && (google_conversion_label = i)) 9394 : (google_conversion_label = IBE.Utils.getReservationSetting(n, "adwordsConversionLabel")), 9395 (google_conversion_value = ko.unwrap(n.reservation().totalCost)), 9396 (google_remarketing_only = !1), 9397 google_conversion_id === 0 || google_conversion_id === "") 9398 ) { 9399 console.log("IBE: google_conversion_id is not valid"); 9400 return; 9401 } 9402 n.options.appendAdwordsImage && 9403 ((t = document.createElement("img")), 9404 (t.height = 1), 9405 (t.width = 1), 9406 (t.border = 0), 9407 (t.src = 9408 "//www.googleadservices.com/pagead/conversion/" + 9409 google_conversion_id + 9410 "/?value=" + 9411 ko.unwrap(n.reservation().totalCost) + 9412 "&currency_code=" + 9413 n.currency() + 9414 "&label=" + 9415 google_conversion_label + 9416 "&guid=ON&script=0"), 9417 $("body").append(t)); 9418 n.options.trackAdwordsAsync && 9419 typeof google_trackConversion != "undefined" && 9420 window.google_trackConversion({ 9421 google_conversion_id: google_conversion_id, 9422 google_conversion_language: "en", 9423 google_conversion_format: "3", 9424 google_conversion_color: "ffffff", 9425 google_conversion_label: google_conversion_label, 9426 google_conversion_value: google_conversion_value, 9427 google_conversion_currency: n.currency(), 9428 google_remarketing_only: !1, 9429 }); 9430 n.adWordsSent(!0); 9431 } 9432 }; 9433 n.trackTrivagoConversion = function () { 9434 var t = Cache.read("ref", "localstorage"), 9435 u, 9436 i, 9437 r; 9438 if ( 9439 (t === "Trivago" || t === "trivago" || (t && t.name && (t.name === "Trivago" || t.name === "trivago"))) && 9440 IBE.Config.userCookieAcceptance === !0 9441 ) { 9442 if (((u = IBE.Utils.getReservationSetting(n, "trivagoTrackingId")), typeof u == "undefined")) return; 9443 if ( 9444 ((i = IBE.Utils.getReservationSetting(n, "trivagoConversionKey")), 9445 (r = IBE.Utils.getReservationSetting(n, "trivagoSupplierId")), 9446 t && t.params && t.params.trv_reference && r && i) 9447 ) { 9448 let u = t.params.trv_reference, 9449 f = { 9450 trv_reference: u, 9451 advertiser_id: r, 9452 hotel: n.reservation().hotelId, 9453 arrival: n.reservation().checkIn.format("YYYY-MM-DD"), 9454 departure: n.reservation().checkOut.format("YYYY-MM-DD"), 9455 volume: n.reservation().totalCost(), 9456 booking_id: n.reservation().id, 9457 currency: n.reservation().currencyCode, 9458 number_of_rooms: n.reservation().rooms.length, 9459 locale: IBE.Config.lang.split("-")[1], 9460 date_format: "Y-m-d", 9461 booking_date: moment.utc(n.reservation().created).format("YYYYMMDDHHmmss"), 9462 booking_date_format: "YmdHis", 9463 }; 9464 IBE.Utils.request({ 9465 type: "PUT", 9466 url: "https://secde.trivago.com/tracking/booking", 9467 data: JSON.stringify(f), 9468 dataType: "json", 9469 headers: { "Content-Type": "application/json", "X-Trv-Ana-Key": i }, 9470 }) 9471 .done(function () {}) 9472 .fail(function () {}); 9473 } 9474 } 9475 }; 9476 n.trackEcommerce = function () { 9477 var i, r, t; 9478 if (!n.ecommerce() && typeof ga != "undefined") { 9479 ga("ecommerce:addTransaction", { 9480 id: "" + n.reservation().id, 9481 affiliation: n.reservation().hotelName, 9482 revenue: "" + ko.unwrap(n.reservation().totalCost), 9483 shipping: "0", 9484 tax: "0", 9485 }); 9486 i = 1; 9487 ko.utils.arrayForEach(n.reservation().rooms, function (t) { 9488 var r = ko.unwrap(t); 9489 ga("ecommerce:addItem", { 9490 id: "" + n.reservation().id, 9491 name: r.name + " " + r.board.name, 9492 sku: "#" + i + "-" + r.id + " -- " + n.reservation().status(), 9493 category: "Rooms", 9494 price: r.totalCost, 9495 quantity: "1", 9496 currency: n.currency(), 9497 }); 9498 i += 1; 9499 }); 9500 ko.utils.arrayForEach(n.reservation().supplements, function (t) { 9501 var i = ko.unwrap(t); 9502 ga("ecommerce:addItem", { 9503 id: "" + n.reservation().id, 9504 name: i.name, 9505 sku: i.supplementId() + " -- " + n.reservation().status(), 9506 category: "Supplements", 9507 price: i.unitCost(), 9508 quantity: i.quantity(), 9509 currency: n.currency(), 9510 }); 9511 }); 9512 ga("ecommerce:send"); 9513 r = []; 9514 ko.utils.arrayForEach(n.reservation().rooms, function (t) { 9515 var u = ko.unwrap(t); 9516 r.push({ 9517 id: "" + n.reservation().id, 9518 name: u.name + " " + u.board.name, 9519 category: "Rooms", 9520 quantity: "1", 9521 price: u.totalCost, 9522 }); 9523 i += 1; 9524 }); 9525 ko.utils.arrayForEach(n.reservation().supplements, function (t) { 9526 var i = ko.unwrap(t); 9527 r.push({ 9528 id: "" + n.reservation().id, 9529 name: i.name, 9530 category: "Supplements", 9531 quantity: i.quantity(), 9532 price: i.unitCost(), 9533 }); 9534 }); 9535 var u = IBE.Utils.getReservationSetting(n, "adwordsConversionId"), 9536 f = "", 9537 e = IBE.Utils.getReservationSetting(n, "globalAdwordsConversionId"), 9538 o = IBE.Utils.getReservationSetting(n, "globalAdwordsConversionLabel"), 9539 s = IBE.Utils.getReservationSetting(n, "googleConversionTrackingPartnerId");
9540 (u && typeof gtag != "undefined" && IBE.Config.userCookieAcceptance === !0) || (u = ""); 9541 IBE.Config.reservationStatus[n.reservation().status()] === 3 9542 ? (f = IBE.Utils.getReservationSetting(n, "adwordsRequestLabel")) 9543 : IBE.Config.reservationStatus[n.reservation().status()] === 1 && 9544 (f = IBE.Utils.getReservationSetting(n, "adwordsConversionLabel")); 9545 t = []; 9546 u && f && t.push("AW-" + u + "/" + f); 9547 e && o && t.push("AW-" + e + "/" + o); 9548 s && t.push("HA-" + s); 9549 gtag("event", "purchase", { 9550 send_to: t.length > 0 ? t : undefined, 9551 transaction_id: n.reservation().id, 9552 affiliation: n.reservation().hotelName, 9553 value: ko.unwrap(n.reservation().totalCost), 9554 currency: n.currency(), 9555 items: r, 9556 checkout_step: 4, 9557 id: n.reservation().hotelId, 9558 start_date: n.reservation().checkIn.format("YYYY-MM-DD"), 9559 end_date: n.reservation().checkOut.format("YYYY-MM-DD"), 9560 }); 9561 n.ecommerce(!0); 9562 } 9563 }; 9564 n.trackBingCode = function () { 9565 if (IBE.Config.debug) { 9566 console.log("IBE: In debug mode bing is disabled"); 9567 return; 9568 } 9569 window.uetq && 9570 window.uetq.push({ 9571 ec: "Booking", 9572 ea: ko.unwrap(n.reservation().status), 9573 el: "", 9574 ev: "" + ko.unwrap(n.reservation().totalCost), 9575 }); 9576 }; 9577 n.updateReservation = function () { 9578 var t = { 9579 id: n.reservation().id, 9580 newStatus: n.reservation().status(), 9581 supplements: _bookingSupplements(), 9582 creditCard: {}, 9583 cancellationNotes: n.reservation().cancellationNotes(), 9584 }; 9585 n.clearMessage(); 9586 IBE.Utils.request({ 9587 type: "POST", 9588 data: ko.toJSON(t), 9589 url: IBE.Config.apiBaseUrl + "/hotels/reservation/update/?apikey=" + IBE.Config.apiKey, 9590 beforeSend: function (t) { 9591 t.setRequestHeader( 9592 "Authorization", 9593 IBE.Utils.authenticationCookie(n.reservation().customer.email(), n.reservation().code) 9594 ); 9595 }, 9596 }) 9597 .done(function () {}) 9598 .fail(function (t) { 9599 var i = { id: t.status, severity: "critical", text: t.statusText + ": " + t.responseText }; 9600 n.message(i); 9601 }); 9602 }; 9603 n.init = function (t, i) { 9604 n.options = ko.utils.extend( 9605 { 9606 trackAdwords: !0, 9607 trackAdwordsAsync: !0, 9608 appendAdwordsImage: !0, 9609 reservationSubmitted: !1, 9610 apiKey: IBE.Config.apiKey, 9611 hotelId: parseInt(IBE.Config.hotelId), 9612 lang: IBE.Config.lang, 9613 }, 9614 i 9615 ); 9616 $.when(n.languagePartialInit(n.options), n.currenciesPartialInit()).then(function () { 9617 n.options.reservationSubmitted = !1; 9618 var i = function (n) { 9619 n && (r(n), typeof t.username != "undefined" && typeof t.password != "undefined" ? u(t) : f(t)); 9620 }; 9621 $.when(IBE.Utils.loadHotelInfo(i, n.options)).then(i); 9622 }); 9623 }; 9624}; 9625IBE.ViewModels.MyReservation = function (n) { 9626 function r(n) { 9627 t.hotel(new IBE.Models.HotelInfo(n.info)); 9628 t.reservationSettings = new IBE.Models.ReservationSettings(n.settings); 9629 t.googleMap(new IBE.Models.GoogleMap(n.info)); 9630 } 9631 function u(n) { 9632 t.countries.removeAll(); 9633 ko.utils.arrayPushAll( 9634 t.countries, 9635 ko.utils.arrayMap(n, function (n) { 9636 return new IBE.Models.Country(n); 9637 }) 9638 ); 9639 } 9640 function f(n) { 9641 typeof n.info.acceptedCards != "undefined" && t.acceptedCards(n.info.acceptedCards.split(", ")); 9642 } 9643 var t = this, 9644 i; 9645 t.events = new ko.subscribable(); 9646 t.ready = ko.observable(!1);
9647 ko.utils.extend(t, new IBE.ViewModels.LanguagePartialViewModel(t)); 9648 ko.utils.extend(t, new IBE.ViewModels.CurrenciesPartialViewModel(t)); 9649 ko.utils.extend(t, new IBE.ViewModels.Message()); 9650 t.genders = [ 9651 { name: "", value: IBE.Config.gender.Unknown }, 9652 { name: "male", value: IBE.Config.gender.Male }, 9653 { name: "female", value: IBE.Config.gender.Female }, 9654 ]; 9655 t.idDocumentTypes = [ 9656 { name: "", value: IBE.Config.idDocumentType.Unknown }, 9657 { name: "identityCard", value: IBE.Config.idDocumentType.IidentityCard }, 9658 { name: "passport", value: IBE.Config.idDocumentType.Passport }, 9659 { name: "drivingLicense", value: IBE.Config.idDocumentType.DrivingLicense }, 9660 ]; 9661 t.titles = [ 9662 { name: "", value: IBE.Config.titles.Unknown }, 9663 { name: "mr", value: IBE.Config.titles.Mr }, 9664 { name: "mrs", value: IBE.Config.titles.Mrs }, 9665 { name: "miss", value: IBE.Config.titles.Miss }, 9666 { name: "ms", value: IBE.Config.titles.Ms }, 9667 { name: "dr", value: IBE.Config.titles.Dr }, 9668 ]; 9669 t.username = ko.observable("").extend({ required: { message: IBE.Utils.translate("requiredUsername") } }); 9670 t.password = ko.observable("").extend({ required: { message: IBE.Utils.translate("requiredPassword") } }); 9671 t.cancelCode = ko.observable(""); 9672 t.reservation = ko.observable(); 9673 t.customer = ko.observable(); 9674 t.acceptedCards = ko.observableArray([]); 9675 t.hotel = ko.observable(); 9676 t.googleMap = ko.observable(); 9677 t.countries = ko.observableArray([]); 9678 t.terms = ko.observable(); 9679 t.consents = ko.observableArray([]); 9680 t.customerConsents = ko.observableArray([]); 9681 t.guests = ko.observableArray([]); 9682 t.isWebCheckedIn = ko.observable(!1); 9683 t.errors = ko.validation.group(t); 9684 i = []; 9685 t.dispose = function () { 9686 for (var n = 0; n < i.length; n++) i[n].dispose(); 9687 }; 9688 t.customerConsents = ko.computed({ 9689 read: function () { 9690 return ( 9691 ko.utils.arrayForEach(t.consents(), function (n) { 9692 var i = ko.utils.arrayFirst(t.reservation().customer.consents(), function (t) { 9693 return n.id === t.id; 9694 }); 9695 i && n.value(!0); 9696 }), 9697 t.consents() 9698 ); 9699 }, 9700 write: function () { 9701 return t.consents([]); 9702 }, 9703 deferEvaluation: !0, 9704 }); 9705 typeof n != "undefined" && n.email !== "" && n.code !== "" && (t.username(n.email), t.password(n.code)); 9706 t.isAuthenticated = ko.observable(!1); 9707 t.options = {}; 9708 t.reservationAction = ko.observable("view"); 9709 t.login = function (n) { 9710 if ( 9711 ((t.options = ko.utils.extend( 9712 { apiKey: IBE.Config.apiKey, hotelId: parseInt(IBE.Config.hotelId), lang: IBE.Config.lang }, 9713 n 9714 )), 9715 t.ready(!1), 9716 t.clearMessage(), 9717 t.errors().length > 0 && IBE.Utils.haveAuthenticationCookie() === !1) 9718 ) 9719 return ( 9720 t.errors.showAllMessages(), 9721 t.events.notifySubscribers( 9722 { id: 401, severity: "error", text: "Wrong email or reservation code." }, 9723 "error" 9724 ), 9725 t.ready(!0), 9726 !1 9727 ); 9728 IBE.Utils.request({ 9729 url: IBE.Config.apiBaseUrl + "/hotels/reservation/?apikey=" + IBE.Config.apiKey, 9730 beforeSend: function (n) { 9731 t.username() !== "" && 9732 t.password() !== "" && 9733 n.setRequestHeader("Authorization", IBE.Utils.authenticationCookie(t.username(), t.password())); 9734 }, 9735 }) 9736 .done(function (n) { 9737 var i, r; 9738 (t.reservation(new IBE.Models.Reservation(n)), 9739 t.reservation().taxes(n.taxes || []), 9740 t.customer(new IBE.ViewModels.CustomerPartialViewModel()), 9741 t.isWebCheckedIn(t.reservation().webCheckIn()), 9742 ko.utils.arrayForEach(t.reservation().rooms, function (n) { 9743 for (var i = 0; i < n.adults; i++) 9744 (n.guestType = IBE.Config.guestType.Adult), t.guests.push(new IBE.Models.ReservationGuest(n)); 9745 for (i = 0; i < n.children; i++) 9746 (n.guestType = IBE.Config.guestType.Children), 9747 t.guests.push(new IBE.Models.ReservationGuest(n)); 9748 for (i = 0; i < n.infants; i++) 9749 (n.guestType = IBE.Config.guestType.Infant), t.guests.push(new IBE.Models.ReservationGuest(n)); 9750 }), 9751 t.hotel().hotelId) && 9752 (IBE.Data.HotelInfo[t.hotel().hotelId].info.consents && 9753 ((i = IBE.Data.HotelInfo[t.hotel().hotelId].info.consents), 9754 ko.utils.arrayForEach(i, function (n) { 9755 t.consents.push(new IBE.Models.Consents(n)); 9756 })), 9757 n.customer.consents && 9758 ko.utils.arrayForEach(n.customer.consents, function (n) { 9759 t.reservation().customer.consents.push(new IBE.Models.Consents(n)); 9760 }), 9761 IBE.Data.HotelInfo[t.hotel().hotelId].info.termsAndPrivacy && 9762 ((r = IBE.Data.HotelInfo[t.hotel().hotelId].info.termsAndPrivacy), 9763 (t.terms = new IBE.Models.Terms(r))), 9764 t.trackEcommerce(), 9765 $.when(IBE.Utils.loadCountries()).then(function (n) { 9766 u(n); 9767 var i = ko.utils.arrayFilter(t.countries(), function (n) { 9768 return t.reservation().customer.country() == n.code(); 9769 })[0]; 9770 i.name && (t.reservation().customer.countryName = i.name()); 9771 t.clearMessage(); 9772 t.events.notifySubscribers({ email: t.username(), code: t.password() }, "login"); 9773 t.events.notifySubscribers(!0, "ready"); 9774 t.ready(!0); 9775 t.isAuthenticated(!0); 9776 window.location.href.indexOf("#reservation") > -1 && 9777 $("#IBE-MyReservation-ViewReservation").length != 0 9778 ? t.setView("reservation") 9779 : $("#IBE-MyReservation-Welcome").length != 0 && t.setView("welcome"); 9780 })); 9781 }) 9782 .fail(function (n) { 9783 if ( 9784 (t.events.notifySubscribers(!0, "ready"), 9785 IBE.Utils.haveAuthenticationCookie() && t.username() === "") 9786 ) { 9787 t.isAuthenticated(!1); 9788 IBE.Utils.deleteAuthenticationCookie(); 9789 return; 9790 } 9791 var i = { id: n.status, severity: "error", text: n.responseText }; 9792 i.text = n.status === 401 ? "Wrong email or reservation code." : "An error occurred.";
9793 t.isAuthenticated(!1); 9794 IBE.Utils.deleteAuthenticationCookie(); 9795 t.events.notifySubscribers(i, "error"); 9796 }); 9797 }; 9798 t.logout = function () { 9799 t.username(""); 9800 t.password(""); 9801 IBE.Utils.deleteAuthenticationCookie(); 9802 t.clearMessage(); 9803 t.isAuthenticated(!1); 9804 t.customerConsents([]); 9805 t.errors.showAllMessages(!1); 9806 t.ready(!0); 9807 t.events.notifySubscribers(!0, "logout"); 9808 }; 9809 t.displayExternalPayment = ko.observable(!1); 9810 t.markTrackedReservation = function () { 9811 IBE.Utils.request({ 9812 url: IBE.Config.apiBaseUrl + "/hotels/reservation/markTrackedReservation/?apikey=" + IBE.Config.apiKey, 9813 beforeSend: function (n) { 9814 t.username() !== "" && 9815 t.password() !== "" && 9816 n.setRequestHeader("Authorization", IBE.Utils.authenticationCookie(t.username(), t.password())); 9817 }, 9818 }).done(function () {}); 9819 }; 9820 t.init = function () { 9821 $.when(t.languagePartialInit(), t.currenciesPartialInit()).then(function (n) { 9822 t.dispose(); 9823 i.push( 9824 t.lang.subscribe(function () { 9825 t.init(); 9826 }) 9827 ); 9828 t.ready(!1); 9829 t.clearMessage(); 9830 r(n); 9831 f(n); 9832 IBE.Utils.haveAuthenticationCookie() 9833 ? t.login() 9834 : t.username() === "" || t.password() === "" 9835 ? (t.isAuthenticated(!1), t.ready(!0), t.events.notifySubscribers(!0, "ready")) 9836 : t.login(); 9837 }); 9838 }; 9839 t.setReservationAction = function (n) { 9840 t.reservationAction(n); 9841 }; 9842 t.customerEdit = ko.observable(!1); 9843 t.startEdit = function () { 9844 t.customerEdit(!0); 9845 }; 9846 t.cancelEdit = function () { 9847 t.customerEdit(!1); 9848 }; 9849 t.setView = function (n) { 9850 switch (n) { 9851 case "welcome": 9852 IBE.Utils.destroyView("IBE-MyReservation-Account"); 9853 IBE.Utils.destroyView("IBE-MyReservation-ViewReservation"); 9854 IBE.Utils.bindTemplate("IBE-MyReservation-Welcome", t); 9855 $(".bookwize-nav").removeClass("active"); 9856 $(".nav-" + n).addClass("active"); 9857 break; 9858 case "account": 9859 IBE.Utils.destroyView("IBE-MyReservation-Welcome"); 9860 IBE.Utils.destroyView("IBE-MyReservation-ViewReservation"); 9861 IBE.Utils.bindTemplate("IBE-MyReservation-Account", t); 9862 $(".bookwize-nav").removeClass("active"); 9863 $(".nav-" + n).addClass("active"); 9864 $("#request-personal-data").click(function () { 9865 t.customerDataRequest("Export"); 9866 }); 9867 $("#delete-personal-data").click(function () { 9868 t.customerDataRequest("Delete"); 9869 }); 9870 break; 9871 case "reservation": 9872 IBE.Utils.destroyView("IBE-MyReservation-Account"); 9873 IBE.Utils.destroyView("IBE-MyReservation-Welcome"); 9874 IBE.Utils.bindTemplate("IBE-MyReservation-ViewReservation", t); 9875 $(".bookwize-nav").removeClass("active"); 9876 $(".nav-" + n).addClass("active"); 9877 break; 9878 default: 9879 t.ready(!0); 9880 } 9881 }; 9882 t.customerDataRequest = function (n) { 9883 var i = { hotelId: IBE.Config.hotelId, requestType: n }; 9884 $.ajax({ 9885 type: "POST", 9886 url: IBE.Config.apiBaseUrl + "/members/personalDataRequest/?apikey=" + IBE.Config.apiKey, 9887 data: ko.toJSON(i), 9888 beforeSend: function (n) { 9889 IBE.Utils.haveAuthenticationCookie() && 9890 n.setRequestHeader("Authorization", IBE.Utils.authenticationCookie()); 9891 }, 9892 success: function () { 9893 var n = { id: 200, severity: "success", text: IBE.Utils.translate("customerDataRequestSuccess") }; 9894 t.message(n); 9895 t.customerEdit(!1); 9896 t.ready(!0); 9897 }, 9898 error: function (n) { 9899 t.events.notifySubscribers(!0, "ready"); 9900 var i = { id: n.status, severity: "error", text: n.responseText }; 9901 i.text = n.text; 9902 t.message(i); 9903 t.events.notifySubscribers(i, "error"); 9904 t.ready(!0); 9905 }, 9906 complete: function () { 9907 t.ready(!0); 9908 }, 9909 }); 9910 }; 9911 t.showUpdateCreditCard = function (n) { 9912 var i, r, u; 9913 return !n && typeof n != "undefined" 9914 ? !1 9915 : ((i = moment()), (r = moment(t.reservation().checkOut)), i.diff(r, "days") >= 0) 9916 ? !1 9917 : ((u = ko.utils.arrayFirst(t.reservation().availableActions(), function (n) { 9918 return n === "ConfirmedReservation"; 9919 })), 9920 u) 9921 ? !1 9922 : t.reservation().status() === "NewRequest" || 9923 t.reservation().status() === "CancelledReservation" || 9924 t.reservation().status() === "CancelledReservationPaymentExpired" 9925 ? !1 9926 : !0; 9927 }; 9928 t.disableButton = ko.observable(!1); 9929 t.confirmAction = function (n, i) { 9930 var f = { 9931 id: t.reservation().id, 9932 newStatus: n, 9933 creditCard: {}, 9934 cancellationNotes: t.reservation().cancellationNotes(), 9935 notes: t.reservation().notes(), 9936 }, 9937 r = !1, 9938 e = new Loader(), 9939 o, 9940 u; 9941 switch (n) { 9942 case "CancelledReservation": 9943 case "CancelledRequest": 9944 t.disableButton(!0); 9945 e.visible(!0); 9946 t.cancelCode() != t.reservation().code && 9947 ((o = { id: 5001, severity: "error", text: IBE.Utils.translate("wrongReservationCode") }), 9948 t.message(o), 9949 t.events.notifySubscribers(o, "error"), 9950 (r = !0)); 9951 break; 9952 case "ConfirmedReservation": 9953 if (t.displayExternalPayment()) { 9954 f.creditCard = null; 9955 break; 9956 } 9957 t.customer().errors().creditCard().length > 0 && 9958 ((r = !0), 9959 t.events.notifySubscribers("", "error"), 9960 t.customer().errors().creditCard().length == 1 && t.customer().errors().creditCard()[0] == null 9961 ? (r = !1) 9962 : t.customer().errors().creditCard.showAllMessages()); 9963 u = t.customer().creditCard().cardExpirationYear() + ""; 9964 u = u.substring(2); 9965 f.creditCard = { 9966 holder: t.customer().creditCard().cardHolder(), 9967 expireYear: u, 9968 expireMonth: t.customer().creditCard().cardExpirationMonth(), 9969 number: t.customer().creditCard().cardNumber(), 9970 verification: t.customer().creditCard().cardVerification(), 9971 }; 9972 } 9973 if (r) return t.disableButton(!1), e.visible(!1), !1; 9974 t.clearMessage(); 9975 IBE.Utils.request({ 9976 type: "POST", 9977 data: ko.toJSON(f), 9978 url: IBE.Config.apiBaseUrl + "/hotels/reservation/update/?apikey=" + IBE.Config.apiKey, 9979 beforeSend: function (n) { 9980 n.setRequestHeader("Authorization", IBE.Utils.authenticationCookie(t.username(), t.password())); 9981 }, 9982 }) 9983 .done(function (r) { 9984 if ( 9985 (t.cancelCode(""), 9986 t.reservation(new IBE.Models.Reservation(r)), 9987 t.customer(new IBE.ViewModels.CustomerPartialViewModel()), 9988 t.events.notifySubscribers(!0, n), 9989 (n == "CancelledReservation" || n == "CancelledRequest") && 9990 (t.trackTrivagoConversion(), e.visible(!1)), 9991 t.events.notifySubscribers(!0, n), 9992 i === "UpdateCreditCard") 9993 ) { 9994 var u = { id: 200, severity: "success", text: IBE.Utils.translate("creditCardUpdated") }; 9995 t.message(u); 9996 } 9997 }) 9998 .fail(function () { 9999 var n = { id: 5002, severity: "error", text: IBE.Utils.translate("updateReservationFailed") }; 10000 t.message(n); 10001 t.events.notifySubscribers(n, "error"); 10002 }); 10003 }; 10004 t.webCheckIn = function () { 10005 var n = { code: t.reservation().code, guests: t.guests() }; 10006 $.ajax({ 10007 type: "POST", 10008 url: IBE.Config.apiBaseUrl + "/hotels/reservation/checkin/?apikey=" + IBE.Config.apiKey, 10009 data: ko.toJSON(n), 10010 beforeSend: function (n) { 10011 t.username() !== "" && 10012 t.password() !== "" && 10013 n.setRequestHeader("Authorization", IBE.Utils.authenticationCookie(t.username(), t.password())); 10014 t.ready(!1); 10015 }, 10016 success: function (n) { 10017 var i = { id: 200, severity: "success", text: IBE.Utils.translate("webCheckInSave") }; 10018 t.isWebCheckedIn(n.webCheckIn); 10019 t.message(i); 10020 }, 10021 error: function (n) { 10022 t.events.notifySubscribers(!0, "ready"); 10023 var i = { id: n.status, severity: "error", text: n.responseText }; 10024 i.text = n.text; 10025 t.message(i); 10026 t.events.notifySubscribers(i, "error"); 10027 }, 10028 complete: function () { 10029 t.ready(!0); 10030 }, 10031 }); 10032 }; 10033 t.updateCustomer = function () { 10034 var i = ko.utils.arrayFilter(t.customerConsents(), function (n) {
10035 return n.value(); 10036 }), 10037 n; 10038 t.reservation().customer.consents(i); 10039 n = t.reservation().customer.toJSON(); 10040 $.ajax({ 10041 type: "POST", 10042 url: 10043 IBE.Config.apiBaseUrl + 10044 "/members/member/?apikey=" + 10045 IBE.Config.apiKey + 10046 "&hotelId=" + 10047 IBE.Config.hotelId, 10048 data: n, 10049 beforeSend: function (n) { 10050 IBE.Utils.haveAuthenticationCookie() && 10051 n.setRequestHeader("Authorization", IBE.Utils.authenticationCookie()); 10052 t.ready(!1); 10053 }, 10054 success: function () { 10055 var n = { id: 200, severity: "success", text: IBE.Utils.translate("customerEditSuccess") }; 10056 t.message(n); 10057 t.ready(!0); 10058 t.setView("account"); 10059 t.customerEdit(!1); 10060 }, 10061 error: function (n) { 10062 t.events.notifySubscribers(!0, "ready"); 10063 var i = { id: n.status, severity: "error", text: n.responseText }; 10064 t.ready(!0); 10065 i.text = n.text; 10066 t.message(i); 10067 t.events.notifySubscribers(i, "error"); 10068 }, 10069 complete: function () { 10070 t.ready(!0); 10071 }, 10072 }); 10073 }; 10074 t.trackEcommerce = function () { 10075 if ( 10076 !IBE.Config.debug && 10077 !t.reservation().isTracked && 10078 typeof gtag != "undefined" && 10079 IBE.Config.reservationStatus[t.reservation().status()] === 1 10080 ) { 10081 var u = IBE.Utils.getReservationSetting(t, "googleAnalyticsKey"), 10082 f = IBE.Utils.getReservationSetting(t, "googleAnalyticsKeyGA4"), 10083 o = 1, 10084 n = [], 10085 e = []; 10086 f && 10087 (ko.utils.arrayForEach(t.reservation().rooms, function (n) { 10088 var i = ko.unwrap(n); 10089 e.push({ 10090 item_id: "" + i.id, 10091 item_name: i.name + " " + i.board.name, 10092 item_category: "Rooms", 10093 currency: t.currency(), 10094 quantity: "1", 10095 price: i.totalCost, 10096 }); 10097 o += 1; 10098 }), 10099 ko.utils.arrayForEach(t.reservation().supplements, function (n) { 10100 var i = ko.unwrap(n); 10101 e.push({ 10102 item_id: "" + i.supplementId(), 10103 item_name: i.name, 10104 item_category: "Supplements", 10105 currency: t.currency(), 10106 quantity: i.quantity(), 10107 price: i.unitCost(), 10108 }); 10109 })); 10110 u && 10111 (ko.utils.arrayForEach(t.reservation().rooms, function (i) { 10112 var r = ko.unwrap(i); 10113 n.push({ 10114 id: "" + t.reservation().id, 10115 name: r.name + " " + r.board.name, 10116 category: "Rooms", 10117 quantity: "1", 10118 price: r.totalCost, 10119 }); 10120 o += 1; 10121 }), 10122 ko.utils.arrayForEach(t.reservation().supplements, function (i) { 10123 var r = ko.unwrap(i); 10124 n.push({ 10125 id: "" + t.reservation().id, 10126 name: r.name, 10127 category: "Supplements", 10128 quantity: r.quantity(), 10129 price: r.unitCost(), 10130 }); 10131 })); 10132 var i = IBE.Utils.getReservationSetting(t, "adwordsConversionId"), 10133 r = "", 10134 s = IBE.Utils.getReservationSetting(t, "globalAdwordsConversionId"), 10135 h = IBE.Utils.getReservationSetting(t, "globalAdwordsConversionLabel"), 10136 c = IBE.Utils.getReservationSetting(t, "googleConversionTrackingPartnerId"), 10137 l = IBE.Utils.getReservationSetting(t, "googleConversionTrackingHotelAdsId"), 10138 a = IBE.Utils.getReservationSetting(t, "googleConversionTrackingHotelAdsLabel");
10139 (i && typeof gtag != "undefined" && IBE.Config.userCookieAcceptance === !0) || (i = ""); 10140 IBE.Config.reservationStatus[t.reservation().status()] === 3 10141 ? (r = IBE.Utils.getReservationSetting(t, "adwordsRequestLabel")) 10142 : IBE.Config.reservationStatus[t.reservation().status()] === 1 && 10143 (r = IBE.Utils.getReservationSetting(t, "adwordsConversionLabel")); 10144 i && 10145 r && 10146 gtag("event", "purchase", { 10147 send_to: "AW-" + i + "/" + r, 10148 transaction_id: t.reservation().id, 10149 affiliation: t.reservation().hotelName, 10150 value: ko.unwrap(t.reservation().totalCost()), 10151 currency: t.reservation().currencyCode, 10152 items: n, 10153 checkout_step: 4, 10154 id: t.reservation().hotelId, 10155 start_date: t.reservation().checkIn.format("YYYY-MM-DD"), 10156 end_date: t.reservation().checkOut.format("YYYY-MM-DD"), 10157 }); 10158 s && 10159 h && 10160 gtag("event", "purchase", { 10161 send_to: "AW-" + s + "/" + h, 10162 transaction_id: t.reservation().id, 10163 affiliation: t.reservation().hotelName, 10164 value: ko.unwrap(t.reservation().totalCost()), 10165 currency: t.reservation().currencyCode, 10166 items: n, 10167 checkout_step: 4, 10168 id: t.reservation().hotelId, 10169 start_date: t.reservation().checkIn.format("YYYY-MM-DD"), 10170 end_date: t.reservation().checkOut.format("YYYY-MM-DD"), 10171 }); 10172 c && 10173 gtag("event", "purchase", { 10174 send_to: "HA-" + c, 10175 transaction_id: t.reservation().id, 10176 affiliation: t.reservation().hotelName, 10177 value: ko.unwrap(t.reservation().totalCost()), 10178 currency: t.reservation().currencyCode, 10179 items: n, 10180 checkout_step: 4, 10181 id: t.reservation().hotelId, 10182 start_date: t.reservation().checkIn.format("YYYY-MM-DD"), 10183 end_date: t.reservation().checkOut.format("YYYY-MM-DD"), 10184 }); 10185 l && 10186 a && 10187 gtag("event", "purchase", { 10188 send_to: "AW-" + l + "/" + a, 10189 transaction_id: t.reservation().id, 10190 affiliation: t.reservation().hotelName, 10191 value: ko.unwrap(t.reservation().totalCost()), 10192 currency: t.reservation().currencyCode, 10193 items: n, 10194 checkout_step: 4, 10195 id: t.reservation().hotelId, 10196 start_date: t.reservation().checkIn.format("YYYY-MM-DD"), 10197 end_date: t.reservation().checkOut.format("YYYY-MM-DD"), 10198 }); 10199 u && 10200 gtag("event", "purchase", { 10201 send_to: u, 10202 transaction_id: t.reservation().id, 10203 affiliation: t.reservation().hotelName, 10204 value: ko.unwrap(t.reservation().totalCost()), 10205 currency: t.reservation().currencyCode, 10206 items: n, 10207 checkout_step: 4, 10208 id: t.reservation().hotelId, 10209 start_date: t.reservation().checkIn.format("YYYY-MM-DD"), 10210 end_date: t.reservation().checkOut.format("YYYY-MM-DD"), 10211 }); 10212 f && 10213 gtag("event", "purchase", { 10214 send_to: f, 10215 transaction_id: t.reservation().id, 10216 affiliation: t.reservation().hotelName, 10217 value: ko.unwrap(t.reservation().totalCost()), 10218 currency: t.reservation().currencyCode, 10219 items: e, 10220 checkout_step: 4, 10221 id: t.reservation().hotelId, 10222 start_date: t.reservation().checkIn.format("YYYY-MM-DD"), 10223 end_date: t.reservation().checkOut.format("YYYY-MM-DD"), 10224 }); 10225 t.markTrackedReservation(); 10226 } 10227 }; 10228 t.trackTrivagoConversion = function () { 10229 var n = Cache.read("ref", "localstorage"), 10230 u, 10231 i, 10232 r, 10233 f, 10234 e; 10235 if ( 10236 (n === "Trivago" || n === "trivago" || (n && n.name && (n.name === "Trivago" || n.name === "trivago"))) &&
10237 IBE.Config.userCookieAcceptance === !0 10238 ) { 10239 if (((u = IBE.Utils.getReservationSetting(t, "trivagoTrackingId")), typeof u == "undefined")) return; 10240 i = IBE.Utils.getReservationSetting(t, "trivagoConversionKey"); 10241 r = IBE.Utils.getReservationSetting(t, "trivagoSupplierId"); 10242 n && 10243 n.params && 10244 n.params.trv_reference && 10245 r && 10246 i && 10247 ((f = n.params.trv_reference), 10248 (e = { 10249 trv_reference: f, 10250 advertiser_id: r, 10251 hotel: t.reservation().hotelId, 10252 arrival: t.reservation().checkIn.format("YYYY-MM-DD"), 10253 departure: t.reservation().checkOut.format("YYYY-MM-DD"), 10254 volume: t.reservation().totalCost(), 10255 booking_id: t.reservation().id, 10256 currency: t.reservation().currencyCode, 10257 number_of_rooms: t.reservation().rooms.length, 10258 locale: IBE.Config.lang.split("-")[1], 10259 date_format: "Y-m-d", 10260 booking_date: moment.utc(t.reservation().created).format("YYYYMMDDHHmmss"), 10261 booking_date_format: "YmdHis", 10262 cancellation_date: moment.utc().format("YYYYMMDDHHmmss"), 10263 cancellation_date_format: "YmdHis", 10264 refund_amount: 0, 10265 }), 10266 IBE.Utils.request({ 10267 type: "DELETE", 10268 url: "https://secde.trivago.com/tracking/booking", 10269 data: JSON.stringify(e), 10270 dataType: "json", 10271 headers: { "Content-Type": "application/json", "X-Trv-Ana-Key": i }, 10272 }) 10273 .done(function () {}) 10274 .fail(function () {})); 10275 } 10276 }; 10277}; 10278IBE.ViewModels.PopUpPartialViewModel = function (n) { 10279 function i() { 10280 var n = t.roomId(), 10281 f = ko.utils.arrayFilter(t.request().hotelResults(), function (n) { 10282 return n.hotelId() === t.hotelId(); 10283 })[0], 10284 e = ko.utils.arrayFilter(f.requestedRooms(), function (n) { 10285 return n.roomIndex() === t.roomIndex(); 10286 })[0], 10287 i = ko.utils.arrayFilter(e.roomResults(), function (n) { 10288 return n.roomIndex() === t.roomIndex() && n.roomId() === t.roomId(); 10289 })[0], 10290 u, 10291 r; 10292 n !== 0 && 10293 ((u = [ 10294 IBE.Config.apiBaseUrl, 10295 "/hotels/availability/", 10296 IBE.Config.hotelId, 10297 "/", 10298 n, 10299 "/?apikey=", 10300 IBE.Config.apiKey, 10301 ].join("")), 10302 (r = [ 10303 "RoomAvailability_", 10304 t.hotelId(), 10305 "_", 10306 n, 10307 "_", 10308 MD5([t.bookingProcess().checkIn(), "_", t.bookingProcess().checkOut()].join("")), 10309 ].join("")), 10310 IBE.Data.RoomAvailability[n] 10311 ? ((i.availability = IBE.Data.RoomAvailability[n]), t.data(i)) 10312 : Cache.read(r) !== !1 10313 ? ((IBE.Data.RoomAvailability[n] = Cache.read(r)), 10314 (i.availability = IBE.Data.RoomAvailability[n]), 10315 t.data(i)) 10316 : IBE.Utils.request({ url: u }).done(function (u) { 10317 IBE.Data.RoomAvailability[n] = u; 10318 Cache.write(r, IBE.Data.RoomAvailability[n]); 10319 i.availability = IBE.Data.RoomAvailability[n]; 10320 t.data(i); 10321 })); 10322 } 10323 var t = this; 10324 ko.utils.extend(t, n); 10325 t.roomIndex = ko.observable(1); 10326 t.roomId = ko.observable(0); 10327 t.ratePlanId = ko.observable(0); 10328 t.toggle = function (n, r) { 10329 t.roomIndex(ko.unwrap(n.roomIndex)); 10330 t.roomId(ko.unwrap(n.roomId)); 10331 t.ratePlanId(ko.unwrap(n.ratePlanId)); 10332 i(); 10333 switch (r) { 10334 case "availability": 10335 case "rateplan": 10336 t.activeMenu(r); 10337 break; 10338 default: 10339 t.activeMenu("info"); 10340 } 10341 }; 10342 t.activeMenu = ko.observable("info"); 10343 t.selectMenu = ko.computed({ 10344 write: function (n) { 10345 t.activeMenu(n); 10346 }, 10347 read: function () { 10348 return t.activeMenu(); 10349 }, 10350 deferEvaluation: !0, 10351 }); 10352 t.data = ko.observable(!1); 10353 t.hasFloorplan = ko.computed({ 10354 read: function () { 10355 var i = "floorplan", 10356 n; 10357 return t.data() === !1 10358 ? !1 10359 : t.data().info().photos.length === 0 || typeof t.data().info().photos == "undefined" 10360 ? !1 10361 : ((n = ko.utils.arrayFilter(t.data().info().photos, function (n) { 10362 return n.type.toLowerCase().indexOf(i) !== -1; 10363 })), 10364 n.length > 0 ? !0 : !1); 10365 }, 10366 deferEvaluation: !0, 10367 }); 10368};
10369IBE.ViewModels.Reservation = function (n) { 10370 var t = this; 10371 ko.utils.extend(t, new IBE.ViewModels.Message()); 10372 ko.utils.extend(t, new IBE.ViewModels.Taxes(t)); 10373 t.events = new ko.subscribable(); 10374 t.reservation = ko.observable(n); 10375 t.reservationAction = ko.observable(""); 10376 t.ready = ko.observable(!1); 10377 t.creditCard = ko.observable(); 10378 t.errors = ko.observable({ creditCard: ko.validation.group(t.creditCard) }); 10379 t.setReservationAction = function (n) { 10380 t.reservationAction(n); 10381 }; 10382 t.save = function () { 10383 var n = { 10384 id: t.reservation().id, 10385 code: t.reservation().code, 10386 newStatus: t.reservation().status, 10387 notes: t.reservation().notes(), 10388 cancellactionNotes: t.reservation().cancellactionNotes(), 10389 }; 10390 IBE.Utils.request({ 10391 type: "POST", 10392 data: ko.toJSON(n), 10393 url: IBE.Config.apiBaseUrl + "/hotels/reservation/update/?apikey=" + IBE.Config.apiKey, 10394 beforeSend: function (n) { 10395 n.setRequestHeader("Authorization", IBE.Utils.authenticationCookie()); 10396 }, 10397 }) 10398 .done(function (n) { 10399 var i = t.reservation().id, 10400 r = { id: 1e3, severity: "info", reservationId: i }; 10401 t.reservation().refresh(n); 10402 t.events.notifySubscribers(r, "reservationinfo"); 10403 }) 10404 .fail(function () { 10405 var n = { id: 5002, severity: "error", text: IBE.Utils.translate("updateReservationFailed") }; 10406 t.events.notifySubscribers(n, "error"); 10407 t.message(n); 10408 }); 10409 }; 10410 t.webCheckIn = function () { 10411 var n = { code: t.reservation().code, guests: t.reservation().guests() }; 10412 $.ajax({ 10413 type: "POST", 10414 url: IBE.Config.apiBaseUrl + "/hotels/reservation/checkin/?apikey=" + IBE.Config.apiKey, 10415 data: ko.toJSON(n), 10416 beforeSend: function (n) { 10417 n.setRequestHeader("Authorization", IBE.Utils.authenticationCookie()); 10418 t.ready(!1); 10419 }, 10420 success: function (n) { 10421 t.clearMessage(); 10422 var i = { id: 200, severity: "success", text: IBE.Utils.translate("webCheckInSave") }; 10423 t.reservation().webCheckIn(n.webCheckIn); 10424 t.reservation().webCheckInActive(n.webCheckInActive); 10425 t.message(i); 10426 t.events.notifySubscribers(i, "webcheckinSave"); 10427 }, 10428 error: function (n) { 10429 t.clearMessage(); 10430 t.events.notifySubscribers(!0, "ready"); 10431 var i = { id: n.status, severity: "error", text: JSON.parse(n.responseText) }; 10432 t.message(i); 10433 t.events.notifySubscribers(i, "error"); 10434 }, 10435 complete: function () { 10436 t.ready(!0); 10437 }, 10438 }); 10439 }; 10440 t.confirmReservationAction = function (n, i, r) { 10441 var o = { 10442 id: t.reservation().id, 10443 newStatus: n, 10444 creditCard: {}, 10445 code: t.reservation().code, 10446 cancellationNotes: t.reservation().cancellationNotes(), 10447 }, 10448 u = !1, 10449 e, 10450 f; 10451 loader = new Loader(); 10452 switch (n) { 10453 case "CancelledReservation": 10454 case "CancelledRequest": 10455 loader.visible(!0); 10456 i.code != t.reservation().code && 10457 ((e = { id: 5001, severity: "error", text: IBE.Utils.translate("wrongReservationCode") }), 10458 t.message(e), 10459 t.events.notifySubscribers(e, "error"), 10460 (u = !0)); 10461 break; 10462 case "ConfirmedReservation": 10463 t.errors().creditCard().length > 0 && 10464 ((u = !0), 10465 t.errors().creditCard().length === 1 && t.errors().creditCard()[0] == null 10466 ? (u = !1) 10467 : t.errors().creditCard.showAllMessages()); 10468 f = r.cardExpirationYear() + ""; 10469 f = f.substring(2); 10470 o.creditCard = { 10471 holder: r.cardHolder(), 10472 expireYear: f, 10473 expireMonth: r.cardExpirationMonth(), 10474 number: r.cardNumber(), 10475 verification: r.cardVerification(), 10476 }; 10477 } 10478 if (u) return loader.visible(!1), !1; 10479 IBE.Utils.request({ 10480 type: "POST", 10481 data: ko.toJSON(o), 10482 url: IBE.Config.apiBaseUrl + "/hotels/reservation/update/?apikey=" + IBE.Config.apiKey, 10483 beforeSend: function (n) { 10484 n.setRequestHeader("Authorization", IBE.Utils.authenticationCookie()); 10485 }, 10486 }) 10487 .done(function (i) { 10488 var r = t.reservation().id, 10489 u = { id: 1e3, severity: "info", text: n, reservationId: r }; 10490 (n == "CancelledReservation" || n == "CancelledRequest") && 10491 (loader.visible(!1), $("html,body").animate({ scrollTop: $(".ibe").offset().top }, 1e3)); 10492 t.reservation().refresh(i); 10493 t.events.notifySubscribers(u, "reservationstatus"); 10494 }) 10495 .fail(function () { 10496 var n = { id: 5002, severity: "error", text: IBE.Utils.translate("updateReservationFailed") }; 10497 t.events.notifySubscribers(n, "error"); 10498 t.message(n); 10499 }); 10500 }; 10501};
10502IBE.ViewModels.ResponseViewModel = function () { 10503 var n = this; 10504 n.successTransaction = ko.observable(!1); 10505 n.reservationId = ko.observable(""); 10506 n.authorizationNumber = ko.observable(""); 10507 n.status = ko.observable(""); 10508 n.myReservation = ko.observable(null); 10509 n.ready = ko.observable(!1); 10510 n.statusUpdated = !1; 10511 n.events = new ko.subscribable(); 10512 n.mid = ko.observable(""); 10513 n.paymentTotal = ko.observable(""); 10514 n.message = ko.observable(""); 10515 n.payMethod = ko.observable(""); 10516 n.paymentRef = ko.observable(""); 10517 n.orderAmount = ko.observable(""); 10518 n.txId = ko.observable(""); 10519 ko.utils.extend(n, new IBE.ViewModels.LanguagePartialViewModel(n)); 10520 n.status.subscribe(function (t) { 10521 n.fetchReservation(t); 10522 }); 10523 n.init = function () { 10524 $.when(n.languagePartialInit()).then(function () { 10525 n.status() === "" ? n.events.notifySubscribers(!0, "error") : n.events.notifySubscribers(!0, "ready"); 10526 }); 10527 }; 10528 n.events.subscribe( 10529 function () { 10530 IBEStepsMain.setStep(1); 10531 }, 10532 this, 10533 "error" 10534 ); 10535 n.events.subscribe( 10536 function () { 10537 n.ready(!0); 10538 }, 10539 this, 10540 "ready" 10541 ); 10542 n.fetchReservation = function () { 10543 var t = Cache.read("authenticationKey"), 10544 r, 10545 i; 10546 if (t) t = atob(t); 10547 else { 10548 IBEStepsMain.setStep(1); 10549 $("#Header").show(); 10550 return; 10551 } 10552 r = { email: t, code: n.reservationId() }; 10553 i = new IBE.ViewModels.MyReservation(r); 10554 i.reservation.subscribe(function () { 10555 n.myReservation(i); 10556 n.setConfirmed(); 10557 }); 10558 i.init(); 10559 Cache.clear(); 10560 }; 10561 n.setConfirmed = function () { 10562 n.statusUpdated || 10563 (n.status() === "CAPTURED" 10564 ? n.confirmAction("ConfirmedReservation") 10565 : n.confirmAction("CancelledReservationPaymentExpired"), 10566 (n.statusUpdated = !0)); 10567 }; 10568 n.beforeConfirmAction = function (t, i, r) { 10569 typeof r == "undefined" && (r = i); 10570 hp.disable($(r.currentTarget)); 10571 n.confirmAction(t, r); 10572 }; 10573 n.cancelCode = ko.observable(""); 10574 n.confirmAction = function (t) { 10575 var i = ko.utils.arrayFirst(n.myReservation().reservation().payments(), function (n) { 10576 return moment().diff(n.dateToPay, "days") == 0 && n.paymentType === "ExternalGateway"; 10577 }), 10578 u = "", 10579 e; 10580 i && (u = i.id); 10581 var i = { 10582 reservationId: n.myReservation().reservation().id, 10583 amount: n.paymentTotal(), 10584 transactionId: n.txId(), 10585 merchantId: n.mid(), 10586 notes: n.message(), 10587 transactionLog: 10588 " paymentTotal:" + 10589 n.paymentTotal() + 10590 " payMethod:" + 10591 n.payMethod() + 10592 " paymentRef:" + 10593 n.paymentRef() + 10594 " orderAmount:" + 10595 n.orderAmount() + 10596 " tcID:" + 10597 n.txId(), 10598 id: u, 10599 }, 10600 o = { 10601 id: n.myReservation().reservation().id, 10602 newStatus: t, 10603 creditCard: [], 10604 cancellationNotes: n.myReservation().reservation().cancellationNotes(), 10605 notes: n.myReservation().reservation().notes(), 10606 payment: i, 10607 }, 10608 f = !1, 10609 r = new Loader(); 10610 switch (t) { 10611 case "CancelledReservation": 10612 case "CancelledRequest": 10613 n.disableButton(!0); 10614 r.visible(!0); 10615 n.cancelCode() != n.myReservation().reservation().code && 10616 ((e = { id: 5001, severity: "error", text: IBE.Utils.translate("wrongReservationCode") }), 10617 n.events.notifySubscribers(e, "error"), 10618 (f = !0)); 10619 } 10620 if (f) return n.disableButton(!1), r.visible(!1), !1; 10621 IBE.Utils.request({ 10622 type: "POST", 10623 data: ko.toJSON(o), 10624 url: IBE.Config.apiBaseUrl + "/hotels/reservation/update/?apikey=" + IBE.Config.apiKey, 10625 }) 10626 .done(function (i) { 10627 n.cancelCode(""); 10628 n.myReservation().reservation(new IBE.Models.Reservation(i)); 10629 n.events.notifySubscribers(!0, t); 10630 (t == "CancelledReservation" || t == "CancelledRequest") && r.visible(!1); 10631 }) 10632 .fail(function () { 10633 var t = { id: 5002, severity: "error", text: IBE.Utils.translate("updateReservationFailed") }; 10634 n.message(t); 10635 n.events.notifySubscribers(t, "error"); 10636 }); 10637 }; 10638};
10639IBE.ViewModels.Step1ViewModel = function () { 10640 function r(t) { 10641 var i = new IBE.Models.Hotel({ 10642 info: new IBE.Models.HotelInfo(t.info), 10643 availability: t.availability, 10644 settings: t.settings, 10645 conditions: t.conditions, 10646 defaults: t.defaults, 10647 memberships: t.memberships, 10648 offers: ko.utils.arrayMap(t.offers, function (t) { 10649 return new IBE.Models.Offer(t, n); 10650 }), 10651 }), 10652 u = moment(), 10653 r; 10654 i.conditions.firstAvailableDate && 10655 IBE.Utils.getReservationSetting(n, "displayNotAvailable") == 0 && 10656 (u = moment(i.conditions.firstAvailableDate)); 10657 i.conditions.minCheckInDate && 10658 ((r = moment(i.conditions.minCheckInDate)), 10659 n.minCheckInDate(r), 10660 n.checkIn().diff(r, "days") <= 0 ? n.checkIn(r) : n.checkIn().diff(u, "days") <= 0 && n.checkIn(u)); 10661 i.conditions.maxStay > 0 ? n.maxStay(i.conditions.maxStay) : n.maxStay(IBE.Config.maxStay); 10662 IBE.Config.ibeEnforceMLOS && n.minStay(parseInt(IBE.Config.minStay)); 10663 n.nights(parseInt(IBE.Config.minStay)); 10664 n.maxStay(i.conditions.maxStay); 10665 i.settings.maxStay = n.maxStay(); 10666 n.reservationSettings = new IBE.Models.ReservationSettings(t.settings); 10667 n.groupText = IBE.Config.groupText; 10668 n.couponExists(t.info.couponExists); 10669 n.maxRequestedRooms(i.conditions.maxRequestedRooms); 10670 n.boardTypes.removeAll(); 10671 IBE.Config.ibeShowBoard || n.showBoard(!1); 10672 i.info.boardTypes.sort(function (n, t) { 10673 return IBE.Config.boardType[n.boardType] === IBE.Config.boardType[t.boardType] 10674 ? 0 10675 : IBE.Config.boardType[n.boardType] > IBE.Config.boardType[t.boardType] 10676 ? 1 10677 : -1; 10678 }); 10679 n.boardTypes(i.info.boardTypes); 10680 n.boardType(i.info.defaultBoardType()); 10681 n.rooms = ko.observableArray( 10682 ko.utils.arrayMap(t.info.rooms, function (n) { 10683 return new IBE.Models.RoomInfo(n); 10684 }) 10685 ); 10686 n.hotel(i); 10687 n.requestedRooms().length === 0 && n.addRequestedRoom(); 10688 Cache.read("ref", "localstorage") && n.referrer(new IBE.Models.Referrer(Cache.read("ref", "localstorage"))); 10689 n.ready(!0); 10690 n.events.notifySubscribers(!0, "ready"); 10691 } 10692 function i() { 10693 var t = []; 10694 return ( 10695 ko.utils.arrayForEach(n.requestedRooms(), function (n) { 10696 var i = []; 10697 ko.utils.arrayForEach(n.guests, function (n) { 10698 i.push({ ageCategory: n.ageCategory(), fromAge: n.fromAge(), pax: n.pax(), ages: n.ages() }); 10699 }); 10700 t.push(i); 10701 }), 10702 { 10703 checkIn: IBE.Utils.dateIsoFormat(n.checkIn()), 10704 checkOut: IBE.Utils.dateIsoFormat(n.checkOut()), 10705 rooms: t, 10706 couponCode: n.couponCode(), 10707 travelAgencyID: n.travelAgencyID(), 10708 travelAgencyName: n.travelAgencyName(), 10709 rateplan: n.rateplan, 10710 board: n.boardType(), 10711 referrer: n.referrer(), 10712 } 10713 ); 10714 } 10715 var n = this, 10716 t; 10717 n.events = new ko.subscribable(); 10718 n.ready = ko.observable(!1); 10719 ko.utils.extend(n, new IBE.ViewModels.LanguagePartialViewModel(n)); 10720 ko.utils.extend(n, new IBE.ViewModels.CurrenciesPartialViewModel(n)); 10721 ko.utils.extend(n, new IBE.ViewModels.Message()); 10722 ko.utils.extend(n, new IBE.ViewModels.PartialMemberViewModel(n)); 10723 t = []; 10724 n.dispose = function () { 10725 for (var n in t) t[n].dispose(); 10726 }; 10727 n.referrer = ko.observable(new IBE.Models.Referrer()); 10728 n.allowSubmit = ko.observable(!0); 10729 n.rateplan = ko.observable(new IBE.Models.Offer({}, n)); 10730 n.hotel = ko.observable(); 10731 n.boardTypes = ko.observableArray([]); 10732 n.boardType = ko.observable(""); 10733 n.showBoard = ko.observable(!0); 10734 n.board = ko.computed({ 10735 read: function () { 10736 if (!n.hotel()) return {}; 10737 var t = ko.utils.arrayFirst(n.hotel().info.boardTypes, function (t) { 10738 return t.boardType === n.boardType(); 10739 }); 10740 return t == null && (t = n.hotel().info.boardTypes[0]), t; 10741 }, 10742 deferEvaluation: !0, 10743 }); 10744 n.rooms = ko.observableArray([]); 10745 n.activeRoom = ko.observable(1); 10746 n.addGuest = function (t, i) { 10747 if (t.ageCategory() === IBE.Config.guestType.Adult) { 10748 if (t.pax() > t.options().length - 1) return !1; 10749 } else if (t.pax() > t.options().length - 2) return !1; 10750 if (n.hotel()) { 10751 if (t.ageCategory() !== IBE.Config.guestType.Infant && !i.canAddGuest(n.hotel().conditions.maxGuests)) 10752 return !1; 10753 t.pax(t.pax() + 1); 10754 } 10755 }; 10756 n.addVisible = function (t) { 10757 return n.hotel() ? t.canAddGuest(n.hotel().conditions.maxGuests) : {}; 10758 }; 10759 n.removeGuest = function (n) { 10760 if (n.pax() === 1 && n.ageCategory() === IBE.Config.guestType.Adult) return !1; 10761 n.pax() <= 0 || n.pax(n.pax() - 1); 10762 }; 10763 n.requestedRooms = ko.observableArray([]); 10764 n.maxRequestedRooms = ko.observable(1); 10765 n.totalGuests = ko.computed({ 10766 read: function () { 10767 var t = 0; 10768 return ( 10769 ko.utils.arrayForEach(n.requestedRooms(), function (n) { 10770 ko.utils.arrayForEach(n.guests, function (n) { 10771 var i = ko.utils.unwrapObservable(n.pax); 10772 isNaN(parseInt(i)) || (t += parseInt(i)); 10773 }); 10774 }), 10775 t 10776 ); 10777 }, 10778 deferEvaluation: !0, 10779 }); 10780 n.totalGuestsNoInfants = ko.computed({ 10781 read: function () { 10782 var t = 0; 10783 return ( 10784 ko.utils.arrayForEach(n.requestedRooms(), function (n) { 10785 ko.utils.arrayForEach(n.guests, function (n) { 10786 if (n.ageCategory() !== IBE.Config.guestType.Infant) { 10787 var i = ko.utils.unwrapObservable(n.pax); 10788 isNaN(parseInt(i)) || (t += parseInt(i)); 10789 } 10790 }); 10791 }), 10792 t 10793 ); 10794 }, 10795 deferEvaluation: !0, 10796 }); 10797 n.minStay = ko.observable(1); 10798 n.maxStay = ko.observable(IBE.Config.maxStay); 10799 n.nightOptions = ko.computed({ 10800 read: function () { 10801 for (var i = [], t = 1; t < n.maxStay(); t++) i.push(t); 10802 return i; 10803 }, 10804 deferEvaluation: !0, 10805 }); 10806 n.nights = ko.computed({ 10807 write: function (t) { 10808 var i = moment(n.checkIn()); 10809 i.add(t, "days"); 10810 n.checkOut(i); 10811 }, 10812 read: function () { 10813 try { 10814 return n.checkOut().startOf("day").diff(n.checkIn().startOf("day"), "days"); 10815 } catch (t) { 10816 return IBE.Utils.logEvent({ message: t.message, hotelId: 0, severity: "error" }), 1; 10817 } 10818 }, 10819 deferEvaluation: !0, 10820 }); 10821 n._checkIn = ko.observable(moment()); 10822 n.checkIn = ko.pureComputed({ 10823 write: function (t) { 10824 n._checkIn().startOf("day").diff(moment(t).startOf("day"), "days") !== 0 && n._checkIn(moment(t)); 10825 }, 10826 read: function () { 10827 return n._checkIn(); 10828 }, 10829 }); 10830 n.checkIn.subscribe(function (t) { 10831 var i = moment(t).add(1, "days");
10832 n.checkOut() - i <= 0 && n.checkOut(i); 10833 }); 10834 n.minCheckInDate = ko.observable(moment()); 10835 n.maxCheckInDate = moment().add(2, "years"); 10836 n.minCheckOutDate = ko.computed(function () { 10837 var t = moment(n.checkIn()); 10838 return t.add(n.minStay(), "days"), t; 10839 }); 10840 n._checkOut = ko.observable(n.minCheckOutDate()); 10841 n.checkOut = ko.computed({ 10842 write: function (t) { 10843 var i = n.minCheckOutDate(), 10844 r; 10845 typeof t == "undefined" 10846 ? (i = n.minCheckOutDate()) 10847 : ((r = moment(t)), 10848 r > n.minCheckOutDate() 10849 ? ((i = r), n._checkOut(r)) 10850 : ((i = n.minCheckOutDate()), n._checkOut(n.minCheckOutDate()))); 10851 n._checkOut().diff(i, "days") !== 0 && n._checkOut(i); 10852 }, 10853 read: function () { 10854 return n._checkOut(); 10855 }, 10856 deferEvaluation: !0, 10857 }); 10858 n.dateRange = ko.observable([moment().subtract(1, "days"), moment(), "day"]); 10859 n.couponCode = ko.observable(""); 10860 n.travelAgencyID = ko.observable(""); 10861 n.travelAgencyName = ko.observable(""); 10862 n.couponValid = ko.observable(!0); 10863 n.couponExists = ko.observable(!1); 10864 n.bookingProcess = ko.observable( 10865 new IBE.Models.BookingProcess({ 10866 checkIn: n.checkIn, 10867 checkOut: n.checkOut, 10868 couponCode: n.couponCode, 10869 travelAgencyID: n.travelAgencyID, 10870 travelAgencyName: n.travelAgencyName, 10871 reservationStatus: "Unknown", 10872 lang: n.lang, 10873 currency: n.currency(), 10874 }) 10875 ); 10876 n.setBoardType = function (t) { 10877 n.boardType(t.boardType); 10878 }; 10879 n.setRateplan = function (t) { 10880 IBE.Utils.request({ 10881 url: 10882 IBE.Config.apiBaseUrl + 10883 "/hotels/offer/" + 10884 IBE.Config.hotelId + 10885 "/" + 10886 t + 10887 "?apikey=" + 10888 IBE.Config.apiKey, 10889 }) 10890 .done(function (t) { 10891 t !== !1 && (n.rateplan(new IBE.Models.Offer(t, n)), n.events.notifySubscribers(!0, "ready")); 10892 }) 10893 .fail(function () { 10894 throw { id: "1001", severity: "error", text: "An error occurred" }; 10895 }); 10896 }; 10897 n.canAddRequestedRoom = function () { 10898 if (n.hotel()) return n.requestedRooms().length <= n.hotel().conditions.maxRequestedRooms - 1; 10899 }; 10900 n.addRequestedRoom = function () { 10901 if (!n.canAddRequestedRoom()) return !1; 10902 var i = n.requestedRooms().length + 1, 10903 t = new IBE.Models.RequestedRoom(i); 10904 return ( 10905 (t.guests = ko.utils.arrayMap(n.hotel().info.guestTypes, function (t) { 10906 var i = new IBE.Models.RequestedRoomGuestType(t); 10907 return t.ageCategory === IBE.Config.guestType.Adult && i.pax(n.hotel().conditions.defaultAdults), i; 10908 })), 10909 n.requestedRooms.push(t), 10910 !0 10911 ); 10912 }; 10913 n.removeRequestedRoom = function (t, i) { 10914 if (n.requestedRooms().length > 1) n.requestedRooms.remove(t); 10915 else return !1; 10916 if (typeof i != "undefined") 10917 try { 10918 i.cancelBubble = !0; 10919 i.stopImmediatePropagation(); 10920 } catch (i) {} 10921 for (var r = 0; r < n.requestedRooms().length; r++) n.requestedRooms()[r].roomIndex(r + 1); 10922 return !0; 10923 }; 10924 n.getHotelSettings = function (t) { 10925 var i = ""; 10926 return ( 10927 $.each(n.hotel().settings, function (n, r) { 10928 r.Key === t && (i = r.Value); 10929 }), 10930 i 10931 ); 10932 }; 10933 n.isDateActive = function (t) { 10934 var i = IBE.Utils.dateIsoFormat(t); 10935 return n.hotel().availability.hasOwnProperty(i) ? n.hotel().availability[i] > 0 : !1; 10936 }; 10937 n.isValidCoupon = function () { 10938 var t = $.Deferred(); 10939 return (n.couponCode(n.couponCode().trim()), n.couponCode().length === 0) 10940 ? (n.couponValid(!0), t.resolve(!0), t.promise()) 10941 : (IBE.Utils.request({ 10942 url:
10943 IBE.Config.apiBaseUrl + 10944 "/hotels/validateCoupon/" + 10945 IBE.Config.hotelId + 10946 "/" + 10947 encodeURI(n.couponCode()) + 10948 "?apikey=" + 10949 IBE.Config.apiKey, 10950 }) 10951 .done(function (i) { 10952 var r = !1; 10953 i === !1 10954 ? (n.message({ id: 3001, severity: "warning", text: "Coupon is not valid" }), 10955 n.couponCode(""), 10956 (r = !1)) 10957 : (r = !0); 10958 n.couponValid(r); 10959 t.resolve(r); 10960 }) 10961 .fail(function () { 10962 n.message({ id: "1001", severity: "error", text: "Failed to validate the coupon" }); 10963 n.couponValid(!1); 10964 t.resolve(!1); 10965 }), 10966 t.promise()); 10967 }; 10968 n.validate = function () { 10969 if (!n.isValidStay()) 10970 return ( 10971 n.message({ id: 3002, severity: "error", text: "invalidDateRange" }), 10972 n.events.notifySubscribers({ failure: n.message() }, "submit"), 10973 !1 10974 ); 10975 if (n.couponExists()) 10976 n.allowSubmit(!1), 10977 $.when(n.isValidCoupon()).then(function (t) { 10978 t 10979 ? n.events.notifySubscribers({ success: i() }, "submit") 10980 : (n.message({ id: 3001, severity: "error", text: "invalidPromoCode" }), 10981 n.events.notifySubscribers({ failure: n.message() }, "submit")); 10982 n.allowSubmit(!0); 10983 }); 10984 else return n.allowSubmit(!1), n.events.notifySubscribers({ success: i() }, "submit"), n.allowSubmit(!0), !0; 10985 return !0; 10986 }; 10987 n.isValidStay = ko.computed({ 10988 read: function () { 10989 return n.nights() > 0 && n.nights() <= n.maxStay(); 10990 }, 10991 deferEvaluation: !0, 10992 }); 10993 n.initTriptease = function () { 10994 var n = IBE.Config.tripteaseHotelId, 10995 t = IBE.Config.tripteaseClientKey; 10996 n && 10997 t && 10998 IBE.Config.userCookieAcceptance === !0 && 10999 $("body").append( 11000 '<script src="https://static.triptease.io/paperboy/' + t + ".js?hotelKey=" + n + '" defer></script>' 11001 ); 11002 }; 11003 n.init = function (i) { 11004 var f = $.Deferred(), 11005 e = IBE.Config.lang.split("-", 1)[0], 11006 u; 11007 return ( 11008 window.document.documentElement.setAttribute("lang", e), 11009 (u = ko.utils.extend( 11010 { apiKey: IBE.Config.apiKey, hotelId: parseInt(IBE.Config.hotelId), lang: IBE.Config.lang }, 11011 i 11012 )), 11013 n.ready(!1), 11014 n.dispose(), 11015 t.push( 11016 n.lang.subscribe(function () { 11017 n.init(); 11018 }) 11019 ), 11020 $.when(n.languagePartialInit(u), n.currenciesPartialInit(), n.customerAuthenticate()).then(function () { 11021 var t = function (t) { 11022 t && typeof t != "undefined" && (r(t), n.initTriptease(), f.resolve(!0)); 11023 }; 11024 $.when(IBE.Utils.loadHotelInfo(t, u)).then(t); 11025 }), 11026 f.promise() 11027 ); 11028 }; 11029}; 11030IBE.ViewModels.Step2ViewModel = function () { 11031 function u(t) { 11032 var i = !1, 11033 r = ko.utils.arrayFirst( 11034 n.request().hotelResults(), 11035 function (t) { 11036 return t.hotelId() === n.hotelId(); 11037 }, 11038 n 11039 ), 11040 u = ko.utils.unwrapObservable(t); 11041 return (ko.utils.arrayForEach(r.requestedRooms(), function (n) { 11042 i = ko.utils.arrayFirst(n.roomResults(), function (n) { 11043 return u === n.roomId(); 11044 }); 11045 }), 11046 i !== !1) 11047 ? i.availability 11048 : !1; 11049 } 11050 function r(r, u) { 11051 var o = ko.utils.extend( 11052 { apiKey: IBE.Config.apiKey, hotelId: parseInt(IBE.Config.hotelId), lang: IBE.Config.lang }, 11053 u 11054 ), 11055 e, 11056 c, 11057 f, 11058 s, 11059 l, 11060 h; 11061 n.clearMessage(); 11062 n.baseCurrency = r.currency; 11063 n.reservationSettings = new IBE.Models.ReservationSettings(r.settings); 11064 IBE.Data.HotelInfo[o.hotelId] && 11065 (IBE.Data.HotelInfo[o.hotelId].info.paymentPolicy = r.hotelInfo[0].paymentPolicy); 11066 e = ko.utils.arrayFilter(r.hotelInfo, function (n) { 11067 return n.hotelId === o.hotelId; 11068 })[0]; 11069 n.boards( 11070 ko.utils.arrayMap(e.boardTypes, function (n) { 11071 return new IBE.Models.BoardType(n); 11072 }) 11073 ); 11074 n.offers( 11075 ko.utils.arrayMap(e.offerInfo, function (n) { 11076 return new IBE.Models.OfferInfo(n); 11077 }) 11078 ); 11079 c = moment(r.request.checkOut).diff(moment(r.request.checkIn), "days"); 11080 n.rateplans( 11081 ko.utils.arrayMap(e.ratePlanInfo, function (n) { 11082 return new IBE.Models.RatePlanInfo(n, c); 11083 }) 11084 ); 11085 n.rooms( 11086 ko.utils.arrayMap(e.roomInfo, function (n) { 11087 return new IBE.Models.RoomInfo(n); 11088 }) 11089 ); 11090 n.hotelInfo(new IBE.Models.HotelInfo(e)); 11091 n.hotelInfo().minCheckInDate = new Date(n.reservationSettings.items.MinCheckInDate); 11092 f = new IBE.Models.Request(); 11093 f.checkIn(moment(r.request.checkIn)); 11094 f.checkOut(moment(r.request.checkOut)); 11095 f.couponCode(r.request.couponCode); 11096 f.travelAgencyID(r.request.travelAgencyID); 11097 f.travelAgencyName(r.request.travelAgencyName); 11098 f.preferredBoard(r.request.preferredBoard); 11099 f.ratePlanId(r.request.rateplanId); 11100 s = []; 11101 ko.utils.arrayForEach(r.request.hotelResults, function (t) { 11102 var i = new IBE.Models.HotelResult(), 11103 u; 11104 i.hotelId(t.hotelId); 11105 i.alternatives = t.alternatives; 11106 i.availability(IBE.Config.hotelAvailability[t.availability]); 11107 n.hotelId(t.hotelId); 11108 n.apiKey(o.apiKey); 11109 n.tabsCount = t.requestedRooms.length; 11110 u = []; 11111 ko.utils.arrayForEach(t.requestedRooms, function (t) { 11112 var i = new IBE.Models.RequestedRoom(n), 11113 r, 11114 f; 11115 i.roomIndex(t.roomIndex); 11116 r = []; 11117 f = []; 11118 ko.utils.arrayForEach(t.guestTypes, function (n) { 11119 var t = new IBE.Models.RequestedRoomGuestType(); 11120 t.ageCategory(n.ageCategory); 11121 t.fromAge(n.fromAge); 11122 t.toAge(n.toAge); 11123 t.pax(n.pax); 11124 t.minValue(n.min); 11125 t.maxValue(n.max); 11126 f.push(t); 11127 }); 11128 i.guests = ko.observableArray(f); 11129 f = []; 11130 ko.utils.arrayForEach(t.roomResults, function (i) { 11131 var u = new IBE.Models.RoomResult(n), 11132 e, 11133 f; 11134 u.roomId(i.roomId); 11135 u.hotelId(n.hotelId()); 11136 u.roomIndex(t.roomIndex); 11137 u.rank = i.rank; 11138 u.availability = IBE.Config.roomAvailability[i.availability]; 11139 u.availabilityStatus = i.availability; 11140 u.availableRooms = i.availableRooms; 11141 u.availabilityRestrictions = ko.utils.arrayMap(i.availabilityRestrictions, function (n) { 11142 return new IBE.Models.AvailabilityRestriction(n); 11143 }); 11144 e = []; 11145 ko.utils.arrayForEach(u.availabilityRestrictions, function (n) { 11146 ko.utils.arrayForEach(n.text, function (n) { 11147 e.push(n); 11148 }); 11149 }); 11150 u.uniqueRestrictionMessages = e.sort().filter(function (n, t, i) { 11151 return !t || n != i[t - 1]; 11152 }); 11153 u.supportedBoards = i.supportedBoards; 11154 f = []; 11155 ko.utils.arrayForEach(i.ratePlans, function (i) { 11156 var r = new IBE.Models.RatePlan(n), 11157 e; 11158 r.ratePlanId(i.ratePlanId); 11159 r.availability(i.availability); 11160 r.showRatePlan(i.showRatePlan); 11161 r.hideRatePlanReasonResource(i.hideRatePlanReasonResource); 11162 r.hideRatePlanReasonValue(i.hideRatePlanReasonValue); 11163 r.showRatePlanBrokenRestrictionMessage(i.showRatePlanBrokenRestrictionMessage); 11164 r.offers = ko.observableArray([]); 11165 e = []; 11166 ko.utils.arrayForEach(i.roomBoards, function (f) { 11167 var o = new IBE.Models.RoomBoard(n); 11168 o.availability = i.availability; 11169 o.roomIndex = t.roomIndex; 11170 o.roomId = u.roomId(); 11171 o.ratePlanId = r.ratePlanId(); 11172 o.boardType(f.boardType); 11173 o.offers(f.specialOfferList); 11174 o.price(f.price); 11175 o.priceWithoutDiscount(f.priceWithoutDiscount); 11176 o.rateBreakDown = ko.observable(new IBE.Models.RateBreakDown(f.daily)); 11177 e.push(o); 11178 }); 11179 e.sort(function (n, t) { 11180 return n.price() === t.price() ? 0 : n.price() > t.price() ? 1 : -1; 11181 }); 11182 r.roomBoards = ko.observableArray(e); 11183 e = []; 11184 f.push(r); 11185 }); 11186 u.rateplans = ko.observableArray(f); 11187 f = []; 11188 r.push(u); 11189 }); 11190 i.roomResults = ko.observableArray(r); 11191 r = []; 11192 u.push(i); 11193 }); 11194 i.requestedRooms = ko.observableArray(u); 11195 u = []; 11196 ko.utils.extend(i, new IBE.ViewModels.SupplementPartialViewModel(t.supplements, r.request.rateplanId)); 11197 s.push(i); 11198 }); 11199 f.hotelResults = ko.observableArray(s); 11200 s = []; 11201 n.request(f); 11202 IBE.Utils.calculateRoomBoard(n.request()); 11203 l = new IBE.Models.BookingProcess({ 11204 checkIn: n.request().checkIn, 11205 checkOut: n.request().checkOut, 11206 rooms: n.selectedRooms, 11207 couponCode: n.request().couponCode(), 11208 travelAgencyID: n.request().travelAgencyID(), 11209 travelAgencyName: n.request().travelAgencyName(), 11210 reservationStatus: "Unknown", 11211 lang: n.lang, 11212 currency: n.currency, 11213 totalGuests: n.request().totalGuests, 11214 supplements: ko.observableArray([]), 11215 }); 11216 n.bookingProcess(l); 11217 h = ko.utils.arrayFilter(n.request().hotelResults(), function (n) { 11218 return n.hotelId() === o.hotelId; 11219 })[0]; 11220 t.push( 11221 h.selectedSupplements.subscribe(function () { 11222 n.bookingProcess().supplements(ko.unwrap(h.selectedSupplements)); 11223 }) 11224 ); 11225 IBE.Data.RatePlanInfo = IBE.Data.RatePlanInfo.concat(ko.toJS(n.rateplans())); 11226 ko.utils.arrayForEach(n.request().hotelResults(), function (t) { 11227 ko.utils.arrayForEach(t.requestedRooms(), function (t) { 11228 var r, u, f; 11229 ko.utils.arrayForEach(t.roomResults(), function (n) { 11230 n.rateplans.sort(function (n, t) { 11231 var r, f, u, i, e; 11232 if (IBE.Config.ibeMealplansView) { 11233 if (n.roomBoards().length == 0 || t.roomBoards().length == 0) return 0; 11234 for (r = null, i = 0; i < n.roomBoards().length; i++) 11235 ((f = n.roomBoards()[i]), f.showPrices() && f.price() !== null) && 11236 (r === null || f.price() < r.price()) && 11237 (r = f); 11238 for (u = null, i = 0; i < t.roomBoards().length; i++) 11239 ((e = t.roomBoards()[i]), e.showPrices() && e.price() !== null) && 11240 (u === null || e.price() < u.price()) && 11241 (u = e); 11242 return r === null || u === null || r.price() === u.price() 11243 ? -1 11244 : r.price() < u.price() 11245 ? -1 11246 : 1; 11247 } 11248 return n.price() > t.price() ? 1 : -1; 11249 }); 11250 n.ratePlanId(n.bestRatePlanId()); 11251 }); 11252 r = [];
11253 IBE.Config.sortRoomsBy && IBE.Config.sortRoomsBy.length > 0 && (r = IBE.Config.sortRoomsBy); 11254 typeof IBE.Data.Settings.ibeRoomSorting != "undefined" && 11255 (r = IBE.Data.Settings.ibeRoomSorting.split(",")); 11256 r.length > 0 && t.sortRoomResults(r); 11257 i.hasOwnProperty("roomId") && 11258 ((u = []), 11259 (f = t.roomResults()), 11260 ko.utils.arrayFirst(f, function (n, t) { 11261 if (n.roomId() === i.roomId) return u.push(n), f.splice(t, 1), !0; 11262 }), 11263 u.length > 0 && (u[0].isFiltered(!0), f.unshift(u[0]))); 11264 n.roomsPrices(t.orderedRoomsPrices()); 11265 }); 11266 }); 11267 n.popup(new IBE.ViewModels.PopUpPartialViewModel(n)); 11268 n.ready(!0); 11269 n.trackFacebookPixelEvent(); 11270 n.trackSojernSearch(); 11271 n.trackUserGuestAvailabilityPixelEvent(); 11272 n.trackSojernProduct(); 11273 n.showTriptease(); 11274 n.events.notifySubscribers(!0, "ready"); 11275 } 11276 var n = this, 11277 i, 11278 t; 11279 n.events = new ko.subscribable(); 11280 n.ready = ko.observable(!1); 11281 ko.utils.extend(n, new IBE.ViewModels.LanguagePartialViewModel(n)); 11282 ko.utils.extend(n, new IBE.ViewModels.Message()); 11283 ko.utils.extend(n, new IBE.ViewModels.CurrenciesPartialViewModel(n)); 11284 ko.utils.extend(n, new IBE.ViewModels.PartialMemberViewModel(n)); 11285 n.referrer = new IBE.Models.Referrer(); 11286 n.preferencesChanged = ko.observable(!1); 11287 n.hotelId = ko.observable(parseInt(IBE.Config.hotelId)); 11288 n.apiKey = ko.observable(parseInt(IBE.Config.apiKey)); 11289 n.bookingProcess = ko.observable(); 11290 n.rooms = ko.observableArray([]); 11291 n.selectedRooms = ko.observableArray([]); 11292 n.tabsCount = 1; 11293 n.activeTabIndex = ko.observable(0); 11294 n.activeRoomIndex = ko.observable(1); 11295 n.showTabs = ko.computed({ 11296 read: function () { 11297 switch (n.hotel().availability()) { 11298 case IBE.Config.hotelAvailability.AvailableOnline: 11299 return !0; 11300 case IBE.Config.hotelAvailability.AvailableOnRequest: 11301 return IBE.Config.displayResults[IBE.Utils.getReservationSetting(n, "displayNotAvailable")] == 0 11302 ? !1 11303 : !0; 11304 default: 11305 return !1; 11306 } 11307 }, 11308 deferEvaluation: !0, 11309 }); 11310 n.groupText = IBE.Config.groupText; 11311 n.hotel = ko.computed({ 11312 read: function () { 11313 return ko.utils.arrayFirst( 11314 n.request().hotelResults(), 11315 function (t) { 11316 return t.hotelId() === n.hotelId(); 11317 }, 11318 n 11319 ); 11320 }, 11321 deferEvaluation: !0, 11322 }); 11323 i = {}; 11324 n.rateplans = ko.observableArray([]); 11325 n.offers = ko.observableArray([]); 11326 n.boards = ko.observableArray([]); 11327 n.boardTypeInfo = ko.computed({ 11328 read: function () { 11329 var t = n.request().preferredBoard(); 11330 return ko.utils.arrayFirst( 11331 n.boards(), 11332 function (n) { 11333 return n.boardType === t; 11334 }, 11335 n 11336 ); 11337 }, 11338 deferEvaluation: !0, 11339 }); 11340 n.hotelInfo = ko.observable(); 11341 n.request = ko.observable(); 11342 n.roomsPrices = ko.observableArray(); 11343 n.popup = ko.observable(new IBE.ViewModels.PopUpPartialViewModel(n)); 11344 n.roomImageWidth = ko.observable(390); 11345 n.roomImageHeight = ko.observable(310); 11346 n.selectRoom = function (t, i) { 11347 var a, f, e, o, s, h, v, y; 11348 if (n.selectedRooms().length >= n.tabsCount) return !0; 11349 if (ko.unwrap(t.bookingAction) === IBE.Config.displayResults.Show) 11350 return n.events.notifySubscribers(ko.unwrap(t), "call"), !0; 11351 var r = new IBE.Models.SelectedRoom(), 11352 c = n.activeTabIndex() + 1, 11353 p = c + 1, 11354 l = !1; 11355 if ( 11356 (ko.utils.arrayForEach(n.request().hotelResults(), function (n) { 11357 var t = ko.utils.arrayFilter(n.requestedRooms(), function (n) { 11358 return p == n.roomIndex(); 11359 }); 11360 t.length > 0 && (l = !0); 11361 }), 11362 r.roomIndex(ko.unwrap(t.roomIndex)), 11363 r.roomId(ko.unwrap(t.roomId)), 11364 r.ratePlanId(ko.unwrap(t.ratePlanId)), 11365 r.boardType(ko.unwrap(t.boardType)), 11366 r.availability(ko.unwrap(u(t.roomId))), 11367 (a = ko.utils.arrayFirst(n.boards(), function (n) { 11368 return n.boardType === r.boardType(); 11369 })), 11370 r.board(ko.unwrap(a)), 11371 (r.guestTypes = ko.observableArray([])), 11372 ko.utils.arrayForEach(n.request().hotelResults(), function (n) { 11373 ko.utils.arrayForEach(n.requestedRooms(), function (n) { 11374 if (ko.unwrap(t.roomIndex) === ko.unwrap(n.roomIndex())) { 11375 r.guestTypes(n.guests()); 11376 return; 11377 } 11378 }); 11379 }), 11380 t instanceof IBE.Models.RoomResult 11381 ? ((f = ko.utils.arrayFirst(t.rateplans(), function (n) { 11382 return n.ratePlanId() === r.ratePlanId(); 11383 })), 11384 typeof f != "undefined" && 11385 f != null && 11386 (r.cost(n.showRoomBoardRateWithSurcharge(f.price(), f.ratePlanId(), r.roomIndex())), 11387 r.costWithoutDiscount( 11388 n.showRoomBoardRateWithSurcharge(f.priceWithoutDiscount(), f.ratePlanId(), r.roomIndex()) 11389 ))) 11390 : t instanceof IBE.Models.RoomBoard && 11391 (r.cost(n.showRoomBoardRateWithSurcharge(t.price(), t.ratePlanId, r.roomIndex())), 11392 r.costWithoutDiscount( 11393 n.showRoomBoardRateWithSurcharge(t.priceWithoutDiscount(), t.ratePlanId, r.roomIndex()) 11394 )), 11395 (r.roomInfo = ko.observable()), 11396 (e = n.rooms.filterByProperty("id", ko.unwrap(t.roomId))), 11397 e().length > 0 && r.roomInfo(e()[0]), 11398 (o = ko.utils.arrayFirst(n.selectedRooms(), function (n) { 11399 return r.roomIndex === n.roomIndex; 11400 })), 11401 o !== null && ko.utils.arrayRemoveItem(n.selectedRooms(), o), 11402 typeof gtag != "undefined") 11403 ) 11404 try { 11405 s = IBE.Utils.getReservationSetting(n, "googleAnalyticsKey"); 11406 h = IBE.Utils.getReservationSetting(n, "googleAnalyticsKeyGA4"); 11407 h && 11408 gtag("event", "add_to_cart", { 11409 send_to: h, 11410 currency: n.currency(), 11411 value: r.cost(), 11412 items: [ 11413 { 11414 item_id: r.roomId(), 11415 item_name: r.roomInfo().name, 11416 item_list_name: "Search Results", 11417 item_brand: n.hotelInfo().name, 11418 currency: n.currency(), 11419 quantity: 1, 11420 price: r.cost(), 11421 }, 11422 ], 11423 }); 11424 s && 11425 gtag("event", "select_room", { 11426 send_to: s, 11427 event_category: "Step2 Select Room", 11428 content_type: "room", 11429 items: [ 11430 { 11431 id: r.roomId(), 11432 name: r.roomInfo().name, 11433 list_name: "Search Results", 11434 brand: n.hotelInfo().name, 11435 quantity: 1, 11436 price: r.cost(), 11437 }, 11438 ], 11439 }); 11440 } catch (i) { 11441 console.log(i); 11442 } 11443 return ((v = IBE.Utils.getReservationSetting(n, "facebook_TrackId")), 11444 v && 11445 typeof fbq != "undefined" &&
11446 IBE.Config.userCookieAcceptance === !0 && 11447 fbq("track", "AddToCart", { 11448 content_ids: r.roomId(), 11449 content_type: "Room", 11450 value: r.cost(), 11451 currency: n.currency(), 11452 }), 11453 n.selectedRooms().push(r), 11454 n.bookingProcess.valueHasMutated(), 11455 n.bookingProcess().rooms.valueHasMutated(), 11456 l) 11457 ? (n.activeTabIndex(c), !0) 11458 : n.selectedRooms().length > 0 11459 ? ((y = n.prepareData()), n.events.notifySubscribers(y, "submit"), !0) 11460 : void 0; 11461 }; 11462 n.viewAvailability = ko.observable(!1); 11463 n.availabilityCalender = function (t, i) { 11464 var r = t, 11465 e = i, 11466 s = ko.utils.arrayFilter(n.request().hotelResults(), function (t) { 11467 return t.hotelId() === n.hotelId(); 11468 })[0], 11469 h = ko.utils.arrayFilter(s.requestedRooms(), function (n) { 11470 return n.roomIndex() === e; 11471 })[0], 11472 u = ko.utils.arrayFilter(h.roomResults(), function (n) { 11473 return n.roomIndex() === e && n.roomId() === r; 11474 })[0], 11475 o, 11476 f; 11477 r !== 0 && 11478 ((o = [ 11479 IBE.Config.apiBaseUrl, 11480 "/hotels/availability/", 11481 IBE.Config.hotelId, 11482 "/", 11483 r, 11484 "/?apikey=", 11485 IBE.Config.apiKey, 11486 ].join("")), 11487 (f = [ 11488 "RoomAvailability_", 11489 n.hotelId(), 11490 "_", 11491 r, 11492 "_", 11493 MD5([n.bookingProcess().checkIn(), "_", n.bookingProcess().checkOut()].join("")), 11494 ].join("")), 11495 IBE.Data.RoomAvailability[r] 11496 ? ((u.availability = IBE.Data.RoomAvailability[r]), u.viewAvailability(!0)) 11497 : Cache.read(f) !== !1 11498 ? ((IBE.Data.RoomAvailability[r] = Cache.read(f)), 11499 (u.availability = IBE.Data.RoomAvailability[r]), 11500 u.viewAvailability(!0)) 11501 : IBE.Utils.request({ url: o }).done(function (n) { 11502 IBE.Data.RoomAvailability[r] = n[0].availability; 11503 Cache.write(f, IBE.Data.RoomAvailability[r]); 11504 u.availability = IBE.Data.RoomAvailability[r]; 11505 u.viewAvailability(!0); 11506 })); 11507 }; 11508 n.trackSojernSearch = function () { 11509 var i = IBE.Config.sojernSearchId, 11510 t; 11511 i && 11512 IBE.Config.userCookieAcceptance === !0 && 11513 ((t = 0), 11514 ko.utils.arrayForEach(n.request().hotelResults()[0].requestedRooms(), function (n) { 11515 ko.utils.arrayForEach(n.guests(), function (n) { 11516 n.pax() > 0 && (t = t + n.pax()); 11517 }); 11518 }), 11519 $("body").append('<script async src="https://static.sojern.com/sdk/latest/sojern.min.js"></script>'), 11520 (window.sjn = 11521 window.sjn || 11522 function () { 11523 (sjn.q = sjn.q || []).push(arguments); 11524 }), 11525 sjn("initAndFire", "advertiser", i, "search", { 11526 context: { vertical: "hotel" }, 11527 params: { 11528 hashedEmailSHA256: "", 11529 clientCookieId: IBEConfig.sessionId, 11530 propertyID: n.hotelId(), 11531 checkInDate: n.bookingProcess().checkIn().format("YYYY-MM-DD"), 11532 checkOutDate: n.bookingProcess().checkOut().format("YYYY-MM-DD"), 11533 city: "", 11534 state: "", 11535 property: n.hotelInfo().name, 11536 currency: "", 11537 numberOfRooms: n.request().hotelResults()[0].requestedRooms().length, 11538 numberOfTravelers: "", 11539 }, 11540 })); 11541 }; 11542 n.trackFacebookPixelEvent = function () { 11543 var r = IBE.Utils.getReservationSetting(n, "facebook_TrackId"), 11544 t, 11545 i; 11546 r && 11547 typeof fbq != "undefined" &&
11548 IBE.Config.userCookieAcceptance === !0 && 11549 ((t = 0), (i = 0), typeof n.bookingProcess() != "undefined") && 11550 (ko.utils.arrayForEach(n.request().hotelResults()[0].requestedRooms(), function (n) { 11551 ko.utils.arrayForEach(n.guests(), function (n) { 11552 n.pax() > 0 && (n.ageCategory() === "Adult" ? (t = t + n.pax()) : (i = i + +n.pax())); 11553 }); 11554 }), 11555 fbq("track", "ViewContent", { 11556 content_type: "hotel", 11557 checkin_date: moment(n.request().checkIn()).format("YYYY-MM-DD"), 11558 checkout_date: moment(n.request().checkOut()).format("YYYY-MM-DD"), 11559 content_ids: n.hotelId(), 11560 num_adults: t, 11561 num_children: i, 11562 })); 11563 }; 11564 n.trackUserGuestAvailabilityPixelEvent = function () { 11565 var r, t, i; 11566 if ( 11567 !IBE.Config.debug && 11568 ((r = IBE.Utils.getReservationSetting(n, "userGuestTrackingId")), 11569 r && typeof r != "undefined" && IBE.Config.userCookieAcceptance === !0) && 11570 ((t = 0), (i = 0), typeof n.bookingProcess() != "undefined") 11571 ) { 11572 ko.utils.arrayForEach(n.request().hotelResults()[0].requestedRooms(), function (n) { 11573 ko.utils.arrayForEach(n.guests(), function (n) { 11574 n.pax() > 0 && (n.ageCategory() === "Adult" ? (t = t + n.pax()) : (i = i + +n.pax())); 11575 }); 11576 }); 11577 var o = moment(n.bookingProcess().checkOut()) 11578 .startOf("day") 11579 .diff(moment(n.bookingProcess().checkIn()).startOf("day"), "days"), 11580 s = ko.utils.arrayFirst( 11581 n.request().hotelResults(), 11582 function (t) { 11583 return t.hotelId() === n.hotelId(); 11584 }, 11585 n 11586 ), 11587 u = Number.MAX_VALUE, 11588 f = "", 11589 e = ""; 11590 ko.utils.arrayForEach(s.requestedRooms(), function (t) { 11591 ko.utils.arrayForEach(t.roomResults(), function (t) { 11592 ko.utils.arrayForEach(t.rateplans(), function (t) { 11593 ko.utils.arrayForEach(t.roomBoards(), function (i) { 11594 if (i.price() < u) { 11595 u = i.price(); 11596 f = t.info().defaultName; 11597 var r = ko.utils.arrayFirst(n.rooms(), function (n) { 11598 return i.roomId === n.id; 11599 }); 11600 r !== null && (e = r.name); 11601 } 11602 }); 11603 }); 11604 }); 11605 }); 11606 window.ugLayer = { 11607 event: "availability", 11608 availabilityData: { 11609 checkIn: n.bookingProcess().checkIn().format("YYYY-MM-DD"), 11610 checkOut: n.bookingProcess().checkOut().format("YYYY-MM-DD"), 11611 dateFormat: "yyyy-MM-dd", 11612 room: e, 11613 roomRate: f, 11614 bestPrice: u, 11615 currency: n.currency(), 11616 nights: o, 11617 adults: t, 11618 children: i, 11619 }, 11620 }; 11621 } 11622 }; 11623 n.trackSojernProduct = function () { 11624 var i = IBE.Config.sojernProductId, 11625 t; 11626 i && 11627 IBE.Config.userCookieAcceptance === !0 && 11628 ((t = 0), 11629 ko.utils.arrayForEach(n.request().hotelResults()[0].requestedRooms(), function (n) { 11630 ko.utils.arrayForEach(n.guests(), function (n) { 11631 n.pax() > 0 && (t = t + n.pax()); 11632 }); 11633 }), 11634 $("body").append('<script async src="https://static.sojern.com/sdk/latest/sojern.min.js"></script>'), 11635 (window.sjn = 11636 window.sjn || 11637 function () { 11638 (sjn.q = sjn.q || []).push(arguments); 11639 }), 11640 sjn("initAndFire", "advertiser", i, "product", { 11641 context: { vertical: "hotel" }, 11642 params: { 11643 hashedEmailSHA256: "", 11644 clientCookieId: IBEConfig.sessionId, 11645 propertyID: n.hotelId(), 11646 checkInDate: n.bookingProcess().checkIn().format("YYYY-MM-DD"), 11647 checkOutDate: n.bookingProcess().checkOut().format("YYYY-MM-DD"), 11648 city: "", 11649 state: "", 11650 property: n.hotelInfo().name, 11651 currency: "", 11652 numberOfRooms: n.request().hotelResults()[0].requestedRooms().length, 11653 numberOfTravelers: t, 11654 }, 11655 })); 11656 }; 11657 n.showTriptease = function () { 11658 var t = IBE.Config.tripteaseHotelId, 11659 i = IBE.Config.tripteaseClientKey, 11660 r = IBE.Config.tripteaseWidgetClosed, 11661 u = ko.utils.arrayFirst( 11662 n.request().hotelResults(), 11663 function (t) { 11664 return t.hotelId() === n.hotelId(); 11665 }, 11666 n 11667 ); 11668 t && 11669 i &&
11670 IBE.Config.userCookieAcceptance === !0 && 11671 typeof Paperboy != "undefined" && 11672 Paperboy.ready(function () { 11673 setTimeout(function () { 11674 $(".bookwize-sidebar") && $(".bookwize-sidebar-vertical").append($(".price-fighter-widget")); 11675 var i = 0, 11676 r = []; 11677 ko.utils.arrayForEach(u.requestedRooms(), function (u, f) { 11678 var e = u.guests()[0].pax(); 11679 ko.utils.arrayForEach(u.guests(), function (n) { 11680 n.ageCategory() !== "Adult" && ((i = i + n.pax()), r.push(n.fromAge())); 11681 }); 11682 $(".price-fighter-widget#atr" + (f + 1)).attr({ 11683 "data-pf-hotelkey": t, 11684 "data-pf-checkin": moment(ko.unwrap(n.bookingProcess().checkIn())).format("YYYY-MM-DD"), 11685 "data-pf-checkout": moment(ko.unwrap(n.bookingProcess().checkOut())).format("YYYY-MM-DD"), 11686 "data-pf-direct-price": u.roomResults()[0].price(), 11687 "data-pf-room-rate": u.roomResults()[0].rateplans()[0].info().defaultName, 11688 "data-pf-currency": n.currency(), 11689 "data-pf-layout": "skeleton-1", 11690 "data-pf-language": n.lang().substr(0, 2), 11691 "data-pf-adults": e, 11692 "data-pf-children": i, 11693 "data-pf-children-ages": r, 11694 }); 11695 }); 11696 Paperboy.PriceCheck.activate(); 11697 }, 500); 11698 r === "True" && 11699 setTimeout(function () { 11700 Paperboy.PriceCheck.close(); 11701 }, 3e3); 11702 }); 11703 }; 11704 n.updateTriptease = function (n, t) { 11705 var i = IBE.Config.tripteaseHotelId, 11706 r = IBE.Config.tripteaseClientKey; 11707 i && 11708 r && 11709 typeof Paperboy != "undefined" && 11710 Paperboy.ready(function () { 11711 $(".price-fighter-widget").attr(n, t); 11712 setTimeout(function () { 11713 Paperboy.PriceCheck.reset(); 11714 }, 500); 11715 }); 11716 }; 11717 n.removeLastRoom = function () { 11718 n.selectedRooms().pop(); 11719 typeof n.bookingProcess() != "undefined" && 11720 (n.bookingProcess.valueHasMutated(), n.bookingProcess().rooms.valueHasMutated()); 11721 }; 11722 n.closedDates = function (n, t) { 11723 var r = [], 11724 i; 11725 return ( 11726 ko.utils.arrayForEach(IBE.Data.HotelInfo[t].info.closedDates, function (t) { 11727 moment(t.closedTo).diff(n, "day") >= 0 && r.push(t); 11728 }), 11729 r.sort(function (n, t) { 11730 return n.closedTo === t.closedTo ? 0 : n.closedTo > t.closedTo ? 1 : -1; 11731 }), 11732 (i = ko.utils.arrayFirst(r, function (n) { 11733 return n; 11734 })), 11735 i 11736 ? IBE.Utils.translate("hotelIsClosedFromTo").format( 11737 moment(i.closedFrom).format("LL"), 11738 moment(i.closedTo).format("LL") 11739 ) 11740 : void 0 11741 ); 11742 }; 11743 n.setRoomIndex = function (t) { 11744 var f = n.activeTabIndex() + 1, 11745 i = t.roomIndex() - 1, 11746 r = !1, 11747 u = !1; 11748 u = ko.utils.arrayFilter(n.selectedRooms(), function (n) { 11749 return t.roomIndex() === n.roomIndex(); 11750 }); 11751 u.length > 0 && ((r = !0), n.selectedRooms().splice(i, n.selectedRooms().length)); 11752 r && n.activeTabIndex(i); 11753 n.bookingProcess.valueHasMutated(); 11754 n.bookingProcess().rooms.valueHasMutated(); 11755 }; 11756 t = []; 11757 n.dispose = function () { 11758 for (var n in t) t[n].dispose(); 11759 }; 11760 n.init = function (u, f) { 11761 n.ready(!1); 11762 var e = ko.utils.extend( 11763 { 11764 apiKey: IBE.Config.apiKey, 11765 hotelId: parseInt(IBE.Config.hotelId), 11766 lang: IBE.Config.lang, 11767 referrer: new IBE.Models.Referrer(), 11768 }, 11769 f 11770 ); 11771 i = u; 11772 n.referrer = u.ref || u.referrer || u.referer || new IBE.Models.Referrer(); 11773 n.dispose(); 11774 t.push( 11775 n.lang.subscribe(function (t) { 11776 n.init(i); 11777 n.updateTriptease("data-pf-language", t); 11778 }) 11779 ); 11780 t.push( 11781 n.currency.subscribe(function (t) { 11782 n.updateTriptease("data-pf-currency", t); 11783 }) 11784 );
11785 $.when(n.languagePartialInit(), n.currenciesPartialInit(), n.customerAuthenticate()) 11786 .then(function () { 11787 var f = { 11788 checkIn: u.checkIn, 11789 checkOut: u.checkOut, 11790 rooms: u.rooms, 11791 ratePlan: u.ratePlan, 11792 couponCode: u.couponCode, 11793 travelAgencyID: u.travelAgencyID, 11794 travelAgencyName: u.travelAgencyName, 11795 board: u.board, 11796 ipAddress: null, 11797 lang: n.lang() || IBE.Config.lang || IBE.Config.defaultLang, 11798 hotelId: parseInt(IBE.Config.hotelId), 11799 reservationId: u.reservationId || 0, 11800 referrer: n.referrer || new IBE.Models.Referrer(), 11801 device: IBE.Config.deviceType, 11802 }, 11803 i = ko.toJSON(f), 11804 t = "HotelRates_" + e.hotelId + "_" + MD5(i) + "_" + MD5(e.apiKey); 11805 if ( 11806 (typeof IBE.Data.HotelRates[e.hotelId] == "undefined" && (IBE.Data.HotelRates[e.hotelId] = {}), 11807 IBE.Data.HotelRates[e.hotelId].hasOwnProperty(t)) 11808 ) 11809 return r(IBE.Data.HotelRates[e.hotelId][t]); 11810 if (Cache.read(t) !== !1) return r(Cache.read(t), e); 11811 IBE.Utils.request({ 11812 type: "POST", 11813 contentType: "application/json", 11814 url: IBE.Config.apiBaseUrl + "/hotels/rates/" + e.hotelId + "/?apikey=" + e.apiKey, 11815 data: i, 11816 }) 11817 .done(function (i) { 11818 var u, f, o; 11819 IBE.Data.HotelRates[e.hotelId][t] = i; 11820 Cache.write(t, IBE.Data.HotelRates[e.hotelId][t]); 11821 r(IBE.Data.HotelRates[e.hotelId][t], e); 11822 typeof gtag != "undefined" && 11823 ((u = IBE.Utils.getReservationSetting(n, "googleAnalyticsKey")), 11824 (f = IBE.Utils.getReservationSetting(n, "googleAnalyticsKeyGA4")), 11825 u && gtag("event", "send", { send_to: u, event_category: "step1", event_label: "submit" }), 11826 f && 11827 ((o = []), 11828 ko.utils.arrayForEach(n.request().hotelResults()[0].requestedRooms(), function (t) { 11829 ko.utils.arrayForEach(t.roomResults(), function (t) { 11830 if (t.availability !== 0) { 11831 var i = Number.MAX_VALUE; 11832 if ( 11833 (ko.utils.arrayForEach(t.rateplans(), function (n) { 11834 ko.utils.arrayForEach(n.roomBoards(), function (n) { 11835 n.price() < i && (i = n.price()); 11836 }); 11837 }), 11838 i === Number.MAX_VALUE) 11839 ) 11840 return; 11841 o.push({ 11842 item_id: t.roomId(), 11843 item_name: t.info().name, 11844 item_list_name: "Search Results", 11845 item_brand: n.hotelInfo().name, 11846 currency: n.currency(), 11847 quantity: 1, 11848 price: i, 11849 }); 11850 } 11851 }); 11852 }), 11853 gtag("event", "view_item_list", { 11854 send_to: f, 11855 item_list_name: "Search Results", 11856 items: o, 11857 }))); 11858 }) 11859 .fail(function (t) { 11860 n.ready(!0); 11861 var i = { id: t.status, severity: "critical", text: t.statusText + ": " + t.responseText }; 11862 return ( 11863 n.events.notifySubscribers(!1, "ready"), 11864 n.events.notifySubscribers(i, "error"), 11865 n.message(i), 11866 i 11867 ); 11868 }); 11869 }) 11870 .fail(function (t) { 11871 console.error(t); 11872 var i = { id: t.status, severity: "critical", text: t.statusText + ": " + t.responseText }; 11873 return n.events.notifySubscribers(!1, "ready"), n.events.notifySubscribers(i, "error"), n.message(i), i; 11874 }); 11875 }; 11876 n.prepareData = function () { 11877 var t = {}; 11878 return ( 11879 (t.bookingInfo = { 11880 checkIn: moment(n.request().checkIn()).format("YYYY-MM-DD"), 11881 checkOut: moment(n.request().checkOut()).format("YYYY-MM-DD"), 11882 rooms: n.selectedRooms(), 11883 couponCode: n.request().couponCode(), 11884 travelAgencyID: n.request().travelAgencyID(), 11885 travelAgencyName: n.request().travelAgencyName(), 11886 supplements: n.request().hotelResults()[0].supplements, 11887 notes: "", 11888 totalGuests: n.totalGuests, 11889 referrer: n.referrer, 11890 }), 11891 (t.bookingProcess = n.bookingProcess), 11892 t 11893 ); 11894 }; 11895 n.surchargeTotalCost = function (t, i) { 11896 var r = 0, 11897 u = ko.utils.arrayFirst( 11898 n.request().hotelResults(), 11899 function (t) { 11900 return t.hotelId() === n.hotelId(); 11901 }, 11902 n 11903 ), 11904 f = ko.utils.arrayFirst( 11905 u.requestedRooms(), 11906 function (n) { 11907 return n.roomIndex() === i; 11908 }, 11909 n 11910 ); 11911 return ( 11912 ko.utils.arrayForEach(u.supplements(), function (i) { 11913 ko.utils.arrayForEach(i.supplementResults(), function (i) { 11914 i.isMandatory && 11915 i.timePricingUnit() === "OneOff" && 11916 i.isSurcharge && 11917 ko.utils.arrayForEach(i.rateplans(), function (i) { 11918 i.ratePlanId === t && 11919 ko.utils.arrayForEach(i.prices(), function (t) { 11920 if (t.price > 0 && t.quantity() > 0) 11921 if (t.guestType && Object.keys(t.guestType).length) { 11922 var i = ko.utils.arrayFirst( 11923 f.guests(), 11924 function (n) { 11925 return n.ageCategory() === t.guestType.ageCategory; 11926 }, 11927 n 11928 ); 11929 i != null && (r = r + t.price * t.quantity()); 11930 } else r = r + t.price * t.quantity(); 11931 }); 11932 }); 11933 }); 11934 }), 11935 r 11936 ); 11937 }; 11938 n.showRoomBoardRateWithSurcharge = function (t, i, r) { 11939 return t + n.surchargeTotalCost(i, r); 11940 }; 11941 n.showRoomBoardRateDailyBreakdownWithSurcharge = function (t, i, r) { 11942 return n.request().nights() > 0 ? t + n.surchargeTotalCost(i, r) / n.request().nights() : t; 11943 }; 11944};
11945IBE.ViewModels.Step3ViewModel = function (n) { 11946 function u(n) { 11947 t.bookingProcess().id(n.id); 11948 t.bookingProcess().baseCurrency = n.currency; 11949 t.bookingProcess().isOnline(n.isOnline); 11950 t.bookingProcess().checkIn(moment.utc(n.checkIn)); 11951 t.bookingProcess().checkOut(moment.utc(n.checkOut)); 11952 t.bookingProcess().couponCode(n.couponCode); 11953 t.bookingProcess().travelAgencyID(n.travelAgencyID); 11954 t.customer().travelAgencyID(n.travelAgencyID); 11955 t.bookingProcess().travelAgencyName(n.travelAgencyName); 11956 t.customer().travelAgencyName(n.travelAgencyName); 11957 t.bookingProcess().paymentMethodType(n.paymentMethod); 11958 t.externalPaymentGatewayData(n.externalPaymentGatewayData); 11959 t.externalPaymentGatewaySupportedPaymentMethods(n.externalPaymentGatewaySupportedPaymentMethods); 11960 t.externalPaymentGatewaySupportedWallets(n.externalPaymentGatewaySupportedWallets); 11961 t.typePaymentGateway(n.typePaymentGateway); 11962 t.externalPaymentGatewayCapabilities( 11963 IBE.Data.HotelInfo[t.hotelInfo().hotelId].settings.externalPaymentGatewayCapabilities 11964 ); 11965 t.bookingProcess().advancePayment(n.advancePayment); 11966 t.bookingProcess().cancellationPolicy(n.cancellationPolicy); 11967 t.bookingProcess().paymentPolicy(n.paymentPolicy); 11968 t.bookingProcess().paymentPolicyHotelTextOption(n.paymentPolicyHotelTextOption); 11969 t.bookingProcess().timePolicy(n.timePolicy); 11970 t.bookingProcess().payments(n.payments); 11971 t.bookingProcess().reservationCancellationRules(n.reservationCancellationRules); 11972 n.supplements.length > 0 && 11973 ko.utils.arrayForEach(t.supplements(), function (t) { 11974 ko.utils.arrayForEach(t.supplementResults(), function (t) { 11975 var i = ko.utils.arrayFilter(n.supplements, function (n) { 11976 return n.id === t.supplementId() && n.roomIndex === t.roomIndex(); 11977 }); 11978 ko.utils.arrayForEach(i, function (n) { 11979 if (n != null) 11980 switch (IBE.Config.supplementPricingType[t.pricingType()]) { 11981 case IBE.Config.supplementPricingType.PerGuest: 11982 ko.utils.arrayForEach(t.prices(), function (i) { 11983 ko.unwrap(i.guestType.ageCategory) === n.ageCategory && 11984 (i.quantity(n.quantity), t.isMandatory && i.minQuantity(n.quantity)); 11985 }); 11986 break; 11987 default: 11988 t.prices()[0].quantity(n.quantity); 11989 t.isMandatory && t.prices()[0].minQuantity(n.quantity); 11990 } 11991 }); 11992 }); 11993 }); 11994 t.groupText = IBE.Config.groupText; 11995 t.bookingProcess().supplements(t.selectedSupplements()); 11996 i.push( 11997 t.selectedSupplements.subscribe(function () { 11998 t.bookingProcess().supplements(ko.unwrap(t.selectedSupplements)); 11999 }) 12000 ); 12001 t.bookingProcess().cost = ko.observable(n.totalAmount); 12002 t.bookingProcess().costWithoutDiscount = ko.observable(n.totalAmountBeforeDiscount); 12003 t.bookingProcess().reservationStatus("Unknown"); 12004 t.bookingProcess().lang = t.lang; 12005 t.bookingProcess().taxes(n.reservationTaxes || []); 12006 IBE.Data.bookingProcess = t.bookingProcess; 12007 } 12008 function f(n) { 12009 n.sort(function (n, t) { 12010 return n.name > t.name ? 1 : -1; 12011 }); 12012 t.countries.removeAll(); 12013 ko.utils.arrayPushAll( 12014 t.countries, 12015 ko.utils.arrayMap(n, function (n) { 12016 return new IBE.Models.Country(n); 12017 }) 12018 ); 12019 } 12020 function e(n) { 12021 t.reservationSettings = new IBE.Models.ReservationSettings(n.settings); 12022 typeof n.info.acceptedCards != "undefined" && 12023 n.info.acceptedCards !== "All" && 12024 t.acceptedCards(n.info.acceptedCards.split(", ")); 12025 } 12026 var t = this, 12027 r, 12028 i; 12029 t.events = new ko.subscribable(); 12030 t.ready = ko.observable(!1);
12031 ko.utils.extend(t, new IBE.ViewModels.LanguagePartialViewModel(t)); 12032 ko.utils.extend(t, new IBE.ViewModels.CurrenciesPartialViewModel(t)); 12033 ko.utils.extend(t, new IBE.ViewModels.Message()); 12034 ko.utils.extend(t, new IBE.ViewModels.PartialMemberViewModel(t)); 12035 t.referrer = new IBE.Models.Referrer(); 12036 t.hotelInfo = ko.observable(); 12037 t.bookingProcess = ko.observable(); 12038 t.allowSubmit = ko.observable(!0); 12039 t.acceptedCards = ko.observableArray([]); 12040 t.externalPaymentGateway = ko.observable(); 12041 t.typePaymentGateway = ko.observable(); 12042 t.externalPaymentGatewayCapabilities = ko.observable(); 12043 t.externalPaymentGatewayMessage = ko.observable(""); 12044 t.externalPaymentGatewayData = ko.observable(""); 12045 t.externalPaymentGatewaySupportedPaymentMethods = ko.observableArray([]); 12046 t.externalPaymentGatewaySupportedWallets = ko.observableArray([]); 12047 t.redirectPaymentGatewayData = ko.observable(""); 12048 t.consents = ko.observableArray([]); 12049 t.terms = ko.observable(); 12050 i = []; 12051 t.dispose = function () { 12052 for (var n in i) i[n].dispose(); 12053 }; 12054 t.countries = ko.observableArray([]); 12055 t.creditCardChargeText = ko.computed({ 12056 read: function () { 12057 return typeof t.bookingProcess() == "undefined" 12058 ? "" 12059 : t.bookingProcess().advancePayment() === 0 12060 ? typeof t.externalPaymentGateway() != "undefined" && 12061 !t.requiredCreditCard() && 12062 t.externalPaymentGatewayCapabilities() === 12063 IBE.Config.paymentGatewayCapabilities.PreAuthorizedFuturePayments.toString() 12064 ? IBE.Utils.translate("creditCardChargeNoteDummyAuth").format(t.getRateText(1, t.currency())) 12065 : IBE.Utils.translate("creditCardChargeNoteNoCharge") 12066 : IBE.Utils.translate("creditCardChargeNoteAmount").format( 12067 t.getRateText(t.bookingProcess().advancePayment(), t.currency()) 12068 ); 12069 }, 12070 deferEvaluation: !0, 12071 }); 12072 t.disableButton = ko.observable(!1); 12073 t.displayExternalPayment = ko.computed(function () { 12074 switch (t.typePaymentGateway()) { 12075 case "Braintree": 12076 return !0; 12077 default: 12078 return !1; 12079 } 12080 }); 12081 t.forceShowCreditCardDetailsForm = ko.observable(!1); 12082 t.requiredCreditCard = ko.computed({ 12083 read: function () { 12084 return t.forceShowCreditCardDetailsForm() 12085 ? !0 12086 : t.bookingProcess().isOnline() 12087 ? typeof t.externalPaymentGateway() != "undefined" && 12088 t.typePaymentGateway() !== "None" && 12089 (t.externalPaymentGatewayCapabilities() === 12090 IBE.Config.paymentGatewayCapabilities.PreAuthorizedFuturePayments.toString() || 12091 t.externalPaymentGatewayCapabilities() === 12092 IBE.Config.paymentGatewayCapabilities.FuturePayments.toString() || 12093 t.externalPaymentGatewayCapabilities() === 12094 IBE.Config.paymentGatewayCapabilities.CreditCardRetrieval.toString() || 12095 (t.externalPaymentGatewayCapabilities() === 12096 IBE.Config.paymentGatewayCapabilities.NoFuturePayments.toString() && 12097 t.bookingProcess().advancePayment() > 0)) 12098 ? !1 12099 : typeof t.externalPaymentGateway() != "undefined" && 12100 t.externalPaymentGateway().notStoreCreditCard() 12101 ? !1 12102 : t.displayExternalPayment() 12103 ? !1 12104 : t.bookingProcess().paymentMethodType() === "NoPaymentInfo" 12105 ? !1 12106 : !0 12107 : !1; 12108 }, 12109 deferEvaluation: !0, 12110 }); 12111 t.disableButton = ko.observable(!1); 12112 t.makeReservation = function () { 12113 var i, n, f, u, e, o; 12114 return (t.ready(!1), 12115 (i = !1), 12116 t.disableButton(!0), 12117 t.customer().errors().customer().length > 0 && 12118 t.customer().errors().customer()[0] !== null && 12119 (t.customer().errors().customer.showAllMessages(), (i = !0)), 12120 t.requiredCreditCard() && 12121 t.customer().errors().creditCard().length > 0 && 12122 (t.customer().errors().creditCard()[0] !== null || !t.customer().creditCard().cardNumber.isValid()) && 12123 (t.customer().errors().creditCard.showAllMessages(), (i = !0)),
12124 t.terms.value() || 12125 t.terms.id === -1 || 12126 (t.customer().errors().customer.showAllMessages(), t.terms.value.notifySubscribers(), (i = !0)), 12127 i) 12128 ? (t.disableButton(!1), 12129 typeof t.externalPaymentGateway() != "undefined" && t.externalPaymentGateway().notStoreCreditCard(!1), 12130 t.ready(!0), 12131 t.events.notifySubscribers(!0, "ready"), 12132 !1) 12133 : (r && r.dispose(), 12134 (n = {}), 12135 (f = []), 12136 ko.utils.arrayForEach(t.consents(), function (n) { 12137 n.value() && f.push(n.id); 12138 }), 12139 (n.referrer = t.referrer || new IBE.Models.Referrer()), 12140 (n.checkIn = t.bookingProcess().checkIn()), 12141 (n.checkOut = t.bookingProcess().checkOut()), 12142 (n.consents = f), 12143 (n.termsAndPrivacyAcceptedVersion = t.terms.id), 12144 (n.customer = { 12145 firstName: t.customer().firstName(), 12146 lastName: t.customer().lastName(), 12147 email: t.customer().email(), 12148 address: t.customer().address(), 12149 city: t.customer().city(), 12150 zip: t.customer().zip(), 12151 telephones: t.customer().phone(), 12152 mobile: t.customer().mobile(), 12153 fax: t.customer().fax(), 12154 birthdate: 12155 t.customer().birthdate() && t.customer().birthdate() !== "" 12156 ? moment(t.customer().birthdate()).format("YYYY-MM-DD") 12157 : null, 12158 }), 12159 typeof t.externalPaymentGateway() != "undefined" && 12160 (n.externalPaymentGatewayData = t.externalPaymentGateway().externalPaymentGatewayData()), 12161 typeof t.customer().title() != "undefined" && (n.customer.title = t.customer().title().key), 12162 typeof t.customer().country() != "undefined" && (n.customer.country = t.customer().country().code()), 12163 t.requiredCreditCard() 12164 ? (IBE.Config.ibeShowCVC || t.customer().creditCard().cardVerification("000"), 12165 (u = t.customer().creditCard().cardExpirationYear() + ""), 12166 (u = u.substring(2)), 12167 (n.creditCard = { 12168 holder: t.customer().creditCard().cardHolder(), 12169 expireYear: u, 12170 expireMonth: t.customer().creditCard().cardExpirationMonth(), 12171 number: t.customer().creditCard().cardNumber(), 12172 verification: t.customer().creditCard().cardVerification(), 12173 })) 12174 : (n.creditCard = null), 12175 t.customer().paymentReceipt().name === "companyInvoice" && 12176 ((e = ""), 12177 t.customer().company().country().name && (e = t.customer().company().country().name()), 12178 (o = ""), 12179 t.customer().company().country() != "undefined" && (o = t.customer().company().country().code()), 12180 (n.company = { 12181 name: t.customer().company().name(), 12182 vatNumber: t.customer().company().vatNumber(), 12183 industry: t.customer().company().industry(), 12184 countryCode: o, 12185 countryName: e, 12186 city: t.customer().company().city(), 12187 address: t.customer().company().address(), 12188 zipCode: t.customer().company().zipCode(), 12189 phone: t.customer().company().phone(), 12190 })), 12191 (n.supplements = []), 12192 ko.utils.arrayForEach(t.selectedSupplements(), function (t) { 12193 ko.utils.arrayForEach(t.prices(), function (i) { 12194 if (i.quantity() > 0) { 12195 var r = new IBE.Models.BookingSupplement(), 12196 f = ko.utils.unwrapObservable(t.roomIndex), 12197 u = i.guestType; 12198 switch (IBE.Config.supplementPricingType[t.pricingType()]) { 12199 case IBE.Config.supplementPricingType.PerReservation: 12200 u = 0; 12201 f = 0; 12202 break; 12203 case IBE.Config.supplementPricingType.PerRoom: 12204 u = 0; 12205 } 12206 r.roomIndex = f; 12207 r.supplementId = ko.utils.unwrapObservable(t.supplementId); 12208 r.quantity = ko.utils.unwrapObservable(i.quantity); 12209 r.guestType = u; 12210 r.categoryName = t.category; 12211 r.ratePlanId = ko.utils.unwrapObservable(t.ratePlanId); 12212 n.supplements.push(r); 12213 } 12214 }); 12215 }), 12216 (n.rooms = ko.utils.arrayMap(t.bookingProcess().rooms(), function (n) { 12217 return { 12218 boardType: n.boardType, 12219 ratePlanId: n.ratePlanId, 12220 roomIndex: n.roomIndex, 12221 roomId: n.roomId, 12222 guestTypes: n.guestTypes, 12223 }; 12224 })), 12225 (n.couponCode = t.bookingProcess().couponCode()), 12226 (n.notes = t.customer().notes()), 12227 (n.cost = t.bookingProcess().cost()), 12228 (n.advancePayment = t.bookingProcess().advancePayment()), 12229 t.events.notifySubscribers(n, "submit"), 12230 !1); 12231 }; 12232 t.init = function (r, o) { 12233 var s = ko.utils.extend( 12234 { apiKey: IBE.Config.apiKey, hotelId: parseInt(IBE.Config.hotelId), lang: IBE.Config.lang }, 12235 o 12236 ); 12237 t.referrer = r.bookingInfo.referrer || new IBE.Models.Referrer(); 12238 t.customer(new IBE.ViewModels.CustomerPartialViewModel(n));
12239 $.when(t.languagePartialInit(s), t.currenciesPartialInit(s), t.customerAuthenticate()).then(function () { 12240 IBE.Data.Step3InitData = r; 12241 i.push( 12242 t.lang.subscribe(function () { 12243 t.init(IBE.Data.Step3InitData); 12244 }) 12245 ); 12246 $.when(IBE.Utils.loadCountries(), IBE.Utils.lookupCountry()).then(function (n, i) { 12247 f(n); 12248 var r = ko.utils.arrayFirst(t.countries(), function (n) { 12249 return n.code() === i; 12250 }); 12251 r != null && t.customer().country(r); 12252 }); 12253 var n = function (n) { 12254 n && 12255 (t.hotelInfo(new IBE.Models.HotelInfo(n.info)), 12256 t.customer().customerMandatoryFields(n.settings.customerMandatoryFields || {}), 12257 e(n), 12258 t.consents([]), 12259 ko.utils.arrayForEach(n.info.consents, function (n) { 12260 t.consents.push(new IBE.Models.Consents(n)); 12261 }), 12262 (t.terms = new IBE.Models.Terms(n.info.termsAndPrivacy))); 12263 }; 12264 $.when(IBE.Utils.loadHotelInfo(n, s)).then(n); 12265 t.paymentOptionsRadio = ko.observable(!0); 12266 t.paymentOptionsRadio.ForEditing = ko.computed({ 12267 read: function () { 12268 return t.customer().paymentReceipt(t.paymentOptionsRadio()), t.paymentOptionsRadio().toString(); 12269 }, 12270 write: function (n) { 12271 t.paymentOptionsRadio(n === "true"); 12272 }, 12273 owner: t, 12274 }); 12275 ko.utils.extend( 12276 t, 12277 new IBE.ViewModels.SupplementPartialViewModel( 12278 r.bookingInfo.supplements(), 12279 r.bookingInfo.rooms[0].ratePlanId() 12280 ) 12281 ); 12282 t.bookingProcess = r.bookingProcess; 12283 t.currency = t.bookingProcess().currency; 12284 t.lang = t.bookingProcess().lang; 12285 IBE.Utils.request({ 12286 type: "POST", 12287 url: IBE.Config.apiBaseUrl + "/hotels/BookingProcess/" + s.hotelId + "?apikey=" + s.apiKey, 12288 data: ko.toJSON(t.bookingProcess().bookingProcessPostData()), 12289 headers: { "Content-Type": "application/json" }, 12290 }) 12291 .done(function (n) { 12292 if ((t.clearMessage(), n === !1)) { 12293 t.ready(!0); 12294 t.events.notifySubscribers(!0, "ready"); 12295 t.message({ id: 4001, severity: "error", text: "An error occured. Please try again" }); 12296 t.events.notifySubscribers(t.message(), "error"); 12297 return; 12298 } 12299 u(n); 12300 t.trackSojernCart(); 12301 t.trackFacebookPixelEvent(); 12302 t.ready(!0); 12303 typeof gtag != "undefined" && 12304 gtag("event", "send", { event_category: "step2", event_label: "submit" }); 12305 t.events.notifySubscribers(!0, "ready"); 12306 }) 12307 .fail(function (n) { 12308 t.ready(!0); 12309 t.clearMessage(); 12310 var i = { id: n.status, severity: "critical", text: n.statusText + ": " + n.responseText }; 12311 t.message(i); 12312 t.events.notifySubscribers(!1, "ready"); 12313 t.events.notifySubscribers(i, "error"); 12314 }); 12315 }); 12316 }; 12317 t.typePaymentGateway.subscribe(function (n) { 12318 t.bookingProcess().paymentMethodType() === "ExternalPaymentGateway" && 12319 n !== "None" && 12320 t.externalPaymentGateway(new IBE.ViewModels.ExternalPaymentGateway(t, n, t.externalPaymentGatewayData())); 12321 }); 12322 t.flightInformation = ko.observable(!1); 12323 t.showFlightInformationDetails = ko.computed({ 12324 read: function () { 12325 return ko.utils.arrayFirst(t.bookingSupplements(), function (n) { 12326 return n.categoryName === "transfers"; 12327 }).length; 12328 }, 12329 deferEvaluation: !0, 12330 });
12331 t.flightInformationDetails = { 12332 flightNumber: ko.observable(""), 12333 airportOfArrival: ko.observable(""), 12334 estimatedTime: ko.observable(""), 12335 }; 12336 t.trackSojernCart = function () { 12337 var i = IBE.Config.sojernCartId, 12338 n; 12339 if (i && IBE.Config.userCookieAcceptance === !0) { 12340 if (((n = 0), typeof t.bookingProcess() == "undefined")) return; 12341 ko.utils.arrayForEach(t.bookingProcess().rooms(), function (t) { 12342 ko.utils.arrayForEach(t.guestTypes(), function (t) { 12343 t.pax() > 0 && (n = n + t.pax()); 12344 }); 12345 }); 12346 $("body").append('<script async src="https://static.sojern.com/sdk/latest/sojern.min.js"></script>'); 12347 window.sjn = 12348 window.sjn || 12349 function () { 12350 (sjn.q = sjn.q || []).push(arguments); 12351 }; 12352 sjn("initAndFire", "advertiser", i, "shoppingCart", { 12353 context: { vertical: "hotel" }, 12354 params: { 12355 hashedEmailSHA256: "", 12356 clientCookieId: IBEConfig.sessionId, 12357 propertyID: t.hotelInfo().hotelId, 12358 checkInDate: t.bookingProcess().checkIn().format("YYYY-MM-DD"), 12359 checkOutDate: t.bookingProcess().checkOut().format("YYYY-MM-DD"), 12360 city: "", 12361 state: "", 12362 property: t.hotelInfo().name, 12363 currency: t.bookingProcess().currency(), 12364 numberOfRooms: t.bookingProcess().rooms().length, 12365 numberOfTravelers: "", 12366 }, 12367 }); 12368 } 12369 }; 12370 t.trackFacebookPixelEvent = function () { 12371 var r = IBE.Utils.getReservationSetting(t, "facebook_TrackId"), 12372 n, 12373 i; 12374 r && 12375 typeof fbq != "undefined" && 12376 IBE.Config.userCookieAcceptance === !0 && 12377 ((n = 0), (i = 0), typeof t.bookingProcess() != "undefined") && 12378 (ko.utils.arrayForEach(t.bookingProcess().rooms(), function (t) { 12379 ko.utils.arrayForEach(t.guestTypes(), function (t) { 12380 t.pax() > 0 && (t.ageCategory() === "Adult" ? (n = n + t.pax()) : (i = i + +t.pax())); 12381 }); 12382 }), 12383 fbq("track", "InitiateCheckout", { 12384 content_type: "hotel", 12385 checkin_date: t.bookingProcess().checkIn().format("YYYY-MM-DD"), 12386 checkout_date: t.bookingProcess().checkOut().format("YYYY-MM-DD"), 12387 content_ids: t.hotelInfo().hotelId, 12388 num_adults: n, 12389 num_children: i, 12390 })); 12391 }; 12392 t.events.subscribe( 12393 function (n) { 12394 t.externalPaymentGatewayMessage(n); 12395 }, 12396 this, 12397 "externalPaymentValidation" 12398 ); 12399 t.events.subscribe( 12400 function () { 12401 t.makeReservation(); 12402 }, 12403 this, 12404 "makeReservation" 12405 ); 12406}; 12407IBE.ViewModels.Step4ViewModel = function () { 12408 function i(t) { 12409 ko.utils.arrayForEach(t, function (t) { 12410 var i = new IBE.Models.Reservation(t), 12411 u, 12412 r; 12413 n.membership.customer(i.customer); 12414 u = IBE.Data.HotelInfo[i.hotelId].memberships; 12415 r = u.filter(function (n) { 12416 return n.termsAndConditions && n.termsAndConditions.length > 0; 12417 }); 12418 r && 12419 r.length > 0 && 12420 (n.membership.loyaltyTerms(r[0].termsAndConditions), n.membership.loyaltyTermsVisible(!0)); 12421 typeof IBE.Data.Step3InitData != "undefined" && 12422 ko.utils.extend( 12423 n, 12424 new IBE.ViewModels.SupplementPartialViewModel(IBE.Data.Step3InitData.bookingInfo.supplements()) 12425 ); 12426 n.bookingProcess = IBE.Data.bookingProcess; 12427 i.taxes(t.taxes || []); 12428 n.options.trackEcommerceScripts && 12429 (n.ecommerce(!0), 12430 n.trackEcommerce(i), 12431 n.trackAdwords(i), 12432 n.trackBingCode(i), 12433 n.trackTrivagoConversion(i), 12434 n.trackSojernConversion(i), 12435 n.trackFacebookConversion(i), 12436 n.initTriptease(i), 12437 n.trackUserGuest(i), 12438 n.googleAds(i), 12439 n.events.notifySubscribers(t, "track-conversion")); 12440 n.reservations.push(i); 12441 }); 12442 n.ready(!0); 12443 n.events.notifySubscribers(!0, "ready"); 12444 } 12445 function r(t) { 12446 n.hotel(new IBE.Models.HotelInfo(t.info)); 12447 n.reservationSettings = new IBE.Models.ReservationSettings(t.settings); 12448 n.googleMap(new IBE.Models.GoogleMap(t.info)); 12449 } 12450 function u() { 12451 var t = []; 12452 return ( 12453 ko.utils.arrayForEach(n.selectedSupplements(), function (n) { 12454 ko.utils.arrayForEach(n.prices(), function (i) { 12455 if (i.quantity() > 0) { 12456 var r = new IBE.Models.BookingSupplement(), 12457 f = ko.utils.unwrapObservable(n.roomIndex), 12458 u = i.guestType; 12459 switch (IBE.Config.supplementPricingType[n.pricingType()]) { 12460 case IBE.Config.supplementPricingType.PerReservation: 12461 u = 0; 12462 f = 0; 12463 break; 12464 case IBE.Config.supplementPricingType.PerRoom: 12465 u = 0; 12466 } 12467 r.roomIndex = f; 12468 r.supplementId = ko.utils.unwrapObservable(n.supplementId); 12469 r.quantity = ko.utils.unwrapObservable(i.quantity); 12470 r.guestType = u; 12471 t.push(r); 12472 } 12473 }); 12474 }), 12475 ko.toJS(t) 12476 ); 12477 } 12478 function f(t) { 12479 function u(n) { 12480 var t = "Basic " + $.base64.encode(n.username + ":" + n.password); 12481 return (document.cookie = "Authorization: " + t), t; 12482 } 12483 function f(n) { 12484 var r = "Authorization=", 12485 i = document.cookie.indexOf(r), 12486 t; 12487 return i !== -1 12488 ? ((t = document.cookie.indexOf(";", i + 1)), 12489 t === -1 && (t = document.cookie.length), 12490 unescape(document.cookie.substring(i + r.length, t))) 12491 : u(n); 12492 } 12493 var r = ko.utils.extend( 12494 { apiKey: IBE.Config.apiKey, hotelId: parseInt(IBE.Config.hotelId), lang: IBE.Config.lang }, 12495 n.options 12496 ); 12497 IBE.Utils.request({ 12498 url: IBE.Config.apiBaseUrl + "/hotels/reservation/?apikey=" + r.apiKey, 12499 beforeSend: function (n) { 12500 n.setRequestHeader("Authorization", f(t)); 12501 n.setRequestHeader("Accept-Language", IBE.Config.lang || "en-US"); 12502 }, 12503 }) 12504 .done(function (t) { 12505 n.clearMessage(); 12506 var r = []; 12507 r.push(t); 12508 i(r); 12509 }) 12510 .fail(function (t) { 12511 var i, r; 12512 n.ready(!0); 12513 n.clearMessage(); 12514 i = "critical"; 12515 (t.status === 400 || t.status === 500) && (i = "error"); 12516 r = { id: t.status, severity: i, text: t.responseJSON.Message }; 12517 n.events.notifySubscribers(r, "error"); 12518 }); 12519 } 12520 function e(t) { 12521 var r = ko.utils.extend( 12522 { apiKey: IBE.Config.apiKey, hotelId: parseInt(IBE.Config.hotelId), lang: IBE.Config.lang }, 12523 n.options 12524 ); 12525 t.checkIn = moment(t.checkIn).format("YYYY-MM-DD"); 12526 t.checkOut = moment(t.checkOut).format("YYYY-MM-DD"); 12527 IBE.Utils.request({ 12528 type: "POST", 12529 url: IBE.Config.apiBaseUrl + "/hotels/makereservationslist/" + r.hotelId + "?apikey=" + r.apiKey, 12530 data: ko.toJSON(t), 12531 headers: { "Content-Type": "application/json" }, 12532 }) 12533 .done(function (t) { 12534 var u, r; 12535 if ((n.clearMessage(), t.error)) { 12536 u = { id: t.statusCode(), severity: "error", text: t.responseJSON.message }; 12537 n.message(u); 12538 n.events.notifySubscribers(u, "error"); 12539 throw u; 12540 } 12541 ((r = !1), 12542 ko.utils.arrayForEach(t, function (i) { 12543 if (t.length === 1) { 12544 if (
12545 IBE.Config.externalPaymentGateway === "AlphaBankRedirect" && 12546 IBE.Config.reservationStatus[i.status] === 2 && 12547 i.redirectPaymentGatewayData !== "undefined" 12548 ) { 12549 IBE.Utils.authenticationHeader(i.customer.email, i.code); 12550 IBE.Utils.createFormAlphaBankRedirect(i, n); 12551 n.ready(!1); 12552 r = !0; 12553 return; 12554 } 12555 if ( 12556 IBE.Config.externalPaymentGateway === "Payout" && 12557 IBE.Config.reservationStatus[i.status] === 2 && 12558 i.redirectPaymentGatewayData !== "undefined" && 12559 i.redirectPaymentGatewayData !== null 12560 ) { 12561 IBE.Utils.authenticationHeader(i.customer.email, i.code); 12562 window.location.href = i.redirectPaymentGatewayData; 12563 n.ready(!1); 12564 r = !0; 12565 return; 12566 } 12567 if ( 12568 IBE.Config.externalPaymentGateway === "Six" && 12569 i.redirectPaymentGatewayData !== null && 12570 i.redirectPaymentGatewayData !== "undefined" 12571 ) { 12572 IBE.Utils.authenticationHeader(i.customer.email, i.code); 12573 window.location.href = i.redirectPaymentGatewayData; 12574 n.ready(!1); 12575 r = !0; 12576 return; 12577 } 12578 if ( 12579 IBE.Config.externalPaymentGateway === "Stripe" && 12580 i.redirectPaymentGatewayData !== null && 12581 i.redirectPaymentGatewayData !== "undefined" 12582 ) { 12583 IBE.Utils.authenticationHeader(i.customer.email, i.code); 12584 IBE.Utils.stripeConfirmPayment(i, n); 12585 n.ready(!1); 12586 r = !0; 12587 return; 12588 } 12589 if (IBE.Config.externalPaymentGateway === "Selfbook") { 12590 if ( 12591 (IBE.Utils.authenticationHeader(i.customer.email, i.code), 12592 i.redirectPaymentGatewayData === "") 12593 ) 12594 return; 12595 IBE.Utils.selfbookRedirect(i, n); 12596 n.ready(!1); 12597 r = !0; 12598 return; 12599 } 12600 } else if ( 12601 IBE.Config.externalPaymentGateway === "Six" && 12602 i.redirectPaymentGatewayData !== null && 12603 i.redirectPaymentGatewayData !== "undefined" && 12604 !r 12605 ) { 12606 IBE.Utils.authenticationHeader(i.customer.email, i.code); 12607 window.location.href = i.redirectPaymentGatewayData; 12608 n.ready(!1); 12609 r = !0; 12610 return; 12611 } 12612 }), 12613 r) || (i(t), (IBE.Config.insightParticipantId = "")); 12614 }) 12615 .fail(function (t) { 12616 var i, r; 12617 n.ready(!0); 12618 n.clearMessage(); 12619 i = "critical"; 12620 (t.status === 400 || t.status === 500) && (i = "error"); 12621 r = { id: t.status, severity: i, text: t.responseJSON.message }; 12622 n.events.notifySubscribers(r, "error"); 12623 }); 12624 } 12625 var n = this, 12626 t; 12627 n.options = {}; 12628 n.events = new ko.subscribable(); 12629 n.reservation = ko.observable(); 12630 n.reservations = ko.observableArray(); 12631 n.bookingProcess = ko.observable(); 12632 n.hotel = ko.observable(); 12633 n.googleMap = ko.observable(); 12634 n.ready = ko.observable(!1); 12635 n.customer = ko.observable(); 12636 n.ecommerce = ko.observable(!1); 12637 n.membership = new IBE.ViewModels.Membership();
12638 ko.utils.extend(n, new IBE.ViewModels.LanguagePartialViewModel(n)); 12639 ko.utils.extend(n, new IBE.ViewModels.CurrenciesPartialViewModel(n)); 12640 ko.utils.extend(n, new IBE.ViewModels.Message()); 12641 ko.utils.extend(n, new IBE.ViewModels.Taxes(n)); 12642 t = []; 12643 n.dispose = function () { 12644 for (var n in t) t[n].dispose(); 12645 }; 12646 n.adWordsSent = ko.observable(!1); 12647 n.trackAdwords = function (t) { 12648 var i, s, h; 12649 if ( 12650 !IBE.Config.debug && 12651 ((i = IBE.Utils.getReservationSetting(n, "adwordsConversionId")), 12652 i && typeof gtag != "undefined" && IBE.Config.userCookieAcceptance === !0) 12653 ) { 12654 var r = IBE.Utils.getReservationSetting(n, "globalAdwordsConversionId"), 12655 u = IBE.Utils.getReservationSetting(n, "globalAdwordsConversionLabel"), 12656 f = IBE.Utils.getReservationSetting(n, "googleConversionTrackingPartnerId"), 12657 e = IBE.Utils.getReservationSetting(n, "googleConversionTrackingHotelAdsId"), 12658 o = IBE.Utils.getReservationSetting(n, "googleConversionTrackingHotelAdsLabel"); 12659 IBE.Config.reservationStatus[t.status()] === 3 12660 ? ((s = IBE.Utils.getReservationSetting(n, "adwordsRequestLabel")), 12661 s !== "" && 12662 ((google_conversion_label = s), 12663 gtag("event", "conversion", { 12664 send_to: "AW-" + i + "/" + google_conversion_label, 12665 value: t.totalCost(), 12666 currency: n.currency(), 12667 transaction_id: t.id, 12668 })), 12669 r && 12670 u && 12671 gtag("event", "conversion", { 12672 send_to: "AW-" + r + "/" + u, 12673 value: t.totalCost(), 12674 currency: n.currency(), 12675 transaction_id: t.id, 12676 }), 12677 f && 12678 gtag("event", "conversion", { 12679 send_to: "HA-" + f, 12680 value: t.totalCost(), 12681 currency: n.currency(), 12682 transaction_id: t.id, 12683 }), 12684 e && 12685 o && 12686 gtag("event", "conversion", { 12687 send_to: "AW-" + e + "/" + o, 12688 value: t.totalCost(), 12689 currency: n.currency(), 12690 transaction_id: t.id, 12691 })) 12692 : IBE.Config.reservationStatus[t.status()] === 1 && 12693 ((h = IBE.Utils.getReservationSetting(n, "adwordsConversionLabel")), 12694 h && 12695 gtag("event", "conversion", { 12696 send_to: "AW-" + i + "/" + h, 12697 value: t.totalCost(), 12698 currency: n.currency(), 12699 transaction_id: t.id, 12700 }), 12701 r && 12702 u && 12703 gtag("event", "conversion", { 12704 send_to: "AW-" + r + "/" + u, 12705 value: t.totalCost(), 12706 currency: n.currency(), 12707 transaction_id: t.id, 12708 }), 12709 f && 12710 gtag("event", "conversion", { 12711 send_to: "HA-" + f, 12712 value: t.totalCost(), 12713 currency: n.currency(), 12714 transaction_id: t.id, 12715 }), 12716 e && 12717 o && 12718 gtag("event", "conversion", { 12719 send_to: "AW-" + e + "/" + o, 12720 value: t.totalCost(), 12721 currency: n.currency(), 12722 transaction_id: t.id, 12723 })); 12724 } 12725 }; 12726 n.trackUserGuest = function (t) { 12727 var u, f, r, i;
12728 IBE.Config.debug || 12729 (((u = IBE.Utils.getReservationSetting(n, "userGuestTrackingId")), 12730 u && typeof u != "undefined" && IBE.Config.userCookieAcceptance === !0) && 12731 ((f = moment(t.checkOut).startOf("day").diff(moment(t.checkIn).startOf("day"), "days")), 12732 (r = 0), 12733 ko.utils.arrayForEach(t.rooms, function (n) { 12734 r = r + n.adults; 12735 }), 12736 (i = 0), 12737 ko.utils.arrayForEach(t.rooms, function (n) { 12738 n.children && typeof n.children != "undefined" && (i = i + n.children); 12739 n.Infants && typeof n.Infants != "undefined" && (i = i + n.Infants); 12740 }), 12741 (window.ugLayer = { 12742 event: "conversion", 12743 conversionData: { 12744 bookingId: t.id, 12745 checkIn: t.checkIn.format("YYYY-MM-DD"), 12746 checkOut: t.checkOut.format("YYYY-MM-DD"), 12747 dateFormat: "yyyy-MM-dd", 12748 roomCount: t.rooms.length, 12749 room: t.rooms[0].name, 12750 nights: f, 12751 price: t.totalCost(), 12752 currency: t.currencyCode, 12753 adults: r, 12754 children: i, 12755 }, 12756 }))); 12757 }; 12758 n.initTriptease = function (n) { 12759 if (!IBE.Config.debug) { 12760 var t = IBE.Config.tripteaseHotelId, 12761 i = IBE.Config.tripteaseClientKey; 12762 t && 12763 i && 12764 IBE.Config.userCookieAcceptance === !0 && 12765 setTimeout(function () { 12766 $("body").append( 12767 '<script defer src="https://static.triptease.io/paperboy/confirm?hotelkey=' + 12768 t + 12769 "&bookingValue=" + 12770 n.totalCost() + 12771 "&bookingCurrency=" + 12772 n.currency() + 12773 "&bookingReference=" + 12774 n.id + 12775 '"></script>' 12776 ); 12777 }, 500); 12778 } 12779 }; 12780 n.trackSojernConversion = function (n) { 12781 IBE.Config.debug || 12782 ((sojernConversionId = IBE.Config.sojernConversionId), 12783 sojernConversionId && 12784 IBE.Config.userCookieAcceptance === !0 && 12785 ($("body").append('<script async src="https://static.sojern.com/sdk/latest/sojern.min.js"></script>'), 12786 (window.sjn = 12787 window.sjn || 12788 function () { 12789 (sjn.q = sjn.q || []).push(arguments); 12790 }), 12791 sjn("initAndFire", "advertiser", sojernConversionId, "conversion", { 12792 context: { vertical: "hotel" }, 12793 params: { 12794 hashedEmailSHA256: "", 12795 confirmationNumber: n.code, 12796 clientCookieId: IBEConfig.sessionId, 12797 propertyID: n.hotelId, 12798 checkInDate: n.checkIn.format("YYYY-MM-DD"), 12799 checkOutDate: n.checkOut.format("YYYY-MM-DD"), 12800 city: "", 12801 state: "", 12802 property: n.hotelName, 12803 currency: n.currencyCode, 12804 numberOfRooms: n.rooms.length, 12805 price: n.totalCost(), 12806 numberOfTravelers: n.guests().length, 12807 }, 12808 }))); 12809 }; 12810 n.googleAds = function (t) { 12811 if (!IBE.Config.debug) { 12812 var i = document.createElement("img"); 12813 i.height = 1; 12814 i.width = 1; 12815 i.border = 0; 12816 i.className = "google-ads-image"; 12817 i.src = 12818 "https://www.googletraveladservices.com/travel/clk/pagead/conversion/2097807373/?label=HPA&guid=ON&script=0&ord=" + 12819 t.id + 12820 "&data=hct_partner_hotel_id%3D" + 12821 n.hotel().hotelId + 12822 "%3Bhct_base_price%3D" + 12823 ko.unwrap(t.totalCost) + 12824 "%3Bhct_total_price%3D" + 12825 ko.unwrap(t.totalCost) + 12826 "%3Bhct_currency_code%3D" + 12827 n.currency() + 12828 "%3Bhct_checkin_date%3D" + 12829 t.checkIn.format("YYYY-MM-DD") + 12830 "%3Bhct_checkout_date%3D" + 12831 t.checkOut.format("YYYY-MM-DD") + 12832 "%3Bhct_length_of_stay%3D" + 12833 moment(t.checkOut.format("YYYY-MM-DD")).diff(moment(t.checkIn.format("YYYY-MM-DD")), "days") + 12834 "%3Bhct_date_format%3D%Y-%m-%d%3Bhct_booking_xref%3D"
12834+ 12835 t.code + 12836 "%3Bhct_ver%3D1.0.i"; 12837 $("body").append(i); 12838 } 12839 }; 12840 n.trackFacebookConversion = function (t) { 12841 if (!IBE.Config.debug) { 12842 var i = IBE.Utils.getReservationSetting(n, "facebook_TrackId"); 12843 i && 12844 typeof fbq != "undefined" && 12845 IBE.Config.userCookieAcceptance === !0 && 12846 fbq("track", "Purchase", { 12847 content_type: "hotel", 12848 content_ids: t.hotelId, 12849 value: t.totalCost(), 12850 currency: n.currency(), 12851 }); 12852 } 12853 }; 12854 n.trackTrivagoConversion = function (t) { 12855 var i, f, r, u; 12856 if ( 12857 !IBE.Config.debug && 12858 ((i = Cache.read("ref", "localstorage")), 12859 (i === "Trivago" || i === "trivago" || (i && i.name && (i.name === "Trivago" || i.name === "trivago"))) && 12860 IBE.Config.userCookieAcceptance === !0) 12861 ) { 12862 if (((f = IBE.Utils.getReservationSetting(n, "trivagoTrackingId")), typeof f == "undefined")) return; 12863 if ( 12864 ((r = IBE.Utils.getReservationSetting(n, "trivagoConversionKey")), 12865 (u = IBE.Utils.getReservationSetting(n, "trivagoSupplierId")), 12866 i && i.params && i.params.trv_reference && u && r) 12867 ) { 12868 let n = i.params.trv_reference, 12869 f = { 12870 trv_reference: n, 12871 advertiser_id: u, 12872 hotel: t.hotelId, 12873 arrival: t.checkIn.format("YYYY-MM-DD"), 12874 departure: t.checkOut.format("YYYY-MM-DD"), 12875 volume: t.totalCost(), 12876 booking_id: t.id, 12877 currency: t.currencyCode, 12878 number_of_rooms: t.rooms.length, 12879 locale: IBE.Config.lang.split("-")[1], 12880 date_format: "Y-m-d", 12881 booking_date: moment.utc(t.created).format("YYYYMMDDHHmmss"), 12882 booking_date_format: "YmdHis", 12883 }; 12884 IBE.Utils.request({ 12885 type: "POST", 12886 url: "https://secde.trivago.com/tracking/booking", 12887 data: JSON.stringify(f), 12888 dataType: "json", 12889 headers: { "Content-Type": "application/json", "X-Trv-Ana-Key": r }, 12890 }) 12891 .done(function () {}) 12892 .fail(function () {}); 12893 } 12894 } 12895 }; 12896 n.markTrackedReservation = function (t) { 12897 IBE.Utils.request({ 12898 url: IBE.Config.apiBaseUrl + "/hotels/reservation/markTrackedReservation/?apikey=" + IBE.Config.apiKey, 12899 beforeSend: function (i) { 12900 n.username() !== "" && 12901 n.password() !== "" && 12902 i.setRequestHeader("Authorization", IBE.Utils.authenticationCookie(t.customer.email, t.code)); 12903 }, 12904 }).done(function () {}); 12905 }; 12906 n.trackEcommerce = function (t) { 12907 if ( 12908 !IBE.Config.debug && 12909 !t.isTracked && 12910 n.ecommerce() && 12911 typeof gtag != "undefined" && 12912 IBE.Config.reservationStatus[t.status()] === 1 12913 ) { 12914 var f = IBE.Utils.getReservationSetting(n, "googleAnalyticsKey"), 12915 e = IBE.Utils.getReservationSetting(n, "googleAnalyticsKeyGA4"), 12916 s = 1, 12917 i = [], 12918 o = []; 12919 e && 12920 (ko.utils.arrayForEach(t.rooms, function (t) { 12921 var i = ko.unwrap(t); 12922 o.push({ 12923 item_id: "" + i.id, 12924 item_name: i.name + " " + i.board.name, 12925 item_category: "Rooms", 12926 currency: n.currency(), 12927 quantity: "1", 12928 price: i.totalCost, 12929 }); 12930 s += 1; 12931 }), 12932 ko.utils.arrayForEach(t.supplements, function (t) { 12933 var i = ko.unwrap(t); 12934 o.push({ 12935 item_id: "" + i.supplementId(), 12936 item_name: i.name, 12937 item_category: "Supplements", 12938 currency: n.currency(), 12939 quantity: i.quantity(), 12940 price: i.unitCost(), 12941 }); 12942 })); 12943 f && 12944 (ko.utils.arrayForEach(t.rooms, function (n) { 12945 var r = ko.unwrap(n); 12946 i.push({ 12947 id: "" + t.id, 12948 name: r.name + " " + r.board.name, 12949 category: "Rooms", 12950 quantity: "1", 12951 price: r.totalCost, 12952 }); 12953 s += 1; 12954 }), 12955 ko.utils.arrayForEach(t.supplements, function (n) { 12956 var r = ko.unwrap(n); 12957 i.push({ 12958 id: "" + t.id, 12959 name: r.name, 12960 category: "Supplements", 12961 quantity: r.quantity(), 12962 price: r.unitCost(), 12963 }); 12964 })); 12965 var r = IBE.Utils.getReservationSetting(n, "adwordsConversionId"), 12966 u = "", 12967 h = IBE.Utils.getReservationSetting(n, "globalAdwordsConversionId"), 12968 c = IBE.Utils.getReservationSetting(n, "globalAdwordsConversionLabel"), 12969 l = IBE.Utils.getReservationSetting(n, "googleConversionTrackingPartnerId"), 12970 a = IBE.Utils.getReservationSetting(n, "googleConversionTrackingHotelAdsId"), 12971 v = IBE.Utils.getReservationSetting(n, "googleConversionTrackingHotelAdsLabel");
12972 (r && typeof gtag != "undefined" && IBE.Config.userCookieAcceptance === !0) || (r = ""); 12973 IBE.Config.reservationStatus[t.status()] === 3 12974 ? (u = IBE.Utils.getReservationSetting(n, "adwordsRequestLabel")) 12975 : IBE.Config.reservationStatus[t.status()] === 1 && 12976 (u = IBE.Utils.getReservationSetting(n, "adwordsConversionLabel")); 12977 r && 12978 u && 12979 gtag("event", "purchase", { 12980 send_to: "AW-" + r + "/" + u, 12981 transaction_id: t.id, 12982 affiliation: t.hotelName, 12983 value: ko.unwrap(t.totalCost), 12984 currency: n.currency(), 12985 items: i, 12986 checkout_step: 4, 12987 id: t.hotelId, 12988 start_date: t.checkIn.format("YYYY-MM-DD"), 12989 end_date: t.checkOut.format("YYYY-MM-DD"), 12990 }); 12991 h && 12992 c && 12993 gtag("event", "purchase", { 12994 send_to: "AW-" + h + "/" + c, 12995 transaction_id: t.id, 12996 affiliation: t.hotelName, 12997 value: ko.unwrap(t.totalCost), 12998 currency: n.currency(), 12999 items: i, 13000 checkout_step: 4, 13001 id: t.hotelId, 13002 start_date: t.checkIn.format("YYYY-MM-DD"), 13003 end_date: t.checkOut.format("YYYY-MM-DD"), 13004 }); 13005 l && 13006 gtag("event", "purchase", { 13007 send_to: "HA-" + l, 13008 transaction_id: t.id, 13009 affiliation: t.hotelName, 13010 value: ko.unwrap(t.totalCost), 13011 currency: n.currency(), 13012 items: i, 13013 checkout_step: 4, 13014 id: t.hotelId, 13015 start_date: t.checkIn.format("YYYY-MM-DD"), 13016 end_date: t.checkOut.format("YYYY-MM-DD"), 13017 }); 13018 a && 13019 v && 13020 gtag("event", "purchase", { 13021 send_to: "AW-" + a + "/" + v, 13022 transaction_id: t.id, 13023 affiliation: t.hotelName, 13024 value: ko.unwrap(t.totalCost), 13025 currency: n.currency(), 13026 items: i, 13027 checkout_step: 4, 13028 id: t.hotelId, 13029 start_date: t.checkIn.format("YYYY-MM-DD"), 13030 end_date: t.checkOut.format("YYYY-MM-DD"), 13031 }); 13032 f && 13033 gtag("event", "purchase", { 13034 send_to: f, 13035 transaction_id: t.id, 13036 affiliation: t.hotelName, 13037 value: ko.unwrap(t.totalCost), 13038 currency: n.currency(), 13039 items: i, 13040 checkout_step: 4, 13041 id: t.hotelId, 13042 start_date: t.checkIn.format("YYYY-MM-DD"), 13043 end_date: t.checkOut.format("YYYY-MM-DD"), 13044 }); 13045 e && 13046 gtag("event", "purchase", { 13047 send_to: e, 13048 transaction_id: t.id, 13049 affiliation: t.hotelName, 13050 value: ko.unwrap(t.totalCost), 13051 currency: n.currency(), 13052 items: o, 13053 checkout_step: 4, 13054 id: t.hotelId, 13055 start_date: t.checkIn.format("YYYY-MM-DD"), 13056 end_date: t.checkOut.format("YYYY-MM-DD"), 13057 }); 13058 n.markTrackedReservation(t); 13059 } 13060 }; 13061 n.trackBingCode = function (n) { 13062 if (IBE.Config.debug) { 13063 console.log("IBE: In debug mode bing is disabled"); 13064 return; 13065 } 13066 window.uetq && 13067 IBE.Config.userCookieAcceptance === !0 && 13068 window.uetq.push({ ec: "Booking", ea: ko.unwrap(n.status), el: "", ev: "" + ko.unwrap(n.totalCost) }); 13069 }; 13070 n.updateReservation = function (t) { 13071 var i = { id: t.id, newStatus: t.status(), supplements: u(), creditCard: {} }; 13072 n.clearMessage(); 13073 IBE.Utils.request({ 13074 type: "POST", 13075 data: ko.toJSON(i), 13076 url: IBE.Config.apiBaseUrl + "/hotels/reservation/update/?apikey=" + IBE.Config.apiKey, 13077 beforeSend: function (n) { 13078 n.setRequestHeader("Authorization", IBE.Utils.authenticationCookie(t.customer.email(), t.code)); 13079 }, 13080 }) 13081 .done(function () {}) 13082 .fail(function (t) { 13083 var i = { id: t.status, severity: "critical", text: t.statusText + ": " + t.responseText }; 13084 n.message(i); 13085 }); 13086 }; 13087 n.init = function (t, i) { 13088 n.options = ko.utils.extend( 13089 { 13090 trackAdwords: !0, 13091 trackAdwordsAsync: !0, 13092 appendAdwordsImage: !0, 13093 reservationSubmitted: !1, 13094 trackEcommerceScripts: !0, 13095 apiKey: IBE.Config.apiKey, 13096 hotelId: parseInt(IBE.Config.hotelId), 13097 lang: IBE.Config.lang, 13098 }, 13099 i 13100 );
13101 $.when(n.languagePartialInit(n.options), n.currenciesPartialInit()).then(function () { 13102 var i = function (n) { 13103 n && (r(n), typeof t.username != "undefined" && typeof t.password != "undefined" ? f(t) : e(t)); 13104 }; 13105 $.when(IBE.Utils.loadHotelInfo(i, n.options)).then(i); 13106 }); 13107 }; 13108}; 13109IBE.ViewModels.SupplementPartialViewModel = function (n, t) { 13110 var i = this; 13111 i.supplements = ko.observableArray([]); 13112 i.selectedSupplements = ko.computed({ 13113 read: function () { 13114 var n = []; 13115 return ( 13116 ko.utils.arrayForEach(i.supplements(), function (t) { 13117 ko.utils.arrayForEach(t.supplementResults(), function (t) { 13118 var i = !1; 13119 ko.utils.arrayForEach(t.prices(), function (n) { 13120 if (n.quantity() > 0) { 13121 i = !0; 13122 return; 13123 } 13124 }); 13125 i && n.push(t); 13126 }); 13127 }), 13128 n 13129 ); 13130 }, 13131 deferEvaluation: !0, 13132 }); 13133 i.bookingSupplements = ko.computed({ 13134 read: function () { 13135 var n = []; 13136 return ( 13137 ko.utils.arrayForEach(i.supplements(), function (t) { 13138 ko.utils.arrayForEach(t.supplementResults(), function (t) { 13139 ko.utils.arrayForEach(t.prices(), function (i) { 13140 if (i.quantity() > 0) { 13141 var r = new IBE.Models.BookingSupplement(); 13142 r.roomIndex = ko.utils.unwrapObservable(t.roomIndex); 13143 r.supplementId = ko.utils.unwrapObservable(t.supplementId); 13144 r.quantity = ko.utils.unwrapObservable(i.quantity); 13145 r.guestType = i.guestType; 13146 r.categoryName = t.category; 13147 n.push(r); 13148 } 13149 }); 13150 }); 13151 }), 13152 n 13153 ); 13154 }, 13155 deferEvaluation: !0, 13156 }); 13157 i.showSupplement = function (n) { 13158 var r = !1; 13159 return ( 13160 ko.utils.arrayForEach(i.supplements(), function (i) { 13161 var u = ko.utils.arrayFirst(i.supplementResults(), function (t) { 13162 return t.supplementId() === n; 13163 }); 13164 if (u != null) { 13165 if (u.isSurcharge) return !1; 13166 u.isVisible && 13167 ko.utils.arrayForEach(u.rateplans(), function (n) { 13168 n.ratePlanId !== t || 13169 r || 13170 ko.utils.arrayForEach(n.prices(), function (n) { 13171 if (n.price >= 0) { 13172 r = !0; 13173 return; 13174 } 13175 }); 13176 }); 13177 } 13178 }), 13179 r 13180 ); 13181 }; 13182 i.showSupplementCategory = function (n) { 13183 var i = !1; 13184 return ( 13185 ko.utils.arrayForEach(n.supplementResults(), function (n) { 13186 !n.isVisible || 13187 i || 13188 n.isSurcharge || 13189 ko.utils.arrayForEach(n.rateplans(), function (n) { 13190 n.ratePlanId === t && 13191 ko.utils.arrayForEach(n.prices(), function (n) { 13192 if (n.price >= 0) { 13193 i = !0; 13194 return; 13195 } 13196 }); 13197 }); 13198 }), 13199 i 13200 ); 13201 }; 13202 i.showSupplements = ko.computed({ 13203 read: function () { 13204 var n = !1; 13205 return ( 13206 ko.utils.arrayForEach(i.supplements(), function (i) { 13207 ko.utils.arrayForEach(i.supplementResults(), function (i) { 13208 !i.isVisible || 13209 n || 13210 i.isSurcharge || 13211 ko.utils.arrayForEach(i.rateplans(), function (i) { 13212 i.ratePlanId === t && 13213 ko.utils.arrayForEach(i.prices(), function (t) { 13214 if (t.price >= 0) { 13215 n = !0; 13216 return; 13217 } 13218 }); 13219 }); 13220 }); 13221 }), 13222 n 13223 ); 13224 }, 13225 deferEvaluation: !0, 13226 }); 13227 typeof n != "undefined" && 13228 n !== null && 13229 (t == undefined && (t = 0), 13230 n.length > 0 13231 ? (ko.utils.arrayForEach(n, function (n) { 13232 var r = { categoryName: n.categoryName, supplementResults: ko.observable([]) }; 13233 ko.utils.arrayForEach(n.supplementResults(), function (n) { 13234 var i = ko.utils.arrayFirst(n.rateplans(), function (n) { 13235 return n.ratePlanId === t; 13236 }); 13237 i !== null && (n.setRatePlanId(t), r.supplementResults().push(n)); 13238 }); 13239 i.supplements.push(r); 13240 }), 13241 i.supplements.valueHasMutated()) 13242 : $.each(n, function (n, r) { 13243 var u = { categoryName: r.category, supplementResults: ko.observable([]) };
13244 ko.utils.arrayForEach(r.supplementResults, function (n) { 13245 var r = ko.utils.arrayFirst(n.ratePlans, function (n) { 13246 return n.ratePlanId === t; 13247 }), 13248 i; 13249 r !== null && 13250 ((i = new IBE.Models.Supplement(n)), i.setRatePlanId(t), u.supplementResults().push(i)); 13251 }); 13252 i.supplements.push(u); 13253 })); 13254}; 13255IBE.ViewModels.Taxes = function (n) { 13256 n.taxes = ko.observableArray([]); 13257 ko.utils.extend(n, new IBE.ViewModels.CurrenciesPartialViewModel(n)); 13258 n.excludedTaxes = ko.computed({ 13259 read: function () { 13260 return n.taxes().filter(function (n) { 13261 return n.payable === "CheckIn" || n.payable === "CheckOut"; 13262 }); 13263 }, 13264 deferEvaluation: !0, 13265 }); 13266 n.excludedTaxesCheckIn = ko.computed({ 13267 read: function () { 13268 return n 13269 .excludedTaxes() 13270 .filter(function (n) { 13271 return n.payable === "CheckIn"; 13272 }) 13273 .map(function (n) { 13274 return (n.category = n.category.charAt(0).toLowerCase() + n.category.slice(1)), n; 13275 }); 13276 }, 13277 deferEvaluation: !0, 13278 }); 13279 n.excludedTaxesCheckOut = ko.computed({ 13280 read: function () { 13281 return n 13282 .excludedTaxes() 13283 .filter(function (n) { 13284 return n.payable === "CheckOut"; 13285 }) 13286 .map(function (n) { 13287 return (n.category = n.category.charAt(0).toLowerCase() + n.category.slice(1)), n; 13288 }); 13289 }, 13290 deferEvaluation: !0, 13291 }); 13292 n.totalExcludedTaxes = ko.computed({ 13293 read: function () { 13294 return n 13295 .excludedTaxes() 13296 .map(function (n) { 13297 return n.amount; 13298 }) 13299 .reduce(function (n, t) { 13300 return n + t; 13301 }, 0); 13302 }, 13303 deferEvaluation: !0, 13304 }); 13305 n.excludedTaxesText = ko.computed({ 13306 read: function () { 13307 var t, i, f, r, o, u, e; 13308 if (!n.excludedTaxes().length) return ""; 13309 if ( 13310 ((t = []), 13311 (i = []), 13312 options || 13313 (options = 13314 n.currency() === "CZK" 13315 ? { precision: 2, symbol: n.currency(), thousand: " ", decimal: ",", format: "%v %s" } 13316 : { precision: 2, symbol: n.currency(), thousand: ",", decimal: ".", format: "%v %s" }), 13317 typeof n.lang != "undefined" && n.lang !== "") 13318 ) { 13319 f = Intl.NumberFormat(n.lang(), { style: "currency", currency: n.currency(), currencyDisplay: "code" }); 13320 f.formatToParts 13321 ? ((r = f.formatToParts(1.1)), 13322 typeof r.find((n) => n.type === "decimal") != "undefined" && 13323 r.find((n) => n.type === "decimal") !== null && 13324 (options.decimal = r.find((n) => n.type === "decimal").value)) 13325 : (options.decimal = (1.1).toLocaleString(n.lang()).replace(/1/g, "")); 13326 switch (options.decimal) { 13327 case ".": 13328 options.thousand = ","; 13329 break; 13330 case ",": 13331 options.thousand = "."; 13332 break; 13333 default: 13334 options.thousand = ","; 13335 } 13336 n.currency() === "CZK" && ((options.thousand = " "), (options.decimal = ",")); 13337 o = ko.utils.arrayFirst(n.currencies().rates, function (t) { 13338 return t.code == n.currency(); 13339 }); 13340 switch (o.positivePattern) { 13341 case "SymbolAlignLeft": 13342 options.format = "%s%v"; 13343 break; 13344 case "SymbolAlignRight": 13345 options.format = "%v%s"; 13346 break; 13347 case "SymbolAlignLeftWithSpace": 13348 options.format = "%s %v"; 13349 break; 13350 case "SymbolAlignRightWithSpace": 13351 options.format = "%v %s"; 13352 break; 13353 default: 13354 options.format = "%s%v"; 13355 } 13356 } 13357 return (
13358 n.excludedTaxes().forEach(function (r) { 13359 var u = r.category.charAt(0).toLowerCase() + r.category.slice(1); 13360 r.payable === "CheckIn" 13361 ? t.push( 13362 "{0} {1}".format(n.getRateText(r.amount, n.currency(), options), IBE.Utils.translate(u)) 13363 ) 13364 : i.push( 13365 "{0} {1}".format(n.getRateText(r.amount, n.currency(), options), IBE.Utils.translate(u)) 13366 ); 13367 }), 13368 (u = []), 13369 (e = " {0} ".format(IBE.Utils.translate("and"))), 13370 t.length && 13371 u.push( 13372 "<li>{0}</li>".format( 13373 IBE.Utils.translate("excludedTaxText").format(t.join(e), IBE.Utils.translate("checkIn")) 13374 ) 13375 ), 13376 i.length && 13377 u.push( 13378 "<li>{0}</li>".format( 13379 IBE.Utils.translate("excludedTaxText").format(i.join(e), IBE.Utils.translate("checkOut")) 13380 ) 13381 ), 13382 u.join("") 13383 ); 13384 }, 13385 deferEvaluation: !0, 13386 }); 13387};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.