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
1b4cec82
Commit
1b4cec82
authored
Jul 17, 2021
by
PDuarte
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
season create
parent
bb90ae79
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
73 additions
and
11 deletions
+73
-11
index.js
src/views/assets/seasons/add/index.js
+6
-2
index.js
src/views/assets/seasons/card/index.js
+17
-2
main.js
src/views/assets/seasons/edit/main.js
+9
-7
seasons.js
src/views/assets/store/actions/seasons.js
+37
-0
index.js
src/views/assets/store/reducer/index.js
+4
-0
No files found.
src/views/assets/seasons/add/index.js
View file @
1b4cec82
...
...
@@ -3,7 +3,7 @@ import { Fragment } from 'react'
import
{
Link
}
from
'react-router-dom'
// ** Store & Actions
import
{
add
asset
}
from
'../../store/actions'
import
{
add
season
}
from
'../../store/actions'
import
{
useDispatch
,
useSelector
}
from
'react-redux'
// ** Custom Components
...
...
@@ -24,10 +24,12 @@ const Tables = () => {
const
storeNavbar
=
useSelector
(
state
=>
state
.
navbar
)
const
onSubmitHandler
=
(
values
,
uploadFile
)
=>
{
dispatch
(
add
asset
({
add
season
({
projectid
:
values
.
projectid
,
title
:
values
.
title
,
parentid
:
values
.
parentid
,
seriesid
:
values
.
seriesid
,
seasonNumber
:
values
.
seasonNumber
,
parenttype
:
values
.
parenttype
,
external_id
:
values
.
external_id
,
external_url
:
values
.
external_url
,
...
...
@@ -66,6 +68,8 @@ const Tables = () => {
parenttype
:
null
,
external_id
:
''
,
external_url
:
''
,
seriesID
:
0
,
seasonNumber
:
1
,
textual
:
[],
genres
:
[],
subgenres
:
[],
...
...
src/views/assets/seasons/card/index.js
View file @
1b4cec82
...
...
@@ -93,6 +93,7 @@ const handleError = (text) => {
idproject
:
values
.
idproject
,
title
:
values
.
title
,
seriesid
:
values
.
seriesid
,
seasonNumber
:
values
.
seasonNumber
,
parentid
:
values
.
parentid
,
parenttype
:
values
.
parenttype
,
external_id
:
values
.
external_id
,
...
...
@@ -387,15 +388,29 @@ return (
defaultValue
=
{
dataElement
&&
dataElement
.
seriesid
}
className
=
{
classnames
({
'is-invalid'
:
errors
[
'seriesid'
]
})}
>
{
!!
projectAssets
.
allDataSeries
?
projectAssets
.
allDataSeries
.
map
(
option
=>
{
{
!!
projectAssets
.
allDataSeries
&&
!!
dataElement
?
projectAssets
.
allDataSeries
.
map
(
option
=>
{
return
<
option
key
=
{
option
.
id
}
selected
=
{
option
.
id
===
dataElement
.
series
id
?
option
.
id
:
''
}
selected
=
{
option
.
id
===
dataElement
.
series
ID
?
option
.
id
:
''
}
value
=
{
option
.
id
}
>
{
option
.
title
}
<
/option
>
})
:
<
option
>
Loading
<
/option>
}
<
/Input
>
<
/FormGroup
>
<
/Col
>
<
Col
md
=
'4'
sm
=
'12'
>
<
FormGroup
>
<
Label
for
=
'seasonNumber'
>
Season
number
<
/Label
>
<
Input
type
=
'text'
name
=
'seasonNumber'
id
=
'seasonNumber'
innerRef
=
{
register
({
required
:
false
})}
placeholder
=
'seasonNumber'
defaultValue
=
{
dataElement
&&
dataElement
.
seasonNumber
}
className
=
{
classnames
({
'is-invalid'
:
errors
[
'seasonNumber'
]
})}
/
>
<
/FormGroup
>
<
/Col
>
<
Col
md
=
'4'
sm
=
'12'
>
<
FormGroup
>
<
Label
for
=
'external_id'
>
External
Id
<
/Label
>
...
...
src/views/assets/seasons/edit/main.js
View file @
1b4cec82
...
...
@@ -2,7 +2,7 @@ import { useState, useEffect, Fragment } from 'react'
import
{
useParams
,
Link
}
from
'react-router-dom'
// ** Store & Actions
import
{
get
asset
,
updateseasons
,
deleteasset
}
from
'../../store/actions'
import
{
get
season
,
updateseasons
,
deleteasset
}
from
'../../store/actions'
import
{
useSelector
,
useDispatch
}
from
'react-redux'
...
...
@@ -31,6 +31,7 @@ const ElementEdit = () => {
idproject
:
values
.
idproject
,
title
:
values
.
title
,
seriesid
:
values
.
seriesid
,
seasonNumber
:
values
.
seasonNumber
,
parentid
:
values
.
parentid
,
parenttype
:
values
.
parenttype
,
external_id
:
values
.
external_id
,
...
...
@@ -51,21 +52,22 @@ const ElementEdit = () => {
}
// ** Function to get user on mount
useEffect
(()
=>
{
dispatch
(
get
asset
(
id
))
dispatch
(
get
season
(
id
))
},
[
dispatch
])
// ** Update user image on mount or change
useEffect
(()
=>
{
if
(
store
.
selectedAsset
!==
null
||
(
store
.
selectedAsset
!==
null
&&
dataElement
!==
null
&&
store
.
selectedAsset
.
id
!==
dataElement
.
id
))
{
return
setElementData
(
store
.
selectedAsset
)
console
.
log
(
store
.
selectedSeason
)
if
(
store
.
selectedSeason
!==
null
||
(
store
.
selectedSeason
!==
null
&&
dataElement
!==
null
&&
store
.
selectedSeason
.
id
!==
dataElement
.
id
))
{
return
setElementData
(
store
.
selectedSeason
)
}
},
[
store
.
selected
Asset
])
},
[
store
.
selected
Season
])
return
store
.
selected
Asset
!==
null
&&
store
.
selectedAsset
!==
undefined
?
(
return
store
.
selected
Season
!==
null
&&
store
.
selectedSeason
!==
undefined
?
(
<
ElementCard
selectedElement
=
{
store
.
selected
Asset
}
selectedElement
=
{
store
.
selected
Season
}
onSubmitHandler
=
{
onSubmitHandler
}
handelDelete
=
{
handelDelete
}
/>
...
...
src/views/assets/store/actions/seasons.js
View file @
1b4cec82
...
...
@@ -59,3 +59,40 @@ export const getData_seasons = params => {
}
}
export
const
getseason
=
id
=>
{
return
async
dispatch
=>
{
await
axios
.
get
(
`
${
process
.
env
.
REACT_APP_API
}${
moduleSettings
.
apiBaseURL
}
/
${
id
}
`
)
.
then
(
response
=>
{
// console.log('leu')
// console.log(response)
dispatch
({
type
:
'GET_SEASON'
,
data
:
response
.
data
.
data
})
})
.
catch
(
err
=>
console
.
log
(
err
))
}
}
export
const
addseason
=
params
=>
{
return
(
dispatch
,
getState
)
=>
{
axios
.
post
(
`
${
process
.
env
.
REACT_APP_API
}${
moduleSettings
.
apiBaseURL
}
`
,
params
)
.
then
(
response
=>
{
dispatch
({
type
:
'ADD_ASSET'
,
params
})
})
.
then
(()
=>
{
dispatch
(
setSaveSatus
(
true
))
})
.
catch
(
err
=>
{
const
errosMsg
=
!
err
.
response
?
'error'
:
err
.
response
.
data
.
message
console
.
log
(
errosMsg
)
dispatch
(
setErrorMsg
(
errosMsg
))
})
}
}
\ No newline at end of file
src/views/assets/store/reducer/index.js
View file @
1b4cec82
...
...
@@ -103,6 +103,10 @@ const assets = (state = initialState, action) => {
totalSeasons
:
action
.
totalPages
,
paramsSeasons
:
action
.
params
}
case
'GET_SEASON'
:
return
{
...
state
,
selectedSeason
:
action
.
data
}
// default
default
:
...
...
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