Skip to content
Snippets Groups Projects
Commit 3c8b9222 authored by permcu's avatar permcu
Browse files

Wire AbsenceCreationForm & AbsenceCreationSummary up

parent 03723d56
No related branches found
No related tags found
1 merge request!356Add dialog for creation of long-term absences
...@@ -20,8 +20,18 @@ ...@@ -20,8 +20,18 @@
<!-- Abwesenheit/Entschuldigung Zusammenfassung --> <!-- Abwesenheit/Entschuldigung Zusammenfassung -->
</template> </template>
<template #content> <template #content>
<absence-creation-form v-if="form" /> <absence-creation-form v-if="form"
<absence-creation-summary v-else /> @persons="persons = $event"
@start-date="startDate = $event"
@end-date="endDate = $event"
@comment="comment = $event"
@absence-reason="absenceReason = $event"
/>
<absence-creation-summary v-else
:persons="persons"
:start-date="startDate"
:end-date="endDate"
/>
</template> </template>
<template #actions> <template #actions>
<!-- secondary --> <!-- secondary -->
...@@ -70,6 +80,12 @@ export default { ...@@ -70,6 +80,12 @@ export default {
popup: false, popup: false,
form: true, form: true,
loading: false, loading: false,
// TODO: All needed? Check if sensible defaults.
persons: [],
startDate: "",
endDate: "",
comment: "",
absenceReason: null,
}; };
}, },
methods: { methods: {
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
item-text="fullName" item-text="fullName"
item-value="id" item-value="id"
multiple multiple
@input="persons = $event" @input="$emit('persons', $event)"
/> />
</v-row> </v-row>
<!-- TODO: No outer padding. --> <!-- TODO: No outer padding. -->
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
:label="$t('forms.labels.start')" :label="$t('forms.labels.start')"
:disabled="loading" :disabled="loading"
:max="endDate" :max="endDate"
@input="startDate = $event" @input="$emit('start-date', $event)"
/> />
</v-col> </v-col>
<v-col <v-col
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
:label="$t('forms.labels.end')" :label="$t('forms.labels.end')"
:disabled="loading" :disabled="loading"
:min="startDate" :min="startDate"
@input="endDate = $event" @input="$emit('end-date', $event)"
/> />
</v-col> </v-col>
</v-row> </v-row>
...@@ -39,12 +39,12 @@ ...@@ -39,12 +39,12 @@
<v-text-field <v-text-field
:label="$t('forms.labels.comment')" :label="$t('forms.labels.comment')"
:loading="loading" :loading="loading"
@input="comment = $event" @input="$emit('comment', $event)"
/> />
</v-row> </v-row>
<v-row> <v-row>
<absence-reason-group-select <absence-reason-group-select
@input="absenceReason = $event" @input="$emit('absence-reason', $event)"
/> />
</v-row> </v-row>
</v-container> </v-container>
...@@ -53,7 +53,7 @@ ...@@ -53,7 +53,7 @@
<script> <script>
import AbsenceReasonGroupSelect from "aleksis.apps.kolego/components/AbsenceReasonGroupSelect.vue"; import AbsenceReasonGroupSelect from "aleksis.apps.kolego/components/AbsenceReasonGroupSelect.vue";
import DateField from "aleksis.core/components/generic/forms/DateField.vue"; import DateField from "aleksis.core/components/generic/forms/DateField.vue";
import { persons } from "./absenceCreation.graphql" import { persons } from "./absenceCreation.graphql";
export default { export default {
name: "AbsenceCreationForm", name: "AbsenceCreationForm",
...@@ -61,22 +61,12 @@ export default { ...@@ -61,22 +61,12 @@ export default {
AbsenceReasonGroupSelect, AbsenceReasonGroupSelect,
DateField, DateField,
}, },
emits: ["persons", "start-date", "end-date", "comment", "absence-reason"],
apollo: { apollo: {
// TODO: Query currently returns all persons. But should return // TODO: Query currently returns all persons. But should return
// only persons the current user can create ParticipationStati and // only persons the current user can create ParticipationStati and
// KolegoAbsences for! // KolegoAbsences for!
allPersons: persons, allPersons: persons,
}, },
data() {
return {
// TODO: All needed? Check if sensible defaults.
loading: false,
persons: [],
startDate: "",
endDate: "",
comment: "",
absenceReason: null,
};
},
}; };
</script> </script>
<template> <template>
<!-- TODO: Hide header --> <!-- TODO: Hide header -->
<c-r-u-d-iterator <c-r-u-d-iterator
:gql-query="" :gql-query="gqlQuery"
:gql-additional-query-args="FROM FORM" :gql-additional-query-args="gqlArgs"
:enable-create="false" :enable-create="false"
:enable-edit="false" :enable-edit="false"
:elevated="false" :elevated="false"
...@@ -15,11 +15,40 @@ ...@@ -15,11 +15,40 @@
<script> <script>
import CRUDIterator from "aleksis.core/components/generic/CRUDIterator.vue"; import CRUDIterator from "aleksis.core/components/generic/CRUDIterator.vue";
import { lessonsForPersons } from "./absenceCreation.graphql";
export default { export default {
name: "AbsenceCreationSummary", name: "AbsenceCreationSummary",
components: { components: {
CRUDIterator, CRUDIterator,
}, },
props: {
persons: {
type: Array,
required: true,
},
startDate: {
type: String,
required: true,
},
endDate: {
type: String,
required: true,
},
},
data() {
return {
gqlQuery: lessonsForPersons,
};
},
computed: {
gqlArgs() {
return {
persons: this.persons.map((person) => person.id),
start: this.startDate,
end: this.endDate,
};
},
},
}; };
</script> </script>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment