diff --git a/frontend/components/admin/archiveLotteryPage.vue b/frontend/components/admin/archiveLotteryPage.vue index e748687..724072d 100644 --- a/frontend/components/admin/archiveLotteryPage.vue +++ b/frontend/components/admin/archiveLotteryPage.vue @@ -67,7 +67,14 @@
@@ -81,6 +88,7 @@ export default { data() { return { payed: undefined, + todaysAlreadySubmitted: false, wines: [], winners: [], attendees: [], @@ -97,6 +105,7 @@ export default { this.fetchLotteryWines(); this.fetchLotteryWinners(); this.fetchLotteryAttendees(); + this.checkIfAlreadySubmittedForToday(); }, watch: { lotteryColors: { @@ -162,6 +171,19 @@ export default { } }); }, + checkIfAlreadySubmittedForToday() { + return fetch("/api/lottery/latest") + .then(resp => resp.json()) + .then(response => { + const getDay = d => new Date(d).getDate(); + + if (response.lottery.date && (getDay(response.lottery.date) == getDay(new Date()))) { + this.todaysAlreadySubmitted = true; + } else { + this.todaysAlreadySubmitted = false; + } + }) + }, updateLotteryColorsWithAttendees(attendees) { this.attendees.map(attendee => { this.lotteryColors.map(color => (color.value += attendee[color.key])); @@ -222,6 +244,7 @@ export default { .then(resp => resp.json()) .then(response => { if (response.success) { + this.todaysAlreadySubmitted = true; this.$toast.info({ title: "Lotteriet er sendt inn og arkivert! Du kan nå slette viner, deltakere & vinnere slettes.", timeout: 10000 @@ -278,6 +301,17 @@ select { } } +.info-message { + padding: 0.75rem; + text-align: center; + background-color: var(--light-blue); + color: var(--matte-text-color); + border-radius: 4px; + + font-size: 1.1rem; + line-height: 1.5rem; +} + .winner-element { display: flex; flex-direction: column;