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 = () => {
const
onSubmitHandler
=
values
=>
{
dispatch
(
addmenupages
({
name
:
values
.
name
,
slug
:
values
.
slug
,
view_all
:
values
.
view_all
,
search
:
values
.
search
,
seasons_carousel
:
values
.
seasons_carousel
,
episodes_carousel
:
values
.
episodes_carousel
,
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
,
platforms
:
values
.
platforms
idproject
:
values
.
idproject
,
system_name
:
values
.
system_name
,
last_seen
:
values
.
last_seen
,
layout_page_id
:
values
.
layout_page_id
,
type
:
values
.
type
,
display
:
values
.
display
,
pagetypeid
:
values
.
pagetypeid
,
order
:
values
.
order
})
)
...
...
@@ -59,9 +54,14 @@ const Tables = () => {
<
div
className
=
"card-body"
>
<
ElementCard
selectedElement
=
{{
id
:
'<generate>'
,
name
:
''
,
slug
:
''
,
platforms
:
[]
idproject
:
'2'
,
system_name
:
''
,
last_seen
:
''
,
layout_page_id
:
''
,
type
:
''
,
display
:
''
,
pagetypeid
:
''
,
order
:
'0'
}}
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'
// ** 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
classnames
from
'classnames'
...
...
@@ -20,8 +23,6 @@ import classnames from 'classnames'
import
Swal
from
'sweetalert2'
import
withReactContent
from
'sweetalert2-react-content'
import
ElementPlatform
from
'./plataform'
const
SuccessProgressToast
=
()
=>
(
<
Fragment
>
...
...
@@ -62,25 +63,24 @@ const handleError = (text) => {
const
[
dataElement
,
setElementData
]
=
useState
(
null
),
{
register
,
errors
,
handleSubmit
}
=
useForm
(),
settingStore
=
useSelector
(
state
=>
state
.
projectsettings
),
screensStore
=
useSelector
(
state
=>
state
.
screens
),
[
pagetypes
,
setPagetypes
]
=
useState
(
null
),
[
layoumenu
,
setLayoumenu
]
=
useState
(
null
),
dispatch
=
useDispatch
(),
notifySuccessProgress
=
()
=>
toast
.
success
(
<
SuccessProgressToast
/>
),
onSubmit
=
values
=>
{
if
(
isObjEmpty
(
errors
))
{
const
submitElement
=
{
...
dataElement
,
name
:
values
.
name
,
slug
:
values
.
slug
,
view_all
:
values
.
view_all
,
search
:
values
.
search
,
seasons_carousel
:
values
.
seasons_carousel
,
episodes_carousel
:
values
.
episodes_carousel
,
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
idproject
:
values
.
idproject
,
system_name
:
values
.
system_name
,
last_seen
:
values
.
last_seen
,
layout_page_id
:
values
.
layout_page_id
,
type
:
values
.
type
,
display
:
values
.
display
,
pagetypeid
:
values
.
pagetypeid
,
order
:
values
.
order
}
onSubmitHandler
(
submitElement
)
...
...
@@ -108,6 +108,34 @@ const handleError = (text) => {
}
},
[
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
(
<
Fragment
>
...
...
@@ -117,7 +145,7 @@ return (
<
Row
>
<
Col
md
=
'4'
sm
=
'12'
>
<
FormGroup
>
<
Label
for
=
'
email
'
>
ID
<
/Label
>
<
Label
for
=
'
id
'
>
ID
<
/Label
>
<
Input
readOnly
=
{
true
}
type
=
'text'
...
...
@@ -130,177 +158,139 @@ return (
<
/Col
>
<
Col
md
=
'4'
sm
=
'12'
>
<
FormGroup
>
<
Label
for
=
'name'
>
Name
<
/Label
>
<
Input
type
=
'text'
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
<
Label
for
=
'name'
>
Project
ID
<
/Label
>
<
Input
readOnly
=
{
true
}
type
=
'text'
name
=
'
slug
'
id
=
'
slug
'
name
=
'
idproject
'
id
=
'
idproject
'
innerRef
=
{
register
({
required
:
true
})}
placeholder
=
'
Slug
'
defaultValue
=
{
dataElement
&&
dataElement
.
slug
}
className
=
{
classnames
({
'is-invalid'
:
errors
[
'
slug
'
]
})}
placeholder
=
'
idproject
'
defaultValue
=
{
dataElement
&&
dataElement
.
idproject
}
className
=
{
classnames
({
'is-invalid'
:
errors
[
'
idproject
'
]
})}
/
>
<
/FormGroup
>
<
/Col
>
<
Col
md
=
'4'
sm
=
'12'
>
<
FormGroup
>
<
Label
for
=
'
view_all'
>
view_all
<
/Label
>
<
Label
for
=
'
system_name'
>
System
name
<
/Label
>
<
Input
type
=
'text'
name
=
'
view_all
'
id
=
'
view_all
'
name
=
'
system_name
'
id
=
'
system_name
'
innerRef
=
{
register
({
required
:
true
})}
placeholder
=
'
view_all
'
defaultValue
=
{
dataElement
&&
dataElement
.
view_all
}
className
=
{
classnames
({
'is-invalid'
:
errors
[
'
view_all
'
]
})}
placeholder
=
'
system_name
'
defaultValue
=
{
dataElement
&&
dataElement
.
system_name
}
className
=
{
classnames
({
'is-invalid'
:
errors
[
'
system_name
'
]
})}
/
>
<
/FormGroup
>
<
/Col
>
<
Col
md
=
'4'
sm
=
'12'
>
<
FormGroup
>
<
Label
for
=
'
search'
>
search
<
/Label
>
<
Label
for
=
'
layout_page_id'
>
Layout
page
<
/Label
>
<
Input
type
=
'
tex
t'
name
=
'
search
'
id
=
'
search
'
type
=
'
selec
t'
name
=
'
layout_page_id
'
id
=
'
layout_page_id
'
innerRef
=
{
register
({
required
:
true
})}
placeholder
=
'search'
defaultValue
=
{
dataElement
&&
dataElement
.
search
}
className
=
{
classnames
({
'is-invalid'
:
errors
[
'search'
]
})}
/
>
placeholder
=
'layout_page_id'
defaultValue
=
{
dataElement
&&
dataElement
.
layout_page_id
}
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
>
<
/Col
>
<
Col
md
=
'4'
sm
=
'12'
>
<
FormGroup
>
<
Label
for
=
'
seasons_carousel'
>
seasons_carousel
<
/Label
>
<
Label
for
=
'
type'
>
type
<
/Label
>
<
Input
type
=
'
tex
t'
name
=
'
seasons_carousel
'
id
=
'
seasons_carousel
'
type
=
'
selec
t'
name
=
'
type
'
id
=
'
type
'
innerRef
=
{
register
({
required
:
true
})}
placeholder
=
'seasons_carousel'
defaultValue
=
{
dataElement
&&
dataElement
.
seasons_carousel
}
className
=
{
classnames
({
'is-invalid'
:
errors
[
'seasons_carousel'
]
})}
/
>
placeholder
=
'type'
defaultValue
=
{
dataElement
&&
dataElement
.
type
}
className
=
{
classnames
({
'is-invalid'
:
errors
[
'type'
]
})}
>
<
option
value
=
'master'
>
Master
<
/option
>
<
option
value
=
'child'
>
Child
<
/option
>
<
/Input>
<
/FormGroup
>
<
/Col
>
<
Col
md
=
'4'
sm
=
'12'
>
<
FormGroup
>
<
Label
for
=
'
episodes_carousel'
>
episodes_carousel
<
/Label
>
<
Label
for
=
'
display'
>
display
<
/Label
>
<
Input
type
=
'
tex
t'
name
=
'
episodes_carousel
'
id
=
'
episodes_carousel
'
type
=
'
selec
t'
name
=
'
display
'
id
=
'
display
'
innerRef
=
{
register
({
required
:
true
})}
placeholder
=
'episodes_carousel'
defaultValue
=
{
dataElement
&&
dataElement
.
episodes_carousel
}
className
=
{
classnames
({
'is-invalid'
:
errors
[
'episodes_carousel'
]
})}
/
>
placeholder
=
'display'
defaultValue
=
{
dataElement
&&
dataElement
.
display
}
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
>
<
/Col
>
<
Col
md
=
'4'
sm
=
'12'
>
<
FormGroup
>
<
Label
for
=
'
related_movies'
>
related_movies
<
/Label
>
<
Label
for
=
'
pagetypeid'
>
Page
Type
<
/Label
>
<
Input
type
=
'
tex
t'
name
=
'
related_movies
'
id
=
'
related_movies
'
type
=
'
selec
t'
name
=
'
pagetypeid
'
id
=
'
pagetypeid
'
innerRef
=
{
register
({
required
:
true
})}
placeholder
=
'related_movies'
defaultValue
=
{
dataElement
&&
dataElement
.
related_movies
}
className
=
{
classnames
({
'is-invalid'
:
errors
[
'related_movies'
]
})}
/
>
placeholder
=
'pagetypeid'
defaultValue
=
{
dataElement
&&
dataElement
.
pagetypeid
}
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
>
<
/Col
>
<
Col
md
=
'4'
sm
=
'12'
>
<
FormGroup
>
<
Label
for
=
'
related_series'
>
related_series
<
/Label
>
<
Label
for
=
'
order'
>
order
<
/Label
>
<
Input
type
=
'text'
name
=
'
related_series
'
id
=
'
related_series
'
name
=
'
order
'
id
=
'
order
'
innerRef
=
{
register
({
required
:
true
})}
placeholder
=
'
related_series
'
defaultValue
=
{
dataElement
&&
dataElement
.
related_series
}
className
=
{
classnames
({
'is-invalid'
:
errors
[
'
related_series
'
]
})}
placeholder
=
'
order
'
defaultValue
=
{
dataElement
&&
dataElement
.
order
}
className
=
{
classnames
({
'is-invalid'
:
errors
[
'
order
'
]
})}
/
>
<
/FormGroup
>
<
/Col
>
<
Col
md
=
'4'
sm
=
'12'
>
<
FormGroup
>
<
Label
for
=
'
player_related'
>
player_related
<
/Label
>
<
Label
for
=
'
last_seen'
>
last_seen
<
/Label
>
<
Input
readOnly
=
{
true
}
type
=
'text'
name
=
'
player_related
'
id
=
'
player_related
'
innerRef
=
{
register
({
required
:
tru
e
})}
placeholder
=
'
player_related
'
defaultValue
=
{
dataElement
&&
dataElement
.
player_related
}
className
=
{
classnames
({
'is-invalid'
:
errors
[
'
player_related
'
]
})}
name
=
'
last_seen
'
id
=
'
last_seen
'
innerRef
=
{
register
({
required
:
fals
e
})}
placeholder
=
'
last_seen
'
defaultValue
=
{
dataElement
&&
dataElement
.
last_seen
}
className
=
{
classnames
({
'is-invalid'
:
errors
[
'
last_seen
'
]
})}
/
>
<
/FormGroup
>
<
/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'
>
<
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 = () => {
{
id
}
=
useParams
()
const
onSubmitHandler
=
values
=>
{
console
.
log
(
values
)
dispatch
(
updatemenupages
({
...
dataElement
,
id
:
values
.
id
,
name
:
values
.
name
,
slug
:
values
.
slug
,
platforms
:
values
.
platforms
,
view_all
:
values
.
view_all
,
search
:
values
.
search
,
seasons_carousel
:
values
.
seasons_carousel
,
episodes_carousel
:
values
.
episodes_carousel
,
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
idproject
:
values
.
idproject
,
system_name
:
values
.
system_name
,
last_seen
:
values
.
last_seen
,
layout_page_id
:
values
.
layout_page_id
,
type
:
values
.
type
,
display
:
values
.
display
,
pagetypeid
:
values
.
pagetypeid
,
order
:
values
.
order
})
)
...
...
src/views/menupages/store/actions/pages.js
View file @
33d73756
...
...
@@ -31,10 +31,8 @@ export const getData_menupages = params => {
export
const
addmenupages
=
params
=>
{
return
(
dispatch
,
getState
)
=>
{
const
newparam
=
addProject
(
params
)
console
.
log
(
newparams
)
axios
.
post
(
`
${
process
.
env
.
REACT_APP_API
}${
moduleSettings
.
apiBaseURL
}
`
,
new
params
)
.
post
(
`
${
process
.
env
.
REACT_APP_API
}${
moduleSettings
.
apiBaseURL
}
`
,
params
)
.
then
(
response
=>
{
dispatch
({
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