<?php
$pname = 'Пополнение';
$pkey = 'баланс, пополнение';
$pdesc = 'Пополнение баланса аккаунта';
$prevurl_1 = 'cabinet';
$prevname_1 = 'Кабинет';
include('../inc/top.php');
if(!USER_LOGGED) { header ("Location: /"); exit; }
?>
<!-- Контент -->
<center><a data-toggle="modal" role="button" href="#in" class="btn btn-default">Пополнить баланс аккаунта</a></center>
<div id="in" class="modal fade" tabindex="-1" role="dialog">
<div class="modal-dialog modal-sm">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title"><i class="icon-plus-circle"></i> Пополнение баланса</h4>
</div>
<form id="inner" action="../actions/in.php" method="POST" class="form-horizontal" role="form">
<div class="modal-body">
<center><input id="sum" type="text" name="sum" required="required" placeholder="Сумма к пополнению" autocomplete="off" class="form-control" style="width:70%; margin: 20px 0px 20px 0px;" /></center>
</div>
<div class="modal-footer">
<a class="btn btn-success" href="javascript://" onclick="document.getElementById('inner').submit(); return false;">Пополнить</a>
<button class="btn btn-warning" data-dismiss="modal">Отмена</button>
</form>
</div>
</div>
</div>
</div>
<br /><br />
<div class="panel panel-default">
<div class="panel-heading"><h6 class="panel-title"><i class="icon-history"></i> История пополнений</h6></div>
<div class="table-responsive">
<table class="table table-hover">
<thead>
<tr>
<th width="20%">Дата</th>
<th width="80%">Сумма</th>
</tr>
</thead>
<tbody>
<?php
$st = "SELECT * FROM `t_in` WHERE usr = '$u_id' AND st = '1' ORDER BY id DESC";
$qt = mysqli_query($connect_db, $st);
$ht = mysqli_num_rows($qt);
if ($ht > 0) {
while($row = mysqli_fetch_array($qt)) {
?>
<tr class="rt-top">
<td width="20%"><?php echo date("d.m.y H:i",$row['dt']); ?></td>
<td width="80%"><?php echo $row["sum"]; ?> руб.</td>
</tr>
<?php } } else { echo '<tr><td colspan="2"><center>История пополнений пуста</center></td></tr>'; } ?>
</tbody>
</table>
</div>
</div>
<script type='text/javascript'>
$(document).ready(function () {
$('#sum').keyup(function() {
var $th = $(this);
$th.val( $th.val().replace(/[^0-9\.]/g, function(){ return ''; }) );
});
});
</script>
<!-- /Контент -->
<?php include('../inc/bottom.php'); ?>