|
|
|
|
@ -505,6 +505,83 @@ if (EXPO.company){ |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
var Map = function (opt) { |
|
|
|
|
var self = this; |
|
|
|
|
this.opt = opt; |
|
|
|
|
this.$wrapper= $("#address-block"); |
|
|
|
|
this.$toggle = $(".map-toggle",this.$wrapper); |
|
|
|
|
this.$container = $(".map-wrap", this.$wrapper); |
|
|
|
|
this.status ={ |
|
|
|
|
visible:false |
|
|
|
|
}; |
|
|
|
|
this.$toggle.on("click", function () { |
|
|
|
|
if($(this).hasClass("active")){ |
|
|
|
|
/** |
|
|
|
|
* hide map |
|
|
|
|
*/ |
|
|
|
|
self.hideMap(); |
|
|
|
|
}else{ |
|
|
|
|
/** |
|
|
|
|
* show map |
|
|
|
|
*/ |
|
|
|
|
self.showMap(); |
|
|
|
|
} |
|
|
|
|
return false; |
|
|
|
|
}); |
|
|
|
|
/** |
|
|
|
|
* google map initialization |
|
|
|
|
*/ |
|
|
|
|
var mapHolder = document.getElementById('gmap-canvas'); |
|
|
|
|
var initGooglemap = function () { |
|
|
|
|
var mapOptions = { |
|
|
|
|
zoom: 4 |
|
|
|
|
}; |
|
|
|
|
self.map = new google.maps.Map(mapHolder, mapOptions); |
|
|
|
|
|
|
|
|
|
//var marker = new google.maps.Marker({
|
|
|
|
|
// position: myLatlng,
|
|
|
|
|
// map: map
|
|
|
|
|
//});
|
|
|
|
|
//todo: если есть город то геокодировать его + сделать автокомплит
|
|
|
|
|
var country = $("#id_country option:selected").text(); |
|
|
|
|
var geocoder = new google.maps.Geocoder(); |
|
|
|
|
geocoder.geocode({"address":country}, function (results, status) { |
|
|
|
|
if (status == google.maps.GeocoderStatus.OK){ |
|
|
|
|
self.map.setCenter(results[0].geometry.location); |
|
|
|
|
var marker = new google.maps.Marker({ |
|
|
|
|
map: self.map, |
|
|
|
|
position: results[0].geometry.location |
|
|
|
|
}); |
|
|
|
|
}else{ |
|
|
|
|
alert("Geocode was not successful for the following reason: " + status); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
}; |
|
|
|
|
google.maps.event.addDomListener(window, 'load', initGooglemap); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}; |
|
|
|
|
Map.prototype = { |
|
|
|
|
showMap: function () { |
|
|
|
|
this.$toggle.addClass("active").children(".label").text(this.$toggle.attr("data-hide-text")); |
|
|
|
|
this.status.visible = true; |
|
|
|
|
this.$container.removeClass("hidden"); |
|
|
|
|
}, |
|
|
|
|
hideMap: function () { |
|
|
|
|
this.$toggle.removeClass("active").children(".label").text(this.$toggle.attr("data-show-text")); |
|
|
|
|
this.status.visible = false; |
|
|
|
|
this.$container.addClass("hidden"); |
|
|
|
|
}, |
|
|
|
|
refresh: function () { |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
// methods
|
|
|
|
|
//инициализация общих свойств
|
|
|
|
|
@ -807,9 +884,10 @@ if (EXPO.company){ |
|
|
|
|
* preview button |
|
|
|
|
*/ |
|
|
|
|
$('#'+self.opt.previewBtnId).attr('href',window.location.href+"?logout=1"); |
|
|
|
|
//$('#'+self.opt.previewBtnId).on("click", function () {
|
|
|
|
|
//
|
|
|
|
|
//});
|
|
|
|
|
/** |
|
|
|
|
* google map |
|
|
|
|
*/ |
|
|
|
|
this.map = new Map(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
|