Browse Source

Aqui va, objetivos y view annual plans

parent
commit
f4942bfd1c

+ 1
- 1
.gitignore View File

@@ -12,7 +12,7 @@ app/config/testing/*
12 12
 app/config/database.php
13 13
 app/config/*
14 14
 
15
-!app/config/app.php
15
+
16 16
 node_modules/
17 17
 vendor/*
18 18
 !vendor/barryvdh/

+ 83
- 4
app/controllers/AnnualPlansController.php View File

@@ -985,12 +985,13 @@ class AnnualPlansController extends \BaseController
985 985
   {
986 986
 
987 987
     $annualPlan = AnnualPlan::findOrFail($annual_id);
988
+    $user_id = Auth::user()->id;
988 989
     $pdf = new PDF(app('config'), app("Filesystem"), app('view'), '/storage/plan_pdf');
989
-    $pdf = $pdf->loadView('local.managers.shared.print_annual_report', compact('annualPlan', 'download'))
990
+    $pdf = $pdf->loadView('local.managers.shared.print_annual_report', compact('annualPlan'))
990 991
       ->setOrientation("landscape")
991 992
 
992 993
       ->setPaper('legal', 'landscape');
993
-    $path = app_path() . '/storage/annual_pdfs/' . date('d-m-Y') . '-for-' . $annualPlan->program->id . '.pdf';
994
+    $path = app_path() . '/storage/annual_pdfs/' . date('d-m-Y') . '-for-' . $annualPlan->program->id . '-by-' . $user_id . '.pdf';
994 995
     $pdf->save($path);
995 996
     $name = date('d-m-Y') . '-for-' . $annualPlan->program->id . '.pdf';
996 997
     $pdf->download($name);
@@ -1004,9 +1005,10 @@ class AnnualPlansController extends \BaseController
1004 1005
     if (isset($it_exists)) {
1005 1006
       return '200';
1006 1007
     }
1007
-
1008
+    //$user_id = Auth::user()->id;
1008 1009
     DB::table("paths_for_annual_plans")
1009 1010
       ->where('annual_plan_id', $annual_id)
1011
+      ->where('user_id', $user_id)
1010 1012
       ->where('report', 1)
1011 1013
       ->update(array(
1012 1014
         'last' => 0
@@ -1017,12 +1019,84 @@ class AnnualPlansController extends \BaseController
1017 1019
       'annual_plan_id' => $annual_id,
1018 1020
       'last' => 1,
1019 1021
       'report' => 1,
1022
+      'user_id' => $user_id,
1023
+      'date_posted' => date('Y-m-d')
1020 1024
     ));
1021 1025
 
1022 1026
 
1027
+
1023 1028
     return '200';
1024 1029
   }
1025 1030
 
1031
+  public function annualPlansShow($annual_report_or_plan, $program_id)
1032
+  {
1033
+    $role = Auth::user()->role;
1034
+    switch ($role) {
1035
+      case 1:
1036
+      case 2:
1037
+      case 3:
1038
+        $last = [1, 0];
1039
+        break;
1040
+
1041
+      case 4:
1042
+        $last = [1];
1043
+
1044
+        break;
1045
+      default:
1046
+        App::abort('404');
1047
+    }
1048
+
1049
+    if ($annual_report_or_plan == "report") {
1050
+      $report = 1;
1051
+    } else if ($annual_report_or_plan == "plan") {
1052
+      $report = 0;
1053
+    } else {
1054
+      App::abort('404');
1055
+    }
1056
+
1057
+    $title = "Annual Plans for " . Program::findOrFail($program_id)->name;
1058
+    $paths_with_users = DB::table('paths_for_annual_plans')
1059
+      ->join('annual_plans', 'annual_plans.id', '=', 'paths_for_annual_plans.annual_plan_id')
1060
+      ->join('annual_cycle', 'annual_cycle.id', '=', 'annual_plans.annual_cycle_id')
1061
+      ->join('users', 'users.id', '=', 'paths_for_annual_plans.user_id')
1062
+      ->where('report', $report)
1063
+      ->whereIn('last', $last)
1064
+      ->where('annual_plans.program_id', $program_id)
1065
+      ->orderBy('date_posted', 'desc')
1066
+      ->select('paths_for_annual_plans.path_to_pdf', 'users.*', 'date_posted', 'annual_cycle.*', 'paths_for_annual_plans.last', 'paths_for_annual_plans.id as path_id')
1067
+      ->get();
1068
+
1069
+    return View::make('local.managers.shared.new_view_annual_plans', compact('paths_with_users', 'title', 'report', 'last', 'annual_report_or_plan', 'program_id'));
1070
+  }
1071
+
1072
+  public function downloadPDF($download, $path_id)
1073
+  {
1074
+    $pdf = new PDF(app('config'), app("Filesystem"), app('view'), '/storage/plan_pdf');
1075
+
1076
+    $queryToPath = DB::table('paths_for_annual_plans')
1077
+      ->where('id', $path_id)
1078
+      ->first();
1079
+
1080
+    Log::info("ERES TU? creo que no");
1081
+
1082
+    $annualPlan = AnnualPlan::findOrFail($queryToPath->annual_plan_id);
1083
+
1084
+    Log::info("ERES TU?");
1085
+
1086
+
1087
+    $pdf = $pdf->loadView('local.managers.shared.print_annual_report', compact('annualPlan'))
1088
+      ->setOrientation("landscape")
1089
+
1090
+      ->setPaper('legal', 'landscape');
1091
+    if ($download == "download")
1092
+      return $pdf->download(basename($queryToPath->path_to_pdf));
1093
+
1094
+    else
1095
+      return $pdf->stream(basename($queryToPath->path_to_pdf));
1096
+  }
1097
+
1098
+
1099
+
1026 1100
   public function checkIfPlanReady()
1027 1101
   {
1028 1102
     $annual_plan = AnnualPlan::findOrFail(Input::get("annual_id"));
@@ -1142,12 +1216,13 @@ class AnnualPlansController extends \BaseController
1142 1216
     $alphabet = range("A", "Z");
1143 1217
     $small_alphabet = range('a', 'z');
1144 1218
     $annualPlan = AnnualPlan::findOrFail($annual_id);
1219
+    $user_id = Auth::user()->id;
1145 1220
     $pdf = new PDF(app('config'), app("Filesystem"), app('view'), '/storage/plan_pdf');
1146 1221
     $pdf = $pdf->loadView('local.managers.shared.print_annual_plan', compact('annualPlan', 'alphabet', 'small_alphabet'))
1147 1222
       ->setOrientation("landscape")
1148 1223
 
1149 1224
       ->setPaper('legal', 'landscape');
1150
-    $path = app_path() . '/storage/annual_pdfs/plan-on-' . date('d-m-Y') . '-for-' . $annualPlan->program->id . '.pdf';
1225
+    $path = app_path() . '/storage/annual_pdfs/plan-on-' . date('d-m-Y') . '-for-' . $annualPlan->program->id . '-by-' . $user_id . '.pdf';
1151 1226
     $pdf->save($path);
1152 1227
     $name = "plan-on-" . date('d-m-Y') . '-for-' . $annualPlan->program->id . '.pdf';
1153 1228
     $pdf->download($name);
@@ -1165,6 +1240,8 @@ class AnnualPlansController extends \BaseController
1165 1240
     DB::table("paths_for_annual_plans")
1166 1241
       ->where('annual_plan_id', $annual_id)
1167 1242
       ->where('report', 0)
1243
+      ->where('user_id', $user_id)
1244
+
1168 1245
       ->update(array(
1169 1246
         'last' => 0
1170 1247
       ));
@@ -1174,6 +1251,8 @@ class AnnualPlansController extends \BaseController
1174 1251
       'annual_plan_id' => $annual_id,
1175 1252
       'last' => 1,
1176 1253
       'report' => 0,
1254
+      'user_id' => $user_id,
1255
+      'date_posted' => date('Y-m-d')
1177 1256
     ));
1178 1257
 
1179 1258
 

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

@@ -259,8 +259,35 @@ class CriteriaController extends \BaseController
259 259
     }
260 260
 
261 261
     public function delete()
262
+
263
+
262 264
     {
263
-        DB::delete("delete from criteria where id = ?", array(Input::get('criterion_delete')));
265
+
266
+        Log::info(Input::all());
267
+        Log::info("LLEGAMOS??");
268
+        $number_of_rows = DB::delete("delete from criteria where id = ?", array(Input::get('criterion_delete')));
269
+
270
+        if ($number_of_rows <= 0) {
271
+            $message = '<p>Error deleting Criterion:</p><ul>';
272
+
273
+
274
+
275
+            $message .= '</ul>';
276
+
277
+            /** Send error message and old data */
278
+            Session::flash('status', 'danger');
279
+            Session::flash('message', $message);
280
+        } else {
281
+            $message = '<p>Criterion deleted!</p><ul>';
282
+
283
+
284
+
285
+            $message .= '</ul>';
286
+
287
+            /** Send error message and old data */
288
+            Session::flash('status', 'success');
289
+            Session::flash('message', $message);
290
+        }
264 291
         return Redirect::to('criteria')->withInput();
265 292
         $role = Auth::user()['role'];
266 293
         switch ($role) {

+ 65
- 4
app/controllers/Objective2Controller.php View File

@@ -58,7 +58,7 @@ class Objective2Controller extends \BaseController
58 58
 
59 59
 			),
