Bladeren bron

Arregle el bug

Gabriel Santiago Plaza 2 jaren geleden
bovenliggende
commit
98bb92835a

+ 58
- 0
app/controllers/AnnualPlansController.php Bestand weergeven

@@ -337,6 +337,7 @@ class AnnualPlansController extends \BaseController
337 337
           ->where('annual_plan_id', $annual_plan->id)
338 338
           ->where('typ_semester_course_id', $course->typ_course_id)
339 339
           ->get();
340
+        //Log::info($course->typ_course_id);
340 341
         $typ_info['custom_transformative'][$objective->id][$course->id] = DB::table('transformative_actions')
341 342
           ->join('ta_course', 'ta_course.ta_id', '=', 'transformative_actions.id')
342 343
           ->join('transformative_objective', 'transformative_objective.ta_id', '=', 'transformative_actions.id')
@@ -715,6 +716,9 @@ class AnnualPlansController extends \BaseController
715 716
     $outcome->comments = DB::table('typ_outcome_report_comments')
716 717
       ->where('typ_semester_outcome_id', $typ_semester_outcome_id)
717 718
       ->get();
719
+    $outcome->transformative_actions_categories_html = TransformativeAction::getCategoriesHtml($program_id);
720
+
721
+
718 722
 
719 723
 
720 724
     foreach ($outcome->objectives as $index => $objective) {
@@ -771,6 +775,60 @@ class AnnualPlansController extends \BaseController
771 775
     return;
772 776
   }
773 777
 
778
+  public function futureTransformative()
779
+  {
780
+    $at_text = Input::get('at_text');
781
+    $description = Input::get('description');
782
+    $future_typ_course_id = Input::get('future_typ_course_id');
783
+    $future_semesters = Input::get('future_semesters');
784
+    $type_of_ta = Input::get('type_of_TA');
785
+    $is_custom = Input::get('is_custom');
786
+    $program_id = Input::get('program_id');
787
+    //$annual_plan_id = Input::get('annual_plan_id');
788
+    $objective_id = Input::get('objective_id');
789
+    $course_code = Input::get('course_code');
790
+    $course_number = Input::get('course_number');
791
+
792
+    $newTransId = DB::table('transformative_actions')
793
+      ->insertGetId(array(
794
+        'is_custom' => $is_custom,
795
+        'at_text' => $at_text,
796
+        'description' => $description,
797
+        'type_of_TA' => $type_of_ta,
798
+        'user_id' => Auth::user()->id,
799
+        'program_id' => $program_id,
800
+        'by_professor' => 0,
801
+        'created_at' => date('Y-m-d H:i:s'),
802
+        'updated_at' => date('Y-m-d H:i:s')
803
+      ));
804
+    DB::table('ta_course')->insert(array(
805
+      'ta_id' => $newTransId,
806
+      'course_number' => $course_number,
807
+      'course_code' => $course_code
808
+    ));
809
+    DB::table('transformative_objective')->insert(array(
810
+      'ta_id' => $newTransId,
811
+      'objective_id' => $objective_id
812
+    ));
813
+    foreach ($future_typ_course_id as $index => $typ_future_course_id) {
814
+      $annual_plan = DB::table('annual_cycle')
815
+        ->join('annual_plans', 'annual_plans.annual_cycle_id', '=', 'annual_cycle.id')
816
+        ->where('program_id', $program_id)
817
+        ->where(function ($query) use (&$future_semesters, &$index) {
818
+          $query->where('semester_start', $future_semesters[$index])
819
+            ->orWhere('semester_end', $future_semesters[$index]);
820
+        })->first();
821
+      DB::table('annual_plan_transformative')
822
+        ->insert(array(
823
+          'annual_plan_id' => $annual_plan->id,
824
+          'trans_id' => $newTransId,
825
+          'typ_semester_course_id' => $typ_future_course_id,
826
+          'proposing_coordinator_id' => Auth::user()->id,
827
+          'proposed_date' => date('Y-m-d H:i:s')
828
+        ));
829
+    }
830
+  }
831
+
774 832
   public function fetchTheAnnualPlan()
