설명 없음

learning-outcomes-criteria.blade.php 13KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404
  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-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(array('action' => 'OutcomesController@create')) }}
  22. <div class="form-group">
  23. {{ Form::label('name', 'Name') }}
  24. {{ Form::text('name', '', array('class' => 'form-control')) }}
  25. </div>
  26. <div class="form-group">
  27. {{ Form::label('definition', 'Definition') }}
  28. {{ Form::textarea('definition', '', array('class' => 'form-control', 'rows'=>2)) }}
  29. </div>
  30. {{ Form::submit('Submit', array('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(array('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', '', array('class' => 'form-control')) }}
  52. </div>
  53. <div class="form-group">
  54. {{ Form::label('description12', 'Beginning (1-2)') }}
  55. {{ Form::textarea('description12', '', array('class' => 'form-control', 'rows'=>2)) }}
  56. </div>
  57. <div class="form-group">
  58. {{ Form::label('description34', 'In Progress (3-4)') }}
  59. {{ Form::textarea('description34', '', array('class' => 'form-control', 'rows'=>2)) }}
  60. </div>
  61. <div class="form-group">
  62. {{ Form::label('description56', 'Satisfactory (5-6)') }}
  63. {{ Form::textarea('description56', '', array('class' => 'form-control', 'rows'=>2)) }}
  64. </div>
  65. <div class="form-group">
  66. {{ Form::label('description78', 'Excellent (7-8)') }}
  67. {{ Form::textarea('description78', '', array('class' => 'form-control', 'rows'=>2)) }}
  68. </div>
  69. {{ Form::submit('Create', array('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(array('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'), array('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'), array('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'), array('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'), array('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'), array('class' => 'form-control', 'rows'=>2, 'id'=>'criterion_description78')) }}
  114. </div>
  115. {{ Form::submit('Update', array('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(array('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 }}">{{ $criterion->name }}</option>
  132. @endforeach
  133. </select>
  134. </div>
  135. <div class="form-group">
  136. {{ Form::label('status', 'Status') }}
  137. <p name="status" id="status" class="form-control-static"></p>
  138. </div>
  139. {{ Form::submit('Change', array('class' => 'btn btn-primary btn-block')) }}
  140. {{ Form::close() }}
  141. </div>
  142. </div>
  143. <!-- Form to edit a Learning Outcome -->
  144. <!-- <div class="panel panel-default">
  145. <div class="panel-heading">
  146. Edit a Learning Outcome
  147. </div>
  148. <div class="panel-body">
  149. {{ Form::open(array('action' => 'OutcomesController@update')) }}
  150. <div class="form-group">
  151. {{ Form::label('outcome_id', 'Learning Outcome') }}
  152. <select id="select-outcome" name="id" class="form-control">
  153. @foreach ($outcomes as $outcome)
  154. <option value="{{ $outcome->id }}">{{ $outcome->name }}</option>
  155. @endforeach
  156. </select>
  157. </div>
  158. <div class="form-group">
  159. {{ Form::label('name', 'Name') }}
  160. {{ Form::text('name', Input::old('name'), array('class' => 'form-control', 'id'=>'outcome_name')) }}
  161. </div>
  162. <div class="form-group">
  163. {{ Form::label('definition', 'Definition') }}
  164. {{ Form::textarea('definition', Input::old('definition'), array('class' => 'form-control', 'rows'=>2, 'id'=>'outcome_definition')) }}
  165. </div>
  166. {{ Form::submit('Update', array('class' => 'btn btn-primary btn-block')) }}
  167. {{ Form::close() }}
  168. </div>
  169. </div> -->
  170. </div>
  171. <ul class="list-group">
  172. @foreach ($outcomes as $outcome)
  173. <li data-outcome-id="{{ $outcome->id }}"class="list-group-item">{{ $outcome->name }}</li>
  174. @endforeach
  175. </ul>
  176. </div>
  177. <div class="col-md-9">
  178. <div id="outcome-display" class="panel panel-default">
  179. <div class="panel-heading">
  180. <div class="panel-title"></div>
  181. </h4>
  182. </div>
  183. <div class="panel-body">
  184. <p class="outcome-definition"></p>
  185. <table class="table table-striped table-condensed">
  186. <thead><tr><th>Criterion</th><th>Beginning (1-2)</th><th>In Progress (3-4)</th><th>Satisfactory (5-6)</th><th>Excellent (7-8)</th></tr></thead>
  187. <tbody>
  188. </tbody>
  189. </table>
  190. </div>
  191. </div>
  192. </div>
  193. <div class="col-md-9">
  194. <div class="no-outcome alert alert-info">
  195. <p>Select a Learning Outcome to view its criteria.</p>
  196. </div>
  197. </div>
  198. </div>
  199. @stop
  200. @section('javascript')
  201. // --------------------------------------------------------------------------
  202. // Page load
  203. // --------------------------------------------------------------------------
  204. // Hide accordion panel contents by default
  205. $('.panel-group .panel-body').hide();
  206. $('#outcome-display').parent().hide();
  207. fetchOutcomeForEditing();
  208. fetchCriterionForEditing();
  209. setCriterionStatus();
  210. // --------------------------------------------------------------------------
  211. // Functions
  212. // --------------------------------------------------------------------------
  213. // Fetch outcome info for editing
  214. function fetchOutcomeForEditing()
  215. {
  216. var id = $('#select-outcome').find(':selected').val();
  217. $.post(
  218. "{{ URL::action('OutcomesController@fetchOutcome') }}",
  219. { id: id },
  220. function(json)
  221. {
  222. var name = json.outcome.name;
  223. var definition = json.outcome.definition;
  224. //Display title and definition
  225. $('#outcome_name').val(name);
  226. $('#outcome_definition').text(definition);
  227. },
  228. 'json'
  229. );
  230. }
  231. // Fetch criterion info for editing
  232. function fetchCriterionForEditing()
  233. {
  234. var id = $('#select-criterion').find(':selected').val();
  235. $.post(
  236. "{{ URL::action('CriteriaController@fetchCriterionWithTrashed') }}",
  237. { id: id },
  238. function(json)
  239. {
  240. var name = json.name;
  241. var description12 = json.description12;
  242. var description34 = json.description34;
  243. var description56 = json.description56;
  244. var description78 = json.description78;
  245. // Display title and definition
  246. $('#criterion_name').val(name);
  247. $('#criterion_description12').text(description12);
  248. $('#criterion_description34').text(description34);
  249. $('#criterion_description56').text(description56);
  250. $('#criterion_description78').text(description78);
  251. // Select associated outcome
  252. $('#assoc_outcome_id').val(json.outcome_id);
  253. },
  254. 'json'
  255. );
  256. }
  257. // Set criterion status
  258. function setCriterionStatus()
  259. {
  260. $('#select-criterion-with-status').find(':selected').data('status')
  261. switch($('#select-criterion-with-status').find(':selected').data('status'))
  262. {
  263. case 1:
  264. $('#status').text('Inactive');
  265. break;
  266. default:
  267. $('#status').text('Active');
  268. break;
  269. }
  270. }
  271. // --------------------------------------------------------------------------
  272. // Events
  273. // --------------------------------------------------------------------------
  274. // When panel heading is clicked, toggle it
  275. $('.panel-group .panel-heading').on('click', function()
  276. {
  277. $(this).next().stop().slideToggle();
  278. })
  279. // When list item is clicked, load corresponding info
  280. $('.list-group-item').on('click', function()
  281. {
  282. var id = $(this).data('outcome-id');
  283. $.post(
  284. "{{ URL::action('OutcomesController@fetchOutcome') }}",
  285. { id: id },
  286. function(json)
  287. {
  288. var name = json.outcome.name;
  289. var definition = json.outcome.definition;
  290. var criteria =json.outcome.criteria;
  291. var deleted = json.outcome.deleted_at;
  292. $('#outcome-display').parent().show();
  293. $('.no-outcome').parent().hide();
  294. //Display title and definition
  295. $('#outcome-display .panel-title').html(name);
  296. $('#outcome-display .outcome-definition').html(definition);
  297. //Empty table body
  298. $('tbody').empty();
  299. if(criteria.length>0)
  300. {
  301. $('table').show();
  302. $.each(criteria, function(index, value)
  303. {
  304. $('tbody').append('<tr><td >'+value.name+'</td><td >'+value.description12+'</td><td >'+value.description34+'</td><td >'+value.description56+'</td><td >'+value.description78+'</td></tr>');
  305. });
  306. }
  307. else
  308. {
  309. $('table').hide();
  310. }
  311. },
  312. 'json'
  313. );
  314. });
  315. // When list item is clicked, load corresponding info
  316. $('#select-outcome').on('change', function()
  317. {
  318. fetchOutcomeForEditing();
  319. });
  320. // When list item is clicked, load corresponding info
  321. $('#select-criterion').on('change', function()
  322. {
  323. fetchCriterionForEditing();
  324. });
  325. // When list item is clicked, load corresponding info
  326. $('#select-criterion-with-status').on('change', function()
  327. {
  328. setCriterionStatus();
  329. });
  330. @stop