Você está na página 1de 10

******Aprs les modifications, n'oubliez pas d'excuter les migrations pour needs

et usermanagement:
- python manage.py makemigrations
- python manage.py migrate

******J'ai rajout l'affichage de la Date de cration dans l'affichage principale


pour le statut salari afin d'illustrer
et de distinguer les lignes clients affiches.

******Refonte totale pour la page ...\elink\elink\templates\index_connected.html

******...\elink\elink\templates\index.html
- ligne 4:
<!-- 19-07-2017 Intgration de nouveau filtre dans le template -->
{% load app_filters %}
<!-- --------------------------------------------------------- -->

- lignes 10 19:
<!-- 22-07-2017 Ajout de styles pour la prsentation -->
<style type="text/css">
.evaluate-relation-container{
background: white;
z-index: 500;
}
.table {
width: 600px;
margin: auto;
}
</style>
<!-- ----------------------------------------------- -->

- lignes 43 57:
<!-- 22-07-2017 Affichage des valuations de mise en relation pour nombres
etoiles suprieurs 4 -->
<table class="table">
<tbody>
{% for mission in liste_mission %}
<tr>
<td>Mission : {{ mission.id }}</td>
<td style="width: 20px">
<div id="note_misenrela" class="evaluate-
relation-container">
<div data-name="mise_en" data-average="{{
mission.note_misenrela|str_strip }}" class="scoring-div-relation scoring-div
jDisabled" readonly></div>
</div>
</td>
<td>{{ mission.note_commentaire }}</td>
</tr>
{% endfor %}
</tbody>
</table>
<!--
-----------------------------------------------------------------------------------
--------- -->
- lignes 393 412:
<!-- 22-07-2017 Script d'affichage pour les toiles d'valuation -->
<script type="text/javascript">
$(document).ready(function(){
$('.scoring-div-relation').jRating({
type:"star", // "small" pour avoir une toile plus petite
length: 5, // nombre d'toile
rateMax: 5, // valeur max du rating
decimalLength: 1, // nombre de chiffre aprs virgule, supprimer si
entier
phpPath: "http://google.fr", // action ajax, url relative
sendRequest: false,
canRateAgain: true,
nbRates : 50,
/**
paramtres envoys:
rate: valeur rating;
besoin_id: id de l'lment mettre jour
action=rating (probablement inutile)
*/
});
});
</script>
<!-- ------------------------------------------------------------ -->

******...\elink\elink\templates\needs\besoin_user_list.html
- ligne 4:
<!-- 19-07-2017 Intgration de nouveau filtre dans le template -->
{% load app_filters %}
<!-- --------------------------------------------------------- -->

- ligne 132:
<!-- 19-07-2017 Modification de la valeur average en format texte standard
-->
<div data-name="mise_en" data-average=" {{ besoin.note_misenrela|str_strip }}
" class="scoring-div-relation scoring-div jDisabled" data-id="{{ besoin.id }}"
readonly></div>
<!-- ---------------------------------------------------------------------
-->

- ligne 143:
<!-- 22-07-2017 Modification du champ statut_presta en statut_eval_salarie
-->
{% if not besoin.statut_eval_salarie %}

- ligne 150:
<!-- 22-07-2017 Ajout du besoin.id-->
<div data-name="tech" style="float:right;" data-average="3" class="scoring-
div-prestataire-tech scoring-div" data-id="{{ besoin.mission_presta_id }}" data-
besoin="{{ besoin.id }}" ></div>

- ligne 155:
<!-- 22-07-2017 Ajout du besoin.id-->
<div data-name="orga" style="float:right;" data-average="3" class="scoring-
div-prestataire-orga scoring-div" data-id="{{ besoin.mission_presta_id }}" data-
besoin="{{ besoin.id }}" ></div>

- ligne 160:
<!-- 22-07-2017 Ajout du besoin.id-->
<div data-name="comp" style="float:right;" data-average="3" class="scoring-
div-prestataire-comp scoring-div" data-id="{{ besoin.mission_presta_id }}" data-
besoin="{{ besoin.id }}" ></div>

- ligne 165:
<!-- 22-07-2017 Ajout du besoin.id-->
<div data-name="comm" style="float:right;" data-average="3" class="scoring-
div-prestataire-comm scoring-div" data-id="{{ besoin.mission_presta_id }}" data-
besoin="{{ besoin.id }}" ></div>

