Browse Source

- komuikaty błedów ukryte (widoczne po uzupełnienieniu zmiennej DBG)

dariusz.andryskowski 7 years ago
parent
commit
6fa3a8528c
1 changed files with 42 additions and 38 deletions
  1. 42 38
      tools/Bocian.php.view.js

+ 42 - 38
tools/Bocian.php.view.js

@@ -36,7 +36,7 @@ function urlFetchKontrahenciPowiazania() {
 		$( "#body-reaport-kontrahenci-powiazani-tree" ).html(reaportItemsKontrahenciPowiazani);
 
 	}).catch(function(error) {
-		console.log('request failed', error)
+		if(DBG) console.log('request failed', error)
 	});
 }
 
@@ -75,10 +75,11 @@ function updateLocalStorageBiAuditDepth(idInput) {
 
 						$('.bottom--message-warning-critical-search').text(messageCriticalSearchData);
 
-						console.log('popup i dodanie komunikatu niżej');
+						if(DBG) console.log('popup i dodanie komunikatu niżej');
+
 					} else {
 						$('.bottom--message-warning-critical-search').text('');
-						console.log('popup i dodanie wyczysc komunikatu ');
+						if(DBG) console.log('popup i dodanie wyczysc komunikatu ');
 					}
 			}
 
@@ -213,9 +214,9 @@ function showViewUploadFile( event, headerTitle, enumType, showCheckbox, csvFile
 			})
 		},
 	}).then(function (result) {
-		console.log('result', result)
+		if(DBG) console.log('result', result);
 	}).catch(function (e) {
-		console.log('catch: ', e)
+		if(DBG) console.log('catch: ', e);
 	});
 
 }
@@ -227,7 +228,7 @@ function showViewUploadFile( event, headerTitle, enumType, showCheckbox, csvFile
 function parseCsvFile( fileData, enumType ) {
 	event.preventDefault();
 
-console.log( 'parseCsvFile fileData', fileData);
+	if(DBG) console.log( 'parseCsvFile fileData', fileData);
 
 	fetch(URL_FORM_DATA_CSV_FILE_AJAX, {
 	  method: 'POST',
@@ -265,7 +266,7 @@ console.log( 'parseCsvFile fileData', fileData);
 	 						});
 
  }).catch(function(ex) {
-	 console.log('parsing failed', ex)
+	 if(DBG) console.log('parsing failed', ex);
  });
 }
 
@@ -294,7 +295,7 @@ function saveFormCsvFileAjaxAction(enumType) {
 	.then(function(response) {
 	 return response.json()
  }).then(function(json) {
-	 console.log('parsed json', json)
+	 if(DBG) console.log('parsed json', json);
 
 	 if (response.type == 'success') {
 
@@ -303,7 +304,8 @@ function saveFormCsvFileAjaxAction(enumType) {
 
 	// return json;
  }).catch(function(ex) {
-	 console.log('parsing failed', ex)
+	 if(DBG) console.log('parsing failed', ex);
+
  });
 }
 
@@ -373,7 +375,8 @@ function generateBiAuditRaport(event) {
 					  })
 					})
 					.then(function(response) {
-						console.log('Firsst then', response);
+						if(DBG) console.log('Firsst then', response);
+
 						return response.text();
 					})
 					.then(function(responseText) {
@@ -407,7 +410,7 @@ function generateBiAuditRaport(event) {
 						}
 					})
 					.catch(function(error) {
-						console.log('request failed', error)
+						if(DBG) console.log('request failed', error);
 					});
 			}
 
@@ -448,7 +451,7 @@ function addPracownikToGroup(event) {
 	  showLoaderOnConfirm: true,
 	  preConfirm: function (idGroup) {
 	    return new Promise(function (resolve, reject) {
-				console.log('idGrupy value', idGroup);
+				if(DBG) console.log('idGrupy value', idGroup);
 
 				if ( !pracownicyIdsArray || pracownicyIdsArray === null || pracownicyIdsArray === 'undefined' ) {
 						reject('Wybierz pracowników');
@@ -489,7 +492,7 @@ function addPracownikToGroup(event) {
 					}
 				})
 				.catch(function(error) {
-					console.log('request failed', error)
+					if(DBG) console.warn('request failed', error);
 				});
 	    })
 	  },
