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
68b657a9
Commit
68b657a9
authored
May 27, 2021
by
PDuarte
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avaliability UI
parent
df5e724a
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
171 additions
and
14 deletions
+171
-14
form-flat-pickr.scss
...core/scss/base/plugins/forms/pickers/form-flat-pickr.scss
+2
-1
index.js
src/views/assets/projectassets/add/index.js
+2
-1
avaliability.js
src/views/assets/projectassets/card/avaliability.js
+157
-10
index.js
src/views/assets/projectassets/card/index.js
+9
-1
index.js
src/views/menupages/mainpages/card/index.js
+1
-1
No files found.
src/@core/scss/base/plugins/forms/pickers/form-flat-pickr.scss
View file @
68b657a9
...
...
@@ -133,8 +133,9 @@
}
.flatpickr-time
{
height
:
40px
!
important
;
border-color
:
$theme-dark-body-bg
!
important
;
height
:
40px
;
.numInput
,
.flatpickr-am-pm
{
...
...
src/views/assets/projectassets/add/index.js
View file @
68b657a9
...
...
@@ -61,7 +61,8 @@ const Tables = () => {
external_id
:
''
,
textual
:
[],
genres
:
[],
subgenres
:
[]
subgenres
:
[],
availability
:
[]
}}
onSubmitHandler
=
{
onSubmitHandler
}
/
>
...
...
src/views/assets/projectassets/card/avaliability.js
View file @
68b657a9
...
...
@@ -10,8 +10,10 @@ import { selectThemeColors } from '@utils'
import
Flatpickr
from
'react-flatpickr'
import
Select
,
{
components
}
from
'react-select'
import
{
platform
}
from
'chart.js'
import
Moment
from
'moment'
const
PlanAvaliability
=
({
dataElement
,
AvaChange
})
=>
{
const
PlanAvaliability
=
({
dataElement
,
handleElmChange
})
=>
{
const
[
pickerstartdate
,
setPickerstartdate
]
=
useState
(
Date
.
parse
(
dataElement
.
startdate
)),
[
pickerenddate
,
setPickerenddate
]
=
useState
(
Date
.
parse
(
dataElement
.
enddate
)),
[
plataforms
,
setPlatforms
]
=
useState
([]),
...
...
@@ -68,6 +70,117 @@ const PlanAvaliability = ({dataElement, AvaChange}) => {
},
[
dataElement
])
const
updatePlatforms
=
(
value
)
=>
{
const
newValue
=
value
.
map
(
elm
=>
{
return
{
id
:
elm
.
value
,
name
:
elm
.
label
,
pivot
:
{
idavailability
:
dataElement
.
id
,
idplatform
:
elm
.
value
}
}
})
const
newData
=
{
...
dataElement
,
plataforms
:
newValue
}
handleElmChange
(
newData
)
},
updateStartDate
=
(
value
)
=>
{
const
newData
=
{
...
dataElement
,
startdate
:
Moment
(
value
[
0
]).
format
(
'YYYY-MM-DD HH:mm:ss'
)
}
handleElmChange
(
newData
)
setPickerstartdate
(
value
)
console
.
log
(
value
)
},
updateEndDate
=
(
value
)
=>
{
const
newData
=
{
...
dataElement
,
enddate
:
Moment
(
value
[
0
]).
format
(
'YYYY-MM-DD HH:mm:ss'
)
}
handleElmChange
(
newData
)
setPickerenddate
(
value
)
},
updateGeo
=
(
value
,
actionValue
)
=>
{
const
newValue
=
value
.
map
(
elm
=>
{
return
{
id
:
elm
.
value
,
name
:
elm
.
label
,
pivot
:
{
idgeolocation
:
elm
.
value
,
idavailability
:
dataElement
.
id
,
action
:
actionValue
}
}
})
const
newData
=
{
...
dataElement
,
geolocations
:
newValue
}
handleElmChange
(
newData
)
},
platfomsOnChange
=
(
value
,
{
action
,
removedValue
})
=>
{
switch
(
action
)
{
case
'remove-value'
:
case
'pop-value'
:
if
(
removedValue
.
isFixed
)
{
return
}
setAvaliaPlatforms
(
value
)
break
case
'clear'
:
value
=
genresAllOptions
.
filter
(
v
=>
v
.
isFixed
)
setAvaliaPlatforms
(
value
)
break
default
:
setAvaliaPlatforms
(
value
)
break
}
updatePlatforms
(
value
)
},
permitGeoOnChange
=
(
value
,
{
action
,
removedValue
})
=>
{
switch
(
action
)
{
case
'remove-value'
:
case
'pop-value'
:
if
(
removedValue
.
isFixed
)
{
return
}
setPermitGeo
(
value
)
break
case
'clear'
:
value
=
genresAllOptions
.
filter
(
v
=>
v
.
isFixed
)
setPermitGeo
(
value
)
break
default
:
setPermitGeo
(
value
)
break
}
updateGeo
(
value
,
'permit'
)
},
denyGeoOnChange
=
(
value
,
{
action
,
removedValue
})
=>
{
switch
(
action
)
{
case
'remove-value'
:
case
'pop-value'
:
if
(
removedValue
.
isFixed
)
{
return
}
setDenyGeo
(
value
)
break
case
'clear'
:
value
=
genresAllOptions
.
filter
(
v
=>
v
.
isFixed
)
setDenyGeo
(
value
)
break
default
:
setDenyGeo
(
value
)
break
}
updateGeo
(
value
,
'deny'
)
}
return
<
Fragment
>
<
Row
>
<
Col
md
=
'12'
sm
=
'12'
>
...
...
@@ -84,7 +197,7 @@ const PlanAvaliability = ({dataElement, AvaChange}) => {
id
=
{
`startdate-picker
${
dataElement
.
id
}
`
}
className
=
'form-control'
onChange
=
{
date
=>
setPickerstartd
ate
(
date
)}
onChange
=
{
date
=>
updateStartD
ate
(
date
)}
options
=
{{
enableTime
:
true
,
dateFormat
:
'Y-m-d H:i'
,
...
...
@@ -94,7 +207,7 @@ const PlanAvaliability = ({dataElement, AvaChange}) => {
<
/FormGroup
>
<
/Col
>
<
Col
md
=
'8'
sm
=
'12'
>
<
Label
for
=
'plataforms'
>
Plat
a
forms
<
/Label
>
<
Label
for
=
'plataforms'
>
Platforms
<
/Label
>
<
Select
isClearable
=
{
false
}
theme
=
{
selectThemeColors
}
...
...
@@ -102,7 +215,7 @@ const PlanAvaliability = ({dataElement, AvaChange}) => {
isMulti
name
=
{
`platforms
${
dataElement
.
id
}
`
}
options
=
{
plataforms
}
// onChange={genreSub
OnChange}
onChange
=
{
platfoms
OnChange
}
className
=
'react-select'
classNamePrefix
=
'select'
/>
...
...
@@ -120,7 +233,7 @@ const PlanAvaliability = ({dataElement, AvaChange}) => {
id
=
{
`enddate-picker
${
dataElement
.
id
}
`
}
className
=
'form-control'
onChange
=
{
date
=>
setPickerenddate
(
date
)
}
onChange
=
{
date
=>
updateEndDate
(
date
)
}
options
=
{{
enableTime
:
true
,
dateFormat
:
'Y-m-d H:i'
,
...
...
@@ -139,7 +252,7 @@ const PlanAvaliability = ({dataElement, AvaChange}) => {
isMulti
name
=
{
`platforms
${
dataElement
.
id
}
`
}
options
=
{
geolocations
}
// onChange={genreSub
OnChange}
onChange
=
{
permitGeo
OnChange
}
className
=
'react-select'
classNamePrefix
=
'select'
/>
...
...
@@ -153,7 +266,7 @@ const PlanAvaliability = ({dataElement, AvaChange}) => {
isMulti
name
=
{
`platforms
${
dataElement
.
id
}
`
}
options
=
{
geolocations
}
// onChange={genreSub
OnChange}
onChange
=
{
denyGeo
OnChange
}
className
=
'react-select'
classNamePrefix
=
'select'
/>
...
...
@@ -164,7 +277,35 @@ const PlanAvaliability = ({dataElement, AvaChange}) => {
<
/Fragment>
}
const
AvaliabilityBlock
=
({
dataElement
,
handleAvailiabilityChange
})
=>
{
const
AvaliabilityBlock
=
({
dataElement
,
handleElmChange
})
=>
{
const
handleAvalChange
=
(
value
)
=>
{
const
newData
=
dataElement
.
map
(
elm
=>
{
if
(
elm
.
id
===
value
.
id
)
{
elm
.
plataforms
=
value
.
plataforms
elm
.
geolocations
=
value
.
geolocations
elm
.
startdate
=
value
.
startdate
elm
.
enddate
=
value
.
enddate
}
})
// console.log(value)
},
handleAddBlock
=
()
=>
{
if
(
!
dataElement
)
return
const
newData
=
dataElement
newData
.
push
({
id
:
`<generated
${
dataElement
.
length
}
>`
,
idassets
:
'current'
,
startdate
:
''
,
enddate
:
''
,
plataforms
:
[],
geolocations
:
[]
})
handleElmChange
(
newData
)
console
.
log
(
dataElement
)
}
return
<
Row
>
<
Col
sm
=
'12'
>
<
Card
>
...
...
@@ -173,12 +314,18 @@ const AvaliabilityBlock = ({dataElement, handleAvailiabilityChange}) => {
return
<
PlanAvaliability
key
=
{
elm
.
id
}
dataElement
=
{
elm
}
handleElmChange
=
{
handleAvalChange
}
/
>
})
}
<
Col
sm
=
"12"
className
=
"text-center"
>
<
Button
.
Ripple
className
=
'mb-1 mb-sm-0 mr-0 mr-sm-1'
type
=
'button'
color
=
'primary'
>
new
<
Button
.
Ripple
className
=
'mb-1 mb-sm-0 mr-0 mr-sm-1'
type
=
'button'
color
=
'primary'
onClick
=
{()
=>
handleAddBlock
()}
>
New
<
/Button.Ripple
>
<
/Col
>
<
/CardBody
>
...
...
src/views/assets/projectassets/card/index.js
View file @
68b657a9
...
...
@@ -105,6 +105,14 @@ const handleError = (text) => {
}
setElementData
(
newData
)
},
handleAvalChange
=
value
=>
{
// console.log(value)
const
newData
=
{
...
dataElement
,
availability
:
value
}
setElementData
(
newData
)
},
updateGenres
=
(
value
)
=>
{
const
newValue
=
value
.
map
(
elm
=>
{
return
{
...
...
@@ -434,7 +442,7 @@ return (
<
TabPane
tabId
=
{
2
}
>
<
AvaliabilityBlock
dataElement
=
{
dataElement
&&
dataElement
.
availability
}
// handleTextualChange={handleTextu
alChange}
handleElmChange
=
{
handleAv
alChange
}
/
>
<
/TabPane
>
<
/TabContent>
...
...
src/views/menupages/mainpages/card/index.js
View file @
68b657a9
...
...
@@ -111,7 +111,7 @@ const handleError = (text) => {
})
setElementData
(
newData
)
setActiveTab
(
newData
.
menu_page_layouts
.
length
-
1
)
console
.
log
(
newData
)
//
console.log(newData)
}
...
...
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