Bocian.php 42 KB

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