Skip to content
Snippets Groups Projects
Commit 5161437c authored by permcu's avatar permcu
Browse files

Enable autocomplete for subject, teachers & rooms

Default value is broken.
Default value is id, as was before, does not work.
But object does not work as well, since not the same object.

:value-comparator="(a, b) => a.id === b.id" should work
but selects the wrong default value and makes the field non editable.

=> Bailing for now.
parent 0c8e3f07
No related branches found
No related tags found
1 merge request!310Resolve "Implement Vue substitution frontend"
Pipeline #144727 failed
query gqlSubjects {
amendableSubjects: subjects {
id
name
}
}
query gqlPersons {
amendableTeachers: persons {
id
fullName
}
}
query gqlRooms {
amendableRooms: rooms {
id
name
}
}
mutation createAmendLesson($input: CreateLessonEventInput!) {
createAmendLesson(input: $input) {
lessonEvent {
......
......@@ -114,7 +114,40 @@
:edit-item="initPatchData"
@cancel="amendEvent.open = false"
>
<template #cancelled.field="{ on, attrs }">
<template #subject.field="{ attrs, on }">
<v-autocomplete
:items="amendableSubjects"
item-text="name"
item-value="id"
v-bind="attrs"
v-on="on"
/>
</template>
<template #teachers.field="{ attrs, on }">
<v-autocomplete
multiple
:items="amendableTeachers"
item-text="fullName"
item-value="id"
v-bind="attrs"
v-on="on"
chips
deletable-chips
/>
</template>
<template #rooms.field="{ attrs, on }">
<v-autocomplete
multiple
:items="amendableRooms"
item-text="name"
item-value="id"
v-bind="attrs"
v-on="on"
chips
deletable-chips
/>
</template>
<template #cancelled.field="{ attrs, on }">
<v-checkbox
v-bind="attrs"
v-on="on"
......@@ -139,6 +172,9 @@ import LessonRelatedObjectChip from "../../LessonRelatedObjectChip.vue";
import lessonEvent from "../mixins/lessonEvent";
import LessonEventSubject from "../../LessonEventSubject.vue";
import {
gqlSubjects,
gqlPersons,
gqlRooms,
createAmendLesson,
patchAmendLesson
} from "../../amendLesson.graphql";
......@@ -214,13 +250,18 @@ export default {
initPatchData() {
return {
id: this.selectedEvent.meta.id,
subject: this.selectedEvent.meta.subject?.id,
teachers: this.selectedEvent.meta.teachers.map((teacher) => teacher.id),
rooms: this.selectedEvent.meta.rooms.map((room) => room.id),
subject: this.selectedEvent.meta.subject?,
teachers: this.selectedEvent.meta.teachers,
rooms: this.selectedEvent.meta.rooms,
cancelled: this.selectedEvent.meta.cancelled,
comment: this.selectedEvent.meta.comment,
};
},
},
apollo: {
amendableSubjects: gqlSubjects,
amendableTeachers: gqlPersons,
amendableRooms: gqlRooms,
},
};
</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