@@ -533,7 +536,7 @@ function addPracownikAllToGroup(event) {
 				var frm = document.getElementById('filtersFieldRemoveBtn-PRACOWNICY').form
 				var fieldNameList = FIELD_LIST_PRACOWNICY
 				fieldNameList.filter(function (fieldName) {
-					if (!frm[fieldName]) console.log('Err missing field: "'+fieldName+'"')
+					if (!frm[fieldName] && DBG) console.log('Err missing field: "'+fieldName+'"');
 					return (frm[fieldName]) ? true : false
 				}).map(function (fieldName) {
 					return [ fieldName, frm[fieldName].value ]
@@ -578,7 +581,7 @@ function addPracownikAllToGroup(event) {
 					}
 				})
 				.catch(function(error) {
-					console.log('request failed', error)
+					if(DBG) console.log('request failed', error);
 				});
 	    })
 	  },
@@ -706,7 +709,7 @@ function addKontrahenciAllToGroup(event) {
 				var frm = document.getElementById('filtersFieldRemoveBtn-KONTRAHENCI').form
 				var fieldNameList = FIELD_LIST_KONTRAHENCI
 				fieldNameList.filter(function (fieldName) {
-					if (!frm[fieldName]) console.log('Err missing field: "'+fieldName+'"')
+					if (!frm[fieldName] && DBG) console.log('Err missing field: "'+fieldName+'"')
 					return (frm[fieldName]) ? true : false
 				}).map(function (fieldName) {
 					return [ fieldName, frm[fieldName].value ]
@@ -751,7 +754,7 @@ function addKontrahenciAllToGroup(event) {
 					}
 				})
 				.catch(function(error) {
-					console.log('request failed', error)
+					if(DBG) console.log('request failed', error);
 				});
 	    })
 	  },
@@ -805,7 +808,7 @@ function createGroupKontrahenci(event) {
 					}
 				})
 				.catch(function(error) {
-					console.log('request failed', error)
+					if(DBG) 	console.log('request failed', error);
 				})
 	    })
 	  },
