Skip to content
Snippets Groups Projects
Verified Commit 161a0b61 authored by Julian's avatar Julian Committed by magicfelix
Browse files

Create possibility to select personal note in coursebook

parent d9d633c9
No related branches found
No related tags found
1 merge request!284Draft: Redesign entering of lesson documentation
export default { export default {
methods: { methods: {
removePersonalNote (item) {}, removePersonalNote(item) {
editPersonalNote (item) { console.log("removing personal note", item);
this.dialog=true;
this.editPersonalNote=item;
}, },
updatePersonalNote (item) { editPersonalNote(personID) {
this.personalNotes console.log("editing personal note of person", personID);
this.editedPersonID = personID;
this.updatePersonalNote();
this.dialog = true;
}, },
updatePersonalNote() {
let personalNote = this.personalNoteByStudentID(this.editedPersonID);
this.editedTardiness = personalNote.tardiness || 0;
this.editedAbsent = personalNote.absent || false;
this.editedExcused = personalNote.excused || false;
this.editedExcuseType = personalNote.excuse_type || null;
this.editedExtraMarks = personalNote.extra_marks || [];
},
personalNoteByStudentID(studentID) {
return this.personalNotes.filter(item => item.student.id === studentID)[0] || {};
}
}, },
props: ["personalNotes", "groups"], props: ["personalNotes", "groups"],
name: "personal-notes", name: "personal-notes",
...@@ -16,37 +28,27 @@ export default { ...@@ -16,37 +28,27 @@ export default {
dialog: false, dialog: false,
// Absent versp. exc. type hw note // Absent versp. exc. type hw note
editPersonalNoteId: null, editPersonalNoteId: null,
headers: [ editedPersonID: -1,
{ editedTardiness: 0,
text: window.django.gettext('Name'), editedAbsent: false,
align: 'start', editedExcused: false,
value: 'student.full_name', editedExcuseType: null,
}, editedExtraMarks: [],
{ }
text: window.django.gettext('Absent'), },
value: 'absent', computed: {
}, persons() {
{ // go through each group and get the students
text: window.django.gettext('Tardiness'), // use the group names as headers for the v-select
value: 'tardiness',
}, return this.groups.map(
{ group => {
text: window.django.gettext('Excused'), return [
value: 'excused', {header: group.name, id: group.short_name},
}, group.members
{ ]
text: window.django.gettext('Excuse Type'), }
value: 'excuse_type', ).flat(2);
},
{
text: window.django.gettext('Extra Marks'),
value: 'extra_marks',
},
{
text: window.django.gettext('Remarks'),
value: 'remarks',
},
],
} }
}, },
template: ` template: `
...@@ -56,7 +58,10 @@ export default { ...@@ -56,7 +58,10 @@ export default {
> >
<template v-slot:activator="{ on, attrs }"> <template v-slot:activator="{ on, attrs }">
<div> <div>
<v-chip class="ma-1" v-for="personal_note in personalNotes" close @click="editPersonalNote(personal_note)" @click:close="removePersonalNote(personal_note)">{{personal_note.student.full_name}}: {{personal_note.tardiness}}</v-chip> <v-chip class="ma-1" v-for="personal_note in personalNotes" close
@click="editPersonalNote(personal_note.student.id)" @click:close="removePersonalNote(personal_note)">
{{personal_note.student.full_name}}: {{personal_note.tardiness}}
</v-chip>
</div> </div>
<v-btn <v-btn
class="ma-1" class="ma-1"
...@@ -78,45 +83,11 @@ export default { ...@@ -78,45 +83,11 @@ export default {
<v-card-text> <v-card-text>
<v-container> <v-container>
<!-- FIXME: Sync values with data--> <!-- FIXME: Sync values with data-->
<v-select item-text="student.full_name" item-value="id" :items="personalNotes" :value="editPersonalNote.id" @input="editPersonalNoteId = $event"></v-select> <v-select item-text="full_name" item-value="id" :items="persons"
<v-text-field label="Tardiness" suffix="min" type="number" min="0"></v-text-field> v-model="editedPersonID" @input="updatePersonalNote"></v-select>
<v-checkbox label="Absent"></v-checkbox> <v-text-field label="Tardiness" suffix="min" type="number" min="0" v-model="editedTardiness"></v-text-field>
<v-checkbox label="Excused"></v-checkbox> <v-checkbox label="Absent" v-model="personalNoteByStudentID(editedPersonID).absent"></v-checkbox>
<!--<v-data-table <v-checkbox label="Excused" v-model="editedExcused"></v-checkbox>
:headers="headers"
:items="personalNotes"
class="elevation-1"
disable-filtering="true"
disable-pagination="true"
disable-items-per-page="true"
>
<template v-slot:item.student.full_name="props">
<v-edit-dialog
:return-value.sync="props.item.student.full_name"
@save="save"
@cancel="cancel"
@open="open"
@close="close"
>
{{ props.item.student.full_name }}
<template v-slot:input>
<v-text-field
v-model="props.item.student.full_name"
:rules="[max25chars]"
label="Edit"
single-line
counter
></v-text-field>
</template>
</v-edit-dialog>
</template>
<template v-slot:item.absent="{ item }">
<v-simple-checkbox v-model="item.absent" ></v-simple-checkbox>
</template>
<template v-slot:item.excused="{ item }">
<v-simple-checkbox v-model="item.excused" ></v-simple-checkbox>
</template>
</v-data-table>-->
</v-container> </v-container>
<!-- <small>*indicates required field</small>--> <!-- <small>*indicates required field</small>-->
</v-card-text> </v-card-text>
......
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