775 833
   {
776 834
     $outcome_id = Input::get('id');

app/database/migrations/2022_02_15_121554_create_transformative_future_course.php → app/database/unusedMigrations/2022_02_15_121554_create_transformative_future_course.php Bestand weergeven


+ 47
- 2
app/models/Course.php Bestand weergeven

@@ -43,13 +43,58 @@ class Course extends Eloquent
43 43
       ->select('activities.id')
44 44
       ->distinct()
45 45
       ->lists('activities.id');
46
-    Log::info($activitiesAssessed);
46
+    //Log::info($activitiesAssessed);
47 47
 
48 48
     return $this->hasMany('Activity')->whereIn('activities.id', $activitiesAssessed)->orderBy('date', 'asc');
49 49
 
50 50
     //    return $this->hasMany('Activity')->where('activities.draft', 0)->orderBy('date', 'asc');
51 51
   }
52
+  public static function get_associated_objective_outcome($typ_semester_course_id)
53
+  {
54
+    return DB::table('typ_semester_outcome')->join('typ_semester_objectives', 'typ_semester_outcome.id', '=', 'typ_semester_objectives.typ_semester_outcome_id')
55
+      ->join('typ_semester_courses', 'typ_semester_courses.typ_semester_objective_id', '=', 'typ_semester_objectives.id')
56
+      ->where('typ_semester_courses.id', $typ_semester_course_id);
57
+  }
52 58
 
59
+  public static function getFutureTypSemesterCourses($typ_semester_course_id, $program_id)
60
+  {
61
+    $typ_info = DB::table('typ_semester_outcome')
62
+      ->join('typ_semester_objectives', 'typ_semester_outcome.id', '=', 'typ_semester_objectives.typ_semester_outcome_id')
63
+      ->join('typ_semester_courses', 'typ_semester_courses.typ_semester_objective_id', '=', 'typ_semester_objectives.id')
64
+      ->join('typ_semester_outcome as typ_o_2', 'typ_o_2.outcome_id', '=', 'typ_semester_outcome.outcome_id')
65
+      ->join('semesters as sem1', 'sem1.id', '=', 'typ_semester_outcome.semester_id')
66
+      ->join('typ_semester_objectives as typ_ob_2', function ($query) {
67
+        $query->on('typ_ob_2.typ_semester_outcome_id', '=', 'typ_o_2.id')
68
+          ->on('typ_semester_objectives.objective_id', '=', 'typ_ob_2.objective_id');
69
+      })
70
+      ->join('typ_semester_courses as typ_course_2', function ($join) {
71
+        $join->on('typ_course_2.typ_semester_objective_id', '=', 'typ_ob_2.id')
72
+          ->on('typ_semester_courses.course_id', '=', 'typ_course_2.course_id');
73
+      })
74
+      ->join('typ_program', 'typ_o_2.typ_program_id', '=', 'typ_program.id')
75
+      ->join('semesters', 'semesters.id', '=', 'typ_o_2.semester_id')
76
+
77
+      ->where('typ_semester_courses.id', $typ_semester_course_id)
78
+      ->where('typ_program.program_id', $program_id)
79
+      ->whereRaw('sem1.code < semesters.code')
80
+      ->groupBy('typ_o_2.semester_id')
81
+      ->select(
82
+        'typ_o_2.semester_id',
83
+        'typ_o_2.outcome_id',
84
+        'typ_o_2.id',
85
+        'typ_semester_courses.course_id',
86
+        'typ_semester_objectives.objective_id',
87
+        'typ_ob_2.id as typ_future_objective_id',
88
+        'typ_course_2.id as typ_future_course_id',
89
+        'semesters.name as semester_name',
90
+        'semesters.code as semester_code'
91
+      );
92
+    //Log::info('El sql');
93
+    //Log::info($typ_info->toSql());
94
+    //Log::info($typ_semester_course_id);
95
+    //Log::info($program_id);
96
+    return $typ_info->get();
97
+  }
53 98
   public function publishedActivities()
