Browse Source

Arreglo a criterios

parent
commit
79789abf3a

+ 14
- 12
app/controllers/ActivitiesController.php View File

513
                 DB::table('activities')
513
                 DB::table('activities')
514
                     ->where('id', Input::get('id'))
514
                     ->where('id', Input::get('id'))
515
                     ->update(array(
515
                     ->update(array(
516
-                        'draft' => 0,
517
-                        'outcomes_attempted' => NULL,
518
-                        'outcomes_achieved' => NULL,
519
-                        'criteria_achieved' => NULL,
520
-                        'transforming_actions' => NULL,
516
+                        'draft' => 1,
521
                         'assessment_comments' => NULL,
517
                         'assessment_comments' => NULL,
522
-                        'criteria_achieved_percentage' => NULL,
518
+
519
+
520
+
523
                         'updated_at' => date('Y-m-d H:i:s')
521
                         'updated_at' => date('Y-m-d H:i:s')
524
                     ));
522
                     ));
525
 
523
 
526
                 // Delete students score
524
                 // Delete students score
527
-                DB::table('assessments')->where('activity_id', $activity->id)->delete();
525
+
526
+                DB::table('assessments')
527
+                    ->join('activity_criterion', 'assessments.activity_criterion_id', '=', 'activity_criterion.id')
528
+                    ->where('activity_id', $activity->id)->delete();
528
 
529
 
529
                 // Recalculate course outcomes
530
                 // Recalculate course outcomes
530
                 /*$activities = DB::table('activities')
531
                 /*$activities = DB::table('activities')
615
 
616
 
616
         if (Activity::destroy($id)) {
617
         if (Activity::destroy($id)) {
617
             // Recalculate course outcomes
618
             // Recalculate course outcomes
618
-            $activities = $course->activities;
619
+            /*$activities = $course->activities;
619
 
620
 
620
             // Check if any assessed activties remain
621
             // Check if any assessed activties remain
621
             $remainingAssessed = false;
622
             $remainingAssessed = false;
664
             } else {
665
             } else {
665
                 $course->outcomes_achieved = NULL;
666
                 $course->outcomes_achieved = NULL;
666
                 $course->outcomes_attempted = NULL;
667
                 $course->outcomes_attempted = NULL;
667
-            }
668
+            } */
668
 
669
 
669
-            if ($course->save()) {
670
+            /*if ($course->save()) {
670
                 Session::flash('status', 'success');
671
                 Session::flash('status', 'success');
671
                 Session::flash('message', 'Activity deleted.');
672
                 Session::flash('message', 'Activity deleted.');
672
             } else {
673
             } else {
673
                 Session::flash('status', 'danger');
674
                 Session::flash('status', 'danger');
674
                 Session::flash('message', 'Error deleting activity. Try again later.');
675
                 Session::flash('message', 'Error deleting activity. Try again later.');
675
                 return Redirect::back();
676
                 return Redirect::back();
676
-            }
677
-
677
+            }*/
678
+            Session::flash('status', 'success');
679
+            Session::flash('message', 'Activity deleted.');
678
             return Redirect::action('CoursesController@show', array($course->id));
680
             return Redirect::action('CoursesController@show', array($course->id));
679
         } else {
681
         } else {
680
             Session::flash('status', 'danger');
682
             Session::flash('status', 'danger');

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

161
         }*/
161
         }*/
162
 
162
 
163
         $criterion =  DB::table('criteria')->where('id', Input::get('id'))->first();
163
         $criterion =  DB::table('criteria')->where('id', Input::get('id'))->first();
164
+        if (!$criterion) return $criterion;
164
         $criterion->outcomes = DB::table('criterion_objective_outcome')
165
         $criterion->outcomes = DB::table('criterion_objective_outcome')
165
             ->join('outcomes', 'outcomes.id', '=', 'criterion_objective_outcome.outcome_id')
166
             ->join('outcomes', 'outcomes.id', '=', 'criterion_objective_outcome.outcome_id')
166
             ->where('criterion_id', $criterion->id)
167
             ->where('criterion_id', $criterion->id)
168
+            ->select('outcomes.*')
167
             ->distinct()
169
             ->distinct()
168
             ->get();
170
             ->get();
169
 
171
 
