ソースを参照

Created Transformative Action page

onielm 3 年 前
コミット
46736f4660

+ 1016
- 0
app/controllers/TransformativeActionsController.php
ファイル差分が大きすぎるため省略します
ファイルの表示


+ 51
- 0
app/database/migrations/2021_03_29_151147_create_Transformative_Actions.php ファイルの表示

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

+ 52
- 0
app/database/migrations/2021_03_29_151507_create_transformative_objective_program.php ファイルの表示

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

+ 51
- 0
app/database/migrations/2021_03_29_151542_create_annual_report_transformative.php ファイルの表示

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

+ 42
- 0
app/database/migrations/2021_03_29_154844_create_annual_plan_transformative.php ファイルの表示

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

+ 44
- 0
app/database/migrations/2021_04_25_194120_create_ta_course_table.php ファイルの表示

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

+ 1
- 0
app/views/local/managers/admins/_navigation.blade.php ファイルの表示

@@ -3,6 +3,7 @@
3 3
 
4 4
     <ul class="nav navbar-nav navbar-right">
5 5
       <li>{{ HTML::linkAction('AdministratorsController@overview', 'Overview') }}</li>
6
+      <li>{{ HTML::linkAction('TransformativeActionsController@editTA', 'Transformative Actions') }}</li>
6 7
 
7 8
       <li class="dropdown">
8 9
         <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Management<span class="caret"></span></a>

+ 901
- 0
app/views/local/managers/admins/transformativeAction.blade.php ファイルの表示

@@ -0,0 +1,901 @@
1
+@extends('layouts.master')
2
+
3
+@section('navigation')
4
+    @if($role==2)
5
+        @include('local.managers.sCoords._navigation')
6
+    @elseif($role==3)
7
+        @include('local.managers.pCoords._navigation')
8
+    @else
9
+        @include('local.professors._navigation')
10
+    @endif
11
+@stop
12
+@section('main')
13
+
14
+<div class="row">
15
+    <div class="col-md-6">
16
+        <!-- Form to add a new criterion -->
17
+        <div class="panel panel-default panel-button">
18
+            <div class="panel-heading">
19
+                Create a TA
20
+            </div>
21
+            <div class="panel-body" id="createPanel">
22
+              {{ Form::open(array('action' => 'TransformativeActionsController@createTA')) }}
23
+
24
+              <div class="form-group">
25
+                {{ Form::label('createText', 'Name') }}
26
+                {{ Form::text('createText', '', array('class' => 'form-control')) }}
27
+              </div>
28
+
29
+              <div class="form-group">
30
+                {{ Form::label('createDescription', 'Description') }}
31
+                {{ Form::textarea('createDescription', '', array('class' => 'form-control')) }}
32
+              </div>
33
+
34
+              <div class="form-group"> </div>
35
+              <div class="form-group" id='dummyApproval'>
36
+                <label>Availability</label>
37
+                <select name="approval" class="form-control">
38
+                  <option value="1">Recommended</option>
39
+                  <option value="0">To be implemented</option>
40
+                </select>
41
+              </div>
42
+
43
+              <label>Courses being Transformed by the Action</label>
44
+              <div class="" id="">
45
+                <div class="form-group col-md-11">
46
+                  <select name="courseid[]" class="form-control createCourses selectpicker">
47
+                    @foreach ($courses_create as $course)
48
+                      <option value="{{$course->id}}">{{$course->name}} [{{$course->code}}]</option>
49
+                    @endforeach
50
+                  </select>
51
+                </div>
52
+                <button type="button" class='btn btn-md btn-primary col-md-1 remove-course'>
53
+                  X
54
+                </button>
55
+              </div>
56
+              <button type="button" class='btn btn-md btn-secondary add-course'>
57
+                <span class='glyphicon glyphicon-plus'>
58
+                </span>
59
+                Add another Course
60
+              </button>
61
+              <div class="form-group"> </div>
62
+
63
+              <div class="form-group" id='createOutcome'>
64
+                <label>Outcome perteneciente</label>
65
+                <select name="outcome" class="form-control selectpicker">
66
+                  @foreach ($outcomes as $outcome)
67
+                    <option value="{{$outcome->id}}">{{$outcome->name}}</option>
68
+                  @endforeach
69
+                </select>
70
+              </div>
71
+
72
+              <label>Associated Objectives</label>
73
+              <div class="" id="">
74
+                <div class="form-group col-md-11">
75
+                  {{-- <select class="form-control selectpicker"> --}}
76
+                  <select name="objectiveid[]" class="form-control createObjectives">
77
+                    {{-- @foreach ($objectives as $id => $text)
78
+                      <option value="{{$id}}">{{$text}}</option>
79
+                    @endforeach --}}
80
+                    <option value="">First, select an Outcome</option>
81
+                  </select>
82
+                  {{-- {{ Form::select('objective[]', $objectives, reset($objectives),  ['class'=>'form-control selectpicker', 'id' =>'objective0']) }} --}}
83
+                </div>
84
+                <button type="button" class='btn btn-md btn-primary col-md-1 remove-objective'>
85
+                  X
86
+                </button>
87
+              </div>
88
+              <button type="button" class='btn btn-md btn-secondary add-objective'>
89
+              {{-- <button type="button" class='btn btn-md btn-secondary add-create-objective'> --}}
90
+                <span class='glyphicon glyphicon-plus'>
91
+                </span>
92
+                Add another Objective
93
+              </button>
94
+              <div class="form-group"> </div>
95
+
96
+              {{ Form::submit('Create', array('class' => 'btn btn-primary btn-block')) }}
97
+              {{ Form::close() }}
98
+            </div>
99
+        </div>
100
+        <div class="panel panel-default panel-button">
101
+            <div class="panel-heading">
102
+                Approve a Recommended TA
103
+            </div>
104
+            <div class="panel-body" id="approvePanel">
105
+
106
+              <div class="">
107
+                <button class="btn btn-md btn-secondary filterButton">
108
+                  <span class="glyphicon glyphicon-plus">
109
+                  </span>
110
+                  Filters
111
+                </button>
112
+              </div>
113
+              <div class="filterSection">
114
+                <br>
115
+                <div class="">
116
+                  <div class="">
117
+                    <label>Professor that created the TA</label>
118
+                    <select class="form-control filterProfessor selectpicker">
119
+                      <option value="0">Show All</option>
120
+                      @foreach ($professor_filter_approvePanel as $ta)
121
+                        <option value="{{$ta->id}}">Prof. {{$ta->first_name}} {{$ta->surnames}}</option>
122
+                      @endforeach
123
+                    </select>
124
+                  </div>
125
+                  <br>
126
+                  <div class="">
127
+                    <label>Course evaluated by an Objective of the TA</label>
128
+                    <select class="form-control filterCourse selectpicker">
129
+                      <option value="0">Show All</option>
130
+                      @foreach ($course_filter_approvePanel as $course)
131
+                        <option value="{{$course->id}}">{{$course->name}}[{{$course->code}}]</option>
132
+                      @endforeach
133
+                    </select>
134
+                  </div>
135
+                  <br>
136
+                  <div class="">
137
+                    <label>Outcome of the TA</label>
138
+                    <select class="form-control filterOutcome selectpicker">
139
+                      <option value="0">Show All</option>
140
+                      @foreach ($outcome_filter_approvePanel as $outcome)
141
+                        <option value="{{$outcome->id}}">{{$outcome->name}}</option>
142
+                      @endforeach
143
+                    </select>
144
+                  </div>
145
+                </div>
146
+              </div>
147
+              <hr>
148
+              {{ Form::open(array('action' => 'TransformativeActionsController@approveTA')) }}
149
+
150
+              <div>
151
+                <div class="form-group col-md-11">
152
+                  <label>Select Transformative Action</label>
153
+                  <select name="ta" class="form-control SelectTA selectpicker" id='approvalSelectTA'>
154
+                    @if (count($ta_approval_panel) == 0)
155
+                      <option value="0">No TAs available</option>
156
+                    @else
157
+                      {{-- <option value="0">Select a TA</option> --}}
158
+                    @endif
159
+                    @foreach ($ta_approval_panel as $ta)
160
+                      <option value="{{$ta->id}}">{{$ta->at_text}}</option>
161
+                     {{-- <option value="{{$ta->id}}">{{$ta->at_text}}</option> --}}
162
+                   @endforeach
163
+                  </select>
164
+                </div>
165
+              </div>
166
+
167
+              <div class="form-group">
168
+                {{ Form::label('approvalDescription', 'Description') }}
169
+                {{ Form::textarea('approvalDescription', '', array('class' => 'form-control')) }}
170
+              </div>
171
+
172
+              <label>Associated Courses</label>
173
+              <div class="approveCourses">
174
+                <div class="form-group col-md-11 approveCourse">
175
+                  <select name="courseid[]" class="form-control selectpicker">
176
+                      <option value="">option</option>
177
+                  </select>
178
+                </div>
179
+                <button type="button" class='btn btn-md btn-primary col-md-1 remove-course'>
180
+                  X
181
+                </button>
182
+              </div>
183
+              <button type="button" class='btn btn-md btn-secondary add-course'>
184
+                <span class='glyphicon glyphicon-plus'>
185
+                </span>
186
+                Add another Course
187
+              </button>
188
+
189
+              <label>Associated Objectives</label>
190
+              <div class="approveObjectives">
191
+                <div class="form-group col-md-11">
192
+                  <select name="objectiveid[]" class="form-control">
193
+                    @foreach ($objectives as $id => $text)
194
+                      <option value="{{$id}}">{{$text}}</option>
195
+                    @endforeach
196
+                  </select>
197
+                </div>
198
+                <button type="button" class='btn btn-md btn-primary col-md-1 remove-objective'>
199
+                  X
200
+                </button>
201
+              </div>
202
+              <button type="button" class='btn btn-md btn-secondary add-objective'>
203
+                <span class='glyphicon glyphicon-plus'>
204
+                </span>
205
+                Add another Objective
206
+              </button>
207
+
208
+              <input type='hidden' name='at_text' class="approvalText">
209
+
210
+              <input type='hidden' name='ta_id' class='updateTA'>
211
+
212
+              {{ Form::submit('Approve', array('class' => 'btn btn-primary btn-block')) }}
213
+              {{ Form::close() }}
214
+            </div>
215
+        </div>
216
+    </div>
217
+
218
+    <div class="col-md-6">
219
+        <div class="panel panel-default panel-button">
220
+            <div class="panel-heading">
221
+                Edit a TA
222
+            </div>
223
+            <div class="panel-body" id="editPanel">
224
+
225
+              <div class="">
226
+                <button class="btn btn-md btn-secondary filterButton">
227
+                  <span class="glyphicon glyphicon-plus">
228
+                  </span>
229
+                  Filters
230
+                </button>
231
+              </div>
232
+              <div class="filterSection">
233
+                <br>
234
+                <div class="">
235
+                  <div class="">
236
+                    <label>Professor that created the TA</label>
237
+                    <select class="form-control filterProfessor selectpicker">
238
+                      <option value="0">Show All</option>
239
+                      @foreach ($professor_filter_editPanel as $user)
240
+                        <option value="{{$user->id}}">Prof. {{$user->first_name}} {{$user->surnames}}</option>
241
+                      @endforeach
242
+                    </select>
243
+                  </div>
244
+                  <br>
245
+                  <div class="">
246
+                    <label>Course evaluated by an Objective of the TA</label>
247
+                    <select class="form-control filterCourse selectpicker">
248
+                      <option value="0">Show All</option>
249
+                      @foreach ($course_filter_editPanel as $course)
250
+                        <option value="{{$course->id}}">{{$course->name}}[{{$course->code}}]</option>
251
+                      @endforeach
252
+                    </select>
253
+                  </div>
254
+                  <br>
255
+                  <div class="">
256
+                    <label>Outcome of the TA</label>
257
+                    <select class="form-control filterOutcome selectpicker">
258
+                      <option value="0">Show All</option>
259
+                      @foreach ($outcome_filter_editPanel as $outcome)
260
+                        <option value="{{$outcome->id}}">{{$outcome->name}}</option>
261
+                      @endforeach
262
+                    </select>
263
+                  </div>
264
+                </div>
265
+              </div>
266
+              <hr>
267
+
268
+              {{ Form::open(array('action' => 'TransformativeActionsController@updateTA')) }}
269
+
270
+              <div>
271
+                <div class="form-group col-md-12">
272
+                  <label>Select Transformative Action</label>
273
+                  <select name="ta" class="form-control SelectTA selectpicker" id='editSelectTA'>
274
+                     @if (count($ta_edit_panel) == 0)
275
+                       <option value="0">No TAs available</option>
276
+                     @else
277
+                       {{-- <option value="0">Select a TA</option> --}}
278
+                     @endif
279
+                     @foreach ($ta_edit_panel as $ta)
280
+                      <option value="{{$ta->id}}">{{$ta->at_text}}</option>
281
+                    @endforeach
282
+                  </select>
283
+                </div>
284
+              </div>
285
+
286
+              <div class="form-group" id="editName">
287
+                {{ Form::label('editText', 'Name') }}
288
+                {{ Form::text('editText', '', array('class' => 'form-control')) }}
289
+              </div>
290
+              <input type='hidden' name='ta_id' class='updateTA' value="0">
291
+
292
+              <div class="form-group">
293
+                {{ Form::label('editDescription', 'Description') }}
294
+                {{ Form::textarea('editDescription', '', array('class' => 'form-control')) }}
295
+              </div>
296
+
297
+              <div class="form-group"> </div>
298
+              <div class="form-group" id='editApproval'>
299
+                <label>Availability</label>
300
+                <select name="approval" class="form-control selectpicker">
301
+                    <option value="1">Recommended</option>
302
+                    <option value="0">To be implemented</option>
303
+                </select>
304
+              </div>
305
+
306
+              <label>Associated Courses</label>
307
+              <div class="editCourses">
308
+                <div class="form-group col-md-11 editCourse">
309
+                  <select name="courseid[]" class="form-control selectpicker">
310
+                    @foreach ($courses_create as $course)
311
+                      <option value="{{$course->id}}">{{$course->name}}[{{$course->code}}]</option>
312
+                    @endforeach
313
+                  </select>
314
+                </div>
315
+                <button type="button" class='btn btn-md btn-primary col-md-1 remove-course'>
316
+                  X
317
+                </button>
318
+              </div>
319
+              <button type="button" class='btn btn-md btn-secondary add-course'>
320
+                <span class='glyphicon glyphicon-plus'>
321
+                </span>
322
+                Add another Course
323
+              </button>
324
+              <div class="form-group"> </div>
325
+
326
+              <label>Associated Objectives</label>
327
+              <div class="editObjectives">
328
+                <div class="form-group col-md-11">
329
+                  {{-- <select class="form-control selectpicker"> --}}
330
+                  <select name="objectiveid[]" class="form-control">
331
+                    @foreach ($objectives as $id => $text)
332
+                      <option value="{{$id}}">{{$text}}</option>
333
+                    @endforeach
334
+                  </select>
335
+                  {{-- {{ Form::select('objective[]', $objectives, reset($objectives),  ['class'=>'form-control selectpicker', 'id' =>'objective0']) }} --}}
336
+                </div>
337
+                <button type="button" class='btn btn-md btn-primary col-md-1 remove-objective'>
338
+                  X
339
+                </button>
340
+              </div>
341
+              <button type="button" class='btn btn-md btn-secondary add-objective'>
342
+                <span class='glyphicon glyphicon-plus'>
343
+                </span>
344
+                Add another Objective
345
+              </button>
346
+              <div class="form-group"> </div>
347
+
348
+              {{ Form::submit('Update', array('class' => 'btn btn-primary btn-block')) }}
349
+              {{ Form::close() }}
350
+
351
+              {{ Form::open(array('action' => 'TransformativeActionsController@deleteTA')) }}
352
+              <input type='hidden' name='ta_id' id='deleteTA'>
353
+              {{Form::submit("Delete", array('class'=> 'btn btn-primary btn-block', 'id'=>"DeleteButton"))}}
354
+            </div>
355
+        </div>
356
+    </div>
357
+</div>
358
+
359
+@stop
360
+
361
+@section('javascript')
362
+
363
+// --------------------------------------------------------------------------
364
+// Page load
365
+// --------------------------------------------------------------------------
366
+
367
+// Hide accordion panel contents by default
368
+$('.panel-group .panel-body').hide();
369
+
370
+$('#outcome-display').parent().hide();
371
+
372
+$('.remove-objective').hide();
373
+$('.remove-course').hide();
374
+
375
+////createPanel
376
+// remove TA approval section if the user isnt a program coordinator
377
+var dummyApproval = $('#dummyApproval');
378
+dummyApproval.find('select').prop('disabled', 'disabled');
379
+dummyApproval.find('option').remove();
380
+
381
+
382
+var role = {{Auth::user()['role']}};
383
+if (role == 3){
384
+  dummyApproval.find('select').append('<option value="0">To be implemented</option>');
385
+  $('#approvePanel .add-course').hide();
386
+} else if (role == 4){
387
+  dummyApproval.find('select').append('<option value="1">Recommended</option>');
388
+  $('#approvePanel').parent().hide();
389
+
390
+  //hide the select for changin Availability
391
+  $('#editApproval').find('select').prop('disabled', 'disabled');
392
+  //add an input since disabled the form wont recognize it
393
+  $('#editApproval').append('<input type="text" name="approval" value="1" hidden />')
394
+
395
+  // in edit panel, hide the professor filter
396
+  $('.filterProfessor').parent().hide();
397
+  $('.filterProfessor').parent().next().hide(); // hide <br>
398
+}
399
+
400
+$('.createObjectives').prop('disabled', 'disabled');
401
+$('#createPanel .add-objective').prop('disabled', 'disabled');
402
+
403
+
404
+////editPanel
405
+// disable the buttons of the edit section if there are no TA for selection
406
+if(($('#editSelectTA').val() === "")){
407
+  $('#editPanel').find('select').prop('disabled', 'disabled');
408
+  $('#editPanel').find('button').prop('disabled', 'disabled');
409
+  $('#editPanel').find('input').prop('disabled', 'disabled');
410
+}else{
411
+  var ta_id = $('#editSelectTA').val();
412
+  if(ta_id != 0){
413
+    load_ta_info_for_edit(ta_id);
414
+  }
415
+
416
+
417
+}
418
+
419
+////approvePanel
420
+$('#approvePanel .add-objective').hide();
421
+// disable the buttons of the approval section if there are no TA for selection
422
+if(($('#approvalSelectTA').val() === "")){
423
+  $('#approvePanel').find('select').prop('disabled', 'disabled');
424
+  $('#approvePanel').find('button').prop('disabled', 'disabled');
425
+  $('#approvePanel').find('input').prop('disabled', 'disabled');
426
+  $('#approvalDescription').prop('disabled', 'disabled');
427
+}else{
428
+  var ta_id = $('#approvalSelectTA').val();
429
+  if(ta_id != 0){
430
+    load_ta_info_for_approval(ta_id);
431
+  }
432
+
433
+}
434
+
435
+//
436
+$('.filterSection').hide();
437
+
438
+// --------------------------------------------------------------------------
439
+// Functions
440
+// --------------------------------------------------------------------------
441
+
442
+function load_objectives_from_outcome(outcome_id) {
443
+  $.post(
444
+    "{{ URL::action('TransformativeActionsController@objectivesFromOutcome') }}",
445
+    {
446
+      outcome_id: (outcome_id),
447
+    },
448
+    function(data)
449
+    {
450
+      var panel = $('#createPanel');
451
+
452
+      //
453
+      var objectives = data.objectives;
454
+      //delete al current select
455
+      panel.find('.remove-objective').parent().remove();
456
+
457
+      //create select
458
+      var new_div = $('<div/>',{
459
+        'class': 'createObjectives'
460
+      });
461
+      var new_inner_div = $('<div/>',{
462
+        'class': 'form-group col-md-11'
463
+      });
464
+      var new_select = $('<select/>',{
465
+        'class': 'form-control createObjectives selectpicker',
466
+        'data-live-search': 'true',
467
+        'name': 'objectiveid[]'
468
+      });
469
+      var new_button = $('<button/>',{
470
+        'class': 'btn btn-md btn-primary col-md-1 remove-objective',
471
+        'type': 'button',
472
+        'html': 'X'
473
+      });
474
+      new_button.hide();
475
+
476
+      $.each(objectives, function(index, objective)
477
+      {
478
+        new_select.append('<option value="'+ objective.id +'">'+ objective.text +'</option>');
479
+      });
480
+
481
+      panel.find('.add-objective').before(new_div);
482
+      new_div.append(new_button);
483
+      new_div.append(new_inner_div);
484
+      new_inner_div.append(new_select);
485
+      new_select.selectpicker('refresh');
486
+
487
+      //activate the button for adding more objectives
488
+      $('#createPanel .add-objective').prop('disabled', false);
489
+    }
490
+  );
491
+}
492
+
493
+function load_ta_info_for_edit(ta_id) {
494
+  $.post(
495
+    "{{ URL::action('TransformativeActionsController@selectTA') }}",
496
+    {
497
+      ta_id: (ta_id),
498
+    },
499
+    function(data)
500
+    {
501
+      //
502
+      var selected_courses = data.selected_courses;
503
+      var objectives = data.objectives;
504
+      var objectives_from_outcome = data.objectives_from_outcome;
505
+      var status = data.status;
506
+      var name = data.name[0];
507
+      var description = data.description[0];
508
+      var can_be_deleted = data.can_be_deleted;
509
+
510
+      //add objectives button
511
+      var add_button = $('#editPanel .add-objective');
512
+
513
+      //set if the TA is approved or not
514
+      $('#editApproval select').val(status);
515
+
516
+      //delete objectives select
517
+      $('.editObjectives').remove();
518
+
519
+      //create one objective select and populate it
520
+      var panel = $('#editPanel');
521
+
522
+      //
523
+      var objectives = data.objectives;
524
+      //delete al current select
525
+      panel.find('.remove-objective').parent().remove();
526
+
527
+      //create select
528
+      var new_div = $('<div/>',{
529
+        'class': 'editObjectives'
530
+      });
531
+      var new_inner_div = $('<div/>',{
532
+        'class': 'form-group col-md-11'
533
+      });
534
+      var new_select = $('<select/>',{
535
+        'class': 'form-control editObjectives selectpicker',
536
+        'data-live-search': 'true',
537
+        'name': 'objectiveid[]'
538
+      });
539
+      var new_button = $('<button/>',{
540
+        'class': 'btn btn-md btn-primary col-md-1 remove-objective',
541
+        'type': 'button',
542
+        'html': 'X'
543
+      });
544
+      new_button.hide();
545
+
546
+      $.each(objectives_from_outcome, function(index, objective)
547
+      {
548
+        new_select.append('<option value="'+ objective.id +'">'+ objective.text +'</option>');
549
+      });
550
+
551
+      panel.find('.add-objective').before(new_div);
552
+      new_div.append(new_button);
553
+      new_div.append(new_inner_div);
554
+      new_inner_div.append(new_select);
555
+      new_select.selectpicker('refresh');
556
+
557
+
558
+      //change de value of the select
559
+
560
+      //add the other selects
561
+
562
+      var prev_select = new_div;
563
+      $.each(objectives, function(index, objective)
564
+      {
565
+        prev_select.find('select').val(objective.id);
566
+        add_objective_select(add_button);
567
+        {{-- add_button; --}}
568
+        prev_select = add_button.prev();
569
+
570
+      });
571
+      add_button.prev().remove();
572
+
573
+      //set the text box
574
+      $('#editName').find('input').val(name);
575
+      $('#editDescription').val(description);
576
+
577
+      //
578
+      $('#deleteTA').val(ta_id);
579
+      $('#editPanel .updateTA').val(ta_id);
580
+
581
+      if(can_be_deleted == false){
582
+        $('#DeleteButton').prop('disabled', 'disabled');
583
+      }else{
584
+        $('#DeleteButton').prop('disabled', false);
585
+      }
586
+
587
+
588
+      //locate de "add course" button on edit panel
589
+      var add_course_button = $('#editPanel .add-course')
590
+
591
+      //save current course selectpickers, add a new one, and delete old ones
592
+      var current_course_selects = $('#editPanel .editCourse');
593
+      add_course_button.click();
594
+      current_course_selects.remove();
595
+
596
+      //populate edit panel with courses previusly selected
597
+      var prev_select = add_course_button.prev();
598
+      prev_select.find('.remove-course').hide();
599
+      $.each(selected_courses, function(index, course)
600
+      {
601
+        prev_select.find('select').val(course.id);
602
+        add_course_button.click();
603
+        prev_select = add_course_button.prev();
604
+      });
605
+      prev_select.remove();
606
+
607
+    }
608
+  );
609
+}
610
+
611
+function load_ta_info_for_approval(ta_id) {
612
+  $.post(
613
+    "{{ URL::action('TransformativeActionsController@selectTA') }}",
614
+    {
615
+      ta_id: (ta_id),
616
+    },
617
+    function(data)
618
+    {
619
+      //
620
+      var selected_courses = data.selected_courses;
621
+      var objectives = data.objectives;
622
+      var status = data.status[0];
623
+      var name = data.name[0];
624
+      var description = data.description[0];
625
+
626
+      //clear the objectives of ony prevoius TA selected for approve
627
+      var add_button = $('#approvePanel .add-objective');
628
+      var select = add_button.prev().clone(true);
629
+
630
+      var first_select = select.clone(true);
631
+      first_select.find('button').hide();
632
+
633
+      $('.approveObjectives').remove();
634
+      add_button.before(first_select);
635
+
636
+      var prev_select = first_select;
637
+      $.each(objectives, function(index, objective)
638
+      {
639
+
640
+        // save the new select in a var
641
+        var new_select = select.clone(true);
642
+
643
+        // set only one option on the select
644
+        prev_select.find('option').remove();
645
+        prev_select.find('select').append('<option value="'+ objective.id +'">'+objective.text +'</option>');
646
+        prev_select = new_select;
647
+        // add the copy of the select
648
+        add_button.before(new_select);
649
+      });
650
+      // remove the last objective select, since it isnt one of the saved objectives
651
+      add_button.prev().remove();
652
+
653
+      //
654
+      $('#approvalDescription').val(description);
655
+      $('.approvalText').val(name);
656
+      $('#approvePanel .updateTA').val(ta_id);
657
+
658
+
659
+      //locate de "add course" button on approve panel
660
+      var add_course_button = $('#approvePanel .add-course')
661
+
662
+      //save current course selectpickers, add a new one, and delete old ones
663
+      var current_course_selects = $('#approvePanel .approveCourse');
664
+      add_course_button.click();
665
+      current_course_selects.remove();
666
+
667
+      //populate approve panel with courses previusly selected
668
+      var prev_select = add_course_button.prev();
669
+      prev_select.find('.remove-course').hide();
670
+      $.each(selected_courses, function(index, course)
671
+      {
672
+        var new_option = $('<option/>',{
673
+          'value': course.id,
674
+          'type': 'button',
675
+          'html': course.name+' ['+course.code+']'
676
+        });
677
+        prev_select.find('select option').remove();
678
+        prev_select.find('select').append(new_option);
679
+        prev_select.find('.remove-course').hide();
680
+        add_course_button.click();
681
+        prev_select = add_course_button.prev();
682
+      });
683
+      prev_select.remove();
684
+
685
+    }
686
+  );
687
+}
688
+
689
+function add_objective_select(element) {
690
+  var prev_select = $(element).prev();
691
+
692
+  var parent_panel = $(element).parent().parent().attr('id');
693
+  var select_class = '';
694
+  if(parent_panel == 'editPanel'){
695
+    select_class = 'editObjectives';
696
+  }else{
697
+    select_class = 'createObjectives';
698
+  }
699
+
700
+  //create select
701
+  var new_div = $('<div/>',{
702
+    'class': select_class
703
+  });
704
+  var new_inner_div = $('<div/>',{
705
+    'class': 'form-group col-md-11'
706
+  });
707
+  var new_select = $('<select/>',{
708
+    'class': 'form-control createObjectives selectpicker',
709
+    'data-live-search': 'true',
710
+    'name': 'objectiveid[]'
711
+  });
712
+  var new_button = $('<button/>',{
713
+    'class': 'btn btn-md btn-primary col-md-1 remove-objective',
714
+    'type': 'button',
715
+    'html': 'X'
716
+  });
717
+
718
+
719
+  $.each(prev_select.find('option'), function(index, option)
720
+  {
721
+    var new_option = $('<option/>',{
722
+      'value': $(option).val(),
723
+      'html': $(option).html()
724
+    });
725
+    new_select.append(new_option);
726
+  });
727
+
728
+
729
+  $(element).before(new_div);
730
+  new_div.append(new_inner_div);
731
+  new_div.append(new_button);
732
+  new_inner_div.append(new_select);
733
+  $(element).parent().find('.selectpicker').selectpicker('refresh');
734
+  new_select.selectpicker('refresh');
735
+
736
+}
737
+
738
+function add_course_select(element) {
739
+  var prev_select = $(element).prev();
740
+
741
+  var parent_panel = $(element).parent().parent().attr('id');
742
+  var select_class = '';
743
+  if(parent_panel == 'editPanel'){
744
+    select_class = 'editCourse';
745
+  }else{
746
+    select_class = 'createCourse';
747
+  }
748
+
749
+  //create select
750
+  var new_div = $('<div/>',{
751
+    'class': select_class+' approveCourse'
752
+  });
753
+  var new_inner_div = $('<div/>',{
754
+    'class': 'form-group col-md-11'
755
+  });
756
+  var new_select = $('<select/>',{
757
+    'class': 'form-control createCourses selectpicker',
758
+    'data-live-search': 'true',
759
+    'name': 'courseid[]'
760
+  });
761
+  var new_button = $('<button/>',{
762
+    'class': 'btn btn-md btn-primary col-md-1 remove-course',
763
+    'type': 'button',
764
+    'html': 'X'
765
+  });
766
+
767
+
768
+  $.each(prev_select.find('option'), function(index, option)
769
+  {
770
+    var new_option = $('<option/>',{
771
+      'value': $(option).val(),
772
+      'html': $(option).html()
773
+    });
774
+    new_select.append(new_option);
775
+  });
776
+
777
+
778
+  $(element).before(new_div);
779
+  new_div.append(new_inner_div);
780
+  new_div.append(new_button);
781
+  new_inner_div.append(new_select);
782
+  $(element).parent().find('.selectpicker').selectpicker('refresh');
783
+  new_select.selectpicker('refresh');
784
+
785
+}
786
+
787
+// --------------------------------------------------------------------------
788
+// Events
789
+// --------------------------------------------------------------------------
790
+
791
+// When a TA is selected for edit, load the TA info
792
+$('#createOutcome').on('change', function()
793
+{
794
+  var outcome_id = $(this).find('select').val();
795
+
796
+  load_objectives_from_outcome(outcome_id);
797
+});
798
+
799
+// When a TA is selected for edit, load the TA info
800
+$('#editSelectTA').parent().on('change', function()
801
+{
802
+  var ta_id = $(this).find('select').val();
803
+  if(ta_id != 0){
804
+    load_ta_info_for_edit(ta_id);
805
+  }
806
+});
807
+
808
+// When a TA is selected for approval, load the TA info
809
+$('#approvalSelectTA').parent().on('change', function()
810
+{
811
+  var ta_id = $(this).find('select').val();
812
+  if(ta_id != 0){
813
+    load_ta_info_for_approval(ta_id);
814
+    }
815
+});
816
+
817
+
818
+// Add an objective Select picker
819
+$('.add-objective').on('click', function()
820
+{
821
+  add_objective_select(this);
822
+});
823
+// Add an course Select picker
824
+$('.add-course').on('click', function()
825
+{
826
+  add_course_select(this);
827
+});
828
+
829
+// Remove an objective Select picker
830
+$('.panel').on('click', '.remove-objective', function()
831
+{
832
+  $(this).parent().remove();
833
+});
834
+// Remove an course Select picker
835
+$('.panel').on('click', '.remove-course', function()
836
+{
837
+  $(this).parent().remove();
838
+});
839
+
840
+// Remove an objective Select picker
841
+$('.filterButton').on('click', function()
842
+{
843
+  var span = $(this).find('span');
844
+  if(span.attr('class') == 'glyphicon glyphicon-plus'){
845
+    span.attr('class','glyphicon glyphicon-minus');
846
+  } else{
847
+    span.attr('class','glyphicon glyphicon-plus');
848
+  }
849
+  $(this).parent().next().toggle(533);
850
+});
851
+
852
+//
853
+$('.filterSection').on('change', function()
854
+{
855
+
856
+  var professor_id = $(this).find('.filterProfessor select').val();
857
+  var course_id = $(this).find('.filterCourse select').val();
858
+  var outcome_id = $(this).find('.filterOutcome select').val();
859
+  var panel_id = $(this).parent().attr('id');
860
+
861
+  var select = $('#'+panel_id+' .SelectTA select');
862
+
863
+
864
+  $.post(
865
+    "{{ URL::action('TransformativeActionsController@filterTA') }}",
866
+    {
867
+      professor_id: (professor_id),
868
+      course_id: (course_id),
869
+      outcome_id: (outcome_id),
870
+      panel_id: (panel_id),
871
+    },
872
+    function(data)
873
+    {
874
+      //
875
+      select.find('option').remove();
876
+      $.each(data, function(index, ta)
877
+      {
878
+        var ta_id = ta.id;
879
+        var ta_text = ta.at_text;
880
+        var new_option = '<option value="'+ ta_id +'">'+ ta_text +'</option>';
881
+        select.append(new_option);
882
+      });
883
+
884
+      select.selectpicker('refresh');
885
+
886
+      if(data.length != 0){
887
+        var ta_id = data[0].id;
888
+
889
+        if(panel_id=='editPanel'){
890
+          load_ta_info_for_edit(ta_id);
891
+        }
892
+        if(panel_id=='approvePanel'){
893
+          load_ta_info_for_approval(ta_id);
894
+        }
895
+      }
896
+    }
897
+  );
898
+
899
+});
900
+
901
+@stop

