forked from DGNum/gestioCOF
Correction nouveau neg
- Echec d'indentation corrigé - Plus de CSS pour les pages normales
This commit is contained in:
parent
056fb610de
commit
813b7230b6
6 changed files with 109 additions and 40 deletions
|
@ -133,7 +133,7 @@ class Account(models.Model):
|
||||||
else:
|
else:
|
||||||
overdraft_until = timezone.now() + overdraft_duration_max
|
overdraft_until = timezone.now() + overdraft_duration_max
|
||||||
# Checking it doesn't break 1 rule
|
# Checking it doesn't break 1 rule
|
||||||
if new_balance < overdraft_amount_max or timezone.now() > overdraft_until:
|
if new_balance < overdraft_amount or timezone.now() > overdraft_until:
|
||||||
stop_ope = True
|
stop_ope = True
|
||||||
perms.add('kfet.perform_negative_operations')
|
perms.add('kfet.perform_negative_operations')
|
||||||
return perms, stop_ope
|
return perms, stop_ope
|
||||||
|
|
|
@ -49,3 +49,46 @@ a:focus, a:hover {
|
||||||
text-transform:uppercase;
|
text-transform:uppercase;
|
||||||
font-weight:bold;
|
font-weight:bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.col-content-left, .col-content-right {
|
||||||
|
padding:0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content-left-top {
|
||||||
|
background:#fff;
|
||||||
|
padding:10px 30px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content-left .buttons {
|
||||||
|
background:#fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content-left .buttons .btn {
|
||||||
|
display:block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content-left-top.frozen-account {
|
||||||
|
background:#000FBA;
|
||||||
|
color:#fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content-left .block {
|
||||||
|
padding-top:10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content-left .block .line {
|
||||||
|
font-size:16px;
|
||||||
|
line-height:30px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content-left .line.trigramme {
|
||||||
|
font-family:Oswald;
|
||||||
|
font-size:60px;
|
||||||
|
font-weight:bold;
|
||||||
|
text-align:center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content-left .line.balance {
|
||||||
|
font-size:45px;
|
||||||
|
text-align:center;
|
||||||
|
}
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
{% extends "kfet/base.html" %}
|
{% extends "kfet/base.html" %}
|
||||||
|
{% load kfet_tags %}
|
||||||
|
|
||||||
{% block title %}
|
{% block title %}
|
||||||
{% if account.user == request.user %}
|
{% if account.user == request.user %}
|
||||||
|
@ -19,35 +20,56 @@
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-lg-12">
|
<div class="col-sm-4 col-md-3 col-content-left">
|
||||||
<div class="btn-group btn-group-lg">
|
<div class="content-left">
|
||||||
<a class="btn btn-primary" href="{% url 'kfet.account.update' account.trigramme %}">
|
<div class="content-left-top {% if account.is_frozen %}frozen-account{% endif %}">
|
||||||
|
<div class="line trigramme">{{ account.trigramme }}</div>
|
||||||
|
<div class="line balance">{{ account.balance|ukf:account.is_cof }} UKF</div>
|
||||||
|
<div class="block">
|
||||||
|
<div class="line">{{ account.name }}</div>
|
||||||
|
{% if perms.kfet.is_team %}
|
||||||
|
<div class="line">{{ account.nickname }}</div>
|
||||||
|
{% endif %}
|
||||||
|
<div class="line">
|
||||||
|
{% if account.email %}
|
||||||
|
{{ account.email }}
|
||||||
|
{% else %}
|
||||||
|
Pas d'email !
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
<div class="line">
|
||||||
|
{{ account.departement }} {{ account.promo }}
|
||||||
|
</div>
|
||||||
|
<div class="line">Statut COF: {{ account.is_cof }}</div>
|
||||||
|
</div>
|
||||||
|
<div class="block block-neg">
|
||||||
|
{% if account.negative.start %}
|
||||||
|
<div class="line">En négatif depuis {{ account.negative.start }}</div>
|
||||||
|
{% endif %}
|
||||||
|
{% if account.negative.balance_offset %}
|
||||||
|
<div class="line">Solde réel: {{ account.real_balance }} €</div>
|
||||||
|
{% endif %}
|
||||||
|
{% if account.negative.authz_overdraft_amount %}
|
||||||
|
<div class="line">Découvert autorisé: {{ account.negative.authz_overdraft_amount }} €</div>
|
||||||
|
{% endif %}
|
||||||
|
{% if account.negative.authz_overdraft_until %}
|
||||||
|
<div class="line">Découvert autorisé jusqu'à : {{ account.negative.authz_overdraft_until }}</div>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="buttons">
|
||||||
|
<a class="btn btn-primary btn-lg" href="{% url 'kfet.account.update' account.trigramme %}">
|
||||||
Modifier
|
Modifier
|
||||||
</a>
|
</a>
|
||||||
<a class="btn btn-primary">Recharger par CB</a>
|
<a class="btn btn-primary btn-lg" disabled>
|
||||||
|
Recharger par CB
|
||||||
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="col-sm-8 col-md-9 col-content-right">
|
||||||
<p>Prénom: {{ account.first_name }}</p>
|
{% include "kfet/base_messages.html" %}
|
||||||
<p>Nom: {{ account.last_name }}</p>
|
</div>
|
||||||
{% if perms.kfet.is_team %}
|
</div>
|
||||||
<p>Surnom: {{ account.nickname }}</p>
|
|
||||||
{% endif %}
|
|
||||||
<p>Email: {{ account.email }}</p>
|
|
||||||
<p>Département: {{ account.departement }}</p>
|
|
||||||
<p>Promo: {{ account.promo }}</p>
|
|
||||||
<p>Statut COF: {{ account.is_cof }}</p>
|
|
||||||
<p>Compte gelé: {{ account.is_frozen }}</p>
|
|
||||||
<p>Solde: {{ account.balance }} €</p>
|
|
||||||
{% if account.negative.balance_offset %}
|
|
||||||
<p>Solde réel: {{ account.real_balance }} €</p>
|
|
||||||
{% endif %}
|
|
||||||
{% if account.negative.authorized_overdraft %}
|
|
||||||
<p>Découvert autorisé: {{ account.negative.authorized_overdraft }} €</p>
|
|
||||||
{% endif %}
|
|
||||||
{% if account.negative.start %}
|
|
||||||
<p>En négatif depuis {{ account.negative.start }}</p>
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -36,7 +36,6 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% include "kfet/base_messages.html" %}
|
|
||||||
{% block content %}{% endblock %}
|
{% block content %}{% endblock %}
|
||||||
{% include "kfet/base_footer.html" %}
|
{% include "kfet/base_footer.html" %}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
from django import template
|
from django import template
|
||||||
from django.utils.html import escape
|
from django.utils.html import escape
|
||||||
from django.utils.safestring import mark_safe
|
from django.utils.safestring import mark_safe
|
||||||
|
from kfet.models import Settings
|
||||||
import re
|
import re
|
||||||
|
|
||||||
register = template.Library()
|
register = template.Library()
|
||||||
|
@ -26,3 +27,7 @@ def highlight_clipper(clipper, q):
|
||||||
text = clipper.username
|
text = clipper.username
|
||||||
return highlight_text(escape(text), q)
|
return highlight_text(escape(text), q)
|
||||||
|
|
||||||
|
@register.filter()
|
||||||
|
def ukf(balance, is_cof):
|
||||||
|
grant = is_cof and (1 + Settings.SUBVENTION_COF() / 100) or 1
|
||||||
|
return round(balance * 10 * grant)
|
||||||
|
|
|
@ -545,10 +545,10 @@ def kpsul_perform_operations(request):
|
||||||
balance = F('balance') + operationgroup.amount)
|
balance = F('balance') + operationgroup.amount)
|
||||||
operationgroup.on_acc.refresh_from_db()
|
operationgroup.on_acc.refresh_from_db()
|
||||||
if operationgroup.on_acc.balance < 0:
|
if operationgroup.on_acc.balance < 0:
|
||||||
if hasattr(on_acc, 'negative'):
|
if hasattr(operationgroup.on_acc, 'negative'):
|
||||||
if not on_acc.negative.start:
|
if not operationgroup.on_acc.negative.start:
|
||||||
on_acc.negative.start = timezone.now()
|
operationgroup.on_acc.negative.start = timezone.now()
|
||||||
on_acc.negative.save()
|
operationgroup.on_acc.negative.save()
|
||||||
else:
|
else:
|
||||||
negative = AccountNegative(
|
negative = AccountNegative(
|
||||||
account = operationgroup.on_acc, start = timezone.now())
|
account = operationgroup.on_acc, start = timezone.now())
|
||||||
|
|
Loading…
Reference in a new issue