54 99
   {
55 100
     $activitiesAssessed = DB::table('activities')
@@ -249,7 +294,7 @@ class Course extends Eloquent
249 294
 
250 295
       //Log::info($criteria_id);
251 296
       Log::info('los courseCode');
252
-      Log::info(array($course_code));
297
+      // Log::info(array($course_code));
253 298
       Log::info('los programas');
254 299
       Log::info($program_ids);
255 300
 

+ 4
- 2
app/models/Objective.php Bestand weergeven

@@ -34,7 +34,7 @@ class Objective extends Eloquent
34 34
             ->join('courses', 'courses.id', '=', 'typ_semester_courses.course_id')
35 35
             ->where('typ_semester_objective_id', $objective->typ_semester_objective_id)
36 36
             ->where('courses.program_id', $objective->program_id)
37
-            ->select('courses.code', 'courses.number', 'typ_semester_courses.id as typ_semester_course_id', DB::raw("'{$objective->semester_id}' as semester_id"), "courses.program_id")
37
+            ->select('courses.code', 'courses.number', 'courses.id as course_id', 'typ_semester_courses.id as typ_semester_course_id', DB::raw("'{$objective->semester_id}' as semester_id"), "courses.program_id")
38 38
             ->get();
39 39
         Log::info($course_codes);
40 40
 
@@ -46,9 +46,11 @@ class Objective extends Eloquent
46 46
                 ->where('typ_semester_course_id', $course_code->typ_semester_course_id)
47 47
                 ->select('transformative_actions.*')
48 48
                 ->get();
49
+            $course_code->future_typ_course_id = Course::getFutureTypSemesterCourses($course_code->typ_semester_course_id, $course_code->program_id);
50
+
49 51
 
50 52
             $course_code->students = Course::getStudentReportForOutcome($course_code);
51
-            Log::info(array($course_code));
53
+            //Log::info(array($course_code));
52 54
             $course_code->criteria = Course::getCriteriaPlanReport($course_code);
53 55
         }
54 56
         return $course_codes;

+ 32
- 0
app/models/TransformativeAction.php Bestand weergeven

@@ -11,4 +11,36 @@ class TransformativeAction extends Eloquent
11 11
             ->where('semester_id', $semester_id)
12 12
             ->first();
13 13
     }
14
+
15
+    public static function getCategoriesHtml($program_id)
16
+    {
17
+        $categories = "<option value='0'>Nothing Selected</option>";
18
+
19
+        $types = DB::table('transformative_actions')
20
+            ->select('type_of_TA', 'is_custom')
21
+            ->where('type_of_TA', '<>', '')
22
+            ->where(function ($query) use (&$program_id) {
23
+                $query->whereNull('program_id')
24
+                    ->orWhere('program_id', $program_id);
25
+            })
26
+            ->where('by_professor', 0)
27
+            ->groupBy('type_of_TA')
28
+            ->get();
29
+        $optGroupGeneral = "<optgroup label='General Transformative Actions'>";
30
+        $optGroupCustom = "<optgroup label ='Program Custom Actions'>";
31
+        foreach ($types as $type) {
32
+
33
+            if ($type->is_custom) {
34
+                $optGroupCustom .= "<option value = '" . $type->type_of_TA . "' data-is-custom = '1'>" . $type->type_of_TA . "</option>";
35
+            } else {
36
+                $optGroupGeneral .= "<option value = '" . $type->type_of_TA . "' data-is-custom = '0'>" . $type->type_of_TA . "</option>";
37
+            }
38
+        }
39
+        $categories .= $optGroupGeneral . '</optgroup>';
40
+        $categories .= $optGroupCustom . '</optgroup>';
41
+
42
+
43
+        $categories .= '<option value ="new"> New Type of Transformative Action</option>';
44
+        return $categories;
45
+    }
14 46
 }

+ 9
- 0
app/routes.php Bestand weergeven