+ 1
- 0
app/views/local/managers/pCoords/_navigation.blade.php ファイルの表示

@@ -6,6 +6,7 @@
6 6
     <ul class="nav navbar-nav navbar-right">
7 7
       <li>{{ HTML::linkAction('ProgramCoordinatorsController@overview', 'Overview') }}</li>
8 8
       <li>{{ HTML::linkAction('TemplatesController@newTemplate', 'Rubrics') }}</li>
9
+      <li>{{ HTML::linkAction('TransformativeActionsController@editTA', 'Transformative Actions') }}</li>
9 10
 
10 11
       <li>{{ HTML::linkAction('Objective2Controller@editProgram', 'Objectives')}}</li>
11 12
       <li>{{ HTML::linkAction('CriteriaController@editProgram', 'Criteria') }}</li>

+ 1
- 0
app/views/local/professors/_navigation.blade.php ファイルの表示

@@ -8,6 +8,7 @@
8 8
       <li>{{ HTML::linkAction('ProfessorsController@overview', 'My Courses') }}</li>
9 9
       {{-- la linea siguiente comentada es lo que habia originalmente. tanto la linea como este comentario se pueden borrar --}}
10 10
       {{-- <li>{{ HTML::linkAction('CriteriaController@index', 'Learning Outcomes and Criteria') }}</li> --}}
11
+      <li>{{ HTML::linkAction('TransformativeActionsController@editTA', 'Transformative Actions') }}</li>
11 12
       <li class="dropdown">
12 13
         <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Learning and Criterias<span class="caret"></span></a>
13 14
         <ul class="dropdown-menu" role="menu">