-
Notifications
You must be signed in to change notification settings - Fork 0
/
catalog.html
383 lines (351 loc) · 13.7 KB
/
catalog.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
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Cookies & Bytes Catalog</title>
<link href="styles.css" rel="stylesheet" type="text/css" />
<style>
form {
display: block;
margin: 0 auto;
width: 100%;
max-width: 600px;
box-sizing: border-box;
}
form h4 {
text-align: center;
font-size: 24px;
color: #7b5946;
}
#error {
color: #b14444;
padding: 0px 40px;
text-align: center;
line-height: 1.4em;
}
label {
width: 140px;
display: inline-block;
margin-left: 20px;
font-size: 18px;
text-align: left;
color: #7b5946;
}
input, select, textarea {
margin-bottom: 12px;
padding: 6px;
font-size: 16px;
box-sizing: border-box;
border-radius: 10px;
border: 1px solid #b6b6b6;
width: 300px;
color: #5b5b5b;
font-family: 'Averia Serif Libre', serif;
}
textarea {
width: 300px;
height: 140px;
}
input[type="submit"] {
display: block;
margin: 30px;
margin-left: 230px;
text-align: center;
padding: 20px 0px;
background-color: #A87363;
color: #efe6e0;
font-size: 22px;
font-weight: 600;
font-family: 'Averia Serif Libre', serif;;
border-radius: 10px;
}
input[type="submit"]:hover {
background-color: #caa296;
color: #7b5946;
}
.summary {
display: block;
position: relative;
box-sizing: border-box;
border-radius: 14px;
background-color: #efe6e0;
color: #7b5946;
width: 90%;
height: max-content;
margin: 0 auto;
padding: 30px;
align-items: center;
text-align: center;
}
#catalog-backdrop {
display: block;
position: fixed;
top: 0px;
width: 100%;
height: 800px;
background-image: url('images/backgroundCatalog.jpg');
background-size: cover;
}
@media screen and (max-width: 500px) {
input, select, textarea {
width: 240px;
}
h2 {
font-size: 30px;
width: 70%;
}
}
@media screen and (max-width: 700px) {
input[type='submit'] {
margin: 0 auto;
margin-left: 100;
}
}
</style>
<script>
/*
* name: display
* parameters: string cookie type, string full cookie name, int number of cookies ordered
* purpose: displays all the cookies in final total using HTML
*/
function display(cookieType, name, numCookies) {
idStr = cookieType + "_text";
document.getElementById(idStr).innerHTML = name + numCookies;
}
/*
* name: calcOrder
* parameters: none
* purpose: prepares order summary of each cookie
*/
function calcOrder(){
//storing ordered amounts of each cookie
numCCC = document.getElementsByName("CCC")[0].value;
numPBB = document.getElementsByName("PBB")[0].value;
numDCC = document.getElementsByName("DCC")[0].value;
numMWC = document.getElementsByName("MWC")[0].value;
numNB = document.getElementsByName("NB")[0].value;
//stores whether or not the ordered amounts are integers
boolCCC = Number.isInteger(parseInt(numCCC));
boolPBB = Number.isInteger(parseInt(numPBB));
boolDCC = Number.isInteger(parseInt(numDCC));
boolMWC = Number.isInteger(parseInt(numMWC));
boolNB = Number.isInteger(parseInt(numNB));
// conditionally displays amount of each cookie ordered
if(boolCCC || boolPBB || boolDCC || boolMWC || boolNB)
{
alert("Thank you for ordering, please check your summary below. We'll be in contact soon!");
document.getElementById("summary").style.display = "block";
document.getElementById("orderSum").innerHTML = "Order Summary";
if(boolCCC)
display("CCC", "Classic Chocolate Chip: ", numCCC);
if(boolPBB)
display("PBB", "Peanut Butter Blossoms: ", numPBB);
if(boolDCC)
display("DCC", "Double Chocolate Chip: ", numDCC);
if(boolMWC)
display("MWC", "Matcha White Chocolate: ", numMWC);
if(boolNB)
display("NB", "Nutella Bombs: ", numNB);
}
else{
alert("Please order valid amounts.");
}
}
/*
* name: validatePhone
* parameters: none
* purpose: provides phone number validation
*/
function validatePhone() {
const phone = document.getElementById("phone").value;
if (phone == "") {
return true;
} else {
return phone.match(/^\(?([0-9]{3})\)?[-. ]?([0-9]{3})[-. ]?([0-9]{4})$/);
}
}
/*
* name: validateEmail
* parameters: none
* purpose: validates all required fields and displays result
*/
function validateEmail() {
const email = document.getElementById("email").value;
console.log(email);
return email.match(/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i);
}
/*
* name: validate
* parameters: none
* purpose: provides email validation
*/
function validate() {
reqFields = {
fname: "First Name",
lname: "Last Name",
email: "Email",
message: "Message",
};
let err = "";
for (const id in reqFields) {
if (document.getElementById(id).value == "") {
err += reqFields[id] + " is required.<br />";
}
}
if (!validatePhone()) {
err += "Invalid phone number.<br />";
}
if (!validateEmail()) {
err += "Email format does not match <em>username@domain.tld</em><br />";
}
if (err != "") {
document.getElementById('error').innerHTML =
"Fix the following errors to continue:<br><br>" + err;
return false;
}
//if no errors, return the order summary
if (err == ""){
document.getElementById('error').innerHTML = "";
calcOrder();
return false;
}
return true;
}
</script>
</head>
<body>
<nav>
<a href="index.html" class="logo"></a>
<ul>
<li><a href="index.html">Home</a></li>
<li>
<div class="dropdown">
<a href="mission.html" class="dropdown-btn">About</a>
<div class="dropdown-links">
<a href="mission.html">Our Mission</a>
<a href="impact.html">Our Impact</a>
<a href="team.html">Our Team</a>
</div>
</div>
</li>
<li><a href="catalog.html">Cookies</a></li>
<li><a href="contact.html">Contact</a></li>
<li><a href="faq.html">FAQs</a></li>
</ul>
</nav>
<div id="catalog-backdrop"></div>
<div class="banner-text">
<h1>Cookie Catalog</h1>
</div>
<div class="preview">
<div class="preview-row">
<div class="preview-text">
<h2>Classic Chocolate Chip</h2>
<p>Our take on the classic chocolate chip cookie! We use two different kinds
of chocolate chunks, milk and dark, to create the perfect balance of
sweetness. A light sprinkliing of sea salt on top to finish it off.
<br><br>Price: $24<br><br>
Order Amount(dozen):
<input type="text" name="CCC" placeholder=0>
</p>
</div>
<div class="img-placeholder"><img src="images/chocChip.jpg" alt="chocolate chip cookie" style = "max-width:300px; max-height:300px; width:100%; height:auto;"></div>
</div>
<div class="preview-row">
<div class="img-placeholder"><img src="images/PBBlossom.jpg" alt="peanut butter blossom" style = "max-width:300px; max-height:300px; width:100%; height:auto;"></div>
<div class="preview-text">
<h2>Peanut Butter Blossoms</h2>
<p>These fun sized cookies are a perfect treat to brighten your day! A
delicious peanut butter cookie base with a sweet Hershey's Kiss in
the center to create the perfect combination.
<br><br>Price: $18<br><br>
Order Amount(dozen):
<input type="text" name="PBB" placeholder=0>
</p>
</div>
</div>
<div class="preview-row">
<div class="preview-text">
<h2>Double Chocolate Chip</h2>
<p>The perfect cookie for any chocolate lover! Made with dark and
milk chocolate to balance the sweetness and richness. Each bite
will be full of choclate chips and chunks, with a light sprinkling
of sea salt on top to enhance the flavor.
<br><br>Price: $24<br><br>
Order Amount(dozen):
<input type="text" name="DCC" placeholder=0>
</p>
</div>
<div class="img-placeholder"><img src="images/doubleChoc.jpg" alt="double chocolate chip" style = "max-width:300px; max-height:300px; width:100%; height:auto;"></div>
</div>
<div class="preview-row">
<div class="img-placeholder"><img src="images/matcha.jpg" alt="matcha white chocolate" style = "max-width:300px; max-height:300px; width:100%; height:auto;"></div>
<div class="preview-text">
<h2>Matcha and White Chocolate</h2>
<p>A unique and delicious flavor combination! A delicious
chewy cookie with a rich matcha flavor. Add in some white
chocolate chips for some sweetness and you have a perfect
combination. Pair it with some tea and enjoy!
<br><br>Price: $24<br><br>
Order Amount(dozen):
<input type="text" name="MWC" placeholder=0>
</p>
</div>
</div>
<div class="preview-row">
<div class="preview-text">
<h2>Nutella Bombs</h2>
<p>A fun surprise waiting inside! Our delicious and rich chocolate
cookie base, resulting in a beautiful crisp yet chewy bite.
Add in a Nutella filling to the center to make the perfect
bite every time.
<br><br>Price: $20<br><br>
Order Amount(dozen):
<input type="text" name="NB" placeholder=0>
</p>
</div>
<div class="img-placeholder"><img src="images/chocFilled.jpg" alt="chocolate filled" style = "max-width:300px; max-height:300px; width:100%; height:auto;"></div>
</div>
</div>
<div class="donate-text">
<p style="font-size: 30px">Reserve Today!</p>
<div>
<form onSubmit="return validate()" method="get">
<label>First Name* </label><input type='text' name='first' id="fname"/><br/>
<label>Last Name* </label><input type='text' name='last' id="lname"/><br/>
<label>Email* </label><input type='text' name='email' id="email"/><br/>
<label>Phone Number </label><input type='text' name='phone' id="phone" /><br/>
<label style="padding-right: 300px;">Message* </label><br/>
<label></label><textarea id="message"></textarea><br />
<input type="submit" value="Order Now"/>
<div id="error"> </div>
</form>
</div>
</div>
<div class="summary" id="summary" style = "display: none">
<h2 id="orderSum"></h2>
<p id="CCC_text"></p>
<p id="PBB_text"></p>
<p id="DCC_text"></p>
<p id="MWC_text"></p>
<p id="NB_text"></p>
</div>
<footer class="footer">
<div class="footer-content">
<div class="info">
<h3>Stop by for a quick byte!</h3>
<p>✧ 2121 Cherry Road, Brooklyn NY 11293</p>
<p>✧ Located near Owl's Head Park~</p>
<a href="https://www.facebook.com/" class="fab fa-facebook">@cookiesnbytes</a>
</div>
<div class="hours">
<h3>Our Hours Of Operation:</h3>
<p>✧ Monday - Friday: 8:00 AM - 6:00 PM</p>
<p>✧ Saturday - Sunday: 9:00 AM - 5:00 PM</p>
<p>✧ Holidays: Closed</p>
</div>
</div>
</footer>
</body>
</html>