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 %}
{% block content %}
<div class="card bg-light shadow">
<div class="card bg-light">
<div class="card-header text-center">
<h4>{% trans "Delete invoice" %}</h4>
</div>

View File

@ -1,10 +1,16 @@
{% extends "base.html" %}
{% load static %}
{% load i18n %}
{% load crispy_forms_tags %}
{% block content %}
<p><a class="btn btn-default" href="{% url 'treasury:invoice_list' %}">{% trans "Invoices list" %}</a></p>
{% comment %}
SPDX-License-Identifier: GPL-3.0-or-later
{% endcomment %}
{% load i18n crispy_forms_tags %}
{% 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 %}
<div class="alert alert-info">
{% blocktrans trimmed %}
@ -19,11 +25,16 @@
{% endblocktrans %}
</div>
{% endif %}
</div>
<form method="post" action="">
{% csrf_token %}
{# Render the invoice form #}
<div class="card-body">
{% crispy form %}
</div>
{# The next part concerns the product formset #}
{# Generate some hidden fields that manage the number of products, and make easier the parsing #}
{{ formset.management_form }}
@ -53,20 +64,21 @@
</table>
{# Display buttons to add and remove products #}
<div class="card-body">
{% if not object.locked %}
<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>
</div>
{% endif %}
<div class="btn-block">
<button type="submit" class="btn btn-block btn-primary">{% trans "Submit" %}</button>
</div>
</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'>
<tbody id="for_real">
<tr class="row-formset">
@ -78,12 +90,12 @@
</tr>
</tbody>
</table>
</div>
</div>
{% endblock %}
{% block extrajavascript %}
<script>
{# Script that handles add and remove lines #}
<script>
/* script that handles add and remove lines */
IDS = {};
$("#id_products-TOTAL_FORMS").val($(".row-formset").length - 1);
@ -103,5 +115,5 @@
$('#id_products-TOTAL_FORMS').val(parseInt(form_idx) - 1);
}
});
</script>
</script>
{% endblock %}

View File

@ -1,9 +1,13 @@
{% extends "base.html" %}
{% comment %}
SPDX-License-Identifier: GPL-3.0-or-later
{% endcomment %}
{% load render_table from django_tables2 %}
{% load i18n %}
{% block content %}
{% block contenttitle %}{% endblock %}
<div class="row">
{% 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="#" class="btn btn-sm btn-outline-primary active">
@ -17,10 +21,15 @@
</a>
</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>
{% render_table table %}
<a class="btn btn-primary" href="{% url 'treasury:invoice_create' %}">{% trans "New invoice" %}</a>
</div>
{% endblock %}

View File

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

View File

@ -1,9 +1,13 @@
{% extends "base.html" %}
{% comment %}
SPDX-License-Identifier: GPL-3.0-or-later
{% endcomment %}
{% load render_table from django_tables2 %}
{% load i18n %}
{% block content %}
{% block contenttitle %}{% endblock %}
<div class="row">
{% 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">
@ -17,49 +21,68 @@
</a>
</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 %}
{% render_table opened_remittances %}
{% else %}
<div class="card-body">
<div class="alert alert-warning">
{% trans "There is no opened remittance." %}
</div>
</div>
{% 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>
<hr>
<h2>{% trans "Transfers without remittances" %}</h2>
<div class="card bg-white mb-3">
<h3 class="card-header text-center">
{% trans "Transfers without remittances" %}
</h3>
{% if special_transactions_no_remittance.data %}
{% render_table special_transactions_no_remittance %}
{% else %}
<div class="card-body">
<div class="alert alert-warning">
{% trans "There is no transaction without any linked remittance." %}
</div>
</div>
{% endif %}
</div>
<hr>
<h2>{% trans "Transfers with opened remittances" %}</h2>
<div class="card bg-white mb-3">
<h3 class="card-header text-center">
{% trans "Transfers with opened remittances" %}
</h3>
{% if special_transactions_with_remittance.data %}
{% render_table special_transactions_with_remittance %}
{% else %}
<div class="card-body">
<div class="alert alert-warning">
{% trans "There is no transaction with an opened linked remittance." %}
</div>
</div>
{% endif %}
</div>
<hr>
<h2>{% trans "Closed remittances" %}</h2>
<div class="card bg-white mb-3">
<h3 class="card-header text-center">
{% trans "Closed remittances" %}
</h3>
{% if closed_remittances.data %}
{% render_table closed_remittances %}
{% else %}
<div class="card-body">
<div class="alert alert-warning">
{% trans "There is no closed remittance yet." %}
</div>
</div>
{% endif %}
</div>
{% endblock %}

View File

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

@ -1,9 +1,13 @@
{% extends "base.html" %}
{% comment %}
SPDX-License-Identifier: GPL-3.0-or-later
{% endcomment %}
{% load render_table from django_tables2 %}
{% load i18n %}
{% block content %}
{% block contenttitle %}{% endblock %}
<div class="row">
{% 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">
@ -17,8 +21,13 @@
</a>
</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 ...">
<div class="form-check">
<label for="invalid_only" class="form-check-label">
@ -26,22 +35,24 @@
{% trans "Filter with unvalidated credits only" %}
</label>
</div>
<hr>
</div>
<div id="credits_table">
{% if table.data %}
{% render_table table %}
{% else %}
<div class="card-body">
<div class="alert alert-warning">
{% trans "There is no matched user that have asked for a Société générale credit." %}
</div>
</div>
{% endif %}
</div>
</div>
{% endblock %}
{% block extrajavascript %}
<script type="text/javascript">
$(document).ready(function() {
$(document).ready(function () {
let old_pattern = null;
let searchbar_obj = $("#searchbar");
let invalid_only_obj = $("#invalid_only");
@ -52,9 +63,10 @@
if (pattern === old_pattern || pattern === "")
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");
});
}

View File

@ -1,9 +1,17 @@
{% extends "base.html" %}
{% load static %}
{% load i18n %}
{% load crispy_forms_tags pretty_money %}
{% load render_table from django_tables2 %}
{% comment %}
SPDX-License-Identifier: GPL-3.0-or-later
{% endcomment %}
{% load crispy_forms_tags %}
{% block contenttitle %}{% endblock %}
{% 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 %}
</div>
</div>
{% endblock %}