paypal_payout.tpl 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. <div class="table-responsive">
  2. <table class="table table-striped table-hover">
  3. <thead>
  4. <tr>
  5. <th class="text-center"><input type="checkbox" id="checkAll"></th>
  6. <th class="text-center">{{ 'OrderReference'| get_plugin_lang('BuyCoursesPlugin') }}</th>
  7. <th class="text-center">{{ 'OrderDate'| get_plugin_lang('BuyCoursesPlugin') }}</th>
  8. <th class="text-right">{{ 'Commission'| get_plugin_lang('BuyCoursesPlugin') }}</th>
  9. <th class="text-right">{{ 'PayPalAccount'| get_plugin_lang('BuyCoursesPlugin') }}</th>
  10. <th class="text-right">{{ 'Options'| get_lang }}</th>
  11. </tr>
  12. </thead>
  13. <tbody>
  14. {% for payout in payout_list %}
  15. <tr style="{{ payout.paypal_account ? '' : 'color: red;' }}">
  16. <td class="text-center" style="vertical-align:middle">{% if payout.paypal_account %} <input
  17. id="{{ payout.id }}" type="checkbox" name="data[]"
  18. value="{{ payout.commission }}"> {% endif %}</td>
  19. <td class="text-center" style="vertical-align:middle">{{ payout.reference }}</td>
  20. <td class="text-center" style="vertical-align:middle">{{ payout.date }}</td>
  21. <td class="text-right"
  22. style="vertical-align:middle">{{ payout.currency ~ ' ' ~ payout.commission }}</td>
  23. {% if payout.paypal_account %}
  24. <td class="text-right" style="vertical-align:middle">{{ payout.paypal_account }}</td>
  25. {% else %}
  26. <td class="text-right"
  27. style="vertical-align:middle">{{ 'NoPayPalAccountDetected'| get_plugin_lang('BuyCoursesPlugin') }}</td>
  28. {% endif %}
  29. <td class="text-right" style="vertical-align:middle">
  30. <button id="{{ payout.id }}" type="button"
  31. class="btn btn-danger fa fa-ban cancelPayout"> {{ 'CancelPayout'| get_plugin_lang('BuyCoursesPlugin') }}</button>
  32. </td>
  33. </tr>
  34. {% endfor %}
  35. </tbody>
  36. </table>
  37. <div id="startPayout" class="modal fade" role="dialog">
  38. <div class="modal-dialog modal-lg">
  39. <div class="modal-content">
  40. <div class="modal-header">
  41. <h4 class="modal-title">{{ 'PaypalPayoutCommissions'|get_plugin_lang('BuyCoursesPlugin') }}</h4>
  42. </div>
  43. <div class="modal-body" id="content">
  44. </div>
  45. <div class="modal-footer">
  46. <button id="proceedPayout" type="button"
  47. class="btn btn-success fa fa-paypal"> {{ 'ProceedPayout'|get_plugin_lang('BuyCoursesPlugin') }}</button>
  48. <button id="cancelPayout" type="button" class="btn btn-danger"
  49. data-dismiss="modal">{{ 'Cancel'|get_lang }}</button>
  50. <button id="responseButton" type="button"
  51. class="btn btn-primary">{{ 'Confirm'|get_lang }}</button>
  52. </div>
  53. </div>
  54. </div>
  55. </div>
  56. </div>
  57. <div>
  58. <button id="continuePayout" type="button" class="btn btn-primary fa fa-caret-square-o-right" data-toggle="modal"
  59. data-target="#startPayout" data-backdrop="static"
  60. data-keyboard="false"> {{ 'ContinuePayout'|get_plugin_lang('BuyCoursesPlugin') }}</button>
  61. </div>
  62. <script>
  63. $(function () {
  64. $("#responseButton").hide();
  65. $("#checkAll").click(function () {
  66. $(':checkbox').prop('checked', this.checked);
  67. });
  68. $('#continuePayout').click(function () {
  69. var val = [];
  70. $(':checkbox:checked').not('#checkAll').each(function (i) {
  71. val[i] = $(this).attr("id");
  72. });
  73. $.ajax({
  74. data: {payouts: val},
  75. url: '{{ _p.web_plugin ~ 'buycourses/src/buycourses.ajax.php?' ~ { 'a': 'processPayout' }|url_encode() }}',
  76. type: 'POST',
  77. success: function (response) {
  78. $("#content").html(response);
  79. (jQuery.isEmptyObject(val)) ? $('#proceedPayout').prop("disabled", true) : $('#proceedPayout').prop("disabled", false);
  80. }
  81. });
  82. });
  83. $('#proceedPayout').click(function () {
  84. var val = [];
  85. $(':checkbox:checked').not('#checkAll').each(function (i) {
  86. val[i] = $(this).attr("id");
  87. });
  88. $.ajax({
  89. data: {payouts: val},
  90. url: '{{ _p.web_plugin ~ 'buycourses/src/buycourses.ajax.php?' ~ { 'a': 'proceedPayout' }|url_encode() }}',
  91. type: 'POST',
  92. beforeSend: function () {
  93. $("#proceedPayout").hide();
  94. $("#cancelPayout").hide();
  95. $("#spinner").html('<br /><br /><div class="wobblebar-loader"></div><p> {{ 'ProcessingPayoutsDontCloseThisWindow'|get_plugin_lang('BuyCoursesPlugin') }} </p>');
  96. },
  97. success: function (response) {
  98. $("#content").html(response);
  99. $("#responseButton").show();
  100. }
  101. });
  102. });
  103. $(".cancelPayout").click(function () {
  104. var id = this.id;
  105. $.ajax({
  106. data: 'id=' + id,
  107. url: '{{ _p.web_plugin ~ 'buycourses/src/buycourses.ajax.php?' ~ { 'a': 'cancelPayout' }|url_encode() }}',
  108. type: 'POST',
  109. success: function () {
  110. window.location.reload();
  111. }
  112. });
  113. });
  114. $('#responseButton').click(function () {
  115. window.location.reload();
  116. });
  117. });
  118. </script>