<?php if (!User::logged()) { return; } ?> <footer> <div id="smad-footer-section" class="container-fluid padding-0"> <div class="container"> <div class="row"> <div class="col-lg-12"> <ul class="menu-bottom"> <li><a href="#" title="O Bocianie">O Bocianie</a></li> <li><a href="#" title="">Kontakt</a></li> </ul> </div> </div> </div> </div> </footer> <script type="text/javascript"> // TOP MENU (hamburger) if (document.getElementById("smad-page-home")) { toggledisplay('smad-menu-main', 'none') } // show/hide menu function toggledisplay(elementID, style = 'none') { (function(style) { style.display = (style.display === 'none' ? '' : 'none'); })(document.getElementById(elementID).style); } // todo: do usuniecia var testUrl = 'index.php?_route=ViewTableAjax&namespace=default_db/BI_audit_ENERGA_PRACOWNICY/BI_audit_ENERGA_PRACOWNICY&backRefNS=default_db/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA&backRefPK=26&backRefField=default_db__x3A__BI_audit_ENERGA_PRACOWNICY:BI_audit_ENERGA_PRACOWNICY'; var responseUrl = getUrlParams(testUrl); console.log(responseUrl); // todo: przenieść do eventu który nasłuchuje zakonczenie wczytania tabeli setTimeout(searchColumnWithHref, 2000); /** * Funkcja przeszukuje td i pobiera dane na podstawie znalezionego adresu url */ function searchColumnWithHref() { return false; // todo: usunc //todo: dostanie sie do tabeli jQuery('#BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA').on('TableAjax:render', function (event) { console.log(event) }) console.log('START searchColumnWithHref'); // todo: przeparsować adres url / $(".AjaxTableCont table tbody tr").each(function () { var tableRow = $(this); tableRow.find('td').each(function ( indexTd, valueTd ) { var valueUrl = $(this).find('href'); // pobieramy url z linku a href var hrefFromTd = tableRow.find('td:eq('+indexTd+') a').attr('href'); // pobieramy dane if ( hrefFromTd !== undefined ) { var responseData = getDataByUrl( hrefFromTd ); } console.log('td tabeli', hrefFromTd, responseData); console.log('####################' ); }); }); console.log('END searchColumnWithHref'); } /** * Funkcja do pobrania danych - należy podać url */ function getDataByUrl( paramUrl, urlNamespaceParams = [] ) { if ( !paramUrl ) { return; } // dodanie tego zapisu pozwala na zwrócenie danych w formacie JSON posortowanego var jsonFormatParam = '&_task=loadDataAjax&currSortCol=ID&currSortFlip=desc'; window.fetch(paramUrl + jsonFormatParam, { credentials: 'same-origin' }) .then(function parseJSON(response) { return response.json() }) .then(function(data) { //todo: odebrane daneFVFF //data.body.items console.log(data); if (data.rows === null) { return; } return data.rowsdata.rows; console.log('request succeeded with JSON getDataByNamespaceAndPK', data.rows); }).catch(function(error) { console.log('request failed', error) }); } /** * Funkcja do parsowania url (pobieramy dane na temat parametr=wartosc) * Wymagane aby w adresie znajdował sie "?" * return json eg. {_route: "ViewTableAjax", namespace: "default_db/BI_audit_ENERGA_PRACOWNICY/BI_audit_ENERGA_PRACOWNICY", backRefNS: "default_db/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA", backRefPK: "26", backRefField: "default_db__x3A__BI_audit_ENERGA_PRACOWNICY:BI_audit_ENERGA_PRACOWNICY"} */ function getUrlParams(url) { var params = {}; (url + '?').split('?')[1].split('&').forEach(function (pair) { pair = (pair + '=').split('=').map(decodeURIComponent); if (pair[0].length) { params[pair[0]] = pair[1]; } }); return params; } </script>