-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
108 lines (82 loc) · 2.85 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
<!doctype>
<html>
<head>
<script type="text/javascript">
function getRating() {
var param = document.getElementById("query").value;
var res = contracts["Rating"].contract.ratings(param);
document.getElementById("queryres2").innerText = res;
}
function setRating() {
var key = document.getElementById("key").value;
var value = parseInt(document.getElementById("value").value);
/// NBG Module
//
// $.ajax({
// url: "https://nbgdemo.azure-api.net/nodeopenapi/api/customers/rest?" + $.param(params),
// beforeSend: function(xhrObj){
// // Request headers
// xhrObj.setRequestHeader("Content-Type","application/json");
// xhrObj.setRequestHeader("Ocp-Apim-Subscription-Key","b61a31d0e1d041f2a487b188a778bf32");
// },
// type: "POST",
// // Request body
// data: "{
// "nbgtrackid": "571a162f95806d5414110f20",
// "payload": {
// "customer_number": "571a162f95806d5414110f20"
// }
//}",
// })
// .done(function(data) {
// alert("success");
//alert(data);
// })
// .fail(function() {
// alert("error");
// });
// });
/// NBG Module
///Block NBG Emulation - where emulates the nbg module above and
//key is the inputfrom the credit card scanner at POS and Name_From_Bank is the return name of credit card
//owner that NBG Module returns
var Name_From_Bank
if( key == "571c9801db45021c1aebeec0" )
{ Name_From_Bank = "Petropoulos" }
if( key == "571c9801db45021c1aebeec2" )
{ Name_From_Bank = "Leonidas Fragkiadakis" }
//End
////
var old_value = contracts["Rating"].contract.ratings(Name_From_Bank);
value = parseInt(old_value) + parseInt(value);
document.getElementById("queryname").innerText = Name_From_Bank;
document.getElementById("queryres").innerText = value;
var res = contracts["Rating"].contract.setRating(Name_From_Bank, value);
}
</script>
</head>
<body bgcolor="#E6E6FA">
<h1>Loyalty Program Points</h1>
<div>
Customer Card:
<input type="text" id="key">
<br/>
Customer Points:
<input type="number" id="value">
<br/>
<button onclick="setRating()">Add Points</button>
</div>
<div>
<br/>
<b>Mr <div id="queryname"></div>
has now<div id="queryres"></div> Points </b>
<br/><br/><br/>
Search customer points:
<br/>
Enter Customer name:
<input type="string" id="query" onkeyup='getRating()'>
<div id="queryres2"></div>
<br/>
</div>
</body>
</html>