8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-11-25 04:43:10 +00:00

[Printer] Dashboard des taches en cours

This commit is contained in:
detraz 2018-10-26 17:54:11 +02:00 committed by root
parent 7c3788f019
commit 63c9a23ced
10 changed files with 365 additions and 195 deletions

View file

@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-10-26 01:01+0200\n" "POT-Creation-Date: 2018-10-26 17:50+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@ -18,186 +18,215 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n"
#: printer/forms.py:34 #: forms.py:33
msgid "Print As" msgid "Print As"
msgstr "Imprimer en tant que" msgstr "Imprimer en tant que"
#: printer/models.py:116 #: models.py:87
msgid "This is not your print operation task"
msgstr "Ceci n'est pas votre tache"
#: models.py:124
msgid "Pending" msgid "Pending"
msgstr "En attente" msgstr "En attente"
#: printer/models.py:117 #: models.py:125
msgid "Printable" msgid "Printable"
msgstr "Imprimable" msgstr "Imprimable"
#: printer/models.py:118 #: models.py:126
msgid "Running" msgid "Running"
msgstr "En cours..." msgstr "En cours..."
#: printer/models.py:119 #: models.py:127
msgid "Cancelled" msgid "Cancelled"
msgstr "Annulée" msgstr "Annulée"
#: printer/models.py:120 #: models.py:128
msgid "Finished" msgid "Finished"
msgstr "Terminée" msgstr "Terminée"
#: printer/models.py:132 #: models.py:140
msgid "File" msgid "File"
msgstr "Fichier" msgstr "Fichier"
#: printer/models.py:137 #: models.py:145 templates/printer/aff_jobs.html:31
msgid "File Name" msgid "File Name"
msgstr "Nom du fichier" msgstr "Nom du fichier"
#: printer/models.py:144 #: models.py:152 templates/printer/aff_jobs.html:34
msgid "Status" msgid "Status"
msgstr "Status" msgstr "Status"
#: printer/models.py:153 #: models.py:161
#, fuzzy #, fuzzy
#| msgid "Print As" #| msgid "Print As"
msgid "Print as" msgid "Print as"
msgstr "Imprimer en tant que" msgstr "Imprimer en tant que"
#: printer/models.py:158 #: models.py:166 templates/printer/aff_jobs.html:36
#, fuzzy #, fuzzy
#| msgid "price" #| msgid "price"
msgid "Price" msgid "Price"
msgstr "Prix" msgstr "Prix"
#: printer/models.py:166 #: models.py:174
msgid "Format" msgid "Format"
msgstr "Format" msgstr "Format"
#: printer/models.py:172 printer/settings.py:25 #: models.py:180 settings.py:25
msgid "Color" msgid "Color"
msgstr "Couleur" msgstr "Couleur"
#: printer/models.py:178 #: models.py:186
msgid "Disposition" msgid "Disposition"
msgstr "Disposition" msgstr "Disposition"
#: printer/models.py:182 #: models.py:190
msgid "Count" msgid "Count"
msgstr "Nombre" msgstr "Nombre"
#: printer/models.py:188 #: models.py:196
msgid "Stapling" msgid "Stapling"
msgstr "Agrafage" msgstr "Agrafage"
#: printer/models.py:194 #: models.py:202
msgid "Perforation" msgid "Perforation"
msgstr "Perforation" msgstr "Perforation"
#: printer/settings.py:20 #: models.py:243
msgid "This is not your print job"
msgstr "Ceci n'est pas votre tache"
#: settings.py:20
msgid "A4" msgid "A4"
msgstr "A4" msgstr "A4"
#: printer/settings.py:21 #: settings.py:21
msgid "A3" msgid "A3"
msgstr "A3" msgstr "A3"
#: printer/settings.py:24 #: settings.py:24
msgid "Greyscale" msgid "Greyscale"
msgstr "Noir et blanc" msgstr "Noir et blanc"
#: printer/settings.py:28 #: settings.py:28
msgid "Two sided" msgid "Two sided"
msgstr "Recto-verso" msgstr "Recto-verso"
#: printer/settings.py:29 #: settings.py:29
msgid "One sided" msgid "One sided"
msgstr "Recto" msgstr "Recto"
#: printer/settings.py:30 #: settings.py:30
msgid "Booklet" msgid "Booklet"
msgstr "Livret" msgstr "Livret"
#: printer/settings.py:33 printer/settings.py:40 #: settings.py:33 settings.py:40
msgid "None" msgid "None"
msgstr "Aucun" msgstr "Aucun"
#: printer/settings.py:34 #: settings.py:34
msgid "One top left" msgid "One top left"
msgstr "En haut à gauche" msgstr "En haut à gauche"
#: printer/settings.py:35 #: settings.py:35
msgid "One top right" msgid "One top right"
msgstr "En haut à droite" msgstr "En haut à droite"
#: printer/settings.py:36 #: settings.py:36
msgid "Two left sided" msgid "Two left sided"
msgstr "Deux à gauche" msgstr "Deux à gauche"
#: printer/settings.py:37 #: settings.py:37
msgid "Two right sided" msgid "Two right sided"
msgstr "Deux à droite" msgstr "Deux à droite"
#: printer/settings.py:41 #: settings.py:41
msgid "Two left sided holes" msgid "Two left sided holes"
msgstr "Deux trous à gauche" msgstr "Deux trous à gauche"
#: printer/settings.py:42 #: settings.py:42
msgid "Two right sided holes" msgid "Two right sided holes"
msgstr "Deux trous à droite" msgstr "Deux trous à droite"
#: printer/settings.py:43 #: settings.py:43
msgid "Two top holes" msgid "Two top holes"
msgstr "Deux trous en haut" msgstr "Deux trous en haut"
#: printer/settings.py:44 #: settings.py:44
msgid "Two bottom holes" msgid "Two bottom holes"
msgstr "Deux trous en bas" msgstr "Deux trous en bas"
#: printer/settings.py:45 #: settings.py:45
msgid "Four left sided holes" msgid "Four left sided holes"
msgstr "Quatre trous à gauche" msgstr "Quatre trous à gauche"
#: printer/settings.py:46 #: settings.py:46
msgid "Four right sided holes" msgid "Four right sided holes"
msgstr "Quatre trous à droite" msgstr "Quatre trous à droite"
#: printer/templates/printer/echec.html:11 #: templates/printer/aff_jobs.html:32
msgid "Failure" msgid "By user"
msgstr "Echec" msgstr "Par"
#: printer/templates/printer/newjob.html:13 #: templates/printer/aff_jobs.html:33
msgid "Start at"
msgstr "Début"
#: templates/printer/aff_jobs.html:35
msgid "Number"
msgstr "Exemplaires"
#: templates/printer/aff_jobs.html:43
msgid "for"
msgstr "pour"
#: templates/printer/index_jobs.html:28
#, fuzzy
#| msgid "Print"
msgid "Printer"
msgstr "Imprimer"
#: templates/printer/index_jobs.html:31 templates/printer/sidebar.html:34
msgid "List of jobs"
msgstr "Liste des taches"
#: templates/printer/newjob.html:13
msgid "Printing Menu" msgid "Printing Menu"
msgstr "Menu d'impression" msgstr "Menu d'impression"
#: printer/templates/printer/newjob.html:23 #: templates/printer/newjob.html:23 templates/printer/newjob.html:43
#: printer/templates/printer/newjob.html:44
msgid "Delete file" msgid "Delete file"
msgstr "Supprimer le fichier" msgstr "Supprimer le fichier"
#: printer/templates/printer/newjob.html:34 #: templates/printer/newjob.html:33
msgid "Add a file" msgid "Add a file"
msgstr "Fichier supplémentaire" msgstr "Fichier supplémentaire"
#: printer/templates/printer/print.html:13 #: templates/printer/print.html:13
msgid "Confirm printing" msgid "Confirm printing"
msgstr "Confirmer le lancement de l'impression" msgstr "Confirmer le lancement de l'impression"
#: printer/templates/printer/print.html:20 #: templates/printer/print.html:20
#, fuzzy #, fuzzy
#| msgid "File Name" #| msgid "File Name"
msgid "Filename : " msgid "Filename : "
msgstr "Nom du fichier" msgstr "Nom du fichier"
#: printer/templates/printer/print.html:21 #: templates/printer/print.html:21
msgid "Price for one copy : " msgid "Price for one copy : "
msgstr "Prix d'une copie : " msgstr "Prix d'une copie : "
#: printer/templates/printer/print.html:22 #: templates/printer/print.html:22
msgid "Number of pages : " msgid "Number of pages : "
msgstr "Nombre de pages : " msgstr "Nombre de pages : "
#: printer/templates/printer/success.html:11 #: templates/printer/sidebar.html:30
msgid "Success" msgid "Print document"
msgstr "Succès" msgstr "Imprimer un document"
#: printer/validators.py:48 #: validators.py:48
#, python-format #, python-format
msgid "" msgid ""
"MIME type '%(type)s' is not valid. Please, use one of these types: " "MIME type '%(type)s' is not valid. Please, use one of these types: "
@ -206,7 +235,7 @@ msgstr ""
"Le type '%(type)s' n'est pas autorisé. Merci d'utiliser un type" "Le type '%(type)s' n'est pas autorisé. Merci d'utiliser un type"
"%(allowed_types)s." "%(allowed_types)s."
#: printer/validators.py:51 #: validators.py:51
#, python-format #, python-format
msgid "" msgid ""
"The current file size is %(size)s. The maximum file size is %(max_size)s." "The current file size is %(size)s. The maximum file size is %(max_size)s."
@ -214,14 +243,20 @@ msgstr ""
"Le fichier a une taille de %(size)s. La taille maximum autorisée est " "Le fichier a une taille de %(size)s. La taille maximum autorisée est "
"%(max_size)s." "%(max_size)s."
#: printer/views.py:89 #: views.py:84
msgid "Next" msgid "Next"
msgstr "Suivant" msgstr "Suivant"
#: printer/views.py:121 #: views.py:115
msgid "Print" msgid "Print"
msgstr "Imprimer" msgstr "Imprimer"
#: printer/views.py:150 #: views.py:144
msgid "You are not allowed to print" msgid "You are not allowed to print"
msgstr "Vous n'êtes pas autorisé à imprimer" msgstr "Vous n'êtes pas autorisé à imprimer"
#~ msgid "Failure"
#~ msgstr "Echec"
#~ msgid "Success"
#~ msgstr "Succès"

