Commit 2cbe65ee by Adarsh K

Merge branch 'adarsh' into 'master'

Adarsh See merge request !106
parents 5b3e5c67 d1b4b96b
......@@ -19,7 +19,7 @@ export class AddaddresssPage implements OnInit {
geoLongitude: number;
geoAccuracy: number;
geoAddress: string;
address: Address = {
address: Address = {
addressType: '',
area: '',
city: '',
......@@ -49,7 +49,7 @@ export class AddaddresssPage implements OnInit {
) { }
ngOnInit() {
}
goToPage(path, data = null) {
......@@ -71,21 +71,21 @@ export class AddaddresssPage implements OnInit {
this.geoAccuracy = pos.coords.accuracy;
this.getGeoencoder(this.geoLatitude, this.geoLongitude);
}).catch(err => {
alert('Error getting location' + JSON.stringify(err));
console.log('Error getting location' + JSON.stringify(err));
});
}
getGeoencoder(latitude, longitude) {
console.log('reached');
this.nativeGeocoder.reverseGeocode(latitude, longitude, this.geoencoderOptions)
.then((result: NativeGeocoderResult[]) => {
console.log(result);
this.geoAddress = this.generateAddress(result[0]);
console.log(this.geoAddress);
})
.catch((error: any) => {
alert('Error getting location' + JSON.stringify(error));
});
.then((result: NativeGeocoderResult[]) => {
console.log(result);
this.geoAddress = this.generateAddress(result[0]);
console.log(this.geoAddress);
})
.catch((error: any) => {
console.log('Error getting location' + JSON.stringify(error));
});
}
generateAddress(addressObj) {
......@@ -98,21 +98,21 @@ export class AddaddresssPage implements OnInit {
obj.reverse();
for (const val in obj) {
if (obj[val].length) {
address += obj[val] + ', ';
address += obj[val] + ', ';
}
}
return address.slice(0, -2);
}
}
onAddrss(form: NgForm) {
this.submitted = true;
console.log(form.value);
if (form.valid) {
onAddrss(form: NgForm) {
this.submitted = true;
console.log(form.value);
this.register.createAddress(form.value);
} else {
console.log(form.errors);
if (form.valid) {
console.log(form.value);
this.register.createAddress(form.value);
} else {
console.log(form.errors);
}
}
}
}
......@@ -28,7 +28,8 @@
<div class="sub_menu">
<ul *ngIf="categoryService.activecategories">
<ion-menu-toggle>
<li *ngFor="let category of categoryService.activecategories" (click)="goToPage('catstorelist', category)">
<li *ngFor="let category of categoryService.activecategories"
(click)="goToPage('catstorelist', category)">
{{ category.catName }}
</li>
</ion-menu-toggle>
......@@ -87,8 +88,8 @@
<img src="../assets/basket.png" alt="Product">
</div>
<div class="content">
<h1>Order Placed Successfully</h1>
<p *ngIf="orderId">Order ID {{orderId}} , New Order has been successfully Placed. </p>
<h1>{{service.popupSub}}</h1>
<p *ngIf="orderId">Order ID {{orderId}}, {{service.popupMsg}}</p>
</div>
<span (click)="istoggle();"><img src="../assets/close.png" alt="Close"></span>
......
......@@ -210,6 +210,8 @@ export class CartPage implements OnInit {
custAddress: this.addressService.custAddress,
paymentMethod: this.paymentMethod
};
this.service.popupMsg = 'New Order has been successfully Placed!';
this.service.popupSub = 'Order Placed Successfully';
const state = this.orderService
.checkOut(
this.cartService.carts,
......
......@@ -211,6 +211,8 @@ export class ChangeaddressPage implements OnInit {
status: true
};
console.log(postData, orderId);
this.service.popupMsg = 'Order address has been changed successfully!';
this.service.popupSub = 'Order Address changed';
This.addressService.changeAddress(postData, orderId);
val.deliveryAddress = postData;
This.service.set('order', val);
......
......@@ -92,12 +92,12 @@ export class NearbyPage implements OnInit {
console.log(navigator);
/* this.latitude = -33.87276;
this.longitude = 151.20534; */
this.zoom = 24;
this.zoom = 16;
this.getAddress(this.latitude, this.longitude);
navigator.geolocation.getCurrentPosition(position => {
this.latitude = position.coords.latitude;
this.longitude = position.coords.longitude;
this.zoom = 24;
this.zoom = 16;
this.getAddress(this.latitude, this.longitude);
});
}
......@@ -119,7 +119,7 @@ export class NearbyPage implements OnInit {
console.log(status);
if (status === 'OK') {
if (results[0]) {
this.zoom = 24;
this.zoom = 16;
this.address = results[0].formatted_address;
console.log(this.address);
} else {
......@@ -158,8 +158,8 @@ export class NearbyPage implements OnInit {
this.loader = true;
console.log(data);
const postData: Address = {
address: this.address,
addressType: '',
address: '',
addressType: data.addressType,
building: this.searchElementRef.nativeElement.value,
landmark: data.landmark !== undefined ? data.landmark : '',
defaultVal: 0,
......
......@@ -9,10 +9,14 @@ import * as firebase from 'firebase';
export class ServiceService {
state: boolean;
distance: any;
popupMsg: any;
popupSub: any;
constructor(
public storage: Storage,
public toastController: ToastController
) {
this.popupMsg = '';
this.popupSub = '';
this.state = true;
this.distance = 10;
this.storage.ready().then(() => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment