403Webshell
Server IP : 103.234.187.230  /  Your IP : 216.73.216.216
Web Server : Apache
System : Linux lserver42043-ind.megavelocity.net 3.10.0-1160.108.1.el7.x86_64 #1 SMP Thu Jan 25 16:17:31 UTC 2024 x86_64
User : apache ( 48)
PHP Version : 7.4.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /var/www/html/holidays.tripjack.com/public/js/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/html/holidays.tripjack.com/public/js/custom_mangal.js
(function ($) {


    $(document).on('click', '.sendRateEnuiryPackagetour', function () {
        var PkgSysId = $(this).attr('data-rvs');

        var PackageType = $('#packagetype_' + PkgSysId).val();
        var GTXPkgId = $('#gtxpackage_' + PkgSysId).val();
        var hotelcategoryid = $('#hotelcategoryid_' + PkgSysId).val();
        var packagetpid = $('#packagetpid_' + PkgSysId).val();
        var tourtype = $('#tourtype_' + PkgSysId).val();
        var packagenamemodal = $('#packagename_' + PkgSysId).val();
        var mealplantype = $('#mealplantype_' + PkgSysId).val();
        var packagedesname = $('#packagedesname_' + PkgSysId).val();
        var currencyType = $('#currencyType_' + PkgSysId).val();

        $('.msgs').hide().html('');
        $('.smsg1').hide().html('');
        $("#leadsends").val('0');
        //$('#expandsave').hide();
        $('#packagesys_ids').val(PkgSysId);
        $('#packagetype_ids').val(PackageType);
        $('#package_sids').val(GTXPkgId);
        $('#package_hotelcategoryids').val(hotelcategoryid);
        $('#package_mealplantypeids').val(mealplantype);
        $('#package_tpids').val(packagetpid);
        $('#package_tourtype_ids').val(tourtype);
        $('#packagenamemodal').html(packagenamemodal);
        $('#mpackage_name').val(packagenamemodal);
        $('#packagedesname').val(packagedesname);
        $('.WebRupeeHtml').html(currencyType);
        $('#displaySendRateEnquiryForm').show();
        //$('.hidebutton').find('.sending1').show().html('Check Rate & Send Enquiry').attr('disabled', false);
        //$('.hidebutton').find('.sending2').show().html('Send Enquiry').attr('disabled', false).css('color', '#fff');
        $('.package_rate_enquiry #tableCost, .class-modify-enquiry').hide();
        $('.package_rate_enquiry .smsg1').html('');
        $('.inserted-room-row').remove();
        $('.addmore').show();
        $('.package_rate_enquiry #traveler_adult_1').val(1);
        $('.package_rate_enquiry #traveler_kids_1 , .package_rate_enquiry #traveler_infant_1').val(0);
        $('#itinerary_inputs').val(1);
        $('#itinerary_rooms').val(2);
        $('.hidebutton').find('.class-modify-enquiry').hide();
        if ($('#check_TravelAgent').val() == 1) {
            $('#Send_Enquiry').click();
        }
    });
    $(document).on('click', '.sendRateEnuiryPackage', function () {
        var PkgSysId = $(this).attr('data-rvs');
        var PackageType = $('#packagetype_' + PkgSysId).val();
        var GTXPkgId = $('#gtxpackage_' + PkgSysId).val();
        var hotelcategoryid = $('#hotelcategoryid_' + PkgSysId).val();
        var packagetpid = $('#packagetpid_' + PkgSysId).val();
        var tourtype = $('#tourtype_' + PkgSysId).val();
        var packagenamemodal = $('#packagename_' + PkgSysId).val();
        var mealplantype = $('#mealplantype_' + PkgSysId).val();
        var packagedesname = $('#packagedesname_' + PkgSysId).val();
        $('.msgs').hide().html('');
        $('.smsg1').hide().html('');
        $("#leadsends").val('0');
        //$('#expandsave').hide();
        $('#packagesys_ids').val(PkgSysId);
        $('#packagetype_ids').val(PackageType);
        $('#package_sids').val(GTXPkgId);
        $('#package_hotelcategoryids').val(hotelcategoryid);
        $('#package_mealplantypeids').val(mealplantype);
        $('#package_tpids').val(packagetpid);
        $('#package_tourtype_ids').val(tourtype);
        $('#packagenamemodal').html(packagenamemodal);
        $('#mpackage_name').val(packagenamemodal);
        $('#packagedesname').val(packagedesname);
        $('#displaySendRateEnquiryForm').show();
        //        $('.hidebutton').find('.sending1').show().html('Check Rate & Send Enquiry').attr('disabled', false);
        $('.hidebutton').find('.sending1').show().html('Send Enquiry').attr('disabled', false).css('color', '#fff');
        $('.package_rate_enquiry #tableCost, .class-modify-enquiry').hide();
        $('.package_rate_enquiry .smsg1').html('');
        $('.inserted-room-row').remove();
        $('.addmore').show();
        $('.package_rate_enquiry #traveler_adult_1').val(1);
        $('.package_rate_enquiry #traveler_kids_1 , .package_rate_enquiry #traveler_infant_1').val(0);
        $('#itinerary_inputs').val(1);
        $('#itinerary_rooms').val(2);
        $('.hidebutton').find('.class-modify-enquiry').hide();
        if ($('#check_TravelAgent').val() == 1) {
            $('#Send_Enquiry').click();
        }
    });





})(jQuery);

$(".sendingrequest").on('click', function (e) {
    var EmailReg = new RegExp(/^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/);
    e.preventDefault();
    var data = $(".sendingrequestCallback").serialize();

    //console.log(data);
    if ($('.sendingrequestCallback input[name="email"]').val() == '') {
        $('.msgrequest').show().html('Please enter your email id').css('color', 'red').fadeIn().delay(5000).fadeOut();
        $('.sendingrequestCallback input[name="email"]').focus();
        return false;
    }
    if (!EmailReg.test($('.sendingrequestCallback input[name="email"]').val())) {
        $('.msgrequest').show().html('Please enter valid email address!!!').css('color', 'red').fadeIn().delay(5000).fadeOut();
        $('.sendingrequestCallback input[name="email"]').focus();
        return false;
    }
    if ($('.sendingrequestCallback input[name="mobile"]').val() == '') {
        $('.msgrequest').show().html('Please enter your Mobile').css('color', 'red').fadeIn().delay(5000).fadeOut();
        $('.sendingrequestCallback input[name="mobile"]').focus();
        return false;
    }
    if (!$.isNumeric($('.sendingrequestCallback input[name="mobile"]').val())) {
        $('.msgrequest').show().html('Mobile should be numeric!!').css('color', 'red').fadeIn().delay(5000).fadeOut();
        $('.sendingrequestCallback input[name="mobile"]').focus();
        return false;
    }
    // if ($('.sendingrequestCallback input[name="mobile"]').val().length != '10') {
    //     $('.msgrequest').show().html('Mobile should be 10 digit?').css('color', 'red').fadeIn().delay(5000).fadeOut();
    //     $('.sendingrequestCallback input[name="mobile"]').focus();
    //     return false;
    // }

    $('.msgrequest').html('');
    $('.sendingrequest').attr('disabled', true);
    $.ajax({
        url: SITEURL + 'cms/index/sendenquiry', type: 'POST', data: data, dataType: 'json', beforeSend: function () {
            $('.sendingrequest').html('<i class="ace-icon fa fa-spinner fa-spin orange bigger-125"></i> Sending...');
        }, success: function (result) {
            if (result.status) {

                $('.sendingrequest').html('Request a callback');
                $('.msgrequest').html(result.message).css({'color': '#5cb85c'}).fadeIn().delay(5000).fadeOut();
            } else {
                $('.sendingrequest').html('Request a callback');
                $('.msgrequest').html(result.message);
            }


        }, error: function (result) {
            $('.sendingrequest').html('Request a callback').attr('disabled', false);
            alert('Some error occured.');
        }
    });
});


$(".sendEnquiry").on('submit', function (e) {
    e.preventDefault();
    var data = $(this).serialize();
    var EmailReg = new RegExp(/^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/);
    if ($('.sendEnquiry input[name="name"]').val() == '') {
        $('.enqmsg').html('Please enter your name').css('color', 'red').fadeIn().delay(2000).fadeOut();
        $('.sendEnquiry input[name="name"]').focus();
        return false;
    }

    if ($('.sendEnquiry input[name="mobile"]').val() == '') {
        $('.enqmsg').html('Please enter your Mobile').css('color', 'red').fadeIn().delay(2000).fadeOut();
        $('.sendEnquiry input[name="mobile"]').focus();
        return false;
    }
    if (!$.isNumeric($('.sendEnquiry input[name="mobile"]').val())) {
        $('.enqmsg').html('Mobile should be numeric!!').css('color', 'red').fadeIn().delay(2000).fadeOut();
        $('.sendEnquiry input[name="mobile"]').focus();
        return false;
    }
    // if ($('.sendEnquiry input[name="mobile"]').val().length != '10') {
    //     $('.enqmsg').html('Mobile should be 10 digit?').css('color', 'red').fadeIn().delay(2000).fadeOut();
    //     $('.sendEnquiry input[name="mobile"]').focus();
    //     return false;
    // }
    if ($('.sendEnquiry input[name="email"]').val() == '') {
        $('.enqmsg').html('Please enter your email id').css('color', 'red').fadeIn().delay(2000).fadeOut();
        $('.sendEnquiry input[name="email"]').focus();
        return false;
    }
    if (!EmailReg.test($('.sendEnquiry input[name="email"]').val())) {
        $('.enqmsg').html('Please enter valid email address!!!').css('color', 'red').fadeIn().delay(2000).fadeOut();
        $('.sendEnquiry input[name="email"]').focus();
        return false;
    }

    $('.enqmsg').html('');
    $('.sendEnquirySubmit').attr('disabled', 'disabled');
    $.ajax({
        url: SITEURL + 'cms/index/sendenquiry', type: 'POST', data: data, dataType: 'json', beforeSend: function () {
            $('.sendEnquirySubmit').val('Sending...');
        }, success: function (result) {
            if (result.status) {
                $('.sendEnquirySubmit').val('Send Enquiry');
                $('.enqmsg').html(result.message).css('color', 'green');

            } else {
                $('.sendEnquirySubmit').val('Send Enquiry');
                $('.enqmsg').html(result.message)
            }


        }, error: function (result) {
            $('.sendEnquirySubmit').val('Send Enquiry');
            alert('Some error occured.');
        }
    });

});



function checkValidateBedType(pkg,type,id){
    var adult = $("#adult_" + type + pkg + id).val();
    var child = $("#child_" + type + pkg + id).val();
    var child2 = $("#child_" + type + pkg + id + '_2').val();
    var infant = $("#infant_" + type + pkg + id).val();
    var childrencount = $("#child_" + type + pkg + id).val();
    for (j = 1; j <= childrencount; j++) {
        $("#childcl_" + type + pkg + id + "_" + j).show();
        if(j>1){
            $("#childcl_" + type + pkg + id + "_" + j + ' select option[value="extrabed"]').attr('hidden', true);
            $("#childcl_" + type + pkg + id + "_" + j + ' select option[value="none"]').removeAttr('hidden');
            $("#childcl_" + type + pkg + id + "_" + j + ' select option[value="withoutbed"]').removeAttr('hidden');
            $("#childcl_" + type + pkg + id + "_" + j + ' select').val('withoutbed');
        }else{
            if(parseInt(adult) > 2){
                $("#childcl_" + type + pkg + id + "_" + j + ' select option[value="extrabed"]').attr('hidden', true);
                $("#childcl_" + type + pkg + id + "_" + j + ' select option[value="none"]').removeAttr('hidden');
                $("#childcl_" + type + pkg + id + "_" + j + ' select option[value="withoutbed"]').removeAttr('hidden');
                $("#childcl_" + type + pkg + id + "_" + j + ' select').val('withoutbed');
            }else{
//                if(parseInt(childrencount) > 1){
//                    $("#childcl_" + type + pkg + id + "_" + j + ' select option[value="withoutbed"]').attr('hidden', true);
//                    $("#childcl_" + type + pkg + id + "_" + j + ' select option[value="none"]').attr('hidden', true);
//                    $("#childcl_" + type + pkg + id + "_" + j + ' select option[value="extrabed"]').removeAttr('hidden');
//                    $("#childcl_" + type + pkg + id + "_" + j + ' select').val('extrabed');
//                }else{
                    $("#childcl_" + type + pkg + id + "_" + j + ' select option[value="withoutbed"]').removeAttr('hidden');
                    $("#childcl_" + type + pkg + id + "_" + j + ' select option[value="extrabed"]').removeAttr('hidden');
                    $("#childcl_" + type + pkg + id + "_" + j + ' select option[value="none"]').removeAttr('hidden');
                    $("#childcl_" + type + pkg + id + "_" + j + ' select').val('extrabed');
//                }
            }  
        } 
    }
}

function travellerId(id) {
// alert(id);
    var checkClass = $(".roomBoxMain" + id).hasClass('myCustomClass');
// alert(".roomBoxMain"+id);
    if (checkClass == false) {
        $(".roomBoxMain" + id).toggle('myCustomClass');
        $(".roomBoxMain" + id).css('display', 'block');
        $('#adultgroup_1 select').val(2);
    } else {
        $(".roomBoxMain" + id).css('display', 'none');
    }
}
// alert("check");

//Added by Piyush on 22 Aug 2018 start

