Pārlūkot izejas kodu

updated Bocian from yellowgroup

Piotr Labudda 8 gadi atpakaļ
vecāks
revīzija
86f6337c50

+ 117 - 14
SE/se-lib/Route/UrlAction/BiAuditRaport.php

@@ -9,7 +9,6 @@ class Route_UrlAction_BiAuditRaport extends RouteBase {
 
 	public function defaultAction() {
 		UI::topSection();
-		//UI::startContainer();
 
 		echo '<div class="container-bi_audit_raport"></div>';
 		/*try {
@@ -50,19 +49,19 @@ class Route_UrlAction_BiAuditRaport extends RouteBase {
 			'URL_FETCH_TEST_KRS' => $this->getLink('fetchTestKrsAjax'),
 			'URL_FETCH_TEST_CEIDG' => $this->getLink('fetchTestCeidgAjax'),
 			'URL_FETCH_PRACOWNICY' => $this->getLink('fetchPracownicyAjax'),
+			'URL_FETCH_KONTRAHENCI' => $this->getLink('fetchKontrahenciAjax'),
 			'DBG' => V::get('DBG', 0, $_GET),
 		]);
 
-
-		//UI::endContainer();
 		UI::footerSection();
 	}
-
+/*
 	public function fetchEnergaRumKontrahenciPowiazaniaAjaxAction() {
 		Response::sendTryCatchJson(array($this, 'fetchEnergaRumKontrahenciPowiazaniaAjax')); // , $args = 'JSON_FROM_REQUEST_BODY');
 	}
 	public function fetchEnergaRumKontrahenciPowiazaniaAjax($args) {
 		$id = V::get('ID', 1, $_REQUEST, 'int');
+
 		$items = ACL::getAclByNamespace('default_db/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA')->buildQuery([
 			'cols' => [ // TODO:? propertyName = []
 				'ID',
@@ -136,8 +135,7 @@ public function showPowiazaniaEnergaRumKontrahenciPowiazania($items) {
 
 		return $view;
 }
-
-
+*/
 
 
 
@@ -246,8 +244,87 @@ public function showPowiazaniaEnergaRumKontrahenciPowiazania($items) {
 		];
 	}
 
+/**
+ * KONTRAHENCI
+ */
+//TODO: NIE wiem czemu nie mogę pobrać infoamcji o kontrahentach
+public function fetchKontrahenciAjaxAction() {
+	Response::sendTryCatchJson(array($this, 'fetchKontrahenciAjax'));
+}
+
+public function fetchKontrahenciAjax($args) {
+	//$id = V::get('ID', 1, $_REQUEST, 'int');
+	$items = ACL::getAclByNamespace('default_db/BI_audit_ENERGA_RUM_KONTRAHENCI/BI_audit_ENERGA_RUM_KONTRAHENCI')->buildQuery([
+		'cols' => [ // TODO:? propertyName = []
+				'ID',
+				'Nazwa_grupy_kapitalowej',
+				'Pelna_nazwa_kontrahenta',
+				'NIP',
+				'KRS',
+				'REGON',
+	 		'Miejscowosc',
+				'Kod_pocztowy',
+				'Telefon'
+		],
+		//'f_ID' => $id,
+	])->getItems([
+		'limit' => 10
+	]);
+
+	return [
+		'type' => 'success',
+		'msg' => 'showKontrahenci',
+		'__req_args' => $_REQUEST,
+		'__args' => $args,
+		'body' => [
+			'items' => $items,
+			'view' => $this->htmlViewFormBiAudit($items, 'KONTRAHENCI')
+		]
+	];
+}
 
+public function showListKontrahenci($items) {
+	$view = '<form class="form-horizontal" method="post">
+					<table class="table table-bordered table-hover table-striped" height=5>
+								 <thead>
+									 <tr>
+											<td width=1><input type="checkbox" name="checkAll" id="checkAll" /></td>
+										 <td width=1>ID</td>
+										 <td>Nazwa grupy kapitalowej</td>
+										 <td>Pelnanazwa kontrahenta</td>
+										 <td>NIP</td>
+										 <td>KRS</td>
+										 <td>Regon</td>
+										 <td>Miejscowosc</td>
+										 <td>Kod_pocztowy</td>
+										 <td>Telefon</td>
+									 </tr>
+								 </thead>
+								 <tbody>
+				';
+
+	foreach ($items as $key => $row) {
+			$view .= '<tr>
+			<td><input type="checkbox" name="prID[]" value="'.$row['ID'].'" /></td>
+							<td align="right">'.$row["ID"].'</td>
+							<td align="right">'.$row["Nazwa_grupy_kapitalowej"].'</td>
+							<td align="right">'.$row["Pelna_nazwa_kontrahenta"].'</td>
+							<td align="right">'.$row["NIP"].'</td>
+							<td align="right">'.$row["KRS"].'</td>
+							<td align="right">'.$row["REGON"].'</td>
+							<td align="right">'.$row["Miejscowosc"].'</td>
+							<td align="right">'.$row["Kod_pocztowy"].'</td>
+							<td align="right">'.$row["Telefon"].'</td>
+							';
+	}
+	$view .= '</tbody></table></form>';
 
+	return $view;
+}
+
+/**
+ * Pracownicy
+ */
 	public function fetchPracownicyAjaxAction() {
 		Response::sendTryCatchJson(array($this, 'fetchPracownicyAjax'));
 	}
@@ -278,14 +355,14 @@ public function showPowiazaniaEnergaRumKontrahenciPowiazania($items) {
 			'__args' => $args,
 			'body' => [
 				'items' => $items,
-				'view' => $this->htmlViewEmployees($items)
+				'view' => $this->htmlViewFormBiAudit($items, 'PRACOWNICY')
 			]
 		];
 	}
 
 
-	public function showPracownicy($items) {
-	$view = '<form class="form-horizontal" method="post">
+	public function showListPracownicy($items) {
+		$view = '<form class="form-horizontal" method="post">
 						<table class="table table-bordered table-hover table-striped" height=5>
 									 <thead>
 										 <tr>
@@ -374,7 +451,21 @@ public function showPowiazaniaEnergaRumKontrahenciPowiazania($items) {
 		];
 	}
 
-	public function htmlViewEmployees($items) {
+	public function htmlViewFormBiAudit($items, $type) {
+
+$activeFormSteps = '';
+
+switch($type) {
+		case 'KONTRAHENCI':
+			$activeFormSteps = 'complete';
+			$titleHeader = 'KONTRAHENCI';
+		break;
+
+		case 'PRACOWNICY':
+			$titleHeader = 'PRACOWNICY';
+			break;
+}
+
 
 		$viewEployees = '
 		<!-- start:employees-section-->
@@ -385,7 +476,7 @@ public function showPowiazaniaEnergaRumKontrahenciPowiazania($items) {
 								<div id="smad-menu-section">
 										<div class="col-sm-12 col-md-6 padding-lr-0">
 												<div class="menu-items">
-														<div class="smad-heder-title menu-item"><span class="smad-line-red">|</span> PRACOWNICY</div>
+														<div class="smad-heder-title menu-item"><span class="smad-line-red">|</span> ' . $titleHeader . ' </div>
 												</div>
 										</div>
 										<div class="col-sm-12 col-md-6 padding-lr-0">
@@ -402,7 +493,7 @@ public function showPowiazaniaEnergaRumKontrahenciPowiazania($items) {
 																		</div>
 																</div>
 
-																<div class="col-xs-4 col-md-4 smad-wizard-step ">
+																<div class="col-xs-4 col-md-4 smad-wizard-step ' . $activeFormSteps . '">
 																		<div class="text-center smad-wizard-stepnum">&nbsp;</div>
 																		<div class="progress"><div class="progress-bar"></div></div>
 																		<a href="#" class="smad-wizard-dot"></a>
@@ -502,7 +593,7 @@ public function showPowiazaniaEnergaRumKontrahenciPowiazania($items) {
 		</div>
 		<div class="container-fluid">
 				<div class="container  padding-0">
-						' . $this->showPracownicy($items)  . '
+						' . $this->showListDataByType($items, $type) . '
 				</div>
 		</div>
 		<!-- end:list employees -->
@@ -514,7 +605,7 @@ public function showPowiazaniaEnergaRumKontrahenciPowiazania($items) {
 								<a href="#" title="PRZENIEŚ DO GRUPY" class="btn btn-grey-border">PRZENIEŚ DO GRUPY</a>
 						</div>
 						<div class="col-lg-6 text-right">
-								<a href="#" title="DODAJ DO ANALIZY" class="btn btn-default">DODAJ DO ANALIZY</a>
+								<a href="index.php?_route=UrlAction_BiAuditRaport#KONTRAHENCI" title="DODAJ DO ANALIZY" class="btn btn-default">DODAJ DO ANALIZY</a>
 						</div>
 				</div>
 		</div>
@@ -524,4 +615,16 @@ public function showPowiazaniaEnergaRumKontrahenciPowiazania($items) {
 		';
 		return $viewEployees;
 	}
+
+	public function showListDataByType($items, $type='PRACOWNICY') {
+
+			switch ($type) {
+				case 'PRACOWNICY':
+					return $this->showListPracownicy($items);
+					break;
+				case 'KONTRAHENCI':
+					return $this->showListKontrahenci($items);
+					break;
+			}
+	}
 }

+ 73 - 47
SE/se-lib/Route/UrlAction/BiAuditRaport.php.view.js

@@ -4,57 +4,83 @@ if (!URL_FETCH_TEST) {
 	throw "Brak zmiennej URL_FETCH_TEST"
 }
 
-// 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)
-})
+// // 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)
+// })
 
-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)
-})
+var valueUrl = global.location.hash;
+console.log('hash url', valueUrl);
+console.log('URL_FETCH_KONTRAHENCI', URL_FETCH_KONTRAHENCI);
+switch (valueUrl) {
+	case '#KONTRAHENCI':
+		console.log('fetching...')
+		fetch(URL_FETCH_KONTRAHENCI, {
+			credentials: 'same-origin'
+		})
+		.then(function parseJSON(response) {
+		  return response.json()
+		})
+		.then(function(data) {
+			$( ".container-bi_audit_raport" ).append( data.body.view );
+			console.log('request succeeded with JSON response', data)
+		}).catch(function(e) {
+			console.log('request failed', e)
+		})
 
-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)
-})
+	break;
 
+	case '#PRACOWNICY':
+
+		fetch(URL_FETCH_PRACOWNICY, {
+			credentials: 'same-origin'
+		})
+		.then(function parseJSON(response) {
+		  return response.json()
+		})
+		.then(function(data) {
+			$( ".container-bi_audit_raport" ).append( data.body.view );
+			console.log('request succeeded with JSON response', data)
+		}).catch(function(error) {
+			console.log('request failed', error)
+		})
+
+	break;
+}
 
-fetch(URL_FETCH_PRACOWNICY, {
-	credentials: 'same-origin'
-})
-.then(function parseJSON(response) {
-  return response.json()
-})
-.then(function(data) {
-	$( ".container-bi_audit_raport" ).append( data.body.view );
-	console.log('request succeeded with JSON response', data)
-}).catch(function(error) {
-	console.log('request failed', error)
-})
 
 function checkAll() {
 	$('#checkAll').change(function(){

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 0 - 0
SE/static/theme_bocian/assets/css/styles.css


+ 33 - 1
SE/static/theme_bocian/assets/less/styles.less

@@ -147,6 +147,20 @@ strong {
   background-color: @brand-secondary;
   border-color: @brand-secondary;
 }
+/**Table */
+.table {
+  thead {
+    td {
+      color: @brand-text;
+    }
+  }
+
+  tbody {
+    td {
+      color: @brand-text-light;
+    }
+  }
+}
 
 /** TOP */
 #smad-header-section {
@@ -408,6 +422,7 @@ strong {
     height: 3px;
     box-shadow: none;
     margin: 20px 0;
+    background: @brand-grey-light;
   }
   .smad-wizard > .smad-wizard-step > .progress > .progress-bar {
     width: 0px;
@@ -458,11 +473,28 @@ strong {
         display: inline-block;
 
         li {
-          padding: 0 10px;
+          padding: 10px 10px;
           display: inline-block;
         }
       }
     }
+
+    .form-input {
+      padding-top: 35px;
+      padding-bottom: 25px;
+
+      @media screen and (max-width : @screen-md ) {
+        border-top: 1px solid @brand-grey;
+      }
+
+      .form-item {
+        display: inline-block;
+      }
+      .smad-heder-title {
+        padding-top: 3px;
+        font-size: 14px;
+      }
+    }
   }
 
   /** form list employes */

+ 3 - 2
SE/static/theme_bocian/assets/less/variables.less

@@ -8,7 +8,7 @@
 
 @brand-white: #fff;
 @brand-grey: @brand-secondary;
-@brand-grey-light: #f6f6f6;
+@brand-grey-light: #efefef;
 @brand-dark: #000000;
 
 @brand-error: #ff8585;
@@ -18,7 +18,8 @@
 @brand-link-text: @brand-dark;
 @brand-link-text-active: @brand-white;
 @brand-text: @brand-dark;
-@brand-text-light: #cccccc;
+@brand-text-light: #b1b1b1;
+
 
 
 // Extra small screen / phone

Daži faili netika attēloti, jo izmaiņu fails ir pārāk liels