parent
commit
0da7a31910

+ 0
- 1
app/controllers/CriteriaController.php View File

100
         $json['outcomes'] = DB::select("select  DISTINCT outcomes.id, outcomes.name from outcomes , criterion_objective_outcome where criterion_objective_outcome.criterion_id = ? and outcomes.id = criterion_objective_outcome.outcome_id order by outcomes.id", array(Input::get('id')));
100
         $json['outcomes'] = DB::select("select  DISTINCT outcomes.id, outcomes.name from outcomes , criterion_objective_outcome where criterion_objective_outcome.criterion_id = ? and outcomes.id = criterion_objective_outcome.outcome_id order by outcomes.id", array(Input::get('id')));
101
         $json['objectives'] = DB::select("SELECT DISTINCT objectives.id, objectives.text FROM objectives, criterion_objective_outcome where criterion_objective_outcome.criterion_id = ? and criterion_objective_outcome.objective_id= objectives.id ", array(Input::get('id')));
101
         $json['objectives'] = DB::select("SELECT DISTINCT objectives.id, objectives.text FROM objectives, criterion_objective_outcome where criterion_objective_outcome.criterion_id = ? and criterion_objective_outcome.objective_id= objectives.id ", array(Input::get('id')));
102
         $json['objectives_outcome'] = DB::select("select objectives.id, objectives.text, objective_outcome.outcome_id from objective_outcome, objectives where objective_outcome.outcome_id in(select  DISTINCT outcomes.id from outcomes , criterion_objective_outcome where criterion_objective_outcome.criterion_id = ? and outcomes.id = criterion_objective_outcome.outcome_id) and objectives.id = objective_outcome.objective_id ORDER BY outcome_id", array(Input::get('id')));
102
         $json['objectives_outcome'] = DB::select("select objectives.id, objectives.text, objective_outcome.outcome_id from objective_outcome, objectives where objective_outcome.outcome_id in(select  DISTINCT outcomes.id from outcomes , criterion_objective_outcome where criterion_objective_outcome.criterion_id = ? and outcomes.id = criterion_objective_outcome.outcome_id) and objectives.id = objective_outcome.objective_id ORDER BY outcome_id", array(Input::get('id')));
103
-        $json['scales'] = DB::select("select title, description, min_score, max_score from scales, criterion_scale where criterion_scale.scale_id = scales.id and criterion_id = ?", array(Input::get('id')));
104
         $json['program'] = DB::select("select criterion_id, program_id from program_criterion where criterion_id =?", array(Input::get('id')));
103
         $json['program'] = DB::select("select criterion_id, program_id from program_criterion where criterion_id =?", array(Input::get('id')));
105
         $json['activity_criterion'] = DB::select("select * from new_assessments where activity_criterion_id  in (select id from activity_criterion where criterion_id = ?)", array(Input::get('id')));
104
         $json['activity_criterion'] = DB::select("select * from new_assessments where activity_criterion_id  in (select id from activity_criterion where criterion_id = ?)", array(Input::get('id')));
106
 
105
 

+ 2
- 2
app/controllers/Objective2Controller.php View File

106
 
106
 
107
 
107
 
108
 		$clean_input['outcome_id'] = Input::get('assoc_outcome');
108
 		$clean_input['outcome_id'] = Input::get('assoc_outcome');
109
-
109
+		Log::info(Input::all());
110
 
110
 
111
 
111
 
112
 		$clean_input['program_id'] = Input::get('program_id');
112
 		$clean_input['program_id'] = Input::get('program_id');
135
 		$program_id = Input::get('program_fetch');
135
 		$program_id = Input::get('program_fetch');
136
 		$outcome_id = Input::get('outcome_fetch');
136
 		$outcome_id = Input::get('outcome_fetch');
137
 		$json = array();
137
 		$json = array();
138
-		$json['objective'] = DB::select("SELECT * FROM `objectives` where id in (select objective_id from criterion_objective_outcome where outcome_id ={$outcome_id}) and id in(select objective_id from objective_program where program_id = {$program_id})");
138
+		$json['objective'] = DB::select("SELECT * FROM `objectives` where id in (select objective_id from objective_outcome where outcome_id ={$outcome_id}) and id in (select objective_id from objective_program where program_id = {$program_id})");
139
 		return json_encode($json);
139
 		return json_encode($json);
140
 	}
140
 	}
141
 	public function delete()
141
 	public function delete()

+ 20
- 219
app/views/local/managers/admins/criteria.blade.php View File

68
                     <p class="help-block"><strong>Manually add</strong> bullets or numbering.</p>
68
                     <p class="help-block"><strong>Manually add</strong> bullets or numbering.</p>
69
                     {{ Form::textarea('subcriteria', '', array('class' => 'form-control', 'rows'=>3, 'aria-labelledby'=>'subcriteria')) }}
69
                     {{ Form::textarea('subcriteria', '', array('class' => 'form-control', 'rows'=>3, 'aria-labelledby'=>'subcriteria')) }}
70
                 </div>
70
                 </div>
71
-                <div class="form-group">
72
-                    {{ Form::label('maximum_score', 'Maximum Score') }}
73
-                    {{ Form::text('maximum_score', '1', array('class' => 'form-control', 'id'=>'maximum_score', 'oninput'=>'addOptions("Num_scale", "maximum_score", "Scales")')) }}
74
-                </div>
75
-                <div class="form-group">
76
-                    {{ Form::label('scales', 'Number of Scales') }}
77
-                    <select id="Num_scale" name="scales" class="form-control selectpicker" onchange='numberOfScales("Num_scale", "Scales")'>
78
-
79
-                    </select>
80
-                </div>
81
-                <div id='Scales' data-value="0">
82
-
83
-                </div>
71
+               
84
 
72
 
85
 
73
 
86
                 <div class="form-group">
74
                 <div class="form-group">
112
                     </span>
100
                     </span>
113
                     Filters
101
                     Filters
114
                   </button>
102
                   </button>
103
+                  <div class ="filterSection">
115
                 <div class="form-group">
104
                 <div class="form-group">
105
+                    
116
                     {{ Form::label('program_id2', 'Associated Program')}}
106
                     {{ Form::label('program_id2', 'Associated Program')}}
117
                     <select id='select-program' class="form-control selectpicker" onchange='fetchAllCriterion("select-program", "assoc_outcomes_fetch")'>
107
                     <select id='select-program' class="form-control selectpicker" onchange='fetchAllCriterion("select-program", "assoc_outcomes_fetch")'>
118
                         @foreach ($programs as $program)
108
                         @foreach ($programs as $program)
119
                         <option value='{{$program->id}}' data-subtext="{{$program->code}}">{{$program->name}}</option>
109
                         <option value='{{$program->id}}' data-subtext="{{$program->code}}">{{$program->name}}</option>
120
                         @endforeach
110
                         @endforeach
121
                     </select>
111
                     </select>
112
+
122
                 </div>
113
                 </div>
123
                 <div class="form-group">
114
                 <div class="form-group">
124
                     <label>Associated Outcome</label>
115
                     <label>Associated Outcome</label>
125
                     {{ Form::select('assoc_outcome_fetch', $outcomes, null, ['class'=>'form-control selectpicker', 'id'=>'assoc_outcomes_fetch', 'onchange'=>'fetchAllCriterion("select-program", "assoc_outcomes_fetch")']) }}
116
                     {{ Form::select('assoc_outcome_fetch', $outcomes, null, ['class'=>'form-control selectpicker', 'id'=>'assoc_outcomes_fetch', 'onchange'=>'fetchAllCriterion("select-program", "assoc_outcomes_fetch")']) }}
126
 
117
 
127
                 </div>
118
                 </div>
119
+                    </div>
128
 
120
 
129
                 <div class="form-group">
121
                 <div class="form-group">
130
                     {{ Form::label('criterion_id', 'Criterion') }}
122
                     {{ Form::label('criterion_id', 'Criterion') }}
211
                     {{ Form::textarea('subcriteria', '', array('class' => 'form-control', 'rows'=>3, 'id' => 'criterion_subcriteria')) }}
203
                     {{ Form::textarea('subcriteria', '', array('class' => 'form-control', 'rows'=>3, 'id' => 'criterion_subcriteria')) }}
212
                 </div>
204
                 </div>
213
 
205
 
214
-                <div class="form-group">
215
-                    {{ Form::label('assoc_maximum_score', 'Maximum Score') }}
216
-                    {{ Form::text('assoc_maximum_score', '', array('class' => 'form-control', 'id'=>'assoc_maximum_score', 'oninput'=>'addOptions("Num_assoc_scale", "assoc_maximum_score", "Assoc_Scales")')) }}
217
-                </div>
218
-
219
-
220
-                <div class="form-group">
221
-                    {{ Form::label('scales', 'Number of Scales') }}
222
-                    <select id="Num_assoc_scale" class="form-control selectpicker" onchange='numberOfAssoc("Num_assoc_scale", "Assoc_Scales")'>
223
-
224
-                    </select>
225
-                </div>
226
-                <div id='Assoc_Scales' data-value="0">
227
-
228
-                </div>
229
 
206
 
230
 
207
 
231
                 <div class="form-group">
208
                 <div class="form-group">
255
     var counter = 1;
232
     var counter = 1;
256
     var counterObj = 1;
233
     var counterObj = 1;
257
     var outcomeString = 'OutcomeGroup_';
234
     var outcomeString = 'OutcomeGroup_';
258
-    $(document).ready(function() {
259
-        addOptions('Num_scale', 'maximum_score', 'Scales');
260
-        numberOfScales('Num_scale', 'Scales');
261
-    });
262
-
263
-
264
-    function numberOfAssoc(string, Scales) {
265
-        var maximum = $('#assoc_maximum_score').val();
266
-        var amountOfScale = parseInt($('#' + string).val());
267
-        var dataValue = parseInt($('#' + Scales).attr('data-value'));
268
-        //add
269
-        if (dataValue < amountOfScale) {
270
-
271
-            fullDiv = '';
272
-
273
-            for (var i = dataValue; i < amountOfScale; i++) {
274
-                div = '<div id="assoc_eval' + i.toString() + Scales + '">' +
275
-                    '<div class ="form-row">' +
276
-                    '<label for="header' + (i).toString() + '">Evaluación ' + (i + 1).toString() + '</label><br><br>' +
277
-                    '<input type="hidden"  id="header' + i.toString() + '">' +
278
-                    '<div class="form-group col-md-8" >' +
279
-                    '<label for="title' + i.toString() + '">Nombre de Evaluación ' + (i + 1).toString() + '</label>' +
280
-                    '<input class="form-control" name="assoc_title[]" type="text"  id="title' + i.toString() + '" placeholder ="Nombre de evaluacion" ></div>' +
281
-                    '<div class ="form-group col-md-2">' +
282
-                    '<label for="min' + i.toString() + '">Mínimo </label>' +
283
-                    '<input class="form-control" type="number" id="assoc_min' + i.toString() + '" min="1" max = "' + maximum + '" oninput ="changedMin(' + "'assoc_min" + i.toString() + "', '" + i.toString() + "', 'Assoc_Scales' " + ')" name = "assoc_min[]"></div>' +
284
-                    '<div class ="form-group col-md-2">' +
285
-                    '<label for="max' + i.toString() + '">Máximo </label>' +
286
-                    '<input class="form-control" type="number" id="assoc_max' + i.toString() + '" min="1" max = "' + maximum + '" oninput ="changedMax(' + "'assoc_max" + i.toString() + "', '" + i.toString() + "', 'Assoc_Scales' " + ')" name = "assoc_max[]"></div></div>' +
287
-                    '<div class ="form-group">' +
288
-                    '<label for ="descripcion' + i.toString() + '">Descripción de evaluación</label>' +
289
-                    '<textarea class="form-control" rows="2" aria-labelledby="descripcion' + i.toString() + '" name="assoc_scales[]" cols="50" ></textarea></div></div>';
290
-                fullDiv += div;
291
-
292
-
293
-            }
294
-
295
-            $('#' + Scales).append(fullDiv);
296
-            $('#' + Scales).attr('data-value', amountOfScale);
297
-        } else {
298
-            for (var i = dataValue; i > amountOfScale; i--) {
299
-                $('#assoc_eval' + (i - 1).toString()).remove();
300
-            }
301
-        }
302
-        $('#' + Scales).attr('data-value', amountOfScale);
303
-
304
-    }
305
-
306
-    function addOptions(select, max, scaleDiv) {
307
-        var maxscore = parseInt($('#' + max).val())
308
-        options = '';
309
-        for (var i = 1; i <= maxscore; i++) {
310
-            options += '<option value="' + i.toString() + '">' + i.toString() + '</option>';
311
-
312
-        }
313
-
314
-        var previousvalue = parseInt($('#' + select).val());
315
-        $('#' + select).html(options);
316
-        $('#' + select).val(previousvalue);
317
-        $('#' + select).selectpicker('refresh');
318
-
319
-        var attribute = parseInt($('#' + scaleDiv).attr('data-value'));
320
-
321
-        for (var i = 0; i < attribute; i++) {
322
-            $('#max' + i.toString()).attr('max', maxscore);
323
-            $('#min' + i.toString()).attr('max', maxscore);
324
-        }
325
-
326
-    }
327
   
235
   
328
 
236
 
329
     $('.filterSection').hide();
237
     $('.filterSection').hide();
337
   }
245
   }
338
   $('.filterSection').toggle(533);
246
   $('.filterSection').toggle(533);
339
 });
247
 });
340
-    function numberOfScales(string, Scales) {
341
-        var maximum = $('#maximum_score').val();
342
-        var amountOfScale = parseInt($('#' + string).val());
343
-        var dataValue = parseInt($('#' + Scales).attr('data-value'));
344
-        //add
345
-        if (dataValue < amountOfScale) {
346
-
347
-            fullDiv = '';
348
-
349
-            for (var i = dataValue; i < amountOfScale; i++) {
350
-                div = '<div id="eval' + i.toString() + Scales + '">' +
351
-                    '<div class ="form-row">' +
352
-                    '<label for="header' + (i).toString() + '">Evaluación ' + (i + 1).toString() + '</label><br><br>' +
353
-                    '<input type="hidden"  id="header' + i.toString() + '">' +
354
-                    '<div class="form-group col-md-8" >' +
355
-                    '<label for="title' + i.toString() + '">Nombre de Evaluación ' + (i + 1).toString() + '</label>' +
356
-                    '<input class="form-control" name="title[]" type="text"  id="title' + i.toString() + '" placeholder ="Nombre de evaluacion" ></div>' +
357
-                    '<div class ="form-group col-md-2">' +
358
-                    '<label for="min' + i.toString() + '">Mínimo </label>' +
359
-                    '<input class="form-control" type="number" id="min' + i.toString() + '" min="1" max = "' + maximum + '" oninput ="changedMin(' + "'min" + i.toString() + "', '" + i.toString() + "', 'Scales' " + ')" name = "min[]"></div>' +
360
-                    '<div class ="form-group col-md-2">' +
361
-                    '<label for="max' + i.toString() + '">Máximo </label>' +
362
-                    '<input class="form-control" type="number" id="max' + i.toString() + '" min="1" max = "' + maximum + '" oninput ="changedMax(' + "'max" + i.toString() + "', '" + i.toString() + "', 'Scales' " + ')" name = "max[]"></div></div>' +
363
-                    '<div class ="form-group">' +
364
-                    '<label for ="descripcion' + i.toString() + '">Descripción de evaluación</label>' +
365
-                    '<textarea class="form-control" rows="2" aria-labelledby="descripcion' + i.toString() + '" name="' + Scales + '[]" cols="50" ></textarea></div></div>';
366
-                fullDiv += div;
367
-            }
368
-
369
-            $('#' + Scales).append(fullDiv);
370
-
371
-        } else {
372
-            for (var i = dataValue; i > amountOfScale; i--) {
373
-                $('#eval' + (i - 1).toString() + Scales).remove();
374
-            }
375
-        }
376
-        $('#' + Scales).attr('data-value', amountOfScale);
377
-
378
-    }
379
-
380
-    function changedMin(min, index, scaleDiv) {
381
-        var maximum = parseInt($('#' + min).val()) + 1;
382
-        var maxScaleScore = parseInt($('#' + scaleDiv).attr('data-value'));
383
 
248
 
384
-        for (var i = parseInt(index); i < maxScaleScore; i++) {
385
-            $('#max' + i).attr('min', maximum);
386
 
249
 
387
-        }
388
-
389
-    }
390
-
391
-    function changedMax(max, index, scaleDiv) {
392
-        var maximum = parseInt($('#' + max).val()) + 1;
393
-        var maxScaleScore = parseInt($('#' + scaleDiv).attr('data-value'));
394
-
395
-        for (var i = parseInt(index) + 1; i < maxScaleScore; i++) {
396
-            $('#min' + i).attr('min', maximum)
397
-
398
-        }
399
-
400
-
401
-    }
250
+    
402
 
251
 
403
     //Add outcome Button
252
     //Add outcome Button
