add media_name
prop for other routes
This commit is contained in:
@ -164,7 +164,7 @@ export const LinkedItems = <T extends {id: number; [key: string]: any}>({parentI
|
|||||||
{childResource === 'media' && item.id && (
|
{childResource === 'media' && item.id && (
|
||||||
<img
|
<img
|
||||||
src={`https://wn.krbl.ru/media/${item.id}/download`}
|
src={`https://wn.krbl.ru/media/${item.id}/download`}
|
||||||
alt={String(item.filename)}
|
alt={String(item.media_name)}
|
||||||
style={{
|
style={{
|
||||||
width: '100%',
|
width: '100%',
|
||||||
height: '120px',
|
height: '120px',
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
export type MediaItem = {
|
export type MediaItem = {
|
||||||
id: number
|
id: number
|
||||||
filename: string
|
filename: string
|
||||||
|
media_name: string
|
||||||
media_type: string
|
media_type: string
|
||||||
media_order?: number
|
media_order?: number
|
||||||
}
|
}
|
||||||
@ -23,6 +24,6 @@ export const articleFields: Array<FieldType<ArticleItem>> = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
export const mediaFields: Array<FieldType<MediaItem>> = [
|
export const mediaFields: Array<FieldType<MediaItem>> = [
|
||||||
{label: 'Имя', data: 'filename'},
|
{label: 'Название', data: 'media_name'},
|
||||||
{label: 'Тип', data: 'media_type'},
|
{label: 'Тип', data: 'media_type'},
|
||||||
]
|
]
|
||||||
|
@ -27,7 +27,7 @@ export const CarrierCreate = () => {
|
|||||||
resource: 'media',
|
resource: 'media',
|
||||||
onSearch: (value) => [
|
onSearch: (value) => [
|
||||||
{
|
{
|
||||||
field: 'filename',
|
field: 'media_name',
|
||||||
operator: 'contains',
|
operator: 'contains',
|
||||||
value,
|
value,
|
||||||
},
|
},
|
||||||
@ -183,13 +183,13 @@ export const CarrierCreate = () => {
|
|||||||
field.onChange(value?.id || '')
|
field.onChange(value?.id || '')
|
||||||
}}
|
}}
|
||||||
getOptionLabel={(item) => {
|
getOptionLabel={(item) => {
|
||||||
return item ? item.filename : ''
|
return item ? item.media_name : ''
|
||||||
}}
|
}}
|
||||||
isOptionEqualToValue={(option, value) => {
|
isOptionEqualToValue={(option, value) => {
|
||||||
return option.id === value?.id
|
return option.id === value?.id
|
||||||
}}
|
}}
|
||||||
filterOptions={(options, {inputValue}) => {
|
filterOptions={(options, {inputValue}) => {
|
||||||
return options.filter((option) => option.filename.toLowerCase().includes(inputValue.toLowerCase()))
|
return options.filter((option) => option.media_name.toLowerCase().includes(inputValue.toLowerCase()))
|
||||||
}}
|
}}
|
||||||
renderInput={(params) => <TextField {...params} label="Выберите логотип" margin="normal" variant="outlined" error={!!errors.logo} helperText={(errors as any)?.logo?.message} />}
|
renderInput={(params) => <TextField {...params} label="Выберите логотип" margin="normal" variant="outlined" error={!!errors.logo} helperText={(errors as any)?.logo?.message} />}
|
||||||
/>
|
/>
|
||||||
|
@ -26,7 +26,7 @@ export const CarrierEdit = () => {
|
|||||||
resource: 'media',
|
resource: 'media',
|
||||||
onSearch: (value) => [
|
onSearch: (value) => [
|
||||||
{
|
{
|
||||||
field: 'filename',
|
field: 'media_name',
|
||||||
operator: 'contains',
|
operator: 'contains',
|
||||||
value,
|
value,
|
||||||
},
|
},
|
||||||
@ -182,13 +182,13 @@ export const CarrierEdit = () => {
|
|||||||
field.onChange(value?.id || '')
|
field.onChange(value?.id || '')
|
||||||
}}
|
}}
|
||||||
getOptionLabel={(item) => {
|
getOptionLabel={(item) => {
|
||||||
return item ? item.filename : ''
|
return item ? item.media_name : ''
|
||||||
}}
|
}}
|
||||||
isOptionEqualToValue={(option, value) => {
|
isOptionEqualToValue={(option, value) => {
|
||||||
return option.id === value?.id
|
return option.id === value?.id
|
||||||
}}
|
}}
|
||||||
filterOptions={(options, {inputValue}) => {
|
filterOptions={(options, {inputValue}) => {
|
||||||
return options.filter((option) => option.filename.toLowerCase().includes(inputValue.toLowerCase()))
|
return options.filter((option) => option.media_name.toLowerCase().includes(inputValue.toLowerCase()))
|
||||||
}}
|
}}
|
||||||
renderInput={(params) => <TextField {...params} label="Выберите логотип" margin="normal" variant="outlined" error={!!errors.logo} helperText={(errors as any)?.logo?.message} />}
|
renderInput={(params) => <TextField {...params} label="Выберите логотип" margin="normal" variant="outlined" error={!!errors.logo} helperText={(errors as any)?.logo?.message} />}
|
||||||
/>
|
/>
|
||||||
|
@ -20,7 +20,7 @@ export const CityCreate = () => {
|
|||||||
resource: 'media',
|
resource: 'media',
|
||||||
onSearch: (value) => [
|
onSearch: (value) => [
|
||||||
{
|
{
|
||||||
field: 'filename',
|
field: 'media_name',
|
||||||
operator: 'contains',
|
operator: 'contains',
|
||||||
value,
|
value,
|
||||||
},
|
},
|
||||||
@ -79,13 +79,13 @@ export const CityCreate = () => {
|
|||||||
field.onChange(value?.id || '')
|
field.onChange(value?.id || '')
|
||||||
}}
|
}}
|
||||||
getOptionLabel={(item) => {
|
getOptionLabel={(item) => {
|
||||||
return item ? item.filename : ''
|
return item ? item.media_name : ''
|
||||||
}}
|
}}
|
||||||
isOptionEqualToValue={(option, value) => {
|
isOptionEqualToValue={(option, value) => {
|
||||||
return option.id === value?.id
|
return option.id === value?.id
|
||||||
}}
|
}}
|
||||||
filterOptions={(options, {inputValue}) => {
|
filterOptions={(options, {inputValue}) => {
|
||||||
return options.filter((option) => option.filename.toLowerCase().includes(inputValue.toLowerCase()))
|
return options.filter((option) => option.media_name.toLowerCase().includes(inputValue.toLowerCase()))
|
||||||
}}
|
}}
|
||||||
renderInput={(params) => <TextField {...params} label="Выберите герб" margin="normal" variant="outlined" error={!!errors.arms} helperText={(errors as any)?.arms?.message} />}
|
renderInput={(params) => <TextField {...params} label="Выберите герб" margin="normal" variant="outlined" error={!!errors.arms} helperText={(errors as any)?.arms?.message} />}
|
||||||
/>
|
/>
|
||||||
|
@ -19,7 +19,7 @@ export const CityEdit = () => {
|
|||||||
resource: 'media',
|
resource: 'media',
|
||||||
onSearch: (value) => [
|
onSearch: (value) => [
|
||||||
{
|
{
|
||||||
field: 'filename',
|
field: 'media_name',
|
||||||
operator: 'contains',
|
operator: 'contains',
|
||||||
value,
|
value,
|
||||||
},
|
},
|
||||||
@ -79,13 +79,13 @@ export const CityEdit = () => {
|
|||||||
field.onChange(value?.id || '')
|
field.onChange(value?.id || '')
|
||||||
}}
|
}}
|
||||||
getOptionLabel={(item) => {
|
getOptionLabel={(item) => {
|
||||||
return item ? item.filename : ''
|
return item ? item.media_name : ''
|
||||||
}}
|
}}
|
||||||
isOptionEqualToValue={(option, value) => {
|
isOptionEqualToValue={(option, value) => {
|
||||||
return option.id === value?.id
|
return option.id === value?.id
|
||||||
}}
|
}}
|
||||||
filterOptions={(options, {inputValue}) => {
|
filterOptions={(options, {inputValue}) => {
|
||||||
return options.filter((option) => option.filename.toLowerCase().includes(inputValue.toLowerCase()))
|
return options.filter((option) => option.media_name.toLowerCase().includes(inputValue.toLowerCase()))
|
||||||
}}
|
}}
|
||||||
renderInput={(params) => <TextField {...params} label="Выберите герб" margin="normal" variant="outlined" error={!!errors.arms} helperText={(errors as any)?.arms?.message} />}
|
renderInput={(params) => <TextField {...params} label="Выберите герб" margin="normal" variant="outlined" error={!!errors.arms} helperText={(errors as any)?.arms?.message} />}
|
||||||
/>
|
/>
|
||||||
|
Reference in New Issue
Block a user