Bocian.php 38 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091
  1. <?php
  2. Lib::loadClass('RouteToolBase');
  3. Lib::loadClass('UI');
  4. Lib::loadClass('Response');
  5. Lib::loadClass('Theme');
  6. // class name must have the same name as file
  7. // index.php?_route=UrlAction_BraveCare - uruchamia defaultAction
  8. class Bocian extends RouteToolBase {
  9. public function defaultAction() {
  10. UI::gora();
  11. echo UI::h('script', ['src'=>"static/sweetalert2.min.js"]);
  12. echo UI::h('link', ['rel'=>"stylesheet", 'type'=>"text/css", 'href'=>"static/sweetalert2.min.css"]);
  13. Theme::top();
  14. //echo '<div id="smad-wrapper">'; // todo: sprawdzi czy można usunać
  15. echo '<div class="container-bi_audit_form_pracownicy_raport" style="display: none;"></div>';
  16. echo '<div class="container-bi_audit_form_kontrahenci_raport" style="display: none;"></div>';
  17. UI::inlineJS(__FILE__ . '.view.js', [
  18. 'URL_FETCH_TEST' => $this->getLink('fetchEnergaRumKontrahenciPowiazaniaAjax'),
  19. 'URL_FETCH_TEST_KRS' => $this->getLink('fetchTestKrsAjax'),
  20. 'URL_FETCH_TEST_CEIDG' => $this->getLink('fetchTestCeidgAjax'),
  21. 'URL_FETCH_PRACOWNICY' => $this->getLink('fetchPracownicyAjax'),
  22. 'URL_FETCH_KONTRAHENCI' => $this->getLink('fetchKontrahenciAjax'),
  23. 'URL_CREATE_PRACOWNICY_GROUP' => $this->getLink('createPracownicyGroupAjax'),
  24. 'URL_CREATE_KONTRAHENCIS_GROUP' => $this->getLink('createKontrahenciGroupAjax'),
  25. 'URL_ADD_PRACOWNICY_TO_GROUP' => $this->getLink('addPracownicyToGroupAjax'),
  26. 'URL_ADD_KONTRAHENCI_TO_GROUP' => $this->getLink('addKontrahenciToGroupAjax'),
  27. 'URL_FETCH_GROUP_PRACOWNICY' => $this->getLink('fetchGroupPracownicyAjax'),
  28. 'URL_FETCH_GROUP_KONTRAHENCI' => $this->getLink('fetchGroupKontrahenciAjax'),
  29. 'URL_GENERATE_BI_AUDIT_RAPORT_AJAX' => $this->getLink('generateBiAuditRaportAjax'),
  30. 'DBG' => V::get('DBG', 0, $_GET),
  31. 'VIEW_KONTRAHENCI' => $this->defaultViewFormBiAudit([], 'KONTRAHENCI'),
  32. 'VIEW_PRACOWNICY' => $this->defaultViewFormBiAudit([], 'PRACOWNICY'),
  33. ]);
  34. echo '</div>'; // #smad-wrapper
  35. UI::dol();
  36. }
  37. /*
  38. public function fetchEnergaRumKontrahenciPowiazaniaAjaxAction() {
  39. Response::sendTryCatchJson(array($this, 'fetchEnergaRumKontrahenciPowiazaniaAjax')); // , $args = 'JSON_FROM_REQUEST_BODY');
  40. }
  41. public function fetchEnergaRumKontrahenciPowiazaniaAjax($args) {
  42. $id = V::get('ID', 1, $_REQUEST, 'int');
  43. $items = ACL::getAclByNamespace('default_db/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA')->buildQuery([
  44. 'cols' => [ // TODO:? propertyName = []
  45. 'ID',
  46. 'A_ADM_COMPANY',
  47. 'L_APPOITMENT_USER',
  48. 'A_CLASSIFIED',
  49. 'A_STATUS',
  50. 'A_STATUS_INFO',
  51. 'BI_analiza_depth',
  52. 'BI_analiza_reloadCache',
  53. 'FILE_STATUS',
  54. 'FILE_STATUS_info',
  55. 'L_APPOITMENT_USER',
  56. 'default_db__x3A__BI_audit_ENERGA_PRACOWNICY:BI_audit_ENERGA_PRACOWNICY',
  57. 'default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI:BI_audit_ENERGA_RUM_KONTRAHENCI',
  58. 'default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row',
  59. 'default_db__x3A__BI_audit_KW_requested_person:BI_audit_KW_requested_person',
  60. ],
  61. //'f_ID' => $id,
  62. ])->getItems([
  63. 'limit' => 10
  64. ]);
  65. // $items = [
  66. // [ 'ID' => 1, 'L_APPOITMENT_INFO' => 'x', 'BI_analiza_depth' => 'a', 'FILE_STATUS' => 1, 'FILE_STATUS_info' => 'test1'],
  67. // [ 'ID' => 2, 'L_APPOITMENT_INFO' => 'y', 'BI_analiza_depth' => 'b', 'FILE_STATUS' => 0, 'FILE_STATUS_info' => 'test2'],
  68. // [ 'ID' => 3, 'L_APPOITMENT_INFO' => 'z', 'BI_analiza_depth' => 'c', 'FILE_STATUS' => 1, 'FILE_STATUS_info' => 'test3'],
  69. // ];
  70. return [
  71. 'type' => 'success',
  72. 'msg' => 'OK',
  73. '__req_args' => $_REQUEST,
  74. '__args' => $args,
  75. 'body' => [
  76. 'items' => $items,
  77. 'view' => $this->showPowiazaniaEnergaRumKontrahenciPowiazania($items),
  78. ]
  79. ];
  80. }
  81. public function showPowiazaniaEnergaRumKontrahenciPowiazania($items) {
  82. $view = '<form class="form-horizontal" method="post">
  83. <table class="table table-bordered table-hover table-striped" height=5>
  84. <thead>
  85. <tr style="">
  86. <td width=1><input type="checkbox" name="checkAll" id="checkAll" /></td>
  87. <td width=1>ID</td>
  88. <td>Adnotacje</td>
  89. <td>Głębokość analizy</td>
  90. <td>Status raportu</td>
  91. <td>Status raportu - informacje</td>
  92. </tr>
  93. </thead>
  94. <tbody>
  95. ';
  96. foreach ($items as $key => $row) {
  97. $view .= '<tr>
  98. <td><input type="checkbox" name="prID[]" value="'.$row['ID'].'" onClick="checkAll()"/></td>
  99. <td align="right">'.$row["ID"].'</td>
  100. <td align="right">'.$row["L_APPOITMENT_INFO"].'</td>
  101. <td align="right">'.$row["BI_analiza_depth"].'</td>
  102. <td align="right">'.$row["FILE_STATUS"].'</td>
  103. <td align="right">'.$row["FILE_STATUS_info"].'</td>';
  104. }
  105. $view .= '</tbody></table></form>';
  106. return $view;
  107. }
  108. */
  109. public function fetchTestKrsAjaxAction() {
  110. Response::sendTryCatchJson(array($this, 'fetchTestKrsAjax')); // , $args = 'JSON_FROM_REQUEST_BODY');
  111. }
  112. public function fetchTestKrsAjax($args) {
  113. $id = V::get('ID', 1, $_REQUEST, 'int');
  114. $items = ACL::getAclByNamespace('default_db/BI_audit_KRS/BI_audit_KRS')->buildQuery([
  115. 'cols' => [ // TODO:? propertyName = []
  116. 'A_kod',
  117. 'A_kraj',
  118. 'A_miejscowosc',
  119. 'A_nrDomu',
  120. 'A_nrLokalu',
  121. 'A_poczta',
  122. 'A_ulica',
  123. 'ID',
  124. 'S_gmina',
  125. 'S_kraj',
  126. 'S_miejscowosc',
  127. 'S_powiat',
  128. 'S_wojewodztwo',
  129. 'dataDokumentu',
  130. 'default_db__x3A__BI_audit_KRS_company:BI_audit_KRS_company/ID',
  131. 'default_db__x3A__BI_audit_KRS_company:BI_audit_KRS_company/krs',
  132. 'default_db__x3A__BI_audit_KRS_company:BI_audit_KRS_company/nazwa',
  133. 'default_db__x3A__BI_audit_KRS_company:BI_audit_KRS_company/regon',
  134. 'default_db__x3A__BI_audit_KRS_person:BI_audit_KRS_person/ID',
  135. 'default_db__x3A__BI_audit_KRS_person:BI_audit_KRS_person/imiona',
  136. 'default_db__x3A__BI_audit_KRS_person:BI_audit_KRS_person/nazwisko',
  137. 'default_db__x3A__BI_audit_KRS_person:BI_audit_KRS_person/pesel',
  138. 'krs',
  139. 'nazwa',
  140. 'nip',
  141. 'regon',
  142. ],
  143. 'f_ID' => "{$id}",
  144. ])->getItems([
  145. 'limit' => 10
  146. ]);
  147. return [
  148. 'type' => 'success',
  149. 'msg' => 'KRS',
  150. '__req_args' => $_REQUEST,
  151. '__args' => $args,
  152. 'body' => [
  153. 'items' => $items,
  154. ]
  155. ];
  156. }
  157. public function fetchTestCeidgAjaxAction() {
  158. Response::sendTryCatchJson(array($this, 'fetchTestCeidgAjax')); // , $args = 'JSON_FROM_REQUEST_BODY');
  159. }
  160. public function fetchTestCeidgAjax($args) {
  161. $id = V::get('ID', 0, $_REQUEST, 'int');
  162. $items = ACL::getAclByNamespace('default_db/BI_audit_CEIDG/BI_audit_CEIDG')->buildQuery([
  163. 'cols' => [ // TODO:? propertyName = []
  164. 'ID',
  165. 'budynek',
  166. 'firma',
  167. 'gmina',
  168. 'identyfikatorWpisu',
  169. 'imie',
  170. 'kodPocztowy',
  171. 'kraj',
  172. 'lokal',
  173. 'miejscowosc',
  174. 'nazwisko',
  175. 'nip',
  176. 'poczta',
  177. 'powiat',
  178. 'regon',
  179. 'ulica',
  180. 'default_db__x3A__BI_audit_CEIDG_pelnomocnicy:BI_audit_CEIDG_pelnomocnicy/ID',
  181. 'default_db__x3A__BI_audit_CEIDG_pelnomocnicy:BI_audit_CEIDG_pelnomocnicy/budynek',
  182. 'default_db__x3A__BI_audit_CEIDG_pelnomocnicy:BI_audit_CEIDG_pelnomocnicy/gmina',
  183. 'default_db__x3A__BI_audit_CEIDG_pelnomocnicy:BI_audit_CEIDG_pelnomocnicy/kodPocztowy',
  184. 'default_db__x3A__BI_audit_CEIDG_pelnomocnicy:BI_audit_CEIDG_pelnomocnicy/lokal',
  185. 'default_db__x3A__BI_audit_CEIDG_pelnomocnicy:BI_audit_CEIDG_pelnomocnicy/miejscowosc',
  186. 'default_db__x3A__BI_audit_CEIDG_pelnomocnicy:BI_audit_CEIDG_pelnomocnicy/nazwa',
  187. 'default_db__x3A__BI_audit_CEIDG_pelnomocnicy:BI_audit_CEIDG_pelnomocnicy/nip',
  188. 'default_db__x3A__BI_audit_CEIDG_pelnomocnicy:BI_audit_CEIDG_pelnomocnicy/poczta',
  189. 'default_db__x3A__BI_audit_CEIDG_pelnomocnicy:BI_audit_CEIDG_pelnomocnicy/powiat',
  190. 'default_db__x3A__BI_audit_CEIDG_pelnomocnicy:BI_audit_CEIDG_pelnomocnicy/ulica',
  191. 'default_db__x3A__BI_audit_CEIDG_pelnomocnicy:BI_audit_CEIDG_pelnomocnicy/wojewodztwo',
  192. 'default_db__x3A__BI_audit_CEIDG_powiazania:BI_audit_CEIDG_powiazania/ID',
  193. 'default_db__x3A__BI_audit_CEIDG_powiazania:BI_audit_CEIDG_powiazania/nip',
  194. 'default_db__x3A__BI_audit_CEIDG_powiazania:BI_audit_CEIDG_powiazania/regon',
  195. ],
  196. // 'f_ID' => $id,
  197. ])->getItems([
  198. 'limit' => 10
  199. ]);
  200. return [
  201. 'type' => 'success',
  202. 'msg' => 'CEIDG',
  203. '__req_args' => $_REQUEST,
  204. '__args' => $args,
  205. 'body' => [
  206. 'items' => $items,
  207. ]
  208. ];
  209. }
  210. /**
  211. * KONTRAHENCI
  212. */
  213. public function fetchKontrahenciAjaxAction() {
  214. Response::sendTryCatchJson(array($this, 'fetchKontrahenciAjax'));
  215. }
  216. public function fetchKontrahenciAjax($args) {
  217. $idGroup = V::get('filterIdGroup', 0, $_REQUEST, 'int'); // TODO: dla filtrów "Wysokiego ryzyka" - przekazywany ID rekodu
  218. if ($idGroup < 0) $idGroup = 0;
  219. $limit = 5;
  220. $limitstart = V::get('limitstart', 0, $_REQUEST, 'int');
  221. if ($limitstart < 0) $limitstart = 0;
  222. $page = V::get('page', 0, $_REQUEST, 'int');
  223. $limitstart = ($page - 1) * $limit;
  224. $search = V::get('search', '', $_REQUEST);
  225. $searchParams = [];
  226. if (!empty($search)) {
  227. $ogcSearch = "*{$search}*"; // wildCard="*" -> mysql '%'
  228. $searchParams['ogc:Filter'] = '
  229. <ogc:Filter>
  230. <ogc:Or>
  231. <ogc:PropertyIsLike wildCard="" singleChar="%23" escapeChar="!">
  232. <ogc:PropertyName>NIP</ogc:PropertyName>
  233. <ogc:Literal>' . $ogcSearch . '</ogc:Literal>
  234. </ogc:PropertyIsLike>
  235. <ogc:PropertyIsLike wildCard="*" singleChar="%23" escapeChar="!">
  236. <ogc:PropertyName>Nazwa_grupy_kapitalowej</ogc:PropertyName>
  237. <ogc:Literal>' . $ogcSearch . '</ogc:Literal>
  238. </ogc:PropertyIsLike>
  239. <ogc:PropertyIsLike wildCard="*" singleChar="%23" escapeChar="!">
  240. <ogc:PropertyName>Pelna_nazwa_kontrahenta</ogc:PropertyName>
  241. <ogc:Literal>' . $ogcSearch . '</ogc:Literal>
  242. </ogc:PropertyIsLike>
  243. </ogc:Or>
  244. </ogc:Filter>
  245. ';
  246. }
  247. $backRefFilter = [];
  248. if ($idGroup > 0) {
  249. $backRefFilter['__backRef'] = [
  250. 'namespace' => 'default_db/BI_audit_ENERGA_PRACOWNICY_GRUPY/BI_audit_ENERGA_KONTRAHENCIS_GRUPY', // TODO: nowy rejetr na grupy / filty KONTRAHENCI
  251. 'primaryKey' => $idGroup,
  252. 'fieldName' => 'default_db__x3A__BI_audit_ENERGA_PRACOWNICY:BI_audit_ENERGA_KONTRAHENCIS',
  253. ];
  254. // TODO: Storage dodać obiekt xsd default_db/BI_audit_ENERGA_PRACOWNICY_GRUPY/BI_audit_ENERGA_KONTRAHENCI_GRUPY:
  255. // - ID
  256. // - ID_USER - id usera który stworzył grupę (tylko dla niego będzie widoczna)
  257. // - NAZWA - nazwa grupy
  258. // - 'default_db/BI_audit_ENERGA_PRACOWNICY/BI_audit_ENERGA_KONTRAHENCI' minOccurs="0" maxOccurs="unbounded"
  259. }
  260. $acl = ACL::getAclByNamespace('default_db/BI_audit_ENERGA_RUM_KONTRAHENCI/BI_audit_ENERGA_RUM_KONTRAHENCI');
  261. $query = $acl->buildQuery(array_merge([
  262. 'cols' => [ // TODO:? propertyName = []
  263. 'ID',
  264. 'Nazwa_grupy_kapitalowej',
  265. 'Pelna_nazwa_kontrahenta',
  266. 'Numer_kontrahenta',
  267. 'Skrocona_Nazwa_Kontrahenta',
  268. 'Typ_kontrahenta',
  269. 'NIP',
  270. 'KRS',
  271. 'REGON',
  272. 'PESEL',
  273. 'Forma_prawna_dzialalnosci',
  274. 'Ulica',
  275. 'Numer_budynku',
  276. 'Numer_mieszkania_lokalu',
  277. 'Miejscowosc',
  278. 'Kod_pocztowy',
  279. 'Kraj',
  280. 'Telefon',
  281. 'Fax',
  282. 'Mail',
  283. 'A_ADM_COMPANY',
  284. 'A_CLASSIFIED',
  285. 'A_STATUS',
  286. 'A_STATUS_INFO',
  287. 'Dodano',
  288. 'L_APPOITMENT_USER',
  289. 'Podmiot_dominujacy',
  290. 'Tytul_dokumentu',
  291. 'ownCompany',
  292. 'uwagi',
  293. ],
  294. //'f_ID' => $id,
  295. 'limit' => $limit,
  296. 'limitstart' => $limitstart, // offset
  297. ], $searchParams, $backRefFilter));
  298. $total = $query->getTotal();
  299. $items = $query->getItems();
  300. $pagination = array();
  301. $pagination['total_items'] = $total;
  302. $pagination['size'] = ceil($total/$limit); // pages size
  303. $pagination['current'] = $page;
  304. $pagination['limit'] = $limit;
  305. return [
  306. 'type' => 'success',
  307. 'msg' => 'showKontrajenci',
  308. '__req_args' => $_REQUEST,
  309. '__args' => $args,
  310. 'body' => [
  311. 'items' => $items,
  312. //'view' => $this->htmlViewFormBiAudit($items, 'KONTRAHENCI'),
  313. 'pagination' => $pagination
  314. ]
  315. ];
  316. }
  317. //
  318. // public function fetchKontrahenciAjaxOld($args) {
  319. // //$id = V::get('ID', 1, $_REQUEST, 'int');
  320. // $items = ACL::getAclByNamespace('default_db/BI_audit_ENERGA_RUM_KONTRAHENCI/BI_audit_ENERGA_RUM_KONTRAHENCI')->buildQuery([
  321. // 'cols' => [ // TODO:? propertyName = []
  322. // 'ID',
  323. // 'Nazwa_grupy_kapitalowej',
  324. // 'Pelna_nazwa_kontrahenta',
  325. // 'NIP',
  326. // 'KRS',
  327. // 'REGON',
  328. // 'Miejscowosc',
  329. // 'Kod_pocztowy',
  330. // 'Telefon'
  331. // ],
  332. // //'f_ID' => $id,
  333. // ])->getItems([
  334. // 'limit' => 10
  335. // ]);
  336. //
  337. // return [
  338. // 'type' => 'success',
  339. // 'msg' => 'showKontrahenci',
  340. // '__req_args' => $_REQUEST,
  341. // '__args' => $args,
  342. // 'body' => [
  343. // 'items' => $items,
  344. // 'view' => $this->htmlViewFormBiAudit($items, 'KONTRAHENCI')
  345. // ]
  346. // ];
  347. // }
  348. public function showTableKontrahenci($items) {
  349. $view = '<form class="form-horizontal" method="post">
  350. <table class="table table-bordered table-hover table-striped" height=5>
  351. <thead>
  352. <tr>
  353. <td width=1><input type="checkbox" name="checkAll" id="checkAll-KONTRAHENCI" /></td>
  354. <td width=1>ID</td>
  355. <td>Nazwa grupy kapitalowej</td>
  356. <td>Pelna nazwa kontrahenta</td>
  357. <td>Numer kontrahenta</td>
  358. <td>Skrócona nazwa kontrahenta</td>
  359. <td>Typ_kontrahenta</td>
  360. <td>NIP</td>
  361. <td>KRS</td>
  362. <td>Regon</td>
  363. <td>PESEL</td>
  364. <td>Forma prawna działalności</td>
  365. <td>Ulica</td>
  366. <td>Numer budynku</td>
  367. <td>Numer mieszkania lokalu</td>
  368. <td>Miejscowosc</td>
  369. <td>Kod pocztowy</td>
  370. <td>Kraj</td>
  371. <td>Telefon</td>
  372. <td>Fax</td>
  373. <td>Mail</td>
  374. <td>A_ADM_COMPANY</td>
  375. <td>A_CLASSIFIED</td>
  376. <td>A_STATUS</td>
  377. <td>A_STATUS_INFO</td>
  378. <td>Dodano</td>
  379. <td>L_APPOITMENT_USER</td>
  380. <td>Podmiot dominujacy</td>
  381. <td>Tytul dokumentu</td>
  382. <td>ownCompany</td>
  383. <td>uwagi</td>
  384. </tr>
  385. </thead>
  386. <tbody id="body-kontrahenci">
  387. </tbody></table>
  388. </form>
  389. ';
  390. return $view;
  391. }
  392. // tworzenie grupy kontrahentów
  393. public function createKontrahenciGroupAjaxAction() {
  394. Response::sendTryCatchJson(array($this, 'createKontrahenciGroupAjax'), $args = 'JSON_FROM_REQUEST_BODY'); // użyj tej wersji jeśli chcesz wysyłać z przelgądarki JSON-a post-em
  395. }
  396. public function createKontrahenciGroupAjax($args) {
  397. $nazwa = V::get('NAZWA', '', $args);
  398. // TODO: vlaidacja nazwy - sprawdzenie czy już nie występuje
  399. $idGroup = DB::getPDO()->insert('BI_audit_ENERGA_KONTRAHENCI_GRUPY', [
  400. 'A_RECORD_CREATE_AUTHOR' => User::getLogin(),
  401. 'A_RECORD_CREATE_DATE' => 'NOW()',
  402. 'NAZWA' => $nazwa,
  403. ]);
  404. return [
  405. 'msg' => "Utworzona grupę {$idGroup}",
  406. 'type' => "success",
  407. 'body' => [
  408. 'id' => $idGroup,
  409. ]
  410. ];
  411. }
  412. // Dodanie do grupy filtra kontrahentów
  413. public function addKontrahenciToGroupAjaxAction() {
  414. // Response::sendTryCatchJson(array($this, 'addKontrahenciToGroupAjax'), $args = 'JSON_FROM_REQUEST_BODY'); // użyj tej wersji jeśli chcesz wysyłać z przelgądarki JSON-a post-em
  415. Response::sendTryCatchJson(array($this, 'addKontrahenciToGroupAjax'));
  416. }
  417. public function addKontrahenciToGroupAjax($args) {
  418. $idGroup = V::get('idGroup', 0, $_REQUEST, 'int');
  419. $kontrahenciIds = V::get('kontrahenciIds', [], $_REQUEST, 'array');
  420. // validate
  421. if (!$idGroup) throw new Exception("Nie wybrano grupa");
  422. if (!$kontrahenciIds || count($kontrahenciIds) == 0 ) throw new Exception("Proszę wybrać kontrahentów");
  423. $group = ACL::getAclByNamespace('default_db/BI_audit_ENERGA_KONTRAHENCI_GRUPY/BI_audit_ENERGA_KONTRAHENCI_GRUPY')->buildQuery([
  424. 'cols' => [ // TODO:? propertyName = []
  425. 'ID',
  426. 'ID_USER',
  427. 'NAZWA',
  428. ],
  429. // 'f_ID_USER' => User::getID()
  430. ])->getItem($idGroup);
  431. if (!$group) throw new Exception("Grupa nie istnieje");
  432. if (User::getID() != $group['ID_USER']) throw new Exception("Brak uprawnień do grupy");
  433. // $refGrupyToPracownicy = ACL::getRefTable('obiekt główny', 'nazwa pola - powiązane rekordy');
  434. $refGrupyToKontrahenci = ACL::getRefTable('default_db/BI_audit_ENERGA_KONTRAHENCI_GRUPY/BI_audit_ENERGA_KONTRAHENCI_GRUPY',
  435. 'default_db__x3A__BI_audit_ENERGA_KONTRAHENCI:BI_audit_ENERGA_KONTRAHENCI');
  436. foreach ($kontrahenciIds as $kontrahentIds) {
  437. DB::getPDO()->insert($refGrupyToKontrahenci, ['PRIMARY_KEY' => $idGroup, 'REMOTE_PRIMARY_KEY' => $kontrahentIds]);
  438. }
  439. return [
  440. 'msg' => "Powiązano kontrahentów z grupą {$idGroup}",
  441. 'type' => "success",
  442. ];
  443. }
  444. public function fetchGroupKontrahenciAjaxAction() {
  445. Response::sendTryCatchJson(array($this, 'fetchGroupKontrahenciAjax'));
  446. }
  447. public function fetchGroupKontrahenciAjax() {
  448. // TODO: odkomentować jak zostanie dodana tabela default_db/BI_audit_ENERGA_KONTRAHENCI_GRUPY/BI_audit_ENERGA_KONTRAHENCI_GRUPY
  449. /*$group = ACL::getAclByNamespace('default_db/BI_audit_ENERGA_KONTRAHENCI_GRUPY/BI_audit_ENERGA_KONTRAHENCI_GRUPY')->buildQuery([
  450. 'cols' => [ // TODO:? propertyName = []
  451. 'ID',
  452. 'ID_USER',
  453. 'NAZWA',
  454. ],
  455. 'f_ID_USER' => User::getID()
  456. ])->getItem($idGroup);
  457. if (!$group) throw new Exception("Grupa nie istnieje");
  458. if (User::getID() != $group['ID_USER']) throw new Exception("Brak uprawnień do grupy");
  459. $itemsKontrahenci = $query->getItems();
  460. $arrayGroupKontrahenci = array();
  461. foreach ($itemsKontrahenci as $key => $value) {
  462. $arrayGroupKontrahenci[$value['ID']] = $value['NAZWA'];
  463. }
  464. */
  465. //TODO: USUNAĆ listę grup wpisane na sztywno
  466. $arrayGroupKontrahenci = array();
  467. $arrayGroupKontrahenci[0]["ID"] = 1;
  468. $arrayGroupKontrahenci[0]["NAZWA"] = "Grupa 1";
  469. $arrayGroupKontrahenci[1]["ID"] = 2;
  470. $arrayGroupKontrahenci[1]["NAZWA"] = "Grupa 2";
  471. $arrayGroupKontrahenci[2]["ID"] = 3;
  472. $arrayGroupKontrahenci[2]["NAZWA"] = "Grupa 3";
  473. $arrayGroupKontrahenci[3]["ID"] = 4;
  474. $arrayGroupKontrahenci[3]["NAZWA"] = "Grupa 4";
  475. $arrayGroupKontrahenci[4]["ID"] = 5;
  476. $arrayGroupKontrahenci[4]["NAZWA"] = "Grupa 5";
  477. $arrayGroupKontrahenci[5]["ID"] = 6;
  478. $arrayGroupKontrahenci[5]["NAZWA"] = "Grupa 6";
  479. $arrayGroupKontrahenci[6]["ID"] = 7;
  480. $arrayGroupKontrahenci[6]["NAZWA"] = "Grupa 7";
  481. $arrayGroupKontrahenci[7]["ID"] = 8;
  482. $arrayGroupKontrahenci[7]["NAZWA"] = "Grupa 8";
  483. $arrayGroupKontrahenci[8]["ID"] = 9;
  484. $arrayGroupKontrahenci[8]["NAZWA"] = "Grupa 9";
  485. $arrayGroupKontrahenci[9]["ID"] = 10;
  486. $arrayGroupKontrahenci[9]["NAZWA"] = "Grupa 10";
  487. $arrayGroupKontrahenci[9]["ID"] = 11;
  488. $arrayGroupKontrahenci[9]["NAZWA"] = "Grupa 11";
  489. return [
  490. 'type' => 'success',
  491. 'msg' => 'fetchKontrahenciToGroup',
  492. '__req_args' => $_REQUEST,
  493. '__args' => $args,
  494. 'body' => [
  495. 'itemsGroupKontrahenci' => $arrayGroupKontrahenci
  496. ]
  497. ];
  498. }
  499. /*
  500. * PRACOWNICY
  501. */
  502. public function fetchPracownicyAjaxAction() {
  503. // sleep(2);
  504. Response::sendTryCatchJson(array($this, 'fetchPracownicyAjax'));
  505. }
  506. public function fetchPracownicyAjax($args) {
  507. $idGroup = V::get('filterIdGroup', 0, $_REQUEST, 'int'); // TODO: dla filtrów "Wysokiego ryzyka" - przekazywany ID rekodu
  508. if ($idGroup < 0) $idGroup = 0;
  509. $limit = 2;
  510. $limitstart = V::get('limitstart', 0, $_REQUEST, 'int');
  511. if ($limitstart < 0) $limitstart = 0;
  512. $page = V::get('page', 0, $_REQUEST, 'int');
  513. $limitstart = ($page - 1) * $limit;
  514. $search = V::get('search', '', $_REQUEST);
  515. $searchParams = [];
  516. if (!empty($search)) {
  517. $ogcSearch = "*{$search}*"; // wildCard="*" -> mysql '%'
  518. $searchParams['ogc:Filter'] = '
  519. <ogc:Filter>
  520. <ogc:Or>
  521. <ogc:PropertyIsLike wildCard="" singleChar="%23" escapeChar="!">
  522. <ogc:PropertyName>nip</ogc:PropertyName>
  523. <ogc:Literal>' . $ogcSearch . '</ogc:Literal>
  524. </ogc:PropertyIsLike>
  525. <ogc:PropertyIsLike wildCard="*" singleChar="%23" escapeChar="!">
  526. <ogc:PropertyName>nazwisko</ogc:PropertyName>
  527. <ogc:Literal>' . $ogcSearch . '</ogc:Literal>
  528. </ogc:PropertyIsLike>
  529. </ogc:Or>
  530. </ogc:Filter>
  531. ';
  532. }
  533. $backRefFilter = [];
  534. if ($idGroup > 0) {
  535. $backRefFilter['__backRef'] = [
  536. 'namespace' => 'default_db/BI_audit_ENERGA_PRACOWNICY_GRUPY/BI_audit_ENERGA_PRACOWNICY_GRUPY', // TODO: nowy rejetr na grupy / filty pracowników
  537. 'primaryKey' => $idGroup,
  538. 'fieldName' => 'default_db__x3A__BI_audit_ENERGA_PRACOWNICY:BI_audit_ENERGA_PRACOWNICY',
  539. ];
  540. // TODO: Storage dodać obiekt xsd default_db/BI_audit_ENERGA_PRACOWNICY_GRUPY/BI_audit_ENERGA_PRACOWNICY_GRUPY:
  541. // - ID
  542. // - ID_USER - id usera który stworzył grupę (tylko dla niego będzie widoczna)
  543. // - NAZWA - nazwa grupy
  544. // - 'default_db/BI_audit_ENERGA_PRACOWNICY/BI_audit_ENERGA_PRACOWNICY' minOccurs="0" maxOccurs="unbounded"
  545. }
  546. $acl = ACL::getAclByNamespace('default_db/BI_audit_ENERGA_PRACOWNICY/BI_audit_ENERGA_PRACOWNICY');
  547. $query = $acl->buildQuery(array_merge([
  548. 'cols' => [ // TODO:? propertyName = []
  549. 'ID',
  550. 'imiona',
  551. 'nazwisko',
  552. 'nip',
  553. 'pesel',
  554. 'regon',
  555. 'source',
  556. 'A_ADM_COMPANY',
  557. 'A_CLASSIFIED',
  558. 'A_STATUS',
  559. 'A_STATUS_INFO',
  560. 'L_APPOITMENT_USER',
  561. 'default_db__x3A__BI_audit_ENERGA_PRACOWNICY_adresy:BI_audit_ENERGA_PRACOWNICY_adresy/*'
  562. ],
  563. //'f_ID' => $id,
  564. 'limit' => $limit,
  565. 'limitstart' => $limitstart, // offset
  566. // 'order_by' => 'ID', // sortowanie po kolumnie
  567. // 'order_dir' => 'DESC', // kierunek sortowania
  568. // 'f_nip' = "=12345", // szukamy dokładnie tej wartości - mysql: where nip = "12345"
  569. // 'f_nip' = "12345", // szukamy dokładnie tej wartości - mysql: where nip like "%12345%"
  570. // 'f_nip' = "12345%", // szukamy dokładnie tej wartości - mysql: where nip like "12345%"
  571. // 'f_ID' = "=12345", // szukamy dokładnie tej wartości - mysql: where ID = "12345"
  572. ], $searchParams, $backRefFilter));
  573. $total = $query->getTotal();
  574. $items = $query->getItems();
  575. $pagination = array();
  576. $pagination['total_items'] = $total;
  577. $pagination['size'] = ceil($total/$limit); // pages size
  578. $pagination['current'] = $page;
  579. $pagination['limit'] = $limit;
  580. // { // tworzenie własnego zapytanie mysql
  581. // $rootTableName = $acl->getRootTableName();
  582. // DB::getPDO()->fetchAll("
  583. // select t.*
  584. // from {$rootTableName} t
  585. // where t.ID in (
  586. // select x.ID
  587. // from ... x
  588. // where
  589. // )
  590. // ");
  591. // }
  592. return [
  593. 'type' => 'success',
  594. 'msg' => 'showPracownicy',
  595. '__req_args' => $_REQUEST,
  596. '__args' => $args,
  597. 'body' => [
  598. 'items' => $items,
  599. //'view' => $this->htmlViewFormBiAudit($items, 'PRACOWNICY'),
  600. 'pagination' => $pagination
  601. ]
  602. ];
  603. }
  604. public function showTablePracownicy() {
  605. $view = '<form class="form-horizontal" method="post">
  606. <table class="table table-responsive table-bordered table-hover table-striped" height=5>
  607. <thead>
  608. <tr>
  609. <td width=1><input type="checkbox" name="checkAll" id="checkAll-PRACOWNICY" /></td>
  610. <td width=1>ID</td>
  611. <td>Imię/Imiona</td>
  612. <td>Nazwisko</td>
  613. <td>NIP</td>
  614. <td>Pesel</td>
  615. <td>Regon</td>
  616. <td>source</td>
  617. <td>A_ADM_COMPANY</td>
  618. <td>A_CLASSIFIED</td>
  619. <td>A_STATUS</td>
  620. <td>A_STATUS_INFO</td>
  621. <td>L_APPOITMENT_USER</td>
  622. <td>Adresy</td>
  623. </tr>
  624. </thead>
  625. <tbody id="body-pracownicy">
  626. </tbody></table>
  627. </form>';
  628. return $view;
  629. }
  630. // tworzenie grupy pracowników
  631. public function createPracownicyGroupAjaxAction() {
  632. Response::sendTryCatchJson(array($this, 'createPracownicyGroupAjax'), $args = 'JSON_FROM_REQUEST_BODY'); // użyj tej wersji jeśli chcesz wysyłać z przelgądarki JSON-a post-em
  633. // Response::sendTryCatchJson(array($this, 'createPracownicyGroupAjax'));
  634. }
  635. public function createPracownicyGroupAjax($args) {
  636. $nazwa = V::get('NAZWA', '', $args);
  637. // TODO: vlaidacja nazwy - sprawdzenie czy już nie występuje
  638. // validate
  639. if (!$nazwa) throw new Exception("Nie wybrano grupa");
  640. if (!$kontrahenciIds || count($kontrahenciIds) == 0 ) throw new Exception("Proszę wybrać kontrahentów");
  641. $idGroup = DB::getPDO()->insert('BI_audit_ENERGA_PRACOWNICY_GRUPY', [
  642. 'A_RECORD_CREATE_AUTHOR' => User::getLogin(),
  643. 'A_RECORD_CREATE_DATE' => 'NOW()',
  644. // 'A_STATUS' => 'WAITING', // jeśli trzeba to ustawić
  645. 'NAZWA' => $nazwa,
  646. ]);
  647. // DB::getPDO()->insert('BI_audit_ENERGA_PRACOWNICY_GRUPY_HIST', [
  648. // 'A_RECORD_CREATE_AUTHOR' => User::getLogin(),
  649. // 'A_RECORD_CREATE_DATE' => 'NOW()',
  650. // 'ID_USERS2' => $idRaport,
  651. // // 'A_STATUS' => 'WAITING', // jeśli trzeba to ustawić
  652. // 'NAZWA' => $nazwa,
  653. // ]);
  654. return [
  655. 'msg' => "Utworzona grupę {$idGroup}",
  656. 'type' => "success",
  657. 'body' => [
  658. 'id' => $idGroup,
  659. ]
  660. ];
  661. }
  662. // Dodanie do grupy filtra pracowników
  663. public function addPracownicyToGroupAjaxAction() {
  664. // Response::sendTryCatchJson(array($this, 'addPracownicyToGroupAjax'), $args = 'JSON_FROM_REQUEST_BODY'); // użyj tej wersji jeśli chcesz wysyłać z przelgądarki JSON-a post-em
  665. Response::sendTryCatchJson(array($this, 'addPracownicyToGroupAjax'));
  666. }
  667. public function addPracownicyToGroupAjax($args) {
  668. $idGroup = V::get('idGroup', 0, $_REQUEST, 'int');
  669. $pracownicyIds = V::get('pracownicyIds', [], $_REQUEST, 'array');
  670. // validate
  671. if (!$nazwa) throw new Exception("Nie wybrano grupa");
  672. if (!$pracownicyIds || count($pracownicyIds) == 0 ) throw new Exception("Proszę wybrać pracowników");
  673. // TODO: SPRWADZENIE CZY NIE DODANOU JUZ PRACOWNIKAS
  674. // default_db/BI_audit_ENERGA_PRACOWNICY_GRUPY/BI_audit_ENERGA_PRACOWNICY_GRUPY
  675. // default_db/BI_audit_ENERGA_PRACOWNICY/BI_audit_ENERGA_PRACOWNICY
  676. $group = ACL::getAclByNamespace('default_db/BI_audit_ENERGA_PRACOWNICY_GRUPY/BI_audit_ENERGA_PRACOWNICY_GRUPY')->buildQuery([
  677. 'cols' => [ // TODO:? propertyName = []
  678. 'ID',
  679. 'ID_USER',
  680. 'NAZWA',
  681. ],
  682. // 'f_ID_USER' => User::getID()
  683. ])->getItem($idGroup);
  684. if (!$group) throw new Exception("Grupa nie istnieje");
  685. if (User::getID() != $group['ID_USER']) throw new Exception("Brak uprawnień do grupy");
  686. // $refGrupyToPracownicy = ACL::getRefTable('obiekt główny', 'nazwa pola - powiązane rekordy');
  687. $refGrupyToPracownicy = ACL::getRefTable('default_db/BI_audit_ENERGA_PRACOWNICY_GRUPY/BI_audit_ENERGA_PRACOWNICY_GRUPY',
  688. 'default_db__x3A__BI_audit_ENERGA_PRACOWNICY:BI_audit_ENERGA_PRACOWNICY');
  689. foreach ($pracownicyIds as $idPracownik) {
  690. DB::getPDO()->insert($refGrupyToPracownicy, ['PRIMARY_KEY' => $idGroup, 'REMOTE_PRIMARY_KEY' => $idPracownik]);
  691. }
  692. return [
  693. 'msg' => "Powiązano pracowników z grupą {$idGroup}",
  694. 'type' => "success",
  695. ];
  696. }
  697. public function fetchGroupPracownicyAjaxAction() {
  698. Response::sendTryCatchJson(array($this, 'fetchGroupPracownicyAjax'));
  699. }
  700. public function fetchGroupPracownicyAjax() {
  701. // TODO: odkomentować jak zostanie dodana tabela default_db/BI_audit_ENERGA_PRACOWNICY_GRUPY/BI_audit_ENERGA_PRACOWNICY_GRUPY
  702. /*$group = ACL::getAclByNamespace('default_db/BI_audit_ENERGA_PRACOWNICY_GRUPY/BI_audit_ENERGA_PRACOWNICY_GRUPY')->buildQuery([
  703. 'cols' => [ // TODO:? propertyName = []
  704. 'ID',
  705. 'ID_USER',
  706. 'NAZWA',
  707. ],
  708. 'f_ID_USER' => User::getID()
  709. ])->getItem($idGroup);
  710. if (!$group) throw new Exception("Grupa nie istnieje");
  711. if (User::getID() != $group['ID_USER']) throw new Exception("Brak uprawnień do grupy");
  712. $items = $query->getItems();
  713. $arrayGroupPracownicy = array();
  714. foreach ($items as $key => $value) {
  715. $arrayGroupPracownicy[$value['ID']] = $value['NAZWA'];
  716. }
  717. */
  718. //TODO: USUNAĆ listę grup wpisane na sztywno
  719. $arrayGroupPracownicy = array();
  720. $arrayGroupPracownicy[0]["ID"] = 1;
  721. $arrayGroupPracownicy[0]["NAZWA"] = "Grupa 1";
  722. $arrayGroupPracownicy[1]["ID"] = 2;
  723. $arrayGroupPracownicy[1]["NAZWA"] = "Grupa 2";
  724. $arrayGroupPracownicy[2]["ID"] = 3;
  725. $arrayGroupPracownicy[2]["NAZWA"] = "Grupa 3";
  726. $arrayGroupPracownicy[3]["ID"] = 4;
  727. $arrayGroupPracownicy[3]["NAZWA"] = "Grupa 4";
  728. $arrayGroupPracownicy[4]["ID"] = 5;
  729. $arrayGroupPracownicy[4]["NAZWA"] = "Grupa 5";
  730. return [
  731. 'type' => 'success',
  732. 'msg' => 'fetchGroupPracownicyAjax',
  733. '__req_args' => $_REQUEST,
  734. '__args' => $args,
  735. 'body' => [
  736. 'itmesGroupPracownicy' => $arrayGroupPracownicy
  737. ]
  738. ];
  739. }
  740. // link do ackji w php: $saveFormUrl = $this->getLink('saveRaportAjax');
  741. // przekazać link do JavaScript i tam:
  742. // window.fetch('{$saveFormUrl}', { ... }).then(...) - dokumentacja: https://github.com/github/fetch
  743. public function generateBiAuditRaportAjaxAction() {
  744. //Response::sendTryCatchJson(array($this, 'saveRaportAjax'), $args = 'JSON_FROM_REQUEST_BODY'); // użyj tej wersji jeśli chcesz wysyłać z przelgądarki JSON-a post-em
  745. Response::sendTryCatchJson(array($this, 'generateBiAuditRaportAjax'), $args = 'JSON_FROM_REQUEST_BODY');
  746. //Response::sendTryCatchJson(array($this, 'generateBiAuditRaportAjax'));
  747. }
  748. public function generateBiAuditRaportAjax($args) {
  749. // głebokość powiazan
  750. $depthValue = V::get('depthValue', '', $args);
  751. if (!$depthValue) {
  752. throw new Exception("Nie podano wartości dla głębokości powiązań");
  753. }
  754. // Tworzenie relacji Raport do Pracownicy
  755. $pracownicyIds = []; // array z nr ID na podstawie wysłanego formularza
  756. $pracownicyIds = V::get('pracownicyIds', '', $args);
  757. // walidacja id pracowników
  758. if (!$pracownicyIds) {
  759. throw new Exception("Nie wybrano pracowników");
  760. }
  761. $kontrahenciIds = []; // array z nr ID na podstawie wysłanego formularza
  762. $kontrahenciIds = V::get('kontrahenciIds', '', $args);
  763. // walidacja id kontrahetów
  764. if (!$kontrahenciIds) {
  765. throw new Exception("Nie wybrano kontrahentów");
  766. }
  767. // Tworzenie rekrodu w bazie - Raport -
  768. $idRaport = DB::getPDO()->insert('BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA', [
  769. 'A_RECORD_CREATE_AUTHOR' => User::getLogin(),
  770. 'A_RECORD_CREATE_DATE' => 'NOW()',
  771. 'A_STATUS' => 'WAITING', // TODO: czy trzeba to ustawić (pytanie do Mariusza)
  772. 'FILE_STATUS' => "TO_GENERATE",
  773. 'BI_analiza_minDepth' => 1,
  774. 'BI_analiza_maxDepth' => $depthValue
  775. ]);
  776. // Tworzenie relacji Raport do Pracownicy
  777. $refPowiazaniaToPracownicy = ACL::getRefTable('default_db/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA',
  778. 'default_db__x3A__BI_audit_ENERGA_PRACOWNICY:BI_audit_ENERGA_PRACOWNICY');
  779. foreach ($pracownicyIds as $idPracownik) {
  780. DB::getPDO()->insert($refPowiazaniaToPracownicy, ['PRIMARY_KEY' => $idRaport, 'REMOTE_PRIMARY_KEY' => $idPracownik]);
  781. }
  782. // Tworzenie relacji Raport do Kontrahenci - analogicznie jak wyżej
  783. $refPowiazaniaToKontrahenci = ACL::getRefTable('default_db/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA',
  784. 'default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI:BI_audit_ENERGA_RUM_KONTRAHENCI');
  785. foreach ($kontrahenciIds as $idKontrahent) {
  786. DB::getPDO()->insert($refPowiazaniaToKontrahenci, ['PRIMARY_KEY' => $idRaport, 'REMOTE_PRIMARY_KEY' => $idKontrahent ]);
  787. }
  788. // ...
  789. return [
  790. 'msg' => "Zadanie do wygnerowania raportu zostało zapisane.",
  791. 'type' => "success",
  792. 'body' => [
  793. 'id' => $idRaport,
  794. ]
  795. ];
  796. }
  797. public function defaultViewFormBiAudit($items, $type) {
  798. $activeFormSteps = '';
  799. switch($type) {
  800. case 'KONTRAHENCI':
  801. $activeFormStepsKontrahent = 'complete';
  802. $titleHeader = 'KONTRAHENCI';
  803. $groupFilterList = '
  804. <div class="menu-item">
  805. <ul class="padding-0">
  806. <li><a href="#" title="STWÓRZ GRUPĘ" class="btn btn-default" onClick="createGroupKontrahenci(event)" data-color-noactive="">+ STWÓRZ GRUPĘ</a></li>
  807. </ul>
  808. </div>
  809. <div id="group-kontrahenci" class="btn-group">
  810. <button class="btn btn-default active" title="Wszyscy" data-group-filter="0">Wszyscy</button>
  811. </div>';
  812. $showButtonNextStep = '<button type="button" class="btn btn-primary" onClick="generateBiAuditRaport(event)" id="button-generate-reaport">SZUKAJ POWIĄZAŃ</button>';
  813. $pagination_form = '<div id="pagination-kontrahenci"></div>';
  814. break;
  815. case 'PRACOWNICY':
  816. $titleHeader = 'PRACOWNICY';
  817. $groupFilterList = '
  818. <div class="menu-item">
  819. <ul class="padding-0">
  820. <li><a href="#" title="STWÓRZ GRUPĘ" class="btn btn-default" onClick="createGroupPracownicy(event)" data-color-noactive="">+ STWÓRZ GRUPĘ</a></li>
  821. </ul>
  822. </div>
  823. <div id="group-pracownicy" class="btn-group">
  824. <button class="btn btn-default active" title="Wszyscy" data-group-filter="0">Wszyscy</button>
  825. </div>';
  826. $showButtonNextStep = '<a href="index.php?_route=UrlAction_Bocian#KONTRAHENCI" title="DODAJ DO ANALIZY" class="btn btn-primary">DODAJ DO ANALIZY</a>';
  827. $pagination_form = '<div id="pagination-pracownicy"></div>';
  828. break;
  829. }
  830. $view = '
  831. <!-- start:employees-section-->
  832. <div id="smad-employees-section" class="smad-form-' . $type . '" >
  833. <div class="container-fluid">
  834. <div>
  835. <div class="padding-lr-0">
  836. <div id="smad-menu-section">
  837. <div class="col-sm-12 col-md-6 padding-lr-0">
  838. <div class="menu-items">
  839. <div class="smad-heder-title menu-item"><span class="smad-line-red">|</span> ' . $titleHeader . ' </div>
  840. </div>
  841. </div>
  842. <div class="col-sm-12 col-md-6 padding-lr-0">
  843. <div class="form-steps">
  844. <!-- start:form steps wizard -->
  845. <div class="row smad-wizard" style="border-bottom:0;">
  846. <div class="col-xs-4 col-md-4 smad-wizard-step complete"><!-- complited line -->
  847. <div class="text-center smad-wizard-stepnum">&nbsp;</div>
  848. <div class="progress"><div class="progress-bar"></div></div>
  849. <a href="https://bravecom.yellowgroup.pl/SE/index.php?_route=UrlAction_Bocian#PRACOWNICY" class="smad-wizard-dot"></a>
  850. <div class="smad-wizard-info complete text-center">
  851. <div class="step-item">Krok 1</div>
  852. <div class="step-title ">PRACOWNICY</div>
  853. </div>
  854. </div>
  855. <div class="col-xs-4 col-md-4 smad-wizard-step ' . $activeFormStepsKontrahent . ' ">
  856. <div class="text-center smad-wizard-stepnum">&nbsp;</div>
  857. <div class="progress"><div class="progress-bar"></div></div>
  858. <a href="https://bravecom.yellowgroup.pl/SE/index.php?_route=UrlAction_Bocian#KONTRAHENCI" class="smad-wizard-dot"></a>
  859. <div class="smad-wizard-info text-center">
  860. <div class="step-item">Krok 2</div>
  861. <div class="step-title ">KONTRAHENCI</div>
  862. </div>
  863. </div>
  864. <div class="col-xs-4 col-md-4 smad-wizard-step ">
  865. <div class="text-center smad-wizard-stepnum">&nbsp;</div>
  866. <div class="progress"><div class="progress-bar"></div></div>
  867. <a href="#" class="smad-wizard-dot"></a>
  868. <div class="smad-wizard-info text-center">
  869. <div class="step-item">Krok 3</div>
  870. <div class="step-title ">SZUKANIE POWIĄZAŃ</div>
  871. </div>
  872. </div>
  873. </div>
  874. <!-- end:form steps wizard -->
  875. </div>
  876. </div>
  877. </div>
  878. </div>
  879. </div>
  880. </div>
  881. <div class="container-fluid">
  882. <div class=" padding-lr-0">
  883. <div class="smad-divider"></div>
  884. </div>
  885. </div>
  886. <!-- start:filters -->
  887. <div class="container-fluid">
  888. <div class="row">
  889. <div>
  890. <div class="smad-employees-form-section" class="border-top-grey">
  891. <div class="col-md-9 smad-border-col">
  892. <div class="menu-items">
  893. '.$groupFilterList.'
  894. </div>
  895. </div>
  896. <div class="col-md-3">
  897. <div class="form-input">
  898. <div class="form-item col-md-6 smad-heder-title">głębokość powiązań:</div>
  899. <div class="form-item col-md-6">
  900. <input type="text" class="form-control smad-depth" placeholder="1-16" value="" />
  901. </div>
  902. </div>
  903. </div>
  904. </div>
  905. </div>
  906. </div>
  907. </div>
  908. <!-- end:filters -->
  909. <!-- start:list employees -->
  910. <div class="container-fluid">
  911. <div class="padding-0 smad-employees-list-head">
  912. <div class="col-md-6">
  913. <header>
  914. <h2 class="title">Wszyscy</h2>
  915. </header>
  916. <div class="desc">
  917. Lorem Ipsum jest tekstem stosowanym jako przykładowy wypełniacz w przemyśle poligraficznym.
  918. </div>
  919. </div>
  920. <div class="col-md-6">
  921. <div class="menu-items">
  922. <div class="menu-item">
  923. <ul class="padding-0">
  924. <li><a href="#" title="IMPORT PRACOWNIKÓW" class="btn btn-info data-color-noactive="">IMPORT PRACOWNIKÓW</a></li>
  925. <li><a href="#" title="DODAJ PRACOWNIKÓW" class="btn btn-info" data-color-noactive="">+ DODAJ PRACOWNIKÓW</a></li>
  926. </ul>
  927. </div>
  928. </div>
  929. </div>
  930. </div>
  931. </div>
  932. <div class="container-fluid">
  933. <div class="table-responsive padding-0" id="smad-table-' . $type . '">
  934. ' . $this->showListDataByType($items, $type) . '
  935. </div>
  936. </div>
  937. <!-- end:list employees -->
  938. <!-- start:list paginations employees -->
  939. <div class="container-fluid ">
  940. <div>
  941. '. $pagination_form .'
  942. </div>
  943. </div>
  944. <!-- end:list paginations employees -->
  945. <!-- start:bottom buttons -->
  946. <div class="container-fluid smad-employees-bottom-navigation">
  947. <div class="padding-0">
  948. <div class="col-lg-6 ">
  949. <a href="#" title="PRZENIEŚ DO GRUPY" onClick="addPracownikToGroup(event)" class="btn btn-info">PRZENIEŚ DO GRUPY</a>
  950. </div>
  951. <div class="col-lg-6 text-right">
  952. ' . $showButtonNextStep . '
  953. </div>
  954. </div>
  955. </div>
  956. <!-- end:bottom buttons -->
  957. </div>
  958. <!-- start:employees-section -->
  959. ';
  960. return $view;
  961. }
  962. public function showListDataByType($items, $type='PRACOWNICY') {
  963. switch ($type) {
  964. case 'PRACOWNICY':
  965. return $this->showTablePracownicy();
  966. break;
  967. case 'KONTRAHENCI':
  968. return $this->showTableKontrahenci($items);
  969. break;
  970. }
  971. }
  972. }