blob: a0510f7697dd4433f9d6cf965b03a5d21a55cf14 (
plain)
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
|
export default {
methods: {
getStatus(task) {
let status = {};
const now = new Date(Date.now());
const submissionDate = new Date(task.attributes['submission-date']);
let limit = new Date();
limit.setDate(now.getDate() + 3);
status.canSubmit = true;
if (now <= submissionDate) {
status.shape = 'span-empty';
status.role = 'status-green';
status.description = this.$gettext('Aufgabe bereit');
}
if (task.attributes.renewal !== 'granted') {
if (limit > submissionDate) {
status.shape = 'span-3quarter';
status.role = 'status-yellow';
status.description = this.$gettext('Aufgabe muss bald abgegeben werden');
}
if (now > submissionDate) {
status.canSubmit = false;
status.shape = 'span-full';
status.role = 'status-red';
status.description = this.$gettext('Abgabe ist nicht bis zur Abgabefrist erfolgt');
}
} else {
const renewalDate = new Date(task.attributes['renewal-date']);
if (limit > renewalDate) {
status.shape = 'span-3quarter';
status.role = 'status-yellow';
status.description = this.$gettext('Aufgabe muss bald abgegeben werden');
}
if (now > renewalDate) {
status.canSubmit = false;
status.shape = 'span-full';
status.role = 'status-red';
status.description = this.$gettext('Abgabe ist nicht bis zur verlängerten Abgabefrist erfolgt');
}
}
if (task.attributes.submitted) {
status.shape = 'span-full';
status.role = 'status-green';
status.description = this.$gettext('Aufgabe abgegeben');
}
return status;
},
getLinkToElement(element) {
const unitId = element.relationships?.unit?.data?.id;
if (!unitId) {
return '';
}
return `${STUDIP.URLHelper.base_url}dispatch.php/course/courseware/courseware/${unitId}?cid=${STUDIP.URLHelper.parameters.cid}#/structural_element/${element.id}`;
},
getReadableDate(date) {
let locale = navigator.language ? navigator.language : 'de-DE';
return new Date(date).toLocaleDateString(locale, {
year: "numeric",
month: "2-digit",
day: "2-digit",
});
},
},
};
|