alfortville: add a new table listing mails waiting for validation (#8716)
This commit is contained in:
parent
4c8a13d534
commit
3b2b08a73f
|
@ -0,0 +1,77 @@
|
|||
{% extends "welco/base.html" %}
|
||||
{% load i18n static %}
|
||||
|
||||
{% block bodyargs %}class="mail-table mail-table-waiting"{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
{% if objects %}
|
||||
<div class="source-mail all">
|
||||
<div class="cell document top">
|
||||
<h2>{% trans 'Mails waiting for validation' %}</h2>
|
||||
<div>
|
||||
<div class="mails">
|
||||
<ul>
|
||||
{% for object in objects %}
|
||||
<li
|
||||
data-mail-id="{{object.id}}"
|
||||
data-mail-status="{{object.status}}"
|
||||
data-pdf-href="{{object.content.url}}">
|
||||
{{object.creation_timestamp}}
|
||||
{% for association in object.associations.all %}
|
||||
<br/><span data-formdata-url="{{association.formdata_url}}">{{association.formdef_name}}</span>
|
||||
{% endfor %}
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
<iframe id="pdf-viewer" src="{% url 'mail-viewer' %}" style="width: 100%;
|
||||
height: 100%; border: 0;">
|
||||
</iframe>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="cell mail-status">
|
||||
</div>
|
||||
|
||||
<div class="cell">
|
||||
</div>
|
||||
|
||||
<div class="cell mark-as-seen">
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(function() {
|
||||
$('[data-pdf-href]').on('welco:mail-selected', function() {
|
||||
$('input[name="object-pk"]').val($(this).data('object-pk'));
|
||||
$('.mail-status').empty();
|
||||
var msg = null;
|
||||
if ($(this).data('mail-status') == 'done-qualif') {
|
||||
msg = 'En attente de validation DGS'
|
||||
} else if ($(this).data('mail-status') == 'done-dgs') {
|
||||
msg = 'En attente de validation DGA'
|
||||
}
|
||||
$('<p class="waiting-for">' + msg + '</p>').appendTo('.mail-status');
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{% else %}
|
||||
<!-- nothing -->
|
||||
|
||||
<div class="source-mail all">
|
||||
<div class="cell document top">
|
||||
<h2>{% trans 'Mails waiting for validation' %}</h2>
|
||||
|
||||
<p class="no-mail-table">
|
||||
{% trans 'There is currently no mail in this list.' %}
|
||||
</p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
{% endif %}
|
||||
|
||||
{% endblock %}
|
|
@ -17,7 +17,7 @@
|
|||
from django.conf.urls import patterns, url
|
||||
|
||||
from .views import (dgs, dga, copies, copies_ajax, table_info, table_avis,
|
||||
table_mandatory_avis)
|
||||
table_mandatory_avis, table_waiting)
|
||||
|
||||
urlpatterns = patterns('',
|
||||
url('^dgs/$', dgs, name='alfortville-dgs'),
|
||||
|
@ -27,4 +27,5 @@ urlpatterns = patterns('',
|
|||
url('^table/info/$', table_info, name='alfortville-table-info'),
|
||||
url('^table/avis/$', table_avis, name='alfortville-table-avis'),
|
||||
url('^table/avis-requis/$', table_mandatory_avis, name='alfortville-table-mandatory-avis'),
|
||||
url('^table/en-attente-de-validation/$', table_waiting, name='alfortville-table-waiting'),
|
||||
)
|
||||
|
|
|
@ -28,6 +28,7 @@ from .models import Inbox
|
|||
|
||||
from welco.sources.mail.models import Mail
|
||||
from welco.sources.mail.views import Home as MailHome
|
||||
from welco.qualif.models import Association
|
||||
from welco.utils import get_wcs_data, get_wcs_options
|
||||
from welco.views import Home as HomeScreen
|
||||
|
||||
|
@ -197,3 +198,26 @@ class TableInfo(MailTable):
|
|||
button_text = _('Mark as Seen')
|
||||
|
||||
table_info = login_required(TableInfo.as_view())
|
||||
|
||||
|
||||
class TableWaiting(TemplateView):
|
||||
template_name = 'alfortville/mail-table-waiting.html'
|
||||
|
||||
def get_context_data(self, *args, **kwargs):
|
||||
context = super(TableWaiting, self).get_context_data(**kwargs)
|
||||
|
||||
content_type = ContentType.objects.get_for_model(Mail)
|
||||
context['objects'] = []
|
||||
seen = {}
|
||||
for association in Association.objects.filter(
|
||||
formdef_reference__isnull=False,
|
||||
formdata_id__isnull=True,
|
||||
source_pk__isnull=False,
|
||||
source_type=content_type.id):
|
||||
if association.source_pk not in seen:
|
||||
context['objects'].append(association.source)
|
||||
seen['association.source_pk'] = True
|
||||
|
||||
return context
|
||||
|
||||
table_waiting = login_required(TableWaiting.as_view())
|
||||
|
|
|
@ -57,10 +57,12 @@ body.welco-home div#content {
|
|||
height: 80%;
|
||||
}
|
||||
|
||||
.mail-table-waiting .cell,
|
||||
.mail-table-subtype1 .cell {
|
||||
height: 10%;
|
||||
}
|
||||
|
||||
.mail-table-waiting .cell.top,
|
||||
.mail-table-subtype1 .cell.top {
|
||||
height: 90%;
|
||||
}
|
||||
|
@ -443,6 +445,7 @@ form#note textarea {
|
|||
margin-right: 1ex;
|
||||
}
|
||||
|
||||
p.waiting-for,
|
||||
p.no-mail-table {
|
||||
padding: 10px;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue