Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
C
cms
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Pedro-dev_2
cms
Commits
7328ff4b
Commit
7328ff4b
authored
May 23, 2021
by
PDuarte
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
asset genre subgenre UI
parent
6c0e4a98
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
170 additions
and
7 deletions
+170
-7
index.js
src/views/assets/projectassets/add/index.js
+6
-2
index.js
src/views/assets/projectassets/card/index.js
+161
-4
main.js
src/views/assets/projectassets/edit/main.js
+3
-1
No files found.
src/views/assets/projectassets/add/index.js
View file @
7328ff4b
...
@@ -29,7 +29,9 @@ const Tables = () => {
...
@@ -29,7 +29,9 @@ const Tables = () => {
parentid
:
values
.
parentid
,
parentid
:
values
.
parentid
,
parenttype
:
values
.
parenttype
,
parenttype
:
values
.
parenttype
,
external_id
:
values
.
external_id
,
external_id
:
values
.
external_id
,
textual
:
values
.
textual
textual
:
values
.
textual
,
genres
:
values
.
genres
,
subgenres
:
values
.
subgenres
}
}
)
)
)
)
...
@@ -57,7 +59,9 @@ const Tables = () => {
...
@@ -57,7 +59,9 @@ const Tables = () => {
parentid
:
null
,
parentid
:
null
,
parenttype
:
null
,
parenttype
:
null
,
external_id
:
''
,
external_id
:
''
,
textual
:
[]
textual
:
[],
genres
:
[],
subgenres
:
[]
}}
}}
onSubmitHandler
=
{
onSubmitHandler
}
onSubmitHandler
=
{
onSubmitHandler
}
/
>
/
>
...
...
src/views/assets/projectassets/card/index.js
View file @
7328ff4b
...
@@ -4,12 +4,14 @@ import { useSelector, useDispatch } from 'react-redux'
...
@@ -4,12 +4,14 @@ import { useSelector, useDispatch } from 'react-redux'
import
{
toast
}
from
'react-toastify'
import
{
toast
}
from
'react-toastify'
import
Avatar
from
'@components/avatar'
import
Avatar
from
'@components/avatar'
import
Select
,
{
components
}
from
'react-select'
import
{
Media
,
Button
,
Label
,
Form
,
FormGroup
,
Input
,
Table
,
CustomInput
,
Card
,
CardBody
,
Row
,
Col
,
Nav
,
NavItem
,
NavLink
,
TabContent
,
TabPane
,
Alert
,
CardHeader
,
CardTitle
,
CardText
}
from
'reactstrap'
import
{
Media
,
Button
,
Label
,
Form
,
FormGroup
,
Input
,
Table
,
CustomInput
,
Card
,
CardBody
,
Row
,
Col
,
Nav
,
NavItem
,
NavLink
,
TabContent
,
TabPane
,
Alert
,
CardHeader
,
CardTitle
,
CardText
}
from
'reactstrap'
import
{
isObjEmpty
}
from
'@utils'
import
{
isObjEmpty
,
selectThemeColors
}
from
'@utils'
import
{
Bell
,
Check
,
X
,
AlertTriangle
,
Info
}
from
'react-feather'
import
{
Bell
,
Check
,
Hash
,
X
,
AlertTriangle
,
Info
}
from
'react-feather'
// ** Store & Actions
// ** Store & Actions
import
{
resetResults
}
from
'../../store/actions'
import
{
resetResults
}
from
'../../store/actions'
...
@@ -66,6 +68,9 @@ const handleError = (text) => {
...
@@ -66,6 +68,9 @@ const handleError = (text) => {
}
}
const
[
dataElement
,
setElementData
]
=
useState
(
null
),
const
[
dataElement
,
setElementData
]
=
useState
(
null
),
[
genresAllOptions
,
setGenresAllOptions
]
=
useState
([]),
[
genresAsset
,
setGenresAsset
]
=
useState
([]),
[
genresSubAsset
,
setGenresSubAsset
]
=
useState
([]),
{
register
,
errors
,
handleSubmit
}
=
useForm
(),
{
register
,
errors
,
handleSubmit
}
=
useForm
(),
settingStore
=
useSelector
(
state
=>
state
.
projectsettings
),
settingStore
=
useSelector
(
state
=>
state
.
projectsettings
),
screensStore
=
useSelector
(
state
=>
state
.
screens
),
screensStore
=
useSelector
(
state
=>
state
.
screens
),
...
@@ -96,11 +101,98 @@ const handleError = (text) => {
...
@@ -96,11 +101,98 @@ const handleError = (text) => {
textual
:
value
textual
:
value
}
}
setElementData
(
newData
)
setElementData
(
newData
)
},
updateGenres
=
(
value
)
=>
{
const
newValue
=
value
.
map
(
elm
=>
{
return
{
id
:
elm
.
value
,
idproject
:
dataElement
.
projectid
,
name
:
elm
.
label
,
pivot
:
{
idasset
:
dataElement
.
id
,
idgenres
:
elm
.
value1
}
}
})
const
newData
=
{
...
dataElement
,
genres
:
newValue
}
setElementData
(
newData
)
},
updateSubGenres
=
(
value
)
=>
{
const
newValue
=
value
.
map
(
elm
=>
{
return
{
id
:
elm
.
value
,
idproject
:
dataElement
.
projectid
,
name
:
elm
.
label
,
pivot
:
{
idasset
:
dataElement
.
id
,
idgenres
:
elm
.
value1
}
}
})
const
newData
=
{
...
dataElement
,
subgenres
:
newValue
}
setElementData
(
newData
)
},
genreOnChange
=
(
value
,
{
action
,
removedValue
})
=>
{
switch
(
action
)
{
case
'remove-value'
:
case
'pop-value'
:
if
(
removedValue
.
isFixed
)
{
return
}
setGenresAsset
(
value
)
break
case
'clear'
:
value
=
genresAllOptions
.
filter
(
v
=>
v
.
isFixed
)
setGenresAsset
(
value
)
break
default
:
setGenresAsset
(
value
)
break
}
updateGenres
(
value
)
},
genreSubOnChange
=
(
value
,
{
action
,
removedValue
})
=>
{
switch
(
action
)
{
case
'remove-value'
:
case
'pop-value'
:
if
(
removedValue
.
isFixed
)
{
return
}
setGenresSubAsset
(
value
)
break
case
'clear'
:
value
=
genresAllOptions
.
filter
(
v
=>
v
.
isFixed
)
setGenresSubAsset
(
value
)
break
default
:
setGenresSubAsset
(
value
)
break
}
updateSubGenres
(
value
)
}
}
useEffect
(()
=>
{
useEffect
(()
=>
{
if
(
selectedElement
!==
null
||
(
selectedElement
!==
null
&&
dataElement
!==
null
&&
selectedElement
.
id
!==
dataElement
.
id
))
{
if
(
selectedElement
!==
null
||
(
selectedElement
!==
null
&&
dataElement
!==
null
&&
selectedElement
.
id
!==
dataElement
.
id
))
{
const
genres
=
selectedElement
.
genres
.
map
(
elm
=>
{
return
{
value
:
elm
.
id
,
label
:
elm
.
name
}
})
setGenresAsset
(
genres
)
const
subgenres
=
selectedElement
.
subgenres
.
map
(
elm
=>
{
return
{
value
:
elm
.
id
,
label
:
elm
.
name
}
})
setGenresSubAsset
(
subgenres
)
return
setElementData
(
selectedElement
)
return
setElementData
(
selectedElement
)
}
}
},
[
selectedElement
])
},
[
selectedElement
])
...
@@ -133,6 +225,21 @@ const handleError = (text) => {
...
@@ -133,6 +225,21 @@ const handleError = (text) => {
setPagetypes
(
settingStore
.
allDataPagetypes
)
setPagetypes
(
settingStore
.
allDataPagetypes
)
},
[
settingStore
.
allDataPagetypes
])
},
[
settingStore
.
allDataPagetypes
])
useEffect
(()
=>
{
if
(
!
settingStore
.
selectedProject
)
return
console
.
log
(
settingStore
.
selectedProject
)
const
genres
=
settingStore
.
selectedProject
.
genres
.
map
(
elm
=>
{
return
{
value
:
elm
.
id
,
label
:
elm
.
name
}
})
setGenresAllOptions
(
genres
)
},
[
settingStore
.
selectedProject
])
// populate layout menus
// populate layout menus
useEffect
(()
=>
{
useEffect
(()
=>
{
if
(
!
screensStore
.
allDataLayoutPlaylists
||
screensStore
.
allDataLayoutPlaylists
.
length
<
1
)
{
if
(
!
screensStore
.
allDataLayoutPlaylists
||
screensStore
.
allDataLayoutPlaylists
.
length
<
1
)
{
...
@@ -239,6 +346,38 @@ return (
...
@@ -239,6 +346,38 @@ return (
<
/FormGroup
>
<
/FormGroup
>
<
/Col
>
<
/Col
>
<
/Row
>
<
/Row
>
<
Row
>
<
Col
className
=
'mb-1'
md
=
'6'
sm
=
'12'
>
<
h6
className
=
"py-1 mx-1 mb-0 font-medium-2"
><
Hash
/>
Genres
<
/h6
>
<
Select
isClearable
=
{
false
}
theme
=
{
selectThemeColors
}
value
=
{
genresAsset
}
isMulti
name
=
'genreassets'
options
=
{
genresAllOptions
}
onChange
=
{
genreOnChange
}
className
=
'react-select'
classNamePrefix
=
'select'
/>
<
/Col
>
<
Col
className
=
'mb-1'
md
=
'6'
sm
=
'12'
>
<
h6
className
=
"py-1 mx-1 mb-0 font-medium-2"
><
Hash
/>
Sub
-
genres
<
/h6
>
<
Select
isClearable
=
{
false
}
theme
=
{
selectThemeColors
}
value
=
{
genresSubAsset
}
isMulti
name
=
'subgenreassets'
options
=
{
genresAllOptions
}
onChange
=
{
genreSubOnChange
}
className
=
'react-select'
classNamePrefix
=
'select'
/>
<
/Col
>
<
/Row
>
<
Row
className
=
'app-user-edit'
>
<
Row
className
=
'app-user-edit'
>
...
@@ -255,6 +394,24 @@ return (
...
@@ -255,6 +394,24 @@ return (
<
/NavLink
>
<
/NavLink
>
<
/NavItem
>
<
/NavItem
>
<
NavItem
>
<
NavLink
active
=
{
false
}
onClick
=
{()
=>
toggle
(
1
)}
>
<
span
className
=
'align-middle d-none d-sm-block'
>
Imagery
<
/span
>
<
/NavLink
>
<
/NavItem
>
<
NavItem
>
<
NavLink
active
=
{
false
}
onClick
=
{()
=>
toggle
(
2
)}
>
<
span
className
=
'align-middle d-none d-sm-block'
>
Avaliability
<
/span
>
<
/NavLink
>
<
/NavItem
>
<
/Nav
>
<
/Nav
>
<
TabContent
<
TabContent
activeTab
=
{
activeTab
}
activeTab
=
{
activeTab
}
...
...
src/views/assets/projectassets/edit/main.js
View file @
7328ff4b
...
@@ -29,7 +29,9 @@ const ElementEdit = () => {
...
@@ -29,7 +29,9 @@ const ElementEdit = () => {
title
:
values
.
title
,
title
:
values
.
title
,
parentid
:
values
.
parentid
,
parentid
:
values
.
parentid
,
parenttype
:
values
.
parenttype
,
parenttype
:
values
.
parenttype
,
external_id
:
values
.
external_id
external_id
:
values
.
external_id
,
genres
:
values
.
genres
,
subgenres
:
values
.
subgenres
})
})
)
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment