Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AlekSIS-App-Alsijil
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
AlekSIS®
Official
AlekSIS-App-Alsijil
Commits
5c55e982
Commit
5c55e982
authored
2 years ago
by
Julian
Browse files
Options
Downloads
Patches
Plain Diff
Update LessonDocumentations using mutation
parent
0d344581
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
assets/js/vue/components/alsijil/LessonDocumentation.js
+149
-103
149 additions, 103 deletions
assets/js/vue/components/alsijil/LessonDocumentation.js
with
149 additions
and
103 deletions
assets/js/vue/components/alsijil/LessonDocumentation.js
+
149
−
103
View file @
5c55e982
...
...
@@ -6,112 +6,158 @@ export default {
valid
:
false
,
showPicker
:
false
,
dateAndPeriodEditable
:
false
,
// We use reactive properties and set the values *once*.
// Otherwise Vue won't allow this, as we aren't allowed to edit props via v-model.
editTopic
:
""
,
editHomework
:
""
,
editGroupNote
:
""
,
}
},
created
()
{
this
.
editTopic
=
this
.
topic
;
this
.
editHomework
=
this
.
homework
;
this
.
editGroupNote
=
this
.
groupNote
;
},
computed
:
{
lessonDocumentationMutationInputObject
()
{
return
{
id
:
this
.
id
,
topic
:
this
.
editTopic
,
groupNote
:
this
.
editGroupNote
,
homework
:
this
.
editHomework
,
}
}
},
methods
:
{
onDone
(
data
)
{
console
.
log
(
"
Hello
"
)
console
.
log
(
data
)
}
},
template
:
`
<v-card elevation="2">
<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-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(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="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>
<!-- (this.$root.django.gettext('%s. Period'), period)-->
<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>
<!-- Fixme: load valid lessons -->
<v-list-item
v-for="(item, index) in [1, 2, 3, 4, 5, 6, 7, 8, 9]"
:key="index"
<ApolloMutation
:mutation="gql => gql
\`
mutation UpdateLessonDocumentation($input: LessonDocumentationMutationInput!) {
updateLessonDocumentation(input: $input) {
lessonDocumentation {
id
topic
groupNote
homework
}
}
}
\`
"
:variables="{ input: lessonDocumentationMutationInputObject }"
@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-model="showPicker"
:close-on-content-click="false"
transition="scale-transition"
offset-y
min-width="auto"
>
<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">
<v-textarea
name="input-7-1"
:label="this.$root.django.gettext('Topic')"
rows="1"
auto-grow
required
:value="topic"
@input="$emit('change-topic', $event)"
></v-textarea>
<v-textarea
name="input-7-1"
:label="this.$root.django.gettext('Homework')"
rows="1"
auto-grow
:value="homework"
@input="$emit('change-homework', $event)"
></v-textarea>
<v-textarea
name="input-7-1"
:label="this.$root.django.gettext('Group note')"
rows="1"
auto-grow
:value="groupNote"
@input="$emit('change-group-note', $event)"
></v-textarea>
</v-col>
<v-col cols="12" md="4" lg="3">
<personal-notes
:groups="groups"
:excuse-types="excuseTypes"
:extra-marks="extraMarks"
v-model="personalNotes"
@change="$emit('change-personal-notes', $event)"
></personal-notes>
</v-col>
</v-row>
</v-form>
</v-card>
<template v-slot:activator="{ on, attrs }">
<v-card-title>
<span v-text="new Date(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="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
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>
<!-- Fixme: load valid lessons -->
<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-model="editTopic"
@change="mutate()"
></v-textarea>
<v-textarea
name="input-7-1"
:label="$root.django.gettext('Homework')"
rows="1"
auto-grow
v-model="editHomework"
@change="mutate()"
></v-textarea>
<v-textarea
name="input-7-1"
:label="$root.django.gettext('Group note')"
rows="1"
auto-grow
v-model="editGroupNote"
@change="mutate()"
></v-textarea>
</v-col>
<v-col cols="12" md="4" lg="3">
<personal-notes
:groups="groups"
:excuse-types="excuseTypes"
:extra-marks="extraMarks"
v-model="personalNotes"
@change="$emit('change-personal-notes', $event)"
></personal-notes>
</v-col>
</v-row>
</v-form>
</v-card>
</template>
</ApolloMutation>
`
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment