|
@@ -1,10 +1,3 @@
|
|
|
-console.log('test1... DBG:', DBG)
|
|
|
-
|
|
|
-// localStorage.setItem('Bocian.pracownicyIds', JSON.stringify(ids))
|
|
|
-// var ids = localStorage.getItem('Bocian.pracownicyIds')
|
|
|
-// localStorage.removeItem('Bocian.pracownicyIds')
|
|
|
-// localStorage.removeItem('Bocian.kontrahenciIds')
|
|
|
-// localStorage.removeItem('Bocian.depth') // TODO: zapis na stronie głównej i BiAuditRaport
|
|
|
|
|
|
if (!BASE_URLS) {
|
|
|
throw "Brak BASE_URLS"
|
|
@@ -17,7 +10,6 @@ $(window).on('hashchange', function() {
|
|
|
});
|
|
|
|
|
|
|
|
|
-
|
|
|
/* DATA FOR READ REAPORT */
|
|
|
|
|
|
function urlFetchKontrahenciPowiazania() {
|
|
@@ -38,7 +30,6 @@ function urlFetchKontrahenciPowiazania() {
|
|
|
|
|
|
$( "#body-reaport-kontrahenci-powiazani-tree" ).html(reaportItemsKontrahenciPowiazani);
|
|
|
|
|
|
- console.log('request succeeded with JSON response URL_FETCH_KONTRAHENCI_POWIAZANIA', data)
|
|
|
}).catch(function(error) {
|
|
|
console.log('request failed', error)
|
|
|
});
|
|
@@ -300,7 +291,7 @@ function generateBiAuditRaport(event) {
|
|
|
|
|
|
p5UI__notifyAjaxCallback(result);
|
|
|
defaultBIAuditLocalStorage();
|
|
|
- window.setTimeout(window.location.href = "/SE/index.php?_route=ViewTableAjax&namespace=default_db/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA", 4000);
|
|
|
+ window.setTimeout(window.location.href = "/SE/index.php?_route=ViewTableAjax&namespace=default_db/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA", 6000);
|
|
|
resolve(result.msg);
|
|
|
|
|
|
} else {
|
|
@@ -911,6 +902,9 @@ function checkAll(type) {
|
|
|
|
|
|
deleteListIdBiAuditReaport(type, allValsUnChecked);
|
|
|
}
|
|
|
+
|
|
|
+ // update count selected IDs
|
|
|
+ updateCountItemCheckedByType(type.toLowerCase());
|
|
|
});
|
|
|
}
|
|
|
|
|
@@ -919,6 +913,8 @@ function checkAll(type) {
|
|
|
*/
|
|
|
function checkedChoiseItems(type, store) {
|
|
|
|
|
|
+ updateCountItemCheckedByType(type.toLowerCase());
|
|
|
+
|
|
|
var idElement = 'smad-table-' + type;
|
|
|
|
|
|
// if id element exist
|
|
@@ -940,7 +936,6 @@ function checkedChoiseItems(type, store) {
|
|
|
|
|
|
}
|
|
|
|
|
|
- //$('#checkAll-' + type).on('bind', function() {
|
|
|
$('#smad-table-' + type + ' input[type=checkbox]').on( 'load', function() {
|
|
|
var itemsCHecked = getItemLocalStorage('Bocian.biAuditForm.pracownicyIds');
|
|
|
|
|
@@ -976,12 +971,10 @@ function checkedChoiseItems(type, store) {
|
|
|
|
|
|
deleteListIdBiAuditReaport(type, allValsUnChecked);
|
|
|
}
|
|
|
+
|
|
|
});
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
function catchEventCheckbox(type) {
|
|
|
|
|
|
$('#smad-table-' + type + ' input[type="checkbox"]').on('change', function() {
|
|
@@ -1001,6 +994,9 @@ function catchEventCheckbox(type) {
|
|
|
|
|
|
deleteListIdBiAuditReaport(type, allValsUnChecke);
|
|
|
}
|
|
|
+
|
|
|
+ // update count selected IDs
|
|
|
+ updateCountItemCheckedByType(type.toLowerCase());
|
|
|
});
|
|
|
|
|
|
}
|
|
@@ -1077,8 +1073,7 @@ function fetchGroupPracownicy() {
|
|
|
var filterIdGroup = getItemLocalStorage('Bocian.biAuditForm.pracownicy.filterIdGroup');
|
|
|
var currentDepthValue = getItemLocalStorage('Bocian.biAuditForm.depth');
|
|
|
setItemLocalStorage('Bocian.biAuditForm.pracownicy.filterIdGroup', filterIdGroup);
|
|
|
- //reset LocalStorage
|
|
|
- defaultBIAuditLocalStorage();
|
|
|
+
|
|
|
setItemLocalStorage('Bocian.biAuditForm.depth', currentDepthValue);
|
|
|
|
|
|
var groupsPracownicy = '';
|
|
@@ -1090,10 +1085,10 @@ function fetchGroupPracownicy() {
|
|
|
});
|
|
|
|
|
|
$("#group-pracownicy").append(groupsPracownicy);
|
|
|
+ updateCountItemCheckedByType('pracownicy');
|
|
|
|
|
|
-
|
|
|
-
|
|
|
- console.log('request succeeded with JSON fetchGroupPracownicy', data.body.itmesGroupPracownicy)
|
|
|
+ // detect filter group
|
|
|
+ detectChoiseFilter();
|
|
|
}).catch(function(error) {
|
|
|
console.log('request failed', error)
|
|
|
});
|
|
@@ -1117,8 +1112,7 @@ function fetchGroupKontrahenci() {
|
|
|
var filterIdGroup = getItemLocalStorage('Bocian.biAuditForm.kontrahenci.filterIdGroup');
|
|
|
var currentDepthValue = getItemLocalStorage('Bocian.biAuditForm.depth');
|
|
|
setItemLocalStorage('Bocian.biAuditForm.kontrahenci.filterIdGroup', filterIdGroup);
|
|
|
- //reset LocalStorage
|
|
|
- defaultBIAuditLocalStorage();
|
|
|
+
|
|
|
setItemLocalStorage('Bocian.biAuditForm.depth', currentDepthValue);
|
|
|
|
|
|
var groupsKontrahenci = '';
|
|
@@ -1130,7 +1124,10 @@ function fetchGroupKontrahenci() {
|
|
|
});
|
|
|
|
|
|
$("#group-kontrahenci").append(groupsKontrahenci);
|
|
|
+ updateCountItemCheckedByType('kontrahenci');
|
|
|
|
|
|
+ // detect filter group
|
|
|
+ detectChoiseFilter();
|
|
|
console.log('request succeeded with JSON fetchGroupKontrahenci', data.body.itemsGroupKontrahenci);
|
|
|
}).catch(function(error) {
|
|
|
console.log('request failed', error)
|
|
@@ -1224,6 +1221,7 @@ function removeItemInArray(arr, item) {
|
|
|
* item - array list items
|
|
|
*/
|
|
|
function removeItemArrayInArray(arr, itemsArray) {
|
|
|
+
|
|
|
for(var i = arr.length; i--;) {
|
|
|
for(var j = itemsArray.length; j--;) {
|
|
|
if(arr[i] === itemsArray[j]) {
|
|
@@ -1235,6 +1233,58 @@ function removeItemArrayInArray(arr, itemsArray) {
|
|
|
return arr;
|
|
|
}
|
|
|
|
|
|
+/**
|
|
|
+ * Cleart list local storage by type
|
|
|
+ * typeNameLocalStorage - name (praconwicy/kontrahenci)
|
|
|
+ */
|
|
|
+function clearListLocalStorageByType(typeNameLocalStorage) {
|
|
|
+
|
|
|
+ if (typeNameLocalStorage === 'pracownicy') {
|
|
|
+ setItemLocalStorage('Bocian.biAuditForm.pracownicyIds', []);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (typeNameLocalStorage === 'kontrahenci') {
|
|
|
+ setItemLocalStorage('Bocian.biAuditForm.kontrahenciIds', []);
|
|
|
+
|
|
|
+ }
|
|
|
+ // update count selected item
|
|
|
+ updateCountItemCheckedByType(typeNameLocalStorage);
|
|
|
+ // unchecked checkbox
|
|
|
+ $('#smad-table-'+typeNameLocalStorage.toUpperCase()+' form').find(':checkbox').prop('checked', false);
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * Update count selected pracowniyc/kontrahenci
|
|
|
+ */
|
|
|
+function updateCountItemCheckedByType(typeNameLocalStorage) {
|
|
|
+ var countId = 0;
|
|
|
+
|
|
|
+ if (typeNameLocalStorage === 'pracownicy') {
|
|
|
+ var countPracownicy = getItemLocalStorage('Bocian.biAuditForm.pracownicyIds');
|
|
|
+
|
|
|
+ if (countPracownicy !== null || countPracownicy !== undefined) {
|
|
|
+ return countId;
|
|
|
+ }
|
|
|
+
|
|
|
+ countId = Object.keys(countPracownicy).length;
|
|
|
+ $('#count-selected-item-pracownicy').text(countId);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (typeNameLocalStorage === 'kontrahenci') {
|
|
|
+ var countKontrahenci = getItemLocalStorage('Bocian.biAuditForm.kontrahenciIds');
|
|
|
+
|
|
|
+
|
|
|
+ if (countKontrahenci !== null || countKontrahenci !== undefined) {
|
|
|
+ return countId;
|
|
|
+ }
|
|
|
+
|
|
|
+ countId = Object.keys(countKontrahenci).length;
|
|
|
+ $('#count-selected-item-kontrahenci').text(countId);
|
|
|
+ }
|
|
|
+
|
|
|
+ return countId;
|
|
|
+}
|
|
|
+
|
|
|
// Pagination
|
|
|
var Pagination = {
|
|
|
|
|
@@ -1482,3 +1532,4 @@ global.addKontrahenciToGroup = addKontrahenciToGroup;
|
|
|
|
|
|
global.showViewUploadFile = showViewUploadFile;
|
|
|
global.parseCsvFile = parseCsvFile;
|
|
|
+global.clearListLocalStorageByType = clearListLocalStorageByType;
|