$("#travelers").on("click", function () {
    // alert("check");

    var checkClass = $(".roomBoxMain").hasClass('myCustomClass');
    if (checkClass == false) {
        $(".roomBoxMain").toggle('myCustomClass');
        $(".roomBoxMain").css('display', 'block');
        $('#adultgroup_1 select').val(2);
    } else {
        $(".roomBoxMain").css('display', 'none');
    }
});
function checkTravellers(that, rownumber) {

    var div = $(that).closest('.room-rows-container');
    var totalpax = 0;
    var adults = div.find('#traveler_adult_' + rownumber).val();
    var kids = div.find('#traveler_kids_' + rownumber).val();
    var infant = div.find('#traveler_infant_' + rownumber).val();
    totalpax = parseInt(adults) + parseInt(kids) + parseInt(infant);

    if (parseInt(totalpax) > 4) {
        alert("Total pax can not be more than 4 in a room. Please modify travellers in room " + rownumber);

        if ($(that).hasClass('traveler_adult'))
            $(that).val(1); // reset the current value
        else
            $(that).val(0); // reset the current value

        return false;
    } else {
        if (parseInt(adults) == 3) {
            div.find('#room-row-adult-bedtype-' + rownumber).show();
            div.find('#room-row-adult-bedtype-' + rownumber + ' select').val('extrabed');
        } else {
            div.find('#room-row-adult-bedtype-' + rownumber).hide();
            div.find('#room-row-adult-bedtype-' + rownumber + ' select').val('');
        }

        div.find('.room-row-child-bedtype-' + rownumber).hide(); // hide all select box
        if (parseInt(kids) > 0) {
            for (var i = 1; i <= parseInt(kids); i++) {
                div.find('#room-row-child-bedtype-' + rownumber + "-" + i).show();
                div.find('#room-row-child-bedtype-' + rownumber + "-" + i + ' select').val('extrabed');
            }
        }
    }

}
function tottraveller() {
    var totaladult = '0';
    var totalchild = '0';
    var totalinfant = '0';
    var Group = $('.Group').is(":checked");
    var roomlp = $("#roomlp").val();
    var isHotel = $("#isHotel").val();
    if (isHotel == 0) {
        totaladult = $("#totaladult").val();
        totalchild = $("#totalchild").val();
        if (totaladult === '') {
            alert('Please enter total adults');
            $("#totaladult").focus();
            return false;
        }
        if (totalchild === '') {
            alert('Please enter total children');
            $("#totalchild").focus();
            return false;
        }
        totalinfant = 0;
        var totaltraveller = parseInt(totaladult) + parseInt(totalchild);

    } else {

        var childrenbed = [];
        for (j = 1; j <= roomlp; j++) {
            totaladult = parseFloat(totaladult) + parseFloat($("#adult_" + j).val());
            totalchild = parseFloat(totalchild) + parseFloat($("#child_" + j).val());

            totalinfant = parseFloat(totalinfant) + parseFloat($("#infant_" + j).val());
            var extraBed = $('#extrabed_' + j + ':checked').val();
            childrenbed.push(extraBed);
        }
        var totaltraveller = parseInt(totaladult) + parseInt(totalchild) + parseInt(totalinfant);
        var MaxPax = parseInt(roomlp) * 4;
//        if (Group === false) {
        if (totaltraveller > MaxPax) {
            alert('Only 4 pax are allowed in each room. Please modify travelers');
            return false;
        }
//        }
    }
    $("#totadlt").val(totaladult);
    $("#totchld").val(totalchild);
    $("#totinfnt").val(totalchild);
    $("#numberofroom").html(roomlp);
    $("#roomguest").html(totaltraveller);
    $("#totaltravelers").val(totaltraveller);
    $(".roomBoxMain").hide();
    var roominfojson = '[{"totalRoom" : ' + roomlp + '},{"totalTraveler" : ' + totaltraveller + '},{"totaladult" : ' + totaladult + '},{"totalchild" : ' + totalchild + '},{"totalinfant" : ' + totalinfant + '}]'
    $("#roominfojson").val(roominfojson);
    $(".roomBoxMain").hide();
}
function tottraveller1(that, type) {
    var pkg = $(that).attr('pkg');

    var totaladult = '0';
    var totalchild = '0';
    var totalinfant = '0';
    var roomlp = $("#roomlp" + type + pkg).val();
    var isHotel = $("#isHotel" + pkg).val();
    var IsSharingPrice = $('#ISharingPrice' + pkg).val();

    if (isHotel == 0) {
        totaladult = $("#totaladult").val();
        totalchild = $("#totalchild").val();
        if (totaladult === '') {
            alert('Please enter total adults');
            $("#totaladult").focus();
            return false;
        }
        if (totalchild === '') {
            alert('Please enter total children');
            $("#totalchild").focus();
            return false;
        }
        totalinfant = 0;
        var totaltraveller = parseInt(totaladult) + parseInt(totalchild);

    } else {
        var childrenbed = [];
        var adult_type = 0;
         if(typeof IsSharingPrice == 'undefined'){
                IsSharingPrice = 0;
          }
        for (j = 1; j <= roomlp; j++) {
            var extrabedValid = 0;
            var adult = parseInt($("#adult_" + type + pkg + j).val());
            totaladult = parseInt(totaladult) + adult;
            var child = parseInt($("#child_" + type + pkg + j).val());
            var child2 = parseInt($("#child_" + type + pkg + j +'_2').val());
            var infant =  parseInt($("#infant_" + type + pkg + j).val());
            if (typeof child2 == 'undefined' || isNaN(child2)) {
                child2 = 0;
            }

            totalchild = parseInt(totalchild) + parseInt(child) + parseInt(child2);
            totalinfant = parseInt(totalinfant) + parseInt($("#infant_" + type + pkg + j).val());
            var extraBed = $('#extrabed_' + pkg + j + ':checked').val();
            childrenbed.push(extraBed);
            var sharing_type = $('.adult_type_' + j + '_' + type +':checked').val();
            if ((typeof sharing_type != 'undefined') && (sharing_type == 'hexa' || sharing_type == 'quint' || sharing_type == 'quad')) {
                adult_type++;
            }
            if (adult > 2) {
                var adult_bed_type = $('.adult_bed_type_' + type + pkg + j).val();
                if (adult_bed_type == 'extrabed') {
                    extrabedValid++;
                }
            }
            if (child > 0) {
                for (k = 1; k <= child; k++) {
                    var child_bed_type = $('.child_bed_type_' + type + pkg + j + k).val();
                    if (child_bed_type == 'extrabed') {
                        extrabedValid++;
                    }
                }
            }

            if ((extrabedValid > 1) && (adult_type < 1)) {
                alert('Only 1 extra bed allowed in each room. Please modify travelers');
                return false;
            }
            var checkPax = 4;
            var checkPaxMin = 2 ; 
            if (sharing_type == 'quad') {
                checkPax = 6;
                if(IsSharingPrice > 0){
                    checkPaxMin = 4;
                }

            } else if (sharing_type == 'quint') {
                checkPax = 7;
                if(IsSharingPrice > 0){
                    checkPaxMin = 5;
                }
            } else if (sharing_type == 'hexa') {
                checkPax = 8;
                if(IsSharingPrice > 0){
                    checkPaxMin = 6;
                }
            }
             var totaltraveller1 = parseInt(adult) + parseInt(child) + parseInt(child2) + parseInt(infant);
        //if (Group === false) {
            if ((totaltraveller1 > checkPax)) {
            alert('Maximum ' + checkPax + ' pax are allowed in  room' + j + '. Please modify travelers');
            return false;
            }
            if ((totaltraveller1 < checkPaxMin)) {
            alert('Minimum ' + checkPaxMin + ' pax are allowed in room ' + j + '. Please modify travelers');
            return false;
            }
            
        }
      
        
        var totaltraveller = parseInt(totaladult) + parseInt(totalchild) + parseInt(totalinfant);
//        var MaxPax = parseInt(roomlp) * checkPax;
//        //if (Group === false) {
//        if ((totaltraveller > MaxPax)) {
//            alert('Only' + checkPax + 'pax are allowed in each room. Please modify travelers');
//            return false;
//        }
      
        //}
    }

    $("#totadlt" + type + pkg).val(totaladult);
    $("#totchld" + type + pkg).val(totalchild);
    $("#totinfnt" + type + pkg).val(totalinfant);
    $("#numberofroom" + type + pkg).html(roomlp);
    $("#roomguest" + type + pkg).html(totaltraveller);
    $("#totaltravelers" + type + pkg).val(totaltraveller);

    var roominfojson = '[{"totalRoom" : ' + roomlp + '},{"totalTraveler" : ' + totaltraveller + '},{"totaladult" : ' + totaladult + '},{"totalchild" : ' + totalchild + '},{"totalinfant" : ' + totalinfant + '}]'
    $("#roominfojson" + type + pkg).val(roominfojson);
    $(".roomBoxMain" + pkg).hide();
    $(".roomBoxMainCustom" + pkg).hide();
    $(".roomBoxMainEnquire" + pkg).hide();
    $(".roomBoxMainDynamicCustom").hide();

}
function tottraveller2(that, type) {
    var pkg = $(that).attr('pkg');

    console.log('mangal');
    return false;
}
function tottravelerInRoom1(pkg, type, roomno) {
    //    alert(roomno);

    var adult = $("#adult_" + type + pkg + roomno).val();
    var child = $("#child_" + type + pkg + roomno).val();
    var infant = $("#infant_" + type + pkg + roomno).val();
    var totalPaxInRoom = parseInt(adult) + parseInt(child) + parseInt(infant);

    //var Group = $('.Group').is(":checked");
    //if (Group === false) {
    if (totalPaxInRoom >= 5) {
        alert('Only 4 pax are allowed in each room. Please modify travelers in Room no. ' + roomno);
        return false;
    }
    //}

}
function tottravelerInRoom(roomno) {
    //    alert(roomno);
    var adult = $("#adult_" + roomno).val();
    var child = $("#child_" + roomno).val();
    var infant = $("#infant_" + roomno).val();
    var totalPaxInRoom = parseInt(adult) + parseInt(child) + parseInt(infant);
    var Group = $('.Group').is(":checked");
    if (Group === false) {
        if (totalPaxInRoom >= 5) {
            alert('Only 4 pax are allowed in each room. Please modify travelers in Room no. ' + roomno);
            return false;
        }
    }

}
function addroom() {
    var roomlp = $("#roomlp").val();
    var showroom = parseInt(roomlp) + 1;
    if (showroom === 11) {
        alert('Only 10 rooms are allowed.');
        return false;
        //            $('.addroom').hide();
    }
    $("#roomlp").val(showroom);
    $("#rmres_" + showroom).show();
    $('.disproom').hide();
    $('.disproom_' + showroom).show();
}

