delivery
This commit is contained in:
@@ -144,6 +144,32 @@
|
||||
</div>
|
||||
}
|
||||
|
||||
@if (hasDeliveryInfo()) {
|
||||
<div class="novo-delivery">
|
||||
<h3 class="novo-delivery-title">{{ 'cart.deliveryLabel' | translate }}</h3>
|
||||
|
||||
@if (isDigitalDelivery()) {
|
||||
<div class="novo-delivery-chip">{{ 'cart.digitalDelivery' | translate }}</div>
|
||||
} @else {
|
||||
<div class="novo-delivery-list">
|
||||
@for (option of deliveryOptions(); track trackByDeliveryOption($index, option)) {
|
||||
<div class="novo-delivery-option">
|
||||
<div class="novo-delivery-option-main">
|
||||
@if (option.deliveryPlace) {
|
||||
<span>{{ 'cart.deliveryPlace' | translate }}: {{ option.deliveryPlace }}</span>
|
||||
}
|
||||
@if (option.deliveryTime) {
|
||||
<span>{{ 'cart.deliveryTime' | translate }}: {{ option.deliveryTime }}</span>
|
||||
}
|
||||
</div>
|
||||
<span class="novo-delivery-price">{{ option.deliveryPrice | number:'1.2-2' }} {{ getDeliveryCurrency() }}</span>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
|
||||
<button class="novo-add-cart" (click)="addToCart()">
|
||||
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
||||
<circle cx="9" cy="21" r="1"></circle>
|
||||
@@ -423,6 +449,32 @@
|
||||
</div>
|
||||
}
|
||||
|
||||
@if (hasDeliveryInfo()) {
|
||||
<div class="dx-delivery">
|
||||
<h3 class="dx-delivery-title">{{ 'cart.deliveryLabel' | translate }}</h3>
|
||||
|
||||
@if (isDigitalDelivery()) {
|
||||
<div class="dx-delivery-chip">{{ 'cart.digitalDelivery' | translate }}</div>
|
||||
} @else {
|
||||
<div class="dx-delivery-list">
|
||||
@for (option of deliveryOptions(); track trackByDeliveryOption($index, option)) {
|
||||
<div class="dx-delivery-option">
|
||||
<div class="dx-delivery-option-main">
|
||||
@if (option.deliveryPlace) {
|
||||
<span>{{ 'cart.deliveryPlace' | translate }}: {{ option.deliveryPlace }}</span>
|
||||
}
|
||||
@if (option.deliveryTime) {
|
||||
<span>{{ 'cart.deliveryTime' | translate }}: {{ option.deliveryTime }}</span>
|
||||
}
|
||||
</div>
|
||||
<span class="dx-delivery-price">{{ option.deliveryPrice | number:'1.2-2' }} {{ getDeliveryCurrency() }}</span>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
|
||||
<button class="dx-add-cart" (click)="addToCart()">
|
||||
<svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
||||
<circle cx="9" cy="21" r="1"></circle>
|
||||
|
||||
@@ -383,6 +383,65 @@ $dx-card-bg: #f5f3f9;
|
||||
}
|
||||
}
|
||||
|
||||
.dx-delivery, .novo-delivery {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 10px;
|
||||
padding: 14px 16px;
|
||||
border: 1px solid $dx-border;
|
||||
border-radius: 12px;
|
||||
background: #f8fafa;
|
||||
}
|
||||
|
||||
.dx-delivery-title, .novo-delivery-title {
|
||||
margin: 0;
|
||||
font-size: 1rem;
|
||||
font-weight: 700;
|
||||
color: $dx-dark;
|
||||
}
|
||||
|
||||
.dx-delivery-list, .novo-delivery-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.dx-delivery-option, .novo-delivery-option {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: flex-start;
|
||||
gap: 12px;
|
||||
padding: 10px 12px;
|
||||
border-radius: 10px;
|
||||
background: white;
|
||||
}
|
||||
|
||||
.dx-delivery-option-main, .novo-delivery-option-main {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 4px;
|
||||
color: $dx-muted;
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
|
||||
.dx-delivery-price, .novo-delivery-price {
|
||||
flex-shrink: 0;
|
||||
font-weight: 700;
|
||||
color: $dx-primary;
|
||||
font-size: 0.95rem;
|
||||
}
|
||||
|
||||
.dx-delivery-chip, .novo-delivery-chip {
|
||||
display: inline-flex;
|
||||
align-self: flex-start;
|
||||
padding: 6px 12px;
|
||||
border-radius: 999px;
|
||||
background: rgba(73, 118, 113, 0.12);
|
||||
color: $dx-primary;
|
||||
font-size: 0.9rem;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.dx-description {
|
||||
padding-top: 8px;
|
||||
border-top: 1px solid $dx-border;
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user