-
Notifications
You must be signed in to change notification settings - Fork 0
/
taskboards.html
236 lines (226 loc) · 12.9 KB
/
taskboards.html
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
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
<title>Task Board</title>
</head>
<body>
<div class="container-fluid">
<header>
<!-- navigation bar -->
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
<a class="navbar-brand" href="/">Task Management System</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNavAltMarkup" aria-controls="navbarNavAltMarkup" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNavAltMarkup">
<div class="navbar-nav">
{% if user %}
<a class="nav-item nav-link" href="/createtaskboard">Create TaskBoard</a>
<a class="nav-item nav-link" href="/viewtaskboard">View TaskBoards</a>
{% endif %}
</div>
</div>
</nav>
</header>
<main>
{% if user %}
<!-- card containing taskboard details -->
<div class="card">
<h5 class="card-header">Task Board</h5>
<div class="card-body">
<h5 class="card-title">{{ taskboard.name }}
<!-- Button trigger modal -->
<!-- button to edit taskboard -->
<button type="button" class="btn btn-primary ml-2" data-toggle="modal" data-target="#exampleModal">
Edit Board
</button>
</h5>
<!-- Modal -->
<div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Edit TaskBoard</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<form method="post" action="/taskboards" class="form">
<div class="input-group mb-3">
<input type="text" name="name" class="form-control" value="{{ taskboard.name }}" placeholder="Taskboard name" required>
<div class="input-group-append">
<input type="submit" name="button" value="Change" class="btn btn-primary">
</div>
</div>
<input type="hidden" name="id" value="{{ taskboard.key.id() }}">
</form>
<!-- checks if user is the creator of the taskboard -->
{% if permission %}
<form method="post" action="/taskboards" class="form">
<div class="input-group mb-3">
<!-- list of users -->
<select class="custom-select" name="assigned_user" required>
<option selected="true" disabled="disabled" value="">Select User</option>
{% for i in taskboard.users %}
<option value="{{ i.urlsafe() }}">{{ i.get().email_address }}</option>
{% endfor %}
</select>
<div class="input-group-append">
<input type="submit" name="button" value="Drop" class="btn btn-primary">
</div>
</div>
<input type="hidden" name="id" value="{{ taskboard.key.id() }}">
</form>
{% endif %}
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
{% if permission %}
<form method="post" action="/taskboards" class="form">
<input type="submit" name="button" value="DeleteTaskboard" class="btn btn-primary">
<input type="hidden" name="id" value="{{ taskboard.key.id() }}">
</form>
<small class="form-text text-muted">To delete taskboard all users and tasks must be removed.</small>
{% endif %}
</div>
</div>
</div>
</div>
{% if permission %}
<p class="card-text">You can invite a user add tasks to the Task board</p>
{% else %}
<p class="card-text">You can add a task to the Task board</p>
{% endif %}
<!-- show all users in taskboard -->
<p class="font-weight-bold">Taskboard Users:
{% for i in taskboard.users %}
{% if i == taskboard.creator %}
<span class="font-weight-bold text-danger">{{ i.get().email_address }} </span>
{% else %}
<span class="font-weight-normal">{{ i.get().email_address }} </span>
{% endif %}
{% endfor %}
</p>
<!-- allows only creator to add user -->
{% if permission %}
<form method="post" action="/taskboards" class="form mb-4">
<div class="input-group mb-3">
<select class="custom-select" name="user_id" required>
<option selected="true" disabled="disabled" value="">Invite User</option>
{% for i in q %}
<option value="{{ i.key.urlsafe() }}">{{ i.email_address }}</option>
{% endfor %}
</select>
<div class="input-group-append">
<input type="submit" value="AddUser" name="button" class="btn btn-outline-secondary"/>
</div>
</div>
<input type="hidden" name="id" value="{{ taskboard.key.id() }}">
</form>
{% endif %}
<!-- form to create a task -->
<form method="post" action="/taskboards" class="form mb-4">
<div class="input-group mb-1">
<input type="text" name="title" class="form-control" placeholder="title" aria-label="title" aria-describedby="button-addon2" required>
<input type="date" name="due_date" class="form-control" placeholder="due date" aria-label="due date" aria-describedby="button-addon2" required>
<select class="custom-select" name="assigned_user" required>
<option selected="true" disabled="disabled" value="">Assign User</option>
{% for i in taskboard.users %}
<option value="{{ i.urlsafe() }}">{{ i.get().email_address }}</option>
{% endfor %}
</select>
<div class="input-group-append">
<input type="submit" value="AddTask" name="button" class="btn btn-outline-secondary"/>
</div>
</div>
<input type="hidden" name="id" value="{{ taskboard.key.id() }}">
<small class="form-text text-muted">Cannot add tasks with same name</small>
</form>
<!-- checks if tasks exist -->
{% if taskboard.tasks %}
<h5>Tasks</h5>
<!-- show stats on tasks -->
<h6>Number of Tasks: {{ n_tasks }}</h6>
<h6>Number of Completed Tasks: {{ n_ctasks }}</h6>
<h6>Number of Active Tasks: {{ n_atasks }}</h6>
<h6>Number of Tasks Completed Today: {{ n_ctaskst }}</h6>
{% for i in taskboard.tasks %}
<!-- checks if task is completed -->
{% if i.completion %}
<form method="post" action="/taskboards" class="form">
<div class="row">
<div class="col-sm-12">
<div class="input-group mb-3">
<input type="text" name="title" class="form-control" value="{{ i.title }}" aria-label="task_name" aria-describedby="button-addon2" disabled>
<input type="date" name="due_date" class="form-control" value="{{ i.due_date }}" aria-label="task_due_date" aria-describedby="button-addon2" disabled>
{% if i.assigned_user == None %}
<input type="text" class="form-control" value="" aria-label="task_assigned_user" aria-describedby="button-addon2" disabled>
{% else %}
<input type="text" class="form-control" value="{{ i.assigned_user.get().email_address }}" aria-label="task_assigned_user" aria-describedby="button-addon2" disabled>
<input type="text" name="assigned_user" class="form-control" value="{{ i.assigned_user.urlsafe() }}" aria-label="task_assigned_user" aria-describedby="button-addon2" hidden>
{% endif %}
<input type="text" name="" class="form-control" value="Completed" aria-label="task_due_date" aria-describedby="button-addon2" disabled>
<input type="text" name="" class="form-control" value="Date: {{ i.completion_date }}" aria-label="task_due_date" aria-describedby="button-addon2" disabled>
<div class="input-group-append">
<input type="submit" value="Delete" name="button" class="btn btn-outline-secondary"/>
</div>
</div>
</div>
</div>
<input type="hidden" value="{{ loop.index }}" name="index"/>
<input type="hidden" name="id" value="{{ taskboard.key.id() }}">
</form>
{% else %}
<form method="post" action="/taskboards" class="form">
<div class="row">
<div class="col-sm-12">
<div class="input-group mb-3">
{% if i.assigned_user == None %}
<input type="text" name="title" class="form-control text-danger" value="{{ i.title }}" aria-label="task_name" aria-describedby="button-addon2" required>
{% else %}
<input type="text" name="title" class="form-control" value="{{ i.title }}" aria-label="task_name" aria-describedby="button-addon2" required>
{% endif %}
<input type="date" name="due_date" class="form-control" value="{{ i.due_date }}" aria-label="task_due_date" aria-describedby="button-addon2" required>
<select class="custom-select" name="assigned_user" required>
{% if i.assigned_user == None %}
<option selected disabled>Not Assigned</option>
{% else %}
<option selected value="{{ i.assigned_user.urlsafe() }}">{{ i.assigned_user.get().email_address }}</option>
{% endif %}
{% for i in taskboard.users %}
<option value="{{ i.urlsafe() }}">{{ i.get().email_address }}</option>
{% endfor %}
</select>
<div class="input-group-append">
<input type="submit" value="Completed" name="button" class="btn btn-outline-secondary"/>
<input type="submit" value="Edit" name="button" class="btn btn-outline-secondary"/>
<input type="submit" value="Delete" name="button" class="btn btn-outline-secondary"/>
</div>
</div>
</div>
</div>
<input type="hidden" value="{{ loop.index }}" name="index"/>
<input type="hidden" name="id" value="{{ taskboard.key.id() }}">
</form>
{% endif %}
{% endfor %}
{% endif %}
<a href="/" class="btn btn-outline-dark btn-lg mt-2">Cancel</a>
</div>
</div>
{% endif %}
</main>
</div>
<!-- JavaScript -->
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script src="https://code.jquery.com/jquery-3.4.1.slim.min.js" integrity="sha384-J6qa4849blE2+poT4WnyKhv5vZF5SrPo0iEjwBvKU7imGFAV0wwj1yYfoRSJoZ+n" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js" integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6" crossorigin="anonymous"></script>
</body>
</html>