1/** 2 * Keresesekhez, foglalasokhoz datum kontroll class 3 */ 4function BT_date(ttol,tig,fst,fen,chghandler) { 5 this.min = ttol; 6 this.max = tig; 7 this.ma = null; 8 this.tol = fst; 9 this.ig = fen; 10 if (typeof chghandler==='undefined') { 11 chghandler = null; 12 } 13 this.onchange = chghandler; 14 var dtpicklan = BT_page_lang; 15 if (BT_page_lang==='dk') { 16 dtpicklan = 'da'; 17 } 18 else if (BT_page_lang==='cz') { 19 dtpicklan = 'cs'; 20 } 21 else if (BT_page_lang==='en') { 22 dtpicklan = 'en-gb'; 23 } 24 var cs = $('#'+this.tol).val(); 25 var ce = $('#'+this.ig).val(); 26 if (cs<this.min || cs>this.max) { 27 cs = this.min; 28 $('#'+this.tol).val(cs); 29 ce = moment(cs).add(BT_default_stay_days,'days').format('YYYY-MM-DD'); 30 $('#'+this.ig).val(ce); 31 } 32 //console.log(cs,ce,this.min,this.max); 33 $('#'+this.tol).datetimepicker({ 34 locale:dtpicklan, 35 format:'YYYY-MM-DD', 36 minDate:this.min, 37 maxDate:this.max, 38 useCurrent:false, 39 viewDate:cs, 40 defaultDate:cs 41 }); 42 $('#'+this.ig).datetimepicker({ 43 locale:dtpicklan, 44 format:'YYYY-MM-DD', 45 minDate:this.min, 46 maxDate:this.max, 47 useCurrent:false, 48 viewDate:ce, 49 defaultDate:ce 50 }); 51 if (cs==='null' || cs==='NULL' || cs==='' || cs==='0000-00-00') { 52 this.ma = moment().format('YYYY-MM-DD'); 53 var bts = (this.ma>this.min) ? this.ma : this.min; 54 $('#'+this.tol).data("DateTimePicker").date(bts); 55 cs = bts; 56 } 57 if (ce==='null' || ce==='NULL' || ce==='' || ce==='0000-00-00') { 58 $('#'+this.ig).data("DateTimePicker").date(moment(cs).add(BT_default_stay_days,'days')); 59 } 60 //console.log($('#'+this.tol).data("DateTimePicker").date(),$('#'+this.ig).data("DateTimePicker").date()); 61 $('#'+this.tol).on("dp.change", function (e) { 62 //console.log('changed!'); 63 var cur = $('#'+this.ig).data("DateTimePicker").date().format('YYYY-MM-DD'); 64 var str = moment(e.date).format('YYYY-MM-DD'); 65 $('#'+this.ig).data("DateTimePicker").minDate(moment(str)); 66 if (str>cur) { 67 $('#'+this.ig).data("DateTimePicker").date(moment(e.date).add(BT_default_stay_days,'days')); 68 } 69 if (typeof this.onchange==='function') { 70 this.onchange.apply(this,['from',str]); 71 } 72 }.bind(this)); 73 $('#'+this.ig).on("dp.change", function (e) { 74 //console.log('changed!'); 75 var str = moment(e.date).format('YYYY-MM-DD'); 76 if (typeof this.onchange==='function') { 77 this.onchange.apply(this,['till',str]); 78 } 79 }.bind(this)); 80} 81BT_date.prototype.change = function(min,max) { 82 var curst = $('#'+this.tol).data("DateTimePicker").date().format('YYYY-MM-DD'); 83 var curen = $('#'+this.ig).data("DateTimePicker").date().format('YYYY-MM-DD'); 84 if (curst<min) { 85 curst = min; 86 } 87 if (curen>max) { 88 curen = max; 89 } 90 if (curen===curst || curen<curst) { 91 curen = moment(curst).add(BT_default_stay_days,'days').format('YYYY-MM-DD'); 92 if (curen>max) { 93 curen = max; 94 } 95 } 96 this.min = min; 97 this.max = max; 98 $('#'+this.ig).data("DateTimePicker").date(curen); 99 $('#'+this.tol).data("DateTimePicker").date(curst); 100 $('#'+this.ig).data("DateTimePicker").minDate(min).maxDate(max); 101 $('#'+this.tol).data("DateTimePicker").minDate(min).maxDate(max); 102}; 103 104/** 105 * Fooldali gyorskereso kezeloje 106 */ 107var BT_quicksearch = { 108 dc: null, 109 init: function() { 110 if ($('#quicksearch').length>0) { 111 $('#QS_SZHELY').change(BT_quicksearch.sitename_change); 112 BT_quicksearch.dc = new BT_date(BT_season_start,BT_season_end,'QS_VERK','QS_VTAV'); 113 BT_quicksearch.sitename_change(); 114 $('#quicksearch_form').submit((ev) => { 115 if (BT_isDEdge && $('#QS_SZHELY').val() == '') ev.preventDefault(); 116 }); 117 } 118 }, 119 sitename_change: function() { 120 var cv = $('#QS_SZHELY').val(); 121 var csub = $('#QS_SZTIP').val(); 122 if (cv==='') { 123 $('#QS_SZTIP option').each(function() { 124 $(this).prop('disabled',false).show(); 125 }); 126 BT_quicksearch.dc.change(BT_season_start,BT_season_end); 127 } 128 else { 129 var tipusok = BT_kempingadatok.egysadat[cv]['tipusok']; 130 var szolgok = BT_kempingadatok.egysadat[cv]['szolg']; 131 $('#QS_SZTIP option').each(function() { 132 if ($(this).attr('value')==='' || tipusok.indexOf($(this).attr('value'))>-1) { 133 $(this).prop('disabled',false).show(); 134 } else { 135 $(this).prop('disabled',true).hide(); 136 if ($(this).attr('value')===csub) { 137 csub = ''; 138 $('#QS_SZTIP').val(''); 139 } 140 } 141 }); 142 BT_quicksearch.dc.change(BT_kempingadatok.egysadat[cv]['nyit'],BT_kempingadatok.egysadat[cv]['zar']); 143 } 144 } 145}; 146 147/** 148 * Osszetett kereses kezeloje 149 */ 150var BT_advsearch = { 151 dc: null, 152 init: function() { 153 if ($('#advsearch').length>0) { 154 $('#ADV_SZTIP').change(BT_advsearch.maintype_change); 155 $('#ADV_SZHELY').change(BT_advsearch.sitename_change); 156 BT_advsearch.dc = new BT_date(BT_season_start,BT_season_end,'ADV_VERK','ADV_VTAV'); 157 BT_advsearch.sitename_change(); 158 BT_advsearch.maintype_change(); 159 // $(window).resize(BT_advsearch.winresize); 160 // BT_advsearch.winresize(); 161 $('#advsearch_form').submit((ev) => { 162 if (BT_isDEdge && $('#ADV_SZHELY').val() == '') ev.preventDefault(); 163 }); 164 } 165 }, 166 sitename_change: function() { 167 var cv = $('#ADV_SZHELY').val(); 168 var csub = $('#ADV_SZTIP').val(); 169 if (cv==='') { 170 $('#ADV_SZTIP option').each(function() { 171 $(this).prop('disabled',false).show(); 172 }); 173 $('#advsearch .checkbox-circle').each(function() { 174 $(this).data('must-hide','0'); 175 $(this).show(); 176 }); 177 BT_advsearch.dc.change(BT_season_start,BT_season_end); 178 } 179 else { 180 var tipusok = BT_kempingadatok.egysadat[cv]['tipusok']; 181 var szolgok = BT_kempingadatok.egysadat[cv]['szolg']; 182 $('#ADV_SZTIP option').each(function() { 183 if ($(this).attr('value')==='' || tipusok.indexOf($(this).attr('value'))>-1) { 184 $(this).prop('disabled',false).show(); 185 } else { 186 $(this).prop('disabled',true).hide(); 187 if ($(this).attr('value')===csub) { 188 csub = ''; 189 $('#ADV_SZTIP').val(''); 190 } 191 } 192 }); 193 $('#advsearch .checkbox-circle').each(function() { 194 var kod = $(this).data('srvkod'); 195 if (typeof kod!=='undefined') { 196 if (szolgok.indexOf(kod)===-1) { 197 $(this).data('must-hide','1'); 198 $(this).hide();
199 $(this).find('input').prop('checked',false); 200 } else { 201 $(this).data('must-hide','0'); 202 $(this).show(); 203 } 204 } 205 }); 206 BT_advsearch.dc.change(BT_kempingadatok.egysadat[cv]['nyit'],BT_kempingadatok.egysadat[cv]['zar']); 207 } 208 $('#advsearch .bt-servfilter-berelheto').each(function() { 209 $(this).find('input').prop('checked',false); 210 }); 211 $('#advsearch .bt-servfilter-kemping').each(function() { 212 $(this).find('input').prop('checked',false); 213 }); 214 }, 215 maintype_change: function() { 216 var cv = $('#ADV_SZTIP').val(); 217 if (cv==='') { 218 $('#advsearch .bt-servfilter-kemping').each(function() { 219 if ($(this).data('must-hide')!=='1') { 220 $(this).show(); 221 } 222 }); 223 $('#advsearch .bt-servfilter-berelheto').each(function() { 224 if ($(this).data('must-hide')!=='1') { 225 $(this).show(); 226 } 227 }); 228 } 229 else if (['kempinghely','parcella','komfortparc'].indexOf(cv)>-1) { 230 $('#advsearch .bt-servfilter-kemping').each(function() { 231 if ($(this).data('must-hide')!=='1') { 232 $(this).show(); 233 } 234 }); 235 $('#advsearch .bt-servfilter-berelheto').each(function() { 236 $(this).hide(); 237 $(this).find('input').prop('checked',false); 238 }); 239 } 240 else { 241 $('#advsearch .bt-servfilter-kemping').each(function() { 242 $(this).hide(); 243 $(this).find('input').prop('checked',false); 244 }); 245 $('#advsearch .bt-servfilter-berelheto').each(function() { 246 if ($(this).data('must-hide')!=='1') { 247 $(this).show(); 248 } 249 }); 250 } 251 }, 252 winresize: function() { 253 if (Modernizr.mq('(max-width: 991px)')) { 254 $('#advsearch_internals').hide(); 255 $('#advsearch_toggle').addClass('pointer').off('click').on('click',function() { 256 $('#advsearch_internals').slideToggle(); 257 }); 258 $('#advsearch_toggle_caret').show(); 259 } else { 260 $('#advsearch_internals').show(); 261 $('#advsearch_toggle').removeClass('pointer').off('click'); 262 $('#advsearch_toggle_caret').hide(); 263 } 264 } 265}; 266 267/** 268 * Lastminute kereses kezeloje 269 */ 270var BT_lmsearch = { 271 dc: null, 272 init: function() { 273 if ($('#lmsearch').length>0) { 274 $('#ADV_SZHELY').change(BT_lmsearch.sitename_change); 275 BT_lmsearch.sitename_change(); 276 $(window).resize(BT_lmsearch.winresize); 277 BT_lmsearch.winresize(); 278 } 279 }, 280 sitename_change: function() { 281 var cv = $('#ADV_SZHELY').val(); 282 var csub = $('#ADV_SZTIP').val(); 283 if (cv==='') { 284 $('#ADV_SZTIP option').each(function() { 285 $(this).prop('disabled',false).show(); 286 }); 287 } 288 else { 289 var tipusok = BT_kempingadatok.egysadat[cv]['tipusok']; 290 $('#ADV_SZTIP option').each(function() { 291 if ($(this).attr('value')==='' || tipusok.indexOf($(this).attr('value'))>-1) { 292 $(this).prop('disabled',false).show(); 293 } else { 294 $(this).prop('disabled',true).hide(); 295 if ($(this).attr('value')===csub) { 296 csub = ''; 297 $('#ADV_SZTIP').val(''); 298 } 299 } 300 }); 301 } 302 }, 303 winresize: function() { 304 if (Modernizr.mq('(max-width: 991px)')) { 305 $('#lmsearch_internals').hide(); 306 $('#lmsearch_toggle').addClass('pointer').off('click').on('click',function() { 307 $('#lmsearch_internals').slideToggle(); 308 }); 309 $('#lmsearch_toggle_caret').show(); 310 } else { 311 $('#lmsearch_internals').show(); 312 $('#lmsearch_toggle').removeClass('pointer').off('click'); 313 $('#lmsearch_toggle_caret').hide(); 314 } 315 } 316}; 317 318/** 319 * Fooldali boxok sorbarendezo cucca 320 */ 321var BT_cbd = { 322 init: function() { 323 if ($('#cimlapboxok').length>0 && BT_isadmin===true) { 324 $('.fooldbox').each(function() { 325 var box = $(this); 326 var boxelm = box.get(0); 327 box.attr('draggable','true'); 328 box.on('dragstart',function(ev) { 329 var dt = ev.originalEvent.dataTransfer; 330 dt.setData("text/plain",$(ev.delegateTarget).attr('id')); 331 dt.effectAllowed = "move"; 332 var img = new Image(); 333 img.src = $(ev.delegateTarget).find('img').attr('src'); 334 img.width = '200'; 335 dt.setDragImage(img,10,10); 336 }); 337 boxelm.addEventListener('dragenter',function(ev) { 338 ev.preventDefault(); 339 $(ev.target).closest('.fooldbox').addClass('redbord'); 340 ev.dataTransfer.dropEffect = 'move'; 341 }); 342 boxelm.addEventListener('dragleave',function(ev) { 343 ev.preventDefault(); 344 $(ev.target).closest('.fooldbox').removeClass('redbord'); 345 }); 346 boxelm.addEventListener('dragover',function(ev) { 347 ev.preventDefault(); 348 ev.dataTransfer.dropEffect = 'move'; 349 }); 350 boxelm.addEventListener('drop',function(ev) { 351 ev.preventDefault(); 352 var ida = ev.dataTransfer.getData("text/plain"); 353 if (ida!=='' && ida.match(/^cimlapbox[0-9]+$/)!==null) { 354 $(ev.target).closest('.fooldbox').removeClass('redbord'); 355 var topbox = $(ev.target).closest('.fooldbox'); 356 if (topbox.attr('id')!==ida) { 357 topbox.before($('#'+ida)); 358 setTimeout(function() { 359 var sorrend = []; 360 $('#cimlapboxok .fooldbox').each(function() { 361 sorrend.push(this.id.substr(9)); 362 }); 363 $.ajax({ 364 data:{subsystem:'admin_boxsorrend',lang:BT_page_lang,sorrend:sorrend}, 365 method:'POST', 366 url:'/ajax.php', 367 success:function(d) { 368 WG6_forensics.displaySomething('boxorder save success'); 369 WG6_forensics.displaySomething(d); 370 }, 371 error: function(a,b,c) { 372 WG6_forensics.displaySomething('boxorder save failed'); 373 WG6_forensics.displaySomething(b); 374 WG6_forensics.displaySomething(c); 375 } 376 }); 377 WG6_forensics.displaySomething(sorrend); 378 }); 379 } 380 } 381 }); 382 }); 383 } 384 } 385}; 386/** 387 * Info modalok es popupok kezelese 388 */ 389var BT_infomodals = { 390 acchg: false, 391 mcchg: false, 392 setup: false, 393 waits: null, 394 init: function() { 395 $('#bt-helpdialog').removeClass('hidden').modal({show:false}); 396 $('[data-infomodal]').click(function(ev) { 397 ev.preventDefault(); 398 var ds = $(this).data('infomodal'); 399 if (typeof BT_infomodals_table[ds]!=='undefined') { 400 //var ti = BT_infomodals_table[ds].title; 401 //var bo = BT_infomodals_table[ds].body; 402 var ti = ''; 403 var bo = BT_infomodals_table[ds]; 404 BT_infomodals._popit(ti,bo); 405 } 406 }); 407 if (BT_infomodals.waits!==null) { 408 BT_infomodals._popit(BT_infomodals.waits[0],BT_infomodals.waits[1]); 409 BT_infomodals.waits = null; 410 } 411 if (typeof BT_infomodals_popafter!=='undefined') { 412 BT_infomodals._popit(BT_infomodals_popafter[0],BT_infomodals_popafter[1]); 413 } 414 if (Cookies.get('BTallowTrackingCookies2')===undefined) { 415 Cookies.set('BTallowTrackingCookies2','yes',{expires:730,path:'/',domain:'balatontourist.hu'}); 416 } 417 if (Cookies.get('BTallowMarketingCookies2')===undefined) { 418 Cookies.set('BTallowMarketingCookies2','yes',{expires:730,path:'/',domain:'balatontourist.hu'}); 419 } 420 if (Cookies.get('BTNCookieConsentV4')===undefined) {
421 $('#cookieconsent').css({display:'block'}); 422 } 423 $('.cookieconsent-reveal').off('click').click(function(ev) { 424 ev.preventDefault(); 425 $('#cookieconsent').css({display:'block'}); 426 }); 427 $('#cookieconsent-ok').off('click').click(function(ev) { 428 ev.preventDefault(); 429 $('#cookieconsent-ok').off('click'); 430 $('#cookieconsent').fadeOut('fast'); 431 Cookies.set('BTNCookieConsentV4','yes',{expires:730,path:'/',domain:'balatontourist.hu'}); 432 if (BT_infomodals.acchg || BT_infomodals.mcchg) { 433 window.location.reload(); 434 } 435 }); 436 if (Cookies.get('BTallowTrackingCookies2')==='yes') { 437 $('#cookieconsent-analytics i').removeClass('fa-square').addClass('fa-check-square'); 438 } else { 439 $('#cookieconsent-analytics i').removeClass('fa-check-square').addClass('fa-square'); 440 } 441 if (Cookies.get('BTallowMarketingCookies2')==='yes') { 442 $('#cookieconsent-marketing i').removeClass('fa-square').addClass('fa-check-square'); 443 } else { 444 $('#cookieconsent-marketing i').removeClass('fa-check-square').addClass('fa-square'); 445 } 446 $('#cookieconsent-analytics').off('click').click(function(ev) { 447 ev.preventDefault(); 448 if (Cookies.get('BTallowTrackingCookies2')==='yes') { 449 Cookies.set('BTallowTrackingCookies2','no',{expires:730,path:'/',domain:'balatontourist.hu'}); 450 $('#cookieconsent-analytics i').removeClass('fa-check-square').addClass('fa-square'); 451 } else { 452 Cookies.set('BTallowTrackingCookies2','yes',{expires:730,path:'/',domain:'balatontourist.hu'}); 453 $('#cookieconsent-analytics i').removeClass('fa-square').addClass('fa-check-square'); 454 } 455 BT_infomodals.acchg = (BT_infomodals.acchg) ? false : true; 456 }); 457 $('#cookieconsent-marketing').off('click').click(function(ev) { 458 ev.preventDefault(); 459 if (Cookies.get('BTallowMarketingCookies2')==='yes') { 460 Cookies.set('BTallowMarketingCookies2','no',{expires:730,path:'/',domain:'balatontourist.hu'}); 461 $('#cookieconsent-marketing i').removeClass('fa-check-square').addClass('fa-square'); 462 } else { 463 Cookies.set('BTallowMarketingCookies2','yes',{expires:730,path:'/',domain:'balatontourist.hu'}); 464 $('#cookieconsent-marketing i').removeClass('fa-square').addClass('fa-check-square'); 465 } 466 BT_infomodals.mcchg = (BT_infomodals.mcchg) ? false : true; 467 }); 468 $('#cookieconsent-showdetails').off('click').click(function(ev) { 469 ev.preventDefault(); 470 $('#cookieconsent-showdetails').hide(); 471 $('#cookieconsent-details').fadeIn('fast'); 472 }); 473 $('#cookieconsent-details').hide(); 474 BT_infomodals.setup = true; 475 }, 476 popit: function(ti,bo) { 477 if (BT_infomodals.setup===false) { 478 BT_infomodals.waits = [ti,bo]; 479 } else { 480 BT_infomodals._popit(ti,bo); 481 } 482 }, 483 _popit: function(ti,bo) { 484 $('#bt-helpdialog').find('.modal-title').html(ti); 485 $('#bt-helpdialog').find('.modal-body').html(bo); 486 $('#bt-helpdialog').modal('show'); 487 } 488}; 489 490/** 491 * Kepekkel kapcsolatos segedek 492 */ 493var BT_imgallpre = { 494 makeotherthumb: function(filename,tw,th) { 495 var prefix = ''; 496 if (filename.indexOf('/')>-1) { 497 var z = filename.split('/'); 498 filename = z.pop(); 499 prefix = z.join('/')+'/'; 500 } 501 if (filename.match(/^__thumbnail_[0-9]+x[0-9]+_/)) { 502 filename = filename.replace(/^__thumbnail_[0-9]+x[0-9]+_/,''); 503 } 504 if (typeof tw==='undefined') { 505 return prefix+filename; 506 } 507 else { 508 if (typeof th==='undefined') { 509 th = tw; 510 } 511 return prefix+'__thumbnail_'+tw.toString()+'x'+th.toString()+'_'+filename; 512 } 513 }, 514 scrollto: function(elm) { 515 $('html,body').animate({scrollTop: $(elm).offset().top}); 516 }, 517 loadcounty: function(ev,nofocus) { 518 if (typeof nofocus==='undefined') nofocus = false; 519 var targ = $($(ev.target).data('countycontrol')); 520 var ctry = $(ev.target).val(); 521 $.ajax({ 522 data:{subsystem:'megyelista',lang:BT_page_lang,orszag:ctry}, 523 method:'POST', 524 url:'/ajax.php', 525 success:function(d) { 526 if (d.state && d.state==='ok' && d.options) { 527 targ.html(d.options); 528 if (targ.data('defaultafter')!==undefined) { 529 targ.val(targ.data('defaultafter')); 530 } 531 if (nofocus!==true) targ.focus(); 532 } 533 }, 534 error: function(a,b,c) { 535 WG6_forensics.displaySomething('failed to query county list'); 536 WG6_forensics.displaySomething(b); 537 WG6_forensics.displaySomething(c); 538 } 539 }); 540 }, 541 bterkep: {}, 542 calcLL: function(lat,lon,latfakt,lonfakt) { 543 let hf = 47.073204-lat; 544 let wf = lon-17.125792; 545 let oph = parseInt((hf/0.00096625)*latfakt); 546 let opw = parseInt((wf/0.00118479)*lonfakt); 547 return [opw,oph]; 548 }, 549 calcMapPoints: function() { 550 if ($('#kempingmap-image-new').length>0) { 551 let cw = $('#kempingmap-image-new').width(); 552 let ch = $('#kempingmap-image-new').height(); 553 let poff = $('#kempingmap-image-new').position(); 554 $('#kempingmap-holder').css({ 555 position: 'absolute', 556 top: '0px', 557 left: (parseInt(poff.left)).toString()+'px', 558 zIndex: '9', 559 width: cw.toString()+'px', 560 height: ch.toString()+'px' 561 }); 562 let latfakt = ch/537; 563 let lonfakt = cw/892; 564 let offs = $('#kempingmap-image-new').offset(); 565 $('[data-kempmaplat]').each(function() { 566 let lat = parseFloat($(this).data('kempmaplat')); 567 let lon = parseFloat($(this).data('kempmaplon')); 568 let nev = $(this).data('kempingmap'); 569 let coo = BT_imgallpre.calcLL(lat,lon,latfakt,lonfakt); 570 //$('#kemppin-'+nev).css({top: (coo[1]+offs.top).toString()+'px', left: (coo[0]+offs.left).toString()+'px'}); 571 $('#kemppin-'+nev).css({top: (coo[1]).toString()+'px', left: (coo[0]).toString()+'px'}); 572 }); 573 $('.mappin').fadeIn('fast'); 574 } 575 }, 576 init: function() { 577 $('.btthumbnail').swipebox(); 578 if ($('#kisbalaton').length>0) { 579 setTimeout(function() { 580 let cw = $('#kisbalaton').width(); 581 let ch = $('#kisbalaton').height(); 582 let latfaktKis = ch/537; 583 let lonfaktKis = cw/892; 584 let lat = parseFloat($('#kisbalaton').data('kislat')); 585 let lon = parseFloat($('#kisbalaton').data('kislon')); 586 let coo = BT_imgallpre.calcLL(lat,lon,latfaktKis,lonfaktKis); 587 $('#kisbalaton-kemppin').css({top: (coo[1]).toString()+'px', left: (coo[0]).toString()+'px'}); 588 },0); 589 } 590 if ($('#kempingmap-holder').length>0) { 591 $('[data-kempmaplat]').each(function() { 592 let nev = $(this).data('kempingmap'); 593 let elem = "<div class='mappin' id='kemppin-"+nev+"'></div>"; 594 $('#kempingmap-holder').append(elem); 595 $(this).hover(function() { 596 let offs = $('#kemppin-'+nev).position(); 597 $('#kemppin-'+nev).addClass('active').css({top: (offs.top-5).toString()+'px', left: (offs.left-5).toString()+'px'}); 598 },function() { 599 let offs = $('#kemppin-'+nev).position(); 600 $('#kemppin-'+nev).removeClass('active').css({top: (offs.top+5).toString()+'px', left: (offs.left+5).toString()+'px'}); 601 }); 602 }); 603 $('#kempingsubmenu').click(function(ev) { 604 $('.mappin').hide(); 605 setTimeout(BT_imgallpre.calcMapPoints,20); 606 }); 607 $(window).resize(BT_imgallpre.calcMapPoints); 608 } 609 $('[data-kempingmap]').each(function() { 610 var knev = $(this).data('kempingmap'); 611 var klikka = this; 612 BT_imgallpre.bterkep[knev] = new Image(); 613 BT_imgallpre.bterkep[knev].src = '/static/images/balaton/balatonterkep-'+knev+'.png'; 614 BT_imgallpre.bterkep[knev].addEventListener("load", function() { 615 $(klikka).hover(function() { 616 $('#kempingmap-image').attr('src','/static/images/balaton/balatonterkep-'+knev+'.png?v=2'); 617 },function() { 618 $('#kempingmap-image').attr('src','/static/images/balaton/balatonterkep.png?v=2'); 619 }); 620 }); 621 }); 622 if ($('#carousel').length>0) { 623 $('#carousel').slick({ 624 autoplay:true, 625 arrows:true, 626 dots:false, 627 fade:true, 628 cssEase: 'linear', 629 autoplaySpeed: 5000, 630 pauseOnHover:false, 631 mobileFirst:true 632 }); 633 } 634 $('[data-countycontrol]').change(BT_imgallpre.loadcounty); 635 $('[data-countycontrol]').each(function() { 636 var ev = {target:this}; 637 BT_imgallpre.loadcounty(ev,true); 638 }); 639 640 } 641}; 642 643/** 644 * Egysegeknel szallastipusok navigacioja + celzott #-s linkek kezelese egysegoldalakon 645 */ 646var BT_szalltipnav = { 647 init: function() { 648 $('.szalltipnav').each(function() { 649 var $this = $(this); 650 var t = $this.data('target'); 651 $(t).find('.szalltipold').hide(); 652 $this.find('a.active').each(function() { 653 $(t).find($(this).attr('href')).show(); 654 }); 655 $this.find('a').off('click').on('click',function(ev) { 656 ev.preventDefault(); 657 $this.find('a').removeClass('active'); 658 $(this).addClass('active'); 659 $(t).find('.szalltipold').hide(); 660 $(t).find($(this).attr('href')).show(); 661 let sztip = $(this).data('sztip'); 662 if (sztip) { 663 $('#ADV_SZTIP').val(sztip); 664 } 665 }); 666 }); 667 //#egysegszallas_ 668 if (window.location.hash && window.location.hash!=='' && window.location.hash.substr(0,15)==='#egysegszallas_' && $(window.location.hash).length>0) { 669 setTimeout(function() { 670 var y = $('.egyseg ul.nav-tabs a.bt-switch-lodging'); 671 if (y.length>0) { 672 y.click(); 673 setTimeout(function() { 674 var x = $('.egyseg .tab-pane ul.szalltipnav li a[href="'+window.location.hash+'"]'); 675 if (x.length>0) { 676 x.click(); 677 } 678 },100); 679 } 680 },500); 681 } 682 else if (window.location.hash && window.location.hash!=='' && window.location.hash.substr(0,10)==='#egysprog_' && $(window.location.hash).length>0 && $('a[href="'+window.location.hash+'"]').length>0) { 683 $('a[href="'+window.location.hash+'"]').click(); 684 } 685 else if (window.location.hash && window.location.hash!=='' && window.location.hash.substr(0,11)==='#egysakcio_' && $(window.location.hash).length>0 && $('a[href="'+window.location.hash+'"]').length>0) { 686 $('a[href="'+window.location.hash+'"]').click(); 687 } 688 else if (window.location.hash && window.location.hash!=='' && window.location.hash.substr(0,12)==='#egysszallas_' && $(window.location.hash).length>0 && $('a[href="'+window.location.hash+'"]').length>0) { 689 $('a[href="'+window.location.hash+'"]').click(); 690 } 691 } 692}; 693 694/** 695 * Foglalas AJAX form kezeloje 696 */ 697var BT_foglalas = { 698 dc: null, 699 can_check_price: false, 700 kontingensopciok: {}, 701 kontingenshash: '', 702 kontingensopc: '', 703 fizetesurl: null, 704 normkontnev: '', 705 extkontnev: '', 706 teljesar: '', 707 mostfizetendo: '', 708 suspendprocess: false, 709 defaultopcio: '_', 710 init: function() { 711 if ($('#insidebooking').length>0) { 712 $('#nincsar').hide(); 713 $('#kontingensopciok').hide(); 714 BT_foglalas.normkontnev = $('#normkont').text(); 715 BT_foglalas.extkontnev = $('#extkont').text(); 716 BT_foglalas.teljesar = $('#szotar_teljesosszeg').text(); 717 BT_foglalas.mostfizetendo = $('#szotar_eloleg').text(); 718 $('#foglal_send').hide(); 719 BT_foglalas.dc = new BT_date(BT_foglaldict.szezonkezd,BT_foglaldict.szezonzar,'erkezes','tavozas',function() { 720 BT_foglalas.validate(); 721 if (BT_foglalas.can_check_price===true) { 722 BT_foglalas.check_price(); 723 } 724 }); 725 if (BT_foglaldict.egysegplusz==='') { 726 $('#egysegpluszinfo').html('').hide(); 727 } else { 728 $('#egysegpluszinfo').html(BT_foglaldict.egysegplusz).show(); 729 } 730 if (BT_foglaldict.egysegadatok!==null) { 731 BT_foglalas.szallaschange(); 732 } 733 BT_foglalas.validate(); 734 if (BT_foglalas.can_check_price===true) { 735 BT_foglalas.check_price(); 736 } 737 $('.btfoglalstep').hide(); 738 $('#foglal1').show(); 739 $('#foglal_next').show().prop('disabled',false).click(function(evt) { 740 evt.preventDefault(); 741 $('#foglal_next').hide();
742 $('#foglal1').slideUp('fast',BT_foglalas.validate); 743 }); 744 $('#send_progress').hide(); 745 $('#send_after').hide(); 746 $('#foglal_pay').click(function(evt) { 747 evt.preventDefault(); 748 window.location = BT_foglalas.fizetesurl; 749 }); 750 $('#foglal_prev').hide().off('click').click(function(evt) { 751 evt.preventDefault(); 752 $('#foglal8').hide(); 753 $('#doit').val('no'); 754 $('#foglal_prev').hide(); 755 BT_foglalas.validate(); 756 if (BT_foglalas.can_check_price===true) { 757 BT_foglalas.check_price(); 758 } 759 }); 760 $('#foglal_send').click(function(evt) { 761 evt.preventDefault(); 762 $('#foglal_send').prop('disabled',true); 763 $('#send_before').hide(); 764 $('#send_progress').show(); 765 $('#doit').val('yes'); 766 var sd = $('#btfoglalform').serialize(); 767 var nv = $('#kontingensopciok input[name="kontingens"]:checked'); 768 if (nv.length===0) { 769 nv = $('#kontingensopciok input[name="kontingens"]').first().val(); 770 } else { 771 nv = nv.val(); 772 } 773 if (nv!=='_' && typeof BT_foglalas.kontingensopciok[nv]!=='undefined') { 774 $('.btfoglalstep').hide(); 775 $('#foglal8 .alert').hide(); 776 $('#foglal8 .alert-warning').show(); 777 $('#foglal8').show(); 778 BT_imgallpre.scrollto('#booking'); 779 $.ajax({ 780 data:sd, 781 method:'POST', 782 url:'/ajax.php', 783 success:function(d) { 784 $('#foglal8 .alert').hide(); 785 if (typeof d['state']==='undefined' || d['state']!=='sent') { 786 WG6_forensics.displaySomething("FOGLAL: sikertelen AJAX válasz, hibás formátum",'text-warning'); 787 WG6_forensics.displaySomething(d,'text-warning'); 788 $('#send_progress').hide(); 789 $('#send_before').show(); 790 $('#foglal_send').prop('disabled',false); 791 $('#foglal8 .alert-danger').show(); 792 $('#foglal_prev').show(); 793 } else { 794 WG6_forensics.displaySomething("FOGLAL: sikeres AJAX válasz"); 795 if (typeof fbq!=='undefined') fbq('track', 'SubmitApplication'); 796 $('#send_progress').hide(); 797 $('#send_after').show(); 798 $('#foglal8 .alert-success').show(); 799 $('#foglal_send').hide(); 800 BT_foglalas.fizetesurl = d['fizetesurl']; 801 $('#foglal_pay').show().prop('disabled',false); 802 } 803 }, 804 error: function(a,b,c) { 805 WG6_forensics.displaySomething("FOGLAL: sikertelen AJAX válasz",'text-danger'); 806 WG6_forensics.displaySomething(b,'text-danger'); 807 WG6_forensics.displaySomething(c,'text-danger'); 808 $('#send_progress').hide(); 809 $('#send_before').show(); 810 $('#foglal_send').prop('disabled',false); 811 } 812 }); 813 } else { 814 $.ajax({ 815 data:sd, 816 method:'POST', 817 url:'/ajax.php', 818 success:function(d) { 819 if (typeof d['state']==='undefined' || d['state']!=='sent') { 820 WG6_forensics.displaySomething("FOGLAL: sikertelen beküldési kÃsérlet",'text-warning'); 821 WG6_forensics.displaySomething(d,'text-warning'); 822 $('#send_progress').hide(); 823 $('#send_before').show(); 824 $('#foglal_send').prop('disabled',false); 825 } else { 826 WG6_forensics.displaySomething("FOGLAL: foglalás sikeresen beküldve"); 827 if (typeof fbq!=='undefined') fbq('track', 'SubmitApplication'); 828 $('#send_progress').hide(); 829 $('#send_after').show(); 830 $('.btfoglalstep').hide(); 831 $('#foglal7').show(); 832 BT_imgallpre.scrollto('#booking'); 833 } 834 }, 835 error: function(a,b,c) { 836 WG6_forensics.displaySomething("FOGLAL: sikertelen beküldési kÃsérlet",'text-danger'); 837 WG6_forensics.displaySomething(b,'text-danger'); 838 WG6_forensics.displaySomething(c,'text-danger'); 839 $('#send_progress').hide(); 840 $('#send_before').show(); 841 $('#foglal_send').prop('disabled',false); 842 } 843 }); 844 } 845 }); 846 $('#kontingensopciok').click(function(ev) { 847 if (BT_foglalas.suspendprocess===false) { 848 var et = $(ev.target); 849 if (et.attr('name')==='kontingens') { 850 $('#kontingensopciok .foglalopcio').removeClass('activated'); 851 et.closest('.foglalopcio').addClass('activated'); 852 BT_foglalas.elolegszamol(); 853 } 854 } 855 }.bind(this)); 856 $('#egysegkod').change(BT_foglalas.egysegchange); 857 $('#szallaskod').change(BT_foglalas.szallaschange); 858 ['felnott','diak','gyerek','csecsemo','kisallat','erkezes','tavozas','nev','email','cim_orsz','cim_irsz','cim_varos','cim_cim','szamla_nev','szamla_adoszam','szamla_cim_orsz','szamla_cim_irsz','szamla_cim_varos','szamla_cim_cim','telefon','fax'].forEach(function(fn) { 859 $('#'+fn).change(function() { 860 if (BT_foglalas.suspendprocess===false) { 861 BT_foglalas.validate(); 862 if (BT_foglalas.can_check_price===true) { 863 BT_foglalas.check_price(); 864 } 865 } 866 }); 867 }); 868 $('#agree').click(function() { 869 if ($('#agree').prop('checked')===false) { 870 $('#agree').closest('.alert').removeClass('alert-success').addClass('alert-danger'); 871 } else { 872 $('#agree').closest('.alert').removeClass('alert-danger').addClass('alert-success'); 873 } 874 BT_foglalas.validate(); 875 return true; 876 }); 877 $('#inv_sameasnormal').click(function() { 878 $('#szamla_cim_megye').data('defaultafter',$('#cim_megye').val()); 879 ['nev','cim_orsz','cim_irsz','cim_varos','cim_cim'].forEach(function(cf) { 880 $('#szamla_'+cf).val($('#'+cf).val()); 881 }); 882 BT_foglalas.validate(); 883 return true; 884 }); 885 } 886 }, 887 szepszam: function(szam,vnem) { 888 var out = '', cnt = 0; 889 while(szam.length>0) { 890 out = szam.substr(szam.length-1,1)+out; 891 szam = szam.substr(0,szam.length-1); 892 ++cnt; 893 if (cnt===3) { 894 cnt = 0; 895 out = ' '+out; 896 } 897 } 898 if (BT_page_lang==='hu') { 899 if (vnem==='EUR') { 900 vnem = 'â¬'; 901 } 902 else if (vnem==='HUF') { 903 vnem = 'Ft'; 904 } 905 else if (vnem==='USD') { 906 vnem = 'US$'; 907 } 908 out = out+' '+vnem; 909 } else { 910 if (vnem==='EUR') { 911 vnem = 'â¬'; 912 } 913 else if (vnem==='USD') { 914 vnem = 'US$'; 915 } 916 out = vnem+' '+out; 917 } 918 return out; 919 }, 920 szepdatum: function(dat,monthonly) { 921 if (typeof monthonly==='undefined') { 922 monthonly = false;
923 } 924 var y = dat.substr(0,4); 925 var m = dat.substr(5,2); 926 var d = dat.substr(8,2); 927 if (BT_page_lang==='hu') { 928 if (monthonly) { 929 return m+'/'+d; 930 } 931 return y+'/'+m+'/'+d; 932 } 933 else { 934 if (monthonly) { 935 return d+'/'+m; 936 } 937 return d+'/'+m+'/'+y; 938 } 939 }, 940 elolegszamol: function() { 941 //TODO csak HUF 942 var nv = $('#kontingensopciok input[name="kontingens"]:checked'); 943 if (nv.length>0) { 944 nv = nv.val(); 945 if (typeof BT_foglalas.kontingensopciok[nv]!=='undefined') { 946 WG6_forensics.displaySomething('elolegszamolas: '+nv); 947 BT_foglalas.kontingensopc = nv; 948 var ar = BT_foglalas.szepszam(BT_foglalas.kontingensopciok[nv][1].toString(),'HUF'); 949 $('#arajanlat').text(ar); 950 if (nv==='_') { 951 $('#mostfizetendo').hide(); 952 $('#foglalfirstwarn').show(); 953 } else { 954 $('#foglalfirstwarn').hide(); 955 var eloleg = parseInt(parseInt(BT_foglalas.kontingensopciok[nv][1])*(parseInt(BT_foglalas.kontingensopciok[nv][4])/100)); 956 eloleg = '<nobr>'+BT_foglalas.szepszam(eloleg.toString(),'HUF')+'</nobr>'; 957 $('#mostfizetendoar').text(eloleg); 958 $('#mostfizetendo').show(); 959 if ($('#erkezes').val()!==BT_foglalas.kontingensopciok[nv][2] || $('#tavozas').val()!==BT_foglalas.kontingensopciok[nv][3]) { 960 BT_foglalas.suspendprocess = true; 961 $('#erkezes').val(BT_foglalas.kontingensopciok[nv][2]); 962 $('#tavozas').val(BT_foglalas.kontingensopciok[nv][3]); 963 BT_foglalas.validate(); 964 if (BT_foglalas.can_check_price===true) { 965 BT_foglalas.check_price(); 966 } 967 BT_foglalas.suspendprocess = false; 968 } 969 } 970 } 971 } 972 }, 973 validate: function() { 974 $('#foglal_send').hide().prop('disabled',true); 975 $('#foglal_pay').hide().prop('disabled',true); 976 $('.btfoglalerror').hide(); 977 $('#arinfo').hide(); 978 $('#mostfizetendo').hide(); 979 $('#btfoglalform .form-group').removeClass('has-error'); 980 var allok = true; 981 BT_foglalas.can_check_price = false; 982 var cv = $('#egysegkod').val(); 983 if (cv==='') { 984 BT_foglalas.hidefrom(3); 985 BT_foglalas.dc.change(BT_season_start,BT_season_end); 986 $('#error_egysegkod').show(); 987 $('#egysegkod').closest('.form-group').addClass('has-error'); 988 allok = false; 989 } else { 990 cv = $('#szallaskod').val(); 991 if (cv==='') { 992 BT_foglalas.hidefrom(4); 993 $('#error_szallaskod').show(); 994 $('#szallaskod').closest('.form-group').addClass('has-error'); 995 allok = false; 996 } else { 997 BT_foglalas.hidefrom(5); 998 let esdat = BT_foglaldict.egysegadatok[cv]; 999 if (esdat.pluszagy===0) { 1000 $('#potagyak').val('0'); 1001 } 1002 if (esdat.diak===false) { 1003 $('#diak').val('0'); 1004 } 1005 if (esdat.gyerek===false) { 1006 $('#gyerek').val('0'); 1007 } 1008 if (esdat.csecsemo===false) { 1009 $('#csecsemo').val('0'); 1010 } 1011 if (esdat.kisallat===false) { 1012 $('#kisallat').val('0'); 1013 } 1014 var szemelyek = parseInt($('#felnott').val())+parseInt($('#diak').val())+parseInt($('#gyerek').val())+parseInt($('#csecsemo').val()); 1015 if (szemelyek===0) { 1016 $('#error_szemelyek').show(); 1017 $('.szemelytipus').addClass('has-error'); 1018 allok = false; 1019 } 1020 else if (szemelyek>BT_foglaldict.egysegadatok[cv].maxszem) { 1021 var kul = szemelyek-BT_foglaldict.egysegadatok[cv].maxszem; 1022 if (kul>BT_foglaldict.egysegadatok[cv].pluszagy) { 1023 $('#error_szemelytulsok').show(); 1024 $('.szemelytipus').addClass('has-error'); 1025 allok = false; 1026 } else { 1027 $('#potagyak').val(kul.toString()); 1028 } 1029 } 1030 else { 1031 $('#potagyak').val('0'); 1032 } 1033 if (allok===true) { 1034 BT_foglalas.can_check_price = true; 1035 $('#arinfo').show(); 1036 BT_foglalas.hidefrom(6); 1037 if (!$('#email').val().match(/^([a-zA-Z0-9_!,.:-]+)@([a-zA-Z0-9-]+[.][a-zA-Z0-9.-]+)$/)) { 1038 $('#error_email').show(); 1039 $('#email').closest('.form-group').addClass('has-error'); 1040 allok = false; 1041 } 1042 if (!$('#telefon').val().match(new RegExp('^[0-9/().+ -]+$'))) { 1043 $('#error_telefon').show(); 1044 $('#telefon').closest('.form-group').addClass('has-error'); 1045 allok = false;
1046 } 1047 ['nev','cim_irsz','cim_varos','cim_cim','szamla_nev','szamla_cim_irsz','szamla_cim_varos','szamla_cim_cim'].forEach(function(cf) { 1048 if ($('#'+cf).val()==='') { 1049 $('#error_'+cf).show(); 1050 $('#'+cf).closest('.form-group').addClass('has-error'); 1051 allok = false; 1052 } 1053 }); 1054 if (allok===true) { 1055 BT_foglalas.hidefrom(7); 1056 if ($('#agree').prop('checked')===true) { 1057 $('#foglal_send').show().prop('disabled',false); 1058 $('#foglal_next').hide(); 1059 } 1060 } 1061 } 1062 } 1063 } 1064 }, 1065 check_price: function() { 1066 $('#arinfo').hide(); 1067 $('#nincsar').hide(); 1068 var sd = $('#btfoglalform').serialize(); 1069 $.ajax({ 1070 data:sd, 1071 method:'POST', 1072 url:'/ajax.php', 1073 success:function(d) { 1074 if (typeof d['price']==='undefined') { 1075 WG6_forensics.displaySomething("FOGLAL: árlekérés sikeres, de hibás a válasz!",'text-warning'); 1076 WG6_forensics.displaySomething(d,'text-warning'); 1077 $('#arinfo').show(); 1078 $('#nincsar').show(); 1079 $('#kontingensopciok').hide(); 1080 BT_foglalas.kontingenshash = ''; 1081 } else { 1082 if (d['price']==='X') { 1083 WG6_forensics.displaySomething("FOGLAL: árlekérés sikeres, de nincs ár!",'text-warning'); 1084 $('#arinfo').show(); 1085 $('#nincsar').show(); 1086 $('#kontingensopciok').hide(); 1087 BT_foglalas.kontingenshash = ''; 1088 } else { 1089 if (d['price']!==d['price_orig']) { 1090 $('#arajanlat').html('<span class="eredeti">'+d['price_orig']+'</span> '+d['price']); 1091 } else { 1092 $('#arajanlat').html(d['price']); 1093 } 1094 if (BT_foglalas.kontingenshash!==d['konthash']) { 1095 WG6_forensics.displaySomething("FOGLAL: új árak érkeztek be, újraszámolás!"); 1096 WG6_forensics.displaySomething(d['kontopts']); 1097 BT_foglalas.defaultopcio = '_'; 1098 var kijeopcio = '_'; 1099 BT_foglalas.kontingenshash = d['konthash']; 1100 var inopts = ''; 1101 BT_foglalas.kontingensopciok = d['kontopts']; 1102 var kulcsok = Object.keys(BT_foglalas.kontingensopciok); 1103 $('#foglal_alapopcio').hide(); 1104 var thisopt; 1105 for(var i=0;i<kulcsok.length;i++) { 1106 thisopt = BT_foglalas.kontingensopciok[kulcsok[i]]; 1107 if (kulcsok[i]==='_') { 1108 continue; 1109 } 1110 if (thisopt[6]!=='') continue; 1111 if (!BT_istestingmode && !BT_isdevsite && (thisopt[7]===true || thisopt[8]===true)) continue; 1112 if (BT_foglalas.defaultopcio==='_') { 1113 BT_foglalas.defaultopcio = kulcsok[i]; 1114 } 1115 if (thisopt[7]===false && thisopt[8]===false) { 1116 if (thisopt[5]===true || kijeopcio==='_') { 1117 kijeopcio = kulcsok[i]; 1118 } 1119 } 1120 inopts += "<div class=\"radio foglalopcio kontingens\"><input type=\"radio\" name=\"kontingens\" id=\"kontingens_"+kulcsok[i]+"\" value=\""+kulcsok[i]+"\">"; 1121 inopts += "<label for=\"kontingens_"+kulcsok[i]+"\" class='arak'>"; 1122 if (thisopt[7]===true || thisopt[8]===true) { 1123 let nudd = BT_foglalas.szepdatum(thisopt[2],true)+' - '+BT_foglalas.szepdatum(thisopt[3],true); 1124 inopts += '<b>'+BT_foglalas.normkontnev+':</b> <span title="'+BT_foglalas.extkontnev+'" class="label label-primary"><span class="glyphicon '; 1125 if (thisopt[7]===true) { 1126 inopts += 'glyphicon-log-in'; 1127 } else { 1128 inopts += 'glyphicon-log-out'; 1129 } 1130 inopts += '"></span> '+nudd+'</span>'; 1131 //+thisopt[2]+'-'+thisopt[3]+'<br>('+BT_foglalas.extkontnev+')'; 1132 } 1133 else { 1134 inopts += '<b>'+BT_foglalas.normkontnev+'</b>'; 1135 } 1136 inopts += "<br><span class='arak'>"+BT_foglalas.teljesar+": <span class='glyphicon glyphicon-tag'></span> <nobr><b>"+BT_foglalas.szepszam(thisopt[1].toString(), 'HUF'); 1137 if (thisopt[4]>0) { 1138 var eloleg = parseInt(parseInt(thisopt[1])*(parseInt(thisopt[4])/100)); 1139 eloleg = BT_foglalas.szepszam(eloleg.toString(),'HUF'); 1140 inopts += "</b></nobr> ⢠"+BT_foglalas.mostfizetendo+": <span class='glyphicon glyphicon-credit-card'></span> <nobr><b>"+eloleg; 1141 } 1142 inopts += "</b></nobr></span></label></div>\n"; 1143 } 1144 for(var i=0;i<kulcsok.length;i++) { 1145 thisopt = BT_foglalas.kontingensopciok[kulcsok[i]]; 1146 if (kulcsok[i]==='_') { 1147 $('#ajanlat__ar').html('<nobr>'+BT_foglalas.szepszam(thisopt[1].toString(), 'HUF')+'</nobr>'); 1148 BT_foglalas.defaultopcio = '_'; 1149 $('#foglal_alapopcio').show(); 1150 } else { 1151 continue; 1152 } 1153 } 1154 $('#kontingens_tipusok').html(inopts); 1155 $('#kontingensopciok').show(); 1156 var nv = $('#kontingensopciok input[name="kontingens"]:checked'); 1157 if (nv.length===0) { 1158 if (kulcsok.indexOf(BT_foglalas.kontingensopc)===-1) { 1159 BT_foglalas.kontingensopc = kijeopcio; 1160 //BT_foglalas.kontingensopc = BT_foglalas.defaultopcio; 1161 } 1162 BT_foglalas.suspendprocess = true; 1163 $('#kontingensopciok .foglalopcio').removeClass('activated'); 1164 $('#kontingens_'+BT_foglalas.kontingensopc).closest('.foglalopcio').addClass('activated'); 1165 $('#kontingens_'+BT_foglalas.kontingensopc).click(); 1166 BT_foglalas.suspendprocess = false;
1167 } 1168 } else { 1169 WG6_forensics.displaySomething("FOGLAL: nincs új ár",'text-info'); 1170 } 1171 BT_foglalas.elolegszamol(); 1172 $('#arinfo').show(); 1173 } 1174 } 1175 } 1176 }); 1177 }, 1178 hidefrom: function(num) { 1179 $('.btfoglalstep').hide(); 1180 for(var i=2;i<8;i++) { 1181 if (num>i) { 1182 $('#foglal'+i.toString()).show(); 1183 } else { 1184 $('#foglal'+i.toString()).hide(); 1185 } 1186 } 1187 $('#foglal_send').hide(); 1188 }, 1189 egysegchange: function() { 1190 var cv = $('#egysegkod').val(); 1191 if (cv==='') { 1192 BT_foglalas.validate(); 1193 } else { 1194 BT_foglalas.hidefrom(3); 1195 BT_foglalas.dc.change(BT_season_start,BT_season_end); 1196 $('#foglal_next').prop('disabled',true); 1197 $.ajax({ 1198 data:{'egyseg_change':cv}, 1199 method:'GET', 1200 cache:false, 1201 url:'/ajax.php', 1202 success:BT_foglalas.egysegchanged 1203 }); 1204 } 1205 }, 1206 egysegchanged: function(d) { 1207 if (typeof d['state']==='undefined' || d.state==='fail') { 1208 WG6_forensics.displaySomething('BT_foglalas.egysegchanged failed'); 1209 WG6_forensics.displaySomething(d); 1210 BT_foglalas.hidefrom(3); 1211 BT_foglalas.dc.change(BT_season_start,BT_season_end); 1212 } else { 1213 //console.log('success',d); 1214 BT_foglaldict.egysegadatok = d.adatok; 1215 if (d.warn==='') { 1216 $('#egysegpluszinfo').html('').hide(); 1217 } else { 1218 $('#egysegpluszinfo').html(d.warn).show(); 1219 } 1220 BT_foglalas.dc.change(d.adatok['__szezon'][0],d.adatok['__szezon'][1]); 1221 var optlist = '<option value="">'+BT_foglaldict.valassz+'</option>'; 1222 Object.keys(d.adatok).forEach(function(k) { 1223 if (k!=='__szezon') { 1224 optlist += '<option value="'+k+'"'; 1225 if (k===d.sztip) { 1226 optlist += ' selected'; 1227 } 1228 optlist += '>'+d.adatok[k].title+'</option>'; 1229 } 1230 }); 1231 BT_foglalas.hidefrom(4); 1232 $('#szallaskod').html(optlist); 1233 $('#szallaskod').val(d.sztip); 1234 } 1235 BT_foglalas.validate(); 1236 if (BT_foglalas.can_check_price===true) { 1237 BT_foglalas.check_price(); 1238 } 1239 }, 1240 szallaschange: function() { 1241 var cv = $('#szallaskod').val(); 1242 if (cv==='') { 1243 var x = 1; 1244 } else { 1245 $('#foglal_next').prop('disabled',false); 1246 var dat = BT_foglaldict.egysegadatok[cv]; 1247 $('#maxszemelyek').html(dat.maxszem.toString()); 1248 $('#maxpotagy').html(dat.pluszagy.toString()); 1249 if (dat.pluszagy===0) { 1250 $('#potagykontrol').hide(); 1251 $('#potagyak').val('0'); 1252 } else { 1253 $('#potagykontrol').show(); 1254 } 1255 if (dat.diak===false) { 1256 $('#diakkontrol').hide(); 1257 $('#diak').val('0'); 1258 } else { 1259 $('#diakkontrol').show(); 1260 } 1261 if (dat.gyerek===false) { 1262 $('#gyerekkontrol').hide(); 1263 $('#gyerek').val('0'); 1264 } else { 1265 $('#gyerekkontrol').show(); 1266 } 1267 if (dat.csecsemo===false) { 1268 $('#csecsemokontrol').hide(); 1269 $('#csecsemo').val('0'); 1270 } else { 1271 $('#csecsemokontrol').show(); 1272 } 1273 if (dat.kisallat===false) { 1274 $('#kisallatkontrol').hide(); 1275 $('#kisallat').val('0'); 1276 } else { 1277 $('#kisallatkontrol').show(); 1278 } 1279 } 1280 BT_foglalas.validate(); 1281 if (BT_foglalas.can_check_price===true) { 1282 BT_foglalas.check_price(); 1283 } 1284 }, 1285 testdata: function() { 1286 $('#nev').val('teszt béla'); 1287 $('#email').val('[email protected]'); 1288 $('#szamla_nev').val('teszt kft'); 1289 $('#szamla_adoszam').val('HU1234758'); 1290 $('#telefon').val('0123489723'); 1291 $('#fax').val('9898293'); 1292 $('#cim_irsz').val('9999'); 1293 $('#cim_varos').val('rudapest'); 1294 $('#cim_cim').val('cimbora u. 255.'); 1295 $('#szamla_cim_irsz').val('9998'); 1296 $('#szamla_cim_varos').val('rudapest'); 1297 $('#szamla_cim_cim').val('megatron u. 55.'); 1298 $('#egyeb').val('random generator'); 1299 BT_foglalas.validate(); 1300 } 1301}; 1302 1303/** 1304 * Csoportos foglalas AJAX form kezeloje 1305 */ 1306var BT_foglalascsop = { 1307 dc: null, 1308 init: function() { 1309 if ($('#insidebookinggrp').length>0) { 1310 $('#foglal_send').hide(); 1311 BT_foglalascsop.dc = new BT_date(BT_foglaldict.szezonkezd,BT_foglaldict.szezonzar,'erkezes','tavozas',function() { 1312 BT_foglalascsop.validate(); 1313 }); 1314 if (BT_foglaldict.egysegplusz==='') { 1315 $('#egysegpluszinfo').html('').hide(); 1316 } else { 1317 $('#egysegpluszinfo').html(BT_foglaldict.egysegplusz).show(); 1318 } 1319 BT_foglalascsop.validate(); 1320 $('.btfoglalstep').hide(); 1321 $('#foglal1').show(); 1322 $('#foglal_next').show().prop('disabled',false).click(function(evt) { 1323 evt.preventDefault(); 1324 $('#foglal_next').hide();
1325 $('#foglal1').slideUp('fast',BT_foglalascsop.validate); 1326 }); 1327 $('#send_progress').hide(); 1328 $('#send_after').hide(); 1329 $('#foglal_send').click(function(evt) { 1330 evt.preventDefault(); 1331 $('#foglal_send').prop('disabled',true); 1332 $('#send_before').hide(); 1333 $('#send_progress').show(); 1334 $('#doit').val('yes'); 1335 var sd = $('#btfoglalform').serialize(); 1336 $.ajax({ 1337 data:sd, 1338 method:'POST', 1339 url:'/ajax.php', 1340 success:function(d) { 1341 if (typeof d['state']==='undefined' || d['state']!=='sent') { 1342 WG6_forensics.displaySomething('foglalcsop foglalsend failed'); 1343 WG6_forensics.displaySomething(d); 1344 $('#send_progress').hide(); 1345 $('#send_before').show(); 1346 $('#foglal_send').prop('disabled',false); 1347 } else { 1348 if (typeof fbq!=='undefined') fbq('track', 'SubmitApplication'); 1349 $('#send_progress').hide(); 1350 $('#send_after').show(); 1351 $('.btfoglalstep').hide(); 1352 $('#foglal7').show(); 1353 BT_imgallpre.scrollto('#booking'); 1354 } 1355 }, 1356 error: function(a,b,c) { 1357 WG6_forensics.displaySomething('foglalcsop send failed'); 1358 WG6_forensics.displaySomething(b); 1359 WG6_forensics.displaySomething(c); 1360 $('#send_progress').hide(); 1361 $('#send_before').show(); 1362 $('#foglal_send').prop('disabled',false); 1363 } 1364 }); 1365 }); 1366 $('#egysegkod').change(BT_foglalascsop.egysegchange); 1367 ['felnott','diak','gyerek','csecsemo','kisallat','erkezes','tavozas','nev','email','cim_orsz','cim_irsz','cim_varos','cim_cim','szamla_nev','szamla_adoszam','szamla_cim_orsz','szamla_cim_irsz','szamla_cim_varos','szamla_cim_cim','telefon','fax'].forEach(function(fn) { 1368 $('#'+fn).change(function() { 1369 BT_foglalascsop.validate(); 1370 }); 1371 }); 1372 $('#agree').click(function() { 1373 if ($('#agree').prop('checked')===false) { 1374 $('#agree').closest('.alert').removeClass('alert-success').addClass('alert-danger'); 1375 } else { 1376 $('#agree').closest('.alert').removeClass('alert-danger').addClass('alert-success'); 1377 } 1378 BT_foglalascsop.validate(); 1379 return true; 1380 }); 1381 $('#inv_sameasnormal').click(function() { 1382 ['nev','cim_orsz','cim_irsz','cim_varos','cim_cim'].forEach(function(cf) { 1383 $('#szamla_'+cf).val($('#'+cf).val()); 1384 }); 1385 BT_foglalascsop.validate(); 1386 return true; 1387 }); 1388 } 1389 }, 1390 validate: function() { 1391 $('#foglal_send').hide().prop('disabled',true); 1392 $('.btfoglalerror').hide(); 1393 $('#btfoglalform .form-group').removeClass('has-error'); 1394 var allok = true; 1395 var cv = $('#egysegkod').val(); 1396 if (cv==='') { 1397 BT_foglalascsop.hidefrom(3); 1398 BT_foglalascsop.dc.change(BT_season_start,BT_season_end); 1399 $('#error_egysegkod').show(); 1400 $('#egysegkod').closest('.form-group').addClass('has-error'); 1401 allok = false; 1402 } else { 1403 BT_foglalascsop.hidefrom(5); 1404 var szemelyek = parseInt($('#felnott').val())+parseInt($('#diak').val())+parseInt($('#gyerek').val())+parseInt($('#csecsemo').val()); 1405 //var szemelyek = parseInt($('#felnott').val())+parseInt($('#gyerek').val()); 1406 if (szemelyek===0) { 1407 $('#error_szemelyek').show(); 1408 $('.szemelytipus').addClass('has-error'); 1409 allok = false; 1410 }
1411 if (allok===true) { 1412 BT_foglalascsop.hidefrom(6); 1413 if (!$('#email').val().match(/^([a-zA-Z0-9_!,.:-]+)@([a-zA-Z0-9-]+[.][a-zA-Z0-9.-]+)$/)) { 1414 $('#error_email').show(); 1415 $('#email').closest('.form-group').addClass('has-error'); 1416 allok = false; 1417 } 1418 if (!$('#telefon').val().match(new RegExp('^[0-9/().+ -]+$'))) { 1419 $('#error_telefon').show(); 1420 $('#telefon').closest('.form-group').addClass('has-error'); 1421 allok = false; 1422 } 1423 ['nev','cim_irsz','cim_varos','cim_cim','szamla_nev','szamla_cim_irsz','szamla_cim_varos','szamla_cim_cim'].forEach(function(cf) { 1424 if ($('#'+cf).val()==='') { 1425 $('#error_'+cf).show(); 1426 $('#'+cf).closest('.form-group').addClass('has-error'); 1427 allok = false; 1428 } 1429 }); 1430 if (allok===true) { 1431 BT_foglalascsop.hidefrom(7); 1432 if ($('#agree').prop('checked')===true) { 1433 $('#foglal_send').show().prop('disabled',false); 1434 $('#foglal_next').hide(); 1435 } 1436 } 1437 } 1438 } 1439 }, 1440 hidefrom: function(num) { 1441 $('.btfoglalstep').hide(); 1442 for(var i=2;i<8;i++) { 1443 if (num>i) { 1444 $('#foglal'+i.toString()).show(); 1445 } else { 1446 $('#foglal'+i.toString()).hide(); 1447 } 1448 } 1449 $('#foglal_send').hide(); 1450 }, 1451 egysegchange: function() { 1452 var cv = $('#egysegkod').val(); 1453 if (cv==='') { 1454 BT_foglalascsop.validate(); 1455 } else { 1456 BT_foglalascsop.hidefrom(3); 1457 BT_foglalascsop.dc.change(BT_season_start,BT_season_end); 1458 $('#foglal_next').prop('disabled',true); 1459 $.ajax({ 1460 data:{'egyseg_change':cv}, 1461 method:'GET', 1462 cache:false, 1463 url:'/ajax.php', 1464 success:BT_foglalascsop.egysegchanged 1465 }); 1466 } 1467 }, 1468 egysegchanged: function(d) { 1469 if (typeof d['state']==='undefined' || d.state==='fail') { 1470 WG6_forensics.displaySomething('BT_foglalascsop.egysegchanged failed'); 1471 WG6_forensics.displaySomething(d); 1472 BT_foglalascsop.hidefrom(3); 1473 BT_foglalascsop.dc.change(BT_season_start,BT_season_end); 1474 } else { 1475 //console.log('success',d); 1476 BT_foglaldict.egysegadatok = d.adatok; 1477 if (d.warn==='') { 1478 $('#egysegpluszinfo').html('').hide(); 1479 } else { 1480 $('#egysegpluszinfo').html(d.warn).show(); 1481 } 1482 BT_foglalascsop.dc.change(d.adatok['__szezon'][0],d.adatok['__szezon'][1]); 1483 var optlist = ''; 1484 Object.keys(d.adatok).forEach(function(k) { 1485 if (k!=='__szezon') { 1486 optlist += '<div class="col-xs-6"><div class="checkbox checkbox-info checkbox-circle"><input type="checkbox" id="csopszallastip_'+k+'" name="szallastip_'+k+'" value="1"> <label for="csopszallastip_'+k+'">'+d.adatok[k].title+'</label></div></div>'; 1487 } 1488 }); 1489 BT_foglalascsop.hidefrom(4); 1490 $('#csopszalltipusok').html(optlist); 1491 } 1492 BT_foglalascsop.validate(); 1493 }, 1494 testdata: function() { 1495 $('#nev').val('teszt béla'); 1496 $('#email').val('[email protected]'); 1497 $('#szamla_nev').val('teszt kft'); 1498 $('#szamla_adoszam').val('HU1234758'); 1499 $('#telefon').val('0123489723'); 1500 $('#fax').val('9898293'); 1501 $('#cim_irsz').val('9999'); 1502 $('#cim_varos').val('rudapest'); 1503 $('#cim_cim').val('cimbora u. 255.'); 1504 $('#szamla_cim_irsz').val('9998'); 1505 $('#szamla_cim_varos').val('rudapest'); 1506 $('#szamla_cim_cim').val('megatron u. 55.'); 1507 $('#egyeb').val('random generator'); 1508 BT_foglalascsop.validate(); 1509 } 1510}; 1511 1512/** 1513 * Katalogus rendeles form kezeloje 1514 */ 1515var BT_katrend = { 1516 init: function() { 1517 if ($('#katrend').length>0) { 1518 ['nev','email','orszag','irsz','varos','cim'].forEach(function(fn) { 1519 $('#'+fn).change(function() { 1520 BT_katrend.validate(); 1521 }); 1522 }); 1523 $('#katrendform .btn').prop('disabled',true); 1524 $('.btfoglalerror').hide(); 1525 $('#katrendform .form-group').removeClass('has-error'); 1526 } 1527 }, 1528 validate: function() { 1529 var allok = true; 1530 $('#katrendform .btn').prop('disabled',true); 1531 $('.btfoglalerror').hide(); 1532 $('#katrendform .form-group').removeClass('has-error'); 1533 if (!$('#email').val().match(/^([a-zA-Z0-9_!,.:-]+)@([a-zA-Z0-9-]+[.][a-zA-Z0-9.-]+)$/)) { 1534 $('#error_email').show(); 1535 $('#email').closest('.form-group').addClass('has-error'); 1536 allok = false; 1537 } 1538 ['nev','irsz','varos','cim'].forEach(function(cf) { 1539 if ($('#'+cf).val()==='') { 1540 $('#error_'+cf).show(); 1541 $('#'+cf).closest('.form-group').addClass('has-error'); 1542 allok = false;
1543 } 1544 }); 1545 if (BT_katrend.captcha_ok===false) { 1546 allok = false; 1547 } 1548 if (allok===true) { 1549 $('#katrendform .btn').prop('disabled',false); 1550 } 1551 }, 1552 captcha_ok: false, 1553 captchad: function(resp) { 1554 if (resp!=='') { 1555 BT_katrend.captcha_ok = true; 1556 BT_katrend.validate(); 1557 } 1558 } 1559}; 1560 1561/** 1562 * Online checkin AJAX form kezeloje 1563 */ 1564var BT_checkin = { 1565 init: function() { 1566 if ($('#checkinform').length>0) { 1567 $('#checkin_addperson').off('click').click(function(ev) { 1568 ev.preventDefault(); 1569 BT_checkin.create_new_person(); 1570 }); 1571 $('#checkin_done').off('click').click(function(ev) { 1572 ev.preventDefault(); 1573 BT_checkin.submitdata(); 1574 }); 1575 BT_checkin.addhandlers(); 1576 BT_checkin.errors([]); 1577 } 1578 }, 1579 submitdata: function() { 1580 $('#checkin_done').prop('disabled',true); 1581 var sd = $('#checkinform').serialize(); 1582 $.ajax({ 1583 data:sd, 1584 method:'POST', 1585 url:'/ajax.php', 1586 success:function(d) { 1587 if (typeof d['state']==='undefined' || d['state']!=='ok') { 1588 WG6_forensics.displaySomething('checkin send failed'); 1589 WG6_forensics.displaySomething(d); 1590 if (typeof d['errors']!=='undefined') { 1591 BT_checkin.errors(d['errors']); 1592 } 1593 $('#checkin_done').prop('disabled',false); 1594 } else { 1595 BT_checkin.errors([]); 1596 BT_infomodals.popit('',BT_checkin_strings.success); 1597 if (typeof fbq!=='undefined') fbq('trackCustom', 'CheckinDone'); 1598 $('#checkin_done').prop('disabled',false); 1599 } 1600 }, 1601 error: function(a,b,c) { 1602 WG6_forensics.displaySomething('checkin send failed'); 1603 WG6_forensics.displaySomething(b); 1604 WG6_forensics.displaySomething(c); 1605 $('#checkin_done').prop('disabled',false); 1606 } 1607 }); 1608 }, 1609 lasterrors: [], 1610 errors: function(errs) { 1611 if (typeof errs==='undefined') { 1612 errs = BT_checkin.lasterrors; 1613 } else { 1614 BT_checkin.lasterrors = errs; 1615 } 1616 WG6_forensics.displaySomething('BT_checkin.errors:'); 1617 WG6_forensics.displaySomething(errs); 1618 $('#checkinform .btfoglalerror').hide(); 1619 $('#checkinform .has-error').removeClass('has-error'); 1620 errs.forEach(function(k) { 1621 if ($('#checkinform #error_'+k).length>0) { 1622 $('#checkinform #error_'+k).show().closest('.form-group').addClass('has-error'); 1623 } 1624 }); 1625 if (errs.length>0) { 1626 var topp = $('#checkinform .has-error').first(); 1627 if (topp.length>0) { 1628 BT_imgallpre.scrollto(topp); 1629 } 1630 } 1631 }, 1632 addhandlers: function() { 1633 $('#checkin_szemelyek a.checkin_removeperson').off('click').click(function(ev) { 1634 ev.preventDefault(); 1635 if ($('#checkin_szemelyek .checkin_szemely').length>1) { 1636 var main = $(this).closest('div.checkin_szemely'); 1637 main.find('.birthday').data("DateTimePicker").destroy(); 1638 main.remove(); 1639 } 1640 }); 1641 $('#checkin_szemelyek input.uninit-date').each(function() { 1642 var d = $(this); 1643 var dtpicklan = BT_page_lang; 1644 if (BT_page_lang==='dk') { 1645 dtpicklan = 'da'; 1646 } 1647 else if (BT_page_lang==='cz') { 1648 dtpicklan = 'cs'; 1649 } 1650 else if (BT_page_lang==='en') { 1651 dtpicklan = 'en-gb'; 1652 } 1653 let cv = d.val(); 1654 d.datetimepicker({ 1655 locale:dtpicklan, 1656 format:'YYYY-MM-DD', 1657 viewMode: 'years', 1658 minDate:'1900-01-01', 1659 maxDate:BT_current_year.toString()+'-01-01', 1660 defaultDate:cv, 1661 date:cv 1662 }); 1663 d.removeClass('uninit-date'); 1664 }); 1665 }, 1666 create_new_person: function() { 1667 var lastCountrylist1 = $('#onlinecheckin_cim_orsz').html(); 1668 var lastCountrylist2 = $('#onlinecheckin_cim_orsz').html(); 1669 var lastNemlist = $('#nem_1').html(); 1670 var lastCountry1 = $('#onlinecheckin_cim_orsz').val(); 1671 var lastCountry2 = $('#onlinecheckin_cim_orsz').val(); 1672 var lastNem = $('#nem_1').val(); 1673 var lastIrsz = $('#onlinecheckin_cim_irsz').val().replace(/"/g, ''); 1674 var lastVaros = $('#onlinecheckin_cim_varos').val().replace(/"/g, ''); 1675 var lastCim = $('#onlinecheckin_cim_cim').val().replace(/"/g, ''); 1676 var pszam = 0; 1677 $('#checkin_szemelyek .checkin_szemely').each(function() { 1678 var szam = parseInt($(this).data('checkin-index')); 1679 if (szam>pszam) pszam = szam; 1680 lastCountrylist1 = $('#orszag_'+szam).html(); 1681 lastCountry1 = $('#orszag_'+szam).val(); 1682 lastCountrylist2 = $('#lhorszag_'+szam).html(); 1683 lastCountry2 = $('#lhorszag_'+szam).val(); 1684 lastIrsz = $('#lhiszam_'+szam).val().replace(/"/g, ''); 1685 lastVaros = $('#lhvaros_'+szam).val().replace(/"/g, ''); 1686 lastCim = $('#lhcim_'+szam).val().replace(/"/g, ''); 1687 lastNemlist = $('#nem_'+szam).html(); 1688 lastNem = $('#nem_'+szam).val(); 1689 }); 1690 ++pszam; 1691 //BT_checkin_strings 1692 var html = '<div class="checkin_szemely" data-checkin-index="'+pszam.toString()+'">'; 1693 html += '<div class="row">'; 1694 html += '<div class="col-xs-6 form-group">'; 1695 html += '<label>'+BT_checkin_strings.nev+'*</label>'; 1696 html += '<input type="text" name="nev_'+pszam.toString()+'" id="nev_'+pszam.toString()+'" value="" class="form-control">'; 1697 html += '<span id="error_nev_'+pszam.toString()+'" class="help-block btfoglalerror">'+BT_checkin_strings.toltsd+'</span>'; 1698 html += '</div>'; 1699 html += '<div class="col-xs-6 form-group">'; 1700 html += '<label>'+BT_checkin_strings.igazolvany+'*</label>'; 1701 html += '<input type="text" name="igazolvanyszam_'+pszam.toString()+'" id="igazolvanyszam_'+pszam.toString()+'" value="" class="form-control">'; 1702 html += '<span id="error_igazolvanyszam_'+pszam.toString()+'" class="help-block btfoglalerror">'+BT_checkin_strings.toltsd+'</span>'; 1703 html += '</div>'; 1704 html += '</div>'; 1705 html += '<div class="row">'; 1706 html += '<div class="col-xs-4 form-group">'; 1707 html += '<label>'+BT_checkin_strings.nem+'*</label>'; 1708 html += '<select name="nem_'+pszam.toString()+'" id="nem_'+pszam.toString()+'" class="form-control">'; 1709 html += lastNemlist; 1710 html += '</select>'; 1711 html += '</div>'; 1712 html += '<div class="col-xs-4 form-group">'; 1713 html += '<label>'+BT_checkin_strings.szulhely+'*</label>'; 1714 html += '<input type="text" name="szulhely_'+pszam.toString()+'" id="szulhely_'+pszam.toString()+'" value="" class="form-control">'; 1715 html += '<span id="error_szulhely_'+pszam.toString()+'" class="help-block btfoglalerror">'+BT_checkin_strings.toltsd+'</span>'; 1716 html += '</div>'; 1717 html += '<div class="col-xs-4 form-group has-feedback">'; 1718 html += '<label>'+BT_checkin_strings.szuldatum+'*</label>'; 1719 html += '<input type="text" name="szuldatum_'+pszam.toString()+'" id="szuldatum_'+pszam.toString()+'" value="" class="form-control uninit-d
1719ate birthday"> <span class="glyphicon glyphicon-calendar form-control-feedback" aria-hidden="true"></span>'; 1720 html += '<span id="error_szuldatum_'+pszam.toString()+'" class="help-block btfoglalerror">'+BT_checkin_strings.toltsd+'</span>'; 1721 html += '</div>'; 1722 html += '</div>'; 1723 html += '<div class="row">'; 1724 html += '<div class="col-xs-12">'; 1725 html += BT_checkin_strings.lakohely; 1726 html += '</div>'; 1727 html += '</div>'; 1728 html += '<div class="row">'; 1729 html += '<div class="col-xs-6 form-group">'; 1730 html += '<label>'+BT_checkin_strings.orszag+'*</label>'; 1731 html += '<select name="lhorszag_'+pszam.toString()+'" id="lhorszag_'+pszam.toString()+'" class="form-control">'; 1732 html += lastCountrylist2; 1733 html += '</select>'; 1734 html += '</div>'; 1735 html += '<div class="col-xs-6 form-group">'; 1736 html += '<label>'+BT_checkin_strings.irsz+'*</label>'; 1737 html += '<input type="text" name="lhiszam_'+pszam.toString()+'" id="lhiszam_'+pszam.toString()+'" value="'+lastIrsz+'" class="form-control">'; 1738 html += '<span id="error_lhiszam_'+pszam.toString()+'" class="help-block btfoglalerror">'+BT_checkin_strings.toltsd+'</span>'; 1739 html += '</div>'; 1740 html += '</div>'; 1741 html += '<div class="row">'; 1742 html += '<div class="col-xs-6 form-group">'; 1743 html += '<label>'+BT_checkin_strings.varos+'*</label>'; 1744 html += '<input type="text" name="lhvaros_'+pszam.toString()+'" id="lhvaros_'+pszam.toString()+'" value="'+lastVaros+'" class="form-control">'; 1745 html += '<span id="error_lhvaros_'+pszam.toString()+'" class="help-block btfoglalerror">'+BT_checkin_strings.toltsd+'</span>'; 1746 html += '</div>'; 1747 html += '<div class="col-xs-6 form-group">'; 1748 html += '<label>'+BT_checkin_strings.cim+'*</label>'; 1749 html += '<input type="text" name="lhcim_'+pszam.toString()+'" id="lhcim_'+pszam.toString()+'" value="'+lastCim+'" class="form-control">'; 1750 html += '<span id="error_lhcim_'+pszam.toString()+'" class="help-block btfoglalerror">'+BT_checkin_strings.toltsd+'</span>'; 1751 html += '</div>'; 1752 html += '</div>'; 1753 html += '<div class="row">'; 1754 html += '<div class="col-xs-6 form-group">'; 1755 html += '<label>'+BT_checkin_strings.nationality+'*</label>'; 1756 html += '<select name="orszag_'+pszam.toString()+'" id="orszag_'+pszam.toString()+'" class="form-control">'; 1757 html += lastCountrylist1; 1758 html += '</select>'; 1759 html += '</div>'; 1760 html += '<div class="col-xs-6 form-group">'; 1761 html += '<label> </label>'; 1762 html += '<a href="#" class="checkin_removeperson btn btn-block btn-danger"><i class="fa fa-trash"></i> '+BT_checkin_strings.remove+'</a>'; 1763 html += '</div>'; 1764 html += '</div><hr>'; 1765 html += '</div>'; 1766 $('#checkin_szemelyek').append(html); 1767 $('#orszag_'+pszam).val(lastCountry1); 1768 $('#lhorszag_'+pszam).val(lastCountry2); 1769 $('#nem_'+pszam).val(lastNem); 1770 BT_checkin.addhandlers(); 1771 BT_checkin.errors(); 1772 } 1773}; 1774 1775var BT_developer = { 1776 isshown: false, 1777 init: function() { 1778 BT_developer.hide(); 1779 $('.showdeveloper-button').click(function(e) { 1780 e.preventDefault(); 1781 if (BT_developer.isshown===false) { 1782 BT_developer.show(); 1783 } else { 1784 BT_developer.hide(); 1785 } 1786 }); 1787 }, 1788 show: function() { 1789 $('.showdevonly').removeClass('hidden').show(); 1790 BT_developer.isshown = true; 1791 }, 1792 hide: function() { 1793 $('.showdevonly').hide(); 1794 BT_developer.isshown = false; 1795 } 1796} 1797BT_developer.init(); 1798 1799var BT_eredmenysorrend = { 1800 items: [], 1801 showindex: 0, 1802 showatonce: 10, 1803 allshown: false, 1804 fetching: false, 1805 init: function() { 1806 if ($('#btkeressorend').length>0) { 1807 $('.listatoltes').removeClass('hidden').removeClass('xparent').hide(); 1808 $('#keres_tovabb').removeClass('hidden').removeClass('xparent').hide().find('a').off('click').on('click',function(ev) { 1809 ev.preventDefault(); 1810 BT_eredmenysorrend.show_next_batch(); 1811 }); 1812 let van_relevancia = true, van_hossz = true, van_erkezes = true; 1813 $('#btkeresoeredmeny .egysegpreview').each(function() { 1814 let ob = { 1815 ar: $(this).data('ar'), 1816 arkalkdat: $(this).data('arkalkdat'), 1817 sorr1: $(this).data('sorrend'), 1818 sorr2: $(this).data('egysegnev'), 1819 onlinefog: $(this).hasClass('onlinefoglalhato'), 1820 relevancia: $(this).data('relevancia'), 1821 erkezes: $(this).data('erkezes'), 1822 tarthossz: $(this).data('tarthossz'), 1823 item: $(this).removeClass('hidden').removeClass('xparent').detach() 1824 }; 1825 BT_eredmenysorrend.items.push(ob); 1826 if (ob.relevancia==='') { 1827 van_relevancia = false;
1828 } 1829 if (ob.erkezes==='') { 1830 van_erkezes = false; 1831 } 1832 if (ob.tarthossz==='') { 1833 van_hossz = false; 1834 } 1835 }); 1836 console.log('debug:', 'relevancia', van_relevancia, 'erkezes', van_erkezes, 'tarthossz', van_hossz); 1837 $('.btkeressorrendval').off('click').click(function(ev) { 1838 ev.preventDefault(); 1839 $('#btkeressorend_most').html($(this).html()); 1840 BT_eredmenysorrend.reorder(parseInt($(this).data('sorrend'))); 1841 }); 1842 if (van_erkezes===true) { 1843 $('#btkeressorends').find('a[data-sorrend="2"]').parent().remove(); 1844 //$('#btkeressorends').find('a[data-sorrend="3"]').parent().remove(); 1845 $('#btkeressorends').find('a[data-sorrend="3"]').click(); 1846 } 1847 else if (van_relevancia===false) { 1848 $('#btkeressorends').find('a[data-sorrend="3"]').parent().remove(); 1849 $('#btkeressorends').find('a[data-sorrend="4"]').parent().remove(); 1850 $('#btkeressorends').find('a[data-sorrend="5"]').parent().remove(); 1851 BT_eredmenysorrend.reorder(0); 1852 } 1853 else { 1854 $('#btkeressorends').find('a[data-sorrend="2"]').parent().remove(); 1855 $('#btkeressorends').find('a[data-sorrend="4"]').parent().remove(); 1856 $('#btkeressorends').find('a[data-sorrend="5"]').parent().remove(); 1857 $('#btkeressorends').find('a[data-sorrend="3"]').click(); 1858 } 1859 // INFINITY SCROLL! 1860 $(document).on('scroll',function(e) { 1861 if (BT_eredmenysorrend.allshown===false && BT_eredmenysorrend.fetching===false) { 1862 let off = $('#keres_tovabb').offset(); 1863 let et = parseInt(off.top); 1864 let wh = parseInt($(window).height()); 1865 let sb = parseInt($(window).scrollTop()+wh); 1866 if (sb >= et-(wh/2)) { 1867 BT_eredmenysorrend.show_next_batch(); 1868 } 1869 } 1870 }); 1871 } else { 1872 $('.xparent').removeClass('xparent').show(); 1873 } 1874 }, 1875 preprecords: function(startpoint,recs) { 1876 return Promise.resolve(true); 1877 }, 1878 show_next_batch: function() { 1879 //TODO 1880 BT_eredmenysorrend.fetching = true; 1881 $('.listatoltes').show(); 1882 $('#keres_tovabb').hide(); 1883 let hasmore = true; 1884 let startat = BT_eredmenysorrend.showindex; 1885 let endat = startat+BT_eredmenysorrend.showatonce; 1886 for(var i=startat;i<endat;i++) { 1887 if (i<BT_eredmenysorrend.items.length) { 1888 $('#btkeresoeredmeny').append(BT_eredmenysorrend.items[i].item); 1889 BT_eredmenysorrend.items[i].item; 1890 } else { 1891 hasmore = false; 1892 } 1893 ++BT_eredmenysorrend.showindex; 1894 } 1895 $('.listatoltes').hide(); 1896 if (hasmore===true) { 1897 $('#keres_tovabb').show(); 1898 BT_eredmenysorrend.allshown = false; 1899 } else { 1900 BT_eredmenysorrend.allshown = true; 1901 } 1902 BT_eredmenysorrend.fetching = false; 1903 }, 1904 reorder: function(byw) { 1905 $('.listatoltes').show(); 1906 $('#keres_tovabb').hide(); 1907 $('#btkeresoeredmeny .egysegpreview').detach(); 1908 BT_eredmenysorrend.preprecords(byw,-1).then(function() { 1909 BT_eredmenysorrend.items.sort(function(a,b) { 1910 if (byw===0) { 1911 if (a.onlinefog===b.onlinefog) { 1912 return parseInt(a.ar)-parseInt(b.ar); 1913 } 1914 else if (a.onlinefog===true) { 1915 return -1; 1916 } 1917 else { 1918 return 1; 1919 } 1920 } 1921 else if (byw===1) { 1922 if (a.onlinefog===b.onlinefog) { 1923 return parseInt(b.ar)-parseInt(a.ar); 1924 } 1925 else if (a.onlinefog===true) { 1926 return -1; 1927 } 1928 else { 1929 return 1; 1930 } 1931 } 1932 else if (byw===2) { 1933 if (a.sorr1===b.sorr1) { 1934 if (a.sorr2<b.sorr2) return -1; 1935 else if (a.sorr2>b.sorr2) return 1; 1936 return 0; 1937 } else { 1938 return parseInt(a.sorr1)-parseInt(b.sorr1); 1939 } 1940 } 1941 else if (byw===3) { 1942 return parseInt(b.relevancia)-parseInt(a.relevancia); 1943 } 1944 else if (byw===4) { 1945 return parseInt(b.tarthossz)-parseInt(a.tarthossz); 1946 } 1947 else if (byw===5) { 1948 return (b.erkezes>a.erkezes) ? -1 : (b.erkezes<a.erkezes) ? 1 : 0; 1949 } 1950 }); 1951 BT_eredmenysorrend.showindex = 0; 1952 BT_eredmenysorrend.show_next_batch(); 1953 }.bind(this)); 1954 } 1955}; 1956 1957 1958/* 1959 1960getarkalkad: function(start,num) { 1961return BT_eredmenysorrend.items.slice(start,start+num).map(function(a) {return a['arkalkdat']}).filter(function(a,b,c) {return a!=='' && c.indexOf(a)===b}); 1962}, 1963preprecords: function(startpoint,recs) { 1964if (recs===-1 && startpoint<2) { 1965 return BT_eredmenysorrend.fetchprice(BT_eredmenysorrend.getarkalkad(0,BT_eredmenysorrend.items.length)); 1966} else { 1967 return BT_eredmenysorrend.fetchprice(BT_eredmenysorrend.getarkalkad(startpoint,recs)); 1968} 1969}, 1970fetchprice: function(items) { 1971return new Promise(function(succ,fail) { 1972 if (items.length===0) { 1973 succ(); 1974 } else { 1975 $.ajax({ 1976 data:sd, 1977 method:'POST', 1978 url:'/ajax.php', 1979 success:function(d) { 1980 if (typeof d['state']==='undefined' || d['state']!=='ok') { 1981 console.log('failed',d); 1982 if (typeof d['errors']!=='undefined') { 1983 BT_checkin.errors(d['errors']); 1984 } 1985 $('#checkin_done').prop('disabled',false); 1986 } else { 1987 BT_checkin.errors([]); 1988 BT_infomodals.popit('',BT_checkin_strings.success); 1989 $('#checkin_done').prop('disabled',false); 1990 } 1991 }, 1992 error: function(a,b,c) { 1993 console.log('failed',b,c); 1994 $('#checkin_done').prop('disabled',false); 1995 } 1996 }); 1997 } 1998}); 1999}, 2000 2001*/
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.