-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathproducts.html
106 lines (101 loc) · 4.04 KB
/
products.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
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
</head>
<style>
h1 {
color: black;
font-family: arial;
font-size: 20pt;
}
body{
font-size: 15pt;
font-family: arial;
}
p {
border: 1px solid powderblue;
padding: 20px;
}
</style>
<body>
<h1>Welcome to Payment Demo</h1>
<br/>
<article>
<label>
<dev>These are the details of the foundation products</dev></br>
<img src= "https://s3-us-west-2.amazonaws.com/modern-service/static/1_Clinique_lipstick.jpg" width="300" height="200" border="0">
<p><font size="3" color="black">
Product name: lipstick<br>
Supplied by: Clinique<br>
Price: 12</font><br></p>
<img src= "https://s3-us-west-2.amazonaws.com/modern-service/static/2_ENERGIE_lotion.jpg" width="300" height="200" border="0">
<p><font size="3" color="black">
Product name: lotion<br>
Supplied by: ENERGIE<br>
Price: 7</font><br></p>
<img src= "https://s3-us-west-2.amazonaws.com/modern-service/static/3_EsteeLauder_foundation.jpg" width="300" height="200" border="0">
<p><font size="3" color="black">
Product name: foundation<br>
Supplied by: Estee Lauder<br>
Price: 9</font><br></p>
</label>
</article>
<p>Please Select Products You Want to Buy</p>
<form method="POST" action="">
<input type="checkbox" id="item1" name="productlist" value="12"/><font size="3" color="black">Clinique lipstick</font><br />
<input type="checkbox" id="item2" name="productlist" value="7"/><font size="3" color="black">ENERGIE lotion</font><br />
<input type="checkbox" id="item3" name="productlist" value="9"/><font size="3" color="black">Estee Lauder foundation</font><br />
<p><button name="pay" id="submitButton" type="submit" >submit</button> </p>
</form>
<!--<div>-->
<!--{% if error %}-->
<!--<p class="error"><strong>Error:</strong> {{ error }}-->
<!--{% endif %}-->
<!--</div>-->
<br/>
<script type="text/javascript">
var API_URL = ' https://fqa9vsks99.execute-api.us-east-1.amazonaws.com/production/createorder';
var count=0;
$(document).ready(function(){
$.ajax({
type: "GET",
url: API_URL,
success: function(data){
count=data+1;
}
});
});
$('#submitButton').on('click', function(){
//var email=localstorage.getItem('email');
console.log("clicked!");
var itemList=[];
//var id=Math.floor(Math.random() * (10000 - 0))
var totalPrice=0;
if ($("#item1").is(":checked")) {
itemList.push("1");
totalPrice+=12;
}
if ($("#item2").is(":checked")) {
itemList.push("2");
totalPrice+=7;
}
if ($("#item3").is(":checked")) {
itemList.push("3");
totalPrice+=9;
}
$.ajax({
type: "POST",
url: API_URL,
data: JSON.stringify({"id":count,"email":"[email protected]","itemList": itemList, "totalPrice":totalPrice}),
contentType: "application/json",
success: function(data){
console.log("create order successfully");
localStorage.setItem('totalPrice', totalPrice);
window.location.replace('payment.html');
}
});
return false;
});
</script>
</body>
</html>