暂无描述

view-objectives-criteria.blade.php 6.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. @extends('layouts.master')
  2. @section('navigation')
  3. @if (Auth::user()->role == 1)
  4. @include('local.managers.admins._new_navigation')
  5. @elseif(Auth::user()->role == 2)
  6. @include('local.managers.sCoords._new_navigation')
  7. @elseif(Auth::user()->role == 3)
  8. @include('local.managers.pCoords._new_navigation')
  9. @elseif(Auth::user()->role == 4)
  10. @include('local.professors._navigation')
  11. @endif
  12. @stop
  13. @section('main')
  14. {{-- TODO: look where to place this script.
  15. if placed inside .ready() or before it,
  16. an error that the function is not defined occurs. --}}
  17. {{-- TODO: no reconoce acentos --}}
  18. <script type="text/javascript">
  19. function filterObjectives() {
  20. // Declare variables
  21. var input, filter, div, li, i, objectiveText;
  22. input = document.getElementById('userInput');
  23. filter = input.value.toUpperCase();
  24. div = document.getElementById("list");
  25. li = div.getElementsByTagName('li');
  26. // Loop through all list items, and hide those who don't match the search query
  27. for (i = 0; i < li.length; i++) {
  28. objectiveText = li[i].textContent;
  29. if (objectiveText.toUpperCase().indexOf(filter) > -1) {
  30. li[i].style.display = "";
  31. } else {
  32. li[i].style.display = "none";
  33. }
  34. }
  35. }
  36. </script>
  37. <div class="row">
  38. <div class="col-md-3">
  39. <input class="form-control" type="text" id="userInput" onkeyup="filterObjectives()"
  40. placeholder="Search for Learning Outcomes..">
  41. <div class="list-group" id='list'>
  42. @foreach ($outcomes as $outcome)
  43. <li data-outcome-id="{{ $outcome->id }}" class="list-group-item">{{ $outcome->name }}</li>
  44. @endforeach
  45. </div>
  46. </div>
  47. <div class="col-md-9">
  48. <div id="objective-display" class="panel panel-default">
  49. <div class="panel-heading">
  50. <h4 class=" panel-title" style="cursor:auto!important;">
  51. </h4>
  52. </div>
  53. <div class="panel-body">
  54. <p class="objective-definition "></p>
  55. <div class="table-responsive table-responsive-0">
  56. <table class="table table-striped table-condensed datatable">
  57. <thead id="theHead">
  58. <th>Objective</th>
  59. <th>Program</th>
  60. </thead>
  61. <tfoot>
  62. </tfoot>
  63. <tbody id="table_objectives">
  64. </tbody>
  65. </table>
  66. </div>
  67. </div>
  68. </div>
  69. </div>
  70. <div class="col-md-9">
  71. <div class="no-objective alert alert-info">
  72. <p>Select a Learning Objective to view its information</p>
  73. </div>
  74. </div>
  75. </div>
  76. <script>
  77. $(document).ready(function() {
  78. // --------------------------------------------------------------------------
  79. // Page load
  80. // --------------------------------------------------------------------------
  81. // Hide accordion panel contents by default
  82. $('.panel-group .panel-body').hide(); -
  83. $('#objective-display').parent().hide();
  84. // --------------------------------------------------------------------------
  85. // Functions
  86. // --------------------------------------------------------------------------
  87. /*
  88. */
  89. function fetchObjectives(li) {
  90. {
  91. var id = $(li).data('outcome-id');
  92. $.post(
  93. "{{ URL::action('Objective2Controller@fetchObjectivesForOutcome') }}", {
  94. id: id,
  95. },
  96. function(json) {
  97. // Retrieve datatable instance
  98. //var table = $('.table-responsive-0').;
  99. var name = $(li).html();
  100. //var definition = json.objective.program.name;
  101. //var criteria = json.objective.criteria;
  102. $('#objective-display').parent().show();
  103. $('.no-objective').parent().hide();
  104. //Display title and definition
  105. $('#objective-display .panel-title').html(name);
  106. // $('#objective-display .objective-definition').html(definition);
  107. //Empty table
  108. $('#table_objectives').empty();
  109. $.each(json, function(ind2, objective) {
  110. tr = $("<tr>");
  111. td_text = $("<td>").html(objective.text);
  112. td_programs = $("<td>");
  113. ol = $("<ol>");
  114. $.each(objective.programs, function(ind, prog) {
  115. li = $("<li>").html(prog.name);
  116. li.appendTo(ol);
  117. })
  118. ol.appendTo(td_programs);
  119. tr.append(td_text);
  120. tr.append(td_programs);
  121. tr.appendTo($('#table_objectives'))
  122. })
  123. },
  124. 'json'
  125. );
  126. }
  127. }
  128. // --------------------------------------------------------------------------
  129. // Events
  130. // --------------------------------------------------------------------------
  131. // When list item is clicked, load corresponding info
  132. $('.list-group-item').on('click', function() {
  133. fetchObjectives(this);
  134. })
  135. });
  136. $('.view-scales').on('click', function() {
  137. var number_of_scales = this.value;
  138. $('.table-responsive').hide();
  139. $('.table-responsive-0').show();
  140. $('.table-' + number_of_scales).show();
  141. })
  142. </script>
  143. @stop
  144. @section('included-js')
  145. @include('global._datatables_js')
  146. @stop
  147. @section('javascript')