Skip to content
Snippets Groups Projects
Commit 226ce752 authored by Viktoria Wiebe's avatar Viktoria Wiebe Committed by Jan-Hendrik Willms
Browse files

Courseware: Datum bei Verlängerung von Aufgaben

Closes #2553

Merge request studip/studip!3335
parent 4fb5564e
No related branches found
No related tags found
No related merge requests found
<template> <template>
<input :value="formattedDate" @input="onInput" type="date" /> <input :value="formattedDate" @input="onInput" type="date" :min="formattedMinDate" />
</template> </template>
<script> <script>
...@@ -8,14 +8,18 @@ const toISO8601 = (date) => date.toISOString(); ...@@ -8,14 +8,18 @@ const toISO8601 = (date) => date.toISOString();
const pad = (what, length = 2) => `00000000${what}`.substr(-length); const pad = (what, length = 2) => `00000000${what}`.substr(-length);
export default { export default {
props: ['value'], props: ['value', 'min'],
data: () => ({ data: () => ({
date: new Date(), date: new Date(),
submissionDate: new Date()
}), }),
computed: { computed: {
formattedDate() { formattedDate() {
return `${this.date.getFullYear()}-${pad(this.date.getMonth() + 1)}-${pad(this.date.getDate())}`; return `${this.date.getFullYear()}-${pad(this.date.getMonth() + 1)}-${pad(this.date.getDate())}`;
}, },
formattedMinDate() {
return `${this.submissionDate.getFullYear()}-${pad(this.submissionDate.getMonth() + 1)}-${pad(this.submissionDate.getDate())}`;
}
}, },
methods: { methods: {
onInput({ target }) { onInput({ target }) {
...@@ -29,6 +33,9 @@ export default { ...@@ -29,6 +33,9 @@ export default {
if (this.value) { if (this.value) {
this.date = fromISO8601(this.value); this.date = fromISO8601(this.value);
} }
if (this.min) {
this.submissionDate = fromISO8601(this.min);
}
}, },
}; };
</script> </script>
...@@ -50,8 +50,8 @@ ...@@ -50,8 +50,8 @@
<RenewalDialog <RenewalDialog
v-if="renewalTask" v-if="renewalTask"
:renewalDate="renewalDate"
:renewalState="renewalTask.attributes.renewal" :renewalState="renewalTask.attributes.renewal"
:submissionDate="renewalTask.attributes['submission-date']"
@update="updateRenewal" @update="updateRenewal"
@close="closeDialogs" @close="closeDialogs"
/> />
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
</label> </label>
<label v-if="state === 'granted'"> <label v-if="state === 'granted'">
{{ $gettext('neue Frist') }} {{ $gettext('neue Frist') }}
<DateInput v-model="date" class="size-l" /> <DateInput v-model="date" class="size-l" :min="submissionDate" />
</label> </label>
</form> </form>
</template> </template>
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
<script> <script>
import DateInput from '../layouts/CoursewareDateInput.vue'; import DateInput from '../layouts/CoursewareDateInput.vue';
export default { export default {
props: ['renewalDate', 'renewalState'], props: ['renewalState', 'submissionDate'],
components: { components: {
DateInput, DateInput,
}, },
...@@ -44,7 +44,7 @@ export default { ...@@ -44,7 +44,7 @@ export default {
}), }),
methods: { methods: {
resetLocalVars() { resetLocalVars() {
this.date = this.renewalDate ?? null; this.date = this.submissionDate ?? null;
this.state = this.renewalState; this.state = this.renewalState;
}, },
updateRenewal() { updateRenewal() {
...@@ -64,7 +64,7 @@ export default { ...@@ -64,7 +64,7 @@ export default {
this.resetLocalVars(); this.resetLocalVars();
}, },
watch: { watch: {
renewalDate(newValue) { submissionDate(newValue) {
if (newValue !== this.date) { if (newValue !== this.date) {
this.resetLocalVars(); this.resetLocalVars();
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment