-
Notifications
You must be signed in to change notification settings - Fork 3
/
responses.php
84 lines (74 loc) · 2.7 KB
/
responses.php
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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Responses | this.Survey</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js"></script>
</head>
<body>
<nav class="navbar navbar-expand-md navbar-dark bg-dark fixed-top">
<div class="d-flex w-50 order-0">
<a class="navbar-brand mr-1" href="/">this.Survey</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#collapsingNavbar">
<span class="navbar-toggler-icon"></span>
</button>
</div>
<div class="navbar-collapse collapse justify-content-center order-2" id="collapsingNavbar">
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link" href="/">Create</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/fill.php">Fill</a>
</li>
<li class="nav-item">
<a class="nav-link active" href="/responses.php">Responses</a>
</li>
</ul>
</div>
<span class="navbar-text small text-truncate mt-1 w-50 text-right order-1 order-md-last">Hello! User</span>
</nav>
<br><br><br>
<div class="container">
<div class="card-columns">
</div>
</div>
<script src="js/app.js"></script>
<script src="https://unpkg.com/ipfs-api/dist/index.min.js" crossorigin="anonymous"></script>
<script>
$(document).ready(function() {
var allForms;
contractInstance.forms_of_users({gas: 1000000}, function(error, result){
if(!error){
allForms = result;
var count;
var finalContent = '';
allForms.forEach(function(listItem, index){
contractInstance.livecount(web3.fromAscii(listItem), {gas:10000000}, function(error, result){
if(!error){
count = result[0];
var content = `<div class="card">
<div class="card-body text-center">
<h4 class="card-title">Survey #${listItem.slice(-5,-1)}</h4>
<p class="card-text">${count} responses</p>
<a href="getForm.php?key=Qm${listItem}" class="btn btn-dark">See responses</a>
</div>
</div>`
finalContent = finalContent+content;
}else{
console.log(error);
}
})
})
$(".card-columns").innerHTML(finalContent);
}
})
}
</script>
</body>
</html>