Browse Source

- aktualizacja kodu do ostatniej wersji wgranej na git
- dodanie widoku listy pizycji raportów

dariusz.andryskowski 7 years ago
parent
commit
11cf74b7cb
2 changed files with 71 additions and 31 deletions
  1. 25 13
      tools/Bocian.php
  2. 46 18
      tools/Bocian.php.view.js

File diff suppressed because it is too large
+ 25 - 13
tools/Bocian.php


+ 46 - 18
tools/Bocian.php.view.js

@@ -6,8 +6,8 @@ console.log('test1... DBG:', DBG)
 // 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 (!URL_FETCH_KONTRAHENCI_POWIAZANIA) {
+	throw "Brak zmiennej URL_FETCH_KONTRAHENCI_POWIAZANIA"
 }
 
 $(window).on('hashchange', function() {
@@ -15,6 +15,36 @@ $(window).on('hashchange', function() {
 	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);
+
+		console.log('request succeeded with JSON response URL_FETCH_KONTRAHENCI_POWIAZANIA', data)
+	}).catch(function(error) {
+		console.log('request failed', error)
+	});
+}
+
+
+/* FORM DATA FOR GENERATAE REAPORT */
 function loadCurrentDepthInInput(idInput) {
   var depthValue = getItemLocalStorage('Bocian.biAuditForm.depth');
 
@@ -400,20 +430,7 @@ 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'
 // })
@@ -440,6 +457,8 @@ function createGroupPracownicy(event) {
 
 function rootChangeForm() {
 
+//todo: do przeniesienia
+urlFetchKontrahenciPowiazania();
 	var valueUrl = global.location.hash;
 
 	switch (valueUrl) {
@@ -459,6 +478,14 @@ function rootChangeForm() {
 			$( ".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 );
 			urlFetchPracownicy(1);
@@ -553,7 +580,7 @@ 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: 'https://bravecom.yellowgroup.pl/SE/index.php?_route=UrlAction_BiAuditRaport#KONTRAHENCI',
 							id_pagination: 'pagination-kontrahenci',
 							type: 'KONTRAHENCI',
 							total_items: data.body.pagination.total_items, // pages size
@@ -625,7 +652,7 @@ 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: 'https://bravecom.yellowgroup.pl/SE/index.php?_route=UrlAction_BiAuditRaport#PRACOWNICY',
 								id_pagination: 'pagination-pracownicy',
 								type: 'PRACOWNICY',
 								total_items: data.body.pagination.total_items, // pages size
@@ -899,6 +926,7 @@ function fetchGroupKontrahenci() {
 			});
 }
 
+
 function detectChoiseFilter() {
 
 	$('#group-kontrahenci').on('click', 'button', function(evt) {

Some files were not shown because too many files changed in this diff