-
Notifications
You must be signed in to change notification settings - Fork 633
/
ReportsGroupReportLessonResourceLearnerListPage.vue
136 lines (120 loc) · 3.55 KB
/
ReportsGroupReportLessonResourceLearnerListPage.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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
<template>
<CoreBase
:immersivePage="false"
:authorized="userIsAuthorized"
authorizedRole="adminOrCoach"
:showSubNav="true"
>
<TopNavbar slot="sub-nav" />
<KPageContainer>
<p>
<BackLink
:to="classRoute('ReportsGroupReportLessonPage', {})"
:text="$tr('back', { lesson: lesson.title })"
/>
</p>
<h1>
<KLabeledIcon>
<KBasicContentIcon slot="icon" :kind="resource.kind" />
{{ resource.title }}
</KLabeledIcon>
</h1>
<!-- TODO COACH
<KButton :text="coachStrings.$tr('previewAction')" />
-->
<HeaderTable>
<HeaderTableRow>
<template slot="key">
{{ coachStrings.$tr('avgTimeSpentLabel') }}
</template>
<template slot="value">
<TimeDuration :seconds="360" />
</template>
</HeaderTableRow>
</HeaderTable>
<p>
<StatusSummary :tally="tally" />
</p>
<CoreTable :emptyMessage="coachStrings.$tr('activityListEmptyState')">
<thead slot="thead">
<tr>
<th>{{ coachStrings.$tr('nameLabel') }}</th>
<th>{{ coachStrings.$tr('statusLabel') }}</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>
<KLabeledIcon>
<KIcon slot="icon" person />
{{ tableRow.name }}
</KLabeledIcon>
</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';
export default {
name: 'ReportsGroupReportLessonResourceLearnerListPage',
components: {},
mixins: [commonCoach],
computed: {
lesson() {
return this.lessonMap[this.$route.params.lessonId];
},
resource() {
return this.contentMap[this.$route.params.resourceId];
},
recipients() {
return this.getLearnersForGroups([this.$route.params.groupId]);
},
tally() {
return this.getContentStatusTally(this.$route.params.resourceId, 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.resourceId,
learner.id
),
};
Object.assign(tableRow, learner);
return tableRow;
});
return mapped;
},
},
$trs: {
back: "Back to '{lesson}'",
avgNumViews: 'Average number of views',
},
};
</script>
<style lang="scss" scoped>
.stats {
margin-right: 16px;
}
</style>