1
0
mirror of https://gitlab.crans.org/bde/nk20 synced 2024-11-26 18:37:12 +00:00

Cards everywhere in member app

This commit is contained in:
Alexandre Iooss 2020-08-25 16:30:02 +02:00
parent 2e659c63cd
commit e3785e11f1
16 changed files with 338 additions and 316 deletions

View File

@ -1,68 +1,75 @@
{% extends "member/base.html" %} {% extends "member/base.html" %}
{% load crispy_forms_tags %} {% comment %}
{% load static %} SPDX-License-Identifier: GPL-3.0-or-later
{% load i18n %} {% endcomment %}
{% load pretty_money %} {% load crispy_forms_tags i18n pretty_money %}
{% block profile_content %} {% block profile_content %}
{% if additional_fee_renewal %} <div class="card bg-light">
<h3 class="card-header text-center">
{{ title }}
</h3>
<div class="card-body">
{% if additional_fee_renewal %}
<div class="alert alert-warning"> <div class="alert alert-warning">
{% if renewal %} {% if renewal %}
{% blocktrans trimmed with clubs=clubs_renewal|join:", " pretty_fee=additional_fee_renewal|pretty_money %} {% blocktrans trimmed with clubs=clubs_renewal|join:", " pretty_fee=additional_fee_renewal|pretty_money %}
The user is not a member of the club·s {{ clubs }}. An additional fee of {{ pretty_fee }} The user is not a member of the club·s {{ clubs }}. An additional fee of {{ pretty_fee }}
will be charged to renew automatically the membership in this/these club·s. will be charged to renew automatically the membership in this/these club·s.
{% endblocktrans %} {% endblocktrans %}
{% else %} {% else %}
{% blocktrans trimmed with clubs=clubs_renewal|join:", " pretty_fee=additional_fee_renewal|pretty_money %} {% blocktrans trimmed with clubs=clubs_renewal|join:", " pretty_fee=additional_fee_renewal|pretty_money %}
This club has parents {{ clubs }}. An additional fee of {{ pretty_fee }} This club has parents {{ clubs }}. An additional fee of {{ pretty_fee }}
will be charged to adhere automatically to this/these club·s. will be charged to adhere automatically to this/these club·s.
{% endblocktrans %} {% endblocktrans %}
{% endif %} {% endif %}
</div> </div>
{% endif %} {% endif %}
<form method="post" action=""> <form method="post" action="">
{% csrf_token %} {% csrf_token %}
{{ form|crispy }} {{ form|crispy }}
<button class="btn btn-primary" type="submit">{% trans "Submit" %}</button> <button class="btn btn-primary" type="submit">{% trans "Submit" %}</button>
</form> </form>
</div>
</div>
{% endblock %} {% endblock %}
{% block extrajavascript %} {% block extrajavascript %}
<script> <script>
function autocompleted(user) { function autocompleted(user) {
$("#id_last_name").val(user.last_name); $("#id_last_name").val(user.last_name);
$("#id_first_name").val(user.first_name); $("#id_first_name").val(user.first_name);
$.getJSON("/api/members/profile/" + user.id + "/", function(profile) { $.getJSON("/api/members/profile/" + user.id + "/", function (profile) {
let fee = profile.paid ? {{ club.membership_fee_paid }} : {{ club.membership_fee_unpaid }}; let fee = profile.paid ? "{{ club.membership_fee_paid }}" : "{{ club.membership_fee_unpaid }}";
$("#id_credit_amount").val((fee / 100).toFixed(2)); $("#id_credit_amount").val((Number(fee) / 100).toFixed(2));
}); });
}
soge_field = $("#id_soge");
function fillFields() {
let checked = soge_field.is(':checked');
if (!checked) {
$("input").attr('disabled', false);
$("#id_user").attr('disabled', true);
$("select").attr('disabled', false);
return;
} }
soge_field = $("#id_soge"); let credit_type = $("#id_credit_type");
credit_type.attr('disabled', true);
credit_type.val(4);
function fillFields() { let credit_amount = $("#id_credit_amount");
let checked = soge_field.is(':checked'); credit_amount.attr('disabled', true);
if (!checked) { credit_amount.val('{{ total_fee }}');
$("input").attr('disabled', false);
$("#id_user").attr('disabled', true);
$("select").attr('disabled', false);
return;
}
let credit_type = $("#id_credit_type"); let bank = $("#id_bank");
credit_type.attr('disabled', true); bank.attr('disabled', true);
credit_type.val(4); bank.val('Société générale');
}
let credit_amount = $("#id_credit_amount"); soge_field.change(fillFields);
credit_amount.attr('disabled', true); </script>
credit_amount.val('{{ total_fee }}');
let bank = $("#id_bank");
bank.attr('disabled', true);
bank.val('Société générale');
}
soge_field.change(fillFields);
</script>
{% endblock %} {% endblock %}

