1
0
mirror of https://gitlab.crans.org/bde/nk20 synced 2025-06-24 19:20:29 +02:00

Handle credits from the Société générale

This commit is contained in:
Yohann D'ANELLO
2020-04-22 03:26:45 +02:00
parent f83f6da79a
commit b23814aef0
25 changed files with 954 additions and 500 deletions

View File

@ -19,14 +19,20 @@
{% endif %}
{% if club.require_memberships %}
<dt class="col-xl-6">{% trans 'membership start'|capfirst %}</dt>
<dd class="col-xl-6">{{ club.membership_start }}</dd>
{% if club.membership_start %}
<dt class="col-xl-6">{% trans 'membership start'|capfirst %}</dt>
<dd class="col-xl-6">{{ club.membership_start }}</dd>
{% endif %}
<dt class="col-xl-6">{% trans 'membership end'|capfirst %}</dt>
<dd class="col-xl-6">{{ club.membership_end }}</dd>
{% if club.membership_end %}
<dt class="col-xl-6">{% trans 'membership end'|capfirst %}</dt>
<dd class="col-xl-6">{{ club.membership_end }}</dd>
{% endif %}
<dt class="col-xl-6">{% trans 'membership duration'|capfirst %}</dt>
<dd class="col-xl-6">{{ club.membership_duration }} {% trans "days" %}</dd>
{% if club.membership_duration %}
<dt class="col-xl-6">{% trans 'membership duration'|capfirst %}</dt>
<dd class="col-xl-6">{{ club.membership_duration }} {% trans "days" %}</dd>
{% endif %}
{% if club.membership_fee_paid == club.membership_fee_unpaid %}
<dt class="col-xl-6">{% trans 'membership fee'|capfirst %}</dt>
@ -52,15 +58,18 @@
<dd class="col-xl-8"><a href="mailto:{{ club.email }}">{{ club.email }}</a></dd>
</dl>
</div>
<div class="card-footer text-center">
{% if can_add_members %}
<a class="btn btn-primary btn-sm my-1" href="{% url 'member:club_add_member' club_pk=club.pk %}"> {% trans "Add member" %}</a>
{% endif %}
{% if ".change_"|has_perm:club %}
<a class="btn btn-primary btn-sm my-1" href="{% url 'member:club_update' pk=club.pk %}"> {% trans "Edit" %}</a>
{% endif %}
{% url 'member:club_detail' club.pk as club_detail_url %}
{%if request.path_info != club_detail_url %}
<a class="btn btn-primary btn-sm my-1" href="{{ club_detail_url }}">{% trans 'View Profile' %}</a>
{% endif %} </div>
{% if not club.weiclub %}
<div class="card-footer text-center">
{% if can_add_members %}
<a class="btn btn-primary btn-sm my-1" href="{% url 'member:club_add_member' club_pk=club.pk %}"> {% trans "Add member" %}</a>
{% endif %}
{% if ".change_"|has_perm:club %}
<a class="btn btn-primary btn-sm my-1" href="{% url 'member:club_update' pk=club.pk %}"> {% trans "Edit" %}</a>
{% endif %}
{% url 'member:club_detail' club.pk as club_detail_url %}
{%if request.path_info != club_detail_url %}
<a class="btn btn-primary btn-sm my-1" href="{{ club_detail_url }}">{% trans 'View Profile' %}</a>
{% endif %}
</div>
{% endif %}
</div>

View File

@ -8,44 +8,15 @@
<h2>{% trans "Sign up" %}</h2>
<div class="alert alert-warning">
{% blocktrans %}
If you already signed up, your registration is taken into account. The BDE must validate your account before
your can log in. You have to go to the Kfet and pay the registration fee. You must also validate your email
address by following the link you received. If you forgot to register to the WEI, then you can pre-register
to the WEI after your account get validated, so please go to the Kfet.
{% endblocktrans %}
{% blocktrans %}If you already signed up, your registration is taken into account. The BDE must validate your account before your can log in. You have to go to the Kfet and pay the registration fee. You must also validate your email address by following the link you received.{% endblocktrans %}
</div>
<form method="post">
{% csrf_token %}
{{ form|crispy }}
{{ profile_form|crispy }}
{{ wei_registration_form|crispy }}
<div id="wei_form_div" class="d-none">
{{ wei_form|crispy }}
</div>
<button class="btn btn-success" type="submit">
{% trans "Sign up" %}
</button>
</form>
{% endblock %}
{% block extrajavascript %}
<script>
$("#id_wei_registration").change(function () {
if ($(this).is(":checked")) {
$("#wei_form_div").removeClass('d-none');
$("#wei_form_div .form-control").removeAttr('disabled');
}
else {
$("#wei_form_div").addClass('d-none');
$("#wei_form_div .form-control").attr('disabled', true);
}
});
if ($("#id_wei_registration").is(":checked")) {
$("#wei_form_div").removeClass('d-none');
$("#wei_form_div .form-control").removeAttr('disabled');
}
</script>
{% endblock %}

