You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

169 lines
7.8 KiB

{% extends 'partials/base.html' %}
{% load staticfiles %}
{% load thumbnail %}
{% block content %}
{% include 'partials/header.html' %}
<div class="container mainScore">
<div class="row">
<div class="col-lg-12">
<p class="titleScore">Ваш счет</p>
</div>
<div class="col-lg-12">
<div class="scoreButtons disTab">
<div class="triangle1"></div>
<p>{{ user_score_balance }} <i class="fa fa-rub"></i></p>
{% if user_score.is_customer and user_score_balance > 0 %}
<div class="col-lg-12">
<a href="#" data-toggle="modal" data-target="#fullfill-balance" class="linkS linkS1">пополнить</a>
</div>
{% endif %}
{% if user_score.is_contractor %}
<div class="col-lg-12">
<a href="#" data-toggle="modal" data-target="#withdraw-money" class="linkS linkS2">вывести средства</a>
</div>
{% endif %}
<div id="withdraw-money" class="modal fade" role="dialog">
<div class="modal-dialog" role="document" style="width:900px;">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×
</button>
<h4 class="modal-title">Вывод денег</h4>
</div>
<form id="withdraw-form" action="{% url 'wallets:withdraw-create' %}" method="POST">{% csrf_token %}
<div class="modal-body">
<div style="height: 150px;">
<div class="textAreaBlock2 text-nn box-sizing disTab">
<p>Кол-во денег</p>
<input type="text" name="{{ form.sum.html_name }}">
</div>
<div class="textAreaBlock2 text-nn box-sizing disTab">
<p>Номер Яндекс кошелька</p>
<input type="text" name="{{ form.yandex_card.html_name }}">
<input type="hidden" name="{{ form.user.html_name }}" value="{{ user_score.pk }}">
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Закрыть</button>
<button type="submit" class="btn btn-primary">Вывести</button>
</div>
</form>
</div>
</div>
</div>
<div id="fullfill-balance" class="modal fade" role="dialog">
<div class="modal-dialog" role="document" style="width:900px;">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×
</button>
<h4 class="modal-title">Пополнить счет</h4>
</div>
<form id="withdraw-form" action="{{ YANDEX_MONEY.url }}" method="POST">{% csrf_token %}
<div class="modal-body">
<div style="height: 150px;">
<div class="textAreaBlock2 text-nn box-sizing disTab">
<p>Кол-во денег</p>
<input type="text" name="sum">
<input type='hidden' name='shopId' value='{{ YANDEX_MONEY.shop_id }}'>
<input type='hidden' name='scid' value='{{ YANDEX_MONEY.scid }}'>
<input type='hidden' name='customerNumber' value='{{ user_score.pk }}'>
<input type='hidden' name='paymentType' value='AC'>
<input type='hidden' name='transactionId' value='{{ transaction.pk }}'>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Закрыть</button>
<button type="submit" class="btn btn-primary">Пополнить</button>
</div>
</form>
</div>
</div>
</div>
<table>
<tr>
<th>Дата</th>
<th>Описание</th>
<th>Поступление/Списание</th>
<th>Баланс</th>
</tr>
{% for history in user_score.invoice_history.all %}
<tr>
<td>{{ history.created }}</td>
<td>
{{ history.comment }}
</td>
<td>
{{ history.sum }}
<i class="fa fa-rub"></i>
</td>
<td>
{{ history.balance }}
<i class="fa fa-rub"></i>
</td>
</tr>
{% empty %}
<tr>
<td colspan="4">
Платежей и/или списаний пока нет
</td>
</tr>
{% endfor %}
</table>
</div>
</div>
{% include 'partials/footer.html' %}
</div>
</div>
{% endblock %}
{% block js_block %}
<script type="text/javascript">
$(function () {
$('#withdraw-form').on('submit', function (e) {
e.preventDefault();
var dataSerializer = $(this).serialize()
$.ajax({
url: '/wallets/withdraw/create/',
method: 'POST',
data: dataSerializer,
dataType: 'json',
success: function (data) {
console.log(data);
if (data.status == 'ok') {
location.reload();
}
},
error: function (jqXHR, exception) {
console.log(jqXHR);
console.log(exception);
console.log(jqXHR.statusCode);
}
})
});
});
</script>
{% endblock %}