|
@@ -18,7 +18,7 @@
|
18
|
18
|
<div class="form-group col-md-11">
|
19
|
19
|
<label>Associated Outcomes</label>
|
20
|
20
|
|
21
|
|
- {{ Form::select('outcome[]', $outcomes, reset($outcomes), ['class'=>'form-control selectpicker', 'id' =>'outcome0', 'onchange'=>'fetchObjectiveForSelect("outcome0")']) }}
|
|
21
|
+ {{ Form::select('outcome[]', $outcomes, reset($outcomes), ['class'=>'form-control selectpicker', 'id' =>'outcome0', 'onchange'=>'fetchObjectiveForSelect("outcomeGroup", "objectiveGroup")']) }}
|
22
|
22
|
</div>
|
23
|
23
|
</div>
|
24
|
24
|
<input type='hidden' name='counterOutcome' id='counterOutcome' value=1>
|
|
@@ -28,7 +28,7 @@
|
28
|
28
|
</span>
|
29
|
29
|
Add another Outcome
|
30
|
30
|
</button>
|
31
|
|
- <div id='objectiveGroup'>
|
|
31
|
+ <div id='objectiveGroup' data-value = '1'>
|
32
|
32
|
<div class="form-group">
|
33
|
33
|
<label>Associated Objectives</label>
|
34
|
34
|
<select id="objective_0" name="objective[]" class="form-control selectpicker">
|
|
@@ -67,19 +67,7 @@
|
67
|
67
|
<p class="help-block"><strong>Manually add</strong> bullets or numbering.</p>
|
68
|
68
|
{{ Form::textarea('subcriteria', '', array('class' => 'form-control', 'rows'=>3, 'aria-labelledby'=>'subcriteria')) }}
|
69
|
69
|
</div>
|
70
|
|
- <div class="form-group">
|
71
|
|
- {{ Form::label('maximum_score', 'Maximum Score') }}
|
72
|
|
- {{ Form::text('maximum_score', '1', array('class' => 'form-control', 'id'=>'maximum_score', 'oninput'=>'addOptions("Num_scale", "maximum_score", "Scales")')) }}
|
73
|
|
- </div>
|
74
|
|
- <div class="form-group">
|
75
|
|
- {{ Form::label('scales', 'Number of Scales') }}
|
76
|
|
- <select id="Num_scale" name="scales" class="form-control selectpicker" onchange='numberOfScales("Num_scale", "Scales")'>
|
77
|
|
-
|
78
|
|
- </select>
|
79
|
|
- </div>
|
80
|
|
- <div id='Scales' data-value="0">
|
81
|
|
-
|
82
|
|
- </div>
|
|
70
|
+
|
83
|
71
|
|
84
|
72
|
|
85
|
73
|
<div class="form-group">
|
|
@@ -146,7 +134,7 @@
|
146
|
134
|
</div>
|
147
|
135
|
|
148
|
136
|
<!-- Associated Outcome -->
|
149
|
|
- <div id='assocOutcomeGroup'>
|
|
137
|
+ <div id='assocOutcomeGroup' data-value="1">
|
150
|
138
|
<div class="form-group">
|
151
|
139
|
<label>Associated Outcome</label>
|
152
|
140
|
{{ Form::select('assoc_outcome[]', $outcomes, null, ['class'=>'form-control selectpicker', 'id'=>'assoc_outcome_0', 'onchange'=>'fetchAssocObjective("assoc_outcome_0")']) }}
|
|
@@ -160,10 +148,11 @@
|
160
|
148
|
Add another Outcome
|
161
|
149
|
</button>
|
162
|
150
|
|
163
|
|
- <div id='assoc_objectiveGroup'>
|
|
151
|
+ <div id='assoc_objectiveGroup' data-value="1">
|
164
|
152
|
<div class="form-group">
|
165
|
153
|
<label>Associated Objectives</label>
|
166
|
154
|
<select id="assoc_objective_0" name="assoc_objective[]" class="form-control selectpicker">
|
|
155
|
+ <option value="0">No associated objectives</option>
|
167
|
156
|
</select>
|
168
|
157
|
|
169
|
158
|
</div>
|
|
@@ -212,21 +201,7 @@
|
212
|
201
|
{{ Form::textarea('subcriteria', '', array('class' => 'form-control', 'rows'=>3, 'id' => 'criterion_subcriteria')) }}
|
213
|
202
|
</div>
|
214
|
203
|
|
215
|
|
- <div class="form-group">
|
216
|
|
- {{ Form::label('assoc_maximum_score', 'Maximum Score') }}
|
217
|
|
- {{ Form::text('assoc_maximum_score', '', array('class' => 'form-control', 'id'=>'assoc_maximum_score', 'oninput'=>'addOptions("Num_assoc_scale", "assoc_maximum_score", "Assoc_Scales")')) }}
|
218
|
|
- </div>
|
219
|
|
-
|
220
|
|
-
|
221
|
|
- <div class="form-group">
|
222
|
|
- {{ Form::label('scales', 'Number of Scales') }}
|
223
|
|
- <select id="Num_assoc_scale" class="form-control selectpicker" onchange='numberOfAssoc("Num_assoc_scale", "Assoc_Scales")'>
|
224
|
|
-
|
225
|
|
- </select>
|
226
|
|
- </div>
|
227
|
|
- <div id='Assoc_Scales' data-value="0">
|
228
|
204
|
|
229
|
|
- </div>
|
230
|
205
|
|
231
|
206
|
|
232
|
207
|
<div class="form-group">
|
|
@@ -241,9 +216,11 @@
|
241
|
216
|
|
242
|
217
|
{{ Form::submit('Update', array('class' => 'btn btn-primary btn-block')) }}
|
243
|
218
|
{{ Form::close() }}
|
244
|
|
- <div id='delete'>
|
245
|
|
-
|
246
|
|
- </div>
|
|
219
|
+ {{ Form::open(array('action' => 'CriteriaController@delete')) }}
|
|
220
|
+
|
|
221
|
+ <input type='hidden' name='criterion_delete' id='deleteCriteria'>
|
|
222
|
+
|
|
223
|
+ {{Form::submit("Delete", array('class'=> 'btn btn-primary btn-block', 'id'=>"DeleteButton"))}}
|
247
|
224
|
|
248
|
225
|
</div>
|
249
|
226
|
</div>
|
|
@@ -255,75 +232,7 @@
|
255
|
232
|
var counter = 1;
|
256
|
233
|
var counterObj = 1;
|
257
|
234
|
var outcomeString = 'OutcomeGroup_';
|
258
|
|
- $(document).ready(function() {
|
259
|
|
- addOptions('Num_scale', 'maximum_score', 'Scales');
|
260
|
|
- numberOfScales('Num_scale', 'Scales');
|
261
|
|
- });
|
262
|
|
-
|
263
|
|
-
|
264
|
|
- function numberOfAssoc(string, Scales) {
|
265
|
|
- var maximum = $('#assoc_maximum_score').val();
|
266
|
|
- var amountOfScale = parseInt($('#' + string).val());
|
267
|
|
- var dataValue = parseInt($('#' + Scales).attr('data-value'));
|
268
|
|
- //add
|
269
|
|
- if (dataValue < amountOfScale) {
|
270
|
|
-
|
271
|
|
- fullDiv = '';
|
272
|
|
-
|
273
|
|
- for (var i = dataValue; i < amountOfScale; i++) {
|
274
|
|
- div = '<div id="assoc_eval' + i.toString() + Scales + '">' +
|
275
|
|
- '<div class ="form-row">' +
|
276
|
|
- '<label for="header' + (i).toString() + '">Evaluación ' + (i + 1).toString() + '</label><br><br>' +
|
277
|
|
- '<input type="hidden" id="header' + i.toString() + '">' +
|
278
|
|
- '<div class="form-group col-md-8" >' +
|
279
|
|
- '<label for="title' + i.toString() + '">Nombre de Evaluación ' + (i + 1).toString() + '</label>' +
|
280
|
|
- '<input class="form-control" name="assoc_title[]" type="text" id="title' + i.toString() + '" placeholder ="Nombre de evaluacion" ></div>' +
|
281
|
|
- '<div class ="form-group col-md-2">' +
|
282
|
|
- '<label for="min' + i.toString() + '">Mínimo </label>' +
|
283
|
|
- '<input class="form-control" type="number" id="assoc_min' + i.toString() + '" min="1" max = "' + maximum + '" oninput ="changedMin(' + "'assoc_min" + i.toString() + "', '" + i.toString() + "', 'Assoc_Scales' " + ')" name = "assoc_min[]"></div>' +
|
284
|
|
- '<div class ="form-group col-md-2">' +
|
285
|
|
- '<label for="max' + i.toString() + '">Máximo </label>' +
|
286
|
|
- '<input class="form-control" type="number" id="assoc_max' + i.toString() + '" min="1" max = "' + maximum + '" oninput ="changedMax(' + "'assoc_max" + i.toString() + "', '" + i.toString() + "', 'Assoc_Scales' " + ')" name = "assoc_max[]"></div></div>' +
|
287
|
|
- '<div class ="form-group">' +
|
288
|
|
- '<label for ="descripcion' + i.toString() + '">Descripción de evaluación</label>' +
|
289
|
|
- '<textarea class="form-control" rows="2" aria-labelledby="descripcion' + i.toString() + '" name="assoc_scales[]" cols="50" ></textarea></div></div>';
|
290
|
|
- fullDiv += div;
|
291
|
|
-
|
292
|
|
-
|
293
|
|
- }
|
294
|
|
-
|
295
|
|
- $('#' + Scales).append(fullDiv);
|
296
|
|
- $('#' + Scales).attr('data-value', amountOfScale);
|
297
|
|
- } else {
|
298
|
|
- for (var i = dataValue; i > amountOfScale; i--) {
|
299
|
|
- $('#assoc_eval' + (i - 1).toString()).remove();
|
300
|
|
- }
|
301
|
|
- }
|
302
|
|
- $('#' + Scales).attr('data-value', amountOfScale);
|
303
|
|
-
|
304
|
|
- }
|
305
|
|
-
|
306
|
|
- function addOptions(select, max, scaleDiv) {
|
307
|
|
- var maxscore = parseInt($('#' + max).val())
|
308
|
|
- options = '';
|
309
|
|
- for (var i = 1; i <= maxscore; i++) {
|
310
|
|
- options += '<option value="' + i.toString() + '">' + i.toString() + '</option>';
|
311
|
|
-
|
312
|
|
- }
|
313
|
|
-
|
314
|
|
- var previousvalue = parseInt($('#' + select).val());
|
315
|
|
- $('#' + select).html(options);
|
316
|
|
- $('#' + select).val(previousvalue);
|
317
|
|
- $('#' + select).selectpicker('refresh');
|
318
|
|
-
|
319
|
|
- var attribute = parseInt($('#' + scaleDiv).attr('data-value'));
|
320
|
|
-
|
321
|
|
- for (var i = 0; i < attribute; i++) {
|
322
|
|
- $('#max' + i.toString()).attr('max', maxscore);
|
323
|
|
- $('#min' + i.toString()).attr('max', maxscore);
|
324
|
|
- }
|
325
|
|
-
|
326
|
|
- }
|
|
235
|
+
|
327
|
236
|
|
328
|
237
|
|
329
|
238
|
$('.filterSection').hide();
|
|
@@ -338,71 +247,11 @@ $('.filterSection').hide();
|
338
|
247
|
$('.filterSection').toggle(533);
|
339
|
248
|
});
|
340
|
249
|
|
341
|
|
- function numberOfScales(string, Scales) {
|
342
|
|
- var maximum = $('#maximum_score').val();
|
343
|
|
- var amountOfScale = parseInt($('#' + string).val());
|
344
|
|
- var dataValue = parseInt($('#' + Scales).attr('data-value'));
|
345
|
|
- //add
|
346
|
|
- if (dataValue < amountOfScale) {
|
347
|
|
-
|
348
|
|
- fullDiv = '';
|
349
|
|
-
|
350
|
|
- for (var i = dataValue; i < amountOfScale; i++) {
|
351
|
|
- div = '<div id="eval' + i.toString() + Scales + '">' +
|
352
|
|
- '<div class ="form-row">' +
|
353
|
|
- '<label for="header' + (i).toString() + '">Evaluación ' + (i + 1).toString() + '</label><br><br>' +
|
354
|
|
- '<input type="hidden" id="header' + i.toString() + '">' +
|
355
|
|
- '<div class="form-group col-md-8" >' +
|
356
|
|
- '<label for="title' + i.toString() + '">Nombre de Evaluación ' + (i + 1).toString() + '</label>' +
|
357
|
|
- '<input class="form-control" name="title[]" type="text" id="title' + i.toString() + '" placeholder ="Nombre de evaluacion" ></div>' +
|
358
|
|
- '<div class ="form-group col-md-2">' +
|
359
|
|
- '<label for="min' + i.toString() + '">Mínimo </label>' +
|
360
|
|
- '<input class="form-control" type="number" id="min' + i.toString() + '" min="1" max = "' + maximum + '" oninput ="changedMin(' + "'min" + i.toString() + "', '" + i.toString() + "', 'Scales' " + ')" name = "min[]"></div>' +
|
361
|
|
- '<div class ="form-group col-md-2">' +
|
362
|
|
- '<label for="max' + i.toString() + '">Máximo </label>' +
|
363
|
|
- '<input class="form-control" type="number" id="max' + i.toString() + '" min="1" max = "' + maximum + '" oninput ="changedMax(' + "'max" + i.toString() + "', '" + i.toString() + "', 'Scales' " + ')" name = "max[]"></div></div>' +
|
364
|
|
- '<div class ="form-group">' +
|
365
|
|
- '<label for ="descripcion' + i.toString() + '">Descripción de evaluación</label>' +
|
366
|
|
- '<textarea class="form-control" rows="2" aria-labelledby="descripcion' + i.toString() + '" name="' + Scales + '[]" cols="50" ></textarea></div></div>';
|
367
|
|
- fullDiv += div;
|
368
|
|
- }
|
369
|
|
-
|
370
|
|
- $('#' + Scales).append(fullDiv);
|
371
|
|
-
|
372
|
|
- } else {
|
373
|
|
- for (var i = dataValue; i > amountOfScale; i--) {
|
374
|
|
- $('#eval' + (i - 1).toString() + Scales).remove();
|
375
|
|
- }
|
376
|
|
- }
|
377
|
|
- $('#' + Scales).attr('data-value', amountOfScale);
|
378
|
|
-
|
379
|
|
- }
|
380
|
|
-
|
381
|
|
- function changedMin(min, index, scaleDiv) {
|
382
|
|
- var maximum = parseInt($('#' + min).val()) + 1;
|
383
|
|
- var maxScaleScore = parseInt($('#' + scaleDiv).attr('data-value'));
|
384
|
250
|
|
385
|
|
- for (var i = parseInt(index); i < maxScaleScore; i++) {
|
386
|
|
- $('#max' + i).attr('min', maximum);
|
387
|
|
-
|
388
|
|
- }
|
389
|
|
-
|
390
|
|
- }
|
391
|
|
-
|
392
|
|
- function changedMax(max, index, scaleDiv) {
|
393
|
|
- var maximum = parseInt($('#' + max).val()) + 1;
|
394
|
|
- var maxScaleScore = parseInt($('#' + scaleDiv).attr('data-value'));
|
395
|
|
-
|
396
|
|
- for (var i = parseInt(index) + 1; i < maxScaleScore; i++) {
|
397
|
|
- $('#min' + i).attr('min', maximum)
|
398
|
|
-
|
399
|
|
- }
|
400
|
|
-
|
401
|
|
-
|
402
|
|
- }
|
403
|
251
|
|
404
|
252
|
//Add outcome Button
|
405
|
253
|
function addOutcomeTest() {
|
|
254
|
+ counter = parseInt($('#outcomeGroup').data("value"));
|
406
|
255
|
var $select = $('<select/>', {
|
407
|
256
|
'class': "selectpicker form-control",
|
408
|
257
|
'name': "outcome[]",
|
|
@@ -434,11 +283,12 @@ $('.filterSection').hide();
|
434
|
283
|
$select.append(selectOptions);
|
435
|
284
|
|
436
|
285
|
$select.appendTo('#outcomeForm' + counter.toString()).selectpicker('refresh');
|
|
286
|
+ $('#outcomeGroup').data("value", counter +1);
|
437
|
287
|
fetchObjectiveForSelect('outcomeGroup', "objectiveGroup");
|
438
|
288
|
counter += 1;
|
439
|
289
|
$divForButton.appendTo('#outcomeGroup');
|
440
|
290
|
|
441
|
|
- $('#counterOutcome').val(counter)
|
|
291
|
+
|
442
|
292
|
|
443
|
293
|
|
444
|
294
|
}
|
|
@@ -458,11 +308,14 @@ $('.filterSection').hide();
|
458
|
308
|
|
459
|
309
|
}
|
460
|
310
|
//Delete Objective
|
461
|
|
- function deleteObjective(objectiveForm, closeObj) {
|
|
311
|
+
|
|
312
|
+ function deleteObjective(objectiveForm, closeObj, objectiveGroup) {
|
462
|
313
|
$div = document.getElementById(objectiveForm);
|
463
|
314
|
$div.remove();
|
464
|
315
|
$div = document.getElementById(closeObj);
|
465
|
316
|
$div.remove();
|
|
317
|
+ counter = parseInt($('#'+objectiveGroup).data("value"));
|
|
318
|
+ $('#'+objectiveGroup).data("value", counter-1);
|
466
|
319
|
|
467
|
320
|
|
468
|
321
|
}
|
|
@@ -471,6 +324,7 @@ $('.filterSection').hide();
|
471
|
324
|
|
472
|
325
|
function addAssocObjective() {
|
473
|
326
|
selectObj = document.getElementById('assoc_objective_0').innerHTML;
|
|
327
|
+ assocObjectiveCounter = parseInt($('#assoc_objectiveGroup').data('value'));
|
474
|
328
|
var $select = $('<select/>', {
|
475
|
329
|
'class': "selectpicker form-control",
|
476
|
330
|
'name': "assoc_objective[]",
|
|
@@ -491,7 +345,7 @@ $('.filterSection').hide();
|
491
|
345
|
var $button = $('<button/>', {
|
492
|
346
|
'type': 'button',
|
493
|
347
|
'class': 'btn btn-primary',
|
494
|
|
- 'onclick': 'deleteObjective("assoc_objectiveForm' + assocObjectiveCounter.toString() + '", "assoc_closeObj' + assocObjectiveCounter.toString() + '")'
|
|
348
|
+ 'onclick': 'deleteObjective("assoc_objectiveForm' + assocObjectiveCounter.toString() + '", "assoc_closeObj' + assocObjectiveCounter.toString() + ', "assoc_objectiveGroup")'
|
495
|
349
|
});
|
496
|
350
|
|
497
|
351
|
$button.append('X');
|
|
@@ -501,7 +355,7 @@ $('.filterSection').hide();
|
501
|
355
|
$select.append(selectObj);
|
502
|
356
|
|
503
|
357
|
$select.appendTo('#assoc_objectiveForm' + assocObjectiveCounter.toString()).selectpicker('refresh');
|
504
|
|
- counterObj += 1;
|
|
358
|
+ $('#assoc_objectiveGroup').data("value", assocObjectiveCounter +1);
|
505
|
359
|
|
506
|
360
|
$divForButton.appendTo('#assoc_objectiveGroup');
|
507
|
361
|
|
|
@@ -511,26 +365,27 @@ $('.filterSection').hide();
|
511
|
365
|
//Add objective when creating a criteria
|
512
|
366
|
function addObjectiveTest() {
|
513
|
367
|
selectObj = document.getElementById('objective_0').innerHTML;
|
|
368
|
+ counter = $("#objectiveGroup").data('value');
|
514
|
369
|
var $select = $('<select/>', {
|
515
|
370
|
'class': "selectpicker form-control",
|
516
|
371
|
'name': "objective[]",
|
517
|
372
|
'data-live-search': 'true',
|
518
|
|
- 'id': 'objective_' + counterObj.toString()
|
|
373
|
+ 'id': 'objective_' + counter.toString()
|
519
|
374
|
|
520
|
375
|
});
|
521
|
376
|
var $div = $('<div/>', {
|
522
|
|
- 'id': 'objectiveForm' + counterObj.toString(),
|
|
377
|
+ 'id': 'objectiveForm' + counter.toString(),
|
523
|
378
|
'class': 'form-group col-md-11'
|
524
|
379
|
});
|
525
|
380
|
var $divForButton = $('<div/>', {
|
526
|
381
|
'class': 'col-md-1',
|
527
|
|
- 'id': 'closeObj' + counterObj.toString()
|
|
382
|
+ 'id': 'closeObj' + counter.toString()
|
528
|
383
|
|
529
|
384
|
});
|
530
|
385
|
var $button = $('<button/>', {
|
531
|
386
|
'type': 'button',
|
532
|
387
|
'class': 'btn btn-primary',
|
533
|
|
- 'onclick': 'deleteObjective("objectiveForm' + counterObj.toString() + '", "closeObj' + counterObj.toString() + '")'
|
|
388
|
+ 'onclick': 'deleteObjective("objectiveForm' + counter.toString() + '", "closeObj' + counter.toString() + '")'
|
534
|
389
|
});
|
535
|
390
|
|
536
|
391
|
$button.append('X');
|
|
@@ -539,11 +394,11 @@ $('.filterSection').hide();
|
539
|
394
|
$div.appendTo('#objectiveGroup')
|
540
|
395
|
$select.append(selectObj);
|
541
|
396
|
|
542
|
|
- $select.appendTo('#objectiveForm' + counterObj.toString()).selectpicker('refresh');
|
543
|
|
- counterObj += 1;
|
|
397
|
+ $select.appendTo('#objectiveForm' + counter.toString()).selectpicker('refresh');
|
|
398
|
+
|
544
|
399
|
|
545
|
400
|
$divForButton.appendTo('#objectiveGroup');
|
546
|
|
- $('#counterObjective').val(counterObj)
|
|
401
|
+ $('#objectiveGroup').data('value', counter +1);
|
547
|
402
|
}
|
548
|
403
|
|
549
|
404
|
//Create outcome for editing
|
|
@@ -552,6 +407,7 @@ $('.filterSection').hide();
|
552
|
407
|
|
553
|
408
|
|
554
|
409
|
function addAssocOutcome() {
|
|
410
|
+ assocOutcomeCounter = parseInt($('#assocOutcomeGroup').data('value'));
|
555
|
411
|
var $select = $('<select/>', {
|
556
|
412
|
'class': "selectpicker form-control",
|
557
|
413
|
'name': "assoc_outcome[]",
|
|
@@ -583,11 +439,10 @@ $('.filterSection').hide();
|
583
|
439
|
$select.append(selectOptions);
|
584
|
440
|
|
585
|
441
|
$select.appendTo('#assoc_outcomeForm' + assocOutcomeCounter.toString()).selectpicker('refresh');
|
586
|
|
- //fetchAssocObjective('assoc_outcome_' + assocOutcomeCounter.toString());
|
587
|
|
- assocOutcomeCounter += 1;
|
|
442
|
+ assocOutcomeCounter += 1;
|
588
|
443
|
$divForButton.appendTo('#assocOutcomeGroup');
|
589
|
444
|
|
590
|
|
-
|
|
445
|
+ $('#assocOutcomeGroup').data('value', assocOutcomeCounter);
|
591
|
446
|
|
592
|
447
|
|
593
|
448
|
}
|
|
@@ -596,37 +451,64 @@ $('.filterSection').hide();
|
596
|
451
|
|
597
|
452
|
var assocObjectiveCounter = 1;
|
598
|
453
|
|
599
|
|
- function fetchAssocObjective(outcomeId) {
|
600
|
|
- var id = $('#' + outcomeId).find(':selected').val();
|
|
454
|
+ function fetchAssocObjective(outcomeDiv, objectiveGroup) {
|
|
455
|
+ var count = $('#'+outcomeDiv).data('value');
|
|
456
|
+ var allOutcomes =[];
|
|
457
|
+
|
|
458
|
+ $("#" + outcomeDiv + ' select').each(function() {
|
|
459
|
+ allOutcomes.push( this.value);
|
|
460
|
+
|
|
461
|
+ })
|
|
462
|
+ var allObjectives = [];
|
|
463
|
+ $("#" + objectiveGroup + ' select').each(function() {
|
|
464
|
+ var temp = {
|
|
465
|
+ id: this.id,
|
|
466
|
+ value: this.value
|
|
467
|
+ }
|
|
468
|
+ allObjectives.push(temp);
|
|
469
|
+ })
|
601
|
470
|
|
602
|
471
|
|
603
|
472
|
$.post(
|
604
|
473
|
"{{ URL::action('CriteriaController@fetchObjectivesForSelect') }}", {
|
605
|
|
- id: id
|
|
474
|
+ allOutcomes: allOutcomes
|
606
|
475
|
},
|
607
|
476
|
|
608
|
477
|
function(json) {
|
609
|
478
|
|
610
|
|
- var optionName = '<optgroup id="' + 'Associated_Outcome' + (assocOutcomeCounter - 1).toString() + '"label="' + 'Associated Outcome' + (assocOutcomeCounter).toString() + '"';
|
611
|
|
- for (var i = 0; i < json.length; i++) {
|
612
|
|
- var option = '<option value ="' + json[i].id.toString() + '">' + json[i].text + '</option>'
|
613
|
|
- optionName += (option)
|
614
|
|
-
|
615
|
|
- }
|
616
|
|
- optGroup = document.getElementById('Associated_Outcome' + (assocOutcomeCounter - 1).toString());
|
617
|
|
- if (optGroup != null) {
|
618
|
|
- optGroup.remove()
|
|
479
|
+ optionName = '';
|
|
480
|
+ for(outcome in varArray.outcomes){
|
|
481
|
+ optionName += '<optgroup label="' + varArray.outcomes[outcome][0].name + '"';
|
|
482
|
+ var objectiveForOutcome = varArray.objectives;
|
|
483
|
+ var objectives = objectiveForOutcome[outcome];
|
|
484
|
+ for (objective in objectives) {
|
|
485
|
+
|
619
|
486
|
|
|
487
|
+ var obj= objectives[objective];
|
|
488
|
+ var option = '<option value ="' + obj.id + '">' +obj.text + '</option>';
|
|
489
|
+ optionName += (option);
|
|
490
|
+ }
|
620
|
491
|
}
|
621
|
492
|
|
622
|
493
|
|
623
|
|
- $('#assoc_objective_0').append(optionName);
|
|
494
|
+ $('#assoc_objective_0').html(optionName);
|
624
|
495
|
$('#assoc_objective_0').selectpicker('refresh');
|
|
496
|
+ if($("#assoc_objective_0 option[value='"+allObjectives[0].value+"']").length>0){
|
|
497
|
+ $("#assoc_objective_0").val(allObjectives[0].value);
|
|
498
|
+ $('#assoc_objective_0').selectpicker('refresh');
|
|
499
|
+ }
|
625
|
500
|
|
626
|
|
- for (var i = assocObjectiveCounter - 1; i > 0; i--) {
|
627
|
|
- deleteObjective('assoc_objectiveForm' + i.toString(), 'assoc_closeObj' + i.toString())
|
|
501
|
+ for (var i = allObjectives.length - 1; i > 0; i--) {
|
|
502
|
+ deleteObjective('assoc_objectiveForm' + i.toString(), 'assoc_closeObj' + i.toString(), 'assoc_objectiveGroup');
|
|
503
|
+ }
|
|
504
|
+ for(var i=1; i<allObjectives.length; i++){
|
|
505
|
+ addAssocObjective();
|
|
506
|
+ $('#assoc_objective_'+i.toString()).selectpicker('refresh');
|
|
507
|
+ if($("#assoc_objective_"+i.toString()+" option[value='"+allObjectives[i].value+"']").length>0){
|
|
508
|
+ $("#assoc_objective_"+i.toString()).val(allObjectives[i].value);
|
|
509
|
+ $("#assoc_objective_"+i.toString()).selectpicker("refresh");
|
|
510
|
+ }
|
628
|
511
|
}
|
629
|
|
- assocObjectiveCounter = 1;
|
630
|
512
|
|
631
|
513
|
|
632
|
514
|
|
|
@@ -708,7 +590,7 @@ $('.filterSection').hide();
|
708
|
590
|
}
|
709
|
591
|
//after post
|
710
|
592
|
|
711
|
|
- fetchAllCriterion("select-program", "assoc_outcomes_fetch");
|
|
593
|
+
|
712
|
594
|
//For editing criterion
|
713
|
595
|
function fetchAllCriterion(program, outcome) {
|
714
|
596
|
var program_id_fetch = $('#' + program).find(':selected').val();
|
|
@@ -758,10 +640,11 @@ $('.filterSection').hide();
|
758
|
640
|
|
759
|
641
|
if (!(json.activity_criterion.length)) {
|
760
|
642
|
|
761
|
|
- var button = "<button type='button' class ='btn btn-primary btn-block' onclick ='deleteCriterion()'>Delete Criterion</button><br><br>"
|
762
|
|
- $('#delete').html(button)
|
|
643
|
+$('#DeleteButton').prop('enabled', true);
|
763
|
644
|
|
764
|
|
- }
|
|
645
|
+} else {
|
|
646
|
+$('#DeleteButton').prop('disabled', true);
|
|
647
|
+}
|
765
|
648
|
|
766
|
649
|
if (!(json.criteria.length)) {
|
767
|
650
|
name = ' ';
|
|
@@ -777,9 +660,16 @@ $('.filterSection').hide();
|
777
|
660
|
var name = json.criteria[0].name;
|
778
|
661
|
if (json.criteria[0].subcriteria) {
|
779
|
662
|
subcriteria = JSON.parse(json.criteria[0].subcriteria).join('\n');
|
|
663
|
+ }else {
|
|
664
|
+ subcriteria = "";
|
780
|
665
|
}
|
781
|
|
- var copyright = json.criteria[0].copyright;
|
782
|
|
- var notes = json.criteria[0].notes;
|
|
666
|
+ if (json.criteria[0].copyright) {
|
|
667
|
+ var copyright = json.criteria[0].copyright;
|
|
668
|
+ } else {
|
|
669
|
+ var copyright = ''
|
|
670
|
+ }
|
|
671
|
+ if (json.criteria[0].notes) notes = json.criteria[0].notes;
|
|
672
|
+ else notes = '';
|
783
|
673
|
|
784
|
674
|
// Display info
|
785
|
675
|
$('#criterion_name').val(name);
|
|
@@ -796,16 +686,12 @@ $('.filterSection').hide();
|
796
|
686
|
}
|
797
|
687
|
|
798
|
688
|
|
799
|
|
- if (copyright) {
|
|
689
|
+
|
800
|
690
|
$('#criterion_copyright').text(copyright);
|
801
|
|
- } else {
|
802
|
|
- $('#criterion_copyright').text('');
|
803
|
|
- }
|
804
|
|
- if (notes) {
|
|
691
|
+
|
|
692
|
+
|
805
|
693
|
$('#criterion_notes').text(notes);
|
806
|
|
- } else {
|
807
|
|
- $('#criterion_notes').text('');
|
808
|
|
- }
|
|
694
|
+
|
809
|
695
|
|
810
|
696
|
|
811
|
697
|
|
|
@@ -814,6 +700,7 @@ $('.filterSection').hide();
|
814
|
700
|
|
815
|
701
|
// Select associated outcome
|
816
|
702
|
try {
|
|
703
|
+ assocOutcomeCounter= parseInt($("#assocOutcomeGroup").data('value'));
|
817
|
704
|
for (var i = assocOutcomeCounter - 1; i > 0; i--) {
|
818
|
705
|
deleteLast("assoc_outcomeForm" + i.toString() , "assocOutcomeGroup", "assoc_close" + i.toString() ,"assoc_objectiveGroup");
|
819
|
706
|
}
|
|
@@ -838,17 +725,17 @@ $('.filterSection').hide();
|
838
|
725
|
|
839
|
726
|
}
|
840
|
727
|
|
841
|
|
-
|
|
728
|
+ counterObj =$('#assoc_objectiveGroup').data('value');
|
842
|
729
|
|
843
|
730
|
|
844
|
731
|
try {
|
845
|
732
|
for (var i = counterObj - 1; i > 0; i--) {
|
846
|
|
- deleteObjective('objectiveForm' + i.toString(), 'closeObj' + i.toString())
|
|
733
|
+ deleteObjective('assoc_objectiveForm' + i.toString(), 'assoc_closeObj' + i.toString(), 'assoc_objectiveGroup')
|
847
|
734
|
}
|
848
|
735
|
} catch (err) {
|
849
|
736
|
var noEntro = true;
|
850
|
737
|
}
|
851
|
|
- counterObj = 1;
|
|
738
|
+ $('#assoc_objectiveGroup').data('value', 1);
|
852
|
739
|
|
853
|
740
|
|
854
|
741
|
|
|
@@ -856,32 +743,27 @@ $('.filterSection').hide();
|
856
|
743
|
|
857
|
744
|
assocOutcomeCounter = 0;
|
858
|
745
|
var i = 0;
|
859
|
|
- for (var j = 0; j < json.outcomes.length; j++) {
|
860
|
|
- assocOutcomeCounter += 1;
|
861
|
|
- var optionName = '<optgroup id="' + 'Associated_Outcome' + (assocOutcomeCounter - 1).toString() + '"label="' + json.outcomes[j].name + '"';
|
862
|
|
- for (; i < json.objectives_outcome.length; i++) {
|
863
|
|
- if (json.objectives_outcome[i].outcome_id != json.outcomes[j].id) break;
|
864
|
|
-
|
865
|
|
- var option = '<option value ="' + json.objectives_outcome[i].id.toString() + '">' + json.objectives_outcome[i].text + '</option>'
|
866
|
|
- optionName += (option)
|
867
|
|
-
|
868
|
|
- }
|
869
|
|
- optGroup = document.getElementById('Associated_Outcome' + (assocOutcomeCounter - 1).toString());
|
870
|
|
- if (optGroup != null) {
|
871
|
|
- optGroup.remove()
|
|
746
|
+ optionName = '';
|
|
747
|
+ for(outcome in json.outcomes_assoc){
|
|
748
|
+ optionName += '<optgroup label="' + json.outcomes_assoc[outcome][0].name + '"';
|
|
749
|
+ var objectiveForOutcome = json.objectives_assoc;
|
|
750
|
+ var objectives = objectiveForOutcome[outcome];
|
|
751
|
+ for (objective in objectives) {
|
|
752
|
+
|
872
|
753
|
|
|
754
|
+ var obj= objectives[objective];
|
|
755
|
+ var option = '<option value ="' + obj.id + '">' +obj.text + '</option>';
|
|
756
|
+ optionName += (option);
|
873
|
757
|
}
|
874
|
|
- $('#assoc_objective_0').append(optionName);
|
875
|
|
- $('#assoc_objective_0').selectpicker('refresh');
|
876
|
758
|
}
|
|
759
|
+ $('#assoc_objective_0').html(optionName);
|
877
|
760
|
|
|
761
|
+ $('#assoc_objective_0').selectpicker('refresh');
|
878
|
762
|
|
879
|
763
|
|
880
|
764
|
|
881
|
|
- for (var i = assocObjectiveCounter - 1; i > 0; i--) {
|
882
|
|
- deleteObjective('assoc_objectiveForm' + i.toString(), 'assoc_closeObj' + i.toString())
|
883
|
|
- }
|
884
|
|
- assocObjectiveCounter = 1;
|
|
765
|
+
|
|
766
|
+
|
885
|
767
|
|
886
|
768
|
|
887
|
769
|
|
|
@@ -903,8 +785,7 @@ $('.filterSection').hide();
|
903
|
785
|
$('#assoc_objective_' + i.toString()).val(json.objectives[i].id);
|
904
|
786
|
$('#assoc_objective_' + i.toString()).selectpicker('refresh');
|
905
|
787
|
}
|
906
|
|
- assocObjectiveCounter = json.objectives.length;
|
907
|
|
-
|
|
788
|
+ $('assoc_objectiveGroup').data('value',json.objectives.length);
|
908
|
789
|
|
909
|
790
|
|
910
|
791
|
|
|
@@ -916,62 +797,7 @@ $('.filterSection').hide();
|
916
|
797
|
// Select status
|
917
|
798
|
|
918
|
799
|
|
919
|
|
- scaleLength = json.scales.length;
|
920
|
|
- fullDiv = '';
|
921
|
|
- if (!scaleLength) {
|
922
|
|
- div = '<div id="assoc_eval 0"">' +
|
923
|
|
- '<div class ="form-row">' +
|
924
|
|
- '<label for="header0">Evaluación 1</label><br><br>' +
|
925
|
|
- '<input type="hidden" id="header0">' +
|
926
|
|
- '<div class="form-group col-md-8" >' +
|
927
|
|
- '<label for="title0">Nombre de Evaluación 1</label>' +
|
928
|
|
- '<input class="form-control" name="assoc_title[]" value =" "type="text" id="title0" placeholder ="Nombre de evaluacion" ></div>' +
|
929
|
|
- '<div class ="form-group col-md-2">' +
|
930
|
|
- '<label for="min0">Mínimo </label>' +
|
931
|
|
- '<input class="form-control" type="number" id="assoc_min0" min="1" max = "1" value =" " name = "assoc_min[]"></div>' +
|
932
|
|
- '<div class ="form-group col-md-2">' +
|
933
|
|
- '<label for="max">Máximo </label>' +
|
934
|
|
- '<input class="form-control" type="number" id="assoc_max" min="1" max = "" value =" " name = "assoc_max[]"></div></div>' +
|
935
|
|
- '<div class ="form-group">' +
|
936
|
|
- '<label for ="descripcion">Descripción de evaluación</label>' +
|
937
|
|
- '<textarea class="form-control" rows="2" aria-labelledby="descripcion" name="assoc_scales[]" cols="50" ></textarea></div></div>';
|
938
|
|
- fullDiv += div;
|
939
|
|
- } else {
|
940
|
|
- var dataValue = parseInt($('#Assoc_Scales').attr('data-value'));
|
941
|
|
- $('#assoc_maximum_score').val(json.criteria[0].maximum_score);
|
942
|
|
- var maximum = json.criteria[0].maximum_score;
|
943
|
|
-
|
944
|
|
-
|
945
|
|
- $('#Assoc_Scales').html(' ');
|
946
|
|
- for (var i = 0; i < scaleLength; i++) {
|
947
|
|
-
|
948
|
|
- div = '<div id="assoc_eval' + i.toString() + '">' +
|
949
|
|
- '<div class ="form-row">' +
|
950
|
|
- '<label for="header' + (i).toString() + '">Evaluación ' + (i + 1).toString() + '</label><br><br>' +
|
951
|
|
- '<input type="hidden" id="header' + i.toString() + '">' +
|
952
|
|
- '<div class="form-group col-md-8" >' +
|
953
|
|
- '<label for="title' + i.toString() + '">Nombre de Evaluación ' + (i + 1).toString() + '</label>' +
|
954
|
|
- '<input class="form-control" name="assoc_title[]" value ="' + json.scales[i].title + '"type="text" id="title' + i.toString() + '" placeholder ="Nombre de evaluacion" ></div>' +
|
955
|
|
- '<div class ="form-group col-md-2">' +
|
956
|
|
- '<label for="min' + i.toString() + '">Mínimo </label>' +
|
957
|
|
- '<input class="form-control" type="number" id="assoc_min' + i.toString() + '" min="1" max = "' + maximum + '" value ="' + json.scales[i].min_score + '"oninput ="changedMin(' + "'assoc_min" + i.toString() + "', '" + i.toString() + "', 'Assoc_Scales' " + ')" name = "assoc_min[]"></div>' +
|
958
|
|
- '<div class ="form-group col-md-2">' +
|
959
|
|
- '<label for="max' + i.toString() + '">Máximo </label>' +
|
960
|
|
- '<input class="form-control" type="number" id="assoc_max' + i.toString() + '" min="1" max = "' + maximum + '" value ="' + json.scales[i].max_score + '"oninput ="changedMax(' + "'assoc_max" + i.toString() + "', '" + i.toString() + "', 'Assoc_Scales' " + ')" name = "assoc_max[]"></div></div>' +
|
961
|
|
- '<div class ="form-group">' +
|
962
|
|
- '<label for ="descripcion' + i.toString() + '">Descripción de evaluación</label>' +
|
963
|
|
- '<textarea class="form-control" rows="2" aria-labelledby="descripcion' + i.toString() + '" name="assoc_scales[]" cols="50" >' + json.scales[i].description + '</textarea></div></div>';
|
964
|
|
- fullDiv += div;
|
965
|
|
-
|
966
|
|
- }
|
967
|
|
- }
|
968
|
|
-
|
969
|
|
- addOptions('Num_assoc_scale', 'assoc_maximum_score');
|
970
|
|
-
|
971
|
|
- $('#Assoc_Scales').append(fullDiv);
|
972
|
|
- $('#Assoc_Scales').attr('data-value', scaleLength);
|
973
|
|
- $('#Num_assoc_scale').val(scaleLength);
|
974
|
|
- $('#Num_assoc_scale').selectpicker('refresh')
|
|
800
|
+
|
975
|
801
|
|
976
|
802
|
|
977
|
803
|
|
|
@@ -1000,7 +826,7 @@ fetchObjectiveForSelect('outcomeGroup', 'objectiveGroup');
|
1000
|
826
|
// setCriterionStatus();
|
1001
|
827
|
|
1002
|
828
|
|
1003
|
|
-
|
|
829
|
+fetchAllCriterion("select-program", "assoc_outcomes_fetch");
|
1004
|
830
|
|
1005
|
831
|
// --------------------------------------------------------------------------
|
1006
|
832
|
// Functions
|
|
@@ -1053,10 +879,10 @@ $('.panel-group .panel-heading').on('click', function()
|
1053
|
879
|
$(this).next().stop().slideToggle();
|
1054
|
880
|
})
|
1055
|
881
|
|
1056
|
|
-$('#outcome[0]').on('change', function(){
|
|
882
|
+//$('#outcome[0]').on('change', function(){
|
1057
|
883
|
|
1058
|
|
-$('.selectpicker').selectpicker('refresh');
|
1059
|
|
-})
|
|
884
|
+//$('.selectpicker').selectpicker('refresh');
|
|
885
|
+//})
|
1060
|
886
|
// When list item is clicked, load corresponding info
|
1061
|
887
|
|
1062
|
888
|
|