diff --git a/src/pages/ServicesPage/components/ServicesTable/columns.tsx b/src/pages/ServicesPage/components/ServicesTable/columns.tsx index 91366d4..20c0965 100644 --- a/src/pages/ServicesPage/components/ServicesTable/columns.tsx +++ b/src/pages/ServicesPage/components/ServicesTable/columns.tsx @@ -1,8 +1,25 @@ import {useMemo} from "react"; import {MRT_ColumnDef} from "mantine-react-table"; import {ServiceSchema} from "../../../../client"; +import {List} from "@mantine/core"; export const useServicesTableColumns = () => { + const getPriceRow = (service: ServiceSchema) => { + if (service.priceRanges.length == 0) + return <>{service.price}₽; + return ( + <> + + {service.priceRanges.map(range => ( + + {`${range.fromQuantity} - ${range.toQuantity}: ${range.price}₽`} + + ))} + + + ); + } + return useMemo[]>(() => [ { accessorKey: "category", @@ -23,7 +40,7 @@ export const useServicesTableColumns = () => { header: "Цена", enableGrouping: false, enableSorting: false, - + Cell: ({row}) => getPriceRow(row.original) }, ], []);