|
@@ -706,20 +706,18 @@ function addPracownikToGroup(event) {
|
|
|
showLoaderOnConfirm: true,
|
|
|
preConfirm: function (idGroup) {
|
|
|
return new Promise(function (resolve, reject) {
|
|
|
- if(DBG) console.log('idGrupy value', idGroup);
|
|
|
-
|
|
|
- if ( !pracownicyIdsArray || pracownicyIdsArray === null || pracownicyIdsArray === 'undefined' ) {
|
|
|
- reject('Wybierz pracowników');
|
|
|
- } else if ( pracownicyIdsArray.length === 0 ) {
|
|
|
+ if (!idGroup) {
|
|
|
+ reject('Proszę wybrać nazwę grupy');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (!pracownicyIdsArray || !pracownicyIdsArray.length) {
|
|
|
reject('Wybierz pracowników');
|
|
|
+ return;
|
|
|
}
|
|
|
- if (!idGroup) reject('Proszę wybrać nazwę grupy');
|
|
|
|
|
|
window.fetch(URL_ADD_PRACOWNICY_TO_GROUP, {
|
|
|
method: 'POST',
|
|
|
- header: {
|
|
|
- 'contentType': 'applications/json'
|
|
|
- },
|
|
|
+ header: { 'contentType': 'applications/json' },
|
|
|
credentials: 'same-origin',
|
|
|
body: JSON.stringify({
|
|
|
'idGroup': idGroup,
|
|
@@ -730,7 +728,6 @@ function addPracownikToGroup(event) {
|
|
|
return response.text();
|
|
|
})
|
|
|
.then(function(responseText) {
|
|
|
-
|
|
|
try {
|
|
|
return JSON.parse(responseText);
|
|
|
} catch (e) {
|
|
@@ -738,7 +735,6 @@ function addPracownikToGroup(event) {
|
|
|
}
|
|
|
})
|
|
|
.then(function(result) {
|
|
|
-
|
|
|
if (result.type == 'success') {
|
|
|
p5UI__notifyAjaxCallback(result);
|
|
|
resolve(result.msg);
|
|
@@ -752,8 +748,12 @@ function addPracownikToGroup(event) {
|
|
|
})
|
|
|
},
|
|
|
allowOutsideClick: false
|
|
|
- }).then(function (groupPracownicyData) {
|
|
|
- //TODO: pIOTRKU CZY TU POWINIENEM COŚ JESZCZE OBSŁUŻYĆ
|
|
|
+ }).then(function (value) {
|
|
|
+ { // remove from selected
|
|
|
+ setItemLocalStorage('Bocian.biAuditForm.pracownicyIds', []);
|
|
|
+ updateCountItemCheckedByType('pracownicy');
|
|
|
+ $('form').find(':checkbox').prop('checked', false);
|
|
|
+ }
|
|
|
});
|
|
|
}
|
|
|
|
|
@@ -879,7 +879,6 @@ function addKontrahenciToGroup(event) {
|
|
|
showLoaderOnConfirm: true,
|
|
|
preConfirm: function (idGroup) {
|
|
|
return new Promise(function (resolve, reject) {
|
|
|
-
|
|
|
if (!idGroup) {
|
|
|
reject('Proszę wybrać nazwę grupy');
|
|
|
return;
|
|
@@ -891,9 +890,7 @@ function addKontrahenciToGroup(event) {
|
|
|
|
|
|
window.fetch(URL_ADD_KONTRAHENCI_TO_GROUP, {
|
|
|
method: 'POST',
|
|
|
- header: {
|
|
|
- 'contentType': 'applications/json'
|
|
|
- },
|
|
|
+ header: { 'contentType': 'applications/json' },
|
|
|
credentials: 'same-origin',
|
|
|
body: JSON.stringify({
|
|
|
'idGroup': idGroup,
|
|
@@ -904,7 +901,6 @@ function addKontrahenciToGroup(event) {
|
|
|
return response.text();
|
|
|
})
|
|
|
.then(function(responseText) {
|
|
|
-
|
|
|
try {
|
|
|
return JSON.parse(responseText);
|
|
|
} catch (e) {
|
|
@@ -912,7 +908,6 @@ function addKontrahenciToGroup(event) {
|
|
|
}
|
|
|
})
|
|
|
.then(function(result) {
|
|
|
- result
|
|
|
if (result.type == 'success') {
|
|
|
p5UI__notifyAjaxCallback(result);
|
|
|
resolve(result.msg);
|
|
@@ -920,12 +915,18 @@ function addKontrahenciToGroup(event) {
|
|
|
reject(result.msg);
|
|
|
}
|
|
|
})
|
|
|
- ;
|
|
|
+ .catch(function(error) {
|
|
|
+ if(DBG) console.warn('request failed', error);
|
|
|
+ });
|
|
|
})
|
|
|
},
|
|
|
allowOutsideClick: false
|
|
|
- }).then(function (groupKontrahenciData) {
|
|
|
- //TODO: PIOTRKU CZY TU POWINIENEM COŚ JESZCZE OBSŁUŻYĆ
|
|
|
+ }).then(function (value) {
|
|
|
+ { // remove from selected
|
|
|
+ setItemLocalStorage('Bocian.biAuditForm.kontrahenciIds', []);
|
|
|
+ updateCountItemCheckedByType('kontrahenci');
|
|
|
+ $('form').find(':checkbox').prop('checked', false);
|
|
|
+ }
|
|
|
});
|
|
|
}
|
|
|
function addKontrahenciAllToGroup(event) {
|
|
@@ -1017,7 +1018,7 @@ function addKontrahenciAllToGroup(event) {
|
|
|
});
|
|
|
}
|
|
|
|
|
|
-function removeKontrahenciFromGroup(event){
|
|
|
+function removeKontrahenciFromGroup(event) {
|
|
|
event.preventDefault;
|
|
|
|
|
|
var kontrahenciIdsArray = getItemLocalStorage('Bocian.biAuditForm.kontrahenciIds');
|
|
@@ -1027,10 +1028,10 @@ function removeKontrahenciFromGroup(event){
|
|
|
showTextListIdKontrahentow = '' + kontrahenciIdsArray.length + ' podmiotów/kontrahentów';
|
|
|
}
|
|
|
|
|
|
- var groupId = localStorage.getItem("Bocian.biAuditForm.kontrahenci.filterIdGroup");
|
|
|
+ var groupId = getItemLocalStorage("Bocian.biAuditForm.kontrahenci.filterIdGroup");
|
|
|
var removeTitle = "Czy chcesz usunąć z "
|
|
|
- if(groupId === "0"){
|
|
|
- removeTitle+= "systemu";
|
|
|
+ if (groupId === "0") {
|
|
|
+ removeTitle += "systemu";
|
|
|
} else {
|
|
|
var arrayGroupOptions = [];
|
|
|
var listGroupStorage = getItemLocalStorage('Bocian.biAuditForm.kontrahenci.groups');
|
|
@@ -1040,18 +1041,19 @@ function removeKontrahenciFromGroup(event){
|
|
|
arrayGroupOptions[item.ID] = item.NAZWA;
|
|
|
}
|
|
|
});
|
|
|
- removeTitle+= "grupy ";
|
|
|
- removeTitle+= arrayGroupOptions[groupId];
|
|
|
+ removeTitle += "grupy ";
|
|
|
+ removeTitle += arrayGroupOptions[groupId];
|
|
|
}
|
|
|
swal({
|
|
|
title: removeTitle,
|
|
|
text: showTextListIdKontrahentow,
|
|
|
+ showConfirmButton: true,
|
|
|
showCancelButton: true,
|
|
|
- confirmButtonText: 'Submit',
|
|
|
+ confirmButtonText: 'Usuń',
|
|
|
+ cancelButtonText: 'Anuluj',
|
|
|
showLoaderOnConfirm: true,
|
|
|
preConfirm: function () {
|
|
|
return new Promise(function (resolve, reject) {
|
|
|
-
|
|
|
if (!kontrahenciIdsArray || !kontrahenciIdsArray.length) {
|
|
|
reject('Wybierz kontrahentów');
|
|
|
return;
|
|
@@ -1059,9 +1061,7 @@ function removeKontrahenciFromGroup(event){
|
|
|
|
|
|
window.fetch(URL_REMOVE_KONTRAHENCI_FROM_GROUP, {
|
|
|
method: 'POST',
|
|
|
- header: {
|
|
|
- 'contentType': 'applications/json'
|
|
|
- },
|
|
|
+ header: { 'contentType': 'applications/json' },
|
|
|
credentials: 'same-origin',
|
|
|
body: JSON.stringify({
|
|
|
'idGroup': getItemLocalStorage('Bocian.biAuditForm.kontrahenci.filterIdGroup'),
|
|
@@ -1072,7 +1072,6 @@ function removeKontrahenciFromGroup(event){
|
|
|
return response.text();
|
|
|
})
|
|
|
.then(function(responseText) {
|
|
|
-
|
|
|
try {
|
|
|
return JSON.parse(responseText);
|
|
|
} catch (e) {
|
|
@@ -1083,7 +1082,6 @@ function removeKontrahenciFromGroup(event){
|
|
|
result
|
|
|
if (result.type == 'success') {
|
|
|
p5UI__notifyAjaxCallback(result);
|
|
|
- defaultBIAuditLocalStorage();
|
|
|
updateTopCounters();
|
|
|
$('#smad-table-KONTRAHENCI form').find(':checkbox').prop('checked', false);
|
|
|
resolve(result.msg);
|
|
@@ -1091,12 +1089,19 @@ function removeKontrahenciFromGroup(event){
|
|
|
reject(result.msg);
|
|
|
}
|
|
|
})
|
|
|
- ;
|
|
|
})
|
|
|
},
|
|
|
allowOutsideClick: false
|
|
|
}).then((result) => {
|
|
|
-
|
|
|
+ if (!result) return;
|
|
|
+ if (result.dismiss) return;
|
|
|
+ if (!result.value) return;
|
|
|
+ { // remove from selected
|
|
|
+ setItemLocalStorage('Bocian.biAuditForm.kontrahenciIds', []);
|
|
|
+ updateCountItemCheckedByType('kontrahenci');
|
|
|
+ $('#smad-table-KONTRAHENCI form').find(':checkbox').prop('checked', false);
|
|
|
+ }
|
|
|
+ urlFetchKontrahenci(1);
|
|
|
});
|
|
|
}
|
|
|
|
|
@@ -1109,10 +1114,10 @@ function removePracownikFromGroup(event){
|
|
|
} else {
|
|
|
showTextListIdPracownikow = '' + pracownicyIdsArray.length + ' osób';
|
|
|
}
|
|
|
- var groupId = localStorage.getItem("Bocian.biAuditForm.pracownicy.filterIdGroup");
|
|
|
+ var groupId = getItemLocalStorage('Bocian.biAuditForm.pracownicy.filterIdGroup');
|
|
|
var removeTitle = "Czy chcesz usunąć z "
|
|
|
- if(groupId === "0"){
|
|
|
- removeTitle+= "systemu";
|
|
|
+ if (!groupId) {
|
|
|
+ removeTitle += "systemu";
|
|
|
} else {
|
|
|
var arrayGroupOptions = [];
|
|
|
var listGroupStorage = getItemLocalStorage('Bocian.biAuditForm.pracownicy.groups');
|
|
@@ -1122,18 +1127,19 @@ function removePracownikFromGroup(event){
|
|
|
arrayGroupOptions[item.ID] = item.NAZWA;
|
|
|
}
|
|
|
});
|
|
|
- removeTitle+= "grupy ";
|
|
|
- removeTitle+= arrayGroupOptions[groupId];
|
|
|
+ removeTitle += "grupy ";
|
|
|
+ removeTitle += arrayGroupOptions[groupId];
|
|
|
}
|
|
|
swal({
|
|
|
title: removeTitle,
|
|
|
text: showTextListIdPracownikow,
|
|
|
+ showConfirmButton: true,
|
|
|
showCancelButton: true,
|
|
|
- confirmButtonText: 'Submit',
|
|
|
+ confirmButtonText: 'Usuń',
|
|
|
+ cancelButtonText: 'Anuluj',
|
|
|
showLoaderOnConfirm: true,
|
|
|
preConfirm: function () {
|
|
|
return new Promise(function (resolve, reject) {
|
|
|
-
|
|
|
if (!pracownicyIdsArray || !pracownicyIdsArray.length) {
|
|
|
reject('Wybierz osoby');
|
|
|
return;
|
|
@@ -1141,9 +1147,7 @@ function removePracownikFromGroup(event){
|
|
|
|
|
|
window.fetch(URL_REMOVE_PRACOWNICY_FROM_GROUP, {
|
|
|
method: 'POST',
|
|
|
- header: {
|
|
|
- 'contentType': 'applications/json'
|
|
|
- },
|
|
|
+ header: { 'contentType': 'applications/json' },
|
|
|
credentials: 'same-origin',
|
|
|
body: JSON.stringify({
|
|
|
'idGroup': getItemLocalStorage('Bocian.biAuditForm.pracownicy.filterIdGroup'),
|
|
@@ -1154,7 +1158,6 @@ function removePracownikFromGroup(event){
|
|
|
return response.text();
|
|
|
})
|
|
|
.then(function(responseText) {
|
|
|
-
|
|
|
try {
|
|
|
return JSON.parse(responseText);
|
|
|
} catch (e) {
|
|
@@ -1162,10 +1165,8 @@ function removePracownikFromGroup(event){
|
|
|
}
|
|
|
})
|
|
|
.then(function(result) {
|
|
|
- result
|
|
|
if (result.type == 'success') {
|
|
|
p5UI__notifyAjaxCallback(result);
|
|
|
- defaultBIAuditLocalStorage();
|
|
|
updateTopCounters();
|
|
|
$('#smad-table-PRACOWNICY form').find(':checkbox').prop('checked', false);
|
|
|
resolve(result.msg);
|
|
@@ -1173,12 +1174,19 @@ function removePracownikFromGroup(event){
|
|
|
reject(result.msg);
|
|
|
}
|
|
|
})
|
|
|
- ;
|
|
|
})
|
|
|
},
|
|
|
allowOutsideClick: false
|
|
|
}).then((result) => {
|
|
|
-
|
|
|
+ if (!result) return;
|
|
|
+ if (result.dismiss) return;
|
|
|
+ if (!result.value) return;
|
|
|
+ { // remove from selected
|
|
|
+ setItemLocalStorage('Bocian.biAuditForm.pracownicyIds', []);
|
|
|
+ updateCountItemCheckedByType('pracownicy');
|
|
|
+ $('#smad-table-PRACOWNICY form').find(':checkbox').prop('checked', false);
|
|
|
+ }
|
|
|
+ urlFetchPracownicy(1);
|
|
|
});
|
|
|
|
|
|
}
|
|
@@ -1194,13 +1202,14 @@ function createGroupKontrahenci(event) {
|
|
|
showLoaderOnConfirm: true,
|
|
|
preConfirm: function (NAZWA) {
|
|
|
return new Promise(function (resolve, reject) {
|
|
|
- if (!NAZWA) reject('Proszę podać nazwę grupy');
|
|
|
+ if (!NAZWA) {
|
|
|
+ reject('Proszę podać nazwę grupy');
|
|
|
+ return;
|
|
|
+ }
|
|
|
|
|
|
- window.fetch(URL_CREATE_KONTRAHENCIS_GROUP, {
|
|
|
+ window.fetch(URL_CREATE_PRACOWNICY_GROUP, {
|
|
|
method: 'POST',
|
|
|
- header: {
|
|
|
- 'contentType': 'applications/json'
|
|
|
- },
|
|
|
+ header: { 'contentType': 'applications/json' },
|
|
|
credentials: 'same-origin',
|
|
|
body: JSON.stringify({
|
|
|
'NAZWA': NAZWA
|
|
@@ -1210,7 +1219,6 @@ function createGroupKontrahenci(event) {
|
|
|
return response.text();
|
|
|
})
|
|
|
.then(function(responseText) {
|
|
|
-
|
|
|
try {
|
|
|
return JSON.parse(responseText);
|
|
|
} catch (e) {
|
|
@@ -1218,26 +1226,38 @@ function createGroupKontrahenci(event) {
|
|
|
}
|
|
|
})
|
|
|
.then(function(result) {
|
|
|
-
|
|
|
if (result.type == 'success') {
|
|
|
- fetchGroupKontrahenci();
|
|
|
p5UI__notifyAjaxCallback(result);
|
|
|
resolve(result.body);
|
|
|
} else {
|
|
|
-
|
|
|
reject("Proszę podać inną nazwę grupy");
|
|
|
}
|
|
|
})
|
|
|
.catch(function(error) {
|
|
|
- if(DBG) console.log('request failed', error);
|
|
|
+ if(DBG) console.log('request failed', error);
|
|
|
})
|
|
|
})
|
|
|
},
|
|
|
allowOutsideClick: false
|
|
|
- }).then(function (groupKontrahenciData) {
|
|
|
- //TODO: aktualizacja fitrów na widoku -> SPrawdzić co dostaniemy w odpowiedzi po dodaniu filtra grupy
|
|
|
- groupsKontrahenci = '<button class="btn btn-default" title="'+groupKontrahenciData['nazwa']+'" data-group-filter="'+groupKontrahenciData['id']+'">'+groupKontrahenciData['nazwa']+'</button>';
|
|
|
- $('#group-kontrahenci').append(groupsKontrahenci);
|
|
|
+ }).then(function (result) {
|
|
|
+ if (!result) return;
|
|
|
+ if (result.dismiss) return;
|
|
|
+ if (!result.value) return;
|
|
|
+ // NOTE: swal has input, so resolver object from preConfirm is in { value: resolvedObject }
|
|
|
+ var addedGroup = result.value;
|
|
|
+ if (addedGroup.id && addedGroup.nazwa) {
|
|
|
+ $('#group-kontrahenci').append('<button class="btn btn-default" title="'+addedGroup['nazwa']+'" data-group-filter="'+addedGroup['id']+'">'+addedGroup['nazwa']+'</button>');
|
|
|
+ { // add group to local storage
|
|
|
+ setItemLocalStorage(
|
|
|
+ 'Bocian.biAuditForm.kontrahenci.groups',
|
|
|
+ [].concat(
|
|
|
+ getItemLocalStorage('Bocian.biAuditForm.kontrahenci.groups') || [],
|
|
|
+ [ { 'ID': addedGroup.id, 'NAZWA': addedGroup.nazwa } ]
|
|
|
+ )
|
|
|
+ );
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //TODO: aktualizacja fitrów na widoku -> SPrawdzić co dostaniemy w odpowiedzi po dodaniu filtra grupy
|
|
|
});
|
|
|
|
|
|
}
|
|
@@ -1253,13 +1273,14 @@ function createGroupPracownicy(event) {
|
|
|
showLoaderOnConfirm: true,
|
|
|
preConfirm: function (NAZWA) {
|
|
|
return new Promise(function (resolve, reject) {
|
|
|
- if (!NAZWA) reject('Proszę podać nazwę grupy');
|
|
|
+ if (!NAZWA) {
|
|
|
+ reject('Proszę podać nazwę grupy');
|
|
|
+ return;
|
|
|
+ }
|
|
|
|
|
|
window.fetch(URL_CREATE_PRACOWNICY_GROUP, {
|
|
|
method: 'POST',
|
|
|
- header: {
|
|
|
- 'contentType': 'applications/json'
|
|
|
- },
|
|
|
+ header: { 'contentType': 'applications/json' },
|
|
|
credentials: 'same-origin',
|
|
|
body: JSON.stringify({
|
|
|
'NAZWA': NAZWA
|
|
@@ -1269,7 +1290,6 @@ function createGroupPracownicy(event) {
|
|
|
return response.text();
|
|
|
})
|
|
|
.then(function(responseText) {
|
|
|
-
|
|
|
try {
|
|
|
return JSON.parse(responseText);
|
|
|
} catch (e) {
|
|
@@ -1277,9 +1297,8 @@ function createGroupPracownicy(event) {
|
|
|
}
|
|
|
})
|
|
|
.then(function(result) {
|
|
|
-
|
|
|
+ console.warn('DBG group added? result', result)
|
|
|
if (result.type == 'success') {
|
|
|
- fetchGroupPracownicy();
|
|
|
p5UI__notifyAjaxCallback(result);
|
|
|
resolve(result.body);
|
|
|
} else {
|
|
@@ -1293,13 +1312,25 @@ function createGroupPracownicy(event) {
|
|
|
})
|
|
|
},
|
|
|
allowOutsideClick: false
|
|
|
- }).then(function (groupPracownicyData) {
|
|
|
- if(DBG) console.log('grupa prac2: ', groupPracownicyData);
|
|
|
-
|
|
|
+ }).then(function (result) {
|
|
|
+ if (!result) return;
|
|
|
+ if (result.dismiss) return;
|
|
|
+ if (!result.value) return;
|
|
|
+ // NOTE: swal has input, so resolver object from preConfirm is in { value: resolvedObject }
|
|
|
+ var addedGroup = result.value;
|
|
|
+ if (addedGroup.id && addedGroup.nazwa) {
|
|
|
+ $('#group-pracownicy').append('<button class="btn btn-default" title="'+addedGroup['nazwa']+'" data-group-filter="'+addedGroup['id']+'">'+addedGroup['nazwa']+'</button>');
|
|
|
+ { // add group to local storage
|
|
|
+ setItemLocalStorage(
|
|
|
+ 'Bocian.biAuditForm.pracownicy.groups',
|
|
|
+ [].concat(
|
|
|
+ getItemLocalStorage('Bocian.biAuditForm.pracownicy.groups') || [],
|
|
|
+ [ { 'ID': addedGroup.id, 'NAZWA': addedGroup.nazwa } ]
|
|
|
+ )
|
|
|
+ );
|
|
|
+ }
|
|
|
+ }
|
|
|
//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);
|
|
|
-
|
|
|
});
|
|
|
|
|
|
}
|
|
@@ -1956,99 +1987,93 @@ function updateListIdBiAuditReaport(type, valueArray) {
|
|
|
}
|
|
|
|
|
|
function deleteListIdBiAuditReaport(type, valueArray) {
|
|
|
-
|
|
|
- var currentStoragePracownicyIds = [];
|
|
|
- var updateListPracownicyIds = null;
|
|
|
-
|
|
|
if ( type == 'PRACOWNICY') {
|
|
|
deleteItemLocalStorage('Bocian.biAuditForm.pracownicyIds', valueArray);
|
|
|
}
|
|
|
-
|
|
|
if ( type == 'KONTRAHENCI') {
|
|
|
deleteItemLocalStorage('Bocian.biAuditForm.kontrahenciIds', valueArray);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-// filter group detect
|
|
|
function fetchGroupPracownicy() {
|
|
|
- fetch(URL_FETCH_GROUP_PRACOWNICY, {
|
|
|
- credentials: 'same-origin'
|
|
|
- })
|
|
|
- .then(function parseJSON(response) {
|
|
|
- return response.json()
|
|
|
- })
|
|
|
- .then(function(data) {
|
|
|
- setItemLocalStorage('Bocian.biAuditForm.pracownicy.groups', data.body.itmesGroupPracownicy);
|
|
|
+ fetch(URL_FETCH_GROUP_PRACOWNICY, {
|
|
|
+ credentials: 'same-origin'
|
|
|
+ })
|
|
|
+ .then(function parseJSON(response) {
|
|
|
+ return response.json()
|
|
|
+ })
|
|
|
+ .then(function(data) {
|
|
|
+ setItemLocalStorage('Bocian.biAuditForm.pracownicy.groups', data.body.itmesGroupPracownicy);
|
|
|
|
|
|
- if (data.body.itmesGroupPracownicy === null) {
|
|
|
- return;
|
|
|
- }
|
|
|
+ if (data.body.itmesGroupPracownicy === null) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
|
|
|
- var filterIdGroup = getItemLocalStorage('Bocian.biAuditForm.pracownicy.filterIdGroup');
|
|
|
- var currentDepthValue = getItemLocalStorage('Bocian.biAuditForm.depth');
|
|
|
- setItemLocalStorage('Bocian.biAuditForm.pracownicy.filterIdGroup', filterIdGroup);
|
|
|
+ var filterIdGroup = getItemLocalStorage('Bocian.biAuditForm.pracownicy.filterIdGroup');
|
|
|
+ var currentDepthValue = getItemLocalStorage('Bocian.biAuditForm.depth');
|
|
|
+ setItemLocalStorage('Bocian.biAuditForm.pracownicy.filterIdGroup', filterIdGroup);
|
|
|
|
|
|
- setItemLocalStorage('Bocian.biAuditForm.depth', currentDepthValue);
|
|
|
+ setItemLocalStorage('Bocian.biAuditForm.depth', currentDepthValue);
|
|
|
|
|
|
- var groupsPracownicy = '';
|
|
|
- var activeButton = '';
|
|
|
+ var groupsPracownicy = '';
|
|
|
+ var activeButton = '';
|
|
|
|
|
|
- data.body.itmesGroupPracownicy.forEach (function(row) {
|
|
|
- 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>';
|
|
|
- });
|
|
|
- $('#group-pracownicy').empty();
|
|
|
- $("#group-pracownicy").append(groupsPracownicy);
|
|
|
- updateCountItemCheckedByType('pracownicy');
|
|
|
+ data.body.itmesGroupPracownicy.forEach (function(row) {
|
|
|
+ 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>';
|
|
|
+ });
|
|
|
+ $("#group-pracownicy").append(groupsPracownicy);
|
|
|
+ updateCountItemCheckedByType('pracownicy');
|
|
|
|
|
|
- // detect filter group
|
|
|
- detectChoiseFilter();
|
|
|
- }).catch(function(error) {
|
|
|
- if(DBG) console.log('request failed', error)
|
|
|
- });
|
|
|
+ detectChoiseFilter();
|
|
|
+ }).catch(function(error) {
|
|
|
+ if(DBG) console.log('request failed', error)
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
function fetchGroupKontrahenci() {
|
|
|
+ fetch(URL_FETCH_GROUP_KONTRAHENCI, {
|
|
|
+ credentials: 'same-origin'
|
|
|
+ })
|
|
|
+ .then(function parseJSON(response) {
|
|
|
+ return response.json()
|
|
|
+ })
|
|
|
+ .then(function(data) {
|
|
|
+ setItemLocalStorage('Bocian.biAuditForm.kontrahenci.groups', data.body.itemsGroupKontrahenci);
|
|
|
|
|
|
- fetch(URL_FETCH_GROUP_KONTRAHENCI, {
|
|
|
- credentials: 'same-origin'
|
|
|
- })
|
|
|
- .then(function parseJSON(response) {
|
|
|
- return response.json()
|
|
|
- })
|
|
|
- .then(function(data) {
|
|
|
- setItemLocalStorage('Bocian.biAuditForm.kontrahenci.groups', data.body.itemsGroupKontrahenci);
|
|
|
-
|
|
|
- if (data.body.itemsGroupKontrahenci === null) {
|
|
|
- return;
|
|
|
- }
|
|
|
+ if (data.body.itemsGroupKontrahenci === null) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
|
|
|
- var filterIdGroup = getItemLocalStorage('Bocian.biAuditForm.kontrahenci.filterIdGroup');
|
|
|
- var currentDepthValue = getItemLocalStorage('Bocian.biAuditForm.depth');
|
|
|
- setItemLocalStorage('Bocian.biAuditForm.kontrahenci.filterIdGroup', filterIdGroup);
|
|
|
+ var filterIdGroup = getItemLocalStorage('Bocian.biAuditForm.kontrahenci.filterIdGroup');
|
|
|
+ var currentDepthValue = getItemLocalStorage('Bocian.biAuditForm.depth');
|
|
|
+ setItemLocalStorage('Bocian.biAuditForm.kontrahenci.filterIdGroup', filterIdGroup);
|
|
|
|
|
|
- setItemLocalStorage('Bocian.biAuditForm.depth', currentDepthValue);
|
|
|
+ setItemLocalStorage('Bocian.biAuditForm.depth', currentDepthValue);
|
|
|
|
|
|
- var groupsKontrahenci = '';
|
|
|
- var activeButton = '';
|
|
|
+ var groupsKontrahenci = '';
|
|
|
+ var activeButton = '';
|
|
|
|
|
|
- data.body.itemsGroupKontrahenci.forEach (function(row) {
|
|
|
- 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>';
|
|
|
- });
|
|
|
+ data.body.itemsGroupKontrahenci.forEach (function(row) {
|
|
|
+ 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>';
|
|
|
+ });
|
|
|
|
|
|
- $("#group-kontrahenci").append(groupsKontrahenci);
|
|
|
- updateCountItemCheckedByType('kontrahenci');
|
|
|
+ $("#group-kontrahenci").append(groupsKontrahenci);
|
|
|
+ updateCountItemCheckedByType('kontrahenci');
|
|
|
|
|
|
- // detect filter group
|
|
|
- detectChoiseFilter();
|
|
|
- if(DBG) console.log('request succeeded with JSON fetchGroupKontrahenci', data.body.itemsGroupKontrahenci);
|
|
|
- }).catch(function(error) {
|
|
|
- if(DBG) console.log('request failed', error)
|
|
|
- });
|
|
|
+ detectChoiseFilter();
|
|
|
+ }).catch(function(error) {
|
|
|
+ if(DBG) console.log('request failed', error)
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
|
|
@@ -2648,7 +2673,7 @@ global.addKontrahenciAllToGroup = addKontrahenciAllToGroup;
|
|
|
global.createPracownikAjax = createPracownikAjax;
|
|
|
global.createKontrahentAjax = createKontrahentAjax;
|
|
|
global.removePracownikFromGroup = removePracownikFromGroup;
|
|
|
-global.removeKontrahenciFromGroup= removeKontrahenciFromGroup;
|
|
|
+global.removeKontrahenciFromGroup = removeKontrahenciFromGroup;
|
|
|
|
|
|
global.showViewUploadFile = showViewUploadFile;
|
|
|
global.parseCsvFile = parseCsvFile;
|