Newer
Older
<template>
<div class="cw-dashboard-students-wrapper">
<table v-if="tasks.length > 0" class="default">
<colgroup>
<col />
</colgroup>
<thead>
<tr>
<th><translate>Status</translate></th>
<th><translate>Aufgabentitel</translate></th>
<th><translate>Teilnehmende/Gruppen</translate></th>
<th><translate class="responsive-hidden">Seite</translate></th>
<th><translate>bearbeitet</translate></th>
<th><translate>Abgabefrist</translate></th>
<th><translate>Abgabe</translate></th>
<th class="responsive-hidden renewal"><translate>Verlängerungsanfrage</translate></th>
<th class="responsive-hidden feedback"><translate>Feedback</translate></th>
</tr>
</thead>
<tbody>
<tr v-for="{ task, taskGroup, status, element, user, group, feedback } in tasks" :key="task.id">
<td>
<studip-icon
v-if="status.shape !== undefined"
:shape="status.shape"
:role="status.role"
:title="status.description"
</td>
<td>
{{ taskGroup && taskGroup.attributes.title }}
</td>
<td>
<span v-if="user">
<studip-icon
shape="person2"
role="info"
aria-hidden="true"
:title="$gettext('Teilnehmende Person')"
/>
<span class="sr-only">{{ $gettext('Teilnehmende Person') }}</span>
<studip-icon
shape="group2"
role="info"
aria-hidden="true"
:title="$gettext('Gruppe')"
/>
<span class="sr-only">{{ $gettext('Gruppe') }}</span>
</span>
</td>
<td class="responsive-hidden">
<a v-if="task.attributes.submitted" :href="getLinkToElement(element.id)">
{{ element.attributes.title }}
</a>
<span v-else>{{ element.attributes.title }}</span>
</td>
<td>{{ task.attributes?.progress?.toFixed(2) || '-.--' }}%</td>
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
<td>{{ getReadableDate(task.attributes['submission-date']) }}</td>
<td>
<studip-icon v-if="task.attributes.submitted" shape="accept" role="status-green" />
</td>
<td class="responsive-hidden">
<button
v-show="task.attributes.renewal === 'pending'"
class="button"
@click="solveRenewalRequest(task)"
>
<translate>Anfrage bearbeiten</translate>
</button>
<span v-show="task.attributes.renewal === 'declined'">
<studip-icon shape="decline" role="status-red" />
<translate>Anfrage abgelehnt</translate>
</span>
<span v-show="task.attributes.renewal === 'granted'">
<translate>verlängert bis</translate>:
{{ getReadableDate(task.attributes['renewal-date']) }}
</span>
<studip-icon
v-if="task.attributes.renewal === 'declined' || task.attributes.renewal === 'granted'"
:title="$gettext('Anfrage bearbeiten')"
class="edit"
shape="edit"
role="clickable"
@click="solveRenewalRequest(task)"
/>
</td>
<td class="responsive-hidden">
<span
v-if="feedback"
:title="
$gettext('Feedback geschrieben am:') +
' ' +
getReadableDate(feedback.attributes['chdate'])
"
>
<studip-icon shape="accept" role="status-green" />
<translate>Feedback gegeben</translate>
<studip-icon
:title="$gettext('Feedback bearbeiten')"
class="edit"
shape="edit"
role="clickable"
@click="editFeedback(feedback)"
/>
</span>
<button
v-show="!feedback && task.attributes.submitted"
class="button"
@click="addFeedback(task)"
>
<translate>Feedback geben</translate>
</button>
</td>
</tr>
</tbody>
</table>
<div v-else>
<courseware-companion-box
mood="pointing"
:msgCompanion="$gettext('Es wurden bisher keine Aufgaben gestellt.')"
>
</courseware-companion-box>
</div>
<studip-dialog
v-if="showRenewalDialog"
:title="text.renewalDialog.title"
:confirmText="text.renewalDialog.confirm"
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
height="350"
@close="
showRenewalDialog = false;
currentDialogTask = {};
"
@confirm="updateRenewal"
>
<template v-slot:dialogContent>
<form class="default" @submit.prevent="">
<label>
<translate>Fristverlängerung</translate>
<select v-model="currentDialogTask.attributes.renewal">
<option value="declined">
<translate>ablehnen</translate>
</option>
<option value="granted">
<translate>gewähren</translate>
</option>
</select>
</label>
<label v-if="currentDialogTask.attributes.renewal === 'granted'">
<translate>neue Frist</translate>
<courseware-date-input v-model="currentDialogTask.attributes['renewal-date']" class="size-l" />
</label>
</form>
</template>
</studip-dialog>
<studip-dialog
v-if="showEditFeedbackDialog"
:title="text.editFeedbackDialog.title"
:confirmText="text.editFeedbackDialog.confirm"
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
height="420"
@close="
showEditFeedbackDialog = false;
currentDialogFeedback = {};
"
@confirm="updateFeedback"
>
<template v-slot:dialogContent>
<courseware-companion-box
v-if="currentDialogFeedback.attributes.content === ''"
mood="pointing"
:msgCompanion="
$gettext('Sie haben kein Feedback geschrieben, beim Speichern wird dieses Feedback gelöscht!')
"
/>
<form class="default" @submit.prevent="">
<label>
<translate>Feedback</translate>
<textarea v-model="currentDialogFeedback.attributes.content" />
</label>
</form>
</template>
</studip-dialog>
<studip-dialog
v-if="showAddFeedbackDialog"
:title="text.addFeedbackDialog.title"
:confirmText="text.addFeedbackDialog.confirm"
@close="
showAddFeedbackDialog = false;
currentDialogFeedback = {};
"
@confirm="createFeedback"
>
<template v-slot:dialogContent>
<form class="default" @submit.prevent="">
<label>
<translate>Feedback</translate>
<textarea v-model="currentDialogFeedback.attributes.content" />
</label>
</form>
</template>
</studip-dialog>
<courseware-tasks-dialog-distribute v-if="showTasksDistributeDialog"/>
</div>
</template>
<script>
import StudipIcon from './../StudipIcon.vue';
import StudipDialog from './../StudipDialog.vue';
import CoursewareCompanionBox from './CoursewareCompanionBox.vue';
import CoursewareDateInput from './CoursewareDateInput.vue';
import CoursewareTasksDialogDistribute from './CoursewareTasksDialogDistribute.vue';
import taskHelperMixin from '../../mixins/courseware/task-helper.js';
import { mapActions, mapGetters } from 'vuex';
export default {
name: 'courseware-dashboard-students',
mixins: [taskHelperMixin],
components: {
CoursewareCompanionBox,
CoursewareDateInput,
StudipIcon,
StudipDialog,
CoursewareTasksDialogDistribute,
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
},
data() {
return {
showRenewalDialog: false,
showAddFeedbackDialog: false,
showEditFeedbackDialog: false,
currentDialogTask: {},
currentDialogFeedback: {},
text: {
renewalDialog: {
title: this.$gettext('Verlängerungsanfrage bearbeiten'),
confirm: this.$gettext('Speichern'),
close: this.$gettext('Schließen'),
},
editFeedbackDialog: {
title: this.$gettext('Feedback zur Aufgabe ändern'),
confirm: this.$gettext('Speichern'),
close: this.$gettext('Schließen'),
},
addFeedbackDialog: {
title: this.$gettext('Feedback zur Aufgabe geben'),
confirm: this.$gettext('Speichern'),
close: this.$gettext('Schließen'),
},
},
};
},
computed: {
...mapGetters({
context: 'context',
allTasks: 'courseware-tasks/all',
userById: 'users/byId',
statusGroupById: 'status-groups/byId',
getElementById: 'courseware-structural-elements/byId',
getFeedbackById: 'courseware-task-feedback/byId',
relatedTaskGroups: 'courseware-task-groups/related',
showTasksDistributeDialog: 'showTasksDistributeDialog'
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
}),
tasks() {
return this.allTasks.map((task) => {
const result = {
task,
taskGroup: this.relatedTaskGroups({ parent: task, relationship: 'task-group' }),
status: this.getStatus(task),
element: this.getElementById({ id: task.relationships['structural-element'].data.id }),
user: null,
group: null,
feedback: null,
};
let solver = task.relationships.solver.data;
if (solver.type === 'users') {
result.user = this.userById({ id: solver.id });
}
if (solver.type === 'status-groups') {
result.group = this.statusGroupById({ id: solver.id });
}
const feedbackId = task.relationships['task-feedback'].data?.id;
if (feedbackId) {
result.feedback = this.getFeedbackById({ id: feedbackId });
}
return result;
});
},
managerUrl() {
return STUDIP.URLHelper.getURL('dispatch.php/course/courseware/manager', {cid: this.context.id});
}
},
methods: {
...mapActions({
updateTask: 'updateTask',
createTaskFeedback: 'createTaskFeedback',
updateTaskFeedback: 'updateTaskFeedback',
deleteTaskFeedback: 'deleteTaskFeedback',
loadRemoteCoursewareStructure: 'loadRemoteCoursewareStructure',
copyStructuralElement: 'copyStructuralElement',
companionSuccess: 'companionSuccess',
companionError: 'companionError',
}),
addFeedback(task) {
this.currentDialogFeedback.attributes = {};
this.currentDialogFeedback.attributes.content = '';
this.currentDialogFeedback.relationships = {};
this.currentDialogFeedback.relationships.task = {};
this.currentDialogFeedback.relationships.task.data = {};
this.currentDialogFeedback.relationships.task.data.id = task.id;
this.currentDialogFeedback.relationships.task.data.type = task.type;
this.showAddFeedbackDialog = true;
},
createFeedback() {
if (this.currentDialogFeedback.attributes.content === '') {
this.companionError({
info: this.$gettext('Bitte schreiben Sie ein Feedback.'),
});
return false;
}
this.showAddFeedbackDialog = false;
this.createTaskFeedback({
taskFeedback: this.currentDialogFeedback,
});
this.currentDialogFeedback = {};
},
editFeedback(feedback) {
this.currentDialogFeedback = _.cloneDeep(feedback);
this.showEditFeedbackDialog = true;
},
async updateFeedback() {
this.showEditFeedbackDialog = false;
let attributes = {};
attributes.content = this.currentDialogFeedback.attributes.content;
if (attributes.content === '') {
await this.deleteTaskFeedback({
taskFeedbackId: this.currentDialogFeedback.id,
});
this.companionSuccess({
info: this.$gettext('Feedback wurde gelöscht.'),
});
} else {
await this.updateTaskFeedback({
attributes: attributes,
taskFeedbackId: this.currentDialogFeedback.id,
});
this.companionSuccess({
info: this.$gettext('Feedback wurde gespeichert.'),
});
}
this.currentDialogFeedback = {};
},
solveRenewalRequest(task) {
this.currentDialogTask = _.cloneDeep(task);
this.currentDialogTask.attributes['renewal-date'] = new Date().toISOString();
this.showRenewalDialog = true;
},
updateRenewal() {
this.showRenewalDialog = false;
let attributes = {};
attributes.renewal = this.currentDialogTask.attributes.renewal;
if (attributes.renewal === 'granted') {
attributes['renewal-date'] = new Date(this.currentDialogTask.attributes['renewal-date'] || Date.now()).toISOString();