Commit 2687a883 by Arjun

Merge branch 'master' into arjunlatest

parents 80e14d79 a01b6e82
......@@ -68,7 +68,8 @@
<p class="textLeft">Total Price:</p>
</ion-col>
<ion-col>
<p class="textRight">A$ {{service.formatNumber(cartService.cartTotal.toFixed(2))}}
<p class="textRight">A$
{{service.formatNumber(cartService.cartTotal.toFixed(2))}}
</p>
</ion-col>
</ion-row>
......@@ -113,7 +114,8 @@
<ion-row>
<ion-col class="p0">
<h6>
{{addressService.custAddress.building}},<br /> {{addressService.custAddress.landmark}},
{{addressService.custAddress.building}},<br />
{{addressService.custAddress.landmark}},
<br /> {{addressService.custAddress.address}}
</h6>
</ion-col>
......@@ -133,7 +135,8 @@
</label>
</div> -->
<div class="payment_method">
<input type="radio" name="payments" id="paypal" name="radio-group" (click)="getwaypaypal()" checked="true" />
<input type="radio" name="payments" id="paypal" name="radio-group"
(click)="getwaypaypal()" checked="true" />
<label for="paypal">
<p>PayPal</p>
</label>
......@@ -142,7 +145,8 @@
<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()" />
<input type="radio" name="payments" id="afterpay" name="radio-group"
(click)="getwayafterpay()" />
<label for="afterpay">
<p>AfterPay</p>
</label>
......@@ -152,7 +156,8 @@
<input class="cv_number" placeholder="CVV" />
</div> -->
<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">
<p>PayK</p>
</label>
......@@ -178,7 +183,8 @@
<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)">
<input class="" placeholder="COUPON CODE: GET50" #promo /><button
class="add_btn apply_btn" (click)="promoApply(promo.value)">
APPLY
</button>
</div>
......@@ -252,7 +258,8 @@
</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);">
<div class="footer_btn" *ngIf="cartService.carts && cartService.carts.length > 0" [hidden]="currentIndex != 1"
(click)="next(2);">
PAY
</div>
......@@ -283,7 +290,8 @@
</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-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-map>
<div class="add_address_wrapper">
......@@ -292,12 +300,16 @@
<span class="floatRight" (click)="istoggle(); goToPage('nearby')">ADD NEW</span>
<div class="clear"></div>
</h5>
<ul *ngIf="addressService.nearestList && addressService.nearestList.length > 0">
<li *ngFor="let address of addressService.nearestList; let i = index" class="no-devlivery">
<h4>DELIVERS TO</h4>
<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">NO DELIVERS TO</h4>
<div class="floatLeft">
{{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>
</div>
<div class="floatLeft">
......@@ -308,7 +320,8 @@
<div class="clear"></div>
</li>
</ul>
<div class="textCenter" *ngIf="addressService.nearestList && addressService.nearestList.length === 0">No Address Found in the nearest center</div>
<div class="textCenter" *ngIf="addressService.addressList && addressService.addressList.length === 0">No
Address Found</div>
</div>
<!-- <div class="loader" *ngIf="loader">
......
......@@ -183,7 +183,7 @@ export class CartPage implements OnInit {
setDefault(addressId: any, index: number) {
console.log('loading....');
this.loader = true;
this.addressService.custAddress = this.addressService.nearestList[index];
this.addressService.custAddress = this.addressService.addressList[index];
console.log(this.custAddress);
this.istoggle();
setTimeout(() => {
......@@ -200,32 +200,36 @@ export class CartPage implements OnInit {
console.log(index);
if (index === 2) {
if (this.addressService.custAddress !== undefined) {
const otherCharges = {
deliveryCharge: this.deliveryCharge,
taxAmount: this.taxAmount,
discount: this.discount,
discountApplied: this.discountApplied === 1 ? true : false,
totalAmt: this.totalAmt,
custAddress: this.addressService.custAddress,
paymentMethod: this.paymentMethod
};
const state = this.orderService
.checkOut(
this.cartService.carts,
otherCharges,
this.addressService.centerLoc
)
.then(data => {
this.cartService.cartCenter = '';
const cartCount = this.orderService.cartCount;
const timer = (cartCount - 1) * 20 + 60;
const totalTime = this.add_minutes(timer);
console.log('ready for slide');
this.timeinterval = setInterval(() => {
This.getDeliveryTime(totalTime.getTime());
}, 1000);
this.slides.slideNext();
});
if (this.addressService.custAddress.nearest === true) {
const otherCharges = {
deliveryCharge: this.deliveryCharge,
taxAmount: this.taxAmount,
discount: this.discount,
discountApplied: this.discountApplied === 1 ? true : false,
totalAmt: this.totalAmt,
custAddress: this.addressService.custAddress,
paymentMethod: this.paymentMethod
};
const state = this.orderService
.checkOut(
this.cartService.carts,
otherCharges,
this.addressService.centerLoc
)
.then(data => {
this.cartService.cartCenter = '';
const cartCount = this.orderService.cartCount;
const timer = (cartCount - 1) * 20 + 60;
const totalTime = this.add_minutes(timer);
console.log('ready for slide');
this.timeinterval = setInterval(() => {
This.getDeliveryTime(totalTime.getTime());
}, 1000);
this.slides.slideNext();
});
} else {
this.service.showToast('Not delivered to the selected location', 'top', 'my-error', 1000);
}
} else {
this.istoggle();
}
......@@ -321,7 +325,8 @@ export class CartPage implements OnInit {
}
this.discount.toFixed(2);
} else {
this.discountApplied = 2;
this.discountApplied = 0;
this.discount = 0;
}
});
}
......
......@@ -120,12 +120,14 @@ export class NearbyPage implements OnInit {
mapReady(map) {
map.addListener('dragend', () => {
console.log(this.newCenterLat, this.newCenterLng);
this.getAddress(this.newCenterLat, this.newCenterLng);
});
}
centerChange(e) {
console.log(e);
this.newCenterLat = e.lat;
this.newCenterLng = e.lng;
this.getAddress(this.newCenterLat, this.newCenterLng);
}
goToPage(path, data = null) {
......
......@@ -42,7 +42,8 @@ export class AddressService {
defaultVal: item.defaultVal,
building: item.building,
landmark: item.landmark,
addressId: item.addressId
addressId: item.addressId,
nearest: false
};
this.addressList.push(address);
});
......@@ -72,7 +73,8 @@ export class AddressService {
defaultVal: item.defaultVal,
building: item.building,
landmark: item.landmark,
addressId: item.addressId
addressId: item.addressId,
nearest: false
};
this.defaultAdd = address;
console.log(this.defaultAdd);
......@@ -203,7 +205,8 @@ export class AddressService {
defaultVal: item.defaultVal,
building: item.building,
landmark: item.landmark,
addressId: item.addressId
addressId: item.addressId,
nearest: true
};
this.nearestList.push(address);
});
......@@ -212,6 +215,23 @@ export class AddressService {
} else {
// alert('No Orders Found');
}
if (this.addressList.length > 0 && this.nearestList.length > 0) {
this.addressList.forEach((address) => {
const index = this.nearestList.findIndex(x => x.addressId === address.addressId);
if (index >= 0) {
address.nearest = true;
}
});
}
console.log(this.addressList);
this.addressList = this.addressList.sort((a: any, b: any) => {
return b.nearest - a.nearest;
});
console.log(this.addressList);
});
} else {
console.log('No such document!');
......
......@@ -22,4 +22,5 @@ export interface AddressList {
building: string;
latLng: any;
landmark: string;
nearest: boolean;
}
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