import React from 'react'; import CardBox from '../CardBox'; import ImageField from '../ImageField'; import dataFormatter from '../../helpers/dataFormatter'; import {saveFile} from "../../helpers/fileSaver"; import ListActionsPopover from "../ListActionsPopover"; import {useAppSelector} from "../../stores/hooks"; import {Pagination} from "../Pagination"; import LoadingSpinner from "../LoadingSpinner"; import Link from 'next/link'; import {hasPermission} from "../../helpers/userPermissions"; type Props = { orders: any[]; loading: boolean; onDelete: (id: string) => void; currentPage: number; numPages: number; onPageChange: (page: number) => void; }; const ListOrders = ({ orders, loading, onDelete, currentPage, numPages, onPageChange }: Props) => { const currentUser = useAppSelector((state) => state.auth.currentUser); const hasUpdatePermission = hasPermission(currentUser, 'UPDATE_ORDERS') const corners = useAppSelector((state) => state.style.corners); const bgColor = useAppSelector((state) => state.style.cardsColor); return ( <>
OrderNumber
{ item.order_number }
Customer
{ dataFormatter.usersOneListFormatter(item.customer) }
ShippingAddress
{ dataFormatter.user_addressesOneListFormatter(item.shipping_address) }
ShippingMethod
{ dataFormatter.shipping_methodsOneListFormatter(item.shipping_method) }
OrderStatus
{ item.order_status }
PaymentStatus
{ item.payment_status }
FulfillmentStatus
{ item.fulfillment_status }
SubtotalAmount
{ item.subtotal_amount }
DiscountAmount
{ item.discount_amount }
ShippingAmount
{ item.shipping_amount }
TaxAmount
{ item.tax_amount }
TotalAmount
{ item.total_amount }
CurrencyCode
{ item.currency_code }
Coupon
{ dataFormatter.couponsOneListFormatter(item.coupon) }
CustomerNote
{ item.customer_note }
PlacedAt
{ dataFormatter.dateTimeFormatter(item.placed_at) }
PaidAt
{ dataFormatter.dateTimeFormatter(item.paid_at) }
Items
{ dataFormatter.order_itemsManyListFormatter(item.items).join(', ')}
Payments
{ dataFormatter.paymentsManyListFormatter(item.payments).join(', ')}
Shipments
{ dataFormatter.shipmentsManyListFormatter(item.shipments).join(', ')}
No data to display