Commit 38fc3a89 authored by PDuarte's avatar PDuarte

playlist avalibility UI

parent bd3254d0
...@@ -340,7 +340,7 @@ const AvaliabilityBlock = ({dataElement, handleElmChange}) => { ...@@ -340,7 +340,7 @@ const AvaliabilityBlock = ({dataElement, handleElmChange}) => {
<Col sm='12'> <Col sm='12'>
<Card> <Card>
<CardBody className='pt-2'> <CardBody className='pt-2'>
{ dataElement !== null && dataElement.map(elm => { { dataElement !== null && dataElement !== undefined && dataElement.map(elm => {
return <PlanAvaliability return <PlanAvaliability
key={elm.id} key={elm.id}
dataElement={elm} dataElement={elm}
......
...@@ -31,7 +31,8 @@ const Tables = () => { ...@@ -31,7 +31,8 @@ const Tables = () => {
dynamic: values.dynamic, dynamic: values.dynamic,
special: values.special, special: values.special,
special_id: values.special_id, special_id: values.special_id,
assets: values.assets assets: values.assets,
availability: values.availability
} }
) )
) )
...@@ -62,7 +63,14 @@ const Tables = () => { ...@@ -62,7 +63,14 @@ const Tables = () => {
dynamic: 0, dynamic: 0,
special: 0, special: 0,
special_id: '', special_id: '',
assets: [] assets: [],
parent: {
textual: [],
genres: [],
subgenres: [],
availability: [],
imagery: []
}
}} }}
onSubmitHandler={onSubmitHandler} onSubmitHandler={onSubmitHandler}
/> />
......
...@@ -13,13 +13,11 @@ import { Bell, Check, X, AlertTriangle, Info } from 'react-feather' ...@@ -13,13 +13,11 @@ import { Bell, Check, X, AlertTriangle, Info } from 'react-feather'
import ManageAssets from './manageassets' import ManageAssets from './manageassets'
import AvaliabilityBlock from '../../../assets/projectassets/card/avaliability'
// import TabLayoutPlaylist from './tablayoutplaylists'
// ** Store & Actions // ** Store & Actions
import {resetResults} from '../../store/actions' import {resetResults} from '../../store/actions'
import { getData_pagetypes } from '../../../settings/store/actions' import { getProject } from '../../../settings/store/actions'
import { getData_assets } from '../../../assets/store/actions' import { getData_assets } from '../../../assets/store/actions'
import { getData_layoutPlaylists } from '../../../screens/store/actions' import { getData_layoutPlaylists } from '../../../screens/store/actions'
...@@ -32,6 +30,8 @@ import withReactContent from 'sweetalert2-react-content' ...@@ -32,6 +30,8 @@ import withReactContent from 'sweetalert2-react-content'
// ** Styles // ** Styles
import '@styles/react/apps/app-users.scss' import '@styles/react/apps/app-users.scss'
import '@styles/react/libs/flatpickr/flatpickr.scss'
const SuccessProgressToast = () => ( const SuccessProgressToast = () => (
<Fragment> <Fragment>
...@@ -53,6 +53,7 @@ const SuccessProgressToast = () => ( ...@@ -53,6 +53,7 @@ const SuccessProgressToast = () => (
const ElementCard = ({ selectedElement, onSubmitHandler, handelDelete }) => { const ElementCard = ({ selectedElement, onSubmitHandler, handelDelete }) => {
const store = useSelector(state => state.projectsettings) const store = useSelector(state => state.projectsettings)
const storeNavbar = useSelector(state => state.navbar)
const [PlatformName, setPlatformName] = useState('Web') const [PlatformName, setPlatformName] = useState('Web')
const MySwal = withReactContent(Swal) const MySwal = withReactContent(Swal)
...@@ -72,8 +73,8 @@ const handleError = (text) => { ...@@ -72,8 +73,8 @@ 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), screensStore = useSelector(state => state.screens),
projectStore = useSelector(state => state.projectsettings),
// [pagetypes, setPagetypes] = useState(null), // [pagetypes, setPagetypes] = useState(null),
[layoutplaylists, setLayoutplaylists] = useState(null), [layoutplaylists, setLayoutplaylists] = useState(null),
[activeTab, setActiveTab] = useState(0), [activeTab, setActiveTab] = useState(0),
...@@ -106,6 +107,13 @@ const handleError = (text) => { ...@@ -106,6 +107,13 @@ const handleError = (text) => {
} }
}, },
handleAvalChange = (value) => {
const newData = {
...dataElement,
availability: value
}
setElementData(newData)
},
handleAddBlock = () => { handleAddBlock = () => {
if (!dataElement) return if (!dataElement) return
...@@ -123,8 +131,9 @@ const handleError = (text) => { ...@@ -123,8 +131,9 @@ const handleError = (text) => {
useEffect(() => { useEffect(() => {
if (!!dataElement) return
if (selectedElement !== null || (selectedElement !== null && dataElement !== null && selectedElement.id !== dataElement.id)) { if (selectedElement !== null || (selectedElement !== null && dataElement !== null && selectedElement.id !== dataElement.id)) {
return setElementData(selectedElement) setElementData(selectedElement)
} }
}, [selectedElement]) }, [selectedElement])
...@@ -142,21 +151,6 @@ const handleError = (text) => { ...@@ -142,21 +151,6 @@ 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(() => { useEffect(() => {
if (!screensStore.allDataLayoutPlaylists || screensStore.allDataLayoutPlaylists.length < 1) { if (!screensStore.allDataLayoutPlaylists || screensStore.allDataLayoutPlaylists.length < 1) {
dispatch(getData_layoutPlaylists({ dispatch(getData_layoutPlaylists({
...@@ -165,13 +159,17 @@ const handleError = (text) => { ...@@ -165,13 +159,17 @@ const handleError = (text) => {
q: null q: null
})) }))
} }
if (!projectStore.selectedProject) {
dispatch(getProject(selectedElement.idproject))
}
}, [dispatch]) }, [dispatch])
useEffect(() => { useEffect(() => {
setLayoutplaylists(screensStore.allDataLayoutPlaylists) setLayoutplaylists(screensStore.allDataLayoutPlaylists)
}, [screensStore.allDataLayoutPlaylists]) }, [screensStore.allDataLayoutPlaylists])
useEffect(() => { useEffect(() => {
if (dataElement !== null && (!store.allDataLayoutAssets || store.allDataLayoutAssets.length < 1)) { if (dataElement !== null && (!store.allDataAssets || store.allDataAssets.length < 1)) {
dispatch(getData_assets({ dispatch(getData_assets({
start: 0, start: 0,
length: 1000, length: 1000,
...@@ -302,7 +300,48 @@ return ( ...@@ -302,7 +300,48 @@ return (
<Row className='app-user-edit'> <Row className='app-user-edit'>
<Col sm='12'> <Col sm='12'>
<ManageAssets dataElement={dataElement && dataElement.assets} handleChange={handleAssetsChange} /> <Card>
<CardBody className='pt-2'>
<Nav pills>
<NavItem>
<NavLink
active={activeTab === 0}
onClick={() => toggle(0)}
>
<span className='align-middle d-none d-sm-block'>Assets</span>
</NavLink>
</NavItem>
<NavItem>
<NavLink
active={activeTab === 1}
onClick={() => toggle(1)}
>
<span className='align-middle d-none d-sm-block'>Avaliability</span>
</NavLink>
</NavItem>
</Nav>
<TabContent
activeTab={activeTab}
>
<TabPane tabId={0}>
<ManageAssets
dataElement={dataElement && dataElement.assets}
handleChange={handleAssetsChange}
/>
</TabPane>
<TabPane tabId={1}>
<AvaliabilityBlock
dataElement={dataElement && dataElement.parent && dataElement.parent.availability}
handleElmChange={handleAvalChange}
/>
</TabPane>
</TabContent>
</CardBody>
</Card>
</Col> </Col>
</Row> </Row>
......
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