-
Notifications
You must be signed in to change notification settings - Fork 633
/
ReportsGroupReportLessonExerciseLearnerListPage.vue
120 lines (104 loc) · 3.21 KB
/
ReportsGroupReportLessonExerciseLearnerListPage.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
<template>
<CoreBase
:immersivePage="false"
:authorized="userIsAuthorized"
authorizedRole="adminOrCoach"
:showSubNav="true"
>
<TopNavbar slot="sub-nav" />
<KPageContainer>
<ReportsGroupReportLessonExerciseHeader />
<p>
<StatusSummary :tally="tally" />
</p>
<CoreTable :emptyMessage="coachStrings.$tr('activityListEmptyState')">
<thead slot="thead">
<tr>
<th>{{ coachStrings.$tr('nameLabel') }}</th>
<th>{{ coachStrings.$tr('progressLabel') }}</th>
<th>{{ coachStrings.$tr('timeSpentLabel') }}</th>
<th>{{ coachStrings.$tr('groupsLabel') }}</th>
<th>{{ coachStrings.$tr('lastActivityLabel') }}</th>
</tr>
</thead>
<transition-group slot="tbody" tag="tbody" name="list">
<tr v-for="tableRow in table" :key="tableRow.id">
<td>
<KRouterLink
v-if="showLink(tableRow.statusObj.status)"
:text="tableRow.name"
:to="link(tableRow.id)"
/>
<template v-else>
{{ tableRow.name }}
</template>
</td>
<td>
<StatusSimple :status="tableRow.statusObj.status" />
</td>
<td>
<TimeDuration :seconds="tableRow.statusObj.time_spent" />
</td>
<td>
<TruncatedItemList :items="tableRow.groups" />
</td>
<td>
<ElapsedTime :date="tableRow.statusObj.last_activity" />
</td>
</tr>
</transition-group>
</CoreTable>
</KPageContainer>
</CoreBase>
</template>
<script>
import commonCoach from '../common';
import { PageNames } from '../../constants';
import ReportsGroupReportLessonExerciseHeader from './ReportsGroupReportLessonExerciseHeader';
export default {
name: 'ReportsGroupReportLessonExerciseLearnerListPage',
components: {
ReportsGroupReportLessonExerciseHeader,
},
mixins: [commonCoach],
computed: {
recipients() {
return this.getLearnersForGroups([this.$route.params.groupId]);
},
tally() {
return this.getContentStatusTally(this.$route.params.exerciseId, this.recipients);
},
table() {
const learners = this.recipients.map(learnerId => this.learnerMap[learnerId]);
const sorted = this._.sortBy(learners, ['name']);
const mapped = sorted.map(learner => {
const tableRow = {
groups: this.getGroupNamesForLearner(learner.id),
statusObj: this.getContentStatusObjForLearner(
this.$route.params.exerciseId,
learner.id
),
};
Object.assign(tableRow, learner);
return tableRow;
});
return mapped;
},
},
methods: {
link(learnerId) {
return this.classRoute(PageNames.REPORTS_GROUP_REPORT_LESSON_EXERCISE_LEARNER_PAGE_ROOT, {
learnerId,
});
},
showLink(status) {
return status !== this.STATUSES.notStarted;
},
},
};
</script>
<style lang="scss" scoped>
.stats {
margin-right: 16px;
}
</style>