function addroomlist(that, type) {
    var pkg = $(that).attr('pkg');
    var roomlp = $("#roomlp" + parseInt(type) + parseInt(pkg)).val();

    var showroom = parseInt(roomlp) + 1;
    if (showroom === 11) {
        alert('Only 10 rooms are allowed.');
        return false;
        //            $('.addroom').hide();
    }
    $("#roomlp" + parseInt(type) + parseInt(pkg)).val(showroom);
    $("#rmres_" + parseInt(type) + parseInt(pkg) + showroom).show();

    $('.disproom' + parseInt(type) + parseInt(pkg)).hide();
    $('.disproom_' + parseInt(type) + parseInt(pkg) + showroom).show();
    $("#adult_" + parseInt(type) + parseInt(pkg) + showroom).focus();
}

function delroomRemove(id) {
    var showroom = parseInt(id) - 1;
    $('.addroom').show();
    $("#roomlp").val(showroom);
    $("#rmres_" + id).hide();
    $('.disproom').hide();
    $('.disproom_' + showroom).show();
}
function delroom(that, type, id) {
    var pkg = $(that).attr('pkg');
    var showroom = parseInt(id) - 1;
    $('.addroom' + parseInt(type) + parseInt(pkg)).show();
    $("#roomlp" + parseInt(type) + parseInt(pkg)).val(showroom);
    $("#rmres_" + parseInt(type) + parseInt(pkg) + id).hide();
    $('.disproom' + parseInt(type) + parseInt(pkg)).hide();
    $('.disproom_' + parseInt(type) + parseInt(pkg) + showroom).show();
}

function showchildagebox(id) {
    var childrencount = $("#child_" + id).val();
    //        alert(childrencount+'___'+id);
    var j;
    $(".childcl_" + id).show();
    $(".childage_" + id).hide();
    if (childrencount === '0') {
        $(".childcl_" + id).hide();
        return false;
    }

    for (j = 1; j <= childrencount; j++) {

        $("#child_" + id + "_" + j).show();
    }
    //var showroom = parseInt(roomlp)+parseInt(roomlp);
    //$("#rmres_"+showroom).show();adult_ child_ roomBoxMain
    tottravelerInRoom(id);
}
function showchildagebox(that, type, id) {
    var pkg = $(that).attr('pkg');
    var adult = $("#adult_" + type + pkg + id).val();
    var child = $("#child_" + type + pkg + id).val();
    var infant = $("#infant_" + type + pkg + id).val();
    var totalPaxInRoom = parseInt(adult) + parseInt(child) + parseInt(infant);
    if (totalPaxInRoom >= 5) {
        alert('Only 4 pax are allowed in each room. Please modify travelers in Room no. ' + id);
        $("#child_" + type + pkg + id).val(0);
        $(".childage_" + type + pkg + id).hide();
        return false;
    }
    var childrencount = $("#child_" + type + pkg + id).val();
    //        alert(childrencount+'___'+id);
    var j;
    $(".childcl_" + type + pkg + id).show();
    $(".childage_" + type + pkg + id).hide();
    if (childrencount === '0') {
        $(".childcl_" + type + pkg + id).hide();
        return false;
    }

    for (j = 1; j <= childrencount; j++) {

        $("#child_" + type + pkg + id + "_" + j).show();
    }
    //var showroom = parseInt(roomlp)+parseInt(roomlp);
    //$("#rmres_"+showroom).show();adult_ child_ roomBoxMain

}
function showextrabedchildagebox(id) {
    var childrencount = $("#child_" + id).val();
    //        alert(childrencount+'___'+id);
    var j;
    $(".childage_" + id).hide();
    for (j = 1; j <= childrencount; j++) {
        $("#childcl_" + id + "_" + j).show();
        $("#childcl_" + id + "_" + j + ' select').val('extrabed');
    }
    tottravelerInRoom(id);
}
function showextrabedchildagebox(that, type, id) {
    var pkg = $(that).attr('pkg');
    var sharing_type = $('.adult_type_' + id + '_' + type +':checked').val();
    var adult = $("#adult_" + type + pkg + id).val();
    var child = $("#child_" + type + pkg + id).val();
    var child2 = $("#child_" + type + pkg + id+ '_2').val();
    var infant = $("#infant_" + type + pkg + id).val();
    if (typeof child2 == 'undefined') {
        child2 = 0;
    }
   
    var checkPax = 4;

    if (sharing_type == 'quad') {
        checkPax = 6;
     

    } else if (sharing_type == 'quint') {
        checkPax = 7;
    

    } else if (sharing_type == 'hexa') {
        checkPax = 8;
     
    }
    var totalPaxInRoom = parseInt(adult) + parseInt(child) + parseInt(child2) + parseInt(infant);
  
    if (parseInt(totalPaxInRoom) > parseInt(checkPax)) {
//        alert('Only  pax are allowed in each room. Please modify travelers in Room no. ' + id);
        alert("Total pax can not be more than " + parseInt(checkPax) + " in a room. Please modify travellers in room " + id);

//        $("#child_" + type + pkg + id).val(0);
//        $("#child_" + type + pkg + id +'_2').val(0);
            $(that).val(0);
//        $(".childage_" + type + pkg + id).hide();
    var childrencount = $("#child_" + type + pkg + id).val();
    var childrencount2 = $("#child_" + type + pkg + id +'_2').val();
    if(childrencount == 0){
         $('.kidbedtype_' + type+ id).hide();
    }else if(childrencount2 == 0){
        $('.childage_' + type + id + '_2').hide();
    }
      
        return false;
    }
    var childrencount = $("#child_" + type + pkg + id).val();
    var childrencount2 = $("#child_" + type + pkg + id +'_2').val();

    //        alert(childrencount+'___'+id);
    var j;
    var k;
    $(".childage_" + type + pkg + id).hide();
    $(".childage_" + type + pkg + id + '_2').hide();

    for (j = 1; j <= childrencount; j++) {
        $("#childcl_" + type + pkg + id + "_" + j).show();
        if ((typeof sharing_type != 'undefined') && (sharing_type == 'quad' || sharing_type == 'quint' || sharing_type == 'hexa')) {
                  $(".childbyage" + type + "_" + id).hide();  
                   $(".childbyage1" + type + "_" + id).show();  

                 
        }
        $("#childcl_" + type + pkg + id + "_" + j + ' select').val('extrabed');
    }
    
      for (k = 1; k <= childrencount2; k++) {
        $("#childcl_" + type + pkg + id + "_" + k +'_2').show();
        $("#childcl_" + type + pkg + id + "_" + k +'_2' + ' select').val('extrabed');
    }
	checkValidateBedType(pkg,type,id);

}
function showextrabedbox(roomno) {
    var adult = $("#adult_" + roomno).val();
    if (adult == 3) {
        $(".adultcl_" + roomno + '_3').show();
    } else {
        $(".adultcl_" + roomno + '_3').hide();
    }
    tottravelerInRoom(roomno);
}
function showextrabedbox(that, type, roomno) {
    var pkg = $(that).attr('pkg');
    var sharing_type = $('.adult_type_' + roomno + '_' + type + ':checked').val();
    var adult = $("#adult_" + type + pkg + roomno).val();
    var child = $("#child_" + type + pkg + roomno).val();
    var child2 = $("#child_" + type + pkg + roomno + '_2').val();
    var infant = $("#infant_" + type + pkg + roomno).val();
    if (typeof child2 == 'undefined') {
        child2 = 0;
    }
 
    var checkPax = 4;
    if (sharing_type == 'quad') {
        checkPax = 6;
      
        
    } else if (sharing_type == 'quint') {
        checkPax = 7;
       
    } else if (sharing_type == 'hexa') {
        checkPax = 8;
        
    }
    var totalPaxInRoom = parseInt(adult) + parseInt(child) + parseInt(child2) + parseInt(infant);
     
    if ((totalPaxInRoom > checkPax)) {
       //        alert('Only 4 pax are allowed in each room. Please modify travelers in Room no. ' + roomno);
        alert("Total pax can not be more than " + parseInt(checkPax) + " in a room. Please modify travellers in room " + roomno);

        $("#adult_" + type + pkg + roomno).val(2);
        $(".adultcl_" + type + pkg + roomno + '_3').hide();
        return false;
    }
    var adult = $("#adult_" + type + pkg + roomno).val();
    if (adult == 3) {
        $(".adultcl_" + type + pkg + roomno + '_3').show();
    } else {
        $(".adultcl_" + type + pkg + roomno + '_3').hide();
    }
	checkValidateBedType(pkg,type,roomno);

}
$("#selectDestination").autocomplete({

    source: function (request, response) {
        var query = $("#selectDestination").val();
        var countryId = '';
        $.getJSON("/index/autosuggest", {query: query, countryId: countryId},
                response);
    },
    minLength: 3,
    autoFocus: true,
    select: function (event, ui) {
        var CityId = ui.item.CityId;
        var CityName = ui.item.CityName;
        $("#hidden_selected_hotel_cityid").val(CityId);
        $("#hidden_selected_city_name").val(CityName);
        $("#DestinationIDspkg").val(CityId);
        $("#Destinationspkg").val(CityName);
    }
});


