123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203 |
- <?php
- Lib::loadClass('RouteToolBase');
- Lib::loadClass('UI');
- Lib::loadClass('Response');
- // index.php?_route=UrlAction_BiAuditRaport - uruchamia defaultAction
- class Bocian extends RouteToolBase {
- public function defaultAction() {
- UI::gora();
- echo UI::h('script', ['src'=>"static/sweetalert2.min.js"]);
- echo UI::h('link', ['rel'=>"stylesheet", 'type'=>"text/css", 'href'=>"static/sweetalert2.min.css"]);
- Theme::top();
- //echo '<div id="smad-wrapper">'; // todo: sprawdzi czy można usunać
- echo '<div class="container-bi_audit_form_pracownicy_raport" style="display: none;"></div>';
- echo '<div class="container-bi_audit_form_kontrahenci_raport" style="display: none;"></div>';
- // echo '<div class="container-bi_audit_form_raport_data" style="display: none;"></div>';
- UI::inlineJS(__FILE__ . '.view.js', [
- 'URL_FETCH_KONTRAHENCI_POWIAZANIA' => $this->getLink('fetchEnergaRumKontrahenciPowiazaniaAjax'),
- 'URL_FETCH_TEST_KRS' => $this->getLink('fetchTestKrsAjax'),
- 'URL_FETCH_TEST_CEIDG' => $this->getLink('fetchTestCeidgAjax'),
- 'URL_FETCH_PRACOWNICY' => $this->getLink('fetchPracownicyAjax'),
- 'URL_FETCH_KONTRAHENCI' => $this->getLink('fetchKontrahenciAjax'),
- 'URL_CREATE_PRACOWNICY_GROUP' => $this->getLink('createPracownicyGroupAjax'),
- 'URL_CREATE_KONTRAHENCIS_GROUP' => $this->getLink('createKontrahenciGroupAjax'),
- 'URL_ADD_PRACOWNICY_TO_GROUP' => $this->getLink('addPracownicyToGroupAjax'),
- 'URL_ADD_KONTRAHENCI_TO_GROUP' => $this->getLink('addKontrahenciToGroupAjax'),
- 'URL_FETCH_GROUP_PRACOWNICY' => $this->getLink('fetchGroupPracownicyAjax'),
- 'URL_FETCH_GROUP_KONTRAHENCI' => $this->getLink('fetchGroupKontrahenciAjax'),
- 'URL_GENERATE_BI_AUDIT_RAPORT_AJAX' => $this->getLink('generateBiAuditRaportAjax'),
- 'DBG' => V::get('DBG', 0, $_GET),
- 'VIEW_KONTRAHENCI' => $this->defaultViewFormBiAudit([], 'KONTRAHENCI'),
- 'VIEW_PRACOWNICY' => $this->defaultViewFormBiAudit([], 'PRACOWNICY'),
- 'URL_PARSE_CSV_FILE_AJAX' => $this->getLink('parseCsvFileAjax'),
- 'URL_SAVE_FORM_CSV_FILE_AJAX' => $this->getLink('saveFormCsvFileAjax'),
- ]);
- echo '</div>'; // #smad-wrapper
- UI::dol();
- }
- /**
- * Funkcja ajax do odebrania danych z przesłanego pliku CSV do parsowania
- */
- public function parseCsvFileAjaxAction() {
- Response::sendTryCatchJson(array($this, 'parseCsvFileAjax')); // , $args = 'JSON_FROM_REQUEST_BODY');
- }
- /**
- * Funkcja parsuje dane wgrywanego plku csv
- */
- public function parseCsvFileAjax() {
- if (!file_exists($_FILES['file']['tmp_name'])) throw new Exception("Wybierz plik do przesłania.");
- $file = file($_FILES['file']['tmp_name']);
- // nagłowki csv
- $headCsv = array();
- // wiersze CSV(poza pierwszym)
- $arrayRows = array();
- $i = 0;
- $viewFormHtml = '<div id="smad-window-modal" style="overflow-x: scroll;"><form method="POST" id="formDataFromCsv" >';
- foreach ($file as $line) {
- if ( $i == 0 ) {
- $headCsv = explode(';', $line);
- } else {
- $arrayRows = explode(';', $line);
- $viewFormHtml .= '<div style="margin: 10px 0"><span>'.$i.'. </span>';
- foreach ($arrayRows as $keyData => $rowData) {
- // sprawdzenie czy ustawiony naglówek - jeśli nie to wyświetl komunikat
- // if ($headCsv[$keyData]) throw new Exception("Brak nagłówka w kolumnie " . ($keyData + 1) . "w pliku CSV.");
- // usuwamy puste znaki i znaki od nowej linii
- $rowData = trim(str_replace(array("\n", "\r", "\r\n", "\n\r"), ' ', $rowData));
- $nameValue = trim(str_replace(array("\n", "\r", "\r\n", "\n\r"), ' ', $headCsv[$keyData]));
- // utworzenie inputa do edycji
- $viewFormHtml .= "<input type='text' name='item[$i][$nameValue]' value='".str_replace('"', '', $rowData )."' />";
- }
- $viewFormHtml .= '</div><div style="margin: 20px 0;"></div>';
- }
- $i++;
- }
- $viewFormHtml .= '</form></div>';
- //return $viewFormHtml;
- return [
- 'type' => 'success',
- 'msg' => 'OK',
- '__req_args' => $_REQUEST,
- '__args' => $args,
- 'body' => [
- 'view' => $viewFormHtml,
- ]
- ];
- // if (!isset($_FILES['fileData'])) throw new Exception("Błąd formularza ");
- }
- /**
- * Funkcja ajax do odebrania danych z przesłanego formularza z parsowanego CSV
- */
- public function saveFormCsvFileAjaxAction() {
- Response::sendTryCatchJson(array($this, 'saveFormCsvFileAjax'), $args = 'JSON_FROM_REQUEST_BODY');
- Response::sendTryCatchJson(array($this, 'saveFormCsvFileAjax'));
- }
- /**
- * Funkcja ajax do zapisania danych z przesłanego formularza z parsowanego CSV
- */
- public function saveFormCsvFileAjax($args) {
- $formData = V::get('formData', '', $args);
- parse_str($formData, $resultArrayFormdata);
- //$formData = V::get('formData', '', $_REQUEST, '');
- print_r($resultArrayFormdata);
- //print_r($formData);
- //todo: dane do zapisania z formularza
- }
- public function fetchEnergaRumKontrahenciPowiazaniaAjaxAction() {
- Response::sendTryCatchJson(array($this, 'fetchEnergaRumKontrahenciPowiazaniaAjax')); // , $args = 'JSON_FROM_REQUEST_BODY');
- }
- public function fetchEnergaRumKontrahenciPowiazaniaAjax($args) {
- $id = V::get('ID', 26, $_REQUEST, 'int');
- $items = ACL::getAclByNamespace('default_db/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA')->buildQuery([
- 'cols' => [ // TODO:? propertyName = []
- 'ID',
- 'A_ADM_COMPANY',
- 'L_APPOITMENT_USER',
- 'A_CLASSIFIED',
- 'A_STATUS',
- 'A_STATUS_INFO',
- 'BI_analiza_maxDepth',
- 'BI_analiza_minDepth',
- 'BI_analiza_onlyTargets',
- 'BI_analiza_reloadCache',
- 'FILE_STATUS',
- 'FILE_STATUS_info',
- 'L_APPOITMENT_USER',
- 'default_db__x3A__BI_audit_ENERGA_PRACOWNICY:BI_audit_ENERGA_PRACOWNICY',
- 'default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI:BI_audit_ENERGA_RUM_KONTRAHENCI',
- 'default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row',
- 'default_db__x3A__BI_audit_KW_requested_person:BI_audit_KW_requested_person',
- ],
- 'f_ID' => "{$id}",
- ])->getItems([
- 'limit' => 10
- ]);
- // $items = [
- // [ 'ID' => 1, 'L_APPOITMENT_INFO' => 'x', 'BI_analiza_depth' => 'a', 'FILE_STATUS' => 1, 'FILE_STATUS_info' => 'test1'],
- // [ 'ID' => 2, 'L_APPOITMENT_INFO' => 'y', 'BI_analiza_depth' => 'b', 'FILE_STATUS' => 0, 'FILE_STATUS_info' => 'test2'],
- // [ 'ID' => 3, 'L_APPOITMENT_INFO' => 'z', 'BI_analiza_depth' => 'c', 'FILE_STATUS' => 1, 'FILE_STATUS_info' => 'test3'],
- // ];
- return [
- 'type' => 'success',
- 'msg' => 'OK',
- '__req_args' => $_REQUEST,
- '__args' => $args,
- 'body' => [
- 'items' => $items,
- 'view' => $this->showPowiazaniaEnergaRumKontrahenciPowiazania($items),
- ]
- ];
- }
- public function showPowiazaniaEnergaRumKontrahenciPowiazania($items) {
- $view = '<form class="form-horizontal" method="post">
- <table class="table table-bordered table-hover table-striped" height=5>
- <thead>
- <tr style="">
- <td width=1><input type="checkbox" name="checkAll" id="checkAll" /></td>
- <td width=1>ID</td>
- <td>Adnotacje</td>
- <td>Głębokość analizy</td>
- <td>Status raportu</td>
- <td>Status raportu - informacje</td>
- </tr>
- </thead>
- <tbody>
- ';
- foreach ($items as $key => $row) {
- $view .= '<tr>
- <td><input type="checkbox" name="prID[]" value="'.$row['ID'].'" onClick="checkAll()"/></td>
- <td align="right">'.$row["ID"].'</td>
- <td align="right">'.$row["L_APPOITMENT_INFO"].'</td>
- <td align="right">'.$row["BI_analiza_depth"].'</td>
- <td align="right">'.$row["FILE_STATUS"].'</td>
- <td align="right">'.$row["FILE_STATUS_info"].'</td>';
- }
- $view .= '</tbody></table></form>';
- return $view;
- }
- public function fetchTestKrsAjaxAction() {
- Response::sendTryCatchJson(array($this, 'fetchTestKrsAjax')); // , $args = 'JSON_FROM_REQUEST_BODY');
- }
- public function fetchTestKrsAjax($args) {
- $id = V::get('ID', 1, $_REQUEST, 'int');
- $items = ACL::getAclByNamespace('default_db/BI_audit_KRS/BI_audit_KRS')->buildQuery([
- 'cols' => [ // TODO:? propertyName = []
- 'A_kod',
- 'A_kraj',
- 'A_miejscowosc',
- 'A_nrDomu',
- 'A_nrLokalu',
- 'A_poczta',
- 'A_ulica',
- 'ID',
- 'S_gmina',
- 'S_kraj',
- 'S_miejscowosc',
- 'S_powiat',
- 'S_wojewodztwo',
- 'dataDokumentu',
- 'default_db__x3A__BI_audit_KRS_company:BI_audit_KRS_company/ID',
- 'default_db__x3A__BI_audit_KRS_company:BI_audit_KRS_company/krs',
- 'default_db__x3A__BI_audit_KRS_company:BI_audit_KRS_company/nazwa',
- 'default_db__x3A__BI_audit_KRS_company:BI_audit_KRS_company/regon',
- 'default_db__x3A__BI_audit_KRS_person:BI_audit_KRS_person/ID',
- 'default_db__x3A__BI_audit_KRS_person:BI_audit_KRS_person/imiona',
- 'default_db__x3A__BI_audit_KRS_person:BI_audit_KRS_person/nazwisko',
- 'default_db__x3A__BI_audit_KRS_person:BI_audit_KRS_person/pesel',
- 'krs',
- 'nazwa',
- 'nip',
- 'regon',
- ],
- 'f_ID' => "{$id}",
- ])->getItems([
- 'limit' => 10
- ]);
- return [
- 'type' => 'success',
- 'msg' => 'KRS',
- '__req_args' => $_REQUEST,
- '__args' => $args,
- 'body' => [
- 'items' => $items,
- ]
- ];
- }
- public function fetchTestCeidgAjaxAction() {
- Response::sendTryCatchJson(array($this, 'fetchTestCeidgAjax')); // , $args = 'JSON_FROM_REQUEST_BODY');
- }
- public function fetchTestCeidgAjax($args) {
- $id = V::get('ID', 0, $_REQUEST, 'int');
- $items = ACL::getAclByNamespace('default_db/BI_audit_CEIDG/BI_audit_CEIDG')->buildQuery([
- 'cols' => [ // TODO:? propertyName = []
- 'ID',
- 'budynek',
- 'firma',
- 'gmina',
- 'identyfikatorWpisu',
- 'imie',
- 'kodPocztowy',
- 'kraj',
- 'lokal',
- 'miejscowosc',
- 'nazwisko',
- 'nip',
- 'poczta',
- 'powiat',
- 'regon',
- 'ulica',
- 'default_db__x3A__BI_audit_CEIDG_pelnomocnicy:BI_audit_CEIDG_pelnomocnicy/ID',
- 'default_db__x3A__BI_audit_CEIDG_pelnomocnicy:BI_audit_CEIDG_pelnomocnicy/budynek',
- 'default_db__x3A__BI_audit_CEIDG_pelnomocnicy:BI_audit_CEIDG_pelnomocnicy/gmina',
- 'default_db__x3A__BI_audit_CEIDG_pelnomocnicy:BI_audit_CEIDG_pelnomocnicy/kodPocztowy',
- 'default_db__x3A__BI_audit_CEIDG_pelnomocnicy:BI_audit_CEIDG_pelnomocnicy/lokal',
- 'default_db__x3A__BI_audit_CEIDG_pelnomocnicy:BI_audit_CEIDG_pelnomocnicy/miejscowosc',
- 'default_db__x3A__BI_audit_CEIDG_pelnomocnicy:BI_audit_CEIDG_pelnomocnicy/nazwa',
- 'default_db__x3A__BI_audit_CEIDG_pelnomocnicy:BI_audit_CEIDG_pelnomocnicy/nip',
- 'default_db__x3A__BI_audit_CEIDG_pelnomocnicy:BI_audit_CEIDG_pelnomocnicy/poczta',
- 'default_db__x3A__BI_audit_CEIDG_pelnomocnicy:BI_audit_CEIDG_pelnomocnicy/powiat',
- 'default_db__x3A__BI_audit_CEIDG_pelnomocnicy:BI_audit_CEIDG_pelnomocnicy/ulica',
- 'default_db__x3A__BI_audit_CEIDG_pelnomocnicy:BI_audit_CEIDG_pelnomocnicy/wojewodztwo',
- 'default_db__x3A__BI_audit_CEIDG_powiazania:BI_audit_CEIDG_powiazania/ID',
- 'default_db__x3A__BI_audit_CEIDG_powiazania:BI_audit_CEIDG_powiazania/nip',
- 'default_db__x3A__BI_audit_CEIDG_powiazania:BI_audit_CEIDG_powiazania/regon',
- ],
- // 'f_ID' => $id,
- ])->getItems([
- 'limit' => 10
- ]);
- return [
- 'type' => 'success',
- 'msg' => 'CEIDG',
- '__req_args' => $_REQUEST,
- '__args' => $args,
- 'body' => [
- 'items' => $items,
- ]
- ];
- }
- /**
- * KONTRAHENCI
- */
- public function fetchKontrahenciAjaxAction() {
- Response::sendTryCatchJson(array($this, 'fetchKontrahenciAjax'));
- }
- public function fetchKontrahenciAjax($args) {
- $idGroup = V::get('filterIdGroup', 0, $_REQUEST, 'int'); // TODO: dla filtrów "Wysokiego ryzyka" - przekazywany ID rekodu
- if ($idGroup < 0) $idGroup = 0;
- $limit = 5;
- $limitstart = V::get('limitstart', 0, $_REQUEST, 'int');
- if ($limitstart < 0) $limitstart = 0;
- $page = V::get('page', 0, $_REQUEST, 'int');
- $limitstart = ($page - 1) * $limit;
- $search = V::get('search', '', $_REQUEST);
- $searchParams = [];
- if (!empty($search)) {
- $ogcSearch = "*{$search}*"; // wildCard="*" -> mysql '%'
- $searchParams['ogc:Filter'] = '
- <ogc:Filter>
- <ogc:Or>
- <ogc:PropertyIsLike wildCard="" singleChar="%23" escapeChar="!">
- <ogc:PropertyName>NIP</ogc:PropertyName>
- <ogc:Literal>' . $ogcSearch . '</ogc:Literal>
- </ogc:PropertyIsLike>
- <ogc:PropertyIsLike wildCard="*" singleChar="%23" escapeChar="!">
- <ogc:PropertyName>Nazwa_grupy_kapitalowej</ogc:PropertyName>
- <ogc:Literal>' . $ogcSearch . '</ogc:Literal>
- </ogc:PropertyIsLike>
- <ogc:PropertyIsLike wildCard="*" singleChar="%23" escapeChar="!">
- <ogc:PropertyName>Pelna_nazwa_kontrahenta</ogc:PropertyName>
- <ogc:Literal>' . $ogcSearch . '</ogc:Literal>
- </ogc:PropertyIsLike>
- </ogc:Or>
- </ogc:Filter>
- ';
- }
- $backRefFilter = [];
- if ($idGroup > 0) {
- $backRefFilter['__backRef'] = [
- 'namespace' => 'default_db/BI_audit_ENERGA_PRACOWNICY_GRUPY/BI_audit_ENERGA_KONTRAHENCIS_GRUPY', // TODO: nowy rejetr na grupy / filty KONTRAHENCI
- 'primaryKey' => $idGroup,
- 'fieldName' => 'default_db__x3A__BI_audit_ENERGA_PRACOWNICY:BI_audit_ENERGA_KONTRAHENCIS',
- ];
- // TODO: Storage dodać obiekt xsd default_db/BI_audit_ENERGA_PRACOWNICY_GRUPY/BI_audit_ENERGA_KONTRAHENCI_GRUPY:
- // - ID
- // - ID_USER - id usera który stworzył grupę (tylko dla niego będzie widoczna)
- // - NAZWA - nazwa grupy
- // - 'default_db/BI_audit_ENERGA_PRACOWNICY/BI_audit_ENERGA_KONTRAHENCI' minOccurs="0" maxOccurs="unbounded"
- }
- $acl = ACL::getAclByNamespace('default_db/BI_audit_ENERGA_RUM_KONTRAHENCI/BI_audit_ENERGA_RUM_KONTRAHENCI');
- $query = $acl->buildQuery(array_merge([
- 'cols' => [ // TODO:? propertyName = []
- 'ID',
- 'Nazwa_grupy_kapitalowej',
- 'Pelna_nazwa_kontrahenta',
- 'Numer_kontrahenta',
- 'Skrocona_Nazwa_Kontrahenta',
- 'Typ_kontrahenta',
- 'NIP',
- 'KRS',
- 'REGON',
- 'PESEL',
- 'Forma_prawna_dzialalnosci',
- 'Ulica',
- 'Numer_budynku',
- 'Numer_mieszkania_lokalu',
- 'Miejscowosc',
- 'Kod_pocztowy',
- 'Kraj',
- 'Telefon',
- 'Fax',
- 'Mail',
- 'A_ADM_COMPANY',
- 'A_CLASSIFIED',
- 'A_STATUS',
- 'A_STATUS_INFO',
- 'Dodano',
- 'L_APPOITMENT_USER',
- 'Podmiot_dominujacy',
- 'Tytul_dokumentu',
- 'ownCompany',
- 'uwagi',
- ],
- //'f_ID' => $id,
- 'limit' => $limit,
- 'limitstart' => $limitstart, // offset
- ], $searchParams, $backRefFilter));
- $total = $query->getTotal();
- $items = $query->getItems();
- $pagination = array();
- $pagination['total_items'] = $total;
- $pagination['size'] = ceil($total/$limit); // pages size
- $pagination['current'] = $page;
- $pagination['limit'] = $limit;
- return [
- 'type' => 'success',
- 'msg' => 'showKontrajenci',
- '__req_args' => $_REQUEST,
- '__args' => $args,
- 'body' => [
- 'items' => $items,
- //'view' => $this->htmlViewFormBiAudit($items, 'KONTRAHENCI'),
- 'pagination' => $pagination
- ]
- ];
- }
- //
- // public function fetchKontrahenciAjaxOld($args) {
- // //$id = V::get('ID', 1, $_REQUEST, 'int');
- // $items = ACL::getAclByNamespace('default_db/BI_audit_ENERGA_RUM_KONTRAHENCI/BI_audit_ENERGA_RUM_KONTRAHENCI')->buildQuery([
- // 'cols' => [ // TODO:? propertyName = []
- // 'ID',
- // 'Nazwa_grupy_kapitalowej',
- // 'Pelna_nazwa_kontrahenta',
- // 'NIP',
- // 'KRS',
- // 'REGON',
- // 'Miejscowosc',
- // 'Kod_pocztowy',
- // 'Telefon'
- // ],
- // //'f_ID' => $id,
- // ])->getItems([
- // 'limit' => 10
- // ]);
- //
- // return [
- // 'type' => 'success',
- // 'msg' => 'showKontrahenci',
- // '__req_args' => $_REQUEST,
- // '__args' => $args,
- // 'body' => [
- // 'items' => $items,
- // 'view' => $this->htmlViewFormBiAudit($items, 'KONTRAHENCI')
- // ]
- // ];
- // }
- public function showTableKontrahenci($items) {
- $view = '<form class="form-horizontal" method="post">
- <table class="table table-bordered table-hover table-striped" height=5>
- <thead>
- <tr>
- <td width=1><input type="checkbox" name="checkAll" id="checkAll-KONTRAHENCI" /></td>
- <td width=1>ID</td>
- <td>Nazwa grupy kapitalowej</td>
- <td>Pelna nazwa kontrahenta</td>
- <td>Numer kontrahenta</td>
- <td>Skrócona nazwa kontrahenta</td>
- <td>Typ_kontrahenta</td>
- <td>NIP</td>
- <td>KRS</td>
- <td>Regon</td>
- <td>PESEL</td>
- <td>Forma prawna działalności</td>
- <td>Ulica</td>
- <td>Numer budynku</td>
- <td>Numer mieszkania lokalu</td>
- <td>Miejscowosc</td>
- <td>Kod pocztowy</td>
- <td>Kraj</td>
- <td>Telefon</td>
- <td>Fax</td>
- <td>Mail</td>
- <td>A_ADM_COMPANY</td>
- <td>A_CLASSIFIED</td>
- <td>A_STATUS</td>
- <td>A_STATUS_INFO</td>
- <td>Dodano</td>
- <td>L_APPOITMENT_USER</td>
- <td>Podmiot dominujacy</td>
- <td>Tytul dokumentu</td>
- <td>ownCompany</td>
- <td>uwagi</td>
- </tr>
- </thead>
- <tbody id="body-kontrahenci">
- </tbody></table>
- </form>
- ';
- return $view;
- }
- // tworzenie grupy kontrahentów
- public function createKontrahenciGroupAjaxAction() {
- 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
- }
- public function createKontrahenciGroupAjax($args) {
- $nazwa = V::get('NAZWA', '', $args);
- // TODO: vlaidacja nazwy - sprawdzenie czy już nie występuje
- $idGroup = DB::getPDO()->insert('BI_audit_ENERGA_KONTRAHENCI_GRUPY', [
- 'A_RECORD_CREATE_AUTHOR' => User::getLogin(),
- 'A_RECORD_CREATE_DATE' => 'NOW()',
- 'NAZWA' => $nazwa,
- ]);
- return [
- 'msg' => "Utworzona grupę {$idGroup}",
- 'type' => "success",
- 'body' => [
- 'id' => $idGroup,
- ]
- ];
- }
- // Dodanie do grupy filtra kontrahentów
- public function addKontrahenciToGroupAjaxAction() {
- // 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
- Response::sendTryCatchJson(array($this, 'addKontrahenciToGroupAjax'));
- }
- public function addKontrahenciToGroupAjax($args) {
- $idGroup = V::get('idGroup', 0, $_REQUEST, 'int');
- $kontrahenciIds = V::get('kontrahenciIds', [], $_REQUEST, 'array');
- // validate
- if (!$idGroup) throw new Exception("Nie wybrano grupa");
- if (!$kontrahenciIds || count($kontrahenciIds) == 0 ) throw new Exception("Proszę wybrać kontrahentów");
- $group = ACL::getAclByNamespace('default_db/BI_audit_ENERGA_KONTRAHENCI_GRUPY/BI_audit_ENERGA_KONTRAHENCI_GRUPY')->buildQuery([
- 'cols' => [ // TODO:? propertyName = []
- 'ID',
- 'ID_USER',
- 'NAZWA',
- ],
- // 'f_ID_USER' => User::getID()
- ])->getItem($idGroup);
- if (!$group) throw new Exception("Grupa nie istnieje");
- if (User::getID() != $group['ID_USER']) throw new Exception("Brak uprawnień do grupy");
- // $refGrupyToPracownicy = ACL::getRefTable('obiekt główny', 'nazwa pola - powiązane rekordy');
- $refGrupyToKontrahenci = ACL::getRefTable('default_db/BI_audit_ENERGA_KONTRAHENCI_GRUPY/BI_audit_ENERGA_KONTRAHENCI_GRUPY',
- 'default_db__x3A__BI_audit_ENERGA_KONTRAHENCI:BI_audit_ENERGA_KONTRAHENCI');
- foreach ($kontrahenciIds as $kontrahentIds) {
- DB::getPDO()->insert($refGrupyToKontrahenci, ['PRIMARY_KEY' => $idGroup, 'REMOTE_PRIMARY_KEY' => $kontrahentIds]);
- }
- return [
- 'msg' => "Powiązano kontrahentów z grupą {$idGroup}",
- 'type' => "success",
- ];
- }
- public function fetchGroupKontrahenciAjaxAction() {
- Response::sendTryCatchJson(array($this, 'fetchGroupKontrahenciAjax'));
- }
- public function fetchGroupKontrahenciAjax() {
- // TODO: odkomentować jak zostanie dodana tabela default_db/BI_audit_ENERGA_KONTRAHENCI_GRUPY/BI_audit_ENERGA_KONTRAHENCI_GRUPY
- /*$group = ACL::getAclByNamespace('default_db/BI_audit_ENERGA_KONTRAHENCI_GRUPY/BI_audit_ENERGA_KONTRAHENCI_GRUPY')->buildQuery([
- 'cols' => [ // TODO:? propertyName = []
- 'ID',
- 'ID_USER',
- 'NAZWA',
- ],
- 'f_ID_USER' => User::getID()
- ])->getItem($idGroup);
- if (!$group) throw new Exception("Grupa nie istnieje");
- if (User::getID() != $group['ID_USER']) throw new Exception("Brak uprawnień do grupy");
- $itemsKontrahenci = $query->getItems();
- $arrayGroupKontrahenci = array();
- foreach ($itemsKontrahenci as $key => $value) {
- $arrayGroupKontrahenci[$value['ID']] = $value['NAZWA'];
- }
- */
- //TODO: USUNAĆ listę grup wpisane na sztywno
- $arrayGroupKontrahenci = array();
- $arrayGroupKontrahenci[0]["ID"] = 1;
- $arrayGroupKontrahenci[0]["NAZWA"] = "Grupa 1";
- $arrayGroupKontrahenci[1]["ID"] = 2;
- $arrayGroupKontrahenci[1]["NAZWA"] = "Grupa 2";
- $arrayGroupKontrahenci[2]["ID"] = 3;
- $arrayGroupKontrahenci[2]["NAZWA"] = "Grupa 3";
- $arrayGroupKontrahenci[3]["ID"] = 4;
- $arrayGroupKontrahenci[3]["NAZWA"] = "Grupa 4";
- $arrayGroupKontrahenci[4]["ID"] = 5;
- $arrayGroupKontrahenci[4]["NAZWA"] = "Grupa 5";
- $arrayGroupKontrahenci[5]["ID"] = 6;
- $arrayGroupKontrahenci[5]["NAZWA"] = "Grupa 6";
- $arrayGroupKontrahenci[6]["ID"] = 7;
- $arrayGroupKontrahenci[6]["NAZWA"] = "Grupa 7";
- $arrayGroupKontrahenci[7]["ID"] = 8;
- $arrayGroupKontrahenci[7]["NAZWA"] = "Grupa 8";
- $arrayGroupKontrahenci[8]["ID"] = 9;
- $arrayGroupKontrahenci[8]["NAZWA"] = "Grupa 9";
- $arrayGroupKontrahenci[9]["ID"] = 10;
- $arrayGroupKontrahenci[9]["NAZWA"] = "Grupa 10";
- $arrayGroupKontrahenci[9]["ID"] = 11;
- $arrayGroupKontrahenci[9]["NAZWA"] = "Grupa 11";
- return [
- 'type' => 'success',
- 'msg' => 'fetchKontrahenciToGroup',
- '__req_args' => $_REQUEST,
- '__args' => $args,
- 'body' => [
- 'itemsGroupKontrahenci' => $arrayGroupKontrahenci
- ]
- ];
- }
- /*
- * PRACOWNICY
- */
- public function fetchPracownicyAjaxAction() {
- // sleep(2);
- Response::sendTryCatchJson(array($this, 'fetchPracownicyAjax'));
- }
- public function fetchPracownicyAjax($args) {
- $idGroup = V::get('filterIdGroup', 0, $_REQUEST, 'int'); // TODO: dla filtrów "Wysokiego ryzyka" - przekazywany ID rekodu
- if ($idGroup < 0) $idGroup = 0;
- $limit = 2;
- $limitstart = V::get('limitstart', 0, $_REQUEST, 'int');
- if ($limitstart < 0) $limitstart = 0;
- $page = V::get('page', 0, $_REQUEST, 'int');
- $limitstart = ($page - 1) * $limit;
- $search = V::get('search', '', $_REQUEST);
- $searchParams = [];
- if (!empty($search)) {
- $ogcSearch = "*{$search}*"; // wildCard="*" -> mysql '%'
- $searchParams['ogc:Filter'] = '
- <ogc:Filter>
- <ogc:Or>
- <ogc:PropertyIsLike wildCard="" singleChar="%23" escapeChar="!">
- <ogc:PropertyName>nip</ogc:PropertyName>
- <ogc:Literal>' . $ogcSearch . '</ogc:Literal>
- </ogc:PropertyIsLike>
- <ogc:PropertyIsLike wildCard="*" singleChar="%23" escapeChar="!">
- <ogc:PropertyName>nazwisko</ogc:PropertyName>
- <ogc:Literal>' . $ogcSearch . '</ogc:Literal>
- </ogc:PropertyIsLike>
- </ogc:Or>
- </ogc:Filter>
- ';
- }
- $backRefFilter = [];
- if ($idGroup > 0) {
- $backRefFilter['__backRef'] = [
- 'namespace' => 'default_db/BI_audit_ENERGA_PRACOWNICY_GRUPY/BI_audit_ENERGA_PRACOWNICY_GRUPY', // TODO: nowy rejetr na grupy / filty pracowników
- 'primaryKey' => $idGroup,
- 'fieldName' => 'default_db__x3A__BI_audit_ENERGA_PRACOWNICY:BI_audit_ENERGA_PRACOWNICY',
- ];
- // TODO: Storage dodać obiekt xsd default_db/BI_audit_ENERGA_PRACOWNICY_GRUPY/BI_audit_ENERGA_PRACOWNICY_GRUPY:
- // - ID
- // - ID_USER - id usera który stworzył grupę (tylko dla niego będzie widoczna)
- // - NAZWA - nazwa grupy
- // - 'default_db/BI_audit_ENERGA_PRACOWNICY/BI_audit_ENERGA_PRACOWNICY' minOccurs="0" maxOccurs="unbounded"
- }
- $acl = ACL::getAclByNamespace('default_db/BI_audit_ENERGA_PRACOWNICY/BI_audit_ENERGA_PRACOWNICY');
- $query = $acl->buildQuery(array_merge([
- 'cols' => [ // TODO:? propertyName = []
- 'ID',
- 'imiona',
- 'nazwisko',
- 'nip',
- 'pesel',
- 'regon',
- 'source',
- 'A_ADM_COMPANY',
- 'A_CLASSIFIED',
- 'A_STATUS',
- 'A_STATUS_INFO',
- 'L_APPOITMENT_USER',
- 'default_db__x3A__BI_audit_ENERGA_PRACOWNICY_adresy:BI_audit_ENERGA_PRACOWNICY_adresy/*'
- ],
- //'f_ID' => $id,
- 'limit' => $limit,
- 'limitstart' => $limitstart, // offset
- // 'order_by' => 'ID', // sortowanie po kolumnie
- // 'order_dir' => 'DESC', // kierunek sortowania
- // 'f_nip' = "=12345", // szukamy dokładnie tej wartości - mysql: where nip = "12345"
- // 'f_nip' = "12345", // szukamy dokładnie tej wartości - mysql: where nip like "%12345%"
- // 'f_nip' = "12345%", // szukamy dokładnie tej wartości - mysql: where nip like "12345%"
- // 'f_ID' = "=12345", // szukamy dokładnie tej wartości - mysql: where ID = "12345"
- ], $searchParams, $backRefFilter));
- $total = $query->getTotal();
- $items = $query->getItems();
- $pagination = array();
- $pagination['total_items'] = $total;
- $pagination['size'] = ceil($total/$limit); // pages size
- $pagination['current'] = $page;
- $pagination['limit'] = $limit;
- // { // tworzenie własnego zapytanie mysql
- // $rootTableName = $acl->getRootTableName();
- // DB::getPDO()->fetchAll("
- // select t.*
- // from {$rootTableName} t
- // where t.ID in (
- // select x.ID
- // from ... x
- // where
- // )
- // ");
- // }
- return [
- 'type' => 'success',
- 'msg' => 'showPracownicy',
- '__req_args' => $_REQUEST,
- '__args' => $args,
- 'body' => [
- 'items' => $items,
- //'view' => $this->htmlViewFormBiAudit($items, 'PRACOWNICY'),
- 'pagination' => $pagination
- ]
- ];
- }
- public function showTablePracownicy() {
- $view = '<form class="form-horizontal" method="post">
- <table class="table table-responsive table-bordered table-hover table-striped" height=5>
- <thead>
- <tr>
- <td width=1><input type="checkbox" name="checkAll" id="checkAll-PRACOWNICY" /></td>
- <td width=1>ID</td>
- <td>Imię/Imiona</td>
- <td>Nazwisko</td>
- <td>NIP</td>
- <td>Pesel</td>
- <td>Regon</td>
- <td>source</td>
- <td>A_ADM_COMPANY</td>
- <td>A_CLASSIFIED</td>
- <td>A_STATUS</td>
- <td>A_STATUS_INFO</td>
- <td>L_APPOITMENT_USER</td>
- <td>Adresy</td>
- </tr>
- </thead>
- <tbody id="body-pracownicy">
- </tbody></table>
- </form>';
- return $view;
- }
- // tworzenie grupy pracowników
- public function createPracownicyGroupAjaxAction() {
- 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
- // Response::sendTryCatchJson(array($this, 'createPracownicyGroupAjax'));
- }
- public function createPracownicyGroupAjax($args) {
- $nazwa = V::get('NAZWA', '', $args);
- // TODO: vlaidacja nazwy - sprawdzenie czy już nie występuje
- // validate
- if (!$nazwa) throw new Exception("Nie wybrano grupa");
- if (!$kontrahenciIds || count($kontrahenciIds) == 0 ) throw new Exception("Proszę wybrać kontrahentów");
- $idGroup = DB::getPDO()->insert('BI_audit_ENERGA_PRACOWNICY_GRUPY', [
- 'A_RECORD_CREATE_AUTHOR' => User::getLogin(),
- 'A_RECORD_CREATE_DATE' => 'NOW()',
- // 'A_STATUS' => 'WAITING', // jeśli trzeba to ustawić
- 'NAZWA' => $nazwa,
- ]);
- // DB::getPDO()->insert('BI_audit_ENERGA_PRACOWNICY_GRUPY_HIST', [
- // 'A_RECORD_CREATE_AUTHOR' => User::getLogin(),
- // 'A_RECORD_CREATE_DATE' => 'NOW()',
- // 'ID_USERS2' => $idRaport,
- // // 'A_STATUS' => 'WAITING', // jeśli trzeba to ustawić
- // 'NAZWA' => $nazwa,
- // ]);
- return [
- 'msg' => "Utworzona grupę {$idGroup}",
- 'type' => "success",
- 'body' => [
- 'id' => $idGroup,
- ]
- ];
- }
- // Dodanie do grupy filtra pracowników
- public function addPracownicyToGroupAjaxAction() {
- // 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
- Response::sendTryCatchJson(array($this, 'addPracownicyToGroupAjax'));
- }
- public function addPracownicyToGroupAjax($args) {
- $idGroup = V::get('idGroup', 0, $_REQUEST, 'int');
- $pracownicyIds = V::get('pracownicyIds', [], $_REQUEST, 'array');
- // validate
- if (!$nazwa) throw new Exception("Nie wybrano grupa");
- if (!$pracownicyIds || count($pracownicyIds) == 0 ) throw new Exception("Proszę wybrać pracowników");
- // TODO: SPRWADZENIE CZY NIE DODANOU JUZ PRACOWNIKAS
- // default_db/BI_audit_ENERGA_PRACOWNICY_GRUPY/BI_audit_ENERGA_PRACOWNICY_GRUPY
- // default_db/BI_audit_ENERGA_PRACOWNICY/BI_audit_ENERGA_PRACOWNICY
- $group = ACL::getAclByNamespace('default_db/BI_audit_ENERGA_PRACOWNICY_GRUPY/BI_audit_ENERGA_PRACOWNICY_GRUPY')->buildQuery([
- 'cols' => [ // TODO:? propertyName = []
- 'ID',
- 'ID_USER',
- 'NAZWA',
- ],
- // 'f_ID_USER' => User::getID()
- ])->getItem($idGroup);
- if (!$group) throw new Exception("Grupa nie istnieje");
- if (User::getID() != $group['ID_USER']) throw new Exception("Brak uprawnień do grupy");
- // $refGrupyToPracownicy = ACL::getRefTable('obiekt główny', 'nazwa pola - powiązane rekordy');
- $refGrupyToPracownicy = ACL::getRefTable('default_db/BI_audit_ENERGA_PRACOWNICY_GRUPY/BI_audit_ENERGA_PRACOWNICY_GRUPY',
- 'default_db__x3A__BI_audit_ENERGA_PRACOWNICY:BI_audit_ENERGA_PRACOWNICY');
- foreach ($pracownicyIds as $idPracownik) {
- DB::getPDO()->insert($refGrupyToPracownicy, ['PRIMARY_KEY' => $idGroup, 'REMOTE_PRIMARY_KEY' => $idPracownik]);
- }
- return [
- 'msg' => "Powiązano pracowników z grupą {$idGroup}",
- 'type' => "success",
- ];
- }
- public function fetchGroupPracownicyAjaxAction() {
- Response::sendTryCatchJson(array($this, 'fetchGroupPracownicyAjax'));
- }
- public function fetchGroupPracownicyAjax() {
- // TODO: odkomentować jak zostanie dodana tabela default_db/BI_audit_ENERGA_PRACOWNICY_GRUPY/BI_audit_ENERGA_PRACOWNICY_GRUPY
- /*$group = ACL::getAclByNamespace('default_db/BI_audit_ENERGA_PRACOWNICY_GRUPY/BI_audit_ENERGA_PRACOWNICY_GRUPY')->buildQuery([
- 'cols' => [ // TODO:? propertyName = []
- 'ID',
- 'ID_USER',
- 'NAZWA',
- ],
- 'f_ID_USER' => User::getID()
- ])->getItem($idGroup);
- if (!$group) throw new Exception("Grupa nie istnieje");
- if (User::getID() != $group['ID_USER']) throw new Exception("Brak uprawnień do grupy");
- $items = $query->getItems();
- $arrayGroupPracownicy = array();
- foreach ($items as $key => $value) {
- $arrayGroupPracownicy[$value['ID']] = $value['NAZWA'];
- }
- */
- //TODO: USUNAĆ listę grup wpisane na sztywno
- $arrayGroupPracownicy = array();
- $arrayGroupPracownicy[0]["ID"] = 1;
- $arrayGroupPracownicy[0]["NAZWA"] = "Grupa 1";
- $arrayGroupPracownicy[1]["ID"] = 2;
- $arrayGroupPracownicy[1]["NAZWA"] = "Grupa 2";
- $arrayGroupPracownicy[2]["ID"] = 3;
- $arrayGroupPracownicy[2]["NAZWA"] = "Grupa 3";
- $arrayGroupPracownicy[3]["ID"] = 4;
- $arrayGroupPracownicy[3]["NAZWA"] = "Grupa 4";
- $arrayGroupPracownicy[4]["ID"] = 5;
- $arrayGroupPracownicy[4]["NAZWA"] = "Grupa 5";
- return [
- 'type' => 'success',
- 'msg' => 'fetchGroupPracownicyAjax',
- '__req_args' => $_REQUEST,
- '__args' => $args,
- 'body' => [
- 'itmesGroupPracownicy' => $arrayGroupPracownicy
- ]
- ];
- }
- // link do ackji w php: $saveFormUrl = $this->getLink('saveRaportAjax');
- // przekazać link do JavaScript i tam:
- // window.fetch('{$saveFormUrl}', { ... }).then(...) - dokumentacja: https://github.com/github/fetch
- public function generateBiAuditRaportAjaxAction() {
- //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
- Response::sendTryCatchJson(array($this, 'generateBiAuditRaportAjax'), $args = 'JSON_FROM_REQUEST_BODY');
- //Response::sendTryCatchJson(array($this, 'generateBiAuditRaportAjax'));
- }
- public function generateBiAuditRaportAjax($args) {
- // głebokość powiazan
- $depthValue = V::get('depthValue', '', $args);
- if (!$depthValue) {
- throw new Exception("Nie podano wartości dla głębokości powiązań");
- }
- // Tworzenie relacji Raport do Pracownicy
- $pracownicyIds = []; // array z nr ID na podstawie wysłanego formularza
- $pracownicyIds = V::get('pracownicyIds', '', $args);
- // walidacja id pracowników
- if (!$pracownicyIds) {
- throw new Exception("Nie wybrano pracowników");
- }
- $kontrahenciIds = []; // array z nr ID na podstawie wysłanego formularza
- $kontrahenciIds = V::get('kontrahenciIds', '', $args);
- // walidacja id kontrahetów
- if (!$kontrahenciIds) {
- throw new Exception("Nie wybrano kontrahentów");
- }
- // Tworzenie rekrodu w bazie - Raport -
- $idRaport = DB::getPDO()->insert('BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA', [
- 'A_RECORD_CREATE_AUTHOR' => User::getLogin(),
- 'A_RECORD_CREATE_DATE' => 'NOW()',
- 'A_STATUS' => 'WAITING', // TODO: czy trzeba to ustawić (pytanie do Mariusza)
- 'FILE_STATUS' => "TO_GENERATE",
- 'BI_analiza_minDepth' => 1,
- 'BI_analiza_maxDepth' => $depthValue
- ]);
- // Tworzenie relacji Raport do Pracownicy
- $refPowiazaniaToPracownicy = ACL::getRefTable('default_db/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA',
- 'default_db__x3A__BI_audit_ENERGA_PRACOWNICY:BI_audit_ENERGA_PRACOWNICY');
- foreach ($pracownicyIds as $idPracownik) {
- DB::getPDO()->insert($refPowiazaniaToPracownicy, ['PRIMARY_KEY' => $idRaport, 'REMOTE_PRIMARY_KEY' => $idPracownik]);
- }
- // Tworzenie relacji Raport do Kontrahenci - analogicznie jak wyżej
- $refPowiazaniaToKontrahenci = ACL::getRefTable('default_db/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA',
- 'default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI:BI_audit_ENERGA_RUM_KONTRAHENCI');
- foreach ($kontrahenciIds as $idKontrahent) {
- DB::getPDO()->insert($refPowiazaniaToKontrahenci, ['PRIMARY_KEY' => $idRaport, 'REMOTE_PRIMARY_KEY' => $idKontrahent ]);
- }
- // ...
- return [
- 'msg' => "Zadanie do wygnerowania raportu zostało zapisane.",
- 'type' => "success",
- 'body' => [
- 'id' => $idRaport,
- ]
- ];
- }
- /**
- * Widok formularza dodawania pracowników i kontrahentów
- */
- public function defaultViewFormBiAudit($items, $type) {
- $activeFormSteps = '';
- switch($type) {
- case 'KONTRAHENCI':
- $activeFormStepsKontrahent = 'complete';
- $titleHeader = 'KONTRAHENCI';
- $groupFilterList = '
- <div class="menu-item">
- <ul class="padding-0">
- <li><a href="#" title="STWÓRZ GRUPĘ" class="btn btn-default" onClick="createGroupKontrahenci(event)" data-color-noactive="">+ STWÓRZ GRUPĘ</a></li>
- </ul>
- </div>
- <div id="group-kontrahenci" class="btn-group">
- <button class="btn btn-default active" title="Wszyscy" data-group-filter="0">Wszyscy</button>
- </div>';
- $formAddNewData ='
- <li><a title="IMPORT KONTRAHENCI" onClick="showViewUploadFile(event, \'Import kontrahentów\' )" class="btn btn-info">IMPORT KONTRAHENCI</a></li>
- <!--<li><a href="#" title="DODAJ KONTRAHENCI" class="btn btn-info">+ DODAJ KONTRAHENCI</a></li>-->'; //todo: dodać obsługe doddawania kontrahentow
- $showButtonNextStep = '<button type="button" class="btn btn-primary" onClick="generateBiAuditRaport(event)" id="button-generate-reaport">SZUKAJ POWIĄZAŃ</button>';
- $pagination_form = '<div id="pagination-kontrahenci"></div>';
- break;
- case 'PRACOWNICY':
- $titleHeader = 'PRACOWNICY';
- $groupFilterList = '
- <div class="menu-item">
- <ul class="padding-0">
- <li><a href="#" title="STWÓRZ GRUPĘ" class="btn btn-default" onClick="createGroupPracownicy(event)" >+ STWÓRZ GRUPĘ</a></li>
- </ul>
- </div>
- <div id="group-pracownicy" class="btn-group">
- <button class="btn btn-default active" title="Wszyscy" data-group-filter="0">Wszyscy</button>
- </div>';
- $formAddNewData ='
- <li><a href="#" title="IMPORT PRACOWNIKÓW" class="btn btn-info">IMPORT PRACOWNIKÓW</a></li>
- <!--<li><a href="#" title="DODAJ PRACOWNIKÓW" class="btn btn-info" >+ DODAJ PRACOWNIKÓW</a></li>-->'; //todo: dodać obsługe doddawania pracownikow
- $showButtonNextStep = '<a href="index.php?_route=UrlAction_Bocian#KONTRAHENCI" title="DODAJ DO ANALIZY" class="btn btn-primary">DODAJ DO ANALIZY</a>';
- $pagination_form = '<div id="pagination-pracownicy"></div>';
- break;
- }
- $view = '
- <!-- start:employees-section-->
- <div id="smad-employees-section" class="smad-form-' . $type . '" >
- <div class="container-fluid">
- <div>
- <div class="padding-lr-0">
- <div id="smad-menu-section">
- <div class="col-sm-12 col-md-6 padding-lr-0">
- <div class="menu-items">
- <div class="smad-heder-title menu-item"><span class="smad-line-red">|</span> ' . $titleHeader . ' </div>
- </div>
- </div>
- <div class="col-sm-12 col-md-6 padding-lr-0">
- <div class="form-steps">
- <!-- start:form steps wizard -->
- <div class="row smad-wizard" style="border-bottom:0;">
- <div class="col-xs-4 col-md-4 smad-wizard-step complete"><!-- complited line -->
- <div class="text-center smad-wizard-stepnum"> </div>
- <div class="progress"><div class="progress-bar"></div></div>
- <a href="index.php?_route=UrlAction_Bocian#PRACOWNICY" class="smad-wizard-dot"></a>
- <div class="smad-wizard-info complete text-center">
- <div class="step-item">Krok 1</div>
- <div class="step-title ">PRACOWNICY</div>
- </div>
- </div>
- <div class="col-xs-4 col-md-4 smad-wizard-step ' . $activeFormStepsKontrahent . ' ">
- <div class="text-center smad-wizard-stepnum"> </div>
- <div class="progress"><div class="progress-bar"></div></div>
- <a href="index.php?_route=UrlAction_Bocian#KONTRAHENCI" class="smad-wizard-dot"></a>
- <div class="smad-wizard-info text-center">
- <div class="step-item">Krok 2</div>
- <div class="step-title ">KONTRAHENCI</div>
- </div>
- </div>
- <div class="col-xs-4 col-md-4 smad-wizard-step ">
- <div class="text-center smad-wizard-stepnum"> </div>
- <div class="progress"><div class="progress-bar"></div></div>
- <a href="#" class="smad-wizard-dot"></a>
- <div class="smad-wizard-info text-center">
- <div class="step-item">Krok 3</div>
- <div class="step-title ">SZUKANIE POWIĄZAŃ</div>
- </div>
- </div>
- </div>
- <!-- end:form steps wizard -->
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- <div class="container-fluid">
- <div class=" padding-lr-0">
- <div class="smad-divider"></div>
- </div>
- </div>
- <!-- start:filters -->
- <div class="container-fluid">
- <div class="row">
- <div>
- <div class="smad-employees-form-section" class="border-top-grey">
- <div class="col-md-9 smad-border-col">
- <div class="menu-items">
- '.$groupFilterList.'
- </div>
- </div>
- <div class="col-md-3">
- <div class="form-input">
- <div class="form-item col-md-6 smad-heder-title">głębokość powiązań:</div>
- <div class="form-item col-md-6">
- <input type="text" class="form-control smad-depth" placeholder="1-16" value="" />
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- <!-- end:filters -->
- <!-- start:list employees -->
- <div class="container-fluid">
- <div class="padding-0 smad-employees-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 class="menu-items">
- <div class="menu-item">
- <ul class="padding-0">
- '.$formAddNewData.'
- </ul>
- </div>
- </div>
- </div>
- </div>
- </div>
- <div class="container-fluid">
- <div class="table-responsive padding-0" id="smad-table-' . $type . '">
- ' . $this->showListDataByType($items, $type) . '
- </div>
- </div>
- <!-- end:list employees -->
- <!-- start:list paginations employees -->
- <div class="container-fluid ">
- <div>
- '. $pagination_form .'
- </div>
- </div>
- <!-- end:list paginations employees -->
- <!-- start:bottom buttons -->
- <div class="container-fluid smad-employees-bottom-navigation">
- <div class="padding-0">
- <div class="col-lg-6 ">
- <a href="#" title="PRZENIEŚ DO GRUPY" onClick="addPracownikToGroup(event)" class="btn btn-info">PRZENIEŚ DO GRUPY</a>
- </div>
- <div class="col-lg-6 text-right">
- ' . $showButtonNextStep . '
- </div>
- </div>
- </div>
- <!-- end:bottom buttons -->
- </div>
- <!-- start:employees-section -->
- ';
- return $view;
- }
- public function showListDataByType($items, $type='PRACOWNICY') {
- switch ($type) {
- case 'PRACOWNICY':
- return $this->showTablePracownicy();
- break;
- case 'KONTRAHENCI':
- return $this->showTableKontrahenci($items);
- break;
- }
- }
- }
|