Browse Source

creo que ahora si

parent
commit
0a9acbc46d

app/controllers/.gitkeep → app/.gitkeep View File


+ 16
- 11
app/controllers/AnnualPlansController.php View File

134
     $title = "Annual Plans";
134
     $title = "Annual Plans";
135
     //$typ_parts = DB::select("select * from typ_parts");
135
     //$typ_parts = DB::select("select * from typ_parts");
136
     if (!$typ_id) {
136
     if (!$typ_id) {
137
-      $current_typ = DB::select("select * from three_year_plan where year_start <=" . date('Y') . " and year_end >=" . date('Y'))[0]->id;
137
+      $current_typ = DB::select("select * from three_year_plan where year_start <=" . date('Y') . " and year_end >=" . date('Y'))[0];
138
     } else {
138
     } else {
139
-      $current_typ = DB::select("select * from three_year_plan where id ={$typ_id}")[0]->id;
139
+      $current_typ = DB::select("select * from three_year_plan where id ={$typ_id}")[0];
140
     }
140
     }
141
     Log::info($current_typ);
141
     Log::info($current_typ);
142
 
142
 
143
+
143
     $program = Program::where('id', '=', $program_id)->first();
144
     $program = Program::where('id', '=', $program_id)->first();
144
     $annual_plans = DB::select("select * from annual_plans where program_id = {$program_id} order by id desc limit 5");
145
     $annual_plans = DB::select("select * from annual_plans where program_id = {$program_id} order by id desc limit 5");
145
     Log::info($annual_plans);
146
     Log::info($annual_plans);
147
     $allSemesterOrder = array();
148
     $allSemesterOrder = array();
148
     foreach ($annual_plans as $an_plan) {
149
     foreach ($annual_plans as $an_plan) {
149
       Log::info($an_plan->id);
150
       Log::info($an_plan->id);
150
-      $outcomes[$an_plan->id]["first"] = DB::select("select * from outcomes where id in (select outcome_id from typ_semester_outcome where semester_id = {$an_plan->semester_start} and typ_program_id in (select id from typ_program where program_id ={$an_plan->program_id} and three_year_plan_id ={$current_typ} ))");
151
+      $outcomes[$an_plan->id]["first"] = DB::select("select * from outcomes where id in (select outcome_id from typ_semester_outcome where semester_id = {$an_plan->semester_start} and typ_program_id in (select id from typ_program where program_id ={$an_plan->program_id} and three_year_plan_id ={$current_typ->id} ))");
151
       $allSemesterOrder[$an_plan->id]["first"] = DB::select("select * from semesters where id = {$an_plan->semester_start}")[0];
152
       $allSemesterOrder[$an_plan->id]["first"] = DB::select("select * from semesters where id = {$an_plan->semester_start}")[0];
152
-      $outcomes[$an_plan->id]["second"] = DB::select("select * from outcomes where id in (select outcome_id from typ_semester_outcome where semester_id ={$an_plan->semester_end} and typ_program_id in (select id from typ_program where program_id ={$an_plan->program_id} and three_year_plan_id = {$current_typ} ))");
153
+      $outcomes[$an_plan->id]["second"] = DB::select("select * from outcomes where id in (select outcome_id from typ_semester_outcome where semester_id ={$an_plan->semester_end} and typ_program_id in (select id from typ_program where program_id ={$an_plan->program_id} and three_year_plan_id = {$current_typ->id} ))");
153
       $allSemesterOrder[$an_plan->id]["second"] = DB::select("select * from semesters where id = {$an_plan->semester_end}")[0];
154
       $allSemesterOrder[$an_plan->id]["second"] = DB::select("select * from semesters where id = {$an_plan->semester_end}")[0];
154
     }
155
     }
155
     $alltyp = DB::select('select * from three_year_plan order by id desc');
156
     $alltyp = DB::select('select * from three_year_plan order by id desc');
156
-
157
+    $current_typ = $current_typ->id;
157
     return View::make('local.managers.sCoords.annual-plans', compact('title', 'annual_plans', 'current_typ', 'program', 'outcomes', 'allSemesterOrder', 'alltyp'));
158
     return View::make('local.managers.sCoords.annual-plans', compact('title', 'annual_plans', 'current_typ', 'program', 'outcomes', 'allSemesterOrder', 'alltyp'));
158
   }
159
   }
159
 
160
 
256
     foreach ($transformative_action_info as $trans) {
257
     foreach ($transformative_action_info as $trans) {
257
       $json_to_send['Trans_act'][$trans->id] = $trans;
258
       $json_to_send['Trans_act'][$trans->id] = $trans;
258
       $json_to_send['outcomes'][$trans->id] = DB::select("select * from outcomes where id in (select outcome_id from typ_semester_outcome where id in(select typ_semester_outcome_id from typ_semester_objectives where id in (select typ_semester_objective_id from annual_plan_transformative where trans_id ={$trans->id} and annual_plan_id = {$annual_id})))");
259
       $json_to_send['outcomes'][$trans->id] = DB::select("select * from outcomes where id in (select outcome_id from typ_semester_outcome where id in(select typ_semester_outcome_id from typ_semester_objectives where id in (select typ_semester_objective_id from annual_plan_transformative where trans_id ={$trans->id} and annual_plan_id = {$annual_id})))");
259
-      $json_to_send['typ_objective'][$trans->id] = DB::select("select * from typ_semester_objectives where id in (select typ_semester_objective_id from annual_plan_transformative where annual_plan_id ={$annual_id} and trans_id = {$trans->id})");
260
-      foreach ($json_to_send['typ_objective'][$trans->id] as $typ) {
261
-        $json_to_send['objective'][$typ->id][$trans->id] = DB::select("select * from objectives where id = {$typ->objective_id}");
262
-        $json_to_send['coordinator'][$typ->id][$trans->id] = DB::select("select * from users where id in (select proposing_coordinator_id from annual_plan_transformative where typ_semester_objective_id = {$typ->id} and annual_plan_id = {$annual_id} and trans_id = {$trans->id})");
263
-        $json_to_send['proposed_date'][$typ->id][$trans->id] = DB::select("select proposed_date from annual_plan_transformative where typ_semester_objective_id = {$typ->id} and annual_plan_id = {$annual_id} and trans_id = {$trans->id} ");
264
-        $json_to_send['all_info_report'][$typ->id][$trans->id] = DB::select("select art.accomplished, art.cycle_of_life, semesters.name, art.semester_continue,  art.annual_trans_id, art.supervised_coordinator_id  from annual_report_transformative art, (select id from annual_plan_transformative where typ_semester_objective_id = {$typ->id} and annual_plan_id = {$annual_id} and trans_id = {$trans->id} ) apt, semesters  where art.annual_trans_id = apt.id and semesters.id = art.semester_used");
260
+
261
+      foreach ($json_to_send['outcomes'][$trans->id] as $outcome) {
262
+        $json_to_send['typ_objective'][$outcome->id][$trans->id] = DB::select("select * from typ_semester_objectives where typ_semester_outcome_id in (select id from typ_semester_outcome where outcome_id ={$outcome->id}) and id in (select typ_semester_objective_id from annual_plan_transformative where annual_plan_id ={$annual_id} and trans_id = {$trans->id})");
263
+        foreach ($json_to_send['typ_objective'][$outcome->id][$trans->id] as $typ) {
264
+          $json_to_send['objective'][$outcome->id][$typ->id][$trans->id] = DB::select("select * from objectives where id = {$typ->objective_id}");
265
+          $json_to_send['coordinator'][$outcome->id][$typ->id][$trans->id] = DB::select("select * from users where id in (select proposing_coordinator_id from annual_plan_transformative where typ_semester_objective_id = {$typ->id} and annual_plan_id = {$annual_id} and trans_id = {$trans->id})");
266
+          $json_to_send['proposed_date'][$outcome->id][$typ->id][$trans->id] = DB::select("select proposed_date from annual_plan_transformative where typ_semester_objective_id = {$typ->id} and annual_plan_id = {$annual_id} and trans_id = {$trans->id} ");
267
+          $json_to_send['all_info_report'][$outcome->id][$typ->id][$trans->id] = DB::select("select art.accomplished, art.cycle_of_life, semesters.name, art.semester_continue,  art.annual_trans_id, art.supervised_coordinator_id  from annual_report_transformative art, (select id from annual_plan_transformative where typ_semester_objective_id = {$typ->id} and annual_plan_id = {$annual_id} and trans_id = {$trans->id} ) apt, semesters  where art.annual_trans_id = apt.id and semesters.id = art.semester_used");
268
+        }
265
       }
269
       }
266
 
270
 
271
+
267
       if ($trans->user_id) {
272
       if ($trans->user_id) {
268
         $json_to_send['suggested'][$trans->id] = DB::select("select * from users where id = {$trans->user_id}");
273
         $json_to_send['suggested'][$trans->id] = DB::select("select * from users where id = {$trans->user_id}");
269
       }
274
       }

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

93
 		}
93
 		}
94
 
94
 
95
 		$clean_input['program_id'] = Input::get('program_id');
95
 		$clean_input['program_id'] = Input::get('program_id');
96
-
96
+		Log::info(Input::get('program_id'));
97
 
97
 
98
 		return $clean_input;
98
 		return $clean_input;
99
 	}
99
 	}

+ 238
- 221
app/controllers/ThreeYearPlanController.php View File

7
 
7
 
8
   public function threeYearsReport()
8
   public function threeYearsReport()
