feat(carousel): introduce new catalog group layout options and update related components for enhanced product display
This commit is contained in:
@@ -56,6 +56,7 @@ function createCatalog(
|
||||
id: 7,
|
||||
title: 'Destacados',
|
||||
layout: 'column_with_image',
|
||||
group_layout: 'paginated',
|
||||
group_order: 0,
|
||||
items: createItemsPage(items, currentPage, lastPage),
|
||||
},
|
||||
|
||||
@@ -53,8 +53,7 @@ export class StoreHomePageComponent implements OnInit, OnDestroy {
|
||||
|
||||
ngOnInit(): void {
|
||||
const resolvedData = this.route.snapshot.data['catalogData'] as
|
||||
| StoreHomeCatalogResolvedData
|
||||
| undefined;
|
||||
StoreHomeCatalogResolvedData | undefined;
|
||||
|
||||
if (resolvedData) {
|
||||
this.applyResolvedData(resolvedData);
|
||||
@@ -78,6 +77,7 @@ export class StoreHomePageComponent implements OnInit, OnDestroy {
|
||||
|
||||
if (
|
||||
!group ||
|
||||
Array.isArray(group.items) ||
|
||||
page < 1 ||
|
||||
page === group.items.meta.current_page ||
|
||||
this.isGroupLoading(groupId)
|
||||
@@ -112,18 +112,15 @@ export class StoreHomePageComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
|
||||
protected onAddToCart(event: ProductListCartEvent): void {
|
||||
this.cartService
|
||||
.addItem(event.product.id, event.variant ?? null, event.quantity)
|
||||
.subscribe({
|
||||
next: (response) => {
|
||||
this.toastService.success(response.message || 'Producto agregado al carrito');
|
||||
},
|
||||
error: (error: HttpErrorResponse) => {
|
||||
const message =
|
||||
error.error?.message || 'No se pudo agregar el producto al carrito.';
|
||||
this.toastService.danger(message);
|
||||
},
|
||||
});
|
||||
this.cartService.addItem(event.product.id, event.variant ?? null, event.quantity).subscribe({
|
||||
next: (response) => {
|
||||
this.toastService.success(response.message || 'Producto agregado al carrito');
|
||||
},
|
||||
error: (error: HttpErrorResponse) => {
|
||||
const message = error.error?.message || 'No se pudo agregar el producto al carrito.';
|
||||
this.toastService.danger(message);
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
private loadCatalog(): void {
|
||||
|
||||
Reference in New Issue
Block a user