{"version":3,"file":"stylesheets/9235.css?h=9b0e96f66f036f1e353f","mappings":"AAwGA,oBAEA,mBADA,YAEA","sources":["webpack://@studip/core/./resources/vue/components/courseware/structural-element/CoursewareFeedbackPopup.vue"],"sourcesContent":["<template>\n    <studip-dialog\n        height=\"430\"\n        width=\"600\"\n        :title=\"$gettext('Feedback')\"\n        :confirmText=\"$gettext('Feedback abgeben')\"\n        confirmClass=\"accept\"\n        :closeText=\"$gettext('Schließen')\"\n        closeClass=\"cancel\"\n        @close=\"$emit('close')\"\n        @confirm=\"submitEntry\"\n    >\n        <template v-slot:dialogContent>\n            <h2>{{ $gettextInterpolate($gettext('Bewertung für %{title}'),  { title: structuralElement.attributes.title }) }}</h2>\n\n            <div class=\"feedback-entry-create\">\n                <studip-five-stars-input v-model=\"rating\" />\n                <label v-if=\"isCommentable\">\n                    {{ $gettext('Kommentar') }}\n                    <textarea v-model=\"comment\"></textarea>\n                </label>\n                <label v-if=\"anonymousEntriesEnabled\">\n                    <input type=\"checkbox\" v-model=\"anonymous\" />\n                    {{ $gettext('Feedback anonym abgeben') }}\n                </label>\n            </div>\n        </template>\n    </studip-dialog>\n</template>\n<script>\nimport StudipFiveStarsInput from '../../feedback/StudipFiveStarsInput.vue';\n\nimport { mapActions, mapGetters } from 'vuex';\n\nexport default {\n    name: 'courseware-feedback-popup',\n    components: {\n        StudipFiveStarsInput,\n    },\n    props: {\n        feedbackElement: {\n            type: Object,\n            required: true,\n        },\n    },\n    data() {\n        return {\n            rating: 0,\n            comment: '',\n            anonymous: false\n        };\n    },\n    computed: {\n        ...mapGetters({\n            currentUser: 'currentUser',\n            structuralElementById: 'courseware-structural-elements/byId',\n        }),\n        structuralElement() {\n            return this.structuralElementById({ id: this.feedbackElement.relationships.range.data.id });\n        },\n        anonymousEntriesEnabled() {\n            return this.feedbackElement.attributes['anonymous-entries'];\n        },\n        isCommentable() {\n            return this.feedbackElement.attributes['is-commentable'];\n        }\n    },\n    methods: {\n        ...mapActions({\n            createFeedbackEntries: 'feedback-entries/create',\n        }),\n        submitEntry() {\n            let data = {\n                attributes: {\n                    rating: this.rating,\n                },\n                relationships: {\n                    'feedback-element': {\n                        data: {\n                            type: 'feedback-elements',\n                            id: this.feedbackElement.id,\n                        },\n                    },\n                    author: {\n                        data: {\n                            id: this.currentUser.id,\n                            type: 'users',\n                        },\n                    },\n                },\n            };\n            if (this.isCommentable) {\n                data.attributes.comment = this.comment\n            }\n            if (this.anonymousEntriesEnabled) {\n                data.attributes.anonymous = this.anonymous;\n            }\n            this.createFeedbackEntries(data);\n            this.$emit('submit');\n        },\n    },\n};\n</script>\n<style scoped>\nh2 {\n    margin-top: 0;\n    margin-bottom: 20px;\n}\n</style>\n"],"names":[],"sourceRoot":""}