Gabriel Santiago Plaza il y a 2 ans
Parent
révision
18554c25f2

+ 44
- 4
app/controllers/AnnualPlansController.php Voir le fichier

@@ -42,7 +42,9 @@ class AnnualPlansController extends \BaseController
42 42
 
43 43
   public function viewAllPlans($program_id)
44 44
   {
45
-    $title = "Annual Plans";
45
+    $program = Program::find($program_id);
46
+    $title = "Annual Plans for " . $program->name;
47
+
46 48
     $annual_plans = DB::select("select semester_start, semester_end, program_id, annual_plans.id, academic_year from annual_plans, annual_cycle   where annual_plans.annual_cycle_id = annual_cycle.id and program_id ={$program_id} order by id desc");
47 49
 
48 50
 
@@ -132,7 +134,8 @@ class AnnualPlansController extends \BaseController
132 134
 
133 135
   public function showPlan($program_id, $typ_id = null)
134 136
   {
135
-    $title = "Annual Plans";
137
+    $program = Program::find($program_id);
138
+    $title = "Annual Plans for " . $program->name;
136 139
     //$typ_parts = DB::select("select * from typ_parts");
137 140
 
138 141
     //     $current_typ = DB::select("select * from three_year_plan where year_start <=" . date('Y') . " and year_end >=" . date('Y'))[0];
@@ -145,7 +148,7 @@ class AnnualPlansController extends \BaseController
145 148
     }
146 149
 
147 150
 
148
-    $program = Program::where('id', '=', $program_id)->first();
151
+    //$program = Program::where('id', '=', $program_id)->first();
149 152
 
150 153
     //Dame los annual plans que esten dentro del three year plan
151 154
 
@@ -644,4 +647,41 @@ class AnnualPlansController extends \BaseController
644 647
 
645 648
     return $outcome;
646 649
   }
647
-}
650
+
651
+  public function fetchObjectiveInfo()
652
+  {
653
+    $typ_objective_id = Input::get('typ_objective_id');
654
+    $courses = DB::table('typ_semester_courses')
655
+      ->join('courses', 'courses.id', '=', 'typ_semester_courses.course_id')
656
+
657
+      ->select('courses.code', 'courses.number', 'courses.name', 'typ_semester_courses.id as typ_semester_course_id')
658
+      ->where('typ_semester_objective_id', $typ_objective_id)
659
+      ->distinct()
660
+      ->get();
661
+    foreach ($courses as $course) {
662
+      /*$course->criteria_scale = DB::table('annual_plan_objective')
663
+        ->join('criteria', 'criteria.id', '=', 'annual_plan_objective.criteria_id')
664
+        ->join('criterion_scale', 'criterion_scale.criterion_id', '=', 'criteria.id')
665
+        ->join('scales', 'scales.id', '=', 'criterion_scale.scale_id')
666
+        ->select('criterion_scale.*', 'scales.*')
667
+        ->where('typ_semester_course_id', $course->typ_semester_course_id)
668
+        ->orderBy('position', 'ASC')
669
+        ->get();*/
670
+      $course->criteria = DB::table('annual_plan_objective')
671
+        ->join('criteria', 'criteria.id', '=', 'annual_plan_objective.criteria_id')
672
+        ->where('typ_semester_course_id', $course->typ_semester_course_id)
673
+        ->select('criteria.*')
674
+        ->get();
675
+      foreach ($course->criteria as $criterion) {
676
+        $criterion->scales = DB::table('criteria')
677
+          ->join('criterion_scale', 'criterion_scale.criterion_id', '=', 'criteria.id')
678
+          ->join('scales', 'scales.id', '=', 'criterion_scale.scale_id')
679
+          ->select('criterion_scale.*', 'scales.*')
680
+          ->where('criteria.id', $criterion->id)
681
+          ->orderBy('position', 'ASC')
682
+          ->get();
683
+      }
684
+    }
685
+    return $courses;
686
+  }
687
+}

+ 3
- 3
app/controllers/OutcomesController.php Voir le fichier

