Merge branch 'aureplop/kfet_cms' into 'master'

Add Wagtail CMS for kfet app.

See merge request !237
This commit is contained in:
Martin Pepin 2017-06-25 16:47:48 +02:00
commit d30b36269a
105 changed files with 4295 additions and 1501 deletions

View file

@ -177,7 +177,7 @@ Charger les mails indispensables au bon fonctionnement de GestioCOF :
Une base de donnée pré-remplie est disponible en lançant les commandes :
python manage.py loaddata gestion sites accounts groups articles
python manage.py loaddata gestion sites articles
python manage.py loaddevdata
Vous êtes prêts à développer ! Lancer GestioCOF en faisant

View file

@ -58,6 +58,22 @@ INSTALLED_APPS = [
'widget_tweaks',
'custommail',
'djconfig',
'wagtail.wagtailforms',
'wagtail.wagtailredirects',
'wagtail.wagtailembeds',
'wagtail.wagtailsites',
'wagtail.wagtailusers',
'wagtail.wagtailsnippets',
'wagtail.wagtaildocs',
'wagtail.wagtailimages',
'wagtail.wagtailsearch',
'wagtail.wagtailadmin',
'wagtail.wagtailcore',
'wagtail.contrib.modeladmin',
'wagtailmenus',
'modelcluster',
'taggit',
'kfet.cms',
]
MIDDLEWARE_CLASSES = [
@ -71,6 +87,8 @@ MIDDLEWARE_CLASSES = [
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django.middleware.security.SecurityMiddleware',
'djconfig.middleware.DjConfigMiddleware',
'wagtail.wagtailcore.middleware.SiteMiddleware',
'wagtail.wagtailredirects.middleware.RedirectMiddleware',
]
ROOT_URLCONF = 'cof.urls'
@ -89,6 +107,7 @@ TEMPLATES = [
'django.core.context_processors.i18n',
'django.core.context_processors.media',
'django.core.context_processors.static',
'wagtailmenus.context_processors.wagtailmenus',
'djconfig.context_processors.config',
'gestioncof.shared.context_processor',
'kfet.context_processors.auth',
@ -145,9 +164,12 @@ LOGIN_URL = "cof-login"
LOGIN_REDIRECT_URL = "home"
CAS_SERVER_URL = 'https://cas.eleves.ens.fr/'
CAS_VERSION = '3'
CAS_LOGIN_MSG = None
CAS_IGNORE_REFERER = True
CAS_REDIRECT_URL = '/'
CAS_EMAIL_FORMAT = "%s@clipper.ens.fr"
AUTHENTICATION_BACKENDS = (
'django.contrib.auth.backends.ModelBackend',
'gestioncof.shared.COFCASBackend',
@ -185,3 +207,9 @@ CHANNEL_LAYERS = {
}
FORMAT_MODULE_PATH = 'cof.locale'
# Wagtail settings
WAGTAIL_SITE_NAME = 'GestioCOF'
WAGTAIL_ENABLE_UPDATE_CHECK = False
TAGGIT_CASE_INSENSITIVE = True

View file

@ -28,6 +28,26 @@ MEDIA_URL = '/media/'
# Debug tool bar
# ---
# "Versions" panel of django-debug-toolbar <=1.8 is not compatible with
# wagtailmenus.
# See https://github.com/jazzband/django-debug-toolbar/issues/922
# TODO: Bug should be fixed in ddt 1.9 (not released yet). When fixed, this
# declaration may be removed.
DEBUG_TOOLBAR_PANELS = [
'debug_toolbar.panels.timer.TimerPanel',
'debug_toolbar.panels.settings.SettingsPanel',
'debug_toolbar.panels.headers.HeadersPanel',
'debug_toolbar.panels.request.RequestPanel',
'debug_toolbar.panels.sql.SQLPanel',
'debug_toolbar.panels.staticfiles.StaticFilesPanel',
'debug_toolbar.panels.templates.TemplatesPanel',
'debug_toolbar.panels.cache.CachePanel',
'debug_toolbar.panels.signals.SignalsPanel',
'debug_toolbar.panels.logging.LoggingPanel',
'debug_toolbar.panels.redirects.RedirectsPanel',
]
def show_toolbar(request):
"""
On ne veut pas la vérification de INTERNAL_IPS faite par la debug-toolbar

View file

@ -14,6 +14,10 @@ from django.views.generic.base import TemplateView
from django.contrib.auth import views as django_views
from django_cas_ng import views as django_cas_views
from wagtail.wagtailadmin import urls as wagtailadmin_urls
from wagtail.wagtailcore import urls as wagtail_urls
from wagtail.wagtaildocs import urls as wagtaildocs_urls
from gestioncof import views as gestioncof_views, csv_views
from gestioncof.urls import export_patterns, petitcours_patterns, \
surveys_patterns, events_patterns, calendar_patterns, \
@ -48,7 +52,7 @@ urlpatterns = [
url(r'^outsider/login$', gestioncof_views.login_ext),
url(r'^outsider/logout$', django_views.logout, {'next_page': 'home'}),
url(r'^login$', gestioncof_views.login, name="cof-login"),
url(r'^logout$', gestioncof_views.logout),
url(r'^logout$', gestioncof_views.logout, name="cof-logout"),
# Infos persos
url(r'^profile$', gestioncof_views.profile),
url(r'^outsider/password-change$', django_views.password_change),
@ -82,8 +86,10 @@ urlpatterns = [
url(r'^utile_cof/diff_cof$', gestioncof_views.liste_diffcof),
url(r'^utile_bda/bda_revente$', gestioncof_views.liste_bdarevente),
url(r'^k-fet/', include('kfet.urls')),
url(r'^cms/', include(wagtailadmin_urls)),
url(r'^documents/', include(wagtaildocs_urls)),
# djconfig
url(r"^config", gestioncof_views.ConfigUpdate.as_view())
url(r"^config", gestioncof_views.ConfigUpdate.as_view()),
]
if 'debug_toolbar' in settings.INSTALLED_APPS:
@ -92,7 +98,13 @@ if 'debug_toolbar' in settings.INSTALLED_APPS:
url(r'^__debug__/', include(debug_toolbar.urls)),
]
if settings.DEBUG:
# Si on est en production, MEDIA_ROOT est servi par Apache.
# Il faut dire à Django de servir MEDIA_ROOT lui-même en développement.
urlpatterns += static(settings.MEDIA_URL,
document_root=settings.MEDIA_ROOT)
# Wagtail for uncatched
urlpatterns += [
url(r'', include(wagtail_urls)),
]

View file

@ -6,6 +6,7 @@ class GestioncofConfig(AppConfig):
verbose_name = "Gestion des adhérents du COF"
def ready(self):
from . import signals
self.register_config()
def register_config(self):

View file

@ -1,62 +1,25 @@
from django.contrib.sites.models import Site
from django.conf import settings
from django.contrib.sites.models import Site
from django_cas_ng.backends import CASBackend
from django_cas_ng.utils import get_cas_client
from django.contrib.auth import get_user_model
from gestioncof.models import CofProfile
User = get_user_model()
class COFCASBackend(CASBackend):
def authenticate_cas(self, ticket, service, request):
"""Verifies CAS ticket and gets or creates User object"""
client = get_cas_client(service_url=service)
username, attributes, _ = client.verify_ticket(ticket)
if attributes:
request.session['attributes'] = attributes
if not username:
return None
def clean_username(self, username):
# Le CAS de l'ENS accepte les logins avec des espaces au début
# et à la fin, ainsi quavec une casse variable. On normalise pour
# éviter les doublons.
username = username.strip().lower()
return username.strip().lower()
profiles = CofProfile.objects.filter(login_clipper=username)
if len(profiles) > 0:
profile = profiles.order_by('-is_cof')[0]
user = profile.user
return user
try:
user = User.objects.get(username=username)
except User.DoesNotExist:
# user will have an "unusable" password
user = User.objects.create_user(username, '')
user.save()
return user
def authenticate(self, ticket, service, request):
"""Authenticates CAS ticket and retrieves user data"""
user = self.authenticate_cas(ticket, service, request)
if user is None:
return user
try:
profile = user.profile
except CofProfile.DoesNotExist:
profile, created = CofProfile.objects.get_or_create(user=user)
profile.save()
if not profile.login_clipper:
profile.login_clipper = user.username
profile.save()
if not user.email:
user.email = settings.CAS_EMAIL_FORMAT % profile.login_clipper
user.save()
if profile.is_buro and not user.is_staff:
user.is_staff = True
user.save()
def configure_user(self, user):
clipper = user.username
user.profile.login_clipper = clipper
user.profile.save()
user.email = settings.CAS_EMAIL_FORMAT % clipper
user.save()
return user

23
gestioncof/signals.py Normal file
View file

@ -0,0 +1,23 @@
from django.contrib import messages
from django.contrib.auth.signals import user_logged_in
from django.dispatch import receiver
from django.utils.translation import ugettext_lazy as _
from django_cas_ng.signals import cas_user_authenticated
@receiver(user_logged_in)
def messages_on_out_login(request, user, **kwargs):
if user.backend.startswith('django.contrib.auth'):
msg = _('Connexion à GestioCOF réussie. Bienvenue {}.').format(
user.get_short_name(),
)
messages.success(request, msg)
@receiver(cas_user_authenticated)
def mesagges_on_cas_login(request, user, **kwargs):
msg = _('Connexion à GestioCOF par CAS réussie. Bienvenue {}.').format(
user.get_short_name(),
)
messages.success(request, msg)

View file

@ -1,4 +1,5 @@
{% extends "gestioncof/base_header.html" %}
{% load wagtailcore_tags %}
{% block homelink %}
{% endblock %}
@ -55,7 +56,8 @@
<h3 class="block-title">K-Fêt<span class="pull-right"><i class="fa fa-coffee"></i></span></h3>
<div class="hm-block">
<ul>
<li><a href="{% url "kfet.home" %}">Page d'accueil</a></li>
{# TODO: Since Django 1.9, we can store result with "as", allowing proper value management (if None) #}
<li><a href="{% slugurl "k-fet" %}">Page d'accueil</a></li>
<li><a href="https://www.cof.ens.fr/k-fet/calendrier">Calendrier</a></li>
{% if perms.kfet.is_team %}
<li><a href="{% url 'kfet.kpsul' %}">K-Psul</a></li>

View file

@ -7,14 +7,19 @@ from custommail.shortcuts import send_custom_mail
from django.shortcuts import redirect, get_object_or_404, render
from django.http import Http404, HttpResponse, HttpResponseForbidden
from django.contrib.auth.decorators import login_required
from django.contrib.auth.views import login as django_login_view
from django.contrib.auth.views import (
login as django_login_view, logout as django_logout_view,
)
from django.contrib.auth.models import User
from django.contrib.sites.models import Site
from django.core.urlresolvers import reverse_lazy
from django.views.generic import FormView
from django.utils import timezone
from django.utils.translation import ugettext_lazy as _
from django.contrib import messages
from django_cas_ng.views import logout as cas_logout_view
from gestioncof.models import Survey, SurveyAnswer, SurveyQuestion, \
SurveyQuestionAnswer
from gestioncof.models import Event, EventRegistration, EventOption, \
@ -81,15 +86,21 @@ def login_ext(request):
@login_required
def logout(request):
try:
profile = request.user.profile
except CofProfile.DoesNotExist:
profile, created = CofProfile.objects.get_or_create(user=request.user)
if profile.login_clipper:
return redirect("django_cas_ng.views.logout")
def logout(request, next_page=None):
if next_page is None:
next_page = request.GET.get('next', None)
profile = getattr(request.user, 'profile', None)
if profile and profile.login_clipper:
msg = _('Déconnexion de GestioCOF et CAS réussie. À bientôt {}.')
logout_view = cas_logout_view
else:
return redirect("django.contrib.auth.views.logout")
msg = _('Déconnexion de GestioCOF réussie. À bientôt {}.')
logout_view = django_logout_view
messages.success(request, msg.format(request.user.get_short_name()))
return logout_view(request, next_page=next_page)
@login_required

1
kfet/cms/__init__.py Normal file
View file

@ -0,0 +1 @@
default_app_config = 'kfet.cms.apps.KFetCMSAppConfig'

10
kfet/cms/apps.py Normal file
View file

@ -0,0 +1,10 @@
from django.apps import AppConfig
class KFetCMSAppConfig(AppConfig):
name = 'kfet.cms'
label = 'kfetcms'
verbose_name = 'CMS K-Fêt'
def ready(self):
from . import hooks

View file

@ -0,0 +1,20 @@
from kfet.models import Article
def get_articles(request=None):
articles = (
Article.objects
.filter(is_sold=True, hidden=False)
.select_related('category')
.order_by('category__name', 'name')
)
pressions, others = [], []
for article in articles:
if article.category.name == 'Pression':
pressions.append(article)
else:
others.append(article)
return {
'pressions': pressions,
'articles': others,
}

File diff suppressed because one or more lines are too long

12
kfet/cms/hooks.py Normal file
View file

@ -0,0 +1,12 @@
from django.contrib.staticfiles.templatetags.staticfiles import static
from django.utils.html import format_html
from wagtail.wagtailcore import hooks
@hooks.register('insert_editor_css')
def editor_css():
return format_html(
'<link rel="stylesheet" href="{}">',
static('kfetcms/css/editor.css'),
)

View file

@ -0,0 +1,35 @@
from django.contrib.auth.models import Group
from django.core.management import call_command
from django.core.management.base import BaseCommand
from wagtail.wagtailcore.models import Page, Site
class Command(BaseCommand):
help = "Importe des données pour Wagtail"
def add_arguments(self, parser):
parser.add_argument('--file', default='kfet_wagtail_17_05')
def handle(self, *args, **options):
self.stdout.write("Import des données wagtail")
# Nettoyage des données initiales posées par Wagtail dans la migration
# wagtailcore/0002
Group.objects.filter(name__in=('Moderators', 'Editors')).delete()
try:
homepage = Page.objects.get(
title="Welcome to your new Wagtail site!"
)
homepage.delete()
Site.objects.filter(root_page=homepage).delete()
except Page.DoesNotExist:
pass
# Import des données
# Par défaut, il s'agit d'une copie du site K-Fêt (17-05)
call_command('loaddata', options['file'])

View file

@ -0,0 +1,49 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import wagtail.wagtailsnippets.blocks
import wagtail.wagtailcore.blocks
import wagtail.wagtailcore.fields
import django.db.models.deletion
import kfet.cms.models
class Migration(migrations.Migration):
dependencies = [
('wagtailcore', '0033_remove_golive_expiry_help_text'),
('wagtailimages', '0019_delete_filter'),
]
operations = [
migrations.CreateModel(
name='KFetPage',
fields=[
('page_ptr', models.OneToOneField(serialize=False, primary_key=True, parent_link=True, auto_created=True, to='wagtailcore.Page')),
('no_header', models.BooleanField(verbose_name='Sans en-tête', help_text="Coché, l'en-tête (avec le titre) de la page n'est pas affiché.", default=False)),
('content', wagtail.wagtailcore.fields.StreamField((('rich', wagtail.wagtailcore.blocks.RichTextBlock(label='Éditeur')), ('carte', kfet.cms.models.MenuBlock()), ('group_team', wagtail.wagtailcore.blocks.StructBlock((('show_only', wagtail.wagtailcore.blocks.IntegerBlock(help_text='Nombre initial de membres affichés. Laisser vide pour tou-te-s les afficher.', required=False, label='Montrer seulement')), ('members', wagtail.wagtailcore.blocks.ListBlock(wagtail.wagtailsnippets.blocks.SnippetChooserBlock(kfet.cms.models.MemberTeam), classname='team-group', label='K-Fêt-eux-ses'))))), ('group', wagtail.wagtailcore.blocks.StreamBlock((('rich', wagtail.wagtailcore.blocks.RichTextBlock(label='Éditeur')), ('carte', kfet.cms.models.MenuBlock()), ('group_team', wagtail.wagtailcore.blocks.StructBlock((('show_only', wagtail.wagtailcore.blocks.IntegerBlock(help_text='Nombre initial de membres affichés. Laisser vide pour tou-te-s les afficher.', required=False, label='Montrer seulement')), ('members', wagtail.wagtailcore.blocks.ListBlock(wagtail.wagtailsnippets.blocks.SnippetChooserBlock(kfet.cms.models.MemberTeam), classname='team-group', label='K-Fêt-eux-ses')))))), label='Contenu groupé'))), verbose_name='Contenu')),
('layout', models.CharField(max_length=255, choices=[('kfet/base_col_1.html', 'Une colonne : centrée sur la page'), ('kfet/base_col_2.html', 'Deux colonnes : fixe à gauche, contenu à droite'), ('kfet/base_col_mult.html', 'Contenu scindé sur plusieurs colonnes')], help_text='Comment cette page devrait être affichée ?', verbose_name='Template', default='kfet/base_col_mult.html')),
('main_size', models.CharField(max_length=255, blank=True, verbose_name='Taille de la colonne de contenu')),
('col_count', models.CharField(max_length=255, blank=True, verbose_name='Nombre de colonnes', help_text="S'applique au page dont le contenu est scindé sur plusieurs colonnes")),
],
options={
'verbose_name': 'page K-Fêt',
'verbose_name_plural': 'pages K-Fêt',
},
bases=('wagtailcore.page',),
),
migrations.CreateModel(
name='MemberTeam',
fields=[
('id', models.AutoField(verbose_name='ID', auto_created=True, serialize=False, primary_key=True)),
('first_name', models.CharField(blank=True, max_length=255, verbose_name='Prénom', default='')),
('last_name', models.CharField(blank=True, max_length=255, verbose_name='Nom', default='')),
('nick_name', models.CharField(verbose_name='Alias', blank=True, default='', max_length=255)),
('photo', models.ForeignKey(null=True, related_name='+', on_delete=django.db.models.deletion.SET_NULL, verbose_name='Photo', blank=True, to='wagtailimages.Image')),
],
options={
'verbose_name': 'K-Fêt-eux-se',
},
),
]

View file

174
kfet/cms/models.py Normal file
View file

@ -0,0 +1,174 @@
from django.db import models
from django.utils.translation import ugettext_lazy as _
from wagtail.wagtailadmin.edit_handlers import (
FieldPanel, FieldRowPanel, MultiFieldPanel, StreamFieldPanel
)
from wagtail.wagtailcore import blocks
from wagtail.wagtailcore.fields import StreamField
from wagtail.wagtailcore.models import Page
from wagtail.wagtailimages.edit_handlers import ImageChooserPanel
from wagtail.wagtailsnippets.blocks import SnippetChooserBlock
from wagtail.wagtailsnippets.models import register_snippet
from kfet.cms.context_processors import get_articles
@register_snippet
class MemberTeam(models.Model):
first_name = models.CharField(
verbose_name=_('Prénom'),
blank=True, default='', max_length=255,
)
last_name = models.CharField(
verbose_name=_('Nom'),
blank=True, default='', max_length=255,
)
nick_name = models.CharField(
verbose_name=_('Alias'),
blank=True, default='', max_length=255,
)
photo = models.ForeignKey(
'wagtailimages.Image',
verbose_name=_('Photo'),
on_delete=models.SET_NULL,
null=True, blank=True,
related_name='+',
)
class Meta:
verbose_name = _('K-Fêt-eux-se')
panels = [
FieldPanel('first_name'),
FieldPanel('last_name'),
FieldPanel('nick_name'),
ImageChooserPanel('photo'),
]
def __str__(self):
return self.get_full_name()
def get_full_name(self):
return '{} {}'.format(self.first_name, self.last_name).strip()
class MenuBlock(blocks.StaticBlock):
class Meta:
icon = 'list-ul'
label = _('Carte')
template = 'kfetcms/block_menu.html'
def get_context(self, *args, **kwargs):
context = super().get_context(*args, **kwargs)
context.update(get_articles())
return context
class GroupTeamBlock(blocks.StructBlock):
show_only = blocks.IntegerBlock(
label=_('Montrer seulement'),
required=False,
help_text=_(
'Nombre initial de membres affichés. Laisser vide pour tou-te-s '
'les afficher.'
),
)
members = blocks.ListBlock(
SnippetChooserBlock(MemberTeam),
label=_('K-Fêt-eux-ses'),
classname='team-group',
)
class Meta:
icon = 'group'
label = _('Groupe de K-Fêt-eux-ses')
template = 'kfetcms/block_teamgroup.html'
class ChoicesStreamBlock(blocks.StreamBlock):
rich = blocks.RichTextBlock(label=_('Éditeur'))
carte = MenuBlock()
group_team = GroupTeamBlock()
class KFetStreamBlock(ChoicesStreamBlock):
group = ChoicesStreamBlock(label=_('Contenu groupé'))
class KFetPage(Page):
content = StreamField(KFetStreamBlock, verbose_name=_('Contenu'))
# Layout fields
TEMPLATE_COL_1 = 'kfet/base_col_1.html'
TEMPLATE_COL_2 = 'kfet/base_col_2.html'
TEMPLATE_COL_MULT = 'kfet/base_col_mult.html'
no_header = models.BooleanField(
verbose_name=_('Sans en-tête'),
default=False,
help_text=_(
"Coché, l'en-tête (avec le titre) de la page n'est pas affiché."
),
)
layout = models.CharField(
verbose_name=_('Template'),
choices=[
(TEMPLATE_COL_1, _('Une colonne : centrée sur la page')),
(TEMPLATE_COL_2, _('Deux colonnes : fixe à gauche, contenu à droite')),
(TEMPLATE_COL_MULT, _('Contenu scindé sur plusieurs colonnes')),
],
default=TEMPLATE_COL_MULT, max_length=255,
help_text=_(
"Comment cette page devrait être affichée ?"
),
)
main_size = models.CharField(
verbose_name=_('Taille de la colonne de contenu'),
blank=True, max_length=255,
)
col_count = models.CharField(
verbose_name=_('Nombre de colonnes'),
blank=True, max_length=255,
help_text=_(
"S'applique au page dont le contenu est scindé sur plusieurs colonnes."
),
)
# Panels
content_panels = Page.content_panels + [
StreamFieldPanel('content'),
]
layout_panel = [
FieldPanel('no_header'),
FieldPanel('layout'),
FieldRowPanel([
FieldPanel('main_size'),
FieldPanel('col_count'),
]),
]
settings_panels = [
MultiFieldPanel(layout_panel, _('Affichage'))
] + Page.settings_panels
# Base template
template = "kfetcms/base.html"
class Meta:
verbose_name = _('page K-Fêt')
verbose_name_plural = _('pages K-Fêt')
def get_context(self, request, *args, **kwargs):
context = super().get_context(request, *args, **kwargs)
page = context['page']
if not page.seo_title:
page.seo_title = page.title
return context

View file

@ -0,0 +1,93 @@
.main.cms {
padding: 20px 15px;
}
@media (min-width: 768px) {
.main.cms {
padding: 35px 30px;
}
}
.cms {
text-align: justify;
font-size: 1.1em;
}
@media (min-width:768px) {
.cms {
font-size: 1.2em;
line-height: 1.6em;
}
}
/* Titles */
.cms h2, .cms h3 {
clear: both;
margin: 0 0 15px;
padding-bottom: 10px;
border-bottom: 1px solid #c8102e;
text-align: left;
font-weight: bold;
}
@media (min-width: 768px) {
.cms h2, .cms h3 {
padding-bottom: 15px;
}
}
/* Paragraphs */
.cms p {
margin-bottom: 20px;
text-indent: 2em;
}
.cms p + :not(h2):not(h3):not(div) {
margin-top: -10px;
}
@media (min-width: 768px) {
.cms p {
padding-bottom: 15px;
}
.cms p + :not(h2):not(h3):not(div) {
margin-top: -30px;
}
}
/* Lists */
.cms ol, .cms ul {
padding: 0 0 0 15px;
margin: 0 0 10px;
}
.cms ul {
list-style-type: square;
}
.cms ol > li, .cms ul > li {
padding-left: 5px;
}
/* Images */
.cms .richtext-image {
max-height: 100%;
margin: 5px 0 15px;
}
.cms .richtext-image.left {
float: left;
margin-right: 30px;
}
.cms .richtext-image.right {
float: right;
margin-left: 30px;
}

View file

@ -0,0 +1,18 @@
.snippets.listing thead, .snippets.listing thead tr {
border: 0;
}
.snippets.listing tbody {
display: block;
column-count: 2;
}
.snippets.listing tbody tr {
display: block;
}
@media (min-width: 992px) {
.snippets.listing tbody {
column-count: 3;
}
}

View file

@ -0,0 +1,3 @@
@import url("base.css");
@import url("menu.css");
@import url("team.css");

View file

@ -0,0 +1,58 @@
.carte {
margin-bottom: 15px;
font-family: "Roboto Slab";
}
.carte .carte-title {
padding-top: 0;
margin-top: 0;
margin-bottom: 0;
}
.carte .carte-list {
width: 100%;
padding: 15px;
list-style-type: none;
}
.carte .carte-item {
position: relative;
text-align: right;
white-space: nowrap;
padding: 0;
}
.carte .carte-item .filler {
position: absolute;
left: 0;
right: 0;
border-bottom: 2px dotted #333;
height: 75%;
}
.carte .carte-item > span {
position: relative;
}
.carte .carte-item .carte-label {
background: white;
float: left;
padding-right: 10px;
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
}
.carte .carte-item .carte-ukf {
padding: 0 10px;
background: #ffdbc7;
}
.carte-inverted .carte-list,
.carte-inverted .carte-item .carte-label {
background: #ffdbc7;
}
.carte-inverted .carte-item .carte-ukf {
background: white;
}

View file

@ -0,0 +1,47 @@
.team-group {
margin-bottom: 20px;
}
.team-group .col-btn {
margin-bottom: 20px;
}
.team-group .member-more {
display: none;
}
.team-member {
padding: 0;
margin-bottom: 20px;
min-height: 190px;
background-color: inherit;
border: 0;
}
.team-member img {
max-width: 100%;
max-height: 125px;
width: auto;
height: auto;
display: block;
}
.team-member .infos {
height: 50px;
margin-top: 15px;
}
@media (min-width: 768px) {
.team-group {
margin-left: 20px;
margin-right: 20px;
}
.team-member {
min-height: 215px;
}
.team-member img {
max-height: 150px;
}
}

View file

@ -0,0 +1,41 @@
{% extends page.layout %}
{% load static wagtailcore_tags wagtailuserbar %}
{# CSS/JS #}
{% block extra_head %}
{{ block.super }}
<link rel="stylesheet" type="text/css" href="{% static "kfetcms/css/index.css" %}">
{% endblock %}
{# Titles #}
{% block title %}{{ page.seo_title }}{% endblock %}
{% block header-title %}{{ page.title }}{% endblock %}
{# Layout #}
{% block main-size %}{{ page.main_size|default:block.super }}{% endblock %}
{% block mult-count %}{{ page.col_count|default:block.super }}{% endblock %}
{% block main-class %}cms main-bg{% endblock %}
{# Content #}
{% block main %}
{% for block in page.content %}
<div class="{% if block.block_type == "rich" or block.block_type == "group" %}unbreakable{% endif %}">
{% include_block block %}
</div>
{% endfor %}
{% wagtailuserbar %}
{% endblock %}
{# Footer #}
{% block footer %}
{% include "kfet/base_footer.html" %}
{% endblock %}

View file

@ -0,0 +1,11 @@
{% load static %}
{% if pressions %}
{% include "kfetcms/block_menu_category.html" with title="Pressions du moment" articles=pressions class="carte-inverted" %}
{% endif %}
{% regroup articles by category as categories %}
{% for category in categories %}
{% include "kfetcms/block_menu_category.html" with title=category.grouper.name articles=category.list %}
{% endfor %}

View file

@ -0,0 +1,12 @@
<div class="carte {{ class }} unbreakable">
<h3 class="carte-title">{{ title }}</h3>
<ul class="carte-list">
{% for article in articles %}
<li class="carte-item">
<div class="filler"></div>
<span class="carte-label">{{ article.name }}</span>
<span class="carte-ukf">{{ article.price_ukf }} UKF</span>
</li>
{% endfor %}
</ul>
</div>

View file

@ -0,0 +1,66 @@
{% load wagtailcore_tags wagtailimages_tags %}
{% with groupteam=value len=value.members|length %}
<div class="team-group row">
{% if len == 2 %}
<div class="visible-sm col-sm-3"></div>
{% endif %}
{% for member in groupteam.members %}
<div class="
{% if len == 1 %}
col-xs-12
{% else %}
col-xs-6
{% if len == 3 %}
col-sm-4
{% elif len == 2 %}
col-sm-3 col-md-6
{% else %}
col-sm-3 col-md-4 col-lg-3
{% endif %}
{% endif %}
{% if groupteam.show_only != None and forloop.counter0 >= groupteam.show_only %}
member-more
{% endif %}
">
<div class="team-member thumbnail text-center">
{% image member.photo max-200x500 %}
<div class="infos">
<b>{{ member.get_full_name }}</b>
<br>
{% if member.nick_name %}
<i>alias</i> {{ member.nick_name }}
{% endif %}
</div>
</div>
</div>
{% endfor %}
{% if groupteam.show_only != None and len > groupteam.show_only %}
<div class="col-xs-12 col-btn text-center">
<button class="btn btn-primary btn-lg more">
{% if groupteam.show_only %}
Y'en a plus !
{% else %}
Les voir
{% endif %}
</button>
</div>
{% endif %}
</div>
{% endwith %}
<script type="text/javascript">
$( function() {
$('.more').click( function() {
$(this).closest('.col-btn').hide();
$(this).closest('.team-group').children('.member-more').show();
});
});
</script>

View file

@ -25,8 +25,8 @@ from gestioncof.models import CofProfile
# -----
class DateTimeWidget(forms.DateTimeInput):
def __init__(self, attrs=None):
super(DateTimeWidget, self).__init__(attrs)
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.attrs['format'] = '%Y-%m-%d %H:%M'
class Media:
@ -458,8 +458,11 @@ class KFetConfigForm(ConfigForm):
class FilterHistoryForm(forms.Form):
checkouts = forms.ModelMultipleChoiceField(queryset = Checkout.objects.all())
accounts = forms.ModelMultipleChoiceField(queryset = Account.objects.all())
checkouts = forms.ModelMultipleChoiceField(queryset=Checkout.objects.all())
accounts = forms.ModelMultipleChoiceField(queryset=Account.objects.all())
from_date = forms.DateTimeField(widget=DateTimeWidget)
to_date = forms.DateTimeField(widget=DateTimeWidget)
# -----
# Transfer forms

View file

@ -147,3 +147,9 @@ class Command(MyBaseCommand):
# ---
call_command('createopes', '100', '7', '--transfers=20')
# ---
# Wagtail CMS
# ---
call_command('kfet_loadwagtail')

View file

@ -14,7 +14,8 @@ from datetime import date
import re
import hashlib
from kfet.config import kfet_config
from .config import kfet_config
from .utils import to_ukf
def choices_length(choices):
return reduce(lambda m, choice: max(m, len(choice[0])), choices, 0)
@ -79,7 +80,7 @@ class Account(models.Model):
def __str__(self):
return '%s (%s)' % (self.trigramme, self.name)
# Propriétés pour accéder aux attributs de user et cofprofile et user
# Propriétés pour accéder aux attributs de cofprofile et user
@property
def user(self):
return self.cofprofile.user
@ -103,6 +104,10 @@ class Account(models.Model):
return self.cofprofile.is_cof
# Propriétés supplémentaires
@property
def balance_ukf(self):
return to_ukf(self.balance, is_cof=self.is_cof)
@property
def real_balance(self):
if hasattr(self, 'negative') and self.negative.balance_offset:
@ -121,6 +126,14 @@ class Account(models.Model):
def need_comment(self):
return self.trigramme == '#13'
@property
def readable(self):
return self.trigramme != 'GNR'
@property
def is_team(self):
return self.has_perm('kfet.is_team')
@staticmethod
def is_validandfree(trigramme):
data = { 'is_valid' : False, 'is_free' : False }
@ -302,6 +315,10 @@ class AccountNegative(models.Model):
('view_negs', 'Voir la liste des négatifs'),
)
@property
def until_default(self):
return self.start + kfet_config.overdraft_duration
class Checkout(models.Model):
created_by = models.ForeignKey(
@ -454,6 +471,10 @@ class Article(models.Model):
def get_absolute_url(self):
return reverse('kfet.article.read', kwargs={'pk': self.pk})
def price_ukf(self):
return to_ukf(self.price)
class ArticleRule(models.Model):
article_on = models.OneToOneField(
Article, on_delete = models.PROTECT,

View file

@ -23,6 +23,8 @@
.kfetopen .details {
margin: 0;
padding: 10px !important;
min-width: 200px;
font-family: "Roboto Slab";
font-size: 16px;
color: black;
}

View file

@ -4,6 +4,7 @@ from django.contrib import messages
from django.contrib.auth.signals import user_logged_in
from django.core.urlresolvers import reverse
from django.dispatch import receiver
from django.utils.safestring import mark_safe
@receiver(user_logged_in)
@ -12,8 +13,9 @@ def messages_on_login(sender, request, user, **kwargs):
user.has_perm('kfet.is_team') and
hasattr(request, 'GET') and
'k-fet' in request.GET.get('next', '')):
messages.info(
request,
('<a href="{}" target="_blank">Connexion en utilisateur partagé ?</a>'
.format(reverse('kfet.login.genericteam'))),
extra_tags='safe')
messages.info(request, mark_safe(
'<a href="{}" class="genericteam" target="_blank">'
' Connexion en utilisateur partagé ?'
'</a>'
.format(reverse('kfet.login.genericteam'))
))

View file

@ -0,0 +1,88 @@
/* General ------------------------- */
.btn {
border: 0;
outline: none !important;
transition: background-color, border, color, opacity;
transition-duration: 0.15s;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
font-family: "Roboto Slab";
}
.btn, .btn-lg, .btn-group-lg>.btn {
border-radius:0;
}
/* Default ------------------------- */
.btn-default {
background-color: transparent !important;
color: #555;
}
.btn-default:hover,
.btn-default.focus, .btn-default:focus {
color: #c8102e;
}
.btn-default[disabled]:hover, .btn-default.disabled:hover {
color: inherit !important;
}
/* Primary ------------------------- */
.btn-primary {
background-color:#c63b52;
color:#FFF;
}
.btn-primary:hover,
.btn-primary.focus, .btn-primary:focus,
.btn-primary.active.focus, .btn-primary.active:focus, .btn-primary.active:hover,
.btn-primary:active.focus, .btn-primary:active:focus, .btn-primary:active:hover {
background-color:#c8102e;
color:#FFF;
}
/* Primary + White background ------ */
.btn-primary-w {
background: white;
color: black;
}
.btn-primary-w:hover {
background: #c63b52;
color: white;
}
.btn-primary-w.focus, .btn-primary-w:focus,
.btn-primary-w.active.focus, .btn-primary-w.active:focus, .btn-primary-w.active:hover,
.btn-primary-w:active.focus, .btn-primary-w:active:focus, .btn-primary-w:active:hover {
background: #c8102e;
color: white;
}
/* Nav ----------------------------- */
.btn-nav {
background-color: transparent !important;
color: inherit;
border-bottom: 1px solid #ddd;
}
.btn-nav:hover,
.btn-nav.focus, .btn-nav:focus,
.btn-nav.active.focus, .btn-nav.active:focus, .btn-nav.active:hover,
.btn-nav:active.focus, .btn-nav:active:focus, .btn-nav:active:hover {
border-bottom: 1px solid #c8102e;
}

View file

@ -0,0 +1,151 @@
.fixed > * + * {
margin-top: 15px;
}
/* Aside --------------------------- */
/* Aside - Block */
aside {
background: white;
padding: 15px;
}
aside > * + * {
margin-top: 15px;
}
/* Aside - Misc */
aside .glyphicon-question-sign {
font-size: 0.8;
}
aside h4 {
font-weight: bold;
}
/* Aside - Heading */
aside .heading {
font-family: "Roboto Slab";
font-size: 25px;
font-weight: bold;
line-height: 1.1;
text-align: center;
}
aside .heading .big {
font-size: 2em;
}
aside .heading .sub {
font-size: 0.7em;
font-weight: normal;
}
@media (min-width: 992px) {
aside .heading {
font-size: 32px;
line-height: 1.3;
}
}
/* Aside - Buttons */
aside .buttons {
margin-left: -15px;
margin-right: -15px;
}
aside .buttons > * {
flex: 0 1 auto !important;
}
/* Aside - Text */
aside .text {
line-height: 1.3;
font-size: 14px;
}
@media (min-width: 992px) {
aside .text {
line-height: 1.6;
font-size: 16px;
}
}
aside .text ul {
margin-bottom: 0;
}
/* Buttons ------------------------- */
.fixed .buttons {
display: flex;
flex-flow: row wrap;
justify-content: center;
text-align: center;
}
.fixed .buttons > * {
flex: 0 1 auto;
overflow: hidden;
}
.fixed .buttons > .solo {
flex: 1 100%;
}
@media (min-width: 768px) {
.fixed .buttons > * {
flex: 1 auto;
}
.fixed .buttons > .full > * {
width: 100%;
}
}
.fixed .buttons .btn {
padding: 8px 12px;
}
@media (min-width: 992px) {
.fixed .buttons .btn {
font-size: 16px;
}
}
/* Tabs ---------------------------- */
.fixed .tabs-buttons {
margin-bottom: -5px;
}
.fixed .tabs-buttons > * {
margin-bottom: 5px;
}
.fixed .tabs-buttons .glyphicon-chevron-right {
margin-left: 5px;
line-height: 1.4;
color: white;
}
@media (min-width: 768px) {
.fixed .tabs-buttons {
text-align: right;
justify-content: flex-end;
}
.fixed .tabs-buttons > * {
flex: 1 100%;
}
}

View file

@ -0,0 +1,18 @@
.footer {
line-height: 40px;
background: #c63b52;
color: white;
text-align: center;
font-size: 14px;
font-family: Roboto;
}
.footer a {
color: inherit !important;
}
.footer a:hover, .footer a:focus {
text-decoration: underline;
}

View file

@ -0,0 +1,138 @@
/* Global layout ------------------- */
.main-col, .fixed-col {
padding: 0 0 15px;
}
@media (min-width: 768px) {
.fixed-col {
position: sticky;
top: 35px;
padding-top: 15px;
}
.fixed-col + .main-col {
padding: 15px 0 15px 15px;
}
}
@media (min-width: 992px) {
.main-col {
padding: 15px;
}
}
.main-col-mult {
column-gap: 45px;
}
.main-bg {
background: white;
}
.main-padding {
padding: 15px;
}
@media (min-width: 768px) {
.main-padding {
padding: 30px;
}
}
/* Section ------------------------- */
section {
margin-bottom: 15px;
position:relative;
}
section:last-child {
margin-bottom: 0;
}
/* Section - Elements -------------- */
section > * {
background: white;
padding: 15px;
}
section > .full,
section > table,
section > .table-responsive {
padding: 0 !important;
margin-left: 0 !important;
margin-right: 0 !important;
}
section .full {
margin-left: -15px;
margin-right: -15px;
}
@media (min-width: 992px) {
section > * {
padding: 30px;
}
section .full {
margin-left: -30px;
margin-right: -30px;
}
}
section .row > div:last-child {
margin-bottom: 0 !important;
}
@media (max-width: 768px) {
section .row > div {
margin-bottom: 10px;
}
}
@media (max-width: 1200px) {
section .row > div {
margin-bottom: 20px;
}
}
section ul ul {
padding-left: 30px;
}
/* Titles & Heading */
section h2,
section .heading {
background: transparent;
margin: 20px 15px 15px;
padding: 0;
border-bottom: 3px solid #c8102e;
font-family: "Roboto Slab";
font-size: 40px;
line-height: 1.1;
}
section h3 {
border-bottom: 2px solid #c8102e;
margin: 0 0 10px;
padding: 10px 0 10px;
font-size: 25px;
font-weight: bold;
}
section .heading .buttons {
opacity: 0.7;
top: 10px;
float: right;
}
section h2:first-child,
section h3:first-child {
padding-top: 0;
margin-top: 0;
}

View file

@ -0,0 +1,36 @@
.messages .alert {
padding:10px 15px;
margin:0;
border:0;
border-radius:0;
}
.messages .alert:last-child {
margin-bottom: 15px;
}
.messages .alert .close {
top:0;
right:0;
}
.messages .alert-info {
color:inherit;
background-color:#ccc;
}
.messages .alert-error {
color: white;
background-color: #c63b52;
}
.messages .alert-success {
color: white;
background: #3d9947;
}
.messages a {
font-weight: bold;
text-decoration: none;
}

View file

@ -0,0 +1,118 @@
/* General ------------------------- */
body {
margin-top:50px;
font-family:Roboto;
background:#ddd;
}
.glyphicon + span, span + .glyphicon {
margin-left: 10px;
}
/* Titles */
h1,h2,h3,h4,h5,h6 {
font-family:"Roboto Slab";
}
/* Links */
a {
color:#C8202E;
}
a:focus, a:hover {
color:#C8102E;
}
/* Inputs */
:focus {
outline:none;
}
textarea {
font-family:'Roboto Mono';
border-radius:0 !important;
}
/* Lists */
ul, ol {
padding-left: 30px;
}
ul {
list-style-type: square;
}
/* Tables */
.table {
margin-bottom:0;
border-bottom:1px solid #ddd;
width:100%;
background-color: #FFF;
}
.table td {
vertical-align:middle !important;
}
.table td.no-padding {
padding:0;
}
.table thead {
background:#c8102e;
color:#fff;
font-weight:bold;
font-size:16px;
}
.table thead td {
padding:8px !important;
}
.table tr.section {
background: #c63b52 !important;
color:#fff;
font-weight:bold;
}
.table tr.section td {
border-top:0;
font-size:16px;
padding:8px 30px;
}
.table tr.more td {
padding: 0;
}
.table-responsive {
border: 0;
margin-bottom: 0;
}
/* Toggle on hover ----------------- */
.toggle:not(:hover) .hover {
display: none;
}
.toggle:hover .base {
display: none;
}
/* Spinning animation -------------- */
.glyphicon.spinning {
animation: spin 1s infinite linear;
}
@keyframes spin {
from { transform: scale(1) rotate(0deg); }
to { transform: scale(1) rotate(360deg); }
}

View file

@ -0,0 +1,151 @@
.navbar {
background: #000;
color: #DDD;
border: 0;
font-family: Roboto;
}
.navbar .navbar-header {
float: left;
display: none;
margin-left: -15px;
margin-right: 0;
}
.navbar .navbar-brand {
padding: 3px 0;
margin: 0 15px !important;
}
.navbar .navbar-brand img {
height: 44px;
}
.navbar .navbar-toggle {
border: 0;
border-radius: 0;
padding: 18px 15px;
margin: 0;
min-width: auto;
}
.navbar .navbar-toggle .icon-bar {
background: #fff;
}
.navbar-nav {
font-size: 14px;
margin: 0 0 0 -15px;
float: left;
}
@media (min-width: 460px) {
.navbar .navbar-header {
display: block;
}
.navbar-nav {
margin-left: 0;
}
.navbar-nav .nav-pages.dropdown .dropdown-menu > li:first-child {
display: none;
}
}
.navbar-right {
float: right !important;
margin: 0 -15px 0 0;
}
.navbar-nav a {
transition: background-color, box-shadow, color;
transition-duration: 0.15s;
}
.navbar-nav > li {
float: left;
text-align: center;
}
.navbar-nav > li > a {
min-width: 50px;
padding: 15px 10px;
color: #FFF;
}
.navbar-nav > .divider {
height: 1px;
background: rgba(255, 255, 255, 0.1);
}
@media (min-width: 1200px) {
.navbar-nav > li > a {
padding-left: 15px;
padding-right: 15px;
}
}
.navbar-nav > li > a:hover, .navbar-nav > li > a:focus,
.nav .open > a:hover, .nav .open > a:focus,
.navbar-nav > li.active > a,
.navbar-nav .dropdown:hover > a, .navbar-nav .dropdown:focus > a {
background-color: #C8102E;
color: #FFF;
box-shadow: inset 0 3px 3px -4px #000;
}
.navbar-nav .dropdown .dropdown-menu {
padding: 0;
border: 0;
border-radius: 0;
background-color: #FFF;
font-size: 14px;
/* override max-width: 767px of bs */
position: absolute;
float: left;
box-shadow: 0 6px 12px rgba(0,0,0,.175);
}
.navbar-nav .dropdown .dropdown-menu > li > a {
padding: 8px 10px;
line-height: inherit;
color: #000;
}
.navbar-nav .dropdown .dropdown-menu > li > a:hover,
.navbar-nav .dropdown .dropdown-menu > li > a:focus {
color: #c8102e;
background-color: transparent;
}
.navbar-nav .dropdown .dropdown-menu .divider {
margin: 0;
}
.navbar-nav .dropdown .dropdown-menu {
display: block;
visibility: hidden;
opacity: 0;
transition: opacity 0.15s;
}
.navbar-nav .dropdown:hover > .dropdown-menu,
.navbar-nav .dropdown:focus > .dropdown-menu,
.navbar-nav .dropdown.open > .dropdown-menu {
visibility: visible;
opacity: 1;
}
@media (min-width: 992px) {
.navbar-nav .dropdown .dropdown-menu > li > a {
padding-left: 20px;
padding-right: 20px;
}
}
.nav-app .dropdown-menu {
right: 0;
left: auto;
}

View file

@ -9,9 +9,10 @@
#history .day {
height:40px;
line-height:40px;
background-color:rgba(200,16,46,0.9);
background-color:rgba(200,16,46,1);
color:#fff;
padding-left:20px;
font-family:"Roboto Slab";
font-size:16px;
font-weight:bold;
position:sticky;
@ -22,7 +23,7 @@
#history .opegroup {
height:30px;
line-height:30px;
background-color:rgba(200,16,46,0.75);
background-color: #c63b52;
color:#fff;
font-weight:bold;
padding-left:20px;

View file

@ -1,54 +0,0 @@
ul.carte {
width: 100%;
list-style-type: none;
padding-left: 15px;
padding-right: 15px;
display: inline-block;
*display: inline;
zoom: 1;
position: relative;
clip: auto;
overflow: hidden;
}
/*
ul.carte > li {
border-style: none none solid none;
border-width: 1px;
border-color: #DDD;
}
*/
li.carte-line {
position: relative;
text-align: right;
white-space: nowrap;
}
.filler {
position: absolute;
left: 0;
right: 0;
border-bottom: 3px dotted #333;
height: 70%;
}
.carte-label {
background: white;
float: left;
padding-right: 4px;
position: relative;
max-width: calc(100% - 40px);
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.carte-ukf {
background: white;
padding-left: 4px;
position: relative;
}
.unbreakable.carte-inverted .carte-ukf,
.unbreakable.carte-inverted .carte-label,
.unbreakable.carte-inverted {
background: #FFDBC7;
}

View file

@ -1,275 +1,78 @@
@import url("nav.css");
/* Libs */
@import url("libs/columns.css");
/* Libs customizations */
@import url("libs/jconfirm-kfet.css");
@import url("libs/multiple-select-kfet.css");
/* Base */
@import url("base/misc.css");
@import url("base/buttons.css");
/* Blocks */
@import url("base/main.css");
@import url("base/nav.css");
@import url("base/messages.css");
@import url("base/fixed.css");
@import url("base/footer.css");
/* Components */
@import url("kpsul.css");
@import url("jconfirm-kfet.css");
@import url("history.css");
body {
margin-top:50px;
font-family:Roboto;
background:#ddd;
.header {
padding: 15px 20px;
background-color: rgba(200,16,46,1);
color: #FFF;
}
h1,h2,h3,h4,h5,h6 {
font-family:Oswald;
}
a {
color:#333;
}
a:focus, a:hover {
color:#C8102E;
}
:focus {
outline:none;
}
textarea {
font-family:'Roboto Mono';
border-radius:0 !important;
}
.glyphicon.spinning {
animation: spin 1s infinite linear;
}
@keyframes spin {
from { transform: scale(1) rotate(0deg); }
to { transform: scale(1) rotate(360deg); }
}
.table {
margin-bottom:0;
border-bottom:1px solid #ddd;
width:100%;
background-color: #FFF;
}
.table td {
vertical-align:middle !important;
}
.table td.no-padding {
padding:0;
}
.table thead {
background:#c8102e;
color:#fff;
font-weight:bold;
font-size:16px;
}
.table thead td {
padding:8px !important;
}
.table tr.section {
background:rgba(200,16,46,0.9);
color:#fff;
font-weight:bold;
}
.table tr.section td {
border-top:0;
font-size:16px;
padding:8px 30px;
}
.table-responsive {
border: 0;
margin-bottom: 0;
}
.btn {
transition: background-color, color;
transition-duration: 0.15s;
}
.btn, .btn-lg, .btn-group-lg>.btn {
border-radius:0;
}
.btn-primary {
font-family:Oswald;
background-color:rgba(200,16,46,0.9);
color:#FFF;
border:0;
}
.btn-primary:hover,
.btn-primary.focus, .btn-primary:focus,
.btn-primary.active.focus, .btn-primary.active:focus, .btn-primary.active:hover,
.btn-primary:active.focus, .btn-primary:active:focus, .btn-primary:active:hover,
.nav-pills>li.active>a, .nav-pills>li.active>a:focus, .nav-pills>li.active>a:hover {
outline: 0;
background-color:rgba(200,16,46,1);
color:#FFF;
}
.btn-primary[disabled]:hover,
.btn-primary[disabled]:focus {
background-color: #000;
color: #666;
}
.nav-pills>li>a {
border-radius:0;
}
.nav-pills>li>a:focus, .nav-pills>li>a:hover {
outline: 0;
background-color:rgba(200,16,46,1);
color:#FFF;
}
.row-page-header {
background-color:rgba(200,16,46,1);
color:#FFF;
border-bottom:3px solid #000;
}
.page-header {
border:0;
padding:0;
margin:15px 20px;
text-transform:uppercase;
font-weight:bold;
.header h1 {
padding: 0;
margin: 0;
font-weight: bold;
}
.nopadding {
padding: 0 !important;
}
.col-content-left, .col-content-right {
padding:0;
}
@media (min-width: 768px) {
.col-content-left {
position: sticky;
top:50px;
}
}
.content-left-top {
background:#fff;
padding:10px 30px;
}
.content-left .buttons {
background:#fff;
}
.content-left .buttons .btn {
display:block;
}
.content-left .buttons ul.nav-pills {
margin-bottom:5px;
}
.content-left .buttons ul.nav-pills li {
margin:0 0 -5px;
}
.content-left-top.frozen-account {
background:#000FBA;
.frozen-account {
background:#5072e0;
color:#fff;
}
.content-left .block {
padding-top:25px;
.main .table a:not(.btn) {
color: inherit;
}
.content-left .block .line {
font-size:16px;
line-height:30px;
.main .table a:not(.btn):focus ,
.main .table a:not(.btn):hover {
color: #C81022;
}
.content-left .line.line-big {
font-family:Oswald;
font-size:60px;
font-weight:bold;
text-align:center;
}
.content-left .line.line-bigsub {
font-size:25px;
font-weight:bold;
text-align:center;
}
.content-left .line.balance {
font-size:45px;
text-align:center;
}
@media (min-width: 768px) {
.content-right {
margin: 15px;
}
}
.content-right-block {
position:relative;
}
.content-right-block > *:not(.buttons-title) {
background: #fff;
}
.content-right-block > h2 {
background: transparent !important;
}
.content-right-block .buttons-title {
position:absolute;
top:8px;
right:20px;
}
.content-right-block > div.row {
margin:0;
}
.content-right-block h2 {
margin:20px 20px 15px;
padding-bottom:5px;
border-bottom:3px solid #c8102e;
font-size:40px;
}
.content-right-block h3 {
border-bottom: 1px solid #c8102e;
margin: 0px 15px 15px;
padding: 20px 20px 10px;
font-size:25px;
}
/*
* Pages tableaux seuls
*/
.content-center > *:not(.content-right-block) {
background: #fff;
}
@media (min-width: 992px) {
.content-center {
margin: 15px 0;
}
}
.content-center tbody tr:not(.section) td {
padding:0px 5px;
}
.table .form-control {
padding: 1px 12px ;
height:28px;
margin:3px 0px;
background: transparent;
}
.table .form-control[disabled], .table .form-control[readonly] {
background: #f5f5f5;
}
.table-condensed-input tbody tr:not(.section) td {
padding:0px 5px;
}
.table-condensed input.form-control {
@ -279,19 +82,34 @@ textarea {
border-radius: 0;
}
.content-center .auth-form {
margin:15px;
.auth-form {
padding: 15px 0;
background: #d86c7e;
color: white;
}
.auth-form.form-horizontal {
padding: 0;
margin: 0;
}
.auth-form .form-group {
margin-bottom: 0;
}
.auth-form input {
box-shadow: none !important;
background: transparent;
color: white;
border: 0 !important;
border-radius: 0;
border-bottom: 1px solid white !important;
}
/*
* Pages formulaires seuls
*/
.content-form {
background-color: #fff;
padding: 15px;
}
.account_create #id_trigramme {
display:block;
width:200px;
@ -354,42 +172,48 @@ textarea {
padding:5px 20px;
}
/*
* Messages
/* Account autocomplete window */
#account_results ul {
list-style-type:none;
background:rgba(255,255,255,0.9);
padding:0;
}
#account_results li {
display:block;
padding:5px 20px;
height:100%;
width:100%;
}
#account_results .hilight {
background:rgba(200,16,46,0.9);
color:#fff;
text-decoration:none;
}
/**
* Stats (graphs)
*/
.messages {
margin: 0;
.stat-nav {
margin-bottom: 10px;
font-family: Roboto;
}
.messages .alert {
padding:10px 15px;
margin:0;
border:0;
border-radius:0;
.stat-nav li {
float: left;
}
.messages .alert-dismissible {
padding-right:35px;
.stat-nav a {
opacity: 0.6;
font-family: Roboto;
}
.messages .alert .close {
top:0;
right:0;
}
.messages .alert-info {
color:inherit;
background-color:#ccc;
}
.messages .alert-error {
color:inherit;
background-color:rgba(200,16,46,0.2);
}
.messages .alert-success {
color:#333;
.stat-nav a:hover,
.stat-nav a.focus, .stat-nav a:focus {
opacity: 1;
}
/*
@ -412,7 +236,7 @@ textarea {
margin-top:30px;
padding-top:1px;
padding-bottom:15px;
background:rgba(51,51,51,0.7);
background:rgba(51,51,51,0.9);
color:#fff;
}
@ -449,159 +273,10 @@ thead .tooltip {
height: 100px;
}
/*
* Responsive Columns
*/
.unbreakable {
display:inline-block;
width: 100%;
}
.column-row {
padding: 15px 20px;
}
.column-xs-1,
.column-sm-1,
.column-md-1,
.column-lg-1,
.column-xs-2,
.column-sm-2,
.column-md-2,
.column-lg-2,
.column-xs-3,
.column-sm-3,
.column-md-3,
.column-lg-3,
.column-xs-4,
.column-sm-4,
.column-md-4,
.column-lg-4,
.column-xs-5,
.column-sm-5,
.column-md-5,
.column-lg-5 {
-webkit-column-count: 1; /* Chrome, Safari, Opera */
-moz-column-count: 1; /* Firefox */
column-count: 1;
}
.column-xs-1 {
-webkit-column-count: 1; /* Chrome, Safari, Opera */
-moz-column-count: 1; /* Firefox */
column-count: 1;
}
.column-xs-2 {
-webkit-column-count: 2; /* Chrome, Safari, Opera */
-moz-column-count: 2; /* Firefox */
column-count: 2;
}
.column-xs-3 {
-webkit-column-count: 3; /* Chrome, Safari, Opera */
-moz-column-count: 3; /* Firefox */
column-count: 3;
}
.column-xs-4 {
-webkit-column-count: 4; /* Chrome, Safari, Opera */
-moz-column-count: 4; /* Firefox */
column-count: 4;
}
.column-xs-5 {
-webkit-column-count: 5; /* Chrome, Safari, Opera */
-moz-column-count: 5; /* Firefox */
column-count: 5;
}
@media (min-width: 576px) {
.column-sm-1 {
-webkit-column-count: 1; /* Chrome, Safari, Opera */
-moz-column-count: 1; /* Firefox */
column-count: 1;
}
.column-sm-2 {
-webkit-column-count: 2; /* Chrome, Safari, Opera */
-moz-column-count: 2; /* Firefox */
column-count: 2;
}
.column-sm-3 {
-webkit-column-count: 3; /* Chrome, Safari, Opera */
-moz-column-count: 3; /* Firefox */
column-count: 3;
}
.column-sm-4 {
-webkit-column-count: 4; /* Chrome, Safari, Opera */
-moz-column-count: 4; /* Firefox */
column-count: 4;
}
.column-sm-5 {
-webkit-column-count: 5; /* Chrome, Safari, Opera */
-moz-column-count: 5; /* Firefox */
column-count: 5;
}
}
@media (min-width: 768px) {
.column-md-1 {
-webkit-column-count: 1; /* Chrome, Safari, Opera */
-moz-column-count: 1; /* Firefox */
column-count: 1;
}
.column-md-2 {
-webkit-column-count: 2; /* Chrome, Safari, Opera */
-moz-column-count: 2; /* Firefox */
column-count: 2;
}
.column-md-3 {
-webkit-column-count: 3; /* Chrome, Safari, Opera */
-moz-column-count: 3; /* Firefox */
column-count: 3;
}
.column-md-4 {
-webkit-column-count: 4; /* Chrome, Safari, Opera */
-moz-column-count: 4; /* Firefox */
column-count: 4;
}
.column-md-5 {
-webkit-column-count: 5; /* Chrome, Safari, Opera */
-moz-column-count: 5; /* Firefox */
column-count: 5;
}
}
@media (min-width: 992px) {
.column-lg-1 {
-webkit-column-count: 1; /* Chrome, Safari, Opera */
-moz-column-count: 1; /* Firefox */
column-count: 1;
}
.column-lg-2 {
-webkit-column-count: 2; /* Chrome, Safari, Opera */
-moz-column-count: 2; /* Firefox */
column-count: 2;
}
.column-lg-3 {
-webkit-column-count: 3; /* Chrome, Safari, Opera */
-moz-column-count: 3; /* Firefox */
column-count: 3;
}
.column-lg-4 {
-webkit-column-count: 4; /* Chrome, Safari, Opera */
-moz-column-count: 4; /* Firefox */
column-count: 4;
}
.column-lg-5 {
-webkit-column-count: 5; /* Chrome, Safari, Opera */
-moz-column-count: 5; /* Firefox */
column-count: 5;
}
}
/* Inventaires */
#inventoryform input[type=number] {
.table-condensed-input input[type=number] {
text-align: center;
}
@ -620,18 +295,6 @@ thead .tooltip {
margin: 0 auto;
}
/* Multiple select customizations */
.ms-choice {
height: 34px !important;
line-height: 34px !important;
border: 1px solid #ccc !important;
box-shadow: inset 0 1px 1px rgba(0,0,0,.075) !important;
}
.ms-choice > div {
top: 4px !important;
}
/* Checkbox select multiple */

View file

@ -154,9 +154,10 @@ input[type=number]::-webkit-outer-spin-button {
height:50px;
padding:0 15px;
background:rgba(200,16,46,0.9);
background:rgba(200,16,46,1);
color:#fff;
font-family:"Roboto Slab";
font-weight:bold;
font-size:18px;
}
@ -237,16 +238,10 @@ input[type=number]::-webkit-outer-spin-button {
height:40px;
}
#special_operations button {
height:100%;
width:25%;
#special_operations .btn {
height:40px;
float:left;
background: rgba(200,16,46,0.9);
color:#FFF;
font-size:18px;
font-size:15px;
font-weight:bold;
text-overflow: ellipsis;
@ -254,12 +249,6 @@ input[type=number]::-webkit-outer-spin-button {
overflow: hidden;
}
#special_operations button:focus,
#special_operations button:hover {
outline:none;
background: rgba(200,16,46,1);
color:#fff;
}
/* Article autocomplete */
@ -328,16 +317,22 @@ input[type=number]::-webkit-outer-spin-button {
font-size:14px;
}
#articles_data table tr.article>td:first-child {
#articles_data table tr.article td:first-child {
padding-left:10px;
}
#articles_data table tr.article td + td {
padding-right:10px;
text-align:right;
}
#articles_data table tr.category {
height:35px;
background-color:rgba(200,16,46,0.9);
background-color:#c8102e;
font-family:"Roboto Slab";
font-size:16px;
color:#FFF;
font-weight:bold;
color:#FFF;
}
#articles_data table tr.category>td:first-child {

View file

@ -0,0 +1,43 @@
.unbreakable {
display:inline-block;
width: 100%;
}
.column-xs-1, .column-sm-1, .column-md-1, .column-lg-1,
.column-xs-2, .column-sm-2, .column-md-2, .column-lg-2,
.column-xs-3, .column-sm-3, .column-md-3, .column-lg-3,
.column-xs-4, .column-sm-4, .column-md-4, .column-lg-4,
.column-xs-5, .column-sm-5, .column-md-5, .column-lg-5 {
column-count: 1;
}
.column-xs-1 { column-count: 1; }
.column-xs-2 { column-count: 2; }
.column-xs-3 { column-count: 3; }
.column-xs-4 { column-count: 4; }
.column-xs-5 { column-count: 5; }
@media (min-width: 768px) {
.column-sm-1 { column-count: 1; }
.column-sm-2 { column-count: 2; }
.column-sm-3 { column-count: 3; }
.column-sm-4 { column-count: 4; }
.column-sm-5 { column-count: 5; }
}
@media (min-width: 992px) {
.column-md-1 { column-count: 1; }
.column-md-2 { column-count: 2; }
.column-md-3 { column-count: 3; }
.column-md-4 { column-count: 4; }
.column-md-5 { column-count: 5; }
}
@media (min-width: 1200px) {
.column-lg-1 { column-count: 1; }
.column-lg-2 { column-count: 2; }
.column-lg-3 { column-count: 3; }
.column-lg-4 { column-count: 4; }
.column-lg-5 { column-count: 5; }
}

View file

@ -5,7 +5,7 @@
.jconfirm .jconfirm-box {
padding:0;
border-radius:0 !important;
font-family:"Roboto Mono";
font-family:Roboto;
}
.jconfirm .jconfirm-box div.title-c .title {
@ -28,7 +28,6 @@
.jconfirm .jconfirm-box .content {
border-bottom:1px solid #ddd;
padding:5px 10px;
}
.jconfirm .jconfirm-box input {
@ -37,6 +36,7 @@
border:0;
font-family:"Roboto Mono";
font-size:40px;
text-align:center;
@ -49,6 +49,7 @@
}
.jconfirm .jconfirm-box .buttons button {
min-width:40px;
height:100%;
margin:0;
margin:0 !important;
@ -84,24 +85,3 @@
padding-right: 50px;
padding-left: 50px;
}
/* Account autocomplete window */
#account_results ul {
list-style-type:none;
background:rgba(255,255,255,0.9);
padding:0;
}
#account_results li {
display:block;
padding:5px 20px;
height:100%;
width:100%;
}
#account_results .hilight {
background:rgba(200,16,46,0.9);
color:#fff;
text-decoration:none;
}

View file

@ -0,0 +1,14 @@
/**
* Multiple Select plugin customizations
*/
.ms-choice {
height: 34px !important;
line-height: 34px !important;
border: 1px solid #ccc !important;
box-shadow: inset 0 1px 1px rgba(0,0,0,.075) !important;
}
.ms-choice > div {
top: 4px !important;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

View file

@ -189,3 +189,13 @@ function requestAuth(data, callback, focus_next = null) {
});
}
/**
* Setup jquery-confirm
*/
jconfirm.defaults = {
confirmButton: '<span class="glyphicon glyphicon-ok"></span>',
cancelButton: '<span class="glyphicon glyphicon-remove"></span>'
};

View file

@ -7,7 +7,7 @@
var self = this;
var element = $(target);
var content = $("<div>");
var content = $("<div class='full'>");
var buttons;
function dictToArray (dict, start) {
@ -67,7 +67,6 @@
{
label: chart.label,
borderColor: chart.color,
backgroundColor: chart.color,
fill: is_time_chart,
lineTension: 0,
data: chart_data,
@ -154,9 +153,8 @@
// initialize the interface
function initialize (data) {
// creates the bar with the buttons
buttons = $("<div>",
{class: "btn-group btn-group-justified",
role: "group",
buttons = $("<ul>",
{class: "nav stat-nav",
"aria-label": "select-period"});
var to_click;
@ -164,11 +162,9 @@
for (var i = 0; i < context.length; i++) {
// creates the button
var btn_wrapper = $("<div>",
{class: "btn-group",
role:"group"});
var btn = $("<button>",
{class: "btn btn-primary",
var btn_wrapper = $("<li>", {role:"presentation"});
var btn = $("<a>",
{class: "btn btn-nav",
type: "button"})
.text(context[i].label)
.prop("stats_target_url", context[i].url)

View file

@ -1,41 +1,51 @@
{% extends "kfet/base_col_2.html" %}
{% block title %}Liste des comptes{% endblock %}
{% block title %}Comptes{% endblock %}
{% block header-title %}Comptes{% endblock %}
{% block fixed-content %}
{% block fixed %}
<aside>
<div class="heading">
{% with n_accounts=accounts|length|add:-1 %}
{{ n_accounts }}
<span class="sub">compte{{ n_accounts|pluralize }}</span>
{% endwith %}
</div>
</aside>
<div class="content-left-top">
<div class="line line-big">{{ accounts|length|add:-1 }}</div>
<div class="line line-bigsub">compte{{ accounts|length|add:-1|pluralize }}</div>
</div>
<div class="buttons">
<a class="btn btn-primary btn-lg" href="{% url 'kfet.account.create' %}">Créer un compte</a>
<div class="solo full">
<a class="btn btn-primary" href="{% url 'kfet.account.create' %}">
<span class="glyphicon glyphicon-plus"></span>
<span>Créer un compte</span>
</a>
</div>
{% if perms.kfet.manage_perms %}
<a class="btn btn-primary btn-lg" href="{% url 'kfet.account.group' %}">Permissions</a>
<a class="btn btn-primary" href="{% url 'kfet.account.group' %}">Permissions</a>
{% endif %}
{% if perms.kfet.view_negs %}
<a class="btn btn-primary btn-lg" href="{% url 'kfet.account.negative' %}">Négatifs</a>
<a class="btn btn-primary" href="{% url 'kfet.account.negative' %}">Négatifs</a>
{% endif %}
</div>
{% endblock %}
{% block main-content %}
{% block main %}
<div class="content-right-block">
<h2>Liste des comptes</h2>
<section>
<div class="table-responsive">
<table class="table table-condensed">
<table class="table table-hover table-condensed">
<thead>
<tr>
<td></td>
<td>Trigramme</td>
<td class="text-center">Tri.</td>
<td>Nom</td>
<td>Balance</td>
<td>COF</td>
<td class="text-right">Balance</td>
<td class="text-center">COF</td>
<td>Dpt</td>
<td>Promo</td>
<td class="text-center">Promo</td>
</tr>
</thead>
<tbody>
@ -43,20 +53,19 @@
<tr>
<td class="text-center">
<a href="{% url 'kfet.account.read' account.trigramme %}">
<span class="glyphicon glyphicon-cog"></span>
{{ account.trigramme }}
</a>
</td>
<td>{{ account.trigramme }}</td>
<td>{{ account.name }}</td>
<td class="text-right">{{ account.balance }}€</td>
<td>{{ account.is_cof|yesno:"Oui,Non" }}</td>
<td class="text-center">{{ account.is_cof|yesno }}</td>
<td>{{ account.departement }}</td>
<td>{{ account.promo|default_if_none:'' }}</td>
<td class="text-center">{{ account.promo|default_if_none:'' }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</section>
{% endblock %}

View file

@ -1,4 +1,4 @@
{% extends "kfet/base_col_1.html" %}
{% extends "kfet/base_form.html" %}
{% load staticfiles %}
{% block title %}Nouveau compte{% endblock %}
@ -8,9 +8,7 @@
<script src="{% static "autocomplete_light/autocomplete.js" %}" type="text/javascript"></script>
{% endblock %}
{% block main-class %}content-form{% endblock %}
{% block main-content %}
{% block main %}
<form action="" method="post" class="account_create">
{% csrf_token %}
@ -18,7 +16,6 @@
{{ trigramme_form.trigramme.errors }}
{{ trigramme_form.trigramme }}
</div>
<div id="trigramme_valid"></div>
<p class="help-block">Les mots contenant des caractères non alphanumériques seront ignorés</p>
<input type="text" name="q" id="search_autocomplete" spellcheck="false" placeholder="Chercher un utilisateur par nom, prénom ou identifiant clipper" class="form-control">
<div style="position:relative;">
@ -62,7 +59,6 @@
// et de ladisponibilité du trigramme choisi
$('#id_trigramme').on('input', function() {
var trigramme = $('#id_trigramme').val().toUpperCase();
var container = '#trigramme_valid';
var pattern = /^[^a-z]{3}$/;
if (!(trigramme.match(pattern))) {

View file

@ -10,7 +10,7 @@
{% block main-class %}content-form{% endblock %}
{% block main-content %}
{% block main %}
<form action="" method="post" class="account_create">
{% csrf_token %}

View file

@ -3,49 +3,59 @@
{% block title %}Groupes de comptes{% endblock %}
{% block header-title %}Groupes de comptes{% endblock %}
{% block fixed-content %}
{% block fixed %}
<div class="buttons">
<a class="btn btn-primary btn-lg" href="{% url 'kfet.account.group.create' %}">Créer un groupe</a>
<a class="btn btn-primary" href="{% url 'kfet.account.group.create' %}">
<span class="glyphicon glyphicon-plus"></span><span>Créer un groupe</span>
</a>
</div>
{% endblock %}
{% block main-content %}
{% block main %}
{% for group in groups %}
<div class="content-right-block">
<div class="buttons-title">
<a class="btn btn-primary" href="{% url 'kfet.account.group.update' group.pk %}">
<span class="glyphicon glyphicon-cog"></span>
</a>
<section>
<div class="heading">
{{ group.name }}
<div class="buttons">
<a class="btn btn-default" href="{% url 'kfet.account.group.update' group.pk %}">
<span class="glyphicon glyphicon-cog"></span><span class="hidden-xs">Éditer</span>
</a>
</div>
</div>
<h2>{{ group.name }}</h2>
<div class="row">
<div class="col-sm-6">
<h3>Permissions</h3>
<div>
<h3>Comptes</h3>
<div class="sub-block column-sm-2 column-md-3">
<ul>
{% for user in group.user_set.all %}
<li>
<a href="{% url "kfet.account.update" user.profile.account_kfet.trigramme %}">
{{ user.profile.account_kfet }}
</a>
</li>
{% endfor %}
</ul>
</div>
<h3>Permissions</h3>
<div class="column-sm-2 column-lg-3">
{% regroup group.permissions.all by content_type as grouped_perms %}
<ul class="list-unstyled">
{% for perms_group in grouped_perms %}
<li><b>{{ perms_group.grouper|title }}</b>
<ul class="list-unstyled">
{% for perm in perms_group.list %}
<li style="padding-left: 20px">{{ perm.name }}</li>
{% endfor %}
<li class="unbreakable">
<b>{{ perms_group.grouper|title }}</b>
<ul>
{% for perm in perms_group.list %}
<li>{{ perm.name }}</li>
{% endfor %}
</ul>
{% endfor %}
</ul>
</div>
<div class="col-sm-6">
<h3>Comptes</h3>
<ul class="list-unstyled">
{% for user in group.user_set.all %}
<li>{{ user.profile.account_kfet }}</li>
</li>
{% endfor %}
</ul>
</div>
</div>
</div>
</section>
{% endfor %}
{% endblock %}

View file

@ -1,4 +1,4 @@
{% extends 'kfet/base_col_1.html' %}
{% extends 'kfet/base_form.html' %}
{% load staticfiles %}
{% load widget_tweaks %}
@ -10,9 +10,7 @@
{% block title %}Permissions - Édition{% endblock %}
{% block header-title %}Modification des permissions{% endblock %}
{% block main-class %}content-form{% endblock %}
{% block main-content %}
{% block main %}
<form action="" method="post" class="form-horizontal">
{% csrf_token %}
@ -23,8 +21,12 @@
<span class="input-group-addon">K-Fêt</span>
{{ form.name|add_class:"form-control" }}
</div>
{% if form.name.errors %}<span class="help-block">{{ form.name.errors }}</span>{% endif %}
{% if form.name.help_text %}<span class="help-block">{{ form.name.help_text }}</span>{% endif %}
{% if form.name.errors %}
<span class="help-block">{{ form.name.errors }}</span>
{% endif %}
{% if form.name.help_text %}
<span class="help-block">{{ form.name.help_text }}</span>
{% endif %}
</div>
</div>
{% include "kfet/form_field_snippet.html" with field=form.permissions %}

View file

@ -1,74 +1,76 @@
{% extends "kfet/base_col_2.html" %}
{% block title %}Comptes - Négatifs{% endblock %}
{% block header-title %}Comptes en négatifs{% endblock %}
{% block header-title %}Comptes en négatif{% endblock %}
{% block fixed-content %}
{% block fixed %}
<div class="content-left-top">
<div class="line line-big">{{ negatives|length }}</div>
<div class="line line-bigsub">compte{{ negatives|length|pluralize }} en négatif</div>
<div class="block">
<div class="line"><b>Total:</b> {{ negatives_sum|floatformat:2 }}€</div>
<aside>
<div class="heading">
{{ negatives|length }}
<span class="sub">compte{{ negatives|length|pluralize }} en négatif</span>
</div>
<div class="block">
<div class="line"><b>Découvert autorisé par défaut</b></div>
<div class="line">Montant: {{ kfet_config.overdraft_amount }}€</div>
<div class="line">Pendant: {{ kfet_config.overdraft_duration }}</div>
<div class="text">
<b>Total:</b> {{ negatives_sum|floatformat:2 }}€
</div>
</div>
<div class="text">
<b>Plafond par défaut</b>
<ul class="list-unstyled">
<li>Montant: {{ kfet_config.overdraft_amount }}€</li>
<li>Pendant: {{ kfet_config.overdraft_duration }}</li>
</ul>
</div>
</aside>
{% if perms.kfet.change_settings %}
<div class="buttons">
<a class="btn btn-primary btn-lg" href="{% url 'kfet.settings' %}">Modifier les valeurs par défaut</a>
<div class="full">
<button type="button" class="btn btn-primary" href="{% url 'kfet.settings' %}">Modifier les valeurs par défaut</a>
</div>
</div>
{% endif %}
{% endblock %}
{% block main-content %}
{% block main %}
<div class="content-right-block">
<h2>Liste des comptes en négatifs</h2>
<div class="table-responsive">
<table class="table table-condensed">
<thead>
<tr>
<td></td>
<td>Tri</td>
<td>Nom</td>
<td>Balance</td>
<td>Réelle</td>
<td>Début</td>
<td>Découvert autorisé</td>
<td>Jusqu'au</td>
<td>Balance offset</td>
</tr>
</thead>
<tbody>
{% for neg in negatives %}
<tr>
<td class="text-center">
<a href="{% url 'kfet.account.update' neg.account.trigramme %}">
<span class="glyphicon glyphicon-cog"></span>
</a>
</td>
<td>{{ neg.account.trigramme }}</td>
<td>{{ neg.account.name }}</td>
<td class="text-right">{{ neg.account.balance|floatformat:2 }}€</td>
<td class="text-right">
{% if neg.balance_offset %}
{{ neg.account.real_balance|floatformat:2 }}€
{% endif %}
</td>
<td>{{ neg.start|date:'d/m/Y H:i:s'}}</td>
<td>{{ neg.authz_overdraft_amount|default_if_none:'' }}</td>
<td>{{ neg.authz_overdrafy_until|default_if_none:'' }}</td>
<td>{{ neg.balance_offset|default_if_none:'' }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
<div class="table-responsive">
<table class="table table-hover table-condensed">
<thead>
<tr>
<td class="text-center">Tri.</td>
<td>Nom</td>
<td class="text-right">Balance</td>
<td class="text-right">Réelle</td>
<td>Début</td>
<td>Découvert autorisé</td>
<td>Jusqu'au</td>
<td>Balance offset</td>
</tr>
</thead>
<tbody>
{% for neg in negatives %}
<tr>
<td class="text-center">
<a href="{% url 'kfet.account.update' neg.account.trigramme %}">
{{ neg.account.trigramme }}
</a>
</td>
<td>{{ neg.account.name }}</td>
<td class="text-right">{{ neg.account.balance|floatformat:2 }}€</td>
<td class="text-right">
{% if neg.balance_offset %}
{{ neg.account.real_balance|floatformat:2 }}€
{% endif %}
</td>
<td>{{ neg.start|date:'d/m/Y H:i:s'}}</td>
<td>{{ neg.authz_overdraft_amount|default_if_none:'' }}</td>
<td>{{ neg.authz_overdrafy_until|default_if_none:'' }}</td>
<td>{{ neg.balance_offset|default_if_none:'' }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% endblock %}

View file

@ -40,38 +40,47 @@ $(document).ready(function() {
{% endif %}
{% endblock %}
{% block fixed-content %}
{% block footer %}
{% include "kfet/base_footer.html" %}
{% endblock %}
{% block fixed %}
{% include "kfet/left_account.html" %}
{% endblock %}
{% block main-content %}
{% block main %}
<div class="tab-content">
{% if account.user == request.user %}
<div class="content-right-block tab-pane fade in active" id="tab_stats">
<h2>Statistiques</h2>
<div>
<h3>Ma balance</h3>
<div id="stat_balance"></div>
<h3>Ma consommation</h3>
<div id="stat_last"></div>
</div>
</div><!-- content-right-block -->
<div id="tab_stats" class="tab-pane fade in active">
<section>
<div>
<h3>Ma balance</h3>
<div id="stat_balance"></div>
<h3>Ma consommation</h3>
<div id="stat_last"></div>
</div>
</section>
</div><!-- stats tab -->
{% endif %}
<div class="content-right-block tab-pane fade {% if account.user != request.user %}in active{% endif %}" id="tab_history">
{% if addcosts %}
<h2>Gagné des majorations</h2>
<div>
<ul>
{% for addcost in addcosts %}
<li>{{ addcost.date|date:'l j F' }}: +{{ addcost.sum_addcosts }}€</li>
{% endfor %}
</ul>
</div>
{% endif %}
<h2>Historique</h2>
<div id="history"></div>
</div><!-- content-right-block -->
<div id="tab_history" class="tab-pane fade {% if account.user != request.user %}in active{% endif %}">
<section>
{% if addcosts %}
<h2>Gagné des majorations</h2>
<div>
<ul>
{% for addcost in addcosts %}
<li>{{ addcost.date|date:'l j F' }}: +{{ addcost.sum_addcosts }}€</li>
{% endfor %}
</ul>
</div>
{% endif %}
<div id="history" class="full"></div>
</section>
</div><!-- history tab -->
</div><!-- tab-content -->
<script type="text/javascript">

View file

@ -1,4 +1,4 @@
{% extends "kfet/base_col_1.html" %}
{% extends "kfet/base_form.html" %}
{% block extra_head %}
{{ negative_form.media }}
@ -20,9 +20,13 @@
{% endif %}
{% endblock %}
{% block main-class %}content-form{% endblock %}
{% block footer %}
{% if not account.is_team %}
{% include "kfet/base_footer.html" %}
{% endif %}
{% endblock %}
{% block main-content %}
{% block main %}
<form action="" method="post" class="form-horizontal">
{% csrf_token %}

View file

@ -3,63 +3,63 @@
{% block title %}Articles{% endblock %}
{% block header-title %}Articles{% endblock %}
{% block fixed-content %}
{% block fixed %}
<aside>
<div class="heading">
{{ articles|length }}
<span class="sub">article{{ articles|length|pluralize }}</span>
</div>
</aside>
<div class="content-left-top">
<div class="line line-big">{{ articles|length }}</div>
<div class="line line-bigsub">article{{ articles|length|pluralize }}</div>
</div>
<div class="buttons">
<a class="btn btn-primary btn-lg" href="{% url 'kfet.article.create' %}">
Nouvel article
<a class="btn btn-primary" href="{% url 'kfet.article.create' %}">
<span class="glyphicon glyphicon-plus"></span>
<span>Nouvel article</span>
</a>
<a class="btn btn-primary btn-lg" href="{% url 'kfet.category' %}">
<a class="btn btn-primary" href="{% url 'kfet.category' %}">
Catégories
</a>
</div>
{% endblock %}
{% block main-content %}
<div class="content-right-block">
<h2>Liste des articles</h2>
<div class="table-responsive">
<table class="table table-condensed">
<thead>
<tr>
<td></td>
<td>Nom</td>
<td class="text-right">Prix</td>
<td class="text-right">Stock</td>
<td class="text-right">En vente</td>
<td class="text-right">Affiché</td>
<td class="text-right">Dernier inventaire</td>
</tr>
</thead>
<tbody>
{% for article in articles %}
{% ifchanged article.category %}
<tr class="section">
<td colspan="7">{{ article.category.name }}</td>
</tr>
{% endifchanged %}
<tr>
<td class="text-center">
<a href="{% url 'kfet.article.read' article.pk %}">
<span class="glyphicon glyphicon-cog"></span>
</a>
</td>
<td>{{ article.name }}</td>
<td class="text-right">{{ article.price }}€</td>
<td class="text-right">{{ article.stock }}</td>
<td class="text-right">{{ article.is_sold | yesno:"En vente,Non vendu"}}</td>
<td class="text-right">{{ article.hidden | yesno:"Caché,Affiché" }}</td>
<td class="text-right">{{ article.inventory.0.at }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% block main %}
<div class="table-responsive">
<table class="table table-hover table-condensed">
<thead>
<tr>
<td>Nom</td>
<td class="text-right">Prix</td>
<td class="text-right">Stock</td>
<td class="text-right">En vente</td>
<td class="text-right">Affiché</td>
<td class="text-right">Dernier inventaire</td>
</tr>
</thead>
<tbody>
{% for article in articles %}
{% ifchanged article.category %}
<tr class="section">
<td colspan="6">{{ article.category.name }}</td>
</tr>
{% endifchanged %}
<tr>
<td>
<a href="{% url 'kfet.article.read' article.pk %}">
{{ article.name }}
</a>
</td>
<td class="text-right">{{ article.price }}€</td>
<td class="text-right">{{ article.stock }}</td>
<td class="text-right">{{ article.is_sold | yesno:"En vente,Non vendu"}}</td>
<td class="text-right">{{ article.hidden | yesno:"Caché,Affiché" }}</td>
<td class="text-right">{{ article.inventory.0.at }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
{% endblock %}

View file

@ -1,12 +1,10 @@
{% extends 'kfet/base_col_1.html' %}
{% extends 'kfet/base_form.html' %}
{% block title %}Nouvel article{% endblock %}
{% block header-title %}Création d'un article{% endblock %}
{% block main-class %}content-form{% endblock %}
{% block main %}
{% block main-content %}
{% include "kfet/base_form.html" with authz=perms.kfet.add_article submit_text="Enregistrer" %}
{% include "kfet/form_full_snippet.html" with authz=perms.kfet.add_article submit_text="Enregistrer" %}
{% endblock %}

View file

@ -0,0 +1,22 @@
<table class="table table-hover table-condensed">
<thead>
<tr>
<td>Date</td>
<td>Stock</td>
<td>Erreur</td>
</tr>
</thead>
<tbody>
{% for inventoryart in inventoryarts %}
<tr>
<td>
<a href="{% url "kfet.inventory.read" inventoryart.inventory.pk %}">
{{ inventoryart.inventory.at }}
</a>
</td>
<td>{{ inventoryart.stock_new }}</td>
<td>{{ inventoryart.stock_error }}</td>
</tr>
{% endfor %}
</tbody>
</table>

View file

@ -1,5 +1,5 @@
{% extends 'kfet/base_col_2.html' %}
{% load staticfiles %}
{% load staticfiles kfet_tags %}
{% block extra_head %}
<script type="text/javascript" src="{% static 'kfet/js/Chart.bundle.js' %}"></script>
@ -9,87 +9,104 @@
{% block title %}Article - {{ article.name }}{% endblock %}
{% block header-title %}Informations sur l'article {{ article.name }}{% endblock %}
{% block fixed-content %}
{% block fixed %}
<div class="content-left-top">
<div class="line line-big">{{ article.name }}</div>
<div class="line line-bigsub">{{ article.category }}</div>
<div class="block">
<div class="line">Prix (hors réduc.): {{ article.price }}€</div>
<div class="line">Stock: {{ article.stock }}</div>
<div class="line">En vente: {{ article.is_sold | yesno:"Oui,Non" }}</div>
<div class="line">Affiché: {{ article.hidden | yesno:"Non,Oui" }}</div>
<aside>
<div class="heading">
<div>{{ article.name }}</div>
<div class="sub">{{ article.category }}</div>
</div>
<div class="buttons">
<a class="btn btn-default" href="{% url 'kfet.article.update' article.pk %}">
<span class="glyphicon glyphicon-cog"></span><span>Éditer</span>
</a>
</div>
<div class="text">
<ul class="list-unstyled">
<li>
<b>Prix:</b> <span>{{ article.price }}€</span>
<span data-toggle="tooltip" data-placement="right" class="glyphicon glyphicon-question-sign" title="Hors réduction COF"></span>
</li>
<li><b>Stock:</b> {{ article.stock }}</li>
<li><b>En vente:</b> {{ article.is_sold|yesno|title }}</li>
<li><b>Affiché:</b> {{ article.hidden|yesno|title }}</li>
</ul>
</div>
</aside>
<div class="buttons tabs-buttons">
<div>
<a href="#tab_summary" data-toggle="pill" class="btn btn-primary-w focus">
Résumé
<span class="hidden-xs glyphicon glyphicon-chevron-right"></span>
</a>
</div>
<div>
<a href="#tab_inventories" data-toggle="pill" class="btn btn-primary-w">
Inventaires
<span class="hidden-xs glyphicon glyphicon-chevron-right"></span>
</a>
</div>
<div>
<a href="#tab_suppliers" data-toggle="pill" class="btn btn-primary-w">
Fournisseurs
<span class="hidden-xs glyphicon glyphicon-chevron-right"></span>
</a>
</div>
</div>
<div class="buttons">
<a class="btn btn-primary btn-lg" href="{% url 'kfet.article.update' article.pk %}">
Modifier
</a>
</div>
{% endblock %}
{% block main-content %}
{% block main %}
<div class="content-right-block">
<h2>Historique</h2>
<div class="row" style="padding-bottom: 15px">
<div class="col-md-6">
<h3>Inventaires</h3>
<table class="table">
<thead>
<tr>
<td>Date</td>
<td>Stock</td>
<td>Erreur</td>
</tr>
</thead>
<tbody>
{% for inventoryart in inventoryarts %}
<tr>
<td>{{ inventoryart.inventory.at }}</td>
<td>{{ inventoryart.stock_new }}</td>
<td>{{ inventoryart.stock_error }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
<div class="col-md-6">
<h3>Prix fournisseurs</h3>
<div class="table-responsive">
<table class="table">
<thead>
<tr>
<td>Date</td>
<td>Fournisseur</td>
<td>HT</td>
<td>TVA</td>
<td>Droits</td>
</tr>
</thead>
<tbody>
{% for supplierart in supplierarts %}
<tr>
<td>{{ supplierart.at }}</td>
<td>{{ supplierart.supplier.name }}</td>
<td>{{ supplierart.price_HT }}</td>
<td>{{ supplierart.TVA }}</td>
<td>{{ supplierart.rights }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div><!-- /row-->
</div>
<div class="content-right-block">
<h2>Statistiques</h2>
<div class="tab-content">
<div id="tab_summary" class="tab-pane fade in active">
<section>
<div>
<div class="row">
<div class="col-lg-6">
<h3>Inventaires récents</h3>
<div class="table-responsive">
{% include "kfet/article_inventories_snippet.html" with inventoryarts=inventoryarts|slice:5 %}
</div>
</div><!-- col -->
<div class="col-lg-6">
<h3>Derniers prix fournisseurs</h3>
<div class="table-responsive">
{% include "kfet/article_suppliers_snippet.html" with supplierarts=supplierarts|slice:5 %}
</div>
</div><!-- col -->
</div><!-- row -->
</div>
</section>
<section>
<div>
<h3>Ventes</h3>
<div id="stat_last"></div>
</div>
</section>
</div><!-- summary tab -->
<div id="tab_inventories" class="tab-pane fade">
<div class="table-responsive">
{% include "kfet/article_inventories_snippet.html" %}
</div>
</div><!-- inventories tab -->
<div id="tab_suppliers" class="tab-pane fade">
<div class="table-responsive">
{% include "kfet/article_suppliers_snippet.html" %}
</div>
</div><!-- suppliers tab -->
</div>
<script type="text/javascript">
@ -98,6 +115,20 @@ $(document).ready(function() {
"{% url 'kfet.article.stat.sales.list' article.id %}",
$("#stat_last")
);
$('[data-toggle="tooltip"]').tooltip();
$("table .more").click( function() {
$(this).hide();
$(this).siblings(".hidden").removeClass("hidden");
});
let tabs_buttons = $('.tabs-buttons a');
tabs_buttons.click( function() {
tabs_buttons.removeClass('focus');
$(this).addClass('focus');
});
});
</script>

View file

@ -0,0 +1,22 @@
<table class="table table-hover table-condensed">
<thead>
<tr>
<td>Date</td>
<td>Fournisseur</td>
<td>HT</td>
<td>TVA</td>
<td>Droits</td>
</tr>
</thead>
<tbody>
{% for supplierart in supplierarts %}
<tr>
<td>{{ supplierart.at }}</td>
<td>{{ supplierart.supplier.name }}</td>
<td>{{ supplierart.price_HT|default_if_none:"" }}</td>
<td>{{ supplierart.TVA|default_if_none:"" }}</td>
<td>{{ supplierart.rights|default_if_none:"" }}</td>
</tr>
{% endfor %}
</tbody>
</table>

View file

@ -1,12 +1,10 @@
{% extends "kfet/base_col_1.html" %}
{% extends "kfet/base_form.html" %}
{% block title %}{{ article.name }} - Édition{% endblock %}
{% block header-title %}Édition de l'article {{ article.name }}{% endblock %}
{% block main-class %}content-form{% endblock %}
{% block main %}
{% block main-content %}
{% include "kfet/base_form.html" with authz=perms.kfet.change_article submit_text="Mettre à jour"%}
{% include "kfet/form_full_snippet.html" with authz=perms.kfet.change_article submit_text="Mettre à jour"%}
{% endblock %}

View file

@ -1,4 +1,4 @@
{% load staticfiles %}
{% load static menu_tags %}
<!DOCTYPE html>
<html lang="fr">
<head>
@ -7,9 +7,13 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>{% block title %}{% endblock %} | K-Fêt - ENS Ulm</title>
<meta name="theme-color" content="#a00e26">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<link rel="icon" sizes="96x96" href="{% static "kfet/img/favicon.png" %}">
{# CSS #}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<link href='https://fonts.googleapis.com/css?family=Roboto:400,700|Oswald:400,700|Roboto+Mono:400,700' rel='stylesheet' type='text/css'>
<link href='https://fonts.googleapis.com/css?family=Roboto:400,700|Roboto+Mono:400,700|Roboto+Slab:400,700' rel='stylesheet' type='text/css'>
<link rel="stylesheet" style="text/css" href="{% static 'kfet/css/jquery-ui.min.css' %}">
<link rel="stylesheet" type="text/css" href="{% static 'kfet/css/jquery-confirm.css' %}">
<link rel="stylesheet" type="text/css" href="{% static 'kfet/css/index.css' %}">
@ -37,18 +41,26 @@
<![endif]-->
</head>
<body>
{% include "kfet/base_nav.html" %}
{% flat_menu "kfet-nav" template="kfet/base_nav.html" apply_active_classes=True %}
<div class="container-fluid">
{% block header %}
<div class="row row-page-header">
<div class="col-lg-12">
<h1 class="page-header">{% block header-title %}{% endblock %}</h1>
</div>
</div>
{% if not page or not page.no_header %}
<header class="row">
<div class="header {% block header-class %}{% endblock %}">
<h1>
{% block header-title %}{% endblock %}
</h1>
</div>
</header>
{% endif %}
{% endblock %}
{% block content %}{% endblock %}
{% include "kfet/base_footer.html" %}
{% block footer %}
{% endblock footer %}
</div>
<div class="help">
<div class="help-box col-sm-10 col-sm-offset-1 col-md-8 col-md-offset-2">
<div class="help-content">

View file

@ -1,14 +1,16 @@
{% extends "kfet/base.html" %}
{% block header-class %}text-center{% endblock %}
{% block content %}
<div class="row">
<div class="nopadding {% block main-size %}col-md-8 col-md-offset-2{% endblock %}">
<div class="row content-row">
<div class="main-col {% block main-size %}col-md-10 col-md-offset-1 col-lg-8 col-lg-offset-2{% endblock %}">
{% include "kfet/base_messages.html" %}
<div class="content-center {% block main-class %}{% endblock %}">
{% block main-content %}{% endblock %}
<div class="main {% block main-class %}{% endblock %}">
{% block main %}{% endblock %}
</div>
</div>
<div>
</div>
{% endblock %}

View file

@ -2,16 +2,16 @@
{% block content %}
<div class="row">
<div class="col-content-left {% block fixed-size %}col-sm-4 col-md-3{% endblock %}">
<div class="content-left">
{% block fixed-content %}{% endblock %}
<div class="row content-row">
<div class="fixed-col {% block fixed-size %}col-sm-3{% endblock %}">
<div class="fixed {% block fixed-class %}{% endblock %}">
{% block fixed %}{% endblock %}
</div>
</div>
<div class="col-content-right {% block main-size %}col-sm-8 col-md-9{% endblock %}">
<div class="main-col {% block main-size %}col-sm-9{% endblock %}">
{% include "kfet/base_messages.html" %}
<div class="content-right">
{% block main-content %}{% endblock %}
<div class="main {% block main-class %}{% endblock %}">
{% block main %}{% endblock %}
</div>
</div>
</div>

View file

@ -0,0 +1,18 @@
{% extends "kfet/base.html" %}
{% block header-class %}text-center{% endblock %}
{% block content %}
<div class="row content-row">
<div class="main-col {% block main-size %}col-xs-12{% endblock %}">
{% include "kfet/base_messages.html" %}
<div class="main {% block main-class %}{% endblock %}">
<div class="main-col-mult {% block mult-count %}column-md-2{% endblock %}">
{% block main %}{% endblock %}
</div>
</div>
</div>
</div>
{% endblock %}

View file

@ -0,0 +1,17 @@
{% load wagtailcore_tags %}
{% with "k-fet@ens.fr" as kfet_mail %}
<footer class="row">
<div class="footer">
<span>
<a href="{% slugurl "mentions-legales" %}">Mentions légales</a>
</span>
|
<span>
En cas de pépin : <a href="mailto:{{ kfet_mail }}"><tt>{{ kfet_mail }}</tt></a>
</span>
</div>
</div>
{% endwith %}

View file

@ -1,10 +1,9 @@
{% load kfet_tags %}
{% extends "kfet/base_col_1.html" %}
<form action="" method="post" class="form-horizontal">
{% csrf_token %}
{% include "kfet/form_snippet.html" %}
{% if not authz %}
{% include "kfet/form_authentication_snippet.html" %}
{% endif %}
{% include "kfet/form_submit_snippet.html" with value=submit_text %}
</form>
{% block main-class %}main-bg main-padding{% endblock %}
{% block main %}
{% include "kfet/form_full_snippet.html" %}
{% endblock %}

View file

@ -6,18 +6,14 @@
{% endif %}
{% if messages %}
<div class="row messages">
<div class="messages">
{% for message in messages %}
<div class="col-sm-12 nopadding">
<div class="alert alert-{{ message.level_tag }} alert-dismissible fade in {{ message.tags }}">
<button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">&times;</span></button>
{% if 'safe' in message.tags %}
{{ message|safe }}
{% else %}
{{ message }}
{% endif %}
</div>
</div>
<div class="alert alert-{{ message.level_tag }} alert-dismissible fade in {{ message.tags }}">
<button type="button" class="close" data-dismiss="alert">
<span aria-hidden="true">&times;</span>
</button>
{{ message }}
</div>
{% endfor %}
</div>
{% endif %}

View file

@ -1,18 +1,15 @@
{% load staticfiles %}
{% load static %}
{% load wagtailcore_tags %}
<nav class="navbar navbar-fixed-top">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
<span class="sr-only"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="{% url 'kfet.home' %}">
<a class="navbar-brand" href="{% slugurl "k-fet" %}">
<img src="{% static 'kfet/img/logo3.png' %}">
</a>
<div class="kfetopen dropdown">
</div>
<ul class="nav navbar-nav">
<li class="kfetopen dropdown">
<ul class="base nav dropdown-toggle" data-toggle="dropdown">
<li class="bullet"></li>
{% if perms.kfet.is_team %}
@ -23,67 +20,109 @@
</ul>
<div class="details dropdown-menu">
La K-Fêt est
<span class="status-text">
<b><span class="status-text">
<span class="glyphicon glyphicon-refresh spinning"></span>
</span>.
</span></b>.
{% if perms.kfet.is_team %}
<button class="btn btn-primary force-close-btn">&nbsp;</button>
{% endif %}
</div>
</div>
</div>
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
<li class="hidden-xs">
<a href="{% url 'kfet.home' %}">
<span class="glyphicon glyphicon-home"></span>
</a>
</li>
{% if user.profile.account_kfet %}
<li>
<a href="{% url 'kfet.account.read' user.profile.account_kfet.trigramme %}">Mon compte</a>
</li>
{% endif %}
</ul>
<ul class="nav navbar-nav navbar-right">
{% if user.username == 'kfet_genericteam' %}
<li class="navbar-text">Équipe standard</li>
{% endif %}
{% if perms.kfet.is_team %}
<li><a href="{% url 'kfet.kpsul' %}">K-Psul</a></li>
<li><a href="{% url 'kfet.history' %}">Historique</a></li>
<li><a href="{% url 'kfet.transfers' %}">Transferts</a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Admin <span class="caret"></span></a>
<ul class="dropdown-menu">
<li class="divider"></li>
<li><a href="{% url 'kfet.account' %}">Comptes</a></li>
<li><a href="{% url 'kfet.checkout' %}">Caisses</a></li>
<li class="divider"></li>
<li><a href="{% url 'kfet.article' %}">Articles</a></li>
<li><a href="{% url 'kfet.inventory' %}">Inventaires</a></li>
<li><a href="{% url 'kfet.order' %}">Commandes</a></li>
{% if user.username != 'kfet_genericteam' %}
<li class="divider"></li>
<li><a href="{% url 'kfet.login.genericteam' %}" target="_blank" id="genericteam">Connexion standard</a></li>
{% endif %}
{% if perms.kfet.change_settings %}
<li><a href="{% url 'kfet.settings' %}">Paramètres</a></li>
{% endif %}
</ul>
</li>
{% endif %}
{% if user.is_authenticated %}
<li><a href="{% url 'gestioncof.views.logout' %}?next=/k-fet/" title="Déconnexion"><span class="glyphicon glyphicon-log-out"></span></a></li>
{% endif %}
</ul>
</div>
</li>
{% for item in menu_items %}
{% if item.text == "Accueil" %}
<li class="{{ item.active_class }} hidden-xs hidden-sm">
<a href="{{ item.href }}" title="Accueil">
<span class="glyphicon glyphicon-home"></span>
</a>
</li>
{% else %}
<li class="{{ item.active_class }} hidden-xs hidden-sm">
<a href="{{ item.href }}">
{{ item.text }}
</a>
</li>
{% endif %}
{% endfor %}
<li class="dropdown visible-xs visible-sm nav-pages">
<a href="#" data-toggle="dropdown" roles="button" aria-haspopup="true" aria-expanded="false" class="navbar-toggle">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<ul class="dropdown-menu">
{% for item in menu_items %}
<li>
<a href="{{ item.href }}">
{{ item.text }}
</a>
</li>
{% endfor %}
</ul>
</li>
</ul>
<ul class="nav navbar-nav navbar-right nav-app">
{% if user.username == 'kfet_genericteam' %}
{% include "kfet/nav_item.html" with text="Équipe standard" %}
{% elif user.is_authenticated and not user.profile.account_kfet %}
{% include "kfet/nav_item.html" with class="disabled" href="#" glyphicon="user" text="Mon compte" %}
{% elif user.profile.account_kfet.readable %}
{% url "kfet.account.read" user.profile.account_kfet.trigramme as url_my_account %}
{% include "kfet/nav_item.html" with href=url_my_account glyphicon="user" text="Mon compte" %}
{% endif %}
{% if perms.kfet.is_team %}
{% include "kfet/nav_item.html" with url="kfet.kpsul" glyphicon="shopping-cart" text="K-Psul" %}
{% include "kfet/nav_item.html" with url="kfet.transfers" glyphicon="transfer" text="Transferts" %}
{% include "kfet/nav_item.html" with url="kfet.history" glyphicon="th-list" text="Historique" %}
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<span class="glyphicon glyphicon-option-vertical"></span>
</a>
<ul class="dropdown-menu">
<li class="divider"></li>
<li><a href="{% url 'kfet.account' %}">Comptes</a></li>
<li><a href="{% url 'kfet.checkout' %}">Caisses</a></li>
<li class="divider"></li>
<li><a href="{% url 'kfet.article' %}">Articles</a></li>
<li><a href="{% url 'kfet.inventory' %}">Inventaires</a></li>
<li><a href="{% url 'kfet.order' %}">Commandes</a></li>
{% if user.username != 'kfet_genericteam' %}
<li class="divider"></li>
<li><a href="{% url 'kfet.login.genericteam' %}" target="_blank" class="genericteam">Connexion standard</a></li>
{% endif %}
{% if perms.kfet.change_settings %}
<li><a href="{% url 'kfet.settings' %}">Paramètres</a></li>
{% endif %}
<li class="divider"></li>
<li>
<a href="{% url "cof-logout" %}?next=/k-fet/">
<span class="glyphicon glyphicon-log-out"></span><span>Déconnexion</span>
</a>
</li>
</ul>
</li>
{% endif %}
{% if user.is_authenticated and not perms.kfet.is_team %}
<li>
<a href="{% url "cof-logout" %}?next=/k-fet/" title="Déconnexion">
<span class="glyphicon glyphicon-log-out"></span>
</a>
</li>
{% elif not user.is_authenticated %}
<li>
<a href="{% url "cof-login" %}?next={{ request.path }}" title="Connexion">
<span>Connexion</span><!--
--><span class="glyphicon glyphicon-log-in"></span>
</a>
</li>
{% endif %}
</ul>
</div>
</nav>
<script type="text/javascript">
$(document).ready(function () {
$('#genericteam').on('click', function () {
$('.genericteam').on('click', function () {
setTimeout(function () { location.reload() }, 1000);
});
});

View file

@ -3,45 +3,42 @@
{% block title %}Categories d'articles{% endblock %}
{% block header-title %}Categories d'articles{% endblock %}
{% block fixed-content %}
{% block fixed %}
<div class="content-left-top">
<div class="line line-big">{{ categories|length }}</div>
<div class="line line-bigsub">catégorie{{ categories|length|pluralize }}</div>
</div>
{% endblock %}
{% block main-content %}
<div class="content-right-block">
<h2>Liste des catégories</h2>
<div class="table-responsive">
<table class="table table-condensed">
<thead>
<tr>
<td></td>
<td>Nom</td>
<td class="text-right">Nombre d'articles</td>
<td class="text-right">Peut être majorée</td>
</tr>
</thead>
<tbody>
{% for category in categories %}
<tr>
<td class="text-center">
<a href="{% url 'kfet.category.update' category.pk %}">
<span class="glyphicon glyphicon-cog"></span>
</a>
</td>
<td>{{ category.name }}</td>
<td class="text-right">{{ category.articles.all|length }}</td>
<td class="text-right">{{ category.has_addcost | yesno:"Oui,Non"}}</td>
</tr>
{% endfor %}
</tbody>
</table>
<aside>
<div class="heading">
{{ categories|length }}
<span class="sub">catégorie{{ categories|length|pluralize }}</span>
</div>
</aside>
{% endblock %}
{% block main %}
<div class="table-responsive">
<table class="table table-hover table-condensed">
<thead>
<tr>
<td>Nom</td>
<td class="text-right">Nombre d'articles</td>
<td class="text-right">Peut être majorée</td>
</tr>
</thead>
<tbody>
{% for category in categories %}
<tr>
<td>
<a href="{% url 'kfet.category.update' category.pk %}">
{{ category.name }}
</a>
</td>
<td class="text-right">{{ category.articles.all|length }}</td>
<td class="text-right">{{ category.has_addcost | yesno:"Oui,Non"}}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% endblock %}

View file

@ -1,12 +1,10 @@
{% extends "kfet/base_col_1.html" %}
{% extends "kfet/base_form.html" %}
{% block title %}{{ articlecategory.name }} - Édition{% endblock %}
{% block header-title %}Édition de la catégorie {{ articlecategory.name }}{% endblock %}
{% block main-class %}content-form{% endblock %}
{% block main %}
{% block main-content %}
{% include "kfet/base_form.html" with authz=perms.kfet.edit_articlecategory submit_text="Enregistrer"%}
{% include "kfet/form_full_snippet.html" with authz=perms.kfet.edit_articlecategory submit_text="Enregistrer"%}
{% endblock %}

View file

@ -3,52 +3,53 @@
{% block title %}Caisses{% endblock %}
{% block header-title %}Caisses{% endblock %}
{% block fixed-content %}
{% block fixed %}
<div class="content-left-top text-center">
<div class="line line-big">{{ checkouts|length }}</div>
<div class="line line-bigsub">caisse{{ checkouts|length|pluralize }}</div>
</div>
<div class="buttons">
<a class="btn btn-primary btn-lg" href="{% url 'kfet.checkout.create' %}">Créer une caisse</a>
</div>
{% endblock %}
{% block main-content %}
<div class="content-right-block">
<h2>Liste des caisses</h2>
<div class="table-responsive">
<table class="table table-condensed">
<thead>
<tr>
<td></td>
<td>Nom</td>
<td class="text-right">Balance</td>
<td class="text-right">Déb. valid.</td>
<td class="text-right">Fin valid.</td>
<td class="text-right">Protégée</td>
</tr>
</thead>
<tbody>
{% for checkout in checkouts %}
<tr>
<td>
<a href="{% url 'kfet.checkout.read' checkout.pk %}">
<span class="glyphicon glyphicon-cog"></span>
</a>
</td>
<td>{{ checkout.name }}</td>
<td class="text-right">{{ checkout.balance}}€</td>
<td class="text-right">{{ checkout.valid_from }}</td>
<td class="text-right">{{ checkout.valid_to }}</td>
<td class="text-right">{{ checkout.is_protected }}</td>
</tr>
{% endfor %}
</tbody>
</table>
<aside>
<div class="heading">
{{ checkouts|length }}
<span class="sub">caisse{{ checkouts|length|pluralize }}</span>
</div>
</aside>
<div class="buttons">
<a class="btn btn-primary" href="{% url 'kfet.checkout.create' %}">
<span class="glyphicon glyphicon-plus"></span>
<span>Créer une caisse</span>
</a>
</div>
{% endblock %}
{% block main %}
<div class="table-responsive">
<table class="table table-hover table-condensed">
<thead>
<tr>
<td>Nom</td>
<td class="text-right">Balance</td>
<td class="text-right">Déb. valid.</td>
<td class="text-right">Fin valid.</td>
<td class="text-right">Protégée</td>
</tr>
</thead>
<tbody>
{% for checkout in checkouts %}
<tr>
<td>
<a href="{% url 'kfet.checkout.read' checkout.pk %}">
{{ checkout.name }}
</a>
</td>
<td class="text-right">{{ checkout.balance}}€</td>
<td class="text-right">{{ checkout.valid_from }}</td>
<td class="text-right">{{ checkout.valid_to }}</td>
<td class="text-right">{{ checkout.is_protected|yesno }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% endblock %}

View file

@ -1,13 +1,12 @@
{% extends "kfet/base_col_1.html" %}
{% extends "kfet/base_form.html" %}
{% block extra_head %}{{ form.media }}{% endblock %}
{% block title %}Nouvelle caisse{% endblock %}
{% block header-title %}Création d'une caisse{% endblock %}
{% block main-class %}content-form{% endblock %}
{% block main-content %}
{% block main %}
{% include "kfet/base_form.html" with authz=perms.kfet.add_checkout submit_text="Enregistrer" %}
{% include "kfet/form_full_snippet.html" with authz=perms.kfet.add_checkout submit_text="Enregistrer" %}
<script type="text/javascript">

View file

@ -3,21 +3,20 @@
{% block title %}Caisse - {{ checkout.name }}{% endblock %}
{% block header-title %}Informations sur la caisse {{ checkout.name }}{% endblock %}
{% block fixed-content %}
{% block fixed %}
{% include 'kfet/left_checkout.html' %}
{% endblock %}
{% block main-content %}
<div class="content-right-block">
{% block main %}
<section>
<h2>Relevés</h2>
<div class="table-responsive">
{% if not statements %}
Pas de relevé
{% else %}
<table class="table">
<table class="table table-hover table-condensed">
<thead>
<tr>
<td></td>
<td>Date/heure</td>
<td>Montant pris</td>
<td>Montant laissé</td>
@ -26,8 +25,11 @@
<tbody>
{% for statement in statements %}
<tr>
<td><a href="{% url 'kfet.checkoutstatement.update' checkout.pk statement.pk %}"><span class="glyphicon glyphicon-cog"></span></a></td>
<td>{{ statement.at }}</td>
<td>
<a href="{% url 'kfet.checkoutstatement.update' checkout.pk statement.pk %}">
{{ statement.at }}
</a>
</td>
<td>{{ statement.amount_taken }}</td>
<td>{{ statement.balance_new }}</td>
<td>{{ statement.amount_error }}</td>
@ -37,6 +39,6 @@
</table>
{% endif %}
</div>
</div>
</section>
{% endblock %}

View file

@ -1,20 +1,12 @@
{% extends "kfet/base_col_2.html" %}
{% extends "kfet/base_form.html" %}
{% block extra_head %}{{ form.media }}{% endblock %}
{% block title %}Caisse {{ checkout.name }} - Édition{% endblock %}
{% block header-title %}Édition de la caisse {{ checkout.name }}{% endblock %}
{% block fixed-content %}
{% include "kfet/left_checkout.html" %}
{% endblock %}
{% block main %}
{% block main-content %}
<div class="content-right-block">
<div style="padding: 15px;">
{% include "kfet/base_form.html" with authz=perms.kfet.change_checkout submit_text="Mettre à jour" %}
</div>
</div>
{% include "kfet/form_full_snippet.html" with authz=perms.kfet.change_checkout submit_text="Mettre à jour" %}
<script type="text/javascript">

View file

@ -1,20 +1,16 @@
{% extends "kfet/base_col_2.html" %}
{% extends "kfet/base_col_1.html" %}
{% load l10n %}
{% load widget_tweaks %}
{% block title %}Nouveau relevé - {{ checkout.name }}{% endblock %}
{% block header-title %}Création d'un relevé pour la caisse {{ checkout.name }}{% endblock %}
{% block fixed-content %}
{% include "kfet/left_checkout.html" %}
{% endblock %}
{% block main-content %}
{% block main %}
<form action="" method="post">
{% csrf_token %}
<div class="content-right-block">
<section>
<h2>Général</h2>
<div class="content-form statement-create-summary">
<div class="statement-create-summary">
<table>
<tr>
<td>
@ -41,18 +37,18 @@
<td><span id="amount_error">0</span></td>
</tr>
</table>
<br>
{% if not perms.kfet.add_checkoutstatement %}
{% include "kfet/form_authentication_snippet.html" %}
{% endif %}
<br>
<div class="row text-center">
<input type="submit" value="Enregistrer" class="btn btn-lg btn-primary">
<input type="submit" class="btn btn-primary btn-lg" value="Enregistrer">
</div>
</div>
</div>
<div class="content-right-block">
</section>
<section>
<h2>Pris</h2>
<div id="detail_taken">
<div id="detail_taken" class="nopadding">
<div class="table-responsive">
<table class="table table-condensed">
<thead>
@ -122,10 +118,10 @@
</table>
</div>
</div>
</div>
<div class="content-right-block">
</section>
<section>
<h2>En caisse</h2>
<div id="detail_balance">
<div id="detail_balance" class="nopadding">
<div class="table-responsive">
<table class="table table-condensed">
<thead>
@ -181,23 +177,22 @@
</table>
</div>
</div>
</div>
</section>
</form>
<script type="text/javascript">
$(document).ready(function() {
$('#id_not_count').on('change', function() {
if ($(this).prop('checked')) {
$('#detail_balance input').prop('disabled', true);
} else {
$('#detail_balance input').prop('disabled', false);
}
updateAmounts();
});
let $not_count = $('#id_not_count');
$('#detail_balance input, #detail_taken input').on('input', function() {
function updateAll() {
$('#detail_balance input').prop('disabled', $not_count.prop('checked'));
updateAmounts();
});
}
$not_count.on('change', updateAll);
updateAll();
$('#detail_balance input, #detail_taken input').on('input', updateAmounts);
function getTotal(id_container) {
var total = 0;
@ -210,7 +205,7 @@ $(document).ready(function() {
function updateAmounts() {
var balance_old = parseFloat($('#balance_old').text());
var taken = getTotal('detail_taken');
if ($('#id_not_count').prop('checked')) {
if ($not_count.prop('checked')) {
var error = 0;
var balance_new = balance_old - taken;
} else {

View file

@ -1,4 +1,4 @@
{% extends "kfet/base_col_1.html" %}
{% extends "kfet/base_form.html" %}
{% block title %}Modification d'un relevé{% endblock %}
{% block header-title %}
@ -6,10 +6,8 @@ Caisse {{ checkout.name }}<br>
Modification du relevé {{ checkoutstatement.at }}
{% endblock %}
{% block main-class %}content-form{% endblock %}
{% block main %}
{% block main-content %}
{% include "kfet/base_form.html" with authz=perms.kfet.change_checkoutstatement submit_text="Enregistrer"%}
{% include "kfet/form_full_snippet.html" with authz=perms.kfet.change_checkoutstatement submit_text="Enregistrer"%}
{% endblock %}

View file

@ -1,4 +1,4 @@
<div class="form-group">
<div class="form-group auth-form">
<label for="password" class="col-sm-2 control-label">Authentification</label>
<div class="col-sm-10">
<input type="password" name="KFETPASSWORD" id="password" class="form-control">

View file

@ -0,0 +1,8 @@
<form action="" method="post" class="form-horizontal">
{% csrf_token %}
{% include "kfet/form_snippet.html" %}
{% if not authz %}
{% include "kfet/form_authentication_snippet.html" %}
{% endif %}
{% include "kfet/form_submit_snippet.html" with value=submit_text %}
</form>

View file

@ -1,53 +1,39 @@
{% extends 'kfet/base.html' %}
{% load staticfiles %}
{% load l10n %}
{% extends 'kfet/base_col_2.html' %}
{% load l10n staticfiles widget_tweaks %}
{% block extra_head %}
<link rel="stylesheet" type="text/css" href="{% static 'kfet/css/bootstrap-datetimepicker.min.css' %}">
<link rel="stylesheet" type="text/css" href="{% static 'kfet/css/multiple-select.css' %}">
<script type="text/javascript" src="{% static 'kfet/js/bootstrap-datetimepicker.min.js' %}"></script>
<script type="text/javascript" src="{% static 'kfet/js/multiple-select.js' %}"></script>
{{ filter_form.media }}
<script type="text/javascript" src="{% static 'kfet/js/history.js' %}"></script>
{% endblock %}
{% block title %}Historique{% endblock %}
{% block content-header-title %}Historique{% endblock %}
{% block header-title %}Historique{% endblock %}
{% block content %}
{% block fixed %}
<div class="row">
<div class="col-sm-4 col-md-3 col-content-left">
<div class="content-left">
<div class="content-left-top">
<div class="line line-big" id="nb_opes"></div>
<div class="line line-bigsub">opérations</div>
<div class="block">
<div class="line" style="position:relative"><b>De</b> <input type="text" id="from_date" class="form-control"></div>
<div class="line" style="position:relative"><b>à</b> <input type="text" id="to_date" class="form-control"></div>
<div class="line"><b>Caisses</b> {{ filter_form.checkouts }}</div>
<div class="line"><b>Comptes</b> {{ filter_form.accounts }}</div>
</div>
</div>
</div>
<aside>
<div class="heading">
<span id="nb_opes"></span>
<span class="sub">opérations</span>
</div>
<div class="col-sm-8 col-md-9 col-content-right">
{% include 'kfet/base_messages.html' %}
<div class="content-right">
<div class="content-right-block">
<h2>Général</h2>
<div>
</div>
</div>
<div class="content-right-block">
<h2>Opérations</h2>
<div>
<table id="history" class="table">
</table>
</div>
</div>
</div>
<div class="text">
<ul class="list-unstyled">
<li style="position: relative;"><b>De</b> {{ filter_form.from_date|add_class:"form-control" }}</li>
<li style="position: relative;"><b>à</b> {{ filter_form.to_date|add_class:"form-control" }}</li>
<li><b>Caisses</b> {{ filter_form.checkouts }}</li>
<li><b>Comptes</b> {{ filter_form.accounts }}</li>
</ul>
</div>
</div>
</aside>
{% endblock %}
{% block main %}
<table id="history" class="table">
</table>
<script type="text/javascript">
$(document).ready(function() {
@ -55,8 +41,8 @@ $(document).ready(function() {
khistory = new KHistory();
var $from_date = $('#from_date');
var $to_date = $('#to_date');
var $from_date = $('#id_from_date');
var $to_date = $('#id_to_date');
var $checkouts = $('#id_checkouts');
var $accounts = $('#id_accounts');
@ -95,22 +81,21 @@ $(document).ready(function() {
});
}
$('#from_date').datetimepicker({
let defaults_datetimepicker = {
timeZone : 'Europe/Paris',
format : 'YYYY-MM-DD HH:mm',
stepping : 5,
locale : 'fr',
showTodayButton: true
};
$from_date.datetimepicker($.extend({}, defaults_datetimepicker, {
defaultDate: moment().subtract(24, 'hours'),
showTodayButton: true,
});
$('#to_date').datetimepicker({
timeZone : 'Europe/Paris',
format : 'YYYY-MM-DD HH:mm',
stepping : 5,
}));
$to_date.datetimepicker($.extend({}, defaults_datetimepicker, {
defaultDate: moment(),
locale : 'fr',
showTodayButton: true,
});
}));
$("#from_date").on("dp.change", function (e) {
$('#to_date').data("DateTimePicker").minDate(e.date);
});
@ -121,9 +106,9 @@ $(document).ready(function() {
$("select").multipleSelect({
width: '100%',
filter: true,
allSelected: " ",
selectAllText: "Tout-te-s",
countSelected: "# sur %"
allSelected: " ",
selectAllText: "Tout-te-s",
countSelected: "# sur %"
});
$("input").on('dp.change change', function() {

View file

@ -3,54 +3,42 @@
{% block title %}Inventaires{% endblock %}
{% block header-title %}Inventaires{% endblock %}
{% block fixed-content %}
{% block fixed %}
<div class="buttons">
<a href="{% url 'kfet.inventory.create' %}" class="btn btn-primary btn-lg">
Nouveau
<a href="{% url 'kfet.inventory.create' %}" class="btn btn-primary">
<span class="glyphicon glyphicon-plus"></span>
<span>Nouveau</span>
</a>
</div>
{% endblock %}
{% block main-content %}
{% block main %}
<div class="content-right-block">
<h2>Liste des inventaires</h2>
<div class="table-responsive">
<table class="table table-condensed">
<thead>
<tr>
<td></td>
<td>Date</td>
<td>Par</td>
<td>Nb articles</td>
<td>Commande</td>
</tr>
</thead>
<tbody>
{% for inventory in inventories %}
<tr>
<td class="text-center">
<a href="{% url 'kfet.inventory.read' inventory.pk %}">
<span class="glyphicon glyphicon-cog"></span>
</a>
</td>
<td>{{ inventory.at }}</td>
<td>{{ inventory.by.trigramme }}</td>
<td>{{ inventory.nb_articles }}</td>
<td>
{% if inventory.order %}
<a href="{% url 'kfet.order.read' inventory.order.pk %}">
#{{ inventory.order.pk }}
</a>
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
<div class="table-responsive">
<table class="table table-hover table-condensed">
<thead>
<tr>
<td>Date</td>
<td>Par</td>
<td>Nb articles</td>
</tr>
</thead>
<tbody>
{% for inventory in inventories %}
<tr>
<td>
<a href="{% url 'kfet.inventory.read' inventory.pk %}">
<span>{{ inventory.at }}</span>
</a>
</td>
<td>{{ inventory.by }}</td>
<td>{{ inventory.nb_articles }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% endblock %}

View file

@ -1,16 +1,17 @@
{% extends "kfet/base_col_1.html" %}
{% load staticfiles widget_tweaks %}
{% load static widget_tweaks %}
{% block title %}Nouvel inventaire{% endblock %}
{% block header-title %}Création d'un inventaire{% endblock %}
{% block main-size %}col-md-10 col-md-offset-1 col-lg-8 col-lg-offset-2{% endblock %}
{% block main-content %}
{% block main %}
<form id='inventoryform' action="" method="post">
<div class="table-responsive">
<table class="table table-condensed text-center">
<table class="table table-hover table-condensed table-condensed-input text-center">
<thead>
<tr>
<td>Article</td>
@ -33,7 +34,7 @@
{% endifchanged %}
<tr>
{{ form.article }}
<td class='name'>{{ form.name }}</td>
<td class='name text-left'>{{ form.name }}</td>
<td class='box_capacity'>{{ form.box_capacity }}</td>
<td>
<span class='current_stock'>{{ form.stock_old }}</span><span class='stock_diff'></span>

View file

@ -3,54 +3,59 @@
{% block title %}Inventaire #{{ inventory.pk }}{% endblock %}
{% block header-title %}Inventaire #{{ inventory.pk }}{% endblock %}
{% block fixed-content %}
{% block fixed %}
<div class="content-left-top">
<div class="line"><b>Date:</b> {{ inventory.at }}</div>
<div class="line"><b>Par:</b> {{ inventory.by.trigramme }}</div>
{% if inventory.order %}
<div class="line">
<b>Commande relative:</b>&nbsp;
<a href="{% url 'kfet.order.read' inventory.order.pk %}">
#{{ inventory.order.pk }}
</a>
</div>
{% endif %}
</div>
{% endblock %}
{% block main-content %}
<div class="content-right-block">
<h2>Détails</h2>
<div class="table-responsive">
<table class="table table-condensed">
<thead>
<tr>
<td>Article</td>
<td>Stock avant</td>
<td>Stock après</td>
<td>Erreur</td>
</tr>
</thead>
<tbody>
{% for inventoryart in inventoryarts %}
{% ifchanged inventoryart.article.category %}
<tr class="section">
<td colspan="4">{{ inventoryart.article.category.name }}</td>
</tr>
{% endifchanged %}
<tr>
<td>{{ inventoryart.article.name }}</td>
<td>{{ inventoryart.stock_old }}</td>
<td>{{ inventoryart.stock_new }}</td>
<td>{{ inventoryart.stock_error }}</td>
</tr>
{% endfor %}
</tbody>
</table>
<aside>
<div class="text">
<ul class="list-unstyled">
<li><b>Date :</b> {{ inventory.at }}</li>
<li><b>Par :</b> {{ inventory.by }}</li>
{% if inventory.order %}
<li>
<b>Commande relative :</b>
<a href="{% url 'kfet.order.read' inventory.order.pk %}">
#{{ inventory.order.pk }}
</a>
</li>
{% endif %}
</ul>
</div>
</aside>
{% endblock %}
{% block main %}
<div class="table-responsive">
<table class="table table-condensed">
<thead>
<tr>
<td>Article</td>
<td>Stock avant</td>
<td>Stock après</td>
<td>Erreur</td>
</tr>
</thead>
<tbody>
{% for inventoryart in inventoryarts %}
{% ifchanged inventoryart.article.category %}
<tr class="section">
<td colspan="4">{{ inventoryart.article.category.name }}</td>
</tr>
{% endifchanged %}
<tr>
<td>
<a href="{% url "kfet.article.read" inventoryart.article.id %}">
{{ inventoryart.article.name }}
</a>
</td>
<td>{{ inventoryart.stock_old }}</td>
<td>{{ inventoryart.stock_new }}</td>
<td>{{ inventoryart.stock_error }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% endblock %}

View file

@ -10,6 +10,7 @@
{% block title %}K-Psul{% endblock %}
{% block header %}{% endblock %}
{% block footer %}{% endblock %}
{% block help %}
@ -105,11 +106,27 @@
<div class="col-sm-8 kpsul_middle_left_col">
<div class="kpsul_middle_left">
<div class="kpsul_middle_left_top">
<div id="special_operations">
<button role="button" class="btn" id="operation_deposit">Charge (F3)</button>
<button role="button" class="btn" id="operation_withdraw">Retrait (Shift+F3)</button>
<button role="button" class="btn" id="cool_reset">RAZ (F1)</button>
<button role="button" class="btn" id="ask_addcost">Major. (F9)</button>
<div id="special_operations" class="btn-group btn-group-justified">
<div class="btn-group">
<button type="button" class="btn btn-primary" id="operation_deposit">
Charge <span class="hidden-xs hidden-sm">(F3)</span>
</button>
</div>
<div class="btn-group">
<button type="button" class="btn btn-primary" id="operation_withdraw">
Retrait <span class="hidden-xs hidden-sm">(Shift+F3)</span>
</button>
</div>
<div class="btn-group">
<button type="button" class="btn btn-primary" id="cool_reset">
RAZ <span class="hidden-xs hidden-sm">(F1)</span>
</button>
</div>
<div class="btn-group">
<button type="button" class="btn btn-primary" id="ask_addcost">
Major. <span class="hidden-xs hidden-sm">(F9)</span>
</button>
</div>
</div>
<div id="article_selection">
<input type="text" id="article_autocomplete" autocomplete="off">

View file

@ -1,49 +1,96 @@
{% load kfet_tags %}
<div class="content-left-top {% if account.is_frozen %}frozen-account{% endif %}">
<div class="line line-big">{{ account.trigramme }}</div>
<div class="line balance">{{ account.balance|ukf:account.is_cof }} UKF</div>
<div class="block">
<div class="line">{{ account.name }}</div>
{% if perms.kfet.is_team %}
<div class="line">{{ account.nickname }}</div>
{% endif %}
<div class="line">
{% if account.email %}
{{ account.email }}
{% else %}
Pas d'email !
<aside class="aside {% if account.is_frozen %}frozen-account{% endif %}">
<div class="heading">
<div class="big">{{ account.trigramme }}</div>
<div class="toggle">
<span class="base">{{ account.balance_ukf }} UKF</span>
<span class="hover">{{ account.balance }} €</span>
</div>
</div>
<div class="buttons">
<a class="btn btn-default" href="{% url 'kfet.account.update' account.trigramme %}">
<span class="glyphicon glyphicon-cog"></span><span>Éditer</span>
</a>
<a class="btn btn-default" disabled>
<span class="glyphicon glyphicon-credit-card"></span><span>Créditer</span>
</a>
</div>
<div class="text">
<h4>{{ account.name|title }}</h4>
<ul class="list-unstyled">
{% if perms.kfet.is_team %}
<li>{{ account.nickname }}</li>
{% endif %}
</div>
<div class="line">
{{ account.departement }} {{ account.promo }}
</div>
<div class="line">Statut COF: {{ account.is_cof }}</div>
<li>{{ account.email|default:"Pas d'email!" }}</li>
<li>{{ account.departement }} {{ account.promo }}</li>
<li>
{% if account.is_cof %}
<span title="Réduction de {{ kfet_config.reduction_cof }} % sur tes commandes" data-toggle="tooltip" data-placement="right">Adhérent COF</span>
{% else %}
Non-COF
{% endif %}
</li>
</ul>
</div>
<div class="block block-neg">
{% if account.negative.start %}
<div class="line">En négatif depuis {{ account.negative.start }}</div>
{% endif %}
{% if account.negative.balance_offset %}
<div class="line">Solde réel: {{ account.real_balance }} €</div>
{% endif %}
{% if account.negative.authz_overdraft_amount %}
<div class="line">Découvert autorisé: {{ account.negative.authz_overdraft_amount }} €</div>
{% endif %}
{% if account.negative.authz_overdraft_until %}
<div class="line">Découvert autorisé jusqu'à : {{ account.negative.authz_overdraft_until }}</div>
{% endif %}
{% if account.negative %}
<div class="text">
<h4>Négatif</h4>
<ul class="list-unstyled">
{% if account.negative.start %}
<li>Depuis le <b>{{ account.negative.start|date:"d/m/Y à H:i" }}</b></li>
{% endif %}
{% if account.real_balance != account.balance %}
<li>Solde réel: {{ account.real_balance }} €</li>
{% endif %}
<li>
Plafond :
<b>{{ account.negative.authz_overdraft_amount|default:kfet_config.overdraft_amount }} €</b>
jusqu'au
<b>{{ account.negative.authz_overdraft_until|default:account.negative.until_default|date:"d/m/Y à H:i" }}</b>
</li>
</ul>
</div>
</div>
<div class="buttons">
{% if account.user == request.user %}
<ul class='nav nav-pills nav-justified'>
<li class="active"><a class="btn btn-primary" data-toggle="pill" href="#tab_stats">Statistiques</a></li>
<li><a class="btn btn-primary" data-toggle="pill" href="#tab_history">Historique</a></li>
</ul>
{% endif %}
<a class="btn btn-primary btn-lg" href="{% url 'kfet.account.update' account.trigramme %}">
Modifier
</a>
<a class="btn btn-primary btn-lg" disabled>Recharger par CB</a>
</aside>
{% if account.user == request.user %}
<div class="buttons tabs-buttons">
<div>
<a class="btn btn-primary-w focus" data-toggle="pill" href="#tab_stats">
Statistiques
<span class="hidden-xs glyphicon glyphicon-chevron-right"></span>
</a>
</div>
<div>
<a class="btn btn-primary-w" data-toggle="pill" href="#tab_history">
Historique
<span class="hidden-xs glyphicon glyphicon-chevron-right"></span>
</a>
</div>
</div>
{% endif %}
<script type="text/javascript">
$( function() {
// Tooltips
$('[data-toggle="tooltip"]').tooltip();
// Opened tab button
let tabs_buttons = $('.tabs-buttons a');
tabs_buttons.click( function() {
tabs_buttons.removeClass('focus');
$(this).addClass('focus');
});
});
</script>

View file

@ -1,13 +1,24 @@
<div class="content-left-top">
<div class="line line-big">{{ checkout.name }}</div>
<div class="line balance">{{ checkout.balance|floatformat:2 }} €</div>
<div class="block">
<div class="line">Valide du {{ checkout.valid_from|date:'l j F Y, G:i' }}</div>
<div class="line">au {{ checkout.valid_to|date:'l j F Y, G:i' }}</div>
<div class="line">Créée par {{ checkout.created_by }}</div>
<aside>
<div class="heading">
{{ checkout.name }}
<div class="sub">{{ checkout.balance|floatformat:2 }} €</div>
</div>
</div>
<div class="buttons">
<a class="btn btn-default {% if checkout.is_protected %} disabled{% endif %}" href="{% url 'kfet.checkout.update' checkout.pk %}">
<span class="glyphicon glyphicon-cog"></span><span>Modifier</span>
</a>
</div>
<div class="text">
<ul class="list-unstyled">
<li>Valide du {{ checkout.valid_from|date:'l j F Y, G:i' }}</li>
<li>au {{ checkout.valid_to|date:'l j F Y, G:i' }}</li>
<li>Créée par {{ checkout.created_by }}</li>
</ul>
</div>
</aside>
<div class="buttons">
<a class="btn btn-primary btn-lg {% if checkout.is_protected %} disabled{% endif %}" href="{% url 'kfet.checkout.update' checkout.pk %}">Modifier</a>
<a class="btn btn-primary btn-lg" href="{% url 'kfet.checkoutstatement.create' checkout.pk %}">Effectuer un relevé</a>
<a class="btn btn-primary" href="{% url 'kfet.checkoutstatement.create' checkout.pk %}">
Effectuer un relevé
</a>
</div>

View file

@ -0,0 +1,18 @@
{% if not href %}
{% url url as href %}
{% endif %}
<li class="{% if not href %}navbar-text{% endif %} {% if request.path == href %}active{% endif %} {{ class }}">
{% if href %}
<a href="{{ href }}" title="{{ text }}">
{% endif %}<!--
{% if glyphicon %}
--><span class="glyphicon glyphicon-{{ glyphicon }}"></span><!--
{% endif %}
{% if text %}
--><span class="visible-lg-inline">{{ text }}</span><!--
{% endif %}
-->
{% if href %}
</a>
{% endif %}
</li>

View file

@ -3,24 +3,25 @@
{% block title %}Commandes{% endblock %}
{% block header-title %}Commandes{% endblock %}
{% block fixed-content %}
{% block fixed %}
<div class="content-left-top">
<div class="line line-big">{{ orders|length }}</div>
<div class="line line-bigsub">commande{{ orders|length|pluralize }}</div>
</div>
<aside>
<div class="heading">
{{ orders|length }}
<span class="sub">commande{{ orders|length|pluralize }}</span>
</div>
</aside>
{% endblock %}
{% block main-content %}
{% block main %}
<div class="content-right-block">
<section>
<h2>Fournisseurs</h2>
<div class="table-responsive">
<table class="table table-condensed">
<table class="table table-hover table-condensed">
<thead>
<tr>
<td></td>
<td></td>
<td>Nom</td>
<td>Mail</td>
@ -31,16 +32,15 @@
{% for supplier in suppliers %}
<tr>
<td class="no-padding">
<a href="{% url 'kfet.order.new' supplier.pk %}" class="btn btn-primary">
Passer une commande
<a href="{% url 'kfet.order.new' supplier.pk %}" class="btn btn-default">
Commander
</a>
</td>
<td class="text-center">
<td>
<a href="{% url 'kfet.order.supplier.update' supplier.pk %}">
<span class="glyphicon glyphicon-cog"></span>
{{ supplier.name }}
</a>
</td>
<td>{{ supplier.name }}</td>
<td>{{ supplier.email }}</td>
<td>{{ supplier.phone }}</td>
<td>{{ supplier.address }}</td>
@ -50,14 +50,14 @@
</tbody>
</table>
</div>
</div>
<div class="content-right-block">
</section>
<section>
<h2>Liste des commandes</h2>
<div class="table-responsive">
<table class="table table-condensed">
<table class="table table-hover table-condensed">
<thead>
<tr>
<td></td>
<td></td>
<td>Date</td>
<td>Fournisseur</td>
@ -69,17 +69,16 @@
<tr>
<td class="no-padding">
{% if not order.inventory %}
<a href="{% url 'kfet.order.to_inventory' order.pk %}" class="btn btn-primary">
<a href="{% url 'kfet.order.to_inventory' order.pk %}" class="btn btn-default">
Générer inventaire
</a>
{% endif %}
</td>
<td>
<a href="{% url 'kfet.order.read' order.pk %}">
<span class="glyphicon glyphicon-cog"></span>
{{ order.at }}
</a>
</td>
<td>{{ order.at }}</td>
<td>{{ order.supplier }}</td>
<td>
{% if order.inventory %}
@ -93,6 +92,6 @@
</tbody>
</table>
</div>
</div>
</section>
{% endblock %}

View file

@ -4,14 +4,14 @@
{% block title %}Nouvelle commande{% endblock %}
{% block header-title %}Création d'une commande {{ supplier.name }}{% endblock %}
{% block main-size %}col-md-10 col-md-offset-1 col-lg-8 col-lg-offset-2{% endblock %}
{% block main-size %}col-lg-8 col-lg-offset-2{% endblock %}
{% block main-content %}
{% block main %}
<form action="" method="post">
{% csrf_token %}
<div class="table-responsive">
<table class="table table-condensed text-center">
<table class="table table-hover table-condensed table-condensed-input text-center">
<thead>
<tr>
<td rowspan="2">Article</td>
@ -51,7 +51,7 @@
{% endifchanged %}
<tr>
{{ form.article }}
<td>{{ form.name }}</td>
<td class="text-left">{{ form.name }}</td>
{% for v_chunk in form.v_all %}
<td>{{ v_chunk }}</td>
{% endfor %}

View file

@ -3,25 +3,43 @@
{% block title %}Commande #{{ order.pk }}{% endblock %}
{% block header-title %}Commande #{{ order.pk }}{% endblock %}
{% block fixed-content %}
{% block fixed %}
<div class="content-left-top">
<div class="line"><b>Créée le:</b> {{ order.at }}</div>
<div class="line"><b>Fournisseur:</b> {{ order.supplier.name }}</div>
</div>
<aside>
<div class="text">
<ul class="list-unstyled">
<li><b>Créée le:</b> {{ order.at }}</li>
<li>
<b>Fournisseur:</b>
<a href="{% url "kfet.order.supplier.update" order.supplier.id %}">
{{ order.supplier.name }}
</a>
</li>
{% if order.inventory %}
<li>
<b>Inventaire relatif:</b>
<a href="{% url "kfet.inventory.read" order.inventory.pk %}">
#{{ order.inventory.pk }}
</a>
</li>
{% endif %}
</ul>
</div>
</aside>
{% if not order.inventory %}
<div class="buttons">
{% if not order.inventory %}
<a class="btn btn-primary btn-lg" href="{% url 'kfet.order.to_inventory' order.pk %}">
<a class="btn btn-primary" href="{% url 'kfet.order.to_inventory' order.pk %}">
Générer inventaire
</a>
{% endif %}
</div>
{% endif %}
{% endblock %}
{% block main-content %}
{% block main %}
<div class="content-right-block">
<section>
<h2>Détails</h2>
<div class="table-responsive">
<table class="table table-condensed">
@ -41,7 +59,11 @@
</tr>
{% endifchanged %}
<tr>
<td>{{ orderart.article.name }}</td>
<td>
<a href="{% url "kfet.article.read" orderart.article.id %}">
{{ orderart.article.name }}
</a>
</td>
<td>{{ orderart.quantity_ordered }}</td>
<td>
{% if orderart.article.box_capacity %}
@ -57,12 +79,13 @@
</tbody>
</table>
</div>
</div>
<div class="content-right-block">
</section>
<section>
<h2>Mail</h2>
<div>
<div class="full">
<textarea class="form-control" style="height:500px;">{{ mail }}</textarea>
</div>
</div>
</section>
{% endblock %}

View file

@ -6,15 +6,15 @@
{% block main-size %}col-md-10 col-md-offset-1 col-lg-8 col-lg-offset-2{% endblock %}
{% block main-content %}
{% block main %}
<form action="" method="post">
{% csrf_token %}
<div class="table-responsive">
<table class='table table-condensed text-center'>
<table class='table table-condensed table-condensed-input text-center'>
<thead>
<tr>
<td style="width:25%">Article</td>
<td style="width: 25%">Article</td>
<td>Prix HT</td>
<td>TVA</td>
<td>Droits</td>
@ -25,13 +25,13 @@
<tbody>
{% for form in formset %}
{% ifchanged form.category %}
<tr class='section'>
<td>{{ form.category_name }}</td>
<td colspan="5"></td>
<tr class='section text-left'>
<td colspan="6">{{ form.category_name }}</td>
</tr>
{% endifchanged %}
<tr>
<td>{{ form.name }}</td>
{{ form.article }}
<td class="text-left">{{ form.name }}</td>
<td class="nopadding">{{ form.price_HT | add_class:"form-control" }}</td>
<td class="nopadding">{{ form.TVA | add_class:"form-control" }}</td>
<td class="nopadding">{{ form.rights | add_class:"form-control" }}</td>

View file

@ -3,22 +3,22 @@
{% block title %}Paramètres{% endblock %}
{% block header-title %}Paramètres{% endblock %}
{% block fixed-content %}
{% block fixed %}
<div class="buttons">
<a class="btn btn-primary btn-lg" href="{% url 'kfet.settings.update' %}">
<a class="btn btn-primary" href="{% url 'kfet.settings.update' %}">
Modifier
</a>
</div>
{% endblock %}
{% block main-content %}
{% block main %}
<div class="content-right-block">
<section>
<h2>Valeurs</h2>
<div class="table-responsive">
<table class="table table-condensed">
<table class="table table-hover table-condensed">
<thead>
<tr>
<td>Nom</td>
@ -35,6 +35,6 @@
</tbody>
</table>
</div>
</div>
</section>
{% endblock %}

View file

@ -1,12 +1,10 @@
{% extends "kfet/base_col_1.html" %}
{% extends "kfet/base_form.html" %}
{% block title %}Modification des paramètres{% endblock %}
{% block header-title %}Modification des paramètres{% endblock %}
{% block main-class %}content-form{% endblock %}
{% block main %}
{% block main-content %}
{% include "kfet/base_form.html" with authz=perms.kfet.change_settings submit_text="Mettre à jour"%}
{% include "kfet/form_full_snippet.html" with authz=perms.kfet.change_settings submit_text="Mettre à jour"%}
{% endblock %}

View file

@ -1,12 +1,10 @@
{% extends "kfet/base_col_1.html" %}
{% extends "kfet/base_form.html" %}
{% block title %}{{ supplier.name }} - Édition{% endblock %}
{% block header-title %}Édition du fournisseur {{ supplier.name }}{% endblock %}
{% block main-class %}content-form{% endblock %}
{% block main %}
{% block main-content %}
{% include 'kfet/base_form.html' with authz=perms.kfet.change_supplier submit_text="Mettre à jour" %}
{% include 'kfet/form_full_snippet.html' with authz=perms.kfet.change_supplier submit_text="Mettre à jour" %}
{% endblock %}

View file

@ -1,48 +1,37 @@
{% extends 'kfet/base.html' %}
{% extends 'kfet/base_col_2.html' %}
{% load staticfiles %}
{% block title %}Transferts{% endblock %}
{% block content-header-title %}Transferts{% endblock %}
{% block header-title %}Transferts{% endblock %}
{% block content %}
{% block fixed %}
<div class="row">
<div class="col-sm-4 col-md-3 col-content-left">
<div class="content-left">
<div class="content-left-top">
</div>
<div class="buttons">
<a class="btn btn-primary btn-lg" href="{% url 'kfet.transfers.create' %}">
Nouveaux
</a>
</div>
<div class="buttons">
<a class="btn btn-primary" href="{% url 'kfet.transfers.create' %}">
Nouveaux
</a>
</div>
{% endblock %}
{% block main %}
<div id="history">
{% for transfergroup in transfergroups %}
<div class="opegroup transfergroup" data-transfergroup="{{ transfergroup.pk }}">
<span>{{ transfergroup.at }}</span>
<span>{{ transfergroup.valid_by.trigramme }}</span>
<span>{{ transfergroup.comment }}</span>
</div>
</div>
<div class="col-sm-8 col-md-9 col-content-right">
{% include 'kfet/base_messages.html' %}
<div class="content-right">
<div class="content-right-block">
<h2>Liste des transferts</h2>
<div id="history">
{% for transfergroup in transfergroups %}
<div class="opegroup transfergroup" data-transfergroup="{{ transfergroup.pk }}">
<span>{{ transfergroup.at }}</span>
<span>{{ transfergroup.valid_by.trigramme }}</span>
<span>{{ transfergroup.comment }}</span>
</div>
{% for transfer in transfergroup.transfers.all %}
<div class="ope transfer{% if transfer.canceled_at %} canceled{% endif %}" data-transfer="{{ transfer.pk }}" data-transfergroup="{{ transfergroup.pk }}">
<span class="amount">{{ transfer.amount }} €</span>
<span class="from_acc">{{ transfer.from_acc.trigramme }}</span>
<span class="glyphicon glyphicon-arrow-right"></span>
<span class="to_acc">{{ transfer.to_acc.trigramme }}</span>
</div>
{% endfor %}
{% endfor %}
</table>
{% for transfer in transfergroup.transfers.all %}
<div class="ope transfer{% if transfer.canceled_at %} canceled{% endif %}" data-transfer="{{ transfer.pk }}" data-transfergroup="{{ transfergroup.pk }}">
<span class="amount">{{ transfer.amount }} €</span>
<span class="from_acc">{{ transfer.from_acc.trigramme }}</span>
<span class="glyphicon glyphicon-arrow-right"></span>
<span class="to_acc">{{ transfer.to_acc.trigramme }}</span>
</div>
</div>
</div>
{% endfor %}
{% endfor %}
</div>
<script type="text/javascript">

View file

@ -10,9 +10,9 @@
{% block main-size %}col-sm-12{% endblock %}
{% block main-content %}
{% block main %}
<form id="transfers_form" style="background-color: transparent;">
<form id="transfers_form">
{% csrf_token %}
<div class="transfer_general text-center">
<input type="text" name="comment" id="comment" placeholder="Commentaire"><!--

View file

@ -1,15 +1,18 @@
# -*- coding: utf-8 -*-
import re
from django import template
from django.utils.html import escape
from django.utils.safestring import mark_safe
from math import floor
import re
from kfet.config import kfet_config
from ..utils import to_ukf
register = template.Library()
register.filter('ukf', to_ukf)
@register.filter()
def highlight_text(text, q):
@ -38,11 +41,13 @@ def highlight_clipper(clipper, q):
@register.filter()
def ukf(balance, is_cof):
grant = is_cof and (1 + kfet_config.subvention_cof / 100) or 1
return floor(balance * 10 * grant)
def widget_type(field):
return field.field.widget.__class__.__name__
@register.filter()
def widget_type(field):
return field.field.widget.__class__.__name__
def slice(l, start, end=None):
if end is None:
end = start
start = 0
return l[start:end]

View file

@ -9,7 +9,8 @@ from kfet.models import Account, Article, ArticleCategory
class TestStats(TestCase):
@patch('kfet.signals.messages')
@patch('gestioncof.signals.messages')
def test_user_stats(self, mock_messages):
"""
Checks that we can get the stat-related pages without any problem.

Some files were not shown because too many files have changed in this diff Show more