|
@@ -151,13 +151,15 @@
|
151
|
151
|
onchange='fetchCriterionForEditing()'>
|
152
|
152
|
@foreach ($criteria as $criterion)
|
153
|
153
|
<option value="{{ $criterion->id }}" data-subtext="
|
154
|
|
-
|
155
|
|
-
|
156
|
|
-
|
157
|
|
-
|
158
|
|
-
|
159
|
|
-
|
160
|
|
- @if ($criterion->program)
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+ @if ($criterion->program)
|
161
|
163
|
[{{ $criterion->program->name }}]
|
162
|
164
|
@endif
|
163
|
165
|
">
|
|
@@ -317,7 +319,8 @@
|
317
|
319
|
what = $(submitter).data('form-id');
|
318
|
320
|
form_id = $(submitter).data('form-id');
|
319
|
321
|
form = $("#" + form_id)
|
320
|
|
- form = $("#" + form_id).children('div')
|
|
322
|
+ form = $("#" + form_id).children('div');
|
|
323
|
+
|
321
|
324
|
|
322
|
325
|
$("#" + form_id).children('.form_validation').each(function(index) {
|
323
|
326
|
//alert($(this).attr('id') + ' ' + index);
|
|
@@ -404,7 +407,7 @@
|
404
|
407
|
} else if ($(this).hasClass('program_form')) {
|
405
|
408
|
checkedboxes = $(this).children('input[type="checkbox"]:checked').length;
|
406
|
409
|
if (!checkedboxes) {
|
407
|
|
- var timer;
|
|
410
|
+
|
408
|
411
|
|
409
|
412
|
alert = $('<div/>', {
|
410
|
413
|
'class': 'alert alert-danger alert-dismissible',
|
|
@@ -422,12 +425,13 @@
|
422
|
425
|
$(this).prepend(alert);
|
423
|
426
|
$('html, body').animate({
|
424
|
427
|
scrollTop: $(alert).offset().top
|
425
|
|
- }, 1000);
|
|
428
|
+ }, 300);
|
426
|
429
|
//$(divGroup).focus();
|
427
|
430
|
isEverythingOkay = false;
|
428
|
431
|
}
|
429
|
432
|
|
430
|
433
|
} else if ($(this).hasClass('name_form')) {
|
|
434
|
+
|
431
|
435
|
input = $(this).children('input')[0];
|
432
|
436
|
if ($(input).val() == '') {
|
433
|
437
|
var timer;
|
|
@@ -448,17 +452,92 @@
|
448
|
452
|
$(this).prepend(alert);
|
449
|
453
|
$('html, body').animate({
|
450
|
454
|
scrollTop: $(alert).offset().top
|
451
|
|
- }, 1000);
|
|
455
|
+ }, 300);
|
452
|
456
|
//$(divGroup).focus();
|
453
|
457
|
isEverythingOkay = false;
|
454
|
458
|
}
|
455
|
459
|
|
456
|
460
|
} else if ($(this).hasClass('maximum_form')) {
|
|
461
|
+ input = $(this).children('input')[0];
|
|
462
|
+ if (isNaN($(input).val())) {
|
|
463
|
+ alert = $('<div/>', {
|
|
464
|
+ 'class': 'alert alert-danger alert-dismissible',
|
|
465
|
+ 'role': 'alert'
|
|
466
|
+ })
|
|
467
|
+ button = $('<button/>', {
|
|
468
|
+ 'type': 'button',
|
|
469
|
+ 'class': 'close',
|
|
470
|
+ 'data-dismiss': 'alert',
|
|
471
|
+ 'alert-label': 'close'
|
|
472
|
+ }).html('<span aria-hidden="true">×</span>');
|
|
473
|
+ alert.append(button);
|
|
474
|
+ alert.append('<strong>Write a valid number for maximum score</strong>')
|
457
|
475
|
|
|
476
|
+ $(this).prepend(alert);
|
|
477
|
+ $('html, body').animate({
|
|
478
|
+ scrollTop: $(alert).offset().top
|
|
479
|
+ }, 300);
|
|
480
|
+ //$(divGroup).focus();
|
|
481
|
+ isEverythingOkay = false;
|
|
482
|
+ }
|
458
|
483
|
|
459
|
|
- } else if ($(this).hasClass('scales_form')) {
|
460
|
484
|
|
461
|
485
|
} else if ($(this).hasClass('number_of_scales')) {
|
|
486
|
+ btn_group = $(this).children('div.btn-group')[0];
|
|
487
|
+ select = $(btn_group).children('select')[0];
|
|
488
|
+ if (isNaN($(select).val())) {
|
|
489
|
+
|
|
490
|
+ alert = $('<div/>', {
|
|
491
|
+ 'class': 'alert alert-danger alert-dismissible',
|
|
492
|
+ 'role': 'alert'
|
|
493
|
+ })
|
|
494
|
+ button = $('<button/>', {
|
|
495
|
+ 'type': 'button',
|
|
496
|
+ 'class': 'close',
|
|
497
|
+ 'data-dismiss': 'alert',
|
|
498
|
+ 'alert-label': 'close'
|
|
499
|
+ }).html('<span aria-hidden="true">×</span>');
|
|
500
|
+ alert.append(button);
|
|
501
|
+ alert.append('<strong>Select a valid number</strong>')
|
|
502
|
+
|
|
503
|
+ $(this).prepend(alert);
|
|
504
|
+ $('html, body').animate({
|
|
505
|
+ scrollTop: $(alert).offset().top
|
|
506
|
+ }, 300);
|
|
507
|
+ //$(divGroup).focus();
|
|
508
|
+ isEverythingOkay = false;
|
|
509
|
+ }
|
|
510
|
+
|
|
511
|
+ } else if ($(this).hasClass('scales_form')) {
|
|
512
|
+
|
|
513
|
+ //amount_of_scales = parseInt($(this).data('value'));
|
|
514
|
+
|
|
515
|
+ $.each($(this).children('div'), function() {
|
|
516
|
+ form_group = $(this).children('div.form-group')[0];
|
|
517
|
+ textarea = $(form_group).children('textarea')[0];
|
|
518
|
+ if ($(textarea).val() == '') {
|
|
519
|
+ alert = $('<div/>', {
|
|
520
|
+ 'class': 'alert alert-danger alert-dismissible',
|
|
521
|
+ 'role': 'alert'
|
|
522
|
+ })
|
|
523
|
+ button = $('<button/>', {
|
|
524
|
+ 'type': 'button',
|
|
525
|
+ 'class': 'close',
|
|
526
|
+ 'data-dismiss': 'alert',
|
|
527
|
+ 'alert-label': 'close'
|
|
528
|
+ }).html('<span aria-hidden="true">×</span>');
|
|
529
|
+ alert.append(button);
|
|
530
|
+ alert.append('<strong>Make sure to fill this scale</strong>')
|
|
531
|
+
|
|
532
|
+ $(form_group).prepend(alert);
|
|
533
|
+ $('html, body').animate({
|
|
534
|
+ scrollTop: $(alert).offset().top
|
|
535
|
+ }, 300);
|
|
536
|
+ //$(divGroup).focus();
|
|
537
|
+ isEverythingOkay = false;
|
|
538
|
+ }
|
|
539
|
+ })
|
|
540
|
+
|
462
|
541
|
|
463
|
542
|
} else return;
|
464
|
543
|
|
|
@@ -467,9 +546,9 @@
|
467
|
546
|
})
|
468
|
547
|
|
469
|
548
|
|
470
|
|
- //BORRAR
|
471
|
|
- //if (!isEverythingOkay)
|
472
|
|
- e.preventDefault();
|
|
549
|
+
|
|
550
|
+ if (!isEverythingOkay)
|
|
551
|
+ e.preventDefault();
|
473
|
552
|
|
474
|
553
|
|
475
|
554
|
} else e.preventDefault();
|
|
@@ -486,11 +565,17 @@
|
486
|
565
|
visibleProgram["allAssocOutcomes"] = {}
|
487
|
566
|
visibleProgram["allOutcomes"] = {}
|
488
|
567
|
|
|
568
|
+
|
489
|
569
|
function visiblePrograms(allOutcomesDiv) {
|
|
570
|
+ checkedPrograms = {}
|
490
|
571
|
$('#' + allOutcomesDiv).parent().find('input:checkbox').each(function(index) {
|
491
|
572
|
|
492
|
573
|
id = $(this).attr('id');
|
493
|
|
- $(this).prop("checked", false);
|
|
574
|
+ if ($(this).is(':checked')) {
|
|
575
|
+ checkedPrograms[$(this).attr('id')] = 1;
|
|
576
|
+ $(this).prop("checked", false);
|
|
577
|
+ }
|
|
578
|
+
|
494
|
579
|
program_id = $(this).val();
|
495
|
580
|
if (!(program_id in visibleProgram[allOutcomesDiv])) {
|
496
|
581
|
visibleProgram[allOutcomesDiv][program_id] = {};
|
|
@@ -502,6 +587,8 @@
|
502
|
587
|
})
|
503
|
588
|
if (allOutcomesDiv == "allOutcomes") {
|
504
|
589
|
$('#' + allOutcomesDiv).parent().find("select[name='objective[]']").each(function(index) {
|
|
590
|
+
|
|
591
|
+ //program_ids in objective
|
505
|
592
|
var the_programs = $(this).find(':selected').data('program-ids');
|
506
|
593
|
if (!the_programs) return;
|
507
|
594
|
|
|
@@ -509,11 +596,21 @@
|
509
|
596
|
for (index in the_programs) {
|
510
|
597
|
program_id = the_programs[index];
|
511
|
598
|
|
|
599
|
+ //if the program_id is inside the visibleProgram scope
|
|
600
|
+ //and the checkbox isnt alread present
|
|
601
|
+
|
512
|
602
|
if (program_id in visibleProgram[allOutcomesDiv] &&
|
513
|
603
|
!($('#program-checkboxes').find('#' + visibleProgram[allOutcomesDiv][program_id][
|
514
|
604
|
'checkbox'
|
515
|
605
|
].attr('id')).val())) {
|
|
606
|
+ //if it was checked, check it again
|
|
607
|
+ id = visibleProgram[allOutcomesDiv][program_id]['checkbox'].attr('id');
|
|
608
|
+ if (checkedPrograms[id]) {
|
|
609
|
+ visibleProgram[allOutcomesDiv][program_id]['checkbox'].prop('checked', true);
|
|
610
|
+ }
|
516
|
611
|
visibleProgram[allOutcomesDiv][program_id]['checkbox'].appendTo('#program-checkboxes');
|
|
612
|
+
|
|
613
|
+
|
517
|
614
|
visibleProgram[allOutcomesDiv][program_id]['label'].appendTo("#program-checkboxes");
|
518
|
615
|
$('#program-checkboxes').append('<br>');
|
519
|
616
|
|
|
@@ -535,8 +632,15 @@
|
535
|
632
|
!($('#assoc-program-checkboxes').find('#' + visibleProgram[allOutcomesDiv][program_id][
|
536
|
633
|
'checkbox'
|
537
|
634
|
].attr('id')).val())) {
|
|
635
|
+
|
|
636
|
+ id = visibleProgram[allOutcomesDiv][program_id]['checkbox'].attr('id');
|
|
637
|
+ if (checkedPrograms[id]) {
|
|
638
|
+ visibleProgram[allOutcomesDiv][program_id]['checkbox'].prop('checked', true);
|
|
639
|
+
|
|
640
|
+ }
|
538
|
641
|
visibleProgram[allOutcomesDiv][program_id]['checkbox'].appendTo(
|
539
|
642
|
'#assoc-program-checkboxes');
|
|
643
|
+
|
540
|
644
|
visibleProgram[allOutcomesDiv][program_id]['label'].appendTo(
|
541
|
645
|
"#assoc-program-checkboxes");
|
542
|
646
|
$('#assoc-program-checkboxes').append('<br>');
|