|
|
@@ -58,13 +58,7 @@ $(document).ready(function() {
|
|
|
|
|
|
function loadResources() {
|
|
|
$("#main").html("<center>Pobieranie danych o zasobach.</center>");
|
|
|
- //console.log("res!");
|
|
|
- var res = new Array();
|
|
|
-
|
|
|
var sFiltr = "";
|
|
|
- var link = BASE_URL + 'wfs-data.php/default_db/?SERVICE=WFS&VERSION=1.0.0&REQUEST=GetFeature&TYPENAME=p5_default_db:CRM_WSKAZNIK&SRSNAME=EPSG:3003&sortBy=SORT_PRIO+A,ID';
|
|
|
- //console.log("link "+link);
|
|
|
-
|
|
|
sFiltr += `
|
|
|
<GetFeature xmlns="http://www.opengis.net/wfs/2.0"
|
|
|
xmlns:p5_default_db="` + BASE_URL + `wfs/default_db"
|
|
|
@@ -72,19 +66,27 @@ $(document).ready(function() {
|
|
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
|
service="WFS"
|
|
|
version="2.0.2"
|
|
|
- xsi:schemaLocation="http://www.opengis.net/wfs/2.0 http://schemas.opengis.net/wfs/2.0/wfs.xsd">
|
|
|
- <ogc:Filter>
|
|
|
- <ogc:And>
|
|
|
- <ogc:Or>`;
|
|
|
-
|
|
|
- $.each(state, function(i, e) {
|
|
|
- var id = e["id"];
|
|
|
- sFiltr += '<ogc:PropertyIsEqualTo><ogc:PropertyName>ID_PROCES</ogc:PropertyName><ogc:Literal>' + id + '</ogc:Literal></ogc:PropertyIsEqualTo>';
|
|
|
-
|
|
|
+ xsi:schemaLocation="http://www.opengis.net/wfs/2.0 http://schemas.opengis.net/wfs/2.0/wfs.xsd">`;
|
|
|
+ sFiltr += ' <ogc:Filter>';
|
|
|
+ sFiltr += ' <ogc:And>';
|
|
|
+ sFiltr += ' <ogc:Or>';
|
|
|
+ $.each(state, function(idx, procesItem) {
|
|
|
+ sFiltr += ' <ogc:PropertyIsEqualTo><ogc:PropertyName>ID_PROCES</ogc:PropertyName><ogc:Literal>' + procesItem["id"] + '</ogc:Literal></ogc:PropertyIsEqualTo>';
|
|
|
});
|
|
|
-
|
|
|
- sFiltr += '</ogc:Or><ogc:Not><ogc:PropertyIsEqualTo><ogc:PropertyName>A_STATUS</ogc:PropertyName><ogc:Literal>DELETED</ogc:Literal></ogc:PropertyIsEqualTo></ogc:Not></ogc:And></ogc:Filter></GetFeature>';
|
|
|
- //console.log("x "+sFiltr);
|
|
|
+ sFiltr += ' </ogc:Or>';
|
|
|
+ sFiltr += ' <ogc:Not>';
|
|
|
+ sFiltr += ' <ogc:PropertyIsEqualTo><ogc:PropertyName>A_STATUS</ogc:PropertyName><ogc:Literal>DELETED</ogc:Literal></ogc:PropertyIsEqualTo>';
|
|
|
+ sFiltr += ' </ogc:Not>';
|
|
|
+ sFiltr += ' </ogc:And>';
|
|
|
+ sFiltr += ' </ogc:Filter>';
|
|
|
+ sFiltr += '</GetFeature>';
|
|
|
+
|
|
|
+ var link = BASE_URL + 'wfs-data.php/default_db/?SERVICE=WFS&VERSION=1.0.0&SRSNAME=EPSG:3003';
|
|
|
+ link += '&REQUEST=GetFeature';
|
|
|
+ link += '&TYPENAME=p5_default_db:CRM_WSKAZNIK';
|
|
|
+ link += '&sortBy=SORT_PRIO+A,ID';
|
|
|
+
|
|
|
+ var wskazniki = new Array();
|
|
|
$.ajax({
|
|
|
url: link,
|
|
|
data: sFiltr,
|
|
|
@@ -94,69 +96,73 @@ $(document).ready(function() {
|
|
|
success: function(data) {
|
|
|
//console.log(data);
|
|
|
$.each($(data).find("featureMember"), function() {
|
|
|
- if ($(this).find("ID").text() == 0)
|
|
|
- return;
|
|
|
- var result = new Array();
|
|
|
- result["ID"] = $(this).find("ID").text();
|
|
|
- result["ID_ZASOB"] = $(this).find("ID_ZASOB").text();
|
|
|
- result["ID_PROCES"] = $(this).find("ID_PROCES").text();
|
|
|
- result["SORT_PRIO"] = $(this).find("SORT_PRIO").text();
|
|
|
- result["ID_PRZYPADEK"] = $(this).find("ID_PRZYPADEK").text();
|
|
|
- result["OPIS_ZASOB"] = $(this).find("OPIS_ZASOB").text();
|
|
|
-
|
|
|
- res.push(result);
|
|
|
-
|
|
|
+ if ($(this).find("ID").text() == 0) return;
|
|
|
+ var wsk = new Array();
|
|
|
+ wsk["ID"] = $(this).find("ID").text();
|
|
|
+ wsk["ID_ZASOB"] = $(this).find("ID_ZASOB").text();
|
|
|
+ wsk["ID_PROCES"] = $(this).find("ID_PROCES").text();
|
|
|
+ wsk["SORT_PRIO"] = $(this).find("SORT_PRIO").text();
|
|
|
+ wsk["ID_PRZYPADEK"] = $(this).find("ID_PRZYPADEK").text();
|
|
|
+ wsk["OPIS_ZASOB"] = $(this).find("OPIS_ZASOB").text();
|
|
|
+ wskazniki.push(wsk);
|
|
|
});
|
|
|
//console.log(res);
|
|
|
- var sFiltr2 = [];
|
|
|
- $.each(res, function(index, value) {
|
|
|
- var id = res[index]["ID_ZASOB"];
|
|
|
- sFiltr2.push(id);
|
|
|
+ var idsZasobyToFetch = [];
|
|
|
+ $.each(wskazniki, function(index, wsk) {
|
|
|
+ idsZasobyToFetch.push(wsk["ID_ZASOB"]);
|
|
|
});
|
|
|
- if (sFiltr2.length > 0) {
|
|
|
- //sFiltr2 = JSON.stringify(sFiltr2);
|
|
|
- //console.log(sFiltr2);
|
|
|
- //console.log(link2);
|
|
|
+ if (idsZasobyToFetch.length > 0) {
|
|
|
+ //idsZasobyToFetch = JSON.stringify(idsZasobyToFetch);
|
|
|
+ //console.log(idsZasobyToFetch);
|
|
|
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);
|
|
|
- }
|
|
|
+ $.ajax({
|
|
|
+ type: 'POST',
|
|
|
+ url: BASE_URL+"index.php?_route=UrlAction_ProcesEditor&_task=getSingleResAjax",
|
|
|
+ data: {data: idsZasobyToFetch},
|
|
|
+ dataType: 'json'
|
|
|
+ })
|
|
|
+ .done(function(jsonZasobyTree) {
|
|
|
+ $.each(jsonZasobyTree, function(idx, zasob) {
|
|
|
+ zasobInfo[zasob["ID"]] = new Array();
|
|
|
+ zasobInfo[zasob["ID"]]["DESC"] = zasob["DESC"];
|
|
|
+ zasobInfo[zasob["ID"]]["OPIS"] = zasob["OPIS"];
|
|
|
+ zasobInfo[zasob["ID"]]["TYPE"] = zasob["TYPE"];
|
|
|
+ zasobInfo[zasob["ID"]]["TREE"] = [];
|
|
|
+ for (var i = 3; i > 0; i--) {
|
|
|
+ if (zasob["p"+i+"_ID"] != null) {
|
|
|
+ var temp = {};
|
|
|
+ temp["ID"] = zasob["p"+i+"_ID"];
|
|
|
+ temp["DESC"] = zasob["p"+i+"_DESC"];
|
|
|
+ zasobInfo[zasob["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";
|
|
|
- }
|
|
|
- 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);
|
|
|
+ $.each(wskazniki, function(index, wsk) {
|
|
|
+ var type,
|
|
|
+ idZasob = wsk["ID_ZASOB"];
|
|
|
+ if (!zasobInfo[idZasob]) {
|
|
|
+ $("#main").html("<center>Generowanie widoku.</center>");
|
|
|
+ render(state, $("#main"));
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (zasobInfo[idZasob]["TYPE"] == "DZIAL" || zasobInfo[idZasob]["TYPE"] == "STANOWISKO" || zasobInfo[idZasob]["TYPE"] == "PODMIOT") {
|
|
|
+ type = "prof";
|
|
|
+ } else {
|
|
|
+ type = "res";
|
|
|
+ }
|
|
|
+ var id = wsk["ID_PROCES"];
|
|
|
+
|
|
|
+ var temp = {};
|
|
|
+ temp["id_zasob"] = idZasob
|
|
|
+ temp["id"] = wsk["ID"];
|
|
|
+ temp["id_przypadek"] = wsk["ID_PRZYPADEK"];
|
|
|
+ temp["komentarz"] = wsk["OPIS_ZASOB"];
|
|
|
+ temp["desc"] = zasobInfo[idZasob]["DESC"];
|
|
|
+ temp["opis"] = zasobInfo[idZasob]["OPIS"];
|
|
|
+ temp["tree"] = zasobInfo[idZasob]["TREE"];
|
|
|
+ //console.log(temp);
|
|
|
+ state[getIndexById(id)][type].push(temp);
|
|
|
});
|
|
|
|
|
|
$("#main").html("<center>Generowanie widoku.</center>");
|
|
|
@@ -608,6 +614,31 @@ $(document).ready(function() {
|
|
|
}
|
|
|
|
|
|
|
|
|
+ });
|
|
|
+
|
|
|
+ $(document).on('click', '#btnPhotos', function(e) {
|
|
|
+ e.preventDefault();
|
|
|
+ $(".lButton").removeClass("btn-primary");
|
|
|
+ if (dialog == 0) {
|
|
|
+ photos();
|
|
|
+ $(this).addClass("btn-primary");
|
|
|
+ $("#wrapper").removeClass("toggled");
|
|
|
+ dialog = 3;
|
|
|
+ } else if (dialog == 3) {
|
|
|
+ $("#wrapper").addClass("toggled");
|
|
|
+ dialog = 0;
|
|
|
+ } else {
|
|
|
+ $("#wrapper").addClass("toggled");
|
|
|
+ $(this).addClass("btn-primary");
|
|
|
+ setTimeout(function() {
|
|
|
+ photos();
|
|
|
+ $("#wrapper").removeClass("toggled");
|
|
|
+
|
|
|
+ }, 500);
|
|
|
+ dialog = 3;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
});
|
|
|
|
|
|
$(document).on('click', '#btnProcesy', function(e) {
|
|
|
@@ -1147,7 +1178,73 @@ $(document).ready(function() {
|
|
|
});
|
|
|
|
|
|
|
|
|
+ $(document).on('change', '#inp', function() {
|
|
|
+ if (this.files && this.files[0]) {
|
|
|
+ var link = BASE_URL + "wfs-data.php/default_db/?SERVICE=WFS&VERSION=1.0.0&SRSNAME=EPSG:3003";
|
|
|
+
|
|
|
+ var name = this.files[0].name;
|
|
|
+ var FR = new FileReader();
|
|
|
+ FR.onload = function(e) {
|
|
|
+ var contentBase64 = e.target.result;
|
|
|
+ var xml = `<Transaction
|
|
|
+ xmlns="http://www.opengis.net/wfs"
|
|
|
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
|
+ version="1.0.0"
|
|
|
+ service="WFS"
|
|
|
+ xmlns:p5_objects="https://biuro.biall-net.pl/wfs/objects"
|
|
|
+ xmlns:gml="http://www.opengis.net/gml">
|
|
|
+ <Insert xmlns="http://www.opengis.net/wfs">
|
|
|
+ <File xmlns="https://biuro.biall-net.pl/wfs/objects">
|
|
|
+ <name xmlns="https://biuro.biall-net.pl/wfs/objects">`+name+`</name>
|
|
|
+ <content xmlns="https://biuro.biall-net.pl/wfs/objects">`+contentBase64+`</content>
|
|
|
+ </File>
|
|
|
+ </Insert>
|
|
|
+ </Transaction>`;
|
|
|
+
|
|
|
+
|
|
|
+ $.ajax({
|
|
|
+ url: link,
|
|
|
+ data: xml,
|
|
|
+ type: 'POST',
|
|
|
+ contentType: "text/xml",
|
|
|
+ dataType: "xml",
|
|
|
+ success: function(data) {
|
|
|
+ console.log(data);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ };
|
|
|
+ FR.readAsDataURL( this.files[0] );
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ function photos() {
|
|
|
+ var side = $("#side");
|
|
|
+ $(side).empty();
|
|
|
|
|
|
+ var form = `
|
|
|
+ <h4>Wrzuć pliki do swojego schowka</h4>
|
|
|
+ <input id="inp" type='file'>
|
|
|
+
|
|
|
+ <div class="progress">
|
|
|
+ <div class="progress-bar" role="progressbar" aria-valuenow="60" aria-valuemin="0" aria-valuemax="100" style="width: 60%;">
|
|
|
+ <span class="sr-only">60% Complete</span>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <h4>Pliki w schowku</h4>`;
|
|
|
+ console.log("test");
|
|
|
+ $(side).append(form);
|
|
|
+ var schowek = '<ul>';
|
|
|
+ schowek += '<li>';
|
|
|
+ schowek += 'Test';
|
|
|
+ schowek += '</li>';
|
|
|
+
|
|
|
+ schowek += '</ul>';
|
|
|
+ console.log(schowek);
|
|
|
+ console.log("test");
|
|
|
+
|
|
|
+ $(side).append(schowek);
|
|
|
+ }
|
|
|
|
|
|
function zasoby() {
|
|
|
var side = $("#side");
|