diff --git a/shop/mobile-ionic/src/app/pages/pages.module.ts b/shop/mobile-ionic/src/app/pages/pages.module.ts index 44ed916d4..1e0112f9a 100644 --- a/shop/mobile-ionic/src/app/pages/pages.module.ts +++ b/shop/mobile-ionic/src/app/pages/pages.module.ts @@ -33,7 +33,7 @@ const routes: Routes = [ canLoad: [OrdersHistoryModuleGuard] }, { - path: ' ', + path: 'invite', loadChildren: './+invite/invite.module#InvitePageModule', canLoad: [InviteModuleGuard] }, diff --git a/shop/mobile-ionic/src/app/pages/user-locations/user-locations.module.ts b/shop/mobile-ionic/src/app/pages/user-locations/user-locations.module.ts index b5fd0d42c..6edd8d046 100644 --- a/shop/mobile-ionic/src/app/pages/user-locations/user-locations.module.ts +++ b/shop/mobile-ionic/src/app/pages/user-locations/user-locations.module.ts @@ -2,25 +2,25 @@ import { NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; import { FormsModule } from '@angular/forms'; import { Routes, RouterModule } from '@angular/router'; - import { IonicModule } from '@ionic/angular'; - import { UserLocationsPage } from './user-locations.page'; +import { Geolocation } from '@ionic-native/geolocation/ngx'; const routes: Routes = [ - { - path: '', - component: UserLocationsPage - } + { + path: '', + component: UserLocationsPage + } ]; @NgModule({ - imports: [ - CommonModule, - FormsModule, - IonicModule, - RouterModule.forChild(routes) - ], - declarations: [UserLocationsPage] + imports: [ + CommonModule, + FormsModule, + IonicModule, + RouterModule.forChild(routes) + ], + declarations: [UserLocationsPage], + providers: [Geolocation] }) -export class UserLocationsPageModule {} +export class UserLocationsPageModule { } diff --git a/shop/mobile-ionic/src/app/pages/user-locations/user-locations.page.css b/shop/mobile-ionic/src/app/pages/user-locations/user-locations.page.css index 77d36517b..defad0a18 100644 --- a/shop/mobile-ionic/src/app/pages/user-locations/user-locations.page.css +++ b/shop/mobile-ionic/src/app/pages/user-locations/user-locations.page.css @@ -5,3 +5,7 @@ ion-item-group#address-info { ion-button#save { margin-bottom: 10px; } + +.map { + height: 60%; +} diff --git a/shop/mobile-ionic/src/app/pages/user-locations/user-locations.page.html b/shop/mobile-ionic/src/app/pages/user-locations/user-locations.page.html index 99f3d871c..df1530364 100644 --- a/shop/mobile-ionic/src/app/pages/user-locations/user-locations.page.html +++ b/shop/mobile-ionic/src/app/pages/user-locations/user-locations.page.html @@ -8,31 +8,17 @@ +
- Add new address + - - - - - - - - - - - - - - - - + diff --git a/shop/mobile-ionic/src/app/pages/user-locations/user-locations.page.ts b/shop/mobile-ionic/src/app/pages/user-locations/user-locations.page.ts index b9fea7e61..5131884cc 100644 --- a/shop/mobile-ionic/src/app/pages/user-locations/user-locations.page.ts +++ b/shop/mobile-ionic/src/app/pages/user-locations/user-locations.page.ts @@ -1,15 +1,40 @@ -import { Component, OnInit } from '@angular/core'; +import { Component, OnInit, ViewChild, ElementRef, AfterViewInit } from '@angular/core'; +import { Geolocation } from '@ionic-native/geolocation/ngx'; +import { Geoposition } from '@ionic-native/geolocation'; +declare var google: any; @Component({ - selector: 'e-cu-user-locations', - templateUrl: './user-locations.page.html', - styleUrls: ['./user-locations.page.css'], + selector: 'e-cu-user-locations', + templateUrl: './user-locations.page.html', + styleUrls: ['./user-locations.page.css'], }) -export class UserLocationsPage implements OnInit { +export class UserLocationsPage implements OnInit, AfterViewInit { + @ViewChild('container', { static: true }) container: ElementRef; + public latitude: number; + public longitude: number; + public map: google.maps.Map; - constructor() { } + constructor(private geolocation: Geolocation) { } - ngOnInit() { - } + ngOnInit() { + this.geolocation.getCurrentPosition().then((_res: Geoposition) => { + this.latitude = _res.coords.latitude; + this.longitude = _res.coords.longitude; + this.loadMap(); + }); + } + + loadMap() { + this.map = new google.maps.Map(this.container.nativeElement, this.configureMapSettings()); + } + + configureMapSettings() { + return { + zoom: 17, + center: { lat: this.latitude, lng: this.longitude }, + mapTypeControl: false, + streetViewControl: false + }; + } }