latest
This commit is contained in:
@@ -14,7 +14,7 @@
|
||||
<div class="col-xs-4">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-body">
|
||||
<button type="submit" class="btn btn-warning btn-block">Place your order
|
||||
<button md-raised-button type="submit " class="btn-block mat-primary">Place your order
|
||||
</button>
|
||||
<p style="font-size: smaller">By placing your order, you agree to Le's Bookstore <a href="#">privacy</a> notice and
|
||||
<a href="#">conditions</a> of use.</p>
|
||||
@@ -66,7 +66,7 @@
|
||||
</h4>
|
||||
</div>
|
||||
<div class="panel-body ">
|
||||
<table class="table " *ngIf="not emptyShippingList ">
|
||||
<table class="table " *ngIf="!emptyShippingList ">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Available Shipping Address</th>
|
||||
@@ -79,7 +79,7 @@
|
||||
{{userShipping.userShippingStreet1}}, {{userShipping.userShippingStreet2}}, {{userShipping.userShippingCity}}, {{userShipping.userShippingState}}
|
||||
</td>
|
||||
<td>
|
||||
<a (click)="setShippingAddress(userShipping) ">use
|
||||
<a class="pointer" (click)="setShippingAddress(userShipping) ">use
|
||||
this address</a>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -107,7 +107,7 @@
|
||||
<div class="form-group ">
|
||||
<label for="shippingState ">* State</label>
|
||||
<select id="shippingState " class="form-control " name="shippingAddressState " [(ngModel)]="shippingAddress.shippingAddressState ">
|
||||
<option value=" " disabled>-- state --</option>
|
||||
<option value="" disabled>-- state --</option>
|
||||
<option *ngFor="let state of stateList ">{{state}}
|
||||
</option>
|
||||
</select>
|
||||
|
||||
@@ -3,6 +3,7 @@ import {AppConst} from '../../constants/app-const';
|
||||
import {Book} from '../../models/book';
|
||||
import {Router} from "@angular/router";
|
||||
import {CartService} from '../../services/cart.service';
|
||||
import {ShippingService} from '../../services/shipping.service';
|
||||
import {CartItem} from '../../models/cart-item';
|
||||
import {ShoppingCart} from '../../models/shopping-cart';
|
||||
import {ShippingAddress} from '../../models/shipping-address';
|
||||
@@ -28,9 +29,12 @@ export class OrderComponent implements OnInit {
|
||||
private userPayment:UserPayment = new UserPayment();
|
||||
private userShipping:UserShipping = new UserShipping();
|
||||
private userBilling: UserBilling = new UserBilling();
|
||||
private userShippingList: UserShipping[] = [];
|
||||
private selectedTab: number;
|
||||
private emptyShippingList: boolean = true;
|
||||
private stateList: string[] = [];
|
||||
|
||||
constructor(private router:Router, private cartService: CartService) { }
|
||||
constructor(private router:Router, private cartService: CartService, private shippingService: ShippingService) { }
|
||||
|
||||
onSelect(book:Book) {
|
||||
this.selectedBook = book;
|
||||
@@ -61,6 +65,16 @@ export class OrderComponent implements OnInit {
|
||||
);
|
||||
}
|
||||
|
||||
setShippingAddress(userShipping: UserShipping) {
|
||||
this.shippingAddress.shippingAddressName = userShipping.userShippingNmae;
|
||||
this.shippingAddress.shippingAddressStreet1 = userShipping.userShippingStreet1;
|
||||
this.shippingAddress.shippingAddressStreet2 = userShipping.userShippingStreet2;
|
||||
this.shippingAddress.shippingAddressCity = userShipping.userShippingCity;
|
||||
this.shippingAddress.shippingAddressState = userShipping.userShippingState;
|
||||
this.shippingAddress.shippingAddressCountry = userShipping.userShippingCountry;
|
||||
this.shippingAddress.shippingAddressZipcode = userShipping.userShippingZipcode;
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.getCartItemList();
|
||||
|
||||
@@ -74,6 +88,25 @@ export class OrderComponent implements OnInit {
|
||||
console.log(error.text());
|
||||
}
|
||||
);
|
||||
|
||||
this.shippingService.getUserShippingList().subscribe(
|
||||
res=>{
|
||||
console.log(res.json());
|
||||
this.userShippingList=res.json();
|
||||
this.emptyShippingList = false;
|
||||
},
|
||||
error=>{
|
||||
console.log(error.text());
|
||||
}
|
||||
);
|
||||
|
||||
for (let s in AppConst.usStates) {
|
||||
this.stateList.push(s);
|
||||
}
|
||||
|
||||
this.billingAddress.billingAddressState="";
|
||||
|
||||
this.shippingAddress.shippingAddressState="";
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -19,6 +19,16 @@ export class ShippingService {
|
||||
return this.http.post(url, JSON.stringify(shipping), {headers : tokenHeader});
|
||||
}
|
||||
|
||||
getUserShippingList() {
|
||||
let url = this.serverPath+"/shipping/getUserShippingList";
|
||||
|
||||
let tokenHeader = new Headers ({
|
||||
'Content-Type': 'application/json',
|
||||
'x-auth-token' : localStorage.getItem("xAuthToken")
|
||||
});
|
||||
return this.http.get(url, {headers : tokenHeader});
|
||||
}
|
||||
|
||||
removeShipping(id: number) {
|
||||
let url = this.serverPath+"/shipping/remove";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user