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