404
     function addOutcomeTest() {
253
     function addOutcomeTest() {
501
         var $button = $('<button/>', {
350
         var $button = $('<button/>', {
502
             'type': 'button',
351
             'type': 'button',
503
             'class': 'btn btn-primary',
352
             'class': 'btn btn-primary',
504
-            'onclick': 'deleteObjective("assoc_objectiveForm' + assocObjectiveCounter.toString() + '", "assoc_closeObj' + assocObjectiveCounter.toString() + ', assoc_objectiveGroup")'
353
+            'onclick': 'deleteObjective("assoc_objectiveForm' + assocObjectiveCounter.toString() + '", "assoc_closeObj' + assocObjectiveCounter.toString() + ', "assoc_objectiveGroup")'
505
         });
354
         });
506
 
355
 
507
         $button.append('X');
356
         $button.append('X');
522
     function addObjectiveTest() {
371
     function addObjectiveTest() {
523
         selectObj = document.getElementById('objective_0').innerHTML;
372
         selectObj = document.getElementById('objective_0').innerHTML;
524
         counter = $("#objectiveGroup").data('value');
373
         counter = $("#objectiveGroup").data('value');
525
-        $('#objectiveGroup')
374
+       
526
         var $select = $('<select/>', {
375
         var $select = $('<select/>', {
527
             'class': "selectpicker form-control",
376
             'class': "selectpicker form-control",
528
             'name': "objective[]",
377
             'name': "objective[]",
750
 
599
 
751
     //after post
600
     //after post
752
 
601
 
753
-    fetchAllCriterion("select-program", "assoc_outcomes_fetch");
602
+    
754
     //For editing criterion
603
     //For editing criterion
755
     function fetchAllCriterion(program, outcome) {
604
     function fetchAllCriterion(program, outcome) {
756
         var program_id_fetch = $('#' + program).find(':selected').val();
605
         var program_id_fetch = $('#' + program).find(':selected').val();
800
 
649
 
801
                 if (!(json.activity_criterion.length)) {
650
                 if (!(json.activity_criterion.length)) {
802
 
651
 
803
-                    $('#DeleteButton').prop('disabled', true);
652
+                    $('#DeleteButton').prop('enabled', true);
804
 
653
 
805
                 } else {
654
                 } else {
806
-                    $('#DeleteButton').prop('enabled', true);
655
+                    $('#DeleteButton').prop('disabled', true);
807
                 }
656
                 }
808
 
657
 
809
                 if (!(json.criteria.length)) {
658
                 if (!(json.criteria.length)) {
961
                 // Select status
810
                 // Select status
962
 
811
 
963
 
812
 
964
-                scaleLength = json.scales.length;
965
-                fullDiv = '';
966
-                if (!scaleLength) {
967
-                    div = '<div id="assoc_eval 0"">' +
968
-                        '<div class ="form-row">' +
969
-                        '<label for="header0">Evaluación 1</label><br><br>' +
970
-                        '<input type="hidden"  id="header0">' +
971
-                        '<div class="form-group col-md-8" >' +
972
-                        '<label for="title0">Nombre de Evaluación 1</label>' +
973
-                        '<input class="form-control" name="assoc_title[]" value =" "type="text"  id="title0" placeholder ="Nombre de evaluacion" ></div>' +
974
-                        '<div class ="form-group col-md-2">' +
975
-                        '<label for="min0">Mínimo </label>' +
976
-                        '<input class="form-control" type="number" id="assoc_min0" min="1" max = "1" value =" " name = "assoc_min[]"></div>' +
977
-                        '<div class ="form-group col-md-2">' +
978
-                        '<label for="max">Máximo </label>' +
979
-                        '<input class="form-control" type="number" id="assoc_max" min="1" max = "" value =" " name = "assoc_max[]"></div></div>' +
980
-                        '<div class ="form-group">' +
981
-                        '<label for ="descripcion">Descripción de evaluación</label>' +
982
-                        '<textarea class="form-control" rows="2" aria-labelledby="descripcion" name="assoc_scales[]" cols="50" ></textarea></div></div>';
983
-                    fullDiv += div;
984
-                } else {
985
-                    var dataValue = parseInt($('#Assoc_Scales').attr('data-value'));
986
-                    $('#assoc_maximum_score').val(json.criteria[0].maximum_score);
987
-                    var maximum = json.criteria[0].maximum_score;
988
-
989
-
990
-                    $('#Assoc_Scales').html(' ');
991
-                    for (var i = 0; i < scaleLength; i++) {
992
-
993
-                        div = '<div id="assoc_eval' + i.toString() + '">' +
994
-                            '<div class ="form-row">' +
995
-                            '<label for="header' + (i).toString() + '">Evaluación ' + (i + 1).toString() + '</label><br><br>' +
996
-                            '<input type="hidden"  id="header' + i.toString() + '">' +
997
-                            '<div class="form-group col-md-8" >' +
998
-                            '<label for="title' + i.toString() + '">Nombre de Evaluación ' + (i + 1).toString() + '</label>' +
999
-                            '<input class="form-control" name="assoc_title[]" value ="' + json.scales[i].title + '"type="text"  id="title' + i.toString() + '" placeholder ="Nombre de evaluacion" ></div>' +
1000
-                            '<div class ="form-group col-md-2">' +
1001
-                            '<label for="min' + i.toString() + '">Mínimo </label>' +
1002
-                            '<input class="form-control" type="number" id="assoc_min' + i.toString() + '" min="1" max = "' + maximum + '" value ="' + json.scales[i].min_score + '"oninput ="changedMin(' + "'assoc_min" + i.toString() + "', '" + i.toString() + "', 'Assoc_Scales' " + ')" name = "assoc_min[]"></div>' +
1003
-                            '<div class ="form-group col-md-2">' +
1004
-                            '<label for="max' + i.toString() + '">Máximo </label>' +
1005
-                            '<input class="form-control" type="number" id="assoc_max' + i.toString() + '" min="1" max = "' + maximum + '" value ="' + json.scales[i].max_score + '"oninput ="changedMax(' + "'assoc_max" + i.toString() + "', '" + i.toString() + "', 'Assoc_Scales' " + ')" name = "assoc_max[]"></div></div>' +
1006
-                            '<div class ="form-group">' +
1007
-                            '<label for ="descripcion' + i.toString() + '">Descripción de evaluación</label>' +
1008
-                            '<textarea class="form-control" rows="2" aria-labelledby="descripcion' + i.toString() + '" name="assoc_scales[]" cols="50" >' + json.scales[i].description + '</textarea></div></div>';
1009
-                        fullDiv += div;
1010
-
1011
-                    }
1012
-                }
1013
-
1014
-                addOptions('Num_assoc_scale', 'assoc_maximum_score');
1015
-
1016
-                $('#Assoc_Scales').append(fullDiv);
1017
-                $('#Assoc_Scales').attr('data-value', scaleLength);
1018
-                $('#Num_assoc_scale').val(scaleLength);
1019
-                $('#Num_assoc_scale').selectpicker('refresh')
1020
 
813
 
1021
 
814
 
1022
 
815
 
1043
 fetchCriterionForEditing();
836
 fetchCriterionForEditing();
1044
 fetchObjectiveForSelect('outcomeGroup', 'objectiveGroup');
837
 fetchObjectiveForSelect('outcomeGroup', 'objectiveGroup');
1045
 // setCriterionStatus();
838
 // setCriterionStatus();
1046
-
839
+fetchAllCriterion("select-program", "assoc_outcomes_fetch");
1047
 
840
 
1048
 
841
 
1049
 
842
 
1078
 
871
 
1079
 return false;
872
 return false;
1080
 });
873
 });
874
+
875
+$('.filterButton').on('click', function(e) {
876
+    // Prevent the default action of the clicked item. In this case that is submit
877
+    e.preventDefault();
878
+    
879
+    
880
+    return false;
881
+    });
1081
 // Fetch criterion info for editing
882
 // Fetch criterion info for editing
1082
 
883
 
1083
 
884
 

+ 30
- 13
app/views/local/managers/admins/objectives.blade.php View File

67
                 Edit
67
                 Edit
68
             </div>
68
             </div>
69
             <div class="panel-body">
69
             <div class="panel-body">
70
-
70
+                <button class="btn btn-md btn-secondary filterButton">
71
+                    <span class="glyphicon glyphicon-plus">
72
+                    </span>
73
+                    Filters
74
+                  </button>
75
+                  <div class='filterSection'>
71
                 {{ Form::open(array('action' => 'Objective2Controller@update')) }}
76
                 {{ Form::open(array('action' => 'Objective2Controller@update')) }}
72
                 <div class="form-group">
77
                 <div class="form-group">
73
                     {{ Form::label('program_id2', 'Associated Program')}}
78
                     {{ Form::label('program_id2', 'Associated Program')}}
79
                 </div>
84
                 </div>
80
                 <div class="form-group">
85
                 <div class="form-group">
81
                     <label>Associated Outcome</label>
86
                     <label>Associated Outcome</label>
82
-                    {{ Form::select('assoc_outcome_fetch', $outcomes, null, ['class'=>'form-control selectpicker', 'id'=>'assoc_outcomes_fetch', 'onchange'=>'fetchAllObjectives("select-program", "assoc_outcomes_fetch")']) }}
87
+                    {{ Form::select('assoc_outcomes_fetch', $outcomes, null, ['class'=>'form-control selectpicker', 'id'=>'assoc_outcomes_fetch', 'onchange'=>'fetchAllObjectives("select-program", "assoc_outcomes_fetch")']) }}
83
 
88
 
84
                 </div>
89
                 </div>
90
+                  </div>
85
                 <div class="form-group">
91
                 <div class="form-group">
86
                     {{ Form::label('objective_id', 'Objectives') }}
92
                     {{ Form::label('objective_id', 'Objectives') }}
87
                     <select id="select-objective" name="id" class="form-control selectpicker">
93
                     <select id="select-objective" name="id" class="form-control selectpicker">
106
                     <div id='assocOutcomeGroup'>
112
                     <div id='assocOutcomeGroup'>
107
                         <label>Associated Outcome</label>
113
                         <label>Associated Outcome</label>
108
 
114
 
109
-                        {{ Form::select('assoc_outcome[]', $outcomes, null, ['class'=>'form-control selectpicker', 'id'=>'assoc_outcome0']) }}
115
+                        {{ Form::select('outcome[]', $outcomes, null, ['class'=>'form-control selectpicker', 'id'=>'assoc_outcome0']) }}
110
 
116
 
111
                     </div>
117
                     </div>
112
                 </div>
118
                 </div>
165
     </div>
171
     </div>
166
 </div>
172
 </div>
167
 <script>
173
 <script>
174
+    $('.filterSection').hide();
175
+    $('.filterButton').on('click', function()
176
+{
177
+  var span = $(this).find('span');
178
+  if(span.attr('class') == 'glyphicon glyphicon-plus'){
179
+    span.attr('class','glyphicon glyphicon-minus');
180
+  } else{
181
+    span.attr('class','glyphicon glyphicon-plus');
182
+  }
183
+  $('.filterSection').toggle(533);
184
+});
168
     var outcomeHTML = document.getElementById('outcomeGroup').innerHTML;
185
     var outcomeHTML = document.getElementById('outcomeGroup').innerHTML;
169
     var selectOptions = document.getElementById('outcome[0]').innerHTML;
186
     var selectOptions = document.getElementById('outcome[0]').innerHTML;
170
-    fetchAllObjectives("select-program", "assoc_outcomes_fetch")
171
-
187
+   
172
     function fetchAllObjectives(program, outcome) {
188
     function fetchAllObjectives(program, outcome) {
173
         var program_id_fetch = $('#' + program).find(':selected').val();
189
         var program_id_fetch = $('#' + program).find(':selected').val();
174
         var outcome_fetch = $('#' + outcome).find(':selected').val();
190
         var outcome_fetch = $('#' + outcome).find(':selected').val();
280
 
296
 
281
                 // Select associated outcome
297
                 // Select associated outcome
282
                 for (var i = counterAssoc; i != 1; i--) {
298
                 for (var i = counterAssoc; i != 1; i--) {
283
-                    deleteLastAssoc(i);
299
+                    deleteLastAssoc(i-1);
284
 
300
 
285
                 }
301
                 }
286
                 $('#assoc_outcome0').val(json.outcome[0].outcome_id);
302
                 $('#assoc_outcome0').val(json.outcome[0].outcome_id);
290
                     counterAssoc = i + 1;
306
                     counterAssoc = i + 1;
291
                     var $select = $('<select />', {
307
                     var $select = $('<select />', {
292
                         'class': "selectpicker form-control",
308
                         'class': "selectpicker form-control",
293
-                        'name': "assoc_outcome[]",
309
+                        'name': "outcome[]",
294
                         'data-live-search': 'true',
310
                         'data-live-search': 'true',
295
                         'id': 'assoc_outcome' + i.toString()
311
                         'id': 'assoc_outcome' + i.toString()
296
 
312
 
307
                     var $button = $('<button />', {
323
                     var $button = $('<button />', {
308
                         'type': 'button',
324
                         'type': 'button',
309
                         'class': 'btn btn-primary',
325
                         'class': 'btn btn-primary',
310
-                        'onclick': 'deleteLastAssoc()'
326
+                        'onclick': 'deleteLastAssoc('+i+')'
311
                     });
327
                     });
312
                     $button.append('X');
328
                     $button.append('X');
313
                     $divForButton.append($button);
329
                     $divForButton.append($button);
411
         );
427
         );
412
     }
428
     }
413
 
429
 
414
-    function deleteLastAssoc() {
430
+    function deleteLastAssoc(i) {
415
 
431
 
416
-        div = document.getElementById('assocOutcomeForm' + (counterAssoc).toString());
432
+        div = document.getElementById('assocOutcomeForm' + (i).toString());
417
         div.remove();
433
         div.remove();
418
-        button = document.getElementById('closeAssoc' + (counterAssoc).toString());
434
+        button = document.getElementById('closeAssoc' + (i).toString());
419
         button.remove();
435
         button.remove();
420
         counterAssoc -= 1;
436
         counterAssoc -= 1;
421
 
437
 
426
 
442
 
427
         var $select = $('<select />', {
443
         var $select = $('<select />', {
428
             'class': "selectpicker form-control",
444
             'class': "selectpicker form-control",
429
-            'name': "assoc_outcome[]",
445
+            'name': "outcome[]",
430
             'data-live-search': 'true',
446
             'data-live-search': 'true',
431
             'id': 'assoc_outcome' + counterAssoc.toString()
447
             'id': 'assoc_outcome' + counterAssoc.toString()
432
 
448
 
443
         var $button = $('<button />', {
459
         var $button = $('<button />', {
444
             'type': 'button',
460
             'type': 'button',
445
             'class': 'btn btn-primary',
461
             'class': 'btn btn-primary',
446
-            'onclick': 'deleteLastAssoc()'
462
+            'onclick': 'deleteLastAssoc('+counterAssoc+')'
447
         });
463
         });
448
         $button.append('X');
464
         $button.append('X');
449
         $divForButton.append($button);
465
         $divForButton.append($button);
478
 // setCriterionStatus();
494
 // setCriterionStatus();
479
 
495
 
480
 
496
 
497
+fetchAllObjectives("select-program", "assoc_outcomes_fetch")
481
 
498
 
482
 
499
 
483
 // --------------------------------------------------------------------------
500
 // --------------------------------------------------------------------------

+ 118
- 292
app/views/local/managers/pCoords/criteria.blade.php View File

18
                     <div class="form-group col-md-11">
18
                     <div class="form-group col-md-11">
19
                         <label>Associated Outcomes</label>
19
                         <label>Associated Outcomes</label>
20
 
20
 
21
-                        {{ Form::select('outcome[]', $outcomes, reset($outcomes),  ['class'=>'form-control selectpicker', 'id' =>'outcome0', 'onchange'=>'fetchObjectiveForSelect("outcome0")']) }}
21
+                        {{ Form::select('outcome[]', $outcomes, reset($outcomes),  ['class'=>'form-control selectpicker', 'id' =>'outcome0', 'onchange'=>'fetchObjectiveForSelect("outcomeGroup", "objectiveGroup")']) }}
22
                     </div>
22
                     </div>
23
                 </div>
23
                 </div>
24
                 <input type='hidden' name='counterOutcome' id='counterOutcome' value=1>
24
                 <input type='hidden' name='counterOutcome' id='counterOutcome' value=1>
28
                     </span>
28
                     </span>
29
                     Add another Outcome
29
                     Add another Outcome
30
                 </button>
30
                 </button>
31
-                <div id='objectiveGroup'>
31
+                <div id='objectiveGroup' data-value = '1'>
32
                     <div class="form-group">
32
                     <div class="form-group">
33
                         <label>Associated Objectives</label>
33
                         <label>Associated Objectives</label>
34
                         <select id="objective_0" name="objective[]" class="form-control selectpicker">
34
                         <select id="objective_0" name="objective[]" class="form-control selectpicker">
67
                     <p class="help-block"><strong>Manually add</strong> bullets or numbering.</p>
67
                     <p class="help-block"><strong>Manually add</strong> bullets or numbering.</p>
68
                     {{ Form::textarea('subcriteria', '', array('class' => 'form-control', 'rows'=>3, 'aria-labelledby'=>'subcriteria')) }}
68
                     {{ Form::textarea('subcriteria', '', array('class' => 'form-control', 'rows'=>3, 'aria-labelledby'=>'subcriteria')) }}
69
                 </div>
69
                 </div>
70
-                <div class="form-group">
71
-                    {{ Form::label('maximum_score', 'Maximum Score') }}
72
-                    {{ Form::text('maximum_score', '1', array('class' => 'form-control', 'id'=>'maximum_score', 'oninput'=>'addOptions("Num_scale", "maximum_score", "Scales")')) }}
73
-                </div>
74
-                <div class="form-group">
75
-                    {{ Form::label('scales', 'Number of Scales') }}
76
-                    <select id="Num_scale" name="scales" class="form-control selectpicker" onchange='numberOfScales("Num_scale", "Scales")'>
77
-
78
-                    </select>
79
-                </div>
80
-                <div id='Scales' data-value="0">
81
-
82
-                </div>
70
+                
83
 
71
 
84
 
72
 
85
                 <div class="form-group">
73
                 <div class="form-group">
146
                 </div>
134
                 </div>
147
 
135
 
148
                 <!-- Associated Outcome -->
136
                 <!-- Associated Outcome -->
149
-                <div id='assocOutcomeGroup'>
137
+                <div id='assocOutcomeGroup' data-value="1">
150
                     <div class="form-group">
138
                     <div class="form-group">
151
                         <label>Associated Outcome</label>
139
                         <label>Associated Outcome</label>
152
                         {{ Form::select('assoc_outcome[]', $outcomes, null, ['class'=>'form-control selectpicker', 'id'=>'assoc_outcome_0', 'onchange'=>'fetchAssocObjective("assoc_outcome_0")']) }}
140
                         {{ Form::select('assoc_outcome[]', $outcomes, null, ['class'=>'form-control selectpicker', 'id'=>'assoc_outcome_0', 'onchange'=>'fetchAssocObjective("assoc_outcome_0")']) }}
160
                     Add another Outcome
148
                     Add another Outcome
161
                 </button>
149
                 </button>
162
 
150
 
163
-                <div id='assoc_objectiveGroup'>
151
+                <div id='assoc_objectiveGroup' data-value="1">
164
                     <div class="form-group">
152
                     <div class="form-group">
165
                         <label>Associated Objectives</label>
153
                         <label>Associated Objectives</label>
166
                         <select id="assoc_objective_0" name="assoc_objective[]" class="form-control selectpicker">
154
                         <select id="assoc_objective_0" name="assoc_objective[]" class="form-control selectpicker">
155
+                            <option value="0">No associated objectives</option>
167
                         </select>
156
                         </select>
168
 
157
 
169
                     </div>
158
                     </div>
212
                     {{ Form::textarea('subcriteria', '', array('class' => 'form-control', 'rows'=>3, 'id' => 'criterion_subcriteria')) }}
201
                     {{ Form::textarea('subcriteria', '', array('class' => 'form-control', 'rows'=>3, 'id' => 'criterion_subcriteria')) }}
213
                 </div>
202
                 </div>
214
 
203
 
215
-                <div class="form-group">
216
-                    {{ Form::label('assoc_maximum_score', 'Maximum Score') }}
217
-                    {{ Form::text('assoc_maximum_score', '', array('class' => 'form-control', 'id'=>'assoc_maximum_score', 'oninput'=>'addOptions("Num_assoc_scale", "assoc_maximum_score", "Assoc_Scales")')) }}
218
-                </div>
219
-
220
-
221
-                <div class="form-group">
222
-                    {{ Form::label('scales', 'Number of Scales') }}
223
-                    <select id="Num_assoc_scale" class="form-control selectpicker" onchange='numberOfAssoc("Num_assoc_scale", "Assoc_Scales")'>
224
-
225
-                    </select>
226
-                </div>
227
-                <div id='Assoc_Scales' data-value="0">
228
 
204
 
229
-                </div>
230
 
205
 
231
 
206
 
232
                 <div class="form-group">
207
                 <div class="form-group">
241
                
216
                
242
                 {{ Form::submit('Update', array('class' => 'btn btn-primary btn-block')) }}
217
                 {{ Form::submit('Update', array('class' => 'btn btn-primary btn-block')) }}
243
                 {{ Form::close() }}
218
                 {{ Form::close() }}
244
- <div id='delete'>
245
-
246
-                </div>
219
+                {{ Form::open(array('action' => 'CriteriaController@delete')) }}
220
+                
221
+                                <input type='hidden' name='criterion_delete' id='deleteCriteria'>
222
+               
223
+                                {{Form::submit("Delete", array('class'=> 'btn btn-primary btn-block', 'id'=>"DeleteButton"))}}
247
 
224
 
248
             </div>
225
             </div>
249
         </div>
226
         </div>
255
     var counter = 1;
232
     var counter = 1;
256
     var counterObj = 1;
233
     var counterObj = 1;
257
     var outcomeString = 'OutcomeGroup_';
234
     var outcomeString = 'OutcomeGroup_';
258
-    $(document).ready(function() {
259
-        addOptions('Num_scale', 'maximum_score', 'Scales');
260
-        numberOfScales('Num_scale', 'Scales');
261
-    });
262
-
263
-
264
-    function numberOfAssoc(string, Scales) {
265
-        var maximum = $('#assoc_maximum_score').val();
266
-        var amountOfScale = parseInt($('#' + string).val());
267
-        var dataValue = parseInt($('#' + Scales).attr('data-value'));
268
-        //add
269
-        if (dataValue < amountOfScale) {
270
-
271
-            fullDiv = '';
272
-
273
-            for (var i = dataValue; i < amountOfScale; i++) {
274
-                div = '<div id="assoc_eval' + i.toString() + Scales + '">' +
275
-                    '<div class ="form-row">' +
276
-                    '<label for="header' + (i).toString() + '">Evaluación ' + (i + 1).toString() + '</label><br><br>' +
277
-                    '<input type="hidden"  id="header' + i.toString() + '">' +
278
-                    '<div class="form-group col-md-8" >' +
279
-                    '<label for="title' + i.toString() + '">Nombre de Evaluación ' + (i + 1).toString() + '</label>' +
280
-                    '<input class="form-control" name="assoc_title[]" type="text"  id="title' + i.toString() + '" placeholder ="Nombre de evaluacion" ></div>' +
281
-                    '<div class ="form-group col-md-2">' +
282
-                    '<label for="min' + i.toString() + '">Mínimo </label>' +
283
-                    '<input class="form-control" type="number" id="assoc_min' + i.toString() + '" min="1" max = "' + maximum + '" oninput ="changedMin(' + "'assoc_min" + i.toString() + "', '" + i.toString() + "', 'Assoc_Scales' " + ')" name = "assoc_min[]"></div>' +
284
-                    '<div class ="form-group col-md-2">' +
285
-                    '<label for="max' + i.toString() + '">Máximo </label>' +
286
-                    '<input class="form-control" type="number" id="assoc_max' + i.toString() + '" min="1" max = "' + maximum + '" oninput ="changedMax(' + "'assoc_max" + i.toString() + "', '" + i.toString() + "', 'Assoc_Scales' " + ')" name = "assoc_max[]"></div></div>' +
287
-                    '<div class ="form-group">' +
288
-                    '<label for ="descripcion' + i.toString() + '">Descripción de evaluación</label>' +
289
-                    '<textarea class="form-control" rows="2" aria-labelledby="descripcion' + i.toString() + '" name="assoc_scales[]" cols="50" ></textarea></div></div>';
290
-                fullDiv += div;
291
-
292
-
293
-            }
294
-
295
-            $('#' + Scales).append(fullDiv);
296
-            $('#' + Scales).attr('data-value', amountOfScale);
297
-        } else {
298
-            for (var i = dataValue; i > amountOfScale; i--) {
299
-                $('#assoc_eval' + (i - 1).toString()).remove();
300
-            }
301
-        }
302
-        $('#' + Scales).attr('data-value', amountOfScale);
303
-
304
-    }
305
-
306
-    function addOptions(select, max, scaleDiv) {
307
-        var maxscore = parseInt($('#' + max).val())
308
-        options = '';
309
-        for (var i = 1; i <= maxscore; i++) {
310
-            options += '<option value="' + i.toString() + '">' + i.toString() + '</option>';
311
-
312
-        }
313
-
314
-        var previousvalue = parseInt($('#' + select).val());
315
-        $('#' + select).html(options);
316
-        $('#' + select).val(previousvalue);
317
-        $('#' + select).selectpicker('refresh');
318
-
319
-        var attribute = parseInt($('#' + scaleDiv).attr('data-value'));
320
-
321
-        for (var i = 0; i < attribute; i++) {
322
-            $('#max' + i.toString()).attr('max', maxscore);
323
-            $('#min' + i.toString()).attr('max', maxscore);
324
-        }
325
-
326
-    }
235
+   
327
 
236
 
328
 
237
 
329
 $('.filterSection').hide();
238
 $('.filterSection').hide();
338
   $('.filterSection').toggle(533);
247
   $('.filterSection').toggle(533);
339
 });
248
 });
340
 
249
 
341
-    function numberOfScales(string, Scales) {
342
-        var maximum = $('#maximum_score').val();
343
-        var amountOfScale = parseInt($('#' + string).val());
344
-        var dataValue = parseInt($('#' + Scales).attr('data-value'));
345
-        //add
346
-        if (dataValue < amountOfScale) {
347
-
348
-            fullDiv = '';
349
-
350
-            for (var i = dataValue; i < amountOfScale; i++) {
351
-                div = '<div id="eval' + i.toString() + Scales + '">' +
352
-                    '<div class ="form-row">' +
353
-                    '<label for="header' + (i).toString() + '">Evaluación ' + (i + 1).toString() + '</label><br><br>' +
354
-                    '<input type="hidden"  id="header' + i.toString() + '">' +
355
-                    '<div class="form-group col-md-8" >' +
356
-                    '<label for="title' + i.toString() + '">Nombre de Evaluación ' + (i + 1).toString() + '</label>' +
357
-                    '<input class="form-control" name="title[]" type="text"  id="title' + i.toString() + '" placeholder ="Nombre de evaluacion" ></div>' +
358
-                    '<div class ="form-group col-md-2">' +
359
-                    '<label for="min' + i.toString() + '">Mínimo </label>' +
360
-                    '<input class="form-control" type="number" id="min' + i.toString() + '" min="1" max = "' + maximum + '" oninput ="changedMin(' + "'min" + i.toString() + "', '" + i.toString() + "', 'Scales' " + ')" name = "min[]"></div>' +
361
-                    '<div class ="form-group col-md-2">' +
362
-                    '<label for="max' + i.toString() + '">Máximo </label>' +
363
-                    '<input class="form-control" type="number" id="max' + i.toString() + '" min="1" max = "' + maximum + '" oninput ="changedMax(' + "'max" + i.toString() + "', '" + i.toString() + "', 'Scales' " + ')" name = "max[]"></div></div>' +
364
-                    '<div class ="form-group">' +
365
-                    '<label for ="descripcion' + i.toString() + '">Descripción de evaluación</label>' +
366
-                    '<textarea class="form-control" rows="2" aria-labelledby="descripcion' + i.toString() + '" name="' + Scales + '[]" cols="50" ></textarea></div></div>';
367
-                fullDiv += div;
368
-            }
369
-
370
-            $('#' + Scales).append(fullDiv);
371
-
372
-        } else {
373
-            for (var i = dataValue; i > amountOfScale; i--) {
374
-                $('#eval' + (i - 1).toString() + Scales).remove();
375
-            }
376
-        }
377
-        $('#' + Scales).attr('data-value', amountOfScale);
378
-
379
-    }
380
-
381
-    function changedMin(min, index, scaleDiv) {
382
-        var maximum = parseInt($('#' + min).val()) + 1;
383
-        var maxScaleScore = parseInt($('#' + scaleDiv).attr('data-value'));
384
 
250
 
385
-        for (var i = parseInt(index); i < maxScaleScore; i++) {
386
-            $('#max' + i).attr('min', maximum);
387
-
388
-        }
389
-
390
-    }
391
-
392
-    function changedMax(max, index, scaleDiv) {
393
-        var maximum = parseInt($('#' + max).val()) + 1;
394
-        var maxScaleScore = parseInt($('#' + scaleDiv).attr('data-value'));
395
-
396
-        for (var i = parseInt(index) + 1; i < maxScaleScore; i++) {
397
-            $('#min' + i).attr('min', maximum)
398
-
399
-        }
400
-
401
-
402
-    }
403
 
251
 
404
     //Add outcome Button
252
     //Add outcome Button
405
     function addOutcomeTest() {
253
     function addOutcomeTest() {
254
+        counter = parseInt($('#outcomeGroup').data("value"));
406
         var $select = $('<select/>', {
255
         var $select = $('<select/>', {
407
             'class': "selectpicker form-control",
256
             'class': "selectpicker form-control",
408
             'name': "outcome[]",
257
             'name': "outcome[]",
434
         $select.append(selectOptions);
283
         $select.append(selectOptions);
435
 
284
 
436
         $select.appendTo('#outcomeForm' + counter.toString()).selectpicker('refresh');
285
         $select.appendTo('#outcomeForm' + counter.toString()).selectpicker('refresh');
286
+        $('#outcomeGroup').data("value", counter +1);
437
         fetchObjectiveForSelect('outcomeGroup', "objectiveGroup");
287
         fetchObjectiveForSelect('outcomeGroup', "objectiveGroup");
438
         counter += 1;
288
         counter += 1;
439
         $divForButton.appendTo('#outcomeGroup');
289
         $divForButton.appendTo('#outcomeGroup');
440
 
290
 
441
-        $('#counterOutcome').val(counter)
291
+        
442
 
292
 
443
 
293
 
444
     }
294
     }
458
 
308
 
459
     }
309
     }
460
     //Delete Objective
310
     //Delete Objective
461
-    function deleteObjective(objectiveForm, closeObj) {
311
+ 
312
+    function deleteObjective(objectiveForm, closeObj, objectiveGroup) {
462
         $div = document.getElementById(objectiveForm);
313
         $div = document.getElementById(objectiveForm);
463
         $div.remove();
314
         $div.remove();
464
         $div = document.getElementById(closeObj);
315
         $div = document.getElementById(closeObj);
465
         $div.remove();
316
         $div.remove();
317
+        counter = parseInt($('#'+objectiveGroup).data("value"));
318
+        $('#'+objectiveGroup).data("value", counter-1);
466
 
319
 
467
 
320
 
468
     }
321
     }
471
 
324
 
472
     function addAssocObjective() {
325
     function addAssocObjective() {
473
         selectObj = document.getElementById('assoc_objective_0').innerHTML;
326
         selectObj = document.getElementById('assoc_objective_0').innerHTML;
327
+        assocObjectiveCounter = parseInt($('#assoc_objectiveGroup').data('value'));
474
         var $select = $('<select/>', {
328
         var $select = $('<select/>', {
475
             'class': "selectpicker form-control",
329
             'class': "selectpicker form-control",
476
             'name': "assoc_objective[]",
330
             'name': "assoc_objective[]",
491
         var $button = $('<button/>', {
345
         var $button = $('<button/>', {
492
             'type': 'button',
346
             'type': 'button',
493
             'class': 'btn btn-primary',
347
             'class': 'btn btn-primary',
494
-            'onclick': 'deleteObjective("assoc_objectiveForm' + assocObjectiveCounter.toString() + '", "assoc_closeObj' + assocObjectiveCounter.toString() + '")'
348
+            'onclick': 'deleteObjective("assoc_objectiveForm' + assocObjectiveCounter.toString() + '", "assoc_closeObj' + assocObjectiveCounter.toString() + ', "assoc_objectiveGroup")'
495
         });
349
         });
496
 
350
 
497
         $button.append('X');
351
         $button.append('X');
501
         $select.append(selectObj);
355
         $select.append(selectObj);
502
 
356
 
503
         $select.appendTo('#assoc_objectiveForm' + assocObjectiveCounter.toString()).selectpicker('refresh');
357
         $select.appendTo('#assoc_objectiveForm' + assocObjectiveCounter.toString()).selectpicker('refresh');
504
-        counterObj += 1;
358
+        $('#assoc_objectiveGroup').data("value", assocObjectiveCounter +1);
505
 
359
 
506
         $divForButton.appendTo('#assoc_objectiveGroup');
360
         $divForButton.appendTo('#assoc_objectiveGroup');
507
 
361
 
511
     //Add objective when creating a criteria
365
     //Add objective when creating a criteria
512
     function addObjectiveTest() {
366
     function addObjectiveTest() {
513
         selectObj = document.getElementById('objective_0').innerHTML;
367
         selectObj = document.getElementById('objective_0').innerHTML;
368
+        counter = $("#objectiveGroup").data('value');
514
         var $select = $('<select/>', {
369
         var $select = $('<select/>', {
515
             'class': "selectpicker form-control",
370
             'class': "selectpicker form-control",
516
             'name': "objective[]",
371
             'name': "objective[]",
517
             'data-live-search': 'true',
372
             'data-live-search': 'true',
518
-            'id': 'objective_' + counterObj.toString()
373
+            'id': 'objective_' + counter.toString()
519
 
374
 
520
         });
375
         });
521
         var $div = $('<div/>', {
376
         var $div = $('<div/>', {
522
-            'id': 'objectiveForm' + counterObj.toString(),
377
+            'id': 'objectiveForm' + counter.toString(),
523
             'class': 'form-group col-md-11'
378
             'class': 'form-group col-md-11'
524
         });
379
         });
525
         var $divForButton = $('<div/>', {
380
         var $divForButton = $('<div/>', {
526
             'class': 'col-md-1',
381
             'class': 'col-md-1',
527
-            'id': 'closeObj' + counterObj.toString()
382
+            'id': 'closeObj' + counter.toString()
528
 
383
 
529
         });
384
         });
530
         var $button = $('<button/>', {
385
         var $button = $('<button/>', {
531
             'type': 'button',
386
             'type': 'button',
532
             'class': 'btn btn-primary',
387
             'class': 'btn btn-primary',
533
-            'onclick': 'deleteObjective("objectiveForm' + counterObj.toString() + '", "closeObj' + counterObj.toString() + '")'
388
+            'onclick': 'deleteObjective("objectiveForm' + counter.toString() + '", "closeObj' + counter.toString() + '")'
534
         });
389
         });
535
 
390
 
536
         $button.append('X');
391
         $button.append('X');
539
         $div.appendTo('#objectiveGroup')
394
         $div.appendTo('#objectiveGroup')
540
         $select.append(selectObj);
395
         $select.append(selectObj);
541
 
396
 
542
-        $select.appendTo('#objectiveForm' + counterObj.toString()).selectpicker('refresh');
543
-        counterObj += 1;
397
+        $select.appendTo('#objectiveForm' + counter.toString()).selectpicker('refresh');
398
+        
544
 
399
 
545
         $divForButton.appendTo('#objectiveGroup');
400
         $divForButton.appendTo('#objectiveGroup');
546
-        $('#counterObjective').val(counterObj)
401
+        $('#objectiveGroup').data('value', counter +1);
547
     }
402
     }
548
 
403
 
549
     //Create outcome for editing
404
     //Create outcome for editing
552
 
407
 
553
 
408
 
554
     function addAssocOutcome() {
409
     function addAssocOutcome() {
410
+        assocOutcomeCounter = parseInt($('#assocOutcomeGroup').data('value'));
555
         var $select = $('<select/>', {
411
         var $select = $('<select/>', {
556
             'class': "selectpicker form-control",
412
             'class': "selectpicker form-control",
557
             'name': "assoc_outcome[]",
413
             'name': "assoc_outcome[]",
583
         $select.append(selectOptions);
439
         $select.append(selectOptions);
584
 
440
 
585
         $select.appendTo('#assoc_outcomeForm' + assocOutcomeCounter.toString()).selectpicker('refresh');
441
         $select.appendTo('#assoc_outcomeForm' + assocOutcomeCounter.toString()).selectpicker('refresh');
586
-        //fetchAssocObjective('assoc_outcome_' + assocOutcomeCounter.toString());
587
-        assocOutcomeCounter += 1;
442
+         assocOutcomeCounter += 1;
588
         $divForButton.appendTo('#assocOutcomeGroup');
443
         $divForButton.appendTo('#assocOutcomeGroup');
589
 
444
 
590
-
445
+        $('#assocOutcomeGroup').data('value', assocOutcomeCounter);
591
 
446
 
592
 
447
 
593
     }
448
     }
596
 
451
 
597
     var assocObjectiveCounter = 1;
452
     var assocObjectiveCounter = 1;
598
 
453
 
599
-    function fetchAssocObjective(outcomeId) {
600
-        var id = $('#' + outcomeId).find(':selected').val();
454
+    function fetchAssocObjective(outcomeDiv, objectiveGroup) {
455
+        var count = $('#'+outcomeDiv).data('value');
456
+        var allOutcomes =[];
457
+
458
+         $("#" + outcomeDiv + ' select').each(function() {
459
+            allOutcomes.push( this.value);
460
+
461
+        })
462
+        var allObjectives = [];
463
+        $("#" + objectiveGroup + ' select').each(function() {
464
+            var temp = {
465
+                id: this.id,
466
+                value: this.value
467
+            }
468
+            allObjectives.push(temp);
469
+        })
601
 
470
 
602
 
471
 
603
         $.post(
472
         $.post(
604
             "{{ URL::action('CriteriaController@fetchObjectivesForSelect') }}", {
473
             "{{ URL::action('CriteriaController@fetchObjectivesForSelect') }}", {
605
-                id: id
474
+                allOutcomes: allOutcomes
606
             },
475
             },
607
 
476
 
608
             function(json) {
477
             function(json) {
609
 
478
 
610
-                var optionName = '<optgroup id="' + 'Associated_Outcome' + (assocOutcomeCounter - 1).toString() + '"label="' + 'Associated Outcome' + (assocOutcomeCounter).toString() + '"';
611
-                for (var i = 0; i < json.length; i++) {
612
-                    var option = '<option value ="' + json[i].id.toString() + '">' + json[i].text + '</option>'
613
-                    optionName += (option)
614
-
615
-                }
616
-                optGroup = document.getElementById('Associated_Outcome' + (assocOutcomeCounter - 1).toString());
617
-                if (optGroup != null) {
618
-                    optGroup.remove()
479
+                optionName = '';
480
+                for(outcome in varArray.outcomes){
481
+                    optionName += '<optgroup label="' + varArray.outcomes[outcome][0].name + '"';
482
+                    var objectiveForOutcome = varArray.objectives;
483
+                    var objectives = objectiveForOutcome[outcome];
484
+                    for (objective in objectives) {
485
+                
619
 
486
 
487
+                        var obj= objectives[objective];
488
+                        var option = '<option value ="' + obj.id + '">' +obj.text + '</option>';
489
+                        optionName += (option);
490
+                    }
620
                 }
491
                 }
621
 
492
 
622
 
493
 
623
-                $('#assoc_objective_0').append(optionName);
494
+                $('#assoc_objective_0').html(optionName);
624
                 $('#assoc_objective_0').selectpicker('refresh');
495
                 $('#assoc_objective_0').selectpicker('refresh');
496
+                if($("#assoc_objective_0 option[value='"+allObjectives[0].value+"']").length>0){
497
+                    $("#assoc_objective_0").val(allObjectives[0].value);
498
+                    $('#assoc_objective_0').selectpicker('refresh');
499
+                }
625
 
500
 
626
-                for (var i = assocObjectiveCounter - 1; i > 0; i--) {
627
-                    deleteObjective('assoc_objectiveForm' + i.toString(), 'assoc_closeObj' + i.toString())
501
+                for (var i = allObjectives.length - 1; i > 0; i--) {
502
+                    deleteObjective('assoc_objectiveForm' + i.toString(), 'assoc_closeObj' + i.toString(), 'assoc_objectiveGroup');
503
+                }
504
+                for(var i=1; i<allObjectives.length; i++){
505
+                    addAssocObjective();
506
+                    $('#assoc_objective_'+i.toString()).selectpicker('refresh');
507
+                    if($("#assoc_objective_"+i.toString()+" option[value='"+allObjectives[i].value+"']").length>0){
508
+                    $("#assoc_objective_"+i.toString()).val(allObjectives[i].value);
509
+                    $("#assoc_objective_"+i.toString()).selectpicker("refresh");
510
+                    }
628
                 }
511
                 }
629
-                assocObjectiveCounter = 1;
630
 
512
 
631
 
513
 
632
 
514
 
708
     }
590
     }
709
     //after post
591
     //after post
710
 
592
 
711
-    fetchAllCriterion("select-program", "assoc_outcomes_fetch");
593
+   
712
     //For editing criterion
594
     //For editing criterion
713
     function fetchAllCriterion(program, outcome) {
595
     function fetchAllCriterion(program, outcome) {
714
         var program_id_fetch = $('#' + program).find(':selected').val();
596
         var program_id_fetch = $('#' + program).find(':selected').val();
758
 
640
 
759
                 if (!(json.activity_criterion.length)) {
641
                 if (!(json.activity_criterion.length)) {
760
 
642
 
761
-                    var button = "<button type='button' class ='btn btn-primary btn-block' onclick ='deleteCriterion()'>Delete Criterion</button><br><br>"
762
-                    $('#delete').html(button)
643
+$('#DeleteButton').prop('enabled', true);
763
 
644
 
764
-                }
645
+} else {
646
+$('#DeleteButton').prop('disabled', true);
647
+}
765
 
648
 
766
                 if (!(json.criteria.length)) {
649
                 if (!(json.criteria.length)) {
767
                     name = ' ';
650
                     name = ' ';
777
                     var name = json.criteria[0].name;
660
                     var name = json.criteria[0].name;
778
                     if (json.criteria[0].subcriteria) {
661
                     if (json.criteria[0].subcriteria) {
779
                         subcriteria = JSON.parse(json.criteria[0].subcriteria).join('\n');
662
                         subcriteria = JSON.parse(json.criteria[0].subcriteria).join('\n');
663
+                    }else {
664
+                        subcriteria = "";
780
                     }
665
                     }
781
-                    var copyright = json.criteria[0].copyright;
782
-                    var notes = json.criteria[0].notes;
666
+                    if (json.criteria[0].copyright) {
667
+                        var copyright = json.criteria[0].copyright;
668
+                    } else {
669
+                        var copyright = ''
670
+                    }
671
+                    if (json.criteria[0].notes) notes = json.criteria[0].notes;
672
+                    else notes = '';
783
 
673
 
784
                     // Display info
674
                     // Display info
785
                     $('#criterion_name').val(name);
675
                     $('#criterion_name').val(name);
796
                 }
686
                 }
797
 
687
 
798
 
688
 
799
-                if (copyright) {
689
+               
800
                     $('#criterion_copyright').text(copyright);
690
                     $('#criterion_copyright').text(copyright);
801
-                } else {
802
-                    $('#criterion_copyright').text('');
803
-                }
804
-                if (notes) {
691
+                
692
+                
805
                     $('#criterion_notes').text(notes);
693
                     $('#criterion_notes').text(notes);
806
-                } else {
807
-                    $('#criterion_notes').text('');
808
-                }
694
+               
809
 
695
 
810
 
696
 
811
 
697
 
814
 
700
 
815
                 // Select associated outcome
701
                 // Select associated outcome
816
                 try {
702
                 try {
703
+                    assocOutcomeCounter= parseInt($("#assocOutcomeGroup").data('value'));
817
                     for (var i = assocOutcomeCounter - 1; i > 0; i--) {
704
                     for (var i = assocOutcomeCounter - 1; i > 0; i--) {
818
                         deleteLast("assoc_outcomeForm" + i.toString() , "assocOutcomeGroup", "assoc_close" + i.toString() ,"assoc_objectiveGroup");
705
                         deleteLast("assoc_outcomeForm" + i.toString() , "assocOutcomeGroup", "assoc_close" + i.toString() ,"assoc_objectiveGroup");
819
                                }
706
                                }
838
 
725
 
839
                 }
726
                 }
840
 
727
 
841
-
728
+                counterObj =$('#assoc_objectiveGroup').data('value');
842
 
729
 
843
 
730
 
844
                 try {
731
                 try {
845
                     for (var i = counterObj - 1; i > 0; i--) {
732
                     for (var i = counterObj - 1; i > 0; i--) {
846
-                        deleteObjective('objectiveForm' + i.toString(), 'closeObj' + i.toString())
733
+                        deleteObjective('assoc_objectiveForm' + i.toString(), 'assoc_closeObj' + i.toString(), 'assoc_objectiveGroup')
847
                     }
734
                     }
848
                 } catch (err) {
735
                 } catch (err) {
849
                     var noEntro = true;
736
                     var noEntro = true;
850
                 }
737
                 }
851
-                counterObj = 1;
738
+                $('#assoc_objectiveGroup').data('value', 1);
852
 
739
 
853
 
740
 
854
 
741
 
856
 
743
 
857
                 assocOutcomeCounter = 0;
744
                 assocOutcomeCounter = 0;
858
                 var i = 0;
745
                 var i = 0;
859
-                for (var j = 0; j < json.outcomes.length; j++) {
860
-                    assocOutcomeCounter += 1;
861
-                    var optionName = '<optgroup id="' + 'Associated_Outcome' + (assocOutcomeCounter - 1).toString() + '"label="' + json.outcomes[j].name + '"';
862
-                    for (; i < json.objectives_outcome.length; i++) {
863
-                        if (json.objectives_outcome[i].outcome_id != json.outcomes[j].id) break;
864
-
865
-                        var option = '<option value ="' + json.objectives_outcome[i].id.toString() + '">' + json.objectives_outcome[i].text + '</option>'
866
-                        optionName += (option)
867
-
868
-                    }
869
-                    optGroup = document.getElementById('Associated_Outcome' + (assocOutcomeCounter - 1).toString());
870
-                    if (optGroup != null) {
871
-                        optGroup.remove()
746
+                optionName = '';
747
+                for(outcome in json.outcomes_assoc){
748
+                    optionName += '<optgroup label="' + json.outcomes_assoc[outcome][0].name + '"';
749
+                    var objectiveForOutcome = json.objectives_assoc;
750
+                    var objectives = objectiveForOutcome[outcome];
751
+                    for (objective in objectives) {
752
+                
872
 
753
 
754
+                        var obj= objectives[objective];
755
+                        var option = '<option value ="' + obj.id + '">' +obj.text + '</option>';
756
+                        optionName += (option);
873
                     }
757
                     }
874
-                    $('#assoc_objective_0').append(optionName);
875
-                    $('#assoc_objective_0').selectpicker('refresh');
876
                 }
758
                 }
759
+                $('#assoc_objective_0').html(optionName);
877
 
760
 
761
+                $('#assoc_objective_0').selectpicker('refresh');  
878
 
762
 
879
 
763
 
880
 
764
 
881
-                for (var i = assocObjectiveCounter - 1; i > 0; i--) {
882
-                    deleteObjective('assoc_objectiveForm' + i.toString(), 'assoc_closeObj' + i.toString())
883
-                }
884
-                assocObjectiveCounter = 1;
765
+
766
+        
885
 
767
 
886
 
768
 
887
 
769
 
903
                     $('#assoc_objective_' + i.toString()).val(json.objectives[i].id);
785
                     $('#assoc_objective_' + i.toString()).val(json.objectives[i].id);
904
                     $('#assoc_objective_' + i.toString()).selectpicker('refresh');
786
                     $('#assoc_objective_' + i.toString()).selectpicker('refresh');
905
                 }
787
                 }
906
-                assocObjectiveCounter = json.objectives.length;
907
-
788
+                $('assoc_objectiveGroup').data('value',json.objectives.length);
908
 
789
 
909
                 
790
                 
910
 
791
 
916
                 // Select status
797
                 // Select status
917
 
798
 
918
 
799
 
919
-                scaleLength = json.scales.length;
920
-                fullDiv = '';
921
-                if (!scaleLength) {
922
-                    div = '<div id="assoc_eval 0"">' +
923
-                        '<div class ="form-row">' +
924
-                        '<label for="header0">Evaluación 1</label><br><br>' +
925
-                        '<input type="hidden"  id="header0">' +
926
-                        '<div class="form-group col-md-8" >' +
927
-                        '<label for="title0">Nombre de Evaluación 1</label>' +
928
-                        '<input class="form-control" name="assoc_title[]" value =" "type="text"  id="title0" placeholder ="Nombre de evaluacion" ></div>' +
929
-                        '<div class ="form-group col-md-2">' +
930
-                        '<label for="min0">Mínimo </label>' +
931
-                        '<input class="form-control" type="number" id="assoc_min0" min="1" max = "1" value =" " name = "assoc_min[]"></div>' +
932
-                        '<div class ="form-group col-md-2">' +
933
-                        '<label for="max">Máximo </label>' +
934
-                        '<input class="form-control" type="number" id="assoc_max" min="1" max = "" value =" " name = "assoc_max[]"></div></div>' +
935
-                        '<div class ="form-group">' +
936
-                        '<label for ="descripcion">Descripción de evaluación</label>' +
937
-                        '<textarea class="form-control" rows="2" aria-labelledby="descripcion" name="assoc_scales[]" cols="50" ></textarea></div></div>';
938
-                    fullDiv += div;
939
-                } else {
940
-                    var dataValue = parseInt($('#Assoc_Scales').attr('data-value'));
941
-                    $('#assoc_maximum_score').val(json.criteria[0].maximum_score);
942
-                    var maximum = json.criteria[0].maximum_score;
943
-
944
-
945
-                    $('#Assoc_Scales').html(' ');
946
-                    for (var i = 0; i < scaleLength; i++) {
947
-
948
-                        div = '<div id="assoc_eval' + i.toString() + '">' +
949
-                            '<div class ="form-row">' +
950
-                            '<label for="header' + (i).toString() + '">Evaluación ' + (i + 1).toString() + '</label><br><br>' +
951
-                            '<input type="hidden"  id="header' + i.toString() + '">' +
952
-                            '<div class="form-group col-md-8" >' +
953
-                            '<label for="title' + i.toString() + '">Nombre de Evaluación ' + (i + 1).toString() + '</label>' +
954
-                            '<input class="form-control" name="assoc_title[]" value ="' + json.scales[i].title + '"type="text"  id="title' + i.toString() + '" placeholder ="Nombre de evaluacion" ></div>' +
955
-                            '<div class ="form-group col-md-2">' +
956
-                            '<label for="min' + i.toString() + '">Mínimo </label>' +
957
-                            '<input class="form-control" type="number" id="assoc_min' + i.toString() + '" min="1" max = "' + maximum + '" value ="' + json.scales[i].min_score + '"oninput ="changedMin(' + "'assoc_min" + i.toString() + "', '" + i.toString() + "', 'Assoc_Scales' " + ')" name = "assoc_min[]"></div>' +
958
-                            '<div class ="form-group col-md-2">' +
959
-                            '<label for="max' + i.toString() + '">Máximo </label>' +
960
-                            '<input class="form-control" type="number" id="assoc_max' + i.toString() + '" min="1" max = "' + maximum + '" value ="' + json.scales[i].max_score + '"oninput ="changedMax(' + "'assoc_max" + i.toString() + "', '" + i.toString() + "', 'Assoc_Scales' " + ')" name = "assoc_max[]"></div></div>' +
961
-                            '<div class ="form-group">' +
962
-                            '<label for ="descripcion' + i.toString() + '">Descripción de evaluación</label>' +
963
-                            '<textarea class="form-control" rows="2" aria-labelledby="descripcion' + i.toString() + '" name="assoc_scales[]" cols="50" >' + json.scales[i].description + '</textarea></div></div>';
964
-                        fullDiv += div;
965
-
966
-                    }
967
-                }
968
-
969
-                addOptions('Num_assoc_scale', 'assoc_maximum_score');
970
-
971
-                $('#Assoc_Scales').append(fullDiv);
972
-                $('#Assoc_Scales').attr('data-value', scaleLength);
973
-                $('#Num_assoc_scale').val(scaleLength);
974
-                $('#Num_assoc_scale').selectpicker('refresh')
800
+             
975
 
801
 
976
 
802
 
977
 
803
 
1000
 // setCriterionStatus();
826
 // setCriterionStatus();
1001
 
827
 
1002
 
828
 
1003
-
829
+fetchAllCriterion("select-program", "assoc_outcomes_fetch");
1004
 
830
 
1005
 // --------------------------------------------------------------------------
831
 // --------------------------------------------------------------------------
1006
 // Functions
832
 // Functions
1053
 $(this).next().stop().slideToggle();
879
 $(this).next().stop().slideToggle();
1054
 })
880
 })
1055
 
881
 
1056
-$('#outcome[0]').on('change', function(){
882
+//$('#outcome[0]').on('change', function(){
1057
 
883
 
1058
-$('.selectpicker').selectpicker('refresh');
1059
-})
884
+//$('.selectpicker').selectpicker('refresh');
885
+//})
1060
 // When list item is clicked, load corresponding info
886
 // When list item is clicked, load corresponding info
1061
 
887
 
1062
 
888
 

+ 73
- 1
app/views/local/managers/pCoords/objectives.blade.php View File

65
             <div class="panel-heading">
65
             <div class="panel-heading">
66
                 Edit
66
                 Edit
67
             </div>
67
             </div>
68
+            <button class="btn btn-md btn-secondary filterButton">
69
+                <span class="glyphicon glyphicon-plus">
70
+                </span>
71
+                Filters
72
+              </button>
68
             <div class="panel-body">
73
             <div class="panel-body">
69
-                {{ Form::open(array('action' => 'Objective2Controller@update')) }}
74
+                <div class='filterSection'>
75
+            
76
+                    {{ Form::open(array('action' => 'Objective2Controller@update')) }}
77
+                    
78
+                    <div class="form-group">
79
+                        {{ Form::label('program_id2', 'Associated Program')}}
80
+                        <select id='select-program' class="form-control selectpicker" onchange='fetchAllObjectives("select-program", "assoc_outcomes_fetch")'>
81
+                            @foreach ($programs as $program)
82
+                            <option value='{{$program->id}}' data-subtext="{{$program->code}}">{{$program->name}}</option>
83
+                            @endforeach
84
+                        </select>
85
+                    </div>
86
+                    <div class="form-group">
87
+                        <label>Associated Outcome</label>
88
+                        {{ Form::select('assoc_outcome_fetch', $outcomes, null, ['class'=>'form-control selectpicker', 'id'=>'assoc_outcomes_fetch', 'onchange'=>'fetchAllObjectives("select-program", "assoc_outcomes_fetch")']) }}
89
+    
90
+                    </div>
91
+                      </div>
70
 
92
 
71
                 <div class="form-group">
93
                 <div class="form-group">
72
                     {{ Form::label('objective_id', 'Objectives') }}
94
                     {{ Form::label('objective_id', 'Objectives') }}
133
                     {{ Form::label('text', 'Text') }}
155
                     {{ Form::label('text', 'Text') }}
134
                     {{ Form::text('text', Input::old('text'), array('class' => 'form-control', 'id'=>'objective-text')) }}
156
                     {{ Form::text('text', Input::old('text'), array('class' => 'form-control', 'id'=>'objective-text')) }}
135
                 </div>
157
                 </div>
158
+                <div id="text">
159
+
160
+                </div>
161
+
136
                 {{ Form::submit('Update', array('class' => 'btn btn-primary btn-block')) }}
162
                 {{ Form::submit('Update', array('class' => 'btn btn-primary btn-block')) }}
137
                 {{ Form::close() }}
163
                 {{ Form::close() }}
164
+
165
+                <form action="/deleteObjective" method="POST" id='deleteObj'>
166
+                
167
+                    
168
+                </form>
138
             </div>
169
             </div>
139
 
170
 
140
 
171
 
145
     </div>
176
     </div>
146
 </div>
177
 </div>
147
 <script>
178
 <script>
179
+
180
+$('.filterSection').hide();
181
+	
182
+    $('.filterButton').on('click', function()
183
+{
184
+  var span = $(this).find('span');
185
+  if(span.attr('class') == 'glyphicon glyphicon-plus'){
186
+    span.attr('class','glyphicon glyphicon-minus');
187
+  } else{	
188
+    span.attr('class','glyphicon glyphicon-plus');
189
+	
190
+  }
191
+
192
+  $('.filterSection').toggle(533);
193
+
194
+});
148
     var outcomeHTML = document.getElementById('outcomeGroup').innerHTML;
195
     var outcomeHTML = document.getElementById('outcomeGroup').innerHTML;
149
     var selectOptions = document.getElementById('outcome[0]').innerHTML;
196
     var selectOptions = document.getElementById('outcome[0]').innerHTML;
150
     var ran = false;
197
     var ran = false;
198
+   
199
+    function fetchAllObjectives(program, outcome) {
200
+        var program_id_fetch = $('#' + program).find(':selected').val();
201
+        var outcome_fetch = $('#' + outcome).find(':selected').val();
202
+        $.post(
203
+            "{{URL::action('Objective2Controller@fetchAllObjectives')}}", {
204
+                program_fetch: program_id_fetch,
205
+                outcome_fetch: outcome_fetch
206
+            },
207
+            function(json) {
208
+                json_length = (json.objective.length);
209
+                fullHTML = '';
210
+                for (var i = 0; i < json_length; i++) {
211
+                    fullHTML += '<option value="' + json.objective[i].id + '">' + json.objective[i].text + '</option>';
212
+                }
213
+                $('#select-objective').html(fullHTML);
214
+                $('#select-objective').selectpicker('refresh');
215
+                fetchObjectiveForEditing();
216
+
217
+            },
218
+            'json'
219
+        );
220
+    }
151
 
221
 
152
     var counter = 1;
222
     var counter = 1;
153
     var counterAssoc = 1;
223
     var counterAssoc = 1;
427
 // setCriterionStatus();
497
 // setCriterionStatus();
428
 
498
 
429
 
499
 
500
+ 
501
+fetchAllObjectives("select-program", "assoc_outcomes_fetch")
430
 
502
 
431
 
503
 
432
 // --------------------------------------------------------------------------
504
 // --------------------------------------------------------------------------

+ 41
- 240
app/views/local/managers/sCoords/criteria.blade.php View File

14
             </div>
14
             </div>
15
             <div class="panel-body">
15
             <div class="panel-body">
16
                 {{ Form::open(array('action' => 'CriteriaController@create')) }}
16
                 {{ Form::open(array('action' => 'CriteriaController@create')) }}
17
-                <div id='outcomeGroup'>
17
+                <div id='outcomeGroup' data-value='1'>
18
                     <div class="form-group col-md-11">
18
                     <div class="form-group col-md-11">
19
                         <label>Associated Outcomes</label>
19
                         <label>Associated Outcomes</label>
20
 
20
 
21
-                        {{ Form::select('outcome[]', $outcomes, reset($outcomes),  ['class'=>'form-control selectpicker', 'id' =>'outcome0', 'onchange'=>'fetchObjectiveForSelect("outcome0")']) }}
21
+                        {{ Form::select('outcome[]', $outcomes, reset($outcomes),  ['class'=>'form-control selectpicker', 'id' =>'outcome0', 'onchange'=>'fetchObjectiveForSelect("outcomeGroup", "objectiveGroup")']) }}
22
 
22
 
23
                     </div>
23
                     </div>
24
                 </div>
24
                 </div>
29
                     </span>
29
                     </span>
30
                     Add another Outcome
30
                     Add another Outcome
31
                 </button>
31
                 </button>
32
-                <div id='objectiveGroup'>
32
+                <div id='objectiveGroup' data-value ="1">
33
                     <div class="form-group">
33
                     <div class="form-group">
34
                         <label>Associated Objectives</label>
34
                         <label>Associated Objectives</label>
35
                         <select id="objective_0" name="objective[]" class="form-control selectpicker">
35
                         <select id="objective_0" name="objective[]" class="form-control selectpicker">
68
                     <p class="help-block"><strong>Manually add</strong> bullets or numbering.</p>
68
                     <p class="help-block"><strong>Manually add</strong> bullets or numbering.</p>
69
                     {{ Form::textarea('subcriteria', '', array('class' => 'form-control', 'rows'=>3, 'aria-labelledby'=>'subcriteria')) }}
69
                     {{ Form::textarea('subcriteria', '', array('class' => 'form-control', 'rows'=>3, 'aria-labelledby'=>'subcriteria')) }}
70
                 </div>
70
                 </div>
71
-                <div class="form-group">
72
-                    {{ Form::label('maximum_score', 'Maximum Score') }}
73
-                    {{ Form::text('maximum_score', '1', array('class' => 'form-control', 'id'=>'maximum_score', 'oninput'=>'addOptions("Num_scale", "maximum_score", "Scales")')) }}
74
-                </div>
75
-                <div class="form-group">
76
-                    {{ Form::label('scales', 'Number of Scales') }}
77
-                    <select id="Num_scale" name="scales" class="form-control selectpicker" onchange='numberOfScales("Num_scale", "Scales")'>
78
-
79
-                    </select>
80
-                </div>
81
-                <div id='Scales' data-value="0">
82
-
83
-                </div>
71
+                
84
 
72
 
85
 
73
 
86
                 <div class="form-group">
74
                 <div class="form-group">
146
                 </div>
134
                 </div>
147
 
135
 
148
                 <!-- Associated Outcome -->
136
                 <!-- Associated Outcome -->
149
-                <div id='assocOutcomeGroup'>
137
+                <div id='assocOutcomeGroup' data-value='1'>
150
                     <div class="form-group">
138
                     <div class="form-group">
151
                         <label>Associated Outcome</label>
139
                         <label>Associated Outcome</label>
152
                         {{ Form::select('assoc_outcome[]', $outcomes, null, ['class'=>'form-control selectpicker', 'id'=>'assoc_outcome_0', 'onchange'=>'fetchAssocObjective("assoc_outcome_0")']) }}
140
                         {{ Form::select('assoc_outcome[]', $outcomes, null, ['class'=>'form-control selectpicker', 'id'=>'assoc_outcome_0', 'onchange'=>'fetchAssocObjective("assoc_outcome_0")']) }}
160
                     Add another Outcome
148
                     Add another Outcome
161
                 </button>
149
                 </button>
162
 
150
 
163
-                <div id='assoc_objectiveGroup'>
151
+                <div id='assoc_objectiveGroup' data-value='1'>
164
                     <div class="form-group">
152
                     <div class="form-group">
165
                         <label>Associated Objectives</label>
153
                         <label>Associated Objectives</label>
166
                         <select id="assoc_objective_0" name="assoc_objective[]" class="form-control selectpicker">
154
                         <select id="assoc_objective_0" name="assoc_objective[]" class="form-control selectpicker">
155
+                            <option value="0">No associated objectives</option>
167
                         </select>
156
                         </select>
168
 
157
 
169
                     </div>
158
                     </div>
211
                     {{ Form::textarea('subcriteria', '', array('class' => 'form-control', 'rows'=>3, 'id' => 'criterion_subcriteria')) }}
200
                     {{ Form::textarea('subcriteria', '', array('class' => 'form-control', 'rows'=>3, 'id' => 'criterion_subcriteria')) }}
212
                 </div>
201
                 </div>
213
 
202
 
214
-                <div class="form-group">
215
-                    {{ Form::label('assoc_maximum_score', 'Maximum Score') }}
216
-                    {{ Form::text('assoc_maximum_score', '', array('class' => 'form-control', 'id'=>'assoc_maximum_score', 'oninput'=>'addOptions("Num_assoc_scale", "assoc_maximum_score", "Assoc_Scales")')) }}
217
-                </div>
218
-
219
-
220
-                <div class="form-group">
221
-                    {{ Form::label('scales', 'Number of Scales') }}
222
-                    <select id="Num_assoc_scale" class="form-control selectpicker" onchange='numberOfAssoc("Num_assoc_scale", "Assoc_Scales")'>
223
-
224
-                    </select>
225
-                </div>
226
-                <div id='Assoc_Scales' data-value="0">
227
-
228
-                </div>
229
-
203
+                
230
 
204
 
231
                 <div class="form-group">
205
                 <div class="form-group">
232
                     {{ Form::label('copyright', 'Copyright Information') }}
206
                     {{ Form::label('copyright', 'Copyright Information') }}
237
                     {{ Form::label('notes', 'Additional Notes') }}
211
                     {{ Form::label('notes', 'Additional Notes') }}
238
                     {{ Form::textarea('notes', Input::old('notes'), array('class' => 'form-control', 'rows'=>2, 'id'=>'criterion_notes', 'placeholder'=>'(optional)')) }}
212
                     {{ Form::textarea('notes', Input::old('notes'), array('class' => 'form-control', 'rows'=>2, 'id'=>'criterion_notes', 'placeholder'=>'(optional)')) }}
239
                 </div>
213
                 </div>
240
-                <div id='delete'>
241
-
242
-                </div>
214
+                
243
                 {{ Form::submit('Update', array('class' => 'btn btn-primary btn-block')) }}
215
                 {{ Form::submit('Update', array('class' => 'btn btn-primary btn-block')) }}
244
                 {{ Form::close() }}
216
                 {{ Form::close() }}
245
 
217
 
218
+                {{ Form::open(array('action' => 'CriteriaController@delete')) }}
219
+	
220
+                <input type='hidden' name='criterion_delete' id='deleteCriteria'>
221
+
222
+                {{Form::submit("Delete", array('class'=> 'btn btn-primary btn-block', 'id'=>"DeleteButton"))}}
223
+
246
 
224
 
247
             </div>
225
             </div>
248
         </div>
226
         </div>
249
     </div>
227
     </div>
250
 </div>
228
 </div>
251
 <script>
229
 <script>
230
+
231
+    var selectOptions = document.getElementById('outcome0').innerHTML;
232
+
233
+    var counter = 1;
234
+    var counterObj = 1;
235
+    var outcomeString = 'OutcomeGroup_';
236
+   
252
     $('.filterSection').hide();
237
     $('.filterSection').hide();
253
     $('.filterButton').on('click', function()
238
     $('.filterButton').on('click', function()
254
 {
239
 {
260
   }
245
   }
261
   $('.filterSection').toggle(533);
246
   $('.filterSection').toggle(533);
262
 });
247
 });
263
-    var selectOptions = document.getElementById('outcome0').innerHTML;
264
-
265
-    var counter = 1;
266
-    var counterObj = 1;
267
-    var outcomeString = 'OutcomeGroup_';
268
-    $(document).ready(function() {
269
-        addOptions('Num_scale', 'maximum_score', 'Scales');
270
-        numberOfScales('Num_scale', 'Scales');
271
-    });
272
-
273
-
274
-    function numberOfAssoc(string, Scales) {
275
-        var maximum = $('#assoc_maximum_score').val();
276
-        var amountOfScale = parseInt($('#' + string).val());
277
-        var dataValue = parseInt($('#' + Scales).attr('data-value'));
278
-        //add
279
-        if (dataValue < amountOfScale) {
280
-
281
-            fullDiv = '';
282
-
283
-            for (var i = dataValue; i < amountOfScale; i++) {
284
-                div = '<div id="assoc_eval' + i.toString() + Scales + '">' +
285
-                    '<div class ="form-row">' +
286
-                    '<label for="header' + (i).toString() + '">Evaluación ' + (i + 1).toString() + '</label><br><br>' +
287
-                    '<input type="hidden"  id="header' + i.toString() + '">' +
288
-                    '<div class="form-group col-md-8" >' +
289
-                    '<label for="title' + i.toString() + '">Nombre de Evaluación ' + (i + 1).toString() + '</label>' +
290
-                    '<input class="form-control" name="assoc_title[]" type="text"  id="title' + i.toString() + '" placeholder ="Nombre de evaluacion" ></div>' +
291
-                    '<div class ="form-group col-md-2">' +
292
-                    '<label for="min' + i.toString() + '">Mínimo </label>' +
293
-                    '<input class="form-control" type="number" id="assoc_min' + i.toString() + '" min="1" max = "' + maximum + '" oninput ="changedMin(' + "'assoc_min" + i.toString() + "', '" + i.toString() + "', 'Assoc_Scales' " + ')" name = "assoc_min[]"></div>' +
294
-                    '<div class ="form-group col-md-2">' +
295
-                    '<label for="max' + i.toString() + '">Máximo </label>' +
296
-                    '<input class="form-control" type="number" id="assoc_max' + i.toString() + '" min="1" max = "' + maximum + '" oninput ="changedMax(' + "'assoc_max" + i.toString() + "', '" + i.toString() + "', 'Assoc_Scales' " + ')" name = "assoc_max[]"></div></div>' +
297
-                    '<div class ="form-group">' +
298
-                    '<label for ="descripcion' + i.toString() + '">Descripción de evaluación</label>' +
299
-                    '<textarea class="form-control" rows="2" aria-labelledby="descripcion' + i.toString() + '" name="assoc_scales[]" cols="50" ></textarea></div></div>';
300
-                fullDiv += div;
301
-
302
-
303
-            }
304
-
305
-            $('#' + Scales).append(fullDiv);
306
-            $('#' + Scales).attr('data-value', amountOfScale);
307
-        } else {
308
-            for (var i = dataValue; i > amountOfScale; i--) {
309
-                $('#assoc_eval' + (i - 1).toString()).remove();
310
-            }
311
-        }
312
-        $('#' + Scales).attr('data-value', amountOfScale);
313
-
314
-    }
315
-
316
-    function addOptions(select, max, scaleDiv) {
317
-        var maxscore = parseInt($('#' + max).val())
318
-        options = '';
319
-        for (var i = 1; i <= maxscore; i++) {
320
-            options += '<option value="' + i.toString() + '">' + i.toString() + '</option>';
321
-
322
-        }
323
-
324
-        var previousvalue = parseInt($('#' + select).val());
325
-        $('#' + select).html(options);
326
-        $('#' + select).val(previousvalue);
327
-        $('#' + select).selectpicker('refresh');
328
-
329
-        var attribute = parseInt($('#' + scaleDiv).attr('data-value'));
330
-
331
-        for (var i = 0; i < attribute; i++) {
332
-            $('#max' + i.toString()).attr('max', maxscore);
333
-            $('#min' + i.toString()).attr('max', maxscore);
334
-        }
335
-
336
-    }
337
-
338
-
339
-
340
-    function numberOfScales(string, Scales) {
341
-        var maximum = $('#maximum_score').val();
342
-        var amountOfScale = parseInt($('#' + string).val());
343
-        var dataValue = parseInt($('#' + Scales).attr('data-value'));
344
-        //add
345
-        if (dataValue < amountOfScale) {
346
-
347
-            fullDiv = '';
348
-
349
-            for (var i = dataValue; i < amountOfScale; i++) {
350
-                div = '<div id="eval' + i.toString() + Scales + '">' +
351
-                    '<div class ="form-row">' +
352
-                    '<label for="header' + (i).toString() + '">Evaluación ' + (i + 1).toString() + '</label><br><br>' +
353
-                    '<input type="hidden"  id="header' + i.toString() + '">' +
354
-                    '<div class="form-group col-md-8" >' +
355
-                    '<label for="title' + i.toString() + '">Nombre de Evaluación ' + (i + 1).toString() + '</label>' +
356
-                    '<input class="form-control" name="title[]" type="text"  id="title' + i.toString() + '" placeholder ="Nombre de evaluacion" ></div>' +
357
-                    '<div class ="form-group col-md-2">' +
358
-                    '<label for="min' + i.toString() + '">Mínimo </label>' +
359
-                    '<input class="form-control" type="number" id="min' + i.toString() + '" min="1" max = "' + maximum + '" oninput ="changedMin(' + "'min" + i.toString() + "', '" + i.toString() + "', 'Scales' " + ')" name = "min[]"></div>' +
360
-                    '<div class ="form-group col-md-2">' +
361
-                    '<label for="max' + i.toString() + '">Máximo </label>' +
362
-                    '<input class="form-control" type="number" id="max' + i.toString() + '" min="1" max = "' + maximum + '" oninput ="changedMax(' + "'max" + i.toString() + "', '" + i.toString() + "', 'Scales' " + ')" name = "max[]"></div></div>' +
363
-                    '<div class ="form-group">' +
364
-                    '<label for ="descripcion' + i.toString() + '">Descripción de evaluación</label>' +
365
-                    '<textarea class="form-control" rows="2" aria-labelledby="descripcion' + i.toString() + '" name="' + Scales + '[]" cols="50" ></textarea></div></div>';
366
-                fullDiv += div;
367
-            }
368
-
369
-            $('#' + Scales).append(fullDiv);
370
-
371
-        } else {
372
-            for (var i = dataValue; i > amountOfScale; i--) {
373
-                $('#eval' + (i - 1).toString() + Scales).remove();
374
-            }
375
-        }
376
-        $('#' + Scales).attr('data-value', amountOfScale);
377
-
378
-    }
379
-
380
-    function changedMin(min, index, scaleDiv) {
381
-        var maximum = parseInt($('#' + min).val()) + 1;
382
-        var maxScaleScore = parseInt($('#' + scaleDiv).attr('data-value'));
383
-
384
-        for (var i = parseInt(index); i < maxScaleScore; i++) {
385
-            $('#max' + i).attr('min', maximum);
386
-
387
-        }
388
-
389
-    }
390
-
391
-    function changedMax(max, index, scaleDiv) {
392
-        var maximum = parseInt($('#' + max).val()) + 1;
393
-        var maxScaleScore = parseInt($('#' + scaleDiv).attr('data-value'));
394
-
395
-        for (var i = parseInt(index) + 1; i < maxScaleScore; i++) {
396
-            $('#min' + i).attr('min', maximum)
397
-
398
-        }
399
-
400
-
401
-    }
402
 
248
 
249
+ 
403
     //Add outcome Button
250
     //Add outcome Button
404
     function addOutcomeTest() {
251
     function addOutcomeTest() {
405
         counter = parseInt($('#outcomeGroup').data("value"));
252
         counter = parseInt($('#outcomeGroup').data("value"));
522
     function addObjectiveTest() {
369
     function addObjectiveTest() {
523
         selectObj = document.getElementById('objective_0').innerHTML;
370
         selectObj = document.getElementById('objective_0').innerHTML;
524
         counter = $("#objectiveGroup").data('value');
371
         counter = $("#objectiveGroup").data('value');
525
-        $('#objectiveGroup')
372
+       
526
         var $select = $('<select/>', {
373
         var $select = $('<select/>', {
527
             'class': "selectpicker form-control",
374
             'class': "selectpicker form-control",
528
             'name': "objective[]",
375
             'name': "objective[]",
750
 
597
 
751
     //after post
598
     //after post
752
 
599
 
753
-    fetchAllCriterion("select-program", "assoc_outcomes_fetch");
600
+
754
     //For editing criterion
601
     //For editing criterion
755
     function fetchAllCriterion(program, outcome) {
602
     function fetchAllCriterion(program, outcome) {
756
         var program_id_fetch = $('#' + program).find(':selected').val();
603
         var program_id_fetch = $('#' + program).find(':selected').val();
800
 
647
 
801
                 if (!(json.activity_criterion.length)) {
648
                 if (!(json.activity_criterion.length)) {
802
 
649
 
803
-                    $('#DeleteButton').prop('disabled', true);
650
+                    $('#DeleteButton').prop('enabled', true);
804
 
651
 
805
                 } else {
652
                 } else {
806
-                    $('#DeleteButton').prop('enabled', true);
653
+                    $('#DeleteButton').prop('disabled', true);
807
                 }
654
                 }
808
 
655
 
809
                 if (!(json.criteria.length)) {
656
                 if (!(json.criteria.length)) {
961
                 // Select status
808
                 // Select status
962
 
809
 
963
 
810
 
964
-                scaleLength = json.scales.length;
965
-                fullDiv = '';
966
-                if (!scaleLength) {
967
-                    div = '<div id="assoc_eval 0"">' +
968
-                        '<div class ="form-row">' +
969
-                        '<label for="header0">Evaluación 1</label><br><br>' +
970
-                        '<input type="hidden"  id="header0">' +
971
-                        '<div class="form-group col-md-8" >' +
972
-                        '<label for="title0">Nombre de Evaluación 1</label>' +
973
-                        '<input class="form-control" name="assoc_title[]" value =" "type="text"  id="title0" placeholder ="Nombre de evaluacion" ></div>' +
974
-                        '<div class ="form-group col-md-2">' +
975
-                        '<label for="min0">Mínimo </label>' +
976
-                        '<input class="form-control" type="number" id="assoc_min0" min="1" max = "1" value =" " name = "assoc_min[]"></div>' +
977
-                        '<div class ="form-group col-md-2">' +
978
-                        '<label for="max">Máximo </label>' +
979
-                        '<input class="form-control" type="number" id="assoc_max" min="1" max = "" value =" " name = "assoc_max[]"></div></div>' +
980
-                        '<div class ="form-group">' +
981
-                        '<label for ="descripcion">Descripción de evaluación</label>' +
982
-                        '<textarea class="form-control" rows="2" aria-labelledby="descripcion" name="assoc_scales[]" cols="50" ></textarea></div></div>';
983
-                    fullDiv += div;
984
-                } else {
985
-                    var dataValue = parseInt($('#Assoc_Scales').attr('data-value'));
986
-                    $('#assoc_maximum_score').val(json.criteria[0].maximum_score);
987
-                    var maximum = json.criteria[0].maximum_score;
988
-
989
-
990
-                    $('#Assoc_Scales').html(' ');
991
-                    for (var i = 0; i < scaleLength; i++) {
992
-
993
-                        div = '<div id="assoc_eval' + i.toString() + '">' +
994
-                            '<div class ="form-row">' +
995
-                            '<label for="header' + (i).toString() + '">Evaluación ' + (i + 1).toString() + '</label><br><br>' +
996
-                            '<input type="hidden"  id="header' + i.toString() + '">' +
997
-                            '<div class="form-group col-md-8" >' +
998
-                            '<label for="title' + i.toString() + '">Nombre de Evaluación ' + (i + 1).toString() + '</label>' +
999
-                            '<input class="form-control" name="assoc_title[]" value ="' + json.scales[i].title + '"type="text"  id="title' + i.toString() + '" placeholder ="Nombre de evaluacion" ></div>' +
1000
-                            '<div class ="form-group col-md-2">' +
1001
-                            '<label for="min' + i.toString() + '">Mínimo </label>' +
1002
-                            '<input class="form-control" type="number" id="assoc_min' + i.toString() + '" min="1" max = "' + maximum + '" value ="' + json.scales[i].min_score + '"oninput ="changedMin(' + "'assoc_min" + i.toString() + "', '" + i.toString() + "', 'Assoc_Scales' " + ')" name = "assoc_min[]"></div>' +
1003
-                            '<div class ="form-group col-md-2">' +
1004
-                            '<label for="max' + i.toString() + '">Máximo </label>' +
1005
-                            '<input class="form-control" type="number" id="assoc_max' + i.toString() + '" min="1" max = "' + maximum + '" value ="' + json.scales[i].max_score + '"oninput ="changedMax(' + "'assoc_max" + i.toString() + "', '" + i.toString() + "', 'Assoc_Scales' " + ')" name = "assoc_max[]"></div></div>' +
1006
-                            '<div class ="form-group">' +
1007
-                            '<label for ="descripcion' + i.toString() + '">Descripción de evaluación</label>' +
1008
-                            '<textarea class="form-control" rows="2" aria-labelledby="descripcion' + i.toString() + '" name="assoc_scales[]" cols="50" >' + json.scales[i].description + '</textarea></div></div>';
1009
-                        fullDiv += div;
1010
-
1011
-                    }
1012
-                }
1013
-
1014
-                addOptions('Num_assoc_scale', 'assoc_maximum_score');
1015
-
1016
-                $('#Assoc_Scales').append(fullDiv);
1017
-                $('#Assoc_Scales').attr('data-value', scaleLength);
1018
-                $('#Num_assoc_scale').val(scaleLength);
1019
-                $('#Num_assoc_scale').selectpicker('refresh')
1020
-
1021
-
1022
 
811
 
1023
 
812
 
1024
 
813
 
1042
 fetchCriterionForEditing();
831
 fetchCriterionForEditing();
1043
 fetchObjectiveForSelect('outcomeGroup', 'objectiveGroup');
832
 fetchObjectiveForSelect('outcomeGroup', 'objectiveGroup');
1044
 // setCriterionStatus();
833
 // setCriterionStatus();
1045
-
834
+fetchAllCriterion("select-program", "assoc_outcomes_fetch");
1046
 
835
 
1047
 
836
 
1048
 
837
 
1089
 {
878
 {
1090
 $(this).next().stop().slideToggle();
879
 $(this).next().stop().slideToggle();
1091
 })
880
 })
1092
-
881
+$('.filterButton').on('click', function(e) {
882
+    
883
+        // Prevent the default action of the clicked item. In this case that is submit
884
+    
885
+        e.preventDefault();
886
+    
887
+        
888
+    
889
+        
890
+    
891
+        return false;
892
+    
893
+        });
1093
 //$('#outcome[0]').on('change', function(){
894
 //$('#outcome[0]').on('change', function(){
1094
 //fetchObjectiveForSelect(0);
895
 //fetchObjectiveForSelect(0);
1095
 //$('.selectpicker').selectpicker('refresh');
896
 //$('.selectpicker').selectpicker('refresh');

+ 70
- 1
app/views/local/managers/sCoords/objectives.blade.php View File

65
             <div class="panel-heading">
65
             <div class="panel-heading">
66
                 Edit
66
                 Edit
67
             </div>
67
             </div>
68
-            <div class="panel-body">
68
+            <button class="btn btn-md btn-secondary filterButton">
69
+                <span class="glyphicon glyphicon-plus">
70
+                </span>
71
+                Filters
72
+              </button>
73
+              <div class="panel-body">
74
+              <div class='filterSection'>
75
+            
69
                 {{ Form::open(array('action' => 'Objective2Controller@update')) }}
76
                 {{ Form::open(array('action' => 'Objective2Controller@update')) }}
77
+                
78
+                <div class="form-group">
79
+                    {{ Form::label('program_id2', 'Associated Program')}}
80
+                    <select id='select-program' class="form-control selectpicker" onchange='fetchAllObjectives("select-program", "assoc_outcomes_fetch")'>
81
+                        @foreach ($programs as $program)
82
+                        <option value='{{$program->id}}' data-subtext="{{$program->code}}">{{$program->name}}</option>
83
+                        @endforeach
84
+                    </select>
85
+                </div>
86
+                <div class="form-group">
87
+                    <label>Associated Outcome</label>
88
+                    {{ Form::select('assoc_outcome_fetch', $outcomes, null, ['class'=>'form-control selectpicker', 'id'=>'assoc_outcomes_fetch', 'onchange'=>'fetchAllObjectives("select-program", "assoc_outcomes_fetch")']) }}
70
 
89
 
90
+                </div>
91
+                  </div>
71
                 <div class="form-group">
92
                 <div class="form-group">
72
                     {{ Form::label('objective_id', 'Objectives') }}
93
                     {{ Form::label('objective_id', 'Objectives') }}
73
                     <select id="select-objective" name="id" class="form-control selectpicker">
94
                     <select id="select-objective" name="id" class="form-control selectpicker">
131
                     {{ Form::label('text', 'Text') }}
152
                     {{ Form::label('text', 'Text') }}
132
                     {{ Form::text('text', Input::old('text'), array('class' => 'form-control', 'id'=>'objective-text')) }}
153
                     {{ Form::text('text', Input::old('text'), array('class' => 'form-control', 'id'=>'objective-text')) }}
133
                 </div>
154
                 </div>
155
+                <div id="text">
156
+
157
+                </div>
158
+
134
                 {{ Form::submit('Update', array('class' => 'btn btn-primary btn-block')) }}
159
                 {{ Form::submit('Update', array('class' => 'btn btn-primary btn-block')) }}
135
                 {{ Form::close() }}
160
                 {{ Form::close() }}
161
+                <form action="/deleteObjective" method="POST" id='deleteObj'>
162
+                
163
+                    
164
+                                    </form>
136
             </div>
165
             </div>
137
 
166
 
138
 
167
 
142
     </div>
171
     </div>
143
 </div>
172
 </div>
144
 <script>
173
 <script>
174
+        $('.filterSection').hide();
175
+	
176
+    $('.filterButton').on('click', function()
177
+{
178
+  var span = $(this).find('span');
179
+  if(span.attr('class') == 'glyphicon glyphicon-plus'){
180
+    span.attr('class','glyphicon glyphicon-minus');
181
+  } else{	
182
+    span.attr('class','glyphicon glyphicon-plus');
183
+	
184
+  }
185
+
186
+  $('.filterSection').toggle(533);
187
+
188
+});
145
     var outcomeHTML = document.getElementById('outcomeGroup').innerHTML;
189
     var outcomeHTML = document.getElementById('outcomeGroup').innerHTML;
146
     var selectOptions = document.getElementById('outcome[0]').innerHTML;
190
     var selectOptions = document.getElementById('outcome[0]').innerHTML;
191
+
192
+    
193
+    function fetchAllObjectives(program, outcome) {
194
+        var program_id_fetch = $('#' + program).find(':selected').val();
195
+        var outcome_fetch = $('#' + outcome).find(':selected').val();
196
+        $.post(
197
+            "{{URL::action('Objective2Controller@fetchAllObjectives')}}", {
198
+                program_fetch: program_id_fetch,
199
+                outcome_fetch: outcome_fetch
200
+            },
201
+            function(json) {
202
+                json_length = (json.objective.length);
203
+                fullHTML = '';
204
+                for (var i = 0; i < json_length; i++) {
205
+                    fullHTML += '<option value="' + json.objective[i].id + '">' + json.objective[i].text + '</option>';
206
+                }
207
+                $('#select-objective').html(fullHTML);
208
+                $('#select-objective').selectpicker('refresh');
209
+                fetchObjectiveForEditing();
210
+
211
+            },
212
+            'json'
213
+        );
214
+    }
147
     var ran = false;
215
     var ran = false;
148
 
216
 
149
     var counter = 1;
217
     var counter = 1;
430
 fetchObjectiveForEditing();
498
 fetchObjectiveForEditing();
431
 // setCriterionStatus();
499
 // setCriterionStatus();
432
 
500
 
501
+fetchAllObjectives("select-program", "assoc_outcomes_fetch")
433
 
502
 
434
 
503
 
435
 
504
 

+ 2
- 4
app/views/local/managers/sCoords/view-annual-plans.blade.php View File

106
         transformative:transformative, 
106
         transformative:transformative, 
107
         annual_id: an_id}
107
         annual_id: an_id}
108
         )
108
         )
109
-     
110
-  
111
-                                 }
109
+    }
112
 
110
 
113
 
111
 
114
 function fetchInfoTrans(){
112
 function fetchInfoTrans(){
120
                                     function(json){
118
                                     function(json){
121
                                       json_to_use = json;
119
                                       json_to_use = json;
122
                                       $('#report_print').click();
120
                                       $('#report_print').click();
123
-                                       $('#trans_print').click();
121
+                                      $('#trans_print').click();
124
                                     },
122
                                     },
125
                                     'json'
123
                                     'json'
126
 
124