|
@@ -0,0 +1,803 @@
|
|
1
|
+@extends('layouts.master')
|
|
2
|
+
|
|
3
|
+@section('navigation')
|
|
4
|
+ @if(Auth::user()->role==2)
|
|
5
|
+ @include('local.managers.sCoords._navigation')
|
|
6
|
+ @elseif(Auth::user()->role==3)
|
|
7
|
+ @include('local.managers.pCoords._navigation')
|
|
8
|
+ @endif
|
|
9
|
+@stop
|
|
10
|
+
|
|
11
|
+@section('main')
|
|
12
|
+ {{-- TODO: look where to place this script.
|
|
13
|
+ if placed inside .ready() or before it,
|
|
14
|
+ an error that the function is not defined occurs. --}}
|
|
15
|
+ {{-- TODO: no reconoce acentos --}}
|
|
16
|
+ <script type="text/javascript">
|
|
17
|
+ function filterCycles() {
|
|
18
|
+ // Declare variables
|
|
19
|
+ var input, filter, div, li, i, cycleText;
|
|
20
|
+ input = document.getElementById('userInput');
|
|
21
|
+ filter = input.value.toUpperCase();
|
|
22
|
+ div = document.getElementById("list");
|
|
23
|
+ li = div.getElementsByTagName('li');
|
|
24
|
+
|
|
25
|
+ // Loop through all list items, and hide those who don't match the search query
|
|
26
|
+ for (i = 0; i < li.length; i++) {
|
|
27
|
+ cycleText = li[i].textContent;
|
|
28
|
+ if (cycleText.toUpperCase().indexOf(filter) > -1) {
|
|
29
|
+ li[i].style.display = "";
|
|
30
|
+ } else {
|
|
31
|
+ li[i].style.display = "none";
|
|
32
|
+ }
|
|
33
|
+ }
|
|
34
|
+ }
|
|
35
|
+
|
|
36
|
+ // onChange, update selected outcomes-semesters
|
|
37
|
+ function update_outcome_semesters() {
|
|
38
|
+ var outcomeSemesterArray= new Array();
|
|
39
|
+ // For each learning outcome, get selected boxes and put it into an array
|
|
40
|
+ $('#outcome-semesters-body tr').each(function( index )
|
|
41
|
+ {
|
|
42
|
+ var outcomeObject = new Object();
|
|
43
|
+ outcomeObject.id= $(this).data('id');
|
|
44
|
+ var semesters = new Array();
|
|
45
|
+ var temp = new Array();
|
|
46
|
+ temp.push($(this).children(".sem1-box").find("input").attr('name'));
|
|
47
|
+ temp.push($(this).children(".sem1-box").find("input").prop("checked"));
|
|
48
|
+ semesters.push(temp);
|
|
49
|
+
|
|
50
|
+ temp = new Array();
|
|
51
|
+ temp.push($(this).children(".sem2-box").find("input").attr('name'));
|
|
52
|
+ temp.push($(this).children(".sem2-box").find("input").prop("checked"));
|
|
53
|
+ semesters.push(temp);
|
|
54
|
+
|
|
55
|
+ temp = new Array();
|
|
56
|
+ temp.push($(this).children(".sem3-box").find("input").attr('name'));
|
|
57
|
+ temp.push($(this).children(".sem3-box").find("input").prop("checked"));
|
|
58
|
+ semesters.push(temp);
|
|
59
|
+
|
|
60
|
+ temp = new Array();
|
|
61
|
+ temp.push($(this).children(".sem4-box").find("input").attr('name'));
|
|
62
|
+ temp.push($(this).children(".sem4-box").find("input").prop("checked"));
|
|
63
|
+ semesters.push(temp);
|
|
64
|
+
|
|
65
|
+ temp = new Array();
|
|
66
|
+ temp.push($(this).children(".sem5-box").find("input").attr('name'));
|
|
67
|
+ temp.push($(this).children(".sem5-box").find("input").prop("checked"));
|
|
68
|
+ semesters.push(temp);
|
|
69
|
+
|
|
70
|
+ temp = new Array();
|
|
71
|
+ temp.push($(this).children(".sem6-box").find("input").attr('name'));
|
|
72
|
+ temp.push($(this).children(".sem6-box").find("input").prop("checked"));
|
|
73
|
+ semesters.push(temp);
|
|
74
|
+
|
|
75
|
+ outcomeObject.semesters= semesters;
|
|
76
|
+
|
|
77
|
+ var clone = jQuery.extend({}, outcomeObject);
|
|
78
|
+ outcomeSemesterArray.push(clone);
|
|
79
|
+ });
|
|
80
|
+
|
|
81
|
+ var id = $('#table-cycles').data('typ-id');
|
|
82
|
+
|
|
83
|
+ $.post(
|
|
84
|
+ "{{ URL::action('ThreeYearPlanController@update_typ_outcomes_semesters') }}",
|
|
85
|
+ {
|
|
86
|
+ outcomeSemesterArray : JSON.stringify(outcomeSemesterArray),
|
|
87
|
+ typ_id: (id)
|
|
88
|
+ },
|
|
89
|
+ function(data)
|
|
90
|
+ {
|
|
91
|
+ //;
|
|
92
|
+ }
|
|
93
|
+ );
|
|
94
|
+ }
|
|
95
|
+
|
|
96
|
+ </script>
|
|
97
|
+
|
|
98
|
+ <div class="row">
|
|
99
|
+ <div class="col-md-3">
|
|
100
|
+ <input class="form-control" type="text" id="userInput" onkeyup="filterCycles()" placeholder="Search for Cycles..">
|
|
101
|
+ <div class="list-group" id='list'>
|
|
102
|
+ @foreach ($typs as $typ)
|
|
103
|
+ <li data-cycle-id="{{$typ->id}}" class="list-group-item">{{$typ->year_start}}-{{$typ->year_end}}</li>
|
|
104
|
+ @endforeach
|
|
105
|
+ </div>
|
|
106
|
+ </div>
|
|
107
|
+
|
|
108
|
+ <div class="col-md-9">
|
|
109
|
+ <div id="cycle-display" class="panel panel-default">
|
|
110
|
+ <div class="panel-heading">
|
|
111
|
+ <h4 class=" panel-title" style="cursor:auto!important;">
|
|
112
|
+ </h4>
|
|
113
|
+ </div>
|
|
114
|
+ <div class="panel-body" id="section1">
|
|
115
|
+ <p class="section1-description">Select two or more Semesters that will be evaluated by an Outcome.</p>
|
|
116
|
+ <div class="table-responsive">
|
|
117
|
+ {{-- <table class="table table-striped table-condensed datatable"> --}}
|
|
118
|
+ <table data-typ-id="0" class="table table-striped table-condensed" id="table-cycles">
|
|
119
|
+ <style media="screen">
|
|
120
|
+ input[type=checkbox] {transform: scale(2);}
|
|
121
|
+ </style>
|
|
122
|
+ <thead>
|
|
123
|
+ <tr style="background-color:#FDD8B5;">
|
|
124
|
+ {{-- <th rowspan="0" style="background-color:#F5DEDD;" class="text-center">Dominios de aprendizaje</th> --}}
|
|
125
|
+ <th rowspan="0" style="background-color:#F5DEDD;" class="text-center">Learning Outcomes</th>
|
|
126
|
+ <th colspan="2" class="text-center" id="cycle1"></th>
|
|
127
|
+ <th colspan="2" class="text-center" id="cycle2"></th>
|
|
128
|
+ <th colspan="2" class="text-center" id="cycle3"></th>
|
|
129
|
+ </tr>
|
|
130
|
+ <tr class="">
|
|
131
|
+ <th class="text-center">1er sem</th>
|
|
132
|
+ <th class="text-center">2do sem</th>
|
|
133
|
+ <th class="text-center">1er sem</th>
|
|
134
|
+ <th class="text-center">2do sem</th>
|
|
135
|
+ <th class="text-center">1er sem</th>
|
|
136
|
+ <th class="text-center">2do sem</th>
|
|
137
|
+ </tr>
|
|
138
|
+ </thead>
|
|
139
|
+ <tfoot>
|
|
140
|
+ </tfoot>
|
|
141
|
+ <input type="text" id="cycle_id" name="cycle_id" value="getsReplacedWithJS" hidden>
|
|
142
|
+ {{-- <label for="profesores">Profesores (pares)</label> --}}
|
|
143
|
+ <tbody id="outcome-semesters-body" onchange="update_outcome_semesters()">
|
|
144
|
+ @foreach ($outcomes as $outcome)
|
|
145
|
+ <tr data-id="{{$outcome->id}}">
|
|
146
|
+ <th>{{$outcome->name}}</th>
|
|
147
|
+ <th class="text-center sem1-box"><input type="checkbox" id="{{$outcome->id}}-sem1" name="{{$outcome->id}}-sem1" value="checked" /></th>
|
|
148
|
+ <th class="text-center sem2-box"><input type="checkbox" id="{{$outcome->id}}-sem2" name="{{$outcome->id}}-sem2" value="checked" /></th>
|
|
149
|
+ <th class="text-center sem3-box"><input type="checkbox" id="{{$outcome->id}}-sem3" name="{{$outcome->id}}-sem3" value="checked" /></th>
|
|
150
|
+ <th class="text-center sem4-box"><input type="checkbox" id="{{$outcome->id}}-sem4" name="{{$outcome->id}}-sem4" value="checked" /></th>
|
|
151
|
+ <th class="text-center sem5-box"><input type="checkbox" id="{{$outcome->id}}-sem5" name="{{$outcome->id}}-sem5" value="checked" /></th>
|
|
152
|
+ <th class="text-center sem6-box"><input type="checkbox" id="{{$outcome->id}}-sem6" name="{{$outcome->id}}-sem6" value="checked" /></th>
|
|
153
|
+ </tr>
|
|
154
|
+ @endforeach
|
|
155
|
+ </tbody>
|
|
156
|
+ </table>
|
|
157
|
+ <hr>
|
|
158
|
+ <div class="">
|
|
159
|
+ <button class="btn-lg btn-primary pull-right go-to-2" style="margin:5px;">Select Objectives</button>
|
|
160
|
+ </div>
|
|
161
|
+ </div>
|
|
162
|
+ </div>
|
|
163
|
+ <div class="panel-body" id="section2">
|
|
164
|
+ <p class="section2-description">Select one or more Objectives that will be evaluated in a given Semester.</p>
|
|
165
|
+ <div>
|
|
166
|
+ <div class="objectives-section-0">
|
|
167
|
+ </div>
|
|
168
|
+ <div class="objectives-section">
|
|
169
|
+ </div>
|
|
170
|
+ <hr>
|
|
171
|
+ <div class="">
|
|
172
|
+ <button class="btn-lg btn-primary pull-right go-to-3" style="margin:5px;">Go to Objectives Selection</button>
|
|
173
|
+ <button class="btn-lg btn-primary pull-right back-to-1" style="margin:5px;">Back to Semester Selection</button>
|
|
174
|
+ </div>
|
|
175
|
+ </div>
|
|
176
|
+ </div>
|
|
177
|
+ <div class="panel-body" id="section3">
|
|
178
|
+ <p class="section3-description">Select one or more Courses that will be evaluated by an Objective in a given Semester.</p>
|
|
179
|
+ <div>
|
|
180
|
+ <div class="courses-main-clone-0" hidden>
|
|
181
|
+ <div class="title-course-selection-0">
|
|
182
|
+ <button class="btn btn-md btn-secondary pull-right hide-course-selection"><span class="glyphicon glyphicon-minus"></span> Hide Outcome Options</button>
|
|
183
|
+ <button class="btn btn-md btn-secondary pull-right show-course-selection"><span class="glyphicon glyphicon-plus"></span> Show Outcome Options</button>
|
|
184
|
+ <p class="h3" style="width:100%;max-width:80%;"><b>Outcome: example</b></p>
|
|
185
|
+ </div>
|
|
186
|
+ <div class="semester-course-selection-0" style="margin-left:30px;">
|
|
187
|
+ <label class="semester-label-course-selection-0" for="">First Semester of 2000-2000</label>
|
|
188
|
+ <div class="select-course-selection-0" style="margin-left:30px;">
|
|
189
|
+ <div class="objective-selector-0">
|
|
190
|
+ <label for="">OBJECTIVE TEMP</label>
|
|
191
|
+ <select class="select-0" name="" style="width:100%;max-width:55%;">
|
|
192
|
+ <option class="default-option" value="nothing_selected">Select a course</option>
|
|
193
|
+ </select>
|
|
194
|
+ <button class="btn btn-md btn-danger delete-selection-0" style="margin:5px;"><span class="glyphicon glyphicon-minus"></span> remove</button>
|
|
195
|
+ </div>
|
|
196
|
+ <div class="clone-objective-course-select-0">
|
|
197
|
+ <button class="btn btn-md btn-secondary add-objective-course" style="margin:5px;"><span class="glyphicon glyphicon-plus"></span> Choose more Courses</button>
|
|
198
|
+ </div>
|
|
199
|
+ </div>
|
|
200
|
+ </div>
|
|
201
|
+ <div class="footer-course-selection-0" style="margin-left:30px;" hidden>
|
|
202
|
+ <p><b>Course selection for this Outcome is currently hidden</b></p>
|
|
203
|
+ </div>
|
|
204
|
+ </div>
|
|
205
|
+ <div class="courses-section-0">
|
|
206
|
+ </div>
|
|
207
|
+ <div class="courses-section">
|
|
208
|
+ </div>
|
|
209
|
+ <hr>
|
|
210
|
+ <div class="">
|
|
211
|
+ <button class="btn-lg btn-primary pull-right go-to-temp" style="margin:5px;">Go to TYP evaluation page</button>
|
|
212
|
+ <button class="btn-lg btn-primary pull-right back-to-2" style="margin:5px;">Back to Objective Selection</button>
|
|
213
|
+ </div>
|
|
214
|
+ </div>
|
|
215
|
+ </div>
|
|
216
|
+ </div>
|
|
217
|
+ </div>
|
|
218
|
+ <div class="col-md-9">
|
|
219
|
+ <div class="no-cycle alert alert-info">
|
|
220
|
+ <p>Select a Three year cycle to start</p>
|
|
221
|
+ </div>
|
|
222
|
+ </div>
|
|
223
|
+
|
|
224
|
+ </div>
|
|
225
|
+@stop
|
|
226
|
+
|
|
227
|
+@section('included-js')
|
|
228
|
+ @include('global._datatables_js')
|
|
229
|
+@stop
|
|
230
|
+
|
|
231
|
+@section('javascript')
|
|
232
|
+
|
|
233
|
+$(document).ready(function()
|
|
234
|
+{
|
|
235
|
+ // --------------------------------------------------------------------------
|
|
236
|
+ // Page load
|
|
237
|
+ // --------------------------------------------------------------------------
|
|
238
|
+
|
|
239
|
+ // Hide accordion panel contents by default
|
|
240
|
+ var outcomes = {{json_encode($outcomes)}};
|
|
241
|
+
|
|
242
|
+ $('.panel-group .panel-body').hide();
|
|
243
|
+
|
|
244
|
+ $('#cycle-display').parent().hide();
|
|
245
|
+
|
|
246
|
+ $("#clonedOutcome0").hide();;
|
|
247
|
+
|
|
248
|
+ $('.show-course-selection').hide();
|
|
249
|
+
|
|
250
|
+ // --------------------------------------------------------------------------
|
|
251
|
+ // Functions
|
|
252
|
+ // --------------------------------------------------------------------------
|
|
253
|
+
|
|
254
|
+
|
|
255
|
+
|
|
256
|
+(function () {
|
|
257
|
+ var previous;
|
|
258
|
+ $("select").on('focus', function () {
|
|
259
|
+ // Store the current value on focus and on change
|
|
260
|
+ previous = this.value;
|
|
261
|
+ }).change(function() {
|
|
262
|
+
|
|
263
|
+ //comienzo
|
|
264
|
+ var options_values = $(this).parent().find('select').val().split('-');
|
|
265
|
+
|
|
266
|
+ //ifs
|
|
267
|
+ if (options_values.length == 3){
|
|
268
|
+
|
|
269
|
+ var typ_id = $('#table-cycles').data('typ-id');
|
|
270
|
+ var previous_objective_id = previous.split('-')[2];
|
|
271
|
+
|
|
272
|
+ var options_values =this.value.split('-');
|
|
273
|
+ var outcome_id = options_values[0];
|
|
274
|
+ var semester_id = options_values[1];
|
|
275
|
+ var new_objective_id = options_values[2];
|
|
276
|
+
|
|
277
|
+ if (new_objective_id == 'n'){
|
|
278
|
+ new_objective_id = 'nothing_selected';
|
|
279
|
+ }
|
|
280
|
+ if (previous_objective_id == 'n'){
|
|
281
|
+ previous_objective_id = 'nothing_selected';
|
|
282
|
+ }
|
|
283
|
+
|
|
284
|
+ $.post(
|
|
285
|
+ "{{ URL::action('ThreeYearPlanController@section2_on_change') }}",
|
|
286
|
+ {
|
|
287
|
+ typ_id: (typ_id),
|
|
288
|
+ previous_objective_id: (previous_objective_id),
|
|
289
|
+ outcome_id: (outcome_id),
|
|
290
|
+ semester_id: (semester_id),
|
|
291
|
+ new_objective_id: (new_objective_id)
|
|
292
|
+ },
|
|
293
|
+ function(data)
|
|
294
|
+ {
|
|
295
|
+ //
|
|
296
|
+ }
|
|
297
|
+ );
|
|
298
|
+ previous = this.value;
|
|
299
|
+
|
|
300
|
+ }
|
|
301
|
+ else if (options_values.length == 4){
|
|
302
|
+
|
|
303
|
+ var typ_id = $('#table-cycles').data('typ-id');
|
|
304
|
+ var previous_course_id = previous.split('-')[3];
|
|
305
|
+
|
|
306
|
+ var options_values =this.value.split('-');
|
|
307
|
+ var outcome_id = options_values[0];
|
|
308
|
+ var semester_id = options_values[1];
|
|
309
|
+ var objective_id = options_values[2];
|
|
310
|
+ var new_course_id = options_values[3];
|
|
311
|
+
|
|
312
|
+ if (new_course_id == 'n'){
|
|
313
|
+ new_course_id = 'nothing_selected';
|
|
314
|
+ }
|
|
315
|
+ if (previous_course_id == 'n'){
|
|
316
|
+ previous_course_id = 'nothing_selected';
|
|
317
|
+ }
|
|
318
|
+
|
|
319
|
+ $.post(
|
|
320
|
+ "{{ URL::action('ThreeYearPlanController@section3_on_change') }}",
|
|
321
|
+ {
|
|
322
|
+ typ_id: (typ_id),
|
|
323
|
+ previous_course_id: (previous_course_id),
|
|
324
|
+ outcome_id: (outcome_id),
|
|
325
|
+ semester_id: (semester_id),
|
|
326
|
+ objective_id: (objective_id),
|
|
327
|
+ new_course_id: (new_course_id)
|
|
328
|
+ },
|
|
329
|
+ function(data)
|
|
330
|
+ {
|
|
331
|
+ //
|
|
332
|
+ }
|
|
333
|
+ );
|
|
334
|
+ previous = this.value;
|
|
335
|
+
|
|
336
|
+ }
|
|
337
|
+ });
|
|
338
|
+})();
|
|
339
|
+
|
|
340
|
+
|
|
341
|
+ // --------------------------------------------------------------------------
|
|
342
|
+ // Events
|
|
343
|
+ // --------------------------------------------------------------------------
|
|
344
|
+
|
|
345
|
+
|
|
346
|
+
|
|
347
|
+ // When list item is clicked, load corresponding info
|
|
348
|
+ //section 1
|
|
349
|
+ $('.list-group-item').on('click', function()
|
|
350
|
+ {
|
|
351
|
+ var id = $(this).data('cycle-id');
|
|
352
|
+ $('#table-cycles').data('typ-id',id);
|
|
353
|
+ $('#section1').show();
|
|
354
|
+ $('#section2').hide();
|
|
355
|
+ $('#section3').hide();
|
|
356
|
+
|
|
357
|
+ var outcome_id_semester_code_program_id_box_id_typ_id = new Object();
|
|
358
|
+ var outcome_id_semester_code_program_id_box_id_typ_id = Array();
|
|
359
|
+
|
|
360
|
+ $.post(
|
|
361
|
+ "{{ URL::action('ThreeYearPlanController@fetchThreeYears') }}",
|
|
362
|
+ { id: id },
|
|
363
|
+ function(json)
|
|
364
|
+ {
|
|
365
|
+
|
|
366
|
+
|
|
367
|
+ // Retrieve datatable instance
|
|
368
|
+ var table = $('#table-cycles');
|
|
369
|
+
|
|
370
|
+ var typ = json.typ;
|
|
371
|
+ var year_start = json.typ.year_start;
|
|
372
|
+ var year_end = json.typ.year_end;
|
|
373
|
+ var semesters = json.typ.semesters;
|
|
374
|
+ var program_id = {{$program_id}};
|
|
375
|
+ // var outcomes = already defined
|
|
376
|
+
|
|
377
|
+ $('#cycle-display').parent().show();
|
|
378
|
+ $('.no-cycle').parent().hide();
|
|
379
|
+
|
|
380
|
+ //Display title and definition
|
|
381
|
+ $('#cycle-display .panel-title').html('Planning for the years of ' + year_start + '-' + year_end);
|
|
382
|
+ $('#cycle-display .cycle-definition').html("Select the semesters which you would like to review an outcome in the three year plan of " + year_start + '-' + year_end+".");
|
|
383
|
+
|
|
384
|
+ //Empty table
|
|
385
|
+ //table.clear();
|
|
386
|
+
|
|
387
|
+ // Add new semesters
|
|
388
|
+ //if(typ.length>0)
|
|
389
|
+ //{
|
|
390
|
+ $('table').show();
|
|
391
|
+ $('#cycle1').html((year_start)+"-"+(year_start+1));
|
|
392
|
+ $('#cycle2').html((year_start+1)+"-"+(year_end-1));
|
|
393
|
+ $('#cycle3').html((year_end-1)+"-"+(year_end));
|
|
394
|
+
|
|
395
|
+ $('#cycle_id').val(typ.id);
|
|
396
|
+
|
|
397
|
+ //resets the checkboxes' name, clears marked, and disables them by default.
|
|
398
|
+ $.each(outcomes, function(index, outcome)
|
|
399
|
+ {
|
|
400
|
+ $.each([1,2,3,4,5,6], function(index, semester)
|
|
401
|
+ {
|
|
402
|
+ var id = outcome.id+"-sem"+semester;
|
|
403
|
+ var new_name = id;
|
|
404
|
+ document.getElementById(id).setAttribute("name", new_name);
|
|
405
|
+ $("#"+id).attr("disabled", true);
|
|
406
|
+ $("#"+id).prop("checked", false);
|
|
407
|
+ });
|
|
408
|
+ });
|
|
409
|
+
|
|
410
|
+
|
|
411
|
+ var i = 1;
|
|
412
|
+ $.each(outcomes, function(index, outcome)
|
|
413
|
+ {
|
|
414
|
+ $.each(semesters, function(index, semester)
|
|
415
|
+ {
|
|
416
|
+ var id = outcome.id+"-sem"+i;
|
|
417
|
+ var new_name = outcome.id+"-sem"+semester.code;
|
|
418
|
+
|
|
419
|
+ var checkbox = document.getElementById(id);
|
|
420
|
+ checkbox.setAttribute("name", new_name);
|
|
421
|
+
|
|
422
|
+ //enable the check box
|
|
423
|
+ $("#"+id).removeAttr("disabled");
|
|
424
|
+
|
|
425
|
+ //store checkboxes info in an array to later lookup which are marked
|
|
426
|
+ var temp = Array(outcome.id,semester.code,program_id, id, typ.id);
|
|
427
|
+ outcome_id_semester_code_program_id_box_id_typ_id.push(temp);
|
|
428
|
+ i++;
|
|
429
|
+ });
|
|
430
|
+ i = 1;
|
|
431
|
+ });
|
|
432
|
+
|
|
433
|
+ //search which boxes are marked in the data-base
|
|
434
|
+ $.post(
|
|
435
|
+ "{{ URL::action('ThreeYearPlanController@lookup_typ_semester_outcome' ) }}",
|
|
436
|
+ {
|
|
437
|
+ info : (outcome_id_semester_code_program_id_box_id_typ_id)
|
|
438
|
+ },
|
|
439
|
+ function(data)
|
|
440
|
+ {
|
|
441
|
+ $.each(data.box_value, function(index, box_id_value)
|
|
442
|
+ {
|
|
443
|
+ var box_id = box_id_value[0];
|
|
444
|
+ var value = box_id_value[1];
|
|
445
|
+ if (1 == value) {
|
|
446
|
+ $("#"+box_id).prop("checked", true);
|
|
447
|
+ }
|
|
448
|
+ });
|
|
449
|
+ }
|
|
450
|
+ );
|
|
451
|
+ },
|
|
452
|
+ 'json'
|
|
453
|
+ );
|
|
454
|
+
|
|
455
|
+
|
|
456
|
+ });
|
|
457
|
+
|
|
458
|
+
|
|
459
|
+ });
|
|
460
|
+
|
|
461
|
+
|
|
462
|
+ // go back to section 1
|
|
463
|
+ $('.back-to-1').on('click', function(e)
|
|
464
|
+ {
|
|
465
|
+ window.scrollTo(0, 0);
|
|
466
|
+ $(".panel-body").hide();
|
|
467
|
+ $("#section1").show();
|
|
468
|
+ });
|
|
469
|
+
|
|
470
|
+
|
|
471
|
+ // go back to section 2
|
|
472
|
+ $('.back-to-2').on('click', function(e)
|
|
473
|
+ {
|
|
474
|
+ window.scrollTo(0, 0);
|
|
475
|
+ $(".panel-body").hide();
|
|
476
|
+ $("#section2").show();
|
|
477
|
+ });
|
|
478
|
+
|
|
479
|
+
|
|
480
|
+ // go to section 2
|
|
481
|
+ $('.go-to-2').on('click', function(e)
|
|
482
|
+ {
|
|
483
|
+ var not_enough = false;
|
|
484
|
+ var i = 0;
|
|
485
|
+ $('#table-cycles tbody tr').each(function() {
|
|
486
|
+ $(this).find('th').each(function() {
|
|
487
|
+ if ($(this).find('input').is(':checked')){
|
|
488
|
+ i = i + 1;
|
|
489
|
+ }
|
|
490
|
+ });
|
|
491
|
+
|
|
492
|
+ if (i < 2){
|
|
493
|
+ not_enough = true;
|
|
494
|
+ }
|
|
495
|
+ i = 0;
|
|
496
|
+ });
|
|
497
|
+
|
|
498
|
+ if (not_enough == true){
|
|
499
|
+ alert("Each Outcome must be evaluated in at least 2 semesters.");
|
|
500
|
+ return true;
|
|
501
|
+ }
|
|
502
|
+
|
|
503
|
+ $(".panel-body").hide();;
|
|
504
|
+ $("#section2").show();;
|
|
505
|
+
|
|
506
|
+ var typ_id = $('#table-cycles').data('typ-id');
|
|
507
|
+ $.post(
|
|
508
|
+ "{{ URL::action('ThreeYearPlanController@section2_arrive') }}",
|
|
509
|
+ {
|
|
510
|
+ typ_id: (typ_id)
|
|
511
|
+ },
|
|
512
|
+ function(data)
|
|
513
|
+ {
|
|
514
|
+ $('.objectives-section').empty();
|
|
515
|
+
|
|
516
|
+ $.each(data, function(index, outcome)
|
|
517
|
+ {
|
|
518
|
+ var outcome_name = outcome.name;
|
|
519
|
+ var outcome_id = outcome.id;
|
|
520
|
+ $('.objectives-section').append('<hr>');
|
|
521
|
+
|
|
522
|
+ var area = $('.courses-section-0').clone(true);
|
|
523
|
+ area.attr('class','');
|
|
524
|
+
|
|
525
|
+ var title = 'Outcome: ' + outcome_name;
|
|
526
|
+ var title_area = $('.title-course-selection-0').clone(true);
|
|
527
|
+ title_area.attr('class','title-course-selection h3');
|
|
528
|
+ title_area.find('p').html(title);
|
|
529
|
+
|
|
530
|
+ area.append(title_area);
|
|
531
|
+
|
|
532
|
+ $.each(outcome.selected_semesters, function(index, semester)
|
|
533
|
+ {
|
|
534
|
+ var semester_name = semester.name;
|
|
535
|
+ var semester_id = semester.semester_id;
|
|
536
|
+
|
|
537
|
+ var select_area = $('.semester-course-selection-0').clone(true);
|
|
538
|
+ select_area.attr('class','semester-course-selection');
|
|
539
|
+ select_area.attr('style',' ');
|
|
540
|
+ select_area.find('.semester-label-course-selection-0').html(semester_name+"'s Objectives");
|
|
541
|
+ var no_option = outcome_id+'-'+semester_id+'-n';
|
|
542
|
+ select_area.find('option').val(no_option).html('Select an Objective');
|
|
543
|
+ select_area.find('.add-objective-course').html('<span class="glyphicon glyphicon-plus"></span> Choose more Objectives');
|
|
544
|
+
|
|
545
|
+ if (semester.available_objectives.length != 0){
|
|
546
|
+ select_area.find('.objective-selector-0 label').hide();
|
|
547
|
+ $.each(semester.available_objectives, function(index, objective)
|
|
548
|
+ {
|
|
549
|
+ var objective_id = objective.id;
|
|
550
|
+ var option_value = outcome_id+'-'+semester_id+'-'+objective_id;
|
|
551
|
+
|
|
552
|
+ var option_name = objective.text;
|
|
553
|
+ var new_option = select_area.find('.default-option').clone(true);
|
|
554
|
+ new_option.html(option_name);
|
|
555
|
+ new_option.val(option_value);
|
|
556
|
+ new_option.attr('class','select_objective');
|
|
557
|
+
|
|
558
|
+ select_area.find('select').append(new_option);
|
|
559
|
+ });
|
|
560
|
+ }
|
|
561
|
+ if (semester.available_objectives.length == 0){
|
|
562
|
+ select_area.find('select').prop('disabled', 'disabled');
|
|
563
|
+ select_area.find('.objective-selector-0 label').html('There are no Objectives available for this Outcome and Semester combination');
|
|
564
|
+ select_area.find('.objective-selector-0 select').hide();
|
|
565
|
+ select_area.find('button').prop('disabled', 'disabled');
|
|
566
|
+ }
|
|
567
|
+ $.each(semester.selected_objectives, function(index, objective)
|
|
568
|
+ {
|
|
569
|
+ select_area.find('.objective-selector-0').hide();
|
|
570
|
+ //si hay objetivos previamente seleccionados, escribirlos
|
|
571
|
+ var objective_id = objective.id;
|
|
572
|
+ var option_value = outcome_id+'-'+semester_id+'-'+objective_id;
|
|
573
|
+ var new_select = select_area.find('.objective-selector-0').clone(true);
|
|
574
|
+ new_select.attr('class','objective-selector');
|
|
575
|
+ new_select.find('select').val(option_value);
|
|
576
|
+ select_area.find('.clone-objective-course-select-0').before(new_select);
|
|
577
|
+ select_area.find('.objective-selector').show();
|
|
578
|
+ });
|
|
579
|
+ area.append(select_area);
|
|
580
|
+ });
|
|
581
|
+ var footer = $('.footer-course-selection-0').clone(true);
|
|
582
|
+ footer.attr('class','footer-course-selection');
|
|
583
|
+ footer.find('p').html('<b>Objective selection for this Outcome is currently hidden.</b>');
|
|
584
|
+ area.append(footer);
|
|
585
|
+
|
|
586
|
+ area.append('<br>');
|
|
587
|
+ area.show(true);
|
|
588
|
+ $('.objectives-section').append(area);
|
|
589
|
+ });
|
|
590
|
+ }
|
|
591
|
+ );
|
|
592
|
+ });
|
|
593
|
+
|
|
594
|
+
|
|
595
|
+
|
|
596
|
+ // hide the options of an outcome in section 2 and 3
|
|
597
|
+ $('.hide-course-selection').on('click', function(e)
|
|
598
|
+ {
|
|
599
|
+ $(this).parent().find('.show-course-selection').show();;
|
|
600
|
+ $(this).hide();;
|
|
601
|
+ $(this).parent().parent().find('.semester-course-selection').hide(333);
|
|
602
|
+ $(this).parent().parent().find('.footer-course-selection').show(333);
|
|
603
|
+ });
|
|
604
|
+
|
|
605
|
+ // show the options of an outcome in section 2 and 3
|
|
606
|
+ $('.show-course-selection').on('click', function(e)
|
|
607
|
+ {
|
|
608
|
+ $(this).parent().find('.hide-course-selection').show();
|
|
609
|
+ $(this).hide();
|
|
610
|
+ $(this).parent().parent().find('.semester-course-selection').show(333);
|
|
611
|
+ $(this).parent().parent().find('.footer-course-selection').hide(333);
|
|
612
|
+ });
|
|
613
|
+
|
|
614
|
+
|
|
615
|
+ // in section 2 and 3, add selects for choosing more objectives and courses, respectively
|
|
616
|
+ $('.add-objective-course').on('click', function(e)
|
|
617
|
+ {
|
|
618
|
+ var new_select = $(this).parent().parent().find('.objective-selector-0').clone(true);
|
|
619
|
+ new_select.attr('class','objective-selector');
|
|
620
|
+ new_select.show();
|
|
621
|
+ $(this).parent().before(new_select);
|
|
622
|
+ });
|
|
623
|
+
|
|
624
|
+
|
|
625
|
+ // go to section 3
|
|
626
|
+ $('.go-to-3').on('click', function(e)
|
|
627
|
+ {
|
|
628
|
+ window.scrollTo(0, 0);
|
|
629
|
+ $(".panel-body").hide();;
|
|
630
|
+ $("#section3").show();;
|
|
631
|
+
|
|
632
|
+ var typ_id = $('#table-cycles').data('typ-id');
|
|
633
|
+ $.post(
|
|
634
|
+ "{{ URL::action('ThreeYearPlanController@section3_arrive') }}",
|
|
635
|
+ {
|
|
636
|
+ typ_id: (typ_id)
|
|
637
|
+ },
|
|
638
|
+ function(data)
|
|
639
|
+ {
|
|
640
|
+ $('.courses-section').empty();
|
|
641
|
+
|
|
642
|
+ $.each(data, function(index, outcome)
|
|
643
|
+ {
|
|
644
|
+ var outcome_name = outcome.name;
|
|
645
|
+ var outcome_id = outcome.id;
|
|
646
|
+ $('.courses-section').append('<hr>');
|
|
647
|
+
|
|
648
|
+ var area = $('.courses-section-0').clone(true);
|
|
649
|
+ area.attr('class','');
|
|
650
|
+
|
|
651
|
+ var title = 'Outcome: ' + outcome_name;
|
|
652
|
+ var title_area = $('.title-course-selection-0').clone(true);
|
|
653
|
+ title_area.attr('class','title-course-selection h3');
|
|
654
|
+ title_area.find('p').html(title);
|
|
655
|
+
|
|
656
|
+ area.append(title_area);
|
|
657
|
+
|
|
658
|
+ $.each(outcome.selected_semesters, function(index, semester)
|
|
659
|
+ {
|
|
660
|
+ var semester_name = semester.name;
|
|
661
|
+ var semester_id = semester.semester_id;
|
|
662
|
+
|
|
663
|
+ var select_area = $('.semester-course-selection-0').clone(true);
|
|
664
|
+ select_area.attr('class','semester-course-selection');
|
|
665
|
+ select_area.attr('style',' ');
|
|
666
|
+ select_area.find('.semester-label-course-selection-0').html(semester_name);
|
|
667
|
+
|
|
668
|
+
|
|
669
|
+ $.each(semester.selected_objectives, function(index, objective)
|
|
670
|
+ {
|
|
671
|
+ var objective_id = objective.objective_id;
|
|
672
|
+ var objective_text = objective.text;
|
|
673
|
+ var new_select = select_area.find('.select-course-selection-0').clone(true);
|
|
674
|
+ new_select.attr('class','select-course-selection');
|
|
675
|
+ new_select.find('label').html('');
|
|
676
|
+ new_select.find('.objective-selector-0').before('<p>Objective: <b>'+objective_text+'</b></p>');
|
|
677
|
+ {{-- new_select.find('.objective-selector-0 select').attr('style','width:100%;max-width:25%;'); --}}
|
|
678
|
+ $.each(objective.available_courses, function(index, course)
|
|
679
|
+ {
|
|
680
|
+ var course_id = course.course_id;
|
|
681
|
+
|
|
682
|
+ var option_value = outcome_id+'-'+semester_id+'-'+objective_id+'-'+course_id;
|
|
683
|
+
|
|
684
|
+ var option_name = '['+course.code+'] '+course.name;
|
|
685
|
+
|
|
686
|
+ var new_option = new_select.find('.default-option').clone(true);
|
|
687
|
+ new_option.html(option_name);
|
|
688
|
+ new_option.val(option_value);
|
|
689
|
+ new_option.attr('class','select_course');
|
|
690
|
+ new_select.find('select').append(new_option);
|
|
691
|
+
|
|
692
|
+ });
|
|
693
|
+ if (objective.available_courses.length == 0){
|
|
694
|
+ new_select.find('.select-course-selection-0').hide();
|
|
695
|
+ new_select.find('select').prop('disabled', 'disabled');
|
|
696
|
+ new_select.find('select label').html(' Objective "'+objective_text+'" has no courses available for selection');
|
|
697
|
+ new_select.find('button').prop('disabled', 'disabled');
|
|
698
|
+ }
|
|
699
|
+ $.each(objective.selected_courses, function(index, course)
|
|
700
|
+ {
|
|
701
|
+ new_select.find('.objective-selector-0').hide();
|
|
702
|
+ //si hay objetivos previamente seleccionados, escribirlos
|
|
703
|
+ var course_id = course.course_id;
|
|
704
|
+ var option_value = outcome_id+'-'+semester_id+'-'+objective_id+'-'+course_id;
|
|
705
|
+
|
|
706
|
+ var new_selected_course = new_select.find('.objective-selector-0').clone(true);
|
|
707
|
+ new_selected_course.attr('class','objective-selector');
|
|
708
|
+ new_selected_course.find('select').val(option_value);
|
|
709
|
+ {{-- new_selected_course.find('label').html(''); --}}
|
|
710
|
+ new_selected_course.show();
|
|
711
|
+ new_select.find('.clone-objective-course-select-0').before(new_selected_course);
|
|
712
|
+ });
|
|
713
|
+ select_area.find('.select-course-selection-0').after(new_select);
|
|
714
|
+ });
|
|
715
|
+ if (semester.selected_objectives.length != 0){
|
|
716
|
+ select_area.find('.select-course-selection-0').hide();
|
|
717
|
+ }
|
|
718
|
+ else{
|
|
719
|
+ select_area.find('select').prop('disabled', 'disabled');
|
|
720
|
+ select_area.find('.objective-selector-0').html('There are no objectives selected for this semester');
|
|
721
|
+ select_area.find('button').prop('disabled', 'disabled');
|
|
722
|
+ }
|
|
723
|
+ area.append(select_area);
|
|
724
|
+ });
|
|
725
|
+ var footer = $('.footer-course-selection-0').clone(true);
|
|
726
|
+ footer.attr('class','footer-course-selection');
|
|
727
|
+ area.append(footer);
|
|
728
|
+
|
|
729
|
+ area.append('<br>');
|
|
730
|
+ area.show(true);
|
|
731
|
+ $('.courses-section').append(area);
|
|
732
|
+ });
|
|
733
|
+ }
|
|
734
|
+ );
|
|
735
|
+ });
|
|
736
|
+
|
|
737
|
+
|
|
738
|
+ // remove an
|
|
739
|
+ $('.delete-selection-0').on('click', function(e)
|
|
740
|
+ {
|
|
741
|
+ var options_values = $(this).parent().find('select').val().split('-');
|
|
742
|
+
|
|
743
|
+ if (options_values.length == 3){
|
|
744
|
+ var typ_id = $('#table-cycles').data('typ-id');
|
|
745
|
+ var outcome_id = options_values[0];
|
|
746
|
+ var semester_id = options_values[1];
|
|
747
|
+ var new_objective_id = "nothing_selected";
|
|
748
|
+
|
|
749
|
+ var previous_objective_id = options_values[2];
|
|
750
|
+ if (previous_objective_id == 'n'){
|
|
751
|
+ previous_objective_id = "nothing_selected";
|
|
752
|
+ // with the next return, the post shouldnt excecute.
|
|
753
|
+ // im leaving the assignment in the line before this one just in case.
|
|
754
|
+ $(this).parent().hide();;
|
|
755
|
+ return true;
|
|
756
|
+ }
|
|
757
|
+
|
|
758
|
+ $.post(
|
|
759
|
+ "{{ URL::action('ThreeYearPlanController@section2_on_change') }}",
|
|
760
|
+ {
|
|
761
|
+ typ_id: (typ_id),
|
|
762
|
+ previous_objective_id: (previous_objective_id),
|
|
763
|
+ outcome_id: (outcome_id),
|
|
764
|
+ semester_id: (semester_id),
|
|
765
|
+ new_objective_id: (new_objective_id)
|
|
766
|
+ },
|
|
767
|
+ function(data)
|
|
768
|
+ {
|
|
769
|
+ //
|
|
770
|
+ }
|
|
771
|
+ );
|
|
772
|
+ }
|
|
773
|
+ else if (options_values.length == 4){
|
|
774
|
+
|
|
775
|
+ var typ_id = $('#table-cycles').data('typ-id');
|
|
776
|
+ var outcome_id = options_values[0];
|
|
777
|
+ var semester_id = options_values[1];
|
|
778
|
+ var objective_id = options_values[2];
|
|
779
|
+ var previous_course_id = options_values[3];
|
|
780
|
+ var new_course_id = 'nothing_selected';
|
|
781
|
+
|
|
782
|
+ $.post(
|
|
783
|
+ "{{ URL::action('ThreeYearPlanController@section3_on_change') }}",
|
|
784
|
+ {
|
|
785
|
+ typ_id: (typ_id),
|
|
786
|
+ previous_course_id: (previous_course_id),
|
|
787
|
+ outcome_id: (outcome_id),
|
|
788
|
+ semester_id: (semester_id),
|
|
789
|
+ objective_id: (objective_id),
|
|
790
|
+ new_course_id: (new_course_id)
|
|
791
|
+ },
|
|
792
|
+ function(data)
|
|
793
|
+ {
|
|
794
|
+ //
|
|
795
|
+ }
|
|
796
|
+ );
|
|
797
|
+ }
|
|
798
|
+
|
|
799
|
+ $(this).parent().hide();;
|
|
800
|
+ });
|
|
801
|
+
|
|
802
|
+
|
|
803
|
+@stop
|