Aucune description

criteria.blade.php 48KB

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