No Description

edit_objectives_FOR_DELETION.blade.php 9.0KB

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