|
|
@@ -111,65 +111,65 @@ $(document).ready(function() {
|
|
|
});
|
|
|
//console.log(res);
|
|
|
var sFiltr2 = [];
|
|
|
-
|
|
|
- var link2 = BASE_URL+"index.php?_route=UrlAction_ProcesEditor&_task=getSingleResAjax";
|
|
|
$.each(res, function(index, value) {
|
|
|
var id = res[index]["ID_ZASOB"];
|
|
|
sFiltr2.push(id);
|
|
|
});
|
|
|
- //sFiltr2 = JSON.stringify(sFiltr2);
|
|
|
- //console.log(sFiltr2);
|
|
|
- //console.log(link2);
|
|
|
- var zasobInfo = new Array();
|
|
|
- $.post(link2, {data: sFiltr2}, function(data2){
|
|
|
- //console.log("data");
|
|
|
- // console.log(data2);
|
|
|
-
|
|
|
- $.each(data2, function(i, e) {
|
|
|
-
|
|
|
- zasobInfo[e["ID"]] = new Array();
|
|
|
- zasobInfo[e["ID"]]["DESC"] = e["DESC"];
|
|
|
- zasobInfo[e["ID"]]["OPIS"] = e["OPIS"];
|
|
|
- zasobInfo[e["ID"]]["TYPE"] = e["TYPE"];
|
|
|
- zasobInfo[e["ID"]]["TREE"] = [];
|
|
|
- for(var i=3;i>0;i--){
|
|
|
- if(e["p"+i+"_ID"] != null){
|
|
|
- var temp = {};
|
|
|
- temp["ID"] = e["p"+i+"_ID"];
|
|
|
- temp["DESC"] = e["p"+i+"_DESC"];
|
|
|
- zasobInfo[e["ID"]]["TREE"].push(temp);
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
- //console.log(res);
|
|
|
- $.each(res, function(index, value) {
|
|
|
- var type;
|
|
|
- if (zasobInfo[res[index]["ID_ZASOB"]]["TYPE"] == "DZIAL" || zasobInfo[res[index]["ID_ZASOB"]]["TYPE"] == "STANOWISKO" || zasobInfo[res[index]["ID_ZASOB"]]["TYPE"] == "PODMIOT") {
|
|
|
- type = "prof";
|
|
|
- } else {
|
|
|
- type = "res";
|
|
|
+ if (sFiltr2.length > 0) {
|
|
|
+ //sFiltr2 = JSON.stringify(sFiltr2);
|
|
|
+ //console.log(sFiltr2);
|
|
|
+ //console.log(link2);
|
|
|
+ var zasobInfo = new Array();
|
|
|
+ var link2 = BASE_URL+"index.php?_route=UrlAction_ProcesEditor&_task=getSingleResAjax";
|
|
|
+ $.post(link2, {data: sFiltr2}, function(data2){
|
|
|
+ //console.log("data");
|
|
|
+ // console.log(data2);
|
|
|
+ $.each(data2, function(i, e) {
|
|
|
+ zasobInfo[e["ID"]] = new Array();
|
|
|
+ zasobInfo[e["ID"]]["DESC"] = e["DESC"];
|
|
|
+ zasobInfo[e["ID"]]["OPIS"] = e["OPIS"];
|
|
|
+ zasobInfo[e["ID"]]["TYPE"] = e["TYPE"];
|
|
|
+ zasobInfo[e["ID"]]["TREE"] = [];
|
|
|
+ for(var i=3;i>0;i--){
|
|
|
+ if(e["p"+i+"_ID"] != null){
|
|
|
+ var temp = {};
|
|
|
+ temp["ID"] = e["p"+i+"_ID"];
|
|
|
+ temp["DESC"] = e["p"+i+"_DESC"];
|
|
|
+ zasobInfo[e["ID"]]["TREE"].push(temp);
|
|
|
+ }
|
|
|
}
|
|
|
- var id = res[index]["ID_PROCES"];
|
|
|
-
|
|
|
- var temp = {};
|
|
|
- temp["id_zasob"] = res[index]["ID_ZASOB"]
|
|
|
- temp["id"] = res[index]["ID"];
|
|
|
- temp["id_przypadek"] = res[index]["ID_PRZYPADEK"];
|
|
|
- temp["komentarz"] = res[index]["OPIS_ZASOB"];
|
|
|
- temp["desc"] = zasobInfo[res[index]["ID_ZASOB"]]["DESC"];
|
|
|
- temp["opis"] = zasobInfo[res[index]["ID_ZASOB"]]["OPIS"];
|
|
|
- temp["tree"] = zasobInfo[res[index]["ID_ZASOB"]]["TREE"];
|
|
|
- //console.log(temp);
|
|
|
- state[getIndexById(id)][type].push(temp);
|
|
|
-
|
|
|
+ });
|
|
|
+ //console.log(res);
|
|
|
+ })
|
|
|
+ .fail(function(xhr) {
|
|
|
+ if (xhr.responseJSON && xhr.responseJSON.msg && xhr.responseJSON.type) jQuery.notify(xhr.responseJSON.msg, xhr.responseJSON.type);
|
|
|
+ else jQuery.notify("Wystąpił nieznany błąd", 'error');
|
|
|
});
|
|
|
- $("#main").html("<center>Generowanie widoku.</center>");
|
|
|
- render(state, $("#main"));
|
|
|
- })
|
|
|
- .fail(function(res) {
|
|
|
- if (res.responseJSON && res.responseJSON.msg && res.responseJSON.type) jQuery.notify(res.responseJSON.msg, res.responseJSON.type);
|
|
|
- else jQuery.notify("Wystąpił nieznany błąd", 'error');
|
|
|
+ }
|
|
|
+
|
|
|
+ $.each(res, function(index, value) {
|
|
|
+ var type;
|
|
|
+ if (zasobInfo[res[index]["ID_ZASOB"]]["TYPE"] == "DZIAL" || zasobInfo[res[index]["ID_ZASOB"]]["TYPE"] == "STANOWISKO" || zasobInfo[res[index]["ID_ZASOB"]]["TYPE"] == "PODMIOT") {
|
|
|
+ type = "prof";
|
|
|
+ } else {
|
|
|
+ type = "res";
|
|
|
+ }
|
|
|
+ var id = res[index]["ID_PROCES"];
|
|
|
+
|
|
|
+ var temp = {};
|
|
|
+ temp["id_zasob"] = res[index]["ID_ZASOB"]
|
|
|
+ temp["id"] = res[index]["ID"];
|
|
|
+ temp["id_przypadek"] = res[index]["ID_PRZYPADEK"];
|
|
|
+ temp["komentarz"] = res[index]["OPIS_ZASOB"];
|
|
|
+ temp["desc"] = zasobInfo[res[index]["ID_ZASOB"]]["DESC"];
|
|
|
+ temp["opis"] = zasobInfo[res[index]["ID_ZASOB"]]["OPIS"];
|
|
|
+ temp["tree"] = zasobInfo[res[index]["ID_ZASOB"]]["TREE"];
|
|
|
+ //console.log(temp);
|
|
|
+ state[getIndexById(id)][type].push(temp);
|
|
|
+
|
|
|
});
|
|
|
+ $("#main").html("<center>Generowanie widoku.</center>");
|
|
|
+ render(state, $("#main"));
|
|
|
}
|
|
|
});
|
|
|
}
|