No Description

criteria.blade.php 49KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304
  1. @extends('layouts.master')
  2. @section('navigation')
  3. @include('local.managers.pCoords._navigation')
  4. @stop
  5. @section('main')
  6. <div class="row">
  7. <div id = "alert_placeholder">
  8. </div>
  9. <div class="col-md-6">
  10. <!-- Form to add a new criterion -->
  11. <div class="panel panel-default panel-button">
  12. <div class="panel-heading">
  13. Create
  14. </div>
  15. <div class="panel-body">
  16. {{ Form::open(array('action' => 'CriteriaController@create', 'id'=> 'create_criterion')) }}
  17. <div id='allOutcomes'>
  18. <div id='outcomeGroup0' data-value="1">
  19. <div class="form-group col-md-12">
  20. <label>Outcome 1</label>
  21. {{ Form::select('outcome[]', $outcomes, reset($outcomes), ['class'=>'form-control selectpicker', 'id' =>'outcome0', 'onchange'=>'fetchObjectiveForSelect("outcome0", "objectiveGroupFor0")']) }}
  22. </div>
  23. <div id='objectiveGroupFor0' data-value='1'>
  24. <div class="form-group col-md-11">
  25. <label>Associated Objectives for Outcome 1</label>
  26. <select id="objective_0_counter_1" name="objective[]" class="form-control selectpicker">
  27. </select>
  28. </div>
  29. <div class="col-md-1">
  30. </div>
  31. </div>
  32. <input type='hidden' name='counterObjective' id='counterObjective' value=1>
  33. <button class='btn btn-md btn-secondary button-add-objective' onclick='addObjectiveTest("objectiveGroupFor0", "objective_0")'>
  34. <span class='glyphicon glyphicon-plus'>
  35. </span>
  36. Add another Objective
  37. </button>
  38. <br>
  39. </div>
  40. <hr>
  41. </div>
  42. <input type='hidden' name='counterOutcome' id='counterOutcome' value=1>
  43. <button id='button-add-outcome' class='btn btn-md btn-secondary' onclick='addOutcomeTest()'>
  44. <span class='glyphicon glyphicon-plus'>
  45. </span>
  46. Add another Outcome
  47. </button>
  48. <!-- Associated Program -->
  49. <div class="form-group">
  50. {{ Form::label('program_id', 'Associated Program') }}<br>
  51. <br>
  52. <input type="hidden" id="{{ $programs[0]->name }}" name="program_id[]" value="{{$programs[0]->id}}">
  53. <input type="checkbox" id="{{ $programs[0]->name }}" name="program_id[]" value="{{$programs[0]->id}}" disabled checked>
  54. <label for="{{ $programs[0]->name }}"> {{ $programs[0]->name }} [{{ $programs[0]->school->name }}]</label><br>
  55. </div>
  56. <div class="form-group">
  57. {{ Form::label('name', 'Name') }}
  58. {{ Form::text('name', '', array('class' => 'form-control')) }}
  59. </div>
  60. <div class="form-group">
  61. {{ Form::label('subcriteria', 'Subcriteria') }}
  62. <p class="help-block"><strong>Manually add</strong> bullets or numbering.</p>
  63. {{ Form::textarea('subcriteria', '', array('class' => 'form-control', 'rows'=>3, 'aria-labelledby'=>'subcriteria')) }}
  64. </div>
  65. <div class="form-group">
  66. {{ Form::label('maximum_score', 'Maximum Score') }}
  67. {{ Form::text('maximum_score', '1', array('class' => 'form-control', 'id'=>'maximum_score', 'oninput'=>'addOptions("Num_scale", "maximum_score", "Scales")')) }}
  68. </div>
  69. <div class="form-group">
  70. {{ Form::label('scales', 'Number of Scales') }}
  71. <select id="Num_scale" name="scales" class="form-control selectpicker" onchange='numberOfScales("Num_scale", "Scales")'>
  72. </select>
  73. </div>
  74. <div id='Scales' data-value="0">
  75. </div>
  76. <div class="form-group">
  77. {{ Form::label('copyright', 'Copyright') }}
  78. {{ Form::textarea('copyright', '', array('class' => 'form-control', 'rows'=>2, 'placeholder'=>'(optional)', 'aria-labelledby'=>'copyright')) }}
  79. </div>
  80. <div class="form-group">
  81. {{ Form::label('notes', 'Notes') }}
  82. {{ Form::textarea('notes', '', array('class' => 'form-control', 'rows'=>2, 'placeholder'=>'(optional)', 'aria-labelledby'=>'notes')) }}
  83. </div>
  84. {{ Form::submit('Create', array('class' => 'btn btn-primary btn-block', 'id'=>'create_the_criterion')) }}
  85. {{ Form::close() }}
  86. </div>
  87. </div>
  88. </div>
  89. <div class="col-md-6">
  90. <div class="panel panel-default panel-button">
  91. <div class="panel-heading">
  92. Edit
  93. </div>
  94. <div class="panel-body">
  95. {{ Form::open(array('action' => 'CriteriaController@update','id'=>'update_criterion')) }}
  96. <button class="btn btn-md btn-secondary filterButton">
  97. <span class="glyphicon glyphicon-plus">
  98. </span>
  99. Filters
  100. </button>
  101. <div class="filterSection">
  102. <div class="form-group">
  103. {{ Form::label('program_id2', 'Associated Program')}}
  104. <select id='select-program' class="form-control selectpicker" onchange='fetchAllCriterion("select-program", "assoc_outcomes_fetch")'>
  105. <option value='{{$programs[0]->id}}' data-subtext="{{$programs[0]->code}}">{{$programs[0]->name}}</option>
  106. </select>
  107. </div>
  108. <div class="form-group">
  109. <label>Associated Outcome</label>
  110. {{ Form::select('assoc_outcome_fetch', $outcomes, null, ['class'=>'form-control selectpicker', 'id'=>'assoc_outcomes_fetch', 'onchange'=>'fetchAllCriterion("select-program", "assoc_outcomes_fetch")']) }}
  111. </div>
  112. </div>
  113. <hr>
  114. <div class="form-group">
  115. {{ Form::label('criterion_id', 'Criterion') }}
  116. <select id="select-criterion" name="id" class="form-control selectpicker" onchange='fetchCriterionForEditing()'>
  117. @foreach ($criteria as $criterion)
  118. <option value="{{ $criterion->id }}" data-subtext="
  119. @if($criterion->program)
  120. &nbsp;&nbsp;&nbsp;[{{ $criterion->program->name }}]
  121. @endif
  122. ">
  123. {{ $criterion->name }}
  124. </option>
  125. @endforeach
  126. </select>
  127. </div>
  128. <div id='allAssocOutcomes'>
  129. <!-- Associated Outcome -->
  130. <div id='assocOutcomeGroup0' data-value="1">
  131. <div class="form-group col-md-12">
  132. <label>Outcome 1</label>
  133. {{ Form::select('outcome[]', $outcomes, null, ['class'=>'form-control selectpicker', 'id'=>'assoc_outcome_0', 'onchange'=>'fetchObjectiveForSelect("assoc_outcome_0", "assoc_objectiveGroupFor0")']) }}
  134. </div>
  135. <div id='assoc_objectiveGroupFor0' data-value="1">
  136. <div class="form-group col-md-11">
  137. <label>Associated Objectives for Outcome 1</label>
  138. <select id="assoc_objective_0_counter_1" name="objective[]" class="form-control selectpicker">
  139. <option value="0">No associated objectives</option>
  140. </select>
  141. </div>
  142. <div class='col-md-1'></div>
  143. </div>
  144. <button id='button-add-objective-assoc' class='btn btn-md btn-secondary' onclick='addAssocObjective("assoc_objectiveGroupFor0", "assoc_objective_0")'>
  145. <span class='glyphicon glyphicon-plus'>
  146. </span>
  147. Add another Objective
  148. </button>
  149. </div>
  150. <hr>
  151. </div>
  152. <button class='btn btn-md btn-secondary button-add-outcome-assoc' onclick='addAssocOutcome()'>
  153. <span class='glyphicon glyphicon-plus'>
  154. </span>
  155. Add another Outcome
  156. </button>
  157. <!-- Associated Program -->
  158. <div class="form-group">
  159. {{ Form::label('program_id2', 'Associated Program') }}<br><br>
  160. <input type="hidden" id="{{ $programs[0]->name }}" name="program_id[]" value="{{$programs[0]->id}}">
  161. <input type="checkbox" id="assoc_program_id_{{ $programs[0]->id }}" name="program_id[]" value="{{$programs[0]->id}}" disabled checked>
  162. <label for="assoc_program_id_{{ $programs[0]->id }}"> {{ $programs[0]->name }} <sub>[{{ $programs[0]->school->name }}]</sub></label><br>
  163. </div>
  164. <!-- Status -->
  165. <div class="form-group">
  166. {{ Form::label('status', 'Status') }}
  167. <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>
  168. <select id="status" name="status" class="form-control">
  169. <option value="1">Active</option>
  170. <option value="0">Inactive</option>
  171. </select>
  172. </div>
  173. <div class="form-group">
  174. {{ Form::label('name', 'Name') }}
  175. {{ Form::text('name', Input::old('name'), array('class' => 'form-control', 'id'=>'criterion_name')) }}
  176. </div>
  177. <div class="form-group">
  178. {{ Form::label('subcriteria', 'Subcriteria') }}
  179. <p class="help-block"><strong>Manually add</strong> bullets or numbering.</p>
  180. {{ Form::textarea('subcriteria', '', array('class' => 'form-control', 'rows'=>3, 'id' => 'criterion_subcriteria')) }}
  181. </div>
  182. <div class="form-group">
  183. {{ Form::label('maximum_score', 'Maximum Score') }}
  184. {{ Form::text('maximum_score', '', array('class' => 'form-control', 'id'=>'assoc_maximum_score', 'oninput'=>'addOptions("Num_assoc_scale", "assoc_maximum_score", "Assoc_Scales")')) }}
  185. </div>
  186. <div class="form-group">
  187. {{ Form::label('scales', 'Number of Scales') }}
  188. <select id="Num_assoc_scale" class="form-control selectpicker" onchange='numberOfAssoc("Num_assoc_scale", "Assoc_Scales")'>
  189. </select>
  190. </div>
  191. <div id='Assoc_Scales' data-value="0">
  192. </div>
  193. <div class="form-group">
  194. {{ Form::label('copyright', 'Copyright Information') }}
  195. {{ Form::textarea('copyright', Input::old('copyright'), array('class' => 'form-control', 'rows'=>2, 'id'=>'criterion_copyright', 'placeholder'=>'(optional)')) }}
  196. </div>
  197. <div class="form-group">
  198. {{ Form::label('notes', 'Additional Notes') }}
  199. {{ Form::textarea('notes', Input::old('notes'), array('class' => 'form-control', 'rows'=>2, 'id'=>'criterion_notes', 'placeholder'=>'(optional)')) }}
  200. </div>
  201. {{ Form::submit('Update', array('class' => 'btn btn-primary btn-block', 'id'=>'update_the_criterion')) }}
  202. {{ Form::close() }}
  203. {{ Form::open(array('action' => 'CriteriaController@delete')) }}
  204. <input type='hidden' name='criterion_delete' id='deleteCriteria'>
  205. {{Form::submit("Delete", array('class'=> 'btn btn-primary btn-block', 'id'=>"DeleteButton"))}}
  206. </div>
  207. </div>
  208. </div>
  209. </div>
  210. <script>
  211. var selectOptions = document.getElementById('outcome0').innerHTML;
  212. var counter = 1;
  213. var counterObj = 1;
  214. var outcomeString = 'OutcomeGroup_';
  215. $(document).ready(function() {
  216. addOptions('Num_scale', 'maximum_score', 'Scales');
  217. numberOfScales('Num_scale', 'Scales');
  218. });
  219. $(document).on('submit', '#create_criterion', function(e) {
  220. if (e.originalEvent.submitter.id != "create_the_criterion")
  221. e.preventDefault();
  222. })
  223. $(document).on('submit', '#update_criterion', function(e) {
  224. if (e.originalEvent.submitter.id != "update_the_criterion")
  225. e.preventDefault();
  226. })
  227. function addOptions(select, max, scaleDiv) {
  228. var maxscore = parseInt($('#' + max).val())
  229. options = '<option value = "1"> 1</option>';
  230. selectedValue = 1;
  231. valueBefore = 0;
  232. for (var i = 2; i <= 20; i++) {
  233. if (maxscore % i == 0) {
  234. options += '<option value="' + i.toString() + '">' + i.toString() + '</option>';
  235. }
  236. }
  237. var previousvalue = parseInt($('#' + select).val());
  238. $('#' + select).html(options);
  239. $('#' + select).val(previousvalue);
  240. $('#' + select).selectpicker('refresh');
  241. $('#' + select).trigger('change');
  242. }
  243. function numberOfAssoc(string, Scales) {
  244. var maximum = $('#assoc_maximum_score').val();
  245. var amountOfScale = parseInt($('#' + string).val());
  246. var dataValue = parseInt($('#' + Scales).attr('data-value'));
  247. var division = maximum / amountOfScale;
  248. //add
  249. fullDiv = '';
  250. if (division == 1) {
  251. for (var i = 0; i < amountOfScale; i++) {
  252. div = '<div id="assoc_eval' + i.toString() + Scales + '">' +
  253. '<div class ="form-group">' +
  254. '<label for ="assoc_descripcion' + i.toString() + '">Scale Description (' + (i + 1) + ')</label>' +
  255. '<textarea id = "assoc_scale_' + i + '" class="form-control" rows="2" aria-labelledby="assoc_descripcion' + i.toString() + '" name="Scales[]" cols="50" ></textarea></div></div>';
  256. fullDiv += div;
  257. }
  258. } else if (division == maximum) {
  259. div = '<div id="assoc_eval' + 0 + Scales + '">' +
  260. '<div class ="form-group">' +
  261. '<label for ="assoc_descripcion' + 0 + '">Scale Description (' + 1 + ' - ' + maximum + ') </label>' +
  262. '<textarea id = "assoc_scale_' + 0 + '" class="form-control" rows="2" aria-labelledby="assoc_descripcion' + 0 + '" name="Scales[]" cols="50" ></textarea></div></div>';
  263. fullDiv += div;
  264. } else {
  265. for (var i = 0; i < amountOfScale; i++) {
  266. div = '<div id="assoc_eval' + i.toString() + Scales + '">' +
  267. '<div class ="form-group">' +
  268. '<label for ="assoc_descripcion' + i.toString() + '">Scale Description (' + (1 + (i * division)) + ' - ' + ((1 + i) * division) + ')</label>' +
  269. '<textarea id = "assoc_scale_' + i + '" class="form-control" rows="2" aria-labelledby="assoc_descripcion' + i.toString() + '" name="Scales[]" cols="50" ></textarea></div></div>';
  270. fullDiv += div;
  271. }
  272. }
  273. $('#' + Scales).html(fullDiv);
  274. $('#' + Scales).attr('data-value', amountOfScale);
  275. }
  276. //add
  277. function numberOfScales(string, Scales) {
  278. var maximum = parseInt($('#maximum_score').val());
  279. var amountOfScale = parseInt($('#' + string).val());
  280. var dataValue = parseInt($('#' + Scales).attr('data-value'));
  281. var division = maximum / amountOfScale;
  282. //add
  283. fullDiv = '';
  284. if (division == 1) {
  285. for (var i = 0; i < amountOfScale; i++) {
  286. div = '<div id="eval' + i.toString() + Scales + '">' +
  287. '<div class ="form-group">' +
  288. '<label id = "label_for_des' + i.toString() + '" for ="descripcion' + i.toString() + '">Scale Description (' + (i + 1) + ')</label>' +
  289. '<textarea class="form-control" rows="2" aria-labelledby="descripcion' + i.toString() + '" name="' + Scales + '[]" cols="50" ></textarea></div></div>';
  290. fullDiv += div;
  291. }
  292. } else if (division == maximum) {
  293. div = '<div id="eval' + 0 + Scales + '">' +
  294. '<div class ="form-group">' +
  295. '<label id = "label_for_des' + 0 + '" for ="descripcion' + 0 + '">Scale Description (' + 1 + ' - ' + maximum + ')</label>' +
  296. '<textarea class="form-control" rows="2" aria-labelledby="descripcion' + 0 + '" name="' + Scales + '[]" cols="50" ></textarea></div></div>';
  297. fullDiv += div;
  298. } else {
  299. for (var i = 0; i < amountOfScale; i++) {
  300. div = '<div id="eval' + i.toString() + Scales + '">' +
  301. '<div class ="form-group">' +
  302. '<label id = "label_for_des' + i.toString() + '" for ="descripcion' + i.toString() + '">Scale Description (' + (1 + (i * division)) + ' - ' + ((1 + i) * division) + ')</label>' +
  303. '<textarea class="form-control" rows="2" aria-labelledby="descripcion' + i.toString() + '" name="' + Scales + '[]" cols="50" ></textarea></div></div>';
  304. fullDiv += div;
  305. }
  306. }
  307. $('#' + Scales).html(fullDiv);
  308. $('#' + Scales).attr('data-value', amountOfScale);
  309. }
  310. $('.filterSection').hide();
  311. $('.filterButton').on('click', function() {
  312. var span = $(this).find('span');
  313. if (span.attr('class') == 'glyphicon glyphicon-plus') {
  314. span.attr('class', 'glyphicon glyphicon-minus');
  315. } else {
  316. span.attr('class', 'glyphicon glyphicon-plus');
  317. }
  318. $('.filterSection').toggle(533);
  319. });
  320. //Add outcome Button
  321. function addOutcomeTest() {
  322. counter = parseInt($('#outcomeGroup0').data("value"));
  323. var $select = $('<select/>', {
  324. 'class': "selectpicker form-control",
  325. 'name': "outcome[]",
  326. 'data-live-search': 'true',
  327. 'id': 'outcome' + counter.toString(),
  328. 'onchange': 'fetchObjectiveForSelect("outcome' + counter + '", "objectiveGroupFor' + counter + '")'
  329. });
  330. var $div = $('<div/>', {
  331. 'id': 'outcomeForm' + counter.toString(),
  332. 'class': 'form-group col-md-11 '
  333. });
  334. var $divForButton = $('<div/>', {
  335. 'class': 'col-md-1',
  336. 'id': 'close' + counter.toString()
  337. });
  338. var $button = $('<button/>', {
  339. 'type': 'button',
  340. 'class': 'btn btn-primary',
  341. 'onclick': '$(this).parent().parent().remove();'
  342. });
  343. var divForGroup = $('<div/>', {
  344. 'id': 'outcomeGroup' + counter.toString(),
  345. }).html("<label>Outcome " + (counter + 1) + "</label>");
  346. var objectiveGroup = $('<div/>', {
  347. 'id': 'objectiveGroupFor' + counter,
  348. 'data-value': '1'
  349. });
  350. var form_group_for_objective = $('<div/>', {
  351. 'class': 'form-group col-md-11'
  352. }).html('<label>Associated Objectives for Outcome ' + (counter + 1) + '</label>');
  353. var $select_objective = $('<select/>', {
  354. 'class': "selectpicker form-control",
  355. 'name': "objective[]",
  356. 'data-live-search': 'true',
  357. 'id': 'objective_' + counter + '_counter_1'
  358. });
  359. var empty_div = $('<div/>', {
  360. 'class': 'col-md-1'
  361. });
  362. var button_for_add = $('<button/>', {
  363. 'class': 'btn btn-md btn-secondary button-add-objective',
  364. 'onclick': 'addObjectiveTest("objectiveGroupFor' + counter + '", "objective_' + counter + '")'
  365. }).html("<span class='glyphicon glyphicon-plus'></span>Add another Objective");
  366. divForGroup.append($div)
  367. $button.append('X');
  368. $divForButton.append($button);
  369. $('#allOutcomes').append(divForGroup);
  370. $select.append(selectOptions);
  371. $select.appendTo('#outcomeForm' + counter.toString()).selectpicker('refresh');
  372. $('#outcomeGroup0').data("value", (counter + 1));
  373. divForGroup.append($divForButton);
  374. form_group_for_objective.append($select_objective)
  375. objectiveGroup.append(form_group_for_objective);
  376. objectiveGroup.append(empty_div);
  377. //objectiveGroup.append(button_for_add);
  378. divForGroup.append(objectiveGroup);
  379. divForGroup.append(button_for_add);
  380. divForGroup.append('<hr>');
  381. fetchObjectiveForSelect('outcome' + counter, "objectiveGroupFor" + counter);
  382. $select_objective.selectpicker('refresh');
  383. }
  384. //Delete Outcome and OptGroup associated
  385. function deleteLast(outcomeForm, outcomeDiv, closeButton, objectiveGroup) {
  386. $div = document.getElementById(outcomeForm);
  387. $div.remove();
  388. $div = document.getElementById(closeButton);
  389. $div.remove();
  390. if (outcomeDiv == 'outcomeGroup') {
  391. $('#' + outcomeDiv).data('value', parseInt($('#' + outcomeDiv).data('value')) - 1);
  392. fetchObjectiveForSelect(outcomeDiv, objectiveGroup);
  393. }
  394. }
  395. //Delete Objective
  396. function deleteObjective(objectiveForm, closeObj, objectiveGroup) {
  397. $div = document.getElementById(objectiveForm);
  398. $div.remove();
  399. $div = document.getElementById(closeObj);
  400. $div.remove();
  401. counter = parseInt($('#'+objectiveGroup).data("value"));
  402. $('#'+objectiveGroup).data("value", counter-1);
  403. }
  404. //Add objective when editing
  405. function addAssocObjective(objForGroup, originalObjective) {
  406. counter = $("#" + objForGroup).data('value');
  407. selectObj = document.getElementById(originalObjective + '_counter_1').innerHTML;
  408. assocObjectiveCounter = parseInt($('#' + objForGroup).data('value'));
  409. var $select = $('<select/>', {
  410. 'class': "selectpicker form-control",
  411. 'name': "objective[]",
  412. 'data-live-search': 'true',
  413. 'id': originalObjective + '_counter_' + (assocObjectiveCounter + 1).toString(),
  414. });
  415. var $div = $('<div/>', {
  416. 'id': 'assoc_objectiveForm_' + objForGroup + '_' + assocObjectiveCounter.toString(),
  417. 'class': 'form-group col-md-10'
  418. });
  419. var $divForButton = $('<div/>', {
  420. 'class': 'col-md-2',
  421. 'id': 'assoc_closeObj_' + objForGroup + '_' + assocObjectiveCounter.toString()
  422. });
  423. var $button = $('<button/>', {
  424. 'type': 'button',
  425. 'class': 'btn btn-primary',
  426. 'onclick': 'deleteObjective("assoc_objectiveForm_' + objForGroup + '_' + assocObjectiveCounter.toString() + '", "assoc_closeObj_' + objForGroup + '_' + assocObjectiveCounter.toString() + '", "' + objForGroup + '")'
  427. });
  428. $button.append('X');
  429. $divForButton.append($button);
  430. $div.appendTo('#' + objForGroup)
  431. $select.append(selectObj);
  432. $select.appendTo($div).selectpicker('refresh');
  433. //$('#assoc_objectiveGroup').data("value", assocObjectiveCounter +1);
  434. $divForButton.appendTo('#' + objForGroup);
  435. $('#' + objForGroup).data('value', counter + 1);
  436. }
  437. //Add objective when creating a criteria
  438. function addObjectiveTest(objForGroup, originalObjective) {
  439. counter = $('#' + objForGroup).data('value');
  440. selectObj = document.getElementById(originalObjective + '_counter_1').innerHTML;
  441. var $select = $('<select/>', {
  442. 'class': "selectpicker form-control",
  443. 'name': "objective[]",
  444. 'data-live-search': 'true',
  445. 'id': originalObjective + '_counter_' + (counter + 1).toString()
  446. });
  447. var $div = $('<div/>', {
  448. 'id': 'objectiveForm_' + objForGroup + '_' + counter.toString(),
  449. 'class': 'form-group col-md-10'
  450. });
  451. var $divForButton = $('<div/>', {
  452. 'class': 'col-md-2',
  453. 'id': 'closeObj_' + objForGroup + '_' + counter.toString()
  454. });
  455. var $button = $('<button/>', {
  456. 'type': 'button',
  457. 'class': 'btn btn-primary',
  458. 'onclick': 'deleteObjective("objectiveForm_' + objForGroup + '_' + counter.toString() + '", "closeObj_' + objForGroup + '_' + counter.toString() + '", "' + objForGroup + '")'
  459. });
  460. $button.append('X');
  461. $divForButton.append($button);
  462. $div.appendTo('#' + objForGroup)
  463. $select.append(selectObj);
  464. $select.appendTo($div).selectpicker('refresh');
  465. $divForButton.appendTo('#' + objForGroup);
  466. $('#' + objForGroup).data('value', counter + 1);
  467. }
  468. //Create outcome for editing
  469. var assocOutcomeCounter = 0;
  470. function addAssocOutcome(depends = null) {
  471. assocOutcomeCounter = parseInt($('#assocOutcomeGroup0').data('value'));
  472. var $select = $('<select/>', {
  473. 'class': "selectpicker form-control",
  474. 'name': "outcome[]",
  475. 'data-live-search': 'true',
  476. 'id': 'assoc_outcome_' + assocOutcomeCounter.toString(),
  477. 'onchange': 'fetchObjectiveForSelect("assoc_outcome_' + assocOutcomeCounter.toString() + '", "assoc_objectiveGroupFor' + assocOutcomeCounter + '")'
  478. });
  479. var $div = $('<div/>', {
  480. 'id': 'assoc_outcomeForm' + assocOutcomeCounter.toString(),
  481. 'class': 'form-group col-md-11'
  482. });
  483. var $divForButton = $('<div/>', {
  484. 'class': 'col-md-1',
  485. 'id': 'assoc_close' + assocOutcomeCounter.toString()
  486. });
  487. var $button = $('<button/>', {
  488. 'type': 'button',
  489. 'class': 'btn btn-primary',
  490. 'id': 'assoc_close_button' + assocOutcomeCounter,
  491. 'onclick': '$(this).parent().parent().remove()'
  492. });
  493. var divForGroup = $('<div/>', {
  494. 'id': 'assocOutcomeGroup' + assocOutcomeCounter.toString(),
  495. }).html("<label>Outcome " + (assocOutcomeCounter + 1) + "</label>");
  496. var objectiveGroup = $('<div/>', {
  497. 'id': 'assoc_objectiveGroupFor' + assocOutcomeCounter,
  498. 'data-value': '1'
  499. });
  500. var form_group_for_objective = $('<div/>', {
  501. 'class': 'form-group col-md-11'
  502. }).html('<label>Associated Objectives for Outcome ' + (assocOutcomeCounter + 1) + '</label>');
  503. var $select_objective = $('<select/>', {
  504. 'class': "selectpicker form-control",
  505. 'name': "objective[]",
  506. 'data-live-search': 'true',
  507. 'id': 'assoc_objective_' + assocOutcomeCounter + '_counter_1'
  508. });
  509. var empty_div = $('<div/>', {
  510. 'class': 'col-md-1'
  511. });
  512. var button_for_add = $('<button/>', {
  513. 'class': 'btn btn-md btn-secondary button-add-objective',
  514. 'onclick': 'addAssocObjective("assoc_objectiveGroupFor' + assocOutcomeCounter + '", "assoc_objective_' + assocOutcomeCounter + '")'
  515. }).html("<span class='glyphicon glyphicon-plus'></span>Add another Objective");
  516. divForGroup.append($div)
  517. $button.append('X');
  518. $divForButton.append($button);
  519. $('#allAssocOutcomes').append(divForGroup);
  520. //$div.appendTo('#assocOutcomeGroup')
  521. $select.append(selectOptions);
  522. $select.appendTo('#assoc_outcomeForm' + assocOutcomeCounter.toString()).selectpicker('refresh');
  523. //assocOutcomeCounter += 1;
  524. $('#assocOutcomeGroup0').data('value', assocOutcomeCounter + 1);
  525. //$divForButton.appendTo('#assocOutcomeGroup');
  526. divForGroup.append($divForButton);
  527. form_group_for_objective.append($select_objective)
  528. objectiveGroup.append(form_group_for_objective);
  529. objectiveGroup.append(empty_div);
  530. //objectiveGroup.append(button_for_add);
  531. divForGroup.append(objectiveGroup);
  532. divForGroup.append(button_for_add);
  533. divForGroup.append('<hr>');
  534. if (!depends) fetchObjectiveForSelect('assoc_outcome_' + assocOutcomeCounter, 'assoc_objectiveGroupFor' + assocOutcomeCounter);
  535. $select_objective.selectpicker('refresh');
  536. }
  537. //Fetch associated objective for editing
  538. var assocObjectiveCounter = 1;
  539. /* function fetchAssocObjective(outcomeDiv, objectiveGroup) {
  540. var count = $('#' + outcomeDiv).data('value');
  541. var allOutcomes = [];
  542. $("#" + outcomeDiv + ' select').each(function() {
  543. allOutcomes.push(this.value);
  544. })
  545. var allObjectives = [];
  546. $("#" + objectiveGroup + ' select').each(function() {
  547. var temp = {
  548. id: this.id,
  549. value: this.value
  550. }
  551. allObjectives.push(temp);
  552. })
  553. $.post(
  554. "{{ URL::action('CriteriaController@fetchObjectivesForSelect') }}", {
  555. allOutcomes: allOutcomes
  556. },
  557. function(varArray) {
  558. optionName = '<option value ="0">Nothing Selected</option>';
  559. for (outcome in varArray.outcomes) {
  560. optionName += '<optgroup label="' + varArray.outcomes[outcome][0].name + '">';
  561. var objectiveForOutcome = varArray.objectives;
  562. var objectives = objectiveForOutcome[outcome];
  563. for (objective in objectives) {
  564. var obj = objectives[objective];
  565. var option = '<option value ="' + obj.id + '">' + obj.text + '</option>';
  566. optionName += (option);
  567. }
  568. optionName += '</optgroup>';
  569. }
  570. $('#assoc_objective_0').html(optionName);
  571. $('#assoc_objective_0').selectpicker('refresh');
  572. if ($("#assoc_objective_0 option[value='" + allObjectives[0].value + "']").length > 0) {
  573. $("#assoc_objective_0").val(allObjectives[0].value);
  574. $('#assoc_objective_0').selectpicker('refresh');
  575. }
  576. for (var i = allObjectives.length - 1; i > 0; i--) {
  577. deleteObjective('assoc_objectiveForm_' + objectiveGroup +'_'+i, 'assoc_closeObj_'+objectiveGroup+'_' + i.toString(), objectiveGroup);
  578. }
  579. /*for (var i = 1; i < allObjectives.length; i++) {
  580. addAssocObjective();
  581. $('#assoc_objective_' + i.toString()).selectpicker('refresh');
  582. if ($("#assoc_objective_" + i.toString() + " option[value='" + allObjectives[i].value + "']").length > 0) {
  583. $("#assoc_objective_" + i.toString()).val(allObjectives[i].value);
  584. $("#assoc_objective_" + i.toString()).selectpicker("refresh");
  585. }
  586. }
  587. },
  588. 'json'
  589. );
  590. }*/
  591. //Fetch objective at creating criteria
  592. counterForPost = 0;
  593. function fetchObjectiveForSelect(outcome, objectiveGroup) {
  594. outcomeID = $('#' + outcome).val();
  595. var allObjectives = [];
  596. $("#" + objectiveGroup + ' select').each(function() {
  597. var temp = {
  598. id: this.id,
  599. value: this.value
  600. }
  601. allObjectives.push(temp);
  602. })
  603. $.post(
  604. "{{ URL::action('CriteriaController@fetchObjectivesForSelect') }}", {
  605. outcomeID: outcomeID
  606. },
  607. function(varArray) {
  608. counterOutcome = 0;
  609. optionName = '<option value ="0">Nothing Selected</option>';
  610. for (index in varArray) {
  611. objectiveObject = varArray[index];
  612. optionName += '<option data-program-ids = "'+objectiveObject.program_ids+'" value ="('+objectiveObject.outcome_id+','+objectiveObject.objective_id+')">'+
  613. objectiveObject.text+'</option>';
  614. }
  615. /*
  616. for(outcome in varArray.outcomes){
  617. optionName += '<optgroup label="' + varArray.outcomes[outcome][0].name + '">';
  618. var objectiveForOutcome = varArray.objectives;
  619. var objectives = objectiveForOutcome[outcome];
  620. for (objective in varArray.objectives[outcome]) {
  621. var obj= objectives[objective];
  622. var option = '<option value ="' + obj.id + '">' +obj.text + '</option>';
  623. optionName += (option);
  624. }
  625. optionName += "</optgroup>";
  626. }*/
  627. for (index in allObjectives) {
  628. id = allObjectives[index].id
  629. $('#' + id).html(optionName);
  630. $('#' + id).selectpicker('refresh');
  631. }
  632. /*$('#objective_0').html(optionName);
  633. $('#objective_0').selectpicker('refresh');
  634. if($("#objective_0 option[value='"+allObjectives[0].value+"']").length>0){
  635. $("#objective_0").val(allObjectives[0].value);
  636. $('#objective_0').selectpicker('refresh');
  637. }
  638. for (var i = allObjectives.length - 1; i > 0; i--) {
  639. deleteObjective('objectiveForm' + i.toString(), 'closeObj' + i.toString(), 'objectiveGroup');
  640. }
  641. for(var i =1; i<allObjectives.length; i++){
  642. addObjectiveTest();
  643. $('#objective_'+i.toString()).selectpicker('refresh');
  644. if($("#objective_"+i.toString()+" option[value='"+allObjectives[i].value+"']").length>0){
  645. $("#objective_"+i.toString()).val(allObjectives[i].value);
  646. $("#objective_"+i.toString()).selectpicker("refresh");
  647. }
  648. }*/
  649. },
  650. 'json'
  651. );
  652. }
  653. //after post
  654. //For editing criterion
  655. function fetchAllCriterion(program, outcome) {
  656. var program_id_fetch = $('#' + program).find(':selected').val();
  657. var outcome_fetch = $('#' + outcome).find(':selected').val();
  658. $.post(
  659. "{{URL::action('CriteriaController@fetchAllCriterion')}}", {
  660. program_fetch: program_id_fetch,
  661. outcome_fetch: outcome_fetch
  662. },
  663. function(json) {
  664. json_length = (json.criterion.length);
  665. fullHTML = '';
  666. for (var i = 0; i < json_length; i++) {
  667. fullHTML += '<option value="' + json.criterion[i].id + '">' + json.criterion[i].name + '</option>';
  668. }
  669. $('#select-criterion').html(fullHTML);
  670. $('#select-criterion').selectpicker('refresh');
  671. fetchCriterionForEditing()
  672. },
  673. 'json'
  674. );
  675. }
  676. function deleteCriterion() {
  677. var id = $('#select-criterion').find(':selected').val()
  678. $.post(
  679. "{{ URL::action('CriteriaController@delete')}}", {
  680. id: id
  681. },
  682. function() {
  683. window.location.reload(true)
  684. }
  685. )
  686. }
  687. function fetchCriterionForEditing() {
  688. var id = $('#select-criterion').find(':selected').val();
  689. $.post(
  690. "{{ URL::action('CriteriaController@fetchCriterionWithTrashed') }}", {
  691. id: id
  692. },
  693. function(criterion) {
  694. if (!(criterion.length)) {
  695. name = ' ';
  696. var subcriteria = '';
  697. copyright = null;
  698. notes = null;
  699. $('#status').val(0);
  700. maximum = 1;
  701. $('#assoc_maximum_score').val(1);
  702. }
  703. else {
  704. criterion = criterion[0];
  705. if (!(criterion.activity_criterion.length)) {
  706. $('#DeleteButton').prop('disabled', false);
  707. $("#update_the_criterion").val('Update');
  708. $("#update_criterion").attr('action', "{{ URL::action('CriteriaController@update')}}")
  709. } else {
  710. $('#DeleteButton').prop('disabled', true);
  711. $("#update_the_criterion").val("Create New")
  712. $("#update_criterion").attr('action', "{{ URL::action('CriteriaController@create')}}")
  713. $('#alert_placeholder').html('<div class="alert alert-danger alert-dismissible" role="alert"> <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button> <strong>Warning!</strong> The criterion is already used in assessments. Editting the criterion will actually create a new criterion </div>');
  714. }
  715. var name = criterion.name;
  716. if (criterion.subcriteria) {
  717. subcriteria = JSON.parse(criterion.subcriteria).join('\n');
  718. } else {
  719. subcriteria = "";
  720. }
  721. if (criterion.copyright) {
  722. var copyright = criterion.copyright;
  723. } else {
  724. var copyright = ''
  725. }
  726. if (criterion.notes) notes = criterion.notes;
  727. else notes = '';
  728. // Display info
  729. $('#criterion_name').val(name);
  730. $('#criterion_subcriteria').text(subcriteria);
  731. if (criterion.deleted_at)
  732. $('#status').val(0);
  733. else
  734. $('#status').val(1);
  735. $('#assoc_maximum_score').val(criterion.max_score);
  736. var maximum = criterion.max_score;
  737. addOptions("Num_assoc_scale", "assoc_maximum_score", "Assoc_Scales");
  738. $('#Num_assoc_scale').val(criterion.num_scales)
  739. $('#Num_assoc_scale').selectpicker('refresh');
  740. $('#Num_assoc_scale').trigger('change');
  741. for(i=0; i<criterion.num_scales;i++){
  742. $('#assoc_scale_'+i).val(criterion.scales[i].description);
  743. }
  744. // If copyright or notes aren't empty, load them
  745. }
  746. $('#criterion_copyright').text(copyright);
  747. $('#criterion_notes').text(notes);
  748. // Select associated outcome
  749. try {
  750. assocOutcomeCounter = parseInt($("#assocOutcomeGroup0").data('value'));
  751. for (var i = assocOutcomeCounter - 1; i > 0; i--) {
  752. $('#assoc_close_button' + i).click();
  753. }
  754. $('#assocOutcomeGroup0').data('value', 1);
  755. } catch (err) {
  756. var Notran = true;
  757. }
  758. if (criterion.outcomes.length)
  759. {
  760. $('#assoc_outcome_0').val(criterion.outcomes[0].id);
  761. $('#assoc_outcome_0').selectpicker('refresh');
  762. var first_outcome = criterion.outcomes[0];
  763. options = "<option value ='0'>Nothing Selected</option>";
  764. $(first_outcome.assoc_objectives).each(function(index, objective){
  765. options += '<option data-program-ids = "'+objective.program_ids+'" value ="('+first_outcome.id+','+objective.objective_id+')">'+
  766. objective.text+'</option>';
  767. })
  768. /*for (objective_index in json.objectives_assoc[first_outcome_id]) {
  769. objective = json.objectives_assoc[first_outcome_id][objective_index]
  770. options += '<option value ="(' + first_outcome_id + ',' + objective.objective_id + ')">' +
  771. objective.text + '</option>';
  772. }*/
  773. $('#assoc_objective_0_counter_1').html(options);
  774. $('#assoc_objective_0_counter_1').selectpicker('refresh');
  775. if(first_outcome.objectives_criteria.length){
  776. objective_id = first_outcome.objectives_criteria[0].objective_id;
  777. value = '('+first_outcome.id+','+objective_id+')';
  778. $('#assoc_objective_0_counter_1').val(value);
  779. $('#assoc_objective_0_counter_1').selectpicker('refresh');
  780. }
  781. if($("#assoc_objectiveGroupFor0").find(".btn-primary").length>0){
  782. $("#assoc_objectiveGroupFor0").find(".btn-primary").each(function(){
  783. $(this).click()
  784. })
  785. }
  786. for(var i =1; i<first_outcome.objectives_criteria.length; i++ ){
  787. addAssocObjective("assoc_objectiveGroupFor0", "assoc_objective_0");
  788. objective_id = first_outcome.objectives_criteria[i].objective_id;
  789. value = "("+first_outcome.id+","+objective_id+")";
  790. $('#assoc_objective_0_counter_'+(i+1)).val(value);
  791. $('#assoc_objective_0_counter_'+(i+1)).selectpicker('refresh');
  792. }
  793. } else {
  794. $('#assoc_outcome_0').val($('#assoc_outcomes_fetch').find(':selected').val());
  795. $('#assoc_outcome_0').selectpicker('refresh');
  796. }
  797. for (var i = 1; i < criterion.outcomes.length; i++) {
  798. addAssocOutcome(true);
  799. $('#assoc_outcome_' + i.toString()).val(criterion.outcomes[i].id);
  800. $('#assoc_outcome_' + i.toString()).selectpicker('refresh');
  801. var outcome = criterion.outcomes[i];
  802. options = "<option value ='0'>Nothing Selected</option>";
  803. $(outcome.assoc_objectives).each(function(index, objective){
  804. options += '<option value ="('+outcome.id+','+objective.objective_id+')">'+
  805. objective.text+'</option>';
  806. })
  807. /*for (objective_index in json.objectives_assoc[outcome_id]) {
  808. objective = json.objectives_assoc[outcome_id][objective_index]
  809. options += '<option value ="(' + outcome_id + ',' + objective.objective_id + ')">' +
  810. objective.text + '</option>';
  811. }*/
  812. $('#assoc_objective_' + i + '_counter_1').html(options);
  813. $('#assoc_objective_' + i + '_counter_1').selectpicker('refresh');
  814. if(outcome.objectives_criteria.length){
  815. objective_id = outcome.objectives_criteria[0].objective_id;
  816. value = "("+outcome.id+","+objective_id+")"
  817. $('#assoc_objective_'+i+'_counter_1').val(value);
  818. $('#assoc_objective_'+i+'_counter_1').selectpicker('refresh')
  819. }
  820. for(var j =1; j<outcome.objectives_criteria.length; j++ ){
  821. addAssocObjective("assoc_objectiveGroupFor"+i, "assoc_objective_"+i);
  822. objective_id =outcome.objectives_criteria[j].objective_id;
  823. value = "("+outcome.id+","+objective_id+")";
  824. $('#assoc_objective_'+i+'_counter_'+(j+1)).val(value);
  825. $('#assoc_objective_'+i+'_counter_'+(j+1)).selectpicker('refresh');
  826. }
  827. }
  828. /*try {
  829. for (var i = counterObj - 1; i > 0; i--) {
  830. deleteObjective('assoc_objectiveForm' + i.toString(), 'assoc_closeObj' + i.toString(), 'assoc_objectiveGroup')
  831. }
  832. } catch (err) {
  833. var noEntro = true;
  834. }*/
  835. //$('#assoc_objectiveGroup').data('value', 1);
  836. //counterObj =$('#assoc_objectiveGroup').data('value');
  837. /*
  838. assocOutcomeCounter = 0;
  839. var i = 0;
  840. optionName = '<option value ="0">Nothing Selected</option>';
  841. for(outcome in json.outcomes_assoc){
  842. optionName += '<optgroup label="' + json.outcomes_assoc[outcome][0].name + '">';
  843. var objectiveForOutcome = json.objectives_assoc;
  844. var objectives = objectiveForOutcome[outcome];
  845. for (objective in objectives) {
  846. var obj= objectives[objective];
  847. var option = '<option value ="' + obj.id + '">' +obj.text + '</option>';
  848. optionName += (option);
  849. }
  850. optionName+= '</optgroup>';
  851. }
  852. $('#assoc_objective_0').html(optionName);
  853. $('#assoc_objective_0').selectpicker('refresh');
  854. try {
  855. $('#assoc_objective_0').val(json.objectives[0].id);
  856. $('#assoc_objective_0').selectpicker('refresh');
  857. } catch (err) {
  858. if (!json.objectives.length) {
  859. $('#assoc_objective_0').val(0);
  860. $('#assoc_objective_0').selectpicker('refresh');
  861. }
  862. var thereIsNoObjective = true;
  863. }
  864. for (var i = 1; i < json.objectives.length; i++) {
  865. addAssocObjective();
  866. $('#assoc_objective_' + i.toString()).val(json.objectives[i].id);
  867. $('#assoc_objective_' + i.toString()).selectpicker('refresh');
  868. }
  869. $('assoc_objectiveGroup').data('value',json.objectives.length);
  870. */
  871. // Select status
  872. },
  873. 'json'
  874. );
  875. }
  876. </script>
  877. @stop
  878. @section('javascript')
  879. // --------------------------------------------------------------------------
  880. // Page load
  881. // --------------------------------------------------------------------------
  882. // Hide accordion panel contents by default
  883. $('.panel-group .panel-body').hide();
  884. $('#outcome-display').parent().hide();
  885. fetchCriterionForEditing();
  886. fetchObjectiveForSelect('outcome0', 'objectiveGroupFor0');
  887. // setCriterionStatus();
  888. fetchAllCriterion("select-program", "assoc_outcomes_fetch");
  889. // --------------------------------------------------------------------------
  890. // Functions
  891. // --------------------------------------------------------------------------
  892. $('#button-add-outcome').on('click', function(e) {
  893. // Prevent the default action of the clicked item. In this case that is submit
  894. e.preventDefault();
  895. return false;
  896. });
  897. $('.filterButton').on('click', function(e) {
  898. // Prevent the default action of the clicked item. In this case that is submit
  899. e.preventDefault();
  900. return false;
  901. });
  902. $('.button-add-objective-assoc').on('click', function(e) {
  903. // Prevent the default action of the clicked item. In this case that is submit
  904. e.preventDefault();
  905. return false;
  906. });
  907. $('#button-add-outcome-assoc').on('click', function(e) {
  908. // Prevent the default action of the clicked item. In this case that is submit
  909. e.preventDefault();
  910. return false;
  911. });
  912. $('.button-add-objective').on('click', function(e) {
  913. // Prevent the default action of the clicked item. In this case that is submit
  914. e.preventDefault();
  915. return false;
  916. });
  917. // Fetch criterion info for editing
  918. // --------------------------------------------------------------------------
  919. // Events
  920. // --------------------------------------------------------------------------
  921. // When panel heading is clicked, toggle it
  922. $('.panel-group .panel-heading').on('click', function()
  923. {
  924. $(this).next().stop().slideToggle();
  925. })
  926. //$('#outcome[0]').on('change', function(){
  927. //$('.selectpicker').selectpicker('refresh');
  928. //})
  929. // When list item is clicked, load corresponding info
  930. // When list item is clicked, load corresponding info
  931. $('.selectpicker').on('change', function()
  932. {
  933. //alert($(this).find(':selected').val());
  934. $('.selectpicker').selectpicker('refresh');
  935. });
  936. @stop