Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
arbitrium
web
Commits
ac4e1f87
Commit
ac4e1f87
authored
6 years ago
by
alebing
Browse files
Options
Download
Email Patches
Plain Diff
major changes for new modal - tests
parent
d92ac836
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
src/components/CustomModal.vue
+11
-11
src/components/CustomModal.vue
src/components/DaySchedule.vue
+17
-4
src/components/DaySchedule.vue
src/main.js
+2
-0
src/main.js
src/pages/Schedule.vue
+63
-7
src/pages/Schedule.vue
with
93 additions
and
22 deletions
+93
-22
src/components/CustomModal.vue
View file @
ac4e1f87
...
@@ -11,8 +11,8 @@
...
@@ -11,8 +11,8 @@
</slot>
</slot>
<div
class=
"answers-div"
>
<div
class=
"answers-div"
>
<button
class=
"btn btn-outline-primary btn-
ans
"
@
click=
"
postAnswear(ansOne, event.id
)"
><span>
{{
leftB
t
n
}}
</span></button>
<button
class=
"btn btn-outline-primary btn-
left
"
@
click=
"
leftClick(
)"
><span>
{{
leftB
utto
n
}}
</span></button>
<button
class=
"btn btn-outline-primary btn-
ans
"
@
click=
"
postAnswear(ansTwo, event.id
)"
><span>
{{
rightB
t
n
}}
</span></button>
<button
class=
"btn btn-outline-primary btn-
right
"
@
click=
"
rightClick(
)"
><span>
{{
rightB
utto
n
}}
</span></button>
</div>
</div>
</div>
</div>
</div>
</div>
...
@@ -22,16 +22,11 @@
...
@@ -22,16 +22,11 @@
<
script
>
<
script
>
export
default
{
export
default
{
props
:
[
'
boxText
'
,
'
leftB
t
n
'
,
'
rightB
tn
'
],
props
:
[
'
boxText
'
,
'
leftB
utto
n
'
,
'
rightB
utton
'
,
'
leftClick
'
,
'
rightClick
'
],
mounted
(){
mounted
(){
},
},
methods
:
{
}
}
}
</
script
>
</
script
>
...
@@ -68,11 +63,16 @@
...
@@ -68,11 +63,16 @@
margin-top
:
60px
margin-top
:
60px
}
}
.btn-
ans
{
.btn-
left
{
margin-top
:
10px
;
margin-top
:
10px
;
width
:
10
0%
;
width
:
4
0%
;
height
:
50px
;
height
:
50px
;
vertical-align
:
middle
}
.btn-right
{
margin-top
:
10px
;
width
:
40%
;
height
:
50px
;
}
}
.event-txt
{
.event-txt
{
...
...
This diff is collapsed.
Click to expand it.
src/components/DaySchedule.vue
View file @
ac4e1f87
...
@@ -43,6 +43,8 @@
...
@@ -43,6 +43,8 @@
import
_
from
"
underscore
"
import
_
from
"
underscore
"
import
ActivityInput
from
'
../components/ActivityInput
'
import
ActivityInput
from
'
../components/ActivityInput
'
import
{
getAll
as
getActivities
}
from
'
../services/activity
'
import
{
getAll
as
getActivities
}
from
'
../services/activity
'
import
CustomModal
from
'
../components/CustomModal
'
import
{
bus
}
from
'
../main.js
'
export
default
{
export
default
{
...
@@ -70,12 +72,13 @@ export default {
...
@@ -70,12 +72,13 @@ export default {
components
:
{
components
:
{
ActivityInput
,
ActivityInput
,
'
custom-modal
'
:
CustomModal
},
},
data
:
()
=>
{
data
:
()
=>
{
return
{
return
{
activityList
:
[],
activityList
:
[],
allChecked
:
false
allChecked
:
false
,
}
}
},
},
...
@@ -92,6 +95,14 @@ export default {
...
@@ -92,6 +95,14 @@ export default {
if
(
this
.
hasPreviousWeek
){
if
(
this
.
hasPreviousWeek
){
this
.
allChecked
=
true
this
.
allChecked
=
true
}
}
// this.checkRepeatedDay()
try
{
bus
.
$on
(
'
checkDayCompletition
'
,
this
.
checkDayCompletition
)
bus
.
$on
(
'
checkDayCompletition
'
,
this
.
delayedScroll
)
}
catch
(
err
){
console
.
log
(
'
no need for checking
'
)
}
//bus.$on('checkDayCompletition', this.pageScroll)
},
},
methods
:
{
methods
:
{
...
@@ -128,6 +139,10 @@ export default {
...
@@ -128,6 +139,10 @@ export default {
elem
.
scrollTop
=
elem
.
scrollHeight
;
elem
.
scrollTop
=
elem
.
scrollHeight
;
},
},
delayedScroll
(){
setTimeout
(
this
.
pageScroll
,
10
)
},
removeActivity
(
index
){
removeActivity
(
index
){
if
(
this
.
activities
.
length
==
1
){
if
(
this
.
activities
.
length
==
1
){
alert
(
"
Os dias precisam ter pelo menos uma atividade!
"
);
alert
(
"
Os dias precisam ter pelo menos uma atividade!
"
);
...
@@ -142,9 +157,7 @@ export default {
...
@@ -142,9 +157,7 @@ export default {
},
},
copyPreviousDay
(){
copyPreviousDay
(){
this
.
$emit
(
"
copyPreviousDay
"
,
this
.
dayIndex
);
this
.
$emit
(
"
copyPreviousDay
"
,
this
.
dayIndex
)
this
.
checkDayCompletition
();
setTimeout
(
this
.
pageScroll
,
5
);
},
},
verifyAllInputs
(){
verifyAllInputs
(){
...
...
This diff is collapsed.
Click to expand it.
src/main.js
View file @
ac4e1f87
...
@@ -17,3 +17,5 @@ new Vue({
...
@@ -17,3 +17,5 @@ new Vue({
components
:
{
App
},
components
:
{
App
},
template
:
'
<App/>
'
template
:
'
<App/>
'
})
})
export
const
bus
=
new
Vue
()
This diff is collapsed.
Click to expand it.
src/pages/Schedule.vue
View file @
ac4e1f87
...
@@ -11,9 +11,7 @@
...
@@ -11,9 +11,7 @@
<p
v-if=
"alert"
class=
"alert alert-warning"
>
{{
alert
}}
</p>
<p
v-if=
"alert"
class=
"alert alert-warning"
>
{{
alert
}}
</p>
</div>
</div>
<div
class=
"col-md-1"
>
<div
class=
"col-md-1"
>
<router-link
to=
"/fim"
>
<button
class=
"btn btn-outline-danger"
@
click=
"confirmExit()"
>
DESISTIR
</button>
<button
class=
"btn btn-outline-danger"
>
DESISTIR
</button>
</router-link>
</div>
</div>
</div>
</div>
<!-- SCHEDULE -->
<!-- SCHEDULE -->
...
@@ -38,6 +36,19 @@
...
@@ -38,6 +36,19 @@
<button
type=
"button"
@
click=
"adaptAndCreateWeek()"
class=
"btn btn-primary btn-week"
>
Iniciar simulação
</button>
<button
type=
"button"
@
click=
"adaptAndCreateWeek()"
class=
"btn btn-primary btn-week"
>
Iniciar simulação
</button>
</div>
</div>
</div>
</div>
<custom-modal
v-if=
"showModal"
:boxText=
"textMessage"
:rightButton=
"rightButton"
:leftButton=
"leftButton"
:rightClick=
"rightButtonFunction"
:leftClick=
"leftButtonFunction"
@
hideModal=
"hideModal()"
@
copyActivities=
"copyAllActivities($event)"
>
</custom-modal>
</div>
</div>
</
template
>
</
template
>
...
@@ -48,19 +59,28 @@ import { getAll as getActivities } from '../services/activity'
...
@@ -48,19 +59,28 @@ import { getAll as getActivities } from '../services/activity'
import
{
create
}
from
'
../services/week
'
import
{
create
}
from
'
../services/week
'
import
DaySchedule
from
'
../components/DaySchedule
'
import
DaySchedule
from
'
../components/DaySchedule
'
import
_
from
"
underscore
"
import
_
from
"
underscore
"
import
CustomModal
from
'
../components/CustomModal
'
import
{
bus
}
from
'
../main.js
'
export
default
{
export
default
{
name
:
'
Schedule
'
,
name
:
'
Schedule
'
,
components
:
{
components
:
{
DaySchedule
,
DaySchedule
,
Carousel
,
Carousel
,
Slide
Slide
,
'
custom-modal
'
:
CustomModal
},
},
data
:
()
=>
{
data
:
()
=>
{
return
{
return
{
isSunday
:
false
,
isSunday
:
false
,
days
:
[
'
Segunda-Feira
'
,
'
Terça-Feira
'
,
'
Quarta-Feira
'
,
'
Quinta-Feira
'
,
'
Sexta-Feira
'
,
'
Sábado
'
,
'
Domingo
'
],
days
:
[
'
Segunda-Feira
'
,
'
Terça-Feira
'
,
'
Quarta-Feira
'
,
'
Quinta-Feira
'
,
'
Sexta-Feira
'
,
'
Sábado
'
,
'
Domingo
'
],
showModal
:
false
,
textMessage
:
"
Mensagem de teste
"
,
rightButton
:
"
Ok
"
,
leftButton
:
"
Cancelar
"
,
rightButtonFunction
:
Function
,
leftButtonFunction
:
Function
,
validDays
:
[
false
,
false
,
false
,
false
,
false
,
false
,
false
],
validDays
:
[
false
,
false
,
false
,
false
,
false
,
false
,
false
],
validWeek
:
false
,
validWeek
:
false
,
activitiesByDay
:
new
Array
(
7
),
activitiesByDay
:
new
Array
(
7
),
...
@@ -76,6 +96,7 @@ export default {
...
@@ -76,6 +96,7 @@ export default {
countHoursInDay
:
{},
countHoursInDay
:
{},
canStart
:
false
,
canStart
:
false
,
alert
:
""
,
alert
:
""
,
parentCheck
:
true
,
activities
:[[{
activities
:[[{
activity
:
"
Atividade
"
,
activity
:
"
Atividade
"
,
id
:
0
,
id
:
0
,
...
@@ -249,13 +270,26 @@ export default {
...
@@ -249,13 +270,26 @@ export default {
//allows user to copy his previous day, so he can adjust it faster
//allows user to copy his previous day, so he can adjust it faster
copyPreviousDay
(
dayIndex
){
copyPreviousDay
(
dayIndex
){
if
(
this
.
activities
[
dayIndex
-
1
]){
if
(
this
.
activities
[
dayIndex
-
1
]){
if
(
confirm
(
"
Tem certeza que deseja copiar a agenda de
"
+
this
.
days
[
dayIndex
-
1
])){
this
.
textMessage
=
"
Você gostaria de copiar a sua agenda de
"
+
this
.
days
[
dayIndex
]
+
"
?
"
this
.
copyAllActivities
(
dayIndex
,
dayIndex
-
1
)
this
.
rightButton
=
"
Sim
"
this
.
leftButton
=
"
Não
"
this
.
rightButtonFunction
=
function
(){
this
.
$emit
(
'
hideModal
'
)
this
.
$emit
(
'
copyActivities
'
,
dayIndex
)
bus
.
$emit
(
'
checkDayCompletition
'
)
}
this
.
leftButtonFunction
=
function
(){
this
.
$emit
(
'
hideModal
'
)
}
}
this
.
showModal
=
true
// if(confirm("Tem certeza que deseja copiar a agenda de " + this.days[dayIndex-1])){
// this.copyAllActivities(dayIndex, dayIndex - 1)
// }
}
}
},
},
copyAllActivities
(
currentDayIndex
,
previousDayIndex
){
copyAllActivities
(
currentDayIndex
){
let
previousDayIndex
=
currentDayIndex
-
1
let
activitiesLength
=
this
.
activities
[
currentDayIndex
].
length
let
activitiesLength
=
this
.
activities
[
currentDayIndex
].
length
this
.
activities
[
currentDayIndex
].
splice
(
0
,
activitiesLength
)
this
.
activities
[
currentDayIndex
].
splice
(
0
,
activitiesLength
)
for
(
let
i
=
0
;
i
<
this
.
activities
[
previousDayIndex
].
length
;
i
++
){
for
(
let
i
=
0
;
i
<
this
.
activities
[
previousDayIndex
].
length
;
i
++
){
...
@@ -268,6 +302,7 @@ export default {
...
@@ -268,6 +302,7 @@ export default {
}
}
this
.
addActivity
(
activityToAdd
)
this
.
addActivity
(
activityToAdd
)
}
}
this
.
parentCheck
=
!
this
.
parentCheck
},
},
validDay
(
index
){
validDay
(
index
){
...
@@ -290,6 +325,27 @@ export default {
...
@@ -290,6 +325,27 @@ export default {
this
.
validWeek
=
true
this
.
validWeek
=
true
},
},
testButton
(){
alert
(
"
button clicked
"
)
},
hideModal
(){
this
.
showModal
=
false
},
confirmExit
(){
this
.
textMessage
=
"
Tem certeza que deseja sair da sessão?
"
this
.
rightButton
=
"
Sim
"
this
.
leftButton
=
"
Não
"
this
.
rightButtonFunction
=
function
(){
this
.
$emit
(
'
hideModal
'
)
this
.
$router
.
push
(
'
/fim
'
)
}
this
.
leftButtonFunction
=
function
(){
this
.
$emit
(
'
hideModal
'
)
}
this
.
showModal
=
true
}
}
}
}
}
</
script
>
</
script
>
...
...
This diff is collapsed.
Click to expand it.
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