Compare commits
No commits in common. "petitscours" and "master" have entirely different histories.
petitscour
...
master
8 changed files with 101 additions and 275 deletions
|
@ -1,77 +0,0 @@
|
||||||
/** Honteusement copié-collé de bda.css **/
|
|
||||||
/** JQuery-Confirm box **/
|
|
||||||
|
|
||||||
.jconfirm .jconfirm-bg {
|
|
||||||
background-color: rgb(0,0,0,0.6) !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.jconfirm .jconfirm-box {
|
|
||||||
padding:0;
|
|
||||||
border-radius:0 !important;
|
|
||||||
font-family:Roboto;
|
|
||||||
}
|
|
||||||
|
|
||||||
.jconfirm .jconfirm-box .content-pane {
|
|
||||||
border-bottom:1px solid #ddd;
|
|
||||||
margin: 0px !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.jconfirm .jconfirm-box .content {
|
|
||||||
padding: 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.jconfirm .jconfirm-box .content-pane {
|
|
||||||
border-bottom:1px solid #ddd;
|
|
||||||
margin: 0px !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.jconfirm .jconfirm-box .content {
|
|
||||||
padding: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.jconfirm .jconfirm-box .content a,
|
|
||||||
.jconfirm .jconfirm-box .content a:hover {
|
|
||||||
color: #D81138;
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
|
|
||||||
.jconfirm .jconfirm-box .buttons {
|
|
||||||
margin-top:-6px; /* j'arrive pas à voir pk y'a un espace au dessus sinon... */
|
|
||||||
padding:0;
|
|
||||||
height:40px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.jconfirm .jconfirm-box .buttons button {
|
|
||||||
min-width:40px;
|
|
||||||
height:100%;
|
|
||||||
margin:0;
|
|
||||||
margin:0 !important;
|
|
||||||
border-radius: 0 !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.jconfirm .jconfirm-box .buttons button:first-child:focus,
|
|
||||||
.jconfirm .jconfirm-box .buttons button:first-child:hover {
|
|
||||||
color:#FFF !important;
|
|
||||||
background:forestgreen !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.jconfirm .jconfirm-box .buttons button:nth-child(2):focus,
|
|
||||||
.jconfirm .jconfirm-box .buttons button:nth-child(2):hover {
|
|
||||||
color:#FFF !important;
|
|
||||||
background:#D93A32 !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.jconfirm .jconfirm-box div.title-c .title {
|
|
||||||
display: block;
|
|
||||||
|
|
||||||
padding:0 15px;
|
|
||||||
height:40px;
|
|
||||||
line-height:40px;
|
|
||||||
|
|
||||||
font-family:Dosis;
|
|
||||||
font-size:20px;
|
|
||||||
font-weight:bold;
|
|
||||||
|
|
||||||
color:#FFF;
|
|
||||||
background-color:rgb(222, 130, 107);
|
|
||||||
}
|
|
|
@ -21,11 +21,7 @@
|
||||||
<td>{{ demande.created|date:"d E Y" }}</td>
|
<td>{{ demande.created|date:"d E Y" }}</td>
|
||||||
<td style="text-align: center;"><img src="{% if demande.traitee %}{% static "vendor/font-awesome/images/yes.png" %}{% else %}{% static "vendor/font-awesome/images/no.png" %}{% endif %}" /></td>
|
<td style="text-align: center;"><img src="{% if demande.traitee %}{% static "vendor/font-awesome/images/yes.png" %}{% else %}{% static "vendor/font-awesome/images/no.png" %}{% endif %}" /></td>
|
||||||
<td>{% if demande.traitee_par %}{{ demande.traitee_par.username }}{% else %}<span class="glyphicon glyphicon-ban-circle"></span>{% endif %}</td>
|
<td>{% if demande.traitee_par %}{{ demande.traitee_par.username }}{% else %}<span class="glyphicon glyphicon-ban-circle"></span>{% endif %}</td>
|
||||||
<td>{% if demande.traitee %}
|
<td><a href="{% url "petits-cours-demande-details" demande.id %}" class="see_detail">Détails</a></td>
|
||||||
<a href="{% url "petits-cours-demande-details" demande.id %}" class="see_detail">Détails</a>
|
|
||||||
{% else %}
|
|
||||||
<a href="{% url "petits-cours-demande-traitement" demande.id %}" class="see_detail">Traiter</a>
|
|
||||||
{% endif %}</td>
|
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|
|
@ -8,20 +8,7 @@
|
||||||
<tr><td><strong>Quand</strong></td><td> {{ demande.quand }}</td></tr>
|
<tr><td><strong>Quand</strong></td><td> {{ demande.quand }}</td></tr>
|
||||||
<tr><td><strong>Fréquence</strong></td><td> {{ demande.freq }}</td></tr>
|
<tr><td><strong>Fréquence</strong></td><td> {{ demande.freq }}</td></tr>
|
||||||
<tr><td><strong>Matières</strong></td><td> {% for matiere in demande.matieres.all %}{% if forloop.counter0 > 0 %}, {% endif %}{{ matiere }}{% endfor %}</td></tr>
|
<tr><td><strong>Matières</strong></td><td> {% for matiere in demande.matieres.all %}{% if forloop.counter0 > 0 %}, {% endif %}{{ matiere }}{% endfor %}</td></tr>
|
||||||
<tr><td><strong>Niveau souhaité</strong></td><td>
|
<tr><td><strong>Niveau souhaité</strong></td><td> {{ demande.get_niveau_display }}</td></tr>
|
||||||
{% if levels %}
|
|
||||||
<form method="post">
|
|
||||||
{% csrf_token %}
|
|
||||||
<select name="niveau" onchange="this.form.submit()">
|
|
||||||
{% for level_id, level_name in levels %}
|
|
||||||
<option value="{{ level_id }}" {% if level_id == 'other' %}selected{% endif %}>{{ level_name }}</option>
|
|
||||||
{% endfor %}
|
|
||||||
</select>
|
|
||||||
</form>
|
|
||||||
{% else %}
|
|
||||||
{{ demande.get_niveau_display }}
|
|
||||||
{% endif %}
|
|
||||||
</td></tr>
|
|
||||||
<tr><td><strong>Agrégé requis</strong></td><td> <img src="{% if demande.agrege_requis %}{% static "vendor/font-awesome/images/yes.png" %}{% else %}{% static "vendor/font-awesome/images/no.png" %}{% endif %}" /></td></tr>
|
<tr><td><strong>Agrégé requis</strong></td><td> <img src="{% if demande.agrege_requis %}{% static "vendor/font-awesome/images/yes.png" %}{% else %}{% static "vendor/font-awesome/images/no.png" %}{% endif %}" /></td></tr>
|
||||||
<tr><td><strong>Remarques</strong></td><td> {{ demande.remarques }}</td></tr>
|
<tr><td><strong>Remarques</strong></td><td> {{ demande.remarques }}</td></tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
|
@ -1,11 +1,4 @@
|
||||||
{% extends "petitscours/base_title.html" %}
|
{% extends "petitscours/base_title.html" %}
|
||||||
{% load static %}
|
|
||||||
|
|
||||||
{% block extra_head %}
|
|
||||||
<script type="text/javascript" src="{% static 'kfet/vendor/jquery/jquery-confirm.min.js' %}"></script>
|
|
||||||
<link type="text/css" rel="stylesheet" href="{% static 'vendor/jquery/jquery-confirm.css' %}" />
|
|
||||||
<link type="text/css" rel="stylesheet" href="{% static 'petitscours/css/confirmation.css' %}" />
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block realcontent %}
|
{% block realcontent %}
|
||||||
<h2>
|
<h2>
|
||||||
|
@ -16,14 +9,12 @@
|
||||||
</h2>
|
</h2>
|
||||||
{% include "petitscours/details_demande_infos.html" %}
|
{% include "petitscours/details_demande_infos.html" %}
|
||||||
<hr />
|
<hr />
|
||||||
|
|
||||||
{% if errors %}
|
{% if errors %}
|
||||||
<div class="error">
|
<div class="error">
|
||||||
Attention:
|
Attention:
|
||||||
<ul>{% for error in errors %}<li>{{ error }}</li>{% endfor %}</ul>
|
<ul>{% for error in errors %}<li>{{ error }}</li>{% endfor %}</ul>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if unsatisfied %}
|
{% if unsatisfied %}
|
||||||
<div class="error">
|
<div class="error">
|
||||||
Attention: Impossible de trouver des propositions pour les matières suivantes:
|
Attention: Impossible de trouver des propositions pour les matières suivantes:
|
||||||
|
@ -32,12 +23,9 @@
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
|
||||||
<form method="post" id="traitement-form">
|
|
||||||
{% csrf_token %}
|
|
||||||
{% if redo %}<input type="hidden" name="redo" value="1" />{% endif %}
|
|
||||||
{% if proposals %}
|
{% if proposals %}
|
||||||
|
<form method="post">
|
||||||
|
{% csrf_token %}
|
||||||
Propositions:
|
Propositions:
|
||||||
<ul>
|
<ul>
|
||||||
{% for proposeduser, matieres in proposed_for %}
|
{% for proposeduser, matieres in proposed_for %}
|
||||||
|
@ -58,36 +46,13 @@
|
||||||
<pre style="margin-top: 15px;">{{ content|safe }}</pre>
|
<pre style="margin-top: 15px;">{{ content|safe }}</pre>
|
||||||
{% endwith %}
|
{% endwith %}
|
||||||
<input type="hidden" name="attribdata" value="{{ attribdata }}" />
|
<input type="hidden" name="attribdata" value="{{ attribdata }}" />
|
||||||
|
{% if redo %}<input type="hidden" name="redo" value="1" />{% endif %}
|
||||||
<input class="btn btn-primary pull-right" type="submit" value="Valider le {% if redo %}re{% endif %}traitement de la demande" />
|
<input class="btn btn-primary pull-right" type="submit" value="Valider le {% if redo %}re{% endif %}traitement de la demande" />
|
||||||
|
</form>
|
||||||
{% else %}
|
{% else %}
|
||||||
<h3>Impossible de trouver des propositions pour cette demande</h3>
|
<h3>Impossible de trouver des propositions pour cette demande</h3>
|
||||||
<div class="error" style="font-size: 1.6em; margin-top: 10px;">Traitement manuel obligatoire !</div>
|
<div class="error" style="font-size: 1.6em; margin-top: 10px;">Traitement manuel obligatoire !</div>
|
||||||
<input type="hidden" name="manual" value="1" />
|
|
||||||
<input class="btn btn-primary pull-right" type="button" onclick="confirmation()" value="Marquer comme traitée" />
|
|
||||||
<script type="text/javascript">
|
|
||||||
function confirmation() {
|
|
||||||
$.confirm({
|
|
||||||
title: 'Marquer comme traitée',
|
|
||||||
columnClass: 'col-md-6 col-md-offset-3',
|
|
||||||
content: "Voulez-vous vraiment marquer la demande comme traitée ? \
|
|
||||||
Aucun traitement automatique n'aura lieu.",
|
|
||||||
backgroundDismiss: true,
|
|
||||||
opacity: 1,
|
|
||||||
animation:'top',
|
|
||||||
closeAnimation:'bottom',
|
|
||||||
keyboardEnabled: true,
|
|
||||||
confirmButton: '<span class="glyphicon glyphicon-ok"></span>',
|
|
||||||
cancelButton: '<span class="glyphicon glyphicon-remove"></span>',
|
|
||||||
confirm: function() {
|
|
||||||
charte_ok = true ;
|
|
||||||
$("#traitement-form").submit();
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</form>
|
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<a href="{% url 'petits-cours-demandes-list' %}">Retour à la liste des demandes</a>
|
<a href="{% url 'petits-cours-demandes-list' %}">Retour à la liste des demandes</a>
|
||||||
</p>
|
</p>
|
||||||
|
|
|
@ -1,12 +1,6 @@
|
||||||
{% extends "petitscours/base_title.html" %}
|
{% extends "petitscours/base_title.html" %}
|
||||||
{% load static %}
|
{% load static %}
|
||||||
|
|
||||||
{% block extra_head %}
|
|
||||||
<script type="text/javascript" src="{% static 'kfet/vendor/jquery/jquery-confirm.min.js' %}"></script>
|
|
||||||
<link type="text/css" rel="stylesheet" href="{% static 'vendor/jquery/jquery-confirm.css' %}" />
|
|
||||||
<link type="text/css" rel="stylesheet" href="{% static 'petitscours/css/confirmation.css' %}" />
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block realcontent %}
|
{% block realcontent %}
|
||||||
<h2>
|
<h2>
|
||||||
Traitement de la demande de petits cours {{ demande.id }}
|
Traitement de la demande de petits cours {{ demande.id }}
|
||||||
|
@ -27,11 +21,9 @@
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<form method="post" id="traitement-form">
|
|
||||||
{% csrf_token %}
|
|
||||||
{% if redo %}<input type="hidden" name="redo" value="1" />{% endif %}
|
|
||||||
{% if proposals %}
|
{% if proposals %}
|
||||||
|
<form method="post">
|
||||||
|
{% csrf_token %}
|
||||||
{% for matiere, users in proposals %}
|
{% for matiere, users in proposals %}
|
||||||
<h4>{{ matiere }}</h4>
|
<h4>{{ matiere }}</h4>
|
||||||
{% for i in "012"|make_list %}{% if i|add:"0" < users|length %}
|
{% for i in "012"|make_list %}{% if i|add:"0" < users|length %}
|
||||||
|
@ -61,36 +53,13 @@
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
<input type="hidden" name="preparing" value="1" />
|
<input type="hidden" name="preparing" value="1" />
|
||||||
|
{% if redo %}<input type="hidden" name="redo" value="1" />{% endif %}
|
||||||
<input type="submit" value="Préparer le {% if redo %}re{% endif %}traitement de la demande" />
|
<input type="submit" value="Préparer le {% if redo %}re{% endif %}traitement de la demande" />
|
||||||
|
</form>
|
||||||
{% else %}
|
{% else %}
|
||||||
<h3>Impossible de trouver des propositions pour cette demande</h3>
|
<h3>Impossible de trouver des propositions pour cette demande</h3>
|
||||||
<div class="error" style="font-size: 1.6em; margin-top: 10px;">Traitement manuel obligatoire !</div>
|
<div class="error" style="font-size: 1.6em; margin-top: 10px;">Traitement manuel obligatoire !</div>
|
||||||
<input type="hidden" name="manual" value="1" />
|
|
||||||
<input class="btn btn-primary pull-right" type="button" onclick="confirmation()" value="Marquer comme traitée" />
|
|
||||||
<script type="text/javascript">
|
|
||||||
function confirmation() {
|
|
||||||
$.confirm({
|
|
||||||
title: 'Marquer comme traitée',
|
|
||||||
columnClass: 'col-md-6 col-md-offset-3',
|
|
||||||
content: "Voulez-vous vraiment marquer la demande comme traitée ? \
|
|
||||||
Aucun traitement automatique n'aura lieu.",
|
|
||||||
backgroundDismiss: true,
|
|
||||||
opacity: 1,
|
|
||||||
animation:'top',
|
|
||||||
closeAnimation:'bottom',
|
|
||||||
keyboardEnabled: true,
|
|
||||||
confirmButton: '<span class="glyphicon glyphicon-ok"></span>',
|
|
||||||
cancelButton: '<span class="glyphicon glyphicon-remove"></span>',
|
|
||||||
confirm: function() {
|
|
||||||
charte_ok = true ;
|
|
||||||
$("#traitement-form").submit();
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</form>
|
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<a href="{% url 'petits-cours-demandes-list' %}">Retour à la liste des demandes</a>
|
<a href="{% url 'petits-cours-demandes-list' %}">Retour à la liste des demandes</a>
|
||||||
</p>
|
</p>
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
{% extends "petitscours/base_title.html" %}
|
||||||
|
|
||||||
|
{% block realcontent %}
|
||||||
|
<h2>Traitement de la demande de petits cours {{ demande.id }}</h2>
|
||||||
|
<div class="success" style="margin: 15px 0px; font-size: 1.4em;">Demande {{ demande.id }} de {{ demande.name }} {% if redo %}re{% endif %}traitée avec succès !</div>
|
||||||
|
<a href="{% url "petits-cours-demandes-list" %}">Retour à la liste des demandes</a>
|
||||||
|
{% endblock %}
|
|
@ -8,7 +8,6 @@ from django.core import mail
|
||||||
from django.db import transaction
|
from django.db import transaction
|
||||||
from django.shortcuts import get_object_or_404, redirect, render
|
from django.shortcuts import get_object_or_404, redirect, render
|
||||||
from django.template import loader
|
from django.template import loader
|
||||||
from django.urls import reverse
|
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
from django.views.decorators.csrf import csrf_exempt
|
from django.views.decorators.csrf import csrf_exempt
|
||||||
from django.views.generic import DetailView, ListView
|
from django.views.generic import DetailView, ListView
|
||||||
|
@ -17,7 +16,6 @@ from gestioncof.decorators import buro_required
|
||||||
from gestioncof.models import CofProfile
|
from gestioncof.models import CofProfile
|
||||||
from petitscours.forms import DemandeForm, MatieresFormSet
|
from petitscours.forms import DemandeForm, MatieresFormSet
|
||||||
from petitscours.models import (
|
from petitscours.models import (
|
||||||
LEVELS_CHOICES,
|
|
||||||
PetitCoursAbility,
|
PetitCoursAbility,
|
||||||
PetitCoursAttribution,
|
PetitCoursAttribution,
|
||||||
PetitCoursAttributionCounter,
|
PetitCoursAttributionCounter,
|
||||||
|
@ -170,12 +168,6 @@ def _traitement_other_preparing(request, demande):
|
||||||
|
|
||||||
def _traitement_other(request, demande, redo):
|
def _traitement_other(request, demande, redo):
|
||||||
if request.method == "POST":
|
if request.method == "POST":
|
||||||
if "niveau" in request.POST:
|
|
||||||
demande.niveau = request.POST["niveau"]
|
|
||||||
demande.save()
|
|
||||||
return redirect(
|
|
||||||
reverse("petits-cours-demande-traitement", args=(demande.id,))
|
|
||||||
)
|
|
||||||
if "preparing" in request.POST:
|
if "preparing" in request.POST:
|
||||||
return _traitement_other_preparing(request, demande)
|
return _traitement_other_preparing(request, demande)
|
||||||
else:
|
else:
|
||||||
|
@ -188,38 +180,16 @@ def _traitement_other(request, demande, redo):
|
||||||
"demande": demande,
|
"demande": demande,
|
||||||
"unsatisfied": unsatisfied,
|
"unsatisfied": unsatisfied,
|
||||||
"proposals": proposals.items(),
|
"proposals": proposals.items(),
|
||||||
"levels": LEVELS_CHOICES,
|
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def _traitement_post(request, demande):
|
def _traitement_post(request, demande):
|
||||||
redo = "redo" in request.POST
|
|
||||||
manual = "manual" in request.POST
|
|
||||||
|
|
||||||
if not manual:
|
|
||||||
_traitement_attributions(request, demande)
|
|
||||||
|
|
||||||
demande.traitee = True
|
|
||||||
demande.traitee_par = request.user
|
|
||||||
demande.processed = timezone.now()
|
|
||||||
demande.save()
|
|
||||||
|
|
||||||
messages.success(
|
|
||||||
request,
|
|
||||||
f"Demande de {demande.name} {'re' if redo else ''}traitée avec succès !",
|
|
||||||
)
|
|
||||||
if redo:
|
|
||||||
return redirect(demande.get_absolute_url())
|
|
||||||
else:
|
|
||||||
return redirect(reverse("petits-cours-demandes-list"))
|
|
||||||
|
|
||||||
|
|
||||||
def _traitement_attributions(request, demande):
|
|
||||||
proposals = {}
|
proposals = {}
|
||||||
proposed_for = {}
|
proposed_for = {}
|
||||||
unsatisfied = []
|
unsatisfied = []
|
||||||
extra = request.POST["extra"].strip()
|
extra = request.POST["extra"].strip()
|
||||||
|
redo = "redo" in request.POST
|
||||||
attribdata = request.POST["attribdata"]
|
attribdata = request.POST["attribdata"]
|
||||||
attribdata = dict(json.loads(attribdata))
|
attribdata = dict(json.loads(attribdata))
|
||||||
for matiere in demande.matieres.all():
|
for matiere in demande.matieres.all():
|
||||||
|
@ -283,6 +253,15 @@ def _traitement_attributions(request, demande):
|
||||||
user=user, matiere=matiere, demande=demande, rank=rank + 1
|
user=user, matiere=matiere, demande=demande, rank=rank + 1
|
||||||
)
|
)
|
||||||
attrib.save()
|
attrib.save()
|
||||||
|
demande.traitee = True
|
||||||
|
demande.traitee_par = request.user
|
||||||
|
demande.processed = timezone.now()
|
||||||
|
demande.save()
|
||||||
|
return render(
|
||||||
|
request,
|
||||||
|
"petitscours/traitement_demande_success.html",
|
||||||
|
{"demande": demande, "redo": redo},
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
|
|
Loading…
Reference in a new issue