File manager - Edit - /home/gzbnyc5/pty-app/realstate/public/js/pty.front.angjs-property.js
Back
angularApp.directive('onErrorSrc', function() { return { link: function(scope, element, attrs) { element.bind('error', function() { if (attrs.src != attrs.onErrorSrc) { attrs.$set('src', attrs.onErrorSrc); element.parent().attr('href', attrs.onErrorSrc); } }); element.bind('load', function() { element.parent().attr('href', attrs.src); }); } } }); angularApp.filter('bedNumber', function() { return function(x) { if( x == null ) return 0; var z = typeof x == 'string' ? x : x.toString(); if( z.indexOf('.') < 0 ) return x; var parts = z.split('.'); if(parseInt(parts[1]) == 0) { return parts[0]; } else { return x; } }; }); angularApp.controller('propertyController', ['$rootScope', '$scope', '$http', '$compile', function($rootScope, $scope, $http, $compile) { var ctrl = this; /***************************************************************************** * * Property detail * *****************************************************************************/ ctrl.trans = GLOBAL_TRANSLATION; ctrl.property = window.property; ctrl.propFiles= window.propFiles; ctrl.type = window.listingType; ctrl.googleMap = { map: null, infoWindow: null, }; ctrl.showMarker = function() { // Create new markers // Loop through our array of markers & place each one on the map // var bounds = new google.maps.LatLngBounds(); var property = ctrl.property; var geoLocation = { lat: parseFloat(property.latitude), lng: parseFloat(property.longitude) }; var position = new google.maps.LatLng(geoLocation); // bounds.extend(position); var marker = new google.maps.Marker({ position: position, map: ctrl.googleMap.map, title: property.city, // icon : BASEURL + '/assets/front/images/map_marker.png' icon: { path: google.maps.SymbolPath.CIRCLE, scale: 80, strokeWeight: 1, fillColor:'#6eadcd', fillOpacity: 1 } }); // var cityCircle = new google.maps.Circle({ // // strokeColor: '#6eadcd', // strokeWeight: 0, // fillColor: '#6eadcd', // fillOpacity: 1, // map: ctrl.googleMap.map, // center: { lat: parseFloat(property.latitude), lng: parseFloat(property.longitude) }, // radius: 100 // }); // Allow each marker to have an info window // google.maps.event.addListener(marker, 'click', (function(marker) { // return function() { // // var propertyContent = angular.element('<div class="property-listing-map-info-window">' + // '<div class="image-with-label">' + // '<img ng-src="'+BASEURL + '/images/properties/' + (property.migration_id > 0 ? 'migration/' : '') + property.first_image +'" on-error-src="'+BASEURL + '/images/properties/nopic.png' +'" alt="" class="img-responsive" style="width: auto; height: 150px; margin-left: auto; margin-right: auto;">' + // '</div>' + // '<div class="featured-properties-detail" style="white-space: normal"> ' + // '<a href="'+BASEURL + '/property/' + property.id +'"><h4>'+property.city+'</h4></a> ' + // '<p class="featured-properties-address">'+property.street+'</p> ' + // '<h6>'+ctrl.trans['bedrooms']+':{{ '+property.beds+' | bedNumber }} '+ctrl.trans['bathrooms']+':{{ '+property.baths+' | bedNumber}} '+ctrl.trans['sqft']+':{{ '+property.sqft+' | number:2 }}</h6>' + // '</div>'); // $compile(propertyContent)($scope); // ctrl.googleMap.infoWindow.setContent(propertyContent[0]); // ctrl.googleMap.infoWindow.open(ctrl.googleMap.map, marker); // } // })(marker)); ctrl.googleMap.map.setCenter(position); } /***************************************************************************** * * Sending messages * *****************************************************************************/ ctrl.formHasError = false; ctrl.formHidden = false; ctrl.sendMessage = function() { ctrl.formHasError = false; if($scope.name && $scope.email && $scope.message && $scope.phone && $scope.captcha) { $http({ method: 'POST', url: BASEURL + '/send-message', data: { captcha: $scope.captcha, name: $scope.name, email: $scope.email, phone: $scope.phone, message: $scope.message, agent_id: ctrl.property.agent_info != null ? ctrl.property.agent_info.id : null, property_id: ctrl.property.id, } }) .then(function(result) { if (result.status != 200) { console.log('Unknown error. Please contact your administrator', data); } else { if(result.data.error == 0) { ctrl.formHidden = true; } else { ctrl.formHasError = true; var keys = Object.keys(result.data.errors); if(keys.length > 0) { ctrl.formError = result.data.errors[keys[0]][0]; } else { ctrl.formError = 'Unknown error. Please contact your administrator'; } $('#pty-captcha-container > img').replaceWith(result.data.image); } } if(!$scope.$$phase) { $scope.$apply(); } },function(error) { console.log('error',error); }); } else { ctrl.formHasError = true; ctrl.formError = ctrl.trans['all_fields_required']; } } ctrl.refreshCaptcha = function() { $('#pty-captcha-container > .input-group > .input-group-btn button i').addClass('fa-spin'); $http({ method: 'GET', url: BASEURL + '/refresh-captcha', }) .then(function(result) { if (result.status != 200) { console.log('Unknown error. Please contact your administrator', data); } else { if(result.data.error == 0) { $('#pty-captcha-container > .input-group > .input-group-btn > img').replaceWith(result.data.image); } } if(!$scope.$$phase) { $scope.$apply(); } $('#pty-captcha-container > .input-group > .input-group-btn button i').removeClass('fa-spin'); },function(error) { console.log('error',error); $('#pty-captcha-container > .input-group > .input-group-btn button i').removeClass('fa-spin'); }); } $(document).ready(function() { //Property Details var sync1 = $("#property-d-1"); var sync2 = $("#property-d-1-2"); sync1.owlCarousel({ autoPlay: 3000, singleItem: true, slideSpeed: 1000, transitionStyle: "fade", navigation: true, navigationText: ["<i class='fa fa-angle-left'></i>", "<i class='fa fa-angle-right'></i>"], pagination: false, afterAction: syncPosition, responsiveRefreshRate: 200, }); sync2.owlCarousel({ autoPlay: true, items: 5, itemsDesktop: [1199, 10], itemsDesktopSmall: [979, 10], itemsTablet: [768, 8], itemsMobile: [479, 4], pagination: false, responsiveRefreshRate: 100, afterInit: function(el) { el.find(".owl-item").eq(0).addClass("synced"); } }); function syncPosition(el) { var current = this.currentItem; $("#property-d-1-2").find(".owl-item").removeClass("synced").eq(current).addClass("synced") if ($("#property-d-1-2").data("owlCarousel") !== undefined) { center(current) } } $("#property-d-1-2").on("click", ".owl-item", function(e) { e.preventDefault(); var number = $(this).data("owlItem"); sync1.trigger("owl.goTo", number); }); $('#pty-contact-agent-form').click(function() { $('html, body').animate({scrollTop:$('#contact-agent-form').offset().top}, 'slow'); return false; }); $('.pty-show-agent').click(function() { var agentAlias = $(this).data('pty-agent'); window.location.href = BASEURL + '/agent-profile/' + agentAlias; }); function center(number) { var sync2visible = sync2.data("owlCarousel").owl.visibleItems; var num = number; var found = false; for (var i in sync2visible) { if (num === sync2visible[i]) { var found = true; } } if (found === false) { if (num > sync2visible[sync2visible.length - 1]) { sync2.trigger("owl.goTo", num - sync2visible.length + 2) } else { if (num - 1 === -1) { num = 0; } sync2.trigger("owl.goTo", num); } } else if (num === sync2visible[sync2visible.length - 1]) { sync2.trigger("owl.goTo", sync2visible[1]) } else if (num === sync2visible[0]) { sync2.trigger("owl.goTo", num - 1) } } // Property listing map page load map function property_listing_map_initialize() { var defLoc = {lat: parseFloat(window.defLocation[0]), lng: parseFloat(window.defLocation[1])}; var mapOptions = { zoom: 16, center: defLoc, mapTypeId: 'roadmap', scrollwheel: false, styles: [{"featureType":"administrative","elementType":"labels.text.fill","stylers":[{"color":"#444444"}]},{"featureType":"landscape","elementType":"all","stylers":[{"color":"#f2f2f2"}]},{"featureType":"poi","elementType":"all","stylers":[{"visibility":"off"}]},{"featureType":"road","elementType":"all","stylers":[{"saturation":-100},{"lightness":45}]},{"featureType":"road.highway","elementType":"all","stylers":[{"visibility":"simplified"}]},{"featureType":"road.arterial","elementType":"labels.icon","stylers":[{"visibility":"off"}]},{"featureType":"transit","elementType":"all","stylers":[{"visibility":"off"}]},{"featureType":"water","elementType":"all","stylers":[{"color":"#46bcec"},{"visibility":"on"}]}] }; // Display a map on the page ctrl.googleMap.map = new google.maps.Map(document.getElementById("property-listing-map"), mapOptions); ctrl.googleMap.map.setTilt(45); // Display multiple markers on a map ctrl.googleMap.infoWindow = new google.maps.InfoWindow({Width: 365,Height: 400}); ctrl.showMarker(); } if(document.getElementById('property-listing-map') != null ){ google.maps.event.addDomListener(window, 'load', property_listing_map_initialize); } }); }]);
| ver. 1.4 |
Github
|
.
| PHP 8.2.31 | Generation time: 0 |
proxy
|
phpinfo
|
Settings