9
   {
9
   {
10
-      $user_id = auth::user()->id;
10
+    $user_id = auth::user()->id;
11
 
11
 
12
-      // el ID de los semestres que el usuario tiene seleccionado.
13
-      $semesters_ids = Session::get('semesters_ids');
14
-      // buscar informacion de los semestres seleccionados
15
-      $semesters = Semester::whereIn('id',$semesters_ids)->get();
12
+    // el ID de los semestres que el usuario tiene seleccionado.
13
+    $semesters_ids = Session::get('semesters_ids');
14
+    // buscar informacion de los semestres seleccionados
15
+    $semesters = Semester::whereIn('id', $semesters_ids)->get();
16
 
16
 
17
-      $title = "Three Year Plans Planning";
18
-      $outcomes = Outcome::orderBy('name', 'ASC')
19
-          ->where('deactivation_date','=','0000-00-00')
20
-          ->orWhereNull('deactivation_date')
21
-          ->get();
22
-      // $outcomes = DB::table('outcomes')
23
-      //     ->orderBy('name', 'asc')
24
-      //     ->get();
25
-      $typs = DB::table('three_year_plan')
26
-          ->orderBy('year_start', 'asc')
27
-          ->get();
28
-      $criteria = Criterion::withTrashed()->orderBy('name', 'ASC')->get();
29
-      // $criteria = DB::table('criteria')
30
-      //     ->orderBy('name', 'asc')
31
-      //     ->get();
32
-      $program_id = DB::table('program_user')
33
-      ->where('user_id',$user_id)
34
-      // ->where('user_id',8) //voy a usar 8 porque user 60 no tiene
17
+    $title = "Three Year Plans Planning";
18
+    $outcomes = Outcome::orderBy('name', 'ASC')
19
+      ->where('deactivation_date', '=', '0000-00-00')
20
+      ->orWhereNull('deactivation_date')
21
+      ->get();
22
+    $typs = DB::table('three_year_plan')
23
+      ->orderBy('year_start', 'asc')
24
+      ->get();
25
+    $criteria = Criterion::withTrashed()->orderBy('name', 'ASC')->get();
26
+    $program_id = DB::table('program_user')
27
+      ->where('user_id', $user_id)
35
       ->select('program_id')
28
       ->select('program_id')
36
       ->get();
29
       ->get();
37
-      $program_id = $program_id[0]->program_id; //program id 15 debido al user 8
38
-
39
-      // se annadio la nueva variable
40
-      return View::make('global.view-three-year-plan', compact('title', 'outcomes', 'typs', 'criteria', 'semesters', 'program_id'));
30
+    $program_id = $program_id[0]->program_id;
41
 
31
 
32
+    // se annadio la nueva variable
33
+    return View::make('global.view-three-year-plan', compact('title', 'outcomes', 'typs', 'criteria', 'semesters', 'program_id'));
42
   }
34
   }
43
 
35
 
44
 
36
 
45
   public function fetchThreeYears()
37
   public function fetchThreeYears()
46
   {
38
   {
47
-      $id = Input::get('id');
39
+    $id = Input::get('id');
48
 
40
 
49
-      $semesters = DB::table('typ_semesters')
50
-          ->join('semesters','semesters.id','=','typ_semesters.semester_id')
51
-          ->where('typ_semesters.typ_id',$id)
52
-          // ->select('semesters.*')
53
-          ->orderBy('typ_semesters.semester_id', 'asc')
54
-          ->get();
55
-      $typs = DB::table('three_year_plan')
56
-          ->where('id',$id)
57
-          ->orderBy('year_start', 'asc')
58
-          ->get();
41
+    $semesters = DB::table('typ_semesters')
42
+      ->join('semesters', 'semesters.id', '=', 'typ_semesters.semester_id')
43
+      ->where('typ_semesters.typ_id', $id)
44
+      // ->select('semesters.*')
45
+      ->orderBy('typ_semesters.semester_id', 'asc')
46
+      ->get();
47
+    $typs = DB::table('three_year_plan')
48
+      ->where('id', $id)
49
+      ->orderBy('year_start', 'asc')
50
+      ->get();
59
 
51
 
60
-      $typs  = $typs[0];
61
-      $typs->semesters = $semesters;
52
+    $typs  = $typs[0];
53
+    $typs->semesters = $semesters;
62
 
54
 
63
-      return array
64
-      (
65
-          'typ' => $typs,
66
-      );
55
+    return array(
56
+      'typ' => $typs,
57
+    );
67
   }
58
   }
68
 
59
 
69
   public function update_typ_outcomes_semesters()
60
   public function update_typ_outcomes_semesters()
71
     $outcomeSemesterArray = json_decode(Input::get('outcomeSemesterArray'), true);
62
     $outcomeSemesterArray = json_decode(Input::get('outcomeSemesterArray'), true);
72
     $typ_id = Input::get('typ_id');
63
     $typ_id = Input::get('typ_id');
73
 
64
 
74
-    $user_id = auth::user()->id; //ya, tester es 60
65
+    $user_id = auth::user()->id;
75
     $program_id = DB::table('program_user')
66
     $program_id = DB::table('program_user')
76
-    ->where('user_id',$user_id)
77
-    // ->where('user_id',8) //voy a usar 8 porque user 60 no tiene
78
-    ->select('program_id')
79
-    ->get();
80
-    $program_id = $program_id[0]->program_id; //program id 15 debido al user 8
67
+      ->where('user_id', $user_id)
68
+      ->select('program_id')
69
+      ->get();
70
+    $program_id = $program_id[0]->program_id;
81
 
71
 
82
 
72
 
83
     $result = DB::table('typ_program')
73
     $result = DB::table('typ_program')
84
-        ->where('three_year_plan_id',$typ_id)
85
-        ->where('program_id',$program_id)
86
-        ->get();
74
+      ->where('three_year_plan_id', $typ_id)
75
+      ->where('program_id', $program_id)
76
+      ->get();
87
 
77
 
88
     // create the relation if it doesnt exist
78
     // create the relation if it doesnt exist
89
-    if(count($result) == 0){
79
+    if (count($result) == 0) {
90
       $typ_program_id = DB::table('typ_program')->insertGetId(
80
       $typ_program_id = DB::table('typ_program')->insertGetId(
91
-          array('three_year_plan_id' => $typ_id,
92
-                'program_id' => $program_id)
81
+        array(
82
+          'three_year_plan_id' => $typ_id,
83
+          'program_id' => $program_id
84
+        )
93
       );
85
       );
94
     } else {
86
     } else {
95
       $typ_program_id = $result[0]->id;
87
       $typ_program_id = $result[0]->id;
104
       foreach ($outcome_semester["semesters"] as $semester) {
96
       foreach ($outcome_semester["semesters"] as $semester) {
105
         $insert = $semester[1];
97
         $insert = $semester[1];
106
 
98
 
107
-        $outcome_id = explode("-sem",$semester[0])[0];
99
+        $outcome_id = explode("-sem", $semester[0])[0];
108
 
100
 
109
-        $semester_code = explode("-sem",$semester[0])[1];
101
+        $semester_code = explode("-sem", $semester[0])[1];
110
         $result = DB::table('semesters')
102
         $result = DB::table('semesters')
111
-            ->where('code',$semester_code)
112
-            ->select('id')
113
-            ->get();
114
-        if(count($result) == 0){
103
+          ->where('code', $semester_code)
104
+          ->select('id')
105
+          ->get();
106
+        if (count($result) == 0) {
115
           continue;
107
           continue;
116
         }
108
         }
117
         $semester_id = $result[0]->id;
109
         $semester_id = $result[0]->id;
118
 
110
 
119
         // verify if it exists
111
         // verify if it exists
120
         $result = DB::table('typ_semester_outcome')
112
         $result = DB::table('typ_semester_outcome')
121
-            ->where('typ_program_id',$typ_program_id)
122
-            ->where('semester_id',$semester_id)
123
-            ->where('outcome_id',$outcome_id)
124
-            ->get();
113
+          ->where('typ_program_id', $typ_program_id)
114
+          ->where('semester_id', $semester_id)
115
+          ->where('outcome_id', $outcome_id)
116
+          ->get();
125
 
117
 
126
         // if true, it should get inserted
118
         // if true, it should get inserted
127
         if ($insert == true) {
119
         if ($insert == true) {
128
           // if == 0, then insert
120
           // if == 0, then insert
129
-          if(count($result) == 0){
121
+          if (count($result) == 0) {
130
             $_ = DB::table('typ_semester_outcome')->insertGetId(
122
             $_ = DB::table('typ_semester_outcome')->insertGetId(
131
-                array('typ_program_id' => $typ_program_id,
132
-                      'semester_id' => $semester_id,
133
-                      'outcome_id' => $outcome_id)
123
+              array(
124
+                'typ_program_id' => $typ_program_id,
125
+                'semester_id' => $semester_id,
126
+                'outcome_id' => $outcome_id
127
+              )
134
             );
128
             );
135
-
136
           }
129
           }
137
           //if exists, then do nothing
130
           //if exists, then do nothing
138
 
131
 
141
         else { //value == false
134
         else { //value == false
142
 
135
 
143
           // if == 0, it doesnt exist. we do nothing
136
           // if == 0, it doesnt exist. we do nothing
144
-          if(count($result) == 0){
137
+          if (count($result) == 0) {
145
             //pass
138
             //pass
146
           }
139
           }
147
           //if exists, then do nothing
140
           //if exists, then do nothing
148
           else {
141
           else {
149
             DB::table('typ_semester_outcome')
142
             DB::table('typ_semester_outcome')
150
-                ->where('typ_program_id', $typ_program_id)
151
-                ->where('semester_id', $semester_id)
152
-                ->where('outcome_id', $outcome_id)
153
-                ->delete();
143
+              ->where('typ_program_id', $typ_program_id)
144
+              ->where('semester_id', $semester_id)
145
+              ->where('outcome_id', $outcome_id)
146
+              ->delete();
154
           }
147
           }
155
         }
148
         }
156
       }
149
       }
173
 
166
 
174
       //buscar id del typ
167
       //buscar id del typ
175
       $result = DB::table('typ_program')
168
       $result = DB::table('typ_program')
176
-          ->where('three_year_plan_id',$typ_id)
177
-          ->where('program_id',$program_id)
178
-          ->get();
169
+        ->where('three_year_plan_id', $typ_id)
170
+        ->where('program_id', $program_id)
171
+        ->get();
179
       $typ_program_id = $result[0]->id;
172
       $typ_program_id = $result[0]->id;
180
 
173
 
181
       // buscar si existe el outcome_semester
174
       // buscar si existe el outcome_semester
182
       $result = DB::table('typ_semester_outcome')
175
       $result = DB::table('typ_semester_outcome')
183
-          ->join('semesters','semesters.id','=','typ_semester_outcome.semester_id')
184
-          ->where('typ_program_id',$typ_program_id)
185
-          ->where('semesters.code',$semester_code)
186
-          ->where('outcome_id',$outcome_id)
187
-          ->get();
176
+        ->join('semesters', 'semesters.id', '=', 'typ_semester_outcome.semester_id')
177
+        ->where('typ_program_id', $typ_program_id)
178
+        ->where('semesters.code', $semester_code)
179
+        ->where('outcome_id', $outcome_id)
180
+        ->get();
188
 
181
 
189
       // if it doesnt exist
182
       // if it doesnt exist
190
-      if (count($result)==0){
191
-        array_push($box_value,array($box_id,0));
183
+      if (count($result) == 0) {
184
+        array_push($box_value, array($box_id, 0));
192
       } else {
185
       } else {
193
-        array_push($box_value,array($box_id,1));
186
+        array_push($box_value, array($box_id, 1));
194
       }
187
       }
195
-
196
     }
188
     }
197
-    return array
198
-    (
189
+    return array(
199
       'box_value' => ($box_value)
190
       'box_value' => ($box_value)
200
     );
191
     );
201
   }
192
   }
