#3968 Article Search Details display vat and if priceMaintained true

This commit is contained in:
Nino
2023-08-28 16:51:52 +02:00
parent da6489eb7a
commit 878bf44d0b
4 changed files with 43 additions and 20 deletions

View File

@@ -103,28 +103,32 @@
<div class="page-article-details__product-publication">{{ publicationDate$ | async }}</div>
</div>
<div class="page-article-details__product-price-info flex flex-col mb-4">
<div
class="page-article-details__product-price font-bold text-xl self-end"
*ngIf="item.catalogAvailability?.price?.value?.value; else retailPrice"
>
{{ item.catalogAvailability?.price?.value?.value | currency: item.catalogAvailability?.price?.value?.currency:'code' }}
</div>
<ng-template #retailPrice>
<div
class="page-article-details__product-price font-bold text-xl self-end"
*ngIf="store.takeAwayAvailability$ | async; let takeAwayAvailability"
>
{{ takeAwayAvailability?.retailPrice?.value?.value | currency: takeAwayAvailability?.retailPrice?.value?.currency:'code' }}
<div class="page-article-details__product-price-info flex flex-col mb-4 flex-nowrap self-end">
<ng-container *ngIf="item.catalogAvailability?.price?.value?.value; else retailPrice">
<div class="page-article-details__product-price font-bold text-xl self-end">
{{ item.catalogAvailability?.price?.value?.value | currency: item.catalogAvailability?.price?.value?.currency:'code' }}
</div>
<div *ngIf="item.catalogAvailability?.price?.vat?.vatType" class="page-article-details__product-price-bound self-end">
{{ item.catalogAvailability?.price?.vat?.vatType | vat: item.catalogAvailability?.priceMaintained }}
</div>
</ng-container>
<ng-template #retailPrice>
<ng-container *ngIf="store.takeAwayAvailability$ | async; let takeAwayAvailability">
<div class="page-article-details__product-price font-bold text-xl self-end">
{{ takeAwayAvailability?.price?.value?.value | currency: takeAwayAvailability?.price?.value?.currency:'code' }}
</div>
<div *ngIf="takeAwayAvailability?.price?.vat?.vatType" class="page-article-details__product-price-bound self-end">
{{ takeAwayAvailability?.price?.vat?.vatType | vat: takeAwayAvailability?.priceMaintained }}
</div>
</ng-container>
</ng-template>
<div class="page-article-details__product-points self-end" *ngIf="store.promotionPoints$ | async; let promotionPoints">
{{ promotionPoints }} Lesepunkte
</div>
<!-- TODO: Ticket PREISGEBUNDEN -->
<div class="page-article-details__product-price-bound self-end"></div>
</div>
<div class="page-article-details__product-origin-infos flex flex-col mb-4">

View File

@@ -15,8 +15,8 @@
'image contributors contributors contributors'
'image title title print'
'image title title .'
'image misc misc price'
'image misc misc price'
'image misc price price'
'image misc price price'
'image origin origin stock'
'image origin origin stock'
'image specs availabilities availabilities'

View File

@@ -1,11 +1,12 @@
import { NgModule } from '@angular/core';
import { TrimPipe } from './trim.pipe';
import { VatPipe } from './vat.pipe';
@NgModule({
imports: [],
exports: [TrimPipe],
declarations: [TrimPipe],
exports: [TrimPipe, VatPipe],
declarations: [TrimPipe, VatPipe],
providers: [],
})
export class PipesModule {}

View File

@@ -0,0 +1,18 @@
import { Pipe, PipeTransform } from '@angular/core';
import { VATType } from '@swagger/cat';
@Pipe({
name: 'vat',
})
export class VatPipe implements PipeTransform {
transform(vatType: VATType, priceMaintained?: boolean, ...args: any[]): any {
const vatString = vatType === 1 ? '0%' : vatType === 2 ? '19%' : vatType === 8 ? '7%' : undefined;
if (!vatString) {
return;
}
if (priceMaintained) {
return `inkl. ${vatString} MwSt; Preisgebunden`;
}
return `inkl. ${vatString} MwSt`;
}
}