Opći uvjeti

Terms of business

1. OPĆE ODREDBE
Turistička agencija H&I Travel Agency d.o.o. za turizam (u daljnjem tekstu: H&I d.o.o.) pruža usluge smještaja u skladu s informacijama objavljenima na internetskoj stranici te opisom, uvjetima i terminima navedenima u potvrđenoj rezervaciji.
Iznimke su moguće u slučaju izvanrednih okolnosti koje nije moguće predvidjeti, izbjeći ili otkloniti, kao što su rat, nemiri, štrajkovi, teroristički napadi, sanitarne i zdravstvene izvanredne okolnosti, prirodne katastrofe, intervencije nadležnih tijela, smrt ili bolest pružatelja usluge te druge slične okolnosti.
2. REZERVACIJE I PLAĆANJA
Upiti i rezervacije smještaja zaprimaju se elektroničkim putem, pisanim putem ili osobno u poslovnici turističke agencije H&I d.o.o.
Prilikom rezervacije gost potvrđuje da je upoznat s ovim Općim uvjetima poslovanja te da ih u cijelosti prihvaća.
Prilikom rezervacije gost je dužan dostaviti sve podatke potrebne za njezinu provedbu.
Za potvrdu rezervacije smještaja potrebno je uplatiti predujam u iznosu od 30 % ukupne vrijednosti rezervacije. Preostali iznos od 70 % gost plaća prvog dana dolaska, odnosno početka boravka, izravno agenciji.
Plaćanje je moguće izvršiti i putem druge turističke agencije ili internetske platforme s kojom H&I d.o.o. ima sklopljen ugovorni odnos. U tom slučaju iznos i uvjeti plaćanja određuju se prema općim uvjetima poslovanja predmetne agencije ili platforme, kao što su Booking.com, Airbnb i druge.
Načini plaćanja rezervacije:
Bankovnom uplatom na račun agencije.
Gotovinom na prodajnim mjestima agencije.

3. TURISTIČKA PRISTOJBA
Sukladno Zakonu o turističkoj pristojbi Republike Hrvatske, gost je obvezan platiti turističku pristojbu zajedno s plaćanjem usluge smještaja, kada je njezino plaćanje primjenjivo.
U obračunu rezervacije bit će posebno naznačen iznos turističke pristojbe ili će biti navedena informacija da je turistička pristojba uključena u cijenu usluge.
Gost je također dužan platiti je

4. CIJENA SMJEŠTAJA
Cijena smještaja uključuje osnovnu uslugu smještaja navedenu u ponudi.
Posebnim uslugama smatraju se sve dodatne usluge koje nisu uključene u osnovnu cijenu smještaja te se stoga naplaćuju zasebno.
Takve usluge, primjerice korištenje klima-uređaja, perilice rublja, dječjeg krevetića i slično, potrebno je zatražiti prilikom rezervacije.
Sve cijene smještaja objavljene su u eurima (EUR).
H&I d.o.o. zadržava pravo izmjene objavljenih cijena u slučaju promjene cijena smještaja od strane pružatelja usluge ili promjene valutnih tečajeva.

5. KATEGORIZACIJA I OPIS USLUGA
Smještajne jedinice iz ponude turističke agencije opisane su u skladu sa službenom kategorizacijom, odnosno rješenjem nadležnog tijela o odobrenju pružanja usluga smještaja.
Opisi smještajnih jedinica temelje se i na uvidu u njihovo stvarno stanje u trenutku objave ponude.

6. PRAVO H&I d.o.o. NA IZMJENU I OTKAZIVANJE REZERVACIJE
H&I d.o.o. zadržava pravo izmjene rezervacije u slučaju nastupanja izvanrednih okolnosti koje nije bilo moguće predvidjeti, izbjeći ili otkloniti, kako je navedeno u članku 1. ovih Općih uvjeta poslovanja.
Rezervirani smještaj može se zamijeniti drugim smještajem isključivo uz prethodnu obavijest gostu. Zamjenski smještaj mora biti iste ili više kategorije, uz zadržavanje cijene po kojoj je gost potvrdio rezervaciju.
Ako je zamjenski smještaj moguće osigurati isključivo u objektu više kategorije, čija je cijena viša od cijene prethodno potvrđene i plaćene rezervacije, H&I d.o.o. zadržava pravo, uz prethodno savjetovanje i dogovor s gostom, naplatiti razliku u cijeni.

7. PRAVO GOSTA NA IZMJENU I OTKAZIVANJE REZERVACIJE
Ako gost želi izmijeniti ili otkazati rezervaciju koju je prethodno zatražio i potvrdio, dužan je o tome obavijestiti agenciju pisanim putem, odnosno elektroničkom poštom, poštom ili telefaksom.
Izmjenom rezervacije smatra se promjena broja osoba ili promjena datuma početka i/ili završetka korištenja usluge. Zahtjev za izmjenu potrebno je podnijeti najkasnije 30 dana prije početka korištenja usluge.
Prva izmjena rezervacije izvršit će se bez naknade ako je izmjena moguća i ne uzrokuje dodatne troškove.
Za svaku sljedeću izmjenu rezervacije naplaćuje se naknada u iznosu od 15 EUR po izmjeni.
Ako izmjena rezervacije nije moguća, a gost odluči otkazati potvrđenu rezervaciju, primjenjuju se sljedeći uvjeti otkazivanja.
Uvjeti otkazivanja rezervacije:
Od trenutka potvrde rezervacije do dana dolaska predviđena je naknada za otkazivanje u iznosu od 30 % ukupne vrijednosti rezervacije, odnosno iznos uplaćenog predujma.
U razdoblju od 14 dana prije početka korištenja usluge do dana početka korištenja usluge predviđena je naknada za otkazivanje u iznosu od 100 % ukupne vrijednosti rezervacije. U tom slučaju gostu se dodatno naplaćuje preostalih 70 % neplaćenog iznosa rezervacije.
Ako gost ne dođe u rezerviranu smještajnu jedinicu do ponoći na dan početka korištenja usluge, a o tome prethodno nije obavijestio H&I d.o.o., rezervacija se smatra otkazanom.
U tom slučaju obračunavaju se troškovi otkazivanja u skladu s prethodno navedenim uvjetima, odnosno gostu se naplaćuje ukupna vrijednost rezervacije.

