Commit 6f2da630 by Adarsh K

Merge branch 'adarsh' into 'master'

Adarsh See merge request !74
parents 8281ba99 92815ae8
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
<img [src]="carts.image" onerror="this.src=''" /> <img [src]="carts.image" onerror="this.src=''" />
</div> </div>
<div class="cart_detail"> <div class="cart_detail">
<h4>{{carts.prodName}}</h4> <h4>{{unEscape(carts.prodName)}}</h4>
<h4>{{carts.size}}, {{carts.color}}</h4> <h4>{{carts.size}}, {{carts.color}}</h4>
<h5>A$ {{carts.price}}</h5> <h5>A$ {{carts.price}}</h5>
</div> </div>
...@@ -81,7 +81,7 @@ ...@@ -81,7 +81,7 @@
<ion-grid class="p0" *ngIf="cartService.carts && cartService.carts.length > 0"> <ion-grid class="p0" *ngIf="cartService.carts && cartService.carts.length > 0">
<ion-row *ngFor="let carts of cartService.carts"> <ion-row *ngFor="let carts of cartService.carts">
<ion-col size="6" class="p0"> <ion-col size="6" class="p0">
<h6 class="textLeft">{{carts.prodName}}</h6> <h6 class="textLeft">{{unEscape(carts.prodName)}}</h6>
</ion-col> </ion-col>
<ion-col size="2" class="p0"> <ion-col size="2" class="p0">
<h6 class="textRight"><strong>{{carts.qty}} X</strong></h6> <h6 class="textRight"><strong>{{carts.qty}} X</strong></h6>
...@@ -116,13 +116,15 @@ ...@@ -116,13 +116,15 @@
<div class="clear"></div> <div class="clear"></div>
</h5> </h5>
<div class="payment_method"> <div class="payment_method">
<input type="radio" name="payments" id="cod" name="radio-group" checked="true" (click)="getwaycod()" /> <input type="radio" name="payments" id="cod" name="radio-group" checked="true"
(click)="getwaycod()" />
<label for="cod"> <label for="cod">
<p>COD</p> <p>COD</p>
</label> </label>
</div> </div>
<div class="payment_method"> <div class="payment_method">
<input type="radio" name="payments" id="paypal" name="radio-group" (click)="getwaypaypal()" /> <input type="radio" name="payments" id="paypal" name="radio-group"
(click)="getwaypaypal()" />
<label for="paypal"> <label for="paypal">
<p>PayPal</p> <p>PayPal</p>
</label> </label>
...@@ -131,7 +133,8 @@ ...@@ -131,7 +133,8 @@
<input class="card_no borderNone widthFull" placeholder="PayPal ID" /> <input class="card_no borderNone widthFull" placeholder="PayPal ID" />
</div> --> </div> -->
<div class="payment_method"> <div class="payment_method">
<input type="radio" name="payments" id="afterpay" name="radio-group" (click)="getwayafterpay()" /> <input type="radio" name="payments" id="afterpay" name="radio-group"
(click)="getwayafterpay()" />
<label for="afterpay"> <label for="afterpay">
<p>AfterPay</p> <p>AfterPay</p>
</label> </label>
...@@ -141,7 +144,8 @@ ...@@ -141,7 +144,8 @@
<input class="cv_number" placeholder="CVV" /> <input class="cv_number" placeholder="CVV" />
</div> --> </div> -->
<div class="payment_method"> <div class="payment_method">
<input type="radio" name="payments" id="payk" name="radio-group" (click)="getwaypayk()" /> <input type="radio" name="payments" id="payk" name="radio-group"
(click)="getwaypayk()" />
<label for="payk"> <label for="payk">
<p>PayK</p> <p>PayK</p>
</label> </label>
...@@ -167,7 +171,8 @@ ...@@ -167,7 +171,8 @@
<hr /> <hr />
<div class="coupon_code"> <div class="coupon_code">
<div class="promo-row"> <div class="promo-row">
<input class="" placeholder="COUPON CODE: GET50" #promo /><button class="add_btn" (click)="promoApply(promo.value)"> <input class="" placeholder="COUPON CODE: GET50" #promo /><button class="add_btn"
(click)="promoApply(promo.value)">
APPLY APPLY
</button> </button>
</div> </div>
...@@ -240,7 +245,8 @@ ...@@ -240,7 +245,8 @@
</div> </div>
<div class="checkout" (click)="next(1)">CHECKOUT</div> <div class="checkout" (click)="next(1)">CHECKOUT</div>
</div> </div>
<div class="footer_btn" *ngIf="cartService.carts && cartService.carts.length > 0" [hidden]="currentIndex != 1" (click)="next(2);"> <div class="footer_btn" *ngIf="cartService.carts && cartService.carts.length > 0" [hidden]="currentIndex != 1"
(click)="next(2);">
PAY PAY
</div> </div>
<!-- <div class="footer_btn" [hidden]="currentIndex != 2" (click)="finishpop()"> <!-- <div class="footer_btn" [hidden]="currentIndex != 2" (click)="finishpop()">
...@@ -265,7 +271,8 @@ ...@@ -265,7 +271,8 @@
<div class="clear"></div> <div class="clear"></div>
</div> </div>
<ion-content class="sort_wrappper"> <ion-content class="sort_wrappper">
<agm-map [zoom]="20" [latitude]="lat" [longitude]="lng" [disableDefaultUI]="false" [zoomControl]="false" [backgroundColor]="'rgba(29, 27, 130,0.2)'"> <agm-map [zoom]="20" [latitude]="lat" [longitude]="lng" [disableDefaultUI]="false" [zoomControl]="false"
[backgroundColor]="'rgba(29, 27, 130,0.2)'">
<agm-marker [latitude]="lat" [longitude]="lng"></agm-marker> <agm-marker [latitude]="lat" [longitude]="lng"></agm-marker>
</agm-map> </agm-map>
<div class="add_address_wrapper"> <div class="add_address_wrapper">
...@@ -274,11 +281,13 @@ ...@@ -274,11 +281,13 @@
<span class="floatRight" (click)="istoggle(); goToPage('nearby')">ADD NEW</span> <span class="floatRight" (click)="istoggle(); goToPage('nearby')">ADD NEW</span>
<div class="clear"></div> <div class="clear"></div>
</h5> </h5>
<ul *ngIf="addressService.addressList && addressService.addressList.length > 0"> <ul *ngIf="addressService.nearestList && addressService.nearestList.length > 0">
<li *ngFor="let address of addressService.addressList; let i = index"> <li *ngFor="let address of addressService.nearestList; let i = index">
<div class="floatLeft"> <div class="floatLeft">
{{address.default}} {{address.default}}
<input class="styled-checkbox" name="addressId" id="styled-checkbox-{{i}}" type="radio" (click)="setDefault(address.addressId, i)" [value]="address.addressId" #addressType [checked]="address.defaultVal == 1" /> <input class="styled-checkbox" name="addressId" id="styled-checkbox-{{i}}" type="radio"
(click)="setDefault(address.addressId, i)" [value]="address.addressId" #addressType
[checked]="address.defaultVal == 1" />
<label for="styled-checkbox-{{i}}"> {{address.addressType}} </label> <label for="styled-checkbox-{{i}}"> {{address.addressType}} </label>
</div> </div>
<div class="floatLeft"> <div class="floatLeft">
...@@ -289,6 +298,16 @@ ...@@ -289,6 +298,16 @@
<div class="clear"></div> <div class="clear"></div>
</li> </li>
</ul> </ul>
<div class="textCenter" *ngIf="addressService.nearestList && addressService.nearestList.length === 0">No
Address Found in the nearest center</div>
</div> </div>
<!-- <div class="loader" *ngIf="loader">
<div class="lds-ripple">
<div></div>
<div></div>
</div>
</div> -->
</ion-content> </ion-content>
</div> </div>
\ No newline at end of file
...@@ -50,6 +50,7 @@ export class CartPage implements OnInit { ...@@ -50,6 +50,7 @@ export class CartPage implements OnInit {
totalAmt: number; totalAmt: number;
bookDate: any; bookDate: any;
timeinterval: any; timeinterval: any;
paymentMethod: any;
constructor( constructor(
private router: Router, private router: Router,
...@@ -70,13 +71,17 @@ export class CartPage implements OnInit { ...@@ -70,13 +71,17 @@ export class CartPage implements OnInit {
this.taxAmount = 0; this.taxAmount = 0;
this.discountApplied = false; this.discountApplied = false;
this.discount = 0; this.discount = 0;
this.paymentMethod = 'COD';
// this.cartService.cartList(); // this.cartService.cartList();
this.loader = true; this.loader = true;
const users = this.service.get('user').then(data => { const users = this.service.get('user').then(data => {
if (data) { if (data) {
data = JSON.parse(data); data = JSON.parse(data);
this.custId = data.uid; this.custId = data.uid;
this.addressService.addList(data.uid); this.service.get('cartCenter').then((centerData) => {
this.addressService.defaultAddress(this.custId);
this.addressService.getNearBy(centerData, this.custId);
});
} }
}); });
setTimeout(() => { setTimeout(() => {
...@@ -85,37 +90,51 @@ export class CartPage implements OnInit { ...@@ -85,37 +90,51 @@ export class CartPage implements OnInit {
} }
ngOnInit() { ngOnInit() {
console.log(this.addressService.addressList); const This = this;
this.setAddress(); console.log(this.addressService.nearestList);
setTimeout(() => {
this.setAddress();
}, 1000);
} }
ionViewWillEnter() { ionViewWillEnter() {
const users = this.service.get('user').then(data => { const users = this.service.get('user').then(data => {
if (data) { if (data) {
data = JSON.parse(data); data = JSON.parse(data);
const This = this;
this.cartService.cartList(); this.cartService.cartList();
setTimeout(() => {
if (this.cartService.carts.length > 0) {
const cart = this.cartService.carts[0];
}
}, 1000);
} }
}); });
} }
setAddress() { setAddress() {
if (this.addressService.addressList.length > 0) { console.log(this.addressService.nearestList);
let address = this.addressService.addressList.find( if (this.addressService.nearestList.length > 0) {
let address = this.addressService.nearestList.find(
x => x.defaultVal === 1 x => x.defaultVal === 1
); );
if (!address) { if (!address) {
address = this.addressService.addressList[0]; address = this.addressService.nearestList[0];
} }
this.loader = false;
this.custAddress = address; this.custAddress = address;
} }
} }
getwaypaypal() { getwaypaypal() {
this.gateway = 1; this.gateway = 1;
this.paymentMethod = 'PayPal';
} }
getwayafterpay() { getwayafterpay() {
this.gateway = 2; this.gateway = 2;
this.paymentMethod = 'AfterPay';
} }
getDeliveryCharge(amount) { getDeliveryCharge(amount) {
...@@ -124,19 +143,21 @@ export class CartPage implements OnInit { ...@@ -124,19 +143,21 @@ export class CartPage implements OnInit {
} else { } else {
this.deliveryCharge = 10; this.deliveryCharge = 10;
} }
return this.deliveryCharge; return this.deliveryCharge.toFixed(2);
} }
getTax(amount) { getTax(amount) {
return (this.taxAmount = (amount * 10) / 100); return Math.round((this.taxAmount = (amount * 10) / 100)).toFixed(2);
} }
getwaypayk() { getwaypayk() {
this.gateway = 3; this.gateway = 3;
this.paymentMethod = 'PayK';
} }
getwaycod() { getwaycod() {
this.gateway = 4; this.gateway = 4;
this.paymentMethod = 'COD';
} }
async finishpop() { async finishpop() {
...@@ -156,10 +177,14 @@ export class CartPage implements OnInit { ...@@ -156,10 +177,14 @@ export class CartPage implements OnInit {
} }
setDefault(addressId: any, index: number) { setDefault(addressId: any, index: number) {
console.log(index); console.log('loading....');
this.addressService.setDefaultAddress(addressId, this.custId); this.loader = true;
console.log(this.addressService.addressList[index]); this.custAddress = this.addressService.nearestList[index];
this.custAddress = this.addressService.addressList[index]; console.log(this.custAddress);
this.istoggle();
setTimeout(() => {
this.loader = false;
}, 1000);
} }
next(index: number = null) { next(index: number = null) {
...@@ -177,7 +202,8 @@ export class CartPage implements OnInit { ...@@ -177,7 +202,8 @@ export class CartPage implements OnInit {
discount: this.discount, discount: this.discount,
discountApplied: this.discountApplied, discountApplied: this.discountApplied,
totalAmt: this.totalAmt, totalAmt: this.totalAmt,
custAddress: this.custAddress custAddress: this.custAddress,
paymentMethod: this.paymentMethod
}; };
const state = this.orderService const state = this.orderService
.checkOut(this.cartService.carts, otherCharges) .checkOut(this.cartService.carts, otherCharges)
...@@ -255,7 +281,7 @@ export class CartPage implements OnInit { ...@@ -255,7 +281,7 @@ export class CartPage implements OnInit {
const actualTotal = const actualTotal =
this.deliveryCharge + this.taxAmount + total - this.discount; this.deliveryCharge + this.taxAmount + total - this.discount;
this.totalAmt = actualTotal; this.totalAmt = actualTotal;
return actualTotal; return actualTotal.toFixed(2);
} }
promoApply(code) { promoApply(code) {
...@@ -267,7 +293,7 @@ export class CartPage implements OnInit { ...@@ -267,7 +293,7 @@ export class CartPage implements OnInit {
if (value[0].type === 1) { if (value[0].type === 1) {
const rate = value[0].amount; const rate = value[0].amount;
const upto = value[0].amount; const upto = value[0].amount;
const percentage = (this.cartService.cartTotal * rate) / 100; const percentage = Math.round((this.cartService.cartTotal * rate) / 100).toFixed(2);
this.discount = percentage > upto ? upto : percentage; this.discount = percentage > upto ? upto : percentage;
} else { } else {
this.discount = value[0].amount; this.discount = value[0].amount;
...@@ -313,4 +339,8 @@ export class CartPage implements OnInit { ...@@ -313,4 +339,8 @@ export class CartPage implements OnInit {
strTime strTime
); );
} }
unEscape(text: string) {
return unescape(text);
}
} }
<div class="nav_header"> <div class="nav_header">
<button class="nav_btn nav_back floatLeft" (click)="goBack()"> <button class="nav_btn nav_back floatLeft" (click)="goBack()">
<img src="../assets/Group17_2.png" /> <img src="../assets/Group17_2.png" />
</button> </button>
<div class="nav_title floatLeft"> <div class="nav_title floatLeft">
<h4>Change Address</h4> <h4>Change Address</h4>
</div> </div>
...@@ -10,17 +10,21 @@ ...@@ -10,17 +10,21 @@
<ion-content> <ion-content>
<div class="nearby_map"> <div class="nearby_map">
<agm-map [latitude]="latitude" [longitude]="longitude" [zoom]="8" [backgroundColor]="'rgba(29, 27, 130,0.2)'"> <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)"></agm-marker> <agm-marker [latitude]="latitude" [longitude]="longitude" [markerDraggable]="true"
(dragEnd)="markerDragEnd($event)"></agm-marker>
</agm-map> </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"> <div class="add_address_wrapper">
<h5>DELIVERY</h5> <h5>DELIVERY</h5>
<p>{{address}}</p> <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"> <div class="md-errors-spacer" [hidden]="building.valid || landmark.pristine" class="ion-padding-start">
Building Name is required Building Name is required
</div> </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"> <div class="md-errors-spacer" [hidden]="landmark.valid || landmark.pristine" class="ion-padding-start">
Landmark is required Landmark is required
</div> </div>
...@@ -28,30 +32,37 @@ ...@@ -28,30 +32,37 @@
<ion-row> <ion-row>
<ion-col> <ion-col>
<h6> <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> <label for="styled-check-1"><span>Home</span></label>
</h6> </h6>
</ion-col> </ion-col>
<ion-col> <ion-col>
<h6> <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> <label for="styled-check-2"><span>Office</span></label>
</h6> </h6>
</ion-col> </ion-col>
<ion-col> <ion-col>
<h6> <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> <label for="styled-check-3"><span>Others</span></label>
</h6> </h6>
</ion-col> </ion-col>
</ion-row> </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 Address Type is required
</div> </div>
</ion-grid> </ion-grid>
<button class="add_btn" type="submit" [disabled]="!addressForm.form.valid"> <button class="add_btn" type="submit" [disabled]="!addressForm.form.valid" *ngIf="locationRest()">
ADD CHANGE
</button> </button>
</div> </div>
</form> </form>
</div> </div>
......
...@@ -11,6 +11,7 @@ import { MapsAPILoader, MouseEvent } from '@agm/core'; ...@@ -11,6 +11,7 @@ import { MapsAPILoader, MouseEvent } from '@agm/core';
import { Address } from './../../config/services/address'; import { Address } from './../../config/services/address';
import { AddressService } from './../../config/address.service'; import { AddressService } from './../../config/address.service';
import { ServiceService } from './../../config/service.service'; import { ServiceService } from './../../config/service.service';
import { MyordersService } from './../../config/myorder.service';
import { NgForm } from '@angular/forms'; import { NgForm } from '@angular/forms';
import * as firebase from 'firebase'; import * as firebase from 'firebase';
...@@ -31,6 +32,10 @@ export class ChangeaddressPage implements OnInit { ...@@ -31,6 +32,10 @@ export class ChangeaddressPage implements OnInit {
uid: string; uid: string;
type: any; type: any;
loader: boolean; loader: boolean;
order: any;
addressValid: any;
lat: any;
lng: any;
public searchElementRef: ElementRef; public searchElementRef: ElementRef;
constructor( constructor(
...@@ -40,9 +45,13 @@ export class ChangeaddressPage implements OnInit { ...@@ -40,9 +45,13 @@ export class ChangeaddressPage implements OnInit {
private mapsAPILoader: MapsAPILoader, private mapsAPILoader: MapsAPILoader,
private ngZone: NgZone, private ngZone: NgZone,
public addressService: AddressService, public addressService: AddressService,
public service: ServiceService public service: ServiceService,
public myorder: MyordersService
) { ) {
this.addressValid = false;
this.successState = false; this.successState = false;
this.lat = '';
this.lng = '';
this.type = 0; this.type = 0;
const users = this.service.get('user').then(data => { const users = this.service.get('user').then(data => {
if (data) { if (data) {
...@@ -54,6 +63,9 @@ export class ChangeaddressPage implements OnInit { ...@@ -54,6 +63,9 @@ export class ChangeaddressPage implements OnInit {
this.service.get('type').then(data => { this.service.get('type').then(data => {
this.type = data; this.type = data;
}); });
this.service.get('order').then(val => {
this.order = val;
});
} }
ngOnInit() { ngOnInit() {
...@@ -83,6 +95,22 @@ export class ChangeaddressPage implements OnInit { ...@@ -83,6 +95,22 @@ export class ChangeaddressPage implements OnInit {
this.getAddress(this.latitude, this.longitude); this.getAddress(this.latitude, this.longitude);
} }
locationRest() {
if (this.latitude && this.longitude && this.order) {
if (this.latitude !== this.lat && this.longitude !== this.lng) {
this.lat = this.latitude;
this.lng = this.longitude;
this.myorder.getNearBy(this.latitude, this.longitude, this.order.orderId).then(resp => {
console.log(resp);
if (resp) {
this.addressValid = resp;
}
});
}
}
return this.addressValid;
}
getAddress(latitude, longitude) { getAddress(latitude, longitude) {
this.geoCoder.geocode( this.geoCoder.geocode(
{ location: { lat: latitude, lng: longitude } }, { location: { lat: latitude, lng: longitude } },
......
...@@ -15,10 +15,24 @@ ...@@ -15,10 +15,24 @@
</div> </div>
<div class="row"> <div class="row">
<input [(value)]="userData && userData.name" name="name" readonly class="" type="text" <input [(value)]="userData && userData.name" name="name" readonly class="" type="text"
[(ngModel)]="userData && userData.name" placeholder="Change your Name" #name="ngModel" /> placeholder="Change your Name" />
<div class="md-errors-spacer" [hidden]="name.valid" class="ion-padding-start"> <!-- <div
class="md-errors-spacer"
[hidden]="name.valid"
class="ion-padding-start"
>
Name is required Name is required
</div> </div> -->
</div>
<div class="row">
<input [(value)]="userData && userData.dob" name="dob" readonly class="" type="text" />
<!-- <div
class="md-errors-spacer"
[hidden]="name.valid"
class="ion-padding-start"
>
Name is required
</div> -->
</div> </div>
<div class="row"> <div class="row">
<input [(value)]="userData && userData.emailId" readonly class="" name="emailId" type="mail" <input [(value)]="userData && userData.emailId" readonly class="" name="emailId" type="mail"
...@@ -66,7 +80,7 @@ ...@@ -66,7 +80,7 @@
</div> </div>
<div class="row"> <div class="row">
<button class="login_btn" (click)="onFormSubmit(updateForm)" [disabled]="!phone.valid || !name.valid"> <button class="login_btn" (click)="onFormSubmit(updateForm)" [disabled]="!phone.valid ">
UPDATE UPDATE
</button> </button>
</div> </div>
......
...@@ -14,7 +14,7 @@ import { NgForm } from '@angular/forms'; ...@@ -14,7 +14,7 @@ import { NgForm } from '@angular/forms';
export class ChangedetailsPage implements OnInit { export class ChangedetailsPage implements OnInit {
userData: any; userData: any;
updateData: UpdateUserDetails = { updateData: UpdateUserDetails = {
name: '', phoneVerified: false,
phone: '' phone: ''
}; };
confPasswordErr: string; confPasswordErr: string;
...@@ -65,7 +65,8 @@ export class ChangedetailsPage implements OnInit { ...@@ -65,7 +65,8 @@ export class ChangedetailsPage implements OnInit {
// Change Password // Change Password
if ( if (
form.value.currentPassword && form.value.currentPassword &&
form.value.password && form.value.password === form.value.confirmPassword form.value.password &&
form.value.password === form.value.confirmPassword
) { ) {
this.register.updateData(form.value, this.userData.uid); this.register.updateData(form.value, this.userData.uid);
this.register.updatePassword( this.register.updatePassword(
......
...@@ -11,19 +11,10 @@ ...@@ -11,19 +11,10 @@
<div class="verification_div"> <div class="verification_div">
<div class="form_div"> <div class="form_div">
<div class="row"> <div class="row">
<input <input class="" type="email" placeholder="Type your email Id" #emailId required />
class=""
type="email"
placeholder="Type your email Id"
#emailId
required
/>
</div> </div>
<div class="row"> <div class="row">
<button <button class="login_btn" (click)="authService.resetPassword(emailId.value);">
class="login_btn"
(click)="authService.resetPassword(emailId.value)"
>
RESET PASSWORD RESET PASSWORD
</button> </button>
</div> </div>
...@@ -35,4 +26,4 @@ ...@@ -35,4 +26,4 @@
<div></div> <div></div>
<div></div> <div></div>
</div> </div>
</div> </div>
\ No newline at end of file
...@@ -14,9 +14,9 @@ export class ForgotPage implements OnInit { ...@@ -14,9 +14,9 @@ export class ForgotPage implements OnInit {
private route: ActivatedRoute, private route: ActivatedRoute,
private location: Location, private location: Location,
public authService: AuthService public authService: AuthService
) {} ) { }
ngOnInit() {} ngOnInit() { }
goToPage(path, data = null) { goToPage(path, data = null) {
this.router.navigateByUrl(path, { queryParams: data }); this.router.navigateByUrl(path, { queryParams: data });
...@@ -24,6 +24,6 @@ export class ForgotPage implements OnInit { ...@@ -24,6 +24,6 @@ export class ForgotPage implements OnInit {
} }
goBack() { goBack() {
this.location.back(); this.router.navigateByUrl('login');
} }
} }
...@@ -31,7 +31,8 @@ ...@@ -31,7 +31,8 @@
<h5>{{center.centerName}}</h5> <h5>{{center.centerName}}</h5>
<p>{{center.description}}</p> <p>{{center.description}}</p>
</div> </div>
<img [src]="center.centerImg" onerror="this.src='./../../assets/getmi_malls/mall_banner/mall_4.png'" /> <img [src]="center.centerImg"
onerror="this.src='./../../assets/getmi_malls/mall_banner/mall_4.png'" />
</ion-slide> </ion-slide>
</ion-slides> </ion-slides>
</div> </div>
...@@ -39,10 +40,12 @@ ...@@ -39,10 +40,12 @@
Featured Stores Featured Stores
</div> </div>
<div class="featured_slider"> <div class="featured_slider">
<ion-slides pager="false" [options]="slideOpts" *ngIf="shopperService.activeshoppers && shopperService.activeshoppers.length > 0"> <ion-slides pager="false" [options]="slideOpts"
*ngIf="shopperService.activeshoppers && shopperService.activeshoppers.length > 0">
<ion-slide *ngFor="let shopper of shopperService.activeshoppers"> <ion-slide *ngFor="let shopper of shopperService.activeshoppers">
<div class="feature_product" (click)="goToPage('productlist', shopper)"> <div class="feature_product" (click)="goToPage('productlist', shopper)">
<img [src]="shopper.featuredImage" onerror="this.src='./../../assets/getmi_malls/featured/featured1.png'" /> <img [src]="shopper.featuredImage"
onerror="this.src='./../../assets/getmi_malls/featured/featured1.png'" />
<div class="feature_overlay"> <div class="feature_overlay">
<h5>{{shopper.name}}</h5> <h5>{{shopper.name}}</h5>
<p>{{shopper.caption}}</p> <p>{{shopper.caption}}</p>
...@@ -71,7 +74,8 @@ ...@@ -71,7 +74,8 @@
<ul *ngIf="centerService.nearcenters && centerService.nearcenters.length > 0"> <ul *ngIf="centerService.nearcenters && centerService.nearcenters.length > 0">
<li *ngFor="let center of centerService.nearcenters" (click)="goToPage('storelist', center)"> <li *ngFor="let center of centerService.nearcenters" (click)="goToPage('storelist', center)">
<div class="nearby_image"> <div class="nearby_image">
<img [src]="center.centerImg" onerror="this.src='./../../assets/getmi_malls/mall_298/mall2.png'" /> <img [src]="center.centerImg"
onerror="this.src='./../../assets/getmi_malls/mall_298/mall2.png'" />
</div> </div>
<div class="nearby_detail"> <div class="nearby_detail">
<h5> <h5>
...@@ -92,8 +96,10 @@ ...@@ -92,8 +96,10 @@
</div> </div>
<div class="featured_catagory_list"> <div class="featured_catagory_list">
<ul *ngIf="categoriesService.activecategories && categoriesService.activecategories.length > 0"> <ul *ngIf="categoriesService.activecategories && categoriesService.activecategories.length > 0">
<li *ngFor="let categories of categoriesService.activecategories" (click)="goToPage('catstorelist', categories)"> <li *ngFor="let categories of categoriesService.activecategories"
<img [src]="categories.catImage" onerror="this.src='../assets/handsome-man-outdoors-drinking-coffee-with-sunglasses-guy-with-beard-instagram-effect_1212-818@3x.png'" /> (click)="goToPage('catstorelist', categories)">
<img [src]="categories.catImage"
onerror="this.src='../assets/handsome-man-outdoors-drinking-coffee-with-sunglasses-guy-with-beard-instagram-effect_1212-818@3x.png'" />
<div class="featured_overlay"> <div class="featured_overlay">
<h4>{{categories.catName}}</h4> <h4>{{categories.catName}}</h4>
</div> </div>
...@@ -113,7 +119,8 @@ ...@@ -113,7 +119,8 @@
<div class="clear"></div> <div class="clear"></div>
</div> </div>
<ion-content class="sort_wrappper"> <ion-content class="sort_wrappper">
<agm-map [zoom]="20" [latitude]="lat" [longitude]="lng" [disableDefaultUI]="false" [zoomControl]="false" [backgroundColor]="'rgba(29, 27, 130,0.2)'"> <agm-map [zoom]="20" [latitude]="lat" [longitude]="lng" [disableDefaultUI]="false" [zoomControl]="false"
[backgroundColor]="'rgba(29, 27, 130,0.2)'">
<agm-marker [latitude]="lat" [longitude]="lng"></agm-marker> <agm-marker [latitude]="lat" [longitude]="lng"></agm-marker>
</agm-map> </agm-map>
<div class="add_address_wrapper"> <div class="add_address_wrapper">
...@@ -127,7 +134,9 @@ ...@@ -127,7 +134,9 @@
<li *ngFor="let address of addressService.addressList; let i = index"> <li *ngFor="let address of addressService.addressList; let i = index">
<div class="floatLeft"> <div class="floatLeft">
{{address.default}} {{address.default}}
<input class="styled-checkbox" name="addressId" id="styled-checkbox-{{i}}" type="radio" (click)="setDefault(address.addressId)" [value]="address.addressId" #addressType [checked]="address.defaultVal == 1" /> <input class="styled-checkbox" name="addressId" id="styled-checkbox-{{i}}" type="radio"
(click)="setDefault(address)" [value]="address.addressId" #addressType
[checked]="address.defaultVal == 1" />
<label for="styled-checkbox-{{i}}"> <label for="styled-checkbox-{{i}}">
{{address.addressType}} {{address.addressType}}
</label> </label>
......
...@@ -112,9 +112,12 @@ export class HomePage implements OnInit { ...@@ -112,9 +112,12 @@ export class HomePage implements OnInit {
); );
} }
setDefault(addressId: any) { setDefault(address: any) {
this.loader = true; this.loader = true;
this.addressService.setDefaultAddress(addressId, this.custId).then(() => { this.addressService.setDefaultAddress(address.addressId, this.custId).then(() => {
this.address = address.address;
console.log(address.latLng);
this.centerService.getNearBy(address.latLng._lat, address.latLng._long, 10);
this.loader = false; this.loader = false;
}).catch(err => { }).catch(err => {
this.loader = false; this.loader = false;
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
<img [src]="product.image" onerror="" /> <img [src]="product.image" onerror="" />
</div> </div>
<div class="order_detail"> <div class="order_detail">
<h5 class="floatLeft">{{product.prodName}}</h5> <h5 class="floatLeft">{{unEscape(product.prodName)}}</h5>
<div class="clear"></div> <div class="clear"></div>
<h5> <h5>
<span *ngIf="product.color !== 'No-Color'">{{product.color}}, <span *ngIf="product.color !== 'No-Color'">{{product.color}},
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
<p *ngIf="product.price">A$ {{product.price}}</p> <p *ngIf="product.price">A$ {{product.price}}</p>
</div> </div>
<div class="order_other"> <div class="order_other">
<h6 class="floatRight"> <h6 class="floatRight" *ngIf="order.bookDate">
{{ order.bookDate.seconds * 1000 | date:'MMMM dd, y' }} {{ order.bookDate.seconds * 1000 | date:'MMMM dd, y' }}
</h6> </h6>
<span class="floatRight" *ngIf="order.orderStatus < 3 || order.orderStatus >= 7" <span class="floatRight" *ngIf="order.orderStatus < 3 || order.orderStatus >= 7"
......
...@@ -115,4 +115,8 @@ export class MyorderPage implements OnInit { ...@@ -115,4 +115,8 @@ export class MyorderPage implements OnInit {
} }
} }
unEscape(text: string) {
return unescape(text);
}
} }
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
<div class="order_status"> <div class="order_status">
<div class="clear"></div> <div class="clear"></div>
<div class="status_div go_green"> <div class="status_div go_green">
<h4>Order Placed</h4> <h4>{{data.orderCode}}</h4>
<h6>{{ data.bookDate.seconds * 1000 | date:'MMMM dd, y' }}</h6> <h6>{{ data.bookDate.seconds * 1000 | date:'MMMM dd, y' }}</h6>
</div> </div>
<!-- <div class="status_gap go_green"> <!-- <div class="status_gap go_green">
...@@ -69,7 +69,7 @@ ...@@ -69,7 +69,7 @@
</span> </span>
<div class="clear"></div> <div class="clear"></div>
</h5> </h5>
<p class="prodName">{{data.product[0].prodName}}</p> <p class="prodName">{{unEscape(data.product[0].prodName)}}</p>
</div> </div>
<div class="clear"></div> <div class="clear"></div>
</li> </li>
...@@ -77,17 +77,21 @@ ...@@ -77,17 +77,21 @@
</div> </div>
<div class="product_detail" *ngFor="let product of data.product"> <div class="product_detail" *ngFor="let product of data.product">
<h6> <h6>
<span *ngIf="product.color !== 'No-Color'">{{product.color}}, </span> <span *ngIf="product.color !== 'No-Color'">Color: {{product.color}}, </span>
<span *ngIf="product.size !== 'Any-Size'">{{product.size}}</span> <span *ngIf="product.size !== 'Any-Size'">Size: {{product.size}}</span>
</h6> </h6>
<h5>Quantity : <span>{{product.qty}}</span></h5> <h5>Quantity : <span>{{product.qty}}</span></h5>
<h5> <h5>
Amount : <strong>A$ {{product.price}}</strong><span class="afterpay">COD</span> Amount : <strong>A$ {{product.price}}</strong><span class="afterpay">{{data.paymentMode}}</span>
</h5> </h5>
<h5 *ngIf="data.orderStatus >= 3 && data.orderStatus < 7"> <h5 *ngIf="data.orderStatus >= 3 && data.orderStatus < 7">
Delivery time : <span>{{deliveryTime}}</span> Delivery time : <span>{{deliveryTime}}</span>
</h5> </h5>
<h5>Order Status : <span>{{getStatus(data.orderStatus)}}</span></h5> <h5>Order Status : <span>{{getStatus(data.orderStatus)}}</span></h5>
</div>
<div class="product_detail">
<div class="delivery-wrap"> <div class="delivery-wrap">
<h4 class="floatLeft">DELIVERY</h4> <h4 class="floatLeft">DELIVERY</h4>
<span class="floatRight" *ngIf="cancelDelivery > 0 && data.orderStatus != 0 && data.orderStatus != 8"><img <span class="floatRight" *ngIf="cancelDelivery > 0 && data.orderStatus != 0 && data.orderStatus != 8"><img
...@@ -95,6 +99,7 @@ ...@@ -95,6 +99,7 @@
<div class="clear"></div> <div class="clear"></div>
</div> </div>
<h5 *ngIf="data.deliveryAddress"> <h5 *ngIf="data.deliveryAddress">
{{data.deliveryAddress.addressType}},<br />{{data.deliveryAddress.address}}, {{data.deliveryAddress.addressType}},<br />{{data.deliveryAddress.address}},
<br /> <br />
......
...@@ -41,6 +41,10 @@ export class OrderplacedPage implements OnInit { ...@@ -41,6 +41,10 @@ export class OrderplacedPage implements OnInit {
}); });
} }
unEscape(text: string) {
return unescape(text);
}
getDeliveryTime(timeStamp) { getDeliveryTime(timeStamp) {
// console.log(timeStamp); // console.log(timeStamp);
const endDate = new Date(timeStamp * 1000); const endDate = new Date(timeStamp * 1000);
......
...@@ -97,6 +97,8 @@ export class ProductdetailPage implements OnInit { ...@@ -97,6 +97,8 @@ export class ProductdetailPage implements OnInit {
color: params.color, color: params.color,
discount: params.discount, discount: params.discount,
featured: params.featured, featured: params.featured,
centerId: params.centerId,
centerRef: params.center,
image: params.image, image: params.image,
price: params.price, price: params.price,
qty: params.qty, qty: params.qty,
......
...@@ -23,10 +23,9 @@ import { Signup } from './../../config/services/user'; ...@@ -23,10 +23,9 @@ import { Signup } from './../../config/services/user';
] ]
}) })
export class SignupPage implements OnInit { export class SignupPage implements OnInit {
menuShow = false; menuShow = false;
currDate = new Date(); currDate = new Date();
mobnumPattern = '(\(+61\)|\+61|\(0[1-9]\)|0[1-9])?( ?-?[0-9]){6,10}'; mobnumPattern = '((+61)|+61|(0[1-9])|0[1-9])?( ?-?[0-9]){6,10}';
minDate: any; minDate: any;
signup: Signup = { signup: Signup = {
emailId: '', emailId: '',
...@@ -53,8 +52,7 @@ export class SignupPage implements OnInit { ...@@ -53,8 +52,7 @@ export class SignupPage implements OnInit {
this.minDate = [year, month, day].join('-'); this.minDate = [year, month, day].join('-');
} }
ngOnInit() { ngOnInit() { }
}
goToPage(path, data = null) { goToPage(path, data = null) {
this.router.navigateByUrl(path, { replaceUrl: true, queryParams: data }); this.router.navigateByUrl(path, { replaceUrl: true, queryParams: data });
...@@ -77,7 +75,4 @@ export class SignupPage implements OnInit { ...@@ -77,7 +75,4 @@ export class SignupPage implements OnInit {
this.register.signup(form.value); this.register.signup(form.value);
} }
} }
} }
...@@ -3,6 +3,7 @@ import { ...@@ -3,6 +3,7 @@ import {
AngularFirestore, AngularFirestore,
AngularFirestoreCollection AngularFirestoreCollection
} from '@angular/fire/firestore'; } from '@angular/fire/firestore';
import * as firebase from 'firebase';
import { take } from 'rxjs/operators'; import { take } from 'rxjs/operators';
import { Address, AddressList } from './services/address'; import { Address, AddressList } from './services/address';
...@@ -11,6 +12,8 @@ import { Address, AddressList } from './services/address'; ...@@ -11,6 +12,8 @@ import { Address, AddressList } from './services/address';
}) })
export class AddressService { export class AddressService {
addressList: AddressList[] = []; addressList: AddressList[] = [];
nearestList: AddressList[] = [];
defaultAdd: AddressList;
constructor(public afs: AngularFirestore) { } constructor(public afs: AngularFirestore) { }
public async addList(userId: string) { public async addList(userId: string) {
...@@ -44,6 +47,36 @@ export class AddressService { ...@@ -44,6 +47,36 @@ export class AddressService {
}); });
} }
public async defaultAddress(userId: string) {
const This = this;
const state = true;
const orderRef: AngularFirestoreCollection<any> = this.afs.collection(
'address',
ref => ref.where('status', '==', state).where('uid', '==', userId).where('defaultVal', '==', 1)
);
orderRef.valueChanges().subscribe(value => {
this.addressList = [];
const res = value;
if (res.length > 0) {
const item = res[0];
// console.log(item);
const address: AddressList = {
address: item.address,
addressType: item.addressType,
latLng: item.latLng,
defaultVal: item.defaultVal,
building: item.building,
landmark: item.landmark,
addressId: item.addressId
};
this.defaultAdd = address;
console.log(this.defaultAdd);
} else {
// alert('No Orders Found');
}
});
}
addressCreate(data: Address) { addressCreate(data: Address) {
console.log(data); console.log(data);
this.afs this.afs
...@@ -99,4 +132,70 @@ export class AddressService { ...@@ -99,4 +132,70 @@ export class AddressService {
.doc(addId) .doc(addId)
.delete(); .delete();
} }
public async getNearBy(centerId, userId) {
// latitude, longitude, distance, userId
console.log(centerId);
if (centerId) {
this.afs.collection('centers').doc(centerId).ref.get().then((doc) => {
if (doc.exists) {
console.log('Document data:', doc.data());
const center = doc.data();
const This = this;
const state = true;
const latitude = center.latLng._lat;
const longitude = center.latLng._long;
const lat = 0.0144927536231884;
const lon = 0.0181818181818182;
const distance = 10;
const lowerLat = latitude - lat * distance;
const lowerLon = longitude - lon * distance;
const greaterLat = latitude + lat * distance;
const greaterLon = longitude + lon * distance;
const lesserGeopoint = new firebase.firestore.GeoPoint(lowerLat, lowerLon);
const greaterGeopoint = new firebase.firestore.GeoPoint(
greaterLat,
greaterLon
);
const addressRef: AngularFirestoreCollection<any> = this.afs.collection(
'address',
ref =>
ref
.where('latLng', '>', lesserGeopoint)
.where('latLng', '<', greaterGeopoint)
.where('status', '==', state)
.where('uid', '==', userId)
);
addressRef.valueChanges().subscribe(value => {
this.nearestList = [];
const res = value;
if (res.length > 0) {
res.forEach(item => {
// console.log(item);
const address: AddressList = {
address: item.address,
addressType: item.addressType,
latLng: item.latLng,
defaultVal: item.defaultVal,
building: item.building,
landmark: item.landmark,
addressId: item.addressId
};
this.nearestList.push(address);
});
console.log(this.nearestList);
} else {
// alert('No Orders Found');
}
});
} else {
console.log('No such document!');
}
});
}
}
} }
...@@ -149,9 +149,17 @@ export class AuthService { ...@@ -149,9 +149,17 @@ export class AuthService {
this.afAuth.auth this.afAuth.auth
.signInWithPopup(new auth.FacebookAuthProvider()) .signInWithPopup(new auth.FacebookAuthProvider())
.then(result => { .then(result => {
this.loader = false; /* this.loader = false;
console.log('success');
console.log(result); */
console.log('success'); console.log('success');
console.log(result); console.log(result.additionalUserInfo.isNewUser);
if (
result.additionalUserInfo &&
result.additionalUserInfo.isNewUser === true
) {
this.socialSignUp(result);
}
}) })
.catch(err => { .catch(err => {
this.service.showToast(err.message, 'bottom', 'my-error', 1000); this.service.showToast(err.message, 'bottom', 'my-error', 1000);
...@@ -171,6 +179,7 @@ export class AuthService { ...@@ -171,6 +179,7 @@ export class AuthService {
uid: value.uid, uid: value.uid,
emailId: value.emailId, emailId: value.emailId,
name: value.name, name: value.name,
dob: value.dob,
profilePhoto: value.profilePhoto, profilePhoto: value.profilePhoto,
emailVerified: value.emailVerified, emailVerified: value.emailVerified,
phone: value.phone, phone: value.phone,
...@@ -210,6 +219,7 @@ export class AuthService { ...@@ -210,6 +219,7 @@ export class AuthService {
const postData: User = { const postData: User = {
uid: userData.uid, uid: userData.uid,
status: true, status: true,
dob: userData.dob ? userData.dob : '',
profilePhoto: userData.photoURL, profilePhoto: userData.photoURL,
phoneVerified: false, phoneVerified: false,
phone: userData.phoneNumber, phone: userData.phoneNumber,
...@@ -247,8 +257,10 @@ export class AuthService { ...@@ -247,8 +257,10 @@ export class AuthService {
symbol: 'A$' symbol: 'A$'
}; };
const custData = result.user; const custData = result.user;
const dobDate = new Date(userData.dob);
const postData: User = { const postData: User = {
uid: custData.uid, uid: custData.uid,
dob: dobDate.toDateString(),
status: true, status: true,
profilePhoto: '', profilePhoto: '',
phoneVerified: false, phoneVerified: false,
...@@ -268,6 +280,7 @@ export class AuthService { ...@@ -268,6 +280,7 @@ export class AuthService {
.set(postData) .set(postData)
.then(() => { .then(() => {
console.log('successs'); console.log('successs');
this.service.set('userData', JSON.stringify(postData));
}); });
this.loader = false; this.loader = false;
}) })
...@@ -322,4 +335,18 @@ export class AuthService { ...@@ -322,4 +335,18 @@ export class AuthService {
}); });
return false; return false;
} }
resetPassword(email: string) {
this.loader = true;
this.afAuth.auth.sendPasswordResetEmail(email)
.then(() => {
this.service.showToast('Password reset mail has been sent your mail Id', 'top', 'my-toast', 2000);
this.loader = false;
this.router.navigateByUrl('login');
})
.catch((error) => {
this.service.showToast(error, 'top', 'my-error', 1000);
this.loader = false;
});
}
} }
...@@ -51,73 +51,83 @@ export class CartsService { ...@@ -51,73 +51,83 @@ export class CartsService {
this.size = this.size === undefined ? product.size[0] : this.size; this.size = this.size === undefined ? product.size[0] : this.size;
this.color = this.color === undefined ? product.color[0] : this.color; this.color = this.color === undefined ? product.color[0] : this.color;
this.service.get('cartCenter').then((centerData) => {
console.log(centerData);
if (centerData === null || (centerData === product.centerId)) {
this.service.set('cartCenter', product.centerId);
const cartRef: AngularFirestoreCollection<any> = this.afs.collection(
'carts',
ref =>
ref
.where('size', '==', this.size)
.where('color', '==', this.color)
.where('custId', '==', this.custId)
.where('product', '==', prodRef)
);
cartRef
.valueChanges()
.pipe(take(1))
.subscribe(value => {
// console.log(value);
const cartRef: AngularFirestoreCollection<any> = this.afs.collection( if (value.length === 0) {
'carts', product.image =
ref => product.image === undefined
ref ? '../assets/[email protected]'
.where('size', '==', this.size) : product.image;
.where('color', '==', this.color) const cart: Cart = {
.where('custId', '==', this.custId) color: this.color,
.where('product', '==', prodRef) custId: this.custId,
); shopperId: product.shopperId,
cartRef product: firebase.firestore().doc(`products/${this.prodId}`),
.valueChanges() image: product.image,
.pipe(take(1)) prodId: product.prodId,
.subscribe(value => { price: product.price,
// console.log(value); prodName: product.prodName,
if (value.length === 0) { shopper: product.shopper,
product.image = qty: 1,
product.image === undefined size: this.size
? '../assets/[email protected]' };
: product.image; // console.log(cart);
const cart: Cart = { this.afs
color: this.color, .collection('carts')
custId: this.custId, .add(cart)
shopperId: product.shopperId, .then(docRef => {
product: firebase.firestore().doc(`products/${this.prodId}`), const neworderId = docRef.id;
image: product.image, this.afs
prodId: product.prodId, .collection('carts')
price: product.price, .doc(neworderId)
prodName: product.prodName, .update({ cartId: docRef.id })
shopper: product.shopper, .then(() => {
qty: 1, // console.log('Booking Successfully');
size: this.size document.body.scrollTop = document.documentElement.scrollTop = 0;
}; });
// console.log(cart); })
this.afs .catch(error => {
.collection('carts') console.error('Error adding document: ', error);
.add(cart) });
.then(docRef => { } else {
const neworderId = docRef.id; // console.log(value);
// alert('Item already added in the cart');
const cartId = value[0].cartId;
// tslint:disable-next-line:radix
const qty = parseInt(value[0].qty) + 1;
this.afs this.afs
.collection('carts') .collection('carts')
.doc(neworderId) .doc(cartId)
.update({ cartId: docRef.id }) .update({ qty: `${qty}` })
.then(() => { .then(() => {
// console.log('Booking Successfully'); // console.log('Booking Successfully');
document.body.scrollTop = document.documentElement.scrollTop = 0; document.body.scrollTop = document.documentElement.scrollTop = 0;
}); });
}) }
.catch(error => {
console.error('Error adding document: ', error);
}); });
} else { } else {
// console.log(value); this.service.showToast('Your cart is not empty', 'top', 'my-error', 2000);
// alert('Item already added in the cart'); }
const cartId = value[0].cartId; });
// tslint:disable-next-line:radix
const qty = parseInt(value[0].qty) + 1;
this.afs
.collection('carts')
.doc(cartId)
.update({ qty: `${qty}` })
.then(() => {
// console.log('Booking Successfully');
document.body.scrollTop = document.documentElement.scrollTop = 0;
});
}
});
} }
public async cartList() { public async cartList() {
...@@ -160,6 +170,7 @@ export class CartsService { ...@@ -160,6 +170,7 @@ export class CartsService {
this.carts.push(cartItem); this.carts.push(cartItem);
}); });
} else { } else {
this.service.remove('cartCenter');
// alert('No Products Found'); // alert('No Products Found');
} }
}); });
......
...@@ -120,6 +120,7 @@ export class MyordersService { ...@@ -120,6 +120,7 @@ export class MyordersService {
deliveryLocation: item.deliveryLocation, deliveryLocation: item.deliveryLocation,
pickupLocation: item.pickupLocation, pickupLocation: item.pickupLocation,
deliveryAddress: item.deliveryAddress, deliveryAddress: item.deliveryAddress,
paymentMode: item.paymentMethod,
riderName: 'John', riderName: 'John',
orderId: item.orderId, orderId: item.orderId,
orderCode: item.orderCode, orderCode: item.orderCode,
...@@ -225,6 +226,46 @@ export class MyordersService { ...@@ -225,6 +226,46 @@ export class MyordersService {
return of(this.orders); return of(this.orders);
} }
*/ */
public async getNearBy(latitude, longitude, orderId) {
const promise = new Promise(resolve => {
const This = this;
const lat = 0.0144927536231884;
const lon = 0.0181818181818182;
const distance = 10;
const lowerLat = latitude - lat * distance;
const lowerLon = longitude - lon * distance;
const greaterLat = latitude + lat * distance;
const greaterLon = longitude + lon * distance;
const lesserGeopoint = new firebase.firestore.GeoPoint(lowerLat, lowerLon);
const greaterGeopoint = new firebase.firestore.GeoPoint(
greaterLat,
greaterLon
);
const addressRef: AngularFirestoreCollection<any> = this.afs.collection(
'orders',
ref =>
ref
.where('pickupLocation', '>', lesserGeopoint)
.where('pickupLocation', '<', greaterGeopoint)
.where('orderId', '==', orderId)
);
addressRef.valueChanges().subscribe(value => {
const res = value;
if (res.length > 0) {
resolve(true);
} else {
resolve(false);
}
});
});
return promise;
}
public async trackOrder(order) { public async trackOrder(order) {
this.selItem = order; this.selItem = order;
} }
......
...@@ -189,6 +189,7 @@ export class OrdersService { ...@@ -189,6 +189,7 @@ export class OrdersService {
custName: 'Customer', custName: 'Customer',
riderName: 'John', riderName: 'John',
shopperState: 0, shopperState: 0,
paymentMethod: otherCharge.paymentMethod,
shopperName: '', shopperName: '',
product: products, product: products,
discount: 'A$ ' + otherCharge.discount, discount: 'A$ ' + otherCharge.discount,
...@@ -204,6 +205,7 @@ export class OrdersService { ...@@ -204,6 +205,7 @@ export class OrdersService {
.then(() => { .then(() => {
// console.log('Booking Successfully'); // console.log('Booking Successfully');
// this.router.navigateByUrl('cart'); // this.router.navigateByUrl('cart');
this.service.remove('cartCenter');
resolve('Cart to Order Successfully'); resolve('Cart to Order Successfully');
document.body.scrollTop = document.documentElement.scrollTop = 0; document.body.scrollTop = document.documentElement.scrollTop = 0;
}); });
......
...@@ -91,6 +91,8 @@ export class ProductsService { ...@@ -91,6 +91,8 @@ export class ProductsService {
skuCode: item.skuCode, skuCode: item.skuCode,
status: item.status, status: item.status,
rating: item.rating, rating: item.rating,
centerId: item.centerId,
centerRef: item.center,
size: this.service.splitSep(item.size), size: this.service.splitSep(item.size),
subCate: item.subCate, subCate: item.subCate,
tag: this.service.splitSep(item.tag) tag: this.service.splitSep(item.tag)
...@@ -163,6 +165,8 @@ export class ProductsService { ...@@ -163,6 +165,8 @@ export class ProductsService {
rating: item.rating, rating: item.rating,
shopper: item.shopper, shopper: item.shopper,
skuCode: item.skuCode, skuCode: item.skuCode,
centerId: item.centerId,
centerRef: item.center,
status: item.status, status: item.status,
size: this.service.splitSep(item.size), size: this.service.splitSep(item.size),
subCate: item.subCate, subCate: item.subCate,
...@@ -216,6 +220,8 @@ export class ProductsService { ...@@ -216,6 +220,8 @@ export class ProductsService {
shopper: item.shopper, shopper: item.shopper,
rating: item.rating, rating: item.rating,
skuCode: item.skuCode, skuCode: item.skuCode,
centerId: item.centerId,
centerRef: item.center,
status: item.status, status: item.status,
size: this.service.splitSep(item.size), size: this.service.splitSep(item.size),
subCate: item.subCate, subCate: item.subCate,
......
...@@ -12,4 +12,5 @@ export interface Myorder { ...@@ -12,4 +12,5 @@ export interface Myorder {
time: string; time: string;
product: any; product: any;
orderCode: string; orderCode: string;
paymentMode: string;
} }
...@@ -52,6 +52,7 @@ export interface Order { ...@@ -52,6 +52,7 @@ export interface Order {
orderStatus: number; orderStatus: number;
pickupAddress: string; pickupAddress: string;
pickupLocation: object; pickupLocation: object;
paymentMethod: any;
bookDate: any; bookDate: any;
orderDate: any; orderDate: any;
custId: string; custId: string;
......
...@@ -14,6 +14,8 @@ export interface Products { ...@@ -14,6 +14,8 @@ export interface Products {
shopperId: string; shopperId: string;
qty: number; qty: number;
shopper: string; shopper: string;
centerId: string;
centerRef: any;
size: string[]; size: string[];
skuCode: string; skuCode: string;
status: boolean; status: boolean;
......
...@@ -7,6 +7,7 @@ export interface User { ...@@ -7,6 +7,7 @@ export interface User {
profilePhoto: string; profilePhoto: string;
emailVerified: boolean; emailVerified: boolean;
status: boolean; status: boolean;
dob: string;
loginType: number; loginType: number;
otp: string; otp: string;
currency: { currency: {
...@@ -27,7 +28,8 @@ export interface Signup { ...@@ -27,7 +28,8 @@ export interface Signup {
// Model for Change Details page // Model for Change Details page
export interface UpdateUserDetails { export interface UpdateUserDetails {
name: string; // name: string;
phoneVerified: boolean;
phone: string; phone: string;
} }
// Model to Update Password // Model to Update Password
......
...@@ -57,12 +57,13 @@ export class UpdateService { ...@@ -57,12 +57,13 @@ export class UpdateService {
const postData: UpdateUserDetails = { const postData: UpdateUserDetails = {
phone: userData.phone, phone: userData.phone,
name: userData.name phoneVerified: false
// name: userData.name
}; };
const updateOldData = { const updateOldData = {
...oldData, ...oldData,
phone: userData.phone, phone: userData.phone
name: userData.name // name: userData.name
}; };
this.userPostData = postData; this.userPostData = postData;
......
...@@ -39,6 +39,7 @@ export class UserService { ...@@ -39,6 +39,7 @@ export class UserService {
status: item.status, status: item.status,
phoneVerified: item.phoneVerified, phoneVerified: item.phoneVerified,
emailVerified: item.emailVerified, emailVerified: item.emailVerified,
dob: item.dob,
loginType: 0, loginType: 0,
otp: '', otp: '',
currency: { currency: {
......
...@@ -69,6 +69,8 @@ export class WishService { ...@@ -69,6 +69,8 @@ export class WishService {
prodCode: item.prodCode, prodCode: item.prodCode,
prodDesc: item.prodDesc, prodDesc: item.prodDesc,
prodStatus: item.prodStatus, prodStatus: item.prodStatus,
centerId: item.centerId,
centerRef: item.center,
rating: item.rating, rating: item.rating,
skuCode: item.skuCode, skuCode: item.skuCode,
status: item.status, status: item.status,
......
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