Skip to content

Commit

Permalink
fixed #7907
Browse files Browse the repository at this point in the history
  • Loading branch information
kryzanivska-nastya committed Dec 11, 2024
1 parent 9096d11 commit 008bb33
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@ export class LocalizedCurrencyPipe implements PipeTransform, OnDestroy {
});
}

transform(value: any): any {
const roundedValue = Math.round((+value + Number.EPSILON) * 100) / 100;
return `${roundedValue} ${LOCALIZED_CURRENCY[this.lang]}`;
transform(value: any, fixedDigits: boolean = false): any {
const formattedValue = fixedDigits ? (+value).toFixed(2) : Math.round(+value * 100) / 100;

return `${formattedValue} ${LOCALIZED_CURRENCY[this.lang]}`;
}

ngOnDestroy() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ <h5 *ngIf="!currentLocation" class="error-text">{{ 'order-details.title-without-
<li *ngFor="let bag of bags" class="main-list-item">
<span class="bag-name" [appLangValue]="{ ua: bag.name, en: bag.nameEng }"></span>
<span class="bag-name">{{ bag.capacity | volume }}</span>
<span class="bag-name">{{ bag.price | localizedCurrency }}</span>
<span class="bag-name">{{ bag.price | localizedCurrency: true }}</span>
<div class="bag-name form-group count">
<div class="quantity-input-wrapper">
<button (click)="changeQuantity(bag.id, -1)" type="button">
Expand All @@ -55,7 +55,7 @@ <h5 *ngIf="!currentLocation" class="error-text">{{ 'order-details.title-without-
</button>
</div>
</div>
<span class="bag-name label-total"> {{ getBagQuantity(bag.id) * bag.price | localizedCurrency }}</span>
<span class="bag-name label-total"> {{ getBagQuantity(bag.id) * bag.price | localizedCurrency: true }}</span>
</li>
</ul>
</div>
Expand All @@ -66,7 +66,7 @@ <h5 *ngIf="!currentLocation" class="error-text">{{ 'order-details.title-without-
<p class="total-content" [class.d-none]="orderSum === 0">
<span>{{ 'order-details.order-amount' | translate }}</span>
<span>
<strong>{{ orderSum | localizedCurrency }}</strong>
<strong>{{ orderSum | localizedCurrency: true }}</strong>
</span>
</p>
<p class="total-content" *ngIf="certificateUsed">
Expand All @@ -84,7 +84,7 @@ <h5 *ngIf="!currentLocation" class="error-text">{{ 'order-details.title-without-
<p class="total-content">
<span>{{ 'order-details.amount-due' | translate }} </span>
<span>
<strong>{{ finalSum | localizedCurrency }}</strong>
<strong>{{ finalSum | localizedCurrency: true }}</strong>
</span>
</p>
</div>
Expand Down

0 comments on commit 008bb33

Please sign in to comment.