2013-06-10 13:02:15 +00:00
|
|
|
function validate() {
|
|
|
|
var allvals = true;
|
|
|
|
$("[required]").each(function() {
|
|
|
|
if(!$(this).val()) {
|
|
|
|
allvals = false;
|
|
|
|
$(this).addClass('brsr');
|
|
|
|
}
|
|
|
|
else { $(this).removeClass('brsr'); }
|
|
|
|
});
|
|
|
|
if ($('[name=encours]').val()<0 || $('[name=encours]').val()>500 || !$('[name=encours]').val()){
|
|
|
|
allvals = false;
|
|
|
|
$('[name=encours]').addClass('brsr');
|
|
|
|
}
|
|
|
|
else { $('[name=encours]').removeClass('brsr'); }
|
|
|
|
return allvals;
|
|
|
|
}
|
|
|
|
|
2013-07-30 08:31:24 +00:00
|
|
|
function loading() {
|
|
|
|
if ($('.loading').css('display')=='none') {
|
|
|
|
$('.loading').css('display', 'block');
|
|
|
|
$('.ui-dialog-content').css('overflow','hidden');
|
|
|
|
$(".ui-dialog-buttonpane button").button("disable");
|
|
|
|
}
|
|
|
|
else { $('.loading').css('display', 'none');}
|
|
|
|
}
|
|
|
|
|
2013-06-10 13:02:15 +00:00
|
|
|
$(document).ready(function(){
|
|
|
|
validate();
|
|
|
|
});
|
|
|
|
|
|
|
|
$('[required]').blur(function(){
|
|
|
|
validate();
|
|
|
|
});
|
|
|
|
|
|
|
|
$('#dialog').dialog({ buttons: [
|
|
|
|
{ text: "Valider", click: function() {
|
|
|
|
var values = $(this).find('form').serialize();
|
|
|
|
if (validate()) {
|
2013-07-30 08:31:24 +00:00
|
|
|
loading();
|
2013-06-10 13:02:15 +00:00
|
|
|
$.post('/saisie/scorecutoff', values, function(data) {
|
|
|
|
$('#dialog').html(data);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}},
|
2013-08-12 12:08:03 +00:00
|
|
|
{ text: "Supprimer", click: function() {
|
|
|
|
if (validate()) {
|
|
|
|
$('<div></div>').html('<div style="line-height:25px;">Supprimer Cut-off ?</div><div style="font-size:10px; color:#999;">Toutes les valeurs seront effacées.</div>')
|
|
|
|
.dialog({
|
|
|
|
modal: true,
|
|
|
|
title: 'Confirmation de suppression',
|
|
|
|
zIndex: 10000,
|
|
|
|
autoOpen: true,
|
|
|
|
width: '250',
|
|
|
|
resizable: false,
|
|
|
|
buttons: {
|
|
|
|
Oui: function () {
|
|
|
|
$('#dialog [name=delete]').val('1');
|
|
|
|
var values = $('#dialog').find('form').serialize();
|
|
|
|
$(this).dialog("close");
|
|
|
|
loading();
|
|
|
|
$.post('/saisie/scorecutoff', values, function(data) {
|
|
|
|
$('#dialog').html(data);
|
|
|
|
});
|
|
|
|
},
|
|
|
|
Non: function () {
|
|
|
|
$(this).dialog("close");
|
|
|
|
}
|
|
|
|
},
|
|
|
|
close: function (event, ui) {
|
|
|
|
$(this).remove();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
2013-07-30 08:31:24 +00:00
|
|
|
}},
|
2013-06-10 13:02:15 +00:00
|
|
|
{ text: "Fermer", click: function() {
|
2013-07-30 08:31:24 +00:00
|
|
|
if($(".message p").attr('id')==1) {
|
|
|
|
loading();
|
|
|
|
location.reload();
|
|
|
|
}
|
|
|
|
else {$(this).dialog('close');}
|
2013-06-10 13:02:15 +00:00
|
|
|
}
|
|
|
|
}
|
2013-07-30 08:31:24 +00:00
|
|
|
] });
|
|
|
|
|
|
|
|
if($('#dateInsert').text()!='') {
|
2013-08-12 12:08:03 +00:00
|
|
|
$(".ui-dialog-buttonpane button:contains('Supprimer')").show();
|
2013-07-30 08:31:24 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
$(".ui-dialog-buttonpane button:contains('Supprimer')").hide();
|
2013-08-12 12:08:03 +00:00
|
|
|
}
|