|
@@ -19,8 +19,16 @@
|
19
|
19
|
<div class="form-group col-md-11" id='outcomeForm'>
|
20
|
20
|
|
21
|
21
|
|
22
|
|
- {{ Form::select('outcome[0]', $outcomes, null, ['class'=>'form-control selectpicker', 'id' =>'outcome[0]']) }}
|
23
|
|
-
|
|
22
|
+ <select id="outcome[0]" name="outcome[0]" class="form-control selectpicker">
|
|
23
|
+ @foreach ($outcomes as $outcome)
|
|
24
|
+ <option value="{{ $outcome->id }}">
|
|
25
|
+ {{ $outcome->name }}
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+ </option>
|
|
30
|
+ @endforeach
|
|
31
|
+ </select>
|
24
|
32
|
</div>
|
25
|
33
|
|
26
|
34
|
</div>
|
|
@@ -84,10 +92,11 @@
|
84
|
92
|
</div>
|
85
|
93
|
<div class="form-group">
|
86
|
94
|
<label>Associated Outcome</label>
|
87
|
|
- {{ Form::select('assoc_outcomes_fetch', $outcomes, null, ['class'=>'form-control selectpicker', 'id'=>'assoc_outcomes_fetch', 'onchange'=>'fetchAllObjectives("select-program", "assoc_outcomes_fetch")']) }}
|
|
95
|
+ {{ Form::select('assoc_outcome_fetch', $outcomes, null, ['class'=>'form-control selectpicker', 'id'=>'assoc_outcomes_fetch', 'onchange'=>'fetchAllObjectives("select-program", "assoc_outcomes_fetch")']) }}
|
88
|
96
|
|
89
|
97
|
</div>
|
90
|
98
|
</div>
|
|
99
|
+ <hr>
|
91
|
100
|
<div class="form-group">
|
92
|
101
|
{{ Form::label('objective_id', 'Objectives') }}
|
93
|
102
|
<select id="select-objective" name="id" class="form-control selectpicker">
|
|
@@ -113,8 +122,17 @@
|
113
|
122
|
<div id='assocOutcomeGroup'>
|
114
|
123
|
<label>Associated Outcome</label>
|
115
|
124
|
|
116
|
|
- {{ Form::select('outcome[]', $outcomes, null, ['class'=>'form-control selectpicker', 'id'=>'assoc_outcome0']) }}
|
117
|
|
-
|
|
125
|
+ <select id="assoc_outcome0" name="assoc_outcome[]" class="form-control selectpicker">
|
|
126
|
+ @foreach ($outcomes as $outcome)
|
|
127
|
+ <option value="{{ $outcome->id }}">
|
|
128
|
+ {{ $outcome->name }}
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+ </option>
|
|
133
|
+ @endforeach
|
|
134
|
+ </select><br><br>
|
|
135
|
+
|
118
|
136
|
</div>
|
119
|
137
|
|
120
|
138
|
</div>
|
|
@@ -135,7 +153,7 @@
|
135
|
153
|
{{ Form::label('program_id2', 'Associated Program') }}<br><br>
|
136
|
154
|
@foreach ($programs as $program)
|
137
|
155
|
|
138
|
|
- <input type="checkbox" id="assoc_program_id_{{ $program->id }}" name="program_id[]" value="{{$program->id}}">
|
|
156
|
+ <input type="checkbox" id="assoc_program_id_{{ $program->id }}" name="assoc_program_id[]" value="{{$program->id}}">
|
139
|
157
|
<label for="assoc_program_id_{{ $program->id }}"> {{ $program->name }} <sub>[{{ $program->school->name }}]</sub></label><br>
|
140
|
158
|
@endforeach
|
141
|
159
|
</div>
|
|
@@ -161,7 +179,7 @@
|
161
|
179
|
|
162
|
180
|
</div>
|
163
|
181
|
|
164
|
|
- {{ Form::submit('Update', array('class' => 'btn btn-primary btn-block')) }}
|
|
182
|
+ {{ Form::submit('Update', array('class' => 'btn btn-primary btn-block', 'id' => 'update_button')) }}
|
165
|
183
|
{{ Form::close() }}
|
166
|
184
|
<form action="/deleteObjective" method="POST" id='deleteObj'>
|
167
|
185
|
|
|
@@ -299,7 +317,7 @@
|
299
|
317
|
|
300
|
318
|
// Select associated outcome
|
301
|
319
|
for (var i = counterAssoc; i != 1; i--) {
|
302
|
|
- deleteLastAssoc(i - 1);
|
|
320
|
+ deleteLastAssoc(i);
|
303
|
321
|
|
304
|
322
|
}
|
305
|
323
|
$('#assoc_outcome0').val(json.outcome[0].outcome_id);
|
|
@@ -309,7 +327,7 @@
|
309
|
327
|
counterAssoc = i + 1;
|
310
|
328
|
var $select = $('<select />', {
|
311
|
329
|
'class': "selectpicker form-control",
|
312
|
|
- 'name': "outcome[]",
|
|
330
|
+ 'name': "assoc_outcome[]",
|
313
|
331
|
'data-live-search': 'true',
|
314
|
332
|
'id': 'assoc_outcome' + i.toString()
|
315
|
333
|
|
|
@@ -326,7 +344,7 @@
|
326
|
344
|
var $button = $('<button />', {
|
327
|
345
|
'type': 'button',
|
328
|
346
|
'class': 'btn btn-primary',
|
329
|
|
- 'onclick': 'deleteLastAssoc(' + i + ')'
|
|
347
|
+ 'onclick': 'deleteLastAssoc()'
|
330
|
348
|
});
|
331
|
349
|
$button.append('X');
|
332
|
350
|
$divForButton.append($button);
|
|
@@ -430,13 +448,14 @@
|
430
|
448
|
);
|
431
|
449
|
}
|
432
|
450
|
|
433
|
|
- function deleteLastAssoc(i) {
|
|
451
|
+ function deleteLastAssoc() {
|
434
|
452
|
|
435
|
|
- div = document.getElementById('assocOutcomeForm' + (i).toString());
|
436
|
|
- div.remove();
|
437
|
|
- button = document.getElementById('closeAssoc' + (i).toString());
|
438
|
|
- button.remove();
|
439
|
|
- counterAssoc -= 1;
|
|
453
|
+div = document.getElementById('assocOutcomeForm' + (counterAssoc -1).toString());
|
|
454
|
+div.remove();
|
|
455
|
+button = document.getElementById('closeAssoc' + (counterAssoc-1).toString());
|
|
456
|
+button.remove();
|
|
457
|
+counterAssoc -=1;
|
|
458
|
+$('#counterAssoc').val(counterAssoc);
|
440
|
459
|
|
441
|
460
|
}
|
442
|
461
|
|
|
@@ -445,7 +464,7 @@
|
445
|
464
|
|
446
|
465
|
var $select = $('<select />', {
|
447
|
466
|
'class': "selectpicker form-control",
|
448
|
|
- 'name': "outcome[]",
|
|
467
|
+ 'name': "assoc_outcome[]",
|
449
|
468
|
'data-live-search': 'true',
|
450
|
469
|
'id': 'assoc_outcome' + counterAssoc.toString()
|
451
|
470
|
|
|
@@ -462,7 +481,7 @@
|
462
|
481
|
var $button = $('<button />', {
|
463
|
482
|
'type': 'button',
|
464
|
483
|
'class': 'btn btn-primary',
|
465
|
|
- 'onclick': 'deleteLastAssoc(' + counterAssoc + ')'
|
|
484
|
+ 'onclick': 'deleteLastAssoc()'
|
466
|
485
|
});
|
467
|
486
|
$button.append('X');
|
468
|
487
|
$divForButton.append($button);
|
|
@@ -476,9 +495,40 @@
|
476
|
495
|
|
477
|
496
|
|
478
|
497
|
counterAssoc += 1;
|
|
498
|
+ $('#counterAssoc').val(counterAssoc);
|
479
|
499
|
|
480
|
500
|
|
481
|
501
|
}
|
|
502
|
+ $('#update_button').on('click', function(e){
|
|
503
|
+ e.preventDefault();
|
|
504
|
+
|
|
505
|
+ outcome_id= []
|
|
506
|
+ program_id= [];
|
|
507
|
+ status = $('#status').val();
|
|
508
|
+ text =$('#objective-text').val();
|
|
509
|
+ id = $('#select-objective').val();
|
|
510
|
+
|
|
511
|
+ $('#assocOutcomeGroup').find('select').each(function(){
|
|
512
|
+ outcome_id.push($(this).val())
|
|
513
|
+ })
|
|
514
|
+ $('input[name="assoc_program_id[]"]').each(function(){
|
|
515
|
+ if(this.checked)
|
|
516
|
+ program_id.push($(this).val())
|
|
517
|
+ });
|
|
518
|
+ $.post(
|
|
519
|
+ "{{URL::action('Objective2Controller@update')}}",
|
|
520
|
+ {
|
|
521
|
+ assoc_outcome:outcome_id,
|
|
522
|
+ program_id:program_id,
|
|
523
|
+ status:status,
|
|
524
|
+ text:text,
|
|
525
|
+ id:id
|
|
526
|
+ },
|
|
527
|
+ function(){
|
|
528
|
+ location.reload(true);
|
|
529
|
+ }
|
|
530
|
+ )
|
|
531
|
+ })
|
482
|
532
|
</script>
|
483
|
533
|
@stop
|
484
|
534
|
|