Sin descripción

edit_objectives_FOR_DELETION.blade.php 8.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  1. @extends('layouts.master')
  2. @section('navigation')
  3. @if($role==1)
  4. @include('local.managers.admins._navigation')
  5. @elseif($role==2)
  6. @include('local.managers.sCoords._navigation')
  7. @elseif($role==3)
  8. @include('local.managers.pCoords._navigation')
  9. @else
  10. @include('local.professors._navigation')
  11. @endif
  12. @stop
  13. @section('main')
  14. <div class="row">
  15. <div class="col-md-9">
  16. <p class="lead">You should establish at least one objective per Learning Outcome. Inactive objectives will not be available to new rubrics, but the criteria already associated to them will remain unaffected.</p>
  17. <table class="table table-bordered">
  18. <thead>
  19. <tr>
  20. <th class="col-md-6">Learning Outcome</th>
  21. <th class="col-md-6">Objectives</th>
  22. </tr>
  23. </thead>
  24. <tbody>
  25. @foreach($objectives_by_outcome as $outcome)
  26. <?php $first_objective = true; ?>
  27. <?php
  28. // $criteria = DB::table('criterion_objective_program')
  29. // ->where('objective_id', $objective->objective_id)
  30. // ->where('criterion_objective_program.program_id', $program->id)
  31. // ->join('criteria', 'criterion_objective_program.criterion_id', '=', 'criteria.id')
  32. // ->get();
  33. ?>
  34. <tr>
  35. <td>{{ $outcome->outcome_name }} {{ json_encode($outcome) }}</td>
  36. </tr>
  37. @endforeach
  38. </tbody>
  39. </table>
  40. <a href="{{ action('ProgramsController@show', array($program->id)) }}" class="btn btn-primary pull-right"> Back to Program</a>
  41. </div>
  42. <div class="col-md-3">
  43. <br><br>
  44. <!-- Form to add a new objective -->
  45. <div class="panel panel-default panel-button">
  46. <div class="panel-heading">
  47. <span class="glyphicon glyphicon-triangle-right"></span>
  48. <strong>Create</strong>
  49. </div>
  50. <div class="panel-body">
  51. {{ Form::open(array('action' => 'ObjectivesController@create')) }}
  52. <p class="small">Write the name or description of the objective you want to create. Then, select the Learning Outcome to which it be associated. Finally, click Create.</p>
  53. {{ Form::hidden('program_id', $program->id) }}
  54. <div class="form-group">
  55. {{ Form::label('learning_objective', 'Objective') }}
  56. {{ Form::textarea('learning_objective', '', array('class' => 'form-control', 'rows'=>2)) }}
  57. </div>
  58. <div class="form-group">
  59. {{ Form::label('outcome_id', 'Select the Learning Outcome') }}
  60. <select name="outcome_id" class="form-control">
  61. @foreach ($outcomes as $outcome)
  62. @if(Input::old('outcome_id')==$outcome->id)
  63. <option selected="selected" value="{{ $outcome->id }}">{{ $outcome->name }}</option>
  64. @else
  65. <option value="{{ $outcome->id }}">{{ $outcome->name }}</option>
  66. @endif
  67. @endforeach
  68. </select>
  69. </div>
  70. {{ Form::submit('Create', array('class' => 'btn btn-primary btn-block')) }}
  71. {{ Form::close() }}
  72. </div>
  73. </div>
  74. <br>
  75. <!-- Form to add a new objective -->
  76. <div class="panel panel-default panel-button">
  77. <div class="panel-heading">
  78. <span class="glyphicon glyphicon-triangle-right"></span>
  79. <strong>Edit</strong>
  80. </div>
  81. <div class="panel-body">
  82. {{ Form::open(array('action' => 'ObjectivesController@update')) }}
  83. <p class="small">Select the objective you want to edit. Its information will be automatically loaded. You can change the name and select a different Learning Outcome if you wish. Click Update to save the changes.</p>
  84. {{ Form::hidden('edit_program_id', $program->id) }}
  85. <div class="form-group">
  86. {{ Form::label('edit_objective_id', 'Objective Selection') }}
  87. <select name="edit_objective_id" id="edit_objective_id" class="form-control">
  88. @foreach ($program->objectives() as $objective)
  89. @if(false)
  90. <option selected="selected" value="{{ $objective->objective_id }}">{{ $objective->objective }}</option>
  91. @else
  92. <option value="{{ $objective->objective_id }}">{{ $objective->objective }}</option>
  93. @endif
  94. @endforeach
  95. </select>
  96. </div>
  97. <div class="form-group">
  98. {{ Form::label('edit_learning_objective', 'Objective Name') }}
  99. {{ Form::textarea('edit_learning_objective', '', array('class' => 'form-control', 'rows'=>2)) }}
  100. </div>
  101. <div class="form-group">
  102. {{ Form::label('edit_outcome_id', 'Associated Learning Outcome') }}
  103. <select name="edit_outcome_id" id="edit_outcome_id" class="form-control">
  104. @foreach ($outcomes as $outcome)
  105. @if(Input::old('edit_outcome_id')==$outcome->id)
  106. <option selected="selected" value="{{ $outcome->id }}">{{ $outcome->name }}</option>
  107. @else
  108. <option value="{{ $outcome->id }}">{{ $outcome->name }}</option>
  109. @endif
  110. @endforeach
  111. </select>
  112. </div>
  113. <div class="form-group">
  114. {{ Form::label('edit_active', 'Status') }}
  115. <select name="edit_active" id="edit_active" class="form-control">
  116. <option value="1">Active</option>
  117. <option value="0">Inactive</option>
  118. </select>
  119. </div>
  120. {{ Form::submit('Update', array('class' => 'btn btn-primary btn-block')) }}
  121. {{ Form::close() }}
  122. </div>
  123. </div>
  124. </div>
  125. </div>
  126. @stop
  127. @section('javascript')
  128. // ----------------------------------------------------------------------------
  129. // Page Load
  130. // ----------------------------------------------------------------------------
  131. $('.panel-body').hide();
  132. loadObjective();
  133. // ----------------------------------------------------------------------------
  134. // Events
  135. // ----------------------------------------------------------------------------
  136. // Toggle visibility for accordion panels
  137. $('.panel-heading').on('click', function()
  138. {
  139. toggleTriangles($(this));
  140. $(this).siblings('.panel-body').stop().slideToggle();
  141. });
  142. $('#edit_objective_id').on('change', function()
  143. {
  144. loadObjective();
  145. });
  146. // ----------------------------------------------------------------------------
  147. // Functions
  148. // ----------------------------------------------------------------------------
  149. function toggleTriangles(element)
  150. {
  151. if(element.find('.glyphicon').hasClass('glyphicon-triangle-right'))
  152. {
  153. element.find('.glyphicon').removeClass('glyphicon-triangle-right');
  154. element.find('.glyphicon').addClass('glyphicon-triangle-bottom');
  155. }
  156. else if(element.find('.glyphicon').hasClass('glyphicon-triangle-bottom'))
  157. {
  158. element.find('.glyphicon').removeClass('glyphicon-triangle-bottom');
  159. element.find('.glyphicon').addClass('glyphicon-triangle-right');
  160. }
  161. }
  162. function loadObjective()
  163. {
  164. $.post(
  165. '{{ action('ObjectivesController@fetchObjective') }}',
  166. {
  167. objective_id: $('#edit_objective_id').find(':selected').val()
  168. },
  169. function(data)
  170. {
  171. if(data == '')
  172. return;
  173. objective = JSON.parse(data);
  174. $('#edit_learning_objective').text(objective.text);
  175. $('#edit_active').val(objective.active);
  176. $('#edit_outcome_id').val(objective.outcome_id);
  177. }
  178. )
  179. }
  180. @stop