|
1
|
import { HttpTypes } from "@medusajs/types" |
|
2
|
import { useMemo } from "react" |
|
3
|
import { useTranslation } from "react-i18next" |
|
4
|
import { createDataTableColumnHelper } from "@medusajs/ui" |
|
5
|
import { DescriptionCell } from "../../../components/table/table-cells/sales-channel/description-cell" |
|
6
|
|
|
7
|
const columnHelper = createDataTableColumnHelper<HttpTypes.AdminRefundReason>() |
|
8
|
|
|
9
|
export const useRefundReasonTableColumns = () => { |
|
10
|
const { t } = useTranslation() |
|
11
|
|
|
12
|
return useMemo( |
|
13
|
() => [ |
|
14
|
columnHelper.accessor("label", { |
|
15
|
header: () => t("fields.label"), |
|
16
|
enableSorting: true, |
|
17
|
sortLabel: t("fields.label"), |
|
18
|
sortAscLabel: t("filters.sorting.alphabeticallyAsc"), |
|
19
|
sortDescLabel: t("filters.sorting.alphabeticallyDesc"), |
|
20
|
}), |
|
21
|
columnHelper.accessor("code", { |
|
22
|
header: () => t("fields.code"), |
|
23
|
enableSorting: true, |
|
24
|
sortLabel: t("fields.code"), |
|
25
|
sortAscLabel: t("filters.sorting.alphabeticallyAsc"), |
|
26
|
sortDescLabel: t("filters.sorting.alphabeticallyDesc"), |
|
27
|
}), |
|
28
|
columnHelper.accessor("description", { |
|
29
|
header: () => t("fields.description"), |
|
30
|
cell: ({ getValue }) => <DescriptionCell description={getValue()} />, |
|
31
|
enableSorting: true, |
|
32
|
sortLabel: t("fields.description"), |
|
33
|
sortAscLabel: t("filters.sorting.alphabeticallyAsc"), |
|
34
|
sortDescLabel: t("filters.sorting.alphabeticallyDesc"), |
|
35
|
}), |
|
36
|
], |
|
37
|
[t] |
|
38
|
) |
|
39
|
} |