console.log('test1... DBG:', DBG) if (!URL_FETCH_TEST) { throw "Brak zmiennej URL_FETCH_TEST" } // // Documentation: https://github.com/github/fetch // fetch(URL_FETCH_TEST, { // credentials: 'same-origin' // }) // .then(function parseJSON(response) { // return response.json() // }) // .then(function(data) { // //$( ".container" ).append( data.body.view ); // console.log('request succeeded with JSON response', data) // }).catch(function(error) { // console.log('request failed', error) // }) // // fetch(URL_FETCH_TEST_KRS, { // credentials: 'same-origin' // }) // .then(function parseJSON(response) { // return response.json() // }) // .then(function(data) { // console.log('request succeeded with JSON response', data) // }).catch(function(error) { // console.log('request failed', error) // }) // // fetch(URL_FETCH_TEST_CEIDG, { // credentials: 'same-origin' // }) // .then(function parseJSON(response) { // return response.json() // }) // .then(function(data) { // console.log('request succeeded with JSON response', data) // }).catch(function(error) { // console.log('request failed', error) // }) var valueUrl = global.location.hash; console.log('hash url', valueUrl); console.log('URL_FETCH_KONTRAHENCI', URL_FETCH_KONTRAHENCI); switch (valueUrl) { case '#KONTRAHENCI': console.log('kontrahent'); $( ".container-bi_audit_raport" ).append( VIEW_KONTRAHENCI ); urlFetchKontrahenci(); break; case '#PRACOWNICY': $( ".container-bi_audit_raport" ).append( VIEW_PRACOWNICY ); urlFetchPracownicy(); break; default: $( ".container-bi_audit_raport" ).append( VIEW_PRACOWNICY ); urlFetchPracownicy(); break; } function urlFetchKontrahenci() { fetch(URL_FETCH_KONTRAHENCI, { credentials: 'same-origin' }) .then(function parseJSON(response) { return response.json() }) .then(function(data) { $( ".container-bi_audit_raport" ).append( data.body.view ); console.log('request succeeded with JSON response', data) }).catch(function(e) { console.log('request failed', e) }) } function urlFetchPracownicy() { fetch(URL_FETCH_PRACOWNICY, { credentials: 'same-origin' }) .then(function parseJSON(response) { return response.json() }) .then(function(data) { $( ".container-bi_audit_raport" ).append( data.body.view ); console.log('request succeeded with JSON response', data) }).catch(function(error) { console.log('request failed', error) }) } function checkAll() { $('#checkAll').change(function(){ console.log('checkeddd'); var checkboxes = $('form').find(':checkbox'); if($(this).prop('checked')) { checkboxes.prop('checked', true); } else { checkboxes.prop('checked', false); } }); } $(document).ready(function(){ checkAll(); }); global.checkAll = checkAll;