Skip to content
Snippets Groups Projects
Verified Commit 5ae5b3cb authored by Hangzhi Yu's avatar Hangzhi Yu Committed by magicfelix
Browse files

Beautify lesson documentation edit dialog

parent 5a325f6b
No related branches found
No related tags found
1 merge request!284Draft: Redesign entering of lesson documentation
<template> <template>
<ApolloMutation <ApolloMutation
:mutation="require('./LessonDocumentation.graphql')" :mutation="require('./LessonDocumentation.graphql')"
:variables=lessonDocumentationEdit :variables=lessonDocumentationEdit
@done="onDone" @done="onDone"
> >
<template v-slot="{ mutate, loading, error }"> <template v-slot="{ mutate, loading, error }">
<v-card elevation="2" :loading="loading"> <v-card elevation="2" :loading="loading">
<v-form v-model="valid"> <v-form v-model="valid">
<v-row class="ma-0"> <v-card-title>
<v-col cols="12" md="4" lg="3" xl="2"> <v-hover v-slot="{ hover }">
<v-hover v-slot="{ hover }"> <div>
<div> <v-menu
<v-menu
v-model="showPicker" v-model="showPicker"
:close-on-content-click="false" :close-on-content-click="false"
transition="scale-transition" transition="scale-transition"
offset-y offset-y
min-width="auto" min-width="auto"
> >
<template v-slot:activator="{ on, attrs }"> <template v-slot:activator="{ on, attrs }">
<v-card-title> <v-card-title>
<span v-text="new Date(lessonDocumentationEdit.date).toLocaleDateString($root.languageCode)" class="ma-1"></span> <span
<v-btn right v-bind="attrs" v-on="on" icon v-if="hover && dateAndPeriodEditable"> v-text="new Date(lessonDocumentationEdit.date).toLocaleDateString($root.languageCode)"
<v-icon>mdi-pencil-outline</v-icon> class="ma-1"></span>
</v-btn> <v-btn right v-bind="attrs" v-on="on" icon
</v-card-title> v-if="hover && dateAndPeriodEditable">
</template> <v-icon>mdi-pencil-outline</v-icon>
<v-date-picker </v-btn>
</v-card-title>
</template>
<v-date-picker
scrollable scrollable
no-title no-title
@input="showPicker = false; $emit('change-date', $event)" @input="showPicker = false; $emit('change-date', $event)"
v-model="lessonDocumentationEdit.date" v-model="lessonDocumentationEdit.date"
></v-date-picker> ></v-date-picker>
</v-menu> </v-menu>
</div> </div>
</v-hover> </v-hover>
<v-hover v-slot="{ hover }"> <v-hover v-slot="{ hover }">
<div> <div>
<v-menu offset-y> <v-menu offset-y>
<template v-slot:activator="{ on, attrs }"> <template v-slot:activator="{ on, attrs }">
<v-card-title> <v-card-title>
<span v-text="period" class="ma-1"></span> <span v-text="$root.django.gettext('Period') + ' ' + lessonDocumentationEdit.period" class="ma-1"></span>
<v-btn <v-btn
right right
v-bind="attrs" v-bind="attrs"
v-on="on" v-on="on"
icon icon
v-if="hover && dateAndPeriodEditable" v-if="hover && dateAndPeriodEditable"
> >
<v-icon>mdi-pencil-outline</v-icon> <v-icon>mdi-pencil-outline</v-icon>
</v-btn> </v-btn>
</v-card-title> </v-card-title>
</template> </template>
<v-list> <v-list>
<!-- Fixme: load valid lessons --> <!-- Fixme: load valid lessons -->
<v-list-item <v-list-item
v-for="(item, index) in [1, 2, 3, 4, 5, 6, 7, 8, 9]" v-for="(item, index) in [1, 2, 3, 4, 5, 6, 7, 8, 9]"
:key="index" :key="index"
> >
<v-list-item-title>{{ item }}</v-list-item-title> <v-list-item-title>{{ item }}</v-list-item-title>
</v-list-item> </v-list-item>
</v-list> </v-list>
</v-menu> </v-menu>
</div> </div>
</v-hover> </v-hover>
</v-col> </v-card-title>
<v-col cols="12" md="4" lg="6" xl="7"> <v-card-text>
<message-box type="error" v-if="error">Error updating data</message-box> <v-row>
<v-textarea <v-col cols="12" md="8" lg="8">
name="input-7-1" <message-box type="error" v-if="error">Error updating data</message-box>
:label="$root.django.gettext('Topic')" <v-textarea
rows="1" name="input-7-1"
auto-grow :label="$root.django.gettext('Topic')"
required rows="1"
auto-grow
required
v-model="lessonDocumentationEdit.topic" v-model="lessonDocumentationEdit.topic"
@change="mutate()" ></v-textarea>
></v-textarea> <v-textarea
<v-textarea name="input-7-1"
name="input-7-1" :label="$root.django.gettext('Homework')"
:label="$root.django.gettext('Homework')" rows="1"
rows="1" auto-grow
auto-grow
v-model="lessonDocumentationEdit.homework" v-model="lessonDocumentationEdit.homework"
@change="mutate()" ></v-textarea>
></v-textarea> <v-textarea
<v-textarea name="input-7-1"
name="input-7-1" :label="$root.django.gettext('Group note')"
:label="$root.django.gettext('Group note')" rows="1"
rows="1" auto-grow
auto-grow
v-model="lessonDocumentationEdit.groupNote" v-model="lessonDocumentationEdit.groupNote"
@change="mutate()" ></v-textarea>
></v-textarea> </v-col>
<v-btn right color="primary"> <v-col cols="12" md="4" lg="4">
Save Personal notes
</v-btn> <personal-notes
</v-col> :lesson-documentation-id="lessonDocumentationEdit.id"
<v-col cols="12" md="4" lg="3"> :groups="groups"
Personal notes :excuse-types="excuseTypes"
<personal-notes :extra-marks="extraMarks"
:lesson-documentation-id="lessonDocumentationEdit.id"
:groups="groups"
:excuse-types="excuseTypes"
:extra-marks="extraMarks"
v-model="lessonDocumentationEdit.personalNotes" v-model="lessonDocumentationEdit.personalNotes"
@change="$emit('change-personal-notes', $event)" @change="$emit('change-personal-notes', $event)"
></personal-notes> ></personal-notes>
</v-col> </v-col>
</v-row> </v-row>
</v-card-text>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn
color="error"
outlined
@click="$emit('cancel-lesson-documentation-dialog', $event)"
>
{{ $root.django.gettext('Cancel') }}
</v-btn>
<v-btn
color="success"
@click="mutate()"
>
{{ $root.django.gettext('Save') }}
</v-btn>
</v-card-actions>
</v-form> </v-form>
</v-card> </v-card>
</template> </template>
...@@ -119,18 +134,21 @@ ...@@ -119,18 +134,21 @@
</template> </template>
<script> <script>
import PersonalNotes from "./PersonalNotes.vue"; import PersonalNotes from "./PersonalNotes.vue";
export default {
components: { PersonalNotes }, export default {
props: [ "lessonDocumentationEdit", "groups", "excuseTypes", "extraMarks" ], components: {PersonalNotes},
name: "lesson-documentation", props: ["lessonDocumentationEdit", "groups", "excuseTypes", "extraMarks"],
data () { name: "lesson-documentation",
return { data() {
//lessonDocumentationEdit: {}, return {
} dateAndPeriodEditable: false,
}, showPicker: false,
//created() { //lessonDocumentationEdit: {},
//this.lessonDocumentationEdit = this.lessonDocumentation }
//} },
} //created() {
//this.lessonDocumentationEdit = this.lessonDocumentation
//}
}
</script> </script>
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
:groups="groups" :groups="groups"
:excuse-types="excuseTypes" :excuse-types="excuseTypes"
:extra-marks="extraMarks" :extra-marks="extraMarks"
@cancel-lesson-documentation-dialog="cancelDialog"
/> />
</v-dialog> </v-dialog>
<v-data-table <v-data-table
...@@ -87,6 +88,19 @@ ...@@ -87,6 +88,19 @@
}, },
}, },
methods: { methods: {
cancelDialog() {
this.dialog = false;
this.lessonDocumentationEdit = {};
},
recordDocumentation(item) {
if (this.documentLessonTopicsByWeek === "True") {
if (this.recordedWeeks.includes(item.week)) {
return false
}
this.recordedWeeks.push(item.week)
}
return true
},
async loadLessonDocumentation(item) { async loadLessonDocumentation(item) {
const result = await this.$apollo.mutate({ const result = await this.$apollo.mutate({
mutation: require("./LessonDocumentation.graphql"), mutation: require("./LessonDocumentation.graphql"),
...@@ -104,6 +118,7 @@ ...@@ -104,6 +118,7 @@
year: item.year, year: item.year,
week: item.week, week: item.week,
date: lessonDocumentation.date, date: lessonDocumentation.date,
period: item.period,
lessonPeriodId: item.lessonPeriod ? item.lessonPeriod.id : null, lessonPeriodId: item.lessonPeriod ? item.lessonPeriod.id : null,
eventId: item.event ? item.event.id : null, eventId: item.event ? item.event.id : null,
extraLessonId: item.extraLesson ? item.extraLesson.id : null, extraLessonId: item.extraLesson ? item.extraLesson.id : null,
......
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