@@ -1053,7 +1053,7 @@ class OutcomesController extends \BaseController
1053 1053
 
1054 1054
     public function annualReport($program_id)
1055 1055
     {
1056
-        $title = "Program Courses Report";
1056
+        $title = "Program Annual Report";
1057 1057
 
1058 1058
 
1059 1059
         $annual_plans = $annual_plans = DB::select("
@@ -1067,7 +1067,7 @@ class OutcomesController extends \BaseController
1067 1067
           annual_cycle.*
1068 1068
         from annual_plans 
1069 1069
         join annual_cycle on annual_cycle_id = annual_cycle.id 
1070
-        where program_id = 110 
1070
+        where program_id = {$program_id} 
1071 1071
         and(
1072 1072
           semester_start in(
1073 1073
             select semester_id 
@@ -1088,4 +1088,4 @@ class OutcomesController extends \BaseController
1088 1088
 
1089 1089
         return View::make('local.managers.shared.annual_report', compact('title', 'program_id', 'annual_plans', 'program'));
1090 1090
     }
1091
-}
1091
+}

+ 56
- 0
app/database/migrations/2022_02_03_135359_create_transformative_typ_outcome.php Voir le fichier

@@ -0,0 +1,56 @@
1
+<?php
2
+
3
+use Illuminate\Database\Schema\Blueprint;
4
+use Illuminate\Database\Migrations\Migration;
5
+
6
+class CreateTransformativeTypOutcome extends Migration
7
+{
8
+
9
+	/**
10
+	 * Run the migrations.
11
+	 *
12
+	 * @return void
13
+	 */
14
+	public function up()
15
+	{
16
+		Schema::create('transformative_typ_outcome', function (Blueprint $table) {
17
+			$table->increments('id');
18
+			$table->integer('trans_id')->unsigned();
19
+			$table->integer('typ_semester_outcome_id')->unsigned();
20
+			$table->foreign('trans_id')
21
+				->references('id')
22
+				->on('transformative_actions')
23
+				->onDelete('cascade')
24
+				->onUpdate('cascade');
25
+			$table->foreign('typ_semester_outcome_id')
26
+				->references('id')
27
+				->on('typ_semester_outcome')
28
+				->onDelete('cascade')
29
+				->onUpdate('cascade');
30
+			$table->integer('proposing_coordinator_id')->unsigned();
31
+			$table->foreign('proposing_coordinator_id')
32
+				->references('id')
33
+				->on('users')
34
+				->onDelete('restrict')
35
+				->onUpdate('restrict');
36
+
37
+
38
+
39
+			$table->timestamp('created_at')->default(DB::raw('CURRENT_TIMESTAMP'));
40
+			$table->timestamp('updated_at')->default(DB::raw('CURRENT_TIMESTAMP'));
41
+			$table->timestamp('deleted_at')->default(DB::raw('CURRENT_TIMESTAMP'));
42
+			//$table->softDeletes()->default(DB::raw('CURRENT_TIMESTAMP'));
43
+
44
+		});
45
+	}
46
+
47
+	/**
48
+	 * Reverse the migrations.
49
+	 *
50
+	 * @return void
51
+	 */
52
+	public function down()
53
+	{
54
+		Schema::drop('transformative_typ_outcome');
55
+	}
56
+}

+ 42
- 0
app/database/migrations/2022_02_03_193908_create_transformative_action_status.php Voir le fichier

@@ -0,0 +1,42 @@
1
+<?php
2
+
3
+use Illuminate\Database\Schema\Blueprint;
4
+use Illuminate\Database\Migrations\Migration;
5
+
6
+class CreateTransformativeActionStatus extends Migration
7
+{
8
+
9
+	public function up()
10
+	{
11
+		Schema::create('transformative_action_status', function (Blueprint $table) {
12
+			$table->increments('id');
13
+			$table->boolean('accomplished');
14
+			$table->boolean('it_was_useful')->default(0);
15
+
16
+			$table->integer('trans_id')->unsigned();
17
+			$table->foreign('trans_id')
18
+				->references('id')
19
+				->on('transformative_actions')
20
+				->onDelete('cascade')
21
+				->onUpdate('cascade');
22
+
23
+			$table->integer('supervised_coordinator_id')->unsigned();
24
+			$table->foreign('supervised_coordinator_id')
25
+				->references('id')
26
+				->on('users')
27
+				->onDelete('restrict')
28
+				->onUpdate('restrict');
29
+			$table->text('comments')->nullable();
30
+		});
31
+	}
32
+
33
+	/**
34
+	 * Reverse the migrations.
35
+	 *
36
+	 * @return void
37
+	 */
38
+	public function down()
39
+	{
40
+		Schema::drop('transformative_action_status');
41
+	}
42
+}

+ 32
- 0
app/database/migrations/2022_02_04_040351_add_submit_in_typ_program.php Voir le fichier

@@ -0,0 +1,32 @@
1
+<?php
2
+
3
+use Illuminate\Database\Schema\Blueprint;
4
+use Illuminate\Database\Migrations\Migration;
5
+
6
+class AddSubmitInTypProgram extends Migration
7
+{
8
+
9
+	/**
10
+	 * Run the migrations.
11
+	 *
12
+	 * @return void
13
+	 */
14
+	public function up()
15
+	{
16
+		Schema::table('courses', function (Blueprint $table) {
17
+			$table->boolean('is_submitted');
18
+		});
19
+	}
20
+
21
+	/**
22
+	 * Reverse the migrations.
23
+	 *
24
+	 * @return void
25
+	 */
26
+	public function down()
27
+	{
28
+		Schema::table('courses', function (Blueprint $table) {
29
+			$table->dropColumn('is_submitted');
30
+		});
31
+	}
32
+}

app/database/migrations/2021_06_15_235911_create_annual_report_transformative_table.php → app/database/unusedMigrations/2021_06_15_235911_create_annual_report_transformative_table.php Voir le fichier


app/database/migrations/2022_01_19_100041_add_deleted_at_objectives.php → app/database/unusedMigrations/2022_01_19_100041_add_deleted_at_objectives.php Voir le fichier


+ 4
- 1
app/routes.php Voir le fichier

@@ -166,7 +166,10 @@ Route::group(array('before' => 'auth|has_access'), function () {
166 166
     /**
167 167
      * Shared Routes
168 168
      */
169
-
169
+    Route::post('fetchObjectiveInfo', array(
170
+        'as' => 'fetchObjectiveInfo',
171
+        'uses' => 'AnnualPlansController@fetchObjectiveInfo'
172
+    ));
170 173
     Route::get('selectAnnualProgram', array(
171 174
         'as' => 'selectAnnualProgram',
172 175
         'uses' => 'AnnualPlansController@selectProgramPlan'

+ 83
- 4
app/views/local/managers/shared/annual-plans.blade.php Voir le fichier

@@ -87,6 +87,19 @@
87 87
         </div>
88 88
 
89 89
     </div>
90
+    <div class="modal fade" id="modal-view-objective">
91
+        <div class="modal-dialog modal-lg">
92
+            <div class="modal-content">
93
+                <div class="modal-header">
94
+                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
95
+                    <h3 class="modal-title"></h3>
96
+                </div>
97
+                <div class="modal-body">
98
+                   
99
+                </div>
100
+            </div><!-- /.modal-content -->
101
+        </div><!-- /.modal-dialog -->
102
+    </div><!-- /.modal -->
90 103
     <script>
91 104
         function nextChar(c) {
92 105
             return String.fromCharCode(c.charCodeAt(0) + 1);
@@ -124,6 +137,72 @@
124 137
         //   console.log(console.log(annual_id));
125 138
         // }
126 139
 
140
+        function fetchObjectiveInfo(objective_div){
141
+            typ_objective_id = $(objective_div).data('typ-objective-id');
142
+            objective =  $(objective_div).html();
143
+            
144
+            $.ajax({
145
+        type: 'POST',
146
+        url: "{{ URL::action('AnnualPlansController@fetchObjectiveInfo') }}",
147
+        data: {
148
+            typ_objective_id: typ_objective_id
149
+        },
150
+        success: function(courses)
151
+        {
152
+            
153
+            $('.modal-title').html(objective);
154
+            descriptions = '';
155
+            $('.modal-body').empty();
156
+            $.each(courses, function(index, course){
157
+
158
+                $('.modal-body').append('<h4>'+course.code+' '+course.number+': '+course.name+'</h4>')
159
+                $('.modal-body').append('<br><p>The following course is tied to these criteria: </p>')
160
+                $.each(course.criteria, function(index,criterion){
161
+                    criterion_html = '<h5 style ="text-indent: 15px;">'+(index+1)+'. '+criterion.name+'</h5>';
162
+                    table = $('<table>', {
163
+                        'style':'margin-left:15px',
164
+                        //'id':'criteria-'+criterion.id,
165
+                        'class':"table table-striped table-condensed table-bordered"
166
+                    });
167
+                    thead = $('<thead/>');
168
+                    tr = $('<tr/>');
169
+                    for(i=0; i<criterion.num_scales;i++){
170
+                        minimumScore = 1+(i*(criterion.max_score/criterion.num_scales));
171
+                maximumScore = (1+i)*(criterion.max_score/criterion.num_scales);
172
+                th = '<th>Scale '+(i+1)+'. ('+minimumScore+' - '+maximumScore+')</th>';
173
+                tr.append(th);
174
+                    }
175
+                    thead.append(tr);
176
+                    table.append(thead);
177
+                    tbody = $('<tbody>')
178
+                    tr_for_body = $('<tr>', {
179
+                        'id':'criterion_'+criterion.id
180
+                    })
181
+                    td_for_criteria = '';
182
+                    $.each(criterion.scales, function(index, scale){
183
+                    
184
+                    td_for_criteria += '<td>'+scale.description+'</td>';
185
+                });
186
+                tr_for_body.html(td_for_criteria);
187
+                    tbody.append(tr_for_body);
188
+                    table.append(tbody);
189
+                    $('.modal-body').append(criterion_html);
190
+                    $('.modal-body').append(table);
191
+                })
192
+                
193
+                $('.modal-body').append('<hr>')
194
+            });
195
+            
196
+           
197
+
198
+            $('#modal-view-objective').modal();
199
+
200
+        },
201
+        async:true
202
+    });
203
+    
204
+}
205
+
127 206
         function fetchEverything(li) {
128 207
             var id = $(li).data('outcome-id');
129 208
             var name = $(li).data('outcome-name');
@@ -186,8 +265,8 @@
186 265
                         table.clear();
187 266
                         var annual_plan = json.annual_plan.id;
188 267
                         for (objective in objectives) {
189
-
190
-                            var objectivesHTML = '';
268
+                            var typ_objective_id = json.typ_objective_id[objectives[objective].id].id;
269
+                            var objectivesHTML = '<div class="criterion-field" data-typ-objective-id = "'+typ_objective_id+'" onclick = "fetchObjectiveInfo(this)">';
191 270
                             var courseshtml = '';
192 271
                             var courseTAhtml = '';
193 272
 
@@ -195,13 +274,13 @@
195 274
 
196 275
                             var criteriaHTML = '';
197 276
                             objectivesHTML += '<strong>' + nextLetter + '.    ' + objectives[objective].text +
198
-                                '</strong>';
277
+                                '</strong></div>';
199 278
                             // courseshtml += "<strong>Objective "+nextLetter+"</strong>";
200 279
                             // courseshtml += '<ul>';
201 280
                             criteriaHTML += "<strong>Objective " + nextLetter + "</strong>";
202 281
                             //criteriaHTML+= '<ol>';
203 282
 
204
-                            var typ_objective_id = json.typ_objective_id[objectives[objective].id].id;
283
+                            //var typ_objective_id = json.typ_objective_id[objectives[objective].id].id;
205 284
                             nextLetter = nextChar(nextLetter);
206 285
                             for (course in courses[objectives[objective].id]) {
207 286