Recovered most of the completion display code

This commit is contained in:
PMKuipers 2023-05-19 19:24:10 +02:00
parent 27cb13fbfc
commit 050362905d

View file

@ -584,10 +584,10 @@ export default {
</div> </div>
</template> </template>
<r-item-studentgrades <r-item-studentgrades
v-if='!!value.course.grades && value.course.grades.length >0' v-if='!!value.course.grades && value.course.grades.length > 0'
v-model='value' v-model='value'
:guestmode='guestmode'></r-item-studentgrades> :guestmode='guestmode'></r-item-studentgrades>
<-item-studentcompletion <r-item-studentcompletion
v-if='!!value.course.completion' v-if='!!value.course.completion'
v-model='value.course.completion' v-model='value.course.completion'
:course='value.course' :course='value.course'
@ -709,8 +709,37 @@ export default {
}, },
data() { data() {
return { return {
text: {
completion_incomplete: "completion_incomplete",
completion_failed: "completion_failed",
completion_pending: "completion_pending",
completion_progress: "completion_progress",
completion_completed: "completion_completed",
completion_good: "completion_good",
completion_excellent: "completion_excellent",
view_feedback: "view_feedback",
coursetiming_past: "coursetiming_past",
coursetiming_present: "coursetiming_present",
coursetiming_future: "coursetiming_future",
required_goal: "required_goal",
},
}; };
}, },
created(){
const self = this;
// Get text strings for condition settings
let stringkeys = [];
for(const key in this.text){
stringkeys.push({ key: key, component: 'local_treestudyplan'});
}
get_strings(stringkeys).then(function(strings){
let i = 0;
for(const key in self.text){
self.text[key] = strings[i];
i++;
}
});
},
computed: { computed: {
}, },
methods: { methods: {
@ -739,7 +768,7 @@ export default {
}, },
template: ` template: `
<table class="r-item-course-grade-details"> <table class="r-item-course-grade-details">
<template v-for='cgroup in value.conditions> <template v-for='cgroup in value.conditions'>
<tr> <tr>
<th colspan='2'>{{cgroup.title}}</th> <th colspan='2'>{{cgroup.title}}</th>
<th><i :class="'fa fa-'+completion_icon(completion_tag(cgroup))+' r-completion-'+completion_tag(cgroup)" <th><i :class="'fa fa-'+completion_icon(completion_tag(cgroup))+' r-completion-'+completion_tag(cgroup)"
@ -747,23 +776,23 @@ export default {
</tr> </tr>
<tr v-for='ci in cgroup.items'> <tr v-for='ci in cgroup.items'>
<td><span v-if='guestmode'>{{ci.title}}</span> <td><span v-if='guestmode'>{{ci.title}}</span>
<span v-else>{{ci.details.criteria}}</span> <span v-else v-html='ci.details.criteria'></span>
<abbr v-if="ci.details.requirement" :title="ci.details.requirement" <abbr v-if="ci.details.requirement" :title="ci.details.requirement"
:class="'s-required ' + ci.status" :class="'s-required ' + ci.status"
><i class='fa fa-questionmark' ></i ><i class='fa fa-questionmark' ></i
></abbr> ></abbr>
<td><span :class="' r-completion-'+ci.status">{{g.grade}}</span></td> <td><span :class="' r-completion-'+ci.status">{{ci.grade}}</span></td>
<td><i :class="'fa fa-'+completion_icon(ci.status)+' r-completion-'+ci.status" <td><i :class="'fa fa-'+completion_icon(ci.status)+' r-completion-'+ci.status"
:title="text['completion_'+ci.status"></i> :title="text['completion_'+ci.status]"></i>
<i v-if='ci.pending' :title="text['completion_pending']" <i v-if='ci.pending' :title="text['completion_pending']"
class="r-pendingsubmission fa fa-clock-o"></i> class="r-pendingsubmission fa fa-clock-o"></i>
</td> </td>
<td v-if="ci.feedback"> <td v-if="ci.feedback">
<a v-b-modal="'r-grade-feedback-'+g.id" <a v-b-modal="'r-grade-feedback-'+ci.id"
href="#" href="#"
>{{ text["view_feedback"]}}</a> >{{ text["view_feedback"]}}</a>
<b-modal <b-modal
:id="'r-grade-feedback-'+g.id" :id="'r-grade-feedback-'+ci.id"
size="sm" size="sm"
ok-only ok-only
centered centered
@ -771,29 +800,13 @@ export default {
> >
<template #modal-header> <template #modal-header>
<h2><i class="fa fa-graduation-cap"></i>{{ course.fullname }}</h2><br> <h2><i class="fa fa-graduation-cap"></i>{{ course.fullname }}</h2><br>
<span class="r-activity-icon" :title="g.typename" v-html="g.icon"></span>{{g.name}} <span class="r-activity-icon" :title="ci.typename" v-html="ci.icon"></span>{{ci.name}}
</template> </template>
<span v-html="g.feedback"></span> <span v-html="ci.feedback"></span>
</b-modal> </b-modal>
</td> </td>
</tr> </tr>
</template> </template>
<tr v-for="g in value.course.grades">
<td><span class="r-activity-icon" :title="g.typename" v-html="g.icon"></span
><a
:href="(!guestmode)?(g.link):undefined" target="_blank" :title="g.name">{{g.name}}</a>
<abbr v-if="useRequiredGrades && g.required" :title="text.required_goal"
:class="'s-required ' + g.completion"
><i class='fa fa-asterisk' ></i
></abbr>
</td>
<td><span :class="' r-completion-'+g.completion">{{g.grade}}</span></td>
<td><i :class="'fa fa-'+completion_icon(g.completion)+' r-completion-'+g.completion"
:title="text['completion_'+g.completion]"></i>
<i v-if='g.pendingsubmission' :title="text['completion_pending']"
class="r-pendingsubmission fa fa-clock-o"></i></td>
</tr>
</table> </table>
`, `,
}); });