feat(purchase-detail): update item details structure and handle null values in mapping
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user