-ligne 178:
<!-- 20-07-2017 Modification de la valeur average en format texte standard
pour affichage de l'valuation prestataire, ajout du besoin.id, et affichage des
nouveaux champs notes-->
<div data-name="tech" style="float:right;" data-
average="{{ besoin.note_tech_s|str_strip }}" class="scoring-div-prestataire-tech
scoring-div jDisabled" data-id="{{ besoin.mission_presta_id }}" data-
besoin="{{ besoin.id }}" ></div>

- ligne 183:
<!-- 20-07-2017 Modification de la valeur average en format texte standard
pour affichage de l'valuation prestataire, ajout du besoin.id et affichage des
nouveaux champs notes-->
<div data-name="orga" style="float:right;" data-
average="{{ besoin.note_orga_s|str_strip }}" class="scoring-div-prestataire-orga
scoring-div jDisabled" data-id="{{ besoin.mission_presta_id }}" data-
besoin="{{ besoin.id }}" ></div>

- ligne 188:
<!-- 20-07-2017 Modification de la valeur average en format texte standard
pour affichage de l'valuation prestataire, ajout du besoin.id et affichage des
nouveaux champs notes-->
<div data-name="comp" style="float:right;" data-
average="{{ besoin.note_compo_s|str_strip }}" class="scoring-div-prestataire-comp
scoring-div jDisabled" data-id="{{ besoin.mission_presta_id }}" data-
besoin="{{ besoin.id }}" ></div>

- ligne 193:
<!-- 20-07-2017 Modification de la valeur average en format texte standard
pour affichage de l'valuation prestataire, ajout du besoin.id et affichage des
nouveaux champs notes-->
<div data-name="comm" style="float:right;" data-
average="{{ besoin.note_commu_s|str_strip }}" class="scoring-div-prestataire-comm
scoring-div jDisabled" data-id="{{ besoin.mission_presta_id }}" data-
besoin="{{ besoin.id }}" ></div>

- lignes 205 214:


<!-- 22-07-2017 Pour affichage d'une mise en relation value -->
<div style="display: none;" class="toDisplayForRelation">
<div class="evaluate-relation">Mise en relation dj value</div>
<div id="note_misenrela" class="evaluate-relation-container">
<div data-name="mise_en" data-average="" class="scoring-div-relation
scoring-div jDisabled" data-id="" readonly></div>
<div class="scoring-div-comment scoring-div">
<label>Commentaire</label>&nbsp;:&nbsp;&nbsp;
<div><input maxlength="100" type="text" class="comment" value=""
readonly></div>
</div>
</div>
</div>
<!-- ------------------------------------------------- -->

- lignes 217 238:


<!-- 22-07-2017 Pour affichage d'un prestataire valu -->
<div style="display:none;" class="toDisplay">
<div class="evaluate-prestataire">Prestataire dj valu</div>
<div id="note_salarie" class="evaluate-prestataire-container">
<div class="ep-eval-title">Comptences</div>
<div class="ep-scoring-container">
<span class="evaluate-prestataire-
label">Technique</span>&nbsp;:&nbsp;&nbsp;
<div data-name="tech" style="float:right;" data-average=""
class="scoring-div-prestataire-tech scoring-div jDisabled" data-id="" data-
besoin="" ></div>
</div>
<div class="ep-scoring-container">
<span class="evaluate-prestataire-
label">Organisation</span>&nbsp;:&nbsp;&nbsp;
<div data-name="orga" style="float:right;" data-average=""
class="scoring-div-prestataire-orga scoring-div jDisabled" data-id="" data-
besoin="" ></div>
</div>
<div class="ep-scoring-container">
<span class="evaluate-prestataire-
label">Comportement</span>&nbsp;:&nbsp;&nbsp;
<div data-name="comp" style="float:right;" data-average=""
class="scoring-div-prestataire-comp scoring-div jDisabled" data-id="" data-
besoin="" ></div>
</div>
<div class="ep-scoring-container">
<span class="evaluate-prestataire-
label">Communication</span>&nbsp;:&nbsp;&nbsp;
<div data-name="comm" style="float:right;" data-average=""
class="scoring-div-prestataire-comm scoring-div jDisabled" data-id="" data-
besoin="" ></div>
</div>
</div>
</div>
<!-- --------------------------------------------------- -->

- lignes 281 355:


