admin_view.tpl 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. <form id="form_advanced_subscription_admin" class="form-search" method="post" action="/plugin/advanced_subscription/src/admin_view.php" name="form_advanced_subscription_admin">
  2. <div class="row">
  3. <div class="col-md-6">
  4. <p class="text-title-select">{{ 'SelectASession' | get_plugin_lang('AdvancedSubscriptionPlugin') }}</p>
  5. <select id="session-select" name="s">
  6. <option value="0">
  7. {{ "SelectASession" | get_plugin_lang('AdvancedSubscriptionPlugin') }}
  8. </option>
  9. {% for sessionItem in sessionItems %}
  10. <option value="{{ sessionItem.id }}" {{ sessionItem.selected }}>
  11. {{ sessionItem.name }}
  12. </option>
  13. {% endfor %}
  14. </select>
  15. <h4>{{ "SessionName" | get_plugin_lang('AdvancedSubscriptionPlugin') }}</h4>
  16. <h3 class="title-name-session">{{ session.name }}</h3>
  17. <h4>{{ "Target" | get_plugin_lang('AdvancedSubscriptionPlugin') }}</h4>
  18. <p>{{ session.target }}</p>
  19. </div>
  20. <div class="col-md-6">
  21. <p class="separate-badge">
  22. <span class="badge badge-dis">{{ session.vacancies }}</span>
  23. {{ "Vacancies" | get_plugin_lang('AdvancedSubscriptionPlugin') }}</p>
  24. <p class="separate-badge">
  25. <span class="badge badge-info">{{ session.nbr_users }}</span>
  26. {{ 'CountOfSubscribedUsers'|get_lang }}
  27. </p>
  28. <p class="separate-badge">
  29. <span class="badge badge-recom">{{ session.recommended_number_of_participants }}</span>
  30. {{ "RecommendedNumberOfParticipants" | get_plugin_lang('AdvancedSubscriptionPlugin') }}</p>
  31. <h4>{{ "PublicationEndDate" | get_plugin_lang('AdvancedSubscriptionPlugin') }}</h4> <p>{{ session.publication_end_date }}</p>
  32. <h4>{{ "Mode" | get_plugin_lang('AdvancedSubscriptionPlugin') }}</h4> <p>{{ session.mode }}</p>
  33. </div>
  34. </div>
  35. <div class="row">
  36. <div class="col-md-12">
  37. <div class="student-list-table">
  38. <table id="student_table" class="table table-striped">
  39. <thead>
  40. <tr>
  41. <th>{{ "Postulant" | get_plugin_lang('AdvancedSubscriptionPlugin') }}</th>
  42. <th>{{ "InscriptionDate" | get_plugin_lang('AdvancedSubscriptionPlugin') }}</th>
  43. <th>{{ "Area" | get_plugin_lang('AdvancedSubscriptionPlugin') }}</th>
  44. <th>{{ "Institution" | get_plugin_lang('AdvancedSubscriptionPlugin') }}</th>
  45. <th>{{ "BossValidation" | get_plugin_lang('AdvancedSubscriptionPlugin') }}</th>
  46. <th class="advanced-subscription-decision-column">{{ "Decision" | get_plugin_lang('AdvancedSubscriptionPlugin') }}</th>
  47. </tr>
  48. </thead>
  49. <tbody>
  50. {% set row_class = "row_odd" %}
  51. {% for student in students %}
  52. <tr class="{{ row_class }}">
  53. <td class="name">
  54. <a href="{{ student.userLink }}" target="_blank">{{ student.complete_name }}<a>
  55. </td>
  56. <td>{{ student.created_at }}</td>
  57. <td>{{ student.area }}</td>
  58. <td>{{ student.institution }}</td>
  59. {% set cellClass = 'danger'%}
  60. {% if student.validation == 'Yes' %}
  61. {% set cellClass = 'success'%}
  62. {% endif %}
  63. <td>
  64. {% if student.validation != '' %}
  65. <span class="label label-{{ cellClass }}">
  66. {{ student.validation | get_plugin_lang('AdvancedSubscriptionPlugin') }}
  67. </span>
  68. {% endif %}
  69. </td>
  70. <td>
  71. {% if student.status != approveAdmin and student.status != disapproveAdmin %}
  72. <a
  73. class="btn btn-success btn-advanced-subscription btn-accept"
  74. href="{{ student.acceptUrl }}"
  75. >
  76. {{ 'AcceptInfinitive' | get_plugin_lang('AdvancedSubscriptionPlugin') }}
  77. </a>
  78. <a
  79. class="btn btn-danger btn-advanced-subscription btn-reject"
  80. href="{{ student.rejectUrl }}"
  81. >
  82. {{ 'RejectInfinitive' | get_plugin_lang('AdvancedSubscriptionPlugin') }}
  83. </a>
  84. {% else %}
  85. {% if student.status == approveAdmin%}
  86. <span class="label label-success">{{ 'Accepted'|get_lang }}</span>
  87. {% elseif student.status == disapproveAdmin %}
  88. <span class="label label-danger">{{ 'Rejected'|get_lang }}</span>
  89. {% endif %}
  90. {% endif %}
  91. </td>
  92. </tr>
  93. {% if row_class == "row_even" %}
  94. {% set row_class = "row_odd" %}
  95. {% else %}
  96. {% set row_class = "row_even" %}
  97. {% endif %}
  98. {% endfor %}
  99. </tbody>
  100. </table>
  101. </div>
  102. </div>
  103. </div>
  104. <input name="f" value="social" type="hidden">
  105. </form>
  106. <div class="modal fade" id="modalMail" tabindex="-1" role="dialog" aria-labelledby="modalMailLabel" aria-hidden="true">
  107. <div class="modal-dialog modal-lg">
  108. <div class="modal-content">
  109. <div class="modal-header">
  110. <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
  111. <h4 class="modal-title" id="modalMailLabel">{{ "AdvancedSubscriptionAdminViewTitle" | get_plugin_lang('AdvancedSubscriptionPlugin')}}</h4>
  112. </div>
  113. <div class="modal-body">
  114. <iframe id="iframeAdvsub" frameBorder="0">
  115. </iframe>
  116. </div>
  117. <div class="modal-footer">
  118. <button type="button" class="btn btn-primary" data-dismiss="modal">Cerrar</button>
  119. </div>
  120. </div>
  121. </div>
  122. </div>
  123. <link href="{{ _p.web_plugin }}advanced_subscription/views/css/style.css" rel="stylesheet" type="text/css">
  124. <script>
  125. $(document).ready(function(){
  126. $("#session-select").change(function () {
  127. $("#form_advanced_subscription_admin").submit();
  128. });
  129. $("a.btn-advanced-subscription").click(function(event){
  130. event.preventDefault();
  131. var confirmed = false;
  132. var studentName = $.trim($(this).closest("tr").find(".name").text());
  133. if (studentName) {
  134. ;
  135. } else {
  136. studentName = "";
  137. }
  138. var msgRe = /%s/;
  139. if ($(this).hasClass('btn-accept')) {
  140. var msg = "{{ 'AreYouSureYouWantToAcceptSubscriptionOfX' | get_plugin_lang('AdvancedSubscriptionPlugin') }}";
  141. var confirmed = confirm(msg.replace(msgRe, studentName));
  142. } else {
  143. var msg = "{{ 'AreYouSureYouWantToRejectSubscriptionOfX' | get_plugin_lang('AdvancedSubscriptionPlugin') }}";
  144. var confirmed = confirm(msg.replace(msgRe, studentName));
  145. }
  146. if (confirmed) {
  147. var tdParent = $(this).closest("td");
  148. var advancedSubscriptionUrl = $(this).attr("href");
  149. $("#iframeAdvsub").attr("src", advancedSubscriptionUrl);
  150. $("#modalMail").modal("show");
  151. $.ajax({
  152. dataType: "json",
  153. url: advancedSubscriptionUrl
  154. }).done(function(result){
  155. if (result.error === true) {
  156. tdParent.html('');
  157. } else {
  158. console.log(result);
  159. }
  160. });
  161. }
  162. });
  163. });
  164. </script>