This commit is contained in:
sdarbinyan
2026-06-22 06:56:37 +04:00
parent 394ac5ec9d
commit a8b415b4bd
4 changed files with 172 additions and 1 deletions

View File

@@ -4,7 +4,7 @@ import { FormsModule } from '@angular/forms';
import { ActivatedRoute, RouterLink } from '@angular/router';
import { ApiService, CartService, TelegramService, LanguageService, SeoService } from '../../services';
import { AuthService } from '../../services/auth.service';
import { Item, ItemDetail, DescriptionField } from '../../models';
import { Item, ItemDetail, DescriptionField, DeliveryOption } from '../../models';
import { DomSanitizer, SafeHtml } from '@angular/platform-browser';
import { Subscription } from 'rxjs';
import { environment } from '../../../environments/environment';
@@ -76,6 +76,13 @@ export class ItemDetailComponent implements OnInit, OnDestroy {
const detail = this.selectedDetail();
return detail?.remaining ?? this.item()?.quantity ?? null;
});
deliveryOptions = computed(() => this.item()?.deliveryOptions ?? []);
hasDeliveryInfo = computed(() => {
const currentItem = this.item();
return currentItem?.deliveryMode === 'digital' || this.deliveryOptions().length > 0;
});
newReview = {
rating: 0,
@@ -187,6 +194,18 @@ export class ItemDetailComponent implements OnInit, OnDestroy {
return discount > 0 ? price * (1 - discount / 100) : price;
}
isDigitalDelivery(): boolean {
return this.item()?.deliveryMode === 'digital';
}
getDeliveryCurrency(): string {
return this.effectiveCurrency() || this.item()?.currency || 'RUB';
}
trackByDeliveryOption(index: number, option: DeliveryOption): string {
return `${index}-${option.deliveryPlace}-${option.deliveryTime}-${option.deliveryPrice}`;
}
// BackOffice integration helpers
getItemName(): string {