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,10 +1,15 @@
{% extends "member/base.html" %}
{% load crispy_forms_tags %}
{% load static %}
{% load i18n %}
{% load pretty_money %}
{% comment %}
SPDX-License-Identifier: GPL-3.0-or-later
{% endcomment %}
{% load crispy_forms_tags i18n pretty_money %}
{% block profile_content %}
<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">
{% if renewal %}
@ -26,6 +31,8 @@
{{ form|crispy }}
<button class="btn btn-primary" type="submit">{% trans "Submit" %}</button>
</form>
</div>
</div>
{% endblock %}
{% block extrajavascript %}
@ -34,8 +41,8 @@
$("#id_last_name").val(user.last_name);
$("#id_first_name").val(user.first_name);
$.getJSON("/api/members/profile/" + user.id + "/", function (profile) {
let fee = profile.paid ? {{ club.membership_fee_paid }} : {{ club.membership_fee_unpaid }};
$("#id_credit_amount").val((fee / 100).toFixed(2));
let fee = profile.paid ? "{{ club.membership_fee_paid }}" : "{{ club.membership_fee_unpaid }}";
$("#id_credit_amount").val((Number(fee) / 100).toFixed(2));
});
}

View File

@ -2,6 +2,7 @@
{% comment %}
SPDX-License-Identifier: GPL-3.0-or-later
{% endcomment %}
{% load i18n perms %}
{% block contenttitle %}{% endblock %}
{# Use a fluid-width container #}
@ -11,28 +12,63 @@ SPDX-License-Identifier: GPL-3.0-or-later
<div class="row mt-4">
<div class="col-xl-4">
{% block profile_info %}
<div class="card bg-light">
<h4 class="card-header text-center">
{% 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" %}
{% elif note.club.weiclub %}
{% with club=note.club.weiclub %}
{% include "wei/weiclub_info.html" %}
{% endwith %}
{% elif note.club %}
{% with club=note.club %}
{% include "member/includes/club_info.html" %}
{% endwith %}
{% elif note.user %}
{% with user_object=note.user %}
{% include "member/includes/profile_info.html" %}
{% endwith %}
{% endif %}
{% endblock %}
</div>
<div class="card-footer">
{% if user_object %}
<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>
{% url 'member:user_detail' user_object.pk as user_profile_url %}
{% if request.path_info != user_profile_url %}
<a class="btn btn-sm btn-primary" href="{{ user_profile_url }}">{% trans 'View Profile' %}</a>
{% endif %}
{% elif club and not club.weiclub %}
{% 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 class="col-xl-8">
{% block profile_content %}
{% endblock %}
{% block profile_content %}{% endblock %}
</div>
</div>
{% endblock %}

View File

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

View File

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

View File

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

View File

@ -3,8 +3,12 @@
{% load render_table from django_tables2 %}
{% block profile_content %}
<input id="searchbar" type="text" class="form-control" placeholder="Nom/prénom/note ...">
<div class="form-group">
<div class="card bg-light">
<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">
<label class="form-check-label" for="only_active">
<input type="checkbox" class="checkboxinput form-check-input" id="only_active"
@ -12,10 +16,8 @@
{% trans "Display only active memberships" %}
</label>
</div>
</div>
<div id="div_id_roles" class="form-group">
<label for="id_roles" class="col-form-label">{% trans "Filter roles:" %}</label>
<div class="">
<div id="div_id_roles">
<label for="roles" class="col-form-label">{% trans "Filter roles:" %}</label>
<select name="roles" class="selectmultiple form-control" id="roles" multiple="">
{% for role in applicable_roles %}
<option value="{{ role.id }}" selected>{{ role.name }}</option>
@ -23,8 +25,6 @@
</select>
</div>
</div>
<hr>
<div id="memberships_table">
{% if table.data %}
{% render_table table %}
@ -34,6 +34,7 @@
</div>
{% endif %}
</div>
</div>
{% endblock %}
{% block extrajavascript %}
@ -52,9 +53,9 @@
});
let roles_str = roles.join(',');
$("#memberships_table").load(location.pathname + "?search=" + pattern.replace(" ", "%20")
+ "&only_active=" + (only_active_obj.is(':checked') ? '1' : '0')
+ "&roles=" + roles_str + " #memberships_table");
$("#memberships_table").load(location.pathname + "?search=" + pattern.replace(" ", "%20") +
"&only_active=" + (only_active_obj.is(':checked') ? '1' : '0') +
"&roles=" + roles_str + " #memberships_table");
}
searchbar_obj.keyup(reloadTable);

View File

@ -1,15 +1,5 @@
{% load i18n pretty_money perms %}
<div class="card bg-light">
<h4 class="card-header text-center">
Club {{ club.name }}
</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>
@ -57,28 +47,10 @@
<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 }})
{% 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>
</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 %}
</div>

View File

@ -1,15 +1,5 @@
{% load i18n pretty_money perms %}
<div class="card bg-light">
<h4 class="card-header text-center">
{% trans "Account #" %}{{ user_object.pk }}
</h4>
<div class="card-top text-center">
<a href="{% url 'member:user_update_pic' user_object.pk %}">
<img src="{{ user_object.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 %}, {% trans 'first name' %}</dt>
<dd class="col-xl-6">{{ user_object.last_name }} {{ user_object.first_name }}</dd>
@ -29,7 +19,7 @@
<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 }})
{% trans 'Edit aliases' %} ({{ user_object.note.alias_set.all|length }})
</a>
</dd>
@ -40,8 +30,8 @@
<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>
<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>
@ -54,17 +44,6 @@
<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>
{% url 'member:user_detail' user_object.pk as user_profile_url %}
{% if request.path_info != user_profile_url %}
<a class="btn btn-sm btn-primary" href="{{ user_profile_url }}">{% trans 'View Profile' %}</a>
{% endif %}
</div>
</div>
{% if user_object.pk == user_object.pk %}
<a class="small float-right text-decoration-none" href="{% url 'member:auth_token' %}">

View File

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

View File

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

View File

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

View File

@ -1,4 +1,7 @@
{% extends "member/base.html" %}
{% comment %}
SPDX-License-Identifier: GPL-3.0-or-later
{% endcomment %}
{% load render_table from django_tables2 %}
{% load i18n perms %}
@ -12,7 +15,7 @@
</div>
{% endif %}
<div class="card">
<div class="card bg-light mb-3">
<div class="card-header position-relative" id="clubListHeading">
<a class="font-weight-bold">
<i class="fa fa-users"></i> {% trans "View my memberships" %}
@ -21,11 +24,9 @@
{% render_table club_list %}
</div>
<hr>
<div class="card">
<div class="card bg-light">
<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 %}>
<i class="fa fa-euro"></i> {% trans "Transaction history" %}
</a>

View File

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

View File

@ -1,16 +1,34 @@
{% extends "member/base.html" %}
{% extends "base.html" %}
{% comment %}
SPDX-License-Identifier: GPL-3.0-or-later
{% endcomment %}
{% load render_table from django_tables2 %}
{% load crispy_forms_tags %}
{% block contenttitle %}{% endblock %}
{% block profile_content %}
{% crispy form %}
{% endblock %}
{# Use a fluid-width container #}
{% block containertype %}container-fluid{% endblock %}
{% block content %}
{{ block.super }}
<div class="row mt-4">
<div class="col-xl-4">
<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 class="col-xl-8">
<div class="card bg-light">
<div id="table">
{% render_table table %}
</div>
</div>
</div>
</div>
{% endblock %}
{% block extrajavascript %}

View File

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