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
33d73756
Commit
33d73756
authored
May 08, 2021
by
PDuarte
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
menupages basic crud
parent
2de45044
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
152 additions
and
169 deletions
+152
-169
index.js
src/views/menupages/mainpages/add/index.js
+16
-16
index.js
src/views/menupages/mainpages/card/index.js
+126
-136
main.js
src/views/menupages/mainpages/edit/main.js
+9
-14
pages.js
src/views/menupages/store/actions/pages.js
+1
-3
No files found.
src/views/menupages/mainpages/add/index.js
View file @
33d73756
...
@@ -24,19 +24,14 @@ const Tables = () => {
...
@@ -24,19 +24,14 @@ const Tables = () => {
const
onSubmitHandler
=
values
=>
{
const
onSubmitHandler
=
values
=>
{
dispatch
(
dispatch
(
addmenupages
({
addmenupages
({
name
:
values
.
name
,
idproject
:
values
.
idproject
,
slug
:
values
.
slug
,
system_name
:
values
.
system_name
,
view_all
:
values
.
view_all
,
last_seen
:
values
.
last_seen
,
search
:
values
.
search
,
layout_page_id
:
values
.
layout_page_id
,
seasons_carousel
:
values
.
seasons_carousel
,
type
:
values
.
type
,
episodes_carousel
:
values
.
episodes_carousel
,
display
:
values
.
display
,
related_movies
:
values
.
related_movies
,
pagetypeid
:
values
.
pagetypeid
,
related_series
:
values
.
related_series
,
order
:
values
.
order
player_related
:
values
.
player_related
,
live_TV
:
values
.
live_TV
,
my_stuff
:
values
.
my_stuff
,
pages
:
values
.
pages
,
platforms
:
values
.
platforms
})
})
)
)
...
@@ -59,9 +54,14 @@ const Tables = () => {
...
@@ -59,9 +54,14 @@ const Tables = () => {
<
div
className
=
"card-body"
>
<
div
className
=
"card-body"
>
<
ElementCard
selectedElement
=
{{
<
ElementCard
selectedElement
=
{{
id
:
'<generate>'
,
id
:
'<generate>'
,
name
:
''
,
idproject
:
'2'
,
slug
:
''
,
system_name
:
''
,
platforms
:
[]
last_seen
:
''
,
layout_page_id
:
''
,
type
:
''
,
display
:
''
,
pagetypeid
:
''
,
order
:
'0'
}}
}}
onSubmitHandler
=
{
onSubmitHandler
}
onSubmitHandler
=
{
onSubmitHandler
}
/
>
/
>
...
...
src/views/menupages/mainpages/card/index.js
View file @
33d73756
...
@@ -12,7 +12,10 @@ import { Bell, Check, X, AlertTriangle, Info } from 'react-feather'
...
@@ -12,7 +12,10 @@ import { Bell, Check, X, AlertTriangle, Info } from 'react-feather'
// ** Store & Actions
// ** Store & Actions
import
{
updateProject
,
resetResults
,
getPlatform
}
from
'../../store/actions'
import
{
resetResults
}
from
'../../store/actions'
import
{
getData_pagetypes
}
from
'../../../settings/store/actions'
import
{
getData_layoutmenus
}
from
'../../../screens/store/actions'
import
{
useForm
}
from
'react-hook-form'
import
{
useForm
}
from
'react-hook-form'
import
classnames
from
'classnames'
import
classnames
from
'classnames'
...
@@ -20,8 +23,6 @@ import classnames from 'classnames'
...
@@ -20,8 +23,6 @@ import classnames from 'classnames'
import
Swal
from
'sweetalert2'
import
Swal
from
'sweetalert2'
import
withReactContent
from
'sweetalert2-react-content'
import
withReactContent
from
'sweetalert2-react-content'
import
ElementPlatform
from
'./plataform'
const
SuccessProgressToast
=
()
=>
(
const
SuccessProgressToast
=
()
=>
(
<
Fragment
>
<
Fragment
>
...
@@ -62,25 +63,24 @@ const handleError = (text) => {
...
@@ -62,25 +63,24 @@ const handleError = (text) => {
const
[
dataElement
,
setElementData
]
=
useState
(
null
),
const
[
dataElement
,
setElementData
]
=
useState
(
null
),
{
register
,
errors
,
handleSubmit
}
=
useForm
(),
{
register
,
errors
,
handleSubmit
}
=
useForm
(),
settingStore
=
useSelector
(
state
=>
state
.
projectsettings
),
screensStore
=
useSelector
(
state
=>
state
.
screens
),
[
pagetypes
,
setPagetypes
]
=
useState
(
null
),
[
layoumenu
,
setLayoumenu
]
=
useState
(
null
),
dispatch
=
useDispatch
(),
dispatch
=
useDispatch
(),
notifySuccessProgress
=
()
=>
toast
.
success
(
<
SuccessProgressToast
/>
),
notifySuccessProgress
=
()
=>
toast
.
success
(
<
SuccessProgressToast
/>
),
onSubmit
=
values
=>
{
onSubmit
=
values
=>
{
if
(
isObjEmpty
(
errors
))
{
if
(
isObjEmpty
(
errors
))
{
const
submitElement
=
{
const
submitElement
=
{
...
dataElement
,
...
dataElement
,
name
:
values
.
name
,
idproject
:
values
.
idproject
,
slug
:
values
.
slug
,
system_name
:
values
.
system_name
,
view_all
:
values
.
view_all
,
last_seen
:
values
.
last_seen
,
search
:
values
.
search
,
layout_page_id
:
values
.
layout_page_id
,
seasons_carousel
:
values
.
seasons_carousel
,
type
:
values
.
type
,
episodes_carousel
:
values
.
episodes_carousel
,
display
:
values
.
display
,
related_movies
:
values
.
related_movies
,
pagetypeid
:
values
.
pagetypeid
,
related_series
:
values
.
related_series
,
order
:
values
.
order
player_related
:
values
.
player_related
,
live_TV
:
values
.
live_TV
,
my_stuff
:
values
.
my_stuff
,
pages
:
values
.
pages
}
}
onSubmitHandler
(
submitElement
)
onSubmitHandler
(
submitElement
)
...
@@ -108,6 +108,34 @@ const handleError = (text) => {
...
@@ -108,6 +108,34 @@ const handleError = (text) => {
}
}
},
[
store
.
saveSucces
])
},
[
store
.
saveSucces
])
// populate page types
useEffect
(()
=>
{
if
(
!
settingStore
.
allDataPagetypes
||
settingStore
.
allDataPagetypes
.
length
<
1
)
{
dispatch
(
getData_pagetypes
({
start
:
1
,
length
:
1000
,
q
:
null
}))
}
},
[
dispatch
])
useEffect
(()
=>
{
setPagetypes
(
settingStore
.
allDataPagetypes
)
},
[
settingStore
.
allDataPagetypes
])
// populate layout menus
useEffect
(()
=>
{
if
(
!
screensStore
.
allDataLayoutMenus
||
screensStore
.
allDataLayoutMenus
.
length
<
1
)
{
dispatch
(
getData_layoutmenus
({
start
:
1
,
length
:
1000
,
q
:
null
}))
}
},
[
dispatch
])
useEffect
(()
=>
{
setLayoumenu
(
screensStore
.
allDataLayoutMenus
)
},
[
screensStore
.
allDataLayoutMenus
])
return
(
return
(
<
Fragment
>
<
Fragment
>
...
@@ -117,7 +145,7 @@ return (
...
@@ -117,7 +145,7 @@ return (
<
Row
>
<
Row
>
<
Col
md
=
'4'
sm
=
'12'
>
<
Col
md
=
'4'
sm
=
'12'
>
<
FormGroup
>
<
FormGroup
>
<
Label
for
=
'
email
'
>
ID
<
/Label
>
<
Label
for
=
'
id
'
>
ID
<
/Label
>
<
Input
<
Input
readOnly
=
{
true
}
readOnly
=
{
true
}
type
=
'text'
type
=
'text'
...
@@ -130,177 +158,139 @@ return (
...
@@ -130,177 +158,139 @@ return (
<
/Col
>
<
/Col
>
<
Col
md
=
'4'
sm
=
'12'
>
<
Col
md
=
'4'
sm
=
'12'
>
<
FormGroup
>
<
FormGroup
>
<
Label
for
=
'name'
>
Name
<
/Label
>
<
Label
for
=
'name'
>
Project
ID
<
/Label
>
<
Input
<
Input
type
=
'text'
readOnly
=
{
true
}
name
=
'name'
id
=
'name'
innerRef
=
{
register
({
required
:
true
})}
placeholder
=
'Name'
defaultValue
=
{
dataElement
&&
dataElement
.
name
}
className
=
{
classnames
({
'is-invalid'
:
errors
[
'name'
]
})}
/
>
<
/FormGroup
>
<
/Col
>
<
Col
md
=
'4'
sm
=
'12'
>
<
FormGroup
>
<
Label
for
=
'slug'
>
Slug
<
/Label
>
<
Input
type
=
'text'
type
=
'text'
name
=
'
slug
'
name
=
'
idproject
'
id
=
'
slug
'
id
=
'
idproject
'
innerRef
=
{
register
({
required
:
true
})}
innerRef
=
{
register
({
required
:
true
})}
placeholder
=
'
Slug
'
placeholder
=
'
idproject
'
defaultValue
=
{
dataElement
&&
dataElement
.
slug
}
defaultValue
=
{
dataElement
&&
dataElement
.
idproject
}
className
=
{
classnames
({
'is-invalid'
:
errors
[
'
slug
'
]
})}
className
=
{
classnames
({
'is-invalid'
:
errors
[
'
idproject
'
]
})}
/
>
/
>
<
/FormGroup
>
<
/FormGroup
>
<
/Col
>
<
/Col
>
<
Col
md
=
'4'
sm
=
'12'
>
<
Col
md
=
'4'
sm
=
'12'
>
<
FormGroup
>
<
FormGroup
>
<
Label
for
=
'
view_all'
>
view_all
<
/Label
>
<
Label
for
=
'
system_name'
>
System
name
<
/Label
>
<
Input
<
Input
type
=
'text'
type
=
'text'
name
=
'
view_all
'
name
=
'
system_name
'
id
=
'
view_all
'
id
=
'
system_name
'
innerRef
=
{
register
({
required
:
true
})}
innerRef
=
{
register
({
required
:
true
})}
placeholder
=
'
view_all
'
placeholder
=
'
system_name
'
defaultValue
=
{
dataElement
&&
dataElement
.
view_all
}
defaultValue
=
{
dataElement
&&
dataElement
.
system_name
}
className
=
{
classnames
({
'is-invalid'
:
errors
[
'
view_all
'
]
})}
className
=
{
classnames
({
'is-invalid'
:
errors
[
'
system_name
'
]
})}
/
>
/
>
<
/FormGroup
>
<
/FormGroup
>
<
/Col
>
<
/Col
>
<
Col
md
=
'4'
sm
=
'12'
>
<
Col
md
=
'4'
sm
=
'12'
>
<
FormGroup
>
<
FormGroup
>
<
Label
for
=
'
search'
>
search
<
/Label
>
<
Label
for
=
'
layout_page_id'
>
Layout
page
<
/Label
>
<
Input
<
Input
type
=
'
tex
t'
type
=
'
selec
t'
name
=
'
search
'
name
=
'
layout_page_id
'
id
=
'
search
'
id
=
'
layout_page_id
'
innerRef
=
{
register
({
required
:
true
})}
innerRef
=
{
register
({
required
:
true
})}
placeholder
=
'search'
placeholder
=
'layout_page_id'
defaultValue
=
{
dataElement
&&
dataElement
.
search
}
defaultValue
=
{
dataElement
&&
dataElement
.
layout_page_id
}
className
=
{
classnames
({
'is-invalid'
:
errors
[
'search'
]
})}
className
=
{
classnames
({
'is-invalid'
:
errors
[
'layout_page_id'
]
})}
/
>
>
{
!!
layoumenu
?
layoumenu
.
map
(
option
=>
{
return
<
option
key
=
{
option
.
id
}
selected
=
{
option
.
id
===
dataElement
.
layout_page_id
?
option
.
id
:
''
}
value
=
{
option
.
id
}
>
{
option
.
name
}
<
/option
>
})
:
<
option
>
Loading
<
/option>
}
<
/Input
>
<
/FormGroup
>
<
/FormGroup
>
<
/Col
>
<
/Col
>
<
Col
md
=
'4'
sm
=
'12'
>
<
Col
md
=
'4'
sm
=
'12'
>
<
FormGroup
>
<
FormGroup
>
<
Label
for
=
'
seasons_carousel'
>
seasons_carousel
<
/Label
>
<
Label
for
=
'
type'
>
type
<
/Label
>
<
Input
<
Input
type
=
'
tex
t'
type
=
'
selec
t'
name
=
'
seasons_carousel
'
name
=
'
type
'
id
=
'
seasons_carousel
'
id
=
'
type
'
innerRef
=
{
register
({
required
:
true
})}
innerRef
=
{
register
({
required
:
true
})}
placeholder
=
'seasons_carousel'
placeholder
=
'type'
defaultValue
=
{
dataElement
&&
dataElement
.
seasons_carousel
}
defaultValue
=
{
dataElement
&&
dataElement
.
type
}
className
=
{
classnames
({
'is-invalid'
:
errors
[
'seasons_carousel'
]
})}
className
=
{
classnames
({
'is-invalid'
:
errors
[
'type'
]
})}
/
>
>
<
option
value
=
'master'
>
Master
<
/option
>
<
option
value
=
'child'
>
Child
<
/option
>
<
/Input>
<
/FormGroup
>
<
/FormGroup
>
<
/Col
>
<
/Col
>
<
Col
md
=
'4'
sm
=
'12'
>
<
Col
md
=
'4'
sm
=
'12'
>
<
FormGroup
>
<
FormGroup
>
<
Label
for
=
'
episodes_carousel'
>
episodes_carousel
<
/Label
>
<
Label
for
=
'
display'
>
display
<
/Label
>
<
Input
<
Input
type
=
'
tex
t'
type
=
'
selec
t'
name
=
'
episodes_carousel
'
name
=
'
display
'
id
=
'
episodes_carousel
'
id
=
'
display
'
innerRef
=
{
register
({
required
:
true
})}
innerRef
=
{
register
({
required
:
true
})}
placeholder
=
'episodes_carousel'
placeholder
=
'display'
defaultValue
=
{
dataElement
&&
dataElement
.
episodes_carousel
}
defaultValue
=
{
dataElement
&&
dataElement
.
display
}
className
=
{
classnames
({
'is-invalid'
:
errors
[
'episodes_carousel'
]
})}
className
=
{
classnames
({
'is-invalid'
:
errors
[
'display'
]
})}
/
>
>
<
option
value
=
'icon_text'
>
Icon
Text
<
/option
>
<
option
value
=
'icon'
>
Icon
<
/option
>
<
option
value
=
'text'
>
Text
<
/option
>
<
/Input
>
<
/FormGroup
>
<
/FormGroup
>
<
/Col
>
<
/Col
>
<
Col
md
=
'4'
sm
=
'12'
>
<
Col
md
=
'4'
sm
=
'12'
>
<
FormGroup
>
<
FormGroup
>
<
Label
for
=
'
related_movies'
>
related_movies
<
/Label
>
<
Label
for
=
'
pagetypeid'
>
Page
Type
<
/Label
>
<
Input
<
Input
type
=
'
tex
t'
type
=
'
selec
t'
name
=
'
related_movies
'
name
=
'
pagetypeid
'
id
=
'
related_movies
'
id
=
'
pagetypeid
'
innerRef
=
{
register
({
required
:
true
})}
innerRef
=
{
register
({
required
:
true
})}
placeholder
=
'related_movies'
placeholder
=
'pagetypeid'
defaultValue
=
{
dataElement
&&
dataElement
.
related_movies
}
defaultValue
=
{
dataElement
&&
dataElement
.
pagetypeid
}
className
=
{
classnames
({
'is-invalid'
:
errors
[
'related_movies'
]
})}
className
=
{
classnames
({
'is-invalid'
:
errors
[
'pagetypeid'
]
})}
/
>
>
{
!!
pagetypes
?
pagetypes
.
map
(
option
=>
{
return
<
option
key
=
{
option
.
id
}
selected
=
{
option
.
id
===
dataElement
.
pagetypeid
}
value
=
{
option
.
id
}
>
{
option
.
type
}
<
/option
>
})
:
<
option
>
Loading
<
/option>
}
<
/Input
>
<
/FormGroup
>
<
/FormGroup
>
<
/Col
>
<
/Col
>
<
Col
md
=
'4'
sm
=
'12'
>
<
Col
md
=
'4'
sm
=
'12'
>
<
FormGroup
>
<
FormGroup
>
<
Label
for
=
'
related_series'
>
related_series
<
/Label
>
<
Label
for
=
'
order'
>
order
<
/Label
>
<
Input
<
Input
type
=
'text'
type
=
'text'
name
=
'
related_series
'
name
=
'
order
'
id
=
'
related_series
'
id
=
'
order
'
innerRef
=
{
register
({
required
:
true
})}
innerRef
=
{
register
({
required
:
true
})}
placeholder
=
'
related_series
'
placeholder
=
'
order
'
defaultValue
=
{
dataElement
&&
dataElement
.
related_series
}
defaultValue
=
{
dataElement
&&
dataElement
.
order
}
className
=
{
classnames
({
'is-invalid'
:
errors
[
'
related_series
'
]
})}
className
=
{
classnames
({
'is-invalid'
:
errors
[
'
order
'
]
})}
/
>
/
>
<
/FormGroup
>
<
/FormGroup
>
<
/Col
>
<
/Col
>
<
Col
md
=
'4'
sm
=
'12'
>
<
Col
md
=
'4'
sm
=
'12'
>
<
FormGroup
>
<
FormGroup
>
<
Label
for
=
'
player_related'
>
player_related
<
/Label
>
<
Label
for
=
'
last_seen'
>
last_seen
<
/Label
>
<
Input
<
Input
readOnly
=
{
true
}
type
=
'text'
type
=
'text'
name
=
'
player_related
'
name
=
'
last_seen
'
id
=
'
player_related
'
id
=
'
last_seen
'
innerRef
=
{
register
({
required
:
tru
e
})}
innerRef
=
{
register
({
required
:
fals
e
})}
placeholder
=
'
player_related
'
placeholder
=
'
last_seen
'
defaultValue
=
{
dataElement
&&
dataElement
.
player_related
}
defaultValue
=
{
dataElement
&&
dataElement
.
last_seen
}
className
=
{
classnames
({
'is-invalid'
:
errors
[
'
player_related
'
]
})}
className
=
{
classnames
({
'is-invalid'
:
errors
[
'
last_seen
'
]
})}
/
>
/
>
<
/FormGroup
>
<
/FormGroup
>
<
/Col
>
<
/Col
>
<
Col
md
=
'4'
sm
=
'12'
>
<
FormGroup
>
<
Label
for
=
'live_TV'
>
live_TV
<
/Label
>
<
Input
type
=
'text'
name
=
'live_TV'
id
=
'live_TV'
innerRef
=
{
register
({
required
:
true
})}
placeholder
=
'live_TV'
defaultValue
=
{
dataElement
&&
dataElement
.
live_TV
}
className
=
{
classnames
({
'is-invalid'
:
errors
[
'live_TV'
]
})}
/
>
<
/FormGroup
>
<
/Col
>
<
Col
md
=
'4'
sm
=
'12'
>
<
FormGroup
>
<
Label
for
=
'my_stuff'
>
my_stuff
<
/Label
>
<
Input
type
=
'text'
name
=
'my_stuff'
id
=
'my_stuff'
innerRef
=
{
register
({
required
:
true
})}
placeholder
=
'my_stuff'
defaultValue
=
{
dataElement
&&
dataElement
.
my_stuff
}
className
=
{
classnames
({
'is-invalid'
:
errors
[
'my_stuff'
]
})}
/
>
<
/FormGroup
>
<
/Col
>
<
Col
md
=
'4'
sm
=
'12'
>
<
FormGroup
>
<
Label
for
=
'my_stuff'
>
pages
<
/Label
>
<
Input
type
=
'text'
name
=
'pages'
id
=
'pages'
innerRef
=
{
register
({
required
:
true
})}
placeholder
=
'pages'
defaultValue
=
{
dataElement
&&
dataElement
.
pages
}
className
=
{
classnames
({
'is-invalid'
:
errors
[
'pages'
]
})}
/
>
<
/FormGroup
>
<
/Col
>
<
Col
sm
=
'12'
>
<
ElementPlatform
dataElement
=
{
dataElement
}
setElement
=
{
setElementData
}
store
=
{
store
}
/
>
<
/Col
>
<
Col
className
=
'd-flex flex-sm-row flex-column mt-2'
sm
=
'12'
>
<
Col
className
=
'd-flex flex-sm-row flex-column mt-2'
sm
=
'12'
>
<
Button
.
Ripple
className
=
'mb-1 mb-sm-0 mr-0 mr-sm-1'
type
=
'submit'
color
=
'primary'
>
<
Button
.
Ripple
className
=
'mb-1 mb-sm-0 mr-0 mr-sm-1'
type
=
'submit'
color
=
'primary'
>
...
...
src/views/menupages/mainpages/edit/main.js
View file @
33d73756
...
@@ -21,23 +21,18 @@ const ElementEdit = () => {
...
@@ -21,23 +21,18 @@ const ElementEdit = () => {
{
id
}
=
useParams
()
{
id
}
=
useParams
()
const
onSubmitHandler
=
values
=>
{
const
onSubmitHandler
=
values
=>
{
console
.
log
(
values
)
dispatch
(
dispatch
(
updatemenupages
({
updatemenupages
({
...
dataElement
,
...
dataElement
,
id
:
values
.
id
,
idproject
:
values
.
idproject
,
name
:
values
.
name
,
system_name
:
values
.
system_name
,
slug
:
values
.
slug
,
last_seen
:
values
.
last_seen
,
platforms
:
values
.
platforms
,
layout_page_id
:
values
.
layout_page_id
,
view_all
:
values
.
view_all
,
type
:
values
.
type
,
search
:
values
.
search
,
display
:
values
.
display
,
seasons_carousel
:
values
.
seasons_carousel
,
pagetypeid
:
values
.
pagetypeid
,
episodes_carousel
:
values
.
episodes_carousel
,
order
:
values
.
order
related_movies
:
values
.
related_movies
,
related_series
:
values
.
related_series
,
player_related
:
values
.
player_related
,
live_TV
:
values
.
live_TV
,
my_stuff
:
values
.
my_stuff
,
pages
:
values
.
pages
})
})
)
)
...
...
src/views/menupages/store/actions/pages.js
View file @
33d73756
...
@@ -31,10 +31,8 @@ export const getData_menupages = params => {
...
@@ -31,10 +31,8 @@ export const getData_menupages = params => {
export
const
addmenupages
=
params
=>
{
export
const
addmenupages
=
params
=>
{
return
(
dispatch
,
getState
)
=>
{
return
(
dispatch
,
getState
)
=>
{
const
newparam
=
addProject
(
params
)
console
.
log
(
newparams
)
axios
axios
.
post
(
`
${
process
.
env
.
REACT_APP_API
}${
moduleSettings
.
apiBaseURL
}
`
,
new
params
)
.
post
(
`
${
process
.
env
.
REACT_APP_API
}${
moduleSettings
.
apiBaseURL
}
`
,
params
)
.
then
(
response
=>
{
.
then
(
response
=>
{
dispatch
({
dispatch
({
type
:
'ADD_MENUPAGE'
,
type
:
'ADD_MENUPAGE'
,
...
...
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