@@ -208,6 +208,8 @@ Route::group(array('before' => 'auth|has_access'), function () {
208 208
     Route::post('fetchTransformativeStatus', array('uses' => 'TransformativeActionsController@fetchStatus'));
209 209
 
210 210
     Route::post('saveTransStatus', array('uses' => 'TransformativeActionsController@saveTransStatus'));
211
+
212
+    Route::post('futureTransformativeCourse', 'AnnualPlansController@futureTransformative');
211 213
     //other stuff
212 214
     Route::post('postActivityCriterionTrans/{activity_id}', array(
213 215
         'as' => 'postActivityCriterionTrans/{activity_id}',
@@ -342,6 +344,13 @@ Route::group(array('before' => 'auth|has_access'), function () {
342 344
             'before' => 'csrf',
343 345
             'uses' => 'CriteriaController@fetch'
344 346
         ));
347
+
348
+        //Plans routes
349
+        Route::post('showThreeYearPlans', 'ThreeYearPlanController@adminIndex');
350
+        Route::post('showAnnualPlans', 'AnnualPlansController@adminIndex');
351
+
352
+
353
+        //endhere
345 354
         Route::post('createOutcome', array('before' => 'csrf', 'uses' => 'OutcomesController@create'));
346 355
         Route::post('createCriterion', array('before' => 'csrf', 'uses' => 'CriteriaController@create'));
347 356
 

+ 9
- 0
app/views/local/managers/admins/_navigation.blade.php Bestand weergeven

@@ -53,6 +53,7 @@
53 53
 
54 54
             @endif
55 55
 
56
+
56 57
             <li class="dropdown">
57 58
                 <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button"
58 59
                     aria-expanded="false">Results<span class="caret"></span></a>
@@ -67,6 +68,14 @@
67 68
                     @endif
68 69
                 </ul>
69 70
             </li>
71
+            <li class="dropdown">
72
+                <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Program Plans
73
+                    <span class="caret"></span></a>
74
+                <ul class="dropdown-menu" role="menu">
75
+                    <li>{{ HTML::linkAction('AnnualPlansController@adminIndex', 'Annual Plans') }}</li>
76
+                    <li>{{ HTML::linkAction('ThreeYearPlanController@adminIndex', 'Three Year Plans') }}</li>
77
+                </ul>
78
+            </li>
70 79
 
71 80
             <li class="dropdown">
72 81
                 <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Help<span

+ 313
- 2
app/views/local/managers/shared/annual_report.blade.php Bestand weergeven

@@ -92,7 +92,7 @@
92 92
                 <div class="modal-header">
93 93
                     <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
94 94
                             aria-hidden="true">&times;</span></button>
95
-                    <h3 class="modal-title"></h3>
95
+                    <h3 id ='transformative_modal_title' class="modal-title"></h3>
96 96
                 </div>
97 97
                 <div class="modal-body">
98 98
                    <h5 id="was_it_implemented"> </h5>
@@ -124,6 +124,28 @@
124 124
             </div><!-- /.modal-content -->
125 125
         </div><!-- /.modal-dialog -->
126 126
     </div><!-- /.modal -->
127
+
128
+    <div class="modal fade" id="modal-future-trans-course">
129
+        <div class="modal-dialog modal-lg">
130
+            <div class="modal-content">
131
+                <div class="modal-header">
132
+                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
133
+                            aria-hidden="true">&times;</span></button>
134
+                    <h3 class="modal-title"></h3>
135
+                </div>
136
+                <div class="modal-body">
137
+                
138
+            
139
+   
140
+              
141
+            </div>
142
+            <div class='modal-footer'>
143
+                <button type="button" class="btn btn-secondary" data-dismiss="modal" >Cancel</button>
144
+                <button type="button" class="btn btn-primary" id ="save_transformative_info" onclick ='saveTransReport()'>Save</button>
145
+            </div>
146
+            </div><!-- /.modal-content -->
147
+        </div><!-- /.modal-dialog -->
148
+    </div><!-- /.modal -->
127 149
     <script>
128 150
         function nextChar(c) {
129 151
             return String.fromCharCode(c.charCodeAt(0) + 1);
@@ -370,6 +392,288 @@
370 392
             }
371 393
         }
372 394
 
395
+        function draw_transformative_future_course(course_code){
396
+
397
+            /* This is the modal
398
+            <div class="modal fade" id="modal-future-trans-course">
399
+        <div class="modal-dialog modal-lg">
400
+            <div class="modal-content">
401
+                <div class="modal-header">
402
+                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
403
+                            aria-hidden="true">&times;</span></button>
404
+                    <h3 class="modal-title"></h3>
405
+                </div>
406
+                <div class="modal-body">
407
+                
408
+            
409
+   
410
+              
411
+            </div>
412
+            <div class='modal-footer'>
413
+                <button type="button" class="btn btn-secondary" data-dismiss="modal" >Cancel</button>
414
+                <button type="button" class="btn btn-primary" id ="save_transformative_info" onclick ='saveTransReport()'>Save</button>
415
+            </div>
416
+            </div><!-- /.modal-content -->
417
+        </div><!-- /.modal-dialog -->
418
+    </div><!-- /.modal --> */
419
+
420
+            return_complete_div = $('<div>');
421
+
422
+            typ_semester_course_id = course_code.typ_semester_course_id;
423
+            modalComplete = $('<div>',{
424
+                'class':'modal fade',
425
+                'id':'modal_for_future_trans_on_'+typ_semester_course_id
426
+            });
427
+            modalDialog = $('<div>',{
428
+                'class':'modal-dialog modal-lg'
429
+            });
430
+            modalComplete.append(modalDialog);
431
+            
432
+            modalContent = $('<div>',{
433
+                'class':'modal-content'
434
+            });
435
+
436
+            modalDialog.append(modalContent);
437
+
438
+            modalHeader = $('<div>', {
439
+                'class':'modal-header'
440
+            }).html('<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>'+
441
+            '<h3 class="modal-title">Future Transformative Actions for '+course_code.code+' '+course_code.number+'</h3>');
442
+
443
+
444
+            
445
+            modalContent.append(modalHeader);
446
+
447
+
448
+            modalBody = $('<div>', {
449
+                'class':'modal-body'
450
+            });
451
+            modalContent.append(modalBody);
452
+
453
+            div_for_name = $('<div>', {
454
+                'class': 'form-group',
455
+
456
+            });
457
+
458
+
459
+
460
+            input_name = $('<input>', {
461
+                'class': 'form-control',
462
+
463
+                'name': 'at_text',
464
+                'id': 'at_text_for_'+typ_semester_course_id
465
+            });
466
+
467
+            div_for_name.html("<label> Name</label>");
468
+            div_for_name.append(input_name);
469
+            modalBody.append(div_for_name);
470
+
471
+            div_for_category = $('<div>', {
472
+                'class': 'form-group'
473
+            }).html('<label>Type of Transformative Action</label>');
474
+
475
+            select_for_category = $('<select>', {
476
+                'name': 'type_of_ta',
477
+                'id': 'type_of_ta_of_'+typ_semester_course_id,
478
+                'class': 'form-control selectpicker',
479
+                'onchange': 'checkIfNew(this)'
480
+            }).html(GlobalTransCategories);
481
+
482
+            div_for_category.append(select_for_category);
483
+            modalBody.append(select_for_category);
484
+            
485
+
486
+            div_description = $('<div>', {
487
+                'class': 'form-group',
488
+
489
+            }).html('<label> Description</label>');
490
+
491
+            textarea = $('<textarea>', {
492
+                'class': 'form-control',
493
+                'id': 'description_for_'+typ_semester_course_id,
494
+                'name': 'description',
495
+                'rows': '10'
496
+            });
497
+
498
+            div_description.append(textarea);
499
+            modalBody.append(div_description);
500
+            modalBody.append('<hr><label>Select when will this transformative action will be implemeneted</label>');
501
+
502
+           
503
+            
504
+            selectpicker_for_semesters = $('<select>',{
505
+                'name':'selected_semesters_for_'+typ_semester_course_id+'_[]',
506
+                'id':'selected_semester_first_for_'+typ_semester_course_id,
507
+                'class':'form-control selectpicker'
508
+            });
509
+            options_for_semesters='<option value = "0">Nothing Selected</option>';
510
+            $.each(course_code.future_typ_course_id, function(index, typ_future){
511
+                options_for_semesters +='<option value="'+typ_future.typ_future_course_id+'" data-semester-id ="'+typ_future.semester_id+'" data-objective-id = "'+typ_future.objective_id+'" >'+typ_future.semester_name+' ['+typ_future.semester_code+'] '+'</option>';
512
+            });
513
+            selectpicker_for_semesters.html(options_for_semesters);
514
+
515
+            modalBody.append(selectpicker_for_semesters);
516
+            modalBody.append('<br><br>');
517
+
518
+            button_for_more = $('<button>', {
519
+                'class':'btn btn-secondary', 
520
+                'onclick':'addMoreSemesters('+typ_semester_course_id+', this)',
521
+                'style':'float:right'
522
+            }).html('<span class="glyphicon glyphicon-plus">'+
523
+            '</span>Add another semester');
524
+
525
+            modalBody.append(button_for_more);
526
+            modalBody.append('<br><br>');
527
+
528
+            
529
+
530
+
531
+
532
+            
533
+            modalFooter = $('<div>',{
534
+                'class':'modal-footer'
535
+            });
536
+            modalContent.append(modalFooter);
537
+        
538
+            close_button = $('<button>',{
539
+                'type':'button',
540
+                'class':'btn btn-secondary',
541
+                'data-dismiss':'modal'
542
+            }).html('Cancel');
543
+            save_button = $('<button>',{
544
+                'class':'btn btn-primary',
545
+                'onclick':'saveFutureTrans('+typ_semester_course_id+', "'+course_code.code+'", "'+course_code.number+'")'
546
+            }).html('Save');
547
+
548
+            modalFooter.append(close_button);
549
+            modalFooter.append(save_button);
550
+
551
+
552
+            return_complete_div.append(modalComplete);
553
+
554
+            return_complete_div.append('<h3>Future Transformative Actions for '+course_code.code+' '+course_code.number);
555
+            
556
+
557
+            return_complete_div.append('<hr><button type="button" class="btn btn-primary btn-block" data-toggle="modal" data-target="#modal_for_future_trans_on_'+typ_semester_course_id+'">' +
558
+                            'Add Transformative Actions' +
559
+                            '</button><hr>')
560
+
561
+            return return_complete_div;
562
+
563
+
564
+
565
+
566
+
567
+        }
568
+
569
+        function saveFutureTrans(typ_semester_course_id, course_code, course_number){
570
+            annual_plan_id = $('#annual_plan').val()
571
+            at_text = $('#at_text_for_'+typ_semester_course_id).val();
572
+            type_of_TA = $('#type_of_ta_of_'+typ_semester_course_id).val();
573
+            is_custom = $('#type_of_ta_of_'+typ_semester_course_id).find('option:selected').data('is-custom');
574
+            if(type_of_TA == "new"){
575
+                type_of_TA = $('#new_type_type_of_ta_of_'+typ_semester_course_id).val();
576
+                is_custom = 1;
577
+            }
578
+            description = $('#description_for_'+typ_semester_course_id).val();
579
+            future_typ_course_id =[];
580
+            future_semesters = [];
581
+            objective_id =0
582
+
583
+            $.each($('select[name="selected_semesters_for_'+typ_semester_course_id+'_[]"]'), function(index, select){
584
+                objective_id = $(select).find('option:selected').data('objective-id');
585
+                future_semesters.push($(select).find('option:selected').data('semester-id'));
586
+                future_typ_course_id.push($(select).val());
587
+            });
588
+            $.post(
589
+                "{{URL::action('AnnualPlansController@futureTransformative')}}",
590
+                {
591
+                    at_text:at_text,
592
+                    type_of_TA:type_of_TA,
593
+                    description:description,
594
+                    future_semesters:future_semesters,
595
+                    future_typ_course_id:future_typ_course_id,
596
+                    is_custom:is_custom,
597
+                    program_id:{{$program->id}},
598
+                    annual_plan_id:annual_plan_id,
599
+                    course_code:course_code,
600
+                    course_number:course_number,
601
+                    objective_id:objective_id
602
+                },
603
+                function(data){
604
+                    alert('estamos');
605
+                }
606
+            )
607
+
608
+        }
609
+
610
+        function addMoreSemesters(typ_semester_course_id, button_add_new_semester){
611
+            first_select_options = $('#selected_semester_first_for_'+typ_semester_course_id).html();
612
+            /*<div class="input-group">
613
+  <select class="form-control">
614
+    <option>Select option..</option>
615
+    <option>Option 1</option>
616
+    <option>Option 2</option>
617
+  </select>            
618
+  <span class="input-group-btn">
619
+    <button class="btn btn-default" type="button" tabindex="-1"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span></button>
620
+  </span>
621
+</div> */
622
+            input_group = $('<div>', {
623
+                'class':'input-group'
624
+            });
625
+            newselect = $('<select>',{
626
+                'name':'selected_semesters_for_'+typ_semester_course_id+'_[]',
627
+                //'id':'selected_semester_first_for_'+typ_semester_course_id,
628
+                'class':'form-control selectpicker'
629
+            }).html(first_select_options);
630
+
631
+            span_group = $("<span>",{
632
+                'class':'input-group-btn',
633
+
634
+            });
635
+            button_for_close = $('<button>',{
636
+                'class':'btn btn-primary',
637
+                'type':'button',
638
+                'onclick': '$(this).parent().parent().remove()'
639
+
640
+            }).html('<span class="glyphicon glyphicon-remove" aria-hidden="true"></span></button>');
641
+            span_group.append(button_for_close);
642
+            input_group.append(newselect);
643
+            input_group.append(span_group);
644
+            input_group.insertBefore($(button_add_new_semester));
645
+            //input_group.prepend('<hr>');
646
+            $('.selectpicker').selectpicker('refresh');
647
+
648
+        }
649
+
650
+        function checkIfNew(select) {
651
+            id =$(select).attr('id');
652
+if ($(select).val() == "new") {
653
+    var new_div = $('<div/>', {
654
+        'class': 'form-group new_type'
655
+    }).html("<label>New Type </label>");
656
+
657
+    var input = $("<input/>", {
658
+        'type': 'text',
659
+        'id': 'new_type_'+id,
660
+        'name': "new_type",
661
+        'class': 'form-control'
662
+    });
663
+    new_div.append(input);
664
+
665
+    $(select).parent().after(new_div)
666
+
667
+} else {
668
+    $(select).parent().next('.new_type').remove();
669
+}
670
+
671
+
672
+}
673
+
674
+
675
+        GlobalTransCategories= '';
676
+
373 677
         function fetchEverything(li) {
374 678
             var outcome_id = $(li).data('outcome-id');
375 679
             var name = $(li).data('outcome-name');
@@ -398,6 +702,7 @@
398 702
                         } else {
399 703
                             outcome.outcome_program_goal = 'It has not been defined';
400 704
                         }
705
+                        GlobalTransCategories = outcome.transformative_actions_categories_html;
401 706
                         var outcomeHTML = "<h4>Performance of Students by Learning Outcome</h4>" +
402 707
                             '<h5 style = "display: inline; margin:30px;">Target learning by learning outcome: </h5>' +
403 708
                             '<p  style = "display: inline;"> <i>>= ' + outcome.expected_outcome +
@@ -538,8 +843,14 @@
538 843
                                             table_for_transformative_actions.append(tbody_for_transformative_actions);
539 844
                                             div.append('<hr><h4>Transformative actions for '+course_code.code+' '+course_code.number+'</h4>')
540 845
                                             div.append(table_for_transformative_actions);
846
+                                            div.append('<hr>');
847
+
848
+                                         
541 849
                                             //table_for_transformative_actions.DataTable();
542 850
                                         }
851
+                                        the_drawn_transformative_future_html = draw_transformative_future_course(course_code, outcome.transformative_actions_categories_html);
852
+                                            div.append(the_drawn_transformative_future_html);
853
+                                            $('.selectpicker').selectpicker('refresh');
543 854
 
544 855
                                         
545 856
                                         table.DataTable();
@@ -670,7 +981,7 @@
670 981
                 success: function(transformative_action_with_status) {
671 982
                     transformative_action = transformative_action_with_status[0];
672 983
 
673
-                    $('.modal-title').html('<strong>'+transformative_action.at_text+'</strong>: '+transformative_action.description);
984
+                    $('#transformative_modal_title').html('<strong>'+transformative_action.at_text+'</strong>: '+transformative_action.description);
674 985
                     
675 986
                    
676 987
                     $('input[name="implemented"]').prop('checked',false);