diff --git a/kfet/models.py b/kfet/models.py index 241fb39b..e7807805 100644 --- a/kfet/models.py +++ b/kfet/models.py @@ -133,7 +133,7 @@ class Account(models.Model): else: overdraft_until = timezone.now() + overdraft_duration_max # 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 perms.add('kfet.perform_negative_operations') return perms, stop_ope diff --git a/kfet/static/kfet/css/index.css b/kfet/static/kfet/css/index.css index fab773c7..62e73742 100644 --- a/kfet/static/kfet/css/index.css +++ b/kfet/static/kfet/css/index.css @@ -49,3 +49,46 @@ a:focus, a:hover { text-transform:uppercase; 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; +} diff --git a/kfet/templates/kfet/account_read.html b/kfet/templates/kfet/account_read.html index c42fad82..6a4ddb9c 100644 --- a/kfet/templates/kfet/account_read.html +++ b/kfet/templates/kfet/account_read.html @@ -1,4 +1,5 @@ {% extends "kfet/base.html" %} +{% load kfet_tags %} {% block title %} {% if account.user == request.user %} @@ -19,35 +20,56 @@ {% block content %}
-
-
- - Modifier - - Recharger par CB +
+
+
+
{{ account.trigramme }}
+
{{ account.balance|ukf:account.is_cof }} UKF
+
+
{{ account.name }}
+ {% if perms.kfet.is_team %} +
{{ account.nickname }}
+ {% endif %} +
+ {% if account.email %} + {{ account.email }} + {% else %} + Pas d'email ! + {% endif %} +
+
+ {{ account.departement }} {{ account.promo }} +
+
Statut COF: {{ account.is_cof }}
+
+
+ {% if account.negative.start %} +
En négatif depuis {{ account.negative.start }}
+ {% endif %} + {% if account.negative.balance_offset %} +
Solde réel: {{ account.real_balance }} €
+ {% endif %} + {% if account.negative.authz_overdraft_amount %} +
Découvert autorisé: {{ account.negative.authz_overdraft_amount }} €
+ {% endif %} + {% if account.negative.authz_overdraft_until %} +
Découvert autorisé jusqu'à : {{ account.negative.authz_overdraft_until }}
+ {% endif %} +
+
+
+
+ {% include "kfet/base_messages.html" %} +
-

Prénom: {{ account.first_name }}

-

Nom: {{ account.last_name }}

-{% if perms.kfet.is_team %} -

Surnom: {{ account.nickname }}

-{% endif %} -

Email: {{ account.email }}

-

Département: {{ account.departement }}

-

Promo: {{ account.promo }}

-

Statut COF: {{ account.is_cof }}

-

Compte gelé: {{ account.is_frozen }}

-

Solde: {{ account.balance }} €

-{% if account.negative.balance_offset %} -

Solde réel: {{ account.real_balance }} €

-{% endif %} -{% if account.negative.authorized_overdraft %} -

Découvert autorisé: {{ account.negative.authorized_overdraft }} €

-{% endif %} -{% if account.negative.start %} -

En négatif depuis {{ account.negative.start }}

-{% endif %} - {% endblock %} diff --git a/kfet/templates/kfet/base.html b/kfet/templates/kfet/base.html index e57c4cbe..f7a016a0 100644 --- a/kfet/templates/kfet/base.html +++ b/kfet/templates/kfet/base.html @@ -36,7 +36,6 @@
{% endblock %} - {% include "kfet/base_messages.html" %} {% block content %}{% endblock %} {% include "kfet/base_footer.html" %} diff --git a/kfet/templatetags/kfet_tags.py b/kfet/templatetags/kfet_tags.py index 38538d9b..a118a455 100644 --- a/kfet/templatetags/kfet_tags.py +++ b/kfet/templatetags/kfet_tags.py @@ -1,6 +1,7 @@ from django import template from django.utils.html import escape from django.utils.safestring import mark_safe +from kfet.models import Settings import re register = template.Library() @@ -26,3 +27,7 @@ def highlight_clipper(clipper, q): text = clipper.username 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) diff --git a/kfet/views.py b/kfet/views.py index 5eba3476..14b90346 100644 --- a/kfet/views.py +++ b/kfet/views.py @@ -545,17 +545,17 @@ def kpsul_perform_operations(request): balance = F('balance') + operationgroup.amount) operationgroup.on_acc.refresh_from_db() if operationgroup.on_acc.balance < 0: - if hasattr(on_acc, 'negative'): - if not on_acc.negative.start: - on_acc.negative.start = timezone.now() - on_acc.negative.save() - else: - negative = AccountNegative( - account = operationgroup.on_acc, start = timezone.now()) - negative.save() - elif (hasattr(on_acc, 'negative') - and not on_acc.negative.balance_offset): - on_acc.negative.delete() + if hasattr(operationgroup.on_acc, 'negative'): + if not operationgroup.on_acc.negative.start: + operationgroup.on_acc.negative.start = timezone.now() + operationgroup.on_acc.negative.save() + else: + negative = AccountNegative( + account = operationgroup.on_acc, start = timezone.now()) + negative.save() + elif (hasattr(on_acc, 'negative') + and not on_acc.negative.balance_offset): + on_acc.negative.delete() # Updating checkout's balance if to_checkout_balance: