This commit is contained in:
Le Deng
2017-03-10 18:23:09 -05:00
parent 59c7301aae
commit 9ccb1c2659
3 changed files with 29 additions and 8 deletions

View File

@@ -237,9 +237,11 @@
</div>
</div>
<!-- CREDIT CARD FORM ENDS HERE -->
<div class="checkbox ">
<div class="checkbox">
<label>
<input id="theSameAsShippingAddress " type="checkbox " name="billingSameAsShipping " value="true " /> The same as shipping address
<input id="theSameAsShippingAddress" type="checkbox"
name="billingSameAsShipping" value="true" (click)="setBillingAsShipping($event.target.checked)" /> The same as shipping
address
</label>
</div>
<div class="form-group ">

View File

@@ -94,7 +94,6 @@ export class OrderComponent implements OnInit {
this.payment.cvc = userPayment.cvc;
this.payment.holderName = userPayment.holderName;
this.payment.defaultPayment = userPayment.defaultPayment;
this.payment.billingAddress.billingAddressName = userPayment.userBilling.userBillingName;
this.payment.billingAddress.billingAddressStreet1 = userPayment.userBilling.userBillingStreet1;
this.payment.billingAddress.billingAddressStreet2 = userPayment.userBilling.userBillingStreet2;
this.payment.billingAddress.billingAddressCity = userPayment.userBilling.userBillingCity;
@@ -103,6 +102,26 @@ export class OrderComponent implements OnInit {
this.payment.billingAddress.billingAddressZipcode = userPayment.userBilling.userBillingZipcode;
}
setBillingAsShipping(checked:boolean){
console.log("same as shipping")
if(checked) {
this.billingAddress.billingAddressStreet1 = this.shippingAddress.shippingAddressStreet1;
this.billingAddress.billingAddressStreet2 = this.shippingAddress.shippingAddressStreet2;
this.billingAddress.billingAddressCity = this.shippingAddress.shippingAddressCity;
this.billingAddress.billingAddressState = this.shippingAddress.shippingAddressState;
this.billingAddress.billingAddressCountry = this.shippingAddress.shippingAddressCountry;
this.billingAddress.billingAddressZipcode = this.shippingAddress.shippingAddressZipcode;
} else {
this.billingAddress.billingAddressStreet1 = "";
this.billingAddress.billingAddressStreet2 = "";
this.billingAddress.billingAddressCity = "";
this.billingAddress.billingAddressState = "";
this.billingAddress.billingAddressCountry = "";
this.billingAddress.billingAddressZipcode = "";
}
}
ngOnInit() {
this.getCartItemList();