feat: client-side currency conversion with admin-configurable rates
Some checks failed
Architecture Governance / architecture (push) Has been cancelled
Some checks failed
Architecture Governance / architecture (push) Has been cancelled
- CurrencyRatesService: RUB-based rates, persisted via localStorage - CurrencyConvertPipe: impure pipe converting item price to selected currency - Admin settings page: editable currency rates form - Applied conversion to product-card, product-information, quick-view-dialog, delivery-information, compare-table, cart totals + payment payload Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -51,10 +51,10 @@
|
||||
|
||||
<div class="product-price">
|
||||
@if (item.discount > 0) {
|
||||
<span class="original-price">{{ item.price | number:'1.2-2' }} {{ item.currency }}</span>
|
||||
<span class="discounted-price">{{ getDiscountedPrice(item) | number:'1.2-2' }} {{ item.currency }}</span>
|
||||
<span class="original-price">{{ item.price | currencyConvert:item.currency | number:'1.2-2' }} {{ displayCurrency() }}</span>
|
||||
<span class="discounted-price">{{ getDiscountedPrice(item) | currencyConvert:item.currency | number:'1.2-2' }} {{ displayCurrency() }}</span>
|
||||
} @else {
|
||||
<span class="current-price">{{ item.price | number:'1.2-2' }} {{ item.currency }}</span>
|
||||
<span class="current-price">{{ item.price | currencyConvert:item.currency | number:'1.2-2' }} {{ displayCurrency() }}</span>
|
||||
}
|
||||
</div>
|
||||
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
import { ChangeDetectionStrategy, Component, EventEmitter, Input, Output } from '@angular/core';
|
||||
import { ChangeDetectionStrategy, Component, EventEmitter, Input, Output, inject } from '@angular/core';
|
||||
import { DecimalPipe } from '@angular/common';
|
||||
import { RouterLink } from '@angular/router';
|
||||
import { Product } from '../../core/products/models/product-domain.model';
|
||||
import { LangRoutePipe } from '../../pipes/lang-route.pipe';
|
||||
import { TranslatePipe } from '../../i18n/translate.pipe';
|
||||
import { CurrencyConvertPipe } from '../../pipes/currency-convert.pipe';
|
||||
import { LanguageService } from '../../services/language.service';
|
||||
import { cleanDescription, getBadgeClass, getDiscountedPrice, getMainImage, onImageError } from '../../utils/item.utils';
|
||||
|
||||
const STOCK_LABEL_KEYS: Record<string, string> = {
|
||||
@@ -18,12 +20,15 @@ export type ProductCardAppearance = 'standard' | 'compact';
|
||||
@Component({
|
||||
selector: 'app-product-card',
|
||||
standalone: true,
|
||||
imports: [DecimalPipe, RouterLink, LangRoutePipe, TranslatePipe],
|
||||
imports: [DecimalPipe, RouterLink, LangRoutePipe, TranslatePipe, CurrencyConvertPipe],
|
||||
templateUrl: './product-card.component.html',
|
||||
styleUrls: ['./product-card.component.scss'],
|
||||
changeDetection: ChangeDetectionStrategy.OnPush
|
||||
})
|
||||
export class ProductCardComponent {
|
||||
private readonly languageService = inject(LanguageService);
|
||||
readonly displayCurrency = this.languageService.currentCurrency;
|
||||
|
||||
@Input({ required: true }) item!: Product;
|
||||
@Input() title = '';
|
||||
@Input() description = '';
|
||||
|
||||
Reference in New Issue
Block a user