feat: kan opdracht aanmaken met deadline
This commit is contained in:
parent
ca4254bd67
commit
2180425323
4 changed files with 27 additions and 7 deletions
|
@ -18,7 +18,7 @@ export function makeTestAssignemnts(em: EntityManager, classes: Class[]): Assign
|
||||||
description: 'reading',
|
description: 'reading',
|
||||||
learningPathHruid: 'un_ai',
|
learningPathHruid: 'un_ai',
|
||||||
learningPathLanguage: Language.English,
|
learningPathLanguage: Language.English,
|
||||||
deadline: futureDate,
|
deadline: new Date(),
|
||||||
groups: [],
|
groups: [],
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -58,7 +58,7 @@ export const deadlineRules = [
|
||||||
return "Invalid date or time.";
|
return "Invalid date or time.";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (selectedDateTime <= now) {
|
if (selectedDateTime < now) {
|
||||||
return "The deadline must be in the future.";
|
return "The deadline must be in the future.";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,7 @@
|
||||||
|
|
||||||
// Disable combobox when learningPath prop is passed
|
// Disable combobox when learningPath prop is passed
|
||||||
const lpIsSelected = route.query.hruid !== undefined;
|
const lpIsSelected = route.query.hruid !== undefined;
|
||||||
const deadline = ref(null);
|
const deadline = ref(new Date());
|
||||||
const description = ref("");
|
const description = ref("");
|
||||||
const groups = ref<string[][]>([]);
|
const groups = ref<string[][]>([]);
|
||||||
|
|
||||||
|
@ -86,6 +86,7 @@
|
||||||
title: assignmentTitle.value,
|
title: assignmentTitle.value,
|
||||||
description: description.value,
|
description: description.value,
|
||||||
learningPath: lp || "",
|
learningPath: lp || "",
|
||||||
|
deadline: deadline.value,
|
||||||
language: language.value,
|
language: language.value,
|
||||||
groups: groups.value,
|
groups: groups.value,
|
||||||
};
|
};
|
||||||
|
|
|
@ -108,6 +108,21 @@
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getDeadlineClass(deadline?: string | Date): string {
|
||||||
|
if (!deadline) return "";
|
||||||
|
const date = new Date(deadline);
|
||||||
|
const now = new Date();
|
||||||
|
const isToday =
|
||||||
|
date.getDate() === now.getDate() &&
|
||||||
|
date.getMonth() === now.getMonth() &&
|
||||||
|
date.getFullYear() === now.getFullYear();
|
||||||
|
|
||||||
|
if (date.getTime() < now.getTime()) return "deadline-passed";
|
||||||
|
if (isToday) return "deadline-today";
|
||||||
|
return "deadline-upcoming";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
|
@ -147,14 +162,13 @@
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
class="assignment-deadline"
|
class="assignment-deadline"
|
||||||
:class="{ 'deadline-passed': isPastDeadline(assignment.deadline) }"
|
:class="getDeadlineClass(assignment.deadline)"
|
||||||
>
|
>
|
||||||
{{ t("deadline") }}:
|
{{ t("deadline") }}:
|
||||||
<span>
|
<span>{{ formatDate(assignment.deadline) }}</span>
|
||||||
{{ formatDate(assignment.deadline) }}
|
|
||||||
</span>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="spacer"></div>
|
<div class="spacer"></div>
|
||||||
|
@ -259,6 +273,11 @@
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.assignment-deadline.deadline-today {
|
||||||
|
color: #f57c00;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
.spacer {
|
.spacer {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue