Bocian.php 38 KB

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