Skip to content
Snippets Groups Projects
Commit 17b76eec authored by Hangzhi Yu's avatar Hangzhi Yu
Browse files

Beautify lesson documentation edit dialog

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