forked from cryptoGlance/cryptoGlance-web-app
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwallet.php
More file actions
155 lines (143 loc) · 8.73 KB
/
wallet.php
File metadata and controls
155 lines (143 loc) · 8.73 KB
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
<?php
include('includes/inc.php');
if (!$_SESSION['login_string']) {
header('Location: login.php');
exit();
}
session_write_close();
$id = intval($_GET['id']);
require_once('includes/autoloader.inc.php');
// Start our wallet class
$walletObj = new Wallets($id);
// Saving logic
if (!empty($_POST)) {
echo $walletObj->update();
exit();
}
$jsArray = array(
'wallet/script',
);
require_once("includes/header.php");
// Wallet data
$wallet = array();
if ($id != 0) {
$wallet = $walletObj->getUpdate();
$wallet = $wallet[0];
}
?>
<div id="wallet-wrap" class="container sub-nav">
<?php if ($id != 0) { ?>
<div id="walletAddresses" class="panel panel-primary panel-no-grid panel-wallet" data-walletId="<?php echo $id ?>">
<h1>Wallet</h1>
<div class="panel-heading">
<button type="button" class="panel-header-button btn-updater" onClick="location.reload(true);"><i class="icon icon-refresh"></i> Update</button>
<h2 class="panel-title"><?php echo $wallet['label'] ?></h2>
</div>
<div class="panel-body">
<div class="total-wallet-balance">
<span class="green"><?php echo $wallet['currency_balance'] ?> <img src="images/coin/<?php echo $wallet['currency'] ?>.png" /> <?php echo $wallet['currency_code'] ?></span> <span>//</span> <span class="blue"><?php echo $wallet['fiat_balance'] ?> <img src="images/coin/fiat.png" /> <?php echo $wallet['fiat_code'] ?></span> <?php if (strtolower($wallet['currency_code']) !== 'btc') { ?><span>//</span> <span class="blue"><?php echo $wallet['coin_balance'] ?> <img src="images/coin/bitcoin.png" /> <?php echo $wallet['coin_code'] ?></span> <?php } ?>
</div>
<div class="table-responsive">
<form role="form">
<table class="table table-hover table-striped table-wallet">
<thead>
<tr>
<th>Address Name</th>
<th>Balance</th>
<th>Fiat ( <?php echo $wallet['fiat_code'] ?> )</th>
<?php if ($wallet['currency_code'] != $wallet['coin_code']) { ?><th>Coin ( <?php echo $wallet['coin_code'] ?> )</th><?php } ?>
<th>Address / Public Key</th>
<th></th>
</tr>
</thead>
<tbody>
<?php foreach($wallet['addresses'] as $addressKey => $addressData) { ?>
<tr data-id="<?php echo $addressData['id']; ?>">
<td data-type="label">
<span><?php echo $addressData['label']?></span>
<input type="hidden" name="address[<?php echo $addressData['id']; ?>][label]" class="form-control" value="<?php echo $addressData['label']; ?>" placeholder="Label" />
</td>
<td><?php echo $addressData['balance']; ?> <img src="images/coin/<?php echo $wallet['currency'] ?>.png" /> <?php echo $wallet['currency_code'] ?></td>
<td><?php echo $addressData['fiat_balance']; ?> <img src="images/coin/fiat.png" /> <?php echo $wallet['fiat_code']; ?></td>
<?php if ($wallet['currency_code'] != $wallet['coin_code']) { ?><td><?php echo $addressData['coin_balance']; ?> <img src="images/coin/bitcoin.png" /> <?php echo $wallet['coin_code']; ?></td><?php } ?>
<td data-type="address">
<span><?php echo $addressKey; ?></span>
<input type="hidden" name="address[<?php echo $addressData['id']; ?>][address]" class="form-control" value="<?php echo $addressKey; ?>" placeholder="Address" />
</td>
<td><a class="editAddress"><span class="green"><i class="icon icon-edit"></i></span></a> <a class="removeAddress"><span class="red"><i class="icon icon-remove"></i></span></a></td>
</tr>
<?php } ?>
<tr>
<td colspan="2" data-type="label"><input type="text" name="label" class="form-control" placeholder="Label"></td>
<td>0.00 <img src="images/coin/fiat.png" /> <?php echo $wallet['fiat_code']; ?></td>
<?php if ($wallet['currency_code'] != $wallet['coin_code']) { ?><td>0 <img src="images/coin/bitcoin.png" /> <?php echo $wallet['coin_code']; ?></td><?php } ?>
<td data-type="address"><input type="text" name="address" class="form-control" placeholder="Address"></td>
<td><a class="addAddress"><span class="blue"><i class="icon icon-save-floppy"></i></span></a></td>
</tr>
</tbody>
</table>
</form>
</div>
</div>
</div>
<?php } ?>
<div id="walletDetails" data-id="<?php echo $id ?>" class="panel panel-default panel-no-grid panel-narrow">
<h1>Wallet Details</h1>
<div class="panel-heading">
<h2 class="panel-title"><i class="icon icon-walletalt"></i></h2>
</div>
<div class="panel-body">
<form class="form-horizontal" role="form">
<div class="form-group">
<label for="inputWalletName" class="control-label col-sm-4">Wallet Name:</label>
<div class="col-sm-7">
<input type="text" class="form-control" id="walletName" placeholder="Donation Addresses" name="label" value="<?php echo $wallet['label'] ?>">
</div>
</div>
<div class="form-group">
<label for="inputWalletCurrency" class="control-label col-sm-4">Currency:</label>
<div class="col-sm-6">
<select class="form-control" name="currency" id="walletCurrency" <?php echo ($id != 0 ? 'disabled' : '') ?>>
<?php foreach ($walletObj->getCurrencies() as $currency => $code) { ?>
<option value="<?php echo $currency ?>" <?php echo ($wallet['currency'] == $currency ? 'selected' : '') ?>>(<?php echo $code ?>) <?php echo ucwords($currency) ?></option>
<?php } ?>
</select>
</div>
<div class="col-sm-2 col-has-icon">
<img id="currencyImage" src="images/coin/<?php echo ($wallet['currency']) ? $wallet['currency'] : 'bitcoin' ?>.png" />
</div>
</div>
<div class="form-group">
<label for="inputFiatCurrency" class="control-label col-sm-4">Fiat Conversion:</label>
<div class="col-sm-6">
<select class="form-control" id="walletFiat" name="fiat">
<?php foreach ($walletObj->getFiat() as $code => $fiat) { ?>
<option value="<?php echo $code ?>" <?php echo ($wallet['fiat_code'] == $code ? 'selected' : '') ?>>(<?php echo $code ?>) <?php echo $fiat; ?></option>
<?php } ?>
</select>
</div>
<div class="col-sm-1 col-has-icon">
<img src="images/coin/fiat.png" />
</div>
</div>
<div class="form-group">
<div class="col-sm-12">
<br>
<button type="button" class="btn btn-lg btn-success" id="btnSaveWallet"><i class="icon icon-save-floppy"></i> Save Wallet</button>
<?php if ($id != 0) { ?>
<button type="button" class="btn btn-lg btn-danger" id="btnDeleteWallet"><i class="icon icon-circledelete"></i> Remove Wallet</button>
<?php } ?>
</div>
</div>
</form>
<br />
</div>
</div>
</div>
<!-- /container -->
<?php require_once("includes/footer.php"); ?>
</div>
<!-- /page-container -->
<?php require_once("includes/scripts.php"); ?>
</body>
</html>