|
6 | 6 | :class="{'game-event-item': true, 'attention': isChallengeFlag(gameEvent)}"
|
7 | 7 | :key="index">
|
8 | 8 | <span :class="{[teamClass(gameEvent)]: true}" @click="eventSelected(index)">
|
9 |
| - {{gameEvent.type}} |
| 9 | + {{ gameEvent.type }} |
10 | 10 | </span>
|
11 |
| - <div class="btn-accept" |
12 |
| - v-if="showAcceptGoal(gameEvent)" |
13 |
| - v-b-tooltip.hover.d500.righttop="'Accept this goal'"> |
14 |
| - <a @click="acceptGoal(gameEvent)"> |
| 11 | + <div class="event_buttons" |
| 12 | + v-if="showAcceptAndRejectGoal(gameEvent)"> |
| 13 | + <a @click="rejectGoal(gameEvent)" |
| 14 | + v-b-tooltip.hover.d500.righttop="'Reject this goal'"> |
| 15 | + <font-awesome-icon icon="times-circle" class="fa-lg"></font-awesome-icon> |
| 16 | + </a> |
| 17 | + <a @click="acceptGoal(gameEvent)" |
| 18 | + v-b-tooltip.hover.d500.righttop="'Accept this goal'"> |
15 | 19 | <font-awesome-icon icon="check-circle" class="fa-lg"></font-awesome-icon>
|
16 | 20 | </a>
|
17 | 21 | </div>
|
18 | 22 | <p class="details-row"
|
19 | 23 | v-if="selectedEvent === index"
|
20 | 24 | v-for="detail in detailsList(gameEvent)"
|
21 |
| - :key="detail.key">{{detail.key}}: {{detail.value}}</p> |
| 25 | + :key="detail.key">{{ detail.key }}: {{ detail.value }}</p> |
22 | 26 | </div>
|
23 | 27 | </div>
|
24 | 28 | </template>
|
25 | 29 |
|
26 | 30 | <script>
|
27 |
| - import {submitGameEvent} from "../../submit"; |
28 |
| - import {gameEventByTeam, gameEventDetailsList} from "../../gameEvents"; |
| 31 | +import {submitGameEvent} from "@/submit"; |
| 32 | +import {gameEventByTeam, gameEventDetailsList} from "@/gameEvents"; |
| 33 | +import {TEAM_BLUE, TEAM_YELLOW} from "@/refereeState"; |
29 | 34 |
|
30 |
| - export default { |
31 |
| - name: "CurrentEvents", |
32 |
| - data() { |
33 |
| - return { |
34 |
| - selectedEvent: -1, |
35 |
| - } |
| 35 | +export default { |
| 36 | + name: "CurrentEvents", |
| 37 | + data() { |
| 38 | + return { |
| 39 | + selectedEvent: -1, |
| 40 | + } |
| 41 | + }, |
| 42 | + computed: { |
| 43 | + gameEvents() { |
| 44 | + return this.$store.state.matchState.gameEvents; |
36 | 45 | },
|
37 |
| - computed: { |
38 |
| - gameEvents() { |
39 |
| - return this.$store.state.matchState.gameEvents; |
40 |
| - }, |
41 |
| - gameEventsPresent() { |
42 |
| - return this.gameEvents && this.gameEvents.length > 0; |
43 |
| - }, |
44 |
| - goalEventPresent() { |
45 |
| - for (let event of this.$store.state.matchState.gameEvents) { |
46 |
| - if (event.type === 'GOAL') { |
47 |
| - return true; |
48 |
| - } |
49 |
| - } |
50 |
| - return false; |
51 |
| - }, |
| 46 | + gameEventsPresent() { |
| 47 | + return this.gameEvents && this.gameEvents.length > 0; |
52 | 48 | },
|
53 |
| - methods: { |
54 |
| - teamClass(gameEvent) { |
55 |
| - const team = this.byTeam(gameEvent); |
56 |
| - if (team === 'BLUE') { |
57 |
| - return 'team-blue'; |
58 |
| - } else if (team === 'YELLOW') { |
59 |
| - return 'team-yellow'; |
| 49 | + goalOrBallLeftFieldEventPresent() { |
| 50 | + for (let event of this.$store.state.matchState.gameEvents) { |
| 51 | + if (event.type === 'GOAL' || event.type === 'BALL_LEFT_FIELD_GOAL_LINE') { |
| 52 | + return true; |
60 | 53 | }
|
61 |
| - return ''; |
62 |
| - }, |
63 |
| - eventSelected(index) { |
64 |
| - if (this.selectedEvent === index) { |
65 |
| - this.selectedEvent = -1; |
66 |
| - } else { |
67 |
| - this.selectedEvent = index; |
| 54 | + } |
| 55 | + return false; |
| 56 | + }, |
| 57 | + }, |
| 58 | + methods: { |
| 59 | + teamClass(gameEvent) { |
| 60 | + const team = this.byTeam(gameEvent); |
| 61 | + if (team === 'BLUE') { |
| 62 | + return 'team-blue'; |
| 63 | + } else if (team === 'YELLOW') { |
| 64 | + return 'team-yellow'; |
| 65 | + } |
| 66 | + return ''; |
| 67 | + }, |
| 68 | + eventSelected(index) { |
| 69 | + if (this.selectedEvent === index) { |
| 70 | + this.selectedEvent = -1; |
| 71 | + } else { |
| 72 | + this.selectedEvent = index; |
| 73 | + } |
| 74 | + }, |
| 75 | + showAcceptAndRejectGoal(gameEvent) { |
| 76 | + return !this.goalOrBallLeftFieldEventPresent && gameEvent.type === 'POSSIBLE_GOAL'; |
| 77 | + }, |
| 78 | + isChallengeFlag(gameEvent) { |
| 79 | + return !this.goalOrBallLeftFieldEventPresent && gameEvent.type === 'CHALLENGE_FLAG'; |
| 80 | + }, |
| 81 | + detailsList(gameEvent) { |
| 82 | + return gameEventDetailsList(gameEvent); |
| 83 | + }, |
| 84 | + byTeam(gameEvent) { |
| 85 | + return gameEventByTeam(gameEvent); |
| 86 | + }, |
| 87 | + acceptGoal(gameEvent) { |
| 88 | + submitGameEvent({ |
| 89 | + type: 'GOAL', |
| 90 | + origins: gameEvent.origins, |
| 91 | + goal: gameEvent.possibleGoal |
| 92 | + }); |
| 93 | + }, |
| 94 | + rejectGoal(gameEvent) { |
| 95 | + let team = gameEvent.possibleGoal.kickingTeam; |
| 96 | + if (team === null) { |
| 97 | + team = (gameEvent.possibleGoal.by_team === TEAM_BLUE) ? TEAM_YELLOW : TEAM_BLUE; |
| 98 | + } |
| 99 | + submitGameEvent({ |
| 100 | + type: 'BALL_LEFT_FIELD_GOAL_LINE', |
| 101 | + ballLeftFieldGoalLine: { |
| 102 | + by_team: team, |
| 103 | + by_bot: gameEvent.possibleGoal.kickingBot, |
| 104 | + location: gameEvent.possibleGoal.location |
68 | 105 | }
|
69 |
| - }, |
70 |
| - showAcceptGoal(gameEvent) { |
71 |
| - return !this.goalEventPresent && gameEvent.type === 'POSSIBLE_GOAL'; |
72 |
| - }, |
73 |
| - isChallengeFlag(gameEvent) { |
74 |
| - return !this.goalEventPresent && gameEvent.type === 'CHALLENGE_FLAG'; |
75 |
| - }, |
76 |
| - detailsList(gameEvent) { |
77 |
| - return gameEventDetailsList(gameEvent); |
78 |
| - }, |
79 |
| - byTeam(gameEvent) { |
80 |
| - return gameEventByTeam(gameEvent); |
81 |
| - }, |
82 |
| - acceptGoal(gameEvent) { |
83 |
| - submitGameEvent({ |
84 |
| - type: 'GOAL', |
85 |
| - origins: gameEvent.origins, |
86 |
| - goal: gameEvent.possibleGoal |
87 |
| - }); |
88 |
| - }, |
89 |
| - } |
| 106 | + }); |
| 107 | + }, |
90 | 108 | }
|
| 109 | +} |
91 | 110 | </script>
|
92 | 111 |
|
93 | 112 | <style scoped>
|
94 |
| - .content { |
95 |
| - text-align: center; |
96 |
| - } |
| 113 | +.content { |
| 114 | + text-align: center; |
| 115 | +} |
97 | 116 |
|
98 |
| - .game-event-item { |
99 |
| - position: relative; |
100 |
| - min-height: 2em; |
101 |
| - border-style: dotted; |
102 |
| - border-width: thin; |
103 |
| - border-radius: 5px; |
104 |
| - padding: 0.2em; |
105 |
| - margin: 0.2em; |
106 |
| - text-align: left; |
107 |
| - } |
| 117 | +.game-event-item { |
| 118 | + position: relative; |
| 119 | + min-height: 2em; |
| 120 | + border-style: dotted; |
| 121 | + border-width: thin; |
| 122 | + border-radius: 5px; |
| 123 | + padding: 0.2em; |
| 124 | + margin: 0.2em; |
| 125 | + text-align: left; |
| 126 | +} |
108 | 127 |
|
109 |
| - .btn-accept { |
110 |
| - position: absolute; |
111 |
| - right: 0; |
112 |
| - top: 0; |
113 |
| - margin: 0.3em; |
114 |
| - } |
| 128 | +.event_buttons { |
| 129 | + position: absolute; |
| 130 | + right: 0; |
| 131 | + top: 0; |
| 132 | + margin: 0.3em; |
| 133 | +} |
115 | 134 |
|
116 |
| - .attention { |
117 |
| - background-color: red; |
118 |
| - } |
| 135 | +.attention { |
| 136 | + background-color: red; |
| 137 | +} |
119 | 138 |
|
120 |
| - .details-row { |
121 |
| - margin-bottom: 0; |
122 |
| - } |
| 139 | +.details-row { |
| 140 | + margin-bottom: 0; |
| 141 | +} |
123 | 142 | </style>
|
0 commit comments