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 = { cart_items: any[]; loading: boolean; onDelete: (id: string) => void; currentPage: number; numPages: number; onPageChange: (page: number) => void; }; const ListCart_items = ({ cart_items, loading, onDelete, currentPage, numPages, onPageChange }: Props) => { const currentUser = useAppSelector((state) => state.auth.currentUser); const hasUpdatePermission = hasPermission(currentUser, 'UPDATE_CART_ITEMS') const corners = useAppSelector((state) => state.style.corners); const bgColor = useAppSelector((state) => state.style.cardsColor); return ( <>
{loading && } {!loading && cart_items.map((item) => (
dark:divide-dark-700 overflow-x-auto' } >

Cart

{ dataFormatter.cartsOneListFormatter(item.cart) }

Product

{ dataFormatter.productsOneListFormatter(item.product) }

Quantity

{ item.quantity }

UnitPrice

{ item.unit_price }

LineTotal

{ item.line_total }

Notes

{ item.notes }

))} {!loading && cart_items.length === 0 && (

No data to display

)}
) }; export default ListCart_items