import moment from "moment" import { useMemo } from "react" import { useTranslation } from "react-i18next" import { getColor } from "../../../utils/color" import StatusDot from "../../fundamentals/status-indicator" import CustomerAvatarItem from "../../molecules/customer-avatar-item" import Table from "../../molecules/table" const useDraftOrderTableColumns = () => { const { t } = useTranslation() const decideStatus = (status) => { switch (status) { case "completed": return ( ) default: return ( ) } } const columns = useMemo( () => [ { Header: t("draft-order-table-draft", "Draft"), accessor: "display_id", Cell: ({ cell: { value, getCellProps } }) => ( {`#${value}`} ), }, { Header: t("draft-order-table-order", "Order"), accessor: "order", Cell: ({ cell: { value, getCellProps } }) => { return ( {value?.display_id ? `#${value?.display_id}` : "-"} ) }, }, { Header: t("draft-order-table-date-added", "Date added"), accessor: "created_at", Cell: ({ cell: { value, getCellProps } }) => ( {moment(value).format("DD MMM YYYY")} ), }, { Header: t("draft-order-table-customer", "Customer"), accessor: "cart", Cell: ({ row, cell: { value, getCellProps } }) => ( ), }, { Header: t("draft-order-table-status", "Status"), accessor: "status", Cell: ({ cell: { value, getCellProps } }) => ( {decideStatus(value)} ), }, ], [] ) return [columns] } export default useDraftOrderTableColumns