Skip to content
Open

Lab5 #34

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 72 additions & 4 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,81 @@
<!DOCTYPE html>
<html lang="en">
<html lang="uk">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Simple HTML Page</title>
<link rel="stylesheet" href="./style/style.css">
<script src="./src/main.js" defer></script>
<title>Голосування</title>
<link rel="stylesheet" href="style\style.css">
</head>
<body>
<div class="container">
<div class="header">
<button class="reports-btn" onclick="location.href='reports.html'">Перейти до звітів</button>
<button class="create-poll-btn" onclick="openCreateModal()">Створити опитування</button>
</div>
<div class="search-section">
<div class="search-container">
<input type="text" class="search-input" placeholder="Шукати опитування..." id="searchInput">
<select class="category-select" id="categorySelect">
<option value="">Всі категорії</option>
<option value="Технології">Технології</option>
<option value="Соціальні мережі">Соціальні мережі</option>
<option value="Розваги">Розваги</option>
<option value="Освіта">Освіта</option>
<option value="Спорт">Спорт</option>
<option value="Їжа">Їжа</option>
<option value="Подорожі">Подорожі</option>
</select>
<button class="search-btn" onclick="performSearch()">Пошук</button>
</div>
</div>
<div class="polls-grid" id="pollsGrid"></div>
</div>

<div class="modal" id="voteModal">
<div class="modal-content">
<button class="close-btn" onclick="closeModal('voteModal')">&times;</button>
<h2 class="modal-title">Голосування</h2>
<h3 class="modal-question" id="voteQuestion">Питання опитування</h3>
<div class="vote-options" id="voteOptions"></div>
<button class="vote-btn" onclick="submitVote()">Проголосувати</button>
</div>
</div>

<div class="modal" id="createModal">
<div class="modal-content">
<button class="close-btn" onclick="closeModal('createModal')">&times;</button>
<h2 class="modal-title">Створити опитування</h2>
<div class="form-group">
<label class="form-label">Питання</label>
<input type="text" class="form-input" id="questionInput" placeholder="Введіть ваше питання">
</div>
<div class="form-group">
<label class="form-label">Категорія</label>
<select class="form-input" id="categorySelectCreate">
<option value="">Оберіть категорію</option>
<option value="Технології">Технології</option>
<option value="Соціальні мережі">Соціальні мережі</option>
<option value="Розваги">Розваги</option>
<option value="Освіта">Освіта</option>
<option value="Спорт">Спорт</option>
<option value="Їжа">Їжа</option>
<option value="Подорожі">Подорожі</option>
<option value="Інше">Інше</option>
</select>
</div>
<div class="form-group" id="optionsGroup">
<label class="form-label">Варіанти відповідей</label>
<input type="text" class="form-input option-input" placeholder="Варіант 1">
<input type="text" class="form-input option-input" placeholder="Варіант 2">
<input type="text" class="form-input option-input" placeholder="Варіант 3">
<input type="text" class="form-input option-input" placeholder="Варіант 4">
<button class="add-option-btn" onclick="addOption()">+ Додати варіант</button>
</div>
<button class="create-btn" onclick="createPoll()">Створити</button>
</div>
</div>

<div class="notification" id="notification"></div>
<script src="src\main.js"></script>
</body>
</html>
98 changes: 98 additions & 0 deletions polls.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
[
{
"id": 1,
"question": "Яка ваша улюблена мова програмування?",
"category": "Технології",
"options": [
{ "text": "JavaScript", "votes": 525 },
{ "text": "Python", "votes": 600 },
{ "text": "Java", "votes": 300 },
{ "text": "C++", "votes": 75 }
],
"totalVotes": 1500
},
{
"id": 2,
"question": "Якою соціальною мережею ви користуєтесь найбільше?",
"category": "Соціальні мережі",
"options": [
{ "text": "Instagram", "votes": 540 },
{ "text": "TikTok", "votes": 450 },
{ "text": "Facebook", "votes": 315 },
{ "text": "Twitter", "votes": 195 }
],
"totalVotes": 1500
},
{
"id": 3,
"question": "Який ваш улюблений жанр фільмів?",
"category": "Розваги",
"options": [
{ "text": "Драма", "votes": 280 },
{ "text": "Комедія", "votes": 350 },
{ "text": "Бойовик", "votes": 300 },
{ "text": "Жахи", "votes": 170 }
],
"totalVotes": 1100
},
{
"id": 4,
"question": "Яке ваше улюблене заняття у вільний час?",
"category": "Розваги",
"options": [
{ "text": "Читання", "votes": 250 },
{ "text": "Спорт", "votes": 400 },
{ "text": "Відеоігри", "votes": 350 },
{ "text": "Подорожі", "votes": 300 }
],
"totalVotes": 1300
},
{
"id": 5,
"question": "Який найкращий спосіб навчання?",
"category": "Освіта",
"options": [
{ "text": "Онлайн курси", "votes": 450 },
{ "text": "Книги", "votes": 300 },
{ "text": "Відео", "votes": 600 },
{ "text": "Практика", "votes": 650 }
],
"totalVotes": 2000
},
{
"id": 6,
"question": "Який ваш улюблений вид спорту?",
"category": "Спорт",
"options": [
{ "text": "Футбол", "votes": 500 },
{ "text": "Баскетбол", "votes": 300 },
{ "text": "Теніс", "votes": 200 },
{ "text": "Плавання", "votes": 250 }
],
"totalVotes": 1250
},
{
"id": 7,
"question": "Яка ваша улюблена кухня?",
"category": "Їжа",
"options": [
{ "text": "Італійська", "votes": 400 },
{ "text": "Японська", "votes": 350 },
{ "text": "Українська", "votes": 300 },
{ "text": "Французька", "votes": 150 }
],
"totalVotes": 1200
},
{
"id": 8,
"question": "Куди б ви хотіли поїхати у відпустку?",
"category": "Подорожі",
"options": [
{ "text": "Європа", "votes": 450 },
{ "text": "Азія", "votes": 350 },
{ "text": "Америка", "votes": 250 },
{ "text": "Океанія", "votes": 100 }
],
"totalVotes": 1150
}
]
23 changes: 23 additions & 0 deletions reports.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<!DOCTYPE html>
<html lang="uk">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Звіти по опитуванням</title>

<script src="https://cdn.webdatarocks.com/latest/webdatarocks.js"></script>
<link href="https://cdn.webdatarocks.com/latest/webdatarocks.min.css" rel="stylesheet">

<link rel="stylesheet" href="style/style.css">
<link rel="stylesheet" href="style/reports.css">
</head>
<body>
<div class="reports-container">
<button class="back-btn" onclick="location.href='index.html'">← Повернутись</button>
<h1>Аналітика опитувань</h1>
<div id="pivot-container"></div>
</div>

<script src="src/reports.js"></script>
</body>
</html>
Loading