-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
358 lines (314 loc) · 21.3 KB
/
index.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
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Send | MusicMailer</title>
<link rel="icon" href="favicon.png" type="image/png">
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/tailwind.min.css" rel="stylesheet">
</head>
<body class="bg-gray-100 pt-10">
<div class="max-w-md mx-auto bg-white p-6 rounded-lg shadow-lg content-center">
<div class="flex justify-center items-center">
<img src="favicon.png" class="mb-4 w-20 align-items bg-yellow-500 px-4 py-4 rounded-lg">
</div>
<h1 class="text-2xl font-semibold mb-4 mt-2">MusicMailer</h1>
<form action="#">
<div class="mb-4">
<label for="studentName" class="block text-gray-600">Your Name</label>
<input placeholder="Start typing your name" id="studentName" name="studentName" required class="w-full p-2 border rounded">
</div>
<div class="mb-4">
<label for="teacherName" class="block text-gray-600">Teacher's Name</label>
<input type="text" placeholder="Mr Wells" id="teacherName" name="teacherName" required class="w-full p-2 border rounded">
</div>
<div class="mb-4" onclick="event.stopImmediatePropagation();">
<label for="autocompleteInput" class="block text-gray-600">Teacher's Email</label>
<input autocomplete="off" id="autocompleteInput" type="email" required class="w-full p-2 border rounded" onkeyup="onkeyUp(event)" placeholder="Start typing your teachers' name"/>
<div id="dropdown" class="w-60 h-20 border border rounded-md bg-white absolute overflow-y-auto hidden"></div>
</div>
<div class="mb-4">
<label for="selectedDay" class="block text-gray-600">Select a Day</label>
<select id="selectedDay" name="selectedDay" required class="w-full p-2 border rounded">
<option value="Monday">Monday</option>
<option value="Tuesday">Tuesday</option>
<option value="Wednesday">Wednesday</option>
<option value="Thursday">Thursday</option>
<option value="Friday">Friday</option>
<option value="Saturday">Saturday</option>
</select>
</div>
<div class="mb-4">
<label for="selectedTime" class="block text-gray-600">Select a Time</label>
<select id="selectedTime" name="selectedTime" required class="w-full p-2 border rounded">
<option value="first 20 minutes">First 20 minutes</option>
<option value="last 20 minutes">Last 20 minutes</option>
<option value="first 40 minutes">First 40 minutes</option>
<option value="last 40 minutes">Last 40 minutes</option>
</select>
</div>
<button class="bg-yellow-500 text-white px-4 py-2 rounded hover:bg-yellow-700" type="submit">
Generate Email
</button>
<p class="block text-gray-600 pt-3"><a href="report.html">Need Help?</a></p>
<p class="block text-gray-600 pt-3"><a href="about.html">Credits & About</a> | v0.2.0</p>
</form>
</div>
<script>
document.addEventListener("DOMContentLoaded", function () {
const form = document.querySelector("form");
form.addEventListener("submit", function (e) {
e.preventDefault();
const studentName = document.querySelector("#studentName").value;
const teacherName = document.querySelector("#teacherName").value;
const teacherEmail = document.querySelector("#autocompleteInput").value;
const selectedDay = document.querySelector("#selectedDay").value;
const selectedTime = document.querySelector("#selectedTime").value;
const mailtoLink = `mailto:${teacherEmail}?subject=Music%20Lesson%20-%20${selectedDay}&body=Dear%20${teacherName},%0D%0A%0D%0APlease%20could%20I%20miss%20the%20${selectedTime}%20of%20our%20lesson%20on%20${selectedDay}.%0D%0A%0D%0ABest%20Wishes,%0D%0A${studentName}`;
window.location.href = mailtoLink;
});
});
</script>
<script>
let teachers = [
{"name":"Cruickshank, Michelle", "email":"[email protected]"},
{"name":"Vennard, Owen", "email":"[email protected]"},
{"name":"Taylor, Viv","email":"[email protected]"},
{"name":"Mitten, Sam","email":"[email protected]"},
{"name":"Crouch, Stephen","email":"[email protected]"},
{"name":"Thompson, Lisa","email":"[email protected]"},
{"name":"Henderson, Cressida","email":"[email protected]"},
{"name":"Chatterton, Emma","email":"[email protected]"},
{"name":"Ford, Dinah","email":"[email protected]"},
{"name":"Self, Jacqui","email":"[email protected]"},
{"name":"Baker, Katherine","email":"[email protected]"},
{"name":"Boddon, Yvonne","email":"[email protected]"},
{"name":"MacDonald, Emma","email":"[email protected]"},
{"name":"Pearson, Valerie","email":"[email protected]"},
{"name":"Willis-Phillips, Catherine","email":"[email protected]"},
{"name":"Wells, George","email":"[email protected]"},
{"name":"Mead, Caroline","email":"[email protected]"},
{"name":"Romero, Ana","email":"[email protected]"},
{"name":"Dahl, James","email":"[email protected]"},
{"name":"Allcock, Simon","email":"[email protected]"},
{"name":"Reed, Angela","email":"[email protected]"},
{"name":"Wayman, Jo","email":"[email protected]"},
{"name":"Hodge, Nicole","email":"[email protected]"},
{"name":"Heathcote, William","email":"[email protected]"},
{"name":"Burt, Sally","email":"[email protected]"},
{"name":"Varcoe, Dee","email":"[email protected]"},
{"name":"Bailey, Anthony","email":"[email protected]"},
{"name":"Heeley, Jonathan","email":"[email protected]"},
{"name":"Henwood, Susie","email":"[email protected]"},
{"name":"Burrage, Nick","email":"[email protected]"},
{"name":"Farrell, Sean","email":"[email protected]"},
{"name":"Williamson, Simon","email":"[email protected]"},
{"name":"Parker, Sue","email":"[email protected]"},
{"name":"Birkin, Hilary","email":"[email protected]"},
{"name":"Gutteridge, Sam","email":"[email protected]"},
{"name":"Gowland, Lindsay","email":"[email protected]"},
{"name":"Woolhouse, Tarla","email":"[email protected]"},
{"name":"Jennings, Paul","email":"[email protected]"},
{"name":"Varey, Ilona","email":"[email protected]"},
{"name":"Yarnton, Sally","email":"[email protected]"},
{"name":"Henderson, Iain","email":"[email protected]"},
{"name":"Wilson, David","email":"[email protected]"},
{"name":"Lynch, Delyth","email":"[email protected]"},
{"name":"Knights, Sam","email":"[email protected]"},
{"name":"Farrington, Robert","email":"[email protected]"},
{"name":"Candappa, Sophia","email":"[email protected]"},
{"name":"Pratt, Kate","email":"[email protected]"},
{"name":"Pratt, Dan","email":"[email protected]"},
{"name":"O'Loughlin, Julian","email":"[email protected]"},
{"name":"Short, Zoe","email":"[email protected]"},
{"name":"Ewart, Christopher","email":"[email protected]"},
{"name":"Venables, Edward","email":"[email protected]"},
{"name":"Cromarty, Robert","email":"[email protected]"},
{"name":"Potter, Chris","email":"[email protected]"},
{"name":"Rawlinson, John","email":"[email protected]"},
{"name":"Peate, Louise","email":"[email protected]"},
{"name":"MacKenzie, Sarah","email":"[email protected]"},
{"name":"Christodoulou, Alexis","email":"[email protected]"},
{"name":"Gutteridge, Polly","email":"[email protected]"},
{"name":"Tayler, Rachael","email":"[email protected]"},
{"name":"Tapley, James","email":"[email protected]"},
{"name":"Hooker, Caroline","email":"[email protected]"},
{"name":"Symeonidis, Kerry","email":"[email protected]"},
{"name":"Knight, Kelly","email":"[email protected]"},
{"name":"Knight, Melissa","email":"[email protected]"},
{"name":"Miller, Sarah","email":"[email protected]"},
{"name":"Williams, Vicky","email":"[email protected]"},
{"name":"Whittington, Tracy","email":"[email protected]"},
{"name":"Ramkrishna, Niki","email":"[email protected]"},
{"name":"Charles, Susan","email":"[email protected]"},
{"name":"Dray, David","email":"[email protected]"},
{"name":"Price, Cindy","email":"[email protected]"},
{"name":"Horlock, Debra","email":"[email protected]"},
{"name":"Park, Rebecca","email":"[email protected]"},
{"name":"Halliday-Vargas, Jenny","email":"[email protected]"},
{"name":"Hart, Clive","email":"[email protected]"},
{"name":"Scholefield, Vicki","email":"[email protected]"},
{"name":"Cannon, Brian","email":"[email protected]"},
{"name":"Waller, Simon","email":"[email protected]"},
{"name":"Farrell, Ellie","email":"[email protected]"},
{"name":"Denne, Gill","email":"[email protected]"},
{"name":"Solano-Martinez, Carla","email":"[email protected]"},
{"name":"Hathaway, Debbie","email":"[email protected]"},
{"name":"Heslop, Al","email":"[email protected]"},
{"name":"Lindo, Murray","email":"[email protected]"},
{"name":"Wai, Edwin","email":"[email protected]"},
{"name":"Babalola, Ruth","email":"[email protected]"},
{"name":"O'Donnell, Inma","email":"[email protected]"},
{"name":"Clarke, Kevin","email":"[email protected]"},
{"name":"Barat, Katel","email":"[email protected]"},
{"name":"Kirkham, Rachelle","email":"[email protected]"},
{"name":"Atherton, Lucy","email":"[email protected]"},
{"name":"Tulley, Ryan","email":"[email protected]"},
{"name":"Pyke, Janette","email":"[email protected]"},
{"name":"Vincendeau, Goulwenn","email":"[email protected]"},
{"name":"Hulbert, Edward","email":"[email protected]"},
{"name":"Edmunds, Freddie","email":"[email protected]"},
{"name":"Thomas, Emily","email":"[email protected]"},
{"name":"Sagers, Flora","email":"[email protected]"},
{"name":"Lawes, Solomon","email":"[email protected]"},
{"name":"Bilclough, George","email":"[email protected]"},
{"name":"Jaoui, Yasmine","email":"[email protected]"},
{"name":"Edmunds, Astrid","email":"[email protected]"},
{"name":"Benjamin, Gareth","email":"[email protected]"},
{"name":"Dunne, Paul","email":"[email protected]"},
{"name":"Adams, Antony","email":"[email protected]"},
{"name":"Stark-Ordish, Adrian","email":"[email protected]"},
{"name":"O'Neill, Nathan","email":"[email protected]"},
{"name":"Cootes, Paul","email":"[email protected]"},
{"name":"Greenwood, Will","email":"[email protected]"},
{"name":"Christodoulou, Tamara","email":"[email protected]"},
{"name":"Kirby, Tom","email":"[email protected]"},
{"name":"Macleod, Tristan","email":"[email protected]"},
{"name":"Baldwin, Kathy","email":"[email protected]"},
{"name":"Howe, Alex","email":"[email protected]"},
{"name":"Campion, Amanda","email":"[email protected]"},
{"name":"Rothwell, Tim","email":"[email protected]"},
{"name":"Goves, Jessica","email":"[email protected]"},
{"name":"Taylor, Alice","email":"[email protected]"},
{"name":"Dalton, Sarah","email":"[email protected]"},
{"name":"Oliphant-Callum, Charles","email":"[email protected]"},
{"name":"Carrington, John","email":"[email protected]"},
{"name":"Ma, NingNing","email":"[email protected]"},
{"name":"Smith, Colin","email":"[email protected]"},
{"name":"Webber, Joshua","email":"[email protected]"},
{"name":"Oliver, Erynn","email":"[email protected]"},
{"name":"Kenworthy, Caroline","email":"[email protected]"},
{"name":"Davison, Chris","email":"[email protected]"},
{"name":"Coates, Anthony","email":"[email protected]"},
{"name":"Carpenter, Alice","email":"[email protected]"},
{"name":"Granville-Chapman, Katy","email":"[email protected]"},
{"name":"Poynter, Emma","email":"[email protected]"},
{"name":"Atherton, Richard","email":"[email protected]"},
{"name":"Hutchinson, Christelle","email":"[email protected]"},
{"name":"Gutulan, Estella","email":"[email protected]"},
{"name":"Wardlaw, Archie","email":"[email protected]"},
{"name":"Flanagan, Amy","email":"[email protected]"},
{"name":"Cole, Chelsey","email":"[email protected]"},
{"name":"Tang, Yunyun","email":"[email protected]"},
{"name":"Ramsey, Emma","email":"[email protected]"},
{"name":"Johncock, Matthew","email":"[email protected]"},
{"name":"Jobson, Sophie","email":"[email protected]"},
{"name":"Wallis, Sara","email":"[email protected]"},
{"name":"Wright, Harry","email":"[email protected]"},
{"name":"Johnston, Katie","email":"[email protected]"},
{"name":"Opie, Kam","email":"[email protected]"},
{"name":"Aktas, Sandra","email":"[email protected]"},
{"name":"Patterson, Abigail","email":"[email protected]"},
{"name":"Gomez, Aurora","email":"[email protected]"},
{"name":"Simkin, Stephen","email":"[email protected]"},
{"name":"Gray, Helen","email":"[email protected]"},
{"name":"Kirkham, Simon","email":"[email protected]"},
{"name":"Wilson, Sam","email":"[email protected]"},
{"name":"Morris, Ian","email":"[email protected]"},
{"name":"Craig, John","email":"[email protected]"},
{"name":"Laing, Sam","email":"[email protected]"},
{"name":"Whitelaw, Chloe","email":"[email protected]"},
{"name":"Head, Tim","email":"[email protected]"},
{"name":"Yuan, Mike","email":"[email protected]"},
{"name":"Bidston, Emmie","email":"[email protected]"},
{"name":"Duff, Sandrine","email":"[email protected]"},
{"name":"Sayed, Qasim Hasan","email":"[email protected]"},
{"name":"Joy, Philip","email":"[email protected]"},
{"name":"Ellwood, Mark","email":"[email protected]"},
{"name":"Whitworth, John","email":"[email protected]"},
{"name":"Bateson, Tanya","email":"[email protected]"},
{"name":"Hicks, Adam","email":"[email protected]"},
{"name":"Winders, Eleanor","email":"[email protected]"},
{"name":"Clarke, Dushy","email":"[email protected]"},
{"name":"Nickisson-Richards, Jonathan","email":"[email protected]"},
{"name":"Roundell, Simon","email":"[email protected]"},
{"name":"Grillo, Jane","email":"[email protected]"},
{"name":"Lexton, Ruth","email":"[email protected]"},
{"name":"Cooke, Clare","email":"[email protected]"},
{"name":"Dewes, Jim","email":"[email protected]"},
{"name":"Brown, Adele","email":"[email protected]"},
{"name":"Cawdron, Mike","email":"[email protected]"},
{"name":"McDonald, Kyle","email":"[email protected]"},
{"name":"Murray, Jack","email":"[email protected]"},
{"name":"Evans, Caroline","email":"[email protected]"},
{"name":"Lewsley, Ben","email":"[email protected]"},
{"name":"White, Jonathan","email":"[email protected]"},
{"name":"Owen, Sam","email":"[email protected]"},
{"name":"Patterson, Miranda","email":"[email protected]"},
{"name":"Sutton, Charlie","email":"[email protected]"},
{"name":"Wayman, Tom","email":"[email protected]"},
{"name":"Mann, Phil","email":"[email protected]"},
{"name":"Carr, Gareth","email":"[email protected]"},
{"name":"Loaring, Rachel","email":"[email protected]"},
{"name":"Anderson, Claire","email":"[email protected]"},
{"name":"Basra, Narinder","email":"[email protected]"},
{"name":"Barraclough, Stephen","email":"[email protected]"},
{"name":"Biggs, Justin","email":"[email protected]"},
{"name":"Lawrence, Jessica","email":"[email protected]"},
{"name":"Winter, Robert","email":"[email protected]"},
{"name":"Coles, Tracey","email":"[email protected]"},
{"name":"Piper, Ria","email":"[email protected]"},
{"name":"Cantwell, Brooke","email":"[email protected]"},
{"name":"Rea, David","email":"[email protected]"},
{"name":"O'Brien, Will","email":"[email protected]"}
];
function onkeyUp(e) {
let keyword = e.target.value;
let dropdownEl = document.querySelector("#dropdown");
dropdownEl.classList.remove("hidden");
let filteredTeachers = teachers.filter((c) =>
c.name.toLowerCase().includes(keyword.toLowerCase())
);
renderOptions(filteredTeachers);
}
document.addEventListener("DOMContentLoaded", () => {
renderOptions(teachers);
});
function renderOptions(options) {
let dropdownEl = document.querySelector("#dropdown");
let newHtml = ``;
options.forEach((teachers) => {
newHtml += `<div
onclick="selectOption('${teachers.email}')"
class="px-5 py-3 border-b border-gray-200 text-stone-600 cursor-pointer hover:bg-slate-100 transition-colors"
>
${teachers.name}
</div>`;
});
dropdownEl.innerHTML = newHtml;
}
function selectOption(selectedOption) {
hideDropdown();
let input = document.querySelector("#autocompleteInput");
input.value = selectedOption;
}
document.addEventListener("click", () => {
hideDropdown();
});
function hideDropdown() {
let dropdownEl = document.querySelector("#dropdown");
dropdownEl.classList.add("hidden");
}
</script>
</body>
</html>