|
@@ -36,7 +36,7 @@ function urlFetchKontrahenciPowiazania() {
|
|
|
$( "#body-reaport-kontrahenci-powiazani-tree" ).html(reaportItemsKontrahenciPowiazani);
|
|
|
|
|
|
}).catch(function(error) {
|
|
|
- console.log('request failed', error)
|
|
|
+ if(DBG) console.log('request failed', error)
|
|
|
});
|
|
|
}
|
|
|
|
|
@@ -75,10 +75,11 @@ function updateLocalStorageBiAuditDepth(idInput) {
|
|
|
|
|
|
$('.bottom--message-warning-critical-search').text(messageCriticalSearchData);
|
|
|
|
|
|
- console.log('popup i dodanie komunikatu niżej');
|
|
|
+ if(DBG) console.log('popup i dodanie komunikatu niżej');
|
|
|
+
|
|
|
} else {
|
|
|
$('.bottom--message-warning-critical-search').text('');
|
|
|
- console.log('popup i dodanie wyczysc komunikatu ');
|
|
|
+ if(DBG) console.log('popup i dodanie wyczysc komunikatu ');
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -213,9 +214,9 @@ function showViewUploadFile( event, headerTitle, enumType, showCheckbox, csvFile
|
|
|
})
|
|
|
},
|
|
|
}).then(function (result) {
|
|
|
- console.log('result', result)
|
|
|
+ if(DBG) console.log('result', result);
|
|
|
}).catch(function (e) {
|
|
|
- console.log('catch: ', e)
|
|
|
+ if(DBG) console.log('catch: ', e);
|
|
|
});
|
|
|
|
|
|
}
|
|
@@ -227,7 +228,7 @@ function showViewUploadFile( event, headerTitle, enumType, showCheckbox, csvFile
|
|
|
function parseCsvFile( fileData, enumType ) {
|
|
|
event.preventDefault();
|
|
|
|
|
|
-console.log( 'parseCsvFile fileData', fileData);
|
|
|
+ if(DBG) console.log( 'parseCsvFile fileData', fileData);
|
|
|
|
|
|
fetch(URL_FORM_DATA_CSV_FILE_AJAX, {
|
|
|
method: 'POST',
|
|
@@ -259,13 +260,13 @@ console.log( 'parseCsvFile fileData', fileData);
|
|
|
},
|
|
|
}).then(function (result) {
|
|
|
|
|
|
- console.log('result', result)
|
|
|
+ if(DBG) console.log('result', result)
|
|
|
}).catch(function (e) {
|
|
|
- console.log('catch: ', e)
|
|
|
+ if(DBG) console.log('catch: ', e)
|
|
|
});
|
|
|
|
|
|
}).catch(function(ex) {
|
|
|
- console.log('parsing failed', ex)
|
|
|
+ if(DBG) console.log('parsing failed', ex);
|
|
|
});
|
|
|
}
|
|
|
|
|
@@ -294,7 +295,7 @@ function saveFormCsvFileAjaxAction(enumType) {
|
|
|
.then(function(response) {
|
|
|
return response.json()
|
|
|
}).then(function(json) {
|
|
|
- console.log('parsed json', json)
|
|
|
+ if(DBG) console.log('parsed json', json);
|
|
|
|
|
|
if (response.type == 'success') {
|
|
|
|
|
@@ -303,7 +304,8 @@ function saveFormCsvFileAjaxAction(enumType) {
|
|
|
|
|
|
// return json;
|
|
|
}).catch(function(ex) {
|
|
|
- console.log('parsing failed', ex)
|
|
|
+ if(DBG) console.log('parsing failed', ex);
|
|
|
+
|
|
|
});
|
|
|
}
|
|
|
|
|
@@ -373,7 +375,8 @@ function generateBiAuditRaport(event) {
|
|
|
})
|
|
|
})
|
|
|
.then(function(response) {
|
|
|
- console.log('Firsst then', response);
|
|
|
+ if(DBG) console.log('Firsst then', response);
|
|
|
+
|
|
|
return response.text();
|
|
|
})
|
|
|
.then(function(responseText) {
|
|
@@ -407,7 +410,7 @@ function generateBiAuditRaport(event) {
|
|
|
}
|
|
|
})
|
|
|
.catch(function(error) {
|
|
|
- console.log('request failed', error)
|
|
|
+ if(DBG) console.log('request failed', error);
|
|
|
});
|
|
|
}
|
|
|
|
|
@@ -448,7 +451,7 @@ function addPracownikToGroup(event) {
|
|
|
showLoaderOnConfirm: true,
|
|
|
preConfirm: function (idGroup) {
|
|
|
return new Promise(function (resolve, reject) {
|
|
|
- console.log('idGrupy value', idGroup);
|
|
|
+ if(DBG) console.log('idGrupy value', idGroup);
|
|
|
|
|
|
if ( !pracownicyIdsArray || pracownicyIdsArray === null || pracownicyIdsArray === 'undefined' ) {
|
|
|
reject('Wybierz pracowników');
|
|
@@ -489,7 +492,7 @@ function addPracownikToGroup(event) {
|
|
|
}
|
|
|
})
|
|
|
.catch(function(error) {
|
|
|
- console.log('request failed', error)
|
|
|
+ if(DBG) console.warn('request failed', error);
|
|
|
});
|
|
|
})
|
|
|
},
|
|
@@ -533,7 +536,7 @@ function addPracownikAllToGroup(event) {
|
|
|
var frm = document.getElementById('filtersFieldRemoveBtn-PRACOWNICY').form
|
|
|
var fieldNameList = FIELD_LIST_PRACOWNICY
|
|
|
fieldNameList.filter(function (fieldName) {
|
|
|
- if (!frm[fieldName]) console.log('Err missing field: "'+fieldName+'"')
|
|
|
+ if (!frm[fieldName] && DBG) console.log('Err missing field: "'+fieldName+'"');
|
|
|
return (frm[fieldName]) ? true : false
|
|
|
}).map(function (fieldName) {
|
|
|
return [ fieldName, frm[fieldName].value ]
|
|
@@ -578,7 +581,7 @@ function addPracownikAllToGroup(event) {
|
|
|
}
|
|
|
})
|
|
|
.catch(function(error) {
|
|
|
- console.log('request failed', error)
|
|
|
+ if(DBG) console.log('request failed', error);
|
|
|
});
|
|
|
})
|
|
|
},
|
|
@@ -706,7 +709,7 @@ function addKontrahenciAllToGroup(event) {
|
|
|
var frm = document.getElementById('filtersFieldRemoveBtn-KONTRAHENCI').form
|
|
|
var fieldNameList = FIELD_LIST_KONTRAHENCI
|
|
|
fieldNameList.filter(function (fieldName) {
|
|
|
- if (!frm[fieldName]) console.log('Err missing field: "'+fieldName+'"')
|
|
|
+ if (!frm[fieldName] && DBG) console.log('Err missing field: "'+fieldName+'"')
|
|
|
return (frm[fieldName]) ? true : false
|
|
|
}).map(function (fieldName) {
|
|
|
return [ fieldName, frm[fieldName].value ]
|
|
@@ -751,7 +754,7 @@ function addKontrahenciAllToGroup(event) {
|
|
|
}
|
|
|
})
|
|
|
.catch(function(error) {
|
|
|
- console.log('request failed', error)
|
|
|
+ if(DBG) console.log('request failed', error);
|
|
|
});
|
|
|
})
|
|
|
},
|
|
@@ -805,7 +808,7 @@ function createGroupKontrahenci(event) {
|
|
|
}
|
|
|
})
|
|
|
.catch(function(error) {
|
|
|
- console.log('request failed', error)
|
|
|
+ if(DBG) console.log('request failed', error);
|
|
|
})
|
|
|
})
|
|
|
},
|
|
@@ -862,14 +865,15 @@ function createGroupPracownicy(event) {
|
|
|
}
|
|
|
})
|
|
|
.catch(function(error) {
|
|
|
- console.log('request failed', error)
|
|
|
+ if(DBG) console.log('request failed', error);
|
|
|
})
|
|
|
|
|
|
})
|
|
|
},
|
|
|
allowOutsideClick: false
|
|
|
}).then(function (groupPracownicyData) {
|
|
|
- console.log('grupa prac2: ', groupPracownicyData);
|
|
|
+ if(DBG) console.log('grupa prac2: ', groupPracownicyData);
|
|
|
+
|
|
|
//TODO: aktualizacja fitrów na widoku -> SPrawdzić co dostaniemy w odpowiedzi po dodaniu filtra grupy
|
|
|
groupsPracownicy = '<button class="btn btn-default" title="'+groupPracownicyData['nazwa']+'" data-group-filter="'+groupPracownicyData['id']+'">'+groupPracownicyData['nazwa']+'</button>';
|
|
|
$('#group-pracownicy').append(groupsPracownicy);
|
|
@@ -878,7 +882,9 @@ function createGroupPracownicy(event) {
|
|
|
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+/**
|
|
|
+ * Function for load view Form pracownicy/kontrahenci
|
|
|
+ */
|
|
|
function rootChangeForm() {
|
|
|
|
|
|
//todo: do przeniesienia
|
|
@@ -892,6 +898,7 @@ urlFetchKontrahenciPowiazania();
|
|
|
fetchGroupKontrahenci();
|
|
|
$( ".container-bi_audit_form_pracownicy_raport" ).hide();
|
|
|
$( ".container-bi_audit_form_kontrahenci_raport" ).show();
|
|
|
+ //parseGraph();
|
|
|
break;
|
|
|
|
|
|
case '#PRACOWNICY':
|
|
@@ -1066,6 +1073,8 @@ function urlFetchKontrahenci(page) {
|
|
|
$('#paginationShowNextCount-KONTRAHENCI').text(paginationShowNextCount);
|
|
|
$('#smad-filter-desc-kontrahenci').text(data.body.pagination.total_items);
|
|
|
if (data.body.pagination.total_items > 0) {
|
|
|
+ var btnGraphView = $('<button class="btn btn-primary smad-kontrahenci-graph-button" onClick="graphShowHide(\'kontrahenci\')" style="padding:1px 5px; margin-left:12px">GRAF POWIĄZAŃ</button>')
|
|
|
+
|
|
|
var btnAddAll = $('<button class="btn btn-primary" style="padding:1px 5px; margin-left:12px">DODAJ WSZYSTKIE DO ANALIZY</button>')
|
|
|
btnAddAll.on('click', { pagination: data.body.pagination }, function (event) {
|
|
|
// event.data.pagination: { [ filter_idGroup: ... ] }
|
|
@@ -1113,12 +1122,13 @@ function urlFetchKontrahenci(page) {
|
|
|
})
|
|
|
})
|
|
|
$('#smad-filter-desc-kontrahenci').append(btnAddAll);
|
|
|
+ $('#smad-filter-desc-kontrahenci').append(btnGraphView);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
var groupSelectData = getNameGroupById(getItemLocalStorage('Bocian.biAuditForm.kontrahenci.groups'), filterIdGroup);
|
|
|
$('#smad-filter-head-title-kontrahenci').text(groupSelectData);
|
|
|
- console.log('kontrahenci groupSelectData: ', groupSelectData);
|
|
|
+ if(DBG) console.log('kontrahenci groupSelectData: ', groupSelectData);
|
|
|
|
|
|
|
|
|
$( "#body-kontrahenci" ).html(listItemsKontrahenci);
|
|
@@ -1127,16 +1137,16 @@ function urlFetchKontrahenci(page) {
|
|
|
checkedChoiseItems('KONTRAHENCI', getItemLocalStorage('Bocian.biAuditForm.kontrahenciIds') );
|
|
|
|
|
|
// $( ".container-bi_audit_raport" ).append( data.body.view );
|
|
|
- console.log('request succeeded with JSON responseKontrahenci', data)
|
|
|
+ if(DBG) console.log('request succeeded with JSON responseKontrahenci', data)
|
|
|
+
|
|
|
updateTopCounters();
|
|
|
}).catch(function(error) {
|
|
|
- console.log('request failed', error)
|
|
|
+ if(DBG) console.log('request failed', error);
|
|
|
})
|
|
|
}
|
|
|
|
|
|
function urlFetchPracownicy(page) {
|
|
|
hideMoreRecordFunctionsPopover()
|
|
|
-
|
|
|
var page = page || getItemLocalStorage('Bocian.biAuditForm.pracownicy.pagination.page');
|
|
|
|
|
|
if ( page === 1) {
|
|
@@ -1150,7 +1160,7 @@ function urlFetchPracownicy(page) {
|
|
|
var frm = document.getElementById('filtersFieldRemoveBtn-PRACOWNICY').form
|
|
|
var fieldNameList = FIELD_LIST_PRACOWNICY
|
|
|
var filterFields = fieldNameList.filter(function (fieldName) {
|
|
|
- if (!frm[fieldName]) console.log('Err missing field: "'+fieldName+'"')
|
|
|
+ if (!frm[fieldName] && DBG) console.log('Err missing field: "'+fieldName+'"')
|
|
|
return (frm[fieldName]) ? true : false
|
|
|
}).map(function (fieldName) {
|
|
|
return [ fieldName, frm[fieldName].value ]
|
|
@@ -1162,7 +1172,7 @@ function urlFetchPracownicy(page) {
|
|
|
filterFields = (filterFields.length > 0) ? '&' + filterFields : ''
|
|
|
|
|
|
var paginationLimit = 20;
|
|
|
- p5WFS_GetFeature('default_db__x3A__BI_audit_ENERGA_PRACOWNICY:BI_audit_ENERGA_PRACOWNICY',
|
|
|
+ /*p5WFS_GetFeature('default_db__x3A__BI_audit_ENERGA_PRACOWNICY:BI_audit_ENERGA_PRACOWNICY',
|
|
|
Object.assign({
|
|
|
sortBy: 'ID+D',
|
|
|
maxFeatures: paginationLimit,
|
|
@@ -1194,7 +1204,7 @@ function urlFetchPracownicy(page) {
|
|
|
if(DBG)console.log('p5WFS_GetFeature: items: ', items);
|
|
|
}).catch(function (err) {
|
|
|
if(DBG)console.log('p5WFS_GetFeature: err: ', err);
|
|
|
- })
|
|
|
+ })*/
|
|
|
|
|
|
fetch(URL_FETCH_PRACOWNICY + '&page=' + page + '&filterIdGroup=' + filterIdGroup + filterFields, {
|
|
|
credentials: 'same-origin'
|
|
@@ -1206,7 +1216,7 @@ function urlFetchPracownicy(page) {
|
|
|
|
|
|
var addresPerson = '';
|
|
|
var listItemsPracownik = null;
|
|
|
- console.log('urlFetchPracownicy', data.body.items);
|
|
|
+ if(DBG) console.log('urlFetchPracownicy', data.body.items);
|
|
|
|
|
|
data.body.items.forEach (function(row) {
|
|
|
|
|
@@ -1251,6 +1261,8 @@ function urlFetchPracownicy(page) {
|
|
|
$('#paginationShowNextCount-PRACOWNICY').text(paginationShowNextCount);
|
|
|
$('#smad-filter-desc-pracownicy').text(data.body.pagination.total_items);
|
|
|
if (data.body.pagination.total_items > 0) {
|
|
|
+ var btnGraphView = $('<button class="btn btn-primary smad-pracownicy-graph-button" onClick="graphShowHide(\'pracownicy\')" style="padding:1px 5px; margin-left:12px">GRAF POWIĄZAŃ</button>')
|
|
|
+
|
|
|
var btnAddAll = $('<button class="btn btn-primary" style="padding:1px 5px; margin-left:12px">DODAJ WSZYSTKIE DO ANALIZY</button>')
|
|
|
btnAddAll.on('click', { pagination: data.body.pagination }, function (event) {
|
|
|
// event.data.pagination: { [ filter_idGroup: ... ] }
|
|
@@ -1298,6 +1310,8 @@ function urlFetchPracownicy(page) {
|
|
|
})
|
|
|
})
|
|
|
$('#smad-filter-desc-pracownicy').append(btnAddAll);
|
|
|
+ $('#smad-filter-desc-pracownicy').append(btnGraphView);
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -1314,7 +1328,7 @@ function urlFetchPracownicy(page) {
|
|
|
|
|
|
updateTopCounters();
|
|
|
}).catch(function(error) {
|
|
|
- console.log('request failed', error)
|
|
|
+ if(DBG) console.log('request failed', error)
|
|
|
})
|
|
|
|
|
|
}
|
|
@@ -1517,7 +1531,6 @@ function deleteListIdBiAuditReaport(type, valueArray) {
|
|
|
|
|
|
// filter group detect
|
|
|
function fetchGroupPracownicy() {
|
|
|
-
|
|
|
fetch(URL_FETCH_GROUP_PRACOWNICY, {
|
|
|
credentials: 'same-origin'
|
|
|
})
|
|
@@ -1541,7 +1554,9 @@ function fetchGroupPracownicy() {
|
|
|
var activeButton = '';
|
|
|
|
|
|
data.body.itmesGroupPracownicy.forEach (function(row) {
|
|
|
- if ( filterIdGroup === row['ID'] ) { activeButton = 'active'; $('#group-pracownicy button.active').removeClass('active'); }
|
|
|
+ activeButton = '';
|
|
|
+ if ( filterIdGroup === parseInt(row['ID']) ) {activeButton = 'active'; $('#group-pracownicy button.active').removeClass('active');
|
|
|
+ }
|
|
|
groupsPracownicy += '<button class="btn btn-default '+activeButton+'" title="' + row['NAZWA'] + '" data-group-filter="' + row['ID'] + '">' + row['NAZWA'] + '</button>';
|
|
|
});
|
|
|
|
|
@@ -1551,7 +1566,7 @@ function fetchGroupPracownicy() {
|
|
|
// detect filter group
|
|
|
detectChoiseFilter();
|
|
|
}).catch(function(error) {
|
|
|
- console.log('request failed', error)
|
|
|
+ if(DBG) console.log('request failed', error)
|
|
|
});
|
|
|
}
|
|
|
|
|
@@ -1580,7 +1595,8 @@ function fetchGroupKontrahenci() {
|
|
|
var activeButton = '';
|
|
|
|
|
|
data.body.itemsGroupKontrahenci.forEach (function(row) {
|
|
|
- if ( filterIdGroup === row['ID'] ) { activeButton = 'active'; $('#group-kontrahenci button.active').removeClass('active'); }
|
|
|
+ activeButton = '';
|
|
|
+ if ( filterIdGroup === parseInt(row['ID']) ) { activeButton = 'active'; $('#group-kontrahenci button.active').removeClass('active'); }
|
|
|
groupsKontrahenci += '<button class="btn btn-default '+activeButton+'" title="'+row['NAZWA']+'" data-group-filter="'+row['ID']+'">'+row['NAZWA']+'</button>';
|
|
|
});
|
|
|
|
|
@@ -1589,9 +1605,9 @@ function fetchGroupKontrahenci() {
|
|
|
|
|
|
// detect filter group
|
|
|
detectChoiseFilter();
|
|
|
- console.log('request succeeded with JSON fetchGroupKontrahenci', data.body.itemsGroupKontrahenci);
|
|
|
+ if(DBG) console.log('request succeeded with JSON fetchGroupKontrahenci', data.body.itemsGroupKontrahenci);
|
|
|
}).catch(function(error) {
|
|
|
- console.log('request failed', error)
|
|
|
+ if(DBG) console.log('request failed', error)
|
|
|
});
|
|
|
}
|
|
|
|
|
@@ -1599,7 +1615,6 @@ function fetchGroupKontrahenci() {
|
|
|
function detectChoiseFilter() {
|
|
|
|
|
|
$('#group-kontrahenci').on('click', 'button', function(evt) {
|
|
|
-
|
|
|
$('#group-kontrahenci button.active').removeClass('active');
|
|
|
$(this).addClass('active');
|
|
|
|
|
@@ -1624,8 +1639,8 @@ function detectChoiseFilter() {
|
|
|
urlFetchKontrahenci(1);
|
|
|
|
|
|
});
|
|
|
- $('#group-pracownicy').on('click', 'button', function(evt) {
|
|
|
-
|
|
|
+ $('#group-pracownicy').on('click', 'button', function(e) {
|
|
|
+ e.preventDefault();
|
|
|
$('#group-pracownicy button.active').removeClass('active');
|
|
|
$(this).addClass('active');
|
|
|
|
|
@@ -1700,6 +1715,474 @@ function removeItemArrayInArray(arr, itemsArray) {
|
|
|
return arr;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+/**
|
|
|
+ * Function show/hide graph view
|
|
|
+ */
|
|
|
+function graphShowHide(nameSection) {
|
|
|
+ var node = $('.smad-'+nameSection+'-graph-view')
|
|
|
+ if (!node || !node.length) return;
|
|
|
+ if ('block' !== node.css('display')) {
|
|
|
+ node.show()
|
|
|
+ graphFetchData(node.get(0), nameSection)
|
|
|
+ } else {
|
|
|
+ node.hide()
|
|
|
+ }
|
|
|
+}
|
|
|
+function graphFetchData(node, nameSection) {
|
|
|
+ var page = page || getItemLocalStorage('Bocian.biAuditForm.'+nameSection+'.pagination.page');
|
|
|
+ if ( page === 1) {
|
|
|
+ setItemLocalStorage('Bocian.biAuditForm.'+nameSection+'.pagination.page', 1);
|
|
|
+ }
|
|
|
+
|
|
|
+ var filterIdGroup = getItemLocalStorage('Bocian.biAuditForm.'+nameSection+'.filterIdGroup');
|
|
|
+
|
|
|
+ var frm = document.getElementById('filtersFieldRemoveBtn-' + nameSection.toUpperCase()).form
|
|
|
+ console.log('frm', frm)
|
|
|
+ var fieldNameList = ('pracownicy' === nameSection) ? FIELD_LIST_PRACOWNICY : FIELD_LIST_KONTRAHENCI
|
|
|
+ var filterFields = fieldNameList.filter(function (fieldName) {
|
|
|
+ if (!frm[fieldName] && DBG) console.log('Err missing field: "'+fieldName+'"')
|
|
|
+ return (frm[fieldName]) ? true : false
|
|
|
+ }).map(function (fieldName) {
|
|
|
+ return [ fieldName, frm[fieldName].value ]
|
|
|
+ }).filter(function (filter) {
|
|
|
+ return ( filter[1].length > 0 )
|
|
|
+ })
|
|
|
+ // filterFields = (filterFields.length > 0) ? '&' + filterFields : ''
|
|
|
+
|
|
|
+ // <ogc:Filter>
|
|
|
+ // <ogc:Or>
|
|
|
+ // <ogc:PropertyIsLike wildCard="*" singleChar="%23" escapeChar="!">
|
|
|
+ // <ogc:PropertyName>A_STATUS</ogc:PropertyName>
|
|
|
+ // <ogc:Literal>*O%23MA*</ogc:Literal>
|
|
|
+ // </ogc:PropertyIsLike>
|
|
|
+ // <ogc:PropertyIsLike wildCard="*" singleChar="%23" escapeChar="!">
|
|
|
+ // <ogc:PropertyName>A_STATUS</ogc:PropertyName>
|
|
|
+ // <ogc:Literal>*ARNING</ogc:Literal>
|
|
|
+ // </ogc:PropertyIsLike>
|
|
|
+ // </ogc:Or>
|
|
|
+ // </ogc:Filter>
|
|
|
+ var ogcFilterFields = (filterFields.length > 0)
|
|
|
+ ? '<ogc:Filter><ogc:And>' + filterFields.map(function(filter) {
|
|
|
+ if ('ID' === filter[0].substr(2)) return '<ogc:PropertyIsEqualTo>' +
|
|
|
+ '<ogc:PropertyName>' + filter[0].substr(2) + '</ogc:PropertyName>' +
|
|
|
+ '<ogc:Literal>' + filter[1] + '</ogc:Literal>' +
|
|
|
+ '</ogc:PropertyIsEqualTo>';
|
|
|
+
|
|
|
+ return '<ogc:PropertyIsLike wildCard="*" singleChar="%23" escapeChar="!">' +
|
|
|
+ '<ogc:PropertyName>' + filter[0].substr(2) + '</ogc:PropertyName>' +
|
|
|
+ '<ogc:Literal>*' + filter[1] + '*</ogc:Literal>' +
|
|
|
+ '</ogc:PropertyIsLike>';
|
|
|
+ }) + '</ogc:And></ogc:Filter>'
|
|
|
+ : ''
|
|
|
+
|
|
|
+ var paginationLimit = 20;
|
|
|
+
|
|
|
+ if(DBG)console.log('graphFetchData...', {
|
|
|
+ paginationLimit: paginationLimit,
|
|
|
+ page: page,
|
|
|
+ filterIdGroup: filterIdGroup,
|
|
|
+ filterFields: filterFields,
|
|
|
+ ogcFilterFields: ogcFilterFields,
|
|
|
+ });
|
|
|
+ console.log('graphFetchData...', {
|
|
|
+ paginationLimit: paginationLimit,
|
|
|
+ page: page,
|
|
|
+ filterIdGroup: filterIdGroup,
|
|
|
+ filterFields: filterFields,
|
|
|
+ ogcFilterFields: ogcFilterFields,
|
|
|
+ });
|
|
|
+
|
|
|
+ p5WFS_GetFeature('default_db__x3A__BI_audit_ENERGA_PRACOWNICY:BI_audit_ENERGA_PRACOWNICY',
|
|
|
+ Object.assign({
|
|
|
+ sortBy: 'ID+D',
|
|
|
+ maxFeatures: paginationLimit,
|
|
|
+ startIndex: (page - 1) * paginationLimit,
|
|
|
+ // TODO: backRefNS, backRefPK, backRefField - TODO: from groups
|
|
|
+ // resolve: 'all',
|
|
|
+ // resolveDepth: 2
|
|
|
+ 'ogc:Filter': '<wfs:Query>' + '\n' + [
|
|
|
+ 'ID', // '*'
|
|
|
+ 'default_db__x3A__BI_audit_ENERGA_PRACOWNICY_adresy:BI_audit_ENERGA_PRACOWNICY_adresy/*',
|
|
|
+ [
|
|
|
+ 'default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object',
|
|
|
+ 'default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row',
|
|
|
+ 'default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object',
|
|
|
+ 'default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI:BI_audit_ENERGA_RUM_KONTRAHENCI'
|
|
|
+ ].join('/'),
|
|
|
+ [
|
|
|
+ 'default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object',
|
|
|
+ 'ID',
|
|
|
+ ].join('/'),
|
|
|
+ [
|
|
|
+ 'default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object',
|
|
|
+ 'default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row',
|
|
|
+ 'ID',
|
|
|
+ ].join('/'),
|
|
|
+ [
|
|
|
+ 'default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object',
|
|
|
+ 'default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row',
|
|
|
+ 'default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object',
|
|
|
+ 'ID'
|
|
|
+ ].join('/')
|
|
|
+ ].map(function (fieldName) {
|
|
|
+ return '<wfs:PropertyName>' + fieldName + '</wfs:PropertyName>';
|
|
|
+ }).join('\n') + '\n' +
|
|
|
+ ( ogcFilterFields ? ogcFilterFields : '' ) +
|
|
|
+ '</wfs:Query>'
|
|
|
+ }, (filterIdGroup > 0)
|
|
|
+ ? {
|
|
|
+ backRefNS: 'default_db/BI_audit_ENERGA_PRACOWNICY_group/BI_audit_ENERGA_PRACOWNICY_group',
|
|
|
+ backRefPK: filterIdGroup,
|
|
|
+ backRefField: 'default_db__x3A__BI_audit_ENERGA_PRACOWNICY:BI_audit_ENERGA_PRACOWNICY',
|
|
|
+ }
|
|
|
+ : {}
|
|
|
+ )
|
|
|
+ ).then(function (items) {
|
|
|
+ if(DBG)console.log('p5WFS_GetFeature: items: ', items);
|
|
|
+ graphRender(node, { msg: "Pobrano dane", nameSection: nameSection, items: items })
|
|
|
+ }).catch(function (err) {
|
|
|
+ if(DBG)console.log('p5WFS_GetFeature: err: ', err);
|
|
|
+ // graphRender(node, { msg: "Wystąpiły błędy podczas pobierania danych", nameSection: nameSection, err: err })
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
+function graphRender(wrapNode, props) {
|
|
|
+ var svgNode = jQuery(wrapNode).children('svg')
|
|
|
+ svgNode = (svgNode.length) ? d3.select(svgNode.get(0)) : d3.select(wrapNode).append("svg")
|
|
|
+ // svg.append("rect").attr("x",0).attr("y",0).attr("width","100%").attr("height","100%").attr("fill","white").attr('class','background').on('mouseup', () => redraw())
|
|
|
+ // svgNode.attr("width", '100%')
|
|
|
+ // .attr("height", '300px')
|
|
|
+ // .append("g").attr("transform", "translate(" + margin.left + "," + margin.top + ")");
|
|
|
+
|
|
|
+ // var data = parseGraphRec(props.items, props.nameSection)
|
|
|
+ var _todoGraphData = [];
|
|
|
+ parseResponseRec(_todoGraphData, props.items, props.nameSection)
|
|
|
+ if(DBG)console.log('_todoGraphData', _todoGraphData)
|
|
|
+ var _nodes = [];
|
|
|
+ var _links = [];
|
|
|
+ var mapNodeIdToIdx = {};
|
|
|
+ _todoGraphData.forEach(function (levelData, levelIdx) {
|
|
|
+ if (levelData.nodes && levelData.nodes.length) {
|
|
|
+ levelData.nodes.forEach(function (node) {
|
|
|
+ try {
|
|
|
+ if (node.id in mapNodeIdToIdx) return;
|
|
|
+ _nodes.push(node) // _nodes.add(node)
|
|
|
+ mapNodeIdToIdx[node.id] = _nodes.length - 1
|
|
|
+ } catch (e) {
|
|
|
+ if(DBG)console.log('_graphData.nodes.add [level='+levelIdx+'] error:', e);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+ var linkIdsAdded = []
|
|
|
+ _todoGraphData.forEach(function (levelData, levelIdx) {
|
|
|
+ if (levelData.edges && levelData.edges.length) {
|
|
|
+ levelData.edges.forEach(function (edge) {
|
|
|
+ if(DBG)console.log('_graphData.edges.add [level='+levelIdx+']:', {edge, source:mapNodeIdToIdx[edge.source], target:mapNodeIdToIdx[edge.target], mapNodeIdToIdx});
|
|
|
+ // try {
|
|
|
+ // var source = mapNodeIdToIdx[edge.source]
|
|
|
+ // var target = mapNodeIdToIdx[edge.target]
|
|
|
+ // if (!source || !target) { // && !== 0
|
|
|
+ // console.warn('(!source || !target)', {source, target, edge, mapNodeIdToIdx})
|
|
|
+ // }
|
|
|
+ if (-1 !== linkIdsAdded.indexOf(edge.id)) return
|
|
|
+ // _links.push({
|
|
|
+ // id: edge.id,
|
|
|
+ // source: mapNodeIdToIdx[edge.source],
|
|
|
+ // target: mapNodeIdToIdx[edge.target],
|
|
|
+ // value: 1
|
|
|
+ // })
|
|
|
+ _links.push({
|
|
|
+ id: edge.id,
|
|
|
+ source: edge.source,
|
|
|
+ target: edge.target,
|
|
|
+ value: 1
|
|
|
+ }) // _edges.add(edge)
|
|
|
+ linkIdsAdded.push(edge.id)
|
|
|
+ // } catch (e) {
|
|
|
+ // if(DBG)console.log('_graphData.edges.add [level='+levelIdx+'] error:', e);
|
|
|
+ // }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+ var totalLinks = _links.length
|
|
|
+ console.log('DBG:0: _links', _links)
|
|
|
+ console.log('DBG:1: _nodes', _nodes)
|
|
|
+ _nodes = _nodes.filter(function (node, idx) {
|
|
|
+ if (node.typeName !== 'pracownicy') return true
|
|
|
+ for (i=0; i<totalLinks; i++) {
|
|
|
+ var link = _links[i]
|
|
|
+ if (_links[i].source === node.id) return true
|
|
|
+ if (_links[i].target === node.id) return true
|
|
|
+ }
|
|
|
+ return false
|
|
|
+ })
|
|
|
+ console.log('DBG:2: _nodes', _nodes)
|
|
|
+ jQuery(wrapNode).find('p').remove()
|
|
|
+ if (!_nodes || !_nodes.length) {
|
|
|
+ jQuery(wrapNode).find('svg').remove()
|
|
|
+ jQuery(wrapNode).append('<p>Brak powiązań</p>')
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ var graphData = { nodes: _nodes, links: _links };
|
|
|
+
|
|
|
+ var graf = renderGraph(svgNode, graphData)
|
|
|
+ graf.on('click', (event) => {
|
|
|
+ if(DBG)console.log('event', event)
|
|
|
+ // event = {
|
|
|
+ // nativeEvent: d3.event,
|
|
|
+ // node: a,
|
|
|
+ // element: d3.event.srcElement
|
|
|
+ // }
|
|
|
+
|
|
|
+ // TODO: !a.expanded && redraw({type: a.name, criteria: 'ID'})
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
+function parseGraphRec(items, featureType, parentFeatureId) {
|
|
|
+ var parentFeatureId = parentFeatureId || null
|
|
|
+ var nodesArray = []
|
|
|
+ var linksArray = []
|
|
|
+ if (!items) return;
|
|
|
+ items.forEach(function (item) {
|
|
|
+ if ('string' === typeof item) {
|
|
|
+ if(DBG)console.log('TODO: xlink "'+item+'": ', {item:item, parentFeatureId:parentFeatureId})
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (!item['ID']) {
|
|
|
+ if(DBG)console.log('TODO: SKIP item('+featureType+') - missing ID: ', {item:item, parentFeatureId:parentFeatureId})
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ var id = item['ID']
|
|
|
+ console.log('item('+featureType+'): ', {item:item, parentFeatureId:parentFeatureId})
|
|
|
+ var featureId = featureType + '.' + id
|
|
|
+ Object.keys(item).filter(function (fieldName) { return ('ID' !== fieldName); })
|
|
|
+ .forEach(function (fieldName) {
|
|
|
+ parseGraphRec(item[fieldName], fieldName, featureId)
|
|
|
+ })
|
|
|
+ })
|
|
|
+ // items.forEach(element => {
|
|
|
+ // const rowObject = hasTargetArray(element);
|
|
|
+ // if (rowObject)
|
|
|
+ // rowObject.array.forEach(objectElement => {
|
|
|
+ // const trackNode = hasTargetArray(objectElement);
|
|
|
+ // if (trackNode) {
|
|
|
+ // let group = trackNode.name;
|
|
|
+ // let expanded = false;
|
|
|
+ // if (expansion && expansion.type && group === expansion.type) {
|
|
|
+ // group = trackNode.array[0][expansion.criteria];
|
|
|
+ // expanded = true;
|
|
|
+ // }
|
|
|
+ // nodes[group] = {expanded: expanded, type: trackNode.name};
|
|
|
+ // instanceTypes[trackNode.array[0].ID] = group;
|
|
|
+ // }
|
|
|
+ // });
|
|
|
+ // });
|
|
|
+
|
|
|
+ return {
|
|
|
+ nodes: nodesArray,
|
|
|
+ links: linksArray
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+function parseResponseRec(_todoGraphData, json, typeName, parentNodeId, level) {
|
|
|
+ var level = level || 0
|
|
|
+ var parentNodeId = parentNodeId || null
|
|
|
+ if(DBG)console.log('DBG::parseResponseRec', {json:json, typeName:typeName, parentNodeId:parentNodeId, isString: p5Utils__isString(json), isArray: p5Utils__isArray(json), isObject: p5Utils__isObject(json)});
|
|
|
+ if (p5Utils__isArray(json)) {
|
|
|
+ // TODO: create named group
|
|
|
+ var isXlinkList = (json.length > 0 && p5Utils__isString(json[0]))
|
|
|
+ json.forEach(function (subJson) {
|
|
|
+ if (isXlinkList) {
|
|
|
+ parseResponseXlinkListRec(_todoGraphData, subJson, typeName, parentNodeId, level)
|
|
|
+ } else {
|
|
|
+ parseResponseRec(_todoGraphData, subJson, typeName, parentNodeId, level)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else if (p5Utils__isObject(json) && isP5LinkObject(json)) {
|
|
|
+ if(DBG)console.log('DBG::parseResponseRec isP5LinkObject');
|
|
|
+ parseResponseP5Link(_todoGraphData, json, typeName, parentNodeId, level)
|
|
|
+ } else if (p5Utils__isObject(json)) {
|
|
|
+ // _todoGraphData.nodes.add({ id: nodeId, label: nodeId })
|
|
|
+ if (!_todoGraphData[level]) _todoGraphData[level] = { nodes: [], edges: [] }
|
|
|
+ var nodeObject = dataMakeNode({
|
|
|
+ typeName: typeName,
|
|
|
+ primaryKey: (json['ID']) ? json['ID'] : null, // TODO: get primaryKey from object
|
|
|
+ })
|
|
|
+
|
|
|
+ if ("default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object" !== typeName
|
|
|
+ && "default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row" !== typeName
|
|
|
+ ) {
|
|
|
+ var nodeId = nodeObject.id
|
|
|
+ _todoGraphData[level].nodes.push(nodeObject)
|
|
|
+ if (parentNodeId) {
|
|
|
+ _todoGraphData[level].edges.push(dataMakeEdge(parentNodeId, nodeObject))
|
|
|
+ }
|
|
|
+ Object.keys(json).filter(function (fieldName) {
|
|
|
+ return (fieldName.indexOf(':') > -1)
|
|
|
+ })
|
|
|
+ .forEach(function (fieldName) {
|
|
|
+ var value = json[fieldName]
|
|
|
+ parseResponseRec(_todoGraphData, value, fieldName, nodeId, level + 1)
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ Object.keys(json).filter(function (fieldName) {
|
|
|
+ return (fieldName.indexOf(':') > -1)
|
|
|
+ })
|
|
|
+ .forEach(function (fieldName) {
|
|
|
+ var value = json[fieldName]
|
|
|
+ parseResponseRec(_todoGraphData, value, fieldName, parentNodeId, level + 1)
|
|
|
+ })
|
|
|
+ }
|
|
|
+ } else if (p5Utils__isString(json)) {
|
|
|
+ if(DBG)console.log('TODO: Not implemented - parseResponseRec isString');
|
|
|
+ } else {
|
|
|
+ if(DBG)console.log('TODO: Not implemented - parseResponseRec is not string, not array and not object');
|
|
|
+ }
|
|
|
+}
|
|
|
+function parseResponseXlinkListRec(_todoGraphData, json, typeName, parentNodeId, level) {
|
|
|
+ if(DBG)console.log('DBG::parseResponseRec:XlinkList', {json:json, typeName:typeName, parentNodeId:parentNodeId, isString: p5Utils__isString(json), isArray: p5Utils__isArray(json), isObject: p5Utils__isObject(json)});
|
|
|
+ if (p5Utils__isString(json)) { // xlink "https://biuro.biall-net.pl/wfs/default_db/BI_audit_ENERGA_RUM_KONTRAHENCI#BI_audit_ENERGA_RUM_KONTRAHENCI.9233",
|
|
|
+ var nodeId = json.substr(json.indexOf('#') + 1)
|
|
|
+ {
|
|
|
+ // _graphData.nodes.add({ id: nodeId, label: nodeId })
|
|
|
+ if (!_todoGraphData[level]) _todoGraphData[level] = { nodes: [], edges: [] }
|
|
|
+ var nodeObject = dataMakeXlinkNode({
|
|
|
+ xlink: json,
|
|
|
+ typeName: typeName,
|
|
|
+ primaryKey: (json['ID']) ? json['ID'] : null, // TODO: get primaryKey from object
|
|
|
+ })
|
|
|
+ _todoGraphData[level].nodes.push(nodeObject)
|
|
|
+ if (parentNodeId) {
|
|
|
+ _todoGraphData[level].edges.push(dataMakeEdge(parentNodeId, nodeObject))
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else if (p5Utils__isObject(json) && isP5LinkObject(json)) {
|
|
|
+ parseResponseP5Link(_todoGraphData, json, typeName, parentNodeId, level)
|
|
|
+ } else {
|
|
|
+ if(DBG)console.log('TODO: Not implemented - parseResponseRec:XlinkList is not string and not object');
|
|
|
+ }
|
|
|
+}
|
|
|
+function parseResponseP5Link(_todoGraphData, json, typeName, parentNodeId, level) {
|
|
|
+ if(DBG)console.log('parseResponseRec isObject and P5Link - fetch more xlink object');
|
|
|
+ // example json: { type: "next",
|
|
|
+ // @backRefNS: "default_db/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA",
|
|
|
+ // @backRefPK: "42",
|
|
|
+ // @typeName: "default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_P…ow:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row",
|
|
|
+ // @startIndex: "10" }
|
|
|
+ if (!parentNodeId) throw "Missing parentNodeId for ref link object";
|
|
|
+ var objectName = typeName.substr(typeName.indexOf(':') + 1)
|
|
|
+ {
|
|
|
+ // _graphData.nodes.add({ id: nodeId, label: nodeId })
|
|
|
+ if (!_todoGraphData[level]) _todoGraphData[level] = { nodes: [], edges: [] }
|
|
|
+ switch (json.type) {
|
|
|
+ case 'next': {
|
|
|
+ // TODO: add fetch next node
|
|
|
+ // var nodeObject = dataMakeFetchMoreNode({
|
|
|
+ // parentNodeId: parentNodeId,
|
|
|
+ // type: json.type,
|
|
|
+ // objectName: objectName,
|
|
|
+ // ref: json,
|
|
|
+ // })
|
|
|
+ // _todoGraphData[level].nodes.push(nodeObject)
|
|
|
+ // _todoGraphData[level].edges.push(dataMakeFetchMoreEdge(parentNodeId, nodeObject))
|
|
|
+ } break;
|
|
|
+ default: {
|
|
|
+ if(DBG)console.log('TODO: Not implemented - parseResponseRec isObject with type "'+json.type+'" - fetch more xlink object');
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+function isP5LinkObject(json) {
|
|
|
+ if ( !('type' in json) || !json['type'] ) return false;
|
|
|
+ if ( !('value' in json) || !json['value'] ) return false;
|
|
|
+ if ( !('@typeName' in json) || !json['@typeName'] ) return false;
|
|
|
+ if ( !('@startIndex' in json) || !json['@startIndex'] ) return false;
|
|
|
+ if ( !('@backRefPK' in json) || !json['@backRefPK'] ) return false;
|
|
|
+ if ( !('@backRefNS' in json) || !json['@backRefNS'] ) return false;
|
|
|
+ return true;
|
|
|
+}
|
|
|
+
|
|
|
+function dataMakeNode(params) {
|
|
|
+ var objectName = params.typeName.substr(params.typeName.indexOf(':') + 1)
|
|
|
+ var nodeId = objectName + '.' + params.primaryKey // TODO: primaryKey?
|
|
|
+ return {
|
|
|
+ id: nodeId,
|
|
|
+ label: makeShortLabel(nodeId), // TODO: get from schema assert @label attribute
|
|
|
+ name: nodeId,
|
|
|
+ group: objectName,
|
|
|
+ _loaded: true,
|
|
|
+ typeName: params.typeName,
|
|
|
+ primaryKey: params.primaryKey // TODO: _primaryKey
|
|
|
+ }
|
|
|
+}
|
|
|
+function dataMakeEdge(parentNodeId, nodeObject) {
|
|
|
+ return {
|
|
|
+ id: parentNodeId + nodeObject.id,
|
|
|
+ source: parentNodeId,
|
|
|
+ target: nodeObject.id,
|
|
|
+ }
|
|
|
+}
|
|
|
+function dataMakeXlinkNode(params) {
|
|
|
+ var objectName = params.typeName.substr(params.typeName.indexOf(':') + 1)
|
|
|
+ var nodeId = params.xlink.substr(params.xlink.indexOf('#') + 1)
|
|
|
+ var primaryKey = nodeId.substr(nodeId.lastIndexOf('.') + 1)
|
|
|
+ return {
|
|
|
+ id: nodeId,
|
|
|
+ label: makeShortLabel(nodeId) + ' (+)',
|
|
|
+ name: nodeId,
|
|
|
+ group: objectName,
|
|
|
+ _loaded: false,
|
|
|
+ typeName: params.typeName,
|
|
|
+ primaryKey: primaryKey
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+function dataMakeFetchMoreNode(params) {
|
|
|
+ // params = {
|
|
|
+ // parentNodeId: parentNodeId,
|
|
|
+ // type: json.type,
|
|
|
+ // objectName: objectName,
|
|
|
+ // ref: json,
|
|
|
+ // }
|
|
|
+ if(DBG)console.log('DBG dataMakeFetchMoreNode(params)', params)
|
|
|
+ var nodeId = params.parentNodeId+'fetch-more-features-'+params.type+'-on-' + params.objectName;
|
|
|
+ return {
|
|
|
+ id: nodeId,
|
|
|
+ label: 'Pobierz więcej (+)',
|
|
|
+ group: 'fetch-more-data', // params.objectName,
|
|
|
+ _loaded: false,
|
|
|
+ _type: 'ref',
|
|
|
+ parentNodeId: params.parentNodeId,
|
|
|
+ ref: params.ref,
|
|
|
+ // typeName: typeName,
|
|
|
+ // primaryKey: nodeId.substr(nodeId.lastIndexOf('.') + 1)
|
|
|
+ };
|
|
|
+}
|
|
|
+function dataMakeFetchMoreEdge(parentNodeId, fetchMoreNode) {
|
|
|
+ // @param parentNodeId - from node id
|
|
|
+ // @param fetchMoreNode - from dataMakeFetchMoreNode
|
|
|
+ if(DBG)console.log('DBG dataMakeFetchMoreEdge(parentNodeId, fetchMoreNode)', {parentNodeId:parentNodeId, fetchMoreNode:fetchMoreNode})
|
|
|
+ return {
|
|
|
+ id: fetchMoreNode.id,
|
|
|
+ from: parentNodeId,
|
|
|
+ to: fetchMoreNode.id
|
|
|
+ }
|
|
|
+}
|
|
|
+function makeShortLabel(label) { // TODO: shorter name
|
|
|
+ // BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object.1234567
|
|
|
+ if (label.length < 30) return label;
|
|
|
+ var exLabel = label.split('.')
|
|
|
+ if (exLabel.length !== 2) return label;
|
|
|
+ return exLabel[0].substr(0, 24) + '...' + exLabel[0].substr(-10) + '.' + exLabel[1];
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* Cleart list local storage by type
|
|
|
* typeNameLocalStorage - name (praconwicy/kontrahenci)
|
|
@@ -1757,7 +2240,7 @@ function updateTopCounters() {
|
|
|
var totalPracownicy = (countPracownicy) ? Object.keys(countPracownicy).length : 0;
|
|
|
var totalKontrahenci = (countKontrahenci) ? Object.keys(countKontrahenci).length : 0;
|
|
|
var depthValue = getItemLocalStorage('Bocian.biAuditForm.depth');
|
|
|
- console.warn({totalPracownicy: totalPracownicy, totalKontrahenci: totalKontrahenci})
|
|
|
+ if(DBG) console.warn({totalPracownicy: totalPracownicy, totalKontrahenci: totalKontrahenci})
|
|
|
$('.top--count-selected-item-pracownicy').text(totalPracownicy ? '('+totalPracownicy+')' : '');
|
|
|
$('.top--count-selected-item-kontrahenci').text(totalKontrahenci ? '('+totalKontrahenci+')' : '');
|
|
|
$('.bottom--count-selected-item-pracownicy').text(totalPracownicy ? "Wybrano: (" + totalPracownicy + ") pracownika/ów" : '');
|
|
@@ -1771,9 +2254,9 @@ function updateTopCounters() {
|
|
|
|
|
|
if ( ( totalPracownicy === 0 || totalKontrahenci === 0 ) && parseInt(depthValue) > 6) {
|
|
|
$('.bottom--message-warning-critical-search').text(messageCriticalSearchData);
|
|
|
- console.log('dodanie komunikatu niżej');
|
|
|
+ if(DBG) console.log('dodanie komunikatu niżej');
|
|
|
} else {
|
|
|
- console.log('wyczyc komunikatu niżej');
|
|
|
+ if(DBG) console.log('wyczyc komunikatu niżej');
|
|
|
$('.bottom--message-warning-critical-search').text('');
|
|
|
}
|
|
|
|
|
@@ -1979,16 +2462,16 @@ var Pagination = {
|
|
|
};
|
|
|
|
|
|
function todo__fetchRaport(id) {
|
|
|
- p5WFS_GetFeature('default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA', {
|
|
|
+/* p5WFS_GetFeature('default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA', {
|
|
|
primaryKey: id,
|
|
|
resolve: 'all',
|
|
|
resolveDepth: 3,
|
|
|
}).then(function (features) {
|
|
|
- console.log('features', features)
|
|
|
+ if(DBG) console.log('features', features)
|
|
|
}).catch(function (e) {
|
|
|
- console.warn(e)
|
|
|
+ if(DBG) console.warn(e)
|
|
|
p5UI__notifyAjaxCallback({ type: 'error', msg: e })
|
|
|
- })
|
|
|
+ })*/
|
|
|
}
|
|
|
|
|
|
function removeFiltersPracownicy(event, btnNode) {
|
|
@@ -2101,7 +2584,7 @@ function loadMoreRecordFunctions(event, node, rowPK, namespace) {
|
|
|
jQuery(RECORD_MORE_FUNCTIONS_OPENED_NODE).popover('show')
|
|
|
|
|
|
}).catch(function (err) {
|
|
|
- // console.log('err', err)
|
|
|
+ if(DBG) console.log('err', err);
|
|
|
})
|
|
|
}
|
|
|
|
|
@@ -2136,7 +2619,6 @@ global.p5UI_TableAjax_generateFunctionNode = p5UI_TableAjax_generateFunctionNode
|
|
|
|
|
|
$(document).ready(function(){
|
|
|
rootChangeForm();
|
|
|
- detectChoiseFilter();
|
|
|
updateTopCounters();
|
|
|
});
|
|
|
|
|
@@ -2191,6 +2673,7 @@ global.addKontrahenciAllToGroup = addKontrahenciAllToGroup;
|
|
|
|
|
|
global.showViewUploadFile = showViewUploadFile;
|
|
|
global.parseCsvFile = parseCsvFile;
|
|
|
+global.graphShowHide = graphShowHide;
|
|
|
global.clearListLocalStorageByType = clearListLocalStorageByType;
|
|
|
|
|
|
// message
|