暂无描述

learning-outcomes-criteria.blade.php 15KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419
  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-3">
  14. <div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true">
  15. <!-- Form to add a new Learning Outcome -->
  16. <!-- <div class="panel panel-default">
  17. <div class="panel-heading">
  18. New Learning Outcome
  19. </div>
  20. <div class="panel-body">
  21. {{ Form::open(['action' => 'OutcomesController@create']) }}
  22. <div class="form-group">
  23. {{ Form::label('name', 'Name') }}
  24. {{ Form::text('name', '', ['class' => 'form-control']) }}
  25. </div>
  26. <div class="form-group">
  27. {{ Form::label('definition', 'Definition') }}
  28. {{ Form::textarea('definition', '', ['class' => 'form-control', 'rows' => 2]) }}
  29. </div>
  30. {{ Form::submit('Submit', ['class' => 'btn btn-primary btn-block']) }}
  31. {{ Form::close() }}
  32. </div>
  33. </div> -->
  34. <!-- Form to add a new criterion -->
  35. <div class="panel panel-default panel-button">
  36. <div class="panel-heading">
  37. Create
  38. </div>
  39. <div class="panel-body">
  40. {{ Form::open(['action' => 'CriteriaController@create']) }}
  41. <div class="form-group">
  42. {{ Form::label('outcome_id', 'Associated Learning Outcome') }}
  43. <select name="outcome_id" class="form-control">
  44. @foreach ($outcomes as $outcome)
  45. <option value="{{ $outcome->id }}">{{ $outcome->name }}</option>
  46. @endforeach
  47. </select>
  48. </div>
  49. <div class="form-group">
  50. {{ Form::label('name', 'Name') }}
  51. {{ Form::text('name', '', ['class' => 'form-control']) }}
  52. </div>
  53. <div class="form-group">
  54. {{ Form::label('description12', 'Beginning (1-2)') }}
  55. {{ Form::textarea('description12', '', ['class' => 'form-control', 'rows' => 2]) }}
  56. </div>
  57. <div class="form-group">
  58. {{ Form::label('description34', 'In Progress (3-4)') }}
  59. {{ Form::textarea('description34', '', ['class' => 'form-control', 'rows' => 2]) }}
  60. </div>
  61. <div class="form-group">
  62. {{ Form::label('description56', 'Satisfactory (5-6)') }}
  63. {{ Form::textarea('description56', '', ['class' => 'form-control', 'rows' => 2]) }}
  64. </div>
  65. <div class="form-group">
  66. {{ Form::label('description78', 'Excellent (7-8)') }}
  67. {{ Form::textarea('description78', '', ['class' => 'form-control', 'rows' => 2]) }}
  68. </div>
  69. {{ Form::submit('Create', ['class' => 'btn btn-primary btn-block']) }}
  70. {{ Form::close() }}
  71. </div>
  72. </div>
  73. <div class="panel panel-default panel-button">
  74. <div class="panel-heading">
  75. Edit
  76. </div>
  77. <div class="panel-body">
  78. {{ Form::open(['action' => 'CriteriaController@update']) }}
  79. <div class="form-group">
  80. {{ Form::label('criterion_id', 'Criterion') }}
  81. <select id="select-criterion" name="id" class="form-control">
  82. @foreach ($criteria as $criterion)
  83. <option value="{{ $criterion->id }}">{{ $criterion->name }}</option>
  84. @endforeach
  85. </select>
  86. </div>
  87. <div class="form-group">
  88. {{ Form::label('assoc_outcome_id', 'Associated Learning Outcome') }}
  89. <select id="assoc_outcome_id" name="outcome_id" class="form-control">
  90. @foreach ($outcomes as $outcome)
  91. <option value="{{ $outcome->id }}">{{ $outcome->name }}</option>
  92. @endforeach
  93. </select>
  94. </div>
  95. <div class="form-group">
  96. {{ Form::label('name', 'Name') }}
  97. {{ Form::text('name', Input::old('name'), ['class' => 'form-control', 'id' => 'criterion_name']) }}
  98. </div>
  99. <div class="form-group">
  100. {{ Form::label('description12', 'Beginning (1-2)') }}
  101. {{ Form::textarea('description12', Input::old('description12'), ['class' => 'form-control', 'rows' => 2, 'id' => 'criterion_description12']) }}
  102. </div>
  103. <div class="form-group">
  104. {{ Form::label('description34', 'In Progress (3-4)') }}
  105. {{ Form::textarea('description34', Input::old('description34'), ['class' => 'form-control', 'rows' => 2, 'id' => 'criterion_description34']) }}
  106. </div>
  107. <div class="form-group">
  108. {{ Form::label('description56', 'Satisfactory (5-6)') }}
  109. {{ Form::textarea('description56', Input::old('description56'), ['class' => 'form-control', 'rows' => 2, 'id' => 'criterion_description56']) }}
  110. </div>
  111. <div class="form-group">
  112. {{ Form::label('description78', 'Excellent (7-8)') }}
  113. {{ Form::textarea('description78', Input::old('description78'), ['class' => 'form-control', 'rows' => 2, 'id' => 'criterion_description78']) }}
  114. </div>
  115. {{ Form::submit('Update', ['class' => 'btn btn-primary btn-block']) }}
  116. {{ Form::close() }}
  117. </div>
  118. </div>
  119. <div class="panel panel-default panel-button">
  120. <div class="panel-heading">
  121. Change Status
  122. </div>
  123. <div class="panel-body">
  124. <p>Use this form to deactivate or reactivate criteria. Inactive criteria will
  125. stay in the system, but will not be available to use in new rubrics.</p>
  126. {{ Form::open(['action' => 'CriteriaController@destroy', 'method' => 'delete']) }}
  127. <div class="form-group">
  128. {{ Form::label('criterion_id', 'Criterion') }}
  129. <select id="select-criterion-with-status" name="id" class="form-control">
  130. @foreach ($criteria as $criterion)
  131. <option data-status="{{ $criterion->trashed() }}" value="{{ $criterion->id }}">
  132. {{ $criterion->name }}</option>
  133. @endforeach
  134. </select>
  135. </div>
  136. <div class="form-group">
  137. {{ Form::label('status', 'Status') }}
  138. <p name="status" id="status" class="form-control-static"></p>
  139. </div>
  140. {{ Form::submit('Change', ['class' => 'btn btn-primary btn-block']) }}
  141. {{ Form::close() }}
  142. </div>
  143. </div>
  144. <!-- Form to edit a Learning Outcome -->
  145. <!-- <div class="panel panel-default">
  146. <div class="panel-heading">
  147. Edit a Learning Outcome
  148. </div>
  149. <div class="panel-body">
  150. {{ Form::open(['action' => 'OutcomesController@update']) }}
  151. <div class="form-group">
  152. {{ Form::label('outcome_id', 'Learning Outcome') }}
  153. <select id="select-outcome" name="id" class="form-control">
  154. @foreach ($outcomes as $outcome)
  155. <option value="{{ $outcome->id }}">{{ $outcome->name }}</option>
  156. @endforeach
  157. </select>
  158. </div>
  159. <div class="form-group">
  160. {{ Form::label('name', 'Name') }}
  161. {{ Form::text('name', Input::old('name'), ['class' => 'form-control', 'id' => 'outcome_name']) }}
  162. </div>
  163. <div class="form-group">
  164. {{ Form::label('definition', 'Definition') }}
  165. {{ Form::textarea('definition', Input::old('definition'), ['class' => 'form-control', 'rows' => 2, 'id' => 'outcome_definition']) }}
  166. </div>
  167. {{ Form::submit('Update', ['class' => 'btn btn-primary btn-block']) }}
  168. {{ Form::close() }}
  169. </div>
  170. </div> -->
  171. </div>
  172. <ul class="list-group">
  173. @foreach ($outcomes as $outcome)
  174. <li data-outcome-id="{{ $outcome->id }}" class="list-group-item">{{ $outcome->name }}</li>
  175. @endforeach
  176. </ul>
  177. </div>
  178. <div class="col-md-9">
  179. <div id="outcome-display" class="panel panel-default">
  180. <div class="panel-heading">
  181. <div class="panel-title"></div>
  182. </h4>
  183. </div>
  184. <div class="panel-body">
  185. <p class="outcome-definition"></p>
  186. <table class="table table-striped table-condensed">
  187. <thead>
  188. <tr>
  189. <th>Criterion</th>
  190. <th>Beginning (1-2)</th>
  191. <th>In Progress (3-4)</th>
  192. <th>Satisfactory (5-6)</th>
  193. <th>Excellent (7-8)</th>
  194. </tr>
  195. </thead>
  196. <tbody>
  197. </tbody>
  198. </table>
  199. </div>
  200. </div>
  201. </div>
  202. <div class="col-md-9">
  203. <div class="no-outcome alert alert-info">
  204. <p>Select a Learning Outcome to view its criteria.</p>
  205. </div>
  206. </div>
  207. </div>
  208. @stop
  209. @section('javascript')
  210. // --------------------------------------------------------------------------
  211. // Page load
  212. // --------------------------------------------------------------------------
  213. // Hide accordion panel contents by default
  214. $('.panel-group .panel-body').hide();
  215. $('#outcome-display').parent().hide();
  216. fetchOutcomeForEditing();
  217. fetchCriterionForEditing();
  218. setCriterionStatus();
  219. // --------------------------------------------------------------------------
  220. // Functions
  221. // --------------------------------------------------------------------------
  222. // Fetch outcome info for editing
  223. function fetchOutcomeForEditing()
  224. {
  225. var id = $('#select-outcome').find(':selected').val();
  226. $.post(
  227. "{{ URL::action('OutcomesController@fetchOutcome') }}",
  228. { id: id },
  229. function(json)
  230. {
  231. var name = json.outcome.name;
  232. var definition = json.outcome.definition;
  233. //Display title and definition
  234. $('#outcome_name').val(name);
  235. $('#outcome_definition').text(definition);
  236. },
  237. 'json'
  238. );
  239. }
  240. // Fetch criterion info for editing
  241. function fetchCriterionForEditing()
  242. {
  243. var id = $('#select-criterion').find(':selected').val();
  244. $.post(
  245. "{{ URL::action('CriteriaController@fetchCriterionWithTrashed') }}",
  246. { id: id },
  247. function(json)
  248. {
  249. var name = json.name;
  250. var description12 = json.description12;
  251. var description34 = json.description34;
  252. var description56 = json.description56;
  253. var description78 = json.description78;
  254. // Display title and definition
  255. $('#criterion_name').val(name);
  256. $('#criterion_description12').text(description12);
  257. $('#criterion_description34').text(description34);
  258. $('#criterion_description56').text(description56);
  259. $('#criterion_description78').text(description78);
  260. // Select associated outcome
  261. $('#assoc_outcome_id').val(json.outcome_id);
  262. },
  263. 'json'
  264. );
  265. }
  266. // Set criterion status
  267. function setCriterionStatus()
  268. {
  269. $('#select-criterion-with-status').find(':selected').data('status')
  270. switch($('#select-criterion-with-status').find(':selected').data('status'))
  271. {
  272. case 1:
  273. $('#status').text('Inactive');
  274. break;
  275. default:
  276. $('#status').text('Active');
  277. break;
  278. }
  279. }
  280. // --------------------------------------------------------------------------
  281. // Events
  282. // --------------------------------------------------------------------------
  283. // When panel heading is clicked, toggle it
  284. $('.panel-group .panel-heading').on('click', function()
  285. {
  286. $(this).next().stop().slideToggle();
  287. })
  288. // When list item is clicked, load corresponding info
  289. $('.list-group-item').on('click', function()
  290. {
  291. var id = $(this).data('outcome-id');
  292. $.post(
  293. "{{ URL::action('OutcomesController@fetchOutcome') }}",
  294. { id: id },
  295. function(json)
  296. {
  297. var name = json.outcome.name;
  298. var definition = json.outcome.definition;
  299. var criteria =json.outcome.criteria;
  300. var deleted = json.outcome.deleted_at;
  301. $('#outcome-display').parent().show();
  302. $('.no-outcome').parent().hide();
  303. //Display title and definition
  304. $('#outcome-display .panel-title').html(name);
  305. $('#outcome-display .outcome-definition').html(definition);
  306. //Empty table body
  307. $('tbody').empty();
  308. if(criteria.length>0)
  309. {
  310. $('table').show();
  311. $.each(criteria, function(index, value)
  312. {
  313. $('tbody').append('<tr>
  314. <td>'+value.name+'</td>
  315. <td>'+value.description12+'</td>
  316. <td>'+value.description34+'</td>
  317. <td>'+value.description56+'</td>
  318. <td>'+value.description78+'</td>
  319. </tr>');
  320. });
  321. }
  322. else
  323. {
  324. $('table').hide();
  325. }
  326. },
  327. 'json'
  328. );
  329. });
  330. // When list item is clicked, load corresponding info
  331. $('#select-outcome').on('change', function()
  332. {
  333. fetchOutcomeForEditing();
  334. });
  335. // When list item is clicked, load corresponding info
  336. $('#select-criterion').on('change', function()
  337. {
  338. fetchCriterionForEditing();
  339. });
  340. // When list item is clicked, load corresponding info
  341. $('#select-criterion-with-status').on('change', function()
  342. {
  343. setCriterionStatus();
  344. });
  345. @stop