diff --git a/src/js/configurations/geography_sa.js b/src/js/configurations/geography_sa.js index 429afe34..f5240d4d 100644 --- a/src/js/configurations/geography_sa.js +++ b/src/js/configurations/geography_sa.js @@ -67,6 +67,12 @@ export class Config { return false; } + get pointSearchEnabled(){ + if(this.config["point_search_enabled"] != undefined) + return this.config["point_search_enabled"]; + return true; + } + get siteWideFiltersEnabled() { if (this.config["site_wide_filters_enabled"] != undefined) return this.config["site_wide_filters_enabled"]; diff --git a/src/js/elements/header/search.js b/src/js/elements/header/search.js index 3a0c6a40..4bcd187b 100644 --- a/src/js/elements/header/search.js +++ b/src/js/elements/header/search.js @@ -32,13 +32,14 @@ export class Search extends Component { * constructor of the class * sets the default values, calls init function(this.setSearchInput) * */ - constructor(parent, api, profileId, minChars) { + constructor(parent, api, profileId, minChars, config) { super(parent); minLength = minChars; this.api = api; this.profileId = profileId; this.plate = null; + this.config = config; this.prepareDomElements(); this.setSearchInput(); @@ -60,9 +61,11 @@ export class Search extends Component { this.updateGeoSearchHeader(titleRow); this.updateGeoSearch(); - this.appendSearchSeparator(); - this.appendPointsTitle(titleRow); - this.appendPointsNoData(); + if (this.config.pointSearchEnabled) { + this.appendSearchSeparator(); + this.appendPointsTitle(titleRow); + this.appendPointsNoData(); + } } updateGeoSearchHeader(titleRow) { @@ -282,13 +285,15 @@ export class Search extends Component { response(data); }) - const mapCenter = self.getMapCenter(); - self.api.searchPointsByDistance(self.profileId, searchTerm, mapCenter.lat, mapCenter.lng).then(data => { - self.removePointsNoData(); - self.appendPointsHeaderRow(); - self.appendPointsTable(searchTerm, data); - self.updatePointsHeaderSummary(data); - }) + if (self.config.pointSearchEnabled) { + const mapCenter = self.getMapCenter(); + self.api.searchPointsByDistance(self.profileId, searchTerm, mapCenter.lat, mapCenter.lng).then(data => { + self.removePointsNoData(); + self.appendPointsHeaderRow(); + self.appendPointsTable(searchTerm, data); + self.updatePointsHeaderSummary(data); + }) + } }, 0) } }) diff --git a/src/js/load.js b/src/js/load.js index ae69b52f..f39cc8b2 100644 --- a/src/js/load.js +++ b/src/js/load.js @@ -77,7 +77,7 @@ class Application extends Component { const pointData = new PointData(this, api, mapcontrol.map, profileId, config); const pointDataTray = new PointDataTray(this, api, profileId, config.watermarkEnabled, config.ccLicenseEnabled); const mapchip = new MapChip(this, config.choropleth, config.siteWideFiltersEnabled, config.restrictValues, config.defaultFilters); - const search = new Search(this, api, profileId, 2); + const search = new Search(this, api, profileId, 2, config); const profileLoader = new ProfileLoader(this, formattingConfig, api, profileId, config.config, config.watermarkEnabled, config.siteWideFiltersEnabled, config.restrictValues, config.defaultFilters, config.chartColorRange); const locationInfoBox = new LocationInfoBox(this, formattingConfig); const zoomToggle = new ZoomToggle(this);