-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GH-29 recreation of address book page, address card and address form
- Loading branch information
Showing
15 changed files
with
490 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
src/app/features/dvnt-account/dvnt-address-book/dvnt-address-book.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
<div> | ||
<p | ||
*ngIf="!(showAddAddressForm || showEditAddressForm)" | ||
class="address-book-header-label" | ||
> | ||
{{ 'addressBook.header.manage' | cxTranslate }} | ||
{{ 'addressBook.header.manually' | cxTranslate }} | ||
</p> | ||
|
||
<ng-container | ||
*ngIf=" | ||
(addresses$ | async).length && | ||
!(showAddAddressForm || showEditAddressForm) | ||
" | ||
> | ||
<div *ngIf="!(addressesStateLoading$ | async); else loading"> | ||
<div *ngFor="let address of addresses$ | async"> | ||
<app-dvnt-address-card | ||
(editEvent)="editAddressButtonHandle(address)" | ||
[address]="address" | ||
></app-dvnt-address-card> | ||
</div> | ||
</div> | ||
|
||
<div class="add-new-address"> | ||
<button (click)="addAddressButtonHandle()" class="btn btn-primary"> | ||
{{ 'addressBook.addNewAddress' | cxTranslate }} | ||
</button> | ||
</div> | ||
</ng-container> | ||
|
||
<ng-container *ngIf="!(addresses$ | async).length || showAddAddressForm"> | ||
<p class="address-book-header-label"> | ||
{{ 'addressBook.addNewShippingAddress' | cxTranslate }} | ||
</p> | ||
<app-dvnt-address-form | ||
(backToAddress)="addAddressCancel()" | ||
(submitAddress)="addAddressSubmit($event)" | ||
[setAsDefaultField]="!((addresses$ | async).length === 0)" | ||
[showCancelBtn]="!((addresses$ | async).length === 0)" | ||
actionBtnLabel="{{ 'addressBook.addAddress' | cxTranslate }}" | ||
cancelBtnLabel="{{ 'addressBook.backToAddressList' | cxTranslate }}" | ||
showTitleCode="true" | ||
></app-dvnt-address-form> | ||
</ng-container> | ||
|
||
<ng-container *ngIf="showEditAddressForm"> | ||
<p class="address-book-header-label"> | ||
{{ 'addressBook.editShippingAddress' | cxTranslate }} | ||
</p> | ||
<app-dvnt-address-form | ||
(backToAddress)="editAddressCancel()" | ||
(submitAddress)="editAddressSubmit($event)" | ||
[addressData]="currentAddress" | ||
actionBtnLabel="{{ 'addressBook.updateAddress' | cxTranslate }}" | ||
cancelBtnLabel="{{ 'addressBook.backToAddressList' | cxTranslate }}" | ||
showTitleCode="true" | ||
></app-dvnt-address-form> | ||
</ng-container> | ||
</div> | ||
|
||
<ng-template #loading> | ||
<cx-spinner></cx-spinner> | ||
</ng-template> |
9 changes: 9 additions & 0 deletions
9
src/app/features/dvnt-account/dvnt-address-book/dvnt-address-book.component.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
.address-book-header-label { | ||
border-bottom: 1px solid var(--ssf-light-primary); | ||
margin: 0 0 40px; | ||
padding: 0 0 20px; | ||
} | ||
|
||
.add-new-address { | ||
margin-top: 40px; | ||
} |
9 changes: 9 additions & 0 deletions
9
src/app/features/dvnt-account/dvnt-address-book/dvnt-address-book.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { Component } from '@angular/core'; | ||
import { AddressBookComponent } from '@spartacus/storefront'; | ||
|
||
@Component({ | ||
selector: 'app-dvnt-address-book', | ||
templateUrl: './dvnt-address-book.component.html', | ||
styleUrls: ['./dvnt-address-book.component.scss'], | ||
}) | ||
export class DvntAddressBookComponent extends AddressBookComponent {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
src/app/features/dvnt-shared/components/dvnt-address-card/dvnt-address-card.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
<div class="address-card-container"> | ||
<div class="left-container"> | ||
<p class="address-card-label-name"> | ||
{{ address?.firstName }} {{ address?.lastName }} | ||
</p> | ||
<p class="address-card-label"> | ||
{{ address?.line1 }} | ||
</p> | ||
<p class="address-card-label"> | ||
{{ address?.line2 }} | ||
</p> | ||
<p class="address-card-label"> | ||
{{ address?.town }}, | ||
<span *ngIf="!address?.region?.isocode">{{ | ||
address?.country?.isocode | ||
}}</span | ||
><span>{{ address?.region?.isocode }}</span> | ||
</p> | ||
<p class="address-card-label"> | ||
{{ address?.postalCode }} | ||
</p> | ||
<p class="address-card-label-phone"> | ||
{{ address?.phone }} | ||
</p> | ||
</div> | ||
|
||
<div [ngClass]="{ 'align-center': editMode }" class="right-container"> | ||
<ng-container *ngIf="editMode"> | ||
<span> | ||
{{ 'addressBook.areYouSureToDeleteAddress' | cxTranslate }} | ||
</span> | ||
|
||
<div class="address-card-action-buttons"> | ||
<button (click)="deleteAddress(address.id)" class="btn btn-primary"> | ||
{{ 'common.delete' | cxTranslate }} | ||
</button> | ||
<button (click)="cancelEdit()" class="btn btn-secondary"> | ||
{{ 'common.cancel' | cxTranslate }} | ||
</button> | ||
</div> | ||
</ng-container> | ||
<ng-container *ngIf="!editMode"> | ||
<button | ||
*ngIf="!address?.defaultAddress" | ||
(click)="setAddressAsDefault(address.id)" | ||
class="btn btn-outline address-card-set-default-button" | ||
> | ||
{{ 'addressCard.setAsDefault' | cxTranslate }} | ||
</button> | ||
<div class="address-card-action-buttons"> | ||
<button (click)="openEditFormEvent(address.id)" class="btn btn-primary"> | ||
{{ 'common.edit' | cxTranslate }} | ||
</button> | ||
<button (click)="setEditMode(address.id)" class="btn btn-clear"> | ||
{{ 'common.delete' | cxTranslate }} | ||
</button> | ||
</div> | ||
</ng-container> | ||
</div> | ||
</div> |
Oops, something went wrong.