{"version":3,"sources":["common/js/components/dealerLocator2/dealerLocator2Search.js"],"names":["dometic","dealerLocator2","search","init","this","searchButton","redoSearchButton","bindEvents","autocomplete","useMyLocation","getMyPositionOnPageLoad","filters","handleFilterContextInQueryString","handleInitialMapSettings","context","maxResults","distance","location","lat","lng","partnerType","stationary","onroad","productCategories","groups","productType","constants","startDistance","startMaxResults","searchButtonIDselector","searchButtonLoadingClass","searchTextBoxIDSelector","$","click","searchButtonClick","e","preventDefault","skipValidation","find","dataString","data","dataArray","split","length","val","trim","addClass","setTimeout","removeClass","mapView","current","zoom","doSearch","addLoadingClass","removeLoadingClass","googleMapsAutocomplete","setupGoogleAutoComplete","autocompleteType","google","maps","places","Autocomplete","document","getElementById","types","fields","setAutocompleteBiasedToCountry","url","get","response","results","geometry","setBounds","LatLngBounds","console","log","addListener","autocompletePlaceChanged","place","getPlace","formatted_address","textboxValue","getFirstPlaceInAutoComplete","status","GeocoderStatus","OK","callback","service","AutocompleteService","getPlacePredictions","input","componentRestrictions","PlacesServiceStatus","firstResultPlaceId","place_id","geocoder","Geocoder","geocode","placeId","reverseGeocodeLatLng","googleMapPos","parseFloat","bindGetMyPosition","navigator","geolocation","getCurrentPosition","onGeoLocationSuccess","onGeoLocationError","position","getLatLongFromUserPosition","coords","latitude","longitude","onLatLongFromUserPositionSuccess","onLatLongFromUserPositionError","latLng","callbackSuccess","callbackError","partnerTypeRadioButtonNameSelector","partnerTypeDefaultValueSelector","otherFiltersIDSelector","otherFiltersCheckboxesSelector","productCategoryFiltersIDSelector","productCategoryCheckboxesSelector","productCategoryDropdownSelector","productTypeDropdownSelector","productTypeFiltersIDSelector","filterTypesDataAttribute","otherFiltersIDs","filterTypes","productCategory","partnerTypes","dealer","serviceCenter","on","onPartnerTypeChanged","onFilterCheckboxChanged","onSingleFilterDropDownChanged","setSelectedPartnerType","partnerTypeValue","change","showRedoSearchButton","value","hide","setSelectedFiltersInDropDown","selectpicker","show","filterValues","dropdown","i","filterValue","prop","event","isQuery","arguments","undefined","$currentOption","filterType","arrayToAlter","addFilter","restedArray","resetFilterForSpecificArray","removeFilter","scAction","scController","productCategoryPimId","contextItem","contextLanguage","ajax","method","done","result","productTypeDropdown","nothingSelectedOption","detach","empty","append","concat","Value","Key","trigger","fail","jqXHR","textStatus","errorThrown","$currentInput","id","attr","is","arrayToReset","filterArrayToAddTo","indexInArray","indexOf","push","filterArrayToRemoveFrom","splice","splittedquerystring","window","querystring","params","deparam","debug","zip","zipCode","country","handleZipCodeInQueryString","zipLocation","addressParameter","redoSearchButtonIDSelector","redoSearchInThisAreaClicked","getMapInformation","mapInformation","hideRedoSearchButton","withScrollAnimation","createSearchQueryString","queryStringWithDealerContext","addDealerContextToQuerystring","dataType","success","href","history","pushState","title","decodeURIComponent","resultsNeededForMapDisplay","Partners","slideUp","doScroll","animate","scrollTop","offset","top","height","slideDown","listView","populateData","circle","rectangle","doExpandedSearch","error","searchContext","param","dealerLocatorRenderingDatasource","sitecoreContextItem","sitecoreContextLanguage","initialLat","initialLng","jQuery"],"mappings":"AAAAA,WACAA,QAAQC,kBACRD,QAAQC,eAAeC,QACrBC,KAAM,SAASA,OACbC,KAAKC,aAAaF,OAClBC,KAAKE,iBAAiBC,aACtBH,KAAKI,aAAaL,OAClBC,KAAKK,cAAcC,0BACnBN,KAAKO,QAAQR,OACbC,KAAKQ,mCACLR,KAAKS,4BAEPC,SACEC,WAAY,IACZC,SAAU,GACVC,UACEC,IAAK,GACLC,IAAK,IAEPC,YAAa,GACbC,WAAY,KACZC,OAAQ,KAGRC,qBACAC,UAEAC,gBAEFC,WACEC,cAAe,GACfC,gBAAiB,KAEnBvB,cACEqB,WACEG,uBAAwB,0CACxBC,yBAA0B,aAC1BC,wBAAyB,uCAE3BxB,WAAY,SAASA,aACnByB,EAAE5B,KAAKsB,UAAUG,wBAAwBI,MAAM7B,KAAK8B,oBAEtDA,kBAAmB,SAASA,kBAAkBC,GAC5CA,EAAEC,iBAGF,IAAIC,eAAiBL,EAAE,+BAA+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SAAW,KACjCZ,KAAKU,QAAQE,SAAW,IACxBhB,QAAQC,eAAeC,OAAOkD,YACrBhD,KAAKU,QAAQE,SAAW,MACjCZ,KAAKU,QAAQE,SAAW,KACxBhB,QAAQC,eAAeC,OAAOkD,YACrBhD,KAAKU,QAAQE,SAAW,KACjCZ,KAAKU,QAAQE,SAAW,IACxBhB,QAAQC,eAAeC,OAAOkD,YAE9BpB,EAAE,8BAA8BkM,QAAQ,IAAK,WAC3ClM,EAAE,2BAA2ByM,UAAU,QAI7CnB,wBAAyB,SAASA,wBAAwB0B,eAMxD,IAAIrE,OACJ,YANoC,IAAzBqE,cAAcxN,SACnBwN,cAAcxN,OAAOmB,QAAU,GAA6B,MAAxBqM,cAAcxN,QAA8C,KAA5BwN,cAAcxN,OAAO,YACpFwN,cAAcxN,OAGZQ,EAAEiN,MAAMD,gBAGvBxB,8BAA+B,SAASA,8BAA8BlB,aACpE,IAAI4C,iCAAmClN,EAAE,+BAA+BQ,KAAK,eACzE2M,oBACAC,wBACJ,OAAO9C,YAAc,mBAFKtK,EAAE,QAAQQ,KAAK,WAEuB,uBADlCR,EAAE,QAAQQ,KAAK,eACsE,iBAAmB0M,kCAExIrO,yBAA0B,SAASA,2BACjC,IAAIwO,WAAarN,EAAE,8BAA8BQ,KAAK,eAClD8M,WAAatN,EAAE,8BAA8BQ,KAAK,oBAC5B,IAAf6M,iBAAmD,IAAdC,aAC9ClP,KAAKU,QAAQG,SAASC,IAAMmO,WAC5BjP,KAAKU,QAAQG,SAASE,IAAMmO,WAC5BlP,KAAKU,QAAQE,SAAW,IACxBhB,QAAQC,eAAeC,OAAOkD,UAAS,MAI7C,SAAWpB,GACThC,QAAQC,eAAeC,OAAOC,OADhC,CAEGoP","file":"../../../../../common/js/components/dealerLocator2/dealerLocator2Search-b72046abbe.js","sourcesContent":["dometic = {};\ndometic.dealerLocator2 = {};\ndometic.dealerLocator2.search = {\n init: function init() {\n this.searchButton.init();\n this.redoSearchButton.bindEvents();\n this.autocomplete.init();\n this.useMyLocation.getMyPositionOnPageLoad();\n this.filters.init();\n this.handleFilterContextInQueryString();\n this.handleInitialMapSettings();\n },\n context: {\n maxResults: 500,\n distance: 20,\n location: {\n lat: \"\",\n lng: \"\"\n },\n partnerType: \"\",\n stationary: null,\n onroad: null,\n //applications: [],\n //businessSolutions: [],\n productCategories: [],\n groups: [],\n //serviceCenterCategories: [],\n productType: []\n },\n constants: {\n startDistance: 20,\n startMaxResults: 500\n },\n searchButton: {\n constants: {\n searchButtonIDselector: \"#dealerLocatorSearchComponent-btnSubmit\",\n searchButtonLoadingClass: \"is-loading\",\n searchTextBoxIDSelector: \"#dealerLocatorSearchComponent-input\"\n },\n bindEvents: function bindEvents() {\n $(this.constants.searchButtonIDselector).click(this.searchButtonClick);\n },\n searchButtonClick: function searchButtonClick(e) {\n e.preventDefault();\n\n //Note that \"True\" is case sensitive and needs to have a capital letter at the starts\n var skipValidation = $(\".dealerLocatorHeroComponent\").find(\"[data-validation='True']\");\n var dataString = $('.dealerLocatorHeroComponent').find(\"[data-groups]\").data().groups;\n var dataArray = dataString.split('|');\n if (dataArray.length > 0) {\n dometic.dealerLocator2.search.context.groups = dataArray;\n } else {\n dometic.dealerLocator2.search.context.groups = dataString;\n }\n if (skipValidation.length > 0) {\n //skips the validation!\n } else {\n if (dometic.dealerLocator2.search.context.productCategories.length <= 0 || dometic.dealerLocator2.search.context.productType.length <= 0 || dometic.dealerLocator2.search.context.location.lat.length === 0 || dometic.dealerLocator2.search.context.location.lng.length === 0 || $(\"#dealerLocatorSearchComponent-input\").val().trim() === \"\") {\n if (dometic.dealerLocator2.search.context.location.lat.length === 0 || dometic.dealerLocator2.search.context.location.lng.length === 0 || $(\"#dealerLocatorSearchComponent-input\").val().trim() === \"\") {\n $(dometic.dealerLocator2.search.searchButton.constants.searchTextBoxIDSelector).addClass(\"is-flashing\");\n setTimeout(function () {\n $(dometic.dealerLocator2.search.searchButton.constants.searchTextBoxIDSelector).removeClass(\"is-flashing\");\n }, 1000);\n\n //This isn't working, no such property exist in useMyLocation.\n /* $(dometic.dealerLocator2.search.useMyLocation.constants.useMyLocationLinkIdSelector).hide(); */\n }\n if (dometic.dealerLocator2.search.context.productCategories.length <= 0) {\n $(\".dealerLocatorFilterComponent\").find(\"[data-id='productCategory-dropdown']\").addClass(\"is-flashing\");\n setTimeout(function () {\n $(\".dealerLocatorFilterComponent\").find(\"[data-id='productCategory-dropdown']\").removeClass(\"is-flashing\");\n }, 1000);\n }\n if (dometic.dealerLocator2.search.context.productType.length <= 0) {\n $(\".dealerLocatorFilterComponent\").find(\"[data-id='productType-dropdown']\").addClass(\"is-flashing\");\n setTimeout(function () {\n $(\".dealerLocatorFilterComponent\").find(\"[data-id='productType-dropdown']\").removeClass(\"is-flashing\");\n }, 1000);\n }\n return;\n }\n }\n dometic.dealerLocator2.search.context.distance = dometic.dealerLocator2.search.constants.startDistance;\n dometic.dealerLocator2.search.context.maxResults = dometic.dealerLocator2.search.constants.startMaxResults;\n if (typeof dometic.dealerLocator2.mapView != 'undefined') {\n dometic.dealerLocator2.mapView.current.zoom = 12;\n }\n dometic.dealerLocator2.search.doSearch();\n },\n addLoadingClass: function addLoadingClass() {\n $(dometic.dealerLocator2.search.searchButton.constants.searchButtonIDselector).addClass(\"is-loading\");\n },\n removeLoadingClass: function removeLoadingClass() {\n $(dometic.dealerLocator2.search.searchButton.constants.searchButtonIDselector).removeClass(\"is-loading\");\n },\n init: function init() {\n this.bindEvents();\n }\n },\n autocomplete: {\n constants: {\n searchTextBoxIDSelector: \"#dealerLocatorSearchComponent-input\"\n },\n googleMapsAutocomplete: null,\n setupGoogleAutoComplete: function setupGoogleAutoComplete() {\n var autocompleteType = $(\"#dealerLocatorSearchComponent-input\").data(\"autocomplete-type\");\n if (typeof autocompleteType !== 'undefined' && autocompleteType != null && autocompleteType.length > 0) {\n this.googleMapsAutocomplete = new google.maps.places.Autocomplete(document.getElementById(\"dealerLocatorSearchComponent-input\"), {\n types: [autocompleteType],\n fields: [\"name\", \"geometry.location\", \"place_id\", \"formatted_address\"]\n });\n } else {\n this.googleMapsAutocomplete = new google.maps.places.Autocomplete(document.getElementById(\"dealerLocatorSearchComponent-input\"), {\n fields: [\"name\", \"geometry.location\", \"place_id\", \"formatted_address\"]\n });\n }\n this.googleMapsAutocomplete.types = [autocompleteType];\n this.setAutocompleteBiasedToCountry();\n },\n setAutocompleteBiasedToCountry: function setAutocompleteBiasedToCountry() {\n var url = \"https://maps.googleapis.com/maps/api/geocode/json?address=\" + $(\"body\").data(\"sc-market\") + \"&key=\" + $(\".dealerLocatorSearchComponent\").data(\"apikey\");\n $.get(url, function (response) {\n if (response.results.length === 0) {\n console.log(response);\n return;\n }\n var lat = response.results[0].geometry.location.lat;\n var lng = response.results[0].geometry.location.lng;\n dometic.dealerLocator2.search.autocomplete.googleMapsAutocomplete.setBounds(new google.maps.LatLngBounds({\n lat: lat,\n lng: lng\n }));\n });\n },\n bindEvents: function bindEvents() {\n this.googleMapsAutocomplete.addListener('place_changed', this.autocompletePlaceChanged);\n },\n autocompletePlaceChanged: function autocompletePlaceChanged() {\n var place = dometic.dealerLocator2.search.autocomplete.googleMapsAutocomplete.getPlace();\n if (!place.geometry) {\n var textboxValue = $(dometic.dealerLocator2.search.autocomplete.constants.searchTextBoxIDSelector).val();\n if (textboxValue.length === 0) return;\n dometic.dealerLocator2.search.autocomplete.getFirstPlaceInAutoComplete(textboxValue, function (results, status) {\n if (status !== google.maps.GeocoderStatus.OK) return;\n place = results[0];\n dometic.dealerLocator2.search.context.location.lat = place.geometry.location.lat();\n dometic.dealerLocator2.search.context.location.lng = place.geometry.location.lng();\n $(dometic.dealerLocator2.search.autocomplete.constants.searchTextBoxIDSelector).val(place.formatted_address);\n dometic.dealerLocator2.search.doSearch();\n });\n } else {\n dometic.dealerLocator2.search.context.location.lat = place.geometry.location.lat();\n dometic.dealerLocator2.search.context.location.lng = place.geometry.location.lng();\n $(dometic.dealerLocator2.search.autocomplete.constants.searchTextBoxIDSelector).val(place.formatted_address);\n }\n },\n getFirstPlaceInAutoComplete: function getFirstPlaceInAutoComplete(textboxValue, callback) {\n var service = new google.maps.places.AutocompleteService();\n service.getPlacePredictions({\n input: textboxValue,\n componentRestrictions: {}\n }, function (results, status) {\n if (status !== google.maps.places.PlacesServiceStatus.OK) return;\n if (results.length === 0) return;\n var firstResultPlaceId = results[0].place_id;\n var geocoder = new google.maps.Geocoder();\n geocoder.geocode({\n 'placeId': firstResultPlaceId\n }, callback);\n });\n },\n reverseGeocodeLatLng: function reverseGeocodeLatLng(location) {\n if (typeof location != \"undefined\" && location != null) {\n var googleMapPos = {\n lat: parseFloat(location.lat),\n lng: parseFloat(location.lng)\n };\n var geocoder = new google.maps.Geocoder();\n geocoder.geocode({\n 'location': googleMapPos\n }, function (results, status) {\n if (status === google.maps.GeocoderStatus.OK && results[1]) {\n var place = results[1];\n $(dometic.dealerLocator2.search.autocomplete.constants.searchTextBoxIDSelector).val(place.formatted_address);\n dometic.dealerLocator2.search.doSearch();\n } else {\n location.lat = \"\";\n location.lng = \"\";\n }\n });\n } else {\n //todo handle location == null\n }\n ;\n },\n init: function init() {\n this.setupGoogleAutoComplete();\n this.bindEvents();\n }\n },\n useMyLocation: {\n bindEvents: function bindEvents() {\n this.bindGetMyPosition();\n },\n getMyPositionOnPageLoad: function getMyPositionOnPageLoad() {\n if (\"geolocation\" in navigator) {\n navigator.geolocation.getCurrentPosition(dometic.dealerLocator2.search.useMyLocation.onGeoLocationSuccess, dometic.dealerLocator2.search.useMyLocation.onGeoLocationError);\n }\n },\n onGeoLocationSuccess: function onGeoLocationSuccess(position) {\n dometic.dealerLocator2.search.useMyLocation.getLatLongFromUserPosition({\n lat: position.coords.latitude,\n lng: position.coords.longitude\n }, dometic.dealerLocator2.search.useMyLocation.onLatLongFromUserPositionSuccess, dometic.dealerLocator2.search.useMyLocation.onLatLongFromUserPositionError);\n },\n onGeoLocationError: function onGeoLocationError() {},\n getLatLongFromUserPosition: function getLatLongFromUserPosition(latLng, callbackSuccess, callbackError) {\n if (latLng !== null) {\n var geocoder = new google.maps.Geocoder();\n geocoder.geocode({\n 'location': latLng\n }, function (results, status) {\n if (status === google.maps.GeocoderStatus.OK) {\n if (results[1]) {\n callbackSuccess(results[1]);\n } else {\n callbackError();\n }\n } else {\n callbackError();\n }\n });\n } else {\n callbackError();\n }\n ;\n },\n onLatLongFromUserPositionSuccess: function onLatLongFromUserPositionSuccess(place) {\n dometic.dealerLocator2.search.context.location.lat = place.geometry.location.lat();\n dometic.dealerLocator2.search.context.location.lng = place.geometry.location.lng();\n $(dometic.dealerLocator2.search.autocomplete.constants.searchTextBoxIDSelector).val(place.formatted_address);\n },\n onLatLongFromUserPositionError: function onLatLongFromUserPositionError() {\n //todo show user that we couldnt find the position\n }\n },\n filters: {\n constants: {\n partnerTypeRadioButtonNameSelector: \"input[type=radio][name=partnerType]\",\n partnerTypeDefaultValueSelector: \"input[type=radio][name=partnerType]:checked\",\n otherFiltersIDSelector: \"#other-filters\",\n otherFiltersCheckboxesSelector: \"#other-filters input\",\n productCategoryFiltersIDSelector: \"#productCategory-filters\",\n productCategoryCheckboxesSelector: \"#productCategory-dropdown option\",\n productCategoryDropdownSelector: \"#productCategory-dropdown\",\n productTypeDropdownSelector: \"#productType-dropdown\",\n productTypeFiltersIDSelector: \"#productType-filters\",\n filterTypesDataAttribute: \"filter-type\",\n otherFiltersIDs: {\n onroad: \"onroad\",\n stationary: \"stationary\"\n },\n filterTypes: {\n productCategory: \"productCategory\",\n productType: \"productType\"\n },\n partnerTypes: {\n dealer: \"dealer\",\n serviceCenter: \"serviceCenter\"\n }\n },\n bindEvents: function bindEvents() {\n $(this.constants.partnerTypeRadioButtonNameSelector).on(\"change\", this.onPartnerTypeChanged);\n $(this.constants.otherFiltersCheckboxesSelector).on(\"change\", this.onFilterCheckboxChanged);\n $(this.constants.productCategoryDropdownSelector).on(\"change\", this.onSingleFilterDropDownChanged);\n $(this.constants.productTypeDropdownSelector).on(\"change\", this.onSingleFilterDropDownChanged);\n },\n setSelectedPartnerType: function setSelectedPartnerType(partnerTypeValue) {\n $(this.constants.partnerTypeRadioButtonNameSelector).val(partnerTypeValue).change();\n },\n onPartnerTypeChanged: function onPartnerTypeChanged() {\n dometic.dealerLocator2.search.redoSearchButton.showRedoSearchButton();\n var value = $(this).val();\n if (value === dometic.dealerLocator2.search.filters.constants.partnerTypes.dealer) {\n $(dometic.dealerLocator2.search.filters.constants.otherFiltersIDSelector).hide();\n dometic.dealerLocator2.search.context.stationary = null;\n dometic.dealerLocator2.search.context.onroad = null;\n dometic.dealerLocator2.search.filters.setSelectedFiltersInDropDown([\"0\"], $(dometic.dealerLocator2.search.filters.constants.productCategoryDropdownSelector));\n $(dometic.dealerLocator2.search.filters.constants.productCategoryDropdownSelector).selectpicker('refresh');\n $(dometic.dealerLocator2.search.filters.constants.productTypeFiltersIDSelector).hide();\n } else if (value === dometic.dealerLocator2.search.filters.constants.partnerTypes.serviceCenter) {\n dometic.dealerLocator2.search.filters.setSelectedFiltersInDropDown([\"0\"], $(dometic.dealerLocator2.search.filters.constants.productCategoryDropdownSelector));\n $(dometic.dealerLocator2.search.filters.constants.productCategoryDropdownSelector).selectpicker('refresh');\n $(dometic.dealerLocator2.search.filters.constants.otherFiltersIDSelector).show();\n }\n\n //Reset the product type array in case it is populated when we switch between partner type\n if (dometic.dealerLocator2.search.context.productType.length > 0) {\n dometic.dealerLocator2.search.context.productType = [];\n }\n //Reset the product category array in case it is populated when we switch between partner type\n if (dometic.dealerLocator2.search.context.productCategories.length > 0) {\n dometic.dealerLocator2.search.context.productCategories = [];\n }\n $(dometic.dealerLocator2.search.filters.constants.productTypeFiltersIDSelector).hide();\n dometic.dealerLocator2.search.context.partnerType = value;\n },\n setSelectedFiltersInDropDown: function setSelectedFiltersInDropDown(filterValues, dropdown) {\n for (var i = 0; i < filterValues.length; i++) {\n var filterValue = filterValues[i];\n dropdown.find(\"option[value='\" + filterValue + \"']\").prop('selected', true);\n }\n },\n onSingleFilterDropDownChanged: function onSingleFilterDropDownChanged(event) {\n var isQuery = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n dometic.dealerLocator2.search.redoSearchButton.showRedoSearchButton();\n var $currentOption = $(this);\n\n //$currentOption[0][1] represents the first selectable option. This is only to get the filter type.\n var filterType = $($currentOption[0][1]).data(dometic.dealerLocator2.search.filters.constants.filterTypesDataAttribute);\n var arrayToAlter = [];\n if (filterType === dometic.dealerLocator2.search.filters.constants.filterTypes.productCategory) {\n if ($currentOption.val() === \"0\") {\n dometic.dealerLocator2.search.context.productCategories = [];\n }\n //reset the product type list if we change the product category TODO: Reset the dropdown?\n if (!isQuery) {\n dometic.dealerLocator2.search.context.productType = [];\n }\n arrayToAlter = dometic.dealerLocator2.search.context.productCategories;\n }\n if (filterType === dometic.dealerLocator2.search.filters.constants.filterTypes.productType) {\n arrayToAlter = dometic.dealerLocator2.search.context.productType;\n }\n if (arrayToAlter.length > 0) {\n if (!isQuery) {\n var restedArray = dometic.dealerLocator2.search.filters.resetFilterForSpecificArray(arrayToAlter);\n dometic.dealerLocator2.search.filters.removeFilter($currentOption, arrayToAlter);\n dometic.dealerLocator2.search.filters.addFilter($currentOption, restedArray);\n } else {\n dometic.dealerLocator2.search.filters.addFilter($currentOption, arrayToAlter);\n }\n } else {\n dometic.dealerLocator2.search.filters.addFilter($currentOption, arrayToAlter);\n }\n if (filterType === dometic.dealerLocator2.search.filters.constants.filterTypes.productCategory) {\n var data = {\n scAction: \"GetProductTypesBySelectedProductCategory\",\n scController: \"DealerLocator2\",\n productCategoryPimId: dometic.dealerLocator2.search.context.productCategories[0],\n contextItem: $(\"body\").data(\"sc-item\"),\n contextLanguage: $(\"body\").data(\"sc-language\")\n };\n $.ajax({\n method: \"GET\",\n url: \"/get-producttypes\",\n data: data\n }).done(function (result) {\n var productTypeDropdown = $(dometic.dealerLocator2.search.filters.constants.productTypeDropdownSelector);\n if (result.length > 0) {\n var nothingSelectedOption = $(dometic.dealerLocator2.search.filters.constants.productTypeFiltersIDSelector + ' .nothing-selected').detach();\n console.log(nothingSelectedOption);\n productTypeDropdown.empty().append(nothingSelectedOption);\n $(dometic.dealerLocator2.search.filters.constants.productTypeFiltersIDSelector).removeClass(\"hidden\");\n $(dometic.dealerLocator2.search.filters.constants.productTypeFiltersIDSelector).show();\n for (var i = 0; i < result.length; i++) {\n productTypeDropdown.append(\"\"));\n }\n if (!isQuery) {\n $(productTypeDropdown).trigger(\"change\");\n } else {\n $(productTypeDropdown).trigger(\"change\", [true]);\n dometic.dealerLocator2.search.filters.setSelectedFiltersInDropDown(dometic.dealerLocator2.search.context.productType, productTypeDropdown);\n }\n $(productTypeDropdown).selectpicker('refresh');\n } else {\n var nothingSelectedOption = $(dometic.dealerLocator2.search.filters.constants.productTypeFiltersIDSelector + ' .nothing-selected').detach();\n productTypeDropdown.empty().append(nothingSelectedOption);\n $(dometic.dealerLocator2.search.filters.constants.productTypeFiltersIDSelector).addClass(\"hidden\");\n $(productTypeDropdown).selectpicker('refresh');\n }\n }).fail(function (jqXHR, textStatus, errorThrown) {\n $(dometic.dealerLocator2.search.filters.constants.productTypeFiltersIDSelector).addClass(\"hidden\");\n $(productTypeDropdown).selectpicker('refresh');\n });\n }\n },\n onFilterCheckboxChanged: function onFilterCheckboxChanged() {\n dometic.dealerLocator2.search.redoSearchButton.showRedoSearchButton();\n var $currentInput = $(this);\n var id = $currentInput.attr('id');\n if (id === dometic.dealerLocator2.search.filters.constants.otherFiltersIDs.onroad) {\n dometic.dealerLocator2.search.context.onroad = $currentInput.is(\":checked\");\n } else if (id === dometic.dealerLocator2.search.filters.constants.otherFiltersIDs.stationary) {\n dometic.dealerLocator2.search.context.stationary = $currentInput.is(\":checked\");\n }\n },\n resetFilterForSpecificArray: function resetFilterForSpecificArray(arrayToReset) {\n if (arrayToReset === dometic.dealerLocator2.search.context.productCategories) {\n return dometic.dealerLocator2.search.context.productCategories = [];\n }\n if (arrayToReset === dometic.dealerLocator2.search.context.productType) {\n return dometic.dealerLocator2.search.context.productType = [];\n }\n },\n addFilter: function addFilter($currentInput, filterArrayToAddTo) {\n var indexInArray = filterArrayToAddTo.indexOf($currentInput.val());\n if (indexInArray > -1) return;\n if ($currentInput.val() === \"0\") return;\n filterArrayToAddTo.push($currentInput.val());\n },\n removeFilter: function removeFilter($currentOption, filterArrayToRemoveFrom) {\n var indexInArray = filterArrayToRemoveFrom.indexOf($currentOption.val());\n if (indexInArray === -1) return;\n filterArrayToRemoveFrom.splice(indexInArray, 1);\n },\n init: function init() {\n this.bindEvents();\n dometic.dealerLocator2.search.context.partnerType = $(this.constants.partnerTypeDefaultValueSelector).val();\n if (dometic.dealerLocator2.search.context.partnerType === dometic.dealerLocator2.search.filters.constants.partnerTypes.dealer) {\n $(dometic.dealerLocator2.search.filters.constants.otherFiltersIDSelector).hide();\n } else if (dometic.dealerLocator2.search.context.partnerType === dometic.dealerLocator2.search.filters.constants.partnerTypes.serviceCenter) {\n $(dometic.dealerLocator2.search.filters.constants.otherFiltersIDSelector).show();\n }\n }\n },\n handleFilterContextInQueryString: function handleFilterContextInQueryString() {\n var splittedquerystring = window.location.search.split(\"?\");\n if (splittedquerystring.length === 1) return;\n var querystring = splittedquerystring[1];\n var params = $.deparam(querystring);\n if (typeof params.partnerType !== \"undefined\") {\n this.filters.setSelectedPartnerType(params.partnerType);\n }\n if (typeof params.productCategories !== \"undefined\") {\n this.filters.setSelectedFiltersInDropDown(params.productCategories, $(this.filters.constants.productCategoryDropdownSelector));\n this.context.productCategories = params.productCategories;\n $(this.filters.constants.productCategoryDropdownSelector).trigger(\"change\", [true]);\n }\n if (typeof params.productType !== \"undefined\") {\n this.filters.setSelectedFiltersInDropDown(params.productType, $(this.filters.constants.productTypeDropdownSelector));\n this.context.productType = params.productType;\n }\n if (typeof params.onroad !== \"undefined\") {\n $(\"#\" + this.filters.constants.otherFiltersIDs.onroad).prop(\"checked\", params.onroad === \"true\");\n this.context.onroad = params.onroad === \"true\";\n }\n if (typeof params.stationary !== \"undefined\") {\n $(\"#\" + this.filters.constants.otherFiltersIDs.stationary).prop(\"checked\", params.stationary === \"true\");\n this.context.stationary = params.stationary === \"true\";\n }\n if (typeof params.distance !== \"undefined\") {\n this.context.distance = params.distance;\n }\n if (typeof params.groups !== \"undefined\") {\n this.context.groups = params.groups;\n }\n if (typeof params.debug !== \"undefined\") {\n this.context.debug = params.debug;\n }\n if (typeof params.maxResults !== \"undefined\") {\n this.context.maxResults = params.maxResults;\n }\n if (typeof params.location !== \"undefined\" && typeof params.location.lat !== \"undefined\" && typeof params.location.lng !== \"undefined\") {\n this.context.location.lat = params.location.lat;\n this.context.location.lng = params.location.lng;\n this.autocomplete.reverseGeocodeLatLng(this.context.location);\n } else if (typeof params.zip !== \"undefined\") {\n var zipCode = params.zip;\n var country = params.country;\n this.handleZipCodeInQueryString(zipCode, country, function (zipLocation) {\n if (zipLocation) {\n dometic.dealerLocator2.search.context.location.lat = location.lat;\n dometic.dealerLocator2.search.context.location.lng = location.lng;\n dometic.dealerLocator2.search.autocomplete.reverseGeocodeLatLng(location);\n }\n });\n }\n },\n handleZipCodeInQueryString: function handleZipCodeInQueryString(zip, country, callback) {\n var addressParameter = zip;\n if (typeof country !== \"undefined\" && country != null) {\n addressParameter = addressParameter + \",\" + country;\n } else {\n addressParameter = addressParameter + \",\" + $(\"body\").data(\"sc-market\");\n }\n var url = \"http://maps.googleapis.com/maps/api/geocode/json?address=\" + addressParameter;\n $.get(url, function (data) {\n if (data.status !== \"OK\") {\n callback(\"ZERO_RESULTS\");\n } else {\n dometic.dealerLocator2.search.context.location.lat = data.results[0].geometry.location.lat;\n dometic.dealerLocator2.search.context.location.lng = data.results[0].geometry.location.lng;\n dometic.dealerLocator2.search.autocomplete.reverseGeocodeLatLng(data.results[0].geometry.location);\n }\n });\n },\n redoSearchButton: {\n constants: {\n redoSearchButtonIDSelector: \"#dealerLocatorMapComponent-btnRedoSearch\"\n },\n bindEvents: function bindEvents() {\n $(this.constants.redoSearchButtonIDSelector).click(this.redoSearchInThisAreaClicked);\n },\n redoSearchInThisAreaClicked: function redoSearchInThisAreaClicked() {\n if (typeof dometic.dealerLocator2.mapView != 'undefined') {\n dometic.dealerLocator2.mapView.getMapInformation();\n dometic.dealerLocator2.mapView.current.zoom = dometic.dealerLocator2.mapView.current.mapInformation.zoom;\n\n //var searchDistance = 5000;\n //var mapViewPortDistance = dometic.dealerLocator2.mapView.getMapViewportDistance();\n //if (mapViewPortDistance != null) {\n // searchDistance = mapViewPortDistance;\n //} \n\n dometic.dealerLocator2.search.context.location.lat = dometic.dealerLocator2.mapView.current.mapInformation.lat;\n dometic.dealerLocator2.search.context.location.lng = dometic.dealerLocator2.mapView.current.mapInformation.lng;\n dometic.dealerLocator2.search.context.distance = dometic.dealerLocator2.search.constants.startDistance;\n dometic.dealerLocator2.search.context.maxResults = dometic.dealerLocator2.search.constants.startMaxResults;\n dometic.dealerLocator2.search.autocomplete.reverseGeocodeLatLng(dometic.dealerLocator2.search.context.location);\n }\n },\n showRedoSearchButton: function showRedoSearchButton() {\n $(this.constants.redoSearchButtonIDSelector).removeClass(\"hidden\");\n },\n hideRedoSearchButton: function hideRedoSearchButton() {\n $(this.constants.redoSearchButtonIDSelector).addClass(\"hidden\");\n },\n addLoadingClass: function addLoadingClass() {\n $(dometic.dealerLocator2.search.redoSearchButton.constants.redoSearchButtonIDSelector).addClass(\"is-loading\");\n },\n removeLoadingClass: function removeLoadingClass() {\n $(dometic.dealerLocator2.search.redoSearchButton.constants.redoSearchButtonIDSelector).removeClass(\"is-loading\");\n }\n },\n doSearch: function doSearch(withScrollAnimation) {\n dometic.dealerLocator2.search.searchButton.addLoadingClass();\n dometic.dealerLocator2.search.redoSearchButton.addLoadingClass();\n var location = this.context.location;\n var querystring = this.createSearchQueryString(this.context);\n var queryStringWithDealerContext = this.addDealerContextToQuerystring(querystring);\n $.ajax({\n url: \"/get-dealerlocator2-search?\" + queryStringWithDealerContext,\n dataType: \"json\",\n success: function success(result) {\n dometic.dealerLocator2.search.searchButton.removeLoadingClass();\n dometic.dealerLocator2.search.redoSearchButton.removeLoadingClass();\n var url = window.location.href.split(\"?\")[0];\n history.pushState({}, document.title, url + \"?\" + decodeURIComponent(querystring));\n var resultsNeededForMapDisplay = 3;\n if (dometic.dealerLocator2.search.context.distance >= 5000) resultsNeededForMapDisplay = 0;\n if (result.Partners.length > resultsNeededForMapDisplay) {\n $(\".dealerLocatorHeroComponent-header\").slideUp(200, function () {\n var doScroll = typeof withScrollAnimation !== 'undefined' ? withScrollAnimation : true;\n if (doScroll) {\n //scroll to result div\n $('html, body').animate({\n scrollTop: $(\"#scrollToThisWhenSearchIsFinished\").offset().top - $(\"header.Header\").height()\n }, 500);\n }\n });\n $(\"#dealerLocatorNoResults\").slideUp(200, function () {\n $(\"#dealerLocatorMapComponent\").slideDown(500, function () {\n dometic.dealerLocator2.listView.populateData(result);\n if (typeof dometic.dealerLocator2.mapView != 'undefined') {\n dometic.dealerLocator2.mapView.populateData(result.Partners, location);\n if (dometic.dealerLocator2.search.context.debug) {\n dometic.dealerLocator2.mapView.circle(dometic.dealerLocator2.search.context);\n dometic.dealerLocator2.mapView.rectangle(dometic.dealerLocator2.search.context);\n }\n }\n });\n });\n } else {\n dometic.dealerLocator2.search.doExpandedSearch();\n }\n },\n error: function error(data) {\n console.log(data);\n }\n });\n },\n doExpandedSearch: function doExpandedSearch() {\n if (this.context.distance < 60) {\n this.context.distance = 60;\n dometic.dealerLocator2.search.doSearch();\n } else if (this.context.distance < 120) {\n this.context.distance = 120;\n dometic.dealerLocator2.search.doSearch();\n } else if (this.context.distance < 250) {\n this.context.distance = 250;\n dometic.dealerLocator2.search.doSearch();\n } else if (this.context.distance < 500) {\n this.context.distance = 500;\n dometic.dealerLocator2.search.doSearch();\n } else if (this.context.distance < 1000) {\n this.context.distance = 1000;\n dometic.dealerLocator2.search.doSearch();\n } else if (this.context.distance < 2500) {\n this.context.distance = 2500;\n dometic.dealerLocator2.search.doSearch();\n } else if (this.context.distance < 5000) {\n this.context.distance = 5000;\n dometic.dealerLocator2.search.doSearch();\n } else {\n $(\"#dealerLocatorMapComponent\").slideUp(200, function () {\n $(\"#dealerLocatorNoResults\").slideDown(500);\n });\n }\n },\n createSearchQueryString: function createSearchQueryString(searchContext) {\n if (typeof searchContext.groups !== 'undefined') {\n if (searchContext.groups.length <= 0 || searchContext.groups == null || searchContext.groups[0] === \"\") {\n delete searchContext.groups;\n }\n }\n var result = $.param(searchContext);\n return result;\n },\n addDealerContextToQuerystring: function addDealerContextToQuerystring(querystring) {\n var dealerLocatorRenderingDatasource = $(\".dealerLocatorHeroComponent\").data(\"dealer-item\");\n var sitecoreContextItem = $(\"body\").data(\"sc-item\");\n var sitecoreContextLanguage = $(\"body\").data(\"sc-language\");\n return querystring + \"&sitecoreItemId=\" + sitecoreContextItem + \"&sitecoreLanguageId=\" + sitecoreContextLanguage + \"&dealerItemId=\" + dealerLocatorRenderingDatasource;\n },\n handleInitialMapSettings: function handleInitialMapSettings() {\n var initialLat = $(\"#dealerLocatorMapComponent\").data(\"initial-lat\");\n var initialLng = $(\"#dealerLocatorMapComponent\").data(\"initial-lng\");\n if (typeof initialLat !== 'undefined' && typeof initialLng != 'undefined') {\n this.context.location.lat = initialLat;\n this.context.location.lng = initialLng;\n this.context.distance = 10000;\n dometic.dealerLocator2.search.doSearch(false);\n }\n }\n};\n(function ($) {\n dometic.dealerLocator2.search.init();\n})(jQuery);"]}