Explorar el Código

reset to commit Dariusz

a.binder hace 7 años
padre
commit
4caedf933a
Se han modificado 3 ficheros con 496 adiciones y 768 borrados
  1. 0 673
      theme/assets/css/styles.css
  2. 98 13
      theme/assets/less/styles.less
  3. 398 82
      tools/Bocian.php.view.js

La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 0 - 673
theme/assets/css/styles.css


+ 98 - 13
theme/assets/less/styles.less

@@ -1,5 +1,6 @@
 // Variables, Mixins
 @import "variables.less";
+@import "buttons.less";
 
 // html5
 article,
@@ -19,6 +20,7 @@ summary {
 /* MIX */
 body {
   margin: 0 0;
+  padding-bottom: 0!important;
   font-family: @font-primary;
   font-size: 17px;
   line-height: 27px;
@@ -33,6 +35,10 @@ strong {
   color: @brand-primary;
 }
 
+.link-primary {
+  color: @brand-primary!important;
+  cursor: pointer;
+}
 .font-weight-700 {
   font-weight: 700;
 }
@@ -44,6 +50,10 @@ strong {
   padding-left: 0;
   padding-right: 0;
 }
+.padding-top-bottom-25 {
+ padding-top: 25px;
+ padding-bottom: 25px;
+}
 .padding-bottom-25 {
   padding-bottom: 25px;
 }
@@ -68,6 +78,10 @@ strong {
   color: @brand-text-light;
 }
 
+.bg-white {
+  background-color: @brand-white!important;
+}
+
 .btn {
   padding-top: 10px;
   padding-bottom: 10px;
@@ -81,11 +95,48 @@ strong {
   border-bottom: 2px solid @brand-grey;
 }
 
+ul.breadcrumb {
+  background-color: @brand-white;
+  li {
+    a {
+      color: @brand-dark;
+      font-weight: 700;
+
+      &:first-child:before {
+        padding-right: 5px;
+        content: "|";
+        color: @brand-primary;
+      }
+    }
+  }
+}
+
+/* menu hamburger*/
+#hamburger-menu {
+  .smad-menu-title {
+    font-size: 11px;
+    height: 17px;
+    text-align: center;
+    color: @brand-primary;
+    font-weight: bold;
+  }
+
+  float: right;
+  .hamburger-menu-line {
+    width: 35px;
+    height: 3px;
+    background-color: @brand-dark;
+    margin: 6px 0;
+    text-align: right;
+
+  }
+}
+
 /** Bootstrap */
 .btn:focus,.btn:active {
   outline: none !important;
 }
-.btn-primary {
+/*.btn-primary {
   color: @brand-text;
   background-color: @brand-grey;
   border-color: @brand-grey;
@@ -99,9 +150,9 @@ strong {
   color: @brand-white;
   background-color: @brand-primary;
   border-color: @brand-primary;
-}
-
+}*/
 
+/*
 .btn-default {
   color: @brand-primary;
   background-color: @brand-white;
@@ -117,10 +168,10 @@ strong {
   color: @brand-white;
   background-color: @brand-primary;
   border-color: @brand-primary;
-}
+}*/
 
 
-.btn-default-red {
+/*.btn-default-red {
   color: @brand-white!important;
   background-color: @brand-primary;
   border-color: @brand-primary;
@@ -135,8 +186,8 @@ strong {
   color: @brand-primary!important;
   background-color: @brand-white;
   border-color: @brand-primary;
-}
-
+}*/
+/*
 .btn-grey-border {
   color: @brand-secondary!important;
   background-color: @brand-white;
@@ -152,8 +203,14 @@ strong {
   color: @brand-white!important;
   background-color: @brand-secondary;
   border-color: @brand-secondary;
+}*/
+
+/* Select option */
+.form-control {
+  height: 43px;
 }
 
+
 .col-centered {
   margin: 0 auto;
   float: none;
@@ -230,7 +287,7 @@ strong {
   }
 
   .menu-items {
-    padding-top: 35px;
+    padding-top: 20px;
     padding-bottom: 20px;
 
     .menu-item {
@@ -241,7 +298,7 @@ strong {
       display: inline-block;
 
       li {
-        padding: 0 10px;
+        padding: 0 7px;
         display: inline-block;
       }
     }
@@ -323,7 +380,6 @@ strong {
 
 /** Footer */
 footer {
-  position: fixed;
   height: 75px;
   bottom: 0;
   width: 100%;
@@ -366,10 +422,18 @@ footer {
 }
 
 
+
+/**
+ * Employees
+ */
+#smad-reaport-section {
+
+}
+
 /**
  * Employees
  */
-#smad-employees-section {
+#smad-employees-section, #smad-reaport-section  {
   /*Form Wizard*/
   .smad-wizard {
     margin-top: 0px;
@@ -395,6 +459,13 @@ footer {
 
     .step-item {
 
+      a {
+        color: @brand-primary;
+        &:focus, &:hover {
+          color: @brand-primary;
+        }
+      }
+
       .step-title {
         color: @brand-text-light;
       }
@@ -404,6 +475,12 @@ footer {
   .smad-wizard-step.complete {
     .step-item {
       color: @brand-primary;
+      a {
+        color: @brand-primary;
+        &:focus, &:hover {
+          color: @brand-primary;
+        }
+      }
     }
 
     .step-title {
@@ -513,12 +590,19 @@ footer {
         font-size: 14px;
       }
     }
+
+    .smad-depth {
+      width: 80px;
+      text-align: center;
+    }
   }
 
   /** form list employes */
-  .smad-employees-list-head {
+  .smad-employees-list-head, .smad-form-list-head {
     padding: 15px 0px;
     background-color: @brand-grey-light;
+    display: flex;
+
     .title {
 
     }
@@ -548,7 +632,8 @@ footer {
   }
 
   .smad-employees-bottom-navigation {
-    padding: 30px 0;
+    padding-top: 30px;
+    padding-bottom: 30px;
   }
 }
 

+ 398 - 82
tools/Bocian.php.view.js

@@ -1,20 +1,42 @@
-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 (!URL_FETCH_TEST) {
-	throw "Brak zmiennej URL_FETCH_TEST"
+if (!BASE_URLS) {
+	throw "Brak BASE_URLS"
 }
+console.log('BASE_URLS',BASE_URLS);
 
 $(window).on('hashchange', function() {
 	initLocalStorage();
 	rootChangeForm();
 });
 
+
+/* DATA FOR READ REAPORT */
+
+function urlFetchKontrahenciPowiazania() {
+	// Documentation: https://github.com/github/fetch
+	fetch(URL_FETCH_KONTRAHENCI_POWIAZANIA, {
+		credentials: 'same-origin'
+	})
+	.then(function parseJSON(response) {
+	  return response.json()
+	})
+	.then(function(data) {
+
+		var reaportItemsKontrahenciPowiazani = null;
+		data.body.items.forEach (function(row) {
+			reaportItemsKontrahenciPowiazani += '<tr><td><input type="checkbox" name="kontrID[]" value="'+row['ID']+'" /></td>'+
+				'<td align="right">'+row["ID"]+'</td>';
+		});
+
+		$( "#body-reaport-kontrahenci-powiazani-tree" ).html(reaportItemsKontrahenciPowiazani);
+
+	}).catch(function(error) {
+		console.log('request failed', error)
+	});
+}
+
+
+/* FORM DATA FOR GENERATAE REAPORT */
 function loadCurrentDepthInInput(idInput) {
   var depthValue = getItemLocalStorage('Bocian.biAuditForm.depth');
 
@@ -76,6 +98,141 @@ function initLocalStorage() {
 	}
 }
 
+/**
+ * Funkcja pozwala na wyświetlenie okienka importu
+ */
+function showViewUploadFile( event, headerTitle, enumType, showCheckbox, csvFileExample ) {
+	event.preventDefault();
+
+	var enumType = enumType;
+
+	if( csvFileExample !== undefined) { // przykład + instrukcja do pobrania
+			csvFileExample = '<div><a href="'+csvFileExample+'" title="Pobierz przykład" download target="_balnk">Pobierz przykład</a></div>';
+	}
+
+	swal({
+		title: 'Importuj plik csv',
+		input: 'file',
+		html: csvFileExample,
+		inputAttributes: {
+			'accept': 'text/csv',
+			'aria-label': 'Upload csv file'
+		},
+		confirmButtonText: 'Importuj',
+		preConfirm: function (file) {
+			return new Promise(function (resolve, reject) {
+				if (!file) {
+					reject("Proszę wybrać plik csv");
+					return
+				}
+				var input = document.querySelector('input[type="file"]');
+
+				var data = new FormData()
+				data.append('file', input.files[0])
+				data.append('showCheckbox', showCheckbox);
+
+				var responseParseFile = parseCsvFile( data, enumType );
+				resolve('file imported')
+			})
+		},
+	}).then(function (result) {
+		console.log('result', result)
+	}).catch(function (e) {
+		console.log('catch: ', e)
+	});
+
+}
+
+
+/**
+ * Funkcja przekazuje dane z pliku csv do przeparsowania
+ */
+function parseCsvFile( fileData, enumType ) {
+	event.preventDefault();
+
+console.log( 'parseCsvFile fileData', fileData);
+
+	fetch(URL_FORM_DATA_CSV_FILE_AJAX, {
+	  method: 'POST',
+		credentials: 	'same-origin',
+	  body: fileData
+	})
+	.then(function(response) {
+	 return response.json()
+ }).then(function(json) {
+
+					 swal({
+								 title: 'Dane załadowane z pliku CSV',
+								 html: json.body.view,
+								 width: Math.round(window.innerWidth * 0.9),
+								 allowOutsideClick: false, // TODO: btn Anuluj na dole?
+								 showCloseButton: true,
+								 confirmButtonText: 'Zapisz',
+								 preConfirm: function (dataForm) {
+						 			return new Promise(function (resolve, reject) {
+						 				if (!dataForm) {
+						 					reject("Formularz nie zawiera danych do zapisania");
+						 					return
+						 				}
+
+										// zapisanie danych
+						 				var responseSaveData = saveFormCsvFileAjaxAction(enumType);
+						 				resolve('data save from form')
+						 			})
+						 		},
+							 }).then(function (result) {
+
+	 							console.log('result', result)
+	 						}).catch(function (e) {
+	 							console.log('catch: ', e)
+	 						});
+
+ }).catch(function(ex) {
+	 console.log('parsing failed', ex)
+ });
+}
+
+/**
+ * Funkcja zapisuje dane z formularza do wgrania pliku csv
+ */
+function saveFormCsvFileAjaxAction(enumType) {
+	event.preventDefault();
+
+	var formDataFrom =	$("#formDataFromCsv").serialize();
+
+	formDataFrom = formDataFrom.replace(/%5B/g,"[");
+	formDataFrom = formDataFrom.replace(/%5D/g,"]");
+
+//var formDataFrom =	$("#formDataFromCsv").serializeArray();
+console.log('dane z formularza formDataFrom ', formDataFrom );
+
+	fetch(URL_SAVE_FORM_CSV_FILE_AJAX, {
+	  method: 'POST',
+		credentials: 	'same-origin',
+		headers: {
+			'Content-Type': 'application/json'
+		},
+		body: JSON.stringify({
+			 formData: formDataFrom,
+			 enumType: enumType
+		})
+	})
+	.then(function(response) {
+	 return response.json()
+ }).then(function(json) {
+	 console.log('parsed json', json)
+
+	 if (response.type == 'success') {
+
+	 	p5UI__notifyAjaxCallback(response.msg);
+	 }
+
+	// return json;
+ }).catch(function(ex) {
+	 console.log('parsing failed', ex)
+ });
+}
+
 
 function defaultBIAuditLocalStorage() {
 	localStorage.removeItem('Bocian.biAuditForm.pracownicyIds');
@@ -87,6 +244,8 @@ function defaultBIAuditLocalStorage() {
 	setItemLocalStorage('Bocian.biAuditForm.depth', 2);
 }
 
+
+
 function generateBiAuditRaport(event) {
 	event.preventDefault();
 
@@ -127,12 +286,12 @@ function generateBiAuditRaport(event) {
 					}
 				})
 				.then(function(result) {
-					result
+
 					if (result.type == 'success') {
 
 						p5UI__notifyAjaxCallback(result);
 						defaultBIAuditLocalStorage();
-						window.setTimeout(window.location.href = "https://bravecom.yellowgroup.pl/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 {
@@ -145,29 +304,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');
@@ -199,7 +371,7 @@ function addPracownikToGroup(event) {
 					}
 				})
 				.then(function(result) {
-					result
+
 					if (result.type == 'success') {
 						p5UI__notifyAjaxCallback(result);
 						resolve(result.msg);
@@ -218,22 +390,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',
@@ -284,7 +469,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Ć
 	});
 }
 
@@ -324,21 +509,24 @@ function createGroupKontrahenci(event) {
 					}
 				})
 				.then(function(result) {
-					result
+
 					if (result.type == 'success') {
-						p5UI_notifyAjaxCallback(result);
-						resolve(result.msg);
+						p5UI__notifyAjaxCallback(result);
+						resolve(result.body);
 					} else {
-						reject(result.msg);
+
+						reject("Proszę podać inną nazwę grupy");
 					}
 				})
-				;
+				.catch(function(error) {
+					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>';
+			groupsKontrahenci = '<button class="btn btn-default" title="'+groupKontrahenciData['nazwa']+'" data-group-filter="'+groupKontrahenciData['id']+'">'+groupKontrahenciData['nazwa']+'</button>';
 			$('#group-kontrahenci').append(groupsKontrahenci);
 	});
 
@@ -379,15 +567,15 @@ function createGroupPracownicy(event) {
 					}
 				})
 				.then(function(result) {
-					result
+
 					if (result.type == 'success') {
-						p5UI_notifyAjaxCallback(result);
+						p5UI__notifyAjaxCallback(result);
 						resolve(result.msg);
 					} else {
 						reject(result.msg);
 					}
-				})
-				;
+				});
+
 	    })
 	  },
 	  allowOutsideClick: false
@@ -400,48 +588,13 @@ function createGroupPracownicy(event) {
 
 }
 
-// // Documentation: https://github.com/github/fetch
-// fetch(URL_FETCH_TEST, {
-// 	credentials: 'same-origin'
-// })
-// .then(function parseJSON(response) {
-//   return response.json()
-// })
-// .then(function(data) {
-// 	//$( ".container" ).append( data.body.view );
-// 	console.log('request succeeded with JSON response', data)
-// }).catch(function(error) {
-// 	console.log('request failed', error)
-// })
-//
-// fetch(URL_FETCH_TEST_KRS, {
-// 	credentials: 'same-origin'
-// })
-// .then(function parseJSON(response) {
-//   return response.json()
-// })
-// .then(function(data) {
-// 	console.log('request succeeded with JSON response', data)
-// }).catch(function(error) {
-// 	console.log('request failed', error)
-// })
-//
-// fetch(URL_FETCH_TEST_CEIDG, {
-// 	credentials: 'same-origin'
-// })
-// .then(function parseJSON(response) {
-//   return response.json()
-// })
-// .then(function(data) {
-// 	console.log('request succeeded with JSON response', data)
-// }).catch(function(error) {
-// 	console.log('request failed', error)
-// })
 
 function rootChangeForm() {
-
+//todo: do przeniesienia
+urlFetchKontrahenciPowiazania();
 	var valueUrl = global.location.hash;
 
+console.log('URL', valueUrl);
 	switch (valueUrl) {
 		case '#KONTRAHENCI':
 			$( ".container-bi_audit_form_kontrahenci_raport" ).html( VIEW_KONTRAHENCI );
@@ -452,17 +605,25 @@ function rootChangeForm() {
 			break;
 
 		case '#PRACOWNICY':
-			$( ".container-bi_audit_form_pracownicy_raport" ).html( VIEW_PRACOWNICY );
+		$( ".container-bi_audit_form_pracownicy_raport" ).html( VIEW_PRACOWNICY );
 			urlFetchPracownicy(1);
-			fetchGroupPracownicy()
+			fetchGroupPracownicy();
 			$( ".container-bi_audit_form_kontrahenci_raport" ).hide();
 			$( ".container-bi_audit_form_pracownicy_raport" ).show();
 		break;
 
+		// case '#REAPORT':
+		// 	$( ".container-bi_audit_form_raport_data" ).html( VIEW_TREE_REAPORT );
+		// 	urlFetchKontrahenciPowiazania();
+		// 	$( ".container-bi_audit_form_kontrahenci_raport" ).hide();
+		// 	$( ".container-bi_audit_form_pracownicy_raport" ).hide();
+		// 	$( ".container-bi_audit_form_raport_data" ).show();
+		// break;
+
 		default:
-			$( ".container-bi_audit_form_pracownicy_raport" ).html( VIEW_PRACOWNICY );
+		$( ".container-bi_audit_form_pracownicy_raport" ).html( VIEW_PRACOWNICY );
 			urlFetchPracownicy(1);
-			fetchGroupPracownicy()
+			fetchGroupPracownicy();
 			$( ".container-bi_audit_form_kontrahenci_raport" ).hide();
 			$( ".container-bi_audit_form_pracownicy_raport" ).show();
 		break;
@@ -496,6 +657,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');
 
@@ -516,6 +700,7 @@ function urlFetchKontrahenci(page) {
 						})
 				.then(function(data) {
 
+
 						var listItemsKontrahenci = null;
 						data.body.items.forEach (function(row) {
 							listItemsKontrahenci += '<tr><td><input type="checkbox" name="kontrID[]" value="'+row['ID']+'" /></td>'+
@@ -553,17 +738,30 @@ function urlFetchKontrahenci(page) {
 
 				if (data.body.pagination !== undefined) {
 					Pagination.Init(document.getElementById('pagination-kontrahenci'), {
-							url: 'https://bravecom.yellowgroup.pl/SE/index.php?_route=UrlAction_Bocian#KONTRAHENCI',
+							url: BASE_URLS+'index.php?_route=UrlAction_Bocian#KONTRAHENCI',
 							id_pagination: 'pagination-kontrahenci',
 							type: 'KONTRAHENCI',
+							limit: data.body.pagination.limit,
 							total_items: data.body.pagination.total_items, // pages size
 							size: data.body.pagination.size, // pages size
 							page: page,  // selected page
 							step: 1   // pages before and after current
 					});
 
+					var paginationShowNextCount = 1;
+					if ( parseInt(data.body.pagination.current) !== 1) {
+						 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');
@@ -625,23 +823,35 @@ function urlFetchPracownicy(page) {
 
 			if (data.body.pagination.size) {
 						Pagination.Init(document.getElementById('pagination-pracownicy'), {
-							  url: 'https://bravecom.yellowgroup.pl/SE/index.php?_route=UrlAction_Bocian#PRACOWNICY',
+							  url: BASE_URLS+'index.php?_route=UrlAction_Bocian#PRACOWNICY',
 								id_pagination: 'pagination-pracownicy',
 								type: 'PRACOWNICY',
+								limit: data.body.pagination.limit,
 								total_items: data.body.pagination.total_items, // pages size
 								size: data.body.pagination.size, // pages size
 								page: data.body.pagination.current,  // selected page
 								step: 1   // pages before and after current
 						});
+
+						var paginationShowNextCount = 1;
+						if ( parseInt(data.body.pagination.current) !== 1) {
+							 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');
 				checkedChoiseItems('PRACOWNICY', getItemLocalStorage('Bocian.biAuditForm.pracownicyIds') );
 
-			//	$( ".container-bi_audit_raport" ).append( data.body.view );
-				console.log('request succeeded with JSON responsePRACOWNICY', data)
 			}).catch(function(error) {
 				console.log('request failed', error)
 			})
@@ -692,6 +902,9 @@ function checkAll(type) {
 
 				deleteListIdBiAuditReaport(type, allValsUnChecked);
 			}
+
+			// update count selected IDs
+			updateCountItemCheckedByType(type.toLowerCase());
 	});
 }
 
@@ -700,11 +913,18 @@ function checkAll(type) {
  */
 function checkedChoiseItems(type, store) {
 
+	updateCountItemCheckedByType(type.toLowerCase());
+
 	var idElement = 'smad-table-' + type;
 
 	// if id element exist
 	if (document.getElementById(idElement)) {
 
+		// if not checked
+		if (!store) {
+			return false;
+		}
+
 		// checked again if user selected Item (pracownicy/kontrahent)
 			for (i = 0; i < store.length; i++) {
 				$('#body-'+type.toLowerCase() +' input[type=checkbox] ').map(function(k, v) {
@@ -716,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');
 
@@ -752,12 +971,10 @@ function checkedChoiseItems(type, store) {
 
 				deleteListIdBiAuditReaport(type, allValsUnChecked);
 			}
+
 	});
 }
 
-
-
-
 function catchEventCheckbox(type) {
 
 		$('#smad-table-' + type + ' input[type="checkbox"]').on('change', function() {
@@ -777,6 +994,9 @@ function catchEventCheckbox(type) {
 
 						deleteListIdBiAuditReaport(type, allValsUnChecke);
 		    }
+
+				// update count selected IDs
+				updateCountItemCheckedByType(type.toLowerCase());
 		});
 
 }
@@ -851,6 +1071,11 @@ function fetchGroupPracownicy() {
 					}
 
 					var filterIdGroup = getItemLocalStorage('Bocian.biAuditForm.pracownicy.filterIdGroup');
+					var currentDepthValue = getItemLocalStorage('Bocian.biAuditForm.depth');
+					setItemLocalStorage('Bocian.biAuditForm.pracownicy.filterIdGroup', filterIdGroup);
+
+					setItemLocalStorage('Bocian.biAuditForm.depth', currentDepthValue);
+
 					var groupsPracownicy = '';
 					var activeButton = '';
 
@@ -860,8 +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)
 			});
@@ -883,6 +1110,11 @@ function fetchGroupKontrahenci() {
 					}
 
 					var filterIdGroup = getItemLocalStorage('Bocian.biAuditForm.kontrahenci.filterIdGroup');
+					var currentDepthValue = getItemLocalStorage('Bocian.biAuditForm.depth');
+					setItemLocalStorage('Bocian.biAuditForm.kontrahenci.filterIdGroup', filterIdGroup);
+
+					setItemLocalStorage('Bocian.biAuditForm.depth', currentDepthValue);
+
 					var groupsKontrahenci = '';
 					var activeButton = '';
 
@@ -892,13 +1124,17 @@ 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)
 			});
 }
 
+
 function detectChoiseFilter() {
 
 	$('#group-kontrahenci').on('click', 'button', function(evt) {
@@ -908,6 +1144,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
@@ -921,6 +1164,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
@@ -971,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]) {
@@ -982,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 = {
 
@@ -997,6 +1300,7 @@ var Pagination = {
         Pagination.url = data.url;
         Pagination.id_pagination = data.id_pagination;
         Pagination.type = data.type;
+        Pagination.limit = data.limit;
         Pagination.total_items = data.total_items;
         Pagination.size = data.size || 2;
         Pagination.page = data.page || 1;
@@ -1104,9 +1408,15 @@ var Pagination = {
         Pagination.Bind();
     },
 
+
     // find pagination type
     Start: function() {
-			Pagination.code = '<div class="foot-info tblAjax__footer__toolbar__info footer_pagination_menu_items"><p>Wiersze od 1 do ' + Pagination.total_items + ' z ' + Pagination.total_items + '</p></div>';
+			Pagination.code = '';
+			if ( Pagination.type === 'KONTRAHENCI' ) {
+				Pagination.code = '<div class="foot-info tblAjax__footer__toolbar__info footer_pagination_menu_items"><p>Wiersze od <span id="paginationShowNextCount-KONTRAHENCI"></span> do ' + Pagination.total_items + ' z ' + Pagination.total_items + '</p></div>';
+			} else if ( Pagination.type === 'PRACOWNICY' ) {
+					Pagination.code = '<div class="foot-info tblAjax__footer__toolbar__info footer_pagination_menu_items"><p>Wiersze od <span id="paginationShowNextCount-PRACOWNICY"></span> do ' + Pagination.total_items + ' z ' + Pagination.total_items + '</p></div>';
+			}
 			Pagination.code += '<nav aria-label="Page navigation" class="footer_pagination_menu_items"><ul class="btn-group tblAjax__footer__toolbar__pagination smad-pagination">';
 			Pagination.First();
 			Pagination.Prev();
@@ -1115,7 +1425,7 @@ var Pagination = {
 				if ( Pagination.type === 'KONTRAHENCI' ) {
 					Pagination.page = getItemLocalStorage('Bocian.biAuditForm.kontrahenci.pagination.page') || 1;
 				}
-				else if ( Pagination.type === 'PRACOWNICY' ){
+				else if ( Pagination.type === 'PRACOWNICY' ) {
 					Pagination.page = getItemLocalStorage('Bocian.biAuditForm.pracownicy.pagination.page') || 1;
 				}
 
@@ -1193,6 +1503,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;
@@ -1217,3 +1528,8 @@ global.removeItemInArray = removeItemInArray;
 global.removeItemArrayInArray = removeItemArrayInArray;
 
 global.addPracownikToGroup = addPracownikToGroup;
+global.addKontrahenciToGroup = addKontrahenciToGroup;
+
+global.showViewUploadFile = showViewUploadFile;
+global.parseCsvFile = parseCsvFile;
+global.clearListLocalStorageByType = clearListLocalStorageByType;

Algunos archivos no se mostraron porque demasiados archivos cambiaron en este cambio