update other pages with russian translation

This commit is contained in:
maxim 2025-02-19 15:34:43 +03:00
parent fbf1b443fd
commit 5aee851f58
33 changed files with 267 additions and 222 deletions

View File

@ -21,5 +21,61 @@
"edit": "Редактировать страну",
"show": "Показать страну"
}
},
"city": {
"titles": {
"create": "Создать город",
"edit": "Редактировать город",
"show": "Показать город"
}
},
"carrier": {
"titles": {
"create": "Создать перевозчика",
"edit": "Редактировать перевозчика",
"show": "Показать перевозчика"
}
},
"media": {
"titles": {
"create": "Создать медиа",
"edit": "Редактировать медиа",
"show": "Показать медиа"
}
},
"article": {
"titles": {
"create": "Создать статью",
"edit": "Редактировать статью",
"show": "Показать статью"
}
},
"sight": {
"titles": {
"create": "Создать вид",
"edit": "Редактировать вид",
"show": "Показать вид"
}
},
"station": {
"titles": {
"create": "Создать станцию",
"edit": "Редактировать станцию",
"show": "Показать станцию"
}
},
"vehicle": {
"titles": {
"create": "Создать транспорт",
"edit": "Редактировать транспорт",
"show": "Показать транспорт"
}
},
"route": {
"titles": {
"create": "Создать маршрут",
"edit": "Редактировать маршрут",
"show": "Показать маршрут"
}
}
}

View File

