import React from 'react'; import {Heading, Separator, DataList, Stack, Center, Box, Image, Badge, Text} from "@chakra-ui/react" const OrderSummary = ({ orderData, loading, order }) => { const formatCurrency = (amount, currency = 'USD') => { return new Intl.NumberFormat('en-US', { style: 'currency', currency: currency, }).format(parseFloat(amount)); }; if (loading) { return (
Loading...
); } return (
Order Summary Order # {orderData.wc_order_id} { order.billing !== undefined && <> {/**/} {/* First Name*/} {/* {order.billing.first_name}*/} {/**/} {/**/} {/* Last Name*/} {/* {order.billing.last_name}*/} {/**/} Shipping details {order.shipping.first_name} {order.shipping.last_name}
{order.shipping.address_1} {order.shipping.address_2 && `, ${order.shipping.address_2}`} {`, ${order.shipping.city}`} {`, ${order.shipping.postcode}`} {order.shipping.state && `, ${order.shipping.state}`} {`, ${order.shipping.country}`}
E-mail {order.billing.email} {/*{orderData.customer_email && ( E-mail {orderData.customer_email} )}*/} {order.shipping.method && {order.shipping.method} {formatCurrency(order.shipping.total, orderData.currency)} } } Total Amount: {formatCurrency(orderData.total, orderData.currency)}
Ordered Items {order.line_items !== undefined && order.line_items.map((item, index) => ( {item.image && {item.name}}
{item.name}
Qty: {item.quantity} ${item.total}
))}
); }; export default OrderSummary;