Нема описа

view-learning-outcomes-criteria.blade.php 5.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. @extends('layouts.master')
  2. @section('navigation')
  3. @if(Auth::user()->role==1)
  4. @include('local.managers.admins._navigation')
  5. @elseif(Auth::user()->role==2)
  6. @include('local.managers.sCoords._navigation')
  7. @elseif(Auth::user()->role==3)
  8. @include('local.managers.pCoords._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 filterOutcomes() {
  20. // Declare variables
  21. var input, filter, div, li, i, outcomeText;
  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. outcomeText = li[i].textContent;
  29. if (outcomeText.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="filterOutcomes()" placeholder="Search for Learning Outcomes..">
  40. <div class="list-group" id='list'>
  41. @foreach ($outcomes as $outcome)
  42. @foreach ($semesters as $semester)
  43. @if(!$outcome->deleted_at && $outcome->activation_date >= $semester->start && $outcome->activation_date <= $semester->end)
  44. {{-- <li data-outcome-id="{{ $outcome->id }}"class="list-group-item">{{ $outcome->name }}</li> --}}
  45. <li data-outcome-id="{{ $outcome->id }}"class="list-group-item">{{ $outcome->name }} [{{$semester->code}}]</li>
  46. @endif
  47. @endforeach
  48. @endforeach
  49. </div>
  50. </div>
  51. <div class="col-md-9">
  52. <div id="outcome-display" class="panel panel-default">
  53. <div class="panel-heading">
  54. <h4 class=" panel-title" style="cursor:auto!important;">
  55. </h4>
  56. </div>
  57. <div class="panel-body">
  58. <p class="outcome-definition "></p>
  59. <div class="table-responsive">
  60. <table class="table table-striped table-condensed datatable">
  61. <thead><tr><th>Criterion</th><th>Beginning (1-2)</th><th>In Progress (3-4)</th><th>Satisfactory (5-6)</th><th>Excellent (7-8)</th></tr></thead>
  62. <tfoot>
  63. <tr class="column-search">
  64. <th><input class="column-search-bar form-control" type="text" placeholder="Buscar"/></th>
  65. <th><input class="column-search-bar form-control" type="text" placeholder="Buscar"/></th>
  66. <th><input class="column-search-bar form-control" type="text" placeholder="Buscar"/></th>
  67. <th><input class="column-search-bar form-control" type="text" placeholder="Buscar"/></th>
  68. <th><input class="column-search-bar form-control" type="text" placeholder="Buscar"/></th>
  69. </tr>
  70. </tfoot>
  71. <tbody>
  72. </tbody>
  73. </table>
  74. </div>
  75. </div>
  76. </div>
  77. </div>
  78. <div class="col-md-9">
  79. <div class="no-outcome alert alert-info">
  80. <p>Select a Learning Outcome to view its information</p>
  81. </div>
  82. </div>
  83. </div>
  84. @stop
  85. @section('included-js')
  86. @include('global._datatables_js')
  87. @stop
  88. @section('javascript')
  89. $(document).ready(function()
  90. {
  91. // --------------------------------------------------------------------------
  92. // Page load
  93. // --------------------------------------------------------------------------
  94. // Hide accordion panel contents by default
  95. $('.panel-group .panel-body').hide();
  96. $('#outcome-display').parent().hide();
  97. // --------------------------------------------------------------------------
  98. // Functions
  99. // --------------------------------------------------------------------------
  100. // --------------------------------------------------------------------------
  101. // Events
  102. // --------------------------------------------------------------------------
  103. // When list item is clicked, load corresponding info
  104. $('.list-group-item').on('click', function()
  105. {
  106. var id = $(this).data('outcome-id');
  107. $.post(
  108. "{{ URL::action('OutcomesController@fetchOutcome') }}",
  109. { id: id },
  110. function(json)
  111. {
  112. // Retrieve datatable instance
  113. var table = $('.datatable').DataTable();
  114. var name = json.outcome.name;
  115. var definition = json.outcome.definition;
  116. var criteria =json.outcome.criteria;
  117. $('#outcome-display').parent().show();
  118. $('.no-outcome').parent().hide();
  119. //Display title and definition
  120. $('#outcome-display .panel-title').html(name);
  121. $('#outcome-display .outcome-definition').html(definition);
  122. //Empty table
  123. table.clear();
  124. // Add new criteria
  125. if(criteria.length>0)
  126. {
  127. $('table').show();
  128. $.each(criteria, function(index, value)
  129. {
  130. table.row.add([
  131. value.name,
  132. value.description12,
  133. value.description34,
  134. value.description56,
  135. value.description78
  136. ]);
  137. });
  138. }
  139. else
  140. {
  141. $('table').hide();
  142. }
  143. // Update display
  144. table.draw();
  145. },
  146. 'json'
  147. );
  148. })
  149. });
  150. @stop