{"id":246,"date":"2016-06-25T23:26:49","date_gmt":"2016-06-25T20:26:49","guid":{"rendered":"http:\/\/hotel.veagles.ee\/?page_id=246"},"modified":"2025-11-20T13:00:36","modified_gmt":"2025-11-20T10:00:36","slug":"booking","status":"publish","type":"page","link":"https:\/\/veagles.ee\/en\/gallery\/booking\/","title":{"rendered":"Booking"},"content":{"rendered":"<p><\/p>\n<div style=\"font-family: 'Times New Roman', Times, serif; max-width: 1000px; margin: 0 auto; padding: 30px; background: #fff8e9; border-radius: 15px; box-shadow: 0 8px 25px rgba(0,0,0,0.15); line-height: 1.7;\">\n<h2 style=\"text-align: center; color: #ad0a25; margin-bottom: 25px;\">\ud83d\udcc5 \u0411\u0440\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043d\u043e\u043c\u0435\u0440\u043e\u0432 Guest House VEAGLES<\/h2>\n<div style=\"background: #fff5e6; border-left: 6px solid #ad0a25; padding: 25px; border-radius: 10px; box-shadow: 0 4px 12px rgba(0,0,0,0.05); margin-bottom: 30px;\">\n<h3 style=\"color: #ad0a25; margin-bottom: 15px; text-align: center;\">\ud83d\udcdd \u041e\u043d\u043b\u0430\u0439\u043d \u0431\u0440\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435<\/h3>\n<form id=\"bookingForm\" style=\"max-width: 600px; margin: 0 auto;\"><label>\u0412\u0430\u0448\u0435 \u0438\u043c\u044f<\/label><br \/>\n<input style=\"width: 100%; padding: 10px; margin-bottom: 15px;\" name=\"name\" required=\"\" type=\"text\" \/><label>E-mail<\/label><br \/>\n<input style=\"width: 100%; padding: 10px; margin-bottom: 15px;\" name=\"email\" required=\"\" type=\"email\" \/><\/p>\n<p><label>\u0422\u0435\u043b\u0435\u0444\u043e\u043d<\/label><br \/>\n<input style=\"width: 100%; padding: 10px; margin-bottom: 15px;\" name=\"phone\" required=\"\" type=\"tel\" \/><\/p>\n<p><label>\u0414\u0430\u0442\u0430 \u0437\u0430\u0435\u0437\u0434\u0430<\/label><br \/>\n<input id=\"checkin\" style=\"width: 100%; padding: 10px; margin-bottom: 15px;\" name=\"checkin\" required=\"\" type=\"date\" \/><\/p>\n<p><label>\u0414\u0430\u0442\u0430 \u0432\u044b\u0435\u0437\u0434\u0430<\/label><br \/>\n<input id=\"checkout\" style=\"width: 100%; padding: 10px; margin-bottom: 15px;\" name=\"checkout\" required=\"\" type=\"date\" \/><\/p>\n<p><label>\u041a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u044f \u043d\u043e\u043c\u0435\u0440\u0430<\/label><br \/>\n<select id=\"roomCategory\" style=\"width: 100%; padding: 10px; margin-bottom: 15px;\" name=\"roomCategory\" required=\"\"><option value=\"\">\u0412\u044b\u0431\u0435\u0440\u0438\u0442\u0435 \u043d\u043e\u043c\u0435\u0440<\/option><\/select><\/p>\n<p><label>\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0433\u043e\u0441\u0442\u0435\u0439<\/label><br \/>\n<input id=\"guests\" style=\"width: 100%; padding: 10px; margin-bottom: 15px;\" min=\"1\" name=\"guests\" required=\"\" type=\"number\" \/><\/p>\n<p><!-- \u0417\u0430\u0449\u0438\u0442\u0430 \u043e\u0442 \u0431\u043e\u0442\u043e\u0432 --><br \/>\n<label>\u0421\u043a\u043e\u043b\u044c\u043a\u043e \u0431\u0443\u0434\u0435\u0442 3 + 4?<\/label><br \/>\n<input id=\"antibot\" style=\"width: 100%; padding: 10px; margin-bottom: 15px;\" required=\"\" type=\"number\" \/><\/p>\n<div id=\"priceInfo\" style=\"margin-bottom: 15px; font-weight: bold; color: #1e90ff;\"><\/div>\n<p><button style=\"background-color: #ad0a25; color: #fff; font-size: 18px; padding: 12px 25px; border: none; border-radius: 8px; cursor: pointer; width: 100%;\" type=\"submit\">\u041e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0431\u0440\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435<\/button><\/p>\n<\/form>\n<\/div>\n<\/div>\n<p><script>\n\/\/ \u0414\u0430\u043d\u043d\u044b\u0435 \u043d\u043e\u043c\u0435\u0440\u043e\u0432 \u0441 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u044b\u0445 \u043d\u043e\u043c\u0435\u0440\u043e\u0432\nconst roomsData = [\n  { id: 'STANDARD', name: '\u0414\u0432\u0443\u0445\u043c\u0435\u0441\u0442\u043d\u044b\u0439 STANDARD DBL\/SNG', maxGuests: 2, price: 59, available: 3 },\n  { id: 'IMPROVED', name: '\u0414\u0432\u0443\u0445\u043c\u0435\u0441\u0442\u043d\u044b\u0439 \u0443\u043b\u0443\u0447\u0448\u0435\u043d\u043d\u044b\u0439', maxGuests: 2, price: 69, available: 3 },\n  { id: 'FAMILY', name: '\u0422\u0440\u0451\u0445\u043c\u0435\u0441\u0442\u043d\u044b\u0439 FAMILY ROOM', maxGuests: 4, price: 95, available: 1 },\n  { id: 'IMPROVED3', name: '\u0422\u0440\u0451\u0445\u043c\u0435\u0441\u0442\u043d\u044b\u0439 \u0443\u043b\u0443\u0447\u0448\u0435\u043d\u043d\u044b\u0439', maxGuests: 3, price: 100, available: 1 },\n  { id: 'FRIENDS', name: '\u0422\u0440\u0451\u0445\u043c\u0435\u0441\u0442\u043d\u044b\u0439 ROOM FOR FRIENDS', maxGuests: 3, price: 100, available: 1 }\n];<\/p>\n<p>const roomCategory = document.getElementById('roomCategory');\nconst guestsInput = document.getElementById('guests');\nconst checkinInput = document.getElementById('checkin');\nconst checkoutInput = document.getElementById('checkout');\nconst priceInfo = document.getElementById('priceInfo');\nconst bookingForm = document.getElementById('bookingForm');<\/p>\n<p>\/\/ \u0417\u0430\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u0441\u0435\u043b\u0435\u043a\u0442 \u043d\u043e\u043c\u0435\u0440\u0430\u043c\u0438\nfunction populateRooms() {\n  roomCategory.innerHTML = '<option value=\"\">\u0412\u044b\u0431\u0435\u0440\u0438\u0442\u0435 \u043d\u043e\u043c\u0435\u0440<\/option>';\n  roomsData.forEach(room => {\n    const option = document.createElement('option');\n    option.value = room.id;\n    option.textContent = `${room.name} (${room.maxGuests} \u0433\u043e\u0441\u0442\u044f) \u2013 ${room.price} \u20ac (${room.available} \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u043e)`;\n    option.dataset.maxguests = room.maxGuests;\n    option.dataset.price = room.price;\n    option.dataset.available = room.available;\n    roomCategory.appendChild(option);\n  });\n}\npopulateRooms();<\/p>\n<p>\/\/ \u041e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u043c \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0435 \u043f\u043e \u0433\u043e\u0441\u0442\u044f\u043c\nroomCategory.addEventListener('change', updateGuestsLimit);\nguestsInput.addEventListener('input', updatePrice);\ncheckinInput.addEventListener('change', updatePrice);\ncheckoutInput.addEventListener('change', updatePrice);<\/p>\n<p>function updateGuestsLimit() {\n  const selected = roomCategory.selectedOptions[0];\n  if (!selected) return;\n  const maxGuests = parseInt(selected.dataset.maxguests);\n  guestsInput.max = maxGuests;\n  if (guestsInput.value > maxGuests) guestsInput.value = maxGuests;\n  updatePrice();\n}<\/p>\n<p>\/\/ \u0420\u0430\u0441\u0447\u0435\u0442 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u043d\u043e\u0447\u0435\u0439\nfunction calculateNights() {\n  const checkin = new Date(checkinInput.value);\n  const checkout = new Date(checkoutInput.value);\n  if (!checkinInput.value || !checkoutInput.value) return 0;\n  const diff = (checkout - checkin) \/ (1000 * 60 * 60 * 24);\n  return diff > 0 ? diff : 0;\n}<\/p>\n<p>\/\/ \u041e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u0446\u0435\u043d\u044b\nfunction updatePrice() {\n  const selected = roomCategory.selectedOptions[0];\n  if (!selected) {\n    priceInfo.textContent = '';\n    return;\n  }\n  const nights = calculateNights();\n  if (nights === 0) {\n    priceInfo.textContent = '';\n    return;\n  }\n  const basePrice = parseFloat(selected.dataset.price);\n  const total = basePrice * nights;\n  const tax = total * 0.13;\n  const totalWithTax = total + tax;\n  priceInfo.textContent = `\u041d\u043e\u0447\u0435\u0439: ${nights}, \u0426\u0435\u043d\u0430: ${total.toFixed(2)} \u20ac, \u041d\u0430\u043b\u043e\u0433 13%: ${tax.toFixed(2)} \u20ac, \u0418\u0442\u043e\u0433\u043e: ${totalWithTax.toFixed(2)} \u20ac`;\n}<\/p>\n<p>\/\/ \u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e\u0441\u0442\u0438 \u043d\u043e\u043c\u0435\u0440\u043e\u0432 \u043d\u0430 \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u044b\u0435 \u0434\u0430\u0442\u044b\nfunction checkAvailability() {\n  \/\/ \u0417\u0434\u0435\u0441\u044c \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0440\u0435\u0430\u043b\u044c\u043d\u0443\u044e \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u043f\u043e \u0434\u0430\u0442\u0430\u043c \u0441 \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u043c\n  \/\/ \u041f\u043e\u043a\u0430 \u0434\u0435\u043b\u0430\u0435\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u0438\u0437\u0443\u0430\u043b\u044c\u043d\u043e\u0435 \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u0435, \u0435\u0441\u043b\u0438 \u0432\u0441\u0435 \u043d\u043e\u043c\u0435\u0440\u0430 \u0437\u0430\u043d\u044f\u0442\u044b\n  roomsData.forEach(room => {\n    const option = roomCategory.querySelector(`option[value=\"${room.id}\"]`);\n    if (room.available <= 0) {\n      option.disabled = true;\n      option.textContent += ' (\u0437\u0430\u043d\u044f\u0442\u043e)';\n    }\n  });\n}\n\ncheckAvailability();\n\nbookingForm.addEventListener('submit', function(e) {\n  e.preventDefault();\n\n  \/\/ \u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0430\u043d\u0442\u0438-\u0431\u043e\u0442\u0430\n  if (parseInt(document.getElementById('antibot').value) !== 7) {\n    alert('\u041e\u0448\u0438\u0431\u043a\u0430 \u0437\u0430\u0449\u0438\u0442\u044b \u043e\u0442 \u0431\u043e\u0442\u043e\u0432.');\n    return;\n  }\n\n  const selected = roomCategory.selectedOptions[0];\n  if (!selected || parseInt(selected.dataset.available) <= 0) { alert('\u0412\u044b\u0431\u0440\u0430\u043d\u043d\u0430\u044f \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u044f \u043d\u043e\u043c\u0435\u0440\u043e\u0432 \u043d\u0435\u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0430.'); return; } const formData = new FormData(bookingForm); const data = {}; formData.forEach((value, key) => data[key] = value);\n  data['roomName'] = selected.textContent;\n  data['priceInfo'] = priceInfo.textContent;<\/p>\n<p>  \/\/ \u041e\u0442\u043f\u0440\u0430\u0432\u043a\u0430 \u043d\u0430 Formspree\n  fetch('https:\/\/formspree.io\/f\/\u0412\u0410\u0428_FORM_ID', {\n    method: 'POST',\n    headers: { 'Content-Type': 'application\/json' },\n    body: JSON.stringify(data)\n  })\n  .then(res => {\n    if (res.ok) {\n      alert('\u0411\u0440\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043e!');\n      bookingForm.reset();\n      priceInfo.textContent = '';\n    } else {\n      alert('\u041e\u0448\u0438\u0431\u043a\u0430 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u0444\u043e\u0440\u043c\u044b.');\n    }\n  })\n  .catch(err => alert('\u041e\u0448\u0438\u0431\u043a\u0430: ' + err));\n});\n<\/script><\/p>","protected":false},"excerpt":{"rendered":"<p>\ud83d\udcc5 \u0411\u0440\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043d\u043e\u043c\u0435\u0440\u043e\u0432 Guest House VEAGLES \ud83d\udcdd \u041e\u043d\u043b\u0430\u0439\u043d \u0431\u0440\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0412\u0430\u0448\u0435 \u0438\u043c\u044f E-mail \u0422\u0435\u043b\u0435\u0444\u043e\u043d \u0414\u0430\u0442\u0430 \u0437\u0430\u0435\u0437\u0434\u0430 \u0414\u0430\u0442\u0430 \u0432\u044b\u0435\u0437\u0434\u0430 \u041a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u044f \u043d\u043e\u043c\u0435\u0440\u0430 \u0412\u044b\u0431\u0435\u0440\u0438\u0442\u0435 \u043d\u043e\u043c\u0435\u0440 \u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0433\u043e\u0441\u0442\u0435\u0439 \u0421\u043a\u043e\u043b\u044c\u043a\u043e \u0431\u0443\u0434\u0435\u0442 3 + 4? \u041e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0431\u0440\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435<\/p>\n","protected":false},"author":2,"featured_media":0,"parent":31,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_uf_show_specific_survey":0,"_uf_disable_surveys":false,"two_page_speed":{"previous_score":{"desktop_score":89,"desktop_tti":"1.4\u00a0","mobile_score":68,"mobile_tti":"6.0\u00a0","date":"20.11.2025 12:58:26 pm","status":"completed"},"current_score":{"desktop_score":91,"desktop_tti":"1.3\u00a0","mobile_score":63,"mobile_tti":"7.5\u00a0","date":"20.11.2025 01:33:30 pm","status":"completed"}},"footnotes":""},"class_list":["post-246","page","type-page","status-publish","hentry"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/veagles.ee\/en\/wp-json\/wp\/v2\/pages\/246","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/veagles.ee\/en\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/veagles.ee\/en\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/veagles.ee\/en\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/veagles.ee\/en\/wp-json\/wp\/v2\/comments?post=246"}],"version-history":[{"count":18,"href":"https:\/\/veagles.ee\/en\/wp-json\/wp\/v2\/pages\/246\/revisions"}],"predecessor-version":[{"id":2059,"href":"https:\/\/veagles.ee\/en\/wp-json\/wp\/v2\/pages\/246\/revisions\/2059"}],"up":[{"embeddable":true,"href":"https:\/\/veagles.ee\/en\/wp-json\/wp\/v2\/pages\/31"}],"wp:attachment":[{"href":"https:\/\/veagles.ee\/en\/wp-json\/wp\/v2\/media?parent=246"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}