Skip to content

Commit

Permalink
fix: show quote item availability on quote detail page (#51)
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebastian-Haehnlein authored and shauke committed Feb 19, 2020
1 parent 0c9a943 commit 788b6dd
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ <h3>{{ 'quote.items.table.heading' | translate }}</h3>
*ngIf="quote.items"
[lineItems]="quote.items"
[editable]="quote.state === 'New'"
lineItemViewType="simple"
lineItemViewType="availability"
[total]="quote.total"
(updateItem)="onUpdateItem($event)"
(deleteItem)="onDeleteItem($event)"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,35 +13,47 @@
[productBundleSKU]="pli.product.sku"
></ish-product-bundle-display>

<ng-container *ngIf="lineItemViewType !== 'simple'">
<!-- edit variation & quantity -->
<ish-line-item-edit
*ishNotFeature="'advancedVariationHandling'"
[lineItem]="pli"
[editable]="editable"
(updateItem)="onUpdateItem($event)"
></ish-line-item-edit>
<!-- switch by lineItemViewType -->
<ng-container [ngSwitch]="lineItemViewType">
<!-- lineItemViewType = 'simple' -->
<ng-container *ngSwitchCase="'simple'"></ng-container>

<!-- Availability -->
<ish-product-inventory [product]="pli.product"></ish-product-inventory>
<!-- lineItemViewType = 'availability' -->
<ng-container *ngSwitchCase="'availability'">
<ish-product-inventory [product]="pli.product"></ish-product-inventory>
</ng-container>

<!-- ship window message -->
<ish-product-shipment [product]="pli.product"></ish-product-shipment>
<!-- default lineItemViewType -->
<ng-container *ngSwitchDefault>
<!-- edit variation & quantity -->
<ish-line-item-edit
*ishNotFeature="'advancedVariationHandling'"
[lineItem]="pli"
[editable]="editable"
(updateItem)="onUpdateItem($event)"
></ish-line-item-edit>

<!-- Surcharges -->
<div *ngFor="let surcharge of pli.itemSurcharges">
{{ surcharge.displayName }} <span *ngIf="!surcharge.displayName">{{ surcharge.text }}</span>
<span class="text-nowrap"> {{ surcharge.amount | ishPrice }} </span>
<ng-template #SurchargeDescription> <span [innerHTML]="surcharge.description"></span> </ng-template>
<a
class="details-tooltip"
[ngbPopover]="SurchargeDescription"
[popoverTitle]="surcharge.displayName"
placement="top"
>
{{ 'shopping_cart.detail.text' | translate }}
<fa-icon [icon]="['fas', 'info-circle']"></fa-icon>
</a>
</div>
<!-- availability -->
<ish-product-inventory [product]="pli.product"></ish-product-inventory>

<!-- ship window message -->
<ish-product-shipment [product]="pli.product"></ish-product-shipment>

<!-- surcharges -->
<div *ngFor="let surcharge of pli.itemSurcharges">
{{ surcharge.displayName }} <span *ngIf="!surcharge.displayName">{{ surcharge.text }}</span>
<span class="text-nowrap"> {{ surcharge.amount | ishPrice }} </span>
<ng-template #SurchargeDescription> <span [innerHTML]="surcharge.description"></span> </ng-template>
<a
class="details-tooltip"
[ngbPopover]="SurchargeDescription"
[popoverTitle]="surcharge.displayName"
placement="top"
>
{{ 'shopping_cart.detail.text' | translate }}
<fa-icon [icon]="['fas', 'info-circle']"></fa-icon>
</a>
</div>
</ng-container>
</ng-container>
</ng-container>
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import { ProductHelper } from 'ish-core/models/product/product.model';
export class LineItemDescriptionComponent {
@Input() pli: LineItemView;
@Input() editable = true;
@Input() lineItemViewType?: 'simple';
@Input() lineItemViewType?: 'simple' | 'availability';
@Output() updateItem = new EventEmitter<LineItemUpdate>();

isVariationProduct = ProductHelper.isVariationProduct;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export class LineItemListComponent implements OnChanges, OnDestroy {
@Input() lineItems: LineItemView[];
@Input() editable = true;
@Input() total: Price;
@Input() lineItemViewType?: 'simple';
@Input() lineItemViewType?: 'simple' | 'availability';

@Output() updateItem = new EventEmitter<LineItemUpdate>();
@Output() deleteItem = new EventEmitter<string>();
Expand Down

0 comments on commit 788b6dd

Please sign in to comment.