$("#selectDestinationH").autocomplete({

    source: function (request, response) {
        var query = $("#selectDestinationH").val();
        var countryId = '';
        $.getJSON("/index/autosuggest", {query: query, countryId: countryId},
                response);
    },
    minLength: 3,
    autoFocus: true,
    select: function (event, ui) {
        var CityId = ui.item.CityId;
        var CityName = ui.item.CityName;

        $("#DestinationIDsH").val(CityId);
        $("#DestinationsH").val(CityName);
    }
});

$('.bookNowBtn').on('click', function (e) {
    $('.sending1').attr('index', 3);
    $('.sending1').click();
})

$(".sending1").on('click', function (e) {
    // alert("sending alert.");
    //var EmailReg = new RegExp(/^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/);
    e.preventDefault();
    var data = $('.package_rate_enquiry').serialize();
    // alert(data);
    var form_name = $(this).find("input[name='name']");
    var form_email = $(this).find("input[name='email']");
    var form_mobile = $(this).find("input[name='mobile']");
    var form_from_destination = $(this).find("input[name='from_destination']");
    var form_date = $(this).find("input[name='date']");
    // alert(form_date); return false;
    var form_package_id = $(this).find("input[name='package_sid']");
    var page_url = new URL(window.location.href);
    var leadsend = $("#leadsend").val();
    if ($('.package_rate_enquiry input[name="email"]').val() == '') {
        $('.msgs').show().html('Please enter your email address');
        $('.package_rate_enquiry input[name="email"]').focus();
        return false;
    }
    // if (!EmailReg.test($('.package_enquiry input[name="email"]').val())) {
    //     $('.msgs').show().html('Please enter valid email address!!!');
    //     $('.package_enquiry input[name="email"]').focus();
    //     return false;
    // }

    if ($('.package_rate_enquiry input[name="mobile"]').val() == '') {
        $('.msgs').show().html('Please enter your mobile number');
        $('.package_rate_enquiry input[name="mobile"]').focus();
        return false;
    }
//    if ($('.package_rate_enquiry input[name="mobile"]').val().length != '10') {
//        $('.msgs').show().html('Mobile should be 10 digit?');
//        $('.package_rate_enquiry input[name="mobile"]').focus();
//        return false;
//    }
    if (!$.isNumeric($('.package_rate_enquiry input[name="mobile"]').val())) {
        $('.msgs').show().html('Mobile should be numeric!!');
        $('.package_rate_enquiry input[name="mobile"]').focus();
        return false;
    }
//        if ($('.package_enquiry input[name="from_destination"]').val() == '') {
//            $('.msg').show().html('Please enter traveling from');
//            $('.package_enquiry input[name="from_destination"]').focus();
//            return false;
//        }
    if ($('.package_rate_enquiry input[name="traveldate"]').val() == '') {
        $('.msgs').show().html('Please enter travel date');
        $('.package_rate_enquiry input[name="traveldate"]').focus();
        return false;
    }
    // alert(data); return false;
    $('.msgs').hide().html('');
    var index = $('.sending1').attr('index');
    $.ajax({url: SITEURL + 'gtxwebservices/send-enquiry/post', type: 'POST', data: data + '&index=' + index, dataType: 'json', beforeSend: function () {
            if (index == 3) {
                $('.sending1').hide();
                $('.bookNowBtn').html('<i class="ace-icon fa fa-spinner fa-spin orange bigger-125"></i> Please Wait..').attr('disabled', 'disabled');
            } else if (index == 2) {
                $('.bookNowBtn').hide();
                $('.sending1').html('<i class="ace-icon fa fa-spinner fa-spin orange bigger-125"></i> Please Wait..').attr('disabled', 'disabled');
            } else {
                $('.sending1').html('<i class="ace-icon fa fa-spinner fa-spin orange bigger-125"></i> Getting Cost...').attr('disabled', 'disabled');
            }

        }, success: function (result) {
            $('.sending1').hide();
            if ((result.status == 'success') && (result.availability == true)) {
                var priceTax = result.addtional['GSTAmount']; // Tax
                var sumRoomWise = result.addtional['MyCost']; // TotalPrice
                var priceGT = result.addtional['AmountWithGST']; // GrandTotal
                if (result.markupStatus == true) {
                    $('#TPSysIdId').val(0);
                    $('.sending1').html('Get proposal').hide().attr('disabled', false);
                    $('.bookNowBtn').html('Book Now').hide().attr('disabled', false);
                    $('.msgs').show().html("Proposal sent successfully.").css({'color': '#5cb85c'});

                    if (index == 3) {
                        window.open(result.Url, '_blank');
                    }
                } else if (parseInt(sumRoomWise) > 0) {

                    if (parseInt(priceTax) > 0) {
                        $('#totalBasicCostTR , #totalTaxCostTR,#extraMarkUp').show();
                        $('#GSTI').hide().html('');
                    } else {
                        $('#totalBasicCostTR , #totalTaxCostTR').hide();
                        $('#GSTI').show().html('GST (Included)');
                    }
                    var priceTaxFormatted, priceBCFormatted, priceGTFormatted = '';
                    priceTaxFormatted = rvMoneyFormatINR(priceTax, 2, null);
                    priceBCFormatted = rvMoneyFormatINR(sumRoomWise, 2, null);
                    priceGTFormatted = rvMoneyFormatINR((priceGT), 2, null);
                    $('#totalBasicCost').html(priceBCFormatted);
                    $('#totalTaxCost').html(priceTaxFormatted);
                    $('#totalGrandCost').html(priceGTFormatted);
                    $('#tableCost').slideDown();
                    $('#TPSysIdId').val(result.TPSysId);
                    $('.sending1').html('Get proposal').show().attr('disabled', false);
                    $('.sending1').attr('index', 2);
                    if (result.IsBooking == true) {
                        $('.bookNowBtn').show();
                    }

                } else {
                    $('#tableCost').hide();
                    $('.msgs').show().html('Your query has been submitted successfully.').css({'color': 'green'});
                }



            } else if ((result.status == 'success') && (result.availability == false)) {

                $('.msgs').show().html("Thanks! Your enquiry submitted successfully. Soon our expert will contact you.").css({'color': '#5cb85c'});
            } else if ((result.status == false) && (result.availability == false)) {

                $('.msgs').show().html('Thanks! Your enquiry submitted successfully. Soon our expert will contact you.').css({'color': '#5cb85c'});

            } else {

                $('.msgs').show().html('Thanks! Your enquiry submitted successfully. Soon our expert will contact you.').css({'color': '#5cb85c'});

            }

            /* Conversion Tracking End */
            $('.class-modify-enquiry').show();
//                $('.hidebutton').find('.class-continue').show();

        }, error: function (result) {
            $('.smsg').show().html('Sorry, System encountered some error.\n\ We will revert back with suitable suggestions.').css({'color': '#ff0000'});
        }});

});

$(".sending2").on('click', function (e) {
    var EmailReg = new RegExp(/^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/);
    e.preventDefault();
    var data = $(".package_rate_enquiry_pop").serialize();
    var leadsend = $("#leadsends").val();
    if ($('.package_rate_enquiry_pop input[name="email"]').val() == '') {
        $('.msgs').show().html('Please enter your email address');
        $('.package_rate_enquiry_pop input[name="email"]').focus();
        return false;
    }
    if (!EmailReg.test($('.package_rate_enquiry_pop input[name="email"]').val())) {
        $('.msgs').show().html('Please enter valid email address!!!');
        $('.package_rate_enquiry_pop input[name="email"]').focus();
        return false;
    }
    if ($('.package_rate_enquiry_pop input[name="mobile"]').val() == '') {
        $('.msgs').show().html('Please enter your mobile number');
        $('.package_rate_enquiry_pop input[name="mobile"]').focus();
        return false;
    }
    // if ($('.package_rate_enquiry_pop input[name="mobile"]').val().length != '10') {
    //     $('.msgs').show().html('Mobile should be 10 digit?');
    //     $('.package_rate_enquiry_pop input[name="mobile"]').focus();
    //     return false;
    // }
    if (!$.isNumeric($('.package_rate_enquiry_pop input[name="mobile"]').val())) {
        $('.msgs').show().html('Mobile should be numeric!!');
        $('.package_rate_enquiry_pop input[name="mobile"]').focus();
        return false;
    }
    if ($("#travelerDatePicker").val() == '') {
        $('.msgs').show().html('Please enter travel date');
        $('#travelerDatePicker').focus();
        return false;
    }

    $.ajax({
        url: SITEURL + 'cms/index/sendenquiry', type: 'POST', data: data, dataType: 'json', beforeSend: function () {
            $('.sending2').html('<i class="ace-icon fa fa-spinner fa-spin orange bigger-125"></i> Sending...');
        }, success: function (result) {
            $("#leadsends").val('1');
            $('.package_rate_enquiry_pop').find('.msgs').html('');
            //$('.sending2').html('Calculate Cost &amp; Send Enquiry').attr('disabled', false);
            $('#expandsave').show();
        }, error: function (result) {
            $('.smsg1').show().html('Sorry, This package is not available on selected date.\n\ We will revert back with suitable suggestions.').css({'color': '#ff0000'});
        }
    });


    $.ajax({
        url: SITEURL + 'gtxwebservices/send-enquiry/post', type: 'POST', data: data, dataType: 'json', beforeSend: function () {
            $('.sending2').html('<i class="ace-icon fa fa-spinner fa-spin orange bigger-125"></i> Getting Cost...');
        }, success: function (result) {

            if ((result.status == 'success') && (result.availability == true)) {
                $('.package_rate_enquiry_pop .smsg1').show().html("Thanks! Your enquiry submitted successfully. Soon our expert will contact you.").css({'color': '#5cb85c'});
                var priceTax = result.addtional['GSTAmount']; // Tax
                var sumRoomWise = result.addtional['MyCost']; // TotalPrice
                var priceGT = result.addtional['AmountWithGST']; // GrandTotal
                if (priceTax == 0) {
                    $('#totalBasicCostTR , #totalTaxCostTR').hide();
                    $('#GSTI').show().html('GST (Included)');
                } else {
                    $('#totalBasicCostTR , #totalTaxCostTR').show();
                    $('#GSTI').hide().html('');
                }
                var priceTaxFormatted, priceBCFormatted, priceGTFormatted = '';
                priceTaxFormatted = ptMoneyFormatINR(priceTax, 2, null);
                priceBCFormatted = ptMoneyFormatINR(sumRoomWise, 2, null);
                priceGTFormatted = ptMoneyFormatINR((priceGT), 2, null);
                $('#totalBasicCost').html(priceBCFormatted);
                $('#totalTaxCost').html(priceTaxFormatted);
                $('#totalGrandCost').html(priceGTFormatted);
                $('#tableCost').slideDown();
                $('.sending2').html('Calculate Cost &amp; Send Enquiry').attr('disabled', false);
                if (result.IsBooking == true && result.url != '') {
                    $('.class-book-now-btn').show().attr('href', result.url);
                }
            } else if ((result.status == 'success') && (result.availability == "false")) {
                $('.smsg1').show().html("Thanks! Your enquiry submitted successfully. Soon our expert will contact you.").css({'color': '#5cb85c'});
            } else if ((result.status == false) && (result.availability == "false")) {
                $('.package_rate_enquiry_pop .smsg1').show().html('Sorry, This package is not available on selected date.\n\ But we will revert back with suitable suggestions.').css({'color': '#5cb85c'});
            } else if ((result.status == false) && (result.redirect == true)) {
                $('.smsg1').show().html("You are not login.").css({'color': '#5cb85c'});
                window.location.href = SITEURL;
            } else {
                $('.smsg1').show().html('Thanks! Your enquiry submitted successfully.\n\ We will revert back with suitable suggestions.').css({'color': '#5cb85c'});
            }
            $('.sending2').html('Calculate Cost &amp; Send Enquiry').attr('disabled', false);
            $('.hidebutton').find('.sending2').hide();
            $('.hidebutton').find('.class-modify-enquiry').show();

        }, error: function (result) {
            $('.smsg1').show().html('Sorry, This package is not available on selected date.\n\ We will revert back with suitable suggestions.').css({'color': '#ff0000'});
            $('.sending2').hide();
            $('.hidebutton').find('.sending2').hide();
            $('.hidebutton').find('.class-modify-enquiry').show();
        }
    });

});

$(document).on('click', '.removeit', function () {
    var count = $('#itinerary_inputs').val();
    var rooms = $('#itinerary_rooms').val();
    if (count == 1) {
        return false;
    }
    $('#itinerary_inputs').val(parseInt(count) - 1);
    $('#itinerary_rooms').val(parseInt(rooms) - 1);
    $('.room-rows-container').find('.inserted-room-row:last').remove();
});
$('.addmore').click(function () {
    var count = 1;
    var room = 2;
    count = parseInt($('#itinerary_inputs').val());
    room = parseInt($('#itinerary_rooms').val());
    CONST_PACKAGE_TRAVELER_MAX_ROOM = parseInt(CONST_PACKAGE_TRAVELER_MAX_ROOM);
    if (room > CONST_PACKAGE_TRAVELER_MAX_ROOM) {
        alert("Can not add more than " + CONST_PACKAGE_TRAVELER_MAX_ROOM + " rooms.");
        return false;
    }
    $('.room-rows-container').append('<div class="col-lg-12 room-box room-row inserted-room-row">' + '<div class="row">' + '<div class="col-md-12 colspan-booking mt-5">' + '<div class="table-bordered"></div>' + '<label >Room ' + room + ' </label><button style="right:15px;" type="button" class="pull-right rounded text-danger removeit" aria-hidden="true" title="Remove Room">x</button>' + ' <input type="hidden" name="room[]" value="' + room + '" />' + '</div>' + '  <div class="cl"></div>' + '<div class="col-md-2 form-group1">' + '' + '<select name="adult[]" id="traveler_adult_' + room + '"  class="traveler_adult form-control" onchange="checkTravellers(this ,' + room + ');">' + '<option value="1">1</option>' + '<option value="2"> 2</option>' + '<option value="3"> 3</option>' + '</select>' + '  </div>' + '<div class="col-md-2 form-group1" style="display: none" id="room-row-adult-bedtype-' + room + '"><select name="adult_bed_type[]" class="traveler_child form-control" onchange="checkAdultBedType(this);"><option value="">Adult Bedtype</option><option value="withoutbed">Without Bed</option><option value="extrabed">With Bed</option></select></div><div class="col-md-2 form-group1">' + '' + '<select name="child[]" class="traveler_child form-control" id="traveler_kids_' + room + '" onchange="checkTravellers(this,' + room + ');">' + '<option value="0">0</option>' + '<option value="1"> 1</option>' + '<option value="2"> 2</option>' + '</select>' + ' </div>' + '<div class="col-md-2 form-group1 room-row-child-bedtype-' + room + '" style="display: none" id="room-row-child-bedtype-' + room + '-1"><select name="child1_bed_type[]" class="traveler_child form-control" id="room-row-child-bedtype-1-1" onchange="checkAdultBedType(this);"><option value="">Child 1 Bedtype</option><option value="withoutbed">Without Bed</option><option value="extrabed">With Bed</option><option value="none">None</option></select></div><div class="col-md-2 form-group1 room-row-child-bedtype-' + room + '" style="display: none" id="room-row-child-bedtype-' + room + '-2"><select name="child2_bed_type[]" class="traveler_child form-control" id="room-row-child-bedtype-1-2" onchange="checkAdultBedType(this);"><option value="">Child 2 Bedtype</option><option value="withoutbed">Without Bed</option><option value="extrabed">With Bed</option><option value="none">None</option></select></div> <div class="col-md-2 form-group1">' + '' + '<select name="infant[]" class="traveler_infant form-control" id="traveler_infant_' + room + '" onchange="checkTravellers(this,' + room + ');">' + '<option value="0">0</option>' + '<option value="1"> 1</option>' + '<option value="2"> 2</option>' + '<option value="3"> 3</option>' + '<option value="4"> 4</option>' + '</select>' + '</div>' + '</div>');
    $('#itinerary_inputs').val(parseInt(count) + 1);
    $('#itinerary_rooms').val(parseInt(room) + 1);
});


function modify_enquiry(that) {
    $(that).hide();
    $('.sending1').html('Check Rate').attr('disabled', false).show();
    $('#tableCost').hide();
    $('.extraMarkUpInput').val('');
    $('.msgs').html('');
    $('.sending1').attr('index', 1);
    $('.bookNowBtn').hide();


}
function modify_enquiry_btn(that) {
    $(that).hide();
    if ($('#check_TravelAgent').val() == 1) {
        $('.sending1').html('Get Proposal').show();
        $('.sending2').html('Get Proposal').show();
    } else {
        $('.sending1').html('Send Enquiry').show();
        $('.sending2').html('Send Enquiry').show();
    }

    $('#leadsends').val(0);
    $('#tableCost').hide();
    $('.perperson-priceBtn').hide();
}
function checkAdultBedType(that) {
    if ($(that).val() == '') {
        alert('Please select bed type');
        $(that).val('extrabed');
        return false;
    }
}

function ptMoneyFormatINR(n, prec, currSign) {
    if (prec == null)
        prec = 2;
    var n = ('' + parseFloat(n).toFixed(prec).toString()).split('.');
    var num = n[0];
    var dec = n[1];
    var r, s, t;
    if (num.length > 3) {
        s = num.length % 3;
        if (s) {
            t = num.substring(0, s);
            num = t + num.substring(s).replace(/(\d{3})/g, ",$1");
        } else {
            num = num.substring(s).replace(/(\d{3})/g, ",$1").substring(1);
        }
    }
    //    return(currSign == null ? "" : currSign + "") + num + '.' + dec;
    return (currSign == null ? "" : currSign + "") + num;
}



function changeContentByCategory(cname, desname, packageId, catId, gtxId, tourType, mp) {
    var catIdVal = $(catId).val();
    //     var data = SITEURL + 'detail/'+cname+'/'+desname+'-'+packageId+'-'+catId+'-'+gtxId+'-'+tourType+'-'+mp+'.html';
    var countryname = cname;
    var name = desname + '-' + packageId + '-' + catIdVal + '-' + gtxId + '-' + tourType + '-' + mp + '.html';
    var fixdestinations = $('.fixdeparture-destinations' + parseInt(packageId)).val();

    $.ajax({
        url: SITEURL + 'holidays/detail/index-ajax-data',
        type: 'POST',
        data: {countryname: countryname, name: name, fixdestinations: fixdestinations},
        dataType: 'html',
        beforeSend: function () {
            $('#changeContentByajax').html('<div style="text-align:center;padding-top:30px;"><img src="/public/images/loader.gif"/></div>');
        },
        success: function (result) {
            $('#changeContentByajax').html('');
            $('#changeContentByajax').html(result);
            $('#downloadBroucherData').attr('href', SITEURL + 'package/detail/download-package-pdf/gtxid/' + gtxId + '/pkgid/' + packageId + '/catid/' + catIdVal);
            $('.tablistLi').removeClass('active');
            $('.itineraryTav').addClass('active');
            copyPriceFunction(packageId, parseInt(catIdVal));
            return false;
        },
        error: function () {
            alert('Oops unable to connect with server!!');
            return false;
        }
    });
}
function copyPriceFunction(PkgSysId, catIdVal) {
    var FixedDepartureFlightPrice = $('.fixdeparture-destinations' + parseInt(PkgSysId) + ' option:selected').attr('costval');
    var pkgprice_copy = $('.priceByCategory').val();
    var pkgprice_copyNoformat = $('.priceByCategoryNoFormat').val();
    var PackageType = $('#mpackagetpid_' + PkgSysId).val();
    if (!isNaN(FixedDepartureFlightPrice)) {
        pkgprice_copy = parseInt(pkgprice_copyNoformat) + parseInt(FixedDepartureFlightPrice);
    }
    var x = pkgprice_copy;
    var pkgprice_copy = x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");

    $('#pkgprice_paste1').html(pkgprice_copy);
    $('#pkgprice_paste2').html(pkgprice_copy);
    $('#original_pkgprice_' + parseInt(PkgSysId)).val(pkgprice_copyNoformat);
    $('#updated_pkgprice_' + parseInt(PkgSysId)).val(pkgprice_copyNoformat);
    $('#package_tpid').val(PackageType);
    $('#package_hotelcategoryid').val(catIdVal);
}

function viewPerPersonPrice() {
    var data = $(".package_rate_enquiry").serialize();
    $.ajax({
        url: SITEURL + 'gtxwebservices/send-enquiry/get-per-person-price',
        type: 'POST',
        data: data,
        dataType: 'html',
        beforeSend: function () { },
        success: function (result) {
            $('#myModa1PerPersonPrice').modal('show');
            $('#myModa1PerPersonPriceHtml').html(result);
        },
        error: function (result) {

        }
    });



}

function moreless(type, e) {
    if (type == null) {
        $(e).parent().find('a.limore').toggleClass("hidee");
    } else if (type == 'li') {
        $(e).parent().parent().find('li.limore').toggleClass("hidee")
    }
    $(e).html(($(e).text() == '-') ? '+' : '-');
}