View File

@ -2,6 +2,7 @@
{% comment %} {% comment %}
SPDX-License-Identifier: GPL-3.0-or-later SPDX-License-Identifier: GPL-3.0-or-later
{% endcomment %} {% endcomment %}
{% load i18n perms %}
{% block contenttitle %}{% endblock %} {% block contenttitle %}{% endblock %}
{# Use a fluid-width container #} {# Use a fluid-width container #}
@ -11,28 +12,63 @@ SPDX-License-Identifier: GPL-3.0-or-later
<div class="row mt-4"> <div class="row mt-4">
<div class="col-xl-4"> <div class="col-xl-4">
{% block profile_info %} {% block profile_info %}
{% if user_object %} <div class="card bg-light">
{% include "member/includes/profile_info.html" %} <h4 class="card-header text-center">
{% elif club %} {% if user_object %}
{% trans "Account #" %}{{ user_object.pk }}
{% elif club %}
Club {{ club.name }}
{% endif %}
</h4>
<div class="text-center">
{% if user_object %}
<a href="{% url 'member:user_update_pic' user_object.pk %}">
<img src="{{ user_object.note.display_image.url }}" class="img-thumbnail mt-2">
</a>
{% elif club %}
<a href="{% url 'member:club_update_pic' club.pk %}">
<img src="{{ club.note.display_image.url }}" class="img-thumbnail mt-2">
</a>
{% endif %}
</div>
<div class="card-body" id="profile_infos">
{% if user_object %}
{% include "member/includes/profile_info.html" %}
{% elif club %}
{% include "member/includes/club_info.html" %} {% include "member/includes/club_info.html" %}
{% elif note.club.weiclub %} {% endif %}
{% with club=note.club.weiclub %} {% endblock %}
{% include "wei/weiclub_info.html" %} </div>
{% endwith %} <div class="card-footer">
{% elif note.club %} {% if user_object %}
{% with club=note.club %} <a class="btn btn-sm btn-secondary" href="{% url 'member:user_update_profile' user_object.pk %}">
{% include "member/includes/club_info.html" %} <i class="fa fa-edit"></i> {% trans 'Update Profile' %}
{% endwith %} </a>
{% elif note.user %} {% url 'member:user_detail' user_object.pk as user_profile_url %}
{% with user_object=note.user %} {% if request.path_info != user_profile_url %}
{% include "member/includes/profile_info.html" %} <a class="btn btn-sm btn-primary" href="{{ user_profile_url }}">{% trans 'View Profile' %}</a>
{% endwith %} {% endif %}
{% endif %} {% elif club and not club.weiclub %}
{% endblock %} {% if can_add_members %}
<a class="btn btn-sm btn-success" href="{% url 'member:club_add_member' club_pk=club.pk %}"
data-turbolinks="false"> {% trans "Add member" %}</a>
{% endif %}
{% if ".change_"|has_perm:club %}
<a class="btn btn-sm btn-secondary" href="{% url 'member:club_update' pk=club.pk %}"
data-turbolinks="false">
<i class="fa fa-edit"></i> {% trans 'Update Profile' %}
</a>
{% endif %}
{% url 'member:club_detail' club.pk as club_detail_url %}
{% if request.path_info != club_detail_url %}
<a class="btn btn-sm btn-primary" href="{{ club_detail_url }}">{% trans 'View Profile' %}</a>
{% endif %}
{% endif %}
</div>
</div>
</div> </div>
<div class="col-xl-8"> <div class="col-xl-8">
{% block profile_content %} {% block profile_content %}{% endblock %}
{% endblock %}
</div> </div>
</div> </div>
{% endblock %} {% endblock %}

View File

@ -1,4 +1,7 @@
{% extends "member/base.html" %} {% extends "member/base.html" %}
{% comment %}
SPDX-License-Identifier: GPL-3.0-or-later
{% endcomment %}
{% load static django_tables2 i18n %} {% load static django_tables2 i18n %}
{% block profile_content %} {% block profile_content %}

View File

@ -1,4 +1,7 @@
{% extends "member/base.html" %} {% extends "member/base.html" %}
{% comment %}
SPDX-License-Identifier: GPL-3.0-or-later
{% endcomment %}
{% load render_table from django_tables2 %} {% load render_table from django_tables2 %}
{% load i18n perms %} {% load i18n perms %}

View File

@ -1,11 +1,11 @@
{% extends "base.html" %} {% extends "member/base.html" %}
{% comment %} {% comment %}
SPDX-License-Identifier: GPL-3.0-or-later SPDX-License-Identifier: GPL-3.0-or-later
{% endcomment %} {% endcomment %}
{% load i18n crispy_forms_tags %} {% load i18n crispy_forms_tags %}
{% block contenttitle %}{% endblock %} {% block contenttitle %}{% endblock %}
{% block content %} {% block profile_content %}
<div class="card bg-light"> <div class="card bg-light">
<h3 class="card-header text-center"> <h3 class="card-header text-center">
{{ title }} {{ title }}

View File

@ -3,63 +3,64 @@
{% load render_table from django_tables2 %} {% load render_table from django_tables2 %}
{% block profile_content %} {% block profile_content %}
<input id="searchbar" type="text" class="form-control" placeholder="Nom/prénom/note ..."> <div class="card bg-light">
<div class="form-group"> <h3 class="card-header text-center">
{{ title }}
</h3>
<div class="card-body">
<input id="searchbar" type="text" class="form-control" placeholder="Nom/prénom/note…">
<div class="form-check"> <div class="form-check">
<label class="form-check-label" for="only_active"> <label class="form-check-label" for="only_active">
<input type="checkbox" class="checkboxinput form-check-input" id="only_active" <input type="checkbox" class="checkboxinput form-check-input" id="only_active"
{% if only_active %}checked{% endif %}> {% if only_active %}checked{% endif %}>
{% trans "Display only active memberships" %} {% trans "Display only active memberships" %}
</label> </label>
</div> </div>
</div> <div id="div_id_roles">
<div id="div_id_roles" class="form-group"> <label for="roles" class="col-form-label">{% trans "Filter roles:" %}</label>
<label for="id_roles" class="col-form-label">{% trans "Filter roles:" %}</label>
<div class="">
<select name="roles" class="selectmultiple form-control" id="roles" multiple=""> <select name="roles" class="selectmultiple form-control" id="roles" multiple="">
{% for role in applicable_roles %} {% for role in applicable_roles %}
<option value="{{ role.id }}" selected>{{ role.name }}</option> <option value="{{ role.id }}" selected>{{ role.name }}</option>
{% endfor %} {% endfor %}
</select> </select>
</div> </div>
</div> </div>
<hr>
<div id="memberships_table"> <div id="memberships_table">
{% if table.data %} {% if table.data %}
{% render_table table %} {% render_table table %}
{% else %} {% else %}
<div class="alert alert-warning"> <div class="alert alert-warning">
{% trans "There is no membership found with this pattern." %} {% trans "There is no membership found with this pattern." %}
</div> </div>
{% endif %} {% endif %}
</div> </div>
</div>
{% endblock %} {% endblock %}
{% block extrajavascript %} {% block extrajavascript %}
<script type="text/javascript"> <script type="text/javascript">
$(document).ready(function () { $(document).ready(function () {
let searchbar_obj = $("#searchbar"); let searchbar_obj = $("#searchbar");
let only_active_obj = $("#only_active"); let only_active_obj = $("#only_active");
let roles_obj = $("#roles"); let roles_obj = $("#roles");
function reloadTable() { function reloadTable() {
let pattern = searchbar_obj.val(); let pattern = searchbar_obj.val();
let roles = []; let roles = [];
$("#roles option:selected").each(function() { $("#roles option:selected").each(function () {
roles.push($(this).val()); roles.push($(this).val());
}); });
let roles_str = roles.join(','); let roles_str = roles.join(',');
$("#memberships_table").load(location.pathname + "?search=" + pattern.replace(" ", "%20") $("#memberships_table").load(location.pathname + "?search=" + pattern.replace(" ", "%20") +
+ "&only_active=" + (only_active_obj.is(':checked') ? '1' : '0') "&only_active=" + (only_active_obj.is(':checked') ? '1' : '0') +
+ "&roles=" + roles_str + " #memberships_table"); "&roles=" + roles_str + " #memberships_table");
} }
searchbar_obj.keyup(reloadTable); searchbar_obj.keyup(reloadTable);
only_active_obj.change(reloadTable); only_active_obj.change(reloadTable);
roles_obj.change(reloadTable); roles_obj.change(reloadTable);
}); });
</script> </script>
{% endblock %} {% endblock %}

View File

@ -1,84 +1,56 @@
{% load i18n pretty_money perms %} {% load i18n pretty_money perms %}
<div class="card bg-light"> <dl class="row">
<h4 class="card-header text-center"> <dt class="col-xl-6">{% trans 'name'|capfirst %}</dt>
Club {{ club.name }} <dd class="col-xl-6">{{ club.name }}</dd>
</h4>
<div class="card-top text-center">
<a href="{% url 'member:club_update_pic' club.pk %}">
<img src="{{ club.note.display_image.url }}" class="img-thumbnail mt-2">
</a>
</div>
<div class="card-body" id="profile_infos">
<dl class="row">
<dt class="col-xl-6">{% trans 'name'|capfirst %}</dt>
<dd class="col-xl-6">{{ club.name }}</dd>
{% if club.parent_club %} {% if club.parent_club %}
<dt class="col-xl-6"> <dt class="col-xl-6">
<a href="{% url 'member:club_detail' club.parent_club.pk %}">{% trans 'Club Parent'|capfirst %}</a> <a href="{% url 'member:club_detail' club.parent_club.pk %}">{% trans 'Club Parent'|capfirst %}</a>
</dt> </dt>
<dd class="col-xl-6"> {{ club.parent_club.name }}</dd> <dd class="col-xl-6"> {{ club.parent_club.name }}</dd>
{% endif %}
{% if club.require_memberships %}
{% if club.membership_start %}
<dt class="col-xl-6">{% trans 'membership start'|capfirst %}</dt>
<dd class="col-xl-6">{{ club.membership_start }}</dd>
{% endif %}
{% if club.membership_end %}
<dt class="col-xl-6">{% trans 'membership end'|capfirst %}</dt>
<dd class="col-xl-6">{{ club.membership_end }}</dd>
{% endif %}
{% 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>
<dd class="col-xl-6">{{ club.membership_fee_paid|pretty_money }}</dd>
{% else %}
<dt class="col-xl-6">{% trans 'membership fee (paid students)'|capfirst %}</dt>
<dd class="col-xl-6">{{ club.membership_fee_paid|pretty_money }}</dd>
<dt class="col-xl-6">{% trans 'membership fee (unpaid students)'|capfirst %}</dt>
<dd class="col-xl-6">{{ club.membership_fee_unpaid|pretty_money }}</dd>
{% endif %}
{% endif %}
{% if "note.view_note"|has_perm:club.note %}
<dt class="col-xl-6">{% trans 'balance'|capfirst %}</dt>
<dd class="col-xl-6">{{ club.note.balance | pretty_money }}</dd>
{% endif %}
<dt class="col-xl-6">{% trans 'aliases'|capfirst %}</dt>
<dd class="col-xl-6">
<a class="small" href="{% url 'member:club_alias' club.pk %}">
{% trans 'Edit my aliases' %} ({{ club.note.alias_set.all|length }})
</a>
</dd>
<dt class="col-xl-4">{% trans 'email'|capfirst %}</dt>
<dd class="col-xl-8"><a href="mailto:{{ club.email }}">{{ club.email }}</a></dd>
</dl>
</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 %}"
data-turbolinks="false"> {% 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 %}" data-turbolinks="false">
{% 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 %} {% endif %}
</div>
{% if club.require_memberships %}
{% if club.membership_start %}
<dt class="col-xl-6">{% trans 'membership start'|capfirst %}</dt>
<dd class="col-xl-6">{{ club.membership_start }}</dd>
{% endif %}
{% if club.membership_end %}
<dt class="col-xl-6">{% trans 'membership end'|capfirst %}</dt>
<dd class="col-xl-6">{{ club.membership_end }}</dd>
{% endif %}
{% 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>
<dd class="col-xl-6">{{ club.membership_fee_paid|pretty_money }}</dd>
{% else %}
<dt class="col-xl-6">{% trans 'membership fee (paid students)'|capfirst %}</dt>
<dd class="col-xl-6">{{ club.membership_fee_paid|pretty_money }}</dd>
<dt class="col-xl-6">{% trans 'membership fee (unpaid students)'|capfirst %}</dt>
<dd class="col-xl-6">{{ club.membership_fee_unpaid|pretty_money }}</dd>
{% endif %}
{% endif %}
{% if "note.view_note"|has_perm:club.note %}
<dt class="col-xl-6">{% trans 'balance'|capfirst %}</dt>
<dd class="col-xl-6">{{ club.note.balance | pretty_money }}</dd>
{% endif %}
<dt class="col-xl-6">{% trans 'aliases'|capfirst %}</dt>
<dd class="col-xl-6">
<a class="small" href="{% url 'member:club_alias' club.pk %}">
{% trans 'Edit aliases' %} ({{ club.note.alias_set.all|length }})
</a>
</dd>
<dt class="col-xl-4">{% trans 'email'|capfirst %}</dt>
<dd class="col-xl-8"><a href="mailto:{{ club.email }}">{{ club.email }}</a></dd>
</dl>

View File

@ -1,70 +1,49 @@
{% load i18n pretty_money perms %} {% load i18n pretty_money perms %}
<div class="card bg-light"> <dl class="row">
<h4 class="card-header text-center"> <dt class="col-xl-6">{% trans 'name'|capfirst %}, {% trans 'first name' %}</dt>
{% trans "Account #" %}{{ user_object.pk }} <dd class="col-xl-6">{{ user_object.last_name }} {{ user_object.first_name }}</dd>
</h4>
<div class="card-top text-center"> <dt class="col-xl-6">{% trans 'username'|capfirst %}</dt>
<a href="{% url 'member:user_update_pic' user_object.pk %}"> <dd class="col-xl-6">{{ user_object.username }}</dd>
<img src="{{ user_object.note.display_image.url }}" class="img-thumbnail mt-2">
{% if user_object.pk == user.pk %}
<dt class="col-xl-6">{% trans 'password'|capfirst %}</dt>
<dd class="col-xl-6">
<a class="small" href="{% url 'password_change' %}">
{% trans 'Change password' %}
</a> </a>
</div> </dd>
<div class="card-body" id="profile_infos"> {% endif %}
<dl class="row">
<dt class="col-xl-6">{% trans 'name'|capfirst %}, {% trans 'first name' %}</dt>
<dd class="col-xl-6">{{ user_object.last_name }} {{ user_object.first_name }}</dd>
<dt class="col-xl-6">{% trans 'username'|capfirst %}</dt> <dt class="col-xl-6">{% trans 'aliases'|capfirst %}</dt>
<dd class="col-xl-6">{{ user_object.username }}</dd> <dd class="col-xl-6">
<a class="small" href="{% url 'member:user_alias' user_object.pk %}">
{% if user_object.pk == user.pk %} {% trans 'Edit aliases' %} ({{ user_object.note.alias_set.all|length }})
<dt class="col-xl-6">{% trans 'password'|capfirst %}</dt>
<dd class="col-xl-6">
<a class="small" href="{% url 'password_change' %}">
{% trans 'Change password' %}
</a>
</dd>
{% endif %}
<dt class="col-xl-6">{% trans 'aliases'|capfirst %}</dt>
<dd class="col-xl-6">
<a class="small" href="{% url 'member:user_alias' user_object.pk %}">
{% trans 'Edit my aliases' %} ({{ user_object.note.alias_set.all|length }})
</a>
</dd>
<dt class="col-xl-6">{% trans 'section'|capfirst %}</dt>
<dd class="col-xl-6">{{ user_object.profile.section }}</dd>
<dt class="col-xl-6">{% trans 'email'|capfirst %}</dt>
<dd class="col-xl-6"><a href="mailto:{{ user_object.email }}">{{ user_object.email }}</a></dd>
<dt class="col-xl-6">{% trans 'phone number'|capfirst %}</dt>
<dd class="col-xl-6"><a
href="tel:{{ user_object.profile.phone_number }}">{{ user_object.profile.phone_number }}</a></dd>
<dt class="col-xl-6">{% trans 'address'|capfirst %}</dt>
<dd class="col-xl-6">{{ user_object.profile.address }}</dd>
{% if "note.view_note"|has_perm:user_object.note %}
<dt class="col-xl-6">{% trans 'balance'|capfirst %}</dt>
<dd class="col-xl-6">{{ user_object.note.balance | pretty_money }}</dd>
<dt class="col-xl-6">{% trans 'paid'|capfirst %}</dt>
<dd class="col-xl-6">{{ user_object.profile.paid|yesno }}</dd>
{% endif %}
</dl>
</div>
<div class="card-footer">
<a class="btn btn-sm btn-secondary" href="{% url 'member:user_update_profile' user_object.pk %}">
<i class="fa fa-edit"></i> {% trans 'Update Profile' %}
</a> </a>
{% url 'member:user_detail' user_object.pk as user_profile_url %} </dd>
{% if request.path_info != user_profile_url %}
<a class="btn btn-sm btn-primary" href="{{ user_profile_url }}">{% trans 'View Profile' %}</a> <dt class="col-xl-6">{% trans 'section'|capfirst %}</dt>
{% endif %} <dd class="col-xl-6">{{ user_object.profile.section }}</dd>
</div>
</div> <dt class="col-xl-6">{% trans 'email'|capfirst %}</dt>
<dd class="col-xl-6"><a href="mailto:{{ user_object.email }}">{{ user_object.email }}</a></dd>
<dt class="col-xl-6">{% trans 'phone number'|capfirst %}</dt>
<dd class="col-xl-6"><a href="tel:{{ user_object.profile.phone_number }}">{{ user_object.profile.phone_number }}</a>
</dd>
<dt class="col-xl-6">{% trans 'address'|capfirst %}</dt>
<dd class="col-xl-6">{{ user_object.profile.address }}</dd>
{% if "note.view_note"|has_perm:user_object.note %}
<dt class="col-xl-6">{% trans 'balance'|capfirst %}</dt>
<dd class="col-xl-6">{{ user_object.note.balance | pretty_money }}</dd>
<dt class="col-xl-6">{% trans 'paid'|capfirst %}</dt>
<dd class="col-xl-6">{{ user_object.profile.paid|yesno }}</dd>
{% endif %}
</dl>
{% if user_object.pk == user_object.pk %} {% if user_object.pk == user_object.pk %}
<a class="small float-right text-decoration-none" href="{% url 'member:auth_token' %}"> <a class="small float-right text-decoration-none" href="{% url 'member:auth_token' %}">

View File

@ -1,8 +1,11 @@
{% extends "member/base.html" %} {% extends "member/base.html" %}
{% comment %}
SPDX-License-Identifier: GPL-3.0-or-later
{% endcomment %}
{% load i18n %} {% load i18n %}
{% block content %} {% block content %}
<div class="alert alert-info"> <div class="alert alert-info">
<h4>À quoi sert un jeton d'authentification ?</h4> <h4>À quoi sert un jeton d'authentification ?</h4>
Un jeton vous permet de vous connecter à <a href="/api/">l'API de la Note Kfet</a>.<br /> Un jeton vous permet de vous connecter à <a href="/api/">l'API de la Note Kfet</a>.<br />
@ -10,24 +13,24 @@
pour pouvoir vous identifier.<br /><br /> pour pouvoir vous identifier.<br /><br />
Une documentation de l'API arrivera ultérieurement. Une documentation de l'API arrivera ultérieurement.
</div> </div>
<div class="alert alert-info"> <div class="alert alert-info">
<strong>{%trans 'Token' %} :</strong> <strong>{%trans 'Token' %} :</strong>
{% if 'show' in request.GET %} {% if 'show' in request.GET %}
{{ token.key }} (<a href="?">cacher</a>) {{ token.key }} (<a href="?">cacher</a>)
{% else %} {% else %}
<em>caché</em> (<a href="?show">montrer</a>) <em>caché</em> (<a href="?show">montrer</a>)
{% endif %} {% endif %}
<br /> <br />
<strong>{%trans 'Created' %} :</strong> {{ token.created }} <strong>{%trans 'Created' %} :</strong> {{ token.created }}
</div> </div>
<div class="alert alert-warning"> <div class="alert alert-warning">
<strong>Attention :</strong> regénérer le jeton va révoquer tout accès autorisé à l'API via ce jeton ! <strong>Attention :</strong> regénérer le jeton va révoquer tout accès autorisé à l'API via ce jeton !
</div> </div>
<a href="?regenerate"> <a href="?regenerate">
<button class="btn btn-primary">{% trans 'Regenerate token' %}</button> <button class="btn btn-primary">{% trans 'Regenerate token' %}</button>
</a> </a>
{% endblock %} {% endblock %}

View File

@ -99,7 +99,6 @@
$("#id_width").val(cropData["width"]); $("#id_width").val(cropData["width"]);
$("#formUpload").submit(); $("#formUpload").submit();
}); });
}); });
</script> </script>
{% endblock %} {% endblock %}

