Cards for all treasury

This commit is contained in:
Alexandre Iooss 2020-08-25 18:10:21 +02:00
parent 5ba18a2d89
commit bca301700d
8 changed files with 298 additions and 222 deletions

View File

@ -3,7 +3,7 @@
{% load crispy_forms_tags %} {% load crispy_forms_tags %}
{% block content %} {% block content %}
<div class="card bg-light shadow"> <div class="card bg-light">
<div class="card-header text-center"> <div class="card-header text-center">
<h4>{% trans "Delete invoice" %}</h4> <h4>{% trans "Delete invoice" %}</h4>
</div> </div>

View File

@ -1,10 +1,16 @@
{% extends "base.html" %} {% extends "base.html" %}
{% load static %} {% comment %}
{% load i18n %} SPDX-License-Identifier: GPL-3.0-or-later
{% load crispy_forms_tags %} {% endcomment %}
{% block content %} {% load i18n crispy_forms_tags %}
<p><a class="btn btn-default" href="{% url 'treasury:invoice_list' %}">{% trans "Invoices list" %}</a></p> {% block contenttitle %}{% endblock %}
{% block content %}
<div class="card bg-white mb-3">
<h3 class="card-header text-center">
{{ title }}
</h3>
<div class="card-body">
{% if object.pk and not object.locked %} {% if object.pk and not object.locked %}
<div class="alert alert-info"> <div class="alert alert-info">
{% blocktrans trimmed %} {% blocktrans trimmed %}
@ -19,11 +25,16 @@
{% endblocktrans %} {% endblocktrans %}
</div> </div>
{% endif %} {% endif %}
</div>
<form method="post" action=""> <form method="post" action="">
{% csrf_token %} {% csrf_token %}
{# Render the invoice form #} {# Render the invoice form #}
<div class="card-body">
{% crispy form %} {% crispy form %}
</div>
{# The next part concerns the product formset #} {# The next part concerns the product formset #}
{# Generate some hidden fields that manage the number of products, and make easier the parsing #} {# Generate some hidden fields that manage the number of products, and make easier the parsing #}
{{ formset.management_form }} {{ formset.management_form }}
@ -53,20 +64,21 @@
</table> </table>
{# Display buttons to add and remove products #} {# Display buttons to add and remove products #}
<div class="card-body">
{% if not object.locked %} {% if not object.locked %}
<div class="btn-group btn-block" role="group"> <div class="btn-group btn-block" role="group">
<button type="button" id="add_more" class="btn btn-primary">{% trans "Add product" %}</button> <button type="button" id="add_more" class="btn btn-success">{% trans "Add product" %}</button>
<button type="button" id="remove_one" class="btn btn-danger">{% trans "Remove product" %}</button> <button type="button" id="remove_one" class="btn btn-danger">{% trans "Remove product" %}</button>
</div> </div>
{% endif %} {% endif %}
<div class="btn-block">
<button type="submit" class="btn btn-block btn-primary">{% trans "Submit" %}</button> <button type="submit" class="btn btn-block btn-primary">{% trans "Submit" %}</button>
</div> </div>
</form> </form>
</div>
<div id="empty_form" style="display: none;"> {# Hidden div that store an empty product form, to be copied into new forms #}
{# Hidden div that store an empty product form, to be copied into new forms #} <div id="empty_form" style="display: none;">
<table class='no_error'> <table class='no_error'>
<tbody id="for_real"> <tbody id="for_real">
<tr class="row-formset"> <tr class="row-formset">
@ -78,12 +90,12 @@
</tr> </tr>
</tbody> </tbody>
</table> </table>
</div> </div>
{% endblock %} {% endblock %}
{% block extrajavascript %} {% block extrajavascript %}
<script> <script>
{# Script that handles add and remove lines #} /* script that handles add and remove lines */
IDS = {}; IDS = {};
$("#id_products-TOTAL_FORMS").val($(".row-formset").length - 1); $("#id_products-TOTAL_FORMS").val($(".row-formset").length - 1);
@ -103,5 +115,5 @@
$('#id_products-TOTAL_FORMS').val(parseInt(form_idx) - 1); $('#id_products-TOTAL_FORMS').val(parseInt(form_idx) - 1);
} }
}); });
</script> </script>
{% endblock %} {% endblock %}

View File

@ -1,9 +1,13 @@
{% extends "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 i18n %} {% load i18n %}
{% block content %} {% block contenttitle %}{% endblock %}
<div class="row"> {% block content %}
<div class="row">
<div class="col-xl-12"> <div class="col-xl-12">
<div class="btn-group btn-group-toggle" style="width: 100%; padding: 0 0 2em 0" data-toggle="buttons"> <div class="btn-group btn-group-toggle" style="width: 100%; padding: 0 0 2em 0" data-toggle="buttons">
<a href="#" class="btn btn-sm btn-outline-primary active"> <a href="#" class="btn btn-sm btn-outline-primary active">
@ -17,10 +21,15 @@
</a> </a>
</div> </div>
</div> </div>
</div>
<div class="card bg-white mb-3">
<h3 class="card-header text-center">
{{ title }}
</h3>
{% render_table table %}
<div class="card-footer">
<a class="btn btn-sm btn-success" href="{% url 'treasury:invoice_create' %}">{% trans "New invoice" %}</a>
</div> </div>
</div>
{% render_table table %}
<a class="btn btn-primary" href="{% url 'treasury:invoice_create' %}">{% trans "New invoice" %}</a>
{% endblock %} {% endblock %}

View File

@ -1,37 +1,47 @@
{% extends "base.html" %} {% extends "base.html" %}
{% load static %} {% comment %}
SPDX-License-Identifier: GPL-3.0-or-later
{% endcomment %}
{% load i18n %} {% load i18n %}
{% load crispy_forms_tags pretty_money %} {% load crispy_forms_tags pretty_money %}
{% load render_table from django_tables2 %} {% load render_table from django_tables2 %}
{% block content %} {% block content %}
<h1>{% trans "Remittance #" %}{{ object.pk }}</h1> <div class="card bg-white mb-3">
<h3 class="card-header text-center">
<p><a class="btn btn-default" href="{% url 'treasury:remittance_list' %}">{% trans "Remittances list" %}</a></p> {% trans "Remittance #" %}{{ object.pk }}
</h3>
<div class="card-body">
{% if object.pk %} {% if object.pk %}
<div id="div_id_type" class="form-group"><label for="id_count" class="col-form-label">{% trans "Count" %}</label> <div id="div_id_type">
<div class=""> <label for="id_count" class="col-form-label">{% trans "Count" %}</label>
<input type="text" name="count" value="{{ object.count }}" class="textinput textInput form-control" id="id_count" disabled> <input type="text" name="count" value="{{ object.count }}" class="textinput textInput form-control"
</div> id="id_count" disabled>
</div> </div>
<div id="div_id_type" class="form-group"><label for="id_amount" class="col-form-label">{% trans "Amount" %}</label> <div id="div_id_type">
<div class=""> <label for="id_amount" class="col-form-label">{% trans "Amount" %}</label>
<input class="textinput textInput form-control" type="text" value="{{ object.amount|pretty_money }}" id="id_amount" disabled> <input class="textinput textInput form-control" type="text" value="{{ object.amount|pretty_money }}"
</div> id="id_amount" disabled>
</div> </div>
{% endif %} {% endif %}
{% crispy form %} {% crispy form %}
</div>
</div>
<hr> <div class="card bg-white mb-3">
<h3 class="card-header text-center">
<h2>{% trans "Linked transactions" %}</h2> {% trans "Linked transactions" %}
</h3>
{% if special_transactions.data %} {% if special_transactions.data %}
{% render_table special_transactions %} {% render_table special_transactions %}
{% else %} {% else %}
<div class="card-body">
<div class="alert alert-warning"> <div class="alert alert-warning">
{% trans "There is no transaction linked with this remittance." %} {% trans "There is no transaction linked with this remittance." %}
</div> </div>
</div>
{% endif %} {% endif %}
</div>
{% endblock %} {% endblock %}

View File

@ -1,9 +1,13 @@
{% extends "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 i18n %} {% load i18n %}
{% block content %} {% block contenttitle %}{% endblock %}
<div class="row"> {% block content %}
<div class="row">
<div class="col-xl-12"> <div class="col-xl-12">
<div class="btn-group btn-group-toggle" style="width: 100%; padding: 0 0 2em 0" data-toggle="buttons"> <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"> <a href="{% url "treasury:invoice_list" %}" class="btn btn-sm btn-outline-primary">
@ -17,49 +21,68 @@
</a> </a>
</div> </div>
</div> </div>
</div> </div>
<h2>{% trans "Opened remittances" %}</h2> <div class="card bg-white mb-3">
<h3 class="card-header text-center">
{% trans "Opened remittances" %}
</h3>
{% if opened_remittances.data %} {% if opened_remittances.data %}
{% render_table opened_remittances %} {% render_table opened_remittances %}
{% else %} {% else %}
<div class="card-body">
<div class="alert alert-warning"> <div class="alert alert-warning">
{% trans "There is no opened remittance." %} {% trans "There is no opened remittance." %}
</div> </div>
</div>
{% endif %} {% endif %}
<div class="card-footer">
<a class="btn btn-sm btn-success" href="{% url 'treasury:remittance_create' %}">{% trans "New remittance" %}</a>
</div>
</div>
<a class="btn btn-primary" href="{% url 'treasury:remittance_create' %}">{% trans "New remittance" %}</a> <div class="card bg-white mb-3">
<h3 class="card-header text-center">
<hr> {% trans "Transfers without remittances" %}
</h3>
<h2>{% trans "Transfers without remittances" %}</h2>
{% if special_transactions_no_remittance.data %} {% if special_transactions_no_remittance.data %}
{% render_table special_transactions_no_remittance %} {% render_table special_transactions_no_remittance %}
{% else %} {% else %}
<div class="card-body">
<div class="alert alert-warning"> <div class="alert alert-warning">
{% trans "There is no transaction without any linked remittance." %} {% trans "There is no transaction without any linked remittance." %}
</div> </div>
</div>
{% endif %} {% endif %}
</div>
<hr> <div class="card bg-white mb-3">
<h3 class="card-header text-center">
<h2>{% trans "Transfers with opened remittances" %}</h2> {% trans "Transfers with opened remittances" %}
</h3>
{% if special_transactions_with_remittance.data %} {% if special_transactions_with_remittance.data %}
{% render_table special_transactions_with_remittance %} {% render_table special_transactions_with_remittance %}
{% else %} {% else %}
<div class="card-body">
<div class="alert alert-warning"> <div class="alert alert-warning">
{% trans "There is no transaction with an opened linked remittance." %} {% trans "There is no transaction with an opened linked remittance." %}
</div> </div>
</div>
{% endif %} {% endif %}
</div>
<hr> <div class="card bg-white mb-3">
<h3 class="card-header text-center">
<h2>{% trans "Closed remittances" %}</h2> {% trans "Closed remittances" %}
</h3>
{% if closed_remittances.data %} {% if closed_remittances.data %}
{% render_table closed_remittances %} {% render_table closed_remittances %}
{% else %} {% else %}
<div class="card-body">
<div class="alert alert-warning"> <div class="alert alert-warning">
{% trans "There is no closed remittance yet." %} {% trans "There is no closed remittance yet." %}
</div> </div>
</div>
{% endif %} {% endif %}
</div>
{% endblock %} {% endblock %}

View File

@ -1,11 +1,12 @@
{% extends "base.html" %} {% extends "base.html" %}
{% load static %} {% comment %}
{% load i18n %} SPDX-License-Identifier: GPL-3.0-or-later
{% load pretty_money %} {% endcomment %}
{% load perms %} {% load i18n pretty_money perms %}
{% block contenttitle %}{% endblock %}
{% block content %} {% block content %}
<div class="card bg-light shadow"> <div class="card bg-light">
<div class="card-header text-center"> <div class="card-header text-center">
<h4>{% trans "Credit from the Société générale" %}</h4> <h4>{% trans "Credit from the Société générale" %}</h4>
</div> </div>
@ -61,7 +62,8 @@
</div> </div>
</form> </form>
{% endif %} {% endif %}
<a href="{% url 'treasury:soge_credits' %}"><button class="btn btn-primary btn-block">{% trans "Return to credit list" %}</button></a> <a href="{% url 'treasury:soge_credits' %}"><button
</div> class="btn btn-primary btn-block">{% trans "Return to credit list" %}</button></a>
</div> </div>
</div>
{% endblock %} {% endblock %}

View File

@ -1,9 +1,13 @@
{% extends "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 i18n %} {% load i18n %}
{% block content %} {% block contenttitle %}{% endblock %}
<div class="row"> {% block content %}
<div class="row">
<div class="col-xl-12"> <div class="col-xl-12">
<div class="btn-group btn-group-toggle" style="width: 100%; padding: 0 0 2em 0" data-toggle="buttons"> <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"> <a href="{% url "treasury:invoice_list" %}" class="btn btn-sm btn-outline-primary">
@ -17,8 +21,13 @@
</a> </a>
</div> </div>
</div> </div>
</div> </div>
<div class="card bg-white mb-3">
<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 ..."> <input id="searchbar" type="text" class="form-control" placeholder="Nom/prénom/note ...">
<div class="form-check"> <div class="form-check">
<label for="invalid_only" class="form-check-label"> <label for="invalid_only" class="form-check-label">
@ -26,22 +35,24 @@
{% trans "Filter with unvalidated credits only" %} {% trans "Filter with unvalidated credits only" %}
</label> </label>
</div> </div>
<hr> </div>
<div id="credits_table"> <div id="credits_table">
{% if table.data %} {% if table.data %}
{% render_table table %} {% render_table table %}
{% else %} {% else %}
<div class="card-body">
<div class="alert alert-warning"> <div class="alert alert-warning">
{% trans "There is no matched user that have asked for a Société générale credit." %} {% trans "There is no matched user that have asked for a Société générale credit." %}
</div> </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 old_pattern = null; let old_pattern = null;
let searchbar_obj = $("#searchbar"); let searchbar_obj = $("#searchbar");
let invalid_only_obj = $("#invalid_only"); let invalid_only_obj = $("#invalid_only");
@ -52,9 +63,10 @@
if (pattern === old_pattern || pattern === "") if (pattern === old_pattern || pattern === "")
return; return;
$("#credits_table").load(location.pathname + "?search=" + pattern.replace(" ", "%20") + (invalid_only_obj.is(':checked') ? "&valid=false" : "") + " #credits_table"); $("#credits_table").load(location.pathname + "?search=" + pattern.replace(" ", "%20") + (
invalid_only_obj.is(':checked') ? "&valid=false" : "") + " #credits_table");
$(".table-row").click(function() { $(".table-row").click(function () {
window.document.location = $(this).data("href"); window.document.location = $(this).data("href");
}); });
} }

View File

@ -1,9 +1,17 @@
{% extends "base.html" %} {% extends "base.html" %}
{% load static %} {% comment %}
{% load i18n %} SPDX-License-Identifier: GPL-3.0-or-later
{% load crispy_forms_tags pretty_money %} {% endcomment %}
{% load render_table from django_tables2 %} {% load crispy_forms_tags %}
{% block contenttitle %}{% endblock %}
{% block content %} {% block content %}
<p><a class="btn btn-default" href="{% url 'treasury:remittance_list' %}">{% trans "Remittances list" %}</a></p> <div class="card bg-white mb-3">
<h3 class="card-header text-center">
{{ title }}
</h3>
<div class="card-body">
{% crispy form %} {% crispy form %}
</div>
</div>
{% endblock %} {% endblock %}