Added journal

This commit is contained in:
Julien Malka 2020-02-17 11:40:58 +01:00
parent df0dd6cedc
commit db9be39f76
8 changed files with 79 additions and 6 deletions

View file

@ -75,6 +75,7 @@ INSTALLED_APPS = [
"django.contrib.admindocs",
"bda",
"petitscours",
"journaldecaisse.apps.JournaldecaisseConfig",
"captcha",
"django_cas_ng",
"bootstrapform",

View file

@ -16,6 +16,8 @@ from wagtail.admin import urls as wagtailadmin_urls
from wagtail.core import urls as wagtail_urls
from wagtail.documents import urls as wagtaildocs_urls
from gestioncof import csv_views, views as gestioncof_views
from gestioncof.autocomplete import autocomplete
from gestioncof.urls import (
@ -43,6 +45,8 @@ urlpatterns = [
path("event/", include(events_patterns)),
# Calendrier
path("calendar/", include(calendar_patterns)),
#Journal de Caisse
path('journaldecaisse/', include('journaldecaisse.urls', namespace="journaldecaisse")),
# Clubs
path("clubs/", include(clubs_patterns)),
# Authentification

View file

@ -91,6 +91,24 @@
{% endfor %}
</ul>
</div>
<h3 class="block-title">Journal de Caisse<span class="pull-right glyphicon glyphicon-cog"></span></h3>
<div class="hm-block">
<ul>
<h4>Journaux</h4>
<li><a href="{% url "journaldecaisse:index" %}">Journal de Kaisse</a></li>
<li><a href="{% url "petits-cours-demandes-list" %}">Journal d'Emprunts</a></li>
</ul>
<ul>
<h4>Vente</h4>
{% for event in events %}
<li><a href="{% url "event.details.status" event.id %}">Événement : {{ event.title }}</a></li>
{% endfor %}
{% for survey in surveys %}
<li><a href="{% url "survey.details.status" survey.id %}">Sondage : {{ survey.title }}</a></li>
{% endfor %}
</ul>
</div>
<h3 class="block-title">Gestion tirages BdA<span class="pull-right glyphicon glyphicon-list"></span></h3>
<div class="hm-block">
{% if active_tirages %}

View file

@ -2,4 +2,5 @@ from django.apps import AppConfig
class JournaldecaisseConfig(AppConfig):
name = 'journaldecaisse'
name = "journaldecaisse"

View file

@ -2,9 +2,9 @@ from django.db import models
from django.utils.translation import ugettext_lazy as _
PAYMENTS_CHOICES = (
("cash", _("Espèces")),
("cb", _("CB")),
("check", _("Chèque")),
("Espèces", _("Espèces")),
("CB", _("CB")),
("Chèque", _("Chèque")),
)
class JournalEntry(models.Model):

View file

@ -0,0 +1,45 @@
{% extends "petitscours/base_title.html" %}
{% load staticfiles %}
{% block realcontent %}
<h2>Journal de Kaisse</h2>
{% if entry_list %}
<table class="table table-stripped">
<thead>
<th>Date</th>
<th>Cofeux.se</th>
<th>Objet</th>
<th>Moyen de Paiement</th>
<th>Montant</th>
</thead>
<tbody>
{% for entry in entry_list %}
<tr>
<td>{{ entry.entry_date|date:"M d, Y" }}</td>
<td>{{ entry.cofeux_id }}</td>
<td>{{ entry.entry_text }}</td>
<td> {{ entry.payment_type}}</td>
<td> {{ entry.entry_amount }}€</td>
</tr>
{% endfor %}
</tbody>
</table>
{% if is_paginated %}
<div class="pagination">
<span class="page-links">
{% if page_obj.has_previous %}
<a href="{% url "petits-cours-demandes-list" %}?page={{ page_obj.previous_page_number }}">&lt;</a>
{% endif %}
<span class="page-current">
Page {{ page_obj.number }} sur {{ page_obj.paginator.num_pages }}
</span>
{% if page_obj.has_next %}
<a href="{% url "petits-cours-demandes-list" %}?page={{ page_obj.next_page_number }}">&gt;</a>
{% endif %}
</span>
</div>
{% endif %}
{% else %}
<p>Aucune demande :(</p>
{% endif %}
{% endblock %}

View file

@ -2,6 +2,7 @@ from django.urls import path
from . import views
app_name = 'journaldecaisse'
urlpatterns = [
path('', views.index, name='index'),
]

View file

@ -1,5 +1,8 @@
from django.http import HttpResponse
from .models import JournalEntry
from django.shortcuts import render
def index(request):
return HttpResponse("Hello, world. You're at the polls index.")
entry_list = JournalEntry.objects.order_by('entry_date')
context = {'entry_list': entry_list}
return render(request, 'journaldecaisse/index.html', context)