|
@@ -196,7 +196,6 @@ console.log( 'parseCsvFile fileData', fileData);
|
|
|
console.log('catch: ', e)
|
|
|
});
|
|
|
|
|
|
- // return json;
|
|
|
}).catch(function(ex) {
|
|
|
console.log('parsing failed', ex)
|
|
|
});
|
|
@@ -254,6 +253,8 @@ function defaultBIAuditLocalStorage() {
|
|
|
setItemLocalStorage('Bocian.biAuditForm.depth', 2);
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
function generateBiAuditRaport(event) {
|
|
|
event.preventDefault();
|
|
|
|
|
@@ -312,29 +313,42 @@ function generateBiAuditRaport(event) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+/**
|
|
|
+ * Popup z opcja przeniesienia pracowników do innej grupy
|
|
|
+ */
|
|
|
function addPracownikToGroup(event) {
|
|
|
event.preventDefault();
|
|
|
|
|
|
var pracownicyIdsArray = getItemLocalStorage('Bocian.biAuditForm.pracownicyIds');
|
|
|
-
|
|
|
+ console.log(pracownicyIdsArray);
|
|
|
if (pracownicyIdsArray === null) {
|
|
|
showTextListIdPracownikow = 'ID pracowników: nie wybrano';
|
|
|
} else {
|
|
|
showTextListIdPracownikow = 'ID pracowników: ' + pracownicyIdsArray;
|
|
|
}
|
|
|
|
|
|
+ var arrayGroupOptions = [];
|
|
|
+ var listGroupStorage = getItemLocalStorage('Bocian.biAuditForm.pracownicy.groups');
|
|
|
+ // utworzenie tablicy Optionsów grupy
|
|
|
+ listGroupStorage.map(function(item) {
|
|
|
+ if (item.ID !== undefined) {
|
|
|
+ arrayGroupOptions[item.ID] = item.NAZWA;
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
swal({
|
|
|
title: 'Przenieś do grupy',
|
|
|
input: 'select',
|
|
|
text: showTextListIdPracownikow,
|
|
|
- inputOptions: getItemLocalStorage('Bocian.biAuditForm.pracownicy.groups'),
|
|
|
+ inputOptions: arrayGroupOptions,
|
|
|
inputPlaceholder: 'Wybierz grupę',
|
|
|
showCancelButton: true,
|
|
|
confirmButtonText: 'Zapisz',
|
|
|
showLoaderOnConfirm: true,
|
|
|
preConfirm: function (idGroup) {
|
|
|
return new Promise(function (resolve, reject) {
|
|
|
- console.log('value', idGroup);
|
|
|
+ console.log('idGrupy value', idGroup);
|
|
|
|
|
|
if ( !pracownicyIdsArray || pracownicyIdsArray === null || pracownicyIdsArray === 'undefined' ) {
|
|
|
reject('Wybierz pracowników');
|
|
@@ -385,22 +399,35 @@ function addPracownikToGroup(event) {
|
|
|
});
|
|
|
}
|
|
|
|
|
|
+/**
|
|
|
+ * Popup z opcja przeniesienia kontrahentów do innej grupy
|
|
|
+ */
|
|
|
function addKontrahenciToGroup(event) {
|
|
|
event.preventDefault();
|
|
|
|
|
|
var kontrahenciIdsArray = getItemLocalStorage('Bocian.biAuditForm.kontrahenciIds');
|
|
|
|
|
|
if (kontrahenciIdsArray === null) {
|
|
|
- showTextListIdKontrahentow = 'ID pracowników: nie wybrano';
|
|
|
+ showTextListIdKontrahentow = 'ID kontrahentów: nie wybrano';
|
|
|
} else {
|
|
|
- showTextListIdKontrahentow = 'ID pracowników: ' + pracownicyIdsArray;
|
|
|
+ showTextListIdKontrahentow = 'ID kontrahentów: ' + kontrahenciIdsArray;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ var arrayGroupOptions = [];
|
|
|
+ var listGroupStorage = getItemLocalStorage('Bocian.biAuditForm.kontrahenci.groups');
|
|
|
+ // utworzenie tablicy Optionsów grupy
|
|
|
+ listGroupStorage.map(function(item) {
|
|
|
+ if (item.ID !== undefined) {
|
|
|
+ arrayGroupOptions[item.ID] = item.NAZWA;
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
swal({
|
|
|
title: 'Przenieś do grupy',
|
|
|
input: 'select',
|
|
|
text: showTextListIdKontrahentow,
|
|
|
- inputOptions: getItemLocalStorage('Bocian.biAuditForm.kontrahenci.groups'),
|
|
|
+ inputOptions: arrayGroupOptions,
|
|
|
inputPlaceholder: 'Wybierz grupę',
|
|
|
showCancelButton: true,
|
|
|
confirmButtonText: 'Zapisz',
|
|
@@ -451,7 +478,7 @@ function addKontrahenciToGroup(event) {
|
|
|
},
|
|
|
allowOutsideClick: false
|
|
|
}).then(function (groupKontrahenciData) {
|
|
|
- //TODO: pIOTRKU CZY TU POWINIENEM COŚ JESZCZE OBSŁUŻYĆ
|
|
|
+ //TODO: PIOTRKU CZY TU POWINIENEM COŚ JESZCZE OBSŁUŻYĆ
|
|
|
});
|
|
|
}
|
|
|
|
|
@@ -639,6 +666,29 @@ function getAddressData(objectValue) {
|
|
|
return listData;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+/**
|
|
|
+ * Get name name group
|
|
|
+ */
|
|
|
+function getNameGroupById(store, filterIdGroup) {
|
|
|
+
|
|
|
+ var NAZWA = '';
|
|
|
+ if (!store || filterIdGroup === 0 ) {
|
|
|
+ NAZWA = 'Wszyscy';
|
|
|
+ } else {
|
|
|
+
|
|
|
+ $(store).each(function() {
|
|
|
+ if ( parseInt(filterIdGroup) === parseInt(this.ID) ) {
|
|
|
+ NAZWA = this.NAZWA;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ return NAZWA;
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
function urlFetchKontrahenci(page) {
|
|
|
var page = page || getItemLocalStorage('Bocian.biAuditForm.kontrahenci.pagination.page');
|
|
|
|
|
@@ -659,7 +709,7 @@ function urlFetchKontrahenci(page) {
|
|
|
})
|
|
|
.then(function(data) {
|
|
|
|
|
|
-console.log('URL_FETCH_KONTRAHENCI', data);
|
|
|
+
|
|
|
var listItemsKontrahenci = null;
|
|
|
data.body.items.forEach (function(row) {
|
|
|
listItemsKontrahenci += '<tr><td><input type="checkbox" name="kontrID[]" value="'+row['ID']+'" /></td>'+
|
|
@@ -712,9 +762,15 @@ console.log('URL_FETCH_KONTRAHENCI', data);
|
|
|
paginationShowNextCount = parseInt(data.body.pagination.limit) * (parseInt(data.body.pagination.current) - 1 ) + 1;
|
|
|
}
|
|
|
$('#paginationShowNextCount-KONTRAHENCI').text(paginationShowNextCount);
|
|
|
+ $('#smad-filter-desc-kontrahenci').text(data.body.pagination.total_items);
|
|
|
|
|
|
}
|
|
|
|
|
|
+ var groupSelectData = getNameGroupById(getItemLocalStorage('Bocian.biAuditForm.kontrahenci.groups'), filterIdGroup);
|
|
|
+ $('#smad-filter-head-title-kontrahenci').text(groupSelectData);
|
|
|
+ console.log('kontrahenci groupSelectData: ', groupSelectData);
|
|
|
+
|
|
|
+
|
|
|
$( "#body-kontrahenci" ).html(listItemsKontrahenci);
|
|
|
checkAll('KONTRAHENCI');
|
|
|
catchEventCheckbox('KONTRAHENCI');
|
|
@@ -791,10 +847,15 @@ function urlFetchPracownicy(page) {
|
|
|
paginationShowNextCount = parseInt(data.body.pagination.limit) * (parseInt(data.body.pagination.current) - 1 ) + 1;
|
|
|
}
|
|
|
$('#paginationShowNextCount-PRACOWNICY').text(paginationShowNextCount);
|
|
|
-
|
|
|
+ $('#smad-filter-desc-pracownicy').text(data.body.pagination.total_items);
|
|
|
}
|
|
|
|
|
|
|
|
|
+ // wyświetlenie wybranej grupy w naglówku nad tabela
|
|
|
+ var groupSelectData = getNameGroupById(getItemLocalStorage('Bocian.biAuditForm.pracownicy.groups'), filterIdGroup);
|
|
|
+ $('#smad-filter-head-title-pracownicy').text(groupSelectData);
|
|
|
+
|
|
|
+ // zaladaowanie listy pracowników
|
|
|
$( "#body-pracownicy" ).html( listItemsPracownik);
|
|
|
checkAll('PRACOWNICY');
|
|
|
catchEventCheckbox('PRACOWNICY');
|
|
@@ -1086,6 +1147,13 @@ function detectChoiseFilter() {
|
|
|
|
|
|
// pobranie id grupy kliknietego buttonu
|
|
|
var filterIdGroup = $(this).attr("data-group-filter");
|
|
|
+ // aktaulna wartość zagłebienia
|
|
|
+ var currentDepthValue = getItemLocalStorage('Bocian.biAuditForm.depth');
|
|
|
+ //reset LocalStorage
|
|
|
+ defaultBIAuditLocalStorage();
|
|
|
+ // ustawienie ostaniej wartości zagłebienia przed resete
|
|
|
+ setItemLocalStorage('Bocian.biAuditForm.depth', currentDepthValue);
|
|
|
+
|
|
|
// ustawić id grupy do sesyjnej
|
|
|
setItemLocalStorage('Bocian.biAuditForm.kontrahenci.filterIdGroup', parseInt(filterIdGroup));
|
|
|
// wywylac funckje pobrania danych
|
|
@@ -1099,6 +1167,13 @@ function detectChoiseFilter() {
|
|
|
|
|
|
// pobranie id grupy kliknietego buttonu
|
|
|
var filterIdGroup = $(this).attr("data-group-filter");
|
|
|
+ // aktaulna wartość zagłebienia
|
|
|
+ var currentDepthValue = getItemLocalStorage('Bocian.biAuditForm.depth');
|
|
|
+ //reset LocalStorage
|
|
|
+ defaultBIAuditLocalStorage();
|
|
|
+ // ustawienie ostaniej wartości zagłebienia przed resete
|
|
|
+ setItemLocalStorage('Bocian.biAuditForm.depth', currentDepthValue);
|
|
|
+
|
|
|
// ustawić id grupy do sesyjnej
|
|
|
setItemLocalStorage('Bocian.biAuditForm.pracownicy.filterIdGroup', parseInt(filterIdGroup));
|
|
|
// wywylac funckje pobrania danych
|
|
@@ -1378,6 +1453,7 @@ global.checkAll = checkAll;
|
|
|
global.checkedChoiseItems = checkedChoiseItems;
|
|
|
global.catchEventCheckbox = catchEventCheckbox;
|
|
|
global.clearSelectedCheckbox = clearSelectedCheckbox;
|
|
|
+global.getNameGroupById = getNameGroupById;
|
|
|
global.createGroupPracownicy = createGroupPracownicy;
|
|
|
global.createGroupKontrahenci = createGroupKontrahenci;
|
|
|
global.selectPage = selectPage;
|
|
@@ -1402,6 +1478,7 @@ global.removeItemInArray = removeItemInArray;
|
|
|
global.removeItemArrayInArray = removeItemArrayInArray;
|
|
|
|
|
|
global.addPracownikToGroup = addPracownikToGroup;
|
|
|
+global.addKontrahenciToGroup = addKontrahenciToGroup;
|
|
|
|
|
|
global.showViewUploadFile = showViewUploadFile;
|
|
|
global.parseCsvFile = parseCsvFile;
|