-
Notifications
You must be signed in to change notification settings - Fork 17
/
monitor.html
139 lines (128 loc) · 5.96 KB
/
monitor.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
<html lang="en">
<head>
<title>Monitor Account</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<script type="text/javascript" src="web3.js"></script>
<script type="text/javascript" src="bignumber.js"></script>
<script type="text/javascript" src="cc.js"></script>
<script type="text/javascript" >
window.onload = function () {
document.getElementById('me').innerHTML = "alias: " + myAlias + "<br/> account: " + coinbase;
}
function monitor() {
var monitored = document.getElementById('toMonitor').value;
document.getElementById('account').innerHTML = "<b>Account: </b>" + monitored;
var mtrdWallet = communityCurrency.monitorWallet(monitored);
var mtrdCommunityCUnits = mtrdWallet[0];
var mtrdCredit = mtrdWallet[1];
var mtrdDeadline = mtrdWallet[2];
var mtrdMoneyLender = mtrdWallet[3];
var mtrdUnitsOfTrust = mtrdWallet[4];
var mtrdIsMember = mtrdWallet[5];
var mtrdReputation = mtrdWallet[6];
var mtrdAlias = mtrdWallet[7];
var mtrdAvailable = Number(mtrdCredit) + Number(mtrdCommunityCUnits);
if (mtrdIsMember = true) {
var mtrdCommoner ="Commoner of " + communityName + " Community";
} else {
var mtrdCommoner ="Not Commoner";
};
var dateMtrdDealine = new Date(mtrdDeadline * 1000);
document.getElementById('isMember').innerHTML = "<b>Commomer: </b>" + mtrdCommoner;
document.getElementById('alias').innerHTML = "<b>Alias: </b>" + mtrdAlias;
document.getElementById('communityCUnits').innerText = mtrdCommunityCUnits/baseUnits + " HR";
document.getElementById('reputation').innerText = mtrdReputation/baseUnits + " UoT";
document.getElementById('credit').innerText = mtrdCredit/baseUnits + " HR";
document.getElementById('available').innerText = mtrdAvailable/baseUnits + " HR";
document.getElementById('moneyLender').innerText = "Endorser: " + mtrdMoneyLender;
document.getElementById('unitsOfTrust').innerText = mtrdUnitsOfTrust/baseUnits + " UoT";
document.getElementById('deadline').innerText = "Deadline: " + dateMtrdDealine;
var credits = communityCurrency.Credit({'_MoneyLender' : monitored}, {fromBlock: 0, toBlock: 'latest'}, function(error, result) {
var row = "";
credits.watch(function(error, result){
row += Date(result.args.__cDealine) + " " + result.args._borrowerAddress + " <span class=\"badge\">" + result.args._endorsedUoT + " UoT</span><br/>";
document.getElementById('listCredit').innerHTML = row;
});
});
var creditsExp = communityCurrency.CreditExp({'_MoneyLender' : monitored}, {fromBlock: 0, toBlock: 'latest'}, function(error, result) {
var row = "";
creditsExp.watch(function(error, result){
row += Date(result.args._timeStampCX) + " " + result.args._exBorrowerAddress + " <span class=\"badge\">" + result.args._oldUoT + " UoT</span> success <span class=\"badge\">" + result.args._success + "<span><br/>";
document.getElementById('listCreditEx').innerHTML = row;
});
});
}
</script>
<style>
.navbar {
margin-bottom: 0;
border-radius: 0;
}
</style>
</head>
<body>
<div class="container bg-3 text-center">
<div class=container">
<script type="text/javascript" src="navbar.js"></script>
</div>
<div class="row">
<div class="col-sm-6">
<small><p id="me"></p></small>
<h3><span class="glyphicon glyphicon-eye-open"></span> Monitor Account</h3>
<div class="alert alert-warning">
<small>This page only available to Commoners</small>
</div>
<form role="form">
<div class="form-group">
<label class="control-label col-sm-4" for="toMonitor">Monitor Account:</label>
<input type="text" class="form-control" id="toMonitor" placeholder="Enter account to be monitored">
</div>
</form>
<button type="submit" class="btn btn-default" onClick="monitor();"><span class="glyphicon glyphicon-eye-open"></span> Monitor</button>
<h3><span class="glyphicon glyphicon-user"></span> Account</h3>
<p id="account"></p>
<p id="isMember"></p>
<p id="alias"></p>
<h3><span class="glyphicon glyphicon-piggy-bank"></span> Assets</h3>
<form class="form-horizontal" role="form">
<div class="form-group">
<label class="control-label col-sm-4" for="communityCUnits">Balance:</label>
<div class="col-sm-6"><output class="form-control" id="communityCUnits"></output></div>
</div>
<div class="form-group">
<label class="control-label col-sm-4" for="reputation">Reputation:</label>
<div class="col-sm-6"><output class="form-control" id="reputation"></output></div>
</div>
</form>
<h3><span class="glyphicon glyphicon-thumbs-up"></span> Liabilities</h3>
<form class="form-horizontal" role="form">
<div class="form-group">
<label class="control-label col-sm-4" for="credit">Credit Line:</label>
<div class="col-sm-6"><output class="form-control" id="credit"></output></div>
</div>
<div class="form-group">
<label class="control-label col-sm-4" for="available">Available:</label>
<div class="col-sm-6"><output class="form-control" id="available"></output></div>
</div>
<div class="form-group">
<label class="control-label col-sm-4" for="unitsOfTrust">Received Trust:</label>
<div class="col-sm-6"><output class="form-control" id="unitsOfTrust"></output></div>
</div>
</form>
<div id="deadline"></div>
<div id="moneyLender"></div>
<h3><span class="glyphicon glyphicon-thumbs-up"></span> Endorsed Credits</h3>
<h4><span class="glyphicon glyphicon-ok"></span> Endorsed Credits</h4>
<div id="listCredit"></div>
<h4><span class="glyphicon glyphicon-remove"></span> Expired Credits</h4>
<div id="listCreditEx"></div>
</div>
</div>
</div>
<br>
</body>
</html>