@ -19,7 +19,7 @@ export const ArticleCreate = () => {
<Box component="form" sx={{display: 'flex', flexDirection: 'column'}} autoComplete="off">
<TextField
{...register('heading', {
required: 'This field is required',
required: 'Это поле является обязательным',
})}
error={!!(errors as any)?.heading}
helperText={(errors as any)?.heading?.message}
@ -27,12 +27,12 @@ export const ArticleCreate = () => {
fullWidth
InputLabelProps={{shrink: true}}
type="text"
label={'Heading'}
label={'Заголовок'}
name="heading"
/>
<TextField
{...register('body', {
required: 'This field is required',
required: 'Это поле является обязательным',
})}
error={!!(errors as any)?.body}
helperText={(errors as any)?.body?.message}
@ -40,7 +40,7 @@ export const ArticleCreate = () => {
fullWidth
InputLabelProps={{shrink: true}}
type="text"
label={'Body'}
label={'Контент'}
name="body"
/>
</Box>

View File

@ -14,7 +14,7 @@ export const ArticleEdit = () => {
<Box component="form" sx={{display: 'flex', flexDirection: 'column'}} autoComplete="off">
<TextField
{...register('heading', {
required: 'This field is required',
required: 'Это поле является обязательным',
})}
error={!!(errors as any)?.heading}
helperText={(errors as any)?.heading?.message}
@ -22,12 +22,12 @@ export const ArticleEdit = () => {
fullWidth
InputLabelProps={{shrink: true}}
type="text"
label={'Heading'}
label={'Заголовок'}
name="heading"
/>
<TextField
{...register('body', {
required: 'This field is required',
required: 'Это поле является обязательным',
})}
error={!!(errors as any)?.body}
helperText={(errors as any)?.body?.message}
@ -35,7 +35,7 @@ export const ArticleEdit = () => {
fullWidth
InputLabelProps={{shrink: true}}
type="text"
label={'Body'}
label={'Контент'}
name="body"
/>
</Box>

View File

@ -20,7 +20,7 @@ export const ArticleList = () => {
},
{
field: 'heading',
headerName: 'Heading',
headerName: 'Заголовок',
type: 'string',
minWidth: 300,
display: 'flex',
@ -29,7 +29,7 @@ export const ArticleList = () => {
},
{
field: 'body',
headerName: 'Body',
headerName: 'Контент',
type: 'string',
display: 'flex',
align: 'left',
@ -38,7 +38,7 @@ export const ArticleList = () => {
},
{
field: 'actions',
headerName: 'Actions',
headerName: 'Действия',
align: 'right',
headerAlign: 'center',
minWidth: 120,

View File

@ -97,15 +97,15 @@ export const ArticleShow = () => {
}
const fields = [
{label: 'ID', data: 'id'},
{label: 'Heading', data: 'heading'},
{label: 'Body', data: 'body'},
// {label: 'ID', data: 'id'},
{label: 'Заголовок', data: 'heading'},
{label: 'Контент', data: 'body'},
]
const mediaFields = [
{label: 'ID', data: 'id' as keyof MediaItem},
{label: 'Filename', data: 'filename' as keyof MediaItem},
{label: 'Media Type', data: 'media_type' as keyof MediaItem},
// {label: 'ID', data: 'id' as keyof MediaItem},
{label: 'Имя', data: 'filename' as keyof MediaItem},
{label: 'Тип', data: 'media_type' as keyof MediaItem},
]
return (
@ -122,7 +122,7 @@ export const ArticleShow = () => {
<Stack gap={2}>
<Typography variant="body1" fontWeight="bold">
Media
Медиа
</Typography>
<Grid container gap={2}>
@ -145,25 +145,25 @@ export const ArticleShow = () => {
))}
<Button variant="outlined" color="error" onClick={() => deleteMedia(mediaItem?.id)} sx={{mt: 2}}>
Delete
Отвязать
</Button>
</Stack>
</Box>
))
) : (
<Typography>No media found</Typography>
<Typography>Медиа не найдены</Typography>
)}
</Grid>
<Stack gap={2}>
<Typography variant="body1" fontWeight="bold">
Link Media
Привязать медиа
</Typography>
<Stack gap={2.5}>
<FormControl fullWidth>
<InputLabel>Media</InputLabel>
<Select value={selectedMediaId} onChange={(e) => setSelectedMediaId(e.target.value)} label="Media" fullWidth>
<InputLabel>Медиа</InputLabel>
<Select value={selectedMediaId} onChange={(e) => setSelectedMediaId(e.target.value)} fullWidth>
{availableMedia.map((mediaItem) => (
<MenuItem key={mediaItem.id} value={mediaItem.id}>
{mediaItem.filename}
@ -173,11 +173,11 @@ export const ArticleShow = () => {
</FormControl>
<FormControl fullWidth>
<TextField type="number" label="Media Order" name="heading" value={mediaOrder} onChange={(e) => setMediaOrder(Number(e.target.value))} fullWidth InputLabelProps={{shrink: true}} />
<TextField type="number" label="Порядок отображения медиа" name="heading" value={mediaOrder} onChange={(e) => setMediaOrder(Number(e.target.value))} fullWidth InputLabelProps={{shrink: true}} />
</FormControl>
<Button variant="contained" onClick={linkMedia} disabled={!selectedMediaId}>
Link Media
Привязать
</Button>
</Stack>
</Stack>

View File

@ -22,7 +22,7 @@ export const CarrierCreate = () => {
<Controller
control={control}
name="city_id"
rules={{required: 'This field is required'}}
rules={{required: 'Это поле является обязательным'}}
defaultValue={null}
render={({field}) => (
<Autocomplete
@ -37,14 +37,14 @@ export const CarrierCreate = () => {
isOptionEqualToValue={(option, value) => {
return option.id === value?.id
}}
renderInput={(params) => <TextField {...params} label="Select City" margin="normal" variant="outlined" error={!!errors.city_id} helperText={(errors as any)?.city_id?.message} required />}
renderInput={(params) => <TextField {...params} label="Выберите город" margin="normal" variant="outlined" error={!!errors.city_id} helperText={(errors as any)?.city_id?.message} required />}
/>
)}
/>
<TextField
{...register('full_name', {
required: 'This field is required',
required: 'Это поле является обязательным',
})}
error={!!(errors as any)?.full_name}
helperText={(errors as any)?.full_name?.message}
@ -52,13 +52,13 @@ export const CarrierCreate = () => {
fullWidth
InputLabelProps={{shrink: true}}
type="text"
label={'Full Name'}
label={'Полное имя'}
name="full_name"
/>
<TextField
{...register('short_name', {
required: 'This field is required',
required: 'Это поле является обязательным',
})}
error={!!(errors as any)?.short_name}
helperText={(errors as any)?.short_name?.message}
@ -66,7 +66,7 @@ export const CarrierCreate = () => {
fullWidth
InputLabelProps={{shrink: true}}
type="text"
label={'Short Name'}
label={'Короткое имя'}
name="short_name"
/>
</Box>

View File

@ -21,7 +21,7 @@ export const CarrierEdit = () => {
<Controller
control={control}
name="city_id"
rules={{required: 'This field is required'}}
rules={{required: 'Это поле является обязательным'}}
defaultValue={null}
render={({field}) => (
<Autocomplete
@ -36,14 +36,14 @@ export const CarrierEdit = () => {
isOptionEqualToValue={(option, value) => {
return option.id === value?.id
}}
renderInput={(params) => <TextField {...params} label="Select City" margin="normal" variant="outlined" error={!!errors.city_id} helperText={(errors as any)?.city_id?.message} required />}
renderInput={(params) => <TextField {...params} label="Выберите город" margin="normal" variant="outlined" error={!!errors.city_id} helperText={(errors as any)?.city_id?.message} required />}
/>
)}
/>
<TextField
{...register('full_name', {
required: 'This field is required',
required: 'Это поле является обязательным',
})}
error={!!(errors as any)?.full_name}
helperText={(errors as any)?.full_name?.message}
@ -51,13 +51,13 @@ export const CarrierEdit = () => {
fullWidth
InputLabelProps={{shrink: true}}
type="text"
label={'Full Name'}
label={'Полное имя'}
name="full_name"
/>
<TextField
{...register('short_name', {
required: 'This field is required',
required: 'Это поле является обязательным',
})}
error={!!(errors as any)?.short_name}
helperText={(errors as any)?.short_name?.message}
@ -65,7 +65,7 @@ export const CarrierEdit = () => {
fullWidth
InputLabelProps={{shrink: true}}
type="text"
label={'Short Name'}
label={'Короткое имя'}
name="short_name"
/>
</Box>

View File

@ -17,7 +17,7 @@ export const CarrierList = () => {
},
{
field: 'city_id',
headerName: 'City ID',
headerName: 'ID Города',
type: 'number',
minWidth: 100,
align: 'left',
@ -25,20 +25,20 @@ export const CarrierList = () => {
},
{
field: 'full_name',
headerName: 'Full Name',
headerName: 'Полное имя',
type: 'string',
minWidth: 200,
},
{
field: 'short_name',
headerName: 'Short Name',
headerName: 'Короткое имя',
type: 'string',
minWidth: 150,
flex: 1,
},
{
field: 'actions',
headerName: 'Actions',
headerName: 'Действия',
align: 'right',
headerAlign: 'center',
minWidth: 120,

View File

@ -9,10 +9,10 @@ export const CarrierShow = () => {
const record = data?.data
const fields = [
{label: 'ID', data: 'id'},
{label: 'City ID', data: 'city_id'},
{label: 'Full Name', data: 'full_name'},
{label: 'Short Name', data: 'short_name'},
// {label: 'ID', data: 'id'},
{label: 'ID города', data: 'city_id'},
{label: 'Полное имя', data: 'full_name'},
{label: 'Короткое имя', data: 'short_name'},
]
return (

View File

@ -22,7 +22,7 @@ export const CityCreate = () => {
<Controller
control={control}
name="country_code"
rules={{required: 'This field is required'}}
rules={{required: 'Это поле является обязательным'}}
defaultValue={null}
render={({field}) => (
<Autocomplete
@ -37,14 +37,14 @@ export const CityCreate = () => {
isOptionEqualToValue={(option, value) => {
return option.id === value?.id
}}
renderInput={(params) => <TextField {...params} label="Country Code" margin="normal" variant="outlined" error={!!errors.country_code} helperText={(errors as any)?.country_code?.message} required />}
renderInput={(params) => <TextField {...params} label="Код страны" margin="normal" variant="outlined" error={!!errors.country_code} helperText={(errors as any)?.country_code?.message} required />}
/>
)}
/>
<TextField
{...register('name', {
required: 'This field is required',
required: 'Это поле является обязательным',
})}
error={!!(errors as any)?.name}
helperText={(errors as any)?.name?.message}
@ -52,7 +52,7 @@ export const CityCreate = () => {
fullWidth
InputLabelProps={{shrink: true}}
type="text"
label={'Name'}
label={'Название'}
name="name"
/>
</Box>

View File

@ -21,7 +21,7 @@ export const CityEdit = () => {
<Controller
control={control}
name="country_code"
rules={{required: 'This field is required'}}
rules={{required: 'Это поле является обязательным'}}
defaultValue={null}
render={({field}) => (
<Autocomplete
@ -36,14 +36,14 @@ export const CityEdit = () => {
isOptionEqualToValue={(option, value) => {
return option.id === value?.id
}}
renderInput={(params) => <TextField {...params} label="Country Code" margin="normal" variant="outlined" error={!!errors.country_code} helperText={(errors as any)?.country_code?.message} required />}
renderInput={(params) => <TextField {...params} label="Код страны" margin="normal" variant="outlined" error={!!errors.country_code} helperText={(errors as any)?.country_code?.message} required />}
/>
)}
/>
<TextField
{...register('name', {
required: 'This field is required',
required: 'Это поле является обязательным',
})}
error={!!(errors as any)?.title}
helperText={(errors as any)?.title?.message}
@ -51,7 +51,7 @@ export const CityEdit = () => {
fullWidth
InputLabelProps={{shrink: true}}
type="text"
label={'Name'}
label={'Название'}
name="name"
/>
</Box>

View File

@ -17,7 +17,7 @@ export const CityList = () => {
},
{
field: 'country_code',
headerName: 'Country Code',
headerName: 'Код страны',
type: 'string',
minWidth: 150,
align: 'left',
@ -25,14 +25,14 @@ export const CityList = () => {
},
{
field: 'name',
headerName: 'City Name',
headerName: 'Название',
type: 'string',
minWidth: 150,
flex: 1,
},
{
field: 'actions',
headerName: 'Actions',
headerName: 'Действия',
align: 'right',
headerAlign: 'center',
minWidth: 120,

View File

@ -9,9 +9,9 @@ export const CityShow = () => {
const record = data?.data
const fields = [
{label: 'ID', data: 'id'},
{label: 'City Name', data: 'name'},
{label: 'Country Code', data: 'country_code'},
// {label: 'ID', data: 'id'},
{label: 'Название', data: 'name'},
{label: 'Код страны', data: 'country_code'},
]
return (

View File

@ -56,7 +56,7 @@ export const MediaCreate = () => {
<Box display="flex" flexDirection="column-reverse" alignItems="center" gap={6}>
<Box display="flex" alignItems="center" gap={2}>
<Button variant="contained" component="label">
{selectedFile ? 'Change File' : 'Upload File'}
{selectedFile ? 'Изменить файл' : 'Загрузить файл'}
<input type="file" hidden onChange={handleFileChange} />
</Button>
@ -76,7 +76,7 @@ export const MediaCreate = () => {
<TextField
{...register('filename', {
required: 'This field is required',
required: 'Это поле является обязательным',
})}
error={!!(errors as any)?.filename}
helperText={(errors as any)?.filename?.message}
@ -84,13 +84,13 @@ export const MediaCreate = () => {
fullWidth
InputLabelProps={{shrink: true}}
type="text"
label="File Name"
label="Название"
name="filename"
/>
<TextField
{...register('media_type', {
required: 'This field is required',
required: 'Это поле является обязательным',
valueAsNumber: true,
})}
error={!!(errors as any)?.media_type}
@ -99,7 +99,7 @@ export const MediaCreate = () => {
fullWidth
InputLabelProps={{shrink: true}}
type="number"
label="Media Type"
label="Тип"
name="media_type"
/>
</Box>

View File

@ -44,7 +44,7 @@ export const MediaEdit = () => {
<Box display="flex" flexDirection="column-reverse" alignItems="center" gap={6}>
<Box display="flex" alignItems="center" gap={2}>
<Button variant="contained" component="label">
{selectedFile ? 'Change File' : 'Upload File'}
{selectedFile ? 'Изменить файл' : 'Загрузить файл'}
<input type="file" hidden onChange={handleFileChange} />
</Button>
@ -64,7 +64,7 @@ export const MediaEdit = () => {
<TextField
{...register('filename', {
required: 'This field is required',
required: 'Это поле является обязательным',
})}
error={!!(errors as any)?.filename}
helperText={(errors as any)?.filename?.message}
@ -72,13 +72,13 @@ export const MediaEdit = () => {
fullWidth
InputLabelProps={{shrink: true}}
type="text"
label="File Name"
label="Название"
name="filename"
/>
<TextField
{...register('media_type', {
required: 'This field is required',
required: 'Это поле является обязательным',
valueAsNumber: true,
})}
error={!!(errors as any)?.media_type}
@ -87,7 +87,7 @@ export const MediaEdit = () => {
fullWidth
InputLabelProps={{shrink: true}}
type="number"
label="Media Type"
label="Тип"
name="media_type"
/>
</Box>

View File

@ -9,7 +9,7 @@ export const MediaList = () => {
() => [
{
field: 'filename',
headerName: 'File name',
headerName: 'Название',
type: 'string',
minWidth: 250,
display: 'flex',
@ -18,7 +18,7 @@ export const MediaList = () => {
},
{
field: 'media_type',
headerName: 'Media Type',
headerName: 'Тип',
type: 'number',
minWidth: 150,
display: 'flex',
@ -36,7 +36,7 @@ export const MediaList = () => {
},
{
field: 'actions',
headerName: 'Actions',
headerName: 'Действия',
align: 'right',
headerAlign: 'center',
minWidth: 130,

View File

@ -8,31 +8,25 @@ export const MediaShow = () => {
const record = data?.data
const fields = [
{label: 'Название', data: 'filename'},
{label: 'Тип', data: 'media_type'},
{label: 'ID', data: 'id'},
]
return (
<Show isLoading={isLoading}>
<Stack gap={4}>
{record && <img src={`https://wn.krbl.ru/media/${record?.id}/download`} alt={record?.filename} style={{maxWidth: '100%', height: '40vh', objectFit: 'contain', borderRadius: 8}} />}
<Stack gap={1}>
<Typography variant="body1" fontWeight="bold">
{'File name'}
</Typography>
<TextField value={record?.filename} />
</Stack>
<Stack gap={1}>
<Typography variant="body1" fontWeight="bold">
{'Media Type'}
</Typography>
<TextField value={record?.media_type} />
</Stack>
<Stack gap={1}>
<Typography variant="body1" fontWeight="bold">
{'ID'}
</Typography>
<TextField value={record?.id} />
</Stack>
{fields.map(({label, data}) => (
<Stack key={data} gap={1}>
<Typography variant="body1" fontWeight="bold">
{label}
</Typography>
<TextField value={record?.[data]} />
</Stack>
))}
</Stack>
</Show>
)

View File

@ -21,7 +21,7 @@ export const RouteCreate = () => {
<Box component="form" sx={{display: 'flex', flexDirection: 'column'}} autoComplete="off">
<TextField
{...register('carrier_id', {
required: 'This field is required',
required: 'Это поле является обязательным',
valueAsNumber: true,
})}
error={!!(errors as any)?.carrier_id}
@ -30,12 +30,12 @@ export const RouteCreate = () => {
fullWidth
InputLabelProps={{shrink: true}}
type="number"
label={'Carrier ID'}
label={'ID перевозчика'}
name="carrier_id"
/>
<TextField
{...register('route_number', {
required: 'This field is required',
required: 'Это поле является обязательным',
setValueAs: (value) => String(value),
})}
error={!!(errors as any)?.route_number}
@ -44,14 +44,14 @@ export const RouteCreate = () => {
fullWidth
InputLabelProps={{shrink: true}}
type="text"
label={'Route Number'}
label={'Номер маршрута'}
name="route_number"
/>
<Controller
name="route_direction" // boolean
control={control}
defaultValue={false}
render={({field}: {field: any}) => <FormControlLabel control={<Checkbox {...field} checked={field.value} onChange={(e) => field.onChange(e.target.checked)} />} label="Route Direction" />}
render={({field}: {field: any}) => <FormControlLabel control={<Checkbox {...field} checked={field.value} onChange={(e) => field.onChange(e.target.checked)} />} label="Направление маршрута" />}
/>
</Box>
</Create>

View File

@ -16,7 +16,7 @@ export const RouteEdit = () => {
<Box component="form" sx={{display: 'flex', flexDirection: 'column'}} autoComplete="off">
<TextField
{...register('carrier_id', {
required: 'This field is required',
required: 'Это поле является обязательным',
valueAsNumber: true,
})}
error={!!(errors as any)?.carrier_id}
@ -25,12 +25,12 @@ export const RouteEdit = () => {
fullWidth
InputLabelProps={{shrink: true}}
type="number"
label={'Carrier ID'}
label={'ID перевозчика'}
name="carrier_id"
/>
<TextField
{...register('route_number', {
required: 'This field is required',
required: 'Это поле является обязательным',
setValueAs: (value) => String(value),
})}
error={!!(errors as any)?.route_number}
@ -39,14 +39,14 @@ export const RouteEdit = () => {
fullWidth
InputLabelProps={{shrink: true}}
type="text"
label={'Route Number'}
label={'Номер маршрута'}
name="route_number"
/>
<Controller
name="route_direction" // boolean
control={control}
defaultValue={false}
render={({field}: {field: any}) => <FormControlLabel control={<Checkbox {...field} checked={field.value} onChange={(e) => field.onChange(e.target.checked)} />} label="Route Direction" />}
render={({field}: {field: any}) => <FormControlLabel control={<Checkbox {...field} checked={field.value} onChange={(e) => field.onChange(e.target.checked)} />} label="Направление маршрута" />}
/>
</Box>
</Edit>

View File

@ -20,25 +20,25 @@ export const RouteList = () => {
},
{
field: 'carrier_id',
headerName: 'Carrier ID',
headerName: 'ID перевозчика',
type: 'number',
minWidth: 70,
display: 'flex',
align: 'left',
headerAlign: 'left',
},
{
field: 'route_number',
headerName: 'Route Number',
type: 'string',
minWidth: 150,
display: 'flex',
align: 'left',
headerAlign: 'left',
},
{
field: 'route_number',
headerName: 'Номер маршрута',
type: 'string',
minWidth: 170,
display: 'flex',
align: 'left',
headerAlign: 'left',
},
{
field: 'route_direction',
headerName: 'Route Direction',
headerName: 'Направление маршрута',
type: 'boolean',
display: 'flex',
align: 'left',
@ -47,7 +47,7 @@ export const RouteList = () => {
},
{
field: 'actions',
headerName: 'Actions',
headerName: 'Действия',
align: 'right',
headerAlign: 'center',
minWidth: 120,

View File

@ -9,10 +9,10 @@ export const RouteShow = () => {
const record = data?.data
const fields = [
{label: 'ID', data: 'id'},
{label: 'Carrier ID', data: 'carrier_id'},
{label: 'Route Number', data: 'route_number'},
{label: 'Route Direction', data: 'route_direction'},
// {label: 'ID', data: 'id'},
{label: 'ID перевозчика', data: 'carrier_id'},
{label: 'Номер маршрута', data: 'route_number'},
{label: 'Направление маршрута', data: 'route_direction'},
]
return (

View File

@ -25,7 +25,7 @@ export const SightCreate = () => {
<Box component="form" sx={{display: 'flex', flexDirection: 'column'}} autoComplete="off">
<TextField
{...register('name', {
required: 'This field is required',
required: 'Это поле является обязательным',
})}
error={!!(errors as any)?.name}
helperText={(errors as any)?.name?.message}
@ -33,12 +33,12 @@ export const SightCreate = () => {
fullWidth
InputLabelProps={{shrink: true}}
type="text"
label={'Name'}
label={'Название'}
name="name"
/>
<TextField
{...register('latitude', {
required: 'This field is required',
required: 'Это поле является обязательным',
valueAsNumber: true,
})}
error={!!(errors as any)?.latitude}
@ -47,12 +47,12 @@ export const SightCreate = () => {
fullWidth
InputLabelProps={{shrink: true}}
type="number"
label={'Latitude'}
label={'Широта'}
name="latitude"
/>
<TextField
{...register('longitude', {
required: 'This field is required',
required: 'Это поле является обязательным',
valueAsNumber: true,
})}
error={!!(errors as any)?.longitude}
@ -61,14 +61,14 @@ export const SightCreate = () => {
fullWidth
InputLabelProps={{shrink: true}}
type="number"
label={'Longitude'}
label={'Долгота'}
name="longitude"
/>
<Controller
control={control}
name="city_id"
rules={{required: 'This field is required'}}
rules={{required: 'Это поле является обязательным'}}
defaultValue={null}
render={({field}) => (
<Autocomplete
@ -83,7 +83,7 @@ export const SightCreate = () => {
isOptionEqualToValue={(option, value) => {
return option.id === value?.id
}}
renderInput={(params) => <TextField {...params} label="Select City" margin="normal" variant="outlined" error={!!errors.city_id} helperText={(errors as any)?.city_id?.message} required />}
renderInput={(params) => <TextField {...params} label="Выберите город" margin="normal" variant="outlined" error={!!errors.city_id} helperText={(errors as any)?.city_id?.message} required />}
/>
)}
/>

View File

@ -20,7 +20,7 @@ export const SightEdit = () => {
<Box component="form" sx={{display: 'flex', flexDirection: 'column'}} autoComplete="off">
<TextField
{...register('name', {
required: 'This field is required',
required: 'Это поле является обязательным',
})}
error={!!(errors as any)?.name}
helperText={(errors as any)?.name?.message}
@ -28,12 +28,12 @@ export const SightEdit = () => {
fullWidth
InputLabelProps={{shrink: true}}
type="text"
label={'Name'}
label={'Название'}
name="name"
/>
<TextField
{...register('latitude', {
required: 'This field is required',
required: 'Это поле является обязательным',
valueAsNumber: true,
})}
error={!!(errors as any)?.latitude}
@ -42,12 +42,12 @@ export const SightEdit = () => {
fullWidth
InputLabelProps={{shrink: true}}
type="number"
label={'Latitude'}
label={'Широта'}
name="latitude"
/>
<TextField
{...register('longitude', {
required: 'This field is required',
required: 'Это поле является обязательным',
valueAsNumber: true,
})}
error={!!(errors as any)?.longitude}
@ -56,13 +56,13 @@ export const SightEdit = () => {
fullWidth
InputLabelProps={{shrink: true}}
type="number"
label={'Longitude'}
label={'Долгота'}
name="longitude"
/>
<Controller
control={control}
name="city_id"
rules={{required: 'This field is required'}}
rules={{required: 'Это поле является обязательным'}}
defaultValue={null}
render={({field}) => (
<Autocomplete
@ -77,7 +77,7 @@ export const SightEdit = () => {
isOptionEqualToValue={(option, value) => {
return option.id === value?.id
}}
renderInput={(params) => <TextField {...params} label="Select City" margin="normal" variant="outlined" error={!!errors.city_id} helperText={(errors as any)?.city_id?.message} required />}
renderInput={(params) => <TextField {...params} label="Выберите город" margin="normal" variant="outlined" error={!!errors.city_id} helperText={(errors as any)?.city_id?.message} required />}
/>
)}
/>

View File

@ -20,16 +20,16 @@ export const SightList = () => {
},
{
field: 'name',
headerName: 'Name',
headerName: 'Название',
type: 'string',
minWidth: 200,
minWidth: 150,
display: 'flex',
align: 'left',
headerAlign: 'left',
},
{
field: 'latitude',
headerName: 'Latitude',
headerName: 'Широта',
type: 'number',
minWidth: 150,
display: 'flex',
@ -38,7 +38,7 @@ export const SightList = () => {
},
{
field: 'longitude',
headerName: 'Longitude',
headerName: 'Долгота',
type: 'number',
minWidth: 150,
display: 'flex',
@ -47,7 +47,7 @@ export const SightList = () => {
},
{
field: 'city_id',
headerName: 'City ID',
headerName: 'ID города',
type: 'number',
minWidth: 70,
display: 'flex',
@ -57,7 +57,7 @@ export const SightList = () => {
},
{
field: 'actions',
headerName: 'Actions',
headerName: 'Действия',
align: 'right',
headerAlign: 'center',
minWidth: 120,

View File

@ -97,11 +97,11 @@ export const SightShow = () => {
}
const fields = [
{label: 'ID', data: 'id'},
{label: 'Name', data: 'name'},
{label: 'Latitude', data: 'latitude'},
{label: 'Longitude', data: 'longitude'},
{label: 'City ID', data: 'city_id'},
// {label: 'ID', data: 'id'},
{label: 'Название', data: 'name'},
{label: 'Широта', data: 'latitude'},
{label: 'Долгота', data: 'longitude'},
{label: 'ID города', data: 'city_id'},
]
return (
@ -118,46 +118,41 @@ export const SightShow = () => {
<Stack gap={2}>
<Typography variant="body1" fontWeight="bold">
Linked Articles
Привязанные статьи
</Typography>
<Grid container gap={2}>
{articlesLoading ? (
<Typography>Loading articles...</Typography>
<Typography>Загрузка статей...</Typography>
) : linkedArticles.length > 0 ? (
linkedArticles.map((article) => (
<Box key={article.id} sx={{border: '2px solid #dddddd25', padding: '20px', marginBottom: '8px'}}>
<Stack gap={0.5}>
<Typography>
<strong>ID:</strong> {article.id}
</Typography>
<Typography>
<strong>Heading:</strong> {article.heading}
</Typography>
<Typography>
<strong>Body:</strong> {article.body}
<Stack gap={1}>
<Typography variant="h5">
<strong>{article.heading}</strong>
</Typography>
<Typography>{article.body}</Typography>
<Button variant="outlined" color="error" onClick={() => deleteArticle(article.id)} sx={{mt: 2}}>
Unlink Article
Отвязать статью
</Button>
</Stack>
</Box>
))
) : (
<Typography>No articles linked</Typography>
<Typography>Статьи не найдены</Typography>
)}
</Grid>
<Stack gap={2}>
<Typography variant="body1" fontWeight="bold">
Link Article
Привязать статью
</Typography>
<Stack gap={2.5}>
<FormControl fullWidth>
<InputLabel>Article</InputLabel>
<Select value={selectedArticleId} onChange={(e) => setSelectedArticleId(Number(e.target.value))} label="Article" fullWidth>
<InputLabel>Статья</InputLabel>
<Select value={selectedArticleId} onChange={(e) => setSelectedArticleId(Number(e.target.value))} label="Статья" fullWidth>
{availableArticles.map((article) => (
<MenuItem key={article.id} value={article.id}>
{article.heading}
@ -167,11 +162,11 @@ export const SightShow = () => {
</FormControl>
<FormControl fullWidth>
<TextField type="number" label="Page Number" name="page_num" value={pageNum} onChange={(e) => setPageNum(Number(e.target.value))} fullWidth InputLabelProps={{shrink: true}} />
<TextField type="number" label="Номер страницы" name="page_num" value={pageNum} onChange={(e) => setPageNum(Number(e.target.value))} fullWidth InputLabelProps={{shrink: true}} />
</FormControl>
<Button variant="contained" onClick={linkArticle} disabled={!selectedArticleId}>
Link Article
Привязать
</Button>
</Stack>
</Stack>

View File

@ -19,7 +19,7 @@ export const StationCreate = () => {
<Box component="form" sx={{display: 'flex', flexDirection: 'column'}} autoComplete="off">
<TextField
{...register('name', {
required: 'This field is required',
required: 'Это поле является обязательным',
})}
error={!!(errors as any)?.name}
helperText={(errors as any)?.name?.message}
@ -27,12 +27,12 @@ export const StationCreate = () => {
fullWidth
InputLabelProps={{shrink: true}}
type="text"
label={'Name'}
label={'Название'}
name="name"
/>
<TextField
{...register('description', {
required: 'This field is required',
required: 'Это поле является обязательным',
})}
error={!!(errors as any)?.description}
helperText={(errors as any)?.description?.message}
@ -40,12 +40,12 @@ export const StationCreate = () => {
fullWidth
InputLabelProps={{shrink: true}}
type="text"
label={'Description'}
label={'Описание'}
name="description"
/>
<TextField
{...register('latitude', {
required: 'This field is required',
required: 'Это поле является обязательным',
valueAsNumber: true,
})}
error={!!(errors as any)?.latitude}
@ -54,12 +54,12 @@ export const StationCreate = () => {
fullWidth
InputLabelProps={{shrink: true}}
type="number"
label={'Latitude'}
label={'Широта'}
name="latitude"
/>
<TextField
{...register('longitude', {
required: 'This field is required',
required: 'Это поле является обязательным',
valueAsNumber: true,
})}
error={!!(errors as any)?.longitude}
@ -68,7 +68,7 @@ export const StationCreate = () => {
fullWidth
InputLabelProps={{shrink: true}}
type="number"
label={'Longitude'}
label={'Долгота'}
name="longitude"
/>
</Box>

View File

@ -14,7 +14,7 @@ export const StationEdit = () => {
<Box component="form" sx={{display: 'flex', flexDirection: 'column'}} autoComplete="off">
<TextField
{...register('name', {
required: 'This field is required',
required: 'Это поле является обязательным',
})}
error={!!(errors as any)?.name}
helperText={(errors as any)?.name?.message}
@ -22,12 +22,12 @@ export const StationEdit = () => {
fullWidth
InputLabelProps={{shrink: true}}
type="text"
label={'Name'}
label={'Название'}
name="name"
/>
<TextField
{...register('description', {
required: 'This field is required',
required: 'Это поле является обязательным',
})}
error={!!(errors as any)?.description}
helperText={(errors as any)?.description?.message}
@ -35,12 +35,12 @@ export const StationEdit = () => {
fullWidth
InputLabelProps={{shrink: true}}
type="text"
label={'Description'}
label={'Описание'}
name="description"
/>
<TextField
{...register('latitude', {
required: 'This field is required',
required: 'Это поле является обязательным',
valueAsNumber: true,
})}
error={!!(errors as any)?.latitude}
@ -49,12 +49,12 @@ export const StationEdit = () => {
fullWidth
InputLabelProps={{shrink: true}}
type="number"
label={'Latitude'}
label={'Широта'}
name="latitude"
/>
<TextField
{...register('longitude', {
required: 'This field is required',
required: 'Это поле является обязательным',
valueAsNumber: true,
})}
error={!!(errors as any)?.longitude}
@ -63,7 +63,7 @@ export const StationEdit = () => {
fullWidth
InputLabelProps={{shrink: true}}
type="number"
label={'Longitude'}
label={'Долгота'}
name="longitude"
/>
</Box>

View File

@ -20,7 +20,7 @@ export const StationList = () => {
},
{
field: 'name',
headerName: 'Name',
headerName: 'Название',
type: 'string',
minWidth: 300,
display: 'flex',
@ -29,7 +29,7 @@ export const StationList = () => {
},
{
field: 'latitude',
headerName: 'Latitude',
headerName: 'Широта',
type: 'number',
minWidth: 150,
display: 'flex',
@ -38,7 +38,7 @@ export const StationList = () => {
},
{
field: 'longitude',
headerName: 'Longitude',
headerName: 'Долгота',
type: 'number',
minWidth: 150,
display: 'flex',
@ -47,7 +47,7 @@ export const StationList = () => {
},
{
field: 'description',
headerName: 'Description',
headerName: 'Описание',
type: 'string',
display: 'flex',
align: 'left',
@ -56,7 +56,7 @@ export const StationList = () => {
},
{
field: 'actions',
headerName: 'Actions',
headerName: 'Действия',
align: 'right',
headerAlign: 'center',
minWidth: 120,

View File

@ -96,19 +96,19 @@ export const StationShow = () => {
}
const fields = [
{label: 'ID', data: 'id'},
{label: 'Name', data: 'name'},
{label: 'Latitude', data: 'latitude'},
{label: 'Longitude', data: 'longitude'},
{label: 'Description', data: 'description'},
// {label: 'ID', data: 'id'},
{label: 'Название', data: 'name'},
{label: 'Широта', data: 'latitude'},
{label: 'Долгота', data: 'longitude'},
{label: 'Описание', data: 'description'},
]
const sightFields = [
{label: 'ID', data: 'id' as keyof SightItem},
{label: 'Name', data: 'name' as keyof SightItem},
{label: 'Latitude', data: 'latitude' as keyof SightItem},
{label: 'Longitude', data: 'longitude' as keyof SightItem},
{label: 'City ID', data: 'city_id' as keyof SightItem},
// {label: 'ID', data: 'id' as keyof SightItem},
{label: 'Название', data: 'name' as keyof SightItem},
{label: 'Широта', data: 'latitude' as keyof SightItem},
{label: 'Долгота', data: 'longitude' as keyof SightItem},
{label: 'ID города', data: 'city_id' as keyof SightItem},
]
return (
@ -125,12 +125,12 @@ export const StationShow = () => {
<Stack gap={2}>
<Typography variant="body1" fontWeight="bold">
Linked Sights
Привязанные виды
</Typography>
<Grid container gap={2}>
{sightsLoading ? (
<Typography>Loading sights...</Typography>
<Typography>Загрузка видов...</Typography>
) : linkedSights.length > 0 ? (
linkedSights.map((sight, index) => (
<Box key={index} sx={{border: '2px solid #dddddd25', padding: '20px', marginBottom: '8px'}}>
@ -142,24 +142,24 @@ export const StationShow = () => {
))}
<Button variant="outlined" color="error" onClick={() => deleteSight(sight?.id)} sx={{mt: 2}}>
Delete
Отвязать
</Button>
</Stack>
</Box>
))
) : (
<Typography>No sights found</Typography>
<Typography>Виды не найдены</Typography>
)}
</Grid>
<Stack gap={2}>
<Typography variant="body1" fontWeight="bold">
Link Sight
Привязать вид
</Typography>
<FormControl fullWidth>
<InputLabel>Sight</InputLabel>
<Select value={selectedSightId} onChange={(e) => setSelectedSightId(Number(e.target.value))} label="Sight" fullWidth>
<InputLabel>Вид</InputLabel>
<Select value={selectedSightId} onChange={(e) => setSelectedSightId(Number(e.target.value))} label="Вид" fullWidth>
{availableSights.map((sight) => (
<MenuItem key={sight.id} value={sight.id}>
{sight.name}
@ -169,7 +169,7 @@ export const StationShow = () => {
</FormControl>
<Button variant="contained" onClick={linkSight} disabled={!selectedSightId}>
Link Sight
Привязать
</Button>
</Stack>
</Stack>

View File

@ -21,7 +21,7 @@ export const VehicleCreate = () => {
<Box component="form" sx={{display: 'flex', flexDirection: 'column'}} autoComplete="off">
<TextField
{...register('tail_number', {
required: 'This field is required',
required: 'Это поле является обязательным',
valueAsNumber: true,
})}
error={!!(errors as any)?.tail_number}
@ -30,12 +30,12 @@ export const VehicleCreate = () => {
fullWidth
InputLabelProps={{shrink: true}}
type="number"
label={'Tail Number'}
label={'Номер рейса'}
name="tail_number"
/>
<TextField
{...register('type', {
required: 'This field is required',
required: 'Это поле является обязательным',
valueAsNumber: true,
})}
error={!!(errors as any)?.type}
@ -44,14 +44,14 @@ export const VehicleCreate = () => {
fullWidth
InputLabelProps={{shrink: true}}
type="number"
label={'Type'}
label={'Тип'}
name="type"
/>
<Controller
control={control}
name="city_id"
rules={{required: 'This field is required'}}
rules={{required: 'Это поле является обязательным'}}
defaultValue={null}
render={({field}) => (
<Autocomplete
@ -66,7 +66,7 @@ export const VehicleCreate = () => {
isOptionEqualToValue={(option, value) => {
return option.id === value?.id
}}
renderInput={(params) => <TextField {...params} label="Select City" margin="normal" variant="outlined" error={!!errors.city_id} helperText={(errors as any)?.city_id?.message} required />}
renderInput={(params) => <TextField {...params} label="Выберите город" margin="normal" variant="outlined" error={!!errors.city_id} helperText={(errors as any)?.city_id?.message} required />}
/>
)}
/>

View File

@ -20,7 +20,7 @@ export const VehicleEdit = () => {
<Box component="form" sx={{display: 'flex', flexDirection: 'column'}} autoComplete="off">
<TextField
{...register('tail_number', {
required: 'This field is required',
required: 'Это поле является обязательным',
valueAsNumber: true,
})}
error={!!(errors as any)?.tail_number}
@ -29,12 +29,12 @@ export const VehicleEdit = () => {
fullWidth
InputLabelProps={{shrink: true}}
type="number"
label={'Tail Number'}
label={'Номер рейса'}
name="tail_number"
/>
<TextField
{...register('type', {
required: 'This field is required',
required: 'Это поле является обязательным',
valueAsNumber: true,
})}
error={!!(errors as any)?.type}
@ -43,14 +43,14 @@ export const VehicleEdit = () => {
fullWidth
InputLabelProps={{shrink: true}}
type="number"
label={'Type'}
label={'Тип'}
name="type"
/>
<Controller
control={control}
name="city_id"
rules={{required: 'This field is required'}}
rules={{required: 'Это поле является обязательным'}}
render={({field}) => (
<Autocomplete
{...cityAutocompleteProps}
@ -64,7 +64,7 @@ export const VehicleEdit = () => {
isOptionEqualToValue={(option, value) => {
return option.id === value?.id
}}
renderInput={(params) => <TextField {...params} label="Select City" margin="normal" variant="outlined" error={!!errors.city_id} helperText={(errors as any)?.city_id?.message} required />}
renderInput={(params) => <TextField {...params} label="Выберите город" margin="normal" variant="outlined" error={!!errors.city_id} helperText={(errors as any)?.city_id?.message} required />}
/>
)}
/>

View File

@ -18,7 +18,7 @@ export const VehicleList = () => {
},
{
field: 'tail_number',
headerName: 'Tail Number',
headerName: 'Номер рейса',
type: 'number',
minWidth: 150,
display: 'flex',
@ -27,7 +27,7 @@ export const VehicleList = () => {
},
{
field: 'type',
headerName: 'Type',
headerName: 'Тип',
type: 'number',
minWidth: 150,
display: 'flex',
@ -36,7 +36,7 @@ export const VehicleList = () => {
},
{
field: 'city_id',
headerName: 'City ID',
headerName: 'ID города',
type: 'number',
minWidth: 70,
display: 'flex',
@ -46,7 +46,7 @@ export const VehicleList = () => {
},
{
field: 'actions',
headerName: 'Actions',
headerName: 'Действия',
align: 'right',
headerAlign: 'center',
minWidth: 120,

View File

@ -9,10 +9,10 @@ export const VehicleShow = () => {
const record = data?.data
const fields = [
{label: 'ID', data: 'id'},
{label: 'Tail Number', data: 'tail_number'},
{label: 'Type', data: 'type'},
{label: 'City_id', data: 'city_id'},
// {label: 'ID', data: 'id'},
{label: 'Номер рейса', data: 'tail_number'},
{label: 'Тип', data: 'type'},
{label: 'ID города', data: 'city_id'},
]
return (