|
28 | 28 | q-icon(name='mdi-information-outline' size='66px' color='grey-4') |
29 | 29 | small.text-grey Sélectionne un candidat pour voir son programme |
30 | 30 | q-separator.q-my-md |
31 | | - .fit.flex(v-if="candidature.candidatures") |
| 31 | + .fit.flex(v-if="candidature.candidatures && isToVote") |
32 | 32 | .flex.justify-center.items-center.column(:style='{flex: 1}') |
33 | 33 | h3.text-center.q-mb-md.q-mt-none Urne de vote |
34 | 34 | .slot.middle.cursor-pointer.flex.column(@click="toVoteCandidature") |
|
48 | 48 | option-value="proposedBy" |
49 | 49 | option-label="proposedBy" |
50 | 50 | ) |
| 51 | + div.text-center(v-else) C'est pas encore le moment de voter, reviens plus tard ! |
51 | 52 | div(v-else-if='hasLaw') |
52 | 53 | div(v-else) |
53 | 54 | q-card-section.text-center |
@@ -112,7 +113,22 @@ export default { |
112 | 113 | const hours = currentDate.getHours() |
113 | 114 |
|
114 | 115 | // Vendredi à partir de 18h |
115 | | - if (day === 5 && hours >= 18) return true |
| 116 | + if (day === 5) return true |
| 117 | +
|
| 118 | + // Samedi (toute la journée) |
| 119 | + if (day === 6) return true |
| 120 | +
|
| 121 | + // Dimanche avant 20h |
| 122 | + if (day === 0 && hours < 20) return true |
| 123 | +
|
| 124 | + return false |
| 125 | + }, |
| 126 | + isToVote() { |
| 127 | + // les elections se déroulent tout les vendredi de 18h à dimanche 20h |
| 128 | + const currentDate = new Date() |
| 129 | +
|
| 130 | + const day = currentDate.getDay() // 0 = dimanche, 5 = vendredi, 6 = samedi |
| 131 | + const hours = currentDate.getHours() |
116 | 132 |
|
117 | 133 | // Samedi (toute la journée) |
118 | 134 | if (day === 6) return true |
|
0 commit comments