function charger_valeurs_point(implantation_id) {
var params = {'implantation_id' : implantation_id};
var chargement_vp = $.getJSON('/dae/liste_valeurs_point', params);
- var selected_min = $('#id_valeur_point_min').val()
- var selected_max = $('#id_valeur_point_max').val()
+ var selected_min = null;
+ var selected_max = null;
chargement_vp.success(function(data) {
var items = [];
options += '<option' + suggestion + ' value="' + this.id + '">' + this.label + '</option>';
});
- $('#id_valeur_point_min').html(options).val(selected_min);
- $('#id_valeur_point_max').html(options).val(selected_max);
+ $('#id_valeur_point_min').html(options).val(selected_min).trigger('change');
+ $('#id_valeur_point_max').html(options).val(selected_max).trigger('change');
});
}
if (valeur_point_text == "")
valeur_point = 0;
else
- valeur_point = clean_float(valeur_point_text.split(" ")[0]);
-
+ valeur_point = clean_float(valeur_point_text.split(" ")[2]);
if (salaire_manuel == false) {
salaire = clean_float(valeur_point * coeff);
salaire_input.val(salaire);
});
}
+function poste_redirection() {
+ var id_poste = $("#id_poste").val();
+ if (id_poste)
+ window.location = '/dae/poste/' + id_poste +
+ '?type_intervention=' + $("input[name='type_intervention']:checked").val();
+}
+
$(document).ready(function() {
/* Lorsqu'on choisit un poste dans la liste on recharge la page avec le
poste chargé dans la view (grâce à son id dans l'URL).*/
$('#id_poste').change(function() {
- var id_poste = $(this).val();
- if (id_poste)
- window.location = '/dae/poste/' + id_poste;
+ poste_redirection();
});
/* La fonctionnalité de présélection, est activé uniquement si aucune implantation n'a déjà été
sélectionnée.
Lorsque l'implantation est changée, on ajuste les valeurs de points en fonction de cette sélection */
var implantation_id = $("#id_implantation").val();
- if (implantation_id) {
+ var null_vp_min = $("#valeur_point_min").val() == '';
+ var null_vp_max = $("#valeur_point_max").val() == '';
+
+ if (implantation_id && null_vp_min && null_vp_max) {
charger_postes(implantation_id);
charger_valeurs_point(implantation_id);
}
charger_valeurs_point(implantation_id);
});
+ $('#poste_id_shortcut').change(function() {
+ var poste_id_rh = $('#poste_id_shortcut').val();
+ var key = 'rh-'+poste_id_rh;
+ $('#id_poste').val(key);
+ if ($('#id_poste').val() == key) {
+ poste_redirection();
+ }
+
+ });
+
$('#id_valeur_point_min, #id_valeur_point_max').change(function(e) {
// pas de traitement si aucune valeur de point n'est choisie
var chargement_poste = $.getJSON("/dae/poste_resume/" + poste_id);
chargement_poste.success(function(data) {
$('#' + prefix_poste_connexe + 'implantation').val(data['implantation']);
+ $('#' + prefix_poste_connexe + 'cmp_poste').val(data['d_id']);
$('#' + prefix_poste_connexe + 'nom').val(data['poste']);
$('#' + prefix_poste_connexe + 'montant').val(data['montant']);
$('#' + prefix_poste_connexe + 'devise').val(data['devise']);
$('#' + prefix_poste_connexe + 'montant_euros').val(data['montant_euros']);
+ $('#' + prefix_poste_connexe + 'statut').val(data['statut']);
+ $('#' + prefix_poste_connexe + 'classement').val(data['classement']);
});
+
chargement_poste.error(function(data) {
alert(data.responseText);
});
$(this).find('div').remove();
input.val('');
+ var lnk = $(this).parent().find('.clear-cmp a');
+ lnk.show();
+ lnk.unbind('click');
+ lnk.click(function(e){
+ e.preventDefault();
+ $('#' + prefix_poste_connexe + 'implantation').val('');
+ $('#' + prefix_poste_connexe + 'cmp_poste').val('');
+ $('#' + prefix_poste_connexe + 'nom').val('');
+ $('#' + prefix_poste_connexe + 'montant').val('');
+ $('#' + prefix_poste_connexe + 'devise').val('');
+ $('#' + prefix_poste_connexe + 'montant_euros').val('');
+ $('#' + prefix_poste_connexe + 'statut').val('');
+ $('#' + prefix_poste_connexe + 'classement').val('');
+ lnk.hide();
+ });
+ });
+ $(".comparaison-interne .results_on_deck").each(function(i, e){
+ /* on ne veut pas afficher la personne en-dessous */
+ var input_id = $(this).attr('id').replace('_on_deck', '');
+ var input = $('#'+input_id);
+ var prefix_poste_connexe = $(this).attr('id').replace('recherche_on_deck', '');
+ var poste_id = input.val();
+ var lnk = $(this).parent().find('.clear-cmp a');
+ if (poste_id != null && poste_id == '') {
+ lnk.show()
+ }
+ lnk.click(function(e){
+ e.preventDefault();
+ $('#' + prefix_poste_connexe + 'implantation').val('');
+ $('#' + prefix_poste_connexe + 'cmp_poste').val('');
+ $('#' + prefix_poste_connexe + 'nom').val('');
+ $('#' + prefix_poste_connexe + 'montant').val('');
+ $('#' + prefix_poste_connexe + 'devise').val('');
+ $('#' + prefix_poste_connexe + 'montant_euros').val('');
+ $('#' + prefix_poste_connexe + 'statut').val('');
+ $('#' + prefix_poste_connexe + 'classement').val('');
+ lnk.hide();
+ });
});
-
-
});