add path key for /route route
				
					
				
			This commit is contained in:
		| @@ -53,6 +53,20 @@ export const RouteCreate = () => { | |||||||
|           defaultValue={false} |           defaultValue={false} | ||||||
|           render={({field}: {field: any}) => <FormControlLabel control={<Checkbox {...field} checked={field.value} onChange={(e) => field.onChange(e.target.checked)} />} label="Направление маршрута" />} |           render={({field}: {field: any}) => <FormControlLabel control={<Checkbox {...field} checked={field.value} onChange={(e) => field.onChange(e.target.checked)} />} label="Направление маршрута" />} | ||||||
|         /> |         /> | ||||||
|  |         <TextField | ||||||
|  |           {...register('path', { | ||||||
|  |             required: 'Это поле является обязательным', | ||||||
|  |             setValueAs: (value) => String(value), | ||||||
|  |           })} | ||||||
|  |           error={!!(errors as any)?.path} | ||||||
|  |           helperText={(errors as any)?.path?.message} | ||||||
|  |           margin="normal" | ||||||
|  |           fullWidth | ||||||
|  |           InputLabelProps={{shrink: true}} | ||||||
|  |           type="text" | ||||||
|  |           label={'Путь'} | ||||||
|  |           name="path" | ||||||
|  |         /> | ||||||
|       </Box> |       </Box> | ||||||
|     </Create> |     </Create> | ||||||
|   ) |   ) | ||||||
|   | |||||||
| @@ -48,6 +48,20 @@ export const RouteEdit = () => { | |||||||
|           defaultValue={false} |           defaultValue={false} | ||||||
|           render={({field}: {field: any}) => <FormControlLabel control={<Checkbox {...field} checked={field.value} onChange={(e) => field.onChange(e.target.checked)} />} label="Направление маршрута" />} |           render={({field}: {field: any}) => <FormControlLabel control={<Checkbox {...field} checked={field.value} onChange={(e) => field.onChange(e.target.checked)} />} label="Направление маршрута" />} | ||||||
|         /> |         /> | ||||||
|  |         <TextField | ||||||
|  |           {...register('path', { | ||||||
|  |             required: 'Это поле является обязательным', | ||||||
|  |             setValueAs: (value) => String(value), | ||||||
|  |           })} | ||||||
|  |           error={!!(errors as any)?.path} | ||||||
|  |           helperText={(errors as any)?.path?.message} | ||||||
|  |           margin="normal" | ||||||
|  |           fullWidth | ||||||
|  |           InputLabelProps={{shrink: true}} | ||||||
|  |           type="text" | ||||||
|  |           label={'Путь'} | ||||||
|  |           name="path" | ||||||
|  |         /> | ||||||
|       </Box> |       </Box> | ||||||
|     </Edit> |     </Edit> | ||||||
|   ) |   ) | ||||||
|   | |||||||
| @@ -1,5 +1,6 @@ | |||||||
| import {DataGrid, type GridColDef} from '@mui/x-data-grid' | import {DataGrid, type GridColDef} from '@mui/x-data-grid' | ||||||
| import {DeleteButton, EditButton, List, ShowButton, useDataGrid} from '@refinedev/mui' | import {DeleteButton, EditButton, List, ShowButton, useDataGrid} from '@refinedev/mui' | ||||||
|  | import {Typography} from '@mui/material' | ||||||
| import React from 'react' | import React from 'react' | ||||||
|  |  | ||||||
| export const RouteList = () => { | export const RouteList = () => { | ||||||
| @@ -44,6 +45,7 @@ export const RouteList = () => { | |||||||
|         align: 'left', |         align: 'left', | ||||||
|         headerAlign: 'left', |         headerAlign: 'left', | ||||||
|         flex: 1, |         flex: 1, | ||||||
|  |         renderCell: ({value}) => <Typography style={{color: value ? '#48989f' : '#7f6b58'}}>{value ? 'прямое' : 'обратное'}</Typography>, | ||||||
|       }, |       }, | ||||||
|       { |       { | ||||||
|         field: 'actions', |         field: 'actions', | ||||||
|   | |||||||
| @@ -12,7 +12,7 @@ export const RouteShow = () => { | |||||||
|     // {label: 'ID', data: 'id'}, |     // {label: 'ID', data: 'id'}, | ||||||
|     {label: 'ID перевозчика', data: 'carrier_id'}, |     {label: 'ID перевозчика', data: 'carrier_id'}, | ||||||
|     {label: 'Номер маршрута', data: 'route_number'}, |     {label: 'Номер маршрута', data: 'route_number'}, | ||||||
|     {label: 'Направление маршрута', data: 'route_direction'}, |     {label: 'Путь', data: 'path'}, | ||||||
|   ] |   ] | ||||||
|  |  | ||||||
|   return ( |   return ( | ||||||
| @@ -26,6 +26,13 @@ export const RouteShow = () => { | |||||||
|             <TextField value={record?.[data]} /> |             <TextField value={record?.[data]} /> | ||||||
|           </Stack> |           </Stack> | ||||||
|         ))} |         ))} | ||||||
|  |  | ||||||
|  |         <Stack gap={1}> | ||||||
|  |           <Typography variant="body1" fontWeight="bold"> | ||||||
|  |             Направление маршрута | ||||||
|  |           </Typography> | ||||||
|  |           <TextField value={record?.route_direction ? 'ДА' : 'НЕТ'} /> | ||||||
|  |         </Stack> | ||||||
|       </Stack> |       </Stack> | ||||||
|     </Show> |     </Show> | ||||||
|   ) |   ) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user