Bez popisu

learning-outcomes.blade.php 7.7KB

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. @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, click the 'Save' button at the bottom of the page.</p>
  15. <table class="table table-striped table-condensed editable-table" id='outcomes_table'>
  16. <thead><tr class="center-text">
  17. <th class="col-md-4">Learning Outcome</th>
  18. <th class="col-md-7">Definition</th>
  19. <th class="col-md-1">Expected Value</th>
  20. <th class="col-md-2">Activation date</th>
  21. <th class="col-md-2">Deactivation date</th>
  22. <th class="col-md-1">Level</th>
  23. </thead>
  24. <tbody>
  25. @foreach ($outcomes as $outcome)
  26. {{-- @foreach ($semesters as $semester) --}}
  27. {{-- display an outcome only if it is part of a currently selected semester --}}
  28. @if ((($outcome->deactivation_date == '0000-00-00') or ($outcome->deactivation_date == ''))
  29. // and ($outcome->activation_date >= $semester->start && $outcome->activation_date <= $semester->end)
  30. )
  31. <tr data-id="{{ $outcome->id }}">
  32. <td contenteditable="true" class="name col-md-4" >{{ $outcome->name }}</td>
  33. <td contenteditable="true" data-type="textarea" class="definition col-md-6" >{{ $outcome->definition }}</td>
  34. <td contenteditable="true" class="expected-outcome col-md-1" >{{ $outcome->expected_outcome }}</td>
  35. <td contenteditable="true" class="activation-date col-md-2" >{{ $outcome->activation_date }}</td>
  36. <td contenteditable="true" class="deactivation-date col-md-2" >{{ $outcome->deactivation_date }}</td>
  37. <td contenteditable="true" class="level col-md-1" >{{ $outcome->level }}</td>
  38. </tr>
  39. @endif
  40. {{-- @endforeach --}}
  41. @endforeach
  42. @foreach ($outcomes as $outcome)
  43. {{-- @foreach ($semesters as $semester) --}}
  44. {{-- display an outcome only if it is part of a currently selected semester --}}
  45. @if ((($outcome->deactivation_date != '0000-00-00') and ($outcome->deactivation_date != ''))
  46. // and ($outcome->deactivation_date != '0000-00-00') and ($outcome->deactivation_date != '')
  47. )
  48. <tr data-id="{{ $outcome->id }}">
  49. <td contenteditable="true" class="name col-md-4" >{{ $outcome->name }}</td>
  50. <td contenteditable="true" data-type="textarea" class="definition col-md-6" >{{ $outcome->definition }}</td>
  51. <td contenteditable="true" class="expected-outcome col-md-1" >{{ $outcome->expected_outcome }}</td>
  52. <td contenteditable="true" class="activation-date col-md-2" >{{ $outcome->activation_date }}</td>
  53. <td contenteditable="true" class="deactivation-date col-md-2" >{{ $outcome->deactivation_date }}</td>
  54. <td contenteditable="true" class="level col-md-1" >{{ $outcome->level }}</td>
  55. </tr>
  56. @endif
  57. {{-- @endforeach --}}
  58. @endforeach
  59. </tbody>
  60. </table>
  61. </div>
  62. </div>
  63. <div class="row">
  64. <div class="col-md-6"><button class="btn btn-lg btn-secondary center-block" id='show'>New Outcome</button></div>
  65. <div class="col-md-6"><button class="btn btn-lg btn-primary center-block" id='save'>Save</button></div>
  66. </div>
  67. <div class="" id='new_outcome_form'>
  68. <h2>Add a new Learning Outcomes</h2>
  69. {{-- For for adding a new outcome --}}
  70. {{ Form::open(array('action' => 'OutcomesController@create')) }}
  71. <div class="form-group">
  72. {{ Form::label('name', 'Name') }}
  73. {{ Form::text('name', '', array('class' => 'form-control', 'id'=>'outcome_name')) }}
  74. </div>
  75. <div class="form-group">
  76. {{ Form::label('definition', 'Definition') }}
  77. {{ Form::textarea('definition', 'At least 10 characters long', array('class' => 'form-control', 'id'=>'outcome_definition')) }}
  78. </div>
  79. Due to technical limitationss, the following must be edited after adding the new Outcome:
  80. {{-- the technical limitation is: the Outcome Model has to be edited --}}
  81. <ul>
  82. <li>Expected Outcome</li>
  83. <li>Activation Date</li>
  84. <li>Deactivation Date</li>
  85. <li>Level</li>
  86. </ul>
  87. <div class="row">
  88. <div class="col-md-6"><button type="reset" class="btn btn-lg btn-secondary center-block" id='hide'>Hide Form</button></div>
  89. <div class="col-md-6"><button type="submit" class="btn btn-lg btn-primary center-block">Submit New Outcome</button></div>
  90. </div>
  91. {{ Form::close() }}
  92. <hr>
  93. </div>
  94. @stop
  95. @section('javascript')
  96. $('#new_outcome_form').hide();
  97. //show form
  98. $('#show').on('click', function(e)
  99. {
  100. $('#new_outcome_form').show();
  101. $('#show').hide();
  102. });
  103. //hide form
  104. $('#hide').on('click', function(e)
  105. {
  106. $('#new_outcome_form').hide();
  107. $('#show').show();
  108. });
  109. $('#save').on('click', function(e)
  110. {
  111. e.preventDefault();
  112. var outcomeArray= new Array();
  113. // For each learning outcome, get its value and put it into an array
  114. $('tbody tr').each(function( index )
  115. {
  116. var outcomeObject = new Object();
  117. outcomeObject.id= $(this).data('id');
  118. outcomeObject.name= $(this).children('.name').text();
  119. outcomeObject.definition= $(this).children('.definition').text();
  120. outcomeObject.expected_outcome= $(this).children('.expected-outcome').text();
  121. outcomeObject.activation_date= $(this).children('.activation-date').text();
  122. outcomeObject.deactivation_date= $(this).children('.deactivation-date').text();
  123. outcomeObject.level= $(this).children('.level').text();
  124. if($(this).find('.glyphicon-eye-close').length>0)
  125. {
  126. outcomeObject.delete=1;
  127. }
  128. else
  129. outcomeObject.delete=0;
  130. var clone = jQuery.extend({}, outcomeObject);
  131. outcomeArray.push(clone);
  132. });
  133. $.post(
  134. "{{ URL::action('OutcomesController@updateMore') }}",
  135. { outcomeArray: JSON.stringify(outcomeArray)},
  136. function(data)
  137. {
  138. location.reload();
  139. }
  140. );
  141. });
  142. $('span').on('click', function()
  143. {
  144. if($(this).hasClass('glyphicon-eye-open'))
  145. $(this).removeClass('glyphicon-eye-open').addClass('glyphicon-eye-close');
  146. else
  147. $(this).removeClass('glyphicon-eye-close').addClass('glyphicon-eye-open');
  148. });
  149. @stop