View file

@ -234,6 +234,14 @@ class JobWithOptions(RevMixin, AclMixin, FieldPermissionModelMixin, models.Model
return total_price/100 return total_price/100
def can_view(self, user_request, *args, **kwargs):
if user_request.has_perm('printer.view_jobwithoptions'):
return True, None
elif user_request == self.user or user_request == self.printAs:
return True, None
else:
return False, _("This is not your print job")
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
super(JobWithOptions, self).__init__(*args, **kwargs) super(JobWithOptions, self).__init__(*args, **kwargs)
self.field_permissions = { self.field_permissions = {

View file

@ -0,0 +1,52 @@
{% comment %}
Re2o est un logiciel d'administration développé initiallement au rezometz. Il
se veut agnostique au réseau considéré, de manière à être installable en
quelques clics.
Copyright © 2018 Gabriel Détraz
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
{% endcomment %}
{% load acl %}
{% load logs_extra %}
{% load i18n %}
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th>{% trans "File Name" %}</th>
<th>{% trans "By user" %}</th>
<th>{% trans "Start at" %}</th>
<th>{% trans "Status" %}</th>
<th>{% trans "Number" %}</th>
<th>{% trans "Price" %}</th>
</tr>
</thead>
{% for job in jobs_list %}
{% can_view job %}
<tr>
<td>{{ job.filename }}</td>
<td>{{ job.user }} {% if job.user != job.printAs %} {% trans "for" %} {{ job.printAs }}{% endif %}</td>
<td>{{ job.starttime }}</td>
<td>{{ job.status }}</td>
<td>{{ job.count }}</td>
<td>{{ job.price }}</td>
</tr>
{% acl_end %}
{% endfor %}
</table>
</div>

View file

@ -0,0 +1,33 @@
{% extends "printer/sidebar.html" %}
{% comment %}
Re2o est un logiciel d'administration développé initiallement au rezometz. Il
se veut agnostique au réseau considéré, de manière à être installable en
quelques clics.
Copyright © 2018 Gabriel Détraz
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
{% endcomment %}
{% load bootstrap3 %}
{% load acl %}
{% load i18n %}
{% block title %}{% trans "Printer" %}{% endblock %}
{% block content %}
<h2>{% trans "List of jobs" %}</h2>
{% include "printer/aff_jobs.html" with jobs_list=jobs_list %}
{% endblock %}

View file

@ -1,10 +1,10 @@
{% extends "base.html" %} {% extends "printer/sidebar.html" %}
{% load staticfiles %} {% load staticfiles %}
{% load i18n %}
{% load i18n %}
{% load bootstrap3 %} {% load bootstrap3 %}
{% load massive_bootstrap_form %} {% load massive_bootstrap_form %}
{% load static %}
{% block title %}Printing interface{% endblock %} {% block title %}Printing interface{% endblock %}
{% block content %} {% block content %}

View file

@ -1,4 +1,4 @@
{% extends "base.html" %} {% extends "printer/sidebar.html" %}
{% load staticfiles %} {% load staticfiles %}
{% load i18n %} {% load i18n %}

View file

@ -0,0 +1,36 @@
{% extends "base.html" %}
{% comment %}
Re2o est un logiciel d'administration développé initiallement au rezometz. Il
se veut agnostique au réseau considéré, de manière à être installable en
quelques clics.
Copyright © 2017 Gabriel Détraz
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
{% endcomment %}
{% load acl %}
{% load i18n %}
{% block sidebar %}
<a class="list-group-item list-group-item-success" href="{% url "printer:new-job" %}">
<i class="fa fa-plus"></i>
{% trans "Print document" %}
</a>
<a class="list-group-item list-group-item-info" href="{% url "printer:index-jobs" %}">
<i class="fa fa-list-ul"></i>
{% trans "List of jobs" %}
</a>
{% endblock %}

View file

@ -13,5 +13,6 @@ from . import views
urlpatterns = [ urlpatterns = [
url(r'^new_job/$', views.new_job, name="new-job"), url(r'^new_job/$', views.new_job, name="new-job"),
url(r'^print_job/(?P<printoperationid>[0-9]+)$', views.print_job, name='print-job') url(r'^print_job/(?P<printoperationid>[0-9]+)$', views.print_job, name='print-job'),
url(r'^index_jobs/$', views.index_jobs, name="index-jobs")
] ]

View file

@ -15,7 +15,7 @@ from django.utils.translation import ugettext as _
from re2o.views import form from re2o.views import form
from users.models import User from users.models import User
from re2o.utils import re2o_paginator
from . import settings from . import settings
from .utils import pdfinfo, send_mail_printer from .utils import pdfinfo, send_mail_printer
@ -24,20 +24,17 @@ from .models import (
JobWithOptions, JobWithOptions,
PrintOperation PrintOperation
) )
from .forms import ( from .forms import (
JobWithOptionsForm, JobWithOptionsForm,
) )
from preferences.models import GeneralOption
from cotisations.models import( from cotisations.models import(
Paiement, Paiement,
Facture, Facture,
Vente, Vente,
) )
from cotisations.utils import find_payment_method from cotisations.utils import find_payment_method
from cotisations.payment_methods.balance.models import BalancePayment from cotisations.payment_methods.balance.models import BalancePayment
from django.core.exceptions import ValidationError from django.core.exceptions import ValidationError
@ -178,3 +175,11 @@ def payment(request, jobs):
'users:profil', 'users:profil',
kwargs={'userid': str(request.user.id)} kwargs={'userid': str(request.user.id)}
)) ))
@login_required
def index_jobs(request):
""" Display jobs"""
pagination_number = GeneralOption.get_cached_value('pagination_number')
jobs = JobWithOptions.objects.select_related('user').select_related('print_operation')
jobs_list = re2o_paginator(request, jobs, pagination_number)
return render(request, 'printer/index_jobs.html', {'jobs_list': jobs_list})