maps-spp.blade.php 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. <script>
  2. var mapChart;
  3. var data = [
  4. @foreach(\App\Model\Region\Provinsi::all() as $provinsi => $value)
  5. <?php
  6. $myTime = Carbon\Carbon::now();
  7. $month = $myTime->format('m');
  8. $year = '20'.$myTime->format('y');
  9. if ($month == 1) {
  10. $dataTerbayar = 12;
  11. $dataBelumTerbayar = 12;
  12. $fixYear = $year - 1;
  13. }
  14. else{
  15. $dataTerbayar = $month - 1;
  16. $dataBelumTerbayar = $month - 1;
  17. $fixYear = $year;
  18. }
  19. ?>
  20. ['{{$value->id_map}}',@if(\App\Model\SPP\RincianTagihan::whereMonth('bi_begin',$dataBelumTerbayar)->whereYear('bi_begin',$fixYear)->where('status','not paid')->where('status_izin','Perpanjangan')->where('bi_type',0)->where('province',$value->nama)->where('active',1)->count() != 0) 1 @else 100 @endif],
  21. @endforeach
  22. ];
  23. Highcharts.wrap(Highcharts.Point.prototype, 'select', function (proceed) {
  24. proceed.apply(this, Array.prototype.slice.call(arguments, 1));
  25. var points = mapChart.getSelectedPoints();
  26. if (points.length) {
  27. if (points.length === 1) {
  28. $('#info-spp #flag-spp-rt').attr('class', 'flag ' + points[0].flag);
  29. // $('#info-spp-rt h2').html(points[0].name);
  30. $('#info-spp-rt #map-spp-rt').attr('value', points[0].options['hc-key']);
  31. } else {
  32. $('#info-spp-rt #flag-spp-rt').attr('class', 'flag');
  33. // $('#info-spp-rt h2').html('Comparing countries');
  34. $('#info-spp-rt #map-spp-rt').attr('value', '');
  35. }
  36. } else {
  37. $('#info-spp-rt #flag-spp-rt').attr('class', '');
  38. }
  39. });
  40. // Create the chart
  41. mapChart = Highcharts.mapChart('maps-spp-rt', {
  42. chart: {
  43. map: 'countries/id/id-all'
  44. },
  45. title: {
  46. enabled: false,
  47. text: ''
  48. },
  49. mapNavigation: {
  50. enabled: true,
  51. buttonOptions: {
  52. verticalAlign: 'top'
  53. }
  54. },
  55. colorAxis: {
  56. min: 1,
  57. type: 'logarithmic',
  58. minColor: '#0000FF',
  59. maxColor: '#FF0000',
  60. stops: [
  61. [0, '#0d00f2'],
  62. [0.67, '#800080'],
  63. [1, '#FF0000']
  64. ]
  65. },
  66. series: [{
  67. data: data,
  68. name: 'UPT',
  69. allowPointSelect: true,
  70. cursor: 'pointer',
  71. states: {
  72. hover: {
  73. color: '#BADA55'
  74. }
  75. }
  76. }]
  77. });
  78. </script>
  79. <script>
  80. var mapChart;
  81. var data = [
  82. @foreach(\App\Model\Region\Provinsi::all() as $provinsi => $value)
  83. <?php
  84. $myTime = Carbon\Carbon::now();
  85. $month = $myTime->format('m');
  86. $year = '20'.$myTime->format('y');
  87. if ($month == 1) {
  88. $dataTerbayar = 12;
  89. $dataBelumTerbayar = 12;
  90. $fixYear = $year - 1;
  91. }
  92. else{
  93. $dataTerbayar = $month - 1;
  94. $dataBelumTerbayar = $month - 1;
  95. $fixYear = $year;
  96. }
  97. ?>
  98. ['{{$value->id_map}}',@if(\App\Model\SPP\RincianTagihan::whereMonth('bi_begin',$dataBelumTerbayar)->whereYear('bi_begin',$fixYear)->where('status','not paid')->where('status_izin','Perpanjangan')->where('province',$value->nama)->where('active',1)->count() != 0) 1 @else 100 @endif],
  99. @endforeach
  100. ];
  101. Highcharts.wrap(Highcharts.Point.prototype, 'select', function (proceed) {
  102. proceed.apply(this, Array.prototype.slice.call(arguments, 1));
  103. var points = mapChart.getSelectedPoints();
  104. if (points.length) {
  105. if (points.length === 1) {
  106. $('#info-spp #flag-spp-st').attr('class', 'flag ' + points[0].flag);
  107. // $('#info-spp-st h2').html(points[0].name);
  108. $('#info-spp-st #map-spp-st').attr('value', points[0].options['hc-key']);
  109. } else {
  110. $('#info-spp-st #flag-spp-st').attr('class', 'flag');
  111. // $('#info-spp-st h2').html('Comparing countries');
  112. $('#info-spp-st #map-spp-st').attr('value', '');
  113. }
  114. } else {
  115. $('#info-spp-st #flag-spp-st').attr('class', '');
  116. }
  117. });
  118. // Create the chart
  119. mapChart = Highcharts.mapChart('maps-spp-st', {
  120. chart: {
  121. map: 'countries/id/id-all'
  122. },
  123. title: {
  124. enabled: false,
  125. text: ''
  126. },
  127. mapNavigation: {
  128. enabled: true,
  129. buttonOptions: {
  130. verticalAlign: 'top'
  131. }
  132. },
  133. colorAxis: {
  134. min: 1,
  135. type: 'logarithmic',
  136. minColor: '#0000FF',
  137. maxColor: '#FF0000',
  138. stops: [
  139. [0, '#0d00f2'],
  140. [0.67, '#800080'],
  141. [1, '#FF0000']
  142. ]
  143. },
  144. series: [{
  145. data: data,
  146. name: 'UPT',
  147. allowPointSelect: true,
  148. cursor: 'pointer',
  149. states: {
  150. hover: {
  151. color: '#BADA55'
  152. }
  153. }
  154. }]
  155. });
  156. </script>