60 60
 			array(
61
-				'text' => 'required|string|unique:objectives',
61
+				'text' => 'required|string',
62 62
 
63 63
 				'outcome_id' => 'required|array',
64 64
 				'program_id' => 'required|array'
@@ -102,6 +102,7 @@ class Objective2Controller extends \BaseController
102 102
 
103 103
 
104 104
 		$clean_input['program_id'] = Input::get('program_id');
105
+		$clean_input['pair_criteria'] =  Input::get('pair_every_criteria_with_objective');
105 106
 
106 107
 
107 108
 		return $clean_input;
@@ -116,9 +117,37 @@ class Objective2Controller extends \BaseController
116 117
 		$json = array();
117 118
 
118 119
 		$json['program'] = DB::select("select program_id from objective_program where objective_id = ?", array(Input::get('id')));
119
-		$json['outcome'] = DB::select("select outcome_id from objective_outcome outc where outc.objective_id = ?", array(Input::get('id')));
120
+
121
+		//$json['outcome'] = DB::select("select outcome_id from objective_outcome outc where outc.objective_id = ?", array(Input::get('id')));
120 122
 		$json['objective'] = DB::select("select text, id from objectives where id =?", array(Input::get('id')));
121 123
 		$json['assessment'] = DB::select("select * from assessments where activity_criterion_id  in (select id from activity_criterion where criterion_id in (select criterion_id from criterion_objective_outcome where objective_id = ?))", array(Input::get('id')));
124
+		/*
125
+			select objective_outcome.*, typ_semester_outcome.id as typ_semester_outcome_id,count(criterion_id) from objectives join objective_outcome on objective_outcome.objective_id = objectives.id left join criterion_objective_outcome on criterion_objective_outcome.objective_id = objectives.id and objective_outcome.outcome_id = criterion_objective_outcome.outcome_id
126
+			 left join typ_semester_objectives on typ_semester_objectives.objective_id = objectives.id left join typ_semester_outcome on typ_semester_outcome.outcome_id = objective_outcome.outcome_id and typ_semester_outcome.id = typ_semester_objectives.typ_semester_outcome_id group by objectives.id, objective_outcome.outcome_id
127
+
128
+		*/
129
+		$json['outcome'] = DB::table('objective_outcome')
130
+
131
+			->leftJoin('criterion_objective_outcome', function ($j) {
132
+				$j->on('criterion_objective_outcome.objective_id', '=', 'objective_outcome.objective_id')
133
+					->on('criterion_objective_outcome.outcome_id', '=', 'objective_outcome.outcome_id');
134
+			})
135
+			->leftJoin('typ_semester_objectives', 'typ_semester_objectives.objective_id', '=', 'objective_outcome.objective_id')
136
+			->leftJoin('typ_semester_outcome', function ($j) {
137
+				$j->on('typ_semester_outcome.outcome_id', '=', 'objective_outcome.outcome_id')
138
+					->on('typ_semester_outcome.id', '=', 'typ_semester_objectives.typ_semester_outcome_id');
139
+			})
140
+			->groupBy("objective_outcome.objective_id", 'objective_outcome.outcome_id')
141
+			->where('objective_outcome.objective_id', Input::get('id'))
142
+			->select(
143
+				'objective_outcome.*',
144
+				DB::raw("count(criterion_id) as count_criterion_id"),
145
+				'typ_semester_outcome.id as typ_semester_outcome_id'
146
+			)
147
+			->get();
148
+		$json['typ_semester_objectives'] = DB::table('typ_semester_objectives')
149
+			->where('objective_id', Input::get('id'))
150
+			->get();
122 151
 
123 152
 		$json['assoc_criteria'] = DB::select("select name from criteria where id in(select criterion_id from criterion_objective_outcome where objective_id =?)", array(Input::get('id')));
124 153
 		Log::info('is here');
@@ -464,16 +493,48 @@ class Objective2Controller extends \BaseController
464 493
 				//TODO
465 494
 
466 495
 				$objectiveId = $Objective->id;
467
-				DB::delete("delete from `objective_outcome` where objective_id ={$objectiveId}");
496
+				//DB::delete("delete from `objective_outcome` where objective_id ={$objectiveId}");
468 497
 				DB::delete("delete from objective_program where objective_id = {$objectiveId}");
469 498
 
470 499
 				foreach ($clean_input['program_id'] as $program_id) {
471 500
 					DB::insert("insert into `objective_program`(objective_id, program_id) values ({$objectiveId},{$program_id})");
472 501
 				}
502
+				$criteria_assoc = DB::table('criterion_objective_outcome')
503
+					->join('program_criterion', 'program_criterion.criterion_id', '=', 'criterion_objective_outcome.criterion_id')
504
+					->whereIn('program_id', $clean_input['program_id'])
505
+					->where('objective_id', $objectiveId)
506
+					->groupBy('program_criterion.criterion_id')
507
+					->select('program_criterion.criterion_id')
508
+					->lists('program_criterion.criterion_id');
509
+
510
+				$criterion_array = [];
473 511
 				foreach ($clean_input['outcome_id'] as $outcome_id) {
474
-					DB::insert("insert into `objective_outcome` (objective_id, outcome_id) values ({$objectiveId}, {$outcome_id})");
512
+					$check_if_already_inserted = DB::table('objective_outcome')
513
+						->where('objective_id', $objectiveId)
514
+						->where('outcome_id', $outcome_id)
515
+						->first();
516
+
517
+					if (!isset($check_if_already_inserted)) {
518
+						DB::insert("insert into `objective_outcome` (objective_id, outcome_id) values ({$objectiveId}, {$outcome_id})");
519
+						if ($clean_input['pair_criteria'] == '1') {
520
+							foreach ($criteria_assoc as $criterion_id) {
521
+
522
+								DB::table('criterion_objective_outcome')
523
+									->insert(array(
524
+										"criterion_id" => $criterion_id,
525
+										"objective_id" => $objectiveId,
526
+										"outcome_id" => $outcome_id
527
+									));
528
+							}
529
+						}
530
+					}
475 531
 				}
476 532
 
533
+				DB::table('objective_outcome')
534
+					->whereNotIn('outcome_id', $clean_input['outcome_id'])
535
+					->where('objective_id', $objectiveId)
536
+					->delete();
537
+
477 538
 				//Session::flash('status', 'success');
478 539
 				//Session::flash('message', 'Updated Objective: "' . $Objective->text . '"');
479 540
 				$MessageArray = array('status' => 'success', 'message' => 'Updated Objective: "' . $Objective->text . '"');

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

@@ -1029,7 +1029,7 @@ class TransformativeActionsController extends \BaseController
1029 1029
       } else {
1030 1030
         $outcome_id = array($outcome_id);
1031 1031
       }
1032
-
1032
+      Log::info($course_id);
1033 1033
       // search TA with filters
1034 1034
       $filtered_at = DB::table('transformative_actions')
1035 1035
         ->join('ta_course', 'ta_course.ta_id', '=', 'transformative_actions.id')

+ 38
- 0
app/database/migrations/2022_04_26_151616_add_date_to_paths_for_annual_plans.php View File

@@ -0,0 +1,38 @@
1
+<?php
2
+
3
+use Illuminate\Database\Schema\Blueprint;
4
+use Illuminate\Database\Migrations\Migration;
5
+use Illuminate\Support\Facades\Schema;
6
+
7
+class AddDateToPathsForAnnualPlans extends Migration
8
+{
9
+
10
+	/**
11
+	 * Run the migrations.
12
+	 *
13
+	 * @return void
14
+	 */
15
+	public function up()
16
+	{
17
+		Schema::table('paths_for_annual_plans', function (Blueprint $t) {
18
+			$t->date("date_posted");
19
+			$t->integer('user_id')->unsigned();
20
+			$t->foreign('user_id')
21
+				->references('id')
22
+				->on('users');
23
+		});
24
+	}
25
+
26
+	/**
27
+	 * Reverse the migrations.
28
+	 *
29
+	 * @return void
30
+	 */
31
+	public function down()
32
+	{
33
+		Schema::table('paths_for_annual_plans', function (Blueprint $t) {
34
+			$t->dropColumn("date_posted");
35
+			$t->dropColumn("user_id");
36
+		});
37
+	}
38
+}

+ 10
- 6
app/routes.php View File

@@ -181,6 +181,7 @@ Route::group(array('before' => 'auth|has_access'), function () {
181 181
         )
182 182
     );
183 183
 
184
+
184 185
     Route::post('postAnnualReport/{annual_id?}', 'AnnualPlansController@postAnnualReport');
185 186
     Route::get('printAnnualPlan/{annual_plan?}', 'AnnualPlansController@printAnnualPlan');
186 187
     Route::post('checkIfPlanReady', 'AnnualPlansController@checkIfPlanReady');
@@ -214,6 +215,11 @@ Route::group(array('before' => 'auth|has_access'), function () {
214 215
         'uses' => 'AnnualPlansController@fetchAnnualReport'
215 216
     ));
216 217
 
218
+    //View annual plans and report
219
+
220
+    Route::get('{annual_report_or_plan}/show/{program_id}', "AnnualPlansController@annualPlansShow");
221
+    Route::get("downloadAnnualPDF/{download}/{path_id}", "AnnualPlansController@downloadPDF");
222
+
217 223
     //Route::post('submitAnnualPlan', array('uses' => 'AnnualPlansController@submitAnnualPlan'));
218 224
 
219 225
     Route::post('fetchTransformativeStatus', array('uses' => 'TransformativeActionsController@fetchStatus'));
@@ -222,6 +228,7 @@ Route::group(array('before' => 'auth|has_access'), function () {
222 228
 
223 229
     Route::post('futureTransformativeCourse', 'AnnualPlansController@futureTransformative');
224 230
     //other stuff
231
+    Route::post('deleteCriterion', 'CriteriaController@delete');
225 232
     Route::post('postActivityCriterionTrans/{activity_id}', array(
226 233
         'as' => 'postActivityCriterionTrans/{activity_id}',
227 234
         'uses' => 'TransformativeActionsController@postActivityCriterion'
@@ -270,10 +277,7 @@ Route::group(array('before' => 'auth|has_access'), function () {
270 277
         'as' => 'fetchAllCriterion',
271 278
         'uses' => 'CriteriaController@fetchAllCriterion'
272 279
     ));
273
-    Route::post('deleteCriterion', array(
274
-        'as' => 'deleteCriterion',
275
-        'uses' => 'CriteriaController@delete'
276
-    ));
280
+
277 281
 
278 282
     Route::get('viewFormative', array(
279 283
         'as' => 'viewFormative',
@@ -376,8 +380,8 @@ Route::group(array('before' => 'auth|has_access'), function () {
376 380
 
377 381
         Route::post('learning-outcomes/update', array('before' => 'csrf', 'uses' => 'OutcomesController@updateMore'));
378 382
         Route::post('learning-outcomes/update', array('before' => 'csrf', 'uses' => 'OutcomesController@update'));
379
-        Route::post('crtiteria/update', array('before' => 'csrf', 'uses' => 'CriteriaController@update'));
380
-        Route::delete('crtiteria/delete', array('before' => 'csrf', 'uses' => 'CriteriaController@destroy'));
383
+        Route::post('criteria/update', array('before' => 'csrf', 'uses' => 'CriteriaController@update'));
384
+        Route::delete('critteria/delete', array('before' => 'csrf', 'uses' => 'CriteriaController@destroy'));
381 385
 
382 386
         Route::get('administrator/users/{query?}', 'UsersController@index');
383 387
 

BIN
app/storage/annual_pdfs/26-04-2022-for-15-by-3402.pdf View File


BIN
app/storage/annual_pdfs/26-04-2022-for-15.pdf View File


BIN
app/storage/annual_pdfs/plan-on-26-04-2022-for-15-by-3402.pdf View File


+ 904
- 861
app/views/global/view-three-year-plan.blade.php
File diff suppressed because it is too large
View File


+ 26
- 25
app/views/local/managers/admins/assessment_report.blade.php View File

@@ -22,7 +22,7 @@
22 22
             <!-- <h3>Table of Contents</h3> -->
23 23
             <!-- <ol id="table-of-contents" class="upper-roman">
24 24
 
25
-                </ol> -->
25
+                    </ol> -->
26 26
 
27 27
 
28 28
             <h3 id="{{ $outcome->id }}" class="outcome">{{ $outcome->name }}</h3>
@@ -31,7 +31,7 @@
31 31
                     <tr class="center-text">
32 32
                         <th>School or College</th>
33 33
                         <th>Academic Program</th>
34
-                        <th>Assesses Outcome</th>
34
+                        <th>Assesses Learning Outcome</th>
35 35
                         <th>Findings</th>
36 36
                     </tr>
37 37
                 </thead>
@@ -66,16 +66,16 @@
66 66
                                             <?php
67 67
                                             
68 68
                                             /* $sections_evaluating_outcome = Course::has('activities')
69
-                                            //                                             ->whereNotNull('outcomes_attempted')
70
-                                            //                                             ->whereRaw('outcomes_attempted not like \'%"'.$outcome->id.'":0%\'')
71
-                                                                                        ->with(array('activities'=>function($query) use(&$outcome){
72
-                                            //                                                 $query->whereNotNull('outcomes_attempted');
73
-                                            //                                                 $query->whereRaw('outcomes_attempted not like \'%"'.$outcome->id.'":0%\'');} ))
74
-                                            //                                                 $query->whereRaw('outcomes_attempted not like \'%"'.$outcome->id.'":0%\'');
75
-                                                                                            } ))
76
-                                                                                        ->where('code', $course->code)->where('number',$course->number)
77
-                                                                                        ->whereIn('semester_id', Session::get('semesters_ids'))
78
-                                                                                        ->get();*/
69
+                                                                                        //                                             ->whereNotNull('outcomes_attempted')
70
+                                                                                        //                                             ->whereRaw('outcomes_attempted not like \'%"'.$outcome->id.'":0%\'')
71
+                                                                                                                                    ->with(array('activities'=>function($query) use(&$outcome){
72
+                                                                                        //                                                 $query->whereNotNull('outcomes_attempted');
73
+                                                                                        //                                                 $query->whereRaw('outcomes_attempted not like \'%"'.$outcome->id.'":0%\'');} ))
74
+                                                                                        //                                                 $query->whereRaw('outcomes_attempted not like \'%"'.$outcome->id.'":0%\'');
75
+                                                                                                                                        } ))
76
+                                                                                                                                    ->where('code', $course->code)->where('number',$course->number)
77
+                                                                                                                                    ->whereIn('semester_id', Session::get('semesters_ids'))
78
+                                                                                                                                    ->get();*/
79 79
                                             
80 80
                                             $sections_evaluating_outcome = Course::has('activities')
81 81
                                             
@@ -120,23 +120,24 @@
120 120
                                                             <h5>Measure {{ $activity_index + 1 }}</h5>
121 121
                                                             <?php
122 122
                                                             /*
123
-                                                                                                                    var_dump($section->code);
124
-                                                                                                                    var_dump($section->number);
125
-                                                                                                                    var_dump($section->name);
126
-                                                                                                                    var_dump($outcome->name);
127
-                                                                                                                    var_dump(date('M Y', strtotime($activity->date)));
128
-                                                                                                                    var_dump($activity->name);
129
-                                                                                                                    var_dump(count($section->students));
130
-                                                                                                                    print"<br>";
131
-                                                                                                                    print "A rubric was used in the $section->code-$section->number ($section->name) course (". date('M Y', strtotime($activity->date)).") to assess students’ <u>". strtolower($outcome->name) ."</u> in the activity: '<strong>$activity->name </strong>'. N= ". count($section->students);
132
-                                                                                                                    exit();
133
-                                                                                                                    */
123
+                                                                                                                                                                                var_dump($section->code);
124
+                                                                                                                                                                                var_dump($section->number);
125
+                                                                                                                                                                                var_dump($section->name);
126
+                                                                                                                                                                                var_dump($outcome->name);
127
+                                                                                                                                                                                var_dump(date('M Y', strtotime($activity->date)));
128
+                                                                                                                                                                                var_dump($activity->name);
129
+                                                                                                                                                                                var_dump(count($section->students));
130
+                                                                                                                                                                                print"<br>";
131
+                                                                                                                                                                                print "A rubric was used in the $section->code-$section->number ($section->name) course (". date('M Y', strtotime($activity->date)).") to assess students’ <u>". strtolower($outcome->name) ."</u> in the activity: '<strong>$activity->name </strong>'. N= ". count($section->students);
132
+                                                                                                                                                                                exit();
133
+                                                                                                                                                                                */
134 134
                                                             ?>
135 135
 
136 136
 
137 137
                                                             <p>A rubric was used in the
138 138
                                                                 {{ $section->code }}-{{ $section->number }}
139
-                                                                ({{ $section->name }}) course
139
+                                                                ({{ $section->name }})
140
+                                                                course
140 141
                                                                 ({{ date('M Y', strtotime($activity->date)) }}) to assess
141 142
                                                                 students’ <u>{{ strtolower($outcome->name) }}</u> in the
142 143
                                                                 activity: "<strong>{{ $activity->name }}</strong>". N=
@@ -225,7 +226,7 @@
225 226
                                                             <br><br>
226 227
                                                         @else
227 228
                                                             <h5>Measure {{ $activity_index + 1 }}</h5>
228
-                                                            <em>Outcome not measured.</em>
229
+                                                            <em>Learning Outcome not measured.</em>
229 230
                                                         @endif
230 231
                                                     @endforeach
231 232
                                                 @endforeach

+ 988
- 992
app/views/local/managers/admins/criteria.blade.php
File diff suppressed because it is too large
View File


+ 12
- 16
app/views/local/managers/admins/objectives.blade.php View File

@@ -19,7 +19,7 @@
19 19
                 <div class="panel-body">
20 20
                     {{ Form::open(['action' => 'Objective2Controller@create']) }}
21 21
                     <div id='outcomeGroup'>
22
-                        <label> Associated Outcome</label>
22
+                        <label> Associated Learning Outcome</label>
23 23
                         <div class="form-group col-md-11" id='outcomeForm'>
24 24
 
25 25
 
@@ -41,7 +41,7 @@
41 41
                         <span class='glyphicon glyphicon-plus'>
42 42
 
43 43
                         </span>
44
-                        Add another Outcome
44
+                        Add another Learning Outcome
45 45
                     </button>
46 46
 
47 47
                     <!-- Associated Program -->
@@ -53,7 +53,6 @@
53 53
                         <br>
54 54
 
55 55
                         @foreach ($programs as $program)
56
-
57 56
                             <input type="checkbox" id="{{ $program->name }}" name="program_id[]"
58 57
                                 value="{{ $program->id }}">
59 58
                             <label for="{{ $program->name }}"> {{ $program->name }}
@@ -99,7 +98,7 @@
99 98
                             </select>
100 99
                         </div>
101 100
                         <div class="form-group">
102
-                            <label>Associated Outcome</label>
101
+                            <label>Associated Learning Outcome</label>
103 102
                             {{-- Form::select('assoc_outcome_fetch', $outcomes, null, ['class'=>'form-control selectpicker', 'id'=>'assoc_outcomes_fetch', 'onchange'=>'fetchAllObjectives("select-program", "assoc_outcomes_fetch")']) --}}
104 103
                             <select id="assoc_outcomes_fetch" name="assoc_outcome_fetch" class="form-control selectpicker"
105 104
                                 onchange="fetchAllObjectives('select-program', 'assoc_outcomes_fetch')">
@@ -120,25 +119,23 @@
120 119
                         <select id="select-objective" name="id" class="form-control selectpicker">
121 120
                             @foreach ($objectives as $objective)
122 121
                                 <option value="{{ $objective->id }}" data-subtext="
123
-                                             @if ($objective->program)
124
-                                    &nbsp;&nbsp;&nbsp;[{{ $objective->program->name }}]
125
-                            @endif
126
-                            ">
127
-                            {{ $objective->text }}
122
+                                                 @if ($objective->program) &nbsp;&nbsp;&nbsp;[{{ $objective->program->name }}] @endif
123
+                                ">
124
+                                    {{ $objective->text }}
128 125
 
129 126
 
130 127
 
131
-                            </option>
128
+                                </option>
132 129
                             @endforeach
133 130
                         </select>
134 131
                     </div>
135 132
                     <hr>
136 133
 
137
-                    <!-- Associated Outcome -->
134
+                    <!-- Associated Learning Outcome -->
138 135
 
139 136
                     <div class="form-group">
140 137
                         <div id='assocOutcomeGroup'>
141
-                            <label>Associated Outcome</label>
138
+                            <label>Associated Learning Outcome</label>
142 139
 
143 140
                             <select id="assoc_outcome0" name="assoc_outcome[]" class="form-control selectpicker">
144 141
                                 @foreach ($outcomes as $outcome)
@@ -160,7 +157,7 @@
160 157
                         <span class='glyphicon glyphicon-plus'>
161 158
 
162 159
                         </span>
163
-                        Add another Outcome
160
+                        Add another Learning Outcome
164 161
                     </button>
165 162
 
166 163
 
@@ -170,7 +167,6 @@
170 167
 
171 168
                         {{ Form::label('program_id2', 'Associated Program') }}<br><br>
172 169
                         @foreach ($programs as $program)
173
-
174 170
                             <input type="checkbox" id="assoc_program_id_{{ $program->id }}" name="assoc_program_id[]"
175 171
                                 value="{{ $program->id }}">
176 172
                             <label for="assoc_program_id_{{ $program->id }}"> {{ $program->name }}
@@ -254,7 +250,7 @@
254 250
 
255 251
         var counter = 1;
256 252
         var counterAssoc = 1;
257
-        //Add Another Outcome
253
+        //Add Another Learning Outcome
258 254
 
259 255
         function changeOutcomeHtml() {
260 256
             var outcomeHTML = document.getElementById('outcomeGroup').innerHTML;
@@ -405,7 +401,7 @@
405 401
                     if (json.assessment.length) {
406 402
                         $('#deleteObj').html(
407 403
                             "<p>This objective is currently participating in an assessment, therefore it cannot be deleted</p>"
408
-                            );
404
+                        );
409 405
                     } else if (json.assoc_criteria.length) {
410 406
                         modal =
411 407
                             '<button type="button" class="btn btn-primary btn-block" data-toggle="modal" data-target="#delete">' +

+ 911
- 925
app/views/local/managers/admins/transformativeAction.blade.php
File diff suppressed because it is too large
View File


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

@@ -69,7 +69,7 @@
69 69
                     <h6 class="dropdown-header">View Annual Plan from:</h6>
70 70
                     @foreach (Auth::user()->programs as $program)
71 71
                         <li><a
72
-                                href="{{ URL::action('AnnualPlansController@viewAllPlans', [$program->id]) }}">{{ $program->name }}</a>
72
+                                href="{{ URL::action('AnnualPlansController@annualPlansShow', ['plan', $program->id]) }}">{{ $program->name }}</a>
73 73
                         </li>
74 74
                     @endforeach
75 75
                 </ul>

+ 5
- 4
app/views/local/managers/shared/annual-plans.blade.php View File

@@ -1349,7 +1349,7 @@
1349 1349
                     // Create button to print report
1350 1350
 
1351 1351
                     div_btn_group = $('<div>', {
1352
-                        'class': 'btn-group',
1352
+                        'class': 'btn-group-vertical',
1353 1353
                         'role': 'group'
1354 1354
                     });
1355 1355
                     button_save = $('<button>', {
@@ -1500,12 +1500,13 @@
1500 1500
                             'onclick': "postAnnualPlan(" + annual_id + ")"
1501 1501
 
1502 1502
 
1503
-                        }).html("Submit Annual Report");
1503
+                        }).html("Submit Annual Plan");
1504 1504
 
1505 1505
                         $("#submit-modal-title").html("Are you sure you want to submit this report?");
1506 1506
                         $("#submit-modal-body")
1507 1507
                             .html(
1508
-                                "You can submit again later, but may need to give explination to administration on why was it resubmitted"
1508
+                                "You can submit again later, but may need to give explination to administration on why was it resubmitted." +
1509
+                                "When submitting, please be patient. It may take a while. "
1509 1510
                             );
1510 1511
 
1511 1512
                         $('#submit-modal-footer').html(button);
@@ -1540,7 +1541,7 @@
1540 1541
                         }).html('<span aria-hidden="true">×</span>');
1541 1542
                         alert.append(button);
1542 1543
                         alert.append(
1543
-                            '<strong>The plan was submitted. You can check it out in View Annual Plans or Print Plan </strong>'
1544
+                            '<strong>The Annual Plan was submitted. You can check it out in View Annual Plans or Print Plan </strong>'
1544 1545
                         )
1545 1546
                         alert.appendTo($("#alert-for-save"));
1546 1547
                     }

+ 14
- 13
app/views/local/managers/shared/annual_report.blade.php View File

@@ -35,7 +35,7 @@
35 35
 
36 36
             </div>
37 37
             <hr>
38
-            <div id="printButton"></div>
38
+            <div id="printButton" class="text-center"></div>
39 39
         </div>
40 40
 
41 41
 
@@ -68,14 +68,14 @@
68 68
 
69 69
 
70 70
                     <!-- <div class="table-responsive">
71
-                                                                                                                                                                                                                                                                                    <table class="table table-striped table-condensed datatable" style="table-layout: fixed ; width : 100%">
72
-                                                                                                                                                                                                                                                                                      <thead><tr><th>Objectives for courses</th><th>Criteria per Course</th><th>Transformative Actions</th></tr></thead>
73
-                                                                                                                                                                                                                                                                                      <tbody>
74
-                                                                                                                                                                                                                                                                                      </tbody>
71
+                                                                                                                                                                                                                                                                                                                <table class="table table-striped table-condensed datatable" style="table-layout: fixed ; width : 100%">
72
+                                                                                                                                                                                                                                                                                                                  <thead><tr><th>Objectives for courses</th><th>Criteria per Course</th><th>Transformative Actions</th></tr></thead>
73
+                                                                                                                                                                                                                                                                                                                  <tbody>
74
+                                                                                                                                                                                                                                                                                                                  </tbody>
75 75
 
76
-                                                                                                                                                                                                                                                                                    </table>
77
-                                                                                                                                                                                                                                                                                    
78
-                                                                                                                                                                                                                                                                                </div>-->
76
+                                                                                                                                                                                                                                                                                                                </table>
77
+                                                                                                                                                                                                                                                                                                                
78
+                                                                                                                                                                                                                                                                                                            </div>-->
79 79
 
80 80
                 </div>
81 81
             </div>
@@ -1576,16 +1576,16 @@
1576 1576
 
1577 1577
                     //create button for print
1578 1578
                     div_btn_group = $('<div>', {
1579
-                        'class': 'btn-group',
1579
+                        'class': 'btn-group-vertical',
1580 1580
                         'role': 'group'
1581 1581
                     });
1582 1582
                     button_save = $('<button>', {
1583
-                        'class': 'btn btn-lg btn-primary',
1583
+                        'class': ' btn btn-lg btn-primary ',
1584 1584
                         'type': 'button',
1585 1585
                         'onclick': 'check_if_ready(' + annual_id + ')'
1586 1586
                     }).html('Submit Annual Report');
1587 1587
                     button_print = $("<button>", {
1588
-                        "class": 'btn btn-lg btn-primary',
1588
+                        "class": 'btn btn-lg btn-primary ',
1589 1589
                         "type": "button",
1590 1590
                         "onclick": "window.location.href = " +
1591 1591
                             "'{{ URL::action('AnnualPlansController@printAnnualReport') }}" +
@@ -1766,7 +1766,8 @@
1766 1766
                         $("#submit-modal-title").html("Are you sure you want to submit this report?");
1767 1767
                         $("#submit-modal-body")
1768 1768
                             .html(
1769
-                                "You can submit again later, but may need to give explination to administration on why was it resubmitted"
1769
+                                "You can submit again later, but may need to give explination to administration on why was it resubmitted." +
1770
+                                "When submitting, please be patient. It may take a while."
1770 1771
                             );
1771 1772
 
1772 1773
                         $('#submit-modal-footer').html(button);
@@ -1802,7 +1803,7 @@
1802 1803
                         alert.append(button);
1803 1804
                         alert.append(
1804 1805
                             '<strong>Report is complete, You can check it out in View Annual Reports or Print Report </strong>'
1805
-                            )
1806
+                        )
1806 1807
                         alert.appendTo($("#alert-for-save"));
1807 1808
                     }
1808 1809
 

+ 93
- 93
app/views/local/managers/shared/criteria.blade.php View File

@@ -1,20 +1,18 @@
1 1
 @extends('layouts.master')
2 2
 
3 3
 @section('navigation')
4
-@if(Auth::user()->role == 1)
5
-@include('local.managers.admins._navigation')
6
-
7
-@elseif(Auth::user()->role == 2)
8
-@include('local.managers.sCoords._new_navigation')
9
-
4
+    @if (Auth::user()->role == 1)
5
+        @include('local.managers.admins._navigation')
6
+    @elseif(Auth::user()->role == 2)
7
+        @include('local.managers.sCoords._new_navigation')
10 8
     @elseif(Auth::user()->role == 3)
11
-    @include('local.managers.pCoords._new_navigation')
9
+        @include('local.managers.pCoords._new_navigation')
12 10
     @endif
13 11
 @stop
14 12
 @section('main')
15 13
 
16 14
     <div class="row">
17
-        
15
+
18 16
         <div class="col-md-6">
19 17
             <!-- Form to add a new criterion -->
20 18
             <div class="panel panel-default panel-button">
@@ -28,14 +26,14 @@
28 26
                             <div class="form-group col-md-12 selectOutcome">
29 27
                                 <label>Outcome 1</label>
30 28
 
31
-                                {{ Form::select('outcome[]', $outcomes, reset($outcomes), ['class' => 'form-control selectpicker', 'id' => 'outcome0', 'onchange' => 'fetchObjectiveForSelect("outcome0", "objectiveGroupFor0")']) }}
29
+                                {{ Form::select('outcome[]', $outcomes, reset($outcomes), ['class' => 'form-control selectpicker','id' => 'outcome0','onchange' => 'fetchObjectiveForSelect("outcome0", "objectiveGroupFor0")']) }}
32 30
                             </div>
33 31
 
34 32
                             <div id='objectiveGroupFor0' class='createObjective' data-value='1'>
35 33
                                 <div class="form-group col-md-11 selectObjective">
36 34
                                     <label>Associated Objectives for Outcome 1</label>
37 35
                                     <select id="objective_0_counter_1" name="objective[]" class="form-control selectpicker"
38
-                                    onchange="visiblePrograms('allOutcomes')">
36
+                                        onchange="visiblePrograms('allOutcomes')">
39 37
                                     </select>
40 38
 
41 39
                                 </div>
@@ -52,11 +50,11 @@
52 50
                             </button>
53 51
 
54 52
                             <br>
55
-                        
56
-                        <hr>
57
-                    </div>
58 53
 
59
-</div>
54
+                            <hr>
55
+                        </div>
56
+
57
+                    </div>
60 58
 
61 59
                     <input type='hidden' name='counterOutcome' id='counterOutcome' value=1>
62 60
 
@@ -71,23 +69,22 @@
71 69
                     <div class="form-group form_validation program_form" id='program-checkboxes'>
72 70
                         {{ Form::label('program_id', 'Associated Program') }}<br>
73 71
                         <br>
74
-                        @if(count($programs) ==1)
75
-                        <input type="checkbox" id="program-{{ $programs[0]->name }}" name="program_id[]"
76
-                        value="{{ $programs[0]->id }}"  checked>
77
-                    <label for="program-{{ $programs[0]->name }}"> {{ $programs[0]->name }}
78
-                        [{{ $programs[0]->school->name }}]</label><br>
79
-                        <input type="hidden" id="{{ $programs[0]->name }}" name="program_id[]"
80
-                            value="{{ $programs[0]->id }}">
81
-    
72
+                        @if (count($programs) == 1)
73
+                            <input type="checkbox" id="program-{{ $programs[0]->name }}" name="program_id[]"
74
+                                value="{{ $programs[0]->id }}" checked>
75
+                            <label for="program-{{ $programs[0]->name }}"> {{ $programs[0]->name }}
76
+                                [{{ $programs[0]->school->name }}]</label><br>
77
+                            <input type="hidden" id="{{ $programs[0]->name }}" name="program_id[]"
78
+                                value="{{ $programs[0]->id }}">
82 79
                         @else
83
-                  @foreach ($programs as $program)
84
-                         <input type="checkbox" id="program-{{ $program->id }}" name="program_id[]"
85
-                            value="{{ $program->id }}">
86
-                        <label for="program-{{ $program->id }}"> {{ $program->name }}
87
-                            [{{ $program->school->name }}]</label><br>
80
+                            @foreach ($programs as $program)
81
+                                <input type="checkbox" id="program-{{ $program->id }}" name="program_id[]"
82
+                                    value="{{ $program->id }}">
83
+                                <label for="program-{{ $program->id }}"> {{ $program->name }}
84
+                                    [{{ $program->school->name }}]</label><br>
88 85
                             @endforeach
89 86
 
90
-                    @endif
87
+                        @endif
91 88
                     </div>
92 89
 
93 90
                     <div class="form-group form_validation name_form">
@@ -98,11 +95,11 @@
98 95
                     <div class="form-group">
99 96
                         {{ Form::label('subcriteria', 'Subcriteria') }}
100 97
                         <p class="help-block"><strong>Manually add</strong> bullets or numbering.</p>
101
-                        {{ Form::textarea('subcriteria', '', ['class' => 'form-control', 'rows' => 3, 'aria-labelledby' => 'subcriteria']) }}
98
+                        {{ Form::textarea('subcriteria', '', ['class' => 'form-control','rows' => 3,'aria-labelledby' => 'subcriteria']) }}
102 99
                     </div>
103 100
                     <div class="form-group form_validation maximum_form">
104 101
                         {{ Form::label('maximum_score', 'Maximum Score') }}
105
-                        {{ Form::text('maximum_score', '8', ['class' => 'form-control', 'id' => 'maximum_score', 'oninput' => 'addOptions("Num_scale", "maximum_score", "Scales")']) }}
102
+                        {{ Form::text('maximum_score', '8', ['class' => 'form-control','id' => 'maximum_score','oninput' => 'addOptions("Num_scale", "maximum_score", "Scales")']) }}
106 103
                     </div>
107 104
                     <div class="form-group form_validation number_of_scales">
108 105
                         {{ Form::label('scales', 'Number of Scales') }}
@@ -118,15 +115,15 @@
118 115
 
119 116
                     <div class="form-group">
120 117
                         {{ Form::label('copyright', 'Copyright') }}
121
-                        {{ Form::textarea('copyright', '', ['class' => 'form-control', 'rows' => 2, 'placeholder' => '(optional)', 'aria-labelledby' => 'copyright']) }}
118
+                        {{ Form::textarea('copyright', '', ['class' => 'form-control','rows' => 2,'placeholder' => '(optional)','aria-labelledby' => 'copyright']) }}
122 119
                     </div>
123 120
 
124 121
                     <div class="form-group">
125 122
                         {{ Form::label('notes', 'Notes') }}
126
-                        {{ Form::textarea('notes', '', ['class' => 'form-control', 'rows' => 2, 'placeholder' => '(optional)', 'aria-labelledby' => 'notes']) }}
123
+                        {{ Form::textarea('notes', '', ['class' => 'form-control','rows' => 2,'placeholder' => '(optional)','aria-labelledby' => 'notes']) }}
127 124
                     </div>
128 125
 
129
-                    {{ Form::submit('Create', ['class' => 'btn btn-primary btn-block', 'id' => 'create_the_criterion_button', 'data-form-id' => 'create_criterion']) }}
126
+                    {{ Form::submit('Create', ['class' => 'btn btn-primary btn-block','id' => 'create_the_criterion_button','data-form-id' => 'create_criterion']) }}
130 127
                     {{ Form::close() }}
131 128
                 </div>
132 129
             </div>
@@ -138,7 +135,7 @@
138 135
                     Edit
139 136
                 </div>
140 137
                 <div class="panel-body">
141
-                    {{ Form::open(['action' => 'CriteriaController@update', 'id' => 'update_criterion', 'data-form-id' => 'update_criterion']) }}
138
+                    {{ Form::open(['action' => 'CriteriaController@update','id' => 'update_criterion','data-form-id' => 'update_criterion']) }}
142 139
 
143 140
                     <button class="btn btn-md btn-secondary filterButton">
144 141
                         <span class="glyphicon glyphicon-minus">
@@ -160,7 +157,7 @@
160 157
                         </div>
161 158
                         <div class="form-group">
162 159
                             <label>Associated Outcome</label>
163
-                            {{ Form::select('assoc_outcome_fetch', $outcomes, null, ['class' => 'form-control selectpicker', 'id' => 'assoc_outcomes_fetch', 'onchange' => 'fetchAllCriterion("select-program", "assoc_outcomes_fetch")']) }}
160
+                            {{ Form::select('assoc_outcome_fetch', $outcomes, null, ['class' => 'form-control selectpicker','id' => 'assoc_outcomes_fetch','onchange' => 'fetchAllCriterion("select-program", "assoc_outcomes_fetch")']) }}
164 161
 
165 162
                         </div>
166 163
                     </div>
@@ -170,7 +167,7 @@
170 167
                         {{ Form::label('criterion_id', 'Criterion') }}
171 168
                         <select id="select-criterion" name="id" class="form-control selectpicker"
172 169
                             onchange='fetchCriterionForEditing()'>
173
-                          
170
+
174 171
                         </select>
175 172
                     </div>
176 173
                     <div id='allAssocOutcomes' class='form_validation outcome_form'>
@@ -178,7 +175,7 @@
178 175
                         <div id='assocOutcomeGroup0' class='createOutcome' data-value="1">
179 176
                             <div class="form-group col-md-12 selectOutcome">
180 177
                                 <label>Outcome 1</label>
181
-                                {{ Form::select('outcome[]', $outcomes, null, ['class' => 'form-control selectpicker', 'id' => 'assoc_outcome_0', 'onchange' => 'fetchObjectiveForSelect("assoc_outcome_0", "assoc_objectiveGroupFor0")']) }}
178
+                                {{ Form::select('outcome[]', $outcomes, null, ['class' => 'form-control selectpicker','id' => 'assoc_outcome_0','onchange' => 'fetchObjectiveForSelect("assoc_outcome_0", "assoc_objectiveGroupFor0")']) }}
182 179
 
183 180
                             </div>
184 181
                             <div id='assoc_objectiveGroupFor0' class='createObjective' data-value="1">
@@ -201,10 +198,10 @@
201 198
                                 </span>
202 199
                                 Add another Objective
203 200
                             </button>
204
-                        
205
-                        <hr>
201
+
202
+                            <hr>
203
+                        </div>
206 204
                     </div>
207
-                </div>
208 205
                     <button class='btn btn-md btn-secondary button-add-outcome-assoc' onclick='addAssocOutcome()'>
209 206
                         <span class='glyphicon glyphicon-plus'>
210 207
 
@@ -216,32 +213,30 @@
216 213
 
217 214
 
218 215
                     <!-- Associated Program -->
219
-                    <div class="form-group form_validation program_form" id = 'assoc-program-checkboxes'>
216
+                    <div class="form-group form_validation program_form" id='assoc-program-checkboxes'>
217
+
218
+                        {{ Form::label('program_id2', 'Associated Program') }}<br><br>
220 219
 
221
-                            {{ Form::label('program_id2', 'Associated Program') }}<br><br>
220
+                        @if (count($programs) == 1)
222 221
 
223
-                            @if(count($programs) ==1)
224
-                           
225 222
                             <input type="hidden" id="{{ $programs[0]->name }}" name="program_id[]"
226
-                            value="{{ $programs[0]->id }}">
227
-    
223
+                                value="{{ $programs[0]->id }}">
224
+
228 225
                             <input type="checkbox" id="assoc_program-{{ $programs[0]->id }}" name="program_id[]"
229
-                                value="{{ $programs[0]->id }}"  checked>
226
+                                value="{{ $programs[0]->id }}" checked>
230 227
                             <label for="assoc_program-{{ $programs[0]->id }}"> {{ $programs[0]->name }}
231 228
                                 <sub>[{{ $programs[0]->school->name }}]</sub></label><br>
232
-    
233 229
                         @else
234
-                  @foreach ($programs as $program)
235
-                         <input type="checkbox" id="assoc_program-{{ $program->id }}" name="program_id[]"
236
-                                value="{{ $program->id }}">
237
-                            <label for="assoc_program-{{ $program->id }}"> {{ $program->name }}
238
-                                <sub>[{{ $program->school->name }}]</sub></label><br>
239
-                       
230
+                            @foreach ($programs as $program)
231
+                                <input type="checkbox" id="assoc_program-{{ $program->id }}" name="program_id[]"
232
+                                    value="{{ $program->id }}">
233
+                                <label for="assoc_program-{{ $program->id }}"> {{ $program->name }}
234
+                                    <sub>[{{ $program->school->name }}]</sub></label><br>
240 235
                             @endforeach
241 236
 
242
-                    @endif
237
+                        @endif
238
+
243 239
 
244
-                            
245 240
                     </div>
246 241
 
247 242
 
@@ -272,7 +267,7 @@
272 267
                     </div>
273 268
                     <div class="form-group form_validation maximum_form">
274 269
                         {{ Form::label('maximum_score', 'Maximum Score') }}
275
-                        {{ Form::text('maximum_score', '', ['class' => 'form-control', 'id' => 'assoc_maximum_score', 'oninput' => 'addOptions("Num_assoc_scale", "assoc_maximum_score", "Assoc_Scales")']) }}
270
+                        {{ Form::text('maximum_score', '', ['class' => 'form-control','id' => 'assoc_maximum_score','oninput' => 'addOptions("Num_assoc_scale", "assoc_maximum_score", "Assoc_Scales")']) }}
276 271
                     </div>
277 272
 
278 273
 
@@ -292,21 +287,23 @@
292 287
 
293 288
                     <div class="form-group">
294 289
                         {{ Form::label('copyright', 'Copyright Information') }}
295
-                        {{ Form::textarea('copyright', Input::old('copyright'), ['class' => 'form-control', 'rows' => 2, 'id' => 'criterion_copyright', 'placeholder' => '(optional)']) }}
290
+                        {{ Form::textarea('copyright', Input::old('copyright'), ['class' => 'form-control','rows' => 2,'id' => 'criterion_copyright','placeholder' => '(optional)']) }}
296 291
                     </div>
297 292
 
298 293
                     <div class="form-group">
299 294
                         {{ Form::label('notes', 'Additional Notes') }}
300
-                        {{ Form::textarea('notes', Input::old('notes'), ['class' => 'form-control', 'rows' => 2, 'id' => 'criterion_notes', 'placeholder' => '(optional)']) }}
295
+                        {{ Form::textarea('notes', Input::old('notes'), ['class' => 'form-control','rows' => 2,'id' => 'criterion_notes','placeholder' => '(optional)']) }}
301 296
                     </div>
302 297
 
303
-                    {{ Form::submit('Update', ['class' => 'btn btn-primary btn-block', 'id' => 'update_the_criterion_button', 'data-form-id' => 'update_criterion']) }}
298
+                    {{ Form::submit('Update', ['class' => 'btn btn-primary btn-block','id' => 'update_the_criterion_button','data-form-id' => 'update_criterion']) }}
304 299
                     {{ Form::close() }}
305
-                    {{ Form::open(['action' => 'CriteriaController@delete']) }}
300
+                    {{ Form::open(['action' => 'CriteriaController@delete', 'id' => 'deleteCriterionForm']) }}
306 301
 
307
-                    <input type='hidden' name='criterion_delete' id='deleteCriteria'>
302
+                    {{ Form::hidden('criterion_delete', '0', ['id' => 'deleteCriteria']) }}
303
+                    <!--<input type='hidden' name='criterion_delete' id='deleteCriteria'>-->
308 304
 
309 305
                     {{ Form::submit('Delete', ['class' => 'btn btn-primary btn-block', 'id' => 'DeleteButton']) }}
306
+                    {{ Form::close() }}
310 307
 
311 308
                 </div>
312 309
             </div>
@@ -323,28 +320,25 @@
323 320
             addOptions('Num_scale', 'maximum_score', 'Scales');
324 321
             $('#Num_scale').val('4');
325 322
             numberOfScales('Num_scale', 'Scales');
326
-            
323
+
327 324
             $('.selectpicker').selectpicker('refresh');
328
-            
325
+
329 326
         });
330 327
 
331
-        function checkIfNewCriterion(scaleBox){
332
-            if ( $(scaleBox).val() == $(scaleBox).data('old-scale') ){
328
+        function checkIfNewCriterion(scaleBox) {
329
+            if ($(scaleBox).val() == $(scaleBox).data('old-scale')) {
330
+
333 331
 
334
-                
335 332
 
336
-                $('#DeleteButton').prop('disabled', false);
333
+                //$('#DeleteButton').prop('disabled', false);
337 334
                 $("#update_the_criterion_button").val('Update');
338 335
                 $("#update_criterion").attr('action', "{{ URL::action('CriteriaController@update') }}")
339
-                
340
-                $(scaleBox).parent().children('.alert-placeholder').remove();
341
-            }
342 336
 
343
-
344
-             else {
345
-                if( $(scaleBox).parent().children('.alert-placeholder').length===0){
346
-                    div_placeholder = $('<div>',{
347
-                        'class':'alert-placeholder'
337
+                $(scaleBox).parent().children('.alert-placeholder').remove();
338
+            } else {
339
+                if ($(scaleBox).parent().children('.alert-placeholder').length === 0) {
340
+                    div_placeholder = $('<div>', {
341
+                        'class': 'alert-placeholder'
348 342
                     });
349 343
                     $(div_placeholder).html(
350 344
                         '<div class="alert alert-danger alert-dismissible" role="alert"> <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button> <strong>Warning!</strong> If a criterion is already used in assessments, editting it will actually create a new one </div>'
@@ -353,14 +347,15 @@
353 347
 
354 348
                 }
355 349
 
356
-                $('#DeleteButton').prop('disabled', true);
350
+                //$('#DeleteButton').prop('disabled', true);
357 351
                 $("#update_the_criterion_button").val("Create New")
358 352
                 $("#update_criterion").attr('action', "{{ URL::action('CriteriaController@create') }}")
359
-                
353
+
360 354
 
361 355
 
362 356
             }
363 357
         }
358
+
364 359
         function fetchCriterionForEditing() {
365 360
             var id = $('#select-criterion').find(':selected').val();
366 361
 
@@ -383,7 +378,7 @@
383 378
 
384 379
                     } else {
385 380
                         criterion = criterion[0];
386
-                        
381
+
387 382
                         var name = criterion.name;
388 383
                         if (criterion.subcriteria) {
389 384
                             subcriteria = JSON.parse(criterion.subcriteria).join('\n');
@@ -417,16 +412,19 @@
417 412
                             $('#assoc_scale_' + i).val(criterion.scales[i].description);
418 413
                         }
419 414
                         if ((criterion.activity_criterion.length)) {
420
-                            for(i = 0; i<criterion.num_scales; i++){
421
-                                $("#assoc_scale_"+i).attr('oninput','checkIfNewCriterion(this)')
422
-                                $("#assoc_scale_"+i).data('old-scale', $('#assoc_scale_'+i).val())
415
+                            for (i = 0; i < criterion.num_scales; i++) {
416
+                                $("#assoc_scale_" + i).attr('oninput', 'checkIfNewCriterion(this)')
417
+                                $("#assoc_scale_" + i).data('old-scale', $('#assoc_scale_' + i).val())
423 418
                             }
424 419
 
420
+                            $('#DeleteButton').prop('disabled', true);
421
+
425 422
 
426 423
 
427
-                            
428
-                            
429 424
 
425
+
426
+                        } else {
427
+                            $('#DeleteButton').prop('disabled', false);
430 428
                         }
431 429
 
432 430
 
@@ -629,16 +627,19 @@
629 627
 
630 628
 
631 629
                     */
632
-                            visiblePrograms('allAssocOutcomes');
630
+                    visiblePrograms('allAssocOutcomes');
633 631
 
634 632
                     var program_length = criterion.program.length;
635
-                    
636
-                        $('input[type=checkbox]').prop('checked', false);
637
-                        for (var i = 0; i < program_length; i++) {
633
+
634
+                    $('input[type=checkbox]').prop('checked', false);
635
+                    for (var i = 0; i < program_length; i++) {
638 636
                         $('#assoc_program-' + criterion.program[i].program_id).prop("checked", true);
639 637
                     }
640
-                    
641
-                  
638
+
639
+
640
+                    $("#deleteCriteria").val(criterion.id);
641
+
642
+
642 643
 
643 644
 
644 645
 
@@ -896,6 +897,8 @@
896 897
                     e.preventDefault();
897 898
 
898 899
 
900
+            } else if (e.originalEvent.submitter.id == "DeleteButton") {
901
+
899 902
             } else e.preventDefault();
900 903
         })
901 904
 
@@ -1653,9 +1656,6 @@
1653 1656
                 }
1654 1657
             )
1655 1658
         }
1656
-
1657
-
1658
-        
1659 1659
     </script>
1660 1660
 @stop
1661 1661
 

+ 89
- 0
app/views/local/managers/shared/new_view_annual_plans.blade.php View File

@@ -0,0 +1,89 @@
1
+@extends('layouts.master-2')
2
+
3
+@section('navigation')
4
+    @if (Auth::user()->role == 1)
5
+        @include('local.managers.admins._navigation')
6
+    @elseif(Auth::user()->role == 2)
7
+        @include('local.managers.sCoords._new_navigation')
8
+    @elseif(Auth::user()->role == 3)
9
+        @include('local.managers.pCoords._new_navigation')
10
+    @elseif(Auth::user()->role == 4)
11
+        @include('local.professors._navigation')
12
+    @endif
13
+@stop
14
+@section('main')
15
+
16
+    {{-- TODO: look where to place this script.
17
+          if placed inside .ready() or before it,
18
+            an error that the function is not defined occurs. --}}
19
+    {{-- TODO: no reconoce acentos --}}
20
+
21
+
22
+    <div class="row">
23
+
24
+
25
+
26
+        <div class="col-md-12">
27
+            <div class="table-responsive table-responsive-0">
28
+                <table class="table table-striped table-condensed datatable">
29
+                    <thead id="theHead">
30
+                        <tr>
31
+                            <th>Annual Cycle</th>
32
+                            <th>PDF Name</th>
33
+                            <th>User who submitted</th>
34
+                            <th>Date Submitted </th>
35
+                            <th>New Version</th>
36
+                            <th>Download</th>
37
+
38
+                        </tr>
39
+                    </thead>
40
+                    <tbody>
41
+                        @foreach ($paths_with_users as $info)
42
+                            <tr>
43
+                                <td> {{ $info->academic_year }}</td>
44
+                                <td> <a
45
+                                        href="{{ URL::action('AnnualPlansController@downloadPDF', ['print', $info->path_id]) }}">
46
+                                        {{ basename($info->path_to_pdf) }}
47
+                                        <span class="glyphicon glyphicon-eye-open"></span>
48
+
49
+                                </td>
50
+                                <td> {{ $info->surnames . ', ' . $info->first_name }}</td>
51
+                                <td>
52
+                                    {{ $info->date_posted }}
53
+                                </td>
54
+                                <td>
55
+                                    @if ($info->last == 1)
56
+                                        <span class="glyphicon glyphicon-ok"></span>
57
+                                    @endif
58
+                                </td>
59
+                                <td>
60
+                                    <a type="button" class="btn btn-primary"
61
+                                        href="{{ URL::action('AnnualPlansController@downloadPDF', ['download', $info->path_id]) }}">
62
+                                        Download
63
+                                        <span class="glyphicon glyphicon-download-alt"></span>
64
+                                    </a>
65
+                                </td>
66
+
67
+                            </tr>
68
+                        @endforeach
69
+                    </tbody>
70
+                </table>
71
+            </div>
72
+        </div>
73
+
74
+
75
+
76
+    </div>
77
+
78
+
79
+
80
+
81
+
82
+
83
+
84
+
85
+@stop
86
+
87
+@section('included-js')
88
+    @include('global._datatables_js')
89
+@stop

+ 167
- 67
app/views/local/managers/shared/objectives.blade.php View File

@@ -1,13 +1,13 @@
1 1
 @extends('layouts.master')
2 2
 
3 3
 @section('navigation')
4
-@if(Auth::user()->role==1)
5
-@include('local.managers.admins._navigation')
6
-@elseif(Auth::user()->role==2)
7
-@include('local.managers.sCoords._new_navigation')
8
-@elseif(Auth::user()->role==3)
9
-@include('local.managers.pCoords._new_navigation')
10
-@endif
4
+    @if (Auth::user()->role == 1)
5
+        @include('local.managers.admins._navigation')
6
+    @elseif(Auth::user()->role == 2)
7
+        @include('local.managers.sCoords._new_navigation')
8
+    @elseif(Auth::user()->role == 3)
9
+        @include('local.managers.pCoords._new_navigation')
10
+    @endif
11 11
 @stop
12 12
 @section('main')
13 13
     <div class="row">
@@ -25,14 +25,13 @@
25 25
                 <div class="panel-body">
26 26
                     {{ Form::open(['action' => 'Objective2Controller@create']) }}
27 27
                     <div id='outcomeGroup'>
28
-                        <label> Associated Outcome</label>
28
+                        <label> Associated Learning Outcome</label>
29 29
                         <div class="form-group col-md-11" id='outcomeForm'>
30 30
 
31 31
 
32 32
                             <select id="outcome[0]" name="outcome[0]" class="form-control selectpicker">
33 33
 
34 34
                                 @foreach ($outcomes as $outcome)
35
-
36 35
                                     <option value="{{ $outcome->id }}">
37 36
 
38 37
                                         {{ $outcome->name }}
@@ -44,7 +43,6 @@
44 43
 
45 44
 
46 45
                                     </option>
47
-
48 46
                                 @endforeach
49 47
 
50 48
                             </select>
@@ -58,7 +56,7 @@
58 56
                         <span class='glyphicon glyphicon-plus'>
59 57
 
60 58
                         </span>
61
-                        Add another Outcome
59
+                        Add another Learning Outcome
62 60
                     </button>
63 61
 
64 62
                     <!-- Associated Program -->
@@ -69,8 +67,7 @@
69 67
                         <br>
70 68
 
71 69
 
72
-                            @foreach ($programs as $program)
73
-
70
+                        @foreach ($programs as $program)
74 71
                             <input type="checkbox" id="{{ $program->name }}" name="program_id[]"
75 72
                                 value="{{ $program->id }}">
76 73
                             <label for="{{ $program->name }}"> {{ $program->name }}
@@ -120,7 +117,7 @@
120 117
                             </select>
121 118
                         </div>
122 119
                         <div class="form-group">
123
-                            <label>Associated Outcome</label>
120
+                            <label>Associated Learning Outcome</label>
124 121
                             {{-- Form::select('assoc_outcome_fetch', $outcomes, null, ['class'=>'form-control selectpicker', 'id'=>'assoc_outcomes_fetch', 'onchange'=>'fetchAllObjectives("select-program", "assoc_outcomes_fetch")']) --}}
125 122
                             <select id="assoc_outcomes_fetch" name="assoc_outcome_fetch" class="form-control selectpicker"
126 123
                                 onchange="fetchAllObjectives('select-program', 'assoc_outcomes_fetch')">
@@ -142,16 +139,15 @@
142 139
                         {{ Form::label('objective_id', 'Objectives') }}
143 140
                         <select id="select-objective" name='id' class="form-control selectpicker">
144 141
                             @foreach ($objectives as $objective)
145
-                                <option value="{{ $objective->id }}" data-subtext="
146
-                                             @if ($objective->program)
147
-                                    &nbsp;&nbsp;&nbsp;[{{ $objective->program->name }}]
148
-                            @endif
149
-                            ">
150
-                            {{ $objective->text }}
142
+                                <option value="{{ $objective->id }}"
143
+                                    data-subtext="
144
+                                                                                                                                                                                                                             @if ($objective->program) &nbsp;&nbsp;&nbsp;[{{ $objective->program->name }}] @endif
145
+                                                                                                                                                                                                            ">
146
+                                    {{ $objective->text }}
151 147
 
152 148
 
153 149
 
154
-                            </option>
150
+                                </option>
155 151
                             @endforeach
156 152
                         </select>
157 153
 
@@ -162,12 +158,13 @@
162 158
 
163 159
                     <div class="form-group">
164 160
                         <div id='assocOutcomeGroup'>
165
-                            <label>Associated Outcome</label>
161
+                            <label>Associated Learning Outcome</label>
162
+
163
+                            <div id="message_to_disconnect"></div>
166 164
 
167 165
                             <select id="assoc_outcome0" name="assoc_outcome[]" class="form-control selectpicker">
168 166
 
169 167
                                 @foreach ($outcomes as $outcome)
170
-
171 168
                                     <option value="{{ $outcome->id }}">
172 169
 
173 170
                                         {{ $outcome->name }}
@@ -179,7 +176,6 @@
179 176
 
180 177
 
181 178
                                     </option>
182
-
183 179
                                 @endforeach
184 180
 
185 181
                             </select>
@@ -193,7 +189,7 @@
193 189
                         <span class='glyphicon glyphicon-plus'>
194 190
 
195 191
                         </span>
196
-                        Add another Outcome
192
+                        Add another Learning Outcome
197 193
                     </button>
198 194
 
199 195
 
@@ -204,12 +200,11 @@
204 200
 
205 201
 
206 202
                         @foreach ($programs as $program)
207
-
208
-                        <input type="checkbox" id="assoc_program_id_{{ $program->id }}" name="assoc_program_id[]"
209
-                            value="{{ $program->id }}">
210
-                        <label for="assoc_program_id_{{ $program->id }}"> {{ $program->name }}
211
-                            <sub>[{{ $program->school->name }}]</sub></label><br>
212
-                    @endforeach
203
+                            <input type="checkbox" id="assoc_program_id_{{ $program->id }}" name="assoc_program_id[]"
204
+                                value="{{ $program->id }}">
205
+                            <label for="assoc_program_id_{{ $program->id }}"> {{ $program->name }}
206
+                                <sub>[{{ $program->school->name }}]</sub></label><br>
207
+                        @endforeach
213 208
                     </div>
214 209
 
215 210
                     <!-- Status -->
@@ -233,7 +228,7 @@
233 228
 
234 229
                     </div>
235 230
 
236
-                    {{ Form::submit('Update', ['class' => 'btn btn-primary btn-block', 'id' => 'update_button']) }}
231
+                    {{ Form::submit('Update', ['class' => 'btn btn-primary btn-block', 'id' => 'update_button_to_modal']) }}
237 232
                     {{ Form::close() }}
238 233
 
239 234
                     <form action="/deleteObjective" method="POST" id='deleteObj'>
@@ -249,6 +244,29 @@
249 244
             </div>
250 245
         </div>
251 246
     </div>
247
+    <div id="ObjectiveAssocModal" class="modal fade" tabindex="-1" data-criterion-id="0">
248
+        <div class="modal-dialog">
249
+            <div class="modal-content">
250
+                <div class="modal-header">
251
+                    <button type="button" class="close" data-dismiss="modal">&times;</button>
252
+                    <h5 class="modal-title">Would you like to pair these new Outcomes to all the Criteria associated to
253
+                        this Objective?</h5>
254
+
255
+                </div>
256
+                <div class="modal-body" id="ObjectiveModalBody">
257
+
258
+                </div>
259
+                <div class="modal-footer">
260
+                    <button type="button" class="btn btn-secondary"
261
+                        onclick="pair_every_criteria_with_objective =0; $('#update_button').click()"
262
+                        data-dismiss="modal">No</button>
263
+                    <button type="button" onclick="pair_every_criteria_with_objective =1; $('#update_button').click()"
264
+                        class="btn btn-primary" data-dismiss="modal">Yes</button>
265
+                    <button type="hidden" style="display:none" id="update_button" class="btn btn-primary"></button>
266
+                </div>
267
+            </div>
268
+        </div>
269
+    </div>
252 270
     <script>
253 271
         $('.filterSection').show();
254 272
 
@@ -294,7 +312,7 @@
294 312
         }
295 313
 
296 314
         var counter = 1;
297
-        var counterAssoc = 1;
315
+        var counterAssoc = 0;
298 316
         //Add Another Outcome
299 317
 
300 318
         function changeOutcomeHtml() {
@@ -347,7 +365,7 @@
347 365
                 'type': 'button',
348 366
                 'class': 'btn btn-primary',
349 367
                 //send the counter to the function so it can tell which container to remove
350
-                'onclick': 'deleteLast()',
368
+                'onclick': 'deleteLast(' + counter + ')',
351 369
 
352 370
             });
353 371
             $button.append('X');
@@ -365,7 +383,7 @@
365 383
         }
366 384
 
367 385
         //Recieves the counter variable so it can find the specific div and delete it
368
-        function deleteLast() {
386
+        function deleteLast(counter) {
369 387
             div = document.getElementById('outcomeContainer' + (counter).toString());
370 388
             div.remove();
371 389
         }
@@ -387,51 +405,86 @@
387 405
 
388 406
 
389 407
                     // Select associated outcome
390
-                    for (var i = counterAssoc; i != 1; i--) {
391
-                        deleteLastAssoc();
392
-
393
-                    }
408
+                    $(".removable-outcome").remove();
409
+                    $('.alert-dismissible').remove();
394 410
                     $('#assoc_outcome0').val(json.outcome[0].outcome_id);
411
+
412
+                    disabled = 0;
413
+                    if (json.outcome[0].typ_semester_outcome_id != null || json.outcome[0].count_criterion_id != 0) {
414
+                        $('#assoc_outcome0').attr('disabled', true);
415
+                        disabled = 1;
416
+                    } else $('#assoc_outcome0').attr('disabled', false);
417
+                    counterAssoc = 0;
395 418
                     $('#assoc_outcome0').selectpicker('refresh');
396
-                    counterAssoc = 1;
397 419
                     for (var i = 1; i < json.outcome.length; i++) {
398
-                        counterAssoc = i + 1;
420
+                        counterAssoc = i;
399 421
                         var $select = $('<select />', {
400
-                            'class': "selectpicker form-control",
422
+                            'class': "selectpicker form-control ",
401 423
                             'name': "assoc_outcome[]",
402 424
                             'data-live-search': 'true',
403
-                            'id': 'assoc_outcome' + i.toString()
425
+                            'id': 'assoc_outcome' + i.toString(),
426
+
404 427
 
405 428
                         });
406 429
                         var $div = $('<div />', {
407 430
                             'id': 'assocOutcomeForm' + i.toString(),
408
-                            'class': 'form-group col-md-11'
431
+                            'class': 'form-group col-md-11 removable-outcome'
409 432
                         });
410 433
                         var $divForButton = $('<div />', {
411
-                            'class': 'col-md-1',
434
+                            'class': 'col-md-1 removable-outcome',
412 435
                             'id': 'closeAssoc' + i.toString()
413 436
 
414 437
                         });
415 438
                         var $button = $('<button />', {
416 439
                             'type': 'button',
417
-                            'class': 'btn btn-primary',
418
-                            'onclick': 'deleteLastAssoc()'
440
+                            'class': 'btn btn-primary removable-outcome',
441
+                            'onclick': 'deleteLastAssoc(' + i + ')'
419 442
                         });
420 443
                         $button.append('X');
421 444
                         $divForButton.append($button);
422 445
 
423 446
                         $div.appendTo('#assocOutcomeGroup')
424 447
                         $select.append(selectOptions);
425
-
448
+                        if (json.outcome[i].typ_semester_outcome_id != null || json.outcome[i].count_criterion_id !=
449
+                            0) {
450
+                            $select.attr('disabled', true);
451
+                            $button.attr('disabled', true);
452
+                            disabled = 1;
453
+                        }
426 454
                         $select.appendTo('#assocOutcomeForm' + i.toString()).selectpicker('refresh');
427 455
                         $divForButton.appendTo('#assocOutcomeGroup');
428 456
 
457
+
429 458
                         $('#assoc_outcome' + i.toString()).val(json.outcome[i].outcome_id);
430 459
                         $('#assoc_outcome' + i.toString()).selectpicker('refresh');
431 460
 
432 461
 
462
+
463
+
433 464
                     }
434 465
 
466
+
467
+                    if (disabled == 1) {
468
+                        alert = $('<div/>', {
469
+                            'class': 'alert alert-danger alert-dismissible',
470
+                            'role': 'alert'
471
+                        })
472
+                        button = $('<button/>', {
473
+                            'type': 'button',
474
+                            'class': 'close',
475
+                            'data-dismiss': 'alert',
476
+                            'alert-label': 'close'
477
+                        }).html('<span aria-hidden="true">×</span>');
478
+                        alert.append(button);
479
+                        alert.append(
480
+                            '<strong>If you wish to edit the disabled Outcomes you need to detach the Objective from every Criteria paired to it and this Objectvie cannot be in any annual plan with that Outcome</strong>'
481
+                        )
482
+
483
+                        alert.appendTo($('#message_to_disconnect'))
484
+                    }
485
+
486
+
487
+
435 488
                     var program_length = json.program.length;
436 489
                     $('input[type=checkbox]').prop('checked', false);
437 490
 
@@ -446,12 +499,25 @@
446 499
                         $('#status').val(0);
447 500
                     else
448 501
                         $('#status').val(1);
502
+                    typ_status = "";
503
+
504
+                    warning = "";
449 505
 
450
-                    if (json.assessment.length) {
506
+                    if (json.typ_semester_objectives.length > 0 && json.assessment.length > 0) {
507
+                        warning =
508
+                            "<p>This objective is currently participating in an Assessment and it is paired to a Three Year Plan, therefore it cannot be deleted </p>";
509
+                        $("#deleteObj").html(warning);
510
+                    } else if (json.assessment.length > 0) {
451 511
                         $('#deleteObj').html(
452
-                            "<p>This objective is currently participating in an assessment, therefore it cannot be deleted</p>"
453
-                            );
454
-                    } else if (json.assoc_criteria.length) {
512
+                            "<p>This objective is currently participating in an Assessment, therefore it cannot be deleted</p>"
513
+                        );
514
+                    } else if (json.typ_semester_objectives.length > 0) {
515
+                        warning =
516
+                            "<p>This objective is currently paired to a Three Year Plan, therefore it cannot be deleted </p>";
517
+                        $("#deleteObj").html(
518
+                            warning
519
+                        );
520
+                    } else if (json.assoc_criteria.length > 0) {
455 521
                         modal =
456 522
                             '<button type="button" class="btn btn-primary btn-block" data-toggle="modal" data-target="#delete">' +
457 523
                             'Delete' +
@@ -523,40 +589,41 @@
523 589
         }
524 590
 
525 591
 
526
-        function deleteLastAssoc() {
592
+        function deleteLastAssoc(i) {
527 593
 
528
-            div = document.getElementById('assocOutcomeForm' + (counterAssoc - 1).toString());
594
+            div = document.getElementById('assocOutcomeForm' + (i).toString());
529 595
             div.remove();
530
-            button = document.getElementById('closeAssoc' + (counterAssoc - 1).toString());
596
+            button = document.getElementById('closeAssoc' + (i).toString());
531 597
             button.remove();
532
-            counterAssoc -= 1;
533
-            $('#counterAssoc').val(counterAssoc);
598
+            //counterAssoc -= 1;
599
+            //$('#counterAssoc').val(counterAssoc);
534 600
 
535 601
         }
536 602
 
537 603
         function addAssoc() {
538 604
 
539
-
605
+            counterAssoc += 1;
540 606
             var $select = $('<select />', {
541
-                'class': "selectpicker form-control",
607
+                'class': "selectpicker form-control ",
542 608
                 'name': "assoc_outcome[]",
543 609
                 'data-live-search': 'true',
544 610
                 'id': 'assoc_outcome' + counterAssoc.toString(),
611
+                'data-new-outcome': 'true'
545 612
 
546 613
             });
547 614
             var $div = $('<div />', {
548 615
                 'id': 'assocOutcomeForm' + counterAssoc.toString(),
549
-                'class': 'form-group col-md-11'
616
+                'class': 'form-group col-md-11 removable-outcome'
550 617
             });
551 618
             var $divForButton = $('<div />', {
552
-                'class': 'col-md-1',
619
+                'class': 'col-md-1 removable-outcome',
553 620
                 'id': 'closeAssoc' + counterAssoc.toString()
554 621
 
555 622
             });
556 623
             var $button = $('<button />', {
557 624
                 'type': 'button',
558 625
                 'class': 'btn btn-primary',
559
-                'onclick': 'deleteLastAssoc()'
626
+                'onclick': 'deleteLastAssoc(' + counterAssoc + ')'
560 627
             });
561 628
             $button.append('X');
562 629
             $divForButton.append($button);
@@ -569,18 +636,50 @@
569 636
 
570 637
 
571 638
             ran = true;
572
-            counterAssoc += 1;
639
+            //counterAssoc += 1;
573 640
             $('#counterAssoc').val(counterAssoc);
574 641
 
575 642
 
576 643
 
577 644
         }
645
+
646
+        $("#update_button_to_modal").on('click', function(e) {
647
+            e.preventDefault();
648
+            newOutcomes = [];
649
+            $('#assocOutcomeGroup').find('select').each(function() {
650
+                if ($(this).data('new-outcome') == true) {
651
+                    option = $(this).find(':selected');
652
+                    newOutcomes.push(option[0].text);
653
+                }
654
+            })
655
+
656
+            if (newOutcomes.length > 0) {
657
+                ul = $("<ul>");
658
+
659
+                $.each(newOutcomes, function(id, text) {
660
+                    li = $("<li>").html(text)
661
+                    ul.append(li);
662
+                });
663
+
664
+                $("#ObjectiveModalBody").html(ul);
665
+                $('#ObjectiveAssocModal').modal("toggle");
666
+            } else {
667
+                pair_every_criteria_with_objective = 0;
668
+                $("#update_button").click();
669
+
670
+            }
671
+
672
+
673
+        })
674
+        //Terrible notation but
675
+
676
+        pair_every_criteria_with_objective = 0;
578 677
         $('#update_button').on('click', function(e) {
579 678
             e.preventDefault();
580 679
 
581 680
             outcome_id = []
582 681
             program_id = [];
583
-            
682
+
584 683
             status = $('#status').val();
585 684
             text = $('#objective-text').val();
586 685
             id = $('#select-objective').val();
@@ -588,7 +687,7 @@
588 687
             $('#assocOutcomeGroup').find('select').each(function() {
589 688
                 outcome_id.push($(this).val())
590 689
             })
591
-$('input[name="assoc_program_id[]"]').each(function() {
690
+            $('input[name="assoc_program_id[]"]').each(function() {
592 691
                 if (this.checked)
593 692
                     program_id.push($(this).val())
594 693
             });
@@ -598,7 +697,8 @@ $('input[name="assoc_program_id[]"]').each(function() {
598 697
                     program_id: program_id,
599 698
                     status: status,
600 699
                     text: text,
601
-                    id: id
700
+                    id: id,
701
+                    pair_every_criteria_with_objective: pair_every_criteria_with_objective
602 702
                 },
603 703
                 function($array) {
604 704
                     div = $('<div/>', {
@@ -642,7 +742,7 @@ $('input[name="assoc_program_id[]"]').each(function() {
642 742
 
643 743
     $('#outcome-display').parent().hide();
644 744
 
645
-    fetchObjectiveForEditing();
745
+    // fetchObjectiveForEditing();
646 746
     // setCriterionStatus();
647 747
 
648 748