aboutsummaryrefslogtreecommitdiff
path: root/resources/vue/components/courseware/tasks/peer-review/ProcessCreateDialog.vue
blob: 1615107cf832a7c296f817eaf8396567416e7f42 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
<template>
    <StudipDialog
        :title="$gettext('Peer-Review-Prozess anlegen')"
        :confirmText="$gettext('Anlegen')"
        :confirmDisabled="creating"
        :closeText="$gettext('Abbrechen')"
        @close="$emit('close')"
        @confirm="create"
        height="800"
        width="800"
    >
        <template #dialogContent>
            <div v-if="!creating" class="with-sidebar">
                <div>
                    <ul>
                        <li :class="{ active: selectedSlot === 'configuration' }">
                            <a href="#" @click.prevent="selectedSlot = 'configuration'">
                                {{ $gettext('Einstellungen') }}
                            </a>
                        </li>
                        <li :class="{ active: selectedSlot === 'assessment' }">
                            <a href="#" @click.prevent="selectedSlot = 'assessment'">
                                {{ $gettext('Bewertungssystem') }}
                            </a>
                        </li>
                    </ul>
                </div>
                <div v-if="selectedSlot === 'configuration'">
                    <ProcessCreateForm :configuration="configuration" @update="updateConfiguration" />
                </div>
                <div v-if="selectedSlot === 'assessment'">
                    <AssessmentTypeEditor :configuration="configuration" @update="updateConfiguration" />
                </div>
            </div>
            <div v-if="creating">
                <CompanionBox :msgCompanion="$gettext('Der Peer-Review-Prozess wird jetzt angelegt.')" />
            </div>
        </template>
    </StudipDialog>
</template>

<script>
import AssessmentTypeEditor from './AssessmentTypeEditor.vue';
import CompanionBox from '../../layouts/CoursewareCompanionBox.vue';
import ProcessCreateForm from './ProcessCreateForm.vue';
import StudipDialog from '../../../StudipDialog.vue';
import { defaultConfiguration, ProcessConfiguration } from './process-configuration';

export default {
    components: { AssessmentTypeEditor, CompanionBox, ProcessCreateForm, StudipDialog },
    props: ['taskGroup'],
    data: () => ({
        changed: false,
        configuration: defaultConfiguration(),
        creating: false,
        selectedSlot: 'configuration',
    }),
    methods: {
        create() {
            if (this.creating) {
                return;
            }
            this.creating = true;
            this.$emit('create', { ...this.configuration });
        },
        updateConfiguration(configuration) {
            this.changed = true;
            this.configuration = configuration;
        },
    },
};
</script>

<style scoped lang="scss">
.with-sidebar {
    display: flex;
    flex-wrap: wrap;
    gap: 1em;
}

.with-sidebar > :first-child {
    flex-grow: 1;
}

.with-sidebar > :last-child {
    flex-basis: 0;
    flex-grow: 999;
    min-inline-size: 50%;
}

.with-sidebar > :first-child {
    ul {
        list-style: none;
        padding: 0;
        width: 12em;

        > li:has(> a):not(:last-child) {
            border-bottom: solid thin var(--color--sidebar-divider);
        }

        > li {
            padding-block: 2px;
            padding-inline-start: 5px;

            a {
                display: block;
                line-height: 17px;
                padding-block: 4px;
                padding-inline: 0px;
                word-wrap: break-word;
            }

            &.active {
                background-color: var(--color--sidebar-active);
                border-left: solid 4px var(--color--sidebar-marker-active);
                margin-left: -4px;
                padding-left: 1px;

                a {
                    color: var(--black);
                    padding-left: 4px;
                }
            }
        }

        > li.active {
            background-color: var(--color--sidebar-active);
        }
    }
}
</style>