-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
186 lines (181 loc) · 7.01 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
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
<html>
<head>
<title>UBot</title>
<link rel="stylesheet" href="./asset/css/bootstrap.min.css">
<link rel="stylesheet" href="./asset/css/font-awesome.css">
<link rel="stylesheet" href="./asset/css/tether.min.css">
<script src="./asset/js/jquery.min.js"></script>
<script src="./asset/js/tether.min.js"></script>
<script src="./asset/js/bootstrap.min.js"></script>
</head>
<body>
<nav class="navbar navbar-toggleable-md navbar-light bg-faded">
<button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<a class="navbar-brand" href="#" style="color:#fb5a1e; font-weight:bold"><img src="./asset/img/logo.jpg" width="30" height="30" alt=""> <i>u</i>Bot</a>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav mr-auto">
<li class="nav-item">
<a class="nav-link" href="#">Depositor's Queue</a>
</li>
</ul>
</div>
</nav>
<section class="content">
<button id="refereshQueue" class="float-right btn btn-primary">Refresh Queue</button>
<table id="depositQueueTable" class="table table-striped">
<thead>
<tr>
<th>Reference</th>
<th>Account Number</th>
<th>Account Name</th>
<th>Amount</th>
<th>Status</th>
<th>Action</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</section>
<div id="verifyModal" class="modal fade">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Verify Depositor</h5>
</div>
<div class="modal-body">
<form class="form-inline">
<div class="form-group">
<label class="mr-sm-2" for="inlineFormCustomSelect">Reference Number: </label>
<input class="mb-2 mr-sm-2 mb-sm-0" id="verificationReferenceNumber" placeholder="Enter reference number">
</div>
<button id="verifyReferenceNumber" type="button" class="btn btn-primary">Verify</button>
</form>
<div id="verificationFailed" class="text-center text-danger">Invalid Reference Number!</div>
<div id="verificationSuccess"class="text-center text-success">Transaction finished!</div>
</div>
<div class="modal-footer">
</div>
</div>
</div>
</div>
<div class="prototype" style="display:none">
<table>
<tr class="depositQueueTableRow">
<td class="referenceNumber"></td>
<td class="accountNumber"></td>
<td class="accountName"></td>
<td class="amount text-right"></td>
<td class="status"></td>
<td>
<button class="verifyAction btn btn-primary btn-sm">Done</button>
</td>
</tr>
</table>
</div>
</body>
<script>
$(document).ready(function(){
getQueue()
$('#depositQueueTable').on('click', '.verifyAction', function(){
$("#verificationFailed").hide()
$("#verificationSuccess").hide()
$("#verifyModal").modal('show')
})
$('#verifyReferenceNumber').click(function(){
/**
MODIFY FOR API
**/
// $.post('http://api.somethingtechie.co/bot/ubot/verify.php?ref=' + $("#verificationReferenceNumber").val(), {}, function(response){
var response = true
console.log('tae')
if(response * 1){
$("#verificationSuccess").show()
if($("#depositQueueTable").find('.depositQueueTableRow[ref_id="'+$("#verificationReferenceNumber").val()+'"]').length){
$("#depositQueueTable").find('.depositQueueTableRow[ref_id="'+$("#verificationReferenceNumber").val()+'"]').remove()
}
}else{
$("#verificationFailed").show()
}
// })
})
$('#refereshQueue').click(function(){
$('#depositQueueTable tbody').empty()
getQueue()
})
})
function getQueue(){
$('#depositQueueTable tbody').append('<tr><td colspan="6" class="text-center">Please wait...<td></tr>')
/**
MODIFY FOR API
**/
// $.get('http://api.somethingtechie.co/bot/ubot/deposits.php', {}, function(response){
/* response contains the result data */
$('#depositQueueTable tbody').empty()
var response = {
"dataObj": [{
"id":"1",
"account_name":"Edmund Cinco",
"account_number":"1234567890",
"amount":"10,000",
"ref_id":"111222",
"status":"in_process",
"created_at":"2017-07-15 16:34:47",
"updated_at":"0000-00-00 00:00:00"
}, {
"id":"2",
"account_name":"Mark Zuckerberg",
"account_number":"0987654321",
"amount":"15,720",
"ref_id":"333444",
"status":"done",
"created_at":"2017-07-15 16:36:34",
"updated_at":"2017-07-15 17:24:21"
}, {
"id":"3",
"account_name":"Test",
"account_number":"11",
"amount":"1000",
"ref_id":"555666",
"status":"in_process",
"created_at":"2017-07-15 16:49:31",
"updated_at":"0000-00-00 00:00:00"
},{
"id":"5",
"account_name":"test",
"account_number":"11",
"amount":"1000",
"ref_id":"871562",
"status":"in_process",
"created_at":"2017-07-15 17:36:49",
"updated_at":"0000-00-00 00:00:00"
},{
"id":"4",
"account_name":"Test",
"account_number":"11",
"amount":"20000",
"ref_id":"5969DAFE7217",
"status":"in_process",
"created_at":"2017-07-15 17:06:06",
"updated_at":"0000-00-00 00:00:00"
}]
}
for(var x = 0; x < response.dataObj.length; x++){
var rowClone = $('.prototype .depositQueueTableRow').clone()
rowClone.attr('ref_id', response.dataObj[x]['ref_id'])
rowClone.find('.referenceNumber').text(response.dataObj[x]['ref_id'])
rowClone.find('.accountNumber').text(response.dataObj[x]['account_number'])
rowClone.find('.accountName').text(response.dataObj[x]['account_name'])
rowClone.find('.amount').text(numberWithCommas(((response.dataObj[x]['amount']).replace(/\s*,\s*|\s+,/g, '')*1).toFixed(2)))
rowClone.find('.status').text(response.dataObj[x]['status'] === 'done' ? 'Done' : 'In Process')
$('#depositQueueTable tbody').append(rowClone)
}
// });
}
function numberWithCommas(x) {
return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
}
</script>
</html>