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
1ea2548f
Commit
1ea2548f
authored
May 16, 2021
by
PDuarte
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sending menu playlist to api
parent
e5549631
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
14 deletions
+35
-14
index.js
src/views/menupages/mainpages/card/index.js
+1
-5
manageplaylist.js
src/views/menupages/mainpages/card/manageplaylist.js
+15
-7
tablayoutplaylists.js
src/views/menupages/mainpages/card/tablayoutplaylists.js
+19
-2
No files found.
src/views/menupages/mainpages/card/index.js
View file @
1ea2548f
...
...
@@ -363,11 +363,7 @@ return (
)
}
<
TabPane
tabId
=
{
dataElement
?
dataElement
.
menu_page_layouts
.
length
:
0
}
>
<
div
// selectedUser={store.selectedUser}
>
<
/div
>
<
div
><
/div
>
<
/TabPane
>
<
/TabContent>
<
/CardBody>
...
...
src/views/menupages/mainpages/card/manageplaylist.js
View file @
1ea2548f
...
...
@@ -27,25 +27,31 @@ const serverSideColumns = [
]
const
ManagePlaylist
=
(
dataElement
)
=>
{
const
ManagePlaylist
=
(
{
dataElement
,
selectedDataElement
,
handleChange
}
)
=>
{
const
store
=
useSelector
(
state
=>
state
.
playlists
),
storeMenuPages
=
useSelector
(
state
=>
state
.
menupages
),
[
selectedPlaylists
,
setSelectedPlaylists
]
=
useState
(
null
),
[
avaliablePlaylists
,
setavaliablePlaylists
]
=
useState
([]),
[
selectedPlaylists
,
setSelectedPlaylists
]
=
useState
([]),
dispatch
=
useDispatch
()
const
handleAdd
=
(
value
)
=>
{
const
newValue
=
selectedPlaylists
.
concat
(
value
)
setSelectedPlaylists
(
newValue
)
}
handleChange
(
newValue
)
}
const
handleRemove
=
(
value
)
=>
{
const
newValue
=
selectedPlaylists
.
filter
(
element
=>
element
.
id
!==
value
.
id
)
setSelectedPlaylists
(
newValue
)
handleChange
(
newValue
)
}
const
getData_selectedPlaylists
=
(
params
)
=>
{
return
(
dispatch
)
=>
{
if
(
params
.
q
===
null
||
params
.
q
===
''
)
{
setSelectedPlaylists
(
dataElement
.
dataElement
)
setSelectedPlaylists
(
dataElement
)
return
}
const
newValue
=
dataElement
.
dataElement
.
filter
(
element
=>
element
.
title
.
includes
(
params
.
q
))
...
...
@@ -54,6 +60,7 @@ const ManagePlaylist = (dataElement) => {
}
const
getData_avaliablePlaylists
=
(
params
)
=>
{
return
(
dispatch
)
=>
{
if
(
selectedPlaylists
===
null
)
return
const
Ids
=
selectedPlaylists
.
map
(
elem
=>
elem
.
id
),
tabPlaylists
=
store
.
allDataPlaylists
.
filter
(
element
=>
!
Ids
.
includes
(
element
.
id
))
...
...
@@ -68,20 +75,21 @@ const ManagePlaylist = (dataElement) => {
}
useEffect
(()
=>
{
if
(
typeof
selectedPlaylists
===
'undefined'
||
selectedPlaylists
===
null
)
return
const
Ids
=
selectedPlaylists
.
map
(
elem
=>
elem
.
id
)
const
filtered
=
store
.
allDataPlaylists
.
filter
(
element
=>
!
Ids
.
includes
(
element
.
id
))
setavaliablePlaylists
(
filtered
)
},
[
store
.
allDataPlaylists
])
useEffect
(()
=>
{
if
(
selectedPlaylists
===
null
)
return
if
(
typeof
selectedPlaylists
===
'undefined'
||
selectedPlaylists
===
null
)
return
const
Ids
=
selectedPlaylists
.
map
(
elem
=>
elem
.
id
)
const
filtered
=
store
.
allDataPlaylists
.
filter
(
element
=>
!
Ids
.
includes
(
element
.
id
))
setavaliablePlaylists
(
filtered
)
},
[
selectedPlaylists
])
useEffect
(()
=>
{
if
(
dataElement
!==
null
&&
dataElement
.
dataElement
!==
null
)
{
setSelectedPlaylists
(
dataElement
.
dataElement
)
if
(
dataElement
!==
null
&&
dataElement
!==
null
)
{
setSelectedPlaylists
(
dataElement
)
}
},
[
dataElement
])
...
...
src/views/menupages/mainpages/card/tablayoutplaylists.js
View file @
1ea2548f
...
...
@@ -25,11 +25,24 @@ const TabLayoutPlaylist = ({block, selectedDataElement, setElementData}) => {
mpagelayout
[
field
]
=
value
}
})
setElementData
(
{
...
selectedDataElement
})
}
},
handlePLLChange
=
(
value
)
=>
{
const
newData
=
selectedDataElement
.
menu_page_layouts
.
map
((
mpagelayout
)
=>
{
if
(
mpagelayout
.
id
===
block
.
id
)
{
mpagelayout
.
playlists
=
value
}
})
setElementData
(
{
...
selectedDataElement
})
// handleDetailChange(value, 'playlists')
}
useEffect
(()
=>
{
if
(
block
!==
null
||
(
block
!==
null
&&
dataElement
!==
null
&&
block
.
id
!==
dataElement
.
id
))
{
...
...
@@ -112,7 +125,11 @@ const TabLayoutPlaylist = ({block, selectedDataElement, setElementData}) => {
<
/div
>
<
/div
>
<
ManagePlaylist
dataElement
=
{
dataElement
&&
dataElement
.
playlists
}
/>
<
ManagePlaylist
dataElement
=
{
dataElement
&&
dataElement
.
playlists
}
selectedDataElement
=
{
dataElement
}
handleChange
=
{
handlePLLChange
}
/>
<
/Col>
...
...
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