214
     // new_objective_id: (new_objective_id)
205
     // new_objective_id: (new_objective_id)
215
 
206
 
216
     // get program_id
207
     // get program_id
217
-    $user_id = auth::user()->id; //ya, tester es 60
208
+    $user_id = auth::user()->id;
218
     $program_id = DB::table('program_user')
209
     $program_id = DB::table('program_user')
219
-        ->where('user_id',$user_id)
220
-        // ->where('user_id',8) //voy a usar 8 porque user 60 no tiene
221
-        ->select('program_id')
222
-        ->get();
223
-    $program_id = $program_id[0]->program_id; //program id 15 debido al user 8
210
+      ->where('user_id', $user_id)
211
+      ->select('program_id')
212
+      ->get();
213
+    $program_id = $program_id[0]->program_id;
224
 
214
 
225
     // get typ_program_id
215
     // get typ_program_id
226
     $result = DB::table('typ_program')
216
     $result = DB::table('typ_program')
227
-        ->where('three_year_plan_id',$typ_id)
228
-        ->where('program_id',$program_id)
229
-        ->get();
217
+      ->where('three_year_plan_id', $typ_id)
218
+      ->where('program_id', $program_id)
219
+      ->get();
230
     $typ_program_id = $result[0]->id;
220
     $typ_program_id = $result[0]->id;
231
 
221
 
232
     // get typ_semester_outcome_id
222
     // get typ_semester_outcome_id
233
     $result = DB::table('typ_semester_outcome')
223
     $result = DB::table('typ_semester_outcome')
234
-        ->where('typ_program_id',$typ_program_id)
235
-        ->where('semester_id',$semester_id)
236
-        ->where('outcome_id',$outcome_id)
237
-        ->get();
224
+      ->where('typ_program_id', $typ_program_id)
225
+      ->where('semester_id', $semester_id)
226
+      ->where('outcome_id', $outcome_id)
227
+      ->get();
238
     $typ_semester_outcome_id = $result[0]->id;
228
     $typ_semester_outcome_id = $result[0]->id;
239
 
229
 
240
     //delete old objective relation if it exists
230
     //delete old objective relation if it exists
241
     if ($previous_objective_id != 'nothing_selected') {
231
     if ($previous_objective_id != 'nothing_selected') {
242
       $result = DB::table('typ_semester_objectives')
232
       $result = DB::table('typ_semester_objectives')
243
-          ->where('typ_semester_outcome_id',$typ_semester_outcome_id)
244
-          ->where('objective_id',$previous_objective_id)
245
-          ->get();
233
+        ->where('typ_semester_outcome_id', $typ_semester_outcome_id)
234
+        ->where('objective_id', $previous_objective_id)
235
+        ->get();
246
       if (count($result) != 0) {
236
       if (count($result) != 0) {
247
         DB::table('typ_semester_objectives')
237
         DB::table('typ_semester_objectives')
248
-            ->where('typ_semester_outcome_id', $typ_semester_outcome_id)
249
-            ->where('objective_id', $previous_objective_id)
250
-            ->delete();
238
+          ->where('typ_semester_outcome_id', $typ_semester_outcome_id)
239
+          ->where('objective_id', $previous_objective_id)
240
+          ->delete();
251
       }
241
       }
252
     }
242
     }
253
 
243
 
254
     //create new objective relation
244
     //create new objective relation
255
     if ($new_objective_id != 'nothing_selected') {
245
     if ($new_objective_id != 'nothing_selected') {
256
       $result = DB::table('typ_semester_objectives')
246
       $result = DB::table('typ_semester_objectives')
257
-          ->where('typ_semester_outcome_id',$typ_semester_outcome_id)
258
-          ->where('objective_id',$new_objective_id)
259
-          ->get();
247
+        ->where('typ_semester_outcome_id', $typ_semester_outcome_id)
248
+        ->where('objective_id', $new_objective_id)
249
+        ->get();
260
       if (count($result) == 0) {
250
       if (count($result) == 0) {
261
         $_ = DB::table('typ_semester_objectives')->insertGetId(
251
         $_ = DB::table('typ_semester_objectives')->insertGetId(
262
-            array(
263
-              'typ_semester_outcome_id' => $typ_semester_outcome_id,
264
-              'objective_id' => $new_objective_id)
252
+          array(
253
+            'typ_semester_outcome_id' => $typ_semester_outcome_id,
254
+            'objective_id' => $new_objective_id
255
+          )
265
         );
256
         );
266
       }
257
       }
267
     }
258
     }
271
   public function section2_arrive()
262
   public function section2_arrive()
272
   {
263
   {
273
     // get program_id
264
     // get program_id
274
-    $user_id = auth::user()->id; //ya, tester es 60
265
+    $user_id = auth::user()->id;
275
     $program_id = DB::table('program_user')
266
     $program_id = DB::table('program_user')
276
-        ->where('user_id',$user_id)
277
-        // ->where('user_id',8) //voy a usar 8 porque user 60 no tiene
278
-        ->select('program_id')
279
-        ->get();
280
-    $program_id = $program_id[0]->program_id; //program id 15 debido al user 8
267
+      ->where('user_id', $user_id)
268
+      ->select('program_id')
269
+      ->get();
270
+    $program_id = $program_id[0]->program_id;
281
 
271
 
282
     // get typ_program_id
272
     // get typ_program_id
283
     $typ_id = Input::get('typ_id');
273
     $typ_id = Input::get('typ_id');
284
     $result = DB::table('typ_program')
274
     $result = DB::table('typ_program')
285
-        ->where('three_year_plan_id',$typ_id)
286
-        ->where('program_id',$program_id)
287
-        ->get();
275
+      ->where('three_year_plan_id', $typ_id)
276
+      ->where('program_id', $program_id)
277
+      ->get();
288
     $typ_program_id = $result[0]->id;
278
     $typ_program_id = $result[0]->id;
289
 
279
 
290
 
280
 
291
     //search selected outcomes,semesters and get their objectives
281
     //search selected outcomes,semesters and get their objectives
292
     $selected_outcomes = DB::table('typ_semester_outcome')
282
     $selected_outcomes = DB::table('typ_semester_outcome')
293
-        ->join('outcomes','outcomes.id','=','typ_semester_outcome.outcome_id')
294
-        ->where('typ_semester_outcome.typ_program_id',$typ_program_id)
295
-        ->distinct('typ_semester_outcome.outcome_id')
296
-        ->select('typ_semester_outcome.outcome_id')
297
-        ->orderBy('outcomes.name', 'asc')
298
-        ->get();
283
+      ->join('outcomes', 'outcomes.id', '=', 'typ_semester_outcome.outcome_id')
284
+      ->where('typ_semester_outcome.typ_program_id', $typ_program_id)
285
+      ->distinct('typ_semester_outcome.outcome_id')
286
+      ->select('typ_semester_outcome.outcome_id')
287
+      ->orderBy('outcomes.name', 'asc')
288
+      ->get();
299
 
289
 
300
     $selected_objectives_array = array();
290
     $selected_objectives_array = array();
301
     $outcomes_info_array = array();
291
     $outcomes_info_array = array();
308
 
298
 
309
       $outcome_id = $outcome->outcome_id;
299
       $outcome_id = $outcome->outcome_id;
310
       $result_outcomes = DB::table('outcomes')
300
       $result_outcomes = DB::table('outcomes')
311
-          ->where('outcomes.id',$outcome_id)
312
-          ->orderBy('outcomes.name', 'asc')
313
-          ->get();
301
+        ->where('outcomes.id', $outcome_id)
302
+        ->orderBy('outcomes.name', 'asc')
303
+        ->get();
314
 
304
 
315
       foreach ($result_outcomes as $outcome_) {
305
       foreach ($result_outcomes as $outcome_) {
316
 
306
 
317
         $result_semesters = DB::table('typ_semester_outcome')
307
         $result_semesters = DB::table('typ_semester_outcome')
318
-            ->join('semesters','semesters.id','=','typ_semester_outcome.semester_id')
319
-            ->where('typ_semester_outcome.typ_program_id',$typ_program_id)
320
-            ->where('typ_semester_outcome.outcome_id',$outcome_->id)
321
-            ->select('typ_semester_outcome.id','typ_semester_outcome.semester_id','semesters.code','semesters.name')
322
-            ->get();
308
+          ->join('semesters', 'semesters.id', '=', 'typ_semester_outcome.semester_id')
309
+          ->where('typ_semester_outcome.typ_program_id', $typ_program_id)
310
+          ->where('typ_semester_outcome.outcome_id', $outcome_->id)
311
+          ->select('typ_semester_outcome.id', 'typ_semester_outcome.semester_id', 'semesters.code', 'semesters.name')
312
+          ->get();
323
         // buscar info sobre selected_semsters
313
         // buscar info sobre selected_semsters
324
         $outcome_->selected_semesters = array();
314
         $outcome_->selected_semesters = array();
325
         foreach ($result_semesters as $semesters_) {
315
         foreach ($result_semesters as $semesters_) {
327
 
317
 
328
           // lookup previusly selected objectives
318
           // lookup previusly selected objectives
329
           $result_objectives = DB::table('typ_semester_objectives')
319
           $result_objectives = DB::table('typ_semester_objectives')
330
-              ->join('objectives','objectives.id','=','typ_semester_objectives.objective_id')
331
-              ->where('typ_semester_objectives.typ_semester_outcome_id', $typ_semester_outcome_id)
332
-              ->orderBy('typ_semester_objectives.id', 'asc')
333
-              ->get();
320
+            ->join('objectives', 'objectives.id', '=', 'typ_semester_objectives.objective_id')
321
+            ->where('typ_semester_objectives.typ_semester_outcome_id', $typ_semester_outcome_id)
322
+            ->orderBy('typ_semester_objectives.id', 'asc')
323
+            ->get();
334
 
324
 
335
           $semesters_->selected_objectives = array();
325
           $semesters_->selected_objectives = array();
336
           foreach ($result_objectives as $objectives_) {
326
           foreach ($result_objectives as $objectives_) {
339
           }
329
           }
340
 
330
 
341
           // lookup available objectives
331
           // lookup available objectives
342
-          $result_objectives = DB::table('criterion_objective_outcome')
343
-              ->join('outcomes','outcomes.id','=','criterion_objective_outcome.outcome_id')
344
-              ->join('objectives','objectives.id','=','criterion_objective_outcome.objective_id')
345
-              ->join('objective_program','objective_program.objective_id','=','objectives.id')
346
-              ->where('objective_program.program_id',$program_id)
347
-              ->where('criterion_objective_outcome.outcome_id',$outcome_id)
348
-              ->select('objectives.id','objectives.text','outcomes.name as outcome_name')
349
-              ->orderBy('objectives.text', 'asc')
350
-              ->get();
332
+          $result_objectives = DB::table('objective_outcome')
333
+            ->join('outcomes', 'outcomes.id', '=', 'objective_outcome.outcome_id')
334
+            ->join('objectives', 'objectives.id', '=', 'objective_outcome.objective_id')
335
+            ->join('objective_program', 'objective_program.objective_id', '=', 'objectives.id')
336
+            ->where('objective_program.program_id', $program_id)
337
+            ->where('objective_outcome.outcome_id', $outcome_id)
338
+            ->select('objectives.id', 'objectives.text', 'outcomes.name as outcome_name')
339
+            ->orderBy('objectives.text', 'asc')
340
+            ->get();
351
 
341
 
352
           $semesters_->available_objectives = array();
342
           $semesters_->available_objectives = array();
353
           foreach ($result_objectives as $objectives_) {
343
           foreach ($result_objectives as $objectives_) {
366
   public function section3_arrive()
356
   public function section3_arrive()
367
   {
357
   {
368
     // get program_id
358
     // get program_id
369
-    $user_id = auth::user()->id; //ya, tester es 60
359
+    $user_id = auth::user()->id;
370
     $program_id = DB::table('program_user')
360
     $program_id = DB::table('program_user')
371
-        ->where('user_id',$user_id)
372
-        // ->where('user_id',8) //voy a usar 8 porque user 60 no tiene
373
-        ->select('program_id')
374
-        ->get();
375
-    $program_id = $program_id[0]->program_id; //program id 15 debido al user 8
361
+      ->where('user_id', $user_id)
362
+      ->select('program_id')
363
+      ->get();
364
+    $program_id = $program_id[0]->program_id;
376
 
365
 
377
     // get typ_program_id
366
     // get typ_program_id
378
     $typ_id = Input::get('typ_id');
367
     $typ_id = Input::get('typ_id');
379
     $result = DB::table('typ_program')
368
     $result = DB::table('typ_program')
380
-        ->where('three_year_plan_id',$typ_id)
381
-        ->where('program_id',$program_id)
382
-        ->get();
369
+      ->where('three_year_plan_id', $typ_id)
370
+      ->where('program_id', $program_id)
371
+      ->get();
383
     $typ_program_id = $result[0]->id;
372
     $typ_program_id = $result[0]->id;
384
 
373
 
385
 
374
 
386
     //search selected outcomes,semesters and get their objectives
375
     //search selected outcomes,semesters and get their objectives
387
     $selected_outcomes = DB::table('typ_semester_outcome')
376
     $selected_outcomes = DB::table('typ_semester_outcome')
388
-        ->join('outcomes','outcomes.id','=','typ_semester_outcome.outcome_id')
389
-        ->where('typ_semester_outcome.typ_program_id',$typ_program_id)
390
-        ->distinct('typ_semester_outcome.outcome_id')
391
-        ->select('typ_semester_outcome.outcome_id')
392
-        ->orderBy('outcomes.name', 'asc')
393
-        ->get();
377
+      ->join('outcomes', 'outcomes.id', '=', 'typ_semester_outcome.outcome_id')
378
+      ->where('typ_semester_outcome.typ_program_id', $typ_program_id)
379
+      ->distinct('typ_semester_outcome.outcome_id')
380
+      ->select('typ_semester_outcome.outcome_id')
381
+      ->orderBy('outcomes.name', 'asc')
382
+      ->get();
394
 
383
 
395
     $selected_objectives_array = array();
384
     $selected_objectives_array = array();
396
     $outcomes_info_array = array();
385
     $outcomes_info_array = array();
403
 
392
 
404
       $outcome_id = $outcome->outcome_id;
393
       $outcome_id = $outcome->outcome_id;
405
       $result_outcomes = DB::table('outcomes')
394
       $result_outcomes = DB::table('outcomes')
406
-          ->where('outcomes.id',$outcome_id)
407
-          ->get();
395
+        ->where('outcomes.id', $outcome_id)
396
+        ->get();
408
 
397
 
409
       foreach ($result_outcomes as $outcome_) {
398
       foreach ($result_outcomes as $outcome_) {
410
 
399
 
411
         $result_semesters = DB::table('typ_semester_outcome')
400
         $result_semesters = DB::table('typ_semester_outcome')
412
-            ->join('semesters','semesters.id','=','typ_semester_outcome.semester_id')
413
-            ->where('typ_semester_outcome.typ_program_id',$typ_program_id)
414
-            ->where('typ_semester_outcome.outcome_id',$outcome_->id)
415
-            ->select('typ_semester_outcome.id','typ_semester_outcome.semester_id','semesters.code','semesters.name')
416
-            ->get();
401
+          ->join('semesters', 'semesters.id', '=', 'typ_semester_outcome.semester_id')
402
+          ->where('typ_semester_outcome.typ_program_id', $typ_program_id)
403
+          ->where('typ_semester_outcome.outcome_id', $outcome_->id)
404
+          ->select('typ_semester_outcome.id', 'typ_semester_outcome.semester_id', 'semesters.code', 'semesters.name')
405
+          ->get();
417
         // buscar info sobre selected_semsters
406
         // buscar info sobre selected_semsters
418
         $outcome_->selected_semesters = array();
407
         $outcome_->selected_semesters = array();
419
         foreach ($result_semesters as $semesters_) {
408
         foreach ($result_semesters as $semesters_) {
421
 
410
 
422
           $typ_semester_outcome_id = $semesters_->id;
411
           $typ_semester_outcome_id = $semesters_->id;
423
           $result_objectives = DB::table('typ_semester_objectives')
412
           $result_objectives = DB::table('typ_semester_objectives')
424
-              ->join('objectives','objectives.id','=','typ_semester_objectives.objective_id')
425
-              ->where('typ_semester_objectives.typ_semester_outcome_id', $typ_semester_outcome_id)
426
-              ->select('typ_semester_objectives.id as typ_semester_objectives_id','objectives.*','typ_semester_objectives.*')
427
-              ->orderBy('typ_semester_objectives.id', 'asc')
428
-              ->get();
413
+            ->join('objectives', 'objectives.id', '=', 'typ_semester_objectives.objective_id')
414
+            ->where('typ_semester_objectives.typ_semester_outcome_id', $typ_semester_outcome_id)
415
+            ->select('typ_semester_objectives.id as typ_semester_objectives_id', 'objectives.*', 'typ_semester_objectives.*')
416
+            ->orderBy('typ_semester_objectives.id', 'asc')
417
+            ->get();
429
 
418
 
430
           $semesters_->selected_objectives = array();
419
           $semesters_->selected_objectives = array();
431
           foreach ($result_objectives as $objectives_) {
420
           foreach ($result_objectives as $objectives_) {
432
             $objective_id = $objectives_->objective_id;
421
             $objective_id = $objectives_->objective_id;
433
             $program_id = $objectives_->program_id;
422
             $program_id = $objectives_->program_id;
434
             $result_courses = DB::table('objective_program')
423
             $result_courses = DB::table('objective_program')
435
-                ->join('objectives','objectives.id','=','objective_program.objective_id')
436
-                ->join('courses','courses.program_id','=','objective_program.program_id')
437
-                ->where('objective_program.objective_id', $objective_id)
438
-                ->where('objective_program.program_id', $program_id)
439
-                ->where('courses.semester_id', $semester_id)
440
-                ->distinct('courses.name','courses.code')
441
-                ->select('courses.id as course_id','courses.name','courses.code','objective_program.objective_id','objective_program.program_id')
442
-                ->orderBy('courses.name', 'asc')
443
-                ->groupBy('courses.name','courses.code')
444
-                ->get();
424
+              ->join('objectives', 'objectives.id', '=', 'objective_program.objective_id')
425
+              ->join('courses', 'courses.program_id', '=', 'objective_program.program_id')
426
+              ->where('objective_program.objective_id', $objective_id)
427
+              ->where('objective_program.program_id', $program_id)
428
+              ->where('courses.semester_id', $semester_id)
429
+              ->distinct('courses.name', 'courses.code')
430
+              ->select('courses.id as course_id', 'courses.name', 'courses.code', 'objective_program.objective_id', 'objective_program.program_id')
431
+              ->orderBy('courses.name', 'asc')
432
+              ->groupBy('courses.name', 'courses.code')
433
+              ->get();
445
 
434
 
446
             $objectives_->available_courses = array();
435
             $objectives_->available_courses = array();
447
             foreach ($result_courses as $courses_) {
436
             foreach ($result_courses as $courses_) {
451
             // search for previusly selected courses
440
             // search for previusly selected courses
452
             $typ_semester_objective_id = $objectives_->typ_semester_objectives_id;
441
             $typ_semester_objective_id = $objectives_->typ_semester_objectives_id;
453
             $result_courses = DB::table('typ_semester_courses')
442
             $result_courses = DB::table('typ_semester_courses')
454
-                ->join('courses','courses.id','=','typ_semester_courses.course_id')
455
-                ->where('typ_semester_courses.typ_semester_objective_id', $typ_semester_objective_id)
456
-                ->select('courses.id as course_id','courses.*','typ_semester_courses.*')
457
-                ->orderBy('courses.name', 'asc')
458
-                ->get();
443
+              ->join('courses', 'courses.id', '=', 'typ_semester_courses.course_id')
444
+              ->where('typ_semester_courses.typ_semester_objective_id', $typ_semester_objective_id)
445
+              ->select('courses.id as course_id', 'courses.*', 'typ_semester_courses.*')
446
+              ->orderBy('courses.name', 'asc')
447
+              ->get();
459
 
448
 
460
             $objectives_->selected_courses = array();
449
             $objectives_->selected_courses = array();
461
             foreach ($result_courses as $courses_) {
450
             foreach ($result_courses as $courses_) {
490
     // new_course_id: (new_course_id)
479
     // new_course_id: (new_course_id)
491
 
480
 
492
     // get program_id
481
     // get program_id
493
-    $user_id = auth::user()->id; //ya, tester es 60
482
+    $user_id = auth::user()->id;
494
     $program_id = DB::table('program_user')
483
     $program_id = DB::table('program_user')
495
-        ->where('user_id',$user_id)
496
-        // ->where('user_id',8) //voy a usar 8 porque user 60 no tiene
497
-        ->select('program_id')
498
-        ->get();
499
-    $program_id = $program_id[0]->program_id; //program id 15 debido al user 8
484
+      ->where('user_id', $user_id)
485
+      ->select('program_id')
486
+      ->get();
487
+    $program_id = $program_id[0]->program_id;
500
 
488
 
501
     // get typ_program_id
489
     // get typ_program_id
502
     $result = DB::table('typ_program')
490
     $result = DB::table('typ_program')
503
-        ->where('three_year_plan_id',$typ_id)
504
-        ->where('program_id',$program_id)
505
-        ->get();
491
+      ->where('three_year_plan_id', $typ_id)
492
+      ->where('program_id', $program_id)
493
+      ->get();
506
     $typ_program_id = $result[0]->id;
494
     $typ_program_id = $result[0]->id;
507
 
495
 
508
     // get typ_semester_outcome_id
496
     // get typ_semester_outcome_id
509
     $result = DB::table('typ_semester_outcome')
497
     $result = DB::table('typ_semester_outcome')
510
-        ->where('typ_program_id',$typ_program_id)
511
-        ->where('semester_id',$semester_id)
512
-        ->where('outcome_id',$outcome_id)
513
-        ->get();
498
+      ->where('typ_program_id', $typ_program_id)
499
+      ->where('semester_id', $semester_id)
500
+      ->where('outcome_id', $outcome_id)
501
+      ->get();
514
     $typ_semester_outcome_id = $result[0]->id;
502
     $typ_semester_outcome_id = $result[0]->id;
515
 
503
 
516
     // get typ_semester_objective_id
504
     // get typ_semester_objective_id
517
     $result = DB::table('typ_semester_objectives')
505
     $result = DB::table('typ_semester_objectives')
518
-        ->where('typ_semester_outcome_id',$typ_semester_outcome_id)
519
-        ->where('objective_id',$objective_id)
520
-        ->get();
506
+      ->where('typ_semester_outcome_id', $typ_semester_outcome_id)
507
+      ->where('objective_id', $objective_id)
508
+      ->get();
521
     $typ_semester_objective_id = $result[0]->id;
509
     $typ_semester_objective_id = $result[0]->id;
522
 
510
 
523
     //delete old objective relation if it exists
511
     //delete old objective relation if it exists
524
     if ($previous_course_id != 'nothing_selected') {
512
     if ($previous_course_id != 'nothing_selected') {
525
       $result = DB::table('typ_semester_courses')
513
       $result = DB::table('typ_semester_courses')
526
-          ->where('typ_semester_objective_id',$typ_semester_objective_id)
527
-          ->where('course_id',$previous_course_id)
528
-          ->get();
514
+        ->where('typ_semester_objective_id', $typ_semester_objective_id)
515
+        ->where('course_id', $previous_course_id)
516
+        ->get();
529
       if (count($result) != 0) {
517
       if (count($result) != 0) {
530
         DB::table('typ_semester_courses')
518
         DB::table('typ_semester_courses')
531
-            ->where('typ_semester_objective_id', $typ_semester_objective_id)
532
-            ->where('course_id', $previous_course_id)
533
-            ->delete();
519
+          ->where('typ_semester_objective_id', $typ_semester_objective_id)
520
+          ->where('course_id', $previous_course_id)
521
+          ->delete();
534
       }
522
       }
535
     }
523
     }
536
 
524
 
537
     //create new objective relation
525
     //create new objective relation
538
     if ($new_course_id != 'nothing_selected') {
526
     if ($new_course_id != 'nothing_selected') {
539
       $result = DB::table('typ_semester_courses')
527
       $result = DB::table('typ_semester_courses')
540
-          ->where('typ_semester_objective_id',$typ_semester_objective_id)
541
-          ->where('course_id',$new_course_id)
542
-          ->get();
528
+        ->where('typ_semester_objective_id', $typ_semester_objective_id)
529
+        ->where('course_id', $new_course_id)
530
+        ->get();
543
       if (count($result) == 0) {
531
       if (count($result) == 0) {
544
         $_ = DB::table('typ_semester_courses')->insertGetId(
532
         $_ = DB::table('typ_semester_courses')->insertGetId(
545
-            array(
546
-              'typ_semester_objective_id' => $typ_semester_objective_id,
547
-              'course_id' => $new_course_id)
533
+          array(
534
+            'typ_semester_objective_id' => $typ_semester_objective_id,
535
+            'course_id' => $new_course_id
536
+          )
548
         );
537
         );
549
       }
538
       }
550
     }
539
     }
551
     return 'update succes?';
540
     return 'update succes?';
552
   }
541
   }
553
 
542
 
543
+  public function createAnnualPlan($program_id)
544
+  {
545
+    $current_typ = DB::select("select * from three_year_plan where year_start <=" . date('Y') . " and year_end >=" . date('Y'))[0];
546
+    $count = 0;
547
+    $yearStartPlusOne = $current_typ->year_start + 1;
548
+    $yearStart = $current_typ->year_start;
549
+    while ($count < 3) {
550
+
551
+
552
+
553
+      $firstSemester = DB::select("select * from semesters where name like 'First Semester {$yearStart}-{$yearStartPlusOne}'");
554
 
554
 
555
+      $secondSemester = DB::select("select * from semesters where name like 'Second Semester {$yearStart}-{$yearStartPlusOne}'");
556
+      if (count($firstSemester) && count($secondSemester)) {
557
+        $query = DB::select("select * from annual_plans where semester_start ={$firstSemester[0]->id} and semester_end ={$secondSemester[0]->id} and program_id = {$program_id}");
558
+        if (!count($query)) {
559
+          DB::insert("insert into annual_plans (academic_year, semester_start, semester_end, program_id) values ('{$yearStart}-{$yearStartPlusOne}', {$firstSemester->id}, {$secondSemester->id}, {$program_id})");
560
+        }
561
+        $count++;
562
+        $yearStart++;
563
+        $yearStartPlusOne++;
564
+      } else {
565
+        $count++;
566
+        $yearStart++;
567
+        $yearStartPlusOne++;
568
+        continue;
569
+      }
570
+    }
571
+  }
555
 }
572
 }

+ 0
- 33
app/database/migrations/2021_01_31_165057_fix_objectives_table_2.php View File

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

+ 0
- 51
app/database/migrations/2021_03_29_151542_create_annual_report_transformative.php View File

1
-<?php
2
-
3
-use Illuminate\Database\Schema\Blueprint;
4
-use Illuminate\Database\Migrations\Migration;
5
-use Illuminate\Support\Facades\Schema;
6
-
7
-class CreateAnnualReportTransformative extends Migration
8
-{
9
-
10
-	/**
11
-	 * Run the migrations.
12
-	 *
13
-	 * @return void
14
-	 */
15
-	public function up()
16
-	{
17
-		Schema::create('annual_report_transformative', function (Blueprint $table) {
18
-			$table->increments('id');
19
-			$table->boolean('accomplished');
20
-			$table->integer('cycle_of_life');
21
-			$table->integer("semester_used")->unsigned();
22
-			$table->integer('semester_continue')->unsigned()->nullable();
23
-			$table->integer('trans_op_id')->unsigned();
24
-			$table->foreign('trans_op_id')
25
-				->references('id')
26
-				->on('transformative_objective_program')
27
-				->onDelete('cascade')
28
-				->onUpdate('cascade');
29
-			$table->foreign('semester_used')
30
-				->references('id')
31
-				->on('semesters')
32
-				->onDelete('cascade')
33
-				->onUpdate('cascade');
34
-			$table->foreign('semester_continue')
35
-				->references('id')
36
-				->on('semesters')
37
-				->onDelete('cascade')
38
-				->onUpdate('cascade');
39
-		});
40
-	}
41
-
42
-	/**
43
-	 * Reverse the migrations.
44
-	 *
45
-	 * @return void
46
-	 */
47
-	public function down()
48
-	{
49
-		Schema::drop('annual_report_transformative');
50
-	}
51
-}

+ 33
- 0
app/database/unusedMigrations/2021_01_31_165057_fix_objectives_table_2.php View File

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

app/database/migrations/2021_01_31_171210_fix_criterion_scale.php → app/database/unusedMigrations/2021_01_31_171210_fix_criterion_scale.php View File


+ 15
- 11
app/routes.php View File

183
         'as' => 'fetchAllCriterion',
183
         'as' => 'fetchAllCriterion',
184
         'uses' => 'CriteriaController@fetchAllCriterion'
184
         'uses' => 'CriteriaController@fetchAllCriterion'
185
     ));
185
     ));
186
-    Route::post('delete', array(
187
-        'as' => 'delete',
186
+    Route::post('deleteCriterion', array(
187
+        'as' => 'deleteCriterion',
188
         'uses' => 'CriteriaController@delete'
188
         'uses' => 'CriteriaController@delete'
189
     ));
189
     ));
190
+
191
+
190
     Route::post('delete', array(
192
     Route::post('delete', array(
191
         'as' => 'delete',
193
         'as' => 'delete',
192
         'uses' => 'TransformativeActionsController@deleteTA'
194
         'uses' => 'TransformativeActionsController@deleteTA'
247
     Route::get('transformativeAction', array('uses' => 'TransformativeActionsController@editTA'));
249
     Route::get('transformativeAction', array('uses' => 'TransformativeActionsController@editTA'));
248
     Route::post('transformativeAction/createTA', array('before' => 'csrf', 'uses' => 'TransformativeActionsController@createTA'));
250
     Route::post('transformativeAction/createTA', array('before' => 'csrf', 'uses' => 'TransformativeActionsController@createTA'));
249
     Route::post('transformativeAction/selectTA', array('before' => 'csrf', 'uses' => 'TransformativeActionsController@selectTA'));
251
     Route::post('transformativeAction/selectTA', array('before' => 'csrf', 'uses' => 'TransformativeActionsController@selectTA'));
250
-    Route::post('transformativeAction/updateTA', array('before' => 'csrf', 'uses'=>'TransformativeActionsController@updateTA'));
251
-    Route::post('transformativeAction/filterTA', array('before' => 'csrf', 'uses'=>'TransformativeActionsController@filterTA'));
252
-    Route::post('transformativeAction/objectivesFromOutcome', array('before' => 'csrf', 'uses'=>'TransformativeActionsController@objectivesFromOutcome'));
252
+    Route::post('transformativeAction/updateTA', array('before' => 'csrf', 'uses' => 'TransformativeActionsController@updateTA'));
253
+    Route::post('transformativeAction/filterTA', array('before' => 'csrf', 'uses' => 'TransformativeActionsController@filterTA'));
254
+    Route::post('transformativeAction/objectivesFromOutcome', array('before' => 'csrf', 'uses' => 'TransformativeActionsController@objectivesFromOutcome'));
253
 
255
 
254
     /**
256
     /**
255
      * Administrator Routes
257
      * Administrator Routes
322
         Route::post('createCriterion', array('before' => 'csrf', 'uses' => 'CriteriaController@create'));
324
         Route::post('createCriterion', array('before' => 'csrf', 'uses' => 'CriteriaController@create'));
323
         Route::get('school-objective', 'Objective2Controller@editSchool');
325
         Route::get('school-objective', 'Objective2Controller@editSchool');
324
         Route::get('school-criteria', 'CriteriaController@editSchool');
326
         Route::get('school-criteria', 'CriteriaController@editSchool');
327
+        Route::post('crtiteria/update', array('before' => 'csrf', 'uses' => 'CriteriaController@update'));
328
+
325
         //Show users annual plan
329
         //Show users annual plan
326
         Route::get('annual-plan-program/{program_id}/{typ_id?}', 'AnnualPlansController@showPlan');
330
         Route::get('annual-plan-program/{program_id}/{typ_id?}', 'AnnualPlansController@showPlan');
327
         Route::post('annual-plan-fetchTYP/{program_id}/{typ_id}', 'AnnualPlansController@fetchTYP');
331
         Route::post('annual-plan-fetchTYP/{program_id}/{typ_id}', 'AnnualPlansController@fetchTYP');
337
 
341
 
338
         // Show users plan de tres a~nos
342
         // Show users plan de tres a~nos
339
         Route::get('three-years-plan', 'ThreeYearPlanController@threeYearsReport');
343
         Route::get('three-years-plan', 'ThreeYearPlanController@threeYearsReport');
340
-        Route::post('fetchThreeYears', array('before' => 'csrf', 'uses'=>'ThreeYearPlanController@fetchThreeYears'));
344
+        Route::post('fetchThreeYears', array('before' => 'csrf', 'uses' => 'ThreeYearPlanController@fetchThreeYears'));
341
         Route::post('typ/lookUp', array('before' => 'csrf', 'uses' => 'ThreeYearPlanController@lookup_typ_semester_outcome'));
345
         Route::post('typ/lookUp', array('before' => 'csrf', 'uses' => 'ThreeYearPlanController@lookup_typ_semester_outcome'));
342
         Route::post('section2_arrive', array('before' => 'csrf', 'uses' => 'ThreeYearPlanController@section2_arrive'));
346
         Route::post('section2_arrive', array('before' => 'csrf', 'uses' => 'ThreeYearPlanController@section2_arrive'));
343
         Route::post('section2_on_change', array('before' => 'csrf', 'uses' => 'ThreeYearPlanController@section2_on_change'));
347
         Route::post('section2_on_change', array('before' => 'csrf', 'uses' => 'ThreeYearPlanController@section2_on_change'));
346
         Route::post('typ/getObjectives', array('before' => 'csrf', 'uses' => 'ThreeYearPlanController@getObjectivesForTYP'));
350
         Route::post('typ/getObjectives', array('before' => 'csrf', 'uses' => 'ThreeYearPlanController@getObjectivesForTYP'));
347
         Route::post('typ/updateOutcomeSemsters', array('before' => 'csrf', 'uses' => 'ThreeYearPlanController@typ_update_outcomes_semesters'));
351
         Route::post('typ/updateOutcomeSemsters', array('before' => 'csrf', 'uses' => 'ThreeYearPlanController@typ_update_outcomes_semesters'));
348
         Route::post('typ/update', array('before' => 'csrf', 'uses' => 'ThreeYearPlanController@update_typ_outcomes_semesters'));
352
         Route::post('typ/update', array('before' => 'csrf', 'uses' => 'ThreeYearPlanController@update_typ_outcomes_semesters'));
349
-
353
+        Route::post('createAnnualPlan/{program_id}', array('before' => 'csrf', 'uses' => 'ThreeYearPlanController@createAnnualPlan'));
350
     });
354
     });
351
 
355
 
352
 
356
 
370
 
374
 
371
         //Criteria and objectives
375
         //Criteria and objectives
372
         Route::get('program-criteria', 'CriteriaController@editProgram');
376
         Route::get('program-criteria', 'CriteriaController@editProgram');
377
+        Route::post('crtiteria/update', array('before' => 'csrf', 'uses' => 'CriteriaController@update'));
373
         Route::get('program-objective', 'Objective2Controller@editProgram');
378
         Route::get('program-objective', 'Objective2Controller@editProgram');
374
 
379
 
375
         // Print program report
380
         // Print program report
440
 
445
 
441
 
446
 
442
         // Transformative Actions
447
         // Transformative Actions
443
-        Route::post('transformativeAction/approveTA', array('before' => 'csrf', 'uses'=>'TransformativeActionsController@approveTA'));
448
+        Route::post('transformativeAction/approveTA', array('before' => 'csrf', 'uses' => 'TransformativeActionsController@approveTA'));
444
 
449
 
445
         // Show users plan de tres a~nos
450
         // Show users plan de tres a~nos
446
         Route::get('three-years-plan', 'ThreeYearPlanController@threeYearsReport');
451
         Route::get('three-years-plan', 'ThreeYearPlanController@threeYearsReport');
447
-        Route::post('fetchThreeYears', array('before' => 'csrf', 'uses'=>'ThreeYearPlanController@fetchThreeYears'));
452
+        Route::post('fetchThreeYears', array('before' => 'csrf', 'uses' => 'ThreeYearPlanController@fetchThreeYears'));
448
         Route::post('typ/lookUp', array('before' => 'csrf', 'uses' => 'ThreeYearPlanController@lookup_typ_semester_outcome'));
453
         Route::post('typ/lookUp', array('before' => 'csrf', 'uses' => 'ThreeYearPlanController@lookup_typ_semester_outcome'));
449
         Route::post('section2_arrive', array('before' => 'csrf', 'uses' => 'ThreeYearPlanController@section2_arrive'));
454
         Route::post('section2_arrive', array('before' => 'csrf', 'uses' => 'ThreeYearPlanController@section2_arrive'));
450
         Route::post('section2_on_change', array('before' => 'csrf', 'uses' => 'ThreeYearPlanController@section2_on_change'));
455
         Route::post('section2_on_change', array('before' => 'csrf', 'uses' => 'ThreeYearPlanController@section2_on_change'));
453
         Route::post('typ/getObjectives', array('before' => 'csrf', 'uses' => 'ThreeYearPlanController@getObjectivesForTYP'));
458
         Route::post('typ/getObjectives', array('before' => 'csrf', 'uses' => 'ThreeYearPlanController@getObjectivesForTYP'));
454
         Route::post('typ/updateOutcomeSemsters', array('before' => 'csrf', 'uses' => 'ThreeYearPlanController@typ_update_outcomes_semesters'));
459
         Route::post('typ/updateOutcomeSemsters', array('before' => 'csrf', 'uses' => 'ThreeYearPlanController@typ_update_outcomes_semesters'));
455
         Route::post('typ/update', array('before' => 'csrf', 'uses' => 'ThreeYearPlanController@update_typ_outcomes_semesters'));
460
         Route::post('typ/update', array('before' => 'csrf', 'uses' => 'ThreeYearPlanController@update_typ_outcomes_semesters'));
456
-
457
-
461
+        Route::post('createAnnualPlan/{program_id}', array('before' => 'csrf', 'uses' => 'ThreeYearPlanController@createAnnualPlan'));
458
     });
462
     });
459
 
463
 
460
 
464
 

+ 4
- 1
app/views/global/view-three-year-plan.blade.php View File

342
   // Events
342
   // Events
343
   // --------------------------------------------------------------------------
343
   // --------------------------------------------------------------------------
344
 
344
 
345
-
345
+$('.go-to-temp').on('click', function(){
346
+  $.post(
347
+    "{{ URL::action('ThreeYearPlanController@createAnnualPlan', array($program_id))}}");
348
+});
346
 
349
 
347
     // When list item is clicked, load corresponding info
350
     // When list item is clicked, load corresponding info
348
     //section 1
351
     //section 1

+ 17
- 3
app/views/local/managers/admins/criteria.blade.php View File

107
             <div class="panel-body">
107
             <div class="panel-body">
108
                 {{ Form::open(array('action' => 'CriteriaController@update')) }}
108
                 {{ Form::open(array('action' => 'CriteriaController@update')) }}
109
 
109
 
110
-
110
+                <button class="btn btn-md btn-secondary filterButton">
111
+                    <span class="glyphicon glyphicon-plus">
112
+                    </span>
113
+                    Filters
114
+                  </button>
111
                 <div class="form-group">
115
                 <div class="form-group">
112
                     {{ Form::label('program_id2', 'Associated Program')}}
116
                     {{ Form::label('program_id2', 'Associated Program')}}
113
                     <select id='select-program' class="form-control selectpicker" onchange='fetchAllCriterion("select-program", "assoc_outcomes_fetch")'>
117
                     <select id='select-program' class="form-control selectpicker" onchange='fetchAllCriterion("select-program", "assoc_outcomes_fetch")'>
320
         }
324
         }
321
 
325
 
322
     }
326
     }
327
+  
323
 
328
 
324
-
325
-
329
+    $('.filterSection').hide();
330
+    $('.filterButton').on('click', function()
331
+{
332
+  var span = $(this).find('span');
333
+  if(span.attr('class') == 'glyphicon glyphicon-plus'){
334
+    span.attr('class','glyphicon glyphicon-minus');
335
+  } else{
336
+    span.attr('class','glyphicon glyphicon-plus');
337
+  }
338
+  $('.filterSection').toggle(533);
339
+});
326
     function numberOfScales(string, Scales) {
340
     function numberOfScales(string, Scales) {
327
         var maximum = $('#maximum_score').val();
341
         var maximum = $('#maximum_score').val();
328
         var amountOfScale = parseInt($('#' + string).val());
342
         var amountOfScale = parseInt($('#' + string).val());

+ 1
- 1
app/views/local/managers/admins/new_criteria.blade.php View File

430
     }
430
     }
431
 
431
 
432
 
432
 
433
-
433
+    $('.filterSection').hide();
434
     //Delete Outcome and OptGroup associated
434
     //Delete Outcome and OptGroup associated
435
 
435
 
436
     function deleteLast(outcomeForm, outcomeDiv, closeButton, objectiveGroup) {
436
     function deleteLast(outcomeForm, outcomeDiv, closeButton, objectiveGroup) {

+ 32
- 7
app/views/local/managers/pCoords/criteria.blade.php View File

51
                     <br>
51
                     <br>
52
 
52
 
53
 
53
 
54
-
54
+                    <input type = "hidden" id = "{{ $programs[0]->name }}"  name="program_id[]" value="{{$programs[0]->id}}">
55
                     <input type="checkbox" id="{{ $programs[0]->name }}" name="program_id[]" value="{{$programs[0]->id}}" disabled checked>
55
                     <input type="checkbox" id="{{ $programs[0]->name }}" name="program_id[]" value="{{$programs[0]->id}}" disabled checked>
56
                     <label for="{{ $programs[0]->name }}"> {{ $programs[0]->name }} [{{ $programs[0]->school->name }}]</label><br>
56
                     <label for="{{ $programs[0]->name }}"> {{ $programs[0]->name }} [{{ $programs[0]->school->name }}]</label><br>
57
 
57
 
107
             <div class="panel-body">
107
             <div class="panel-body">
108
                 {{ Form::open(array('action' => 'CriteriaController@update')) }}
108
                 {{ Form::open(array('action' => 'CriteriaController@update')) }}
109
 
109
 
110
-
110
+                <button class="btn btn-md btn-secondary filterButton">
111
+                    <span class="glyphicon glyphicon-plus">
112
+                    </span>
113
+                    Filters
114
+                  </button>
115
+                <div class="filterSection">
111
                 <div class="form-group">
116
                 <div class="form-group">
112
                     {{ Form::label('program_id2', 'Associated Program')}}
117
                     {{ Form::label('program_id2', 'Associated Program')}}
113
                     <select id='select-program' class="form-control selectpicker" onchange='fetchAllCriterion("select-program", "assoc_outcomes_fetch")'>
118
                     <select id='select-program' class="form-control selectpicker" onchange='fetchAllCriterion("select-program", "assoc_outcomes_fetch")'>
121
                     {{ Form::select('assoc_outcome_fetch', $outcomes, null, ['class'=>'form-control selectpicker', 'id'=>'assoc_outcomes_fetch', 'onchange'=>'fetchAllCriterion("select-program", "assoc_outcomes_fetch")']) }}
126
                     {{ Form::select('assoc_outcome_fetch', $outcomes, null, ['class'=>'form-control selectpicker', 'id'=>'assoc_outcomes_fetch', 'onchange'=>'fetchAllCriterion("select-program", "assoc_outcomes_fetch")']) }}
122
 
127
 
123
                 </div>
128
                 </div>
129
+                </div>
124
 
130
 
125
                 <div class="form-group">
131
                 <div class="form-group">
126
                     {{ Form::label('criterion_id', 'Criterion') }}
132
                     {{ Form::label('criterion_id', 'Criterion') }}
175
 
181
 
176
                     {{ Form::label('program_id2', 'Associated Program') }}<br><br>
182
                     {{ Form::label('program_id2', 'Associated Program') }}<br><br>
177
 
183
 
178
-
184
+                    <input type = "hidden" id = "{{ $programs[0]->name }}"  name="program_id[]" value="{{$programs[0]->id}}">
185
+                 
179
                     <input type="checkbox" id="assoc_program_id_{{ $programs[0]->id }}" name="program_id[]" value="{{$programs[0]->id}}" disabled checked>
186
                     <input type="checkbox" id="assoc_program_id_{{ $programs[0]->id }}" name="program_id[]" value="{{$programs[0]->id}}" disabled checked>
180
                     <label for="assoc_program_id_{{ $programs[0]->id }}"> {{ $programs[0]->name }} <sub>[{{ $programs[0]->school->name }}]</sub></label><br>
187
                     <label for="assoc_program_id_{{ $programs[0]->id }}"> {{ $programs[0]->name }} <sub>[{{ $programs[0]->school->name }}]</sub></label><br>
181
 
188
 
232
                     {{ Form::label('notes', 'Additional Notes') }}
239
                     {{ Form::label('notes', 'Additional Notes') }}
233
                     {{ Form::textarea('notes', Input::old('notes'), array('class' => 'form-control', 'rows'=>2, 'id'=>'criterion_notes', 'placeholder'=>'(optional)')) }}
240
                     {{ Form::textarea('notes', Input::old('notes'), array('class' => 'form-control', 'rows'=>2, 'id'=>'criterion_notes', 'placeholder'=>'(optional)')) }}
234
                 </div>
241
                 </div>
235
-                <div id='delete'>
236
-
237
-                </div>
242
+               
238
                 {{ Form::submit('Update', array('class' => 'btn btn-primary btn-block')) }}
243
                 {{ Form::submit('Update', array('class' => 'btn btn-primary btn-block')) }}
239
                 {{ Form::close() }}
244
                 {{ Form::close() }}
245
+ <div id='delete'>
240
 
246
 
247
+                </div>
241
 
248
 
242
             </div>
249
             </div>
243
         </div>
250
         </div>
320
     }
327
     }
321
 
328
 
322
 
329
 
330
+$('.filterSection').hide();
331
+    $('.filterButton').on('click', function()
332
+{
333
+  var span = $(this).find('span');
334
+  if(span.attr('class') == 'glyphicon glyphicon-plus'){
335
+    span.attr('class','glyphicon glyphicon-minus');
336
+  } else{
337
+    span.attr('class','glyphicon glyphicon-plus');
338
+  }
339
+  $('.filterSection').toggle(533);
340
+});
323
 
341
 
324
     function numberOfScales(string, Scales) {
342
     function numberOfScales(string, Scales) {
325
         var maximum = $('#maximum_score').val();
343
         var maximum = $('#maximum_score').val();
866
                 assocObjectiveCounter = json.objectives.length;
884
                 assocObjectiveCounter = json.objectives.length;
867
 
885
 
868
 
886
 
869
-
887
+                
870
 
888
 
871
 
889
 
872
 
890
 
972
 
990
 
973
 return false;
991
 return false;
974
 });
992
 });
993
+$('.filterButton').on('click', function(e) {
994
+    // Prevent the default action of the clicked item. In this case that is submit
995
+    e.preventDefault();
996
+    
997
+    
998
+    return false;
999
+    });
975
 $('#button-add-objective-assoc').on('click', function(e) {
1000
 $('#button-add-objective-assoc').on('click', function(e) {
976
 // Prevent the default action of the clicked item. In this case that is submit
1001
 // Prevent the default action of the clicked item. In this case that is submit
977
 e.preventDefault();
1002
 e.preventDefault();

+ 5
- 9
app/views/local/managers/pCoords/objectives.blade.php View File

40
                     <br>
40
                     <br>
41
 
41
 
42
 
42
 
43
-
43
+                    <input type ="hidden" id='{{ $programs[0]->name }}' name="program_id[]" value="{{$programs[0]->id}}">
44
                     <input type="checkbox" id="{{ $programs[0]->name }}" name="program_id[]" value="{{$programs[0]->id}}" disabled checked>
44
                     <input type="checkbox" id="{{ $programs[0]->name }}" name="program_id[]" value="{{$programs[0]->id}}" disabled checked>
45
                     <label for="{{ $programs[0]->name }}"> {{ $programs[0]->name }} [{{ $programs[0]->school->name }}]</label><br>
45
                     <label for="{{ $programs[0]->name }}"> {{ $programs[0]->name }} [{{ $programs[0]->school->name }}]</label><br>
46
 
46
 
110
                     <br>
110
                     <br>
111
 
111
 
112
 
112
 
113
-
113
+                    <input type ="hidden" id='assoc_program_id_{{ $programs[0]->id }}' name="program_id[]" value="{{$programs[0]->id}}">
114
+                   
114
                     <input type="checkbox" id="{{ $programs[0]->name }}" id="assoc_program_id_{{$programs[0]->id}}" name="program_id[]" value="{{$programs[0]->id}}" disabled checked>
115
                     <input type="checkbox" id="{{ $programs[0]->name }}" id="assoc_program_id_{{$programs[0]->id}}" name="program_id[]" value="{{$programs[0]->id}}" disabled checked>
115
                     <label for="{{ $programs[0]->name }}"> {{ $programs[0]->name }} [{{ $programs[0]->school->name }}]</label><br>
116
                     <label for="{{ $programs[0]->name }}"> {{ $programs[0]->name }} [{{ $programs[0]->school->name }}]</label><br>
116
 
117
 
135
                 {{ Form::submit('Update', array('class' => 'btn btn-primary btn-block')) }}
136
                 {{ Form::submit('Update', array('class' => 'btn btn-primary btn-block')) }}
136
                 {{ Form::close() }}
137
                 {{ Form::close() }}
137
             </div>
138
             </div>
138
-            <div id="text">
139
-                <p>lmao</p>
140
-            </div>
139
+
141
 
140
 
142
 
141
 
143
 
142
 
359
             'json'
358
             'json'
360
         );
359
         );
361
     }
360
     }
362
-    },
363
-    'json'
364
-    );
365
-    }
361
+   
366
 
362
 
367
     function deleteLastAssoc() {
363
     function deleteLastAssoc() {
368
 
364
 

+ 18
- 2
app/views/local/managers/sCoords/criteria.blade.php View File

106
             </div>
106
             </div>
107
             <div class="panel-body">
107
             <div class="panel-body">
108
                 {{ Form::open(array('action' => 'CriteriaController@update')) }}
108
                 {{ Form::open(array('action' => 'CriteriaController@update')) }}
109
-
110
-
109
+                <button class="btn btn-md btn-secondary filterButton">
110
+                    <span class="glyphicon glyphicon-plus">
111
+                    </span>
112
+                    Filters
113
+                  </button>
114
+                <div class="filterSection">
111
                 <div class="form-group">
115
                 <div class="form-group">
112
                     {{ Form::label('program_id2', 'Associated Program')}}
116
                     {{ Form::label('program_id2', 'Associated Program')}}
113
                     <select id='select-program' class="form-control selectpicker" onchange='fetchAllCriterion("select-program", "assoc_outcomes_fetch")'>
117
                     <select id='select-program' class="form-control selectpicker" onchange='fetchAllCriterion("select-program", "assoc_outcomes_fetch")'>
121
                     {{ Form::select('assoc_outcome_fetch', $outcomes, null, ['class'=>'form-control selectpicker', 'id'=>'assoc_outcomes_fetch', 'onchange'=>'fetchAllCriterion("select-program", "assoc_outcomes_fetch")']) }}
125
                     {{ Form::select('assoc_outcome_fetch', $outcomes, null, ['class'=>'form-control selectpicker', 'id'=>'assoc_outcomes_fetch', 'onchange'=>'fetchAllCriterion("select-program", "assoc_outcomes_fetch")']) }}
122
 
126
 
123
                 </div>
127
                 </div>
128
+                </div>
124
 
129
 
125
                 <div class="form-group">
130
                 <div class="form-group">
126
                     {{ Form::label('criterion_id', 'Criterion') }}
131
                     {{ Form::label('criterion_id', 'Criterion') }}
244
     </div>
249
     </div>
245
 </div>
250
 </div>
246
 <script>
251
 <script>
252
+    $('.filterSection').hide();
253
+    $('.filterButton').on('click', function()
254
+{
255
+  var span = $(this).find('span');
256
+  if(span.attr('class') == 'glyphicon glyphicon-plus'){
257
+    span.attr('class','glyphicon glyphicon-minus');
258
+  } else{
259
+    span.attr('class','glyphicon glyphicon-plus');
260
+  }
261
+  $('.filterSection').toggle(533);
262
+});
247
     var selectOptions = document.getElementById('outcome0').innerHTML;
263
     var selectOptions = document.getElementById('outcome0').innerHTML;
248
 
264
 
249
     var counter = 1;
265
     var counter = 1;