|
@@ -119,7 +119,7 @@
|
119
|
119
|
Edit
|
120
|
120
|
</div>
|
121
|
121
|
<div class="panel-body">
|
122
|
|
- {{ Form::open(array('action' => 'CriteriaController@update')) }}
|
|
122
|
+ {{ Form::open(array('action' => 'CriteriaController@update','id'=>'update_criterion')) }}
|
123
|
123
|
<button class="btn btn-md btn-secondary filterButton">
|
124
|
124
|
<span class="glyphicon glyphicon-plus">
|
125
|
125
|
</span>
|
|
@@ -163,7 +163,7 @@
|
163
|
163
|
<div id='assocOutcomeGroup0' data-value="1">
|
164
|
164
|
<div class="form-group col-md-12">
|
165
|
165
|
<label>Outcome 1</label>
|
166
|
|
- {{ Form::select('outcome[]', $outcomes, null, ['class'=>'form-control selectpicker', 'id'=>'assoc_outcome_0', 'onchange'=>'fetchAssocObjective("assoc_outcome_0")']) }}
|
|
166
|
+ {{ Form::select('outcome[]', $outcomes, null, ['class'=>'form-control selectpicker', 'id'=>'assoc_outcome_0', 'onchange'=>'fetchObjectiveForSelect("assoc_outcome_0", "assoc_objectiveGroupFor0")']) }}
|
167
|
167
|
|
168
|
168
|
</div>
|
169
|
169
|
<div id='assoc_objectiveGroupFor0' data-value="1">
|
|
@@ -549,8 +549,8 @@ function addOutcomeTest() {
|
549
|
549
|
$div.remove();
|
550
|
550
|
$div = document.getElementById(closeObj);
|
551
|
551
|
$div.remove();
|
552
|
|
- //counter = parseInt($('#'+objectiveGroup).data("value"));
|
553
|
|
- //$('#'+objectiveGroup).data("value", counter-1);
|
|
552
|
+ counter = parseInt($('#'+objectiveGroup).data("value"));
|
|
553
|
+ $('#'+objectiveGroup).data("value", counter-1);
|
554
|
554
|
|
555
|
555
|
|
556
|
556
|
}
|
|
@@ -653,7 +653,7 @@ function addOutcomeTest() {
|
653
|
653
|
'name': "outcome[]",
|
654
|
654
|
'data-live-search': 'true',
|
655
|
655
|
'id': 'assoc_outcome_' + assocOutcomeCounter.toString(),
|
656
|
|
- 'onchange': 'fetchAssocObjective("assoc_outcome_' + assocOutcomeCounter.toString() + '", "assoc_objectiveGroupFor'+assocOutcomeCounter+'")'
|
|
656
|
+ 'onchange': 'fetchObjectiveForSelect("assoc_outcome_' + assocOutcomeCounter.toString() + '", "assoc_objectiveGroupFor'+assocOutcomeCounter+'")'
|
657
|
657
|
|
658
|
658
|
});
|
659
|
659
|
var $div = $('<div/>', {
|
|
@@ -763,7 +763,7 @@ function addOutcomeTest() {
|
763
|
763
|
allOutcomes: allOutcomes
|
764
|
764
|
},
|
765
|
765
|
|
766
|
|
- function(json) {
|
|
766
|
+ function(varArray) {
|
767
|
767
|
|
768
|
768
|
optionName = '<option value ="0">Nothing Selected</option>';
|
769
|
769
|
for(outcome in varArray.outcomes){
|
|
@@ -789,16 +789,16 @@ function addOutcomeTest() {
|
789
|
789
|
}
|
790
|
790
|
|
791
|
791
|
for (var i = allObjectives.length - 1; i > 0; i--) {
|
792
|
|
- deleteObjective('assoc_objectiveForm' + i.toString(), 'assoc_closeObj' + i.toString(), 'assoc_objectiveGroup');
|
793
|
|
- }
|
794
|
|
- for(var i=1; i<allObjectives.length; i++){
|
|
792
|
+ deleteObjective('assoc_objectiveForm_' + objectiveGroup +'_'+i, 'assoc_closeObj_'+objectiveGroup+'_' + i.toString(), objectiveGroup);
|
|
793
|
+ }
|
|
794
|
+ /* for(var i=1; i<allObjectives.length; i++){
|
795
|
795
|
addAssocObjective();
|
796
|
796
|
$('#assoc_objective_'+i.toString()).selectpicker('refresh');
|
797
|
797
|
if($("#assoc_objective_"+i.toString()+" option[value='"+allObjectives[i].value+"']").length>0){
|
798
|
798
|
$("#assoc_objective_"+i.toString()).val(allObjectives[i].value);
|
799
|
799
|
$("#assoc_objective_"+i.toString()).selectpicker("refresh");
|
800
|
800
|
}
|
801
|
|
- }
|
|
801
|
+ }*/
|
802
|
802
|
|
803
|
803
|
|
804
|
804
|
|
|
@@ -935,10 +935,25 @@ function addOutcomeTest() {
|
935
|
935
|
"{{ URL::action('CriteriaController@fetchCriterionWithTrashed') }}", {
|
936
|
936
|
id: id
|
937
|
937
|
},
|
938
|
|
- function(json) {
|
|
938
|
+ function(criterion) {
|
|
939
|
+
|
|
940
|
+
|
|
941
|
+if (!(criterion.length)) {
|
|
942
|
+ name = ' ';
|
|
943
|
+ var subcriteria = '';
|
|
944
|
+ copyright = null;
|
|
945
|
+ notes = null;
|
|
946
|
+ $('#status').val(0);
|
|
947
|
+ maximum = 1;
|
|
948
|
+ $('#assoc_maximum_score').val(1);
|
939
|
949
|
|
940
|
|
- if (!(json.activity_criterion.length)) {
|
941
|
950
|
|
|
951
|
+}
|
|
952
|
+
|
|
953
|
+
|
|
954
|
+else {
|
|
955
|
+criterion = criterion[0];
|
|
956
|
+if (!(criterion.activity_criterion.length)) {
|
942
|
957
|
$('#DeleteButton').prop('disabled', false);
|
943
|
958
|
$("#update_the_criterion").val('Update');
|
944
|
959
|
$("#update_criterion").attr('action', "{{ URL::action('CriteriaController@update')}}")
|
|
@@ -952,48 +967,38 @@ $('#alert_placeholder').html('<div class="alert alert-danger alert-dismissible"
|
952
|
967
|
|
953
|
968
|
}
|
954
|
969
|
|
955
|
|
- if (!(json.criteria.length)) {
|
956
|
|
- name = ' ';
|
957
|
|
- var subcriteria = '';
|
958
|
|
- copyright = null;
|
959
|
|
- notes = null;
|
960
|
|
- $('#status').val(0);
|
961
|
|
- maximum = 1;
|
962
|
|
- $('#assoc_maximum_score').val(1);
|
963
|
|
-
|
964
|
|
-
|
965
|
|
- } else {
|
966
|
|
- var name = json.criteria[0].name;
|
967
|
|
- if (json.criteria[0].subcriteria) {
|
968
|
|
- subcriteria = JSON.parse(json.criteria[0].subcriteria).join('\n');
|
969
|
|
- } else {
|
|
970
|
+
|
|
971
|
+var name = criterion.name;
|
|
972
|
+ if (criterion.subcriteria) {
|
|
973
|
+ subcriteria = JSON.parse(criterion.subcriteria).join('\n');
|
|
974
|
+ } else {
|
970
|
975
|
subcriteria = "";
|
971
|
976
|
}
|
972
|
|
- if (json.criteria[0].copyright) {
|
973
|
|
- var copyright = json.criteria[0].copyright;
|
|
977
|
+ if (criterion.copyright) {
|
|
978
|
+ var copyright = criterion.copyright;
|
974
|
979
|
} else {
|
975
|
980
|
var copyright = ''
|
976
|
981
|
}
|
977
|
|
- if (json.criteria[0].notes) notes = json.criteria[0].notes;
|
978
|
|
- else notes = '';
|
|
982
|
+ if (criterion.notes) notes = criterion.notes;
|
|
983
|
+ else notes = '';
|
979
|
984
|
|
980
|
985
|
// Display info
|
981
|
986
|
$('#criterion_name').val(name);
|
982
|
987
|
$('#criterion_subcriteria').text(subcriteria);
|
983
|
|
- if (json.criteria[0].deleted_at)
|
984
|
|
- $('#status').val(0);
|
|
988
|
+ if (criterion.deleted_at)
|
|
989
|
+ $('#status').val(0);
|
985
|
990
|
else
|
986
|
991
|
$('#status').val(1);
|
987
|
|
- $('#assoc_maximum_score').val(json.criteria[0].maximum_score);
|
988
|
|
- var maximum = json.criteria[0].maximum_score;
|
|
992
|
+ $('#assoc_maximum_score').val(criterion.max_score);
|
|
993
|
+ var maximum = criterion.max_score;
|
989
|
994
|
|
990
|
995
|
addOptions("Num_assoc_scale", "assoc_maximum_score", "Assoc_Scales");
|
991
|
|
- $('#Num_assoc_scale').val(json.criteria[0].num_scales)
|
992
|
|
- $('#Num_assoc_scale').selectpicker('refresh');
|
|
996
|
+ $('#Num_assoc_scale').val(criterion.num_scales)
|
|
997
|
+ $('#Num_assoc_scale').selectpicker('refresh');
|
993
|
998
|
$('#Num_assoc_scale').trigger('change');
|
994
|
999
|
|
995
|
|
- for(i=0; i<json.criteria[0].num_scales;i++){
|
996
|
|
- $('#assoc_scale_'+i).val(json.scales[i].description);
|
|
1000
|
+ for(i=0; i<criterion.num_scales;i++){
|
|
1001
|
+ $('#assoc_scale_'+i).val(criterion.scales[i].description);
|
997
|
1002
|
}
|
998
|
1003
|
// If copyright or notes aren't empty, load them
|
999
|
1004
|
|
|
@@ -1014,8 +1019,8 @@ $('#alert_placeholder').html('<div class="alert alert-danger alert-dismissible"
|
1014
|
1019
|
|
1015
|
1020
|
// Select associated outcome
|
1016
|
1021
|
try {
|
1017
|
|
- assocOutcomeCounter= parseInt($("#assocOutcomeGroup0").data('value'));
|
1018
|
|
- for (var i = assocOutcomeCounter - 1; i > 0; i--) {
|
|
1022
|
+ assocOutcomeCounter = parseInt($("#assocOutcomeGroup0").data('value'));
|
|
1023
|
+ for (var i = assocOutcomeCounter - 1; i > 0; i--) {
|
1019
|
1024
|
$('#assoc_close_button'+i).click();
|
1020
|
1025
|
}
|
1021
|
1026
|
$('#assocOutcomeGroup0').data('value', 1);
|
|
@@ -1023,36 +1028,45 @@ $('#alert_placeholder').html('<div class="alert alert-danger alert-dismissible"
|
1023
|
1028
|
var Notran = true;
|
1024
|
1029
|
}
|
1025
|
1030
|
|
1026
|
|
- if (json.outcomes.length)
|
|
1031
|
+ if (criterion.outcomes.length)
|
1027
|
1032
|
{
|
1028
|
|
- $('#assoc_outcome_0').val(json.outcomes[0].id);
|
1029
|
|
- $('#assoc_outcome_0').selectpicker('refresh');
|
|
1033
|
+ $('#assoc_outcome_0').val(criterion.outcomes[0].id);
|
|
1034
|
+ $('#assoc_outcome_0').selectpicker('refresh');
|
1030
|
1035
|
|
1031
|
|
- var first_outcome_id = json.outcomes[0].id;
|
|
1036
|
+ var first_outcome = criterion.outcomes[0];
|
1032
|
1037
|
options = "<option value ='0'>Nothing Selected</option>";
|
|
1038
|
+ $(first_outcome.assoc_objectives).each(function(index, objective){
|
1033
|
1039
|
|
1034
|
|
- for(objective_index in json.objectives_assoc[first_outcome_id]){
|
|
1040
|
+options += '<option value ="('+first_outcome.id+','+objective.objective_id+')">'+
|
|
1041
|
+ objective.text+'</option>';
|
|
1042
|
+
|
|
1043
|
+})
|
|
1044
|
+ /*for(objective_index in json.objectives_assoc[first_outcome_id]){
|
1035
|
1045
|
objective = json.objectives_assoc[first_outcome_id][objective_index]
|
1036
|
1046
|
options += '<option value ="('+first_outcome_id+','+objective.objective_id+')">'+
|
1037
|
1047
|
objective.text+'</option>';
|
1038
|
|
- }
|
|
1048
|
+ }*/
|
1039
|
1049
|
$('#assoc_objective_0_counter_1').html(options);
|
1040
|
1050
|
$('#assoc_objective_0_counter_1').selectpicker('refresh');
|
1041
|
1051
|
|
1042
|
|
- if(json.objectives[first_outcome_id].length){
|
1043
|
|
- objective_id = json.objectives[first_outcome_id][0].objective_id;
|
1044
|
|
- value = '('+first_outcome_id+','+objective_id+')';
|
|
1052
|
+ if(first_outcome.objectives_criteria.length){
|
|
1053
|
+ objective_id = first_outcome.objectives_criteria[0].objective_id;
|
|
1054
|
+ value = '('+first_outcome.id+','+objective_id+')';
|
1045
|
1055
|
$('#assoc_objective_0_counter_1').val(value);
|
1046
|
1056
|
$('#assoc_objective_0_counter_1').selectpicker('refresh');
|
1047
|
1057
|
|
1048
|
1058
|
}
|
1049
|
|
-
|
|
1059
|
+ if($("#assoc_objectiveGroupFor0").find(".btn-primary").length>0){
|
|
1060
|
+ $("#assoc_objectiveGroupFor0").find(".btn-primary").each(function(){
|
|
1061
|
+ $(this).click()
|
|
1062
|
+ })
|
|
1063
|
+ }
|
1050
|
1064
|
|
1051
|
|
- for(var i =1; i<json.objectives[first_outcome_id].length; i++ ){
|
|
1065
|
+ for(var i =1; i<first_outcome.objectives_criteria.length; i++ ){
|
1052
|
1066
|
addAssocObjective("assoc_objectiveGroupFor0", "assoc_objective_0");
|
1053
|
|
- objective_id = json.objectives[first_outcome_id][i].objective_id;
|
1054
|
|
- value = "("+first_outcome_id+","+objective_id+")";
|
1055
|
|
- $('#assoc_objective_0_counter_'+(i+1)).val(value);
|
|
1067
|
+ objective_id = first_outcome.objectives_criteria[i].objective_id;
|
|
1068
|
+ value = "("+first_outcome.id+","+objective_id+")";
|
|
1069
|
+ $('#assoc_objective_0_counter_'+(i+1)).val(value);
|
1056
|
1070
|
$('#assoc_objective_0_counter_'+(i+1)).selectpicker('refresh');
|
1057
|
1071
|
|
1058
|
1072
|
|
|
@@ -1067,35 +1081,41 @@ $('#alert_placeholder').html('<div class="alert alert-danger alert-dismissible"
|
1067
|
1081
|
|
1068
|
1082
|
|
1069
|
1083
|
|
1070
|
|
- for (var i = 1; i < json.outcomes.length; i++) {
|
|
1084
|
+ for (var i = 1; i < criterion.outcomes.length; i++) {
|
1071
|
1085
|
addAssocOutcome(true);
|
1072
|
1086
|
|
1073
|
1087
|
|
1074
|
|
- $('#assoc_outcome_' + i.toString()).val(json.outcomes[i].id);
|
1075
|
|
- $('#assoc_outcome_' + i.toString()).selectpicker('refresh');
|
|
1088
|
+ $('#assoc_outcome_' + i.toString()).val(criterion.outcomes[i].id);
|
|
1089
|
+ $('#assoc_outcome_' + i.toString()).selectpicker('refresh');
|
1076
|
1090
|
|
1077
|
|
- var outcome_id = json.outcomes[i].id;
|
1078
|
|
- options = "<option value ='0'>Nothing Selected</option>";
|
|
1091
|
+ var outcome = criterion.outcomes[i];
|
|
1092
|
+ options = "<option value ='0'>Nothing Selected</option>";
|
1079
|
1093
|
|
1080
|
|
- for(objective_index in json.objectives_assoc[outcome_id]){
|
1081
|
|
- objective = json.objectives_assoc[outcome_id][objective_index]
|
1082
|
|
- options += '<option value ="('+outcome_id+','+objective.objective_id+')">'+
|
1083
|
|
- objective.text+'</option>';
|
1084
|
|
- }
|
|
1094
|
+ $(outcome.assoc_objectives).each(function(index, objective){
|
|
1095
|
+
|
|
1096
|
+options += '<option value ="('+outcome.id+','+objective.objective_id+')">'+
|
|
1097
|
+ objective.text+'</option>';
|
|
1098
|
+
|
|
1099
|
+})
|
|
1100
|
+ //for(objective_index in json.objectives_assoc[outcome_id]){
|
|
1101
|
+ // objective = json.objectives_assoc[outcome_id][objective_index]
|
|
1102
|
+ // options += '<option value ="('+outcome_id+','+objective.objective_id+')">'+
|
|
1103
|
+ // objective.text+'</option>';
|
|
1104
|
+ //}
|
1085
|
1105
|
$('#assoc_objective_'+i+'_counter_1').html(options);
|
1086
|
1106
|
$('#assoc_objective_'+i+'_counter_1').selectpicker('refresh');
|
1087
|
|
- if(json.objectives[outcome_id].length){
|
1088
|
|
- objective_id = json.objectives[outcome_id][0].objective_id;
|
1089
|
|
- value = "("+outcome_id+","+objective_id+")"
|
1090
|
|
- $('#assoc_objective_'+i+'_counter_1').val(value);
|
|
1107
|
+ if(outcome.objectives_criteria.length){
|
|
1108
|
+ objective_id = outcome.objectives_criteria[0].objective_id;
|
|
1109
|
+ value = "("+outcome.id+","+objective_id+")"
|
|
1110
|
+ $('#assoc_objective_'+i+'_counter_1').val(value);
|
1091
|
1111
|
$('#assoc_objective_'+i+'_counter_1').selectpicker('refresh')
|
1092
|
1112
|
}
|
1093
|
1113
|
|
1094
|
1114
|
|
1095
|
|
- for(var j =1; i<json.objectives[outcome_id].length; i++ ){
|
|
1115
|
+ for(var j =1; j<outcome.objectives_criteria.length; j++ ){
|
1096
|
1116
|
addAssocObjective("assoc_objectiveGroupFor"+i, "assoc_objective_"+i);
|
1097
|
|
- objective_id = json.objectives[outcome_id][j].objective_id;
|
1098
|
|
- value = "("+outcome_id+","+objective_id+")";
|
|
1117
|
+ objective_id =outcome.objectives_criteria[j].objective_id;
|
|
1118
|
+ value = "("+outcome.id+","+objective_id+")";
|
1099
|
1119
|
$('#assoc_objective_'+i+'_counter_'+(j+1)).val(value);
|
1100
|
1120
|
$('#assoc_objective_'+i+'_counter_'+(j+1)).selectpicker('refresh');
|
1101
|
1121
|
|
|
@@ -1169,22 +1189,21 @@ $('#alert_placeholder').html('<div class="alert alert-danger alert-dismissible"
|
1169
|
1189
|
|
1170
|
1190
|
|
1171
|
1191
|
// Select associated program
|
1172
|
|
- var program_length = json.program.length;
|
|
1192
|
+ var program_length = criterion.program.length;
|
1173
|
1193
|
$('input[type=checkbox]').prop('checked', false);
|
1174
|
1194
|
|
1175
|
1195
|
for (var i = 0; i < program_length; i++) {
|
1176
|
|
- $('#assoc_program_id_' + json.program[i].program_id).prop("checked", true);
|
|
1196
|
+ $('#assoc_program_id_' + criterion.program[i].program_id).prop("checked", true);
|
1177
|
1197
|
}
|
1178
|
1198
|
|
1179
|
|
-
|
1180
|
1199
|
// Select status
|
1181
|
1200
|
|
1182
|
1201
|
|
1183
|
1202
|
|
1184
|
1203
|
|
1185
|
1204
|
|
1186
|
|
- },
|
1187
|
|
- 'json'
|
|
1205
|
+ }
|
|
1206
|
+
|
1188
|
1207
|
);
|
1189
|
1208
|
}
|
1190
|
1209
|
</script>@stop
|