//19-07-2017 Modification du format des parametres envoyes et ajout du donne
besoin, gestion pour dj valu
$("body").on("click", ".submit-prestataire-scoring", function(e){
var besoin_id = null;
var besoin = null;
var params = {};
$(e.target).parents(".evaluate-prestataire-
container:first").find(".scoring-div").each(function(i, e){
//console.log($(e).data("note"));
if(besoin_id == null) besoin_id = $(e).data("id");
if(besoin == null) besoin = $(e).data("besoin");
var note = $(e).data("note");
if(note == undefined)
note = $(e).data("average"); //.toFixed(1);
else
note = note; //.toFixed(1);
//params += "&" + + "=" + note;
//params[$(e).data("name")] = note;
//params += "-" + note ;
if($(e).data("name")=="tech") params["tech"]=note;
if($(e).data("name")=="orga") params["orga"]=note;
if($(e).data("name")=="comp") params["comp"]=note;
if($(e).data("name")=="comm") params["comm"]=note;
});

$(e.target).parents(".evaluate-prestataire-
container:first").parent().addClass('toChange');

$('.toChange').find(".jRatingAverage").each(function(i, e){
if($(e).parent().data("name")=="tech") {
if($(e).css('width')=="0px") {
$('.toDisplay .scoring-div-prestataire-tech
.jRatingColor').css('width',$(e).parent().find(".jRatingColor").css('width'));
} else {
$('.toDisplay .scoring-div-prestataire-tech
.jRatingColor').css('width',$(e).css('width'));
}
}
if($(e).parent().data("name")=="orga") {
if($(e).css('width')=="0px") {
$('.toDisplay .scoring-div-prestataire-orga
.jRatingColor').css('width',$(e).parent().find(".jRatingColor").css('width'));
} else {
$('.toDisplay .scoring-div-prestataire-orga
.jRatingColor').css('width',$(e).css('width'));
}
}
if($(e).parent().data("name")=="comp") {
if($(e).css('width')=="0px") {
$('.toDisplay .scoring-div-prestataire-comp
.jRatingColor').css('width',$(e).parent().find(".jRatingColor").css('width'));
} else {
$('.toDisplay .scoring-div-prestataire-comp
.jRatingColor').css('width',$(e).css('width'));
}
}
if($(e).parent().data("name")=="comm") {
if($(e).css('width')=="0px") {
$('.toDisplay .scoring-div-prestataire-comm
.jRatingColor').css('width',$(e).parent().find(".jRatingColor").css('width'));
} else {
$('.toDisplay .scoring-div-prestataire-comm
.jRatingColor').css('width',$(e).css('width'));
}
}
});

$.ajax({
url: '/user/noter-prestataire-' + besoin + '-' + besoin_id + '-' +
params["tech"] + '-' + params["orga"] + '-' + params["comp"] + '-' +
params["comm"],
type: 'POST',
data: {
csrfmiddlewaretoken: '{{ csrf_token }}',
},
success: function(response) {
//console.log(response.chaine);
var tab = response.chaine.split('-');
$('.toDisplay').find(".scoring-div").each(function(i, e){
if($(e).data("name")=="tech") $(e).attr("data-
average", tab[0]);
if($(e).data("name")=="orga") $(e).attr("data-
average", tab[1]);
if($(e).data("name")=="comp") $(e).attr("data-
average", tab[2]);
if($(e).data("name")=="comm") $(e).attr("data-
average", tab[3]);
});
$('.toChange').html($('.toDisplay').html());
}
});
//$('#note_salarie').hide();
});
//--------------------------------------------

- lignes 360 403:


//19-07-2017 Modification du format des parametres envoyes dans le cas sans
commentaire et gestion pour dj value
// =================== mise en relation ====================
$("body").on("click", ".submit-relation-scoring", function(e){
var besoin_id = null;
var params = "";
var note = "";
var comment = ""
$(e.target).parents(".evaluate-relation-
container:first").find(".scoring-div-relation").each(function(i, e){
if (besoin_id == null) besoin_id = $(e).data("id");
var note = $(e).data("note");
if(note == undefined)
note = $(e).data("average"); //.toFixed(1);
else
note = note; //.toFixed(1);
params += "-" + note ;
});
//rcupration du commentaire, comment: contenu du commentaire
comment = $(e.target).parents(".evaluate-relation-
container:first").find(".comment").val();
if(comment!="")
params += "-" + comment ;
//console.log("besoin_id="+besoin_id + params);
$(e.target).parents(".evaluate-relation-
container:first").parent().addClass('toChangeForRelation');
$('.toChangeForRelation').find(".jRatingAverage").each(function(i, e){
if($(e).css('width')=="0px") {
$('.toDisplayForRelation .scoring-div-relation
.jRatingColor').css('width',$(e).parent().find(".jRatingColor").css('width'));
} else {
$('.toDisplayForRelation .scoring-div-relation
.jRatingColor').css('width',$(e).css('width'));
}
});
$.ajax({
url: 'noter-mis-en-relation-' + besoin_id + params,
type: 'POST',
data: {
csrfmiddlewaretoken: '{{ csrf_token }}',
},
success: function(response) {
//console.log("OK");
if(response.chaine.length>0) {
$('.toDisplayForRelation').find(".scoring-div-
relation").attr("data-average", response.chaine[0]);
$
('.toDisplayForRelation').find(".comment").attr("value", response.chaine[1]);
$('.toChangeForRelation').html($
('.toDisplayForRelation').html());
}
}
});
//$('.evaluate-relation-container').hide();
});
//--------------------------------------------------------------------

******...\elink\elink\templatetags\app_filters.py
- lignes 2 10:
#19-07-2017 Ajout de filtre template
from django import template
from django.template.defaultfilters import stringfilter

register = template.Library()

@register.filter(name='str_strip')
@stringfilter
def str_strip(value):
return value.replace(" ","").strip()
#-----------------------------------

******...\elink\elink\views.py
- lignes 29 35:
#19-07-2017 Precision sur le type salarie
elif request.user.type_de_personne_id==18:
#service_list = request.user.type_de_service
#titre_en_haut = "Proposer un service"
#titre_h3 = "Vous proposer le service suivant: "
titre_h3 = "Mes missions"
#url_nom = "proposer"
liste_mission =
Besoin.objects.filter(mission_presta_id=request.user.id).order_by('created')
#-----------------------------------------

- ligne 39:
#22-07-2017 Ajout liste evaluation relation dans la page principale en non
connecte
liste_mission =
Besoin.objects.filter(note_misenrela__gt=4).order_by('created')

******...\elink\needs\urls.py
- lignes 27 30:
#19-07-2017 Modification parametre commentaire et ajout url ayant des cas
optionnels
url(r'^noter-mis-en-relation-(?P<pk>\d+)-(?P<note>\d+.\d+)-(?P<comment>.*)$',
views.scoring, name="scoring"),
url(r'^noter-mis-en-relation-(?P<pk>\d+)-(?P<note>\d+)-(?P<comment>.*)$',
views.scoring, name="scoring"),
url(r'^noter-mis-en-relation-(?P<pk>\d+)-(?P<note>\d+)$', views.scoring,
name="scoring"),
url(r'^noter-mis-en-relation-(?P<pk>\d+)-(?P<note>\d+.\d+)$', views.scoring,
name="scoring"),
#-------------------------------------------------

******...\elink\needs\views.py
- lignes 94 110:
#19-07-2017 Modification de l'argument comment en optionnel et gestion pour
dj value
@login_required
def scoring(request, pk, note,comment=""):
"""
Evaluation de la mise en relation
"""
besoin = Besoin.objects.get(id=pk)
chaine=[]
if request.POST:
besoin.note_misenrela = note
besoin.note_commentaire = comment
besoin.statut_eval = True
if comment!="":
besoin.statut_com = True
besoin.save()
chaine.append(str(note))
chaine.append(str(comment))
return JsonResponse({'chaine':chaine})
#return HttpResponseRedirect(reverse('besoin_user_list'))
#-----------------------------------------------------------

*****...\elink\usermanagement\urls.py
- lignes 43 et 44:
#19-07-2017 Modification url pour les cas de parametres optionnels et ajout
du parametre besoin sur les profils prestataire, client
url(r'^noter-prestataire-(?P<besoin>\d+)-(?P<mission>\d+)-(?P<note_tech>\d+
(\.\d{1}|))-(?P<note_orga>\d+(\.\d{1}|))-(?P<note_comp>\d+(\.\d{1}|))-(?
P<note_comm>\d+(\.\d{1}|))$', usermanagement_views.scoring_prestataire,
name="scoring_prestataire"),
url(r'^noter-client-(?P<besoin>\d+)-(?P<mission>\d+)-(?P<note_tech>\d+
(\.\d{1}|))-(?P<note_orga>\d+(\.\d{1}|))-(?P<note_comp>\d+(\.\d{1}|))-(?
P<note_comm>\d+(\.\d{1}|))$', usermanagement_views.scoring_client,
name="scoring_client"),

#----------------------------------------------------------------------------------
----------------------------

******...\elink\needs\models.py
- lignes 30 et 31:
#22-07-2017 Modification du champ statut_presta en statut_eval_salarie et ajout
statut_eval_client
statut_eval_client = models.BooleanField(verbose_name="Test evaluation client",
default=False)
statut_eval_salarie = models.BooleanField(verbose_name="Test evaluation
prestataire", default=False)

#----------------------------------------------------------------------------------
---------------

- lignes 57 60:
#22-07-2017 Ajouter les champs notes Client
note_tech_c = models.FloatField(default=None, verbose_name="Note
technique", null = True)
note_orga_c = models.FloatField(default = None, verbose_name="Note
organisation", null = True)
note_compo_c = models.FloatField(default = None, verbose_name="Note
comportement", null = True)
note_commu_c = models.FloatField(default = None, verbose_name="Note
communication", null = True)
#---------------------------------------------------

- lignes 63 66:
#22-07-2017 Ajouter les champs notes Salari
note_tech_s = models.FloatField(default=None, verbose_name="Note
technique", null = True)
note_orga_s = models.FloatField(default = None, verbose_name="Note
organisation", null = True)
note_compo_s = models.FloatField(default = None, verbose_name="Note
comportement", null = True)
note_commu_s = models.FloatField(default = None, verbose_name="Note
communication", null = True)
#---------------------------------------------------

******...\elink\usermanagement\models.py
- lignes 43 46:
#22-07-2017 Enlever les champs notes de UserProfile
# note_tech = models.FloatField(default=None, verbose_name="Note
technique", null = True)
# note_orga = models.FloatField(default = None, verbose_name="Note
organisation", null = True)
# note_compo = models.FloatField(default = None, verbose_name="Note
comportement", null = True)
# note_commu = models.FloatField(default = None, verbose_name="Note
communication", null = True)
#---------------------------------------------------

******...\elink\usermanagement\views.py
- ligne 11:
#22-07-2017 Ajout format de rponse json
from django.http import JsonResponse

- lignes 159 186:


#22-07-2017 Modification de la mthode scoring_prestataire en ajoutant le
paramtre besoin et gestion pour dj valu
@login_required
def scoring_prestataire(request, besoin, mission, note_tech, note_orga,
note_comp, note_comm):
"""
Evaluation prestataire par le client
"""
#mission_presta = MissionBase.objects.get(id=mission)
#besoin = Besoin.objects.get(mission_presta_id=mission)
#print('mission ',mission)
# mission_cur = MissionBase.objects.get(id=mission)
# user_prestataire = UserProfile.objects.get(id=mission_cur.user_id)
# user_prestataire.note_tech=note_tech
# user_prestataire.note_orga = note_orga
# user_prestataire.note_compo = note_comp
# user_prestataire.note_commu = note_comm
# user_prestataire.save()
"""
mettre jour le fields statut_presta
"""
besoin = Besoin.objects.get(mission_presta = mission, id = besoin)
besoin.note_tech_s = note_tech
besoin.note_orga_s = note_orga
besoin.note_compo_s= note_comp
besoin.note_commu_s= note_comm
besoin.statut_eval_salarie = True
besoin.save()

chaine = note_tech+"-"+note_orga+"-"+note_comp+"-"+note_comm
return JsonResponse({'chaine':chaine})
#return render(request, 'needs/besoin_user_list.html')

#----------------------------------------------------------------------------------
------------

- lignes 191 206:


#22-07-2017 Modification de la mthode scoring_client en ajoutant le
paramtre besoin et gestion pour dj valu
@login_required
def scoring_client(request, besoin, mission, note_tech, note_orga, note_comp,
note_comm):
"""
Evaluation client par le salari
"""
#recuperation de la mission courante
besoin = Besoin.objects.get(user_id = mission, id = besoin)
besoin.note_tech_c = note_tech
besoin.note_orga_c = note_orga
besoin.note_compo_c= note_comp
besoin.note_commu_c= note_comm
besoin.statut_eval_client = True
besoin.save()

chaine = note_tech+"-"+note_orga+"-"+note_comp+"-"+note_comm
return JsonResponse({'chaine':chaine})
#return render(request, 'mission/proposition_user_list.html')

#----------------------------------------------------------------------------------
------------

Você também pode gostar