View File

@ -1,4 +1,7 @@
{% extends "member/base.html" %} {% extends "member/base.html" %}
{% comment %}
SPDX-License-Identifier: GPL-3.0-or-later
{% endcomment %}
{% load static django_tables2 i18n %} {% load static django_tables2 i18n %}
{% block profile_content %} {% block profile_content %}

View File

@ -1,4 +1,7 @@
{% extends "member/base.html" %} {% extends "member/base.html" %}
{% comment %}
SPDX-License-Identifier: GPL-3.0-or-later
{% endcomment %}
{% load render_table from django_tables2 %} {% load render_table from django_tables2 %}
{% load i18n perms %} {% load i18n perms %}
@ -12,7 +15,7 @@
</div> </div>
{% endif %} {% endif %}
<div class="card"> <div class="card bg-light mb-3">
<div class="card-header position-relative" id="clubListHeading"> <div class="card-header position-relative" id="clubListHeading">
<a class="font-weight-bold"> <a class="font-weight-bold">
<i class="fa fa-users"></i> {% trans "View my memberships" %} <i class="fa fa-users"></i> {% trans "View my memberships" %}
@ -21,11 +24,9 @@
{% render_table club_list %} {% render_table club_list %}
</div> </div>
<hr> <div class="card bg-light">
<div class="card">
<div class="card-header position-relative" id="historyListHeading"> <div class="card-header position-relative" id="historyListHeading">
<a class="stretched-link font-weight-bold" {% if "note.view_note"|has_perm:user_object.note %} <a class="stretched-link font-weight-bold text-decoration-none" {% if "note.view_note"|has_perm:user_object.note %}
href="{% url 'note:transactions' pk=user_object.note.pk %}" {% endif %}> href="{% url 'note:transactions' pk=user_object.note.pk %}" {% endif %}>
<i class="fa fa-euro"></i> {% trans "Transaction history" %} <i class="fa fa-euro"></i> {% trans "Transaction history" %}
</a> </a>