8. OBVEZE H&I d.o.o.
H&I d.o.o. obvezuje se voditi brigu o pravilnoj provedbi ugovorenih usluga, odgovarajućem izboru pružatelja usluga te zaštiti prava i interesa gostiju, u skladu s dobrim poslovnim običajima u turizmu.
H&I d.o.o. obvezuje se sve navedene obveze ispuniti u cijelosti i na opisani način, osim u slučaju nastupanja izvanrednih okolnosti iz članka 1. ovih Općih uvjeta poslovanja.
U takvim okolnostima agencija će postupiti u skladu s odredbama članka 6. ovih Općih uvjeta poslovanja.

9. OBVEZE GOSTA
Gost je dužan:
Posjedovati valjane putne isprave i pravodobno provjeriti je li mu za ulazak u zemlju odredišta potrebna viza.
Pridržavati se carinskih i deviznih propisa zemlje u koju putuje.
Poštovati kućni red smještajnog objekta.
Surađivati s pružateljima usluga tijekom korištenja ugovorenih usluga.
Po dolasku na odredište predočiti agenciji potvrdu o plaćenoj usluzi, odnosno vaučer koji je prethodno zaprimio elektroničkom poštom.
U slučaju nepoštovanja navedenih obveza gost snosi nastale troškove te odgovara za štetu koju je prouzročio.
Potvrdom rezervacije gost prihvaća obvezu naknade eventualne štete koju prouzroči pružatelju usluge te je nastalu štetu dužan podmiriti na licu mjesta.

10. PRTLJAGA
H&I d.o.o. ne preuzima odgovornost za krađu prtljage ili vrijednih predmeta u smještajnom objektu.
Gubitak prtljage ili krađu potrebno je prijaviti pružatelju usluge smještaja i nadležnoj policijskoj postaji.

11. PRIGOVORI I REKLAMACIJE
Ako pružene usluge ne odgovaraju kvaliteti ili uvjetima navedenima u ponudi, gost ima pravo podnijeti pisani prigovor i zatražiti odgovarajuću naknadu.
Svaki gost ima pravo podnijeti prigovor zbog neizvršene ili neodgovarajuće izvršene plaćene usluge.
Svaki gost koji je nositelj potvrđene rezervacije podnosi prigovor zasebno.
Postupak podnošenja i rješavanja prigovora
Na dan dolaska gost je dužan prijaviti uočene nedostatke u pruženoj usluzi izravno pružatelju usluge te o tome obavijestiti H&I d.o.o.
Gost je dužan u dobroj vjeri surađivati s predstavnikom H&I d.o.o. i pružateljima usluga kako bi se otklonili razlozi prigovora i pronašlo odgovarajuće rješenje.
Ako gost na licu mjesta ne prihvati predloženo rješenje prigovora koje odgovara ugovorenoj i plaćenoj usluzi, H&I d.o.o., prema ovim uvjetima, nije obvezan prihvatiti naknadni prigovor.
Najviši iznos naknade po pojedinom prigovoru može dosegnuti vrijednost dijela usluge na koji se prigovor odnosi, ali ne može obuhvatiti već iskorištene usluge niti cjelokupnu vrijednost ugovorene usluge.
Prema ovim uvjetima, isključuje se pravo gosta na naknadu neimovinske štete.
Podnošenje pisanih prigovora potrošača
Sukladno članku 6. stavku 3. Zakona o pružanju usluga u turizmu (Narodne novine, broj 130/17), obavještavamo potrošače da pisani prigovor na kvalitetu pruženih usluga mogu podnijeti na sljedeće načine:
Poštom na adresu:
H&I Travel Agency d.o.o. za turizam
Dramalj 15 a
51265 Dramalj
Hrvatska
Elektroničkom poštom:
h.i.toursdramalj@gmail.com
h.i.toursjadranovo@gmail.com

'; printWindow.document.write(voucherHtml); printWindow.document.close(); printWindow.onload = function() { printWindow.print(); }; }); // Init to step 1 updateWizardStep(1); // Init pets checkbox to reflect includePets // Initialize Stripe Elements for embedded mode var stripeCfgInit = (typeof window.myrentStripeConfig !== 'undefined' && window.myrentStripeConfig) ? window.myrentStripeConfig : { enabled: false }; if (stripeCfgInit.enabled && stripeCfgInit.mode === 'embedded' && stripeCfgInit.publishable) { (function initStripeEmbedded() { function loadStripeJs(callback) { if (window.Stripe) { callback(); return; } var script = document.querySelector('script[src="https://js.stripe.com/v3/"]'); if (script) { script.addEventListener('load', callback); return; } script = document.createElement('script'); script.src = 'https://js.stripe.com/v3/'; script.onload = callback; document.head.appendChild(script); } loadStripeJs(function() { try { window.myrentStripe = window.Stripe(stripeCfgInit.publishable); var elements = window.myrentStripe.elements(); window.myrentStripeCard = elements.create('card', { hidePostalCode: true }); window.myrentStripeCard.mount('#stripe-card-element'); } catch (e) { console.error('Stripe init error:', e); var errEl = document.getElementById('stripe-card-errors'); if (errEl) { errEl.textContent = 'Card form could not be initialized. Please try again or use bank transfer.'; } } }); })(); } if (includePets) { jQuery('#booking-has-pets').prop('checked', true); } // Bind form submit to AJAX booking (desktop & mobile reuse) jQuery('#booking-modal').on('submit', '#booking-form', function(e) { e.preventDefault(); submitBooking(); }); } function startStripeEmbeddedPayment(fullName, hasPets, special) { var stripeCfg = (typeof window.myrentStripeConfig !== 'undefined' && window.myrentStripeConfig) ? window.myrentStripeConfig : { enabled: false }; if (!stripeCfg.enabled || stripeCfg.mode !== 'embedded' || !stripeCfg.publishable) { alert('Card payments are not available at the moment. Please use bank transfer.'); return; } var ctx = (typeof window.myrentWizardContext !== 'undefined' && window.myrentWizardContext) ? window.myrentWizardContext : {}; var depositNow = ctx.deposit || 0; if (!depositNow || depositNow <= 0) { alert('Cannot determine deposit amount for card payment.'); return; } var amountCents = Math.round(depositNow * 100); var $btn = jQuery('#booking-form button[type="submit"]'); var originalText = $btn.text(); $btn.prop('disabled', true).html(' Processing card payment...'); jQuery.ajax({ url: 'https://hitourist.travel/wp-admin/admin-ajax.php', type: 'POST', dataType: 'json', data: { // Koristimo alias action ime radi kompatibilnosti action: 'myrent_stripe_pi', amount: amountCents, currency: 'eur', object_id: jQuery('#booking-property-id').val(), checkin: jQuery('#booking-checkin').val(), checkout: jQuery('#booking-checkout').val(), guests: jQuery('#booking-guests').val() }, success: function(response) { if (!response.success || !response.data || !response.data.client_secret) { $btn.prop('disabled', false).text(originalText); alert('Unable to initialize card payment. Please try again or use bank transfer.'); return; } var clientSecret = response.data.client_secret; if (!window.myrentStripe || !window.myrentStripeCard) { $btn.prop('disabled', false).text(originalText); alert('Card form is not ready. Please try again or use bank transfer.'); return; } window.myrentStripe.confirmCardPayment(clientSecret, { payment_method: { card: window.myrentStripeCard, billing_details: { name: fullName, email: jQuery('#booking-email').val() || '' } } }).then(function(result) { if (result.error) { var errEl = document.getElementById('stripe-card-errors'); if (errEl) { errEl.textContent = result.error.message; } $btn.prop('disabled', false).text(originalText); } else if (result.paymentIntent && result.paymentIntent.status === 'succeeded') { window.myrentStripePaymentStatus = 'success'; if (!window.myrentWizardContext) { window.myrentWizardContext = {}; } window.myrentWizardContext.paymentIntentId = result.paymentIntent.id; // Nakon uspješnog plaćanja ponovno pozovi submitBooking da napravi MyRent rezervaciju $btn.prop('disabled', false).text(originalText); submitBooking(); } else { $btn.prop('disabled', false).text(originalText); alert('Card payment did not complete. Please try again or use bank transfer.'); } }); }, error: function() { $btn.prop('disabled', false).text(originalText); alert('Error initializing card payment. Please try again or use bank transfer.'); } }); } function startStripeCheckoutPayment(fullName, hasPets, special) { var stripeCfg = (typeof window.myrentStripeConfig !== 'undefined' && window.myrentStripeConfig) ? window.myrentStripeConfig : { enabled: false }; if (!stripeCfg.enabled || stripeCfg.mode !== 'checkout' || !stripeCfg.publishable) { alert("Kartično plaćanje trenutno nije dostupno. Molimo koristite bankovni prijenos."); return; } var ctx = (typeof window.myrentWizardContext !== 'undefined' && window.myrentWizardContext) ? window.myrentWizardContext : {}; var depositNow = ctx.deposit || 0; if (!depositNow || depositNow <= 0) { alert("Nije moguće odrediti iznos depozita za kartično plaćanje."); return; } var amountCents = Math.round(depositNow * 100); // Store booking context in localStorage so we can auto-create MyRent booking after redirect try { var checkoutContext = { propertyId: jQuery('#booking-property-id').val(), checkin: jQuery('#booking-checkin').val(), checkout: jQuery('#booking-checkout').val(), guests: jQuery('#booking-guests').val(), total_price: jQuery('#booking-total-price').val(), fullName: fullName, email: jQuery('#booking-email').val(), phone: jQuery('#booking-phone').val(), country: jQuery('#booking-country').val(), hasPets: hasPets, special: special, source: 'desktop' }; if (window.localStorage) { window.localStorage.setItem('myrent_stripe_checkout_ctx', JSON.stringify(checkoutContext)); } } catch (e) { if (window.console) { console.error('Stripe Checkout context store error:', e); } } var $btn = jQuery('#booking-form button[type="submit"]'); var originalText = $btn.text(); $btn.prop('disabled', true).html(' Obrada plaćanja karticom...'); jQuery.ajax({ url: 'https://hitourist.travel/wp-admin/admin-ajax.php', type: 'POST', dataType: 'json', data: { action: 'myrent_stripe_create_checkout_session', amount: amountCents, currency: 'eur', object_id: jQuery('#booking-property-id').val(), checkin: jQuery('#booking-checkin').val(), checkout: jQuery('#booking-checkout').val(), guests: jQuery('#booking-guests').val() }, success: function(response) { if (!response.success || !response.data || !response.data.url) { $btn.prop('disabled', false).text(originalText); alert("Nije moguće pokrenuti plaćanje karticom. Pokušajte ponovno ili koristite bankovni prijenos."); return; } // Redirect to Stripe Checkout URL window.location.href = response.data.url; }, error: function() { $btn.prop('disabled', false).text(originalText); alert("Pogreška pri pokretanju plaćanja karticom. Pokušajte ponovno ili koristite bankovni prijenos."); } }); } // v3.9.286: Export showBookingWizardModal to window for booking-desktop.js window.showBookingWizardModal = showBookingWizardModal; // Legacy showBookingModal function is no longer used (kept for backwards compatibility) function showBookingModal(propertyId, checkIn, checkOut, guests, petsChoice) { showBookingWizardModal(propertyId, checkIn, checkOut, guests, petsChoice); } // React to wizard success to switch to step 3 window.addEventListener('bookingWizardSuccess', function() { if (jQuery('#booking-modal .booking-step.step-3').length) { if (typeof window.myrentUpdateWizardStep === 'function') { window.myrentUpdateWizardStep(3); } else { jQuery('#booking-modal .booking-step').hide().removeClass('active'); jQuery('#booking-modal .booking-step.step-3').show().addClass('active'); jQuery('#booking-modal .booking-step-indicator').each(function() { var s = jQuery(this).data('step'); if (s < 3) { jQuery(this).css('opacity', 1).find('span:first').css('background', '#38a169').css('color', '#fff'); } else if (s === 3) { jQuery(this).css('opacity', 1).find('span:first').css('background', '#c8a35f').css('color', '#fff'); } else { jQuery(this).css('opacity', 0.6).find('span:first').css('background', '#e2e8f0').css('color', '#4a5568'); } }); } // If guest portal URL is available, populate link box var portalUrl = jQuery('#booking-modal').data('guest-portal-url'); if (portalUrl) { jQuery('#booking-guest-portal-link').attr('href', portalUrl); jQuery('#booking-guest-portal').show(); jQuery('#booking-guest-portal-link-button').attr('href', portalUrl).show(); } // v3.9.234: Store booking data for voucher download window.desktopBookingData = { property: jQuery('#booking-modal h2:first').text() || '', dates: jQuery('#booking-modal').data('checkin') + ' - ' + jQuery('#booking-modal').data('checkout'), nights: jQuery('#booking-modal').data('nights') || '', guests: jQuery('#booking-modal').data('guests') || '', guestName: jQuery('#booking-full-name').val() || '', total: jQuery('#booking-modal').data('total') || '', guestPortalUrl: portalUrl || null }; } }); function getBookingIdempotencyKey(scope) { window.myrentBookingIdempotencyKeys = window.myrentBookingIdempotencyKeys || {}; if (!window.myrentBookingIdempotencyKeys[scope]) { if (window.crypto && typeof window.crypto.randomUUID === 'function') { window.myrentBookingIdempotencyKeys[scope] = window.crypto.randomUUID(); } else { window.myrentBookingIdempotencyKeys[scope] = 'booking-' + Date.now() + '-' + Math.random().toString(36).slice(2, 14); } } return window.myrentBookingIdempotencyKeys[scope]; } function clearBookingIdempotencyKey(scope) { if (window.myrentBookingIdempotencyKeys) { delete window.myrentBookingIdempotencyKeys[scope]; } } window.myrentGetBookingIdempotencyKey = getBookingIdempotencyKey; window.myrentClearBookingIdempotencyKey = clearBookingIdempotencyKey; // Submit booking to MyRent API function submitBooking() { var fullName = (jQuery('#booking-full-name').val() || '').trim(); var hasPets = jQuery('#booking-has-pets').length && jQuery('#booking-has-pets').is(':checked') ? 1 : 0; var special = jQuery('#booking-special').val() || ''; // Payment method selected in step 2 var paymentMethod = 'bank'; if (typeof window.myrentWizardContext !== 'undefined' && window.myrentWizardContext && window.myrentWizardContext.paymentMethod) { paymentMethod = window.myrentWizardContext.paymentMethod; } else if (jQuery('input[name="booking-payment-method"]').length) { paymentMethod = jQuery('input[name="booking-payment-method"]:checked').val() || 'bank'; } else if (jQuery('#booking-payment-method-hidden').length) { paymentMethod = jQuery('#booking-payment-method-hidden').val() || 'bank'; } // Ako je kartično plaćanje i Stripe embedded omogućen, prvo obavi Stripe plaćanje var stripeCfg = (typeof window.myrentStripeConfig !== 'undefined' && window.myrentStripeConfig) ? window.myrentStripeConfig : { enabled: false }; if (paymentMethod === 'card' && stripeCfg.enabled) { if (stripeCfg.mode === 'embedded' && !window.myrentStripePaymentStatus) { startStripeEmbeddedPayment(fullName, hasPets, special); return; } if (stripeCfg.mode === 'checkout') { startStripeCheckoutPayment(fullName, hasPets, special); return; } } if (window.myrentBookingSubmitting) { return; } window.myrentBookingSubmitting = true; // Append payment info to special requests so MyRent vidi čime gost želi platiti var cfg = (typeof window.myrentPaymentConfig !== 'undefined' && window.myrentPaymentConfig) ? window.myrentPaymentConfig : {}; if (paymentMethod === 'bank') { special = (special ? special + "\n\n" : '') + 'Payment method: Bank transfer'; } else if (paymentMethod === 'card') { var gwLabel = cfg.cardGateway || 'stripe'; special = (special ? special + "\n\n" : '') + 'Payment method: Credit card (' + gwLabel + ')'; } // debug removed: submitBooking paymentMethod var formData = { action: 'create_booking', property_id: jQuery('#booking-property-id').val(), checkin: jQuery('#booking-checkin').val(), checkout: jQuery('#booking-checkout').val(), guests: jQuery('#booking-guests').val(), total_price: jQuery('#booking-total-price').val(), guest_name: fullName, guest_email: jQuery('#booking-email').val(), guest_phone: jQuery('#booking-phone').val(), guest_country: jQuery('#booking-country').val(), special_requests: special, pets: hasPets, promo_code: (window.myrentPromoCode && typeof window.myrentPromoCode === 'string') ? window.myrentPromoCode : '', payment_method: paymentMethod, idempotency_key: getBookingIdempotencyKey('desktop') }; var $btn = jQuery('#booking-form button[type="submit"]'); var originalText = $btn.text(); $btn.prop('disabled', true).html(' Kreiram rezervaciju...'); jQuery.ajax({ url: 'https://hitourist.travel/wp-admin/admin-ajax.php', type: 'POST', data: formData, success: function(response) { if (response.success) { clearBookingIdempotencyKey('desktop'); window.myrentBookingSubmitting = false; // On success, move wizard to step 3 (confirmation) if (jQuery('#booking-modal .booking-step.step-3').length) { // Pohrani osnovne podatke za voucher i step 3 var ctx = (typeof window.myrentWizardContext !== 'undefined' && window.myrentWizardContext) ? window.myrentWizardContext : {}; var step3PaymentMethod = ctx.paymentMethod || 'bank'; window.desktopBookingData = window.desktopBookingData || {}; window.desktopBookingData.property = ctx.propertyName || (typeof propertyData !== 'undefined' ? propertyData.name : ''); window.desktopBookingData.dates = moment(jQuery('#booking-checkin').val()).format('DD.MM.YYYY') + ' - ' + moment(jQuery('#booking-checkout').val()).format('DD.MM.YYYY'); window.desktopBookingData.nights = (searchParams && searchParams.nights) ? searchParams.nights : ctx.nights || nights; window.desktopBookingData.guests = jQuery('#booking-guests').val(); window.desktopBookingData.total = Math.round(ctx.total || effectiveTotal); // Ako je odabran bank transfer, prikaži bankovne podatke u step 3 if (step3PaymentMethod === 'bank') { var cfgBank = (typeof window.myrentPaymentConfig !== 'undefined' && window.myrentPaymentConfig) ? window.myrentPaymentConfig : {}; var bankHtml = ''; bankHtml += '
'; bankHtml += '
Bank transfer payment details
'; var amountNow = ctx.deposit || (window.myrentDepositDetails && window.myrentDepositDetails.amount ? window.myrentDepositDetails.amount : 0); bankHtml += '
Amount to pay now: €' + Math.round(amountNow) + '
'; if (cfgBank.bankCompanyName) bankHtml += '
Company: ' + cfgBank.bankCompanyName + '
'; if (cfgBank.bankVatId) bankHtml += '
VAT ID / OIB: ' + cfgBank.bankVatId + '
'; if (cfgBank.bankAddress) bankHtml += '
Address: ' + cfgBank.bankAddress + '
'; if (cfgBank.bankAccountName) bankHtml += '
Bank account: ' + cfgBank.bankAccountName + '
'; if (cfgBank.bankIban) bankHtml += '
IBAN: ' + cfgBank.bankIban + '
'; if (cfgBank.bankSwift) bankHtml += '
SWIFT/BIC: ' + cfgBank.bankSwift + '
'; bankHtml += '
Please include your name and booking dates as payment reference.
'; bankHtml += '
'; jQuery('#booking-modal .booking-step.step-3').prepend(bankHtml); } var payload = response.data || {}; // attach booking info for step 3 (booking_id, rent_id if provided) if (payload.booking_id) { jQuery('#booking-modal').data('booking-id', payload.booking_id); } if (payload.rent_id) { jQuery('#booking-modal').data('rent-id', payload.rent_id); } if (payload.guest_portal_url) { jQuery('#booking-modal').data('guest-portal-url', payload.guest_portal_url); } var event = new Event('bookingWizardSuccess'); window.dispatchEvent(event); } else { alert('✅ ' + response.data.message); closeBookingModal(); location.reload(); } } else { alert('❌ ' + response.data.message); window.myrentBookingSubmitting = false; $btn.prop('disabled', false).text(originalText); } }, error: function() { alert('Error creating reservation. Please try again.'); window.myrentBookingSubmitting = false; $btn.prop('disabled', false).text(originalText); } }); } // Close booking modal function closeBookingModal() { jQuery('#booking-modal').remove(); jQuery('body').css('overflow', ''); } // v3.7.5: NEW Two-Month Calendar with Prices, Min Stay, and Changeover Days function generateAvailabilityCalendar() { var container = jQuery('#calendar-months-container'); if (container.length === 0) { container = jQuery('#availability-calendar'); } if (container.length === 0) { return; } var propertyId = container.closest('[data-property-id]').data('property-id') || (typeof propertyData !== 'undefined' ? propertyData.id : ''); if (!propertyId) { container.html('
Property ID nije pronađen.
'); return; } window.calendarContainer = container; window.calendarPropertyId = propertyId; container.html('
Loading calendar...
'); // v3.7.8: Wait for calendar rules (loaded via AJAX in single-property.php) jQuery(document).off('myrentCalendarRulesLoaded.newcal').on('myrentCalendarRulesLoaded.newcal', function() { // Start from first available check-in date if (window.myrentFirstAvailableCheckin) { window.currentCalendarStart = moment(window.myrentFirstAvailableCheckin).startOf('month'); } else { window.currentCalendarStart = moment().startOf('month'); } renderTwoMonthCalendar(); }); // If rules already loaded, render immediately if (window.myrentCalendarRulesLoaded && window.myrentCalendarRules) { if (window.myrentFirstAvailableCheckin) { window.currentCalendarStart = moment(window.myrentFirstAvailableCheckin).startOf('month'); } else { window.currentCalendarStart = moment().startOf('month'); } renderTwoMonthCalendar(); } else { // Wait max 3 seconds for rules, then show basic calendar setTimeout(function() { if (!window.myrentCalendarRulesLoaded) { window.currentCalendarStart = moment().startOf('month'); renderTwoMonthCalendar(); } }, 3000); } } // v3.7.17: Render calendar - two months on desktop, one month on mobile with nav arrows function renderTwoMonthCalendar() { var container = window.calendarContainer || jQuery('#calendar-months-container'); if (!container.length) return; var isMobile = window.innerWidth <= 768; var monthsToShow = isMobile ? 1 : 2; var html = '
'; var startMonth = window.currentCalendarStart || moment().startOf('month'); // Generate months for (var i = 0; i < monthsToShow; i++) { var month = startMonth.clone().add(i, 'months'); var isFirst = (i === 0); var isLast = (i === monthsToShow - 1); html += generateFullMonthCalendar(month, isFirst, isLast, isMobile); } html += '
'; // Add legend html += '
'; html += '
Available
'; html += '
Booked
'; html += '
Changeover
'; html += '
Fixed check-in day
'; html += '
'; container.html(html); // Bind click events for date selection bindCalendarClicks(); } // v3.7.17: Helper function to check if a day is booked/unavailable function isDayBooked(dateStr) { if (!window.myrentCalendarRules || !window.myrentCalendarRules[dateStr]) { return false; } var rule = window.myrentCalendarRules[dateStr]; return rule.is_booked || !rule.free; } // v3.7.17: Generate single month with navigation arrows in header function generateFullMonthCalendar(month, showPrev, showNext, isMobile) { var monthNames = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']; var weekdays = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']; var html = '
'; html += '
'; // v3.7.17: Add prev arrow on first month if (showPrev) { html += ''; } else if (!isMobile) { html += ''; } html += '' + monthNames[month.month()] + ' ' + month.format('YYYY') + ''; // v3.7.17: Add next arrow on last month (or on mobile single month) if (showNext || isMobile) { html += ''; } else if (!isMobile) { html += ''; } html += '
'; html += '
'; weekdays.forEach(function(day) { html += '
' + day + '
'; }); html += '
'; html += '
'; var firstDay = month.clone().startOf('month'); var lastDay = month.clone().endOf('month'); var startOffset = firstDay.day(); // 0 = Sunday // Empty cells before first day for (var i = 0; i < startOffset; i++) { html += '
'; } var today = moment(); for (var day = 1; day <= lastDay.date(); day++) { var currentDate = month.clone().date(day); var dateStr = currentDate.format('YYYY-MM-DD'); var isPast = currentDate.isBefore(today, 'day'); var isToday = currentDate.isSame(today, 'day'); // v3.7.13: Get data from myrentCalendarRules (loaded via AJAX in single-property.php) var rule = (window.myrentCalendarRules && window.myrentCalendarRules[dateStr]) ? window.myrentCalendarRules[dateStr] : null; var price = rule ? (rule.price || 0) : 0; var minStay = rule ? (parseInt(rule.min_stay, 10) || 1) : 1; var isFree = rule ? rule.free : true; var isBooked = rule ? rule.is_booked : false; var canCheckIn = rule ? rule.check_in : true; var canCheckOut = rule ? rule.check_out : true; // v3.7.13: Calculate transition days based on adjacent days var prevDateStr = currentDate.clone().subtract(1, 'day').format('YYYY-MM-DD'); var nextDateStr = currentDate.clone().add(1, 'day').format('YYYY-MM-DD'); var prevDayBooked = isDayBooked(prevDateStr); var currentDayBooked = isBooked || !isFree; var nextDayBooked = isDayBooked(nextDateStr); // v3.7.13: CHANGEOVER DAY LOGIC (corrected): // A "changeover" day is when guests check OUT in the morning and new guests check IN in the afternoon // API marks this day as "booked" but it's actually available for new check-in // 1. CHECKOUT-POSITION (Changeover day - guests leaving): // Day is marked as BOOKED but PREVIOUS day was FREE // = This is the checkout day of a reservation (guests leave morning, new can arrive) // = Diagonal: green top-left → red bottom-right (↘) // = Clickable as both CHECKOUT and CHECK-IN date var isCheckoutPosition = currentDayBooked && !prevDayBooked && !isPast; // 2. CHECKIN-POSITION (Day after checkout): // Day is FREE but PREVIOUS day was BOOKED // = First fully free day after a booking ends // = Diagonal: red top-left → green bottom-right (↗) // = Clickable as CHECK-IN date var isCheckinPosition = !currentDayBooked && prevDayBooked && !isPast; // Build CSS classes var classes = 'cal-day'; if (isPast) { classes += ' past'; } else if (isCheckoutPosition) { // Changeover day - checkout morning, checkin afternoon // Show diagonal ↘ (green→red) - this day is available for new booking classes += ' checkout-position available'; } else if (isCheckinPosition) { // Day after booking ends - diagonal ↗ (red→green) classes += ' checkin-position available'; } else if (currentDayBooked) { classes += ' unavailable'; } else if (!canCheckIn && isFree) { classes += ' checkout-only available'; } else if (isFree) { classes += ' available'; } if (isToday) classes += ' today'; // v3.7.13: Check-in/out allowed on changeover days and free days if ((canCheckIn && !currentDayBooked) || isCheckoutPosition) classes += ' can-checkin'; if ((canCheckOut && !currentDayBooked) || isCheckoutPosition) classes += ' can-checkout'; html += '
'; html += '
' + day + '
'; // Show price if available and not past (show on changeover days too) if (price > 0 && !isPast && (!currentDayBooked || isCheckoutPosition)) { html += '
€' + Math.round(price) + '
'; } // Show min_stay if > 1 and can check-in (including changeover days) if (minStay > 1 && (canCheckIn || isCheckoutPosition) && (!currentDayBooked || isCheckoutPosition)) { html += '
min ' + minStay + '
'; } html += '
'; } html += '
'; return html; } // v3.7.12: Bind click events for selecting dates function bindCalendarClicks() { jQuery('.cal-day.available, .cal-day.checkin-position, .cal-day.checkout-position').off('click').on('click', function() { var $day = jQuery(this); var dateStr = $day.data('date'); var canCheckin = $day.hasClass('can-checkin'); // v3.7.2: Get booking pattern for messages var bookingPattern = getCalendarBookingPattern(); if (!canCheckin && !window.myrentCalSelectedCheckin) { // Can't start booking on non-checkin day var dayNames = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']; var selectedDay = dayNames[moment(dateStr).day()]; var message = 'Check-in is not allowed on ' + selectedDay + '.'; if (bookingPattern) { message += '\n\nThis property requires ' + bookingPattern + ' bookings.'; } message += '\n\nPlease select a valid check-in day.'; alert(message); return; } if (!window.myrentCalSelectedCheckin) { // First click - select check-in window.myrentCalSelectedCheckin = dateStr; $day.addClass('selected-checkin'); jQuery('.cal-day').removeClass('in-range selected-checkout'); } else { // Second click - select check-out var checkinMoment = moment(window.myrentCalSelectedCheckin); var checkoutMoment = moment(dateStr); if (checkoutMoment.isSameOrBefore(checkinMoment)) { // Reset and start over jQuery('.cal-day').removeClass('selected-checkin selected-checkout in-range'); window.myrentCalSelectedCheckin = dateStr; $day.addClass('selected-checkin'); return; } // Validate min_stay var nights = checkoutMoment.diff(checkinMoment, 'days'); var minStay = parseInt(jQuery('.cal-day[data-date="' + window.myrentCalSelectedCheckin + '"]').data('minstay')) || 1; if (nights < minStay) { var message = 'Minimum stay for this period is ' + minStay + ' nights.'; message += '\nYou selected ' + nights + ' night' + (nights !== 1 ? 's' : '') + '.'; message += '\n\nPlease select at least ' + minStay + ' nights.'; alert(message); return; } // Check if checkout is allowed on this day var canCheckout = $day.hasClass('can-checkout'); if (!canCheckout) { var dayNames = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']; var selectedDay = dayNames[checkoutMoment.day()]; var message = 'Check-out is not allowed on ' + selectedDay + '.'; if (bookingPattern) { message += '\n\nThis property requires ' + bookingPattern + ' bookings.'; } message += '\n\nPlease select a valid check-out day.'; alert(message); return; } // v3.7.12: Validate that all days in range are available (no booked days in between) var blockedDates = checkForBlockedDatesInRange(checkinMoment, checkoutMoment); if (blockedDates.length > 0) { var message = 'The selected period contains unavailable dates:\n\n'; blockedDates.forEach(function(d) { message += '• ' + moment(d).format('DD.MM.YYYY') + '\n'; }); message += '\nPlease select a period without booked dates.'; alert(message); return; } // Valid selection - mark checkout and highlight range $day.addClass('selected-checkout'); highlightRange(window.myrentCalSelectedCheckin, dateStr); // Update the daterangepicker input and calculate price updateDatepickerFromCalendar(window.myrentCalSelectedCheckin, dateStr, nights); } }); } // v3.7.12: Check if there are any blocked/booked dates in the selected range function checkForBlockedDatesInRange(startMoment, endMoment) { var blockedDates = []; var current = startMoment.clone().add(1, 'day'); // Start from day after check-in while (current.isBefore(endMoment, 'day')) { var dateStr = current.format('YYYY-MM-DD'); // Check if this date is booked/unavailable if (window.myrentCalendarRules && window.myrentCalendarRules[dateStr]) { var rule = window.myrentCalendarRules[dateStr]; if (rule.is_booked || !rule.free) { blockedDates.push(dateStr); } } current.add(1, 'day'); } return blockedDates; } // v3.7.2: Get booking pattern from calendar rules function getCalendarBookingPattern() { if (!window.myrentCalendarRules) return null; var dayNames = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']; var checkinDays = {}; var dates = Object.keys(window.myrentCalendarRules).slice(0, 30); dates.forEach(function(dateStr) { var rule = window.myrentCalendarRules[dateStr]; if (rule.check_in && rule.free && !rule.is_booked) { var dayOfWeek = moment(dateStr).day(); checkinDays[dayOfWeek] = (checkinDays[dayOfWeek] || 0) + 1; } }); var maxCount = 0; var dominantDay = -1; Object.keys(checkinDays).forEach(function(day) { if (checkinDays[day] > maxCount) { maxCount = checkinDays[day]; dominantDay = parseInt(day); } }); if (dominantDay >= 0 && maxCount >= 3) { return dayNames[dominantDay] + ' to ' + dayNames[dominantDay]; } return null; } // v3.7.0: Highlight range between check-in and check-out function highlightRange(startDate, endDate) { var start = moment(startDate); var end = moment(endDate); jQuery('.cal-day').removeClass('in-range'); jQuery('.cal-day').each(function() { var $day = jQuery(this); var dayDate = moment($day.data('date')); if (dayDate.isAfter(start) && dayDate.isBefore(end)) { $day.addClass('in-range'); } }); } // v3.7.2: Update daterangepicker input from calendar selection AND calculate price function updateDatepickerFromCalendar(checkin, checkout, nights) { var checkinMoment = moment(checkin); var checkoutMoment = moment(checkout); // Update desktop datepicker var $desktopPicker = jQuery('#property-daterange'); if ($desktopPicker.length && $desktopPicker.data('daterangepicker')) { var picker = $desktopPicker.data('daterangepicker'); picker.setStartDate(checkinMoment); picker.setEndDate(checkoutMoment); $desktopPicker.val(checkinMoment.format('DD.MM.YYYY') + ' - ' + checkoutMoment.format('DD.MM.YYYY')); } // Update mobile datepicker var $mobilePicker = jQuery('#mobile-daterange'); if ($mobilePicker.length && $mobilePicker.data('daterangepicker')) { var mobilePicker = $mobilePicker.data('daterangepicker'); mobilePicker.setStartDate(checkinMoment); mobilePicker.setEndDate(checkoutMoment); $mobilePicker.val(checkinMoment.format('DD.MM.YYYY') + ' - ' + checkoutMoment.format('DD.MM.YYYY')); } // v3.7.5: Calculate and display price var checkinDisplay = checkinMoment.format('DD.MM.YYYY'); var checkoutDisplay = checkoutMoment.format('DD.MM.YYYY'); var nightsLabel = nights === 1 ? 'night' : 'nights'; jQuery.ajax({ url: 'https://hitourist.travel/wp-admin/admin-ajax.php', type: 'POST', data: { action: 'get_property_price', property_id: window.calendarPropertyId, checkin: checkin, checkout: checkout }, success: function(response) { if (response.success && response.data && response.data.total_price > 0) { var price = parseFloat(response.data.total_price); var responseNights = parseInt(response.data.nights) || nights; var pricePerNight = Math.round(price / responseNights); // Update #price-total-amount and related elements directly jQuery('#price-total-amount').text('€' + Math.round(price).toLocaleString()); jQuery('#price-period-info').text(checkinDisplay + ' → ' + checkoutDisplay); jQuery('#price-breakdown-info').text(responseNights + ' ' + nightsLabel + ' × €' + pricePerNight + ' per night'); jQuery('#booking-total-price-display').fadeIn(); // Update total price display widget (if function exists) if (typeof window.updateTotalPriceDisplay === 'function') { window.updateTotalPriceDisplay(checkinDisplay, checkoutDisplay, responseNights, price); } // Update booking period price display updateCalendarPriceDisplay(checkinMoment, checkoutMoment, responseNights, price); // v3.7.15: Store validated dates globally for booking - BOTH objects window.myrentValidatedBooking = { checkin: checkin, checkout: checkout, nights: responseNights, price: price, valid: true }; // v3.7.15: Also update searchParams for proceedToBooking function window.searchParams = { checkin: checkin, checkout: checkout, guests: window.searchParams ? (window.searchParams.guests || 2) : 2, nights: responseNights, totalPrice: price }; // console.log('💰 Price stored in searchParams:', window.searchParams); // console.log('💰 Price stored in myrentValidatedBooking:', window.myrentValidatedBooking); // v3.7.22: Store selected dates for mobile modal window.calendarSelectedDates = { checkin: checkin, checkout: checkout, nights: responseNights, totalPrice: price }; // console.log('📱 [CALENDAR] calendarSelectedDates set:', window.calendarSelectedDates); // v3.7.23: Update mobile floating button with selected price and change text var $mobileFloat = jQuery('#mobile-booking-float'); // console.log('📱 [CALENDAR] Mobile float button found:', $mobileFloat.length > 0); if ($mobileFloat.length) { $mobileFloat.addClass('has-dates'); // Update price display jQuery('#mobile-float-nights').text(responseNights + (responseNights === 1 ? ' night' : ' nights')); jQuery('#mobile-float-amount').text('€' + Math.round(price).toLocaleString()); jQuery('#mobile-float-period').text(''); // Change button text and icon jQuery('#mobile-float-text').text('Book Now'); jQuery('#mobile-float-icon').removeClass('fa-calendar').addClass('fa-check'); // console.log('📱 [CALENDAR] Mobile float button updated - price:', price, ', text: Book Now'); } // v3.7.23: Check if mobile view - open modal instead of scrolling var isMobile = window.innerWidth < 992; // console.log('📱 [CALENDAR] Is mobile view:', isMobile, '(width:', window.innerWidth, ')'); // console.log('📱 [CALENDAR] openMobileBooking function exists:', typeof openMobileBooking === 'function'); // console.log('📱 [CALENDAR] window.openMobileBooking exists:', typeof window.openMobileBooking === 'function'); if (isMobile) { // On mobile: open booking modal directly // console.log('📱 [CALENDAR] Attempting to open mobile modal...'); setTimeout(function() { if (typeof openMobileBooking === 'function') { // console.log('📱 [CALENDAR] Calling openMobileBooking()'); openMobileBooking(); } else if (typeof window.openMobileBooking === 'function') { // console.log('📱 [CALENDAR] Calling window.openMobileBooking()'); window.openMobileBooking(); } else { console.error('📱 [CALENDAR] ERROR: openMobileBooking function not found!'); // Fallback: try to show modal directly var $modal = jQuery('#mobile-booking-modal'); if ($modal.length) { // console.log('📱 [CALENDAR] Fallback: showing modal directly'); $modal.css('display', 'flex'); document.body.style.overflow = 'hidden'; } } }, 300); } else { // On desktop: scroll to booking card // console.log('📱 [CALENDAR] Desktop view - scrolling to booking card'); setTimeout(function() { var $bookingCard = jQuery('.booking-card'); if ($bookingCard.length) { jQuery('html, body').animate({ scrollTop: $bookingCard.offset().top - 100 }, 800); // Pulse the Book Now button var $bookBtn = $bookingCard.find('.btn-success, button[type="submit"]'); if ($bookBtn.length) { $bookBtn.addClass('pulse-animation'); setTimeout(function() { $bookBtn.removeClass('pulse-animation'); }, 2000); } // Show confirmation hint - v3.9.72: Compact inline hint that doesn't push content if (jQuery('.calendar-booking-hint').length === 0) { // Add hint AFTER the date selector, not at top var $dateSelector = $bookingCard.find('.booking-dates, #booking-dates-display, .date-selector').first(); if ($dateSelector.length) { $dateSelector.after('
Dates selected! Click "Book Now" below.
'); } else { $bookingCard.find('.booking-widget-content, .card-body').first().prepend('
Dates selected! Click "Book Now" below.
'); } setTimeout(function() { jQuery('.calendar-booking-hint').fadeOut(function() { jQuery(this).remove(); }); }, 4000); } } }, 300); } } else { jQuery('#booking-total-price-display').fadeOut(); window.myrentValidatedBooking = { valid: false }; } }, error: function(xhr, status, error) { window.myrentValidatedBooking = { valid: false }; } }); } // v3.7.5: Update price display from calendar function updateCalendarPriceDisplay(startDate, endDate, nights, price) { // Remove existing price display jQuery('.booking-period-price').remove(); var nightsLabel = nights === 1 ? 'night' : 'nights'; var pricePerNight = Math.round(price / nights); var html = '
'; html += '
'; html += '
'; html += ''; html += startDate.format('DD.MM.YYYY') + ' → ' + endDate.format('DD.MM.YYYY'); html += '
'; html += '
'; html += '€' + Math.round(price).toLocaleString(); html += '
'; html += '
'; html += nights + ' ' + nightsLabel + ' × €' + pricePerNight + '/night'; html += '
'; html += '
'; html += '
'; jQuery('.price-display').after(html); } // Navigation functions function previousMonth() { window.currentCalendarStart = window.currentCalendarStart.subtract(1, 'month'); window.myrentCalSelectedCheckin = null; renderTwoMonthCalendar(); } function nextMonth() { window.currentCalendarStart = window.currentCalendarStart.add(1, 'month'); window.myrentCalSelectedCheckin = null; renderTwoMonthCalendar(); } // v3.7.17: Make navigation functions global window.previousMonth = previousMonth; window.nextMonth = nextMonth; // v3.7.17: Re-render calendar on window resize (for mobile/desktop switch) var resizeTimer; jQuery(window).on('resize', function() { clearTimeout(resizeTimer); resizeTimer = setTimeout(function() { if (jQuery('#calendar-months-container').length > 0) { renderTwoMonthCalendar(); } }, 250); }); // Initialize calendar if (jQuery('#calendar-months-container').length > 0 || jQuery('#availability-calendar').length > 0) { if (typeof moment !== 'undefined') { generateAvailabilityCalendar(); } else { setTimeout(function() { if (typeof moment !== 'undefined') { generateAvailabilityCalendar(); } }, 100); } }