document.write(`
New Chat
Let's Chat
`); var Chat = function (room) { var shoutbox = this; String.prototype.replaceAll = function (target, replacement) { return this.split(target).join(replacement); }; this.getLastMessages = function () { var senddata = localStorage.getItem('SessionId'); var Receive = ""; if (senddata == null || senddata == "") { var sessionId = createUUID(); localStorage.setItem('InputType', ''); $.get("https://www.easetours.in:5003/etcustomerchat?ChatBox=&Name=&MobileNo=&EmailId=&Location=&Session=" + sessionId + "&AuthUser=", function (data) { localStorage.setItem('SessionId', sessionId); var json_STR = JSON.stringify(data); var obj = jQuery.parseJSON(json_STR); localStorage.setItem('InputType', obj.input_type); checkInputType(obj.input_type); printChat(obj.question); $('#hand').hide(); var InputType1 = localStorage.getItem('InputType'); var senddata = localStorage.getItem('ChatMessageInfo'); if (senddata != null) { senddata = senddata + Receive; localStorage.setItem('ChatMessageInfo', senddata); } else { localStorage.setItem('ChatMessageInfo', Receive); } }); } else { Printhistory('sdf'); } } function Printhistory(gf) { var ChatMessageInfo = localStorage.getItem('ChatMessageInfo'); if(ChatMessageInfo != null){ var InputType = localStorage.getItem('InputType'); checkInputType(InputType); "

" + localStorage.getItem('ChatMessageInfo') + "

"; var ChatMessageInfo2 = localStorage.getItem('ChatMessageInfo'); $("#divSender").append(ChatMessageInfo2); $('#overlaydiv').removeClass('overlay'); var objDiv = document.getElementById("chatmessage"); objDiv.scrollTop = objDiv.scrollHeight; $("#btn-input").val(""); } } this.getLastMessages(); document.getElementById("btn-chat").addEventListener("click", function () { setTimeout($('#hand').show(), 000); var InputType = localStorage.getItem('InputType'); var p_name = GetValueByInputType(InputType); if(p_name != ""){ //$('#btn-input').val(); SendChat(p_name); $.post("https://www.easetours.in:5003/etcustomerchat?ChatBox=" + encodeURIComponent(p_name) + "&Name=&MobileNo=&EmailId=&Location=&Session=" + localStorage.getItem('SessionId') + "&AuthUser=", function (data) { var json_STR = JSON.stringify(data); var obj = jQuery.parseJSON(json_STR); localStorage.setItem('InputType', obj.input_type); checkInputType(obj.input_type); if(obj.input_type=="displayitinerary"){ PrintItenary(obj.displayitinerary); }else{ printChat(obj.question); } $('#hand').hide(); }); $('#overlaydiv').removeClass('overlay'); var objDiv = document.getElementById("chatmessage"); objDiv.scrollTop = objDiv.scrollHeight; $("#btn-input").val(""); }else{ $('#hand').hide(); } }); var buttons = document.getElementsByClassName('open_btn'); document.getElementById('btn-input').addEventListener("keypress", keyPressedFunction.bind(this), false); buttons[0].addEventListener('click', function (event) { $('.toggle_chat').slideToggle(); setTimeout(function () { var toggleState = $('.toggle_chat').css('display'); if (toggleState == 'none') { $(".header div").attr('class', 'open_btn'); } else { $(".header div").attr('class', 'close_btn'); } }, 1000); }); function keyPressedFunction(e) { if (!e) { e = window.event; } var keyCode = e.keyCode || e.which; if (keyCode == '13') { this.sendText(); } } this.sendText = function () { $('#hand').show(); var InputType = localStorage.getItem('InputType'); var p_name =GetValueByInputType(InputType); if(p_name != ""){ SendChat(p_name); $.post("https://www.easetours.in:5003/etcustomerchat?ChatBox=" + encodeURIComponent(p_name) + "&Name=&MobileNo=&EmailId=&Location=&Session=" + localStorage.getItem('SessionId') + "&AuthUser=", function (data) { var d = new Date(); tis = d.toLocaleTimeString().split(" "); hh = tis[0].split(':'); var json_STR = JSON.stringify(data); var obj = jQuery.parseJSON(json_STR); localStorage.setItem('InputType', obj.input_type); checkInputType(obj.input_type); if(obj.input_type=="displayitinerary"){ PrintItenary(obj.displayitinerary); }else{ printChat(obj.question); } }); $('#overlaydiv').removeClass('overlay'); var objDiv = document.getElementById("chatmessage"); objDiv.scrollTop = objDiv.scrollHeight; $("#btn-input").val(""); }else{ $('#hand').hide(); } }; function loader() { $('#hand').hide(); } $(".shoutBoxContainer").on("click", ".shoutBoxUserItem", function (e) { e.stopImmediatePropagation(); var userid = ($(e.currentTarget).data("id")); shoutbox.openPrivateChat(userid); }); this.displayError = function ($_element, message) { $_element.html(message); setTimeout(function () { $_element.empty(); }, 1000); }; $("#shoutBoxHeader").click(function () { $("#shoutBoxUserList").toggle("fast"); }); function createUUID() { var s = []; var hexDigits = "0123456789abcdef"; for (var i = 0; i < 36; i++) { s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1); } s[14] = "4"; // bits 12-15 of the time_hi_and_version field to 0010 s[19] = hexDigits.substr((s[19] & 0x3) | 0x8, 1); // bits 6-7 of the clock_seq_hi_and_reserved to 01 s[8] = s[13] = s[18] = s[23] = "-"; var uuid = s.join(""); return uuid; } function PrintItenary(){ } function checkInputType(valuecon) { switch (valuecon) { case "Confirmation": $('#Confirmation').show(); $('#btn-input').hide(); $('#Confirmation').show(); $('#Popula').hide(); var eladd = $(".textid"); eladd.attr("id", "btn-input") eladd.attr("required", "required"); eladd.attr("autofocus", "autofocus"); eladd.attr("placeholder", "Type yours queries.."); var el1 = $(".budjetid"); el1.removeAttr("required"); el1.removeAttr("id"); var el = $(".numberid"); el.removeAttr("id"); el.removeAttr("required"); var elc = $(".calendarid"); elc.removeAttr("id"); elc.removeAttr("required"); var el2 = $(".purpose"); el2.removeAttr("required"); el2.removeAttr("id"); var el3 = $(".calendarid2"); el3.removeAttr("required"); el3.removeAttr("id"); break; case "Name": $('#btn-input').show(); $('#Popula').hide(); var eladd = $(".textid"); eladd.attr("id", "btn-input") eladd.attr("required", "required"); eladd.attr("autofocus", "autofocus"); eladd.attr("placeholder", "Type yours queries.."); var el1 = $(".budjetid"); el1.removeAttr("required"); el1.removeAttr("id"); var el = $(".numberid"); el.removeAttr("id"); el.removeAttr("required"); var elc = $(".calendarid"); elc.removeAttr("id"); elc.removeAttr("required"); var el2 = $(".purpose"); el2.removeAttr("required"); el2.removeAttr("id"); var el3 = $(".calendarid2"); el3.removeAttr("required"); el3.removeAttr("id"); break; case "text": $('#btn-input').show(); $('#Popula').hide(); var eladd = $(".textid"); eladd.attr("id", "btn-input") eladd.attr("required", "required"); eladd.attr("autofocus", "autofocus"); eladd.attr("placeholder", "Type yours queries.."); var el1 = $(".budjetid"); el1.removeAttr("required"); el1.removeAttr("id"); var el = $(".numberid"); el.removeAttr("id"); el.removeAttr("required"); var elc = $(".calendarid"); elc.removeAttr("id"); elc.removeAttr("required"); var el2 = $(".purpose"); el2.removeAttr("required"); el2.removeAttr("id"); var el3 = $(".calendarid2"); el3.removeAttr("required"); el3.removeAttr("id"); break; case "population": $('#btn-input').hide(); $('#Popula').show(); var el1 = $(".budjetid"); el1.removeAttr("required"); el1.removeAttr("id"); var el = $(".numberid"); el.removeAttr("id"); el.removeAttr("required"); var elc = $(".calendarid"); elc.removeAttr("id"); elc.removeAttr("required"); var el2 = $(".purpose"); el2.removeAttr("required"); el2.removeAttr("id"); var el3 = $(".calendarid2"); el3.removeAttr("required"); el3.removeAttr("id"); break; case "day": $('#Popula').hide(); $('#btn-input').show(); var eladd = $(".textid"); eladd.attr("id", "btn-input") eladd.attr("required", "required"); eladd.attr("autofocus", "autofocus"); eladd.attr("placeholder", "Type yours queries.."); var el1 = $(".budjetid"); el1.removeAttr("required"); el1.removeAttr("id"); var el = $(".numberid"); el.removeAttr("id"); el.removeAttr("required"); var elc = $(".calendarid"); elc.removeAttr("id"); elc.removeAttr("required"); var el2 = $(".purpose"); el2.removeAttr("required"); el2.removeAttr("id"); var el3 = $(".calendarid2"); el3.removeAttr("required"); el3.removeAttr("id"); break; break; case "mobileNo": $('#Popula').hide(); $('#btn-input').show(); var eladd = $(".textid"); eladd.attr("id", "btn-input") eladd.attr("required", "required"); eladd.attr("autofocus", "autofocus"); var el1 = $(".budjetid"); el1.removeAttr("required"); el1.removeAttr("id"); var el = $(".numberid"); el.removeAttr("id"); el.removeAttr("required"); var elc = $(".calendarid"); elc.removeAttr("id"); elc.removeAttr("required"); var el2 = $(".purpose"); el2.removeAttr("required"); el2.removeAttr("id"); var el3 = $(".calendarid2"); el3.removeAttr("required"); el3.removeAttr("id"); $('#RadiobtnDiv').hide(); $("#btn-input").removeClass("hasDatepicker"); $("#btn-input").datepicker("destroy"); break; case "radio": $('#Popula').hide(); var radiobtn = $("input[name=radiobtn]"); var checkedValue = radiobtn.filter(":checked").val(); p_name = checkedValue; break; case "EmailId": $('#Popula').hide(); $('#btn-input').show(); var eladd = $(".textid"); eladd.attr("id", "btn-input") eladd.attr("required", "required"); eladd.attr("autofocus", "autofocus"); var el1 = $(".budjetid"); el1.removeAttr("required"); el1.removeAttr("id"); var el = $(".numberid"); el.removeAttr("id"); el.removeAttr("required"); var elc = $(".calendarid"); elc.removeAttr("id"); elc.removeAttr("required"); var el2 = $(".purpose"); el2.removeAttr("required"); el2.removeAttr("id"); var el3 = $(".calendarid2"); el3.removeAttr("required"); el3.removeAttr("id"); $('#RadiobtnDiv').hide(); break; case "option": $('#Popula').hide(); $('#btn-input').hide(); $('#RadiobtnDiv').show(); var startDate = new Date(); $('#grpfixeddate').hide(); $('#grpflexibledate').hide(); break; case "date": $('#Popula').hide(); p_name = $('#btn-input').datepicker(); break; case "select": $('#Popula').hide(); $('#Popula').hide(); $('#btn-input').hide(); $('#RadiobtnDiv').hide(); $('#selectDiv').show(); var startDate = new Date(); $('#grpfixeddate').hide(); $('#grpflexibledate').hide(); break; default: $('#btn-input').show(); $('#Popula').hide(); $('#Confirmation').hide(); //$("input").attr('disabled','disabled'); var eladd = $(".textid"); eladd.attr("id", "btn-input") eladd.attr("required", "required"); eladd.attr("autofocus", "autofocus"); eladd.attr("placeholder", "Type yours queries.."); var el1 = $(".budjetid"); el1.removeAttr("required"); el1.removeAttr("id"); var el = $(".numberid"); el.removeAttr("id"); el.removeAttr("required"); var elc = $(".calendarid"); elc.removeAttr("id"); elc.removeAttr("required"); var el2 = $(".purpose"); el2.removeAttr("required"); el2.removeAttr("id"); var el3 = $(".calendarid2"); el3.removeAttr("required"); el3.removeAttr("id"); break; case "population": $('#btn-input').hide(); $('#Popula').show(); var el1 = $(".budjetid"); el1.removeAttr("required"); el1.removeAttr("id"); var el = $(".numberid"); el.removeAttr("id"); el.removeAttr("required"); var elc = $(".calendarid"); elc.removeAttr("id"); elc.removeAttr("required"); var el2 = $(".purpose"); el2.removeAttr("required"); el2.removeAttr("id"); var el3 = $(".calendarid2"); el3.removeAttr("required"); el3.removeAttr("id"); break; } } function GetValueByInputType(valuecon) { var p_name_value; switch (valuecon) { case "Name": p_name_value = $('#btn-input').val(); break; case "Confirmation": var radiobtn = $("input[name=yeFixed]"); var checkedValue = radiobtn.filter(":checked").val(); p_name_value = checkedValue; // checkedValue = $('#btn-input').val(); // alert(p_name_value) break; case "text": p_name_value = $('#btn-input').val(); break; case "day": p_name_value = $('#btn-input').val(); break; case "population": p_name_value = $('#Adult').val() + '|' + $('#Child').val(); //p_name_value = "population" + "~Adult : " + $('#Adult').val() + "~Child : " + $('#Child').val(); //p_name_value = $('#btn-input').val(); break; case "MobileNo": p_name_value = $('#btn-input').val(); break; case "radio": var radiobtn = $("input[name=radiobtn]"); var checkedValue = radiobtn.filter(":checked").val(); p_name = checkedValue; break; case "EmailId": p_name_value = $('#btn-input').val(); break; case "option": var radiobtn = $("input[name=dateFixed]"); var checkedValue = radiobtn.filter(":checked").datepicker().val(); if(checkedValue ==1) { p_name_value=$('.calendarid').val(); }else{ p_name_value=$('.calendarid2').val(); } $('#btn-input').show(); $('#RadiobtnDiv').hide(); $('#grpflexibledate').hide(); $('#grpfixeddate').hide(); var eladd = $(".textid"); eladd.attr("id", "btn-input") eladd.attr("required", "required"); eladd.attr("autofocus", "autofocus"); eladd.attr("placeholder", "Type yours queries.."); var el1 = $(".budjetid"); var el = $(".numberid"); var elc = $(".calendarid"); var el2 = $(".purpose"); elc.removeAttr("required"); el1.removeAttr("required"); el.removeAttr("required"); el2.removeAttr("required"); elc.removeAttr("id"); el1.removeAttr("id"); el.removeAttr("id"); el2.removeAttr("id"); var el3 = $(".calendarid2"); el3.removeAttr("required"); el3.removeAttr("id"); break; case "date": p_name = $('#btn-input').datepicker({ dateFormat: 'dd/mm/yyyy' }).val(); break; case "select": p_name = $('#btn-input').val(); break; default: p_name_value = $('#btn-input').val(); break; case "day": p_name_value = $('#btn-input').val(); break; case "population": p_name_value = $('#Adult').val() + '|' + $('#Child').val(); //p_name_value = "population" + "~Adult : " + $('#Adult').val() + "~Child : " + $('#Child').val(); //p_name_value = $('#btn-input').val(); break; } return p_name_value; } var swiper = new Swiper('.swiper-container', { navigation: { nextEl: '.swiper-button-next', prevEl: '.swiper-button-prev', } }); function PrintItenary(obj){ $('#Confirmation').hide(); $('#Popula').hide(); $('.panel-footerChat').hide(); debugger var Receive = ""; var response=""; for (var i = 0; i < obj.length; i++) { debugger if(i==0){ response +="
"+ "
  • "+ "
    "+ ""+ "Chania
    "+ "
    "+ "Guaranteed Package
    "+ "
    "+ "Flag"+obj[i].package_name+ "
    "+ "Datedate
    "+ "
    "+ "Money Rs. '"+obj[i].price+"'
    "+ "
    "; } else{ response += "
    "+ "
  • "+ "
    "+ "Chania
    "+ "
    Guaranteed Package
    Flag"+obj[i].package_name+"
    Datedate
    "+ "Money Rs. '"+obj[i].price+"'
    "+ "
    "; } } Receive ="
    "+ "
    "+ "
    "+ "
    "+ "
    "+ "
    "+ "

    "+ ""+ "

    "; $('#divSender').append(Receive); $('#Confirmation').hide(); $('#Popula').hide(); $('.panel-footerChat').hide(); var swiper = new Swiper('.swiper-container', { navigation: { nextEl: '.swiper-button-next', prevEl: '.swiper-button-prev', } }); var senddata = localStorage.getItem('ChatMessageInfo'); if(senddata != null) { senddata = senddata + Receive; }else{ senddata = Receive; } localStorage.setItem('ChatMessageInfo', senddata); var objDiv = document.getElementById("chatmessage"); objDiv.scrollTop = objDiv.scrollHeight; $("#btn-input").val(""); $('#hand').hide(); } function printChat(question) { var Receive = ""; var d = new Date(); var tis = d.toLocaleTimeString().split(" "); var hh = tis[0].split(':'); for (var i = 0; i < question.length; i++) { Receive += "
    "+ "
    " + "
    " + "
    " + "

    " + question[i] + "

    " + "
    " + "
    " + "
    " + hh[0] + ":" + hh[1] + " " + tis[1] + "
    "+ "
    "; } $('#divSender').append(Receive); var senddata = localStorage.getItem('ChatMessageInfo'); if(senddata != null) { senddata = senddata + Receive; }else{ senddata = Receive; } localStorage.setItem('ChatMessageInfo', senddata); var objDiv = document.getElementById("chatmessage"); objDiv.scrollTop = objDiv.scrollHeight; $("#btn-input").val(""); $('#hand').hide(); } function SendChat(p_name) { var d = new Date(); var tis = d.toLocaleTimeString().split(" "); var hh = tis[0].split(':'); var send = "
    " + "
    " + "
    " + "

    " + p_name + "

    " + "
    " + "
    " + "
    " + hh[0] + ":" + hh[1] + " " + tis[1] + "
    " $("#divSender").append(send); var senddata = localStorage.getItem('ChatMessageInfo'); senddata = senddata + send; localStorage.setItem('ChatMessageInfo', senddata); } function loader() { $('#hand').hide(); } $('input[type=radio][name=dateFixed]').change(function () { if (this.value == 1) { $('#grpfixeddate').show(); $('#grpflexibledate').hide(); var eladd = $(".calendarid"); eladd.attr("id", "btn-input"); eladd.attr("required", "required"); eladd.attr("autofocus", "autofocus"); var el3 = $(".calendarid2"); el3.removeAttr("required"); el3.removeAttr("id"); var textField = document.getElementById("btn-input"); textField.focus(); } else { $('#grpflexibledate').show(); $('#grpfixeddate').hide(); var eladd = $(".calendarid2"); eladd.attr("id", "btn-input"); eladd.attr("required", "required"); var el3 = $(".calendarid"); el3.removeAttr("required"); el3.removeAttr("id"); eladd.attr("autofocus", "autofocus"); var textField1 = document.getElementById("btn-input"); textField1.focus(); } }); var Child = 0; $('.Child-Plus').click(function (e) { e.preventDefault(); var Child = parseInt($('#Child').val()); $('#Child').val(Child + 1); }); $('.Child-minus').click(function (e) { e.preventDefault(); var Child = parseInt($('#Child').val()); if (Child > 0) { $('#Child').val(Child - 1); } }); var Adult = 0; $('.Adult-plus').click(function (e) { e.preventDefault(); var Adult = parseInt($('#Adult').val()); $('#Adult').val(Adult + 1); }); $('.Adult-minus').click(function (e) { e.preventDefault(); var Adult = parseInt($('#Adult').val()); if (Adult == 1) { $('#Adult').val(1); } else if (Adult > 0) { $('#Adult').val(Adult - 1); } }); $(".newcht").hide(); $(".menuchat").hover(function(){ $(".newcht").show(); },function(){ $(".newcht").hide(); }); $(".menuchat").click(function(){ localStorage.clear(); //$("#mydiv").load(this); location.reload(); //alert("hi") }); $('.from').datepicker({ autoclose: true, format: 'dd/mm/yyyy', todayHighlight: true, startDate: '+7d', maxDate: "+4M +10D" }).on('changeDate', function (selected) { startDate = new Date(selected.date.valueOf()); startDate.setDate(startDate.getDate(new Date(selected.date.valueOf()))); }); $('.to').datepicker({ autoclose: true, minViewMode: 1, format: 'mm/yyyy', startDate: '+7d', maxDate: "+4M +10D" }).on('changeDate', function (selected) { FromEndDate = new Date(selected.date.valueOf()); FromEndDate.setDate(FromEndDate.getDate(new Date(selected.date.valueOf()))); }); };