Skip to content
Snippets Groups Projects
Commit 7ef753e0 authored by Julian's avatar Julian
Browse files

Create generic menu to copy data from a different validity range

parent e61e01ae
No related branches found
No related tags found
1 merge request!2Resolve "Frontend for Models"
<script>
import {defineComponent} from 'vue'
import ConfirmDialog from "aleksis.core/components/generic/dialogs/ConfirmDialog.vue";
import PrimaryActionButton from "aleksis.core/components/generic/buttons/PrimaryActionButton.vue";
export default defineComponent({
name: "CopyFromRangeMenu",
components: {ConfirmDialog, PrimaryActionButton},
computed: {
ranges() {
return []; // FIXME: Get ranges from backend
},
},
data() {
return {
dialog: false,
rangeToCopyFrom: null,
}
},
methods: {
openConfirmationDialog(range) {
this.rangeToCopyFrom = range;
this.dialog = true;
console.log("Opening dialog");
console.log(!!this.dialog);
},
confirm() {
console.log("Confirmed");
this.$emit("confirm", this.rangeToCopyFrom);
this.dialog = false;
},
cancel() {
console.log("Cancelled");
this.dialog = false;
this.rangeToCopyFrom = null;
},
},
})
</script>
<template>
<div>
<v-menu
offset-y
>
<template #activator="{ attrs, on }">
<slot name="activator" :attrs="attrs" :on="on">
<primary-action-button i18n-key="actions.copy_last_configuration" icon="mdi-content-copy"/>
</slot>
</template>
<v-list dense>
<v-list-item v-for="range in ranges" @click="openConfirmationDialog(range)">
<v-list-item-title>{{ range }}</v-list-item-title>
</v-list-item>
</v-list>
</v-menu>
<confirm-dialog v-model="dialog" @confirm="confirm" @cancel="cancel">
<template #title>
{{ $t('actions.confirm_copy_last_configuration') }}
</template>
<template #text>
{{ $t('actions.confirm_copy_last_configuration_message') }}
</template>
</confirm-dialog>
</div>
</template>
<style scoped>
</style>
\ No newline at end of file
...@@ -93,6 +93,8 @@ ...@@ -93,6 +93,8 @@
"actions": { "actions": {
"copy_to_day": "Copy to another day", "copy_to_day": "Copy to another day",
"search_courses": "Search Courses", "search_courses": "Search Courses",
"copy_last_configuration": "Copy from different range" "copy_last_configuration": "Copy from different range",
"confirm_copy_last_configuration": "Do you really want to copy another configuration to this range?",
"confirm_copy_last_configuration_message": "This will overwrite all existing data in this range. This action cannot be undone."
} }
} }
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