Açıklama Yok

view-objectives-criteria.blade.php 5.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  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 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()" placeholder="Search for Learning Outcomes..">
  40. <div class="list-group" id='list'>
  41. @foreach ($objectives as $objective)
  42. <li data-objective-id="{{ $objective->id }}"class="list-group-item">{{ $objective->text }}</li>
  43. @endforeach
  44. </div>
  45. </div>
  46. <div class="col-md-9">
  47. <div id="objective-display" class="panel panel-default">
  48. <div class="panel-heading">
  49. <h4 class=" panel-title" style="cursor:auto!important;">
  50. </h4>
  51. </div>
  52. <div class="panel-body">
  53. <p class="objective-definition "></p>
  54. <div class="table-responsive">
  55. <table class="table table-striped table-condensed datatable">
  56. <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>
  57. <tfoot>
  58. <tr class="column-search">
  59. <th><input class="column-search-bar form-control" type="text" placeholder="Buscar"/></th>
  60. <th><input class="column-search-bar form-control" type="text" placeholder="Buscar"/></th>
  61. <th><input class="column-search-bar form-control" type="text" placeholder="Buscar"/></th>
  62. <th><input class="column-search-bar form-control" type="text" placeholder="Buscar"/></th>
  63. <th><input class="column-search-bar form-control" type="text" placeholder="Buscar"/></th>
  64. </tr>
  65. </tfoot>
  66. <tbody>
  67. </tbody>
  68. </table>
  69. </div>
  70. </div>
  71. </div>
  72. </div>
  73. <div class="col-md-9">
  74. <div class="no-objective alert alert-info">
  75. <p>Select a Learning Objective to view its information</p>
  76. </div>
  77. </div>
  78. </div>
  79. @stop
  80. @section('included-js')
  81. @include('global._datatables_js')
  82. @stop
  83. @section('javascript')
  84. $(document).ready(function()
  85. {
  86. // --------------------------------------------------------------------------
  87. // Page load
  88. // --------------------------------------------------------------------------
  89. // Hide accordion panel contents by default
  90. $('.panel-group .panel-body').hide();
  91. $('#objective-display').parent().hide();
  92. // --------------------------------------------------------------------------
  93. // Functions
  94. // --------------------------------------------------------------------------
  95. // --------------------------------------------------------------------------
  96. // Events
  97. // --------------------------------------------------------------------------
  98. // When list item is clicked, load corresponding info
  99. $('.list-group-item').on('click', function()
  100. {
  101. var id = $(this).data('objective-id');
  102. $.post(
  103. "{{ URL::action('ObjectivesController@fetchObjectiveForCriteria') }}",
  104. { id: id },
  105. function(json)
  106. {
  107. // Retrieve datatable instance
  108. var table = $('.datatable').DataTable();
  109. var name = json.objective.text;
  110. var definition = json.objective.program.name;
  111. var criteria =json.objective.criteria;
  112. $('#objective-display').parent().show();
  113. $('.no-objective').parent().hide();
  114. //Display title and definition
  115. $('#objective-display .panel-title').html(name);
  116. $('#objective-display .objective-definition').html(definition);
  117. //Empty table
  118. table.clear();
  119. // Add new criteria
  120. if(criteria.length>0)
  121. {
  122. $('table').show();
  123. $.each(criteria, function(index, value)
  124. {
  125. table.row.add([
  126. value.name,
  127. value.description12,
  128. value.description34,
  129. value.description56,
  130. value.description78
  131. ]);
  132. });
  133. }
  134. else
  135. {
  136. $('table').hide();
  137. }
  138. // Update display
  139. table.draw();
  140. },
  141. 'json'
  142. );
  143. })
  144. });
  145. @stop