Commit d1b4b96b by Adarsh K

new changes

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