function resetfilter() {
    $('.filtercheckbox').each(function () {
        console.log('reset');
        var isChecked = $(this).is(':checked');
        if (isChecked == true) {
            $(this).trigger('click');
        }
    });
}
$(document).on('click', '.iamplusminus', function () {
    if ($(this).hasClass('expand')) {
        $(this).html('<i class="icon-plus"></i>').addClass('collepse').removeClass('expand').attr('title', 'More...');
        $(this).parent().css({'height': '180px'});
    } else {
        $(this).html('<i class="icon-minus"></i>').addClass('expand').removeClass('collepse').attr('title', 'Less...');
        ;
        $(this).parent().css({'height': 'auto'});
    }
});
$(".activity_enquiry").on('submit', function (e) {
    var EmailReg = new RegExp(/^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/);
    e.preventDefault();
    var data = $(this).serialize();
    var leadsend = $("#leadsend_act").val();

    if ($('.activity_enquiry input[name="name"]').val() == '') {
        $('.msg').show().html('Please enter your name');
        $('.activity_enquiry input[name="name"]').focus();
        return false;
    }
    if ($('.activity_enquiry input[name="email"]').val() == '') {
        $('.msg').show().html('Please enter your email address');
        $('.activity_enquiry input[name="email"]').focus();
        return false;
    }
    if (!EmailReg.test($('.activity_enquiry input[name="email"]').val())) {
        $('.msg').show().html('Please enter valid email address!!!');
        $('.activity_enquiry input[name="email"]').focus();
        return false;
    }
    if ($('.activity_enquiry input[name="mobile"]').val() == '') {
        $('.msg').show().html('Please enter your mobile number');
        $('.activity_enquiry input[name="mobile"]').focus();
        return false;
    }
    // if ($('.activity_enquiry input[name="mobile"]').val().length != '10') {
    //     $('.msg').show().html('Mobile should be 10 digit?');
    //     $('.activity_enquiry input[name="mobile"]').focus();
    //     return false;
    // }
    if (!$.isNumeric($('.activity_enquiry input[name="mobile"]').val())) {
        $('.msg').show().html('Mobile should be numeric!!');
        $('.activity_enquiry input[name="mobile"]').focus();
        return false;
    }
    if (leadsend == '0') {
        $.ajax({
            url: SITEURL + 'cms/index/sendenquiry', type: 'POST', data: data, dataType: 'json', beforeSend: function () {
                $('.activity_enquiry .msg').hide().html('');
                $('.activity_enquiry .sending').html('<i class="ace-icon fa fa-spinner fa-spin orange bigger-125"></i> Sending...').attr('disabled', 'disabled');
            }, success: function (result) {
                $(".activity_enquiry #leadsend_act").val('1');
                $('.activity_enquiry .sending').html('Calculate Cost &amp; Send Enquiry').attr('disabled', false);
                $('.activity_enquiry .expandsave').show();
                $('.activity_enquiry').submit();

            }, error: function (result) {
                $('.activity_enquiry .smsg').show().html('Sorry, System encountered some error.\n\ We will revert back with suitable suggestions.').css({'color': '#ff0000'});
            }
        });
    } else {

        if ($('.activity_enquiry input[name="date"]').val() == '') {
            $('.activity_enquiry .msg').show().html('Please enter travel date');
            $('.activity_enquiry input[name="date"]').focus();
            return false;
        }
        $('.activity_enquiry .msg').hide().html('');
        $.ajax({
            url: SITEURL + 'gtxwebservices/send-enquiry-activity/post', type: 'POST', data: data, dataType: 'json', beforeSend: function () {
                $('.activity_enquiry .sending').html('<i class="ace-icon fa fa-spinner fa-spin orange bigger-125"></i> Getting Cost...').attr('disabled', 'disabled');
            }, success: function (result) {
                //                console.log(result);
                if ((result.status == 'success') && (result.availability == true)) {
                    $('.smsg').show().html("Thanks! Your enquiry submitted successfully. Soon our expert will contact you.").css({'color': '#5cb85c'});
                    var priceTax = result.addtional['GSTAmount']; // Tax
                    var sumRoomWise = result.addtional['MyCost']; // TotalPrice
                    var priceGT = result.addtional['AmountWithGST']; // GrandTotal
                    if (priceTax == 0) {
                        $('.totalBasicCostTR , .activity_enquiry .totalTaxCostTR').hide();
                        $('.GSTI').show().html('GST (Included)');
                    } else {
                        $('.totalBasicCostTR , .activity_enquiry .totalTaxCostTR').show();
                        $('.GSTI').hide().html('');
                    }
                    var priceTaxFormatted, priceBCFormatted, priceGTFormatted = '';
                    priceTaxFormatted = rvMoneyFormatINR(priceTax, 2, null);
                    priceBCFormatted = rvMoneyFormatINR(sumRoomWise, 2, null);
                    priceGTFormatted = rvMoneyFormatINR((priceGT), 2, null);
                    $('.totalBasicCost').html(priceBCFormatted);
                    $('.totalTaxCost').html(priceTaxFormatted);
                    $('.totalGrandCost').html(priceGTFormatted);
                    $('.activity_enquiry .tableCost').show();
                    if (result.url != '') {
                        $('.bookingButtonHtml').html('<a target="_blank" href="' + result.url + '" class="btn btn-success">Continue to pay</a>');
                    }
                    //alert()
                    //                    $('.activity_enquiry').find('input , select ').attr('disabled', 'disabled');
                } else if ((result.status == 'success') && (result.availability == "false")) {
                    $('.smsg').show().html("Thanks! Your enquiry submitted successfully. Soon our expert will contact you.").css({'color': '#5cb85c'});
                    //                    $('.activity_enquiry').find('input , select ').attr('disabled', 'disabled');
                    $('.sending').hide();
                } else if ((result.status == false) && (result.availability == "false")) {
                    $('.smsg').show().html('Sorry, This package is not available on selected date.\n\ But we will revert back with suitable suggestions.').css({'color': '#5cb85c'});
                    //                    $('.activity_enquiry').find('input , select ').attr('disabled', 'disabled');
                    $('.sending').hide();
                } else {
                    $('.smsg').show().html('Sorry, System encountered some error.\n\ We will revert back with suitable suggestions.').css({'color': '#ff0000'});
                    $('.sending').hide();
                }
                $('.activity_enquiry .sending').html('Book Now');
                $('.hidebutton').find('.sending').hide();
            }, error: function (result) {
                $('.activity_enquiry .smsg').show().html('Sorry, System encountered some error.\n\ We will revert back with suitable suggestions.').css({'color': '#ff0000'});
                $('.activity_enquiry .sending').hide();
            }
        });
    }
});
function rvMoneyFormatINR(n, prec, currSign) {
    if (prec == null)
        prec = 2;
    var n = ('' + parseFloat(n).toFixed(prec).toString()).split('.');
    var num = n[0];
    var dec = n[1];
    var r, s, t;
    if (num.length > 3) {
        s = num.length % 3;
        if (s) {
            t = num.substring(0, s);
            num = t + num.substring(s).replace(/(\d{3})/g, ",$1");
        } else {
            num = num.substring(s).replace(/(\d{3})/g, ",$1").substring(1);
        }
    }
    //    return(currSign == null ? "" : currSign + "") + num + '.' + dec;
    return (currSign == null ? "" : currSign + "") + num;
}
function openpopupModel(n, type) {
    var hotelId = n;
    var type = type;
    var categoryId = $("#categoryId").val();
    var packageId = $("#packageId").val();
    var gtxID = $("#gtxID").val();

    $.ajax({
        type: "POST",
        url: "/holidays/detail/get-hotel-detail",
        async: true,
        data: "type=" + type + "&hotelId=" + hotelId + "&categoryId=" + categoryId + "&packageId=" + packageId + "&gtxID=" + gtxID,
        beforeSend: function () {
            $("#myModa1hotelview").modal('show');
            $('#hotelDetailViewList').html('<div style="text-align:center;padding-top:30px;"><img src="/public/images/loader.gif"/></div>');
        },
        success: function (data) {
            //console.log(data);
            $("#hotelDetailViewList").html(data);
            return false;
        }
    });
}
function openHotelModal(that) {
    var hotelId = $(that).attr('data-hotelid');
    var packageId = $(that).attr('data-pkgid');
    var gtxID = $(that).attr('data-gtxid');
    var type = $(that).attr('type');

    var categoryId = $('.hotelTypeElementClass_' + parseInt(packageId) + ':checked').val();
    $.ajax({
        type: "POST",
        url: "/holidays/detail/get-hotel-detail",
        async: true,
        data: "type=" + type + "&hotelId=" + hotelId + "&categoryId=" + categoryId + "&packageId=" + packageId + "&gtxID=" + gtxID,
        beforeSend: function () {
            $("#myModa1hotelview").modal('show');
            $('#hotelDetailViewList').html('<div style="text-align:center;padding-top:30px;"><img src="/public/images/loader.gif"/></div>');
        },
        success: function (data) {
            //console.log(data);
            $("#hotelDetailViewList").html(data);
            return false;
        }
    });
}
function activityOverview() {
    $('#Overview_content_').toggleClass('show_wrap_less');

    if ($('#Overview_content_').hasClass('show_wrap_less')) {
        $('.readMore_Overview').html('Read More');
    } else {
        $('.readMore_Overview').html('Read Less');
    }
}

Youez - 2016 - github.com/yon3zu
LinuXploit