mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-20 16:42:56 +00:00
@@ -14,6 +14,7 @@
|
||||
*/
|
||||
import {ElementRef, Injectable} from '@angular/core';
|
||||
import {
|
||||
SCBuilding,
|
||||
SCSearchFilter,
|
||||
SCSearchQuery,
|
||||
SCSearchResponse,
|
||||
@@ -24,6 +25,7 @@ import {Point, Polygon} from 'geojson';
|
||||
import {divIcon, geoJSON, icon, LatLng, Map, marker, Marker} from 'leaflet';
|
||||
import {DataProvider} from '../data/data.provider';
|
||||
import {MapPosition, PositionService} from './position.service';
|
||||
import {hasValidLocation} from '../data/types/place/place-types';
|
||||
|
||||
/**
|
||||
* Provides methods for presenting the map
|
||||
@@ -125,7 +127,8 @@ export class MapProvider {
|
||||
}
|
||||
|
||||
/**
|
||||
* Provide places (buildings and canteens)
|
||||
* Provide places (buildings and canteens) const result = await this.dataProvider.search(query);
|
||||
|
||||
*
|
||||
* @param contextFilter Additional contextual filter (e.g. from the context menu)
|
||||
* @param queryText Query (text) of the search query
|
||||
@@ -224,6 +227,12 @@ export class MapProvider {
|
||||
];
|
||||
}
|
||||
|
||||
return this.dataProvider.search(query);
|
||||
const result = await this.dataProvider.search(query);
|
||||
|
||||
result.data = result.data.filter(place =>
|
||||
hasValidLocation(place as SCBuilding),
|
||||
);
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -448,12 +448,15 @@ export class MapPageComponent {
|
||||
* Show a single place
|
||||
*/
|
||||
async showItemModal(item: SCPlace) {
|
||||
const placeWithoutGeo = {...item, geo: undefined};
|
||||
const placeWithNullLocation = {
|
||||
...item,
|
||||
geo: {point: {coordinates: [0, 0]}},
|
||||
};
|
||||
this.modal = await this.modalController.create({
|
||||
component: MapSingleModalComponent,
|
||||
swipeToClose: true,
|
||||
componentProps: {
|
||||
item: placeWithoutGeo,
|
||||
item: placeWithNullLocation,
|
||||
dismissAction: () => {
|
||||
this.modal.dismiss();
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user