Add complete info for merchant pin at "show on map"
This commit is contained in:
parent
30322961de
commit
23e47a73ab
1 changed files with 28 additions and 29 deletions
|
@ -348,12 +348,7 @@ class MerchantsPage extends Component {
|
||||||
color: 'white',
|
color: 'white',
|
||||||
whiteSpace: 'nowrap'
|
whiteSpace: 'nowrap'
|
||||||
}}
|
}}
|
||||||
onClick={() => this.openMaps(
|
onClick={() => this.openMaps(merchant.name, app.getMerchantMarker(merchant))}
|
||||||
merchant.name,
|
|
||||||
infoDescription,
|
|
||||||
merchant.lat,
|
|
||||||
merchant.lon
|
|
||||||
)}
|
|
||||||
>Show on Map
|
>Show on Map
|
||||||
</Button>;
|
</Button>;
|
||||||
return merchant;
|
return merchant;
|
||||||
|
@ -378,25 +373,17 @@ class MerchantsPage extends Component {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
openMaps(name, address, lat, lon){
|
openMaps(name, marker){
|
||||||
this.setState({
|
this.setState({
|
||||||
mapsTitle: name,
|
mapsTitle: name,
|
||||||
mapsDescription: address,
|
mapsDescription: marker.infoDescription,
|
||||||
mapsLat: lat,
|
mapsLat: marker.lat,
|
||||||
mapsLon: lon,
|
mapsLon: marker.lng,
|
||||||
mapsModalIsOpen: true
|
mapsModalIsOpen: true
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
handleSearchChange(data){
|
getMerchantMarker = (merchant) => {
|
||||||
this.setState({ merchantsSearch: data });
|
|
||||||
}
|
|
||||||
|
|
||||||
render() {
|
|
||||||
let { data: merchantsData } = this.state.merchants;
|
|
||||||
const { ambassadorsMarkers, merchantsSearch } = this.state;
|
|
||||||
|
|
||||||
const merchantMarkers = merchantsSearch.map(merchant => {
|
|
||||||
const infoDescription = <div>
|
const infoDescription = <div>
|
||||||
<div><b>Address</b>: {merchant.address}</div>
|
<div><b>Address</b>: {merchant.address}</div>
|
||||||
{(merchant.phone) && (<div><b>Phone</b>: {merchant.phone}</div>)}
|
{(merchant.phone) && (<div><b>Phone</b>: {merchant.phone}</div>)}
|
||||||
|
@ -418,6 +405,18 @@ class MerchantsPage extends Component {
|
||||||
infoDescription: infoDescription,
|
infoDescription: infoDescription,
|
||||||
};
|
};
|
||||||
return marker;
|
return marker;
|
||||||
|
};
|
||||||
|
|
||||||
|
handleSearchChange(data){
|
||||||
|
this.setState({ merchantsSearch: data });
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
let { data: merchantsData } = this.state.merchants;
|
||||||
|
const { ambassadorsMarkers, merchantsSearch } = this.state;
|
||||||
|
|
||||||
|
const merchantMarkers = merchantsSearch.map(merchant => {
|
||||||
|
return this.getMerchantMarker(merchant);
|
||||||
});
|
});
|
||||||
|
|
||||||
merchantsData = merchantsData.sort(sortBy('location.searchText'));
|
merchantsData = merchantsData.sort(sortBy('location.searchText'));
|
||||||
|
|
Loading…
Reference in a new issue