No Description

criteria.blade.php 48KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305
  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 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 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. }
  821. for(var j =1; j<outcome.objectives_criteria.length; j++ ){
  822. addAssocObjective("assoc_objectiveGroupFor"+i, "assoc_objective_"+i);
  823. objective_id =outcome.objectives_criteria[j].objective_id;
  824. value = "("+outcome.id+","+objective_id+")";
  825. $('#assoc_objective_'+i+'_counter_'+(j+1)).val(value);
  826. $('#assoc_objective_'+i+'_counter_'+(j+1)).selectpicker('refresh');
  827. }
  828. }
  829. /*try {
  830. for (var i = counterObj - 1; i > 0; i--) {
  831. deleteObjective('assoc_objectiveForm' + i.toString(), 'assoc_closeObj' + i.toString(), 'assoc_objectiveGroup')
  832. }
  833. } catch (err) {
  834. var noEntro = true;
  835. }*/
  836. //$('#assoc_objectiveGroup').data('value', 1);
  837. //counterObj =$('#assoc_objectiveGroup').data('value');
  838. /*
  839. assocOutcomeCounter = 0;
  840. var i = 0;
  841. optionName = '<option value ="0">Nothing Selected</option>';
  842. for(outcome in json.outcomes_assoc){
  843. optionName += '<optgroup label="' + json.outcomes_assoc[outcome][0].name + '">';
  844. var objectiveForOutcome = json.objectives_assoc;
  845. var objectives = objectiveForOutcome[outcome];
  846. for (objective in objectives) {
  847. var obj= objectives[objective];
  848. var option = '<option value ="' + obj.id + '">' +obj.text + '</option>';
  849. optionName += (option);
  850. }
  851. optionName+= '</optgroup>';
  852. }
  853. $('#assoc_objective_0').html(optionName);
  854. $('#assoc_objective_0').selectpicker('refresh');
  855. try {
  856. $('#assoc_objective_0').val(json.objectives[0].id);
  857. $('#assoc_objective_0').selectpicker('refresh');
  858. } catch (err) {
  859. if (!json.objectives.length) {
  860. $('#assoc_objective_0').val(0);
  861. $('#assoc_objective_0').selectpicker('refresh');
  862. }
  863. var thereIsNoObjective = true;
  864. }
  865. for (var i = 1; i < json.objectives.length; i++) {
  866. addAssocObjective();
  867. $('#assoc_objective_' + i.toString()).val(json.objectives[i].id);
  868. $('#assoc_objective_' + i.toString()).selectpicker('refresh');
  869. }
  870. $('assoc_objectiveGroup').data('value',json.objectives.length);
  871. */
  872. // Select status
  873. },
  874. 'json'
  875. );
  876. }
  877. </script>
  878. @stop
  879. @section('javascript')
  880. // --------------------------------------------------------------------------
  881. // Page load
  882. // --------------------------------------------------------------------------
  883. // Hide accordion panel contents by default
  884. $('.panel-group .panel-body').hide();
  885. $('#outcome-display').parent().hide();
  886. fetchCriterionForEditing();
  887. fetchObjectiveForSelect('outcome0', 'objectiveGroupFor0');
  888. // setCriterionStatus();
  889. fetchAllCriterion("select-program", "assoc_outcomes_fetch");
  890. // --------------------------------------------------------------------------
  891. // Functions
  892. // --------------------------------------------------------------------------
  893. $('#button-add-outcome').on('click', function(e) {
  894. // Prevent the default action of the clicked item. In this case that is submit
  895. e.preventDefault();
  896. return false;
  897. });
  898. $('.filterButton').on('click', function(e) {
  899. // Prevent the default action of the clicked item. In this case that is submit
  900. e.preventDefault();
  901. return false;
  902. });
  903. $('.button-add-objective-assoc').on('click', function(e) {
  904. // Prevent the default action of the clicked item. In this case that is submit
  905. e.preventDefault();
  906. return false;
  907. });
  908. $('#button-add-outcome-assoc').on('click', function(e) {
  909. // Prevent the default action of the clicked item. In this case that is submit
  910. e.preventDefault();
  911. return false;
  912. });
  913. $('.button-add-objective').on('click', function(e) {
  914. // Prevent the default action of the clicked item. In this case that is submit
  915. e.preventDefault();
  916. return false;
  917. });
  918. // Fetch criterion info for editing
  919. // --------------------------------------------------------------------------
  920. // Events
  921. // --------------------------------------------------------------------------
  922. // When panel heading is clicked, toggle it
  923. $('.panel-group .panel-heading').on('click', function()
  924. {
  925. $(this).next().stop().slideToggle();
  926. })
  927. //$('#outcome[0]').on('change', function(){
  928. //$('.selectpicker').selectpicker('refresh');
  929. //})
  930. // When list item is clicked, load corresponding info
  931. // When list item is clicked, load corresponding info
  932. $('.selectpicker').on('change', function()
  933. {
  934. //alert($(this).find(':selected').val());
  935. $('.selectpicker').selectpicker('refresh');
  936. });
  937. @stop