Commit 64c86bf0 authored by PDuarte's avatar PDuarte

movies refactory

parent 1b4cec82
...@@ -8,7 +8,7 @@ export default [ ...@@ -8,7 +8,7 @@ export default [
children: [ children: [
{ {
id: 'assetsDash', id: 'assetsDash',
title: 'Project Assets', title: 'Project Movies',
icon: <Briefcase />, icon: <Briefcase />,
navLink: '/assets/projectassets' navLink: '/assets/projectassets'
}, },
......
...@@ -43,7 +43,7 @@ const Tables = () => { ...@@ -43,7 +43,7 @@ const Tables = () => {
return ( return (
<Fragment> <Fragment>
<Breadcrumbs breadCrumbTitle='Assets' breadCrumbParent='Assets' breadCrumbActive={moduleSettings.mainTitle} /> <Breadcrumbs breadCrumbTitle='Movies' breadCrumbParent='Movies' breadCrumbActive={moduleSettings.mainTitle} />
<Row> <Row>
<Col sm='12'> <Col sm='12'>
<Link to={moduleSettings.baseURL}>Back to {moduleSettings.mainTitle}</Link> <Link to={moduleSettings.baseURL}>Back to {moduleSettings.mainTitle}</Link>
......
...@@ -330,7 +330,8 @@ return ( ...@@ -330,7 +330,8 @@ return (
<Col md='4' sm='12'> <Col md='4' sm='12'>
<FormGroup> <FormGroup>
<Label for='parenttype'>Parent Type</Label> <Label for='parenttype'>Parent Type</Label>
<Input <Input
readOnly={true}
type='text' type='text'
name='parenttype' name='parenttype'
id='parenttype' id='parenttype'
...@@ -345,6 +346,7 @@ return ( ...@@ -345,6 +346,7 @@ return (
<FormGroup> <FormGroup>
<Label for='parentid'>Parent Id</Label> <Label for='parentid'>Parent Id</Label>
<Input <Input
readOnly={true}
type='text' type='text'
name='parentid' name='parentid'
id='parentid' id='parentid'
......
...@@ -18,7 +18,7 @@ import moduleSettings from '../module' ...@@ -18,7 +18,7 @@ import moduleSettings from '../module'
const Tables = () => { const Tables = () => {
return ( return (
<Fragment> <Fragment>
<Breadcrumbs breadCrumbTitle='Assets' breadCrumbParent='Assets' breadCrumbActive={moduleSettings.mainTitle} /> <Breadcrumbs breadCrumbTitle='Movies' breadCrumbParent='Movies' breadCrumbActive={moduleSettings.mainTitle} />
<Row> <Row>
<Col sm='12'> <Col sm='12'>
<Link to={moduleSettings.baseURL}>Back to {moduleSettings.mainTitleSingle}</Link> <Link to={moduleSettings.baseURL}>Back to {moduleSettings.mainTitleSingle}</Link>
......
...@@ -17,7 +17,7 @@ import moduleSettings from './module' ...@@ -17,7 +17,7 @@ import moduleSettings from './module'
const Tables = () => { const Tables = () => {
return ( return (
<Fragment> <Fragment>
<Breadcrumbs breadCrumbTitle='Assets' breadCrumbParent='Assets' breadCrumbActive={moduleSettings.mainTitle} /> <Breadcrumbs breadCrumbTitle='Movies' breadCrumbParent='Movies' breadCrumbActive={moduleSettings.mainTitle} />
<Row> <Row>
<Col sm='12'> <Col sm='12'>
<DataTable /> <DataTable />
......
const moduleSettings = { const moduleSettings = {
mainTitle: 'Assets', mainTitle: 'Movies',
mainTitleSingle: 'Asset', mainTitleSingle: 'Movie',
apiBaseURL: '/api/assets', apiBaseURL: '/api/assets',
baseURL: '/assets/projectassets', baseURL: '/assets/projectassets',
newElement: { newElement: {
......
...@@ -3,7 +3,7 @@ import { Fragment, useState, useEffect, memo } from 'react' ...@@ -3,7 +3,7 @@ import { Fragment, useState, useEffect, memo } from 'react'
// ** Table Columns // ** Table Columns
import { serverSideColumns } from './data' import { serverSideColumns } from './data'
// ** Store & Actions // ** Store & Actions
import { getData_assets} from '../store/actions' import { getData_movies} from '../store/actions'
import { useSelector, useDispatch } from 'react-redux' import { useSelector, useDispatch } from 'react-redux'
import DataTableServerSide from '@components/datatable' import DataTableServerSide from '@components/datatable'
...@@ -16,7 +16,7 @@ const DataTable = () => { ...@@ -16,7 +16,7 @@ const DataTable = () => {
const storeNavbar = useSelector(state => state.navbar) const storeNavbar = useSelector(state => state.navbar)
useEffect(() => { useEffect(() => {
dispatch(getData_assets({ dispatch(getData_movies({
start: 0, start: 0,
length: 1000 length: 1000
})) }))
...@@ -26,11 +26,11 @@ const DataTable = () => { ...@@ -26,11 +26,11 @@ const DataTable = () => {
return ( return (
<DataTableServerSide <DataTableServerSide
cardTitle={moduleSettings.mainTitle} cardTitle={moduleSettings.mainTitle}
allData={store.allDataAssets} allData={store.allDataMovies}
getData={getData_assets} getData={getData_movies}
serverSideColumns={serverSideColumns} serverSideColumns={serverSideColumns}
linkAddButton={`${moduleSettings.baseURL}/add`} linkAddButton={`${moduleSettings.baseURL}/add`}
total={store.totalAssets} total={store.totalMovies}
/> />
) )
......
export * from './assets' export * from './assets'
export * from './movies'
export * from './lives' export * from './lives'
export * from './series' export * from './series'
export * from './seasons' export * from './seasons'
......
import {store} from '@store/storeConfig/store'
import axios from 'axios'
import moduleSettings from '../../projectassets/module'
const _getData_movies = params => {
return async dispatch => {
await axios.get(`${process.env.REACT_APP_API}${moduleSettings.apiBaseURL}`, {params}
).then(response => {
dispatch({
type: 'GET_DATA_MOVIES',
allData: response.data.data,
// datalayoumenus: response.data.invoices,
totalPages: response.data.recordsTotal,
params: response.data.params
})
})
}
}
export const getData_movies = params => {
if (!!params.idproject && params.idproject !== null) {
const newparams = {
...params,
type: 'Movies'
}
return _getData_movies(newparams)
}
const currentProject = store.getState().navbar.projectCurrent
const newparams = {
...params,
idproject: !currentProject ? '%' : currentProject.value,
type: 'Movies'
}
return _getData_movies(newparams)
}
...@@ -19,6 +19,12 @@ const initialState = { ...@@ -19,6 +19,12 @@ const initialState = {
allDataLives: [], allDataLives: [],
selectedLive: null, selectedLive: null,
dataMovies: [],
totalMovies: 1,
paramsMovies: {},
allDataMovies: [],
selectedMovies: null,
dataSeries: [], dataSeries: [],
totalSeries: 1, totalSeries: 1,
paramsSeries: {}, paramsSeries: {},
...@@ -73,8 +79,17 @@ const assets = (state = initialState, action) => { ...@@ -73,8 +79,17 @@ const assets = (state = initialState, action) => {
return { ...state } return { ...state }
case 'ADD_ASSET': case 'ADD_ASSET':
return { ...state } return { ...state }
// Movie
case 'GET_DATA_MOVIES':
return {
...state,
allDataMovies: action.allData,
dataMovies: action.data,
totalMovies: action.totalPages,
paramsMovies: action.params
}
// serie // serie
case 'GET_DATA_SERIES': case 'GET_DATA_SERIES':
return { return {
......
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