-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtaskmanager.html
More file actions
195 lines (181 loc) · 5.45 KB
/
taskmanager.html
File metadata and controls
195 lines (181 loc) · 5.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Task Management Subsystem</title>
<style>
body {
font-family: Arial, sans-serif;
background-color: #f4f4f4;
margin: 0;
padding: 0;
}
.navbar {
background: #333;
padding: 10px;
text-align: center;
}
.navbar a {
color: white;
text-decoration: none;
padding: 14px 20px;
display: inline-block;
}
.navbar a:hover {
background: #575757;
}
.container {
padding: 20px;
text-align: center;
}
.kanban-board {
display: flex;
justify-content: space-around;
margin-top: 20px;
}
.kanban-column {
width: 30%;
background: white;
padding: 15px;
border-radius: 5px;
box-shadow: 0px 0px 5px gray;
min-height: 300px;
}
.task-card {
background: #e3e3e3;
padding: 10px;
margin: 10px 0;
border-radius: 5px;
cursor: grab;
}
.task-form {
background: white;
padding: 20px;
margin: 20px auto;
width: 50%;
border-radius: 5px;
box-shadow: 0px 0px 5px gray;
}
input, textarea, select, button {
width: 100%;
padding: 10px;
margin: 5px 0;
border-radius: 5px;
border: 1px solid #ccc;
}
button {
background: #333;
color: white;
border: none;
cursor: pointer;
}
button:hover {
background: #575757;
}
</style>
<script type="module">
// Firebase imports
import { initializeApp } from "https://www.gstatic.com/firebasejs/11.4.0/firebase-app.js";
import { getFirestore, collection, addDoc, getDocs, updateDoc, doc } from "https://www.gstatic.com/firebasejs/11.4.0/firebase-firestore.js";
// Firebase configuration
const firebaseConfig = {
apiKey: "AIzaSyB6tDk5iNJNBkBRVqwPMBTrCm6o74Wd7mc",
authDomain: "thenordschannel.firebaseapp.com",
projectId: "thenordschannel",
storageBucket: "thenordschannel.firebasestorage.app",
messagingSenderId: "924322422013",
appId: "1:924322422013:web:51cf72f375e18376c7b294"
};
// Initialize Firebase
const app = initializeApp(firebaseConfig);
const db = getFirestore(app);
// Fetch and display tasks from Firestore
async function loadTasks() {
const querySnapshot = await getDocs(collection(db, "tasks"));
querySnapshot.forEach((doc) => {
const taskData = doc.data();
const taskCard = createTaskCard(taskData, doc.id);
document.getElementById(taskData.status).appendChild(taskCard);
});
}
// Function to create a task card
function createTaskCard(taskData, taskId) {
const taskCard = document.createElement("div");
taskCard.classList.add("task-card");
taskCard.setAttribute("draggable", true);
taskCard.setAttribute("data-id", taskId);
taskCard.innerHTML = `
<h3>${taskData.title}</h3>
<p>${taskData.description}</p>
<p><strong>Assigned to:</strong> ${taskData.assignee}</p>
<p><span class="priority">${taskData.priority}</span></p>
<p class="due-date"><strong>Due Date:</strong> ${taskData.dueDate}</p>
`;
// Drag & Drop events
taskCard.addEventListener("dragstart", function(e) {
e.dataTransfer.setData("text/plain", taskId);
});
return taskCard;
}
// Enable drag and drop functionality
document.querySelectorAll(".kanban-column").forEach(column => {
column.addEventListener("dragover", function(e) {
e.preventDefault();
});
column.addEventListener("drop", async function(e) {
e.preventDefault();
const taskId = e.dataTransfer.getData("text/plain");
const taskCard = document.querySelector(`[data-id='${taskId}']`);
column.appendChild(taskCard);
// Update Firestore
await updateDoc(doc(db, "tasks", taskId), { status: column.id });
});
});
// Load tasks on page load
loadTasks();
</script>
</head>
<body>
<div class="navbar">
<a href="index.html">Home</a>
<a href="index.html">Chat</a>
<a href="taskmanager.html">Task Manager</a>
<a href="aboutus.html">About Us</a>
</div>
<h1 class="container">Task Management Subsystem</h1>
<div class="container">
<div class="kanban-board">
<div class="kanban-column" id="to-do">
<h2>To Do</h2>
</div>
<div class="kanban-column" id="in-progress">
<h2>In Progress</h2>
</div>
<div class="kanban-column" id="completed">
<h2>Completed</h2>
</div>
</div>
</div>
<div class="task-form">
<h3>Create New Task</h3>
<form id="task-form">
<input type="text" id="task-title" placeholder="Task Title" required>
<textarea id="task-description" placeholder="Task Description" required></textarea>
<select id="task-assignee" required>
<option value="">Assign To</option>
<option value="Nord">Nord</option>
<option value="Sheena">Sheena</option>
</select>
<select id="task-priority" required>
<option value="">Select Priority</option>
<option value="High">High</option>
<option value="Medium">Medium</option>
<option value="Low">Low</option>
</select>
<input type="date" id="task-due-date" required>
<button type="submit">Create Task</button>
</form>
</div>
</body>
</html>