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>
......
......@@ -6,8 +6,8 @@
<ion-row class="no-gutter">
<ion-col class="no-gutter" size="2">
<button class="nav_btn nav_back_white floatLeft" (click)="goBack()">
<img src="../assets/arrow_white.png" />
</button>
<img src="../assets/arrow_white.png" />
</button>
</ion-col>
<ion-col class="no-gutter" size="8">
<div class="nav_title floatLeft">
......@@ -86,31 +86,27 @@
<h5>
<span class="floatLeft">ITEMS</span>
<span class="floatRight" *ngIf="cartService.cartTotal">A$
{{service.formatNumber(cartService.cartTotal.toFixed(2))}}</span
>
<div class="clear"></div>
</h5>
<ion-grid
class="p0"
*ngIf="cartService.carts && cartService.carts.length > 0"
>
<ion-row *ngFor="let carts of cartService.carts">
<ion-col size="6" class="p0">
<h6 class="textLeft">{{unEscape(carts.prodName)}}</h6>
</ion-col>
<ion-col size="2" class="p0">
<h6 class="textRight"><strong>{{carts.qty}} X</strong></h6>
</ion-col>
<ion-col size="4" class="p0">
<h6 class="textRight">
<strong>A$ {{service.formatNumber(carts.price)}}</strong>
</h6>
</ion-col>
</ion-row>
</ion-grid>
<hr />
<h5>
<span class="floatLeft">DELIVERY</span>
{{service.formatNumber(cartService.cartTotal.toFixed(2))}}</span>
<div class="clear"></div>
</h5>
<ion-grid class="p0" *ngIf="cartService.carts && cartService.carts.length > 0">
<ion-row *ngFor="let carts of cartService.carts">
<ion-col size="6" class="p0">
<h6 class="textLeft">{{unEscape(carts.prodName)}}</h6>
</ion-col>
<ion-col size="2" class="p0">
<h6 class="textRight"><strong>{{carts.qty}} X</strong></h6>
</ion-col>
<ion-col size="4" class="p0">
<h6 class="textRight">
<strong>A$ {{service.formatNumber(carts.price)}}</strong>
</h6>
</ion-col>
</ion-row>
</ion-grid>
<hr />
<h5>
<span class="floatLeft">DELIVERY</span>
<span class="floatRight" (click)="istoggle()">CHANGE</span>
<div class="clear"></div>
</h5>
......@@ -118,58 +114,63 @@
<ion-row>
<ion-col class="p0">
<h6>
{{addressService.custAddress.building}},<span *ngIf="addressService.custAddress.landmark && addressService.custAddress.landmark!==''">{{addressService.custAddress.landmark}},</span
>
<br />
{{addressService.custAddress.address}}
</h6>
</ion-col>
</ion-row>
</ion-grid>
<hr />
<h5>
<span class="floatLeft">PAYMENT</span>
<!-- <span class="floatRight">CHANGE</span> -->
<div class="clear"></div>
</h5>
<div class="payment_method">
<input type="radio" name="payments" id="cod" name="radio-group" checked="true" (click)="getwaycod()" />
<label for="cod">
<p>Credit Card</p>
</label>
</div>
<div class="payment_method">
<input type="radio" name="payments" id="paypal" name="radio-group" (click)="getwaypaypal()" />
<label for="paypal">
<p>PayPal</p>
</label>
</div>
<!-- <div class="card_div" [hidden]="gateway !=1">
{{addressService.custAddress.building}}<span
*ngIf="addressService.custAddress.landmark && addressService.custAddress.landmark!==''">,
{{addressService.custAddress.landmark}}</span>
<!-- <br />
{{addressService.custAddress.address}} -->
</h6>
</ion-col>
</ion-row>
</ion-grid>
<hr />
<h5>
<span class="floatLeft">PAYMENT</span>
<!-- <span class="floatRight">CHANGE</span> -->
<div class="clear"></div>
</h5>
<div class="payment_method">
<input type="radio" name="payments" id="cod" name="radio-group" checked="true"
(click)="getwaycod()" />
<label for="cod">
<p>Credit Card</p>
</label>
</div>
<div class="payment_method">
<input type="radio" name="payments" id="paypal" name="radio-group"
(click)="getwaypaypal()" />
<label for="paypal">
<p>PayPal</p>
</label>
</div>
<!-- <div class="card_div" [hidden]="gateway !=1">
<input class="card_no borderNone widthFull" placeholder="PayPal ID" />
</div> -->
<div class="payment_method">
<input type="radio" name="payments" id="afterpay" name="radio-group" (click)="getwayafterpay()" />
<label for="afterpay">
<p>AfterPay</p>
</label>
</div>
<!-- <div class="card_div" [hidden]="gateway !=2">
<div class="payment_method">
<input type="radio" name="payments" id="afterpay" name="radio-group"
(click)="getwayafterpay()" />
<label for="afterpay">
<p>AfterPay</p>
</label>
</div>
<!-- <div class="card_div" [hidden]="gateway !=2">
<input class="card_no" placeholder="**** **** **** 1458" />
<input class="cv_number" placeholder="CVV" />
</div> -->
<div class="payment_method">
<input type="radio" name="payments" id="payk" name="radio-group" (click)="getwaypayk()" />
<label for="payk">
<p>PayK</p>
</label>
</div>
<!-- <div class="card_div" [hidden]="gateway !=3">
<div class="payment_method">
<input type="radio" name="payments" id="payk" name="radio-group"
(click)="getwaypayk()" />
<label for="payk">
<p>PayK</p>
</label>
</div>
<!-- <div class="card_div" [hidden]="gateway !=3">
<input
class="card_no borderNone widthFull"
placeholder="PafyK ID"
/>
</div> -->
<!-- <div class="delivery_time">
<!-- <div class="delivery_time">
<ul>
<li>
Delivery 10 Mnt<br>
......@@ -181,202 +182,162 @@
</li>
</ul>
</div> -->
<hr />
<div class="coupon_code">
<div class="promo-row">
<input class="" placeholder="COUPON CODE: GET50" #promo /><button class="add_btn apply_btn" (click)="promoApply(promo.value)">
APPLY
</button>
</div>
<span *ngIf="discountApplied == 1" class="promo-success">Promocode applied successfully
</span>
<span *ngIf="discountApplied == 2" class="promo-error">Invalid Promocode</span
>
</div>
<hr />
<div class="coupon_code">
<div class="promo-row">
<input class="" placeholder="COUPON CODE: GET50" #promo /><button
class="add_btn apply_btn" (click)="promoApply(promo.value)">
APPLY
</button>
</div>
<span *ngIf="discountApplied == 1" class="promo-success">Promocode applied successfully
</span>
<span *ngIf="discountApplied == 2" class="promo-error">Invalid Promocode</span>
</div>
<br />
<br />
<h6>
<span class="floatLeft">PRODUCT COST</span>
<span class="floatRight" *ngIf="cartService.cartTotal">A$
{{service.formatNumber(cartService.cartTotal.toFixed(2))}}</span
>
<div class="clear"></div>
</h6>
<h6>
<span class="floatLeft">PRODUCT COST</span>
<span class="floatRight" *ngIf="cartService.cartTotal">A$
{{service.formatNumber(cartService.cartTotal.toFixed(2))}}</span>
<div class="clear"></div>
</h6>
<h6>
<span class="floatLeft">DELIVERY CHARGE</span>
<span class="floatRight" *ngIf="cartService.cartTotal">A$
{{service.formatNumber(getDeliveryCharge(cartService.cartTotal))}}</span
>
<div class="clear"></div>
</h6>
<h6>
<span class="floatLeft">GST/TAX</span>
<span class="floatRight" *ngIf="cartService.cartTotal">A$
{{service.formatNumber(getTax(cartService.cartTotal))}}</span
>
<div class="clear"></div>
</h6>
<h6 *ngIf="discountApplied">
<span class="floatLeft">DISCOUNT</span>
<span class="floatRight">(-) A$ {{service.formatNumber(discount)}}</span
>
<div class="clear"></div>
</h6>
<hr />
<div class="total_div">
<ion-row>
<ion-col>
<p class="textLeft">Total Price:</p>
</ion-col>
<ion-col>
<p class="textRight" *ngIf="cartService.cartTotal">
A$
{{service.formatNumber(getTotal(cartService.cartTotal))}}
</p>
</ion-col>
</ion-row>
</div>
</div>
</ion-slide>
<ion-slide>
<div class="order_placed_div">
<img src="../assets/[email protected]" />
<h4>Order Placed</h4>
<p>{{bookDate}}</p>
<h3>Your order is due for delivery in</h3>
<h1>{{deliveryTime}}</h1>
<button class="view_order" (click)="goToPage('myorder')">
VIEW ORDERS</button
><br />
<button class="home_btn" (click)="goToPage('home')">HOME</button>
<h6>
<span class="floatLeft">DELIVERY CHARGE</span>
<span class="floatRight" *ngIf="cartService.cartTotal">A$
{{service.formatNumber(getDeliveryCharge(cartService.cartTotal))}}</span>
<div class="clear"></div>
</h6>
<h6>
<span class="floatLeft">GST/TAX</span>
<span class="floatRight" *ngIf="cartService.cartTotal">A$
{{service.formatNumber(getTax(cartService.cartTotal))}}</span>
<div class="clear"></div>
</h6>
<h6 *ngIf="discountApplied">
<span class="floatLeft">DISCOUNT</span>
<span class="floatRight">(-) A$ {{service.formatNumber(discount)}}</span>
<div class="clear"></div>
</h6>
<hr />
<div class="total_div">
<ion-row>
<ion-col>
<p class="textLeft">Total Price:</p>
</ion-col>
<ion-col>
<p class="textRight" *ngIf="cartService.cartTotal">
A$
{{service.formatNumber(getTotal(cartService.cartTotal))}}
</p>
</ion-col>
</ion-row>
</div>
</div>
</ion-slide>
<ion-slide>
<div class="order_placed_div">
<img src="../assets/[email protected]" />
<h4>Order Placed</h4>
<p>{{bookDate}}</p>
<h3>Your order is due for delivery in</h3>
<h1>{{deliveryTime}}</h1>
<button class="view_order" (click)="goToPage('myorder')">
VIEW ORDERS</button><br />
<button class="home_btn" (click)="goToPage('home')">HOME</button>
</div>
</ion-slide>
</ion-slides>
</div>
</ion-slide>
</ion-slides>
</div>
</div>
</div>
</div>
</ion-content>
<ion-footer class="hide-on-keyboard-open">
<div
class="footer_btnbay"
*ngIf="cartService.carts && cartService.carts.length > 0"
[hidden]="currentIndex != 0"
>
<div class="continue" (click)="goToPage('productlist')">
CONTINUE SHOPPING
<div class="footer_btnbay" *ngIf="cartService.carts && cartService.carts.length > 0" [hidden]="currentIndex != 0">
<div class="continue" (click)="goToPage('productlist')">
CONTINUE SHOPPING
</div>
<div class="checkout" (click)="next(1)">CHECKOUT</div>
</div>
<div class="footer_btn" *ngIf="cartService.carts && cartService.carts.length > 0" [hidden]="currentIndex != 1"
(click)="next(2);">
PAY
</div>
<div class="checkout" (click)="next(1)">CHECKOUT</div>
</div>
<div
class="footer_btn"
*ngIf="cartService.carts && cartService.carts.length > 0"
[hidden]="currentIndex != 1"
(click)="next(2);"
>
PAY
</div>
</ion-footer>
<div class="loader" *ngIf="loader">
<div class="lds-ripple">
<div></div>
<div></div>
</div>
<div class="lds-ripple">
<div></div>
<div></div>
</div>
</div>
<div *ngIf="isShow" [@slideInOut]>
<div class="nav_header">
<ion-grid class="no-gutter">
<ion-row class="no-gutter">
<ion-col class="no-gutter" size="2">
<button class="nav_btn nav_back floatLeft" (click)="istoggle();">
<img src="../assets/Group17_2.png" />
</button>
</ion-col>
<ion-col class="no-gutter" size="8">
<div class="nav_title floatLeft">
<h4>CHANGE LOCATION</h4>
</div>
</ion-col>
<ion-col class="no-gutter" size="2"></ion-col>
</ion-row>
</ion-grid>
</div>
<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-marker
[latitude]="lat"
[longitude]="lng"
[iconUrl]="
<div class="nav_header">
<ion-grid class="no-gutter">
<ion-row class="no-gutter">
<ion-col class="no-gutter" size="2">
<button class="nav_btn nav_back floatLeft" (click)="istoggle();">
<img src="../assets/Group17_2.png" />
</button>
</ion-col>
<ion-col class="no-gutter" size="8">
<div class="nav_title floatLeft">
<h4>CHANGE LOCATION</h4>
</div>
</ion-col>
<ion-col class="no-gutter" size="2"></ion-col>
</ion-row>
</ion-grid>
</div>
<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-marker [latitude]="lat" [longitude]="lng" [iconUrl]="
{
url: './assets/pin-2.svg',
scaledSize: {
width: 28,
height: 40
}}"
></agm-marker>
</agm-map>
<div class="add_address_wrapper">
<h5>
<span class="floatLeft">SELECT ADDRESS</span>
<span class="floatRight" (click)="istoggle(); goToPage('nearby')">ADD NEW</span
>
<div class="clear"></div>
</h5>
<ul
*ngIf="addressService.addressList && addressService.addressList.length > 0"
>
<li
*ngFor="let address of addressService.addressList; let i = index"
[ngClass]="{'no-devlivery': !address.nearest}"
>
<h4 *ngIf="address.nearest === true">DELIVERS TO</h4>
<h4 *ngIf="address.nearest === false">DOES NOT DELIVER TO</h4>
<div>
{{address.default}}
<input
class="styled-checkbox"
name="addressId"
id="styled-checkbox-{{i}}"
type="radio"
(click)="setDefault(address.addressId, i)"
[value]="address.addressId"
#addressType
/>
<label for="styled-checkbox-{{i}}"> {{address.addressType}} </label>
</div>
<div>
<p>
{{address.building}},
<span *ngIf="address.landmark && address.landmark!==''"
>{{address.landmark}},</span
>
<!-- {{address.address}} -->
</p>
</div>
<div class="clear"></div>
</li>
</ul>
<div
class="textCenter"
*ngIf="addressService.addressList && addressService.addressList.length === 0"
>
No Address Found
</div>
</div>
<!-- <div class="loader" *ngIf="loader">
}}"></agm-marker>
</agm-map>
<div class="add_address_wrapper">
<h5>
<span class="floatLeft">SELECT ADDRESS</span>
<span class="floatRight" (click)="istoggle(); goToPage('nearby')">ADD NEW</span>
<div class="clear"></div>
</h5>
<ul *ngIf="addressService.addressList && addressService.addressList.length > 0">
<li *ngFor="let address of addressService.addressList; let i = index"
[ngClass]="{'no-devlivery': !address.nearest}">
<h4 *ngIf="address.nearest === true">DELIVERS TO</h4>
<h4 *ngIf="address.nearest === false">DOES NOT DELIVER TO</h4>
<div>
{{address.default}}
<input class="styled-checkbox" name="addressId" id="styled-checkbox-{{i}}" type="radio"
(click)="setDefault(address.addressId, i)" [value]="address.addressId" #addressType />
<label for="styled-checkbox-{{i}}"> {{address.addressType}} </label>
</div>
<div>
<p>
{{address.building}},
<span *ngIf="address.landmark && address.landmark!==''">{{address.landmark}},</span>
<!-- {{address.address}} -->
</p>
</div>
<div class="clear"></div>
</li>
</ul>
<div class="textCenter" *ngIf="addressService.addressList && addressService.addressList.length === 0">
No Address Found
</div>
</div>
<!-- <div class="loader" *ngIf="loader">
<div class="lds-ripple">
<div></div>
<div></div>
</div>
</div> -->
</ion-content>
</ion-content>
</div>
\ No newline at end of file
......@@ -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