angular.module("travel",["ngCookie","pasvaz.bindonce","ngSanitize"]),angular.module("travel").controller("SubwayStationPageCtrl",["$scope","$window","CurrencyManager","CityPageHelper","ConfigurationService","$rootScope",function(a,b,c,d,e,f){a.currentCurrency=c.getCurrentCurrencyCode(),a.currencies=e.getCurrencies(),a.hotels=d.getHotels(),a.subwayStations=d.getSubwayStations(),a.subwayLine=d.getSubwayLine();var g=d.getPriceLimits();a.city=d.getCity(),a.getCurrentCurrency=function(){return c.getCurrentCurrencyCode()},a.getCurrencies=function(){return e.getCurrencies()},a.getPriceLimits=function(){return g},f.$broadcast("readyForSnapshot")}]),angular.module("travel").controller("CategoryPageCtrl",["$scope","$rootScope","$window","CurrencyManager","CategoryPageHelper","ConfigurationService","$timeout",function(a,b,c,d,e,f,g){a.currentCurrency=d.getCurrentCurrencyCode(),a.currencies=f.getCurrencies(),a.hotels=e.getHotels(),a.getCurrentCurrency=function(){return d.getCurrentCurrencyCode()},a.getCurrencies=function(){return f.getCurrencies()},a.getPriceLimits=function(){},c.prerenderReady||g(function(){b.$broadcast("readyForSnapshot"),b.$apply()},500);c.prerenderReady?"":c.prerenderReady=!0}]),angular.module("travel").controller("CityPageCtrl",["$scope","$rootScope","$window","CurrencyManager","CityPageHelper","ConfigurationService","$timeout",function(a,b,c,d,e,f,g){a.currentCurrency=d.getCurrentCurrencyCode(),a.currencies=f.getCurrencies(),a.hotels=e.getHotels(),a.subwayStations=e.getSubwayStations(),a.subwayLine=e.getSubwayLine();var h=e.getPriceLimits();a.city=e.getCity(),a.getCurrentCurrency=function(){return d.getCurrentCurrencyCode()},a.getCurrencies=function(){return f.getCurrencies()},a.getPriceLimits=function(){return h},b.isSeoReplaceActive=!0,a.$watch(function(){return c.prerenderReady},function(a){a===!0&&g(function(){b.$broadcast("readyForSnapshot"),b.isSeoReplaceActive=!1,b.$apply()},400)})}]),angular.module("travel").controller("CitySubwayPageCtrl",["$scope","$window","CurrencyManager","CitySubwayPageHelper","ConfigurationService","$rootScope",function(a,b,c,d,e,f){a.subwayStations=d.getSubwayStations(),a.city=d.getCity(),a.subwaySchemePath=d.getSubwaySchemePath(),a.lines=d.getSubwayLines(),f.$broadcast("readyForSnapshot")}]),angular.module("travel").controller("CountryPageCtrl",["$scope","$rootScope","$timeout",function(a,b,c){c(function(){b.$broadcast("readyForSnapshot")},300)}]),angular.module("travel").controller("CustomPageCtrl",["$scope","$rootScope","$timeout",function(a,b,c){c(function(){b.$broadcast("readyForSnapshot")},300)}]),angular.module("travel").controller("HotelMainPageCtrl",["$scope","CurrencyManager","$window","$rootScope","$timeout",function(a,b,c,d,e){a.model={currentCurrency:b.getCurrentCurrencyCode()},e(function(){d.$broadcast("readyForSnapshot")},300)}]),angular.module("travel").controller("HotelPageController",["$scope","CurrencyManager","$window","$rootScope","$filter","$timeout",function(a,b,c,d,e,f){a.model={availbilityHeaderText:"17-18 сентября (2 ночи) 123",currentCurrency:b.getCurrentCurrencyCode()};var g=["января","февраля","марта","апреля","мая","июня","июля","августа","сентября","октября","ноября","декабря"];d.$on("findAvailability",function(b,c){var d=["Наличие мест и цены на "];c.checkIn.getMonth()===c.checkOut.getMonth()?(d.push(c.checkIn.getDate()),d.push("-"),d.push(c.checkOut.getDate()),d.push(" "),d.push(g[c.checkOut.getMonth()])):(d.push(c.checkIn.getDate()),d.push(" "),d.push(g[c.checkIn.getMonth()]),d.push(" - "),d.push(c.checkOut.getDate()),d.push(" "),d.push(g[c.checkOut.getMonth()])),d.push(e("pluralize")(Math.round((c.checkOut-c.checkIn)/864e5),[""," ({0} ночь)"," ({0} ночи)"," ({0} ночей)"])),a.model.availbilityHeaderText=d.join("")});var h=c.TR.pageData.getModel().hotel;a.model.hotel={name:h.name,stars:h.stars,address:h.address,latitude:parseFloat(h.latitude),longitude:parseFloat(h.longitude),iconName:"1",filterMatch:!0},c.TR.config.map.setType(c.TR.pageData.getModel().mapType),a.$on("availabilityDataLoaded",function(b,c){a.$broadcast("updateHotelPrice",c)}),f(function(){d.$broadcast("readyForSnapshot")},600);c.prerenderReady?"":c.prerenderReady=!0}]),angular.module("travel").controller("MainPageCtrl",["$scope","$rootScope","$timeout",function(a,b,c){c(function(){b.$broadcast("readyForSnapshot")},300)}]),angular.module("travel").directive("trUniqueEmail",["$http","AccountService","$timeout",function(a,b,c){return{restrict:"A",require:"ngModel",link:function(a,d,e,f){function g(){for(var a in f.$error)if(j!==a&&f.$error[a]===!0)return!1;return!0}function h(a){a?f.$setValidity("unique",!1):f.$setValidity("unique",!0)}function i(d){return g()?(a.deley&&c.cancel(a.deley),a.deley=c(function(){b.emailIsUnique(d,$.proxy(h,this))},300),void 0):(h(!0),void 0)}var j="unique";a.$watch(function(){return f.$viewValue},i)}}}]),angular.module("travel").directive("clearValue",function(){var a=jQuery('
'),b=jQuery(''),c=function(a){a.length>0?b.show():b.hide()};return{require:"ngModel",link:function(d,e,f,g){c(e.val()),e.before(a),e.appendTo(a),b.appendTo(a),b.click(function(){e.val(""),e.trigger("input"),b.hide()}),g.$parsers.push(function(a){return b.hide(),a.length>0&&b.show(),a})},controller:["$scope","$element",function(a,b){a.$watch(function(){return b.val()},function(a){c(a)})}]}}),angular.module("travel").directive("numbersOnly",function(){return{require:"ngModel",link:function(a,b,c,d){d.$parsers.push(function(a){if(void 0===a)return"";var b=a.replace(/[^0-9]/g,"");return b!==a&&(d.$setViewValue(b),d.$render()),b})}}}),angular.module("travel").directive("stopEvent",function(){return{restrict:"A",link:function(a,b,c){b.bind(c.stopEvent,function(a){a.stopPropagation()})}}}),angular.module("travel").directive("trCurrency",["CurrencyManager","ConfigurationService",function(a){var b=function(a){this.currentCurrency=a};return{link:function(c){a.addCurrencyChangedEvent($.proxy(b,c))}}}]),angular.module("travel").directive("trCurrencyStatic",["CurrencyManager","ConfigurationService",function(a,b){var c=function(a,c){var d=b.getCurrencies()[a],e=c[d.currencyCode];return{price:e,currencyText:d.currencyText}},d=function(a){var b=c(a,this.attrs);"undefined"!=typeof b.price?this.element.text(b.price+" "+b.currencyText):this.element.text(" ")};return{link:function(b,e,f){var g=c(a.getCurrentCurrencyCode(),f);"undefined"!=typeof g.price?e.text(g.price+" "+g.currencyText):e.text(" "),a.addCurrencyChangedEvent($.proxy(d,{element:e,attrs:f}))}}}]),angular.module("travel").directive("trPriceFilterCurrency",["CurrencyManager","ConfigurationService",function(a){var b=function(){this.currencyChanged(a.getCurrentCurrencyCode())};return{link:function(c){a.addCurrencyChangedEvent($.proxy(b,c))}}}]),angular.module("travel").directive("trHotelOnTheMapLink",["$compile",function(a){return{restrict:"A",scope:{hotel:"=",shortHeader:"="},link:{post:function(a,b,c,d){b.bind("click",d.showHotel)}},controller:["$scope","$element",function(b){b.model={popupOptions:{content:"",closeBtn:!1,width:"100%",height:"100%",scrolling:"no",wrapCSS:"hotel-on-the-map",autoScale:!1,autoSize:!1,fitToView:!1,autoDimensions:!1,padding:0},hotelData:b.hotel?{name:b.hotel.name,stars:b.hotel.stars,address:b.hotel.address,city:b.hotel.parentCity,country:b.hotel.parentCountry,price:b.hotel.dayPrice,bonusPoints:0,latitude:b.hotel.latitude,longitude:b.hotel.longitude,url:b.hotel.linkUrl,iconName:b.hotel.iconName,filterMatch:!0}:null,mapData:{type:"Google"},enabled:!0},null===b.model.hotelData&&(b.model.enabled=!1),this.showHotel=function(){return b.model.enabled?(b.model.popupOptions.content=a("
")(b),b.model.popupOptions.afterClose=function(){b.$broadcast("$destroy")},jQuery.fancybox.open(b.model.popupOptions),void 0):!1},b.getLinkText=function(){var a="";switch(b.hotel.category){default:a=b.hotel.isussr?"Гостиница":"Отель";break;case 4:a="Хостел";break;case 26:a="Мини-отель"}return a+" на карте"}}]}}]),angular.module("travel").directive("trLoginOpen",["$window",function(a){return{restrict:"A",scope:{},link:{post:function(a,b,c,d){b.bind("click",d.scrollTop)}},controller:["$scope","$element",function(){this.scrollTop=function(b){jQuery(a).scrollTop(0),jQuery(".js-dropdown-login").dropdown("toggle"),$(".js-register-tab").tab("show"),b.stopPropagation()}}]}}]),angular.module("travel").directive("trPopUpOpener",["$compile","$templateCache",function(a){return{restrict:"A",scope:{directiveToOpen:"@",popCssClass:"@",popUpWidth:"@"},link:{post:function(a,b,c,d){b.click(d.openPopUp)}},controller:["$scope",function(b){b.model={popupOptions:{content:"",closeBtn:!0,width:770,height:"100%",scrolling:"no",wrapCSS:b.popCssClass,autoScale:!0,autoDimensions:!0,padding:0}},this.openPopUp=function(){b.model.popupOptions.content=a(b.directiveToOpen)(b),jQuery.fancybox("show",b.model.popupOptions)}}]}}]),angular.module("travel").directive("trScrollTo",["$window",function(a){return{restrict:"AC",compile:function(){function b(b){b||a.scrollTo(0,0);var d=c.getElementById(b);d||(d=c.getElementsByName(b),d=d&&d.length?d[0]:null),d&&d.scrollIntoView()}var c=a.document;return function(a,c,d){c.bind("click",function(){b(d.trScrollTo)})}}}}]),angular.module("travel").directive("trSrcReplace",function(){return{restrict:"A",link:function(a,b,c){$(b).attr("src",c.tmpsrc)}}}),angular.module("travel").directive("trTooltip",["$compile","$parse",function(a,b){function c(c,d,e){var f=e.$new();c&&(f=angular.extend(f,b(c)(e)));var g=a(d)(f);return g}var d={prerender:!0,content:{button:!1},show:{target:!1,event:"mouseenter",effect:!0,delay:90,solo:!1,ready:!1},hide:{event:"mouseleave",fixed:!0,effect:!0,delay:90},position:{my:"top center",at:"bottom center",adjust:{y:5}},style:{tip:{height:7,width:13,border:1,corner:"top center",mimic:"top center"}}};return{restrict:"A",link:{post:function(a,b,e,f){var g="mouseenter",h="",i=$.extend(!0,{},d);e.trTooltip&&("string"==typeof e.trTooltip?(g=e.trTooltip,i.content.button="click"===g?!0:!1,i.hide.event="mouseenter"===g?"mouseleave":g,i.show.event=g):i=$.extend(!0,i,d)),e.trTooltipText&&(h=e.trTooltipText),e.trTooltipTmpl&&(h=c(e.trTooltipModel,f.getCachedTemplate(e.trTooltipTmpl),a)),e.trTooltipStyle&&(i.style||(i.style={}),i.style.classes=e.trTooltipStyle),i.content.text=h;var j=$(b).qtip(i),k=j.qtip("api");e.trTooltipText&&"undefined"!=typeof e.trTooltipUpdatable&&e.$observe("trTooltipText",function(a){k.set("content.text",a)}),e.trTooltipTmpl&&"undefined"!=typeof e.trTooltipUpdatable&&e.$observe("trTooltipModel",function(b){var d=c(b,f.getCachedTemplate(e.trTooltipTmpl),a);k.set("content.text",d)}),e.trTooltipEnabled&&e.$observe("trTooltipEnabled",function(a){"boolean"!=typeof a&&(a="true"===a),k.disable(!a)}),f.initClickHandler(k)}},controller:["$scope","$window","$templateCache",function(a,b,c){this.initClickHandler=function(a){$(b).click(function(){a.hide()})},this.getCachedTemplate=function(a){return c.get(a)}}]}}]),angular.module("travel").directive("trValidationTooltip",[function(){return{restrict:"E",templateUrl:"directives/attributes/trValidationTooltip/trValidationTooltip.html",transclude:!0,replace:!0,scope:{errors:"=",show:"=",byClass:"=",forNgForm:"="},link:{post:function(a,b,c){var d;d=c.byClass?a.forNgForm?$(b.parents("ng-form")).find(".jsCalendars")[0]:$(b.parents("form")).find(".jsCalendars")[0]:a.forNgForm?$(b.parents("ng-form").find("[name="+c.validationFor+"]")):$(b.parents("form").find("[name="+c.validationFor+"]"));var e=$(d).qtip({prerender:!0,content:{text:b},position:{container:$(b).parent(),my:"top left",at:"bottom left"},show:{target:!1,event:"",effect:!0,delay:90,solo:!1,ready:!1},hide:{event:"",fixed:!0,effect:!0,delay:90},style:{classes:"qtip-validation"}});a.qtipApi=e.qtip("api")}},controller:["$scope","$window","$templateCache",function(a){var b=function(){for(var b in a.errors)if(a.errors[b]===!0&a.show===!0)return a.qtipApi.show(),void 0;return a.errors===!0&a.show===!0?(a.qtipApi.show(),void 0):(a.qtipApi&&a.qtipApi.hide(),void 0)};a.$watch("errors",function(){b()},!0),a.$watch("show",function(){b()},!0)}]}}]),angular.module("travel").directive("trMiracleGalery",[function(){return{restrict:"AE",replace:!0,transclude:!0,templateUrl:"directives/galery/trMiracleGalery/trMiracleGalery.html",scope:{},link:{post:function(a,b,c,d){$(b).on("mouseenter",function(){d.stopAnimation()}).on("mouseleave",function(){d.startAnimation()});var e=$(b).find("li");a.model.selector=$(b).find(".js-selector"),d.onItemClick(e),a.model.items=d.createItemsObject(e),a.model.items.length>0&&d.changeMainImage(0)}},controller:["$scope","$timeout","$window",function(a,b,c){var d=this;a.model={animation:{activeIndex:0,moveForward:!0,isActive:!0},mainItem:{first:{item:null,isActive:!1},second:{item:null,isActive:!1}},imageClick:function(a){c.location=a.link}},this.createItemsObject=function(a){for(var b=[],c=0;c")[0].src=a},f=function(b){$(a.model.items[a.model.animation.activeIndex].domItem).removeClass("item-active"),a.model.animation.activeIndex=b,d.changeMainImage(b),g(b),$(a.model.items[a.model.animation.activeIndex].domItem).addClass("item-active")};this.changeMainImage=function(b){a.model.mainItem.first.isActive?(a.model.mainItem.second.item=a.model.items[b],a.model.mainItem.second.isActive=!0,a.model.mainItem.first.isActive=!1):(a.model.mainItem.first.item=a.model.items[b],a.model.mainItem.first.isActive=!0,a.model.mainItem.second.isActive=!1)};var g=function(b){a.model.selector[0].className=a.model.selector[0].className.replace(/col-md-offset-./g,""),a.model.selector.addClass("col-md-offset-"+3*b)};this.stopAnimation=function(){a.model.animation.isActive=!1,b.cancel(a.model.animationTimeout)},this.startAnimation=function(){a.model.animation.isActive=!0,a.model.animationTimeout=b(h,3e3)};var h=function(){a.model.animation.isActive?(0===a.model.animation.activeIndex&&(a.model.animation.moveForward=!0),a.model.animation.activeIndex===a.model.items.length-1&&(a.model.animation.moveForward=!1),a.model.animation.moveForward&&f(a.model.animation.activeIndex+1),a.model.animation.moveForward||f(a.model.animation.activeIndex-1),a.model.animationTimeout=b(h,3e3)):b.cancel(a.model.animationTimeout)};a.model.animationTimeout=b(h,3e3)}]}}]),angular.module("travel").directive("trWhereToGo",["ConfigurationService",function(a){return{restrict:"AE",replace:!0,transclude:!0,templateUrl:"directives/galery/trWhereToGo/trWhereToGo.html",scope:{},link:{post:function(b,c,d,e){b.element=c,a.isMobileDevice()||$(c).on("mouseenter",function(){e.stopAnimation()}).on("mouseleave",function(){e.startAnimation()});var f=$(c).find(".b-slideshow_items>ul>li");b.model.selector=$(c).find(".js-selector"),e.onItemClick(f),b.model.items=e.createItemsObject(f),b.model.items.length>0&&e.changeMainImage(0)}},controller:["$scope","$timeout","$window",function(a,b,c){var d=this;a.model={hideLegend:!0,animation:{activeIndex:0,moveForward:!0,isActive:!0},mainItem:{first:{item:null,isActive:!1},second:{item:null,isActive:!1}}},this.createItemsObject=function(b){a.model.textContainer=$(a.element).find(".b-slide_text_container");for(var c=[],d=0;d")[0].src=a},f=function(b){$(a.model.items[a.model.animation.activeIndex].domItem).removeClass("item-active"),a.model.animation.activeIndex=b,d.changeMainImage(b),g(b),$(a.model.items[a.model.animation.activeIndex].domItem).addClass("item-active")};this.changeMainImage=function(c){a.model.textContainer.addClass("b-slide_text_container_hide"),b(function(){a.model.mainItem.first.isActive?(a.model.mainItem.second.item=a.model.items[c],a.model.mainItem.second.isActive=!0,a.model.mainItem.first.isActive=!1):(a.model.mainItem.first.item=a.model.items[c],a.model.mainItem.first.isActive=!0,a.model.mainItem.second.isActive=!1),a.$apply(),a.model.textContainer.removeClass("b-slide_text_container_hide")},350)};var g=function(b){a.model.prevSelectorClass&&(a.model.selector[0].className=a.model.selector[0].className.replace(a.model.prevSelectorClass,"")),a.model.selector.addClass("col-md-offset-"+b),a.model.prevSelectorClass="col-md-offset-"+b};this.stopAnimation=function(){a.model.animation.isActive=!1,b.cancel(a.model.animationTimeout)},this.startAnimation=function(){a.model.animation.isActive=!0,a.model.animationTimeout=b(h,3e3)};var h=function(){a.model.animation.isActive?(0===a.model.animation.activeIndex&&(a.model.animation.moveForward=!0),a.model.animation.activeIndex===a.model.items.length-1&&(a.model.animation.moveForward=!1),a.model.animation.moveForward&&f(a.model.animation.activeIndex+1),a.model.animation.moveForward||f(a.model.animation.activeIndex-1),a.model.animationTimeout=b(h,3e3)):b.cancel(a.model.animationTimeout)};a.model.animationTimeout=b(h,3e3)}]}}]),angular.module("travel").directive("trHotelOnTheMap",[function(){return{restrict:"E",replace:!0,scope:{hotelData:"=",mapData:"=",shortHeader:"="},templateUrl:"directives/hotels/hotelOnTheMap/hotelOnTheMap.html",link:{post:function(){}},controller:["$scope","MapHelperService","ConfigurationService","CurrencyManager",function(a,b){a.hotel=a.hotelData,a.hotel.lat=a.hotel.latitude,a.hotel.lon=a.hotel.longitude,a.mapParams={latitude:a.hotel.latitude,longitude:a.hotel.longitude};var c=b.calculateMapBoundaries(a.mapParams.latitude,a.mapParams.longitude);jQuery.extend(a.mapParams,c),a.generateClass=function(){return"b-stars b-stars-big-"+a.hotel.stars},a.generateAddress=function(){var b=a.hotel.address;return a.hotel.city&&(b+=", "+a.hotel.city),a.hotel.country&&(b+=", "+a.hotel.country),b},a.getHotelPrice=function(){return a.hotel.price},a.getBonuses=function(){return Math.floor(a.hotel.bonusPoints).toFixed(0)},a.hotels=[a.hotel]}]}}]),angular.module("travel").directive("trHotelOnTheMapBaloon",["$compile",function(){return{restrict:"E",replace:!0,templateUrl:"directives/hotels/hotelOnTheMapBaloon/hotelOnTheMapBaloon.html",scope:{item:"="},link:function(){},controller:["$scope",function(){}]}}]),angular.module("travel").directive("trHotelsOnTheMap",[function(){return{restrict:"AE",replace:!0,templateUrl:"directives/hotels/hotelsOnTheMap/hotelsOnTheMap.html",transclude:!0,scope:{city:"=",displayModes:"=",hotels:"="},link:{post:function(){}},controller:["$scope","MapHelperService",function(a,b){a.mapParams={latitude:a.city.lat,longitude:a.city.lon},a.isShowNotMatchedHotels=!1;var c=b.calculateMapBoundaries(a.mapParams.latitude,a.mapParams.longitude);jQuery.extend(a.mapParams,c);var d=function(){a.$broadcast("updateMap",a.isShowNotMatchedHotels)};a.showNotMatchedHotels=function(){d()},a.$on("filterComplete",function(){d()})}]}}]),angular.module("travel").directive("hotelBookBtn",["$window","$rootScope",function(){return{restrict:"E",replace:!0,templateUrl:"directives/hotels/hsrHotel/hotelBookBtn/hotelBookBtn.html",link:{post:function(a,b){var c=$(b).closest(".b-hotel").find(".b-hotel_title a").attr("href");$(b).find("a").attr("href",c)}}}}]),angular.module("travel").directive("trHsrHotel",["$window","$rootScope",function(a,b){return{restrict:"E",replace:!0,templateUrl:"directives/hotels/hsrHotel/hsrHotel.html",controller:["$scope",function(a){a.seoReplace=!0,void 0===b.isSeoReplaceActive||b.isSeoReplaceActive||(a.seoReplace=!1),b.$on("readyForSnapshot",function(){a.seoReplace=!1})}]}}]),angular.module("travel").directive("trVisitedHotel",[function(){return{restrict:"E",replace:!0,templateUrl:"directives/hotels/visitedHotel/visitedHotel.html",scope:{hotel:"="},controller:["$scope",function(a){a.model={hotelName:a.hotel.name,hotelStars:a.hotel.starRating,hotelAddress:a.hotel.address,hotelCity:a.hotel.city,hotelCountry:a.hotel.country,hotelRating:a.hotel.travelruRating||0,hotelImage:a.hotel.imageUrl,hotelUrl:a.hotel.hotelUrl},function(){switch(a.model.hotelStars){case 5:a.model.cssClass="b-stars b-stars-small-5";break;case 4:a.model.cssClass="b-stars b-stars-small-4";break;case 3:a.model.cssClass="b-stars b-stars-small-3";break;default:a.model.cssClass=""}}(),a.getAddress=function(){var b=a.model.hotelAddress;return a.model.hotelCity&&(b+=", "+a.model.hotelCity),a.model.hotelCountry&&(b+=", "+a.model.hotelCountry),b},a.goToHotel=function(){}}]}}]),angular.module("travel").directive("trVisitedHotels",[function(){return{restrict:"AE",replace:!0,templateUrl:"directives/hotels/visitedHotels/visitedHotels.html",controller:["$scope","HotelsService",function(a,b){a.hotels=[],a.loaded=!1,a.isShowHotels=function(){return a.loaded&&a.hotels.length>0};var c=function(){d()},d=function(){var c=b.getVisitedHotels();c.then(function(b){b.data&&b.data.hotels&&(a.hotels=b.data.hotels,a.loaded=!0)})};c()}]}}]),angular.module("travel").directive("trDisplayModSwitcher",[function(){return{restrict:"E",replace:!0,templateUrl:"directives/hotelsIssuance/displayModSwitcher/displayModSwitcher.html",transclude:!0,scope:{modes:"="},link:{post:function(){}},controller:["$scope",function(a){var b=function(a,b){a.active=b,a.cssClass="",a.active&&(a.cssClass="active")};a.activateListMode=function(){b(a.modes.map,!1),b(a.modes.list,!0)},a.activateMapMode=function(){b(a.modes.map,!0),b(a.modes.list,!1)}}]}}]),angular.module("travel").directive("trAmenityFilterControl",[function(){return{restrict:"E",replace:!0,templateUrl:"directives/hotelsIssuance/filterControls/amenityFilterControl/amenityFilterControl.html",scope:{onStateInit:"=",onChange:"="},link:{post:function(a,b,c,d){d.initFilter()}},controller:["$scope","AMENITY_FILTER_CONTROL_DEFAULT_MODEL","$window",function(a,b,c){var d={state:new c.TR.controls.AmenityFilterState};this.initFilter=function(){a.resetFilter(!0),a.onStateInit(a.model.state);var b=a.model.state.getStateData();if(b&&b.amenities)for(var c=b.amenities.split(","),d=0;dc&&d>e&&(c=e)}if(b.max&&!isNaN(f)){if(g){var q=!1;for(var r in a.getCurrencies())if(r===b.cur){q=!0;break}if(q){var s=f/a.model.rates[b.cur];for(var t in a.model.currentMaxPrice)j[t]=s*a.model.rates[t];d=j[a.model.currentCurrencyCode]}}d>=f&&f>c&&(d=f)}}i(c,d),this.changeFilter(),k(),n(c,d)},this.changeFilter=function(){c.clearTimeout(a.model.filterTimer),a.model.filterTimer=c.setTimeout(function(){g(),h(),a.onChange(a.model.filterStateName,o,a.model.state)},100)},a.changeFilter=this.changeFilter;var g=function(){a.model.filterRule={min:a.getCurrentMinValue(),max:a.getCurrentMaxValue(),cur:a.model.currentCurrencyCode}},h=function(){a.model.state.setFilterData(a.model.filterRule)};a.currencyChanged=function(b){a.model.currentCurrencyCode=b,j(),m()
},a.inputsChanged=function(){var b=parseInt(a.model.minPriceInputValue,10)||a.getCurrentMinValue(),d=parseInt(a.model.maxPriceInputValue,10)||a.getCurrentMaxValue();c.clearTimeout(a.inputsTimer),a.inputsTimer=c.setTimeout(function(){if(a.model.minPriceInputValue||(a.model.minPriceInputValue=b),a.model.maxPriceInputValue||(a.model.maxPriceInputValue=d),b===a.getCurrentMinValue())a.model.minPriceInputValue=a.getCurrentMinValue();else{if(ba.getCurrentMaxValue())return a.model.minPriceInputValue=a.getCurrentMaxValue(),a.inputsChanged(),void 0}if(d===a.getCurrentMaxValue())a.model.maxPriceInputValue=a.getCurrentMaxValue();else{if(d>a.getMaxLimit())return a.model.maxPriceInputValue=a.getMaxLimit(),a.inputsChanged(),void 0;if(d=c&&d>=e}return!0};a.getMinLimit=function(){return Math.floor(a.model.priceLimits.min[a.model.currentCurrencyCode])},a.getMaxLimit=function(){return Math.ceil(a.model.priceLimits.max[a.model.currentCurrencyCode])},a.getCurrentMinValue=function(){return Math.floor(a.model.currentMinPrice[a.model.currentCurrencyCode])},a.getCurrentMaxValue=function(){return Math.ceil(a.model.currentMaxPrice[a.model.currentCurrencyCode])},a.getCurrentCurrencyText=function(){return d.getCurrencies()[a.model.currentCurrencyCode].currencyText},a.checkToModified=function(){var b=!1;return a.getMinLimit()!==a.getCurrentMinValue()&&(b=!0),a.getMaxLimit()!==a.getCurrentMaxValue()&&(b=!0),b},a.resetFilter=function(b){if(!b){var c=a.getMinLimit(),d=a.getMaxLimit();n(c,d),i(c,d),k(),a.changeFilter()}},this.initModel(),this.initFilter()}]}}]),angular.module("travel").constant("PRICE_FILTER_CONTROL_DEFAULT_MODEL",{filterStateName:"priceFilterState",title:"Цена за ночь",filterRule:[],priceLimits:{min:{},max:{}},currentMinPrice:{},currentMaxPrice:{},minPriceInputValue:"",maxPriceInputValue:"",currentCurrencyCode:"",rates:{},filterTimer:0,inputsTimer:0,enabled:!0}),angular.module("travel").directive("trStarFilterControl",[function(){return{restrict:"E",replace:!0,templateUrl:"directives/hotelsIssuance/filterControls/starFilterControl/starFilterControl.html",scope:{onStateInit:"=",onChange:"="},link:{post:function(a,b,c,d){d.initFilter()}},controller:["$scope","STAR_FILTER_CONTROL_DEFAULT_MODEL","$window",function(a,b,c){var d={state:new c.TR.controls.StarFilterState};this.initFilter=function(){a.resetFilter(!0),a.onStateInit(a.model.state);var b=a.model.state.getStateData();if(b&&b.stars)for(var c=b.stars.split(","),d=0;d0},a.$on("filterComplete",function(a,b){h(b)}),a.$on("filterReset",function(){a.resetFilter()});var g=function(b){return a.model.filterRule[b.stars]},h=function(b){for(var c={},d=0;d=b[0]&&a.travelruRating0,b=b&&e.displayModesActiveStatus.list.active},v=function(){var a=!0;return a=a&&e.displayModesActiveStatus.map.active},w=function(){return e.processing},x=function(){a.$broadcast("filterReset")},y=function(){var a=!!h.min.rub&&!!h.max.rub,b=!0;return a&&(b=g.filter(function(a){return null!==a.dayPrice}).length>1),a&&b},z=function(a){return g.filter(function(b){return b.id===a})};a.issuanceManagerModel={displayModes:e.displayModesActiveStatus,showJsHotels:!1,filterStateInit:function(a){s(a)},sortingStateInit:function(a){t(a)},filterApply:function(a,b,c){l(a,b,c)},sortingApply:function(a,b,c){m(a,b,c)},filtersReset:function(){x()},getRandomHotel:function(){return o()},getPricesLimits:function(){return h},getCurrentCurrency:function(){return q()},getCurrencies:function(){return r()},getRates:function(){return p()},isShowHotelsList:function(){return u()},isShowHotelsOnTheMap:function(){return v()},isShowProcessing:function(){return w()},getHotelsToShow:function(){return j()},getHotelsToShowOnMap:function(){return k()},isPriceFilterEnabled:function(){return y()},getHotelById:function(a){return z(a)}}}]}}]),angular.module("travel").directive("trPriceSortingControl",[function(){return{restrict:"E",replace:!0,templateUrl:"directives/hotelsIssuance/sortingControls/priceSortingControl/priceSortingControl.html",scope:{onStateInit:"=",onChange:"=",getCurrentCurrency:"="},link:{post:function(){}},controller:["$scope","PRICE_SORTING_CONTROL_DEFAULT_MODEL","$window",function(a,b,c){var d={state:new c.TR.controls.PriceSortingState};a.model=jQuery.extend(!0,{},b,d);var e=a.model.sorting.asc,f=function(b){var c=a.getCurrentCurrency();e===a.model.sorting.asc?b.sort(function(a,b){return null===a.dayPrice&&null===b.dayPrice?1:null===a.dayPrice?1:null===b.dayPrice?-1:a.dayPrice[c]-b.dayPrice[c]}):e===a.model.sorting.desc&&b.sort(function(a,b){return null===a.dayPrice&&null===b.dayPrice?1:null===a.dayPrice?1:null===b.dayPrice?-1:b.dayPrice[c]-a.dayPrice[c]})},g=function(){e=e===a.model.sorting.desc?a.model.sorting.asc:a.model.sorting.desc},h=function(){var b={ordering:e};a.model.state.setSortingData(b)};a.changeSorting=function(b){b||g(),h(),a.onChange(a.model.sortingStateName,f,a.model.state)},a.getSortingClass=function(){return a.model.isActive?a.model.classes.active+" "+a.model.classes[e]:null},a.$on("sortingComplete",function(b,c,d){a.model.isActive=a.model.sortingStateName===d}),this.init=function(){a.onStateInit(a.model.state);var b=a.model.state.getStateData();if(b&&b.ordering){var c=a.model.sorting[b.ordering];c&&(e=a.model.sorting[b.ordering],a.changeSorting(!0))}},this.init()}]}}]),angular.module("travel").constant("PRICE_SORTING_CONTROL_DEFAULT_MODEL",{sortingStateName:"priceSortingState",title:"Цена",classes:{asc:"sorting-asc",desc:"sorting-desc",active:"active"},sorting:{asc:"asc",desc:"desc"},isActive:!1}),angular.module("travel").directive("trStarSortingControl",[function(){return{restrict:"E",replace:!0,templateUrl:"directives/hotelsIssuance/sortingControls/starSortingControl/starSortingControl.html",scope:{onStateInit:"=",onChange:"="},link:{post:function(){}},controller:["$scope","STAR_SORTING_CONTROL_DEFAULT_MODEL","$window",function(a,b,c){var d={state:new c.TR.controls.StarSortingState};a.model=jQuery.extend(!0,{},b,d);var e=a.model.sorting.asc,f=function(b){e===a.model.sorting.asc?b.sort(function(a,b){return b.stars!==a.stars?a.stars-b.stars:null===a.dayPrice&&null===b.dayPrice?1:null===a.dayPrice?1:null===b.dayPrice?-1:0}):e===a.model.sorting.desc&&b.sort(function(a,b){return b.stars!==a.stars?b.stars-a.stars:null===a.dayPrice&&null===b.dayPrice?1:null===a.dayPrice?1:null===b.dayPrice?-1:0})},g=function(){e=e===a.model.sorting.desc?a.model.sorting.asc:a.model.sorting.desc},h=function(){var b={ordering:e};a.model.state.setSortingData(b)};a.changeSorting=function(b){b||g(),h(),a.onChange(a.model.sortingStateName,f,a.model.state)},a.getSortingClass=function(){return a.model.isActive?a.model.classes.active+" "+a.model.classes[e]:null},a.$on("sortingComplete",function(b,c,d){a.model.isActive=a.model.sortingStateName===d}),this.init=function(){a.onStateInit(a.model.state);var b=a.model.state.getStateData();if(b&&b.ordering){var c=a.model.sorting[b.ordering];c&&(e=a.model.sorting[b.ordering],a.changeSorting(!0))}},this.init()}]}}]),angular.module("travel").constant("STAR_SORTING_CONTROL_DEFAULT_MODEL",{sortingStateName:"starSortingState",title:"Звезды",classes:{asc:"sorting-asc",desc:"sorting-desc",active:"active"},sorting:{asc:"asc",desc:"desc"}}),angular.module("travel").directive("trTravelruRatingSortingControl",[function(){return{restrict:"E",replace:!0,templateUrl:"directives/hotelsIssuance/sortingControls/travelruRatingSortingControl/travelruRatingSortingControl.html",scope:{onStateInit:"=",onChange:"="},link:{post:function(){}},controller:["$scope","TRAVELRU_RATING_SORTING_CONTROL_DEFAULT_MODEL","$window",function(a,b,c){var d={state:new c.TR.controls.RatingSortingState};a.model=jQuery.extend(!0,{},b,d);var e=a.model.sorting.asc,f=function(b){e===a.model.sorting.asc?b.sort(function(a,b){return b.travelruRating!==a.travelruRating?a.travelruRating-b.travelruRating:null===a.dayPrice&&null===b.dayPrice?1:null===a.dayPrice?1:null===b.dayPrice?-1:0}):e===a.model.sorting.desc&&b.sort(function(a,b){return b.travelruRating!==a.travelruRating?b.travelruRating-a.travelruRating:null===a.dayPrice&&null===b.dayPrice?1:null===a.dayPrice?1:null===b.dayPrice?-1:0})},g=function(){e=e===a.model.sorting.desc?a.model.sorting.asc:a.model.sorting.desc},h=function(){var b={ordering:e};a.model.state.setSortingData(b)};a.changeSorting=function(b){b||g(),h(),a.onChange(a.model.sortingStateName,f,a.model.state)},a.getSortingClass=function(){return a.model.isActive?a.model.classes.active+" "+a.model.classes[e]:null},a.$on("sortingComplete",function(b,c,d){a.model.isActive=a.model.sortingStateName===d}),this.init=function(){a.onStateInit(a.model.state);var b=a.model.state.getStateData();if(b&&b.ordering){var c=a.model.sorting[b.ordering];c&&(e=a.model.sorting[b.ordering],a.changeSorting(!0))}},this.init()}]}}]),angular.module("travel").constant("TRAVELRU_RATING_SORTING_CONTROL_DEFAULT_MODEL",{sortingStateName:"ratingSortingState",title:"Оценка гостей",classes:{asc:"sorting-asc",desc:"sorting-desc",active:"active"},sorting:{asc:"asc",desc:"desc"}}),angular.module("travel").directive("trExtendedPrice",[function(){return{restrict:"E",replace:!0,require:"?ngIf",templateUrl:"directives/prices/trExtendedPrice/trExtendedPrice.html",scope:{},link:function(){},controller:["$scope","CurrencyManager","ConfigurationService",function(a,b){a.model={},a.$on("updateHotelPrice",function(b,c){a.model.object=c,a.model.loaded=!0}),a.hasOldPrice=function(){return!!a.model.object.oldPrice},a.getOldPrice=function(){return a.model.object.oldPrice[b.getCurrentCurrencyCode()]},a.hasDiscount=function(){return!!a.model.object.discount},a.getDiscount=function(){return a.model.object.discount+"%"},a.getRangeObj=function(){return{number:a.model.object.range,words:["ночь","ночи","ночей"]}}}]}}]),angular.module("travel").directive("trPrice",[function(){return{restrict:"E",replace:!0,templateUrl:"directives/prices/trPrice/trPrice.html",require:"?ngIf",scope:{price:"=",hideText:"="},link:function(){},controller:["$scope","CurrencyManager","ConfigurationService",function(a,b,c){var d=function(){return a.price[b.getCurrentCurrencyCode()].toFixed(2)};a.integralPartOfPrice=function(){return d().replace(/\..*$/g,"")},a.fractionalPartOfPrice=function(){return d().replace(/^.*\./g,",")},a.currencyOfPrice=function(){return c.getCurrencies()[b.getCurrentCurrencyCode()].currencyText},a.text="от",a.priceEnabled=function(){return a.price&&a.price[b.getCurrentCurrencyCode()]}}]}}]),angular.module("travel").directive("trEmailInput",[function(){return{restrict:"E",replace:!0,templateUrl:"directives/reachElements/elementsWithValidation/trEmailInput/trEmailInput.html",scope:{elementModel:"=",emailIsUnic:"=",name:"@",validationError:"="},link:function(a,b,c,d){b.children("input").attr("name",a.name),d.initQtip(b),d.initValidationWatch()},controller:["$scope","$log","$timeout",function(a,b){a.model={showPatternError:function(){a.qtipApi.set("content.text","OMG!!! THIS IS WORK!!!"),a.qtipApi.show()},hidePatternError:function(){a.qtipApi.hide()},validationErrorsShown:!1},this.initQtip=function(b){var c=$(b).qtip({content:{text:""},show:{target:!1,event:"",effect:!0,delay:90,solo:!1,ready:!1},hide:{event:"",fixed:!0,effect:!0,delay:90}});a.qtipApi=c.qtip("api")},this.initValidationWatch=function(){a.$watch("validationError",function(c){b.log(c),a.model.validationErrorsShown=c.email===!0?!0:!1},!0)}}]}}]),angular.module("travel").directive("inRoomSelect",["$compile","$templateCache",function(a,b){return{restrict:"AE",replace:!0,scope:{tmplName:"=",maxRooms:"@",maxAdults:"@",maxChilds:"@",maxChildsAge:"@",rooms:"="},link:function(c,d){d.html(b.get("directives/reachElements/inRoomSelect/"+c.tmplName+".html")).show(),a(d.contents())(c)},controller:["$scope","PeopleService","$rootScope",function(a,b){a.model={maxRoomsCount:4},a.model.adultsDdlData=b.getAdultsDdlData(),a.model.childsDdlData=b.getChildsDdlData(),a.model.childsAgeDdlData=b.getChildsAgeDdlData(parseInt(a.maxChildsAge,10)),a.addRoom=function(){var d=b.getRoom();b.setAdults(d,2),c(d),a.rooms.push(d)},a.addChilds=function(){},a.hasChilds=function(){for(var b in a.rooms)if(a.rooms[b].childsCount>0)return!0;return!1},a.removeRoom=function(b){a.rooms.splice(b,1)};var c=function(c){a.$watch(function(){return c.childsCount},function(a){b.setChilds(c,a)})};if(a.rooms)for(var d=0;d0|b.locationList.length>0?(a.model.suggestions=b,k(a.model.suggestions,c),a.model.showSoggestion=!0):a.model.showSoggestion=!1})},a.getAc=function(a){i.getAc(a)};var k=function(a,b){var c=new RegExp(b,"gi");for(var d in a)if(a[d].constructor===Array)for(var e=0;e"+f+"")}};a.onKeyDown=function(b){var c=b.keyCode;switch(c){case j.up_arrow:case j.enter:b.preventDefault();break;case j.right_arrow:a.model.carretPosition=g(a.model.acInput)}},a.onKeyUp=function(b){a.model.acInput||(a.model.acInput=$(b.currentTarget).find("input")[0]);var c=b.keyCode;switch(c){case j.down_arrow:l();break;case j.up_arrow:m();break;case j.right_arrow:a.model.carretPosition===a.model.acInput.value.length&&n();break;case j.enter:n();break;case j.escape:o();break;default:return}},a.onItemMouseEnter=function(b){b.isHighlighted=!0,a.model.hightlightedItem=b};var l=function(){a.model.showSoggestion||(a.model.showSoggestion=!0),p(a.model.suggestions,a.model.hightlightedItem)},m=function(){a.model.showSoggestion||(a.model.showSoggestion=!0),q(a.model.suggestions,a.model.hightlightedItem)},n=function(){a.model.hightlightedItem&&a.model.onSuggestionSelected(a.model.hightlightedItem)},o=function(){a.model.showSoggestion&&(a.model.showSoggestion=!1)},p=function(b,c){var d=!1,e=null;for(var f in b)if(b[f].constructor===Array)for(var g=0;g=0;h--)for(var i=f[h].length-1;i>=0;i--){if(e||(e=f[h][i]),!c)return f[h][i].isHighlighted=!0,a.model.hightlightedItem=f[h][i],void 0;if(d)return f[h][i].isHighlighted=!0,a.model.hightlightedItem=f[h][i],void 0;f[h][i]===c&&(d=!0)}e.isHighlighted=!0,a.model.hightlightedItem=e};a.$watch("model.acText",function(b){return a.model.isAutoset===!0?(a.model.isAutoset=!1,void 0):(h&&d.cancel(h),h=d(function(){""===b?a.model.showSoggestion=!1:a.getAc(b)},300),void 0)}),a.$watch("model.showSoggestion",function(b){b||(a.model.hightlightedItem=null)}),a.$watch("text",function(b){a.model.acText=b,a.model.isAutoset=!0}),a.$watch("model.hightlightedItem",function(a,b){b&&(b.isHighlighted=!1)}),a.$watch("form.$dirty",function(b){b===!0&&a.acForm.$setDirty()})}]}}]),angular.module("travel").directive("trAviaAc",["AutocompleteService",function(a){return{require:"trAutocomplete",templateUrl:"directives/reachElements/trAutocomplete/trBurukiAc.html",link:function(b){b.acForm.dest.$setValidity("isDest",!0),b.model.onSuggestionSelected=function(c){b.onSelected()(c)&&(b.acForm.dest.$setValidity("isDest",!0),b.model.isAutoset=!0,b.model.acText=a.getFormattedSuggestionName(c),b.model.showSoggestion=!1)},b.getAc=function(c){b.acForm.dest.$setValidity("isDest",!1);var d=a.getAviaSuggestion(c);d.then(function(a){b.model.suggestions={airports:a},b.model.showSoggestion=!0},function(){})}}}}]),angular.module("travel").directive("trCalendarInput",["$timeout",function(a){return{restrict:"E",replace:!0,templateUrl:"directives/reachElements/trCalendarInput/trCalendarInput.html",scope:{startDate:"=",endDate:"=",selectedDate:"=",onSelected:"&",isOpen:"=",isEnable:"=?"},link:{post:function(b,c,d,e){b.element=c,b.onSelected&&(b.picker=c.pickadate({format:"dd mmm, ddd",today:"",clear:"",onSet:e.onCalendarSet,onRender:function(){a(function(){b.element.change()},500)}}).pickadate("picker"),"NaN"===b.selectedDate.toString()&&(b.selectedDate=null),b.picker.set("select",b.selectedDate?b.selectedDate:b.startDate,{format:"dd mmm, ddd"}))}},controller:["$scope","$rootScope",function(b,c){var d=!0;"undefined"==typeof b.isEnable&&(b.isEnable=!0),this.onCalendarSet=function(a){return a.select&&(f(this.get("select")),c.$$phase||b.$apply(),b.element.trigger("input"),b.element.change()),!0};var e=function(a,c){b.picker.set("min",a),b.picker.set("max",c)},f=function(a){b.onSelected()(a)};b.$watch("isOpen",function(c,d){a(function(){c&c!==d&&(b.picker.open(),b.isOpen=!1)},100)}),b.$watch("startDate",function(){d?(d=!1,e(b.startDate,b.endDate)):(e(b.startDate,b.endDate),b.selectedDate<=b.startDate&&(b.picker.set("select",b.startDate),b.picker.open()),b.isAutoset=!0)}),b.$watch("isEnable",function(a){a?$(b.element).prop("disabled",!1):$(b.element).prop("disabled",!0)})}]}}]),angular.module("travel").directive("trCarousel",["BrowserService",function(a){return{restrict:"AE",replace:!0,transclude:!0,templateUrl:"directives/reachElements/trCarousel/trCarousel.html",scope:{},link:{post:function(b,c){b.model.itemsWidth=0,b.model.showNavButtons=!1;var d=$(c).find("img"),e=function(){var b=$.Deferred(),c=0;if(d.load(function(){c++,c===d.length&&b.resolve()}),8===a.getIeVersion())for(var e=0;e=a.model.step?"-="+a.model.step:"-="+c},300,function(){a.model.enable=!0}))}},a.model.leftClick=function(){if(a.model.enable){var b=a.model.$carouselItem.position().left;0>b&&(a.model.enable=!1,a.model.$carouselItem.animate({left:Math.abs(b)=o,j.disabled=j.disabledReason.activePolicy||j.disabledReason.notEnoughtRooms}}}function f(){return{roomGroups:[]}}function g(a,b){return{RateCode:a.rateCode,AgesCode:a.agesCode,RoomSubType:a.roomSubType,MealType:a.mealType,SupplierRoomName:a.roomSupplierName,DisplayTotalPrice:a.price.rub,RoomType:a.roomType,RateIndex:b,IsBestRate:!1}}return{restrict:"AE",templateUrl:"directives/trAvailabilityControl/trAvailabilityControl.html",replace:!0,scope:{},controller:["$scope","AvailabilityService","CurrencyManager","$window","$rootScope",function(b,c,d,h,i){b.model={loaded:!1,timeout:!1,currency:d.getCurrentCurrencyCode(),features:{multiroom:!1},availability:null,hotelId:99084,query:"in=18.02.2014&out=19.02.2014&destid=12196&occ=1",selectRate:function(a,c){if(!a.disabled&&!a.selected){for(var d=0;d0){for(var c=0;c1,c.roomGroups.length>1&&(a(b.model.availability),e(b.model.availability)),j()},function(){b.timeout=!0})}),i.$emit("availability.loaded")}]}}]),angular.module("travel").directive("trBonus",[function(){return{restrict:"E",replace:!0,templateUrl:"directives/trBonus/trBonus.html",require:"?ngIf",scope:{price:"="},link:function(){},controller:["$scope","ConfigurationService",function(a,b){var c=function(){return a.price.rub};a.getBonusAmount=function(){return Math.floor(c()/100*b.getBonusPointsPercentage())},a.isEnabledBonuses=function(){var b=a.price&&a.price.rub;return b&&"number"==typeof a.getBonusAmount()&&a.getBonusAmount()>0}}]}}]),angular.module("travel").directive("trCommercial",[function(){return{restrict:"E",replace:!0,templateUrl:"directives/trCommercial/trCommercial.html",controller:["$scope","CommercialService",function(a,b){var c=this;this.templateName="",a.generateClass=function(){return"commercial-"+c.templateName},this.getContent=function(a){return b.getTemplate(a)}}],link:function(a,b,c,d){d.templateName=c.trCommercialTemplate;var e=d.getContent(d.templateName);e?b.children()[0].innerHTML=e:b.hide()}}}]),angular.module("travel").directive("trImage",["$window","$q",function(a,b){return{restrict:"E",replace:!0,templateUrl:"directives/trImage/trImage.html",scope:{tumbnailSrc:"@",width:"@",height:"@",largeSrc:"@"},link:function(c,d,e,f){var g=[];c.tumbnailSrc&&(f.showOverlay(),g.push(f.preloadImage(c.tumbnailSrc).then(function(a){f.positionThumbnail(a.scaledWidth,a.scaledHeight),f.setThumbnailUrl(c.tumbnailSrc)},function(){}))),c.largeSrc&&g.push(f.preloadLargeImage(c.largeSrc).then(function(b){var e={content:function(a,d){d.set("style.width",b.width+8),d.set("style.height",b.height+8);var e=$(new Image);return e.attr("src",c.largeSrc),e.css({width:b.width,height:b.height}),e},position:{my:"top center",at:"bottom center",adjust:{y:5}},show:{effect:!1},hide:{effect:!1},style:{tip:{height:7,width:13},classes:"image-tooltip",def:!1},events:{show:function(){}}};e.position.viewport=$(a),$(d).qtip(e)},function(){})),b.all(g).then(function(){f.hideOverlay()},function(){})},controller:["$scope","$q",function(a,b){this.preloadImage=function(c){var d=b.defer(),e=new Image;return e.onload=function(){var b=this.width,c=this.height,e=b,f=c;b>=c?(e=Math.round(b*(a.width/c)),f=a.height):(f=Math.round(c*(a.height/b)),e=a.width);var g={scaledWidth:Math.floor(e),scaledHeight:Math.floor(f),width:b,height:c};d.resolve(g)},e.src=c,d.promise},this.preloadLargeImage=function(a){var c=b.defer(),d=new Image;return d.onload=function(){var a=this.width,b=this.height,d=a,e=b;a>b?a>400&&(e=Math.round(b*(400/a)),d=400):b>a?a>300&&(e=Math.round(b*(300/a)),d=300):a>400&&(d=400,e=400);var f={scaledWidth:Math.floor(d),scaledHeight:Math.floor(e),width:a,height:b};c.resolve(f)},d.src=a,c.promise},this.positionThumbnail=function(b,c){a.thumbnailStyle={width:Math.floor(b),height:Math.floor(c),marginLeft:Math.floor(-1*(b-a.width)/2),marginTop:Math.floor(-1*(c-a.height)/2)}},this.setThumbnailUrl=function(b){a.thumbnailUrl=b},this.showOverlay=function(){a.overlayVisible=!0},this.hideOverlay=function(){a.overlayVisible=!1}}]}}]),angular.module("travel").constant("LOGIN_BLOCK_DEFAULT_MODEL",{validationInitState:{login:!1,reservation:!1,register:!1,recovery:!1},forms:{recovery:{active:!1,successed:!1,error:!1},register:{successed:!1}},credentials:{login:{login:"",password:"",rememberMe:!0},register:{email:"",password:""},recovery:{email:""},checkReservation:{login:"",reservationNumber:""}}}),angular.module("travel").directive("trLoginBlock",[function(){return{restrict:"E",replace:!0,templateUrl:"directives/trLoginBlock/trLoginBlock.html",scope:{},link:function(a,b,c,d){var e=jQuery(".js-dropdown",b);e.on("click.dropdown.data-api",function(){d.reset(),a.$apply()}),$(b).find(".js-tabs a").click(function(a){a.preventDefault(),$(this).tab("show")})},controller:["$scope","AccountService","ConfigurationService","LOGIN_BLOCK_DEFAULT_MODEL",function(a,b,c,d){this.reset=function(){var e={currentUser:b.getCurrentUser(),userIsLogged:b.isUserLogged(),loggedOffText:"Войти",serverUrl:c.getUrl("httpServerUrl"),serverUrlSsl:c.getUrl("httpsServerUrl")};a.model=jQuery.extend(!0,{},d,e)},this.reset(),a.alerts=[];var e=function(c){0===c.status&&(a.model.currentUser=b.getCurrentUser(),a.model.userIsLogged=b.isUserLogged(),a.$apply())},f=function(b){b=b[0],b&&0===b.status&&(a.model.forms.recovery.successed=!0),a.$apply()};a.loginUser=function(){a.model.validationInitState.login=!0,b.loginUser(a.model.credentials.login,e)},a.checkReservation=function(){a.model.validationInitState.reservation=!0,b.checkReservation(a.model.credentials.checkReservation,e)},a.recoveryPassword=function(){a.model.validationInitState.recovery=!0,b.recoveryPassword(a.model.credentials.recovery,f)},a.registerUser=function(){a.model.validationInitState.register=!0,b.registerUser(a.model.credentials.register,e).promise.then(function(b){b.errors&&b.errors.length>0||(a.model.forms.regiter=!0)},function(){})},a.logoutUser=function(){b.logoutUser(e)},a.showPasswordRecoveryForm=function(){a.model.forms.recovery.active=!0},a.hidePasswordRecoveryForm=function(){a.model.forms.recovery.active=!1},a.getButtonText=function(){var b=a.model.loggedOffText;return a.model.userIsLogged&&(b=a.model.currentUser.firstname&&a.model.currentUser.lastname?a.model.currentUser.firstname+" "+a.model.currentUser.lastname:a.model.currentUser.email),b},a.getProfileUrl=function(){return a.model.serverUrlSsl+"my"},a.getReservationsUrl=function(){return a.model.serverUrlSsl+"my/history"},a.getSettingsUrl=function(){return a.model.serverUrlSsl+"my/settings"},a.getImageUrl=function(){var b=c.getUrl("defaultProfileImageUrl");return a.model.userIsLogged&&(b=a.model.currentUser.image),b},a.bonusPointsVisible=function(){return a.model.userIsLogged&&a.model.currentUser&&a.model.currentUser.bonusPoints>0}}]}}]),angular.module("travel").constant("MARKERS_ICONS",{icons:{0:{src:"",size:{width:9,height:9},anchor:{x:4,y:4},origin:{x:0,y:0},shadow:{src:"",size:{width:9,height:9},anchor:{x:3,y:3},origin:{x:81,y:0}},big:{size:{width:26,height:32},anchor:{x:13,y:26},origin:{x:0,y:17},shadow:{src:"",size:{width:34,height:40},anchor:{x:17,y:30},origin:{x:235,y:10}}}},1:{src:"",size:{width:9,height:9},anchor:{x:4,y:4},origin:{x:9,y:0},shadow:{src:"",size:{width:9,height:9},anchor:{x:3,y:3},origin:{x:81,y:0}},big:{size:{width:26,height:32},anchor:{x:13,y:26},origin:{x:26,y:17},shadow:{src:"",size:{width:34,height:40},anchor:{x:17,y:30},origin:{x:235,y:10}}}},2:{src:"",size:{width:9,height:9},anchor:{x:4,y:4},origin:{x:18,y:0},shadow:{src:"",size:{width:9,height:9},anchor:{x:3,y:3},origin:{x:81,y:0}},big:{size:{width:26,height:32},anchor:{x:13,y:26},origin:{x:52,y:17},shadow:{src:"",size:{width:34,height:40},anchor:{x:17,y:30},origin:{x:235,y:10}}}},3:{src:"",size:{width:9,height:9},anchor:{x:4,y:4},origin:{x:27,y:0},shadow:{src:"",size:{width:9,height:9},anchor:{x:3,y:3},origin:{x:81,y:0}},big:{size:{width:26,height:32},anchor:{x:13,y:26},origin:{x:78,y:17},shadow:{src:"",size:{width:34,height:40},anchor:{x:17,y:30},origin:{x:235,y:10}}}},4:{src:"",size:{width:9,height:9},anchor:{x:4,y:4},origin:{x:36,y:0},shadow:{src:"",size:{width:9,height:9},anchor:{x:3,y:3},origin:{x:81,y:0}},big:{size:{width:26,height:32},anchor:{x:13,y:26},origin:{x:104,y:17},shadow:{src:"",size:{width:34,height:40},anchor:{x:17,y:30},origin:{x:235,y:10}}}},5:{src:"",size:{width:9,height:9},anchor:{x:4,y:4},origin:{x:45,y:0},shadow:{src:"",size:{width:9,height:9},anchor:{x:3,y:3},origin:{x:81,y:0}},big:{size:{width:26,height:32},anchor:{x:13,y:26},origin:{x:130,y:17},shadow:{src:"",size:{width:34,height:40},anchor:{x:17,y:30},origin:{x:235,y:10}}}},6:{src:"",size:{width:9,height:9},anchor:{x:4,y:4},origin:{x:54,y:0},shadow:{src:"",size:{width:9,height:9},anchor:{x:3,y:3},origin:{x:81,y:0}},big:{size:{width:26,height:32},anchor:{x:13,y:26},origin:{x:156,y:17},shadow:{src:"",size:{width:34,height:40},anchor:{x:17,y:30},origin:{x:235,y:10}}}}}}),angular.module("travel").directive("trMap",["$window",function(a){return{restrict:"E",replace:!0,scope:{mapParams:"=",hotels:"=",disableHover:"="},templateUrl:"directives/trMap/trMap.html",link:{post:function(b,c,d,e){e.resizeContainer(),e.initMap(),jQuery(a).resize(e.resizeMap)}},controller:["$scope","$element","$window","$compile","ConfigurationService","MARKERS_ICONS",function(a,b,c,d,e,f){var g=this,h={},i={width:0,height:0};a.baloonItem={},this.mapControllers=["YFullCanvasController","GFullCanvasController"],this.markerIcons=f,this.mapParams=a.mapParams,this.mapType=c.TR.config.map.getType(),this.disableHover=a.disableHover===!0;var j={markersSprite:e.getUrl("httpServerUrl")+"flashcanvas/sprite4.png",map:g.mapType};jQuery.extend(g.mapParams,j),this.initMap=function(){i=g.getParentSize();var c={controller:g.mapControllers["Google"===g.mapParams.map?1:0],params:g.mapParams,center:{lat:parseFloat(g.mapParams.latitude),lng:parseFloat(g.mapParams.longitude)},onMapReady:function(){setTimeout(function(){h.loadData(a.hotels||[])},100)},initUrl:"",showHintForCluster:!1,debug:!1,disableHover:g.disableHover};h=new CityMap(b[0],c),h.setClusteringConfig({enable:!0,clusterDistance:20,groupDistance:1e-4}),h.setIconsOptions(g.markerIcons),g.disableHover||h.setMarkerOnMousetEnter(function(b){a.baloonItem=b;var c=d("
")(a);return a.$digest(),c})},this.getParentSize=function(){return{width:b.parent().width(),height:b.parent().height()}},this.updateMap=function(a,b){h.refreshMap(b)},this.resizeContainer=function(){b.css({width:"100%",height:b.parent().height()-b.siblings().height()+"px"})},this.resizeMap=function(){var a=g.getParentSize();(a.width!==i.width||a.height!==i.height)&&(i=a,g.resizeContainer(),h.fillContainer())},a.$on("updateMap",g.updateMap)}]}}]),angular.module("travel").directive("trRating",[function(){return{restrict:"E",replace:!0,templateUrl:"directives/trRating/trRating.html",scope:{rating:"="},link:function(){},controller:["$scope",function(a){a.getRatingClass=function(){return a.rating<6?"b-rating-normal":"b-rating-good"},a.getRatingText=function(){return 10===a.rating?"Идеально":a.rating>=9?"Превосходно":a.rating>=8?"Отлично":a.rating>=7?"Очень хорошо":a.rating>=6?"Хорошо":a.rating>=5?"Неплохо":a.rating<5?"Удовлетворительно":void 0},a.isVisible=function(){return!!a.rating&&a.rating>0}}]}}]),angular.module("travel").directive("trScrollManager",["CurrencyManager","ConfigurationService",function(){return{restrict:"E",replace:!0,template:"",transclude:!0,scope:{items:"=",showJsHotels:"="},link:{post:function(){}},controller:["$scope","$window","$document","$timeout",function(a,b,c){var d=60;b.onscroll=function(){var f=c.height()-2*$(b).height();c.scrollTop()>f&&(a.showJsHotels=!0,e(d),a.$$phase||a.$apply())};var e=function(b){for(var c=0;c=0;c++)a.items[c].filterMatch&&(a.items[c].show?a.items[c].show!==!0&&(a.items[c].show=!0,b--):(a.items[c].show=!0,b--))},f=function(){for(var b=0;b div")[1]),$(a.acElements.second).append(a.$element.find(".js-avia-ac > div")[0]),a.model.destsIsReversed=!a.model.destsIsReversed};var l=new Date;a.model.calendars={firstCalendarStartDate:l,secondCalendarStartDate:new Date(new Date(l).setDate(l.getDate())),firstCalendarEndDate:new Date(new Date(l).setMonth(l.getMonth()+12)),secondCalendarEndDate:new Date(new Date(l).setMonth(l.getMonth()+12)),firstCalendarIsOpen:!1,secondCalendarIsOpen:!1,firstCalendarSelectedDate:l,secondCalendarSelectedDate:new Date(new Date(l).setDate(l.getDate())),showRangeError:!1},a.model.rooms=[b.getDefaultAvia()];var m=function(){a.model.calendars.showRangeError=moment(a.model.calendars.secondCalendarSelectedDate).diff(a.model.calendars.firstCalendarSelectedDate,"days")>30?!0:!1};a.model.calendars.firstCalendarOnSelected=function(b){a.model.calendars.firstCalendarSelectedDate=b.obj,a.model.calendars.secondCalendarStartDate=new Date(new Date(b.obj).setDate(b.obj.getDate())),a.model.calendars.secondCalendarSelectedDate0&&(a.model.acTextFrom=b[0].label,a.model.autocompleteFrom.selectedSuggestion=b[0])},function(){}),d.then(function(b){console.log(b),b&&b.length>0&&(a.model.acTextTo=b[0].label,a.model.autocompleteTo.selectedSuggestion=b[0])},function(){})}};if(this.restoreStateFromCache(),a.iataFrom&&a.iataTo)n(a.iataFrom,a.iataTo);else if($.url(e.location).param("origin")&&$.url(e.location).param("dest"))n($.url(e.location).param("origin"),$.url(e.location).param("dest"));else{var o=c.getIataFromUrl();o&&n("Москва",o)}a.model.autocompleteFrom||(a.model.autocompleteFrom={}),a.model.autocompleteFrom.onSelect=function(b){return a.model.autocompleteFrom.selectedSuggestion=b,!0},a.model.autocompleteTo||(a.model.autocompleteTo={}),a.model.autocompleteTo.onSelect=function(b){return a.model.autocompleteTo.selectedSuggestion=b,!0},a.model.search=function(){if(a.searchForm.$setDirty(),a.searchForm.$valid){if(a.model.destsIsReversed){var b=$.extend(a.model.autocompleteFrom,{});a.model.autocompleteFrom=a.model.autocompleteTo,a.model.autocompleteTo=b}d.setByKey("_af_state",JSON.stringify(a.model)),k.pushGaTrackingEvent("Avia","Search"),e.location="http://poisk2.avia.travel.ru/search/"+c.getBurukiSearchUrlByModel(a.model)}}}]}}]),angular.module("travel").directive("trHotelsSearchForm",["$compile","$templateCache",function(a,b){return{restrict:"AE",replace:!0,scope:{tmplName:"@",showAc:"=",saveState:"=",forAvailability:"=",hotelId:"@",destinationId:"@",destinationName:"@",inRoomSelectTmpl:"@"},link:function(c,d){d.html(b.get("directives/trSearchForms/trHotels/"+c.tmplName+".html")).show(),a(d.contents())(c)},controller:["$scope","PeopleService","UrlService","CacheService","$window","$log","$timeout","$rootScope","ConfigurationService","CityPageHelper",function(a,b,c,d,e,f,g,h,i,j){a.seoReplace=!0,a.model={showValidationMessages:!1,searchText:a.forAvailability===!0?"Показать цены":"Найти"};var k=new Date;a.model.calendars={firstCalendarStartDate:k,secondCalendarStartDate:new Date(new Date(k).setDate(k.getDate()+1)),firstCalendarEndDate:new Date(new Date(k).setMonth(k.getMonth()+12)),secondCalendarEndDate:new Date(new Date(k).setMonth(k.getMonth()+12)),firstCalendarIsOpen:!1,secondCalendarIsOpen:!1,firstCalendarSelectedDate:k,secondCalendarSelectedDate:new Date(new Date(k).setDate(k.getDate()+1)),showRangeError:!1},a.getBonusPointsUrl=function(){return i.getUrl("bonusPointsUrl")},a.model.autocomplete={selectedSuggestion:{hotelId:a.hotelId,id:a.destinationId},onSelect:function(b){return a.model.autocomplete.selectedSuggestion=b,!0}},a.model.rooms=[b.getRoom()];var l=function(){a.model.calendars.showRangeError=moment(a.model.calendars.secondCalendarSelectedDate).diff(a.model.calendars.firstCalendarSelectedDate,"days")>30?!0:!1};a.model.calendars.firstCalendarOnSelected=function(b){a.model.calendars.firstCalendarSelectedDate=b.obj,a.model.calendars.secondCalendarStartDate=new Date(new Date(b.obj).setDate(b.obj.getDate()+1)),a.model.calendars.secondCalendarSelectedDate=0&&d.push(b[e]):c++;d.sort();var f=["Для "];return f.push(a("pluralize")(c,["","{0} взрослого","{0} взрослых","{0} взрослых"])),d.length>0&&(f.push(" и "),f.push(a("pluralize")(d.length,["","ребенка","{0} детей","{0} детей"])),1===d.length?0===d[0]?f.push(" до года"):f.push(a("pluralize")(d[0],[""," {0} года"," {0} лет"," {0} лет"])):(f.push(": "),f.push(d.map(function(a){return 0===a?"до года":a}).join(", ")),f.push(a("pluralize")(d[d.length-1],[""," года"," лет"," лет"])))),f.join("")}}]),angular.module("travel").filter("currencySign",[function(){return function(a){switch(a){case"rub":return"руб";case"eur":return"€";case"usd":return"$";case"uah":return"грн"}}}]),angular.module("travel").filter("declension",[function(){return function(a){var b=a.number+" ",c=a.number%100>20?a.number%10:a.number%20;switch(c){case 1:b+=a.words[0];break;case 2:case 3:case 4:b+=a.words[1];break;default:b+=a.words[2]}return b}}]),angular.module("travel").filter("formatCurrency",[function(){return function(a,b,c){if("undefined"!=typeof a){var d=Math.floor(a),e=a-d,f=d.toString(),g=","+e.toFixed(2).toString().substring(2);f.length>3&&(f=f.substring(0,f.length-3)+" "+f.substring(f.length-3));var h=[];return b&&h.push(f),c&&h.push(g),h.join("")}}}]),angular.module("travel").filter("pluralize",[function(){function a(a,b){var c=[2,0,1,1,1,2];return b[a%100>4&&20>a%100?2:c[Math.min(a%10,5)]]}return function(b,c){var d=new Formatter;return 0===b?d(c[0],b):d(a(b,c.slice(1)),b)}}]),angular.module("travel").filter("priceFormat",[function(){return function(a){var b=parseFloat(a);return"number"!=typeof b?a:b.toString().replace(/\B(?=(\d{3})+(?!\d))/g," ").replace(".",",")}}]),angular.module("travel").filter("roomImage",[function(){return function(a,b){return"undefined"==typeof a?void 0:0===a.indexOf("http")?a:"http://i.travel.ru/images/roomimages/"+b+"/11/"+a}}]);var TR=TR||{};TR.namespace=function(a){var b,c=a.split("."),d=TR;for("TR"===c[0]&&(c=c.slice(1)),b=0;b0){s=c.settings.stations[t].linkUrl;break}}s&&r.attr({href:s}).attr(c.linkAttr)}}),b.each(b(a).find("text"),function(a,d){var e=b(d),f=e.attr("id")?e.attr("id").substring(1):null,g={x:e.attr("x"),y:parseInt(e.attr("y"),10)+20},h=c.R.text(g.x,g.y,e.text()).attr(c.textBgAttr),i=c.R.text(g.x,g.y,e.text()).attr(c.textAttr);c.alignTop(i),c.alignTop(h);var j=e.attr("line_number");if(j){var k={x:e.attr("number_offset_x"),y:e.attr("number_offset_y"),fill:e.attr("number_fill")},l=parseInt(g.x,10)+parseInt(k.x,10),m=parseInt(g.y,10)+parseInt(k.y,10);c.subwaylineAttr.fill=k.fill;var n=c.R.text(l,m,j).attr(c.subwaylineBgAttr),o=c.R.text(l,m,j).attr(c.subwaylineAttr);c.alignTop(o),c.alignTop(n)}if(f){c.Stations[f]||(c.Stations[f]=new c.Station),c.Stations[f].label=i,c.Stations[f].labelBg=h,i.hover(function(){c.over(f)},function(){c.out(f)});for(var p=null,q=0;q0){p=c.settings.stations[q].linkUrl;break}}p&&i.attr({href:p}).attr(c.linkAttr)}})},c.over=function(a){c.Stations[a]&&(c.Stations[a].label&&c.Stations[a].label.attr(c.textOverAttr),c.Stations[a].station&&c.Stations[a].station.attr(c.stationOverAttr))},c.out=function(a){c.Stations[a]&&(c.Stations[a].label&&c.Stations[a].label.attr(c.textAttr),c.Stations[a].station&&c.Stations[a].station.attr(c.stationAttr))},c.alignTop=function(a){a.translate(0,-a.getBBox().height/4)},a.SubwayScheme=function(a){c.settings.container=b("#"+a.parent),c.settings.parent=c.settings.container.parent(),c.settings.stations=a.stations,c.loadSVG(a.path)}}(TR.namespace("contentSubway"),jQuery),angular.module("travel").factory("CategoryPageHelper",["$window",function(a){var b=a.TR.pageData.getModel();return a.TR.config.map.setType(b.mapType),a.TR.config.map.setZoom(b.defaultZoom),{getHotels:function(){if(b.hotels)for(var a=0;a0},f=function(b,c){try{a.localStorage.setItem(b,c)}catch(d){"QUOTA_EXCEEDED_ERR"===d&&a.localStorage.clear()}},g=function(b){var c=a.localStorage.getItem(b);if(c){if(c=JSON.parse(c),!c.experationDate||e(c.experationDate))return c;a.localStorage.removeItem(b)}return null};return{getByKey:function(a){return c?g(a):null},setByKey:function(a,b,e){return c||b?(e?f(a,d(b)):f(a,b),void 0):null},getByPartOfKey:function(b){for(var c in a.localStorage)if(0===c.indexOf(b))return g(c);return null}}}]),angular.module("travel").factory("CommercialService",["$window","$templateCache",function(a,b){var c=function(a){return"commercial/"+a+".html"},d=function(a){return b.get(a)};return{getTemplate:function(a){return d(c(a))}}}]),angular.module("travel").factory("ConfigurationService",["$window",function(a){var b=null,c=/\/Mobile|iP(hone|od|ad)|Android|BlackBerry|IEMobile|Kindle|NetFront|Silk-Accelerated|(hpw|web)OS|Fennec|Minimo|Opera M(obi|ini)|Blazer|Dolfin|Dolphin|Skyfire|Zune\/"/,d=c.test(a.navigator.userAgent),e=function(){b=a.TR.config.userData.get()},f=function(b){return a.TR.config.userData.set(b)},g=function(){return e(),b},h=function(b){return a.TR.config.urls.getByKey(b)},i=function(){return a.TR.config.currencies.get()},j=function(){return a.TR.config.bonuses.getPercentage()},k=function(){return a.TR.config.pageType.get()};return{getUserInfo:function(){return g()},updateUserInfo:function(a){return f(a)},getUrl:function(a){return h(a)},getCurrencies:function(){return i()},getBonusPointsPercentage:function(){return j()},getBurukiAcUrl:function(){return"http://buruki.ru/ajax_complete/CityAirportLookup/?term="},getPageType:function(){return k()},isMobileDevice:function(){return d}}}]),angular.module("travel").factory("CookieService",["$cookie","$window",function(a){return{setByKey:function(b,c,d){a(b,c,{domain:".Travel.ru",expire:d?d:99,path:"/"})},getByKey:function(b){return a(b)}}}]),angular.module("travel").value("CurrentCurrencyValue",{currencyCode:"rub"}),angular.module("travel").factory("CurrencyManager",["CurrentCurrencyValue","CookieService",function(a,b){var c=[],d=function(a){for(var b=0;bc;c++)a.childs.push({age:0});a.childsCount=a.childs.length},b=function(a,b){a.childs=a.childs.slice(-a.childs.length,-b)},c=function(a,b){a.adultsCount=b},d=function(a,b){a.age=b};return{getRoom:function(){var a={adultsCount:2,childsCount:0,childs:[]};return a},getDefaultAvia:function(){var a={adultsCount:1,childsCount:0,childs:[]};return a},getAviaSeats:function(){var a={adultsCount:2,childsCount:0,babiesCount:0,childs:[],babies:[]};return a},setAdults:function(a,b){c(a,b)},setChilds:function(c,d){var e=c.childs.length-d;e>0?b(c,e):a(c,Math.abs(e))},setChildAge:function(a,b){d(a,b)},getAdultsDdlData:function(){return[{count:1,text:"1 взрослый"},{count:2,text:"2 взрослых"},{count:3,text:"3 взрослых"},{count:4,text:"4 взрослых"},{count:5,text:"5 взрослых"},{count:6,text:"6 взрослых"}]},getChildsDdlData:function(){return[{count:0,text:"без детей"},{count:1,text:"и 1 ребенок"},{count:2,text:"и 2 детей"},{count:3,text:"и 3 детей"}]},getChildsAgeDdlData:function(a){for(var b=[],c=0;a+1>c;c++)b.push(c);return b}}}]),angular.module("travel").factory("StateManagerService",["$location",function(a){var b=function(b){b=b.replace(/^#&/g,""),a.hash(b)},c=function(){return a.hash()};return{replaceHash:function(a){b(a)},getHash:function(){return c()}}}]),angular.module("travel").factory("UrlService",["PeopleService","AutocompleteService",function(a,b){var c="DD.MM.YYYY",d="YYYY-MM-DD",e=new Formatter,f=function(a){for(var b="",d=0;d=h)return l.reject({code:d.TIMEOUT}),void 0;var n=a({url:b.TR.config.urls.getByKey("httpServerUrl")+"HotelAvailability/GetHotelAvailabilityWithContentJson",method:"POST",data:{ticket:i,hotelId:j,query:k}});n.success(function(a){return 500===a.status?(l.reject({code:d.INTERNAL_ERROR}),void 0):a.result.completed?(l.resolve(a.result),void 0):(e(function(){f(c,a.result.ticket,j,k,l)},1e3),void 0)}),n.error(function(){e(function(){f(c,i,j,k,l)},1e3)})}}var g=null,h=null,i=9e4;return{getAvailability:function(e,j){var k=c.defer(),l=Math.random();g=l,h=new Date((new Date).getTime()+i);var m=!0;if(isNaN(e)&&(m=!1),m){var n=a({url:b.TR.config.urls.getByKey("httpServerUrl")+"HotelAvailability/GetHotelAvailabilityWithContentJson",method:"POST",data:{hotelId:e,query:j,ticket:null}});n.success(function(a){return 500===a.status?(k.reject({code:d.INTERNAL_ERROR}),void 0):(a.result.ticket?f(l,a.result.ticket,e,j,k):k.resolve(a.result),void 0)}),n.error(function(){k.reject({code:d.TIMEOUT})})}else k.reject({code:d.INVALID_REQUEST});return k.promise},addRoomsToReservation:function(d){var e=c.defer(),f=a({url:b.TR.config.urls.getByKey("httpServerUrl")+"HotelAvailability/AddRoomsToReservation",method:"POST",data:d});return f.success(function(a){a.result.reservationId?e.resolve(b.TR.config.urls.getByKey("httpServerUrl")+"reserve?g="+a.result.reservationId):e.reject()}),f.error(function(){e.reject()}),e.promise}}}]),angular.module("travel").constant("VISITED_HOTELS_COUNT",5).factory("HotelsService",["$http","$window","ConfigurationService","VISITED_HOTELS_COUNT",function(a,b,c,d){var e=function(){var b={hotels:[],loaded:!1};return a.post(c.getUrl("httpServerUrl")+"visitedhotels",{hotelsCount:d}).success(function(a){return a.hotels&&(b.hotels=a.hotels,b.loaded=!0),b}).error(function(){return b.loaded=!1,b})};return{getVisitedHotels:function(){return e()}}}]),angular.module("travel").factory("PhonesService",["CookieService",function(a){var b="tr_phone_loc",c=[{phone:"+7 (812) 337-13-77",id:12196,combo_text:"Санкт-Петербург"},{phone:"+7 (495) 640-53-72",id:12153,combo_text:"Москва"},{phone:"8 800 333-62-61",id:186,combo_text:"Россия"}],d=c[0],e=a.getByKey(b);if(e)for(var f=0;f'),a.put("directives/galery/trMiracleGalery/trMiracleGalery.html",''),a.put("directives/galery/trWhereToGo/trWhereToGo.html",''),a.put("directives/hotels/hotelOnTheMap/hotelOnTheMap.html",''),a.put("directives/hotels/hotelOnTheMapBaloon/hotelOnTheMapBaloon.html",'{{ item.name }}
{{ item.address }}
'),a.put("directives/hotels/hotelsOnTheMap/hotelsOnTheMap.html",''),a.put("directives/hotels/hsrHotel/hotelBookBtn/hotelBookBtn.html",''),a.put("directives/hotels/hsrHotel/hsrHotel.html",''),a.put("directives/hotels/visitedHotel/visitedHotel.html",''),a.put("directives/hotels/visitedHotels/visitedHotels.html",'Ранее просмотренные отели
'),a.put("directives/hotelsIssuance/displayModSwitcher/displayModSwitcher.html",''),a.put("directives/hotelsIssuance/filterControls/amenityFilterControl/amenityFilterControl.html",''),a.put("directives/hotelsIssuance/filterControls/categoryFilterControl/categoryFilterControl.html",''),a.put("directives/hotelsIssuance/filterControls/priceFilterControl/priceFilterControl.html",''),a.put("directives/hotelsIssuance/filterControls/starFilterControl/starFilterControl.html",''),a.put("directives/hotelsIssuance/filterControls/textFilterControl/textFilterControl.html",''),a.put("directives/hotelsIssuance/filterControls/travelruRatingFilterControl/travelruRatingFilterControl.html",''),a.put("directives/hotelsIssuance/issuanceManager.html",''),a.put("directives/hotelsIssuance/sortingControls/priceSortingControl/priceSortingControl.html",'{{ model.title }}'),a.put("directives/hotelsIssuance/sortingControls/starSortingControl/starSortingControl.html",'{{ model.title }}'),a.put("directives/hotelsIssuance/sortingControls/travelruRatingSortingControl/travelruRatingSortingControl.html",'{{ model.title }}'),a.put("directives/prices/trExtendedPrice/trExtendedPrice.html","За номер за {{ getRangeObj() | declension }}
{{ getOldPrice() | formatCurrency:true:true }} {{ getDiscount() }}
Можно оплатить баллами
"),a.put("directives/prices/trPrice/trPrice.html","{{ text }}{{ integralPartOfPrice() | priceFormat }}{{ fractionalPartOfPrice() }}{{ currencyOfPrice() }}"),a.put("directives/reachElements/elementsWithValidation/trEmailInput/trEmailInput.html",''),a.put("directives/reachElements/inRoomSelect/inRoomSelect.html",'В номере будут проживать
В номерах будут проживать
Количество пассажиров
'),a.put("directives/reachElements/inRoomSelect/inRoomSelectAvia.html",''),a.put("directives/reachElements/inRoomSelect/inRoomSelectInline.html",''),a.put("directives/reachElements/trAutocomplete/trAutocomplete.html",''),a.put("directives/reachElements/trAutocomplete/trBurukiAc.html",''),a.put("directives/reachElements/trCalendarInput/trCalendarInput.html",""),a.put("directives/reachElements/trCarousel/trCarousel.html",''),a.put("directives/reachElements/trCurrencySwitcher/trCurrencySwitcher.html",''),a.put("directives/reachElements/trPhoneSelector/trPhoneSelector.html",'{{ model.selectedPhone.phone }}
'),a.put("directives/reachElements/trSlider/trSlider.html",""),a.put("directives/seoSpecial/trStaticTemplateRenderer/trStaticTemplateRenderer.html",""),a.put("directives/subscribe/subscribeInline.html",' {{ model.message.text }}
'),a.put("directives/subscribe/subscribeMain.html",' {{ model.message.text }}
'),a.put("directives/trAvailabilityControl/trAvailabilityControl.html",'Идет поиск доступных номеров по вашему запросу.
К сожалению, {{model.getDateRange()}}
В данный момент нет информации о доступных номерах в отеле. Пожалуйста, попробуйте еще раз.
|
---|
|
|
| - Скидка {{room.discount}}%
- {{room.meal}}
- Бесплатный Wi-Fi
- Оплата в отеле
- Можно оплатить баллами
- Отмена невозможнаСо штрафом {{room.policy.fees[model.currency] | formatCurrency:false:true}}Бесплатная отменаПравила отмены
| {{room.oldPrice[model.currency] | formatCurrency:true:true }} {{room.price[model.currency] | formatCurrency:true:false}}{{room.price[model.currency] | formatCurrency:false:true}} {{model.currency | currencySign}} Бонус: {{room.points}}* | |
{{room.content.description}} Услуги и удобства: {{room.content.amenities.join(", ")}} - Размер кровати: или
- {{bed}}
Свернуть описание |
|
Итого к оплате за {{model.availability.roomGroups.length}} номера {{model.getTotal() | formatCurrency:true:false}}{{model.getTotal() | formatCurrency:false:true}} {{model.currency | currencySign}} Можно оплатить баллами Бонус: {{model.getMultiroomPoints()}} |
'),a.put("directives/trBonus/trBonus.html","Бонус: {{ getBonusAmount() }}"),a.put("directives/trCommercial/trCommercial.html",''),a.put("directives/trImage/trImage.html",''),a.put("directives/trLoginBlock/trLoginBlock.html",'{{alert.msg}}{{ model.currentUser.bonusPoints }}
'),a.put("directives/trMap/trMap.html",""),a.put("directives/trRating/trRating.html",'{{ getRatingText() }} {{ rating }}'),a.put("directives/trSearchForms/trAvia/trAvia.html",''),a.put("directives/trSearchForms/trHotels/trHotelsSearchForm.html",''),a.put("directives/trSearchForms/trHotels/trHotelsSearchFormInline.html",''),a.put("directives/trSpecialOffers/trHotelsInPopularCities.html",'- currency: {{currentCurrency}} {{hotel.prices[currentCurrency]}} - {{currencies[currentCurrency].currencyText}}
'),a.put("directives/trSpecialOffers/trHotelsInPopularCountries.html",''),a.put("directives/trSpecialOffers/trPopularHotels.html",'{{hotel.title}} {{hotel.starRating}} {{hotel.locationTitle}} {{hotel.travelruRatingText}} | {{hotel.travelruRating}} из 10 от {{hotel.prices[currentCurrency]}} {{currencies[currentCurrency]}}
'),a.put("directives/trSubway/trSubway.html",'Интерактивная схема линий
Условные обозначения
- {{ line.order }}{{ line.name }}
'),a.put("directives/trSubway/trSubwayLine.html",''),a.put("directives/trTaReviews/trTaReviews.html",''),a.put("directives/trTabs/trTab.html",''),a.put("directives/trTabs/trTabs.html",''),a.put("commercial/bonusPointsImageLink.html",'custom static commercial block'),a.put("footer/OldTravelFooter.html",''),a.put("footer/TravelMainFooter.html",''),a.put("tooltip/availability/dayPrice.html","{{ dayPriceOld | formatCurrency:true:true }}
{{ dayPrice | formatCurrency:true:true }} {{ currency | currencySign }}
за номер за одну ночь
"),a.put("tooltip/availability/disabledReason.html","Вы выбрали для бронирования номер, действие штрафных санкций для которого начнется раньше, чем через три дня. Мы не можем оформить заказ, в котором были бы два номера, для которых действие штрафных санкций наступает в один и тот же срок.
Вы выбрали для бронирования номер этого типа. Их количество ограничено. Мы не можем оформить заказ, в котором было бы два и более таких номеров.
"),a.put("tooltip/test.html","This is HELP!!!!
")
}]);