Commit 718a02d9 authored by PDuarte's avatar PDuarte

refactory platforms

parent 74ec76a5
......@@ -16,9 +16,9 @@ import Moment from 'moment'
const PlanAvaliability = ({dataElement, handleElmChange}) => {
const [pickerstartdate, setPickerstartdate] = useState(Date.parse(dataElement.startdate)),
[pickerenddate, setPickerenddate] = useState(Date.parse(dataElement.enddate)),
[plataforms, setPlatforms] = useState([]),
[platforms, setPlatforms] = useState([]),
[geolocations, setGeolocations] = useState([]),
[avaliaPlataforms, setAvaliaPlatforms] = useState([]),
[avaliaPlatforms, setAvaliaPlatforms] = useState([]),
[permitGeo, setPermitGeo] = useState([]),
[denytGeo, setDenyGeo] = useState([]),
store = useSelector(state => state.projectsettings)
......@@ -45,7 +45,7 @@ const PlanAvaliability = ({dataElement, handleElmChange}) => {
useEffect(() => {
if (!dataElement) return
const selected = dataElement.plataforms.map(elm => {
const selected = dataElement.platforms.map(elm => {
return {
value: elm.id,
label: elm.name
......@@ -83,7 +83,7 @@ const PlanAvaliability = ({dataElement, handleElmChange}) => {
})
const newData = {
...dataElement,
plataforms: newValue
platforms: newValue
}
handleElmChange(newData)
},
......@@ -207,14 +207,14 @@ const PlanAvaliability = ({dataElement, handleElmChange}) => {
</FormGroup>
</Col>
<Col md='8' sm='12'>
<Label for='plataforms'>Platforms</Label>
<Label for='platforms'>Platforms</Label>
<Select
isClearable={false}
theme={selectThemeColors}
value={avaliaPlataforms}
value={avaliaPlatforms}
isMulti
name={`platforms${dataElement.id}`}
options={plataforms}
options={platforms}
onChange={platfomsOnChange}
className='react-select'
classNamePrefix='select'
......@@ -281,7 +281,7 @@ const AvaliabilityBlock = ({dataElement, handleElmChange}) => {
const handleAvalChange = (value) => {
const newData = dataElement.map(elm => {
if (elm.id === value.id) {
elm.plataforms = value.plataforms
elm.platforms = value.platforms
elm.geolocations = value.geolocations
elm.startdate = value.startdate
elm.enddate = value.enddate
......@@ -299,7 +299,7 @@ const AvaliabilityBlock = ({dataElement, handleElmChange}) => {
idassets: 'current',
startdate: '',
enddate: '',
plataforms: [],
platforms: [],
geolocations: []
})
handleElmChange(newData)
......
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