No Description

criteria.blade.php 48KB

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