This commit is contained in:
Le Deng
2017-03-09 08:42:58 -05:00
parent e9304c950a
commit d9e6af4125
4 changed files with 107 additions and 10 deletions

View File

@@ -134,10 +134,10 @@
</option>
</component>
<component name="ProjectFrameBounds">
<option name="x" value="82" />
<option name="y" value="23" />
<option name="width" value="1280" />
<option name="height" value="797" />
<option name="x" value="71" />
<option name="y" value="38" />
<option name="width" value="1663" />
<option name="height" value="961" />
</component>
<component name="ProjectView">
<navigator currentView="ProjectPane" proportions="" version="1">
@@ -914,15 +914,15 @@
<workItem from="1486538831944" duration="450000" />
<workItem from="1488378219247" duration="650000" />
<workItem from="1488461561430" duration="18419000" />
<workItem from="1488731165185" duration="19617000" />
<workItem from="1488731165185" duration="19699000" />
</task>
<servers />
</component>
<component name="TimeTrackingManager">
<option name="totallyTimeSpent" value="81629000" />
<option name="totallyTimeSpent" value="81711000" />
</component>
<component name="ToolWindowManager">
<frame x="82" y="23" width="1280" height="797" extended-state="0" />
<frame x="71" y="38" width="1663" height="961" extended-state="0" />
<editor active="true" />
<layout>
<window_info id="Palette" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
@@ -946,7 +946,7 @@
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="8" side_tool="false" content_ui="tabs" />
<window_info id="Spring" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32907802" sideWeight="0.5" order="9" side_tool="false" content_ui="tabs" />
<window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="10" side_tool="false" content_ui="tabs" />
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.31744748" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.24244294" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
<window_info id="Bean Validation" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="8" side_tool="false" content_ui="tabs" />
<window_info id="Theme Preview" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="9" side_tool="false" content_ui="tabs" />
<window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="true" content_ui="tabs" />

View File

@@ -74,7 +74,7 @@
<br>
<div>
<p *ngIf="defaultPaymentSet">Default payment set successfully!</p>
<md-tab-group (selectedIndexChange)="selectedIndexChange($event)" [selectedIndex]="selectedBillingTab">
<md-tab-group (selectedIndexChange)="selectedIndexChange($event)" [selectedIndex]="selectedBillingTab">
<md-tab label="List of Credit Cards">
<form (ngSubmit)="setDefaultPayment()" method="post">
<table class="table">
@@ -248,6 +248,88 @@
</div>
</md-tab>
<md-tab label="Shipping">
<br>
<br>
<div>
<p *ngIf="defaultShippingSet">Default shipping address set successfully!</p>
<md-tab-group (selectedIndexChange)="selectedIndexChange($event)" [selectedIndex]="selectedShippingTab">
<md-tab label="List of Shipping Addresses">
<form (ngSubmit)="setDefaultShipping()" method="post">
<table class="table">
<thead>
<tr>
<th>Default</th>
<th>Shipping Address</th>
<th>Operations</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let userShipping of userShippingList">
<td>
<input type="radio" name="defaultUserShippingId" [(ngModel)]="defaultUserShippingId" [value]="userShipping.id" />
<span>default</span>
</td>
<td>Shipping Address</td>
<td>
<a md-button (click)="onUpdateShipping(userShipping)"><i
class="fa fa-pencil"></i></a>
<a md-button (click)="onRemoveShipping(userShipping.id)"><i
class="fa fa-times"></i></a>
</td>
</tr>
</tbody>
</table>
<button md-raised-button class="mat-primary" type="submit">Save</button>
</form>
</md-tab>
<md-tab label="Add(Update) Shipping Address">
<form (ngSubmit)="onNewShippingAddress()" method="post">
<input hidden="hidden" name="id" [(ngModel)]="userShipping.id" />
<!--Shipping Address-->
<div class="form-group">
<h4>Shipping Address</h4>
</div>
<div class="form-group">
<label for="shippingName">* Name</label>
<input type="text" class="form-control" id="shippingName" required="required" placeholder="Recevier Name" name="userShippingName" [(ngModel)]="userShipping.userShippingName" />
</div>
<div class="form-group">
<label for="shippingAddress">* Street Address</label>
<input type="text" class="form-control" id="shippingAddress" required="required" placeholder="Street Address 1" name="userShippingStreet1" [(ngModel)]="userShipping.userShippingStreet1" />
</div>
<div class="form-group">
<input type="text" class="form-control" placeholder="Street Address 2" name="userShippingStreet2" [(ngModel)]="userShipping.userShippingStreet2" />
</div>
<div class="row">
<div class="col-xs-4">
<div class="form-group">
<label for="shippingCity">* City</label>
<input type="text" class="form-control" id="shippingCity" required="required" placeholder="Your Shipping City" name="userShippingCity" [(ngModel)]="userShipping.userShippingCity" />
</div>
</div>
<div class="col-xs-4">
<div class="form-group">
<label for="shippingState">* State</label>
<select id="shippingState" class="form-control" name="userShippingState" [(ngModel)]="userShipping.userShippingState" required="required">
<option value="" disabled>-- state --</option>
<option *ngFor="let state of stateList">{{state}}
</option>
</select>
</div>
</div>
<div class="col-xs-4">
<div class="form-group">
<label for="shippingZipcode">* Zipcode</label>
<input type="text" class="form-control" id="shippingZipcode" required="required" placeholder="Zipcode" name="userShippingZipcode" [(ngModel)]="userShipping.userShippingZipcode" />
</div>
</div>
</div>
<hr/>
<button type="submit" class="btn btn-primary btn-lg">Save All</button>
</form>
</md-tab>
</md-tab-group>
</div>
</md-tab>
</md-tab-group>
</div>

View File

@@ -7,6 +7,7 @@ import {PaymentService} from "../../services/payment.service";
import {User} from '../../models/user';
import {UserPayment} from '../../models/user-payment';
import {UserBilling} from '../../models/user-billing';
import {UserShipping} from '../../models/user-shipping';
@Component({
selector: 'app-my-profile',
@@ -35,6 +36,7 @@ export class MyProfileComponent implements OnInit {
private userBilling: UserBilling = new UserBilling();
private userPaymentList: UserPayment[] = [];
private stateList: string[] = [];
private userShipping: UserShipping = new UserShipping();
private selectedProfileTab:number = 0;
private selectedBillingTab:number = 0;
@@ -187,6 +189,7 @@ export class MyProfileComponent implements OnInit {
this.userPayment.expiryYear="";
this.userPayment.userBilling = this.userBilling;
this.defaultPaymentSet=false;
this.userShipping.userShippingState="";
}
}

View File

@@ -0,0 +1,12 @@
export class UserShipping {
public id: number;
public userShippingNmae: string;
public userShippingStreet1: string;
public userShippingStreet2: string;
public userShippingCity: string;
public userShippingState: string;
public userShippingCountry: string;
public userShippingZipcode: string;
public userShippingDefault: boolean;
}