Commit b8ed8334 by Arjun

Merge branch 'master' into arjunlatest

parents 31d49272 ccfca2f5
......@@ -94,7 +94,8 @@ export class AppComponent {
});
}
ionViewDidEnter() {}
ionViewWillEnter() {
}
initializeApp() {
this.platform.ready().then(() => {
......@@ -241,6 +242,9 @@ export class AppComponent {
} else {
this.orderId = data.orderCode;
this.isShow = true;
setTimeout(() => {
this.isShow = false;
}, 3000);
}
}
});
......
......@@ -106,7 +106,7 @@
<hr />
<h5>
<span class="floatLeft">DELIVERY</span>
<span class="floatRight" (click)="istoggle()">EDIT</span>
<span class="floatRight" (click)="istoggle()">CHANGE</span>
<div class="clear"></div>
</h5>
<ion-grid class="p0" *ngIf="addressService.custAddress">
......@@ -182,8 +182,9 @@
APPLY
</button>
</div>
<span *ngIf="discountApplied" class="promo-success">Promocode applied successfully
<span *ngIf="discountApplied == 1" class="promo-success">Promocode applied successfully
</span>
<span *ngIf="discountApplied == 2" class="promo-error">Invalid Promocode</span>
</div>
<br />
......
......@@ -242,9 +242,16 @@
}
}
.promo-success {
color: #00f;
font-size: 16px;
text-align: center;
display: block;
margin-top: 5px;
}
.promo-error {
color: #31b131;
font-size: 16px;
text-align: left;
text-align: center;
display: block;
margin-top: 5px;
}
......
......@@ -46,12 +46,14 @@ export class CartPage implements OnInit {
};
deliveryCharge: number;
taxAmount: number;
discountApplied: boolean;
discountApplied: number;
discount: number;
totalAmt: number;
bookDate: any;
timeinterval: any;
paymentMethod: any;
lat: number;
lng: number;
constructor(
private router: Router,
......@@ -71,7 +73,7 @@ export class CartPage implements OnInit {
this.gateway = 1;
this.deliveryCharge = 0;
this.taxAmount = 0;
this.discountApplied = false;
this.discountApplied = 0;
this.discount = 0;
this.paymentMethod = 'PayPal';
// this.cartService.cartList();
......@@ -89,6 +91,7 @@ export class CartPage implements OnInit {
setTimeout(() => {
this.loader = false;
}, 1000);
this.setCurrentLocation();
}
ngOnInit() {
......@@ -99,6 +102,16 @@ export class CartPage implements OnInit {
}, 1000); */
}
private setCurrentLocation() {
const This = this;
if ('geolocation' in navigator) {
navigator.geolocation.getCurrentPosition(position => {
this.lat = position.coords.latitude;
this.lng = position.coords.longitude;
});
}
}
ionViewWillEnter() {
const users = this.service.get('user').then(data => {
if (data) {
......@@ -155,6 +168,9 @@ export class CartPage implements OnInit {
}
goToPage(path, data = null) {
if (path === 'nearby') {
this.addressService.addressState = 1;
}
this.router.navigateByUrl(path, { queryParams: data, replaceUrl: true });
document.body.scrollTop = document.documentElement.scrollTop = 0;
}
......@@ -188,7 +204,7 @@ export class CartPage implements OnInit {
deliveryCharge: this.deliveryCharge,
taxAmount: this.taxAmount,
discount: this.discount,
discountApplied: this.discountApplied,
discountApplied: this.discountApplied === 1 ? true : false,
totalAmt: this.totalAmt,
custAddress: this.addressService.custAddress,
paymentMethod: this.paymentMethod
......@@ -211,7 +227,7 @@ export class CartPage implements OnInit {
this.slides.slideNext();
});
} else {
alert('Please choose delivery location');
this.istoggle();
}
} else {
this.slides.slideNext();
......@@ -292,7 +308,7 @@ export class CartPage implements OnInit {
this.cartService.checkPromo(code).subscribe(value => {
if (value.length > 0) {
const promo = value[0];
this.discountApplied = true;
this.discountApplied = 1;
if (value[0].type === 1) {
const rate = value[0].amount;
const upto = value[0].amount;
......@@ -304,6 +320,8 @@ export class CartPage implements OnInit {
this.discount = value[0].amount;
}
this.discount.toFixed(2);
} else {
this.discountApplied = 2;
}
});
}
......
......@@ -123,8 +123,9 @@ export class MyorderPage implements OnInit {
getProductTotal(products) {
let amtPrice = 0;
products.forEach(element => {
amtPrice += element.price * element.qty;
amtPrice += (element.price * element.qty);
});
return 'A$' + this.service.formatNumber(amtPrice);
const totalAmt: number = parseFloat(amtPrice.toFixed(2));
return 'A$' + (this.service.formatNumber(totalAmt));
}
}
......@@ -19,8 +19,10 @@
</ion-header>
<ion-content>
<div class="nearby_map">
<agm-map [latitude]="latitude" [longitude]="longitude" [zoom]="8" [backgroundColor]="'rgba(29, 27, 130,0.2)'">
<agm-marker [latitude]="latitude" [longitude]="longitude" [markerDraggable]="true" (dragEnd)="markerDragEnd($event)" [iconUrl]="
<agm-map [latitude]="latitude" [longitude]="longitude" [zoom]="8" [backgroundColor]="'rgba(29, 27, 130,0.2)'"
(mapReady)="mapReady($event)" (centerChange)="centerChange($event)">
<agm-marker [latitude]="latitude" [longitude]="longitude" [markerDraggable]="true"
(dragEnd)="markerDragEnd($event)" [iconUrl]="
{
url: './assets/pin.svg',
scaledSize: {
......@@ -28,15 +30,18 @@
height: 40
}}"></agm-marker>
</agm-map>
<form (ngSubmit)="onSubmit(addressForm.value); addressForm.reset()" #addressForm="ngForm" method="post" class="form-horizontal">
<form (ngSubmit)="onSubmit(addressForm.value); addressForm.reset()" #addressForm="ngForm" method="post"
class="form-horizontal">
<div class="add_address_wrapper">
<h5>DELIVERY</h5>
<p>{{address}}</p>
<input [(ngModel)]="addressForm.building" name="building" #building="ngModel" name="building" required placeholder="House No./ Building No" />
<input [(ngModel)]="addressForm.building" name="building" #building="ngModel" name="building" required
placeholder="House No./ Building No" />
<div class="md-errors-spacer" [hidden]="building.valid || landmark.pristine" class="ion-padding-start">
Building Name is required
</div>
<input [(ngModel)]="addressForm.landmark" name="landmark" #landmark="ngModel" name="landmark" required placeholder="Landmark" />
<input [(ngModel)]="addressForm.landmark" name="landmark" #landmark="ngModel" name="landmark" required
placeholder="Landmark" />
<div class="md-errors-spacer" [hidden]="landmark.valid || landmark.pristine" class="ion-padding-start">
Landmark is required
</div>
......@@ -44,24 +49,31 @@
<ion-row>
<ion-col>
<h6>
<input class="styled-checkbox" id="styled-check-1" type="radio" value="Home" [(ngModel)]="addressForm.addressType" name="addressType" #addressType="ngModel" required />
<input class="styled-checkbox" id="styled-check-1" type="radio" value="Home"
[(ngModel)]="addressForm.addressType" name="addressType" #addressType="ngModel"
required />
<label for="styled-check-1"><span>Home</span></label>
</h6>
</ion-col>
<ion-col>
<h6>
<input class="styled-checkbox" id="styled-check-2" type="radio" value="Work" [(ngModel)]="addressForm.addressType" name="addressType" #addressType="ngModel" required />
<input class="styled-checkbox" id="styled-check-2" type="radio" value="Work"
[(ngModel)]="addressForm.addressType" name="addressType" #addressType="ngModel"
required />
<label for="styled-check-2"><span>Office</span></label>
</h6>
</ion-col>
<ion-col>
<h6>
<input class="styled-checkbox" id="styled-check-3" type="radio" value="Other" [(ngModel)]="addressForm.addressType" name="addressType" #addressType="ngModel" required />
<input class="styled-checkbox" id="styled-check-3" type="radio" value="Other"
[(ngModel)]="addressForm.addressType" name="addressType" #addressType="ngModel"
required />
<label for="styled-check-3"><span>Others</span></label>
</h6>
</ion-col>
</ion-row>
<div class="md-errors-spacer" [hidden]="addressType.valid || addressType.pristine" class="ion-padding-start">
<div class="md-errors-spacer" [hidden]="addressType.valid || addressType.pristine"
class="ion-padding-start">
Address Type is required
</div>
</ion-grid>
......
......@@ -35,6 +35,9 @@ export class NearbyPage implements OnInit {
loader: boolean;
public searchElementRef: ElementRef;
newCenterLat: number;
newCenterLng: number;
constructor(
private router: Router,
private route: ActivatedRoute,
......@@ -114,6 +117,17 @@ export class NearbyPage implements OnInit {
);
}
mapReady(map) {
map.addListener('dragend', () => {
console.log(this.newCenterLat, this.newCenterLng);
});
}
centerChange(e) {
console.log(e);
this.newCenterLat = e.lat;
this.newCenterLng = e.lng;
}
goToPage(path, data = null) {
this.router.navigateByUrl(path, { queryParams: data });
document.body.scrollTop = document.documentElement.scrollTop = 0;
......@@ -145,7 +159,12 @@ export class NearbyPage implements OnInit {
if (this.authService.regState === false) {
this.router.navigateByUrl('preference', { queryParams: null });
} else {
this.goBack();
if (this.addressService.addressState === 1) {
this.addressService.addressState = 0;
this.router.navigateByUrl('cart', { replaceUrl: true });
} else {
this.goBack();
}
}
}, 3000);
}
......
......@@ -153,7 +153,7 @@ export class ProductdetailPage implements OnInit {
this.cartService.buyNow(product).then((data) => {
if (data === true) {
if (type === 1) {
this.router.navigateByUrl('cart', { replaceUrl: true });
this.router.navigateByUrl('cart');
} else {
this.service.showToast('Added into cart', 'top', 'my-toast', 2000);
}
......
......@@ -81,6 +81,7 @@ export class WishlistPage implements OnInit {
.then(datas => {
this.loader = false;
this.service.showToast('Added to cart', 'top', 'my-toast', 2000);
this.router.navigateByUrl('cart', { replaceUrl: true, queryParams: data });
})
.catch(err => {
this.loader = false;
......
......@@ -17,7 +17,10 @@ export class AddressService {
defaultAdd: AddressList;
custAddress: AddressList;
centerLoc: CenterData;
constructor(public afs: AngularFirestore) { }
addressState: number;
constructor(public afs: AngularFirestore) {
this.addressState = 0;
}
public async addList(userId: string) {
const This = this;
......@@ -220,13 +223,13 @@ export class AddressService {
setAddress() {
console.log(this.nearestList);
if (this.nearestList.length > 0) {
let address = this.nearestList.find(
this.custAddress = this.nearestList.find(
x => x.defaultVal === 1
);
if (!address) {
/* if (!address) {
address = this.nearestList[0];
}
this.custAddress = address;
this.custAddress = address; */
}
}
}
......@@ -261,6 +261,10 @@ export class AuthService {
this.afAuth.auth
.createUserWithEmailAndPassword(userData.emailId, userData.password)
.then(result => {
result.user.updateProfile({
displayName: userData.name,
photoURL: ''
});
console.log(result.user);
this.afAuth.auth.currentUser.sendEmailVerification();
const currencyData = {
......@@ -367,4 +371,13 @@ export class AuthService {
this.loader = false;
});
}
resend() {
this.service.showToast(
'OTP sent successfully',
'top',
'my-toast',
1000
);
}
}
......@@ -103,7 +103,7 @@ export class MyordersService {
ref => ref.where('custId', '==', custId).orderBy('orderDate', 'desc')
);
orderRef.stateChanges().subscribe(value => {
// console.log(value);
console.log(value);
const res = value;
// console.log(res);
if (res.length > 0) {
......
......@@ -141,8 +141,7 @@ export class OrdersService {
// console.log(cartCount);
const promise = new Promise(resolve => {
distinctShops.forEach(item => {
console.log(item);
const pickup = new firebase.firestore.GeoPoint(centerLoc.latLng.longitude, centerLoc.latLng.longitude);
const pickup = new firebase.firestore.GeoPoint(centerLoc.latLng.latitude, centerLoc.latLng.longitude);
const products = {};
const cartItem = cartGroup[item];
let prodPrice = 0;
......
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