";
while(next !== false){
depth++;
//console.log(next);
result += "
";
var details = false;
//console.log("next: ", next);
//console.log("prev: ", previous);
if(previous !== false)
//console.log("x", state[previous]["details"]);
if(previous !== false && state[previous]["details"] == true){
//console.log("ok");
result += getDetails(state[next]);
details = true;
next = false;
}
if(!details ){
if(state[next]["childs"].length > 0){
$.each(state[next]["childs"], function(i, e){
if(state[next]["active"] == e["ID"])
result += getView(state[e["ID"]], true);
else
result += getView(state[e["ID"]], false);
});
previous = next;
next = state[next]["active"];
} else {
result += getDetails(state[next]);
next = false;
}
}
result += "
";
}
result += "
";
$("#ulproc").scrollTop(0);
$("#view").html(result);
$("#procCon").css("width", depth * 460);
$("#ulproc").scrollLeft(depth * 460);
$(".singleAdv").css("height", $( window ).height()-100 + "px");
//console.log(result);
}
function render(){
if(panels){
console.log("panels");
renderPanels();
}else{
console.log("drzewo");
renderTree();
}
}
function updateParent(id, parent, item){
var link = BASE_URL + 'wfs-data.php/default_db/?SERVICE=WFS&VERSION=1.0.0&SRSNAME=EPSG:3003&';
var req = `
`+id+``+parent+``;
console.log(req);
$.ajax({
url: link,
data: req,
type: 'POST',
contentType: "text/xml",
dataType: "text",
success: function(data) {
return true;
},
error: function(xhr, ajaxOptions, thrownError) {
$(item).sortable('cancel');
$.notify("Brak połączenia z bazą danych", "error");
}
});
}
function getDetails(e){
console.log("test", e);
var result = "";
result += '
';
result += '
[' + e["ID"] + '] ' + e["DESC"] + '
';
result += '
';
result += 'Opis: ' + e["OPIS"];
result += '
';
result += '
';
return result;
}
function getView(data, active){
var result = "";
var childs = true;
var type = 0;
var style = "";
switch(data["TYPE"]){
case "PROCES_INIT": style = 'style="background-color:#ffe5e5;color:#333"';break;
case "PROCES": style = 'style="background-color:#ededed;color:#333"';break;
case "PROCES_GROUP_1": style = 'style="background-color:#9999cc;color:#fff"';break;
case "PROCES_GROUP_2": style = 'style="background-color:#d8d8b2;color:#fff"';break;
default: style = 'style="background-color:#ededed;color:#333"';break;
}
result += "
";
result += '
'
result += "" + data["ID"] + " "
result += data["DESC"] + "