View File

@ -12,6 +12,9 @@
<a href="{% url "treasury:remittance_list" %}" class="btn btn-sm btn-outline-primary">
{% trans "Remittance" %}s
</a>
<a href="{% url "treasury:soge_credits" %}" class="btn btn-sm btn-outline-primary">
{% trans "Société générale credits" %}
</a>
</div>
</div>
</div>

View File

@ -12,6 +12,9 @@
<a href="#" class="btn btn-sm btn-outline-primary active">
{% trans "Remittance" %}s
</a>
<a href="{% url "treasury:soge_credits" %}" class="btn btn-sm btn-outline-primary">
{% trans "Société générale credits" %}
</a>
</div>
</div>
</div>

View File

@ -0,0 +1,52 @@
{% extends "base.html" %}
{% load static %}
{% load i18n %}
{% load pretty_money %}
{% block content %}
<div class="card bg-light shadow">
<div class="card-header text-center">
<h4>{% trans "Credit from the Société générale" %}</h4>
</div>
<div class="card-body">
<dl class="row">
<dt class="col-xl-6 text-right">{% trans 'user'|capfirst %}</dt>
<dd class="col-xl-6"><a href="{% url 'member:user_detail' pk=object.user.pk %}">{{ object.user }}</a></dd>
<dt class="col-xl-6 text-right">{% trans 'transactions'|capfirst %}</dt>
<dd class="col-xl-6">
{% for transaction in object.transactions.all %}
{{ transaction.membership.club }} ({{ transaction.amount|pretty_money }})<br>
{% endfor %}
</dd>
<dt class="col-xl-6 text-right">{% trans 'total amount'|capfirst %}</dt>
<dd class="col-xl-6">{{ object.amount|pretty_money }}</dd>
</dl>
</div>
<div class="alert alert-warning">
{% trans 'Warning: Validating this credit implies that all membership transactions will be validated.' %}
{% trans 'If you delete this credit, there all membership transactions will be also validated, but no credit will be operated.' %}
{% trans "If this credit is validated, then the user won't be able to ask for a credit from the Société générale." %}
{% trans 'If you think there is an error, please contact the "respos info".' %}
</div>
<div class="card-footer text-center" id="buttons_footer">
{% if object.valid %}
<div class="alert alert-danger">
{% trans "This credit is already validated." %}
</div>
{% else %}
<form method="post">
{% csrf_token %}
<div class="btn-group btn-block">
<button name="validate" class="btn btn-success">{% trans "Validate" %}</button>
<button name="delete" class="btn btn-danger">{% trans "Delete" %}</button>
</div>
</form>
{% endif %}
<a href="{% url 'treasury:soge_credits' %}"><button class="btn btn-primary btn-block">{% trans "Return to credit list" %}</button></a>
</div>
</div>
{% endblock %}

View File

@ -0,0 +1,66 @@
{% extends "base.html" %}
{% load render_table from django_tables2 %}
{% load i18n %}
{% block content %}
<div class="row">
<div class="col-xl-12">
<div class="btn-group btn-group-toggle" style="width: 100%; padding: 0 0 2em 0" data-toggle="buttons">
<a href="{% url "treasury:invoice_list" %}" class="btn btn-sm btn-outline-primary">
{% trans "Invoice" %}s
</a>
<a href="{% url "treasury:remittance_list" %}" class="btn btn-sm btn-outline-primary">
{% trans "Remittance" %}s
</a>
<a href="#" class="btn btn-sm btn-outline-primary active">
{% trans "Société générale credits" %}
</a>
</div>
</div>
</div>
<input id="searchbar" type="text" class="form-control" placeholder="Nom/prénom/note ...">
<div class="form-check">
<label for="invalid_only" class="form-check-label">
<input id="invalid_only" name="invalid_only" type="checkbox" class="checkboxinput form-check-input">
{% trans "Filter with unvalidated credits only" %}
</label>
</div>
<hr>
<div id="credits_table">
{% if table.data %}
{% render_table table %}
{% else %}
<div class="alert alert-warning">
{% trans "There is no matched user that have asked for a Société générale credit." %}
</div>
{% endif %}
</div>
{% endblock %}
{% block extrajavascript %}
<script type="text/javascript">
$(document).ready(function() {
let old_pattern = null;
let searchbar_obj = $("#searchbar");
let invalid_only_obj = $("#invalid_only");
function reloadTable() {
let pattern = searchbar_obj.val();
if (pattern === old_pattern || pattern === "")
return;
$("#credits_table").load(location.pathname + "?search=" + pattern.replace(" ", "%20") + (invalid_only_obj.is(':checked') ? "&valid=false" : "") + " #credits_table");
$(".table-row").click(function() {
window.document.location = $(this).data("href");
});
}
searchbar_obj.keyup(reloadTable);
invalid_only_obj.change(reloadTable);
});
</script>
{% endblock %}