BiAuditRaport.php.view.js 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. console.log('test1... DBG:', DBG)
  2. if (!URL_FETCH_TEST) {
  3. throw "Brak zmiennej URL_FETCH_TEST"
  4. }
  5. // // Documentation: https://github.com/github/fetch
  6. // fetch(URL_FETCH_TEST, {
  7. // credentials: 'same-origin'
  8. // })
  9. // .then(function parseJSON(response) {
  10. // return response.json()
  11. // })
  12. // .then(function(data) {
  13. // //$( ".container" ).append( data.body.view );
  14. // console.log('request succeeded with JSON response', data)
  15. // }).catch(function(error) {
  16. // console.log('request failed', error)
  17. // })
  18. //
  19. // fetch(URL_FETCH_TEST_KRS, {
  20. // credentials: 'same-origin'
  21. // })
  22. // .then(function parseJSON(response) {
  23. // return response.json()
  24. // })
  25. // .then(function(data) {
  26. // console.log('request succeeded with JSON response', data)
  27. // }).catch(function(error) {
  28. // console.log('request failed', error)
  29. // })
  30. //
  31. // fetch(URL_FETCH_TEST_CEIDG, {
  32. // credentials: 'same-origin'
  33. // })
  34. // .then(function parseJSON(response) {
  35. // return response.json()
  36. // })
  37. // .then(function(data) {
  38. // console.log('request succeeded with JSON response', data)
  39. // }).catch(function(error) {
  40. // console.log('request failed', error)
  41. // })
  42. var valueUrl = global.location.hash;
  43. console.log('hash url', valueUrl);
  44. console.log('URL_FETCH_KONTRAHENCI', URL_FETCH_KONTRAHENCI);
  45. switch (valueUrl) {
  46. case '#KONTRAHENCI':
  47. console.log('kontrahent');
  48. $( ".container-bi_audit_raport" ).append( VIEW_KONTRAHENCI );
  49. urlFetchKontrahenci();
  50. break;
  51. case '#PRACOWNICY':
  52. $( ".container-bi_audit_raport" ).append( VIEW_PRACOWNICY );
  53. urlFetchPracownicy();
  54. break;
  55. default:
  56. $( ".container-bi_audit_raport" ).append( VIEW_PRACOWNICY );
  57. urlFetchPracownicy();
  58. break;
  59. }
  60. function urlFetchKontrahenci() {
  61. fetch(URL_FETCH_KONTRAHENCI, {
  62. credentials: 'same-origin'
  63. })
  64. .then(function parseJSON(response) {
  65. return response.json()
  66. })
  67. .then(function(data) {
  68. $( ".container-bi_audit_raport" ).append( data.body.view );
  69. console.log('request succeeded with JSON response', data)
  70. }).catch(function(e) {
  71. console.log('request failed', e)
  72. })
  73. }
  74. function urlFetchPracownicy() {
  75. fetch(URL_FETCH_PRACOWNICY, {
  76. credentials: 'same-origin'
  77. })
  78. .then(function parseJSON(response) {
  79. return response.json()
  80. })
  81. .then(function(data) {
  82. $( ".container-bi_audit_raport" ).append( data.body.view );
  83. console.log('request succeeded with JSON response', data)
  84. }).catch(function(error) {
  85. console.log('request failed', error)
  86. })
  87. }
  88. function checkAll() {
  89. $('#checkAll').change(function(){
  90. console.log('checkeddd');
  91. var checkboxes = $('form').find(':checkbox');
  92. if($(this).prop('checked')) {
  93. checkboxes.prop('checked', true);
  94. } else {
  95. checkboxes.prop('checked', false);
  96. }
  97. });
  98. }
  99. $(document).ready(function(){
  100. checkAll();
  101. });
  102. global.checkAll = checkAll;