mirror of
https://gitlab.crans.org/bde/nk20
synced 2025-06-20 17:41:55 +02:00
Reorder templates
This commit is contained in:
33
apps/treasury/templates/treasury/invoice_confirm_delete.html
Normal file
33
apps/treasury/templates/treasury/invoice_confirm_delete.html
Normal file
@ -0,0 +1,33 @@
|
||||
{% extends "base.html" %}
|
||||
{% load i18n %}
|
||||
{% load crispy_forms_tags %}
|
||||
|
||||
{% block content %}
|
||||
<div class="card bg-light shadow">
|
||||
<div class="card-header text-center">
|
||||
<h4>{% trans "Delete invoice" %}</h4>
|
||||
</div>
|
||||
{% if object.locked %}
|
||||
<div class="card-body">
|
||||
<div class="alert alert-danger">
|
||||
{% blocktrans %}This invoice is locked and can't be deleted.{% endblocktrans %}
|
||||
</div>
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="card-body">
|
||||
<div class="alert alert-warning">
|
||||
{% blocktrans %}Are you sure you want to delete this invoice? This action can't be undone.{% endblocktrans %}
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="card-footer text-center">
|
||||
<form method="post">
|
||||
{% csrf_token %}
|
||||
<a class="btn btn-primary" href="{% url 'treasury:invoice_list' %}">{% trans "Return to invoices list" %}</a>
|
||||
{% if not object.locked %}
|
||||
<button class="btn btn-danger" type="submit">{% trans "Delete" %}</button>
|
||||
{% endif %}
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
107
apps/treasury/templates/treasury/invoice_form.html
Normal file
107
apps/treasury/templates/treasury/invoice_form.html
Normal file
@ -0,0 +1,107 @@
|
||||
{% 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>
|
||||
|
||||
{% if object.pk and not object.locked %}
|
||||
<div class="alert alert-info">
|
||||
{% blocktrans trimmed %}
|
||||
Warning: the LaTeX template is saved with this object. Updating the invoice implies regenerate it.
|
||||
Be careful if you manipulate old invoices.
|
||||
{% endblocktrans %}
|
||||
</div>
|
||||
{% elif object.locked %}
|
||||
<div class="alert alert-info">
|
||||
{% blocktrans trimmed %}
|
||||
This invoice is locked and can no longer be edited.
|
||||
{% endblocktrans %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<form method="post" action="">
|
||||
{% csrf_token %}
|
||||
{# Render the invoice form #}
|
||||
{% crispy form %}
|
||||
{# 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 }}
|
||||
<table class="table table-condensed table-striped">
|
||||
{# Fill initial data #}
|
||||
{% for form in formset %}
|
||||
{% if forloop.first %}
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{{ form.designation.label }}<span class="asteriskField">*</span></th>
|
||||
<th>{{ form.quantity.label }}<span class="asteriskField">*</span></th>
|
||||
<th>{{ form.amount.label }}<span class="asteriskField">*</span></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="form_body">
|
||||
{% endif %}
|
||||
<tr class="row-formset">
|
||||
<td>{{ form.designation }}</td>
|
||||
<td>{{ form.quantity }}</td>
|
||||
<td>{{ form.amount }}</td>
|
||||
{# These fields are hidden but handled by the formset to link the id and the invoice id #}
|
||||
{{ form.invoice }}
|
||||
{{ form.id }}
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
{# Display buttons to add and remove products #}
|
||||
{% 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="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 id="empty_form" style="display: none;">
|
||||
{# Hidden div that store an empty product form, to be copied into new forms #}
|
||||
<table class='no_error'>
|
||||
<tbody id="for_real">
|
||||
<tr class="row-formset">
|
||||
<td>{{ formset.empty_form.designation }}</td>
|
||||
<td>{{ formset.empty_form.quantity }} </td>
|
||||
<td>{{ formset.empty_form.amount }}</td>
|
||||
{{ formset.empty_form.invoice }}
|
||||
{{ formset.empty_form.id }}
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block extrajavascript %}
|
||||
<script>
|
||||
{# Script that handles add and remove lines #}
|
||||
IDS = {};
|
||||
|
||||
$("#id_products-TOTAL_FORMS").val($(".row-formset").length - 1);
|
||||
|
||||
$('#add_more').click(function () {
|
||||
let form_idx = $('#id_products-TOTAL_FORMS').val();
|
||||
$('#form_body').append($('#for_real').html().replace(/__prefix__/g, form_idx));
|
||||
$('#id_products-TOTAL_FORMS').val(parseInt(form_idx) + 1);
|
||||
$('#id_products-' + parseInt(form_idx) + '-id').val(IDS[parseInt(form_idx)]);
|
||||
});
|
||||
|
||||
$('#remove_one').click(function () {
|
||||
let form_idx = $('#id_products-TOTAL_FORMS').val();
|
||||
if (form_idx > 0) {
|
||||
IDS[parseInt(form_idx) - 1] = $('#id_products-' + (parseInt(form_idx) - 1) + '-id').val();
|
||||
$('#form_body tr:last-child').remove();
|
||||
$('#id_products-TOTAL_FORMS').val(parseInt(form_idx) - 1);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
26
apps/treasury/templates/treasury/invoice_list.html
Normal file
26
apps/treasury/templates/treasury/invoice_list.html
Normal file
@ -0,0 +1,26 @@
|
||||
{% extends "base.html" %}
|
||||
{% load render_table from django_tables2 %}
|
||||
{% load i18n %}
|
||||
{% 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">
|
||||
{% trans "Invoice" %}s
|
||||
</a>
|
||||
<a href="{% url "treasury:remittance_list" %}" class="btn btn-sm btn-outline-primary">
|
||||
{% trans "Remittance" %}s
|
||||
</a>
|
||||
<a href="{% url "treasury:soge_credits" %}" class="btn btn-sm btn-outline-primary">
|
||||
{% trans "Société générale credits" %}
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% render_table table %}
|
||||
|
||||
<a class="btn btn-primary" href="{% url 'treasury:invoice_create' %}">{% trans "New invoice" %}</a>
|
||||
|
||||
{% endblock %}
|
184
apps/treasury/templates/treasury/invoice_sample.tex
Normal file
184
apps/treasury/templates/treasury/invoice_sample.tex
Normal file
@ -0,0 +1,184 @@
|
||||
{% load escape_tex %}
|
||||
|
||||
\nonstopmode
|
||||
\documentclass[11pt]{article}
|
||||
|
||||
\usepackage[french]{babel}
|
||||
\usepackage[T1]{fontenc}
|
||||
\usepackage[utf8]{inputenc}
|
||||
\usepackage[a4paper]{geometry}
|
||||
\usepackage{units}
|
||||
\usepackage{bera}
|
||||
\usepackage{graphicx}
|
||||
\usepackage{fancyhdr}
|
||||
\usepackage{fp}
|
||||
\usepackage{transparent}
|
||||
\usepackage{eso-pic}
|
||||
|
||||
\def\TVA{0} % Taux de la TVA
|
||||
|
||||
\def\TotalHT{0}
|
||||
\def\TotalTVA{0}
|
||||
|
||||
\newcommand{\AjouterProduit}[4]{% Arguments : Désignation, quantité, prix unitaire HT, prix total HT
|
||||
\FPround{\prix}{#3}{2}
|
||||
\FPround{\montant}{#4}{2}
|
||||
\FPadd{\TotalHT}{\TotalHT}{\montant}
|
||||
}
|
||||
|
||||
\newcommand{\AfficheResultat}{%
|
||||
\ListeProduits
|
||||
|
||||
\FPmul{\TotalTVA}{\TotalHT}{\TVA}
|
||||
\FPdiv{\TotalTVA}{\TotalTVA}{100}
|
||||
\FPadd{\TotalTTC}{\TotalHT}{\TotalTVA}
|
||||
\FPround{\TotalHT}{\TotalHT}{2}
|
||||
\FPround{\TotalTVA}{\TotalTVA}{2}
|
||||
\FPround{\TotalTTC}{\TotalTTC}{2}
|
||||
\global\let\TotalHT\TotalHT
|
||||
\global\let\TotalTVA\TotalTVA
|
||||
\global\let\TotalTTC\TotalTTC
|
||||
|
||||
\cr \hline
|
||||
Total HT & & & \TotalHT \cr
|
||||
TVA \TVA~\% & & & \TotalTVA \cr
|
||||
\hline \hline
|
||||
\textbf{Total TTC} & & & \TotalTTC
|
||||
}
|
||||
|
||||
\newcommand {\ListeProduits}{
|
||||
{% for product in products %}
|
||||
{{ product.designation|safe|escape_tex }} & {{ product.amount_euros|safe|escape_tex|floatformat:2 }} & {{ product.quantity|safe|escape_tex|floatformat:2 }} & {{ product.total_euros|safe|escape_tex|floatformat:2 }} \cr
|
||||
{% endfor %}
|
||||
}
|
||||
|
||||
% Logo du BDE
|
||||
\AddToShipoutPicture*{
|
||||
\put(0,0){
|
||||
\parbox[b][\paperheight]{\paperwidth}{%
|
||||
\vfill
|
||||
\centering
|
||||
{\transparent{0.1}\includegraphics[width=\textwidth]{../../static/img/{{ obj.bde }}}}%
|
||||
\vfill
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%% A MODIFIER DANS LA FACTURE %%%%%%%%%%%%%%%%%%%%%
|
||||
% Infos Association
|
||||
\def\MonNom{{"{"}}{{ obj.my_name|safe|escape_tex }}} % Nom de l'association
|
||||
\def\MonAdresseRue{{"{"}}{{ obj.my_address_street|safe|escape_tex }}} % Adresse de l'association
|
||||
\def\MonAdresseVille{{"{"}}{{ obj.my_city|safe|escape_tex }}}
|
||||
|
||||
% Informations bancaires de l'association
|
||||
\def\CodeBanque{{"{"}}{{ obj.bank_code|stringformat:".05d" }}}
|
||||
\def\CodeGuichet{{"{"}}{{ obj.desk_code|stringformat:".05d" }}}
|
||||
\def\NCompte{{"{"}}{{ obj.account_number|stringformat:".011d" }}}
|
||||
\def\CleRib{{"{"}}{{ obj.rib_key|stringformat:".02d" }}}
|
||||
\def\IBAN{FR76\CodeBanque\CodeGuichet\NCompte\CleRib}
|
||||
\def\CodeBic{{"{"}}{{ obj.bic }}}
|
||||
|
||||
\def\FactureNum {{"{"}}{{ obj.id }}} % Numéro de facture
|
||||
\def\FactureAcquittee {% if obj.acquitted %} {oui} {% else %} {non} {% endif %} % Facture acquittée : oui/non
|
||||
\def\FactureLieu {{"{"}}{{ obj.place|safe|escape_tex }}} % Lieu de l'édition de la facture
|
||||
\def\FactureDate {{"{"}}{{ obj.date }}} % Date de l'édition de la facture
|
||||
\def\FactureObjet {{"{"}}{{ obj.object|safe|escape_tex }} } % Objet du document
|
||||
% Description de la facture
|
||||
\def\FactureDescr {{"{"}}{{ obj.description|safe|escape_tex }}}
|
||||
|
||||
% Infos Client
|
||||
\def\ClientNom{{"{"}}{{ obj.name|safe|escape_tex }}} % Nom du client
|
||||
\def\ClientAdresse{{"{"}}{{ obj.address|safe|escape_tex }}} % Adresse du client
|
||||
|
||||
% Liste des produits facturés : Désignation, quantité, prix unitaire HT
|
||||
|
||||
{% for product in products %}
|
||||
\AjouterProduit{{"{"}}{{ product.designation|safe|escape_tex }}} {{"{"}}{{ product.quantity|safe|escape_tex }}} {{"{"}}{{ product.amount_euros|safe|escape_tex }}} {{"{"}}{{ product.total_euros|safe|escape_tex }}}
|
||||
{% endfor %}
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
|
||||
\geometry{verbose,tmargin=4em,bmargin=8em,lmargin=6em,rmargin=6em}
|
||||
\setlength{\parindent}{1pt}
|
||||
\setlength{\parskip}{1ex plus 0.5ex minus 0.2ex}
|
||||
|
||||
\thispagestyle{fancy}
|
||||
\pagestyle{fancy}
|
||||
\setlength{\parindent}{0pt}
|
||||
|
||||
\renewcommand{\headrulewidth}{0pt}
|
||||
\cfoot{
|
||||
\small{\MonNom ~--~ \MonAdresseRue ~ \MonAdresseVille ~--~ Téléphone : +33(0)6 89 88 56 50\newline
|
||||
Site web : bde.ens-cachan.fr ~--~ E-mail : tresorerie.bde@lists.crans.org \newline Numéro SIRET : 399 485 838 00011
|
||||
}
|
||||
}
|
||||
|
||||
\begin{document}
|
||||
|
||||
% Logo de la société
|
||||
% \includegraphics{logo.jpg}
|
||||
|
||||
% Nom et adresse de la société
|
||||
\MonNom \\
|
||||
\MonAdresseRue \\
|
||||
\MonAdresseVille
|
||||
|
||||
Facture n°\FactureNum
|
||||
|
||||
|
||||
{\addtolength{\leftskip}{10.5cm} %in ERT
|
||||
\ClientNom \\
|
||||
\ClientAdresse \\
|
||||
|
||||
} %in ERT
|
||||
|
||||
|
||||
\hspace*{10.5cm}
|
||||
\FactureLieu, le \FactureDate
|
||||
|
||||
~\\~\\
|
||||
|
||||
\textbf{Objet : \FactureObjet \\}
|
||||
|
||||
\textnormal{\FactureDescr}
|
||||
|
||||
~\\
|
||||
|
||||
\begin{center}
|
||||
\begin{tabular}{lrrr}
|
||||
\textbf{Désignation ~~~~~~} & \textbf{Prix unitaire} & \textbf{Quantité} & \textbf{Montant (EUR)} \\
|
||||
\hline
|
||||
\AfficheResultat{}
|
||||
\end{tabular}
|
||||
\end{center}
|
||||
|
||||
~\\
|
||||
|
||||
\ifthenelse{\equal{\FactureAcquittee}{oui}}{
|
||||
Facture acquittée.
|
||||
}{
|
||||
|
||||
À régler par chèque ou par virement bancaire :
|
||||
|
||||
\begin{center}
|
||||
\begin{tabular}{|c c c c|}
|
||||
\hline
|
||||
\textbf{Code banque} & \textbf{Code guichet} & \textbf{N° de Compte} & \textbf{Clé RIB}\\
|
||||
\CodeBanque & \CodeGuichet & \NCompte & \CleRib \\
|
||||
\hline
|
||||
\textbf{IBAN N°} & \multicolumn{3}{|l|} \IBAN \\
|
||||
\hline
|
||||
\textbf{Code BIC} & \multicolumn{3}{|l|}\CodeBic \\
|
||||
\hline
|
||||
\end{tabular}
|
||||
\end{center}
|
||||
|
||||
}
|
||||
|
||||
\begin{center}
|
||||
TVA non applicable, article 293 B du CGI.
|
||||
\end{center}
|
||||
|
||||
\end{document}
|
37
apps/treasury/templates/treasury/remittance_form.html
Normal file
37
apps/treasury/templates/treasury/remittance_form.html
Normal file
@ -0,0 +1,37 @@
|
||||
{% extends "base.html" %}
|
||||
{% load static %}
|
||||
{% 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>
|
||||
|
||||
{% 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>
|
||||
|
||||
<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>
|
||||
{% endif %}
|
||||
|
||||
{% crispy form %}
|
||||
|
||||
<hr>
|
||||
|
||||
<h2>{% trans "Linked transactions" %}</h2>
|
||||
{% if special_transactions.data %}
|
||||
{% render_table special_transactions %}
|
||||
{% else %}
|
||||
<div class="alert alert-warning">
|
||||
{% trans "There is no transaction linked with this remittance." %}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endblock %}
|
65
apps/treasury/templates/treasury/remittance_list.html
Normal file
65
apps/treasury/templates/treasury/remittance_list.html
Normal file
@ -0,0 +1,65 @@
|
||||
{% extends "base.html" %}
|
||||
{% load render_table from django_tables2 %}
|
||||
{% load i18n %}
|
||||
{% 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">
|
||||
{% trans "Invoice" %}s
|
||||
</a>
|
||||
<a href="#" class="btn btn-sm btn-outline-primary active">
|
||||
{% trans "Remittance" %}s
|
||||
</a>
|
||||
<a href="{% url "treasury:soge_credits" %}" class="btn btn-sm btn-outline-primary">
|
||||
{% trans "Société générale credits" %}
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h2>{% trans "Opened remittances" %}</h2>
|
||||
{% if opened_remittances.data %}
|
||||
{% render_table opened_remittances %}
|
||||
{% else %}
|
||||
<div class="alert alert-warning">
|
||||
{% trans "There is no opened remittance." %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<a class="btn btn-primary" href="{% url 'treasury:remittance_create' %}">{% trans "New remittance" %}</a>
|
||||
|
||||
<hr>
|
||||
|
||||
<h2>{% trans "Transfers without remittances" %}</h2>
|
||||
{% if special_transactions_no_remittance.data %}
|
||||
{% render_table special_transactions_no_remittance %}
|
||||
{% else %}
|
||||
<div class="alert alert-warning">
|
||||
{% trans "There is no transaction without any linked remittance." %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<hr>
|
||||
|
||||
<h2>{% trans "Transfers with opened remittances" %}</h2>
|
||||
{% if special_transactions_with_remittance.data %}
|
||||
{% render_table special_transactions_with_remittance %}
|
||||
{% else %}
|
||||
<div class="alert alert-warning">
|
||||
{% trans "There is no transaction with an opened linked remittance." %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<hr>
|
||||
|
||||
<h2>{% trans "Closed remittances" %}</h2>
|
||||
{% if closed_remittances.data %}
|
||||
{% render_table closed_remittances %}
|
||||
{% else %}
|
||||
<div class="alert alert-warning">
|
||||
{% trans "There is no closed remittance yet." %}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endblock %}
|
67
apps/treasury/templates/treasury/sogecredit_detail.html
Normal file
67
apps/treasury/templates/treasury/sogecredit_detail.html
Normal file
@ -0,0 +1,67 @@
|
||||
{% extends "base.html" %}
|
||||
{% load static %}
|
||||
{% load i18n %}
|
||||
{% load pretty_money %}
|
||||
{% load perms %}
|
||||
|
||||
{% block content %}
|
||||
<div class="card bg-light shadow">
|
||||
<div class="card-header text-center">
|
||||
<h4>{% trans "Credit from the Société générale" %}</h4>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<dl class="row">
|
||||
<dt class="col-xl-6 text-right">{% trans 'user'|capfirst %}</dt>
|
||||
<dd class="col-xl-6"><a href="{% url 'member:user_detail' pk=object.user.pk %}">{{ object.user }}</a></dd>
|
||||
|
||||
{% if "note.view_note_balance"|has_perm:object.user.note %}
|
||||
<dt class="col-xl-6 text-right">{% trans 'balance'|capfirst %}</dt>
|
||||
<dd class="col-xl-6">{{ object.user.note.balance|pretty_money }}</dd>
|
||||
{% endif %}
|
||||
|
||||
<dt class="col-xl-6 text-right">{% trans 'transactions'|capfirst %}</dt>
|
||||
<dd class="col-xl-6">
|
||||
{% for transaction in object.transactions.all %}
|
||||
{{ transaction.membership.club }} ({{ transaction.amount|pretty_money }})<br>
|
||||
{% endfor %}
|
||||
</dd>
|
||||
|
||||
<dt class="col-xl-6 text-right">{% trans 'total amount'|capfirst %}</dt>
|
||||
<dd class="col-xl-6">{{ object.amount|pretty_money }}</dd>
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
<div class="alert alert-warning">
|
||||
{% trans 'Warning: Validating this credit implies that all membership transactions will be validated.' %}
|
||||
{% trans 'If you delete this credit, there all membership transactions will be also validated, but no credit will be operated.' %}
|
||||
{% trans "If this credit is validated, then the user won't be able to ask for a credit from the Société générale." %}
|
||||
{% trans 'If you think there is an error, please contact the "respos info".' %}
|
||||
</div>
|
||||
|
||||
<div class="card-footer text-center" id="buttons_footer">
|
||||
{% if object.valid %}
|
||||
<div class="alert alert-danger">
|
||||
{% trans "This credit is already validated." %}
|
||||
</div>
|
||||
{% else %}
|
||||
{% if object.user.note.balance < object.amount %}
|
||||
<div class="alert alert-warning">
|
||||
{% trans "Warning: if you don't validate this credit, the note of the user doesn't have enough money to pay its memberships." %}
|
||||
{% trans "Please ask the user to credit its note before deleting this credit." %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<form method="post">
|
||||
{% csrf_token %}
|
||||
<div class="btn-group btn-block">
|
||||
<button name="validate" class="btn btn-success">{% trans "Validate" %}</button>
|
||||
{% if object.user.note.balance >= object.amount %}
|
||||
<button name="delete" class="btn btn-danger">{% trans "Delete" %}</button>
|
||||
{% endif %}
|
||||
</div>
|
||||
</form>
|
||||
{% endif %}
|
||||
<a href="{% url 'treasury:soge_credits' %}"><button class="btn btn-primary btn-block">{% trans "Return to credit list" %}</button></a>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
66
apps/treasury/templates/treasury/sogecredit_list.html
Normal file
66
apps/treasury/templates/treasury/sogecredit_list.html
Normal file
@ -0,0 +1,66 @@
|
||||
{% extends "base.html" %}
|
||||
{% load render_table from django_tables2 %}
|
||||
{% load i18n %}
|
||||
{% 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">
|
||||
{% trans "Invoice" %}s
|
||||
</a>
|
||||
<a href="{% url "treasury:remittance_list" %}" class="btn btn-sm btn-outline-primary">
|
||||
{% trans "Remittance" %}s
|
||||
</a>
|
||||
<a href="#" class="btn btn-sm btn-outline-primary active">
|
||||
{% trans "Société générale credits" %}
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<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">
|
||||
<input id="invalid_only" name="invalid_only" type="checkbox" class="checkboxinput form-check-input">
|
||||
{% trans "Filter with unvalidated credits only" %}
|
||||
</label>
|
||||
</div>
|
||||
<hr>
|
||||
|
||||
<div id="credits_table">
|
||||
{% if table.data %}
|
||||
{% render_table table %}
|
||||
{% else %}
|
||||
<div class="alert alert-warning">
|
||||
{% trans "There is no matched user that have asked for a Société générale credit." %}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block extrajavascript %}
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
let old_pattern = null;
|
||||
let searchbar_obj = $("#searchbar");
|
||||
let invalid_only_obj = $("#invalid_only");
|
||||
|
||||
function reloadTable() {
|
||||
let pattern = searchbar_obj.val();
|
||||
|
||||
if (pattern === old_pattern || pattern === "")
|
||||
return;
|
||||
|
||||
$("#credits_table").load(location.pathname + "?search=" + pattern.replace(" ", "%20") + (invalid_only_obj.is(':checked') ? "&valid=false" : "") + " #credits_table");
|
||||
|
||||
$(".table-row").click(function() {
|
||||
window.document.location = $(this).data("href");
|
||||
});
|
||||
}
|
||||
|
||||
searchbar_obj.keyup(reloadTable);
|
||||
invalid_only_obj.change(reloadTable);
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
@ -0,0 +1,9 @@
|
||||
{% extends "base.html" %}
|
||||
{% load static %}
|
||||
{% load i18n %}
|
||||
{% load crispy_forms_tags pretty_money %}
|
||||
{% load render_table from django_tables2 %}
|
||||
{% block content %}
|
||||
<p><a class="btn btn-default" href="{% url 'treasury:remittance_list' %}">{% trans "Remittances list" %}</a></p>
|
||||
{% crispy form %}
|
||||
{% endblock %}
|
Reference in New Issue
Block a user