mirror of
https://gitlab.crans.org/bde/nk20
synced 2025-02-24 09:01:18 +00:00
Compare commits
17 Commits
3f3d807ea1
...
a0ae7c46e4
Author | SHA1 | Date | |
---|---|---|---|
|
a0ae7c46e4 | ||
|
7afd15b1cc | ||
|
258361f116 | ||
|
5de930bf40 | ||
|
f7ebe0e99b | ||
|
73de6e2176 | ||
|
40c239e9da | ||
|
2aaab2b454 | ||
|
fc088dec86 | ||
|
ffac940511 | ||
|
e6f3084588 | ||
|
145e55da75 | ||
|
d3ba95cdca | ||
|
8ffb0ebb56 | ||
|
5038af9e34 | ||
|
819b4214c9 | ||
|
b8a93b0b75 |
@ -38,6 +38,7 @@ SPDX-License-Identifier: GPL-3.0-or-later
|
|||||||
</a>
|
</a>
|
||||||
|
|
||||||
<input id="alias" type="text" class="form-control" placeholder="Nom/note ...">
|
<input id="alias" type="text" class="form-control" placeholder="Nom/note ...">
|
||||||
|
<button id="trigger" class="btn btn-secondary">Click me !</button>
|
||||||
|
|
||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
@ -63,15 +64,46 @@ SPDX-License-Identifier: GPL-3.0-or-later
|
|||||||
refreshBalance();
|
refreshBalance();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function process_qrcode() {
|
||||||
|
let name = alias_obj.val();
|
||||||
|
$.get("/api/note/note?search=" + name + "&format=json").done(
|
||||||
|
function (res) {
|
||||||
|
let note = res.results[0];
|
||||||
|
$.post("/api/activity/entry/?format=json", {
|
||||||
|
csrfmiddlewaretoken: CSRF_TOKEN,
|
||||||
|
activity: {{ activity.id }},
|
||||||
|
note: note.id,
|
||||||
|
guest: null
|
||||||
|
}).done(function () {
|
||||||
|
addMsg(interpolate(gettext(
|
||||||
|
"Entry made for %s whose balance is %s €"),
|
||||||
|
[note.name, note.balance / 100]), "success", 4000);
|
||||||
|
reloadTable(true);
|
||||||
|
}).fail(function (xhr) {
|
||||||
|
errMsg(xhr.responseJSON, 4000);
|
||||||
|
});
|
||||||
|
}).fail(function (xhr) {
|
||||||
|
errMsg(xhr.responseJSON, 4000);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
alias_obj.keyup(function(event) {
|
alias_obj.keyup(function(event) {
|
||||||
let code = event.originalEvent.keyCode
|
let code = event.originalEvent.keyCode
|
||||||
if (65 <= code <= 122 || code === 13) {
|
if (65 <= code <= 122 || code === 13) {
|
||||||
debounce(reloadTable)()
|
debounce(reloadTable)()
|
||||||
}
|
}
|
||||||
|
if (code === 0)
|
||||||
|
process_qrcode();
|
||||||
});
|
});
|
||||||
|
|
||||||
$(document).ready(init);
|
$(document).ready(init);
|
||||||
|
|
||||||
|
alias_obj2 = document.getElementById("alias");
|
||||||
|
$("#trigger").click(function (e) {
|
||||||
|
addMsg("Clicked", "success", 1000);
|
||||||
|
alias_obj.val(alias_obj.val() + "\0");
|
||||||
|
alias_obj2.dispatchEvent(new KeyboardEvent('keyup'));
|
||||||
|
})
|
||||||
function init() {
|
function init() {
|
||||||
$(".table-row").click(function (e) {
|
$(".table-row").click(function (e) {
|
||||||
let target = e.target.parentElement;
|
let target = e.target.parentElement;
|
||||||
@ -168,4 +200,4 @@ SPDX-License-Identifier: GPL-3.0-or-later
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@ -60,7 +60,10 @@
|
|||||||
{% if user_object.pk == user.pk %}
|
{% if user_object.pk == user.pk %}
|
||||||
<div class="text-center">
|
<div class="text-center">
|
||||||
<a class="small badge badge-secondary" href="{% url 'member:auth_token' %}">
|
<a class="small badge badge-secondary" href="{% url 'member:auth_token' %}">
|
||||||
<i class="fa fa-cogs"></i>{% trans 'API token' %}
|
<i class="fa fa-cogs"></i> {% trans 'API token' %}
|
||||||
|
</a>
|
||||||
|
<a class="small badge badge-secondary" href="{% url 'member:qr_code' user_object.pk %}">
|
||||||
|
<i class="fa fa-qrcode"></i> {% trans 'QR Code' %}
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
36
apps/member/templates/member/qr_code.html
Normal file
36
apps/member/templates/member/qr_code.html
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
{% extends "base.html" %}
|
||||||
|
{% comment %}
|
||||||
|
SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
{% endcomment %}
|
||||||
|
{% load i18n %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<div class="card bg-light">
|
||||||
|
<h3 class="card-header text-center">
|
||||||
|
{% trans "QR Code for" %} {{ user_object.username }} ({{ user_object.first_name }} {{user_object.last_name }})
|
||||||
|
</h3>
|
||||||
|
<div class="text-center" id="qrcode">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block extrajavascript %}
|
||||||
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/qrcodejs/1.0.0/qrcode.min.js" integrity="sha512-CNgIRecGo7nphbeZ04Sc13ka07paqdeTu0WR1IM4kNcpmBAUSHSQX0FslNhTDadL4O5SAGapGt4FodqL8My0mA==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
|
||||||
|
<script>
|
||||||
|
var qrc = new QRCode(document.getElementById("qrcode"), {
|
||||||
|
text: "{{ user_object.pk }}\0",
|
||||||
|
width: 1024,
|
||||||
|
height: 1024
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block extracss %}
|
||||||
|
<style>
|
||||||
|
img {
|
||||||
|
width: 100%
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
{% endblock %}
|
@ -25,4 +25,5 @@ urlpatterns = [
|
|||||||
path('user/<int:pk>/aliases/', views.ProfileAliasView.as_view(), name="user_alias"),
|
path('user/<int:pk>/aliases/', views.ProfileAliasView.as_view(), name="user_alias"),
|
||||||
path('user/<int:pk>/trust', views.ProfileTrustView.as_view(), name="user_trust"),
|
path('user/<int:pk>/trust', views.ProfileTrustView.as_view(), name="user_trust"),
|
||||||
path('manage-auth-token/', views.ManageAuthTokens.as_view(), name='auth_token'),
|
path('manage-auth-token/', views.ManageAuthTokens.as_view(), name='auth_token'),
|
||||||
|
path('user/<int:pk>/qr_code/', views.QRCodeView.as_view(), name='qr_code'),
|
||||||
]
|
]
|
||||||
|
@ -365,6 +365,14 @@ class ManageAuthTokens(LoginRequiredMixin, TemplateView):
|
|||||||
context['token'] = Token.objects.get_or_create(user=self.request.user)[0]
|
context['token'] = Token.objects.get_or_create(user=self.request.user)[0]
|
||||||
return context
|
return context
|
||||||
|
|
||||||
|
class QRCodeView(LoginRequiredMixin, DetailView):
|
||||||
|
"""
|
||||||
|
Affiche le QR Code
|
||||||
|
"""
|
||||||
|
model = User
|
||||||
|
context_object_name = "user_object"
|
||||||
|
template_name = "member/qr_code.html"
|
||||||
|
extra_context = {"title": _("QR Code")}
|
||||||
|
|
||||||
# ******************************* #
|
# ******************************* #
|
||||||
# CLUB #
|
# CLUB #
|
||||||
|
@ -5,7 +5,7 @@ from django import forms
|
|||||||
from django.contrib.auth.forms import UserCreationForm
|
from django.contrib.auth.forms import UserCreationForm
|
||||||
from django.contrib.auth.models import User
|
from django.contrib.auth.models import User
|
||||||
from django.utils.translation import gettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
from member.models import Club
|
# from member.models import Club
|
||||||
from note.models import NoteSpecial, Alias
|
from note.models import NoteSpecial, Alias
|
||||||
from note_kfet.inputs import AmountInput
|
from note_kfet.inputs import AmountInput
|
||||||
|
|
||||||
@ -116,11 +116,11 @@ class ValidationForm(forms.Form):
|
|||||||
initial=True,
|
initial=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
# If the bda exists
|
# If the bda exists
|
||||||
if Club.objects.filter(name__iexact="bda").exists():
|
# if Club.objects.filter(name__iexact="bda").exists():
|
||||||
# The user can join the bda club at the inscription
|
# The user can join the bda club at the inscription
|
||||||
join_bda = forms.BooleanField(
|
# join_bda = forms.BooleanField(
|
||||||
label=_("Join BDA Club"),
|
# label=_("Join BDA Club"),
|
||||||
required=False,
|
# required=False,
|
||||||
initial=True,
|
# initial=True,
|
||||||
)
|
# )
|
||||||
|
23
apps/treasury/migrations/0008_auto_20240322_0045.py
Normal file
23
apps/treasury/migrations/0008_auto_20240322_0045.py
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
# Generated by Django 2.2.28 on 2024-03-21 23:45
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('treasury', '0007_auto_20240311_1549'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='invoice',
|
||||||
|
name='payment_date',
|
||||||
|
field=models.CharField(default='', max_length=255, verbose_name='Payment date'),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='invoice',
|
||||||
|
name='quotation',
|
||||||
|
field=models.BooleanField(default=False, verbose_name='Quotation'),
|
||||||
|
),
|
||||||
|
]
|
@ -41,6 +41,10 @@ class Invoice(models.Model):
|
|||||||
),
|
),
|
||||||
verbose_name=_("BDE"),
|
verbose_name=_("BDE"),
|
||||||
)
|
)
|
||||||
|
quotation = models.BooleanField(
|
||||||
|
default=False,
|
||||||
|
verbose_name=_("Quotation"),
|
||||||
|
)
|
||||||
|
|
||||||
object = models.CharField(
|
object = models.CharField(
|
||||||
max_length=255,
|
max_length=255,
|
||||||
@ -65,6 +69,12 @@ class Invoice(models.Model):
|
|||||||
verbose_name=_("Date"),
|
verbose_name=_("Date"),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
payment_date = models.CharField(
|
||||||
|
default="",
|
||||||
|
max_length=255,
|
||||||
|
verbose_name=_("Payment date"),
|
||||||
|
)
|
||||||
|
|
||||||
acquitted = models.BooleanField(
|
acquitted = models.BooleanField(
|
||||||
verbose_name=_("Acquitted"),
|
verbose_name=_("Acquitted"),
|
||||||
default=False,
|
default=False,
|
||||||
|
@ -76,8 +76,11 @@
|
|||||||
|
|
||||||
\def\FactureNum {{"{"}}{{ obj.id }}} % Numéro de facture
|
\def\FactureNum {{"{"}}{{ obj.id }}} % Numéro de facture
|
||||||
\def\FactureAcquittee {% if obj.acquitted %} {oui} {% else %} {non} {% endif %} % Facture acquittée : oui/non
|
\def\FactureAcquittee {% if obj.acquitted %} {oui} {% else %} {non} {% endif %} % Facture acquittée : oui/non
|
||||||
|
\def\Devis {% if obj.quotation %} {oui} {% else %} {non} {% endif %}
|
||||||
|
% Devis : oui/non
|
||||||
\def\FactureLieu {{"{"}}{{ obj.place|escape_tex }}} % Lieu de l'édition de la facture
|
\def\FactureLieu {{"{"}}{{ obj.place|escape_tex }}} % Lieu de l'édition de la facture
|
||||||
\def\FactureDate {{"{"}}{{ obj.date }}} % Date de l'édition de la facture
|
\def\FactureDate {{"{"}}{{ obj.date }}} % Date de l'édition de la facture
|
||||||
|
\def\FacturePaymentDate {{"{"}}{{ obj.payment_date|escape_tex }}} % Date de paiement de la facture
|
||||||
\def\FactureObjet {{"{"}}{{ obj.object|escape_tex }} } % Objet du document
|
\def\FactureObjet {{"{"}}{{ obj.object|escape_tex }} } % Objet du document
|
||||||
% Description de la facture
|
% Description de la facture
|
||||||
\def\FactureDescr {{"{"}}{{ obj.description|escape_tex }}}
|
\def\FactureDescr {{"{"}}{{ obj.description|escape_tex }}}
|
||||||
@ -118,10 +121,12 @@
|
|||||||
% Nom et adresse de la société
|
% Nom et adresse de la société
|
||||||
\MonNom \\
|
\MonNom \\
|
||||||
\MonAdresseRue \\
|
\MonAdresseRue \\
|
||||||
\MonAdresseVille
|
\MonAdresseVille \\
|
||||||
|
\ifthenelse{\equal{\Devis}{oui}}{
|
||||||
|
Devis n°\FactureNum
|
||||||
|
}{
|
||||||
Facture n°\FactureNum
|
Facture n°\FactureNum
|
||||||
|
}
|
||||||
|
|
||||||
{\addtolength{\leftskip}{10.5cm} %in ERT
|
{\addtolength{\leftskip}{10.5cm} %in ERT
|
||||||
\ClientNom \\
|
\ClientNom \\
|
||||||
@ -139,6 +144,7 @@ Facture n°\FactureNum
|
|||||||
|
|
||||||
\textnormal{\FactureDescr}
|
\textnormal{\FactureDescr}
|
||||||
|
|
||||||
|
|
||||||
~\\
|
~\\
|
||||||
|
|
||||||
\begin{center}
|
\begin{center}
|
||||||
@ -154,6 +160,11 @@ Facture n°\FactureNum
|
|||||||
\ifthenelse{\equal{\FactureAcquittee}{oui}}{
|
\ifthenelse{\equal{\FactureAcquittee}{oui}}{
|
||||||
Facture acquittée.
|
Facture acquittée.
|
||||||
}{
|
}{
|
||||||
|
Echéance de paiement : \FacturePaymentDate
|
||||||
|
|
||||||
|
Conditions d'escompte : Aucune
|
||||||
|
|
||||||
|
Taux de pénalité en cas de non paiement ou retard de paiement : 0 \%
|
||||||
|
|
||||||
À régler par chèque ou par virement bancaire :
|
À régler par chèque ou par virement bancaire :
|
||||||
|
|
||||||
@ -176,5 +187,6 @@ Facture n°\FactureNum
|
|||||||
TVA non applicable, article 293 B du CGI.
|
TVA non applicable, article 293 B du CGI.
|
||||||
\end{center}
|
\end{center}
|
||||||
|
|
||||||
|
|
||||||
\end{document}
|
\end{document}
|
||||||
{% endlanguage %}
|
{% endlanguage %}
|
||||||
|
@ -69,9 +69,11 @@ class TestInvoices(TestCase):
|
|||||||
response = self.client.post(reverse("treasury:invoice_create"), data={
|
response = self.client.post(reverse("treasury:invoice_create"), data={
|
||||||
"id": 42,
|
"id": 42,
|
||||||
"object": "Same object",
|
"object": "Same object",
|
||||||
|
"quotation": True,
|
||||||
"description": "Longer description",
|
"description": "Longer description",
|
||||||
"name": "Me and others",
|
"name": "Me and others",
|
||||||
"address": "Alwways earth",
|
"address": "Alwways earth",
|
||||||
|
"payment_date": "Maybe someday...",
|
||||||
"acquitted": True,
|
"acquitted": True,
|
||||||
"products-0-designation": "Designation",
|
"products-0-designation": "Designation",
|
||||||
"products-0-quantity": 1,
|
"products-0-quantity": 1,
|
||||||
@ -97,8 +99,10 @@ class TestInvoices(TestCase):
|
|||||||
"object": "Same object",
|
"object": "Same object",
|
||||||
"description": "Longer description",
|
"description": "Longer description",
|
||||||
"name": "Me and others",
|
"name": "Me and others",
|
||||||
|
"quotation": False,
|
||||||
"address": "Always earth",
|
"address": "Always earth",
|
||||||
"acquitted": True,
|
"acquitted": True,
|
||||||
|
"payment_date": "Never",
|
||||||
"locked": True,
|
"locked": True,
|
||||||
"products-0-designation": "Designation",
|
"products-0-designation": "Designation",
|
||||||
"products-0-quantity": 1,
|
"products-0-quantity": 1,
|
||||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user