s
This commit is contained in:
1 parent
f20a58c7d3
commit
6a80bc17d4
3 files changed
+24
-49
No files matched your search
@@ -3,15 +3,11 @@
|
||||
<v-card variant="text"
|
||||
:disabled="disabledcard.disabled"
|
||||
class="py-2 mx-auto">
|
||||
<v-card-title class="text-body-1">
|
||||
<template v-if="!isFinished">
|
||||
До {{ disabledcard.text }} голосования осталось:
|
||||
</template>
|
||||
<template v-else>
|
||||
Завершено: {{ finishedDate }}
|
||||
</template>
|
||||
<v-card-title class="text-body-1">
|
||||
До {{ disabledcard.text }} голосования осталось:
|
||||
|
||||
</v-card-title>
|
||||
<v-row v-if="!isFinished" no-gutters class="align-baseline">
|
||||
<v-row no-gutters class="align-baseline">
|
||||
<v-col class="text-center">
|
||||
<v-card class="bg-yellow-darken-4">
|
||||
<div>{{ displayDays }}</div>
|
||||
@@ -64,7 +60,7 @@ export default {
|
||||
const displayDays = ref(0);
|
||||
const displaySeconds = ref(0);
|
||||
const isFinished = ref(false);
|
||||
const finishedDate = ref('');
|
||||
|
||||
|
||||
const minutes = computed(() => seconds * 60);
|
||||
const hours = computed(() => minutes.value * 60);
|
||||
@@ -135,8 +131,7 @@ export default {
|
||||
declOfNum,
|
||||
dateendorStart,
|
||||
disabledcard,
|
||||
isFinished,
|
||||
finishedDate
|
||||
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,8 +41,9 @@
|
||||
<span>{{ voteCard.description }}</span>
|
||||
</v-tooltip>
|
||||
</v-card-text>
|
||||
<Timer :voteTime="{ dateend: voteCard.dateend, datestart: voteCard.datestart }"
|
||||
<Timer v-if ="!isFinished" :voteTime="{ dateend: voteCard.dateend, datestart: voteCard.datestart }"
|
||||
@changeBtn="(time) => timeChange = time"/>
|
||||
<div class="font-weight-bold text-center" v-else> Завершено: {{ new Date(voteCard.dateend).toLocaleDateString() }}</div>
|
||||
<v-card-actions class="justify-space-between mt-4 pb-2">
|
||||
<template v-if="!isFinished">
|
||||
<v-btn :disabled="voteCard.is_passed || timeChange" color="teal-darken-4" prepend-icon="mdi-vote-outline"
|
||||
@@ -102,6 +103,10 @@ export default {
|
||||
components: {Timer},
|
||||
emits: ['openVoteModal', 'openEditVoteModal', 'deleteVoting', 'openResultModal'],
|
||||
props: {
|
||||
isFinished:{
|
||||
type:Boolean,
|
||||
default: false
|
||||
},
|
||||
voteCard: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
|
||||
@@ -16,49 +16,28 @@
|
||||
<!-- Текущие голосования -->
|
||||
<!-- <v-tabs-window v-model="currentTab"> -->
|
||||
<!-- Текущие голосования -->
|
||||
<v-tabs-window-item value="active" class="h-100 overflow-auto">
|
||||
<v-tabs-window-item v-for="x in ['active','completed']" :value="x" class="h-100 overflow-auto">
|
||||
<v-row class="mx-2">
|
||||
<v-col
|
||||
v-for="voting in sortedCurrentVotes"
|
||||
v-for="voting in sortedVotes"
|
||||
:key="voting.id"
|
||||
cols="12"
|
||||
lg="3"
|
||||
md="4"
|
||||
>
|
||||
<VoteCardVue
|
||||
:isFinished="currentTab=='active'"
|
||||
:voteCard="voting"
|
||||
@openVoteModal="(voting) => openModal('vote', voting)"
|
||||
@openEditVoteModal="(voting) => openModal('edit', voting)"
|
||||
@deleteVoting="deleteVoting"
|
||||
/>
|
||||
</v-col>
|
||||
</v-row>
|
||||
|
||||
</v-row>
|
||||
</v-tabs-window-item>
|
||||
|
||||
<!-- Завершенные голосования -->
|
||||
<v-tabs-window-item value="completed" class="h-100 overflow-auto">
|
||||
<v-container>
|
||||
<v-row>
|
||||
<v-col
|
||||
v-for="voting in sortedCompletedVotes"
|
||||
:key="voting.id"
|
||||
cols="12"
|
||||
lg="3"
|
||||
md="4"
|
||||
:class="{ 'voted-card': voting.voted }"
|
||||
>
|
||||
<VoteCardVue
|
||||
:voteCard="voting"
|
||||
@deleteVoting="deleteVoting"
|
||||
@openEditVoteModal="(voting) => openModal('edit', voting)"
|
||||
@openVoteModal="(voting) => openModal('vote', voting)"
|
||||
@openResultModal="(voting) => openModal('results', voting)"
|
||||
/>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-container>
|
||||
</v-tabs-window-item>
|
||||
|
||||
|
||||
<!-- Конструктор -->
|
||||
<v-tabs-window-item value="constructor" class="h-100 overflow-auto bg-yellow">
|
||||
@@ -144,17 +123,13 @@ export default {
|
||||
const resultsModal = ref(false);
|
||||
const selectedVoting = ref(null);
|
||||
|
||||
const sortedCurrentVotes = computed(() =>
|
||||
votes.value
|
||||
.filter((v) => new Date(v.dateend) > new Date())
|
||||
.sort((a, b) => new Date(a.dateend) - new Date(b.dateend))
|
||||
const sortedVotes = computed(() =>{
|
||||
return currentTab.value=='active'?votes.value.sort((a, b) => new Date(a.dateend) - new Date(b.dateend)):votes.value.sort((a, b) => new Date(b.dateend) - new Date(a.dateend))
|
||||
}
|
||||
|
||||
);
|
||||
|
||||
const sortedCompletedVotes = computed(() =>
|
||||
votes.value
|
||||
.filter((v) => new Date(v.dateend) <= new Date())
|
||||
.sort((a, b) => new Date(b.dateend) - new Date(a.dateend))
|
||||
);
|
||||
|
||||
|
||||
const loadVoteDetails = async (id) => {
|
||||
try {
|
||||
@@ -228,8 +203,8 @@ export default {
|
||||
return {
|
||||
currentTab,
|
||||
votes,
|
||||
sortedCurrentVotes,
|
||||
sortedCompletedVotes,
|
||||
sortedVotes,
|
||||
|
||||
voteModal,
|
||||
editVoteModal,
|
||||
resultsModal,
|
||||
|
||||
Reference in new issue
Block a user