skill_rel_user.tpl 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <h3>{{ user.complete_name_with_username }}</h3>
  2. <br />
  3. <script>
  4. $(function() {
  5. $(".assign_user_to_skill").on("click", function() {
  6. var skillId = $(this).attr('data-skill-id');
  7. var link = $(this);
  8. $.ajax({
  9. type: "GET",
  10. async: false,
  11. url: "{{ assign_user_url }}&skill_id="+skillId+"&user_id={{ user.id }}&course_id={{ course_id }}&session_id={{ session_id }}",
  12. success: function(result) {
  13. link.removeClass('btn-danger');
  14. link.removeClass('btn-success');
  15. if (result == 'danger') {
  16. link.addClass('btn-danger');
  17. link.html('{{ 'NotYetAchieved' | get_lang }}');
  18. } else {
  19. link.addClass('btn-success');
  20. link.html('{{ 'Achieved' | get_lang }}');
  21. }
  22. }
  23. });
  24. });
  25. });
  26. </script>
  27. <table class="table table-striped">
  28. <tr>
  29. <th>{{ 'Skill' | get_lang }}</th>
  30. <th>{{ 'Occurrences' | get_lang }}</th>
  31. <th>{{ 'Conclusion' | get_lang }}</th>
  32. </tr>
  33. {% for skill in skills %}
  34. <tr>
  35. <td>{{ skill.name }}</td>
  36. <td>
  37. {% for item in items[skill.id] %}
  38. {% set status = 'danger' %}
  39. {% if item.info.status %}
  40. {% set status = 'success' %}
  41. {% endif %}
  42. <span class="label label-{{ status }}">
  43. <a href="{{ item.info.url_activity }}" target="_blank">
  44. {{ item.info.name }}
  45. </a>
  46. </span> &nbsp;
  47. {% endfor %}
  48. </td>
  49. <td>
  50. {% set class = 'danger' %}
  51. {% set text = 'NotYetAchieved' %}
  52. {% if conclusion_list[skill.id] %}
  53. {% set class = 'success' %}
  54. {% set text = 'Achieved' %}
  55. {% endif %}
  56. <a data-skill-id="{{ skill.id }}" href="javascript:void(0);" class="assign_user_to_skill btn btn-{{ class }}">
  57. {{ text | get_lang }}
  58. </a>
  59. </td>
  60. </tr>
  61. {% endfor %}
  62. </table>