templates/workhour/paidView.html.twig line 1

Open in your IDE?
  1. {% extends '@!EasyAdmin/page/content.html.twig' %}
  2. {% block page_content %}
  3. <div class="payview">
  4. <h2>{{worker}}
  5. <select id="workerDateSelect" class="form-control form-control-sm col-3 d-inline ml-auto" style="width: 30%; float:right;" onchange="changeYear()">
  6. {% for w in workerDates %}
  7. <option {{ (selectedDate and w == selectedDate) ? 'selected' : '' }} data-url="{{ (ea_url().setController('App\\Controller\\Admin\\WorkersCrudController').setAction('actionPaid').setEntityId(worker.id)) ~ '&date=' ~ w|url_encode }}">{{w}}</option>
  8. {% endfor %}
  9. </select>
  10. {% if isAdmin %}
  11. <select id="workerSelect" class="form-control form-control-sm col-3 d-inline ml-auto" style="width: 30%; float:right;" onchange="changeWorker()">
  12. {% for w in workers %}
  13. <option {{ w.id == worker.id ? 'selected' : '' }} value="{{w.id}}" {% if w.id == worker.id %}selected{% endif %} data-url="{{ (ea_url().setController('App\\Controller\\Admin\\WorkersCrudController').setAction('actionPaid').setEntityId(w.id)) ~ '?date=' ~ ((selectedDate ?: (workerDates[0] ?? ''))|url_encode) }}">{{w.fullName}}</option>
  14. {% endfor %}
  15. </select>
  16. {% endif %}
  17. </h2> <table class="table">
  18. {% set sum=0 %}
  19. {% set sumHour=0 %}
  20. {% set sumOther=0 %}
  21. <tr>
  22. <th width="20px">Fizetve</th>
  23. <th>Projekt</th>
  24. <th>Idő</th>
  25. <th>Órabér</th>
  26. <th>Egyéb költség</th>
  27. <th>Összesen</th>
  28. <th>Nap</th>
  29. <th>Létrehozva</th>
  30. </tr>
  31. {% for hour in hours %}
  32. <tr id="row-{{hour.id}}">
  33. <td class="text-center"><span class="fa text-success fa-{{(hour.payed == true)? "coins": ""}}"></span></td>
  34. {% if hour.project %}
  35. {% if hour.project.customer %}
  36. <td>({{hour.project.customer.name}}) {{hour.project.name}} - {{hour.note|raw}}</td>
  37. {% else %}
  38. <td>{{hour.project.name}} - {{hour.note|raw}}</td>
  39. {% endif %}
  40. {% else %}
  41. <td>{{hour.note|raw}}</td>
  42. {% endif %}
  43. <td id="hour-{{hour.id}}">{{hour.hours}} ó</td>
  44. <td id="hp-{{hour.id}}">{{hour.payedHourPrice|format_currency('HUF', {rounding_mode: 'floor', fraction_digit: 0})}}</td>
  45. <td id="other-{{hour.id}}">{{hour.otherPrice|format_currency('HUF', {rounding_mode: 'floor', fraction_digit: 0})}}</td>
  46. <td class="text-right" style="padding-right: 3rem !important;" id="sum-{{hour.id}}">{{((hour.hours*worker.priceHour)+hour.otherPrice)|format_currency('HUF', {rounding_mode: 'floor', fraction_digit: 0})}}</td>
  47. <td>{{hour.day?hour.day.format('Y-m-d'):'-'}}</td>
  48. <td>{{hour.created.format('Y-m-d')}}</td>
  49. {% set sumHour = sumHour + hour.hours %}
  50. {% set sum = sum + (hour.hours * hour.payedHourPrice) %}
  51. {% set sumOther = sumOther + (hour.otherPrice?hour.otherPrice:0) %}
  52. </tr>
  53. {% endfor %}
  54. <tfoot style="background-color: #fafafafa">
  55. <tr>
  56. <td colspan="2"><strong>Összesen</strong></td>
  57. <td id="sumHours" >{{sumHour}}</td>
  58. <td></td>
  59. <td></td>
  60. <td></td>
  61. <td></td>
  62. </tr>
  63. <tr>
  64. <td colspan="2"><strong>Fizetendő óra</strong></td>
  65. <td id="sumHoursPrice">{{(sum)|format_currency('HUF',{fraction_digit: 0}, locale='hu')}}</td>
  66. <td></td>
  67. <td></td>
  68. <td></td>
  69. <td></td>
  70. </tr>
  71. <tr>
  72. <td colspan="2"><strong>Egyéb költség</strong></td>
  73. <td id="sumOther">{{sumOther|format_currency('HUF',{fraction_digit: 0}, locale='hu')}}</td>
  74. <td></td>
  75. <td></td>
  76. <td></td>
  77. <td></td>
  78. </tr>
  79. <tr>
  80. <td colspan="2"><strong>Teljes fizetendő összeg</strong></td>
  81. <td><strong id="sumTotalStrong">{{((sum)+sumOther)|format_currency('HUF',{fraction_digit: 0}, locale='hu')}}</strong></td>
  82. <td><input type="hidden" name="sumTotal" id="sumTotal" value="{{(sum)+sumOther}}"></td>
  83. <td></td>
  84. <td></td>
  85. <td></td>
  86. </tr>
  87. </tfoot>
  88. </table>
  89. <script type="text/javascript">
  90. (function(){
  91. window.changeWorker = function(){
  92. var select = document.getElementById('workerSelect');
  93. var dateSelect = document.getElementById('workerDateSelect');
  94. var selectedDate = dateSelect ? dateSelect.value : '';
  95. var url = select.options[select.selectedIndex].dataset.url;
  96. if (url && selectedDate) {
  97. var target = new URL(url, window.location.origin);
  98. target.searchParams.set('date', selectedDate);
  99. window.location.href = target.toString();
  100. return;
  101. }
  102. if (url) {
  103. window.location.href = url;
  104. }
  105. };
  106. window.changeYear = function(){
  107. var select = document.getElementById('workerDateSelect');
  108. var url = select.options[select.selectedIndex].dataset.url;
  109. if (url) {
  110. window.location.href = url;
  111. }
  112. };
  113. })();
  114. function check(){
  115. $('#sumTotal').val(0);
  116. var total = 0;
  117. var sumHours = 0;
  118. var sumHoursPrice = 0;
  119. var sumOther = 0;
  120. var priceHour = parseInt($('#priceHour').val())
  121. $('.hour-checkbox:checked').each(function(key,chk){
  122. var price = parseInt($('#sum-'+chk.value).html())
  123. var other = parseInt($('#other-'+chk.value).html())
  124. var hour = parseFloat($('#hour-'+chk.value).html())
  125. total = total + price;
  126. if(other > 0){
  127. sumOther = sumOther + other;
  128. }
  129. sumHours = sumHours + hour;
  130. sumHoursPrice = sumHoursPrice + (hour*priceHour);
  131. $('#sumTotalStrong').html(total);
  132. $('#sumOther').html(sumOther);
  133. $('#sumHours').html(sumHours);
  134. $('#sumHoursPrice').html(sumHoursPrice);
  135. })
  136. }
  137. </script>
  138. </div>
  139. {% endblock page_content %}