View file siwap.ru/apps/wk/index.php

File size: 2.61Kb
<?php
require_once $_SERVER['DOCUMENT_ROOT'].'/system/App.php';
$title = 'Пополнить счёт';
require_once ROOT.'/system/header.php';
require_once 'config.php';

$user->access();
?>
<div class="col-sm"></div>

<div class="col-sm-10 col-md-6 col-lg-4 col-xl-4">
    <nav aria-label="breadcrumb">
    	<ol class="breadcrumb">
    		<div class="b-item">
    			<li class="breadcrumb-item">
    				<a href="/"><i class="material-icons md-18" style="top: 4px!important;">home</i> Главная</a>
    			</li>
    			<li class="breadcrumb-item active" aria-current="page"><i class="material-icons md-18" style="top: 4px!important;">payment</i> Пополнить баланс</li>
    		</div>
    	</ol>
    </nav>
    
	<script type="text/javascript">
	$(document).ready(function () {
		
		$('#okButton').on('click', function(e) {
			e.preventDefault();
			var formData = $('#formPayment').serialize();
			var alerts = $('#alerts');
			
			$.ajax({
			url: '/AJAX/worldkassa/payment.php',
			type: 'POST',
			data: formData,
			dataType: 'json',
			success: function(json) {

				if(json['error'] == 1) {
					$(alerts).html('<div class="alert alert-danger">'+json['comment']+'</div>');
				} else if(json['success'] == 1) {
					$(alerts).html('<div class="alert alert-success">'+json['comment']+'</div>');
				}
				setTimeout(function () {
					$(alerts).html('');
					if(json['success'] == 1) location.href = json['url'];
				}, 2000);
			},
			error: function(xhr, ajaxOptions, thrownError) {
				alert(thrownError + "\r\n" + xhr.statusText + "\r\n " + xhr.responseText);
			}
			});
		});
	});
	</script>

    <div id="alerts"></div>
    <div class="card list-group list-group-flush">
        <div class="list-group-item">
            <h5>Ваш баланс <?=$me['money']?> ₽</h5>
        </div>
        <div class="list-group-item">
            <form id="formPayment" role="form">
				<div class="form-group">
				    <label for="inputAmount">Сумма пополнения</label>
                    <div class="input-group mb-3">
                      <div class="input-group-prepend">
                        <span class="input-group-text">₽</span>
                      </div>
                      <input type="text" name="amount" id="inputAmount" class="form-control" placeholder="100">
                    </div>
				</div>
            </form> 
        </div>
        <div class="list-group-item text-right">
            <button type="button" class="btn btn-success" id="okButton">Перейти к оплате</button>
        </div>    
    </div>
</div>

<div class="col-sm"></div>
<?php
require_once ROOT.'/system/footer.php';
?>