diff --git a/aleksis/apps/alsijil/frontend/components/coursebook/absences/AbsenceCreationDialog.vue b/aleksis/apps/alsijil/frontend/components/coursebook/absences/AbsenceCreationDialog.vue index 7d36f94f7416996ffb866067470d77586d61ab0c..eeaf604df479a7136566026222615553a908d605 100644 --- a/aleksis/apps/alsijil/frontend/components/coursebook/absences/AbsenceCreationDialog.vue +++ b/aleksis/apps/alsijil/frontend/components/coursebook/absences/AbsenceCreationDialog.vue @@ -69,6 +69,7 @@ import AbsenceCreationSummary from "./AbsenceCreationSummary.vue"; import CreateButton from "aleksis.core/components/generic/buttons/CreateButton.vue"; import CancelButton from "aleksis.core/components/generic/buttons/CancelButton.vue"; import SaveButton from "aleksis.core/components/generic/buttons/SaveButton.vue"; +import { createAbsences } from "./absenceCreation.graphql"; export default { name: "AbsenceCreationDialog", @@ -99,9 +100,30 @@ export default { this.form = true; }, confirm() { - // TODO: Send mutation (shown in absence-creation-summary) - // Clear form fields - popup = false; + this.$apollo.mutate( { + mutation: createAbsences, + variables: { + persons: this.persons.map((p) => p.id), + start: this.startDate, + end: this.endDate, + comment: this.comment, + reason: this.absenceReason, + }, + }) + .then(() => { + this.persons = []; + this.startDate = ""; + this.endDate = ""; + this.comment = ""; + this.absenceReason = ""; + this.popup = false; + // $toastSuccess("TODO"); + }) + .catch((error) => { + popup = false; + this.handleError(error); + }); + // finally for loading }, }, };