-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathorder.html
501 lines (454 loc) · 21.7 KB
/
order.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
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Recircle Cup</title>
<link rel="apple-touch-icon" sizes="57x57" href="/static/apple-icon-57x57.png">
<link rel="apple-touch-icon" sizes="60x60" href="/static/apple-icon-60x60.png">
<link rel="apple-touch-icon" sizes="72x72" href="/static/apple-icon-72x72.png">
<link rel="apple-touch-icon" sizes="76x76" href="/static/apple-icon-76x76.png">
<link rel="apple-touch-icon" sizes="114x114" href="/static/apple-icon-114x114.png">
<link rel="apple-touch-icon" sizes="120x120" href="/static/apple-icon-120x120.png">
<link rel="apple-touch-icon" sizes="144x144" href="/static/apple-icon-144x144.png">
<link rel="apple-touch-icon" sizes="152x152" href="/static/apple-icon-152x152.png">
<link rel="apple-touch-icon" sizes="180x180" href="/static/apple-icon-180x180.png">
<link rel="icon" type="image/png" sizes="192x192" href="/static/android-icon-192x192.png">
<link rel="icon" type="image/png" sizes="32x32" href="/static/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="96x96" href="/static/favicon-96x96.png">
<link rel="icon" type="image/png" sizes="16x16" href="/static/favicon-16x16.png">
<link rel="manifest" href="/static/manifest.json">
<meta name="msapplication-TileColor" content="#ffffff">
<meta name="msapplication-TileImage" content="ms-icon-144x144.png">
<meta name="theme-color" content="#ffffff">
<link rel="stylesheet" href="/static/custom.css" media="all">
<link rel="stylesheet" href="/static/layout.css" media="all and (min-width: 33.236em)">
<!-- 30em + (1.618em * 2) = 33.236em / Eliminates potential of horizontal scrolling in most cases -->
<!--[if (lt IE 9) & (!IEMobile)]>
<link rel="stylesheet" href="/static/layout.css" media="all">
<![endif]-->
<link href="https://fonts.googleapis.com/css?family=Karla:400,700|Merriweather+Sans|Raleway" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Karla:400,700|Merriweather+Sans|Raleway" rel="stylesheet">
<script src="https://cdn.ravenjs.com/3.26.1/raven.min.js" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/js-cookie@2/src/js.cookie.min.js"></script>
<script src="/static/url-polyfill.js"></script>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-150865052-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag() {
dataLayer.push(arguments);
}
gtag('js', new Date());
gtag('config', 'UA-150865052-1');
</script>
<script type="text/javascript" src="https://cdn.emailjs.com/dist/email.min.js"></script>
<script type="text/javascript">
(function(){
emailjs.init("user_STIZUXa2EcJZW0JbNzJkK");
})();
</script>
<script src="https://code.jquery.com/jquery-3.3.1.min.js"
integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8="
crossorigin="anonymous"></script>
</head>
<body id="container">
<header>
<nav>
<div class="logo">
<a href="/"><img src="/static/logoalt.png"/></a>
</div>
<div class="nav">
<a href="/start">Get started</a>
<a href="/#blog">Blog</a>
<a href="/cup-wash">Menstrual Cup Wash</a>
<div class="user-cart display-inline-block" onclick="window.location = ('/checkout')">
<img class="user-cart-image" src="static/cart.png"/>
<span class="user-cart-quantity"></span>
</div>
</div>
</nav>
</header>
<div id="body">
<section>
<article>
<form class="order-form margin-bottom-10">
<div class="col1 compact">
<div class="margin-bottom-40">
<div class="font-1p25em font-bold margin-bottom-20">
Your Cup
</div>
<div class="margin-bottom-15">
<div class="label">Small</div>
<input type="number" name="quantity-small" title="Quantity" value="1" class="cup-quantity"
oninput="updateTotal(this)" min="0">
</div>
<div class="margin-bottom-15">
<div class="label">Large</div>
<input type="number" name="quantity-large" title="Quantity" value="0" class="cup-quantity"
oninput="updateTotal(this)" min="0">
</div>
<div class="margin-bottom-10">
<a href="/which-size" target="_blank">Which size is best for me?</a>
</div>
<div class="margin-bottom-15" onchange="updateTotal(this)">
<div class="label">Color</div>
<select name="cup-color">
<option id="cup-color-white">White</option>
<option selected>Red</option>
<option id="cup-color-purple">Purple</option>
</select>
</div>
<div class="margin-bottom-20">
<div class="stock-help form-info font-bold">
</div>
</div>
<div class="margin-bottom-20">
<div class="quantity-help form-info font-bold display-none">
Small White/Purple Cups are out of stock
</div>
</div>
<div class="margin-bottom-15">
<input type="checkbox" class="cup-offer checkbox-position" name="cup-offer" title="Get an extra cup" onchange="addOffer(this)">
<span class="cup-offer margin-left-2 font-bold">Sister Cup Offer</span>
<div class="light-grey">
Get two cups for PKR 1800 (PKR 200 off the second cup)
</div>
</div>
<div class="margin-bottom-15">
<input type="checkbox" class="add-wash checkbox-position" name="add-wash" title="Add Menstrual Cup Wash" onchange="addWash(this)" disabled>
<span class="margin-left-2 font-bold">Add Menstrual Cup Wash</span>
<div class="light-grey">
Out of stock
</div>
<div class="display-none cup-wash-container margin-top-10">
<div class="label">Menstrual Cup Wash</div>
<input type="number" name="quantity-cup-wash" title="Quantity" value="1" class="wash-quantity"
oninput="updateTotal(this)" min="0">
</div>
</div>
<div class="cup-image">
<img src="/static/cup_colors.png"/>
</div>
</div>
</div>
<div class="col2 compact">
<div class="margin-bottom-40">
<div class="font-1p25em font-bold margin-bottom-20">
Order Summary
</div>
<div class="label">Items</div>
<div class="order-item">
Recircle Cup Small
<span class="order-item-color"></span>
<span class="order-item-quantity-container">
x <span class="order-item-quantity-small">1</span>
</span>
<div class="order-item-price">PKR 2000</div>
</div>
<div class="order-item">
Recircle Cup Large
<span class="order-item-color"></span>
<span class="order-item-quantity-container">
x <span class="order-item-quantity-large">0</span>
</span>
<div class="order-item-price">PKR 0</div>
</div>
<div class="order-item cup-wash display-none">
Recircle Menstrual Cup Wash
<span class="order-item-quantity-container">
x <span class="order-item-quantity-cup-wash">0</span>
</span>
<div class="order-item-price">PKR 0</div>
</div>
<div class="order-item donated-cup display-none">
Recircle Cup (Donated)
<span class="order-item-quantity-container">
x <span class="order-item-quantity-donated-cup">1</span>
</span>
<div class="order-item-price">PKR 700</div>
</div>
</div>
<div class="margin-bottom-20">
<div class="total-price font-bold font-1p25em margin-bottom-5">
Total:
<span class="font-bold">
PKR <span class="price">2000</span><span class="price-discount margin-left-5"></span>
</span>
</div>
<div class="label">Excludes delivery charge</div>
</div>
<button type="button" class="add-to-cart-button light-action-button" onclick="updateCart()">Add to Cart</button>
<button type="button" class="order-now-button" onclick="orderNow()">Order Now</button>
<div class="added-to-cart-message display-none"><img class="checkmark-icon" src="static/checkmark.png"/>
Added to Cart
<a href="/checkout" class="margin-left-5">Checkout</a>
</div>
</div>
</form>
<div class="clear"></div>
</article>
</section>
</div>
<script>
Raven.config('https://[email protected]/1222661').install();
function getCookie(name) {
var value = "; " + document.cookie;
var parts = value.split("; " + name + "=");
if (parts.length == 2) return parts.pop().split(";").shift();
}
var smallCups = (getCookie('Small')) ? getCookie('Small') : 1;
var largeCups = (getCookie('Large')) ? getCookie('Large') : 0;
var outOfStock = true;
var totalPrice;
document.querySelector("input[name='quantity-small']").value = smallCups;
document.querySelector("input[name='quantity-large']").value = largeCups;
var url_string = window.location.href;
var url = new URL(url_string);
var discount = url.searchParams.get("discount");
if (discount == 'true') {
discount = true;
}
else {
discount = false;
}
discount = true;
updateTotal();
function showHelp(element) {
if (element.id == 'transfer') {
document.querySelector('.payment-help').innerHTML =
'Pay to Recircle Enterprise - 1121-2498-5706-3 - UBL Tufail Road and ' +
'<a target="_blank" href="mailto:[email protected]">email</a> or ' +
'<a target="_blank" href="https://www.facebook.com/recirclepakistan">message</a>' +
' us a picture of your receipt/transaction.'
}
else {
document.querySelector('.payment-help').textContent =
'Pay with cash when your order arrives.'
}
}
function updateTotal(element) {
var large = parseInt(document.querySelector("input[name='quantity-large']").value) || 0;
var small = parseInt(document.querySelector("input[name='quantity-small']").value) || 0;
var cupWash = parseInt(document.querySelector("input[name='quantity-cup-wash']").value) || 0;
var color = document.querySelector("select[name='cup-color']").value;
// Show cup unavailability
if (outOfStock) {
if (small > 0) {
document.querySelector(".quantity-help").classList.remove('display-none');
document.querySelector("#cup-color-white").disabled = true;
document.querySelector("#cup-color-purple").disabled = true;
// If white selected, change to red
if (color === 'White' || color === 'Purple') {
document.querySelector("select[name='cup-color']").value = 'Red';
color = 'Red';
}
}
else {
document.querySelector(".quantity-help").classList.add('display-none');
document.querySelector("#cup-color-white").disabled = false;
document.querySelector("#cup-color-purple").disabled = false;
}
}
if (small) {
document.querySelector(".order-item-quantity-small").parentNode.parentNode.classList.remove('display-none');
document.querySelector(".order-item-quantity-small").textContent = small;
document.querySelector(".order-item-quantity-small").parentNode.nextElementSibling.textContent = 'PKR ' + (small * 2000 - (400 * Math.floor(small / 2))).toString();
}
else {
document.querySelector(".order-item-quantity-small").parentNode.parentNode.classList.add('display-none');
}
if (large) {
document.querySelector(".order-item-quantity-large").parentNode.parentNode.classList.remove('display-none');
document.querySelector(".order-item-quantity-large").textContent = large;
document.querySelector(".order-item-quantity-large").parentNode.nextElementSibling.textContent = 'PKR ' + (large * 2000 - (400 * Math.floor(large / 2))).toString();
}
else {
document.querySelector(".order-item-quantity-large").parentNode.parentNode.classList.add('display-none');
}
if (document.querySelector(".add-wash").checked) {
document.querySelector(".order-item-quantity-cup-wash").parentNode.parentNode.classList.remove('display-none');
document.querySelector(".order-item-quantity-cup-wash").textContent = cupWash;
document.querySelector(".order-item-quantity-cup-wash").parentNode.nextElementSibling.textContent = 'PKR ' + (cupWash * 900).toString();
}
// Add color
document.querySelectorAll(".order-item-color").forEach(function(el) {
el.textContent = ' - ' + color
});
var total = small + large;
if (total >= 2) {
var sisterCupOffers = Math.floor(total / 2);
var singleCups = total % 2;
totalPrice = sisterCupOffers * 3600 + singleCups * 2000;
if (discount && total) {
totalPrice *= 0.50;
totalPrice = Math.round(totalPrice/100)*100;
document.querySelector(".price-discount").textContent = "(50% Off)";
}
else {
document.querySelector(".price-discount").textContent = "(Save PKR 200 on every 2 Cups)";
}
document.querySelector(".cup-offer").checked = true;
}
else {
totalPrice = total * 2000;
var singleCupDiscount = true;
if (singleCupDiscount && total) {
totalPrice *= 0.50;
totalPrice = Math.round(totalPrice/100)*100;
document.querySelector(".price-discount").textContent = "(50% Off)";
}
else {
document.querySelector(".price-discount").textContent = "";
}
document.querySelector(".cup-offer").checked = false;
}
if (document.querySelector(".add-wash").checked) {
totalPrice += cupWash * 900;
}
document.querySelector(".price").textContent = totalPrice.toString();
}
function addWash(element) {
if (element.checked) {
document.querySelector(".cup-wash").classList.remove('display-none');
document.querySelector(".cup-wash-container").classList.remove('display-none');
}
else {
document.querySelector(".cup-wash").classList.add('display-none');
document.querySelector(".cup-wash-container").classList.add('display-none');
}
updateTotal(null);
}
function donateCup(element) {
if (element.checked) {
document.querySelector(".donated-cup").classList.remove('display-none');
}
else {
document.querySelector(".donated-cup").classList.add('display-none');
}
updateTotal(null);
}
function addOffer(element) {
if (element.checked) {
document.querySelector("input[name='quantity-small']").value = 2;
document.querySelector("input[name='quantity-large']").value = 0;
}
else {
document.querySelector("input[name='quantity-small']").value = 1;
document.querySelector("input[name='quantity-large']").value = 0;
}
updateTotal();
}
// Get/initialize user cart
var userCart = [];
if (Cookies.getJSON('userCart')) {
userCart = Cookies.getJSON('userCart');
}
displayCart();
function updateCart() {
// Update cart cookies
var small = parseInt(document.querySelector("input[name='quantity-small']").value);
var large = parseInt(document.querySelector("input[name='quantity-large']").value);
var cupWash = 0;
if (document.querySelector('input[name="add-wash"]').checked) {
cupWash = parseInt(document.querySelector("input[name='quantity-cup-wash']").value) || 0
}
var color = document.querySelector("select[name='cup-color']").value;
if (small) {
var orderItem = {};
orderItem.name = 'Small';
orderItem.displayName = 'Cup (Small)';
orderItem.quantity = small;
orderItem.color = color;
userCart.push(orderItem);
}
if (large) {
var orderItem = {};
orderItem.name = 'Large';
orderItem.displayName = 'Cup (Large)';
orderItem.quantity = large;
orderItem.color = color;
userCart.push(orderItem);
}
if (cupWash) {
var orderItem = {};
orderItem.name = 'Wash';
orderItem.displayName = 'Menstrual Cup Wash';
orderItem.quantity = cupWash;
userCart.push(orderItem);
}
Cookies.set('userCart', userCart);
if (small + large + cupWash <= 0) {
alert('You haven\'t selected any items. Please select a quantity of items to add to your cart.');
return false;
}
document.querySelector(".added-to-cart-message").classList.remove('display-none');
document.querySelector(".added-to-cart-message").classList.add('fade');
setTimeout(function(){
document.querySelector(".added-to-cart-message").classList.remove('fade');
}, 1000);
displayCart();
}
function orderNow() {
var tempCart = [];
// Update cart cookies
var small = parseInt(document.querySelector("input[name='quantity-small']").value);
var large = parseInt(document.querySelector("input[name='quantity-large']").value);
var cupWash = 0;
if (document.querySelector('input[name="add-wash"]').checked) {
cupWash = parseInt(document.querySelector("input[name='quantity-cup-wash']").value) || 0
}
var color = document.querySelector("select[name='cup-color']").value;
if (small) {
var orderItem = {};
orderItem.name = 'Small';
orderItem.displayName = 'Cup (Small)';
orderItem.quantity = small;
orderItem.color = color;
tempCart.push(orderItem);
}
if (large) {
var orderItem = {};
orderItem.name = 'Large';
orderItem.displayName = 'Cup (Large)';
orderItem.quantity = large;
orderItem.color = color;
tempCart.push(orderItem);
}
if (cupWash) {
var orderItem = {};
orderItem.name = 'Wash';
orderItem.displayName = 'Menstrual Cup Wash';
orderItem.quantity = cupWash;
tempCart.push(orderItem);
}
Cookies.set('tempCart', tempCart);
if (tempCart.length <= 0) {
alert('You haven\'t selected any items to order. Please select a quantity of items to order now.');
return false;
}
window.location = ('/checkout?orderNow=true');
}
function displayCart() {
// Show/hide cart
var cartQuantity = userCart.reduce(function (a, b) {
return a + b.quantity;
}, 0);
if (cartQuantity) {
document.querySelector(".user-cart-quantity").textContent = cartQuantity;
document.querySelector(".user-cart").classList.remove('display-none');
document.querySelector(".user-cart").classList.add('display-inline-block');
}
else {
document.querySelector(".user-cart").classList.add('display-none');
document.querySelector(".user-cart").classList.remove('display-inline-block');
}
}
</script>
</body>
<div id="footer">
<a href="mailto:[email protected]">[email protected]</a>
<p class="center">
Copyright Recircle Cup 2017 - 2021
</p>
</div>
</html>