diff --git a/src/back/vote/views.py b/src/back/vote/views.py index 8c4627fe5..8b90b251f 100644 --- a/src/back/vote/views.py +++ b/src/back/vote/views.py @@ -15,7 +15,6 @@ class GetVotes(APIView): def get(self, request): user = request.user - print(type(user)) # user = User.objects.get(username='9966-00-125') now = datetime.now() status = request.query_params.get('status') diff --git a/src/front/src/components/vote/VoteConstructor.vue b/src/front/src/components/vote/VoteConstructor.vue index 9ea073c40..6f288a63d 100644 --- a/src/front/src/components/vote/VoteConstructor.vue +++ b/src/front/src/components/vote/VoteConstructor.vue @@ -25,8 +25,18 @@ Основная информация - - + + Назад Сохранить + + {{ errorMessage }} + @@ -264,6 +279,10 @@ export default { questions: [], }); + const rules = { + required: (value) => !!value || "Это поле обязательно для заполнения", + }; + const currentQuestionIndex = ref(0); const questionTypes = ["Ввести вручную", "Выбрать сотрудника"]; @@ -313,7 +332,13 @@ export default { } }; + const errorMessage = ref(""); + const saveVoting = async () => { + if (!form.value.title || !form.value.description || form.value.questions < 1) { + errorMessage.value = "Все обязательные поля должны быть заполнены"; + return; + } try { const response = await createVote(form.value); console.log("Голосование успешно создано:", response); @@ -351,7 +376,9 @@ export default { removeEmployee, saveVoting, isVoteCreated, - resetForm + resetForm, + rules, + errorMessage }; }, }; diff --git a/src/front/src/router/index.js b/src/front/src/router/index.js index 49a51de25..f156a59b4 100644 --- a/src/front/src/router/index.js +++ b/src/front/src/router/index.js @@ -152,6 +152,24 @@ const routes = [ component: () => import("@/views/VoteHomePage.vue") }, + { + path: "/vote/voting/:id", + name: "Voting", + component: () => + import("@/views/VoteHomePage.vue") + }, + { + path: "/vote/edit-vote/:id", + name: "EditVote", + component: () => + import("@/views/VoteHomePage.vue") + }, + { + path: "/vote/vote-results/:id", + name: "VoteResults", + component: () => + import("@/views/VoteHomePage.vue") + }, { path: '/secret', name: 'Secret Page', diff --git a/src/front/src/utils/axios-api.js b/src/front/src/utils/axios-api.js index 919d71896..bdf61e4c6 100644 --- a/src/front/src/utils/axios-api.js +++ b/src/front/src/utils/axios-api.js @@ -77,11 +77,6 @@ async error => { return axiosApiInstance(originalRequest); } catch(e) { - - // - // if (window.location.pathname!='/auth') window.location.reload() - // window.location.reload() - return Promise.reject(error); } } diff --git a/src/front/src/views/VoteHomePage.vue b/src/front/src/views/VoteHomePage.vue index 3e1754c39..f64531ab6 100644 --- a/src/front/src/views/VoteHomePage.vue +++ b/src/front/src/views/VoteHomePage.vue @@ -2,12 +2,11 @@ Голосования - @@ -17,9 +16,19 @@ - - + + @@ -29,14 +38,21 @@ - + {{ voting.title }} Завершено: {{ formatDate(voting.endDate) }} - + Результаты @@ -55,12 +71,11 @@ - - + + - - + mdi-close-thick @@ -71,30 +86,27 @@ - - + - Голосование: {{ selectedVoting?.title }} + Редактировать голосование: {{ selectedVoting?.title }} - Сохранить - Закрыть + Закрыть - - + Результаты голосования: {{ selectedVoting?.title }}

Здесь отображаются результаты голосования...

- Закрыть + Закрыть
@@ -102,25 +114,33 @@