Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
97 changes: 68 additions & 29 deletions djaopsp/static/js/assess-vue.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Vue.component('campaign-questions-list', {
nbRequiredAnswers: this.$sample ? this.$sample.nbRequiredAnswers : 0,
nbRequiredQuestions: this.$sample ? this.$sample.nbRequiredQuestions : 0,
api_profiles_url: this.$urls.api_profiles,
profilesBySlug: {}
profilesBySlug: {},
}
},
methods: {
Expand Down Expand Up @@ -701,8 +701,15 @@ Vue.component('campaign-questions-list', {
return parseInt(this.vsPeersToggle) > 0;
},
},
watch: {
itemsLoaded: function() {
var vm = this;
vm.$parent.items = vm.items;
}
},
mounted: function() {
var vm = this;
vm.prefix = vm.$parent.$prefix;
$("[id^='toggle-value-summary-']").change(function() {
vm.valueSummaryToggle = $(this).prop('checked');
});
Expand Down Expand Up @@ -758,9 +765,6 @@ Vue.component('scorecard', {
data: function() {
return {
url: this.$urls.survey_api_sample_answers,
api_assessment_freeze: this.$urls.api_assessment_freeze ?
this.$urls.api_assessment_freeze : this._safeUrl(
this.$urls.api_assessment_sample, '/freeze'),
api_assessment_reset: this.$urls.api_assessment_reset ?
this.$urls.api_assessment_reset : this._safeUrl(
this.$urls.api_assessment_sample, '/reset'),
Expand All @@ -772,8 +776,7 @@ Vue.component('scorecard', {
params: {o: ""},
activeTile: null,
summaryPerformance: this.$summary_performance ? this.$summary_performance : [],
freezeAssessmentDisabled: false,
verificationStatus: ""
verificationStatus: "",
}
},
methods: {
Expand Down Expand Up @@ -931,29 +934,6 @@ Vue.component('scorecard', {
row.default_unit.system === 'imperial' ||
row.default_unit.system === 'rank');
},
freezeAssessment: function($event) {
var vm = this;
vm.freezeAssessmentDisabled = true;
vm.reqPost(vm.api_assessment_freeze, {is_frozen: true},
function success(resp) {
vm.freezeAssessmentDisabled = false;
vm.$nextTick(function() {
var modalDialog = jQuery('#complete-assessment.modal');
if( modalDialog ) modalDialog.modal('hide');
if( resp.location ) {
window.location = resp.location;
}
});
},
function error(resp) {
vm.freezeAssessmentDisabled = false;
vm.$nextTick(function() {
var modalDialog = jQuery('#complete-assessment.modal');
if( modalDialog ) modalDialog.modal('hide');
vm.showErrorMessages(resp);
});
});
},
openLink: function(event) {
var vm = this;
var href = event.target.getAttribute('href');
Expand Down Expand Up @@ -983,6 +963,8 @@ Vue.component('scorecard', {
vm.items = {results: [], count: 0};
vm.itemsLoaded = false;
vm.get();
vm.$parent.$children[0].get();
/// Do a .get() whenever all survey responses are deleted.
});
},
setActiveElement: function(practice) {
Expand Down Expand Up @@ -1033,9 +1015,66 @@ Vue.component('scorecard', {
var vm = this;
vm.verificationStatus = vm.items.verified_status;
},
},
mounted() {
var vm = this;
vm.prefix = vm.$parent.$prefix;
}
});

Vue.component('assess-scorecard', {
data: function() {
return {
showScorecardToggle: 0,
activeSidebarItem: '',
prefixVal: null,
api_assessment_freeze: this.$urls.api_assessment_freeze ?
this.$urls.api_assessment_freeze : this._safeUrl(
this.$urls.api_assessment_sample, '/freeze'),
freezeAssessmentDisabled: false,
items: {}
}
},
methods: {
setActive(slug) {
var vm = this;
vm.activeSidebarItem = slug;
},
freezeAssessment: function($event) {
var vm = this;
vm.freezeAssessmentDisabled = true;
vm.reqPost(vm.api_assessment_freeze, {is_frozen: true},
function success(resp) {
vm.freezeAssessmentDisabled = false;
vm.$nextTick(function() {
var modalDialog = jQuery('#complete-assessment.modal');
if( modalDialog ) modalDialog.modal('hide');
if( resp.location ) {
window.location = resp.location;
}
});
},
function error(resp) {
vm.freezeAssessmentDisabled = false;
vm.$nextTick(function() {
var modalDialog = jQuery('#complete-assessment.modal');
if( modalDialog ) modalDialog.modal('hide');
vm.showErrorMessages(resp);
});
});
},
},
watch: {
showScorecardToggle: function(val) {
var vm = this;
(vm.showScorecardToggle == 1) ? vm.$prefix = '' : vm.$prefix = vm.prefixVal;
}
},
mounted() {
var vm = this;
vm.prefixVal = vm.$prefix;
},
});

/** Component used to display requested scorecards

Expand Down
Loading