HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
File: D:/HostingSpaces/SBogers10/immoginis.komma.pro/wwwroot/js/propertyDetail.js
/**
 * Created by Pascal on 13/04/16.
 */
$(function () {

    $(window).resize(function () {
        resizer();
    });

    $(window).scroll(function () {
        scroller();
    });

    $imageSlider = $('#image-gallery').lightSlider({
        adaptiveHeight: true,
        gallery: true,
        // autoWidth: true,
        item: 1,
        loop: true,
        thumbItem: 9,
        slideMargin: 5,
        responsive : [
            {
                breakpoint:700,
                settings: {
                    thumbItem: 6,
                }
            },
            {
                breakpoint:480,
                settings: {
                    thumbItem: 4,
                }
            }
        ]
    });

    $('.js-open-image-gallery-modal').click(function () {
        $('.c-image-gallery__body').addClass('is-active');
    });

    $('.c-image-gallery__shade, .js-close-image-gallery').click(function () {
        $('.c-image-gallery__body').removeClass('is-active');
    });

    $('.js-set-slider ').click(function () {

        $slideNumber = parseInt(this.getAttribute('data-slide'));
        $imageSlider.goToSlide($slideNumber);

    });


    $('.stay-in-touch-button').click(function () {
        $('.pop-up-background').addClass('active');
    });

    $('.pop-up-background .background, .pop-up-background .thanks').click(function () {
        $('.pop-up-background').removeClass('active');
    });

    $('.pop-up #sendButton').click(function () {
        var send = true;
        var plan_appointment;
        var plan_location;
        var city;
        var city_notify = true;
        var more_info_prop;
        var prop_location;

        if ($('#popUpMail #plan_appointment').length == 0) {
            plan_appointment = false;
            plan_location = '';
        }
        else {
            plan_appointment = $('#popUpMail #plan_appointment').prop('checked');
            plan_location = $('#popUpMail #plan_appointment').val();
        }

        if ($('#popUpMail #city_name').length == 0) {
            // city_notify = false;
            city = '';
        }
        else {
            city_notify = $('#popUpMail #city_name').prop('checked');
            city = $('#popUpMail #city_name').attr('name');
        }

        if ($('#popUpMail #more_info_prop').length == 0) {
            more_info_prop = false;
            prop_location = '';
        }
        else {
            more_info_prop = $('#popUpMail #more_info_prop').prop('checked');
            prop_location = $('#popUpMail #more_info_prop').val();
        }

        var sendValue = {
            city: city,
            city_notify: city_notify,
            plan_location: plan_location,
            plan_appointment: plan_appointment,
            more_info_prop: more_info_prop,
            more_info_prop2: prop_location,
            name: $('#popUpMail #name').val(),
            sur_name: $('#popUpMail #sur_name').val(),
            email: $('#popUpMail #email').val(),
            phone: $('#popUpMail #phone').val(),
            extra_message: $('#popUpMail #extra_message').val(),
            secretCode: 'isHuman'
        };
        $('.pop-up .check-alert').removeClass('show');
        $('.pop-up .input-rows .alert').removeClass('alert');
        $('.pop-up .check-alert.temp').remove();


        if (sendValue.city == '' && sendValue.plan_location == '') {
            // send = false;
            console.log('city or plan_location is empty');
        }
        if (sendValue.more_info_prop == false && sendValue.plan_appointment == false) {
            // send = false;
            $('.pop-up #popUpMail .input h5').after('<p class="check-alert temp show">Verplicht een te kiezen</p>');
            console.log('city notify is empty');
        }
        if (sendValue.name == '') {
            send = false;
            console.log('name is empty');
            $('.pop-up #name').addClass('alert');
        }
        if (sendValue.sur_name == '') {
            send = false;
            console.log('surname is empty');
            $('.pop-up #sur_name').addClass('alert');
        }
        if (sendValue.email == '') {
            send = false;
            console.log('email is empty');
            $('.pop-up #email').addClass('alert');
        }
        if (sendValue.phone == '') {
            send = false;
            console.log('phone is empty');
            $('.pop-up #phone').addClass('alert');
        }

        if (send) {
            $.ajax({
                method: "POST",
                data: sendValue,
                url: $('#popUpMail').attr('action')
            }).done(function (msg) {
                console.log(msg);
                if (msg != 'true') {

                    for (var key in msg) {
                        $('.pop-up .form h5').after('<p class="check-alert temp show">' + msg[key] + '</p>');
                    }
                }
                else {
                    $('#popUpMail').remove();
                    $('#sendButton').remove();
                    $('.thanks').show();
                }
            });
        }

    });

    $('#map').click(function(){
        if(tabletOrMobile == false){
        window.open('https://maps.google.com/?q='+$('#map').data('googlex')+','+$('#map').data('googley')+'&ll='+$('#map').data('googlex')+','+$('#map').data('googley')+'&z=14', '_blank');
        }
    });

    $('#map').dblclick(function(){window.open('https://maps.google.com/?q='+$('#map').data('googlex')+','+$('#map').data('googley')+'&ll='+$('#map').data('googlex')+','+$('#map').data('googley')+'&z=14', '_blank');
    });


    $('i').click(function(){
       $(this).toggleClass('active');
    });


});

function resizeSubPhotos() {
    if ($(window).width() <= 600) {
        var imageHeight = 0;
        $('.property-detail .sub-images .small-image').each(function () {
            imageHeight = ($(this).width() / 350 * 260 );
            $(this).height(imageHeight);
        });

        $('.sub-images .photoslider').height(imageHeight);
    }
    else{
        $('.property-detail .sub-images .small-image').each(function () {
            $(this).css('height', 'calc(50% - 5px)');
            $('.sub-images .photoslider').css('height', 'calc(50% - 5px)');
        });
    }
}

function resizer() {
    resizeSubPhotos();
}

function scroller() {
    resizeSubPhotos();
}