more comment and dataToSend for pw correction

This commit is contained in:
adri 2018-12-30 18:09:11 +01:00
parent 8a3d053816
commit 21ebc5efd3
1 changed files with 22 additions and 8 deletions

View File

@ -1,4 +1,7 @@
$(function() {
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
/*~~~~~~~~~~~~~~~~TR TO EDIT~~~~~~~~~~~~~~~~*/
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
$("#allRecord").on("click", ".editUser", function() {
$(this).toggleClass('fa-edit fa-check');
$(this).toggleClass('editUser confirmEditUser');
@ -13,17 +16,24 @@ $(function() {
j.html('<input '+inputOptions+' value="'+(j.attr('class')=="pw"?'':ltrim(j.html()))+'" />');
}
});
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
/*~~~~~~~~~~~~~~~~CONFIRM EDIT~~~~~~~~~~~~~~~~*/
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
$("#allRecord").on("click", ".confirmEditUser", function() {
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
/*~~~~~~~~~~~~~~~~CALL BACK DE LA VERIF DE MOT DE PASSE~~~~~~~~~~~~~~~~*/
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
function callBackVerif(data){
var dataToSend = new Object();
var dataToSend = new Object(); //Objet contenant les données à envoyé
dataToSend["updatePW"] = (data===true?false:true);
if($(".pw input", tr).val() === data || data === true)
if($(".pw input", tr).val() === data || data === true) //Verif du mot de passe si nécesaire
{
for(i=0; i<tds.length-1;i++)
for(i=0; i<tds.length-1;i++) //Analyse de chaque td
{
j= $(tds[i]);
className = j.attr('class');
if(className == "pw")
if(className == "pw" && data === true)
value = $('input', j).data("oldpw");
else
value = $('input', j).val();
@ -33,7 +43,7 @@ $(function() {
try {
if(data.return == true)
{
for(i=0; i<tds.length-1;i++)
for(i=0; i<tds.length-1;i++) //On change les input en pure html
{
j= $(tds[i]);
className = j.attr('class');
@ -60,11 +70,12 @@ $(function() {
swal( "Oops" , "Password don't match !" , "error" );
}
}
tds = $("td", $(this).parent().parent());
tr = $(this).parent().parent();
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
tds = $("td", $(this).parent().parent()); //Récupère les td concernant le click
tr = $(this).parent().parent(); //Récupère le tr concernant le click
that = this;
if ($(".pw input", tr).val() === "") {
swal("no pw update");
callBackVerif(true);
}
else {
@ -82,6 +93,9 @@ $(function() {
}
});
});
//J'avais plein d'espace a droite en récupérent mon innerHTML
//https://stackoverflow.com/questions/24282158/removing-the-white-space-at-the-start-of-the-string
function ltrim(str) {
if(str == null) return str;
return str.replace(/^\s+/g, '');