mirror of
https://gitlab.crans.org/bde/nk20
synced 2024-12-22 23:42:25 +00:00
Simplify future user search
This commit is contained in:
parent
891955cedf
commit
9cad8fcc65
@ -1,33 +1,43 @@
|
||||
{% extends "base.html" %}
|
||||
{% load static %}
|
||||
{% load i18n %}
|
||||
{% load crispy_forms_tags %}
|
||||
{% comment %}
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
{% endcomment %}
|
||||
{% load i18n crispy_forms_tags %}
|
||||
{% block contenttitle %}{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<form method="post">
|
||||
{% csrf_token %}
|
||||
{{form|crispy}}
|
||||
<button class="btn btn-primary" type="submit">{% trans "Submit" %}</button>
|
||||
</form>
|
||||
<div class="card bg-light">
|
||||
<h3 class="card-header text-center">
|
||||
{{ title }}
|
||||
</h3>
|
||||
<div class="card-body">
|
||||
<form method="post">
|
||||
{% csrf_token %}
|
||||
{{ form|crispy }}
|
||||
<button class="btn btn-primary" type="submit">{% trans "Submit" %}</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block extrajavascript %}
|
||||
<script>
|
||||
require_memberships_obj = $("#id_require_memberships");
|
||||
<script>
|
||||
require_memberships_obj = $("#id_require_memberships");
|
||||
|
||||
if (!require_memberships_obj.is(":checked")) {
|
||||
$("#div_id_membership_fee_paid").toggle();
|
||||
$("#div_id_membership_fee_unpaid").toggle();
|
||||
$("#div_id_membership_duration").toggle();
|
||||
$("#div_id_membership_start").toggle();
|
||||
$("#div_id_membership_end").toggle();
|
||||
}
|
||||
if (!require_memberships_obj.is(":checked")) {
|
||||
$("#div_id_membership_fee_paid").toggle();
|
||||
$("#div_id_membership_fee_unpaid").toggle();
|
||||
$("#div_id_membership_duration").toggle();
|
||||
$("#div_id_membership_start").toggle();
|
||||
$("#div_id_membership_end").toggle();
|
||||
}
|
||||
|
||||
require_memberships_obj.change(function () {
|
||||
$("#div_id_membership_fee_paid").toggle();
|
||||
$("#div_id_membership_fee_unpaid").toggle();
|
||||
$("#div_id_membership_duration").toggle();
|
||||
$("#div_id_membership_start").toggle();
|
||||
$("#div_id_membership_end").toggle();
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
||||
require_memberships_obj.change(function () {
|
||||
$("#div_id_membership_fee_paid").toggle();
|
||||
$("#div_id_membership_fee_unpaid").toggle();
|
||||
$("#div_id_membership_duration").toggle();
|
||||
$("#div_id_membership_start").toggle();
|
||||
$("#div_id_membership_end").toggle();
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
@ -1,53 +1,16 @@
|
||||
{% extends "base.html" %}
|
||||
{% extends "base_search.html" %}
|
||||
{% comment %}
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
{% endcomment %}
|
||||
{% load render_table from django_tables2 %}
|
||||
{% load crispy_forms_tags %}
|
||||
{% load i18n %}
|
||||
|
||||
{% block content %}
|
||||
<a href="{% url 'registration:signup' %}"><button class="btn btn-primary btn-block">{% trans "New user" %}</button></a>
|
||||
<hr>
|
||||
<input id="searchbar" type="text" class="form-control" placeholder="Nom/prénom/note/section ...">
|
||||
<hr>
|
||||
<a class="btn btn-block btn-success mb-3" href="{% url 'registration:signup' %}">
|
||||
{% trans "New user" %}
|
||||
</a>
|
||||
|
||||
<div id="user_table">
|
||||
{% if table.data %}
|
||||
{% render_table table %}
|
||||
{% else %}
|
||||
<div class="alert alert-warning">
|
||||
{% trans "There is no pending user with this pattern." %}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block extrajavascript %}
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
let old_pattern = null;
|
||||
let searchbar_obj = $("#searchbar");
|
||||
|
||||
function reloadTable() {
|
||||
let pattern = searchbar_obj.val();
|
||||
|
||||
if (pattern === old_pattern || pattern === "")
|
||||
return;
|
||||
|
||||
$("#user_table").load(location.pathname + "?search=" + pattern.replace(" ", "%20") + " #user_table", init);
|
||||
|
||||
$(".table-row").click(function() {
|
||||
window.document.location = $(this).data("href");
|
||||
});
|
||||
}
|
||||
|
||||
searchbar_obj.keyup(reloadTable);
|
||||
|
||||
function init() {
|
||||
$(".table-row").click(function() {
|
||||
window.document.location = $(this).data("href");
|
||||
});
|
||||
}
|
||||
|
||||
init();
|
||||
});
|
||||
</script>
|
||||
{# Search panel #}
|
||||
{{ block.super }}
|
||||
{% endblock %}
|
||||
|
Loading…
Reference in New Issue
Block a user