Revert "feat: enhance variant attribute handling across components for improved selection and display"
This reverts commit 56f602d876.
This commit is contained in:
@@ -12,7 +12,6 @@ import { findMenu } from '../../services/menu.utils';
|
||||
import { CheckoutService } from '../../services/checkout.service';
|
||||
import { ToastService } from '../../services/toast.service';
|
||||
import { Category } from '../../services/tenant.interface';
|
||||
import { VariantAttributeValue } from '../../services/catalog/catalog.interface';
|
||||
|
||||
@Component({
|
||||
selector: 'app-store-layout',
|
||||
@@ -81,7 +80,7 @@ export class StoreLayoutComponent implements OnInit {
|
||||
if (selectedVariant) {
|
||||
attributes = Object.entries(selectedVariant.values).map(([label, value]) => ({
|
||||
label: this.formatAttributeLabel(label),
|
||||
value: this.variantAttributeLabel(value),
|
||||
value: Array.isArray(value) ? value.join(', ') : value,
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -104,14 +103,6 @@ export class StoreLayoutComponent implements OnInit {
|
||||
return label.charAt(0).toUpperCase() + label.slice(1);
|
||||
}
|
||||
|
||||
private variantAttributeLabel(value: VariantAttributeValue): string {
|
||||
if (typeof value === 'string') return value;
|
||||
if (Array.isArray(value)) {
|
||||
return value.map((item) => (typeof item === 'string' ? item : item.label)).join(', ');
|
||||
}
|
||||
return value.label;
|
||||
}
|
||||
|
||||
protected readonly currentYear = new Date().getFullYear();
|
||||
protected readonly tenant = this.tenantService.tenant;
|
||||
protected readonly user = this.authService.user;
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import { VariantAttributeValue } from '../catalog/catalog.interface';
|
||||
|
||||
export interface CartItemProduct {
|
||||
nombre: string;
|
||||
imagen: string | null;
|
||||
@@ -10,7 +8,7 @@ export interface CartItemVariant {
|
||||
id: number;
|
||||
precio: string;
|
||||
stock_tecnico: number | null;
|
||||
values: Record<string, VariantAttributeValue>;
|
||||
values: Record<string, string | string[]>;
|
||||
}
|
||||
|
||||
export interface CartItem {
|
||||
|
||||
@@ -47,17 +47,6 @@ export interface ProductAttribute {
|
||||
|
||||
export type InventoryPolicy = 'tracked' | 'unlimited';
|
||||
|
||||
export interface VariantAttributeOptionValue {
|
||||
value: string;
|
||||
label: string;
|
||||
}
|
||||
|
||||
export type VariantAttributeValue =
|
||||
| VariantAttributeOptionValue
|
||||
| VariantAttributeOptionValue[]
|
||||
| string
|
||||
| string[];
|
||||
|
||||
export interface CatalogItemVariant {
|
||||
id: number;
|
||||
descripcion?: string | null;
|
||||
@@ -70,7 +59,7 @@ export interface CatalogItemVariant {
|
||||
maximum_use_date?: string | null;
|
||||
effective_minimum_use_date?: string | null;
|
||||
effective_maximum_use_date?: string | null;
|
||||
values: Record<string, VariantAttributeValue>;
|
||||
values: Record<string, string | string[]>;
|
||||
}
|
||||
|
||||
export interface SelectedCatalogItemVariant extends CatalogItemVariant {
|
||||
@@ -109,7 +98,7 @@ export interface CatalogFeaturedItemVariant {
|
||||
descripcion?: string | null;
|
||||
precio?: string;
|
||||
stock_tecnico: number | null;
|
||||
values: Record<string, VariantAttributeValue>;
|
||||
values: Record<string, string | string[]>;
|
||||
}
|
||||
|
||||
export interface CatalogFeaturedItem {
|
||||
|
||||
Reference in New Issue
Block a user