Commit 826989c4 authored by Tibor Katelbach's avatar Tibor Katelbach
Browse files

do it again

parent fcd0ddf5
......@@ -558,7 +558,9 @@ $(document).ready(function() {
delete tplCtx.pos;
delete tplCtx.budgetpath;
mylog.log("btnValidateWork save",tplCtx);
dataHelper.path2Value( tplCtx, closePrioModalRel );
dataHelper.path2Value( tplCtx, function(){
saveLinks(answerObj._id.$id,"financeValidated",userId,closePrioModalRel);
} );
}
},
cancel: {
......@@ -616,7 +618,8 @@ $(document).ready(function() {
mylog.log("btnFinancer save",tplCtx);
dataHelper.path2Value( tplCtx, function(params) {
prioModal.modal('hide');
location.reload();
saveLinks(answerObj._id.$id,"financerAdded",userId,function(){location.reload();});
} );
}
},
......
......@@ -162,7 +162,7 @@ jQuery(document).ready(function() {
if(typeof $(this).attr("id") != "undefined" && $(this).val() != "" )
answer.value.answers[ $(this).attr("id") ] = $(this).val();
});
console.log("#openFormSubmit", answer );
mylog.log("#openFormSubmit", answer );
answer.collection = "answers";
if($(this).data("id"))
answer.id = $(this).data("id");
......@@ -196,10 +196,11 @@ jQuery(document).ready(function() {
else
answer.value = $(this).val();
console.log("saveOneByOne",$(this).attr("id"), answer );
mylog.log("saveOneByOne",$(this).attr("id"), answer );
dataHelper.path2Value( answer , function(params) {
toastr.success('saved');
saveLinks(answerObj._id.$id,"updated",userId);
} );
} else {
toastr.error('answer cannot be empty, on saveOneByOne!');
......@@ -319,7 +320,7 @@ jQuery(document).ready(function() {
//et si formInputs.xxx.position est >= tplCtx.value alors
//formInputs.xxx.position = formInputs.xxx.position+1
console.dir(tplCtx );
mylog.dir(tplCtx );
dataHelper.path2Value( tplCtx , function(params) {
toastr.success('move saved!');
......@@ -368,7 +369,7 @@ jQuery(document).ready(function() {
var clearDoublePos = false;
//if input exists on same position delete position attribute
$.each( formInputs[tplCtx.form], function(k,inp) {
console.log("incPositions",k,inp.position)
mylog.log("incPositions",k,inp.position)
if( k != tplCtx.key && inp.position == tplCtx.value ){
clearDoublePos = true;
......@@ -426,7 +427,7 @@ jQuery(document).ready(function() {
} );
//alert("#"+tplCtx.key+" : "+$( "#"+tplCtx.key ).val());
console.log("save tplCtx",tplCtx);
mylog.log("save tplCtx",tplCtx);
if(typeof tplCtx.value == "undefined")
toastr.error('value cannot be empty!');
else {
......@@ -481,7 +482,7 @@ jQuery(document).ready(function() {
type : $("#type").val()
};
delete tplCtx.form;
console.log("activeForm save tplCtx",tplCtx);
mylog.log("activeForm save tplCtx",tplCtx);
if(typeof tplCtx.value == "undefined")
toastr.error('value cannot be empty!');
else {
......@@ -501,5 +502,31 @@ jQuery(document).ready(function() {
<?php } ?>
});
function saveLinks(id,linkType,uid,callB){
var today = new Date();
today = today.getDate() + '/' + (today.getMonth()+1) + '/' + today.getFullYear()+ ' ' + today.getHours()+ ':' + today.getMinutes();
//alert(uid+":"+today);
if( typeof answerObj.links == "undefined" ||
typeof answerObj.links[linkType] == "undefined" ||
typeof answerObj.links[linkType][uid] == "undefined" //||typeof answerObj.links[linkType][uid] != today
)
{
var link = {
collection : "answers",
id : answerObj._id.$id,
path : "links."+linkType+"."+uid,
value : 1 //today
};
mylog.log("saveLinks", link );
dataHelper.path2Value( link , function(params) {
mylog.log("saveLinks saved",params );
if(typeof callB == "function" )
callB();
} );
}
}
</script>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment