feat(purchase-detail): update item details structure and handle null values in mapping

This commit is contained in:
2026-07-21 10:22:32 -03:00
parent 938d15bf83
commit 8e44fa5a46
2 changed files with 12 additions and 12 deletions

View File

@@ -79,12 +79,12 @@ export class PurchaseDetailPage implements OnInit {
private mapItems(purchase: PurchaseDetailResponse): PurchaseItemViewModel[] {
return purchase.items.map((item) => ({
id: item.id,
title: item.product?.nombre ?? 'Producto sin nombre',
imageUrl: item.product?.imagen ?? null,
title: item.item_details.nombre || 'Producto sin nombre',
imageUrl: item.item_details.imagen,
quantity: item.quantity,
attributes: (item.variant?.attributes ?? []).map((attribute) => ({
attributes: item.item_details.attributes.map((attribute) => ({
label: attribute.name,
value: attribute.value,
value: attribute.value === null ? null : String(attribute.value),
})),
price: item.line_total,
originalPrice: null,