Geen omschrijving

learning-outcomes.blade.php 10KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  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. @endif
  10. @stop
  11. @section('main')
  12. <div class="row">
  13. <div class="col-md-12">
  14. <p>Click on the values you want to change. Invalid values will be rejected automatically. To save your changes,
  15. click the 'Save' button at the bottom of the page.</p>
  16. <table class="table table-striped table-condensed editable-table" id='outcomes_table'>
  17. <thead>
  18. <tr class="center-text">
  19. <th class="col-md-1">ID</th>
  20. <th class="col-md-4">Learning Outcome</th>
  21. <th class="col-md-6">Definition</th>
  22. <th class="col-md-1">Expected Value</th>
  23. <th class="col-md-2">Activation date</th>
  24. <th class="col-md-2">Deactivation date</th>
  25. <th class="col-md-1">Level<br><font size="-5">1:undergrad, 2:grad, 3:both</font></th>
  26. <th class="col-md-1">Equivalent to</th>
  27. </thead>
  28. <tbody>
  29. @foreach ($outcomes as $outcome)
  30. {{-- @foreach ($semesters as $semester) --}}
  31. {{-- display an outcome only if it is part of a currently selected semester --}}
  32. @if ($outcome->deactivation_date == '0000-00-00' or $outcome->deactivation_date == '')
  33. {{-- and ($outcome->activation_date >= $semester->start && $outcome->activation_date <= $semester->end)) --}}
  34. <tr data-id="{{ $outcome->id }}">
  35. <td class="id col-md-1">{{ $outcome->id }}</td>
  36. <td contenteditable="true" class="name col-md-4">{{ $outcome->name }}</td>
  37. <td contenteditable="true" data-type="textarea" class="definition col-md-6">{{ $outcome->definition }}</td>
  38. <td contenteditable="true" class="expected-outcome col-md-1">{{ $outcome->expected_outcome }}</td>
  39. <td contenteditable="true" class="activation-date col-md-2">{{ $outcome->activation_date }}</td>
  40. <td contenteditable="true" class="deactivation-date col-md-2">{{ $outcome->deactivation_date }}</td>
  41. <td contenteditable="true" class="level col-md-1">{{ $outcome->level }}</td>
  42. <td></td>
  43. <td><button class="btn btn-sm btn-primary center-block del" id='del{{ $outcome->id }}'>Del</button></td>
  44. </tr>
  45. @endif
  46. {{-- @endforeach --}}
  47. @endforeach
  48. @foreach ($outcomes as $outcome)
  49. {{-- @foreach ($semesters as $semester) --}}
  50. {{-- display an outcome only if it is part of a currently selected semester --}}
  51. @if ($outcome->deactivation_date != '0000-00-00' and $outcome->deactivation_date != '')
  52. {{-- and ($outcome->deactivation_date != '0000-00-00') and ($outcome->deactivation_date != '')) --}}
  53. <tr data-id="{{ $outcome->id }}">
  54. <td class="id col-md-1">{{ $outcome->id }}</td>
  55. <td contenteditable="true" class="name col-md-4">{{ $outcome->name }}</td>
  56. <td contenteditable="true" data-type="textarea" class="definition col-md-6">{{ $outcome->definition }}</td>
  57. <td contenteditable="true" class="expected-outcome col-md-1">{{ $outcome->expected_outcome }}</td>
  58. <td contenteditable="true" class="activation-date col-md-2">{{ $outcome->activation_date }}</td>
  59. <td contenteditable="true" class="deactivation-date col-md-2">{{ $outcome->deactivation_date }}</td>
  60. <td contenteditable="true" class="level col-md-1">{{ $outcome->level }}</td>
  61. <td contenteditable="true" class="new_outcome_id col-md-1">{{ $outcome->new_outcome_id }}</td>
  62. <td><button class="btn btn-sm btn-primary center-block del" id='del{{ $outcome->id }}'>Del</button></td>
  63. </tr>
  64. @endif
  65. {{-- @endforeach --}}
  66. @endforeach
  67. </tbody>
  68. </table>
  69. </div>
  70. </div>
  71. <div class="row">
  72. <div class="col-md-6"><button class="btn btn-lg btn-secondary center-block" id='show'>New Outcome</button>
  73. </div>
  74. <div class="col-md-6"><button class="btn btn-lg btn-primary center-block" id='save'>Save</button></div>
  75. </div>
  76. <div class="" id='new_outcome_form'>
  77. <h2>Add a new Learning Outcomes</h2>
  78. {{-- For for adding a new outcome --}}
  79. {{ Form::open(['action' => 'OutcomesController@create']) }}
  80. <div class="form-group">
  81. {{ Form::label('name', 'Name') }}
  82. {{ Form::text('name', '', ['class' => 'form-control', 'id' => 'outcome_name']) }}
  83. </div>
  84. <div class="form-group">
  85. {{ Form::label('definition', 'Definition') }}
  86. {{ Form::textarea('definition', 'At least 10 characters long', ['class' => 'form-control', 'id' => 'outcome_definition']) }}
  87. </div>
  88. Due to technical limitationss, the following must be edited after adding the new Outcome:
  89. {{-- the technical limitation is: the Outcome Model has to be edited --}}
  90. <ul>
  91. <li>Expected Outcome</li>
  92. <li>Activation Date</li>
  93. <li>Deactivation Date</li>
  94. <li>Level</li>
  95. </ul>
  96. <div class="row">
  97. <div class="col-md-6"><button type="reset" class="btn btn-lg btn-secondary center-block" id='hide'>Hide
  98. Form</button></div>
  99. <div class="col-md-6"><button type="submit" class="btn btn-lg btn-primary center-block">Submit New
  100. Outcome</button></div>
  101. </div>
  102. {{ Form::close() }}
  103. <hr>
  104. </div>
  105. <div class="modal fade" id="delete-outcome-modal">
  106. <div class="modal-dialog modal-md">
  107. <div class="modal-content">
  108. <div class="modal-header">
  109. <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
  110. <h4 class="modal-title text-center" id ="modal-title-rubric">Are you sure you want to delete this Learning Outcome?</h4>
  111. </div>
  112. <div class="modal-body" id ="delete-outcome-modal-body">
  113. <p>You won't be able to retrieve it</p>
  114. </div>
  115. <div class="modal-footer">
  116. <button type="button" class="btn btn-default modal-but" data-dismiss="modal">Close</button>
  117. <button type="button" class="btn btn-primary modal-but" id='modal-delete-button' data-dismiss="modal" onclick ="">Delete Outcome</button>
  118. </div>
  119. </div><!-- /.modal-content -->
  120. </div><!-- /.modal-dialog -->
  121. </div>
  122. <script>
  123. function deleteOutcome(outcome_id){
  124. var outcomeObject = new Object();
  125. outcomeObject.id= outcome_id;
  126. outcomeObject.delete=1;
  127. console.log("algo"+JSON.stringify(outcome_id));
  128. console.log("algo"+JSON.stringify(outcomeObject));
  129. var clone = jQuery.extend({}, outcomeObject);
  130. // outcomeArray.push(clone);
  131. // console.log("algo"+JSON.stringify(outcomeArray));
  132. $.post(
  133. "{{ URL::action('OutcomesController@delete') }}",
  134. { outcomeArray: JSON.stringify(outcomeObject)},
  135. function(data)
  136. {
  137. location.reload();
  138. }
  139. );
  140. }
  141. </script>
  142. @stop
  143. @section('javascript')
  144. $(".modal-but").on('click',function(e){
  145. e.preventDefault();
  146. })
  147. @foreach ($outcomes as $outcome)
  148. $('#del{{ $outcome->id }}').on('click', function(e)
  149. {
  150. e.preventDefault();
  151. //outcomeObject.id= $(this).data('id');
  152. $("#delete-outcome-modal").modal("show");
  153. $("#modal-delete-button").attr('onclick', 'deleteOutcome({{$outcome->id}})')
  154. }
  155. );
  156. @endforeach
  157. $('#new_outcome_form').hide();
  158. //show form
  159. $('#show').on('click', function(e)
  160. {
  161. $('#new_outcome_form').show();
  162. $('#show').hide();
  163. });
  164. //hide form
  165. $('#hide').on('click', function(e)
  166. {
  167. $('#new_outcome_form').hide();
  168. $('#show').show();
  169. });
  170. $('#save').on('click', function(e)
  171. {
  172. e.preventDefault();
  173. var outcomeArray= new Array();
  174. // For each learning outcome, get its value and put it into an array
  175. $('tbody tr').each(function( index )
  176. {
  177. var outcomeObject = new Object();
  178. outcomeObject.id= $(this).data('id');
  179. outcomeObject.name= $(this).children('.name').text();
  180. outcomeObject.definition= $(this).children('.definition').text();
  181. outcomeObject.expected_outcome= $(this).children('.expected-outcome').text();
  182. outcomeObject.activation_date= $(this).children('.activation-date').text();
  183. outcomeObject.deactivation_date= $(this).children('.deactivation-date').text();
  184. outcomeObject.level= $(this).children('.level').text();
  185. if($(this).children('.new_outcome_id').text()!="")outcomeObject.new_outcome_id= $(this).children('.new_outcome_id').text();
  186. if($(this).find('.glyphicon-eye-close').length>0)
  187. {
  188. outcomeObject.delete=1;
  189. }
  190. else
  191. {
  192. outcomeObject.delete=0;
  193. }
  194. var clone = jQuery.extend({}, outcomeObject);
  195. outcomeArray.push(clone);
  196. });
  197. $.post(
  198. "{{ URL::action('OutcomesController@updateMore') }}",
  199. { outcomeArray: JSON.stringify(outcomeArray)},
  200. function(data)
  201. {
  202. location.reload();
  203. }
  204. );
  205. });
  206. $('span').on('click', function()
  207. {
  208. if($(this).hasClass('glyphicon-eye-open'))
  209. $(this).removeClass('glyphicon-eye-open').addClass('glyphicon-eye-close');
  210. else
  211. $(this).removeClass('glyphicon-eye-close').addClass('glyphicon-eye-open');
  212. });
  213. @stop