update list
for project routes
This commit is contained in:
parent
191f495abe
commit
0eddd112ae
@ -7,7 +7,7 @@ interface CustomDataGridProps extends DataGridProps {
|
|||||||
hasCoordinates?: boolean
|
hasCoordinates?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
const DEV_FIELDS = ['id', 'city_id', 'carrier_id'] as const
|
const DEV_FIELDS = ['id', 'code', 'country_code', 'city_id', 'carrier_id'] as const
|
||||||
|
|
||||||
export const CustomDataGrid = ({hasCoordinates = false, columns = [], ...props}: CustomDataGridProps) => {
|
export const CustomDataGrid = ({hasCoordinates = false, columns = [], ...props}: CustomDataGridProps) => {
|
||||||
const isDev = import.meta.env.DEV
|
const isDev = import.meta.env.DEV
|
||||||
|
@ -26,6 +26,14 @@ export const CarrierList = () => {
|
|||||||
align: 'left',
|
align: 'left',
|
||||||
headerAlign: 'left',
|
headerAlign: 'left',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
field: 'city',
|
||||||
|
headerName: 'Город',
|
||||||
|
type: 'string',
|
||||||
|
minWidth: 150,
|
||||||
|
align: 'left',
|
||||||
|
headerAlign: 'left',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
field: 'full_name',
|
field: 'full_name',
|
||||||
headerName: 'Полное имя',
|
headerName: 'Полное имя',
|
||||||
@ -42,11 +50,11 @@ export const CarrierList = () => {
|
|||||||
{
|
{
|
||||||
field: 'actions',
|
field: 'actions',
|
||||||
headerName: 'Действия',
|
headerName: 'Действия',
|
||||||
|
minWidth: 120,
|
||||||
|
display: 'flex',
|
||||||
align: 'right',
|
align: 'right',
|
||||||
headerAlign: 'center',
|
headerAlign: 'center',
|
||||||
minWidth: 120,
|
|
||||||
sortable: false,
|
sortable: false,
|
||||||
display: 'flex',
|
|
||||||
renderCell: function render({row}) {
|
renderCell: function render({row}) {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
@ -26,6 +26,14 @@ export const CityList = () => {
|
|||||||
align: 'left',
|
align: 'left',
|
||||||
headerAlign: 'left',
|
headerAlign: 'left',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
field: 'country',
|
||||||
|
headerName: 'Cтрана',
|
||||||
|
type: 'string',
|
||||||
|
minWidth: 150,
|
||||||
|
align: 'left',
|
||||||
|
headerAlign: 'left',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
field: 'name',
|
field: 'name',
|
||||||
headerName: 'Название',
|
headerName: 'Название',
|
||||||
@ -36,11 +44,11 @@ export const CityList = () => {
|
|||||||
{
|
{
|
||||||
field: 'actions',
|
field: 'actions',
|
||||||
headerName: 'Действия',
|
headerName: 'Действия',
|
||||||
|
minWidth: 120,
|
||||||
|
display: 'flex',
|
||||||
align: 'right',
|
align: 'right',
|
||||||
headerAlign: 'center',
|
headerAlign: 'center',
|
||||||
minWidth: 120,
|
|
||||||
sortable: false,
|
sortable: false,
|
||||||
display: 'flex',
|
|
||||||
renderCell: function render({row}) {
|
renderCell: function render({row}) {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
@ -29,11 +29,11 @@ export const CountryList = () => {
|
|||||||
{
|
{
|
||||||
field: 'actions',
|
field: 'actions',
|
||||||
headerName: 'Действия',
|
headerName: 'Действия',
|
||||||
|
minWidth: 120,
|
||||||
|
display: 'flex',
|
||||||
align: 'right',
|
align: 'right',
|
||||||
headerAlign: 'center',
|
headerAlign: 'center',
|
||||||
minWidth: 120,
|
|
||||||
sortable: false,
|
sortable: false,
|
||||||
display: 'flex',
|
|
||||||
renderCell: function render({row}) {
|
renderCell: function render({row}) {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
@ -2,6 +2,7 @@ import {type GridColDef} from '@mui/x-data-grid'
|
|||||||
import {CustomDataGrid} from '../../components/CustomDataGrid'
|
import {CustomDataGrid} from '../../components/CustomDataGrid'
|
||||||
import {DeleteButton, EditButton, List, ShowButton, useDataGrid} from '@refinedev/mui'
|
import {DeleteButton, EditButton, List, ShowButton, useDataGrid} from '@refinedev/mui'
|
||||||
import React from 'react'
|
import React from 'react'
|
||||||
|
import {MEDIA_TYPES} from '../../lib/constants'
|
||||||
|
|
||||||
import {localeText} from '../../locales/ru/localeText'
|
import {localeText} from '../../locales/ru/localeText'
|
||||||
|
|
||||||
@ -10,6 +11,15 @@ export const MediaList = () => {
|
|||||||
|
|
||||||
const columns = React.useMemo<GridColDef[]>(
|
const columns = React.useMemo<GridColDef[]>(
|
||||||
() => [
|
() => [
|
||||||
|
{
|
||||||
|
field: 'id',
|
||||||
|
headerName: 'ID',
|
||||||
|
type: 'number',
|
||||||
|
minWidth: 350,
|
||||||
|
display: 'flex',
|
||||||
|
align: 'left',
|
||||||
|
headerAlign: 'left',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
field: 'filename',
|
field: 'filename',
|
||||||
headerName: 'Название',
|
headerName: 'Название',
|
||||||
@ -22,28 +32,23 @@ export const MediaList = () => {
|
|||||||
{
|
{
|
||||||
field: 'media_type',
|
field: 'media_type',
|
||||||
headerName: 'Тип',
|
headerName: 'Тип',
|
||||||
type: 'number',
|
type: 'string',
|
||||||
minWidth: 150,
|
|
||||||
display: 'flex',
|
|
||||||
align: 'left',
|
|
||||||
headerAlign: 'left',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'id',
|
|
||||||
headerName: 'ID',
|
|
||||||
type: 'number',
|
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
align: 'left',
|
align: 'left',
|
||||||
headerAlign: 'left',
|
headerAlign: 'left',
|
||||||
flex: 1,
|
flex: 1,
|
||||||
|
renderCell: (params) => {
|
||||||
|
const value = params.row.media_type
|
||||||
|
return MEDIA_TYPES.find((type) => type.value === value)?.label || value
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'actions',
|
field: 'actions',
|
||||||
headerName: 'Действия',
|
headerName: 'Действия',
|
||||||
align: 'right',
|
minWidth: 120,
|
||||||
headerAlign: 'right',
|
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
flex: 1,
|
align: 'right',
|
||||||
|
headerAlign: 'center',
|
||||||
sortable: false,
|
sortable: false,
|
||||||
renderCell: function render({row}) {
|
renderCell: function render({row}) {
|
||||||
return (
|
return (
|
||||||
|
@ -31,6 +31,15 @@ export const RouteList = () => {
|
|||||||
align: 'left',
|
align: 'left',
|
||||||
headerAlign: 'left',
|
headerAlign: 'left',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
field: 'carrier',
|
||||||
|
headerName: 'Перевозчик',
|
||||||
|
type: 'string',
|
||||||
|
minWidth: 150,
|
||||||
|
display: 'flex',
|
||||||
|
align: 'left',
|
||||||
|
headerAlign: 'left',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
field: 'route_number',
|
field: 'route_number',
|
||||||
headerName: 'Номер маршрута',
|
headerName: 'Номер маршрута',
|
||||||
|
@ -54,15 +54,23 @@ export const SightList = () => {
|
|||||||
display: 'flex',
|
display: 'flex',
|
||||||
align: 'left',
|
align: 'left',
|
||||||
headerAlign: 'left',
|
headerAlign: 'left',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'city',
|
||||||
|
headerName: 'Город',
|
||||||
|
type: 'string',
|
||||||
|
minWidth: 150,
|
||||||
|
align: 'left',
|
||||||
|
headerAlign: 'left',
|
||||||
flex: 1,
|
flex: 1,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'actions',
|
field: 'actions',
|
||||||
headerName: 'Действия',
|
headerName: 'Действия',
|
||||||
align: 'right',
|
minWidth: 120,
|
||||||
headerAlign: 'right',
|
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
flex: 1,
|
align: 'right',
|
||||||
|
headerAlign: 'center',
|
||||||
sortable: false,
|
sortable: false,
|
||||||
renderCell: function render({row}) {
|
renderCell: function render({row}) {
|
||||||
return (
|
return (
|
||||||
|
@ -2,6 +2,7 @@ import {type GridColDef} from '@mui/x-data-grid'
|
|||||||
import {CustomDataGrid} from '../../components/CustomDataGrid'
|
import {CustomDataGrid} from '../../components/CustomDataGrid'
|
||||||
import {DeleteButton, EditButton, List, ShowButton, useDataGrid} from '@refinedev/mui'
|
import {DeleteButton, EditButton, List, ShowButton, useDataGrid} from '@refinedev/mui'
|
||||||
import React from 'react'
|
import React from 'react'
|
||||||
|
import {VEHICLE_TYPES} from '../../lib/constants'
|
||||||
|
|
||||||
import {localeText} from '../../locales/ru/localeText'
|
import {localeText} from '../../locales/ru/localeText'
|
||||||
|
|
||||||
@ -31,18 +32,29 @@ export const VehicleList = () => {
|
|||||||
{
|
{
|
||||||
field: 'type',
|
field: 'type',
|
||||||
headerName: 'Тип',
|
headerName: 'Тип',
|
||||||
type: 'number',
|
type: 'string',
|
||||||
|
minWidth: 200,
|
||||||
|
display: 'flex',
|
||||||
|
align: 'left',
|
||||||
|
headerAlign: 'left',
|
||||||
|
renderCell: (params) => {
|
||||||
|
const value = params.row.type
|
||||||
|
return VEHICLE_TYPES.find((type) => type.value === value)?.label || value
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'city_id',
|
||||||
|
headerName: 'ID города',
|
||||||
|
type: 'string',
|
||||||
minWidth: 150,
|
minWidth: 150,
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
align: 'left',
|
align: 'left',
|
||||||
headerAlign: 'left',
|
headerAlign: 'left',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'city_id',
|
field: 'city',
|
||||||
headerName: 'ID города',
|
headerName: 'Город',
|
||||||
type: 'number',
|
type: 'string',
|
||||||
minWidth: 70,
|
|
||||||
display: 'flex',
|
|
||||||
align: 'left',
|
align: 'left',
|
||||||
headerAlign: 'left',
|
headerAlign: 'left',
|
||||||
flex: 1,
|
flex: 1,
|
||||||
@ -50,12 +62,11 @@ export const VehicleList = () => {
|
|||||||
{
|
{
|
||||||
field: 'actions',
|
field: 'actions',
|
||||||
headerName: 'Действия',
|
headerName: 'Действия',
|
||||||
align: 'right',
|
minWidth: 120,
|
||||||
headerAlign: 'right',
|
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
flex: 1,
|
align: 'right',
|
||||||
|
headerAlign: 'center',
|
||||||
sortable: false,
|
sortable: false,
|
||||||
|
|
||||||
renderCell: function render({row}) {
|
renderCell: function render({row}) {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
Loading…
Reference in New Issue
Block a user