feat: edit groups pop up verbeteren
This commit is contained in:
parent
a3185ed1c1
commit
45563b68ea
2 changed files with 292 additions and 290 deletions
|
@ -1,6 +1,5 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { computed, ref, watch } from "vue";
|
import { computed, ref, watch } from "vue";
|
||||||
import draggable from "vuedraggable";
|
|
||||||
import { useI18n } from "vue-i18n";
|
import { useI18n } from "vue-i18n";
|
||||||
import { useClassStudentsQuery } from "@/queries/classes";
|
import { useClassStudentsQuery } from "@/queries/classes";
|
||||||
|
|
||||||
|
@ -46,7 +45,12 @@
|
||||||
|
|
||||||
// Initialize groups if they exist
|
// Initialize groups if they exist
|
||||||
if (existingGroups && existingGroups.length > 0) {
|
if (existingGroups && existingGroups.length > 0) {
|
||||||
currentGroups.value = existingGroups.map((g) => [...g.members]);
|
currentGroups.value = existingGroups.map((group) =>
|
||||||
|
group.members.map(member => ({
|
||||||
|
username: member.username,
|
||||||
|
fullName: `${member.firstName} ${member.lastName}`
|
||||||
|
}))
|
||||||
|
);
|
||||||
const assignedUsernames = new Set(
|
const assignedUsernames = new Set(
|
||||||
existingGroups.flatMap((g) => g.members.map((m: StudentItem) => m.username)),
|
existingGroups.flatMap((g) => g.members.map((m: StudentItem) => m.username)),
|
||||||
);
|
);
|
||||||
|
@ -63,6 +67,7 @@
|
||||||
{ immediate: true },
|
{ immediate: true },
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
// Random groups functions
|
// Random groups functions
|
||||||
function generateRandomGroups() {
|
function generateRandomGroups() {
|
||||||
if (groupSize.value < 1) return;
|
if (groupSize.value < 1) return;
|
||||||
|
@ -195,22 +200,9 @@
|
||||||
>
|
>
|
||||||
<h3 class="mb-2">{{ t("current-groups") }}</h3>
|
<h3 class="mb-2">{{ t("current-groups") }}</h3>
|
||||||
<div
|
<div
|
||||||
v-for="(group, index) in currentGroups"
|
|
||||||
:key="'preview-' + index"
|
|
||||||
class="mb-3"
|
|
||||||
>
|
>
|
||||||
<div class="d-flex align-center">
|
|
||||||
<strong class="mr-2">{{ t("group") }} {{ index + 1 }}:</strong>
|
|
||||||
<span class="text-caption">({{ group.length }} {{ t("members") }})</span>
|
|
||||||
</div>
|
|
||||||
<div class="d-flex flex-wrap">
|
<div class="d-flex flex-wrap">
|
||||||
<v-chip
|
<label>{{currentGroups.length}}</label>
|
||||||
v-for="student in group"
|
|
||||||
:key="student.username"
|
|
||||||
class="ma-1"
|
|
||||||
>
|
|
||||||
{{ student.fullName }}
|
|
||||||
</v-chip>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -218,7 +210,7 @@
|
||||||
v-if="unassignedStudents.length > 0"
|
v-if="unassignedStudents.length > 0"
|
||||||
class="mt-3"
|
class="mt-3"
|
||||||
>
|
>
|
||||||
<strong>{{ t("unassigned") }}:</strong>
|
<strong>{{ t("unassigned-students") }}:</strong>
|
||||||
<div class="d-flex flex-wrap">
|
<div class="d-flex flex-wrap">
|
||||||
<label>{{unassignedStudents.length}}</label>
|
<label>{{unassignedStudents.length}}</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -414,6 +414,7 @@
|
||||||
max-width="800"
|
max-width="800"
|
||||||
persistent
|
persistent
|
||||||
>
|
>
|
||||||
|
<v-card>
|
||||||
<v-card-text>
|
<v-card-text>
|
||||||
<GroupSelector
|
<GroupSelector
|
||||||
:groups="allGroups"
|
:groups="allGroups"
|
||||||
|
@ -422,6 +423,15 @@
|
||||||
@close="editGroups = false"
|
@close="editGroups = false"
|
||||||
/>
|
/>
|
||||||
</v-card-text>
|
</v-card-text>
|
||||||
|
<v-card-actions>
|
||||||
|
<v-btn
|
||||||
|
text
|
||||||
|
@click="editGroups = false"
|
||||||
|
>{{ t("cancel") }}
|
||||||
|
</v-btn
|
||||||
|
>
|
||||||
|
</v-card-actions>
|
||||||
|
</v-card>
|
||||||
</v-dialog>
|
</v-dialog>
|
||||||
</v-container>
|
</v-container>
|
||||||
</using-query-result>
|
</using-query-result>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue