|
|
|
@ -22,47 +22,87 @@
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<form *ngIf="cartItems.length != 0" [formGroup]="checkoutForm" class="cart-payment-from" (ngSubmit)="onSubmit()">
|
|
|
|
|
<form *ngIf="cartItems.length != 0" #checkoutForm="ngForm" class="cart-payment-from" (ngSubmit)="onSubmit()">
|
|
|
|
|
<mat-form-field class="from-input" appearance="outline">
|
|
|
|
|
<mat-label>First Name</mat-label>
|
|
|
|
|
<input matInput formControlName="firstname">
|
|
|
|
|
<mat-error *ngIf="checkoutForm.get('firstname')?.hasError('required')">
|
|
|
|
|
<input
|
|
|
|
|
matInput
|
|
|
|
|
type="text"
|
|
|
|
|
name="firstname"
|
|
|
|
|
[ngModel]="firstname"
|
|
|
|
|
(ngModelChange)="firstname = $event"
|
|
|
|
|
required
|
|
|
|
|
/>
|
|
|
|
|
<mat-error *ngIf="checkoutForm.controls['firstname']?.errors?.['required']">
|
|
|
|
|
First Name is <strong>required</strong>
|
|
|
|
|
</mat-error>
|
|
|
|
|
</mat-form-field>
|
|
|
|
|
|
|
|
|
|
<mat-form-field class="from-input" required appearance="outline">
|
|
|
|
|
<mat-label>Last Name</mat-label>
|
|
|
|
|
<input matInput formControlName="lastname">
|
|
|
|
|
<mat-error *ngIf="checkoutForm.get('lastname')?.hasError('required')">
|
|
|
|
|
<input
|
|
|
|
|
matInput
|
|
|
|
|
type="text"
|
|
|
|
|
name="lastname"
|
|
|
|
|
[ngModel]="lastname"
|
|
|
|
|
(ngModelChange)="lastname = $event"
|
|
|
|
|
required
|
|
|
|
|
/>
|
|
|
|
|
<mat-error *ngIf="checkoutForm.controls['lastname']?.errors?.['required']">
|
|
|
|
|
Last Name is <strong>required</strong>
|
|
|
|
|
</mat-error>
|
|
|
|
|
</mat-form-field>
|
|
|
|
|
|
|
|
|
|
<mat-form-field class="from-input" appearance="outline">
|
|
|
|
|
<mat-label>Email</mat-label>
|
|
|
|
|
<input type="email" matInput formControlName="email" placeholder="Ex. pat@example.com">
|
|
|
|
|
<mat-error *ngIf="checkoutForm.get('email')?.hasError('email') && !checkoutForm.get('email')?.hasError('required')">
|
|
|
|
|
<input
|
|
|
|
|
matInput
|
|
|
|
|
type="email"
|
|
|
|
|
name="email"
|
|
|
|
|
[ngModel]="email"
|
|
|
|
|
(ngModelChange)="email = $event"
|
|
|
|
|
placeholder="Ex. pat@example.com"
|
|
|
|
|
pattern="[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,4}$"
|
|
|
|
|
required
|
|
|
|
|
/>
|
|
|
|
|
<mat-error *ngIf="checkoutForm.controls['email']?.errors?.['pattern']">
|
|
|
|
|
Please enter a <strong>valid</strong> email address
|
|
|
|
|
</mat-error>
|
|
|
|
|
<mat-error *ngIf="checkoutForm.get('email')?.hasError('required')">
|
|
|
|
|
<mat-error *ngIf="checkoutForm.controls['email']?.errors?.['required']">
|
|
|
|
|
Email is <strong>required</strong>
|
|
|
|
|
</mat-error>
|
|
|
|
|
</mat-form-field>
|
|
|
|
|
|
|
|
|
|
<mat-form-field class="from-input" appearance="outline">
|
|
|
|
|
<mat-label>Address</mat-label>
|
|
|
|
|
<input matInput formControlName="address" placeholder="Ex. 100 Main St">
|
|
|
|
|
<mat-error *ngIf="checkoutForm.get('address')?.hasError('required')">
|
|
|
|
|
<input
|
|
|
|
|
matInput
|
|
|
|
|
type="text"
|
|
|
|
|
name="address"
|
|
|
|
|
[ngModel]="address"
|
|
|
|
|
(ngModelChange)="address = $event"
|
|
|
|
|
placeholder="Ex. 100 Main St"
|
|
|
|
|
required
|
|
|
|
|
/>
|
|
|
|
|
<mat-error *ngIf="checkoutForm.controls['address']?.errors?.['required']">
|
|
|
|
|
Address is <strong>required</strong>
|
|
|
|
|
</mat-error>
|
|
|
|
|
</mat-form-field>
|
|
|
|
|
|
|
|
|
|
<mat-form-field class="from-input" appearance="outline">
|
|
|
|
|
<mat-form-field class="from-input" appearance="outline" type="number">
|
|
|
|
|
<mat-label>Postal Code</mat-label>
|
|
|
|
|
<input matInput formControlName="postalcode" #postalCode maxlength="5" placeholder="Ex. 94105">
|
|
|
|
|
<mat-error *ngIf="checkoutForm.get('postalcode')?.hasError('required')">
|
|
|
|
|
Postal Code is <strong>required</strong>
|
|
|
|
|
<input
|
|
|
|
|
matInput
|
|
|
|
|
type="number"
|
|
|
|
|
name="postalcode"
|
|
|
|
|
[ngModel]="postalcode"
|
|
|
|
|
(ngModelChange)="postalcode = $event"
|
|
|
|
|
maxlength="5"
|
|
|
|
|
placeholder="Ex. 94105"
|
|
|
|
|
required
|
|
|
|
|
/>
|
|
|
|
|
<mat-error *ngIf="checkoutForm.controls['postalcode']?.errors?.['required']">
|
|
|
|
|
Postal Code is <strong>required number</strong>
|
|
|
|
|
</mat-error>
|
|
|
|
|
</mat-form-field>
|
|
|
|
|
<button mat-raised-button color="primary" type="submit" [disabled]="!checkoutForm.valid">Submit</button>
|
|
|
|
@ -76,3 +116,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!-- <mat-form-field class="from-input" appearance="outline">
|
|
|
|
|
<mat-label>Email</mat-label>
|
|
|
|
|
<input
|
|
|
|
|
type="email"
|
|
|
|
|
matInput
|
|
|
|
|
formControlName="email"
|
|
|
|
|
placeholder="Ex. pat@example.com"
|
|
|
|
|
/>
|
|
|
|
|
<mat-error *ngIf="checkoutForm.get('email')?.hasError('email') && !checkoutForm.get('email')?.hasError('required')">
|
|
|
|
|
Please enter a <strong>valid</strong> email address
|
|
|
|
|
</mat-error>
|
|
|
|
|
<mat-error *ngIf="checkoutForm.get('email')?.hasError('required')">
|
|
|
|
|
Email is <strong>required</strong>
|
|
|
|
|
</mat-error>
|
|
|
|
|
</mat-form-field>
|
|
|
|
|
-->
|