import { HttpTypes } from "@medusajs/types" import { createColumnHelper } from "@tanstack/react-table" import { useMemo } from "react" import { useTranslation } from "react-i18next" import { CreatedAtCell } from "../../../../../components/table/table-cells/common/created-at-cell" import { PlaceholderCell } from "../../../../../components/table/table-cells/common/placeholder-cell" import { TextCell, TextHeader, } from "../../../../../components/table/table-cells/common/text-cell" import { formatQuantity } from "../../../../../lib/format-quantity" import { ReservationActions } from "./reservation-actions" /** * Adds missing properties to the InventoryItemDTO type. */ export interface ExtendedReservationItem extends HttpTypes.AdminReservation { line_item?: { order_id: string } location?: HttpTypes.AdminStockLocation } const columnHelper = createColumnHelper() export const useReservationTableColumn = ({ sku, unitOfMeasure, }: { sku: string unitOfMeasure?: string | null }) => { const { t } = useTranslation() return useMemo( () => [ columnHelper.display({ id: "sku", header: () => , cell: () => { return }, }), columnHelper.accessor("line_item.order_id", { header: () => , cell: ({ getValue }) => { const orderId = getValue() if (!orderId) { return } return }, }), columnHelper.accessor("description", { header: () => , cell: ({ getValue }) => { const description = getValue() if (!description) { return } return }, }), columnHelper.accessor("location.name", { header: () => , cell: ({ getValue }) => { const location = getValue() if (!location) { return } return }, }), columnHelper.accessor("created_at", { header: () => , cell: ({ getValue }) => , }), columnHelper.accessor("quantity", { header: () => , cell: ({ getValue }) => { return ( ) }, }), columnHelper.display({ id: "actions", cell: ({ row }) => , }), ], [t, sku, unitOfMeasure] ) }