Aucune description

criteria.blade.php 15KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320
  1. @extends('layouts.master')
  2. @section('navigation')
  3. @include('local.managers.admins._navigation')
  4. @stop
  5. @section('main')
  6. <div class="row">
  7. <div class="col-md-6">
  8. <!-- Form to add a new criterion -->
  9. <div class="panel panel-default panel-button">
  10. <div class="panel-heading">
  11. Create
  12. </div>
  13. <div class="panel-body">
  14. {{ Form::open(array('action' => 'CriteriaController@create')) }}
  15. <div class="form-group">
  16. {{ Form::label('outcome_id', 'Associated Learning Outcome') }}
  17. <select name="outcome_id" class="form-control selectpicker">
  18. @foreach ($outcomes as $outcome)
  19. @if(Input::old('outcome_id')==$outcome->id)
  20. <option selected="selected" value="{{ $outcome->id }}">{{ $outcome->name }}</option>
  21. @else
  22. <option value="{{ $outcome->id }}">{{ $outcome->name }}</option>
  23. @endif
  24. @endforeach
  25. </select>
  26. </div>
  27. <!-- Associated Program -->
  28. <div class="form-group">
  29. {{ Form::label('program_id', 'Associated Program') }}
  30. <select id="program_id" name="program_id" class="form-control selectpicker">
  31. <option value="0">All</option>
  32. @foreach ($programs as $program)
  33. <option value="{{ $program->id }}">{{ $program->name }} [{{ $program->school->name }}]</option>
  34. @endforeach
  35. </select>
  36. </div>
  37. <div class="form-group">
  38. {{ Form::label('name', 'Name') }}
  39. {{ Form::text('name', '', array('class' => 'form-control')) }}
  40. </div>
  41. <div class="form-group">
  42. {{ Form::label('subcriteria', 'Subcriteria') }}
  43. <p class="help-block"><strong>Manually add</strong> bullets or numbering.</p>
  44. {{ Form::textarea('subcriteria', '', array('class' => 'form-control', 'rows'=>3, 'aria-labelledby'=>'subcriteria')) }}
  45. </div>
  46. <div class="form-group">
  47. {{ Form::label('description12', 'Beginning (1-2)') }}
  48. {{ Form::textarea('description12', '', array('class' => 'form-control', 'rows'=>2, 'aria-labelledby'=>'description12')) }}
  49. </div>
  50. <div class="form-group">
  51. {{ Form::label('description34', 'In Progress (3-4)') }}
  52. {{ Form::textarea('description34', '', array('class' => 'form-control', 'rows'=>2, 'aria-labelledby'=>'description34')) }}
  53. </div>
  54. <div class="form-group">
  55. {{ Form::label('description56', 'Satisfactory (5-6)') }}
  56. {{ Form::textarea('description56', '', array('class' => 'form-control', 'rows'=>2, 'aria-labelledby'=>'description56')) }}
  57. </div>
  58. <div class="form-group">
  59. {{ Form::label('description78', 'Excellent (7-8)') }}
  60. {{ Form::textarea('description78', '', array('class' => 'form-control', 'rows'=>2, 'aria-labelledby'=>'description78')) }}
  61. </div>
  62. <div class="form-group">
  63. {{ Form::label('copyright', 'Copyright') }}
  64. {{ Form::textarea('copyright', '', array('class' => 'form-control', 'rows'=>2, 'placeholder'=>'(optional)', 'aria-labelledby'=>'copyright')) }}
  65. </div>
  66. <div class="form-group">
  67. {{ Form::label('notes', 'Notes') }}
  68. {{ Form::textarea('notes', '', array('class' => 'form-control', 'rows'=>2, 'placeholder'=>'(optional)', 'aria-labelledby'=>'notes')) }}
  69. </div>
  70. {{ Form::submit('Create', array('class' => 'btn btn-primary btn-block')) }}
  71. {{ Form::close() }}
  72. </div>
  73. </div>
  74. </div>
  75. <div class="col-md-6">
  76. <div class="panel panel-default panel-button">
  77. <div class="panel-heading">
  78. Edit
  79. </div>
  80. <div class="panel-body">
  81. {{ Form::open(array('action' => 'CriteriaController@update')) }}
  82. <div class="form-group">
  83. {{ Form::label('criterion_id', 'Criterion') }}
  84. <select id="select-criterion" name="id" class="form-control selectpicker">
  85. @foreach ($criteria as $criterion)
  86. <option value="{{ $criterion->id }}"
  87. data-subtext="
  88. @if($criterion->program)
  89. &nbsp;&nbsp;&nbsp;[{{ $criterion->program->name }}]
  90. @endif
  91. "
  92. >
  93. {{ $criterion->name }}
  94. </option>
  95. @endforeach
  96. </select>
  97. </div>
  98. <!-- Associated Outcome -->
  99. <div class="form-group">
  100. {{ Form::label('assoc_outcome_id', 'Associated Learning Outcome') }}
  101. <select id="assoc_outcome_id" name="outcome_id" class="form-control selectpicker">
  102. @foreach ($outcomes as $outcome)
  103. <option value="{{ $outcome->id }}">{{ $outcome->name }}</option>
  104. @endforeach
  105. </select>
  106. </div>
  107. <!-- Associated Program -->
  108. <div class="form-group">
  109. {{ Form::label('program_id2', 'Associated Program') }}
  110. <select id="program_id2" name="program_id" class="form-control selectpicker">
  111. <option value="0">All</option>
  112. @foreach ($programs as $program)
  113. <option value="{{ $program->id }}">{{ $program->name }} [{{ $program->school->name }}]</option>
  114. @endforeach
  115. </select>
  116. </div>
  117. <!-- Status -->
  118. <div class="form-group">
  119. {{ Form::label('status', 'Status') }}
  120. <span data-toggle="tooltip" data-placement="top" title="Use this option to deactivate or reactivate criteria. Inactive criteria will stay in the system, but will not be available to use in new rubrics." class="glyphicon glyphicon-question-sign"></span>
  121. <select id="status" name="status" class="form-control">
  122. <option value="1">Active</option>
  123. <option value="0">Inactive</option>
  124. </select>
  125. </div>
  126. <div class="form-group">
  127. {{ Form::label('name', 'Name') }}
  128. {{ Form::text('name', Input::old('name'), array('class' => 'form-control', 'id'=>'criterion_name')) }}
  129. </div>
  130. <div class="form-group">
  131. {{ Form::label('subcriteria', 'Subcriteria') }}
  132. <p class="help-block"><strong>Manually add</strong> bullets or numbering.</p>
  133. {{ Form::textarea('subcriteria', '', array('class' => 'form-control', 'rows'=>3, 'id' => 'criterion_subcriteria')) }}
  134. </div>
  135. <div class="form-group">
  136. {{ Form::label('description12', 'Beginning (1-2)') }}
  137. {{ Form::textarea('description12', Input::old('description12'), array('class' => 'form-control', 'rows'=>2, 'id'=>'criterion_description12')) }}
  138. </div>
  139. <div class="form-group">
  140. {{ Form::label('description34', 'In Progress (3-4)') }}
  141. {{ Form::textarea('description34', Input::old('description34'), array('class' => 'form-control', 'rows'=>2, 'id'=>'criterion_description34')) }}
  142. </div>
  143. <div class="form-group">
  144. {{ Form::label('description56', 'Satisfactory (5-6)') }}
  145. {{ Form::textarea('description56', Input::old('description56'), array('class' => 'form-control', 'rows'=>2, 'id'=>'criterion_description56')) }}
  146. </div>
  147. <div class="form-group">
  148. {{ Form::label('description78', 'Excellent (7-8)') }}
  149. {{ Form::textarea('description78', Input::old('description78'), array('class' => 'form-control', 'rows'=>2, 'id'=>'criterion_description78')) }}
  150. </div>
  151. <div class="form-group">
  152. {{ Form::label('copyright', 'Copyright Information') }}
  153. {{ Form::textarea('copyright', Input::old('copyright'), array('class' => 'form-control', 'rows'=>2, 'id'=>'criterion_copyright', 'placeholder'=>'(optional)')) }}
  154. </div>
  155. <div class="form-group">
  156. {{ Form::label('notes', 'Additional Notes') }}
  157. {{ Form::textarea('notes', Input::old('notes'), array('class' => 'form-control', 'rows'=>2, 'id'=>'criterion_notes', 'placeholder'=>'(optional)')) }}
  158. </div>
  159. {{ Form::submit('Update', array('class' => 'btn btn-primary btn-block')) }}
  160. {{ Form::close() }}
  161. </div>
  162. </div>
  163. </div>
  164. </div>
  165. @stop
  166. @section('javascript')
  167. // --------------------------------------------------------------------------
  168. // Page load
  169. // --------------------------------------------------------------------------
  170. // Hide accordion panel contents by default
  171. $('.panel-group .panel-body').hide();
  172. $('#outcome-display').parent().hide();
  173. fetchCriterionForEditing();
  174. // setCriterionStatus();
  175. // --------------------------------------------------------------------------
  176. // Functions
  177. // --------------------------------------------------------------------------
  178. // Fetch criterion info for editing
  179. function fetchCriterionForEditing()
  180. {
  181. var id = $('#select-criterion').find(':selected').val();
  182. $.post(
  183. "{{ URL::action('CriteriaController@fetchCriterionWithTrashed') }}",
  184. { id: id },
  185. function(json)
  186. {
  187. var name = json.name;
  188. var subcriteria = '';
  189. if(json.subcriteria){
  190. subcriteria= JSON.parse(json.subcriteria).join('\n');
  191. }
  192. var description12 = json.description12;
  193. var description34 = json.description34;
  194. var description56 = json.description56;
  195. var description78 = json.description78;
  196. var copyright = json.copyright;
  197. var notes = json.notes;
  198. // Display info
  199. $('#criterion_name').val(name);
  200. $('#criterion_subcriteria').text(subcriteria);
  201. $('#criterion_description12').text(description12);
  202. $('#criterion_description34').text(description34);
  203. $('#criterion_description56').text(description56);
  204. $('#criterion_description78').text(description78);
  205. // If copyright or notes aren't empty, load them
  206. if(copyright){
  207. $('#criterion_copyright').text(copyright);
  208. }else{
  209. $('#criterion_copyright').text('');
  210. }
  211. if(notes){
  212. $('#criterion_notes').text(notes);
  213. }else{
  214. $('#criterion_notes').text('');
  215. }
  216. // Select associated outcome
  217. $('#assoc_outcome_id').val(json.outcome_id);
  218. $('#assoc_outcome_id').selectpicker('refresh');
  219. // Select associated program
  220. if(json.program_id)
  221. {
  222. $('#program_id2').val(json.program_id);
  223. }
  224. else
  225. {
  226. $('#program_id2').val(0);
  227. }
  228. $('#program_id2').selectpicker('refresh');
  229. // Select status
  230. if(json.deleted_at)
  231. $('#status').val(0);
  232. else
  233. $('#status').val(1);
  234. },
  235. 'json'
  236. );
  237. }
  238. // --------------------------------------------------------------------------
  239. // Events
  240. // --------------------------------------------------------------------------
  241. // When panel heading is clicked, toggle it
  242. $('.panel-group .panel-heading').on('click', function()
  243. {
  244. $(this).next().stop().slideToggle();
  245. })
  246. // When list item is clicked, load corresponding info
  247. $('#select-criterion').on('change', function()
  248. {
  249. fetchCriterionForEditing();
  250. $('.selectpicker').selectpicker('refresh');
  251. });
  252. // When list item is clicked, load corresponding info
  253. $('.selectpicker').on('change', function()
  254. {
  255. //alert($(this).find(':selected').val());
  256. $('.selectpicker').selectpicker('refresh');
  257. });
  258. @stop