Commit f6fb01d3 authored by PDuarte's avatar PDuarte

episodes UI series hamdle

parent dba9a687
...@@ -118,6 +118,16 @@ const handleError = (text) => { ...@@ -118,6 +118,16 @@ const handleError = (text) => {
} }
setElementData(newData) setElementData(newData)
}, },
handleSeriesChange = (value) => {
dispatch(getData_seasons({
start: 0,
length: 1000,
idproject: selectedElement.projectid,
idseries: value,
q: null
}))
},
updateGenres = (value) => { updateGenres = (value) => {
const newValue = value.map(elm => { const newValue = value.map(elm => {
return { return {
...@@ -270,6 +280,13 @@ const handleError = (text) => { ...@@ -270,6 +280,13 @@ const handleError = (text) => {
idproject: selectedElement.projectid, idproject: selectedElement.projectid,
q: null q: null
})) }))
dispatch(getData_seasons({
start: 0,
length: 1000,
idproject: selectedElement.projectid,
idseries: selectedElement.seriesID,
q: null
}))
}, [settingStore.selectedProject]) }, [settingStore.selectedProject])
...@@ -282,12 +299,12 @@ const handleError = (text) => { ...@@ -282,12 +299,12 @@ const handleError = (text) => {
q: null q: null
})) }))
} }
if (dataElement !== null && dataElement.seriesid !== null && (!projectAssets.allDataSeasons || projectAssets.allDataSeasons.length < 1)) { if (dataElement !== null && dataElement.seriesID !== null && (!projectAssets.allDataSeasons || projectAssets.allDataSeasons.length < 1)) {
dispatch(getData_seasons({ dispatch(getData_seasons({
start: 0, start: 0,
length: 1000, length: 1001,
idproject: dataElement.idproject, idproject: dataElement.idproject,
seriesid: dataElement.seriesid, seriesid: dataElement.seriesID,
q: null q: null
})) }))
} }
...@@ -397,6 +414,7 @@ return ( ...@@ -397,6 +414,7 @@ return (
placeholder='seriesid' placeholder='seriesid'
defaultValue={dataElement && dataElement.seriesid} defaultValue={dataElement && dataElement.seriesid}
className={classnames({ 'is-invalid': errors['seriesid'] })} className={classnames({ 'is-invalid': errors['seriesid'] })}
onChange={e => handleSeriesChange(e.target.value)}
> >
{!!projectAssets.allDataSeries && !!dataElement ? projectAssets.allDataSeries.map(option => { {!!projectAssets.allDataSeries && !!dataElement ? projectAssets.allDataSeries.map(option => {
return <option key={option.id} return <option key={option.id}
......
// ** React Imports // ** React Imports
import { Link } from 'react-router-dom' import { Link } from 'react-router-dom'
import { cleanasset } from '../store/actions' import { cleanepisode } from '../store/actions'
import { store } from '@store/storeConfig/store' import { store } from '@store/storeConfig/store'
// ** Custom Components // ** Custom Components
...@@ -228,7 +228,7 @@ export const serverSideColumns = [ ...@@ -228,7 +228,7 @@ export const serverSideColumns = [
<Link <Link
to={`${moduleSettings.baseURL}/edit/${row.id}`} to={`${moduleSettings.baseURL}/edit/${row.id}`}
className='user-name text-truncate mb-0' className='user-name text-truncate mb-0'
onClick={() => store.dispatch(cleanasset(row.id))} onClick={() => store.dispatch(cleanepisode(row.id))}
> >
<span className='font-weight-bold'>{row.title}</span> <span className='font-weight-bold'>{row.title}</span>
</Link> </Link>
......
...@@ -30,8 +30,8 @@ const ElementEdit = () => { ...@@ -30,8 +30,8 @@ const ElementEdit = () => {
...dataElement, ...dataElement,
idproject: values.idproject, idproject: values.idproject,
title: values.title, title: values.title,
seriesid: values.seriesid, seriesID: values.seriesid,
seasonid: values.seasonid, seasonID: values.seasonid,
parentid: values.parentid, parentid: values.parentid,
parenttype: values.parenttype, parenttype: values.parenttype,
external_id: values.external_id, external_id: values.external_id,
......
...@@ -75,6 +75,15 @@ export const getData_episodes = params => { ...@@ -75,6 +75,15 @@ export const getData_episodes = params => {
} }
} }
export const cleanepisode = id => {
return async dispatch => {
dispatch({
type: 'GET_EPISODE',
data: null
})
}
}
export const addepisode = params => { export const addepisode = params => {
return (dispatch, getState) => { return (dispatch, getState) => {
axios axios
......
...@@ -22,10 +22,12 @@ const _getData_seasons = params => { ...@@ -22,10 +22,12 @@ const _getData_seasons = params => {
export const getData_seasons = params => { export const getData_seasons = params => {
if (!!params.idproject && params.idproject !== null) { if (!!params.idproject && params.idproject !== null) {
const newparams = { const newparams = {
...params, ...params,
type: 'Seasons' type: 'Seasons'
} }
console.log(newparams, params)
return _getData_seasons(newparams) return _getData_seasons(newparams)
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment