feat: create return reason (#8516)
* feat: create and edit return reasons * add prop to hide data table header * make return reasons searchable * hide table header
This commit is contained in:
+14
-9
@@ -1,25 +1,30 @@
|
||||
import { HttpTypes } from "@medusajs/types"
|
||||
import { Badge } from "@medusajs/ui"
|
||||
import { createColumnHelper } from "@tanstack/react-table"
|
||||
import { useMemo } from "react"
|
||||
import { useTranslation } from "react-i18next"
|
||||
import { TextCell } from "../../../components/table/table-cells/common/text-cell"
|
||||
|
||||
const columnHelper = createColumnHelper<HttpTypes.AdminReturnReason>()
|
||||
|
||||
export const useReturnReasonTableColumns = () => {
|
||||
const { t } = useTranslation()
|
||||
|
||||
return useMemo(
|
||||
() => [
|
||||
columnHelper.accessor("value", {
|
||||
header: () => t("fields.value"),
|
||||
cell: ({ getValue }) => <TextCell text={getValue()} />,
|
||||
cell: ({ getValue }) => <Badge size="2xsmall">{getValue()}</Badge>,
|
||||
}),
|
||||
columnHelper.accessor("label", {
|
||||
header: () => t("fields.createdAt"),
|
||||
cell: ({ getValue }) => <TextCell text={getValue()} />,
|
||||
cell: ({ row }) => {
|
||||
const { label, description } = row.original
|
||||
return (
|
||||
<div className="flex h-full w-full flex-col justify-center py-4">
|
||||
<span className="truncate font-medium">{label}</span>
|
||||
<span className="truncate">
|
||||
{description ? description : "-"}
|
||||
</span>
|
||||
</div>
|
||||
)
|
||||
},
|
||||
}),
|
||||
],
|
||||
[t]
|
||||
[]
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user