소스 검색

Merge branch 'master' of ssh://biuro.biall-net.pl:2222/p5/project-bocian

dariusz.andryskowski 7 년 전
부모
커밋
b0aa979979
2개의 변경된 파일35개의 추가작업 그리고 30개의 파일을 삭제
  1. 0 5
      tools/Bocian.php
  2. 35 25
      tools/Bocian.php.view.js

+ 0 - 5
tools/Bocian.php

@@ -1105,14 +1105,9 @@ public function showPowiazaniaEnergaRumKontrahenciPowiazania($items) {
 
 		$limit = 20;
 
-		$limitstart = V::get('limitstart', 0, $args, 'int');
-		if ($limitstart < 0) $limitstart = 0;
-
-
 		$page = V::get('page', 0, $args, 'int');
 		$limitstart = ($page - 1) * $limit;
 
-
 		$search = V::get('search', '', $args);
 		$searchParams = [];
 		if (!empty($search)) {

+ 35 - 25
tools/Bocian.php.view.js

@@ -1,3 +1,4 @@
+var DBG = DBG || 0;
 
 if (!URL_TABLE_POWIAZANIA) throw "Brak URL_TABLE_POWIAZANIA";
 if (!BASE_URLS) throw "Brak BASE_URLS"
@@ -1167,31 +1168,40 @@ function urlFetchPracownicy(page) {
 			}).join('&')
 			filterFields = (filterFields.length > 0) ? '&' + filterFields : ''
 
-			// TODO: fetch data from API
-			// p5WFS_GetFeature('default_db__x3A__BI_audit_ENERGA_PRACOWNICY:BI_audit_ENERGA_PRACOWNICY', {
-			// 	sortBy: 'ID+D',
-			// 	maxFeatures: 20,
-			// 	// TODO: startIndex: 0, // TODO: from pagination
-			// 	// TODO: backRefNS, backRefPK, backRefField - TODO: from groups
-			// 	// resolve: 'all',
-			// 	// resolveDepth: 2
-			// 	'ogc:Filter': '<wfs:Query>' + '\n' + [
-			// 		'*',
-			// 		'default_db__x3A__BI_audit_ENERGA_PRACOWNICY_adresy:BI_audit_ENERGA_PRACOWNICY_adresy/*',
-			// 		[
-			// 			'default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object',
-			// 			'default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row',
-			// 			'default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object',
-			// 			'default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI:BI_audit_ENERGA_RUM_KONTRAHENCI'
-			// 		].join('/')
-			// 	].map(function (fieldName) {
-			// 		return '<wfs:PropertyName>' + fieldName + '</wfs:PropertyName>';
-			// 	}).join('\n') + '\n' + '</wfs:Query>'
-			// }).then(function (items) {
-			// 	console.log('p5WFS_GetFeature: items: ', items);
-			// }).catch(function (err) {
-			// 	console.log('p5WFS_GetFeature: err: ', err);
-			// })
+			var paginationLimit = 20;
+			p5WFS_GetFeature('default_db__x3A__BI_audit_ENERGA_PRACOWNICY:BI_audit_ENERGA_PRACOWNICY',
+				Object.assign({
+					sortBy: 'ID+D',
+					maxFeatures: paginationLimit,
+					startIndex: (page - 1) * paginationLimit,
+					// TODO: backRefNS, backRefPK, backRefField - TODO: from groups
+					// resolve: 'all',
+					// resolveDepth: 2
+					'ogc:Filter': '<wfs:Query>' + '\n' + [
+						'*',
+						'default_db__x3A__BI_audit_ENERGA_PRACOWNICY_adresy:BI_audit_ENERGA_PRACOWNICY_adresy/*',
+						[
+							'default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object',
+							'default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row',
+							'default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object',
+							'default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI:BI_audit_ENERGA_RUM_KONTRAHENCI'
+						].join('/')
+					].map(function (fieldName) {
+						return '<wfs:PropertyName>' + fieldName + '</wfs:PropertyName>';
+					}).join('\n') + '\n' + '</wfs:Query>'
+				}, (filterIdGroup > 0)
+					? {
+							backRefNS: 'default_db/BI_audit_ENERGA_PRACOWNICY_group/BI_audit_ENERGA_PRACOWNICY_group',
+							backRefPK: filterIdGroup,
+							backRefField: 'default_db__x3A__BI_audit_ENERGA_PRACOWNICY:BI_audit_ENERGA_PRACOWNICY',
+						}
+					: {}
+				)
+			).then(function (items) {
+				if(DBG)console.log('p5WFS_GetFeature: items: ', items);
+			}).catch(function (err) {
+				if(DBG)console.log('p5WFS_GetFeature: err: ', err);
+			})
 
 			fetch(URL_FETCH_PRACOWNICY + '&page=' + page + '&filterIdGroup=' + filterIdGroup + filterFields, {
 				credentials: 'same-origin'