@@ -862,14 +865,15 @@ function createGroupPracownicy(event) {
 					}
 				})
 				.catch(function(error) {
-					console.log('request failed', error)
+					if(DBG) console.log('request failed', error);
 				})
 
 	    })
 	  },
 	  allowOutsideClick: false
 	}).then(function (groupPracownicyData) {
-		console.log('grupa prac2: ', groupPracownicyData);
+		if(DBG) console.log('grupa prac2: ', groupPracownicyData);
+
 		//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);
@@ -894,7 +898,6 @@ urlFetchKontrahenciPowiazania();
 			fetchGroupKontrahenci();
 			$( ".container-bi_audit_form_pracownicy_raport" ).hide();
 			$( ".container-bi_audit_form_kontrahenci_raport" ).show();
-console.log('rysuj');
 			parseGraph();
 			break;
 
@@ -1125,7 +1128,7 @@ function urlFetchKontrahenci(page) {
 
 				var groupSelectData = getNameGroupById(getItemLocalStorage('Bocian.biAuditForm.kontrahenci.groups'), filterIdGroup);
 				$('#smad-filter-head-title-kontrahenci').text(groupSelectData);
-				console.log('kontrahenci groupSelectData: ', groupSelectData);
+				if(DBG) console.log('kontrahenci groupSelectData: ', groupSelectData);
 
 
 				$( "#body-kontrahenci" ).html(listItemsKontrahenci);
@@ -1134,10 +1137,11 @@ function urlFetchKontrahenci(page) {
 				checkedChoiseItems('KONTRAHENCI', getItemLocalStorage('Bocian.biAuditForm.kontrahenciIds') );
 
 				//	$( ".container-bi_audit_raport" ).append( data.body.view );
-					console.log('request succeeded with JSON responseKontrahenci', data)
+					if(DBG) console.log('request succeeded with JSON responseKontrahenci', data)
+
 					updateTopCounters();
 				}).catch(function(error) {
-					console.log('request failed', error)
+					if(DBG) console.log('request failed', error);
 				})
 }
 
@@ -1157,7 +1161,7 @@ function urlFetchPracownicy(page) {
 			var frm = document.getElementById('filtersFieldRemoveBtn-PRACOWNICY').form
 			var fieldNameList = FIELD_LIST_PRACOWNICY
 			var filterFields = fieldNameList.filter(function (fieldName) {
-				if (!frm[fieldName]) console.log('Err missing field: "'+fieldName+'"')
+				if (!frm[fieldName] && DBG) console.log('Err missing field: "'+fieldName+'"')
 				return (frm[fieldName]) ? true : false
 			}).map(function (fieldName) {
 				return [ fieldName, frm[fieldName].value ]
@@ -1213,7 +1217,7 @@ function urlFetchPracownicy(page) {
 
 					var addresPerson = '';
 					var listItemsPracownik = null;
-					console.log('urlFetchPracownicy', data.body.items);
+					if(DBG) console.log('urlFetchPracownicy', data.body.items);
 
 					data.body.items.forEach (function(row) {
 
@@ -1325,7 +1329,7 @@ function urlFetchPracownicy(page) {
 
 				updateTopCounters();
 			}).catch(function(error) {
-				console.log('request failed', error)
+				if(DBG) console.log('request failed', error)
 			})
 
 }
@@ -1562,7 +1566,7 @@ function fetchGroupPracownicy() {
 					// detect filter group
 					detectChoiseFilter();
 			}).catch(function(error) {
-				console.log('request failed', error)
+				if(DBG) console.log('request failed', error)
 			});
 }
 
@@ -1600,9 +1604,9 @@ function fetchGroupKontrahenci() {
 
 					// detect filter group
 					detectChoiseFilter();
-				console.log('request succeeded with JSON fetchGroupKontrahenci', data.body.itemsGroupKontrahenci);
+				if(DBG) console.log('request succeeded with JSON fetchGroupKontrahenci', data.body.itemsGroupKontrahenci);
 			}).catch(function(error) {
-				console.log('request failed', error)
+				if(DBG) console.log('request failed', error)
 			});
 }
 
@@ -1716,12 +1720,12 @@ function removeItemArrayInArray(arr, itemsArray) {
  * Function show/hide graph view
  */
 function graphShowHide(nameSection) {
-console.log('graphShowHide', '.smad-'+nameSection+'-graph-view');
+
 	if($('.smad-'+nameSection+'-graph-view:visible').length) {
-		console.log('graphShowHide 1' );
+		if(DBG) console.log('graphShowHide 1' );
         $('.smad-'+nameSection+'-graph-view').hide();
   } else {
-		console.log('graphShowHide 2');
+		if(DBG) console.log('graphShowHide 2');
         $('.smad-'+nameSection+'-graph-view').show();
 	}
 }
@@ -1797,9 +1801,9 @@ function updateTopCounters() {
 
 		if ( ( totalPracownicy === 0 || totalKontrahenci === 0 ) && parseInt(depthValue) > 6) {
 			$('.bottom--message-warning-critical-search').text(messageCriticalSearchData);
-			console.log('dodanie komunikatu niżej');
+			if(DBG) console.log('dodanie komunikatu niżej');
 		} else {
-			console.log('wyczyc komunikatu niżej');
+			if(DBG) console.log('wyczyc komunikatu niżej');
 			$('.bottom--message-warning-critical-search').text('');
 		}
 
@@ -2010,9 +2014,9 @@ var Pagination = {
 		resolve: 'all',
 		resolveDepth: 3,
 	}).then(function (features) {
-		console.log('features', features)
+		if(DBG) console.log('features', features)
 	}).catch(function (e) {
-		console.warn(e)
+		if(DBG) console.warn(e)
 		p5UI__notifyAjaxCallback({ type: 'error', msg: e })
 	})
 }*/
@@ -2127,7 +2131,7 @@ function loadMoreRecordFunctions(event, node, rowPK, namespace) {
 		jQuery(RECORD_MORE_FUNCTIONS_OPENED_NODE).popover('show')
 
 	}).catch(function (err) {
-		// console.log('err', err)
+		if(DBG)  console.log('err', err);
 	})
 }