Build Folder Added
This commit is contained in:
1 parent
ac1d53e183
commit
df428196d6
14 files changed
+10051
No files matched your search
@@ -0,0 +1,69 @@
|
|||||||
|
.container {
|
||||||
|
width: 100%;
|
||||||
|
margin-right: auto;
|
||||||
|
margin-left: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (min-width: 576px) {
|
||||||
|
.container {
|
||||||
|
max-width: 540px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* .calenderField {
|
||||||
|
display: block !important;
|
||||||
|
visibility:hidden
|
||||||
|
} */
|
||||||
|
@media (min-width: 768px) {
|
||||||
|
.container {
|
||||||
|
max-width: 950px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (min-width: 992px) {
|
||||||
|
.container {
|
||||||
|
max-width: 960px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (min-width: 1200px) {
|
||||||
|
.container {
|
||||||
|
max-width: 1280px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@media (min-width: 1200px) and (max-width: 1300px) {
|
||||||
|
.container {
|
||||||
|
max-width: 1200px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.toaster-card {
|
||||||
|
position: fixed;
|
||||||
|
z-index: 999999;
|
||||||
|
pointer-events: none;
|
||||||
|
top: 15px;
|
||||||
|
right: 15px;
|
||||||
|
padding: 10px 15px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
border-radius: 4px;
|
||||||
|
color: white;
|
||||||
|
box-shadow: 0 0 12px #999;
|
||||||
|
width: 300px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.toaster-card img {
|
||||||
|
margin-right: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.toast-success {
|
||||||
|
background-color: #51a351;
|
||||||
|
}
|
||||||
|
|
||||||
|
.toast-error {
|
||||||
|
background-color: #bd362f;
|
||||||
|
}
|
||||||
|
|
||||||
|
.toast-warning {
|
||||||
|
background-color: #f89406;
|
||||||
|
}
|
||||||
|
|
||||||
Vendored
+2941
File diff suppressed because it is too large.
Load diff
+102
@@ -0,0 +1,102 @@
|
|||||||
|
.selectData {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.airlineSel {
|
||||||
|
font-size: 12px;
|
||||||
|
border-radius: 1px solid #0000ff59;
|
||||||
|
border-radius: 15px;
|
||||||
|
background: #b1c8dd;
|
||||||
|
padding: 3px 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.SearchBox {
|
||||||
|
border: 1px solid black;
|
||||||
|
/* width: 300px; */
|
||||||
|
height: 30px;
|
||||||
|
cursor: pointer;
|
||||||
|
border-radius: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.SelectList {
|
||||||
|
display: none;
|
||||||
|
width: 300px;
|
||||||
|
position: relative;
|
||||||
|
overflow: auto;
|
||||||
|
background-color: gainsboro;
|
||||||
|
color: black;
|
||||||
|
}
|
||||||
|
|
||||||
|
.SelectList input {
|
||||||
|
width: 93%;
|
||||||
|
border: 1px solid #858585;
|
||||||
|
border-radius: 5px;
|
||||||
|
padding: 6px 10px;
|
||||||
|
}
|
||||||
|
.ShowAirline{
|
||||||
|
display: block !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.SelectList div {
|
||||||
|
position: sticky;
|
||||||
|
top: 0;
|
||||||
|
padding: 8px;
|
||||||
|
background-color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ListItem {
|
||||||
|
list-style-type: none;
|
||||||
|
padding: 0;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
.ListItem li {
|
||||||
|
padding: 10px;
|
||||||
|
background-color: #fff;
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
.ListItem li:not(:last-child) {
|
||||||
|
border-bottom: 1px solid gray;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
.ListItem {
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
.ShowAirlineList {
|
||||||
|
display: block !important;
|
||||||
|
border: 1px solid #939393;
|
||||||
|
border-radius: 5px;
|
||||||
|
}
|
||||||
|
.multiSelect {
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
.ShowAirlineList {
|
||||||
|
position: absolute;
|
||||||
|
top: 91.8%;
|
||||||
|
}
|
||||||
|
.airlinelist {
|
||||||
|
font-size: 13px;
|
||||||
|
margin: pa;
|
||||||
|
margin: 0px 5px;
|
||||||
|
background: #3f4fa2;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
width: 100%;
|
||||||
|
justify-content: space-between;
|
||||||
|
padding-left: 5px;
|
||||||
|
border-radius: 5px;
|
||||||
|
color: #fff;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
.airlinelist button {
|
||||||
|
background: #3f4fa2;
|
||||||
|
border: none;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
.inputMultiSelectBox {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
margin-left: 20px;
|
||||||
|
}
|
||||||
|
.multiInp {
|
||||||
|
width: 300px;
|
||||||
|
}
|
||||||
+1732
File diff suppressed because it is too large.
Load diff
Binary file not shown.
|
After Width: | Height: | Size: 235 B |
Binary file not shown.
|
After Width: | Height: | Size: 328 B |
Binary file not shown.
|
After Width: | Height: | Size: 47 KiB |
@@ -0,0 +1,161 @@
|
|||||||
|
// using window for hide div
|
||||||
|
|
||||||
|
window.addEventListener('mouseup', function (event) {
|
||||||
|
if (!event.target.matches('.TravelDropdown')) {
|
||||||
|
var container = document.getElementById('TravellerCount');
|
||||||
|
if (!container.contains(event.target)) {
|
||||||
|
container.classList.add('travel-content');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
if (!event.target.matches('.dropdown-content')) {
|
||||||
|
var dropdowns = document.getElementsByClassName("dropdown-content");
|
||||||
|
var i;
|
||||||
|
for (i = 0; i < dropdowns.length; i++) {
|
||||||
|
var openDropdown = dropdowns[i];
|
||||||
|
if (openDropdown.classList.contains('show')) {
|
||||||
|
openDropdown.classList.remove('show');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
if (!event.target.matches('.depart-content')) {
|
||||||
|
var dropdowns = document.getElementsByClassName("depart-content");
|
||||||
|
var i;
|
||||||
|
for (i = 0; i < dropdowns.length; i++) {
|
||||||
|
var openDropdown = dropdowns[i];
|
||||||
|
|
||||||
|
if (openDropdown.classList.contains('showdepart')) {
|
||||||
|
openDropdown.classList.remove('showdepart');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
if (!event.target.matches('.tawakkal')) {
|
||||||
|
var dropdowns = document.getElementsByClassName("calenderField");
|
||||||
|
var i;
|
||||||
|
for (i = 0; i < dropdowns.length; i++) {
|
||||||
|
var openDropdown = dropdowns[i];
|
||||||
|
if (event.target != dropdowns && event.target.parentNode != dropdowns) {
|
||||||
|
if (openDropdown.classList.contains('showCalender')) {
|
||||||
|
openDropdown.classList.remove('showCalender');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
if (!event.target.matches('.HotelNationality')) {
|
||||||
|
var dropdowns = document.getElementsByClassName("HotelNationality");
|
||||||
|
var i;
|
||||||
|
for (i = 0; i < dropdowns.length; i++) {
|
||||||
|
var openDropdown = dropdowns[i];
|
||||||
|
if (event.target != dropdowns && event.target.parentNode != dropdowns) {
|
||||||
|
if (!openDropdown.classList.contains('hideInput')) {
|
||||||
|
openDropdown.classList.add('hideInput');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
if (!event.target.matches('.HotelDestination')) {
|
||||||
|
var dropdowns = document.getElementsByClassName("HotelDestination");
|
||||||
|
var i;
|
||||||
|
for (i = 0; i < dropdowns.length; i++) {
|
||||||
|
var openDropdown = dropdowns[i];
|
||||||
|
if (event.target != dropdowns && event.target.parentNode != dropdowns) {
|
||||||
|
if (!openDropdown.classList.contains('hideInput')) {
|
||||||
|
openDropdown.classList.add('hideInput');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
if (!event.target.matches('.PrefAirline-two')) {
|
||||||
|
var container = document.getElementsByClassName('SelectList')[0];
|
||||||
|
if (!container.contains(event.target)) {
|
||||||
|
container.classList.remove('ShowAirlineList');
|
||||||
|
container.querySelector('input').value = '';
|
||||||
|
}
|
||||||
|
};
|
||||||
|
if (!event.target.matches('.PrefAirline-one')) {
|
||||||
|
var dropdowns = document.getElementsByClassName("PrefAirline-one")[0].querySelector('.SelectList');
|
||||||
|
if (dropdowns.classList.contains('ShowAirlineList')) {
|
||||||
|
dropdowns.classList.remove('ShowAirlineList');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
if (!event.target.matches('.roomPaxDetails')) {
|
||||||
|
var container = document.getElementsByClassName('roomPaxDetails')[0];
|
||||||
|
if (!container.contains(event.target)) {
|
||||||
|
container.classList.remove('showRoomPax');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
// hotel and Flight tabs hide and show
|
||||||
|
|
||||||
|
function openTab(cityName, elmnt) {
|
||||||
|
|
||||||
|
// CallCalendar()
|
||||||
|
var i, tabcontent, tablinks;
|
||||||
|
tabcontent = document.getElementsByClassName("tabcontent");
|
||||||
|
for (i = 0; i < tabcontent.length; i++) {
|
||||||
|
tabcontent[i].style.display = "none";
|
||||||
|
}
|
||||||
|
tablinks = document.getElementsByClassName("tablink");
|
||||||
|
for (i = 0; i < tablinks.length; i++) {
|
||||||
|
tablinks[i].style.backgroundColor = "";
|
||||||
|
}
|
||||||
|
document.getElementById(elmnt).style.display = "block";
|
||||||
|
// elmnt.style.backgroundColor = color;
|
||||||
|
document.getElementById("flight_button").classList.remove('active');
|
||||||
|
document.getElementById("hotel_button").classList.remove('active')
|
||||||
|
document.getElementById(cityName).classList.add('active');
|
||||||
|
document.getElementById('target').classList.remove('d-none');
|
||||||
|
document.getElementById(elmnt).classList.remove('d-none');
|
||||||
|
document.querySelector('.mobileName').innerHTML = elmnt;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
document.getElementById("flight_button").click();
|
||||||
|
|
||||||
|
// flight all tabs hide and show
|
||||||
|
|
||||||
|
(function () {
|
||||||
|
var d = document,
|
||||||
|
tabs = d.querySelector('.SearchTripTypeTabs'),
|
||||||
|
tab = d.querySelectorAll('li'),
|
||||||
|
contents = d.querySelectorAll('.content');
|
||||||
|
tabs.addEventListener('click', function (e) {
|
||||||
|
if (e.target && e.target.nodeName === 'LI') {
|
||||||
|
// change tabs
|
||||||
|
for (var i = 0; i < tab.length; i++) {
|
||||||
|
tab[i].classList.remove('active1');
|
||||||
|
}
|
||||||
|
e.target.classList.toggle('active1');
|
||||||
|
|
||||||
|
|
||||||
|
for (i = 0; i < contents.length; i++) {
|
||||||
|
contents[i].classList.remove('active1');
|
||||||
|
}
|
||||||
|
var tabId = '#' + e.target.dataset.tabId;
|
||||||
|
d.querySelector(tabId).classList.toggle('active1');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
})();
|
||||||
|
|
||||||
|
function closeALLTab(elem) {
|
||||||
|
document.getElementById('target').classList.add('d-none')
|
||||||
|
document.getElementById('hotel_button').classList.remove('active')
|
||||||
|
document.getElementById('flight_button').classList.remove('active')
|
||||||
|
console.log(elem)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,748 @@
|
|||||||
|
let airportlist = [];
|
||||||
|
let TravellerDetails = {
|
||||||
|
classType: 'Economy',
|
||||||
|
Adult: 1,
|
||||||
|
child: 0,
|
||||||
|
Infant: 0,
|
||||||
|
};
|
||||||
|
PaxCount('', '');
|
||||||
|
bindMultiCityFrom();
|
||||||
|
bindMultiCityFrom();
|
||||||
|
GetAirportList(undefined, null);
|
||||||
|
let AdvanceShowBtn = false
|
||||||
|
let advancedSerch = true;
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
async function GetAirportList(element, check) {
|
||||||
|
let inpVal = check ? element.value ? element.value : 'BOM' : 'BOM';
|
||||||
|
if (inpVal.length >= 3) {
|
||||||
|
const response = await fetch("https://adminapi.uat.futuretravelplatform.com/api/MasterSearch/GetAllMasterSearch/en/" + inpVal, {
|
||||||
|
method: 'GET',
|
||||||
|
headers: { 'Content-Type': 'application/json', 'OrgId': '2206040706597097092' }
|
||||||
|
});
|
||||||
|
if (!response.ok) {
|
||||||
|
throw new Error(`HTTP error! status: ${response.status}`);
|
||||||
|
}
|
||||||
|
const data = await response.json();
|
||||||
|
airportlist = await data;
|
||||||
|
autobind(element, check, airportlist);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
function autobind(element, check, obj) {
|
||||||
|
check ? check == '0' ? element.closest(".searchBox").querySelector(".dropdown-content").classList.add('show') : element.closest(".searchBox").querySelector(".depart-content").classList.add('showdepart') : '';
|
||||||
|
let html = '';
|
||||||
|
let airlist = obj ? obj : airportlist;
|
||||||
|
airlist.map(e => {
|
||||||
|
html += ` <li class="dropdown-item" onclick="ApplyAirport(this)" data-city-name=${e.ct} data-airport-name=${e.an} data-airport-code=${e.ac}
|
||||||
|
data-country-code = ${e.cc}>
|
||||||
|
<div class="autoCompleteIcon">
|
||||||
|
<svg focusable="false" color="inherit" fill="currentcolor" aria-hidden="true"
|
||||||
|
role="presentation" viewBox="0 0 150 150" preserveAspectRatio="xMidYMid meet"
|
||||||
|
width="24px" height="24px" class="sc-bxivhb dttlRz sc-jxGEyO iICATY">
|
||||||
|
<path
|
||||||
|
d="M118.9 15.7L90.7 43.9l-80.9-25c-1.6-.4-3.3 0-4.6 1.1L.7 24.5c-.9.8-.9 2.1-.2 3 .2.2.4.3.6.4l65.2 40.4-24 24c-3.8 3.7-7.2 7.8-10.2 12.2l-18.2-5c-1.6-.4-3.3.1-4.6 1.2l-3.5 3.5c-1 .8-1 2.3-.2 3.3l.4.4 18.6 13.9.6.5-.2.5c-1.8 3.7-1.2 4.3 2.5 2.5l.5-.2c.2.2.3.4.5.6l13.9 18.6c.7 1 2.2 1.3 3.2.6.1-.1.3-.2.4-.3l3.5-3.5c1.1-1.3 1.6-3 1.2-4.6l-5-18.2c4.4-3 8.5-6.4 12.2-10.2l24-24 40.1 64.7c.6 1 1.8 1.4 2.8.8.2-.1.4-.3.6-.4l4.5-4.5c1.1-1.2 1.5-3 1.1-4.6l-24.9-80.3 28.4-28.4C150 15.9 152 4.9 148.7 1.6S134.4.2 118.9 15.7z">
|
||||||
|
</path>
|
||||||
|
</svg>
|
||||||
|
</div>
|
||||||
|
<div class="ListTypeCity">
|
||||||
|
<span> ${e.ct}</span>
|
||||||
|
<span>
|
||||||
|
${e.an}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<span class="airportCode">${e.ac}</span>
|
||||||
|
</li>`
|
||||||
|
});
|
||||||
|
element ? element.closest(".searchBox").querySelector(".dropdown-wrapper").innerHTML = html : '';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function ApplyAirport(element) {
|
||||||
|
let city_name = element.getAttribute("data-city-name");
|
||||||
|
let code = element.getAttribute("data-airport-code");
|
||||||
|
element.closest(".search-border").querySelector('input').value = city_name;
|
||||||
|
element.closest(".search-border").querySelector('input').setAttribute("data-airport-code", code);
|
||||||
|
let container = element.closest(".search-border").querySelector('input')
|
||||||
|
if (!container.classList.contains('Origin')) {
|
||||||
|
let nextform = element.closest('.MultiForm') ? element.closest('.MultiForm').nextElementSibling : '';
|
||||||
|
if (nextform) {
|
||||||
|
if (nextform.querySelector('.Origin')) {
|
||||||
|
nextform.querySelector('.Origin').value = city_name
|
||||||
|
nextform.querySelector('.Origin').setAttribute("data-airport-code", code)
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// advancedField()
|
||||||
|
function advancedField(elem) {
|
||||||
|
console.log('asd')
|
||||||
|
console.log(elem)
|
||||||
|
elem.querySelector('.expand-less').classList.add('d-none');
|
||||||
|
elem.querySelector('.expand-more').classList.add('d-none');
|
||||||
|
if (advancedSerch) {
|
||||||
|
advancedSerch = false;
|
||||||
|
elem.closest('div').querySelector(".expander_more").classList.remove('d-none');
|
||||||
|
elem.querySelector('.expand-less').classList.remove('d-none');
|
||||||
|
} else {
|
||||||
|
advancedSerch = true;
|
||||||
|
elem.closest('div').querySelector(".expander_more").classList.add('d-none');
|
||||||
|
elem.querySelector('.expand-more').classList.remove('d-none');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function PaxCount(pax, btn_name) {
|
||||||
|
let Adul_num = parseInt(document.getElementById("adult").value);
|
||||||
|
let child_Num = parseInt(document.getElementById("child").value);
|
||||||
|
let Infant_child = parseInt(document.getElementById("infant").value);
|
||||||
|
let adult_minus_btn = document.getElementsByClassName("adult_minus_btn")[0];
|
||||||
|
let adult_plus_btn = document.getElementsByClassName("adult_plus_btn")[0];
|
||||||
|
let child_plus_btn = document.getElementsByClassName("child_plus_btn")[0];
|
||||||
|
let child_minus_btn = document.getElementsByClassName("child_minus_btn")[0];
|
||||||
|
let infant_plus_btn = document.getElementsByClassName("infant_plus_btn")[0];
|
||||||
|
let infant_minus_btn = document.getElementsByClassName("infant_minus_btn")[0];
|
||||||
|
if (btn_name == 'add') {
|
||||||
|
if (pax == "adult" || pax == "child") {
|
||||||
|
if (Adul_num + child_Num < 9) {
|
||||||
|
document.getElementById(pax).value = parseInt(document.getElementById(pax).value) + 1
|
||||||
|
Adul_num = parseInt(document.getElementById('adult').value);
|
||||||
|
child_Num = parseInt(document.getElementById('child').value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (pax == "infant") {
|
||||||
|
if (Infant_child < Adul_num) {
|
||||||
|
document.getElementById(pax).value = parseInt(document.getElementById(pax).value) + 1
|
||||||
|
Infant_child = parseInt(document.getElementById(pax).value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (pax == "adult") {
|
||||||
|
if (Adul_num > 1) {
|
||||||
|
document.getElementById(pax).value = parseInt(document.getElementById(pax).value) - 1
|
||||||
|
Adul_num--;
|
||||||
|
}
|
||||||
|
if (Infant_child > Adul_num) {
|
||||||
|
if (btn_name == 'remove') {
|
||||||
|
document.getElementById('infant').value = Infant_child - 1;
|
||||||
|
Infant_child--
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (pax == "child") {
|
||||||
|
if (child_Num > 0) {
|
||||||
|
document.getElementById(pax).value = parseInt(document.getElementById(pax).value) - 1;
|
||||||
|
child_Num--;
|
||||||
|
}
|
||||||
|
} else if (pax == "infant") {
|
||||||
|
if (Infant_child > 0) {
|
||||||
|
document.getElementById(pax).value = parseInt(document.getElementById(pax).value) - 1;
|
||||||
|
Infant_child = parseInt(document.getElementById(pax).value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Adul_num == 1 ? adult_minus_btn.classList.add("disableBtn") : adult_minus_btn.classList.remove("disableBtn");
|
||||||
|
child_Num == 0 ? child_minus_btn.classList.add('disableBtn') : child_minus_btn.classList.remove('disableBtn');
|
||||||
|
Infant_child == 0 ? infant_minus_btn.classList.add("disableBtn") : infant_minus_btn.classList.remove("disableBtn");
|
||||||
|
if (Adul_num + child_Num == 9) {
|
||||||
|
adult_plus_btn.classList.add('disableBtn');
|
||||||
|
child_plus_btn.classList.add("disableBtn");
|
||||||
|
} else {
|
||||||
|
adult_plus_btn.classList.remove('disableBtn');
|
||||||
|
child_plus_btn.classList.remove("disableBtn");
|
||||||
|
}
|
||||||
|
if (Infant_child == Adul_num) infant_plus_btn.classList.add("disableBtn")
|
||||||
|
else infant_plus_btn.classList.remove('disableBtn');
|
||||||
|
|
||||||
|
|
||||||
|
let travel_no1 = Adul_num + (child_Num + Infant_child);
|
||||||
|
let paxSearch = document.getElementsByClassName('TravelerClassCount')
|
||||||
|
for (let i = 0; i < paxSearch.length; i++) {
|
||||||
|
paxSearch[i].innerHTML = `
|
||||||
|
<h4>${travel_no1} Traveller</h4>
|
||||||
|
<h4>${TravellerDetails.classType}</h4>`
|
||||||
|
};
|
||||||
|
TravellerDetails.Adult = Adul_num;
|
||||||
|
TravellerDetails.child = child_Num;
|
||||||
|
TravellerDetails.Infant = Infant_child;
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
function ClassType(Btn, name) {
|
||||||
|
document.querySelectorAll('.classBtn').forEach(box => box.classList.remove('classTypeBorder'));
|
||||||
|
Btn.classList.add('classTypeBorder');
|
||||||
|
TravellerDetails.classType = name;
|
||||||
|
PaxCount('', '');
|
||||||
|
};
|
||||||
|
|
||||||
|
// traveller div show and hide
|
||||||
|
|
||||||
|
function ShowPaxCounter() {
|
||||||
|
document.getElementById('TravellerCount').classList.remove('travel-content');
|
||||||
|
document.getElementById('TravellerCount').classList.remove('d-none')
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function ApplyTraveller() {
|
||||||
|
document.getElementById('TravellerCount').classList.add('travel-content');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/// multi city
|
||||||
|
|
||||||
|
function bindMultiCityFrom() {
|
||||||
|
var searchList = document.querySelectorAll(".MultiForm");
|
||||||
|
let html = ''
|
||||||
|
if (searchList.length < 6) {
|
||||||
|
let RemoveHtml = `<div class="closeMulticityCard" onclick='removeMultiCityForm(this)' >
|
||||||
|
<span class="material-icons" > close </span>
|
||||||
|
</div>
|
||||||
|
</div> `
|
||||||
|
html = `<div class="MCToFromDate MultiForm">
|
||||||
|
<div class="multiCityBody">
|
||||||
|
<div class="multiCityRemove">
|
||||||
|
<div class="multiCityFlightText">Flight 1</div>
|
||||||
|
</div>
|
||||||
|
<div class="order2">
|
||||||
|
<div class="toFromSearchWrapper">
|
||||||
|
<div class="toFromSearchOrigin search-border">
|
||||||
|
<label for="" class="toOrigin">
|
||||||
|
<div class="toOriginIcon">
|
||||||
|
<span class="material-icons">
|
||||||
|
flight</span>
|
||||||
|
</div>
|
||||||
|
<div class="toOriginContent">
|
||||||
|
<h4>From</h4>
|
||||||
|
<div class="searchBox">
|
||||||
|
<input class="Origin " autocomplete="off" onclick="autobind(this , '0' ,null)"
|
||||||
|
onkeyup="GetAirportList(this , '0')" type="text" data-airport-code="" placeholder="Origin"
|
||||||
|
/>
|
||||||
|
<div id="myDropdown" class="dropdown-content">
|
||||||
|
<div>
|
||||||
|
<div class="mobileBack">
|
||||||
|
<div class="mobileHead">
|
||||||
|
<button class="mobileBackButton toggle">
|
||||||
|
<span class="material-icons">
|
||||||
|
arrow_back
|
||||||
|
</span>
|
||||||
|
</button>
|
||||||
|
<div class="mobileTitle">
|
||||||
|
<h4>Search destination</h4>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="mobileSearchInput">
|
||||||
|
<input type="text" autocomplete="off" class="mobileSearch"
|
||||||
|
placeholder="Search Where Are You Flying" />
|
||||||
|
<span class="material-icons">
|
||||||
|
search
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="toOriginPopular">
|
||||||
|
<h4>TOP ORIGINS</h4>
|
||||||
|
</div>
|
||||||
|
<ul class="dropdown-wrapper">
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<div class="toFromSearchSweep" onclick="ExchangeValue(this)">
|
||||||
|
<span class="material-icons"> sync_alt </span>
|
||||||
|
</div>
|
||||||
|
<div class="toFromSearchDepart search-border">
|
||||||
|
<label class="toDepart" for="">
|
||||||
|
<div class="toDepartIcon">
|
||||||
|
<span class="material-icons">
|
||||||
|
flight</span>
|
||||||
|
</div>
|
||||||
|
<div class="ToDepartContent searchBox">
|
||||||
|
<h4>To</h4>
|
||||||
|
<div>
|
||||||
|
<input class="depart" autocomplete="off" onclick="autobind(this , '1' ,null)"
|
||||||
|
onkeyup="GetAirportList(this , '1')" data-airport-code="" type="text"
|
||||||
|
placeholder="Destination" />
|
||||||
|
<div id="departDropDown" class="depart-content">
|
||||||
|
<div>
|
||||||
|
<div class="mobileBack">
|
||||||
|
<div class="mobileHead">
|
||||||
|
<button class="mobileBackButton toggle">
|
||||||
|
<span class="material-icons">
|
||||||
|
arrow_back
|
||||||
|
</span>
|
||||||
|
</button>
|
||||||
|
<div class="mobileTitle">
|
||||||
|
<h4>Search destination</h4>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="mobileSearchInput">
|
||||||
|
<input type="text" autocomplete="off" class="mobileSearch"
|
||||||
|
placeholder="Search Where Are You Flying" />
|
||||||
|
<span class="material-icons">
|
||||||
|
search
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="toDepartPopular">
|
||||||
|
<h4>TOP ORIGINS</h4>
|
||||||
|
</div>
|
||||||
|
<ul class="dropdown-wrapper">
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="order3">
|
||||||
|
<div class="searchDate">
|
||||||
|
<label for="calenderForm" class="searchDateForm">
|
||||||
|
<div class="searchDateFormIcon">
|
||||||
|
<span class="material-icons">event_note</span>
|
||||||
|
</div>
|
||||||
|
<div class="searchDateFormHead">
|
||||||
|
<h4 class="searchDateFormHeadText">
|
||||||
|
Departure
|
||||||
|
</h4>
|
||||||
|
<input type="text" id="MultiCity-${searchList.length + 1}" />
|
||||||
|
</div>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
${searchList.length >= 2 ? RemoveHtml : ''}
|
||||||
|
`
|
||||||
|
document.getElementById('multiCityForm').insertAdjacentHTML("beforebegin", html);
|
||||||
|
var searchList = document.querySelectorAll(".MultiForm");
|
||||||
|
let index = searchList.length == 2 ? 1 : searchList.length - 1
|
||||||
|
let date = searchList.length == 1 ? new Date : document.getElementById(`MultiCity-${+ (index)}`).value
|
||||||
|
console.log(date)
|
||||||
|
caleran("#MultiCity-" + (searchList.length), {
|
||||||
|
singleDate: true,
|
||||||
|
calendarCount: 1,
|
||||||
|
showHeader: false,
|
||||||
|
showFooter: false,
|
||||||
|
autoCloseOnSelect: true,
|
||||||
|
format: 'DD MMM YYYY',
|
||||||
|
minDate: date,
|
||||||
|
onafterselect: function (instance, start, end) {
|
||||||
|
CheckMultiDate(start, searchList.length)
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (searchList.length >= 5) document.getElementById("addMultiCityForm").style.visibility = 'hidden';
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
function CheckMultiDate(Date, index) {
|
||||||
|
var searchList = document.querySelectorAll(".MultiForm")
|
||||||
|
console.log(searchList)
|
||||||
|
for (let i = index; i < searchList.length; i++) {
|
||||||
|
caleran("#MultiCity-" + (i + 1), {
|
||||||
|
singleDate: true,
|
||||||
|
calendarCount: 1,
|
||||||
|
showHeader: false,
|
||||||
|
showFooter: false,
|
||||||
|
autoCloseOnSelect: true,
|
||||||
|
format: 'DD MMM YYYY',
|
||||||
|
minDate: Date._d,
|
||||||
|
onafterselect: function (instance, start, end) {
|
||||||
|
CheckMultiDate(start, (index + 1))
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function removeMultiCityForm(elem) {
|
||||||
|
elem.closest(".MultiForm").remove();
|
||||||
|
document.getElementById("addMultiCityForm").style.visibility = 'visible';
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
let tripKey = 'IRT';
|
||||||
|
function ChangeTab(type) {
|
||||||
|
tripKey = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function hideToaster(element) {
|
||||||
|
setTimeout(function () {
|
||||||
|
element.classList.add('d-none');
|
||||||
|
element.querySelector('span').innerHTML = '';
|
||||||
|
}, 1500);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/// drop down
|
||||||
|
|
||||||
|
async function GetAirlineList(inp) {
|
||||||
|
console.log(inp.value)
|
||||||
|
let html = ''
|
||||||
|
if (inp.value.length >= 2) {
|
||||||
|
const response = await fetch("https://adminapi.uat.futuretravelplatform.com/api/MasterSearch/GetAllAirline/en/" + inp.value, {
|
||||||
|
method: 'GET',
|
||||||
|
headers: { 'Content-Type': 'application/json', 'OrgId': '2206040706597097092' }
|
||||||
|
});
|
||||||
|
if (!response.ok) {
|
||||||
|
throw new Error(`HTTP error! status: ${response.status}`);
|
||||||
|
}
|
||||||
|
const data = await response.json();
|
||||||
|
// = await data;
|
||||||
|
data.map(e => {
|
||||||
|
html += ` <li class="ListOfAirline" data-airline-code='${e.airline_code}'>${e.airline_name} </li>`
|
||||||
|
})
|
||||||
|
|
||||||
|
console.log(data)
|
||||||
|
inp.closest('div').querySelector('.PrefferedAirline').innerHTML = html;
|
||||||
|
};
|
||||||
|
inp.closest('div').querySelector('.PrefferedAirline').classList.remove('aiplineDropdown');
|
||||||
|
}
|
||||||
|
|
||||||
|
function ExchangeValue(elmnt) {
|
||||||
|
let element = elmnt.closest('.toFromSearchWrapper');
|
||||||
|
let From = element.querySelector('.Origin');
|
||||||
|
let To = element.querySelector('.depart');
|
||||||
|
var from1 = From.value;
|
||||||
|
var form2 = From.getAttribute('data-airport-code');
|
||||||
|
element.querySelector('.Origin').value = To.value;
|
||||||
|
element.querySelector('.Origin').setAttribute('data-airport-code', To.getAttribute('data-airport-code'));
|
||||||
|
element.querySelector('.depart').value = from1;
|
||||||
|
element.querySelector('.depart').setAttribute('data-airport-code', form2);
|
||||||
|
}
|
||||||
|
// caleran js for calender
|
||||||
|
|
||||||
|
caleran("#OW_Calender", {
|
||||||
|
singleDate: true,
|
||||||
|
calendarCount: 1,
|
||||||
|
showHeader: false,
|
||||||
|
showFooter: false,
|
||||||
|
autoCloseOnSelect: true,
|
||||||
|
format: 'DD MMM YYYY',
|
||||||
|
minDate: new Date,
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
var startDate, endDate, startInstance, endInstance;
|
||||||
|
var fillInputs = function () {
|
||||||
|
startInstance.elem.value = startDate ? startDate.locale(startInstance.config.format).format('DD MMM YYYY') : "";
|
||||||
|
endInstance.elem.value = endDate ? endDate.locale(endInstance.config.format).format('DD MMM YYYY') : "";
|
||||||
|
};
|
||||||
|
document.querySelector("#flightStart").value = moment().format('DD MMM YYYY');
|
||||||
|
document.querySelector("#flightEnd").value = moment().format('DD MMM YYYY');
|
||||||
|
caleran("#flightStart", {
|
||||||
|
startEmpty: document.querySelector("#flightStart").value === "",
|
||||||
|
startDate: document.querySelector("#flightStart").value,
|
||||||
|
endDate: document.querySelector("#flightEnd").value,
|
||||||
|
enableKeyboard: false,
|
||||||
|
minDate: new Date,
|
||||||
|
oninit: function (instance) {
|
||||||
|
startInstance = instance;
|
||||||
|
if (!instance.config.startEmpty && instance.config.startDate) {
|
||||||
|
instance.elem.value = instance.config.startDate.locale(instance.config.format).format('DD MMM YYYY');
|
||||||
|
startDate = instance.config.startDate.clone();
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
onbeforeshow: function (instance) {
|
||||||
|
if (startDate) {
|
||||||
|
startInstance.config.startDate = startDate;
|
||||||
|
endInstance.config.startDate = startDate;
|
||||||
|
}
|
||||||
|
if (endDate) {
|
||||||
|
startInstance.config.endDate = endDate.clone();
|
||||||
|
endInstance.config.endDate = endDate.clone();
|
||||||
|
}
|
||||||
|
fillInputs();
|
||||||
|
instance.updateHeader();
|
||||||
|
instance.reDrawCells();
|
||||||
|
},
|
||||||
|
onfirstselect: function (instance, start) {
|
||||||
|
startDate = start.clone();
|
||||||
|
startInstance.globals.startSelected = false;
|
||||||
|
startInstance.hideDropdown();
|
||||||
|
endInstance.showDropdown();
|
||||||
|
endInstance.config.minDate = startDate.clone();
|
||||||
|
endInstance.config.startDate = startDate.clone();
|
||||||
|
endInstance.config.endDate = null;
|
||||||
|
endInstance.globals.startSelected = true;
|
||||||
|
endInstance.globals.endSelected = false;
|
||||||
|
endInstance.globals.firstValueSelected = true;
|
||||||
|
endInstance.setDisplayDate(start);
|
||||||
|
if (endDate && startDate.isAfter(endDate)) {
|
||||||
|
endInstance.globals.endDate = endDate.clone();
|
||||||
|
}
|
||||||
|
endInstance.updateHeader();
|
||||||
|
endInstance.reDrawCells();
|
||||||
|
fillInputs();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
caleran("#flightEnd", {
|
||||||
|
startEmpty: document.querySelector("#flightEnd").value === "",
|
||||||
|
startDate: document.querySelector("#flightStart").value,
|
||||||
|
endDate: document.querySelector("#flightEnd").value,
|
||||||
|
enableKeyboard: false,
|
||||||
|
autoCloseOnSelect: true,
|
||||||
|
minDate: new Date,
|
||||||
|
oninit: function (instance) {
|
||||||
|
endInstance = instance;
|
||||||
|
if (!instance.config.startEmpty && instance.config.endDate) {
|
||||||
|
instance.elem.value = (instance.config.endDate.locale(instance.config.format).format('DD MMM YYYY'));
|
||||||
|
endDate = instance.config.endDate.clone();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onbeforeshow: function (instance) {
|
||||||
|
if (startDate) {
|
||||||
|
startInstance.config.startDate = startDate;
|
||||||
|
endInstance.config.startDate = startDate;
|
||||||
|
}
|
||||||
|
if (endDate) {
|
||||||
|
startInstance.config.endDate = endDate.clone();
|
||||||
|
endInstance.config.endDate = endDate.clone();
|
||||||
|
}
|
||||||
|
fillInputs();
|
||||||
|
instance.updateHeader();
|
||||||
|
instance.reDrawCells();
|
||||||
|
},
|
||||||
|
onafterselect: function (instance, start, end) {
|
||||||
|
startDate = start.clone();
|
||||||
|
endDate = end.clone();
|
||||||
|
endInstance.hideDropdown();
|
||||||
|
startInstance.config.endDate = endDate.clone();
|
||||||
|
startInstance.globals.firstValueSelected = true;
|
||||||
|
fillInputs();
|
||||||
|
endInstance.globals.startSelected = true;
|
||||||
|
endInstance.globals.endSelected = false;
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Flight Search query string
|
||||||
|
|
||||||
|
function Searchflight(elem) {
|
||||||
|
let checkValidation = true;
|
||||||
|
|
||||||
|
let main_div = elem.closest('.CommonSearch');
|
||||||
|
let airlinelist = document.querySelectorAll(".airlinelist");
|
||||||
|
let airline_code = [];
|
||||||
|
if (airlinelist.length != 0) {
|
||||||
|
airlinelist.forEach(e => {
|
||||||
|
airline_code.push(e.getAttribute('data-airline-code'));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
var querystring = {
|
||||||
|
"adult": TravellerDetails.Adult,
|
||||||
|
"child": TravellerDetails.child,
|
||||||
|
"infant": TravellerDetails.Infant,
|
||||||
|
"langcode": "EN",
|
||||||
|
"ref": document.getElementById('Refundable').checked,
|
||||||
|
"direct": document.getElementById('DirectFlights').checked,
|
||||||
|
"key": tripKey,
|
||||||
|
"triptype": CheckTriptype(tripKey),
|
||||||
|
'curr': 'AED',
|
||||||
|
"airlines": airline_code.length != 0 ? airline_code.join(',') : '',
|
||||||
|
}
|
||||||
|
|
||||||
|
let cl = checkClassType()
|
||||||
|
let origin = main_div.querySelector('.Origin').getAttribute("data-airport-code");
|
||||||
|
let depart = main_div.querySelector('.depart').getAttribute("data-airport-code");
|
||||||
|
if (tripKey == 'OW' || tripKey == 'IRT') {
|
||||||
|
let list = tripKey == 'OW' ? 1 : 2
|
||||||
|
for (let i = 0; i < list; i++) {
|
||||||
|
let start = tripKey == 'OW' ? document.getElementById('OW_Calender').value : document.getElementById('flightStart').value
|
||||||
|
if (!validator(origin, depart)) {
|
||||||
|
checkValidation = false
|
||||||
|
}
|
||||||
|
let end = document.getElementById('flightEnd').value
|
||||||
|
querystring[`dep${i + 1}`] = i == 0 ? origin : depart;
|
||||||
|
querystring[`ret${i + 1}`] = i == 0 ? depart : origin;
|
||||||
|
querystring[`cl${i + 1}`] = cl;
|
||||||
|
querystring[`dtt${i + 1}`] = tripKey == 'OW' ? moment(start).format('DD-MMM-YYYY') : i == 0 ? moment(start).format('DD-MMM-YYYY') : moment(end).format('DD-MMM-YYYY');
|
||||||
|
}
|
||||||
|
} else if (tripKey == 'NMC') {
|
||||||
|
var searchList = main_div.querySelectorAll(".MultiForm");
|
||||||
|
searchList.forEach((e, i) => {
|
||||||
|
let Origin = e.getElementsByClassName('Origin')[0].getAttribute("data-airport-code");
|
||||||
|
let depart = e.getElementsByClassName('depart')[0].getAttribute("data-airport-code");
|
||||||
|
if (!validator(Origin, depart)) {
|
||||||
|
checkValidation = false
|
||||||
|
}
|
||||||
|
querystring[`dep${i + 1}`] = Origin;
|
||||||
|
querystring[`ret${i + 1}`] = depart;
|
||||||
|
querystring[`dtt${i + 1}`] = moment(e.querySelector(`#MultiCity-${i + 1}`).value).format('DD-MMM-YYYY'); // changes
|
||||||
|
querystring[`cl${i + 1}`] = cl;
|
||||||
|
})
|
||||||
|
}
|
||||||
|
if (!checkValidation) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
sessionStorage.setItem('SerachReqQueryObj', JSON.stringify(querystring));
|
||||||
|
const urlParams = new URLSearchParams(window.location.search);
|
||||||
|
var query = Object.keys(querystring).map(key => key + '=' + querystring[key]).join('&');
|
||||||
|
window.location.href = 'https://travel.neuholidays.com/Flight/search?' + query;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// validation
|
||||||
|
|
||||||
|
function validator(origin, depart) {
|
||||||
|
let element = document.getElementsByClassName('toast-warning')[0]
|
||||||
|
if (origin == depart) {
|
||||||
|
element.classList.remove('d-none')
|
||||||
|
element.querySelector('span').innerHTML = 'Departure must be different from arrival'
|
||||||
|
hideToaster(element)
|
||||||
|
return false
|
||||||
|
} if (!origin || !depart) {
|
||||||
|
element.classList.remove('d-none')
|
||||||
|
element.querySelector('span').innerHTML = 'Please enter departure and arrival city or airport'
|
||||||
|
hideToaster(element)
|
||||||
|
return false
|
||||||
|
} else return true
|
||||||
|
};
|
||||||
|
|
||||||
|
// common function
|
||||||
|
|
||||||
|
function CheckTriptype(tripKey) {
|
||||||
|
if (tripKey == 'NMC') {
|
||||||
|
return '3'
|
||||||
|
} else if (tripKey == 'IRT') {
|
||||||
|
return '2'
|
||||||
|
} else if (tripKey == 'OW') {
|
||||||
|
return '1'
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
function checkClassType() {
|
||||||
|
if (TravellerDetails.classType == 'FirstClass') {
|
||||||
|
return 'F'
|
||||||
|
} else if (TravellerDetails.classType == 'BusinessClass') {
|
||||||
|
return 'C'
|
||||||
|
} else if (TravellerDetails.classType == 'PremiumEconomy') {
|
||||||
|
return 'W'
|
||||||
|
} else if (TravellerDetails.classType == 'Economy') {
|
||||||
|
return 'Y'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// multi selector
|
||||||
|
|
||||||
|
function Close(e) {
|
||||||
|
e.closest('.multiSelect').querySelector(".SelectList").classList.remove("ShowAirlineList");
|
||||||
|
e.closest("span").remove();
|
||||||
|
let check = document.querySelectorAll(".airlinelist");
|
||||||
|
if (check.length == 0) {
|
||||||
|
e.closest('.multiSelect').querySelector(".SearchBox").classList.add('multiInp')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function showAirlineList(elem) {
|
||||||
|
elem.closest('.multiSelect').querySelector(".SelectList").classList.add("ShowAirlineList");
|
||||||
|
elem.closest('.multiSelect').querySelector("input").focus();
|
||||||
|
}
|
||||||
|
function bindAirLine(airlinelist, elem) {
|
||||||
|
let html = "";
|
||||||
|
airlinelist.map((e, i) => {
|
||||||
|
html += ` <li class="option ${i == 0 ? 'selectAirline' : ''}" onclick="AddAirline(this)" data-airline-code='${e.airline_code}' data-airline-name='${e.airline_name}'>(${e.airline_code}) ${e.airline_name} </li>`
|
||||||
|
})
|
||||||
|
elem.closest('.SelectList').querySelector('.ListItem').innerHTML = html;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function GetAirlineDetails(elem) {
|
||||||
|
let key = window.event
|
||||||
|
let list = document.getElementsByClassName('selectAirline') ? document.getElementsByClassName('selectAirline')[0] : '';
|
||||||
|
if (list) {
|
||||||
|
if (key.keyCode == 38) {
|
||||||
|
console.log('low')
|
||||||
|
var prev = list.previousElementSibling;
|
||||||
|
if (prev) {
|
||||||
|
list.classList.remove("selectAirline");
|
||||||
|
prev.classList.add("selectAirline");
|
||||||
|
}
|
||||||
|
} else if (key.keyCode == 40) {
|
||||||
|
console.log('high')
|
||||||
|
var next = list.nextElementSibling;
|
||||||
|
if (next) {
|
||||||
|
list.classList.remove("selectAirline");
|
||||||
|
next.classList.add("selectAirline");
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
let val = elem.value;
|
||||||
|
if (val.length >= 2 && !(key.keyCode == 38) && !(key.keyCode == 40)) {
|
||||||
|
const response = await fetch("https://adminapi.uat.futuretravelplatform.com/api/MasterSearch/GetAllAirline/en/" + val, {
|
||||||
|
method: 'GET',
|
||||||
|
headers: { 'Content-Type': 'application/json', 'OrgId': '2206040706597097092' }
|
||||||
|
});
|
||||||
|
if (!response.ok) {
|
||||||
|
throw new Error(`HTTP error! status: ${response.status}`);
|
||||||
|
}
|
||||||
|
const data = await response.json();
|
||||||
|
let obj = await data;
|
||||||
|
obj ? bindAirLine(obj, elem) : ''
|
||||||
|
}
|
||||||
|
if (key.keyCode == 13) {
|
||||||
|
AddAirline(document.getElementsByClassName('selectAirline')[0])
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
function AddAirline(val) {
|
||||||
|
let check = document.querySelectorAll(".airlinelist");
|
||||||
|
if (check.length <= 2) {
|
||||||
|
let code = val.getAttribute("data-airline-code");
|
||||||
|
let name = val.getAttribute("data-airline-name");
|
||||||
|
let html = ` <span class='airlinelist' data-airline-code="${code}"> (${code}) ${name}
|
||||||
|
<button onclick="Close(this)">x</button>
|
||||||
|
</span>`;
|
||||||
|
val.closest('.multiSelect').querySelector(".SearchBox").insertAdjacentHTML("beforeend", html);
|
||||||
|
let maindiv = val.closest('.multiSelect').querySelector('input')
|
||||||
|
val.closest('.multiSelect').querySelector("input").value = '';
|
||||||
|
val.closest('div').classList.remove("ShowAirlineList");
|
||||||
|
val.closest('.multiSelect').querySelector(".SearchBox").classList.remove('multiInp');
|
||||||
|
val.remove();
|
||||||
|
bindAirLine([], maindiv);
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
function resetAllPaxCounter() {
|
||||||
|
document.getElementById("infant").value = 0;
|
||||||
|
document.getElementById("child").value = 0;
|
||||||
|
document.getElementById("adult").value = 1;
|
||||||
|
TravellerDetails.Adult = 1;
|
||||||
|
TravellerDetails.child = 0;
|
||||||
|
TravellerDetails.Infant = 0;
|
||||||
|
ClassType(document.getElementsByClassName('EconomyClass')[0] , 'Economy');
|
||||||
|
|
||||||
|
};
|
||||||
@@ -0,0 +1,514 @@
|
|||||||
|
|
||||||
|
function roomCount() {
|
||||||
|
document.getElementById("roomPax").classList.add("showRoomPax");
|
||||||
|
}
|
||||||
|
|
||||||
|
function addmore_rooms() {
|
||||||
|
var rooms = document.querySelectorAll(".HotelNoRoomWrapper");
|
||||||
|
html = "";
|
||||||
|
let RemoveHtml = `
|
||||||
|
<div class="closeRoomCard" onclick="RemoveRoom(this)">
|
||||||
|
<span class="material-icons"> close </span>
|
||||||
|
</div> `
|
||||||
|
|
||||||
|
if (rooms.length < 6) {
|
||||||
|
html = `<div class="HotelNoRoomWrapper">
|
||||||
|
<div class="HotelNoRoomTitle">
|
||||||
|
<span class="material-icons"> local_hotel </span>
|
||||||
|
<h4 class="Rooms_no">Room ${rooms.length + 1}</h4>
|
||||||
|
</div>
|
||||||
|
<div class="HotelNoRoomCount AdultPax">
|
||||||
|
<div class="HotelTravelerSteps">
|
||||||
|
<button class="opacity" onclick="AddAdultPax(this , false)">
|
||||||
|
<span class="material-icons"> remove </span>
|
||||||
|
</button>
|
||||||
|
<input type="text" value="1" autocomplete="off" readonly />
|
||||||
|
<button onclick="AddAdultPax(this , true)">
|
||||||
|
<span class="material-icons"> add </span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="HotelNoRoomCount ChildPax">
|
||||||
|
<div class="HotelTravelerSteps">
|
||||||
|
<button class="opacity" onclick="AddChildPax(this , false)">
|
||||||
|
<span class="material-icons"> remove </span>
|
||||||
|
</button>
|
||||||
|
<input type="text" value="0" autocomplete="off" readonly />
|
||||||
|
<button onclick="AddChildPax(this , true)">
|
||||||
|
<span class="material-icons"> add </span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="HotelNoageChild">
|
||||||
|
|
||||||
|
</div>
|
||||||
|
${rooms.length != 0 ? RemoveHtml : ''}
|
||||||
|
</div> `
|
||||||
|
}
|
||||||
|
if (rooms.length >= 5) document.getElementById('MoreOption').querySelector('.addMoreTravller').classList.add("HotelPaxSelectOption");
|
||||||
|
document.getElementById('MoreOption').querySelector('.addMoreTravller').insertAdjacentHTML("beforebegin", html)
|
||||||
|
TravellerCounter('');
|
||||||
|
}
|
||||||
|
addmore_rooms();
|
||||||
|
|
||||||
|
|
||||||
|
function RemoveRoom(elem) {
|
||||||
|
elem.closest(".HotelNoRoomWrapper").remove();
|
||||||
|
let allRoom = document.querySelectorAll(".HotelNoRoomWrapper")
|
||||||
|
allRoom.forEach((e, i) => {
|
||||||
|
e.querySelector('.Rooms_no').innerHTML = `Room ${i + 1} `
|
||||||
|
});
|
||||||
|
TravellerCounter('');
|
||||||
|
document.getElementById('MoreOption').querySelector('.addMoreTravller').classList.remove("HotelPaxSelectOption");
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
function AddChildPax(elem, check) {
|
||||||
|
|
||||||
|
if (check) {
|
||||||
|
if (elem.previousElementSibling.value <= 3) {
|
||||||
|
elem.previousElementSibling.value++
|
||||||
|
elem.previousElementSibling.previousElementSibling.disabled = false
|
||||||
|
elem.previousElementSibling.previousElementSibling.style.opacity = '1'
|
||||||
|
children_number(elem, check, elem.previousElementSibling.value)
|
||||||
|
TravellerCounter('');
|
||||||
|
} if (elem.previousElementSibling.value == 4) {
|
||||||
|
elem.disabled = true;
|
||||||
|
elem.style.opacity = '0.6';
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (elem.nextElementSibling.value >= 1) {
|
||||||
|
elem.nextElementSibling.nextElementSibling.disabled = false;
|
||||||
|
elem.nextElementSibling.nextElementSibling.style.opacity = '1';
|
||||||
|
elem.nextElementSibling.value--;
|
||||||
|
children_number(elem, check, elem.nextElementSibling.value);
|
||||||
|
TravellerCounter('');
|
||||||
|
} if (elem.nextElementSibling.value == 0) {
|
||||||
|
elem.disabled = true;
|
||||||
|
elem.style.opacity = '0.6';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (true) {
|
||||||
|
if (document.querySelector('.child_1')) {
|
||||||
|
document.querySelector('.Child-one').classList.remove('d-none');;
|
||||||
|
} else document.querySelector('.Child-one').classList.add('d-none');
|
||||||
|
if (document.querySelector('.child_2')) {
|
||||||
|
document.querySelector('.Child-two').classList.remove('d-none');
|
||||||
|
} else document.querySelector('.Child-two').classList.add('d-none');
|
||||||
|
if (document.querySelector('.child_3')) {
|
||||||
|
document.querySelector('.Child-three').classList.remove('d-none');
|
||||||
|
} else document.querySelector('.Child-three').classList.add('d-none');
|
||||||
|
if (document.querySelector('.child_4')) {
|
||||||
|
document.querySelector('.Child-four').classList.remove('d-none');
|
||||||
|
} else document.querySelector('.Child-four').classList.add('d-none');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
function AddAdultPax(elem, check) {
|
||||||
|
|
||||||
|
if (check) {
|
||||||
|
if (elem.previousElementSibling.value <= 5) {
|
||||||
|
elem.previousElementSibling.value++;
|
||||||
|
elem.previousElementSibling.previousElementSibling.disabled = false;
|
||||||
|
elem.previousElementSibling.previousElementSibling.style.opacity = '1';
|
||||||
|
TravellerCounter('');
|
||||||
|
} if (elem.previousElementSibling.value == 6) {
|
||||||
|
|
||||||
|
elem.disabled = true;
|
||||||
|
elem.style.opacity = '0.6';
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (elem.nextElementSibling.value >= 2) {
|
||||||
|
elem.nextElementSibling.value--;
|
||||||
|
elem.nextElementSibling.nextElementSibling.disabled = false;
|
||||||
|
elem.nextElementSibling.nextElementSibling.style.opacity = '1';
|
||||||
|
TravellerCounter('');
|
||||||
|
} if (elem.nextElementSibling.value == 1) {
|
||||||
|
elem.disabled = true;
|
||||||
|
elem.style.opacity = '0.6';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function apply_people(elem) {
|
||||||
|
if (elem) {
|
||||||
|
TravellerCounter(elem.getAttribute('data-room'))
|
||||||
|
document.getElementById("roomPax").classList.remove("showRoomPax");
|
||||||
|
if (elem.getAttribute('data-room') == "addmore") {
|
||||||
|
document.getElementById("MoreOption").classList.remove("moreOptionWrapper")
|
||||||
|
} else document.getElementById("MoreOption").classList.add("moreOptionWrapper")
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
var RoomDetails = []
|
||||||
|
function TravellerCounter(optionType) {
|
||||||
|
console.log(RoomDetails)
|
||||||
|
let searchRooms = [];
|
||||||
|
let totalRooms = "";
|
||||||
|
|
||||||
|
if (optionType === "1Room2Adult") {
|
||||||
|
let array_age = [];
|
||||||
|
let data = {
|
||||||
|
"adult": "2",
|
||||||
|
"child": "0",
|
||||||
|
"childAge": array_age
|
||||||
|
}
|
||||||
|
searchRooms.push(data);
|
||||||
|
totalRooms = "1";
|
||||||
|
} else if (optionType === "1Room1Adult") {
|
||||||
|
let array_age = [];
|
||||||
|
let data = {
|
||||||
|
"adult": "1",
|
||||||
|
"child": "0",
|
||||||
|
"childAge": array_age
|
||||||
|
}
|
||||||
|
totalRooms = "1";
|
||||||
|
searchRooms.push(data);
|
||||||
|
} else {
|
||||||
|
let roomElem = [...document.querySelector('#MoreOption').querySelectorAll('.HotelNoRoomWrapper')];
|
||||||
|
let roomData = roomElem.map(e => {
|
||||||
|
let adultVal = e.querySelector('.AdultPax').querySelector('input').value;
|
||||||
|
let childVal = e.querySelector('.ChildPax').querySelector('input').value;
|
||||||
|
let html = e.querySelector('.HotelNoageChild').querySelectorAll('.HotelNoageSelect');
|
||||||
|
let array_age = [...html].map(elem => elem.querySelector('.select_control').value);
|
||||||
|
return {
|
||||||
|
'adult': adultVal,
|
||||||
|
'child': childVal,
|
||||||
|
'childAge': array_age
|
||||||
|
}
|
||||||
|
});
|
||||||
|
searchRooms = [...roomData];
|
||||||
|
totalRooms = searchRooms.length;
|
||||||
|
}
|
||||||
|
RoomDetails = searchRooms;
|
||||||
|
getRoomsInfo(searchRooms);
|
||||||
|
}
|
||||||
|
TravellerCounter('1Room2Adult')
|
||||||
|
|
||||||
|
function getRoomsInfo(rooms) {
|
||||||
|
let roomsInfo = rooms.reduce((acc, elem) =>
|
||||||
|
(
|
||||||
|
{
|
||||||
|
Adult: parseInt(acc.Adult) + parseInt(elem.adult),
|
||||||
|
Child: parseInt(acc.Child) + parseInt(elem.child)
|
||||||
|
})
|
||||||
|
, ({ Adult: 0, Child: 0 }));
|
||||||
|
roomsInfo['Rooms'] = rooms.length;
|
||||||
|
console.log(roomsInfo)
|
||||||
|
document.getElementById('RoomCount').value = `${rooms.length} Room, ${roomsInfo.Adult} Adult ${roomsInfo.Child > 0 ? ', ' + roomsInfo.Child + ' Child' : ''}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// child count
|
||||||
|
|
||||||
|
function children_number(elem, check, index) {
|
||||||
|
let html = "";
|
||||||
|
console.log(index)
|
||||||
|
if (check) {
|
||||||
|
html += ` <div class="HotelNoageSelect child_${index}">
|
||||||
|
<select class="select_control" onchange="TravellerCounter('')">
|
||||||
|
<option value="1">Under 1</option>
|
||||||
|
<option value="2">2 </option>
|
||||||
|
<option value="3">3</option>
|
||||||
|
<option value="4">4</option>
|
||||||
|
<option value="5">5</option>
|
||||||
|
<option value="6">6</option>
|
||||||
|
<option value="7">7</option>
|
||||||
|
<option value="8">8</option>
|
||||||
|
<option value="9">9</option>
|
||||||
|
<option value="10">10</option>
|
||||||
|
<option value="11">11</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
`;
|
||||||
|
elem.closest(".HotelNoRoomWrapper").querySelector(".HotelNoageChild").insertAdjacentHTML("beforeend", html)
|
||||||
|
} else {
|
||||||
|
let elemet = elem.closest(".HotelNoRoomWrapper").querySelectorAll(".HotelNoageSelect");
|
||||||
|
let ind =
|
||||||
|
elemet.length - 1
|
||||||
|
elemet[ind].remove();
|
||||||
|
}
|
||||||
|
TravellerCounter('');
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// hote api
|
||||||
|
|
||||||
|
let HotelList = [];
|
||||||
|
let NationalityList = [];
|
||||||
|
getBindHotelList()
|
||||||
|
async function getBindHotelList(inp) {
|
||||||
|
const response = await fetch("https://adminapi.uat.futuretravelplatform.com/api/CityMaster/GetSelectedCity?cityCode=39942,12568,41325,38997,33324&LangCode=EN", {
|
||||||
|
method: 'GET',
|
||||||
|
headers: { 'Content-Type': 'application/json', 'OrgId': '2206040706597097092' }
|
||||||
|
});
|
||||||
|
if (!response.ok) {
|
||||||
|
throw new Error(`HTTP error! status: ${response.status}`);
|
||||||
|
}
|
||||||
|
const data = await response.json();
|
||||||
|
HotelList = data
|
||||||
|
console.log(data)
|
||||||
|
|
||||||
|
}
|
||||||
|
// onkeyup
|
||||||
|
|
||||||
|
async function GethotelList(Input) {
|
||||||
|
if (Input.value.length >= 2) {
|
||||||
|
const response = await fetch("https://hotelapi.uat.futuretravelplatform.com/api/hotel/location?searchKey=" + Input.value + "&langCode=EN", {
|
||||||
|
method: 'GET',
|
||||||
|
headers: { 'Content-Type': 'application/json', 'OrgId': '2206040706597097092' }
|
||||||
|
});
|
||||||
|
if (!response.ok) {
|
||||||
|
throw new Error(`HTTP error! status: ${response.status}`);
|
||||||
|
}
|
||||||
|
const data = await response.json();
|
||||||
|
HotelList = data
|
||||||
|
autoHotelListbind(Input)
|
||||||
|
console.log(data)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// bind hotel list
|
||||||
|
|
||||||
|
function ShowHotelList(element) {
|
||||||
|
element.closest(".HotelSearchDestination").querySelector(".hideInput") ? element.closest(".HotelSearchDestination").querySelector(".hideInput").classList.remove('hideInput') : ''
|
||||||
|
autoHotelListbind(element)
|
||||||
|
}
|
||||||
|
function autoHotelListbind(element) {
|
||||||
|
let html = '';
|
||||||
|
HotelList.map(e => {
|
||||||
|
html += `
|
||||||
|
<div class="HotelSearchOtionContent" onclick="ApplyHotelCity(this)">
|
||||||
|
<span class="material-icons"> location_on </span>
|
||||||
|
<a data-countryCode="${e.countryCode}" data-cityCode="${e.cityCode}" data-city_Id="${e.city_Id}" data-cityName="${e.cityName}" data-displayName="${e.displayName}"> ${e.displayName}</a>
|
||||||
|
</div>`
|
||||||
|
});
|
||||||
|
element.closest(".HotelSearchDestination").querySelector(".HotelList").innerHTML = html;
|
||||||
|
}
|
||||||
|
|
||||||
|
function ApplyHotelCity(elem) {
|
||||||
|
console.log(elem)
|
||||||
|
let countryCode = elem.querySelector('a').getAttribute('data-countryCode');
|
||||||
|
let cityCode = elem.querySelector('a').getAttribute('data-cityCode');
|
||||||
|
let city_Id = elem.querySelector('a').getAttribute('data-city_Id');
|
||||||
|
let displayName = elem.querySelector('a').getAttribute('data-displayName');
|
||||||
|
|
||||||
|
let input = document.getElementById('FromHotel');
|
||||||
|
input.value = displayName;
|
||||||
|
input.setAttribute("data-countryCode", countryCode);
|
||||||
|
input.setAttribute("data-cityCode", cityCode);
|
||||||
|
input.setAttribute("data-city_Id", city_Id);
|
||||||
|
|
||||||
|
elem.closest('.HotelDestination').classList.add('hideInput');
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/// nationality list bind
|
||||||
|
|
||||||
|
function showNationality(elem) {
|
||||||
|
elem.closest('.HotelSearchFormNationality').querySelector('.HotelNationality').classList.remove('hideInput');
|
||||||
|
autonationalityListbind(elem);
|
||||||
|
}
|
||||||
|
|
||||||
|
getBindNationalityList()
|
||||||
|
async function getBindNationalityList() {
|
||||||
|
const response = await fetch("https://adminapi.uat.futuretravelplatform.com/api/CountryMaster/GetSelectedCountry/EN/MA,TN,NG,EG,AE,SA,BH,QA,KW,OM", {
|
||||||
|
method: 'GET',
|
||||||
|
headers: { 'Content-Type': 'application/json', 'OrgId': '2206040706597097092' }
|
||||||
|
});
|
||||||
|
if (!response.ok) {
|
||||||
|
throw new Error(`HTTP error! status: ${response.status}`);
|
||||||
|
}
|
||||||
|
const data = await response.json();
|
||||||
|
NationalityList = data
|
||||||
|
}
|
||||||
|
|
||||||
|
async function GetNationalityList(Input) {
|
||||||
|
if (Input.value) {
|
||||||
|
const response = await fetch("https://adminapi.uat.futuretravelplatform.com/api/MasterSearch/GetAllCountry/EN/" + Input.value, {
|
||||||
|
method: 'GET',
|
||||||
|
headers: { 'Content-Type': 'application/json', 'OrgId': '2206040706597097092' }
|
||||||
|
});
|
||||||
|
if (!response.ok) {
|
||||||
|
throw new Error(`HTTP error! status: ${response.status}`);
|
||||||
|
}
|
||||||
|
const data = await response.json();
|
||||||
|
NationalityList = data
|
||||||
|
autonationalityListbind(Input)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function autonationalityListbind(elem) {
|
||||||
|
let html = '';
|
||||||
|
NationalityList.map(e => {
|
||||||
|
html += `
|
||||||
|
<div class="HotelSearchOtionContent" onclick="ApplyNationality(this)">
|
||||||
|
<span class="material-icons"> location_on </span>
|
||||||
|
<a data-countryCode="${e.country_code}" data-countryName="${e.country_name}" > ${e.country_name}</a>
|
||||||
|
</div>`
|
||||||
|
});
|
||||||
|
elem.closest('.HotelSearchFormNationality').querySelector('.NationalityList').innerHTML = html;
|
||||||
|
}
|
||||||
|
|
||||||
|
function ApplyNationality(elem) {
|
||||||
|
let citycode = elem.querySelector('a').getAttribute('data-countryCode');
|
||||||
|
let countryName = elem.querySelector('a').getAttribute('data-countryName');
|
||||||
|
document.getElementById('FromNationality').value = countryName;
|
||||||
|
document.getElementById('FromNationality').setAttribute('data-countryCode', citycode);
|
||||||
|
elem.closest('.HotelNationality').classList.add('hideInput');
|
||||||
|
}
|
||||||
|
|
||||||
|
// caleran js for calender
|
||||||
|
|
||||||
|
|
||||||
|
var startDate, endDate, HotelStartInstance, HotelEndInstance;
|
||||||
|
var HotelFillInputs = function () {
|
||||||
|
HotelStartInstance.elem.value = startDate ? startDate.locale(HotelStartInstance.config.format).format('DD MMM YYYY') : "";
|
||||||
|
HotelEndInstance.elem.value = endDate ? endDate.locale(HotelEndInstance.config.format).format('DD MMM YYYY') : "";
|
||||||
|
};
|
||||||
|
document.querySelector("#hotelStart").value = moment().format('DD MMM YYYY');
|
||||||
|
document.querySelector("#hotelEnd").value = moment().format('DD MMM YYYY');
|
||||||
|
caleran("#hotelStart", {
|
||||||
|
startEmpty: document.querySelector("#hotelStart").value === "",
|
||||||
|
startDate: document.querySelector("#hotelStart").value,
|
||||||
|
endDate: document.querySelector("#hotelEnd").value,
|
||||||
|
enableKeyboard: false,
|
||||||
|
minDate: new Date,
|
||||||
|
oninit: function (instance) {
|
||||||
|
HotelStartInstance = instance;
|
||||||
|
if (!instance.config.startEmpty && instance.config.startDate) {
|
||||||
|
instance.elem.value = instance.config.startDate.locale(instance.config.format).format('DD MMM YYYY');
|
||||||
|
startDate = instance.config.startDate.clone();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onbeforeshow: function (instance) {
|
||||||
|
if (startDate) {
|
||||||
|
HotelStartInstance.config.startDate = startDate;
|
||||||
|
HotelEndInstance.config.startDate = startDate;
|
||||||
|
}
|
||||||
|
if (endDate) {
|
||||||
|
HotelStartInstance.config.endDate = endDate.clone();
|
||||||
|
HotelEndInstance.config.endDate = endDate.clone();
|
||||||
|
}
|
||||||
|
HotelFillInputs();
|
||||||
|
instance.updateHeader();
|
||||||
|
instance.reDrawCells();
|
||||||
|
},
|
||||||
|
onfirstselect: function (instance, start) {
|
||||||
|
startDate = start.clone();
|
||||||
|
HotelStartInstance.globals.startSelected = false;
|
||||||
|
HotelStartInstance.hideDropdown();
|
||||||
|
HotelEndInstance.showDropdown();
|
||||||
|
HotelEndInstance.config.minDate = startDate.clone();
|
||||||
|
HotelEndInstance.config.startDate = startDate.clone();
|
||||||
|
HotelEndInstance.config.endDate = null;
|
||||||
|
HotelEndInstance.globals.startSelected = true;
|
||||||
|
HotelEndInstance.globals.endSelected = false;
|
||||||
|
HotelEndInstance.globals.firstValueSelected = true;
|
||||||
|
HotelEndInstance.setDisplayDate(start);
|
||||||
|
if (endDate && startDate.isAfter(endDate)) {
|
||||||
|
HotelEndInstance.globals.endDate = endDate.clone();
|
||||||
|
}
|
||||||
|
HotelEndInstance.updateHeader();
|
||||||
|
HotelEndInstance.reDrawCells();
|
||||||
|
HotelFillInputs();
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
caleran("#hotelEnd", {
|
||||||
|
startEmpty: document.querySelector("#hotelEnd").value === "",
|
||||||
|
startDate: document.querySelector("#hotelStart").value,
|
||||||
|
endDate: document.querySelector("#hotelEnd").value,
|
||||||
|
enableKeyboard: false,
|
||||||
|
autoCloseOnSelect: true,
|
||||||
|
minDate: new Date,
|
||||||
|
oninit: function (instance) {
|
||||||
|
HotelEndInstance = instance;
|
||||||
|
if (!instance.config.startEmpty && instance.config.endDate) {
|
||||||
|
instance.elem.value = (instance.config.endDate.locale(instance.config.format).format('DD MMM YYYY'));
|
||||||
|
endDate = instance.config.endDate.clone();
|
||||||
|
}
|
||||||
|
calcNumberOfNights(startDate, endDate)
|
||||||
|
},
|
||||||
|
onbeforeshow: function (instance) {
|
||||||
|
if (startDate) {
|
||||||
|
HotelStartInstance.config.startDate = startDate;
|
||||||
|
HotelEndInstance.config.startDate = startDate;
|
||||||
|
}
|
||||||
|
if (endDate) {
|
||||||
|
HotelStartInstance.config.endDate = endDate.clone();
|
||||||
|
HotelEndInstance.config.endDate = endDate.clone();
|
||||||
|
}
|
||||||
|
HotelFillInputs();
|
||||||
|
instance.updateHeader();
|
||||||
|
instance.reDrawCells();
|
||||||
|
},
|
||||||
|
onafterselect: function (instance, start, end) {
|
||||||
|
startDate = start.clone();
|
||||||
|
endDate = end.clone();
|
||||||
|
HotelEndInstance.hideDropdown();
|
||||||
|
HotelStartInstance.config.endDate = endDate.clone();
|
||||||
|
HotelStartInstance.globals.firstValueSelected = true;
|
||||||
|
HotelFillInputs();
|
||||||
|
HotelEndInstance.globals.startSelected = true;
|
||||||
|
HotelEndInstance.globals.endSelected = false;
|
||||||
|
calcNumberOfNights(startDate, endDate)
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
// hotel search query string
|
||||||
|
|
||||||
|
function searchHotel() {
|
||||||
|
let hotelDetails = document.getElementById('FromHotel')
|
||||||
|
let Nationality = document.getElementById('FromNationality').getAttribute('data-countryCode')
|
||||||
|
let element = document.getElementsByClassName('toast-warning')[0]
|
||||||
|
if (!hotelDetails) {
|
||||||
|
element.classList.remove('d-none')
|
||||||
|
element.querySelector('span').innerHTML = 'Please enter destination city'
|
||||||
|
hideToaster(element)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (!Nationality) {
|
||||||
|
element.classList.remove('d-none')
|
||||||
|
element.querySelector('span').innerHTML = 'Please select nationality'
|
||||||
|
hideToaster(element)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
let queryParams = {};
|
||||||
|
queryParams['CityCode'] = hotelDetails.getAttribute('data-cityCode');
|
||||||
|
queryParams['CityId'] = hotelDetails.getAttribute('data-city_Id');
|
||||||
|
queryParams['Country'] = hotelDetails.getAttribute('data-countryCode');
|
||||||
|
queryParams['nationality'] = Nationality;
|
||||||
|
queryParams['langCode'] = 'EN';
|
||||||
|
queryParams['checkinDate'] = moment(document.getElementById('hotelStart').value).format('DD-MMM-YYYY');
|
||||||
|
queryParams['checkoutDate'] = moment(document.getElementById('hotelEnd').value).format('DD-MMM-YYYY');
|
||||||
|
|
||||||
|
RoomDetails.map((e, i) => {
|
||||||
|
let room = []
|
||||||
|
room.push(parseInt(e.adult))
|
||||||
|
room.push(parseInt(e.child))
|
||||||
|
room.push(...e.childAge.map(no => parseInt(no)))
|
||||||
|
let roomdetails = room.join('-')
|
||||||
|
console.log(roomdetails)
|
||||||
|
queryParams[`room${i + 1}`] = roomdetails
|
||||||
|
})
|
||||||
|
// sessionStorage.setItem('SerachReqQueryObj', JSON.stringify(querystring));
|
||||||
|
const urlParams = new URLSearchParams(window.location.search);
|
||||||
|
var query = Object.keys(queryParams).map(key => key + '=' + queryParams[key]).join('&');
|
||||||
|
window.location.href = 'https://travel.neuholidays.com/hotel/result?' + query;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
function calcNumberOfNights(checkInDate, checkOutDate) {
|
||||||
|
let night = moment(checkOutDate).diff(checkInDate, 'days');
|
||||||
|
document.getElementsByClassName('nightCountgBox')[0].querySelector('.nightNum').innerHTML = night;
|
||||||
|
};
|
||||||
File diff suppressed because it is too large.
Load diff
Vendored
+2
@@ -0,0 +1,2 @@
|
|||||||
|
!function(c,h,n){"use strict";function s(t,e){this.elem=t,this.options=e,this.metadata=this.elem.getAttribute("data-plugin-options")?JSON.parse(this.elem.getAttribute("data-plugin-options")):{}}s.defaults=(s.prototype={public:function(){return{startDate:moment().startOf("day"),endDate:moment().startOf("day"),format:"L",dateSeparator:" - ",calendarCount:2,mobileBreakpoint:760,isHotelBooking:!1,inline:!1,minDate:null,maxDate:null,showHeader:!0,showFooter:!0,rangeOrientation:"horizontal",verticalRangeWidth:180,showButtons:!1,startOnMonday:!1,container:"body",oneCalendarWidth:230,enableKeyboard:!0,showOn:"bottom",arrowOn:"left",autoAlign:!0,locale:moment.locale(),singleDate:!1,target:null,autoCloseOnSelect:!1,startEmpty:!1,isRTL:!1,ranges:[{title:"Today",startDate:moment(),endDate:moment()},{title:"3 Days",startDate:moment(),endDate:moment().add(2,"days")},{title:"5 Days",startDate:moment(),endDate:moment().add(4,"days")},{title:"1 Week",startDate:moment(),endDate:moment().add(6,"days")},{title:"Till Next Week",startDate:moment(),endDate:moment().endOf("week")},{title:"Till Next Month",startDate:moment(),endDate:moment().endOf("month")}],rangeLabel:"Ranges: ",cancelLabel:"Cancel",applyLabel:"Apply",nextMonthIcon:"<i class='fa fa-arrow-right'></i>",prevMonthIcon:"<i class='fa fa-arrow-left'></i>",rangeIcon:"<i class='fa fa-retweet'></i>",headerSeparator:"<i class='fa fa-chevron-right'></i>",onbeforeselect:function(){return!0},onafterselect:function(){},onbeforeshow:function(){},onbeforehide:function(){},onaftershow:function(){},onafterhide:function(){},onfirstselect:function(){},onrangeselect:function(){},onbeforemonthchange:function(){return!0},onaftermonthchange:function(){},onafteryearchange:function(){},ondraw:function(){},onBeforeInit:function(){},onBeforeDestroy:function(){return!0},oninit:function(){},ondestroy:function(){},validateClick:function(){return!0},onCancel:function(){return!0},disableDays:function(){return!1},disabledRanges:[],continuous:!1,disableOnlyStart:!1,disableOnlyEnd:!1,minSelectedDays:0,enableMonthSwitcher:!0,enableYearSwitcher:!0,enableSwipe:!0,numericMonthSwitcher:!1,monthSwitcherFormat:"MMMM",showWeekNumbers:!1,hideOutOfRange:!1,DOBCalendar:!1}},private:function(){return{startSelected:!1,currentDate:moment().startOf("day"),endSelected:!0,hoverDate:null,keyboardHoverDate:null,headerStartDay:null,headerStartDate:null,headerStartWeekday:null,headerEndDay:null,headerEndDate:null,headerEndWeekday:null,swipeX:0,swipeY:0,swipeStart:0,swipeTimeout:null,isMobile:!1,valElements:["BUTTON","OPTION","INPUT","LI","METER","PROGRESS","PARAM"],dontHideOnce:!1,initiator:null,initComplete:!1,startDateBackup:null,startDateInitial:null,endDateInitial:null,firstValueSelected:!1,throttleTimeout:null,instanceId:null,documentEvent:null,delayInputUpdate:!1,lastScrollX:0,lastScrollY:0,isTicking:!1,parentScrollEventsAttached:!1,rafID:0,disabledDays:{}}},init:function(){return this.config=this.extend(this.extend(this.public(),this.options),this.metadata),this.globals=this.private(),this.globals.isMobile=this.checkMobile(),this.globals.instanceId=Math.round(+new Date+100*Math.random()),this.events=this.eventsPrototype(),this.events.init(this.globals.instanceId),this.config.onBeforeInit(this),this.applyConfig(),this.fetchInputs(),this.drawUserInterface(),this.drawOverlay(),this.addInitialEvents(),this.addKeyboardEvents(),(this.elem.caleran=this).config.oninit(this),this.globals.initComplete=!0,this.globals.lastScrollX=0,this.globals.lastScrollY=0,this.events.dispatch(c,"resize"),this},validateDates:function(){var t;(moment.isMoment(this.config.startDate)&&this.config.startDate.isValid()||moment(this.config.startDate,this.config.format).isValid())&&(moment.isMoment(this.config.endDate)&&this.config.endDate.isValid()||moment(this.config.endDate,this.config.format).isValid())?(this.config.startDate=moment(this.config.startDate,this.config.format).middleOfDay().locale(this.config.locale),this.config.endDate=moment(this.config.endDate,this.config.format).middleOfDay().locale(this.config.locale),this.config.startDate.isAfter(this.config.endDate,"day")&&(t=this.config.startDate.clone(),this.config.startDate=this.config.endDate.clone(),this.config.endDate=t.clone(),t=null)):(this.config.startDate=moment().middleOfDay().locale(this.config.locale),this.config.endDate=moment().middleOfDay().locale(this.config.locale)),this.globals.currentDate=moment(this.config.startDate,this.config.format),null!==this.config.minDate&&moment(this.config.minDate,this.config.format).isValid()?this.config.minDate=moment(this.config.minDate,this.config.format).middleOfDay():this.config.minDate=null,null!==this.config.maxDate&&moment(this.config.maxDate,this.config.format).isValid()?this.config.maxDate=moment(this.config.maxDate,this.config.format).middleOfDay():this.config.maxDate=null,null!==this.config.minDate&&null!==this.config.maxDate&&this.config.minDate.isAfter(this.config.maxDate,"day")&&(t=this.config.minDate.clone(),this.config.minDaLine truncated
|
||||||
|
//# sourceMappingURL=caleran.min.js.map
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
{"version":3,"sources":["../../js/caleran.js"],"names":["window","document","undefined","caleranPlugin","elem","options","this","metadata","getAttribute","JSON","parse","defaults","prototype","public","startDate","moment","startOf","endDate","format","dateSeparator","calendarCount","mobileBreakpoint","isHotelBooking","inline","minDate","maxDate","showHeader","showFooter","rangeOrientation","verticalRangeWidth","showButtons","startOnMonday","container","oneCalendarWidth","enableKeyboard","showOn","arrowOn","autoAlign","locale","singleDate","target","autoCloseOnSelect","startEmpty","isRTL","ranges","title","add","endOf","rangeLabel","cancelLabel","applyLabel","nextMonthIcon","prevMonthIcon","rangeIcon","headerSeparator","onbeforeselect","onafterselect","onbeforeshow","onbeforehide","onaftershow","onafterhide","onfirstselect","onrangeselect","onbeforemonthchange","onaftermonthchange","onafteryearchange","ondraw","onBeforeInit","onBeforeDestroy","oninit","ondestroy","validateClick","onCancel","disableDays","disabledRanges","continuous","disableOnlyStart","disableOnlyEnd","minSelectedDays","enableMonthSwitcher","enableYearSwitcher","enableSwipe","numericMonthSwitcher","monthSwitcherFormat","showWeekNumbers","hideOutOfRange","DOBCalendar","private","startSelected","currentDate","endSelected","hoverDate","keyboardHoverDate","headerStartDay","headerStartDate","headerStartWeekday","headerEndDay","headerEndDate","headerEndWeekday","swipeX","swipeY","swipeStart","swipeTimeout","isMobile","valElements","dontHideOnce","initiator","initComplete","startDateBackup","startDateInitial","endDateInitial","firstValueSelected","throttleTimeout","instanceId","documentEvent","delayInputUpdate","lastScrollX","lastScrollY","isTicking","parentScrollEventsAttached","rafID","disabledDays","init","config","extend","globals","checkMobile","Math","round","Date","random","events","eventsPrototype","applyConfig","fetchInputs","drawUserInterface","drawOverlay","addInitialEvents","addKeyboardEvents","caleran","dispatch","validateDates","swap","isMoment","isValid","middleOfDay","isAfter","clone","isBefore","checkRangeContinuity","isDisabled","clearInput","querySelector","props","p","length","key","fixDateTime","map","range","createElement","classList","tabIndex","onclick","insertAdjacentElement","appendChild","input","type","setViewport","style","display","setAttribute","arrow","width","parentNode","insertBefore","onfocus","blur","direction","clearRangeSelection","selected","querySelectorAll","r","remove","inArray","needle","haystack","Array","isArray","indexOf","elValue","tagName","value","innerText","parts","split","drawHeader","calendars","nextCal","calendarIndex","drawCalendarOfMonth","drawArrows","drawFooter","updateInput","delayState","reDrawCells","overlay","body","overlayEvents","visibleInstances","vi","item","click","headers","insertAdjacentHTML","h","updateHeader","localizeNumbers","date","year","isUpdateable","returnReasons","clearReasons","withEvents","stayEmpty","innrtText","applyButton","footer","t","hideLeftArrow","hideRightArrow","titles","_month","calendarStart","startOfWeek","day","calendarOutput","month","boxCount","monthClass","yearClass","localeWeekdays","localeData","weekdaysShort","days","prevDisabled","prevKey","cellDate","unix","cellStyle","isDisabledOnDraw","duration","innerWrap","firstChild","range_id","drawNextMonth","event","that","setTimeout","startOfMonth","buffer","scrollTop","reDrawCalendars","isCancellable","stopBubbling","drawPrevMonth","subtract","cellClicked","e","srcElement","contains","closest","cell","parseInt","selectedMoment","start","diff","hideDropdown","removeAttribute","daysInRange","startDateUnix","getDisabledLevel","isSame","i","mday","rangeIndex","isBetween","end","hotelStyle","cellHovered","innerHTML","focus","monthSwitchClicked","monthSelector","currentMonth","get","m","numericMonthSelector","hour","optimizeFontSize","rebindEventEach","yearSwitchClicked","yearSelector","currentYear","rebindEventScoped","currentYearNow","element","wrapper","parent","adjustSubject","fontAdjuster","offsetHeight","removeChild","loopCount","startSize","getComputedStyle","parseFloat","getPropertyValue","fontSize","replace","showDropdown","jQuery","Event","eventTarget","endDateUnix","minDateUnix","maxDateUnix","hoverDateUnix","keyboardHoverDateUnix","currentDateUnix","lastHoverStatus","c","calendar","cells","cellMoment","cellDay","addDisabledStyles","addSelectedStyles","addHoverStyles","attachEvents","cellDateUnix","ref","prev","previousElementSibling","matches","postformat","rangeClicked","hasAttribute","viewport","getViewport","positionOnTopAlign","positionOnTop","horizontalAlign","positionOnLeftAlign","positionOnLeft","verticalAlign","positionOnRightAlign","positionOnRight","positionOnBottomAlign","positionOnBottom","positionOnCenter","height","clientHeight","maxHeight","dropdown","getDimensions","start_difference","top","offsetTop","end_difference","bottom","abs","difference","offsetLeft","right","left","getDropLine truncated
|
||||||
Vendored
+1216
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user