View File

@ -1,8 +1,8 @@
{% extends "member/base.html" %} {% extends "member/base.html" %}
{% load i18n crispy_forms_tags %}
{% comment %} {% comment %}
SPDX-License-Identifier: GPL-3.0-or-later SPDX-License-Identifier: GPL-3.0-or-later
{% endcomment %} {% endcomment %}
{% load i18n crispy_forms_tags %}
{% block contenttitle %}{% endblock %} {% block contenttitle %}{% endblock %}
{% block profile_content %} {% block profile_content %}

View File

@ -1,49 +1,67 @@
{% extends "member/base.html" %} {% extends "base.html" %}
{% comment %}
SPDX-License-Identifier: GPL-3.0-or-later
{% endcomment %}
{% load render_table from django_tables2 %} {% load render_table from django_tables2 %}
{% load crispy_forms_tags %} {% load crispy_forms_tags %}
{% block contenttitle %}{% endblock %}
{% block profile_content %} {# Use a fluid-width container #}
{% crispy form %} {% block containertype %}container-fluid{% endblock %}
{% endblock %}
{% block content %} {% block content %}
{{ block.super }} <div class="row mt-4">
<div id="table"> <div class="col-xl-4">
{% render_table table %} <div class="card bg-light mb-3">
<h3 class="card-header text-center">
{{ title }}
</h3>
<div class="card-body">
{% crispy form %}
</div>
</div>
</div> </div>
<div class="col-xl-8">
<div class="card bg-light">
<div id="table">
{% render_table table %}
</div>
</div>
</div>
</div>
{% endblock %} {% endblock %}
{% block extrajavascript %} {% block extrajavascript %}
<script> <script>
function refreshHistory() { function refreshHistory() {
$("#history_list").load("{% url 'note:transactions' pk=object.pk %} #history_list"); $("#history_list").load("{% url 'note:transactions' pk=object.pk %} #history_list");
$("#profile_infos").load("{% url 'note:transactions' pk=object.pk %} #profile_infos"); $("#profile_infos").load("{% url 'note:transactions' pk=object.pk %} #profile_infos");
} }
function refreshFilters() { function refreshFilters() {
let filters = ""; let filters = "";
filters += "source=" + $("#id_source_pk").val(); filters += "source=" + $("#id_source_pk").val();
filters += "&destination=" + $("#id_destination_pk").val(); filters += "&destination=" + $("#id_destination_pk").val();
filters += $("input[name='type']:checked").map(function() { filters += $("input[name='type']:checked").map(function () {
return "&type=" + $(this).val(); return "&type=" + $(this).val();
}).toArray().join(""); }).toArray().join("");
filters += "&reason=" + $("#id_reason").val(); filters += "&reason=" + $("#id_reason").val();
filters += "&valid=" + ($("#id_valid").is(":checked") ? "1" : ""); filters += "&valid=" + ($("#id_valid").is(":checked") ? "1" : "");
filters += "&amount_gte=" + $("#id_amount_gte").val(); filters += "&amount_gte=" + $("#id_amount_gte").val();
filters += "&amount_lte=" + $("#id_amount_lte").val(); filters += "&amount_lte=" + $("#id_amount_lte").val();
filters += "&created_after=" + $("#id_created_after").val(); filters += "&created_after=" + $("#id_created_after").val();
filters += "&created_before=" + $("#id_created_before").val(); filters += "&created_before=" + $("#id_created_before").val();
console.log(filters.replace(" ", "%20")); console.log(filters.replace(" ", "%20"));
$("#table").load(location.pathname + "?" + filters.replaceAll(" ", "%20") + " #table"); $("#table").load(location.pathname + "?" + filters.replaceAll(" ", "%20") + " #table");
} }
function autocompleted() { function autocompleted() {
refreshFilters(); refreshFilters();
} }
$(document).ready(function() { $(document).ready(function () {
$("input").change(refreshFilters); $("input").change(refreshFilters);
$("input").keyup(refreshFilters); $("input").keyup(refreshFilters);
}); });
</script> </script>
{% endblock %} {% endblock %}

View File

@ -1,8 +1,5 @@
{% extends "wei/base.html" %} {% extends "wei/base.html" %}
{# Use a fluid-width container #}
{% block containertype %}container-fluid{% endblock %}
{% block profile_info %} {% block profile_info %}
{% include "wei/weiclub_info.html" %} {% include "wei/weiclub_info.html" %}
{% endblock %} {% endblock %}