170
         foreach ($criterion->outcomes as $outcome) {
172
         foreach ($criterion->outcomes as $outcome) {
171
             $outcome->assoc_objectives = DB::table('objective_outcome')
173
             $outcome->assoc_objectives = DB::table('objective_outcome')
172
                 ->join('objectives', 'objectives.id', '=', 'objective_outcome.objective_id')
174
                 ->join('objectives', 'objectives.id', '=', 'objective_outcome.objective_id')
173
-                ->where('outcome_id', $outcome->outcome_id)
175
+                ->where('outcome_id', $outcome->id)
174
                 ->get();
176
                 ->get();
175
             $outcome->objectives_criteria = DB::table('criterion_objective_outcome')
177
             $outcome->objectives_criteria = DB::table('criterion_objective_outcome')
176
                 ->join('objectives', 'objectives.id', '=', 'criterion_objective_outcome.objective_id')
178
                 ->join('objectives', 'objectives.id', '=', 'criterion_objective_outcome.objective_id')

+ 2
- 0
app/controllers/ObjectivesController.php View File

243
 
243
 
244
     $criteria_scales = DB::table('criteria')
244
     $criteria_scales = DB::table('criteria')
245
       ->join('criterion_objective_outcome as cobo', 'criterion_id', '=', 'criteria.id')
245
       ->join('criterion_objective_outcome as cobo', 'criterion_id', '=', 'criteria.id')
246
+      ->join('program_criterion', 'cobo.criterion_id', '=', 'program_criterion.criterion_id')
247
+      ->whereIn('program_id', $program_ids)
246
       ->where('objective_id', $objective->id)
248
       ->where('objective_id', $objective->id)
247
       ->select('num_scales')
249
       ->select('num_scales')
248
       ->orderBy('num_scales', 'DESC')
250
       ->orderBy('num_scales', 'DESC')

+ 79
- 4
app/controllers/OutcomesController.php View File

410
         if (Input::get('filter')) {
410
         if (Input::get('filter')) {
411
             switch (Input::get('filter')) {
411
             switch (Input::get('filter')) {
412
                 case 'all':
412
                 case 'all':
413
-                    return DB::table('criteria')
413
+                    $criteria = DB::table('criteria')
414
                         ->join('criterion_objective_outcome', 'criterion_objective_outcome.criterion_id', '=', 'criteria.id')
414
                         ->join('criterion_objective_outcome', 'criterion_objective_outcome.criterion_id', '=', 'criteria.id')
415
                         ->where('criterion_objective_outcome.outcome_id', '=', Input::get('outcome_id'))
415
                         ->where('criterion_objective_outcome.outcome_id', '=', Input::get('outcome_id'))
416
                         ->where('criterion_objective_outcome.objective_id', '=', Input::get('objective_id'))
416
                         ->where('criterion_objective_outcome.objective_id', '=', Input::get('objective_id'))
419
                         ->select('criterion_id as id', 'name')
419
                         ->select('criterion_id as id', 'name')
420
                         ->orderBy('name', 'ASC')
420
                         ->orderBy('name', 'ASC')
421
                         ->get();
421
                         ->get();
422
+
423
+                    foreach ($criteria as $criterion) {
424
+                        $criterion->program_ids = json_encode(DB::table('program_criterion')
425
+                            ->where('criterion_id', $criterion->id)
426
+                            ->lists('program_id'));
427
+                        $criterion->objectives = json_encode(DB::table('criterion_objective_outcome')
428
+                            ->join('objectives', 'objectives.id', '=', 'criterion_objective_outcome.objective_id')
429
+                            ->where('criterion_id', $criterion->id)
430
+                            ->select('objectives.*')
431
+                            ->distinct()
432
+                            ->lists('text'));
433
+                    }
434
+                    return $criteria;
422
                     break;
435
                     break;
423
 
436
 
424
                 case 'school':
437
                 case 'school':
438
                             ->select('criterion_id as id', 'name')
451
                             ->select('criterion_id as id', 'name')
439
                             ->orderBy('name', 'ASC')
452
                             ->orderBy('name', 'ASC')
440
                             ->get();
453
                             ->get();
454
+                        foreach ($criteria as $criterion) {
455
+                            $criterion->program_ids = json_encode(DB::table('program_criterion')
456
+                                ->where('criterion_id', $criterion->id)
457
+                                ->lists('program_id'));
458
+                            $criterion->objectives = json_encode(DB::table('criterion_objective_outcome')
459
+                                ->join('objectives', 'objectives.id', '=', 'criterion_objective_outcome.objective_id')
460
+                                ->where('criterion_id', $criterion->id)
461
+                                ->select('objectives.*')
462
+                                ->distinct()
463
+                                ->lists('text'));
464
+                        }
441
                         // Return all criteria belonging to any of those programs
465
                         // Return all criteria belonging to any of those programs
442
                         return $criteria;
466
                         return $criteria;
443
                     }
467
                     }
446
                     else {
470
                     else {
447
 
471
 
448
                         // Fetch all the programs from the user's school;
472
                         // Fetch all the programs from the user's school;
473
+                        // Fetch all the programs from the user's school;
449
                         $program_ids = DB::table('programs')->where('school_id', Auth::user()->programs[0]->school->id)->lists('id');
474
                         $program_ids = DB::table('programs')->where('school_id', Auth::user()->programs[0]->school->id)->lists('id');
450
 
475
 
451
-                        return DB::table('criteria')
476
+                        $criteria = DB::table('criteria')
452
                             ->join('criterion_objective_outcome', 'criterion_objective_outcome.criterion_id', '=', 'criteria.id')
477
                             ->join('criterion_objective_outcome', 'criterion_objective_outcome.criterion_id', '=', 'criteria.id')
453
                             ->join('program_criterion', 'program_criterion.criterion_id', '=', 'criteria.id')
478
                             ->join('program_criterion', 'program_criterion.criterion_id', '=', 'criteria.id')
454
                             ->where('criterion_objective_outcome.outcome_id', '=', Input::get('outcome_id'))
479
                             ->where('criterion_objective_outcome.outcome_id', '=', Input::get('outcome_id'))
459
                             ->select('criterion_id as id', 'name')
484
                             ->select('criterion_id as id', 'name')
460
                             ->orderBy('name', 'ASC')
485
                             ->orderBy('name', 'ASC')
461
                             ->get();
486
                             ->get();
487
+
488
+                        foreach ($criteria as $criterion) {
489
+                            $criterion->program_ids = json_encode(DB::table('program_criterion')
490
+                                ->where('criterion_id', $criterion->id)
491
+                                ->lists('program_id'));
492
+                            $criterion->objectives = json_encode(DB::table('criterion_objective_outcome')
493
+                                ->join('objectives', 'objectives.id', '=', 'criterion_objective_outcome.objective_id')
494
+                                ->where('criterion_id', $criterion->id)
495
+                                ->select('objectives.*')
496
+                                ->distinct()
497
+                                ->lists('text'));
498
+                        }
499
+                        return $criteria;
462
                     }
500
                     }
463
 
501
 
464
                     break;
502
                     break;
475
                         ->select('criterion_id as id', 'name')
513
                         ->select('criterion_id as id', 'name')
476
                         ->orderBy('name', 'ASC')
514
                         ->orderBy('name', 'ASC')
477
                         ->get();
515
                         ->get();
516
+                    foreach ($criteria as $criterion) {
517
+                        $criterion->program_ids = json_encode(DB::table('program_criterion')
518
+                            ->where('criterion_id', $criterion->id)
519
+                            ->lists('program_id'));
520
+                        $criterion->objectives = json_encode(DB::table('criterion_objective_outcome')
521
+                            ->join('objectives', 'objectives.id', '=', 'criterion_objective_outcome.objective_id')
522
+                            ->where('criterion_id', $criterion->id)
523
+                            ->select('objectives.*')
524
+                            ->distinct()
525
+                            ->lists('text'));
526
+                    }
478
                     return $criteria;
527
                     return $criteria;
479
                     break;
528
                     break;
480
 
529
 
481
                 default:
530
                 default:
482
-                    return DB::table('criteria')
531
+                    $criteria = DB::table('criteria')
483
                         ->join('criterion_objective_outcome', 'criterion_objective_outcome.criterion_id', '=', 'criteria.id')
532
                         ->join('criterion_objective_outcome', 'criterion_objective_outcome.criterion_id', '=', 'criteria.id')
484
                         ->where('criterion_objective_outcome.outcome_id', '=', Input::get('outcome_id'))
533
                         ->where('criterion_objective_outcome.outcome_id', '=', Input::get('outcome_id'))
485
                         ->where('criterion_objective_outcome.objective_id', '=', Input::get('objective_id'))
534
                         ->where('criterion_objective_outcome.objective_id', '=', Input::get('objective_id'))
488
                         ->select('criterion_id as id', 'name')
537
                         ->select('criterion_id as id', 'name')
489
                         ->orderBy('name', 'ASC')
538
                         ->orderBy('name', 'ASC')
490
                         ->get();
539
                         ->get();
540
+
541
+                    foreach ($criteria as $criterion) {
542
+                        $criterion->program_ids = json_encode(DB::table('program_criterion')
543
+                            ->where('criterion_id', $criterion->id)
544
+                            ->lists('program_id'));
545
+                        $criterion->objectives = json_encode(DB::table('criterion_objective_outcome')
546
+                            ->join('objectives', 'objectives.id', '=', 'criterion_objective_outcome.objective_id')
547
+                            ->where('criterion_id', $criterion->id)
548
+                            ->select('objectives.*')
549
+                            ->distinct()
550
+                            ->lists('text'));
551
+                    }
552
+                    return $criteria;
491
                     break;
553
                     break;
492
             }
554
             }
493
         } else {
555
         } else {
494
-            return DB::table('criteria')
556
+            $criteria = DB::table('criteria')
495
                 ->join('criterion_objective_outcome', 'criterion_objective_outcome.criterion_id', '=', 'criteria.id')
557
                 ->join('criterion_objective_outcome', 'criterion_objective_outcome.criterion_id', '=', 'criteria.id')
496
                 ->where('criterion_objective_outcome.outcome_id', '=', Input::get('outcome_id'))
558
                 ->where('criterion_objective_outcome.outcome_id', '=', Input::get('outcome_id'))
497
                 ->where('criterion_objective_outcome.objective_id', '=', Input::get('objective_id'))
559
                 ->where('criterion_objective_outcome.objective_id', '=', Input::get('objective_id'))
500
                 ->select('criterion_id as id', 'name')
562
                 ->select('criterion_id as id', 'name')
501
                 ->orderBy('name', 'ASC')
563
                 ->orderBy('name', 'ASC')
502
                 ->get();
564
                 ->get();
565
+
566
+            foreach ($criteria as $criterion) {
567
+                $criterion->program_ids = json_encode(DB::table('program_criterion')
568
+                    ->where('criterion_id', $criterion->id)
569
+                    ->lists('program_id'));
570
+                $criterion->objectives = json_encode(DB::table('criterion_objective_outcome')
571
+                    ->join('objectives', 'objectives.id', '=', 'criterion_objective_outcome.objective_id')
572
+                    ->where('criterion_id', $criterion->id)
573
+                    ->select('objectives.*')
574
+                    ->distinct()
575
+                    ->lists('text'));
576
+            }
577
+            return $criteria;
503
         }
578
         }
504
     }
579
     }
505
 
580
 

+ 96
- 77
app/views/local/managers/admins/criteria.blade.php View File

119
                 Edit
119
                 Edit
120
             </div>
120
             </div>
121
             <div class="panel-body">
121
             <div class="panel-body">
122
-                {{ Form::open(array('action' => 'CriteriaController@update')) }}
122
+                {{ Form::open(array('action' => 'CriteriaController@update','id'=>'update_criterion')) }}
123
                 <button class="btn btn-md btn-secondary filterButton">
123
                 <button class="btn btn-md btn-secondary filterButton">
124
                     <span class="glyphicon glyphicon-plus">
124
                     <span class="glyphicon glyphicon-plus">
125
                     </span>
125
                     </span>
163
                     <div id='assocOutcomeGroup0' data-value="1">
163
                     <div id='assocOutcomeGroup0' data-value="1">
164
                         <div class="form-group col-md-12">
164
                         <div class="form-group col-md-12">
165
                             <label>Outcome 1</label>
165
                             <label>Outcome 1</label>
166
-                            {{ Form::select('outcome[]', $outcomes, null, ['class'=>'form-control selectpicker', 'id'=>'assoc_outcome_0', 'onchange'=>'fetchAssocObjective("assoc_outcome_0")']) }}
166
+                            {{ Form::select('outcome[]', $outcomes, null, ['class'=>'form-control selectpicker', 'id'=>'assoc_outcome_0', 'onchange'=>'fetchObjectiveForSelect("assoc_outcome_0", "assoc_objectiveGroupFor0")']) }}
167
     
167
     
168
                         </div>
168
                         </div>
169
     <div id='assoc_objectiveGroupFor0' data-value="1">
169
     <div id='assoc_objectiveGroupFor0' data-value="1">
549
         $div.remove();
549
         $div.remove();
550
         $div = document.getElementById(closeObj);
550
         $div = document.getElementById(closeObj);
551
         $div.remove();
551
         $div.remove();
552
-        //counter = parseInt($('#'+objectiveGroup).data("value"));
553
-        //$('#'+objectiveGroup).data("value", counter-1);
552
+        counter = parseInt($('#'+objectiveGroup).data("value"));
553
+        $('#'+objectiveGroup).data("value", counter-1);
554
 
554
 
555
 
555
 
556
     }
556
     }
653
             'name': "outcome[]",
653
             'name': "outcome[]",
654
             'data-live-search': 'true',
654
             'data-live-search': 'true',
655
             'id': 'assoc_outcome_' + assocOutcomeCounter.toString(),
655
             'id': 'assoc_outcome_' + assocOutcomeCounter.toString(),
656
-            'onchange': 'fetchAssocObjective("assoc_outcome_' + assocOutcomeCounter.toString() + '", "assoc_objectiveGroupFor'+assocOutcomeCounter+'")'
656
+            'onchange': 'fetchObjectiveForSelect("assoc_outcome_' + assocOutcomeCounter.toString() + '", "assoc_objectiveGroupFor'+assocOutcomeCounter+'")'
657
 
657
 
658
         });
658
         });
659
         var $div = $('<div/>', {
659
         var $div = $('<div/>', {
763
                 allOutcomes: allOutcomes
763
                 allOutcomes: allOutcomes
764
             },
764
             },
765
 
765
 
766
-            function(json) {
766
+            function(varArray) {
767
 
767
 
768
                 optionName = '<option value ="0">Nothing Selected</option>';
768
                 optionName = '<option value ="0">Nothing Selected</option>';
769
                 for(outcome in varArray.outcomes){
769
                 for(outcome in varArray.outcomes){
789
                 }
789
                 }
790
 
790
 
791
                 for (var i = allObjectives.length - 1; i > 0; i--) {
791
                 for (var i = allObjectives.length - 1; i > 0; i--) {
792
-                    deleteObjective('assoc_objectiveForm' + i.toString(), 'assoc_closeObj' + i.toString(), 'assoc_objectiveGroup');
793
-                }
794
-                for(var i=1; i<allObjectives.length; i++){
792
+                    deleteObjective('assoc_objectiveForm_' + objectiveGroup +'_'+i, 'assoc_closeObj_'+objectiveGroup+'_' + i.toString(), objectiveGroup);
793
+               }
794
+               /* for(var i=1; i<allObjectives.length; i++){
795
                     addAssocObjective();
795
                     addAssocObjective();
796
                     $('#assoc_objective_'+i.toString()).selectpicker('refresh');
796
                     $('#assoc_objective_'+i.toString()).selectpicker('refresh');
797
                     if($("#assoc_objective_"+i.toString()+" option[value='"+allObjectives[i].value+"']").length>0){
797
                     if($("#assoc_objective_"+i.toString()+" option[value='"+allObjectives[i].value+"']").length>0){
798
                     $("#assoc_objective_"+i.toString()).val(allObjectives[i].value);
798
                     $("#assoc_objective_"+i.toString()).val(allObjectives[i].value);
799
                     $("#assoc_objective_"+i.toString()).selectpicker("refresh");
799
                     $("#assoc_objective_"+i.toString()).selectpicker("refresh");
800
                     }
800
                     }
801
-                }
801
+                }*/
802
 
802
 
803
 
803
 
804
 
804
 
935
             "{{ URL::action('CriteriaController@fetchCriterionWithTrashed') }}", {
935
             "{{ URL::action('CriteriaController@fetchCriterionWithTrashed') }}", {
936
                 id: id
936
                 id: id
937
             },
937
             },
938
-            function(json) {
938
+            function(criterion) {
939
+
940
+                
941
+if (!(criterion.length)) {
942
+    name = ' ';
943
+    var subcriteria = '';
944
+    copyright = null;
945
+    notes = null;
946
+    $('#status').val(0);
947
+    maximum = 1;
948
+    $('#assoc_maximum_score').val(1);
939
 
949
 
940
-                if (!(json.activity_criterion.length)) {
941
 
950
 
951
+}
952
+
953
+
954
+else { 
955
+criterion = criterion[0];
956
+if (!(criterion.activity_criterion.length)) {
942
 $('#DeleteButton').prop('disabled', false);
957
 $('#DeleteButton').prop('disabled', false);
943
 $("#update_the_criterion").val('Update');
958
 $("#update_the_criterion").val('Update');
944
 $("#update_criterion").attr('action', "{{ URL::action('CriteriaController@update')}}")
959
 $("#update_criterion").attr('action', "{{ URL::action('CriteriaController@update')}}")
952
 
967
 
953
 }
968
 }
954
 
969
 
955
-                if (!(json.criteria.length)) {
956
-                    name = ' ';
957
-                    var subcriteria = '';
958
-                    copyright = null;
959
-                    notes = null;
960
-                    $('#status').val(0);
961
-                    maximum = 1;
962
-                    $('#assoc_maximum_score').val(1);
963
-
964
-
965
-                } else {
966
-                    var name = json.criteria[0].name;
967
-                    if (json.criteria[0].subcriteria) {
968
-                        subcriteria = JSON.parse(json.criteria[0].subcriteria).join('\n');
969
-                    } else {
970
+              
971
+var name = criterion.name;
972
+                    if (criterion.subcriteria) {
973
+                        subcriteria = JSON.parse(criterion.subcriteria).join('\n');
974
+ } else {
970
                         subcriteria = "";
975
                         subcriteria = "";
971
                     }
976
                     }
972
-                    if (json.criteria[0].copyright) {
973
-                        var copyright = json.criteria[0].copyright;
977
+                    if (criterion.copyright) {
978
+                        var copyright = criterion.copyright;
974
                     } else {
979
                     } else {
975
                         var copyright = ''
980
                         var copyright = ''
976
                     }
981
                     }
977
-                    if (json.criteria[0].notes) notes = json.criteria[0].notes;
978
-                    else notes = '';
982
+                    if (criterion.notes) notes = criterion.notes;
983
+                   else notes = '';
979
 
984
 
980
                     // Display info
985
                     // Display info
981
                     $('#criterion_name').val(name);
986
                     $('#criterion_name').val(name);
982
                     $('#criterion_subcriteria').text(subcriteria);
987
                     $('#criterion_subcriteria').text(subcriteria);
983
-                    if (json.criteria[0].deleted_at)
984
-                        $('#status').val(0);
988
+                    if (criterion.deleted_at)
989
+                       $('#status').val(0);
985
                     else
990
                     else
986
                         $('#status').val(1);
991
                         $('#status').val(1);
987
-                    $('#assoc_maximum_score').val(json.criteria[0].maximum_score);
988
-                    var maximum = json.criteria[0].maximum_score;
992
+                        $('#assoc_maximum_score').val(criterion.max_score);
993
+                    var maximum = criterion.max_score;
989
 
994
 
990
                     addOptions("Num_assoc_scale", "assoc_maximum_score", "Assoc_Scales");
995
                     addOptions("Num_assoc_scale", "assoc_maximum_score", "Assoc_Scales");
991
-                    $('#Num_assoc_scale').val(json.criteria[0].num_scales)
992
-                    $('#Num_assoc_scale').selectpicker('refresh');
996
+                    $('#Num_assoc_scale').val(criterion.num_scales)
997
+                   $('#Num_assoc_scale').selectpicker('refresh');
993
                     $('#Num_assoc_scale').trigger('change');
998
                     $('#Num_assoc_scale').trigger('change');
994
 
999
 
995
-                    for(i=0; i<json.criteria[0].num_scales;i++){
996
-                        $('#assoc_scale_'+i).val(json.scales[i].description);
1000
+                    for(i=0; i<criterion.num_scales;i++){
1001
+                        $('#assoc_scale_'+i).val(criterion.scales[i].description);
997
                     }
1002
                     }
998
                     // If copyright or notes aren't empty, load them
1003
                     // If copyright or notes aren't empty, load them
999
 
1004
 
1014
 
1019
 
1015
                 // Select associated outcome
1020
                 // Select associated outcome
1016
                 try {
1021
                 try {
1017
-                    assocOutcomeCounter= parseInt($("#assocOutcomeGroup0").data('value'));
1018
-                    for (var i = assocOutcomeCounter - 1; i > 0; i--) {
1022
+                    assocOutcomeCounter = parseInt($("#assocOutcomeGroup0").data('value'));
1023
+                   for (var i = assocOutcomeCounter - 1; i > 0; i--) {
1019
                         $('#assoc_close_button'+i).click();
1024
                         $('#assoc_close_button'+i).click();
1020
                                }
1025
                                }
1021
                     $('#assocOutcomeGroup0').data('value', 1); 
1026
                     $('#assocOutcomeGroup0').data('value', 1); 
1023
                     var Notran = true;
1028
                     var Notran = true;
1024
                 }
1029
                 }
1025
 
1030
 
1026
-                if (json.outcomes.length) 
1031
+                if (criterion.outcomes.length) 
1027
                     {
1032
                     {
1028
-                    $('#assoc_outcome_0').val(json.outcomes[0].id);
1029
-                    $('#assoc_outcome_0').selectpicker('refresh');
1033
+                    $('#assoc_outcome_0').val(criterion.outcomes[0].id);
1034
+                     $('#assoc_outcome_0').selectpicker('refresh');
1030
 
1035
 
1031
-                    var first_outcome_id = json.outcomes[0].id;
1036
+                     var first_outcome = criterion.outcomes[0];
1032
                     options = "<option value ='0'>Nothing Selected</option>";
1037
                     options = "<option value ='0'>Nothing Selected</option>";
1038
+                    $(first_outcome.assoc_objectives).each(function(index, objective){
1033
 
1039
 
1034
-                    for(objective_index  in json.objectives_assoc[first_outcome_id]){
1040
+options += '<option value ="('+first_outcome.id+','+objective.objective_id+')">'+
1041
+    objective.text+'</option>';
1042
+
1043
+})
1044
+                    /*for(objective_index  in json.objectives_assoc[first_outcome_id]){
1035
                         objective = json.objectives_assoc[first_outcome_id][objective_index]
1045
                         objective = json.objectives_assoc[first_outcome_id][objective_index]
1036
                         options += '<option value ="('+first_outcome_id+','+objective.objective_id+')">'+
1046
                         options += '<option value ="('+first_outcome_id+','+objective.objective_id+')">'+
1037
                             objective.text+'</option>';
1047
                             objective.text+'</option>';
1038
-                    }
1048
+                    }*/
1039
                     $('#assoc_objective_0_counter_1').html(options);
1049
                     $('#assoc_objective_0_counter_1').html(options);
1040
                     $('#assoc_objective_0_counter_1').selectpicker('refresh');
1050
                     $('#assoc_objective_0_counter_1').selectpicker('refresh');
1041
                     
1051
                     
1042
-                    if(json.objectives[first_outcome_id].length){
1043
-                        objective_id = json.objectives[first_outcome_id][0].objective_id;
1044
-                    value = '('+first_outcome_id+','+objective_id+')';
1052
+                    if(first_outcome.objectives_criteria.length){
1053
+                        objective_id = first_outcome.objectives_criteria[0].objective_id;
1054
+                    value = '('+first_outcome.id+','+objective_id+')';
1045
                     $('#assoc_objective_0_counter_1').val(value);
1055
                     $('#assoc_objective_0_counter_1').val(value);
1046
                     $('#assoc_objective_0_counter_1').selectpicker('refresh');
1056
                     $('#assoc_objective_0_counter_1').selectpicker('refresh');
1047
 
1057
 
1048
                     }
1058
                     }
1049
-                    
1059
+                    if($("#assoc_objectiveGroupFor0").find(".btn-primary").length>0){
1060
+                        $("#assoc_objectiveGroupFor0").find(".btn-primary").each(function(){
1061
+                            $(this).click()
1062
+                        })
1063
+                    }
1050
 
1064
 
1051
-                    for(var i =1; i<json.objectives[first_outcome_id].length; i++ ){
1065
+                    for(var i =1; i<first_outcome.objectives_criteria.length; i++ ){
1052
                         addAssocObjective("assoc_objectiveGroupFor0", "assoc_objective_0");
1066
                         addAssocObjective("assoc_objectiveGroupFor0", "assoc_objective_0");
1053
-                        objective_id = json.objectives[first_outcome_id][i].objective_id;
1054
-                        value = "("+first_outcome_id+","+objective_id+")";
1055
-                        $('#assoc_objective_0_counter_'+(i+1)).val(value);
1067
+                        objective_id = first_outcome.objectives_criteria[i].objective_id;
1068
+                        value = "("+first_outcome.id+","+objective_id+")";
1069
+                       $('#assoc_objective_0_counter_'+(i+1)).val(value);
1056
                         $('#assoc_objective_0_counter_'+(i+1)).selectpicker('refresh');
1070
                         $('#assoc_objective_0_counter_'+(i+1)).selectpicker('refresh');
1057
                         
1071
                         
1058
 
1072
 
1067
 
1081
 
1068
 
1082
 
1069
                
1083
                
1070
-                for (var i = 1; i < json.outcomes.length; i++) {
1084
+                for (var i = 1; i < criterion.outcomes.length; i++) {
1071
                     addAssocOutcome(true);
1085
                     addAssocOutcome(true);
1072
 
1086
 
1073
 
1087
 
1074
-                    $('#assoc_outcome_' + i.toString()).val(json.outcomes[i].id);
1075
-                    $('#assoc_outcome_' + i.toString()).selectpicker('refresh');
1088
+                    $('#assoc_outcome_' + i.toString()).val(criterion.outcomes[i].id);
1089
+                   $('#assoc_outcome_' + i.toString()).selectpicker('refresh');
1076
 
1090
 
1077
-                    var outcome_id = json.outcomes[i].id;
1078
-                    options = "<option value ='0'>Nothing Selected</option>";
1091
+                   var outcome = criterion.outcomes[i];
1092
+                  options = "<option value ='0'>Nothing Selected</option>";
1079
 
1093
 
1080
-                    for(objective_index  in json.objectives_assoc[outcome_id]){
1081
-                        objective = json.objectives_assoc[outcome_id][objective_index]
1082
-                        options += '<option value ="('+outcome_id+','+objective.objective_id+')">'+
1083
-                            objective.text+'</option>';
1084
-                    }
1094
+                  $(outcome.assoc_objectives).each(function(index, objective){
1095
+
1096
+options += '<option value ="('+outcome.id+','+objective.objective_id+')">'+
1097
+    objective.text+'</option>';
1098
+
1099
+})
1100
+                    //for(objective_index  in json.objectives_assoc[outcome_id]){
1101
+                    //    objective = json.objectives_assoc[outcome_id][objective_index]
1102
+                    //    options += '<option value ="('+outcome_id+','+objective.objective_id+')">'+
1103
+                    //        objective.text+'</option>';
1104
+                    //}
1085
                     $('#assoc_objective_'+i+'_counter_1').html(options);
1105
                     $('#assoc_objective_'+i+'_counter_1').html(options);
1086
                     $('#assoc_objective_'+i+'_counter_1').selectpicker('refresh');
1106
                     $('#assoc_objective_'+i+'_counter_1').selectpicker('refresh');
1087
-                    if(json.objectives[outcome_id].length){
1088
-                        objective_id = json.objectives[outcome_id][0].objective_id;
1089
-                        value = "("+outcome_id+","+objective_id+")"
1090
-                    $('#assoc_objective_'+i+'_counter_1').val(value);
1107
+                    if(outcome.objectives_criteria.length){
1108
+                        objective_id = outcome.objectives_criteria[0].objective_id;
1109
+                        value = "("+outcome.id+","+objective_id+")"
1110
+                                       $('#assoc_objective_'+i+'_counter_1').val(value);
1091
                     $('#assoc_objective_'+i+'_counter_1').selectpicker('refresh')
1111
                     $('#assoc_objective_'+i+'_counter_1').selectpicker('refresh')
1092
                     }
1112
                     }
1093
                     
1113
                     
1094
 
1114
 
1095
-                    for(var j =1; i<json.objectives[outcome_id].length; i++ ){
1115
+                    for(var j =1; j<outcome.objectives_criteria.length; j++ ){
1096
                         addAssocObjective("assoc_objectiveGroupFor"+i, "assoc_objective_"+i);
1116
                         addAssocObjective("assoc_objectiveGroupFor"+i, "assoc_objective_"+i);
1097
-                        objective_id = json.objectives[outcome_id][j].objective_id;
1098
-                        value = "("+outcome_id+","+objective_id+")";
1117
+                        objective_id =outcome.objectives_criteria[j].objective_id;
1118
+                        value = "("+outcome.id+","+objective_id+")";
1099
                         $('#assoc_objective_'+i+'_counter_'+(j+1)).val(value);
1119
                         $('#assoc_objective_'+i+'_counter_'+(j+1)).val(value);
1100
                         $('#assoc_objective_'+i+'_counter_'+(j+1)).selectpicker('refresh');
1120
                         $('#assoc_objective_'+i+'_counter_'+(j+1)).selectpicker('refresh');
1101
                         
1121
                         
1169
 
1189
 
1170
 
1190
 
1171
                 // Select associated program
1191
                 // Select associated program
1172
-                var program_length = json.program.length;
1192
+                var program_length = criterion.program.length;
1173
                 $('input[type=checkbox]').prop('checked', false);
1193
                 $('input[type=checkbox]').prop('checked', false);
1174
 
1194
 
1175
                 for (var i = 0; i < program_length; i++) {
1195
                 for (var i = 0; i < program_length; i++) {
1176
-                    $('#assoc_program_id_' + json.program[i].program_id).prop("checked", true);
1196
+                    $('#assoc_program_id_' + criterion.program[i].program_id).prop("checked", true);
1177
                 }
1197
                 }
1178
 
1198
 
1179
-
1180
                 // Select status
1199
                 // Select status
1181
 
1200
 
1182
 
1201
 
1183
 
1202
 
1184
 
1203
 
1185
 
1204
 
1186
-            },
1187
-            'json'
1205
+            }
1206
+            
1188
         );
1207
         );
1189
     }
1208
     }
1190
 </script>@stop
1209
 </script>@stop

+ 103
- 75
app/views/local/managers/pCoords/criteria.blade.php View File

36
                             </div>
36
                             </div>
37
                         </div>
37
                         </div>
38
                         <input type='hidden' name='counterObjective' id='counterObjective' value=1>
38
                         <input type='hidden' name='counterObjective' id='counterObjective' value=1>
39
-                        <button class='btn btn-md btn-secondary button-add-objective' onclick='addObjectiveTest("objectiveGroupFor0", "objective_0")'>
39
+                        <button  class='btn btn-md btn-secondary button-add-objective' onclick='addObjectiveTest("objectiveGroupFor0", "objective_0")'>
40
                             <span class='glyphicon glyphicon-plus'>
40
                             <span class='glyphicon glyphicon-plus'>
41
 
41
 
42
                             </span>
42
                             </span>
117
                 Edit
117
                 Edit
118
             </div>
118
             </div>
119
             <div class="panel-body">
119
             <div class="panel-body">
120
-                {{ Form::open(array('action' => 'CriteriaController@update', 'id'=>'update_criterion')) }}
120
+                {{ Form::open(array('action' => 'CriteriaController@update','id'=>'update_criterion')) }}
121
 
121
 
122
                 <button class="btn btn-md btn-secondary filterButton">
122
                 <button class="btn btn-md btn-secondary filterButton">
123
                     <span class="glyphicon glyphicon-plus">
123
                     <span class="glyphicon glyphicon-plus">
163
                     <div id='assocOutcomeGroup0' data-value="1">
163
                     <div id='assocOutcomeGroup0' data-value="1">
164
                         <div class="form-group col-md-12">
164
                         <div class="form-group col-md-12">
165
                             <label>Outcome 1</label>
165
                             <label>Outcome 1</label>
166
-                            {{ Form::select('outcome[]', $outcomes, null, ['class'=>'form-control selectpicker', 'id'=>'assoc_outcome_0', 'onchange'=>'fetchAssocObjective("assoc_outcome_0")']) }}
167
-
166
+                            {{ Form::select('outcome[]', $outcomes, null, ['class'=>'form-control selectpicker', 'id'=>'assoc_outcome_0', 'onchange'=>'fetchObjectiveForSelect("assoc_outcome_0", "assoc_objectiveGroupFor0")']) }}
167
+    
168
                         </div>
168
                         </div>
169
                         <div id='assoc_objectiveGroupFor0' data-value="1">
169
                         <div id='assoc_objectiveGroupFor0' data-value="1">
170
                             <div class="form-group col-md-11">
170
                             <div class="form-group col-md-11">
547
         $div.remove();
547
         $div.remove();
548
         $div = document.getElementById(closeObj);
548
         $div = document.getElementById(closeObj);
549
         $div.remove();
549
         $div.remove();
550
-        //counter = parseInt($('#'+objectiveGroup).data("value"));
551
-        // $('#'+objectiveGroup).data("value", counter-1);
550
+        counter = parseInt($('#'+objectiveGroup).data("value"));
551
+         $('#'+objectiveGroup).data("value", counter-1);
552
 
552
 
553
 
553
 
554
     }
554
     }
651
             'name': "outcome[]",
651
             'name': "outcome[]",
652
             'data-live-search': 'true',
652
             'data-live-search': 'true',
653
             'id': 'assoc_outcome_' + assocOutcomeCounter.toString(),
653
             'id': 'assoc_outcome_' + assocOutcomeCounter.toString(),
654
-            'onchange': 'fetchAssocObjective("assoc_outcome_' + assocOutcomeCounter.toString() + '", "assoc_objectiveGroupFor' + assocOutcomeCounter + '")'
654
+            'onchange': 'fetchObjectiveForSelect("assoc_outcome_' + assocOutcomeCounter.toString() + '", "assoc_objectiveGroupFor' + assocOutcomeCounter + '")'
655
 
655
 
656
         });
656
         });
657
         var $div = $('<div/>', {
657
         var $div = $('<div/>', {
759
                 allOutcomes: allOutcomes
759
                 allOutcomes: allOutcomes
760
             },
760
             },
761
 
761
 
762
-            function(json) {
762
+            function(varArray) {
763
 
763
 
764
                 optionName = '<option value ="0">Nothing Selected</option>';
764
                 optionName = '<option value ="0">Nothing Selected</option>';
765
                 for (outcome in varArray.outcomes) {
765
                 for (outcome in varArray.outcomes) {
785
                 }
785
                 }
786
 
786
 
787
                 for (var i = allObjectives.length - 1; i > 0; i--) {
787
                 for (var i = allObjectives.length - 1; i > 0; i--) {
788
-                    deleteObjective('assoc_objectiveForm' + i.toString(), 'assoc_closeObj' + i.toString(), 'assoc_objectiveGroup');
788
+                    deleteObjective('assoc_objectiveForm_' + objectiveGroup +'_'+i, 'assoc_closeObj_'+objectiveGroup+'_' + i.toString(), objectiveGroup);
789
                 }
789
                 }
790
-                for (var i = 1; i < allObjectives.length; i++) {
790
+                /*for (var i = 1; i < allObjectives.length; i++) {
791
                     addAssocObjective();
791
                     addAssocObjective();
792
                     $('#assoc_objective_' + i.toString()).selectpicker('refresh');
792
                     $('#assoc_objective_' + i.toString()).selectpicker('refresh');
793
                     if ($("#assoc_objective_" + i.toString() + " option[value='" + allObjectives[i].value + "']").length > 0) {
793
                     if ($("#assoc_objective_" + i.toString() + " option[value='" + allObjectives[i].value + "']").length > 0) {
794
                         $("#assoc_objective_" + i.toString()).val(allObjectives[i].value);
794
                         $("#assoc_objective_" + i.toString()).val(allObjectives[i].value);
795
                         $("#assoc_objective_" + i.toString()).selectpicker("refresh");
795
                         $("#assoc_objective_" + i.toString()).selectpicker("refresh");
796
                     }
796
                     }
797
-                }
797
+                }*/
798
 
798
 
799
 
799
 
800
 
800
 
932
             "{{ URL::action('CriteriaController@fetchCriterionWithTrashed') }}", {
932
             "{{ URL::action('CriteriaController@fetchCriterionWithTrashed') }}", {
933
                 id: id
933
                 id: id
934
             },
934
             },
935
-            function(json) {
935
+                function(criterion) {
936
+
937
+                
938
+if (!(criterion.length)) {
939
+    name = ' ';
940
+    var subcriteria = '';
941
+    copyright = null;
942
+    notes = null;
943
+    $('#status').val(0);
944
+    maximum = 1;
945
+    $('#assoc_maximum_score').val(1);
936
 
946
 
937
-                if (!(json.activity_criterion.length)) {
947
+
948
+}
949
+
950
+
951
+else { 
952
+criterion = criterion[0];
953
+if (!(criterion.activity_criterion.length)) {
954
+
955
+
956
+              
938
 
957
 
939
                     $('#DeleteButton').prop('disabled', false);
958
                     $('#DeleteButton').prop('disabled', false);
940
                     $("#update_the_criterion").val('Update');
959
                     $("#update_the_criterion").val('Update');
947
                     $('#alert_placeholder').html('<div class="alert alert-danger alert-dismissible" role="alert"> <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button> <strong>Warning!</strong> The criterion is already used in assessments. Editting the criterion will actually create a new criterion </div>');
966
                     $('#alert_placeholder').html('<div class="alert alert-danger alert-dismissible" role="alert"> <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button> <strong>Warning!</strong> The criterion is already used in assessments. Editting the criterion will actually create a new criterion </div>');
948
 
967
 
949
                 }
968
                 }
950
-
951
-                if (!(json.criteria.length)) {
952
-                    name = ' ';
953
-                    var subcriteria = '';
954
-                    copyright = null;
955
-                    notes = null;
956
-                    $('#status').val(0);
957
-                    maximum = 1;
958
-                    $('#assoc_maximum_score').val(1);
959
-
960
-
961
-                } else {
962
-                    var name = json.criteria[0].name;
963
-                    if (json.criteria[0].subcriteria) {
964
-                        subcriteria = JSON.parse(json.criteria[0].subcriteria).join('\n');
969
+                var name = criterion.name;
970
+                    if (criterion.subcriteria) {
971
+                        subcriteria = JSON.parse(criterion.subcriteria).join('\n');
965
                     } else {
972
                     } else {
966
                         subcriteria = "";
973
                         subcriteria = "";
967
                     }
974
                     }
968
-                    if (json.criteria[0].copyright) {
969
-                        var copyright = json.criteria[0].copyright;
970
-                    } else {
975
+                    if (criterion.copyright) {
976
+                        var copyright = criterion.copyright;
977
+                 } else {
971
                         var copyright = ''
978
                         var copyright = ''
972
                     }
979
                     }
973
-                    if (json.criteria[0].notes) notes = json.criteria[0].notes;
974
-                    else notes = '';
980
+                    if (criterion.notes) notes = criterion.notes;
981
+                     else notes = '';
975
 
982
 
976
                     // Display info
983
                     // Display info
977
                     $('#criterion_name').val(name);
984
                     $('#criterion_name').val(name);
978
                     $('#criterion_subcriteria').text(subcriteria);
985
                     $('#criterion_subcriteria').text(subcriteria);
979
-                    if (json.criteria[0].deleted_at)
986
+                    if (criterion.deleted_at)
980
                         $('#status').val(0);
987
                         $('#status').val(0);
981
                     else
988
                     else
982
                         $('#status').val(1);
989
                         $('#status').val(1);
983
-                    $('#assoc_maximum_score').val(json.criteria[0].max_score);
984
-                    var maximum = json.criteria[0].max_score;
990
+                        $('#assoc_maximum_score').val(criterion.max_score);
991
+                    var maximum = criterion.max_score;
985
 
992
 
986
                     addOptions("Num_assoc_scale", "assoc_maximum_score", "Assoc_Scales");
993
                     addOptions("Num_assoc_scale", "assoc_maximum_score", "Assoc_Scales");
987
-                    $('#Num_assoc_scale').val(json.criteria[0].num_scales)
988
-                    $('#Num_assoc_scale').selectpicker('refresh');
994
+                    $('#Num_assoc_scale').val(criterion.num_scales)
995
+                  $('#Num_assoc_scale').selectpicker('refresh');
989
                     $('#Num_assoc_scale').trigger('change');
996
                     $('#Num_assoc_scale').trigger('change');
990
 
997
 
991
-                    for (i = 0; i < json.criteria[0].num_scales; i++) {
992
-                        $('#assoc_scale_' + i).val(json.scales[i].description);
993
-                    }
998
+                    for(i=0; i<criterion.num_scales;i++){
999
+                        $('#assoc_scale_'+i).val(criterion.scales[i].description);
1000
+                     }
994
 
1001
 
995
 
1002
 
996
 
1003
 
1022
                     var Notran = true;
1029
                     var Notran = true;
1023
                 }
1030
                 }
1024
 
1031
 
1025
-                if (json.outcomes.length) {
1026
-                    $('#assoc_outcome_0').val(json.outcomes[0].id);
1027
-                    $('#assoc_outcome_0').selectpicker('refresh');
1032
+                if (criterion.outcomes.length) 
1033
+                    {
1034
+                    $('#assoc_outcome_0').val(criterion.outcomes[0].id);
1035
+                                    $('#assoc_outcome_0').selectpicker('refresh');
1028
 
1036
 
1029
-                    var first_outcome_id = json.outcomes[0].id;
1030
-                    options = "<option value ='0'>Nothing Selected</option>";
1037
+                                    var first_outcome = criterion.outcomes[0];
1038
+                   options = "<option value ='0'>Nothing Selected</option>";
1039
+                   $(first_outcome.assoc_objectives).each(function(index, objective){
1040
+
1041
+options += '<option value ="('+first_outcome.id+','+objective.objective_id+')">'+
1042
+    objective.text+'</option>';
1031
 
1043
 
1032
-                    for (objective_index in json.objectives_assoc[first_outcome_id]) {
1044
+})
1045
+                    /*for (objective_index in json.objectives_assoc[first_outcome_id]) {
1033
                         objective = json.objectives_assoc[first_outcome_id][objective_index]
1046
                         objective = json.objectives_assoc[first_outcome_id][objective_index]
1034
                         options += '<option value ="(' + first_outcome_id + ',' + objective.objective_id + ')">' +
1047
                         options += '<option value ="(' + first_outcome_id + ',' + objective.objective_id + ')">' +
1035
                             objective.text + '</option>';
1048
                             objective.text + '</option>';
1036
-                    }
1049
+                    }*/
1037
                     $('#assoc_objective_0_counter_1').html(options);
1050
                     $('#assoc_objective_0_counter_1').html(options);
1038
                     $('#assoc_objective_0_counter_1').selectpicker('refresh');
1051
                     $('#assoc_objective_0_counter_1').selectpicker('refresh');
1039
 
1052
 
1040
-                    if (json.objectives[first_outcome_id].length) {
1041
-                        objective_id = json.objectives[first_outcome_id][0].objective_id;
1042
-                        value = '(' + first_outcome_id + ',' + objective_id + ')';
1043
-                        $('#assoc_objective_0_counter_1').val(value);
1053
+                    if(first_outcome.objectives_criteria.length){
1054
+                        objective_id = first_outcome.objectives_criteria[0].objective_id;
1055
+                    value = '('+first_outcome.id+','+objective_id+')';
1056
+                  $('#assoc_objective_0_counter_1').val(value);
1044
                         $('#assoc_objective_0_counter_1').selectpicker('refresh');
1057
                         $('#assoc_objective_0_counter_1').selectpicker('refresh');
1045
 
1058
 
1046
                     }
1059
                     }
1047
 
1060
 
1061
+                    if($("#assoc_objectiveGroupFor0").find(".btn-primary").length>0){
1062
+                        $("#assoc_objectiveGroupFor0").find(".btn-primary").each(function(){
1063
+                            $(this).click()
1064
+                        })
1065
+                    }
1048
 
1066
 
1049
-                    for (var i = 1; i < json.objectives[first_outcome_id].length; i++) {
1067
+                    for(var i =1; i<first_outcome.objectives_criteria.length; i++ ){
1050
                         addAssocObjective("assoc_objectiveGroupFor0", "assoc_objective_0");
1068
                         addAssocObjective("assoc_objectiveGroupFor0", "assoc_objective_0");
1051
-                        objective_id = json.objectives[first_outcome_id][i].objective_id;
1052
-                        value = "(" + first_outcome_id + "," + objective_id + ")";
1053
-                        $('#assoc_objective_0_counter_' + (i + 1)).val(value);
1054
-                        $('#assoc_objective_0_counter_' + (i + 1)).selectpicker('refresh');
1069
+                        objective_id = first_outcome.objectives_criteria[i].objective_id;
1070
+                        value = "("+first_outcome.id+","+objective_id+")";
1071
+                        $('#assoc_objective_0_counter_'+(i+1)).val(value);
1072
+                        $('#assoc_objective_0_counter_'+(i+1)).selectpicker('refresh');
1073
+                        
1055
 
1074
 
1056
 
1075
 
1057
 
1076
 
1065
 
1084
 
1066
 
1085
 
1067
 
1086
 
1068
-                for (var i = 1; i < json.outcomes.length; i++) {
1069
-                    addAssocOutcome(true);
1087
+                for (var i = 1; i < criterion.outcomes.length; i++) {
1088
+                                   addAssocOutcome(true);
1070
 
1089
 
1071
 
1090
 
1072
-                    $('#assoc_outcome_' + i.toString()).val(json.outcomes[i].id);
1073
-                    $('#assoc_outcome_' + i.toString()).selectpicker('refresh');
1091
+                                   $('#assoc_outcome_' + i.toString()).val(criterion.outcomes[i].id);
1092
+                   $('#assoc_outcome_' + i.toString()).selectpicker('refresh');
1074
 
1093
 
1075
-                    var outcome_id = json.outcomes[i].id;
1094
+                    var outcome = criterion.outcomes[i];
1076
                     options = "<option value ='0'>Nothing Selected</option>";
1095
                     options = "<option value ='0'>Nothing Selected</option>";
1077
 
1096
 
1078
-                    for (objective_index in json.objectives_assoc[outcome_id]) {
1097
+                   
1098
+                    $(outcome.assoc_objectives).each(function(index, objective){
1099
+
1100
+options += '<option value ="('+outcome.id+','+objective.objective_id+')">'+
1101
+    objective.text+'</option>';
1102
+
1103
+})
1104
+                    /*for (objective_index in json.objectives_assoc[outcome_id]) {
1079
                         objective = json.objectives_assoc[outcome_id][objective_index]
1105
                         objective = json.objectives_assoc[outcome_id][objective_index]
1080
                         options += '<option value ="(' + outcome_id + ',' + objective.objective_id + ')">' +
1106
                         options += '<option value ="(' + outcome_id + ',' + objective.objective_id + ')">' +
1081
                             objective.text + '</option>';
1107
                             objective.text + '</option>';
1082
-                    }
1108
+                    }*/
1083
                     $('#assoc_objective_' + i + '_counter_1').html(options);
1109
                     $('#assoc_objective_' + i + '_counter_1').html(options);
1084
                     $('#assoc_objective_' + i + '_counter_1').selectpicker('refresh');
1110
                     $('#assoc_objective_' + i + '_counter_1').selectpicker('refresh');
1085
-                    if (json.objectives[outcome_id].length) {
1086
-                        objective_id = json.objectives[outcome_id][0].objective_id;
1087
-                        value = "(" + outcome_id + "," + objective_id + ")"
1088
-                        $('#assoc_objective_' + i + '_counter_1').val(value);
1089
-                        $('#assoc_objective_' + i + '_counter_1').selectpicker('refresh')
1111
+                    if(outcome.objectives_criteria.length){
1112
+                        objective_id = outcome.objectives_criteria[0].objective_id;
1113
+                        value = "("+outcome.id+","+objective_id+")"
1114
+                    $('#assoc_objective_'+i+'_counter_1').val(value);
1115
+                    $('#assoc_objective_'+i+'_counter_1').selectpicker('refresh')
1090
                     }
1116
                     }
1117
+                                        }
1091
 
1118
 
1092
 
1119
 
1093
-                    for (var j = 1; i < json.objectives[outcome_id].length; i++) {
1094
-                        addAssocObjective("assoc_objectiveGroupFor" + i, "assoc_objective_" + i);
1095
-                        objective_id = json.objectives[outcome_id][j].objective_id;
1096
-                        value = "(" + outcome_id + "," + objective_id + ")";
1097
-                        $('#assoc_objective_' + i + '_counter_' + (j + 1)).val(value);
1098
-                        $('#assoc_objective_' + i + '_counter_' + (j + 1)).selectpicker('refresh');
1120
+                                        for(var j =1; j<outcome.objectives_criteria.length; j++ ){
1121
+                        addAssocObjective("assoc_objectiveGroupFor"+i, "assoc_objective_"+i);
1122
+                        objective_id =outcome.objectives_criteria[j].objective_id;
1123
+                        value = "("+outcome.id+","+objective_id+")";
1124
+                        $('#assoc_objective_'+i+'_counter_'+(j+1)).val(value);
1125
+                        $('#assoc_objective_'+i+'_counter_'+(j+1)).selectpicker('refresh');
1126
+                        
1099
 
1127
 
1100
 
1128
 
1101
                     }
1129
                     }

+ 88
- 64
app/views/local/managers/sCoords/criteria.blade.php View File

157
                     <div id='assocOutcomeGroup0' data-value="1">
157
                     <div id='assocOutcomeGroup0' data-value="1">
158
                         <div class="form-group col-md-12">
158
                         <div class="form-group col-md-12">
159
                             <label>Outcome 1</label>
159
                             <label>Outcome 1</label>
160
-                            {{ Form::select('outcome[]', $outcomes, null, ['class'=>'form-control selectpicker', 'id'=>'assoc_outcome_0', 'onchange'=>'fetchAssocObjective("assoc_outcome_0")']) }}
160
+                            {{ Form::select('outcome[]', $outcomes, null, ['class'=>'form-control selectpicker', 'id'=>'assoc_outcome_0', 'onchange'=>'fetchObjectiveForSelect("assoc_outcome_0", "assoc_objectiveGroupFor0")']) }}
161
     
161
     
162
                         </div>
162
                         </div>
163
     <div id='assoc_objectiveGroupFor0' data-value="1">
163
     <div id='assoc_objectiveGroupFor0' data-value="1">
543
         $div.remove();
543
         $div.remove();
544
         $div = document.getElementById(closeObj);
544
         $div = document.getElementById(closeObj);
545
         $div.remove();
545
         $div.remove();
546
-        //counter = parseInt($('#'+objectiveGroup).data("value"));
547
-        //$('#'+objectiveGroup).data("value", counter-1);
546
+        counter = parseInt($('#'+objectiveGroup).data("value"));
547
+        $('#'+objectiveGroup).data("value", counter-1);
548
 
548
 
549
 
549
 
550
     }
550
     }
647
             'name': "outcome[]",
647
             'name': "outcome[]",
648
             'data-live-search': 'true',
648
             'data-live-search': 'true',
649
             'id': 'assoc_outcome_' + assocOutcomeCounter.toString(),
649
             'id': 'assoc_outcome_' + assocOutcomeCounter.toString(),
650
-            'onchange': 'fetchAssocObjective("assoc_outcome_' + assocOutcomeCounter.toString() + '", "assoc_objectiveGroupFor'+assocOutcomeCounter+'")'
650
+            'onchange': 'fetchObjectiveForSelect("assoc_outcome_' + assocOutcomeCounter.toString() + '", "assoc_objectiveGroupFor'+assocOutcomeCounter+'")'
651
 
651
 
652
         });
652
         });
653
         var $div = $('<div/>', {
653
         var $div = $('<div/>', {
757
                 allOutcomes: allOutcomes
757
                 allOutcomes: allOutcomes
758
             },
758
             },
759
 
759
 
760
-            function(json) {
760
+            function(varArray) {
761
 
761
 
762
                 optionName = '<option value ="0">Nothing Selected</option>';
762
                 optionName = '<option value ="0">Nothing Selected</option>';
763
                 for(outcome in varArray.outcomes){
763
                 for(outcome in varArray.outcomes){
783
                 }
783
                 }
784
 
784
 
785
                 for (var i = allObjectives.length - 1; i > 0; i--) {
785
                 for (var i = allObjectives.length - 1; i > 0; i--) {
786
-                    deleteObjective('assoc_objectiveForm' + i.toString(), 'assoc_closeObj' + i.toString(), 'assoc_objectiveGroup');
786
+                    deleteObjective('assoc_objectiveForm_' + objectiveGroup +'_'+i, 'assoc_closeObj_'+objectiveGroup+'_' + i.toString(), objectiveGroup);
787
                 }
787
                 }
788
-                for(var i=1; i<allObjectives.length; i++){
788
+ /*               for(var i=1; i<allObjectives.length; i++){
789
                     addAssocObjective();
789
                     addAssocObjective();
790
                     $('#assoc_objective_'+i.toString()).selectpicker('refresh');
790
                     $('#assoc_objective_'+i.toString()).selectpicker('refresh');
791
                     if($("#assoc_objective_"+i.toString()+" option[value='"+allObjectives[i].value+"']").length>0){
791
                     if($("#assoc_objective_"+i.toString()+" option[value='"+allObjectives[i].value+"']").length>0){
792
                     $("#assoc_objective_"+i.toString()).val(allObjectives[i].value);
792
                     $("#assoc_objective_"+i.toString()).val(allObjectives[i].value);
793
                     $("#assoc_objective_"+i.toString()).selectpicker("refresh");
793
                     $("#assoc_objective_"+i.toString()).selectpicker("refresh");
794
                     }
794
                     }
795
-                }
795
+                }*/
796
 
796
 
797
 
797
 
798
 
798
 
929
             "{{ URL::action('CriteriaController@fetchCriterionWithTrashed') }}", {
929
             "{{ URL::action('CriteriaController@fetchCriterionWithTrashed') }}", {
930
                 id: id
930
                 id: id
931
             },
931
             },
932
-            function(json) {
932
+            function(criterion) {
933
 
933
 
934
-                if (!(json.activity_criterion.length)) {
934
+                
935
+                if (!(criterion.length)) {
936
+                    name = ' ';
937
+                    var subcriteria = '';
938
+                    copyright = null;
939
+                    notes = null;
940
+                    $('#status').val(0);
941
+                    maximum = 1;
942
+                    $('#assoc_maximum_score').val(1);
943
+
944
+
945
+                }
946
+               
947
+
948
+ else { 
949
+     criterion = criterion[0];
950
+     if (!(criterion.activity_criterion.length)) {
935
 
951
 
936
 $('#DeleteButton').prop('disabled', false);
952
 $('#DeleteButton').prop('disabled', false);
937
 $("#update_the_criterion").val('Update');
953
 $("#update_the_criterion").val('Update');
944
 $('#alert_placeholder').html('<div class="alert alert-danger alert-dismissible" role="alert"> <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button> <strong>Warning!</strong> The criterion is already used in assessments. Editting the criterion will actually create a new criterion </div>');
960
 $('#alert_placeholder').html('<div class="alert alert-danger alert-dismissible" role="alert"> <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button> <strong>Warning!</strong> The criterion is already used in assessments. Editting the criterion will actually create a new criterion </div>');
945
 
961
 
946
 }
962
 }
947
-
948
-                if (!(json.criteria.length)) {
949
-                    name = ' ';
950
-                    var subcriteria = '';
951
-                    copyright = null;
952
-                    notes = null;
953
-                    $('#status').val(0);
954
-                    maximum = 1;
955
-                    $('#assoc_maximum_score').val(1);
956
-
957
-
958
-                } else {
959
-                    var name = json.criteria[0].name;
960
-                    if (json.criteria[0].subcriteria) {
961
-                        subcriteria = JSON.parse(json.criteria[0].subcriteria).join('\n');
963
+                    var name = criterion.name;
964
+                    if (criterion.subcriteria) {
965
+                        subcriteria = JSON.parse(criterion.subcriteria).join('\n');
962
                     } else {
966
                     } else {
963
                         subcriteria = "";
967
                         subcriteria = "";
964
                     }
968
                     }
965
-                    if (json.criteria[0].copyright) {
966
-                        var copyright = json.criteria[0].copyright;
969
+                    if (criterion.copyright) {
970
+                        var copyright = criterion.copyright;
967
                     } else {
971
                     } else {
968
                         var copyright = ''
972
                         var copyright = ''
969
                     }
973
                     }
970
-                    if (json.criteria[0].notes) notes = json.criteria[0].notes;
974
+                    if (criterion.notes) notes = criterion.notes;
971
                     else notes = '';
975
                     else notes = '';
972
 
976
 
973
                     // Display info
977
                     // Display info
974
                     $('#criterion_name').val(name);
978
                     $('#criterion_name').val(name);
975
                     $('#criterion_subcriteria').text(subcriteria);
979
                     $('#criterion_subcriteria').text(subcriteria);
976
-                    if (json.criteria[0].deleted_at)
980
+                    if (criterion.deleted_at)
977
                         $('#status').val(0);
981
                         $('#status').val(0);
978
                     else
982
                     else
979
                         $('#status').val(1);
983
                         $('#status').val(1);
980
-                    $('#assoc_maximum_score').val(json.criteria[0].max_score);
981
-                    var maximum = json.criteria[0].max_score;
984
+                    $('#assoc_maximum_score').val(criterion.max_score);
985
+                    var maximum = criterion.max_score;
982
 
986
 
983
                     addOptions("Num_assoc_scale", "assoc_maximum_score", "Assoc_Scales");
987
                     addOptions("Num_assoc_scale", "assoc_maximum_score", "Assoc_Scales");
984
-                    $('#Num_assoc_scale').val(json.criteria[0].num_scales)
988
+                    $('#Num_assoc_scale').val(criterion.num_scales)
985
                     $('#Num_assoc_scale').selectpicker('refresh');
989
                     $('#Num_assoc_scale').selectpicker('refresh');
986
                     $('#Num_assoc_scale').trigger('change');
990
                     $('#Num_assoc_scale').trigger('change');
987
 
991
 
988
-                    for(i=0; i<json.criteria[0].num_scales;i++){
989
-                        $('#assoc_scale_'+i).val(json.scales[i].description);
992
+                    for(i=0; i<criterion.num_scales;i++){
993
+                        $('#assoc_scale_'+i).val(criterion.scales[i].description);
990
                     }
994
                     }
991
                     // If copyright or notes aren't empty, load them
995
                     // If copyright or notes aren't empty, load them
992
 
996
 
1007
 
1011
 
1008
                 // Select associated outcome
1012
                 // Select associated outcome
1009
                 try {
1013
                 try {
1010
-                    assocOutcomeCounter= parseInt($("#assocOutcomeGroup0").data('value'));
1014
+                    assocOutcomeCounter = parseInt($("#assocOutcomeGroup0").data('value'));
1011
                     for (var i = assocOutcomeCounter - 1; i > 0; i--) {
1015
                     for (var i = assocOutcomeCounter - 1; i > 0; i--) {
1012
                         $('#assoc_close_button'+i).click();
1016
                         $('#assoc_close_button'+i).click();
1013
                                }
1017
                                }
1016
                     var Notran = true;
1020
                     var Notran = true;
1017
                 }
1021
                 }
1018
 
1022
 
1019
-                if (json.outcomes.length) 
1023
+                if (criterion.outcomes.length) 
1020
                     {
1024
                     {
1021
-                    $('#assoc_outcome_0').val(json.outcomes[0].id);
1025
+                    $('#assoc_outcome_0').val(criterion.outcomes[0].id);
1022
                     $('#assoc_outcome_0').selectpicker('refresh');
1026
                     $('#assoc_outcome_0').selectpicker('refresh');
1023
 
1027
 
1024
-                    var first_outcome_id = json.outcomes[0].id;
1028
+                    var first_outcome = criterion.outcomes[0];
1025
                     options = "<option value ='0'>Nothing Selected</option>";
1029
                     options = "<option value ='0'>Nothing Selected</option>";
1030
+                        $(first_outcome.assoc_objectives).each(function(index, objective){
1026
 
1031
 
1027
-                    for(objective_index  in json.objectives_assoc[first_outcome_id]){
1032
+                        options += '<option value ="('+first_outcome.id+','+objective.objective_id+')">'+
1033
+                            objective.text+'</option>';
1034
+
1035
+                        })
1036
+                    /*for(objective_index  in json.objectives_assoc[first_outcome_id]){
1028
                         objective = json.objectives_assoc[first_outcome_id][objective_index]
1037
                         objective = json.objectives_assoc[first_outcome_id][objective_index]
1029
                         options += '<option value ="('+first_outcome_id+','+objective.objective_id+')">'+
1038
                         options += '<option value ="('+first_outcome_id+','+objective.objective_id+')">'+
1030
                             objective.text+'</option>';
1039
                             objective.text+'</option>';
1031
-                    }
1040
+                    }*/
1032
                     $('#assoc_objective_0_counter_1').html(options);
1041
                     $('#assoc_objective_0_counter_1').html(options);
1033
                     $('#assoc_objective_0_counter_1').selectpicker('refresh');
1042
                     $('#assoc_objective_0_counter_1').selectpicker('refresh');
1034
                     
1043
                     
1035
-                    if(json.objectives[first_outcome_id].length){
1036
-                        objective_id = json.objectives[first_outcome_id][0].objective_id;
1037
-                    value = '('+first_outcome_id+','+objective_id+')';
1044
+                    if(first_outcome.objectives_criteria.length){
1045
+                        objective_id = first_outcome.objectives_criteria[0].objective_id;
1046
+                    value = '('+first_outcome.id+','+objective_id+')';
1038
                     $('#assoc_objective_0_counter_1').val(value);
1047
                     $('#assoc_objective_0_counter_1').val(value);
1039
                     $('#assoc_objective_0_counter_1').selectpicker('refresh');
1048
                     $('#assoc_objective_0_counter_1').selectpicker('refresh');
1040
 
1049
 
1041
                     }
1050
                     }
1051
+
1052
+                    if($("#assoc_objectiveGroupFor0").find(".btn-primary").length>0){
1053
+                        $("#assoc_objectiveGroupFor0").find(".btn-primary").each(function(){
1054
+                            $(this).click()
1055
+                        })
1056
+                    }
1057
+
1058
+
1042
                     
1059
                     
1043
 
1060
 
1044
-                    for(var i =1; i<json.objectives[first_outcome_id].length; i++ ){
1061
+                    for(var i =1; i<first_outcome.objectives_criteria.length; i++ ){
1045
                         addAssocObjective("assoc_objectiveGroupFor0", "assoc_objective_0");
1062
                         addAssocObjective("assoc_objectiveGroupFor0", "assoc_objective_0");
1046
-                        objective_id = json.objectives[first_outcome_id][i].objective_id;
1047
-                        value = "("+first_outcome_id+","+objective_id+")";
1063
+                        objective_id = first_outcome.objectives_criteria[i].objective_id;
1064
+                        value = "("+first_outcome.id+","+objective_id+")";
1048
                         $('#assoc_objective_0_counter_'+(i+1)).val(value);
1065
                         $('#assoc_objective_0_counter_'+(i+1)).val(value);
1049
                         $('#assoc_objective_0_counter_'+(i+1)).selectpicker('refresh');
1066
                         $('#assoc_objective_0_counter_'+(i+1)).selectpicker('refresh');
1050
                         
1067
                         
1060
 
1077
 
1061
 
1078
 
1062
                
1079
                
1063
-                for (var i = 1; i < json.outcomes.length; i++) {
1080
+                for (var i = 1; i < criterion.outcomes.length; i++) {
1064
                     addAssocOutcome(true);
1081
                     addAssocOutcome(true);
1065
 
1082
 
1066
 
1083
 
1067
-                    $('#assoc_outcome_' + i.toString()).val(json.outcomes[i].id);
1084
+                    $('#assoc_outcome_' + i.toString()).val(criterion.outcomes[i].id);
1068
                     $('#assoc_outcome_' + i.toString()).selectpicker('refresh');
1085
                     $('#assoc_outcome_' + i.toString()).selectpicker('refresh');
1069
 
1086
 
1070
-                    var outcome_id = json.outcomes[i].id;
1087
+                    var outcome = criterion.outcomes[i];
1071
                     options = "<option value ='0'>Nothing Selected</option>";
1088
                     options = "<option value ='0'>Nothing Selected</option>";
1072
 
1089
 
1073
-                    for(objective_index  in json.objectives_assoc[outcome_id]){
1074
-                        objective = json.objectives_assoc[outcome_id][objective_index]
1075
-                        options += '<option value ="('+outcome_id+','+objective.objective_id+')">'+
1076
-                            objective.text+'</option>';
1077
-                    }
1090
+                    $(outcome.assoc_objectives).each(function(index, objective){
1091
+
1092
+options += '<option value ="('+outcome.id+','+objective.objective_id+')">'+
1093
+    objective.text+'</option>';
1094
+
1095
+})
1096
+                    //for(objective_index  in json.objectives_assoc[outcome_id]){
1097
+                    //    objective = json.objectives_assoc[outcome_id][objective_index]
1098
+                    //    options += '<option value ="('+outcome_id+','+objective.objective_id+')">'+
1099
+                    //        objective.text+'</option>';
1100
+                    // }
1078
                     $('#assoc_objective_'+i+'_counter_1').html(options);
1101
                     $('#assoc_objective_'+i+'_counter_1').html(options);
1079
                     $('#assoc_objective_'+i+'_counter_1').selectpicker('refresh');
1102
                     $('#assoc_objective_'+i+'_counter_1').selectpicker('refresh');
1080
-                    if(json.objectives[outcome_id].length){
1081
-                        objective_id = json.objectives[outcome_id][0].objective_id;
1082
-                        value = "("+outcome_id+","+objective_id+")"
1103
+
1104
+                    if(outcome.objectives_criteria.length){
1105
+                        objective_id = outcome.objectives_criteria[0].objective_id;
1106
+                        value = "("+outcome.id+","+objective_id+")"
1083
                     $('#assoc_objective_'+i+'_counter_1').val(value);
1107
                     $('#assoc_objective_'+i+'_counter_1').val(value);
1084
                     $('#assoc_objective_'+i+'_counter_1').selectpicker('refresh')
1108
                     $('#assoc_objective_'+i+'_counter_1').selectpicker('refresh')
1085
                     }
1109
                     }
1086
                     
1110
                     
1087
 
1111
 
1088
-                    for(var j =1; i<json.objectives[outcome_id].length; i++ ){
1112
+                    for(var j =1; j<outcome.objectives_criteria.length; j++ ){
1089
                         addAssocObjective("assoc_objectiveGroupFor"+i, "assoc_objective_"+i);
1113
                         addAssocObjective("assoc_objectiveGroupFor"+i, "assoc_objective_"+i);
1090
-                        objective_id = json.objectives[outcome_id][j].objective_id;
1091
-                        value = "("+outcome_id+","+objective_id+")";
1114
+                        objective_id =outcome.objectives_criteria[j].objective_id;
1115
+                        value = "("+outcome.id+","+objective_id+")";
1092
                         $('#assoc_objective_'+i+'_counter_'+(j+1)).val(value);
1116
                         $('#assoc_objective_'+i+'_counter_'+(j+1)).val(value);
1093
                         $('#assoc_objective_'+i+'_counter_'+(j+1)).selectpicker('refresh');
1117
                         $('#assoc_objective_'+i+'_counter_'+(j+1)).selectpicker('refresh');
1094
                         
1118
                         
1117
                 assocOutcomeCounter = 0;
1141
                 assocOutcomeCounter = 0;
1118
                 var i = 0;
1142
                 var i = 0;
1119
                 optionName = '<option value ="0">Nothing Selected</option>';
1143
                 optionName = '<option value ="0">Nothing Selected</option>';
1120
-                for(outcome in json.outcomes_assoc){
1121
-                    optionName += '<optgroup label="' + json.outcomes_assoc[outcome][0].name + '">';
1144
+                for(outcome in criterion.outcomes_assoc){
1145
+                    optionName += '<optgroup label="' + criterion.outcomes_assoc[outcome][0].name + '">';
1122
                     var objectiveForOutcome = json.objectives_assoc;
1146
                     var objectiveForOutcome = json.objectives_assoc;
1123
                     var objectives = objectiveForOutcome[outcome];
1147
                     var objectives = objectiveForOutcome[outcome];
1124
                     for (objective in objectives) {
1148
                     for (objective in objectives) {
1162
 
1186
 
1163
 
1187
 
1164
                 // Select associated program
1188
                 // Select associated program
1165
-                var program_length = json.program.length;
1189
+                var program_length = criterion.program.length;
1166
                 $('input[type=checkbox]').prop('checked', false);
1190
                 $('input[type=checkbox]').prop('checked', false);
1167
 
1191
 
1168
                 for (var i = 0; i < program_length; i++) {
1192
                 for (var i = 0; i < program_length; i++) {
1169
-                    $('#assoc_program_id_' + json.program[i].program_id).prop("checked", true);
1193
+                    $('#assoc_program_id_' + criterion.program[i].program_id).prop("checked", true);
1170
                 }
1194
                 }
1171
 
1195
 
1172
 
1196
 

+ 1
- 1
app/views/local/managers/shared/rubrics.blade.php View File

383
             data.forEach( function (arrayItem)
383
             data.forEach( function (arrayItem)
384
             {
384
             {
385
                 $('#select-criterion')
385
                 $('#select-criterion')
386
-                    .append('<option data-criterion-id="'+arrayItem.id+'" >'+arrayItem.name+'</option>');
386
+                    .append('<option data-criterion-id="'+arrayItem.id+'" data-program-ids = "'+arrayItem.program_ids+'" data-assoc-objectives = "'arrayItem.objectives'">'+arrayItem.name+'</option>');
387
             });
387
             });
388
 
388
 
389
             // If there are no criteria assigned to the selected outcome, disable the
389
             // If there are no criteria assigned to the selected outcome, disable the