diff --git a/frontend/package.json b/frontend/package.json index 0826edae..1699e2b5 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -27,6 +27,7 @@ "vue": "^3.5.13", "vue-i18n": "^11.1.2", "vue-router": "^4.5.0", + "vuedraggable": "^2.24.3", "vuetify": "^3.7.12", "wait-on": "^8.0.3" }, diff --git a/frontend/src/components/assignments/GroupSelector.vue b/frontend/src/components/assignments/GroupSelector.vue index d8a16164..a56f7762 100644 --- a/frontend/src/components/assignments/GroupSelector.vue +++ b/frontend/src/components/assignments/GroupSelector.vue @@ -1,75 +1,114 @@ - - {{ t("create-groups") }} + + {{ t("edit-groups") }} - + + + + {{ t("unassigned") }} + + + {{ element }} + + + + + + + {{ t("group") }} {{ i + 1 }} + + + {{ element }} + + + + + {{ t("remove-group") }} + + + - {{ t("create-group") }} + {{ t("add-group") }} - + + + {{ t("save") }} + + + {{ t("cancel") }} + + + - + diff --git a/frontend/src/views/assignments/TeacherAssignment.vue b/frontend/src/views/assignments/TeacherAssignment.vue index f15bd8dd..81ffae9e 100644 --- a/frontend/src/views/assignments/TeacherAssignment.vue +++ b/frontend/src/views/assignments/TeacherAssignment.vue @@ -17,7 +17,7 @@ import {descriptionRules, learningPathRules} from "@/utils/assignment-rules.ts"; import GroupSubmissionStatus from "@/components/GroupSubmissionStatus.vue" import GroupProgressRow from "@/components/GroupProgressRow.vue" import type {AssignmentDTO} from "@dwengo-1/common/dist/interfaces/assignment.ts"; -import router from "@/router"; +import GroupSelector from "@/components/assignments/GroupSelector.vue"; const props = defineProps<{ classId: string; @@ -35,9 +35,12 @@ const {t} = useI18n(); const lang = ref(); const groups = ref([]); const learningPath = ref(); +const form = ref(); + const editingLearningPath = ref(learningPath); const description = ref(""); +const editGroups = ref(false); const assignmentQueryResult = useAssignmentQuery(() => props.classId, props.assignmentId); @@ -111,7 +114,7 @@ function goToGroupSubmissionLink(groupNo: number): string | undefined { const learningPathsQueryResults = useGetAllLearningPaths(lang); -const { mutate, data, isSuccess } = useUpdateAssignmentMutation(); +const {mutate, data, isSuccess} = useUpdateAssignmentMutation(); watch([isSuccess, data], ([success, newData]) => { if (success && newData?.assignment) { @@ -120,9 +123,10 @@ watch([isSuccess, data], ([success, newData]) => { }); async function saveChanges(): Promise { + const {valid} = await form.value.validate(); + if (!valid) return; + isEditing.value = false; - //const { valid } = await form.value.validate(); - //if (!valid) return; const lp = learningPath.value; @@ -133,8 +137,14 @@ async function saveChanges(): Promise { deadline: new Date(), }; - mutate({ cid: assignmentQueryResult.data.value?.assignment.within, an: assignmentQueryResult.data.value?.assignment.id, data: assignmentDTO }); + mutate({ + cid: assignmentQueryResult.data.value?.assignment.within, + an: assignmentQueryResult.data.value?.assignment.id, + data: assignmentDTO + }); } + + @@ -157,237 +167,256 @@ async function saveChanges(): Promise { md="6" class="responsive-col" > - - - - - mdi-arrow-left - - + + + + + mdi-arrow-left + + + { isEditing = true; description = assignmentResponse.data.assignment.description; } " - > - mdi-pencil - - {isEditing = false; editingLearningPath=learningPath}" - >{{ t("cancel") }} - + > + mdi-pencil + + {isEditing = false; editingLearningPath=learningPath}" + >{{ t("cancel") }} + - - mdi-delete - - - mdi-content-save-edit-outline - + > + mdi-delete + + + mdi-content-save-edit-outline + + - - {{ - assignmentResponse.data.assignment.title - }} - - - {{ + assignmentResponse.data.assignment.title + }} + + - - {{ t("learning-path") }} - - - - - - + {{ t("learning-path") }} + + + + + + - - - - - {{ assignmentResponse.data.assignment.description }} - - - - - - - - - {{ t("members") }} - - - - - {{ member.firstName + " " + member.lastName }} - - - - + > - - Close - + + + {{ assignmentResponse.data.assignment.description }} + + + + + + + + + + + {{ t("members") }} + + + - - - - - - - - - - {{ t("group") }} - {{ t("progress") }} - {{ t("submission") }} - - mdi-pencil - - - - - - + + {{ member.firstName + " " + member.lastName }} + + + + + + Close + - {{ g.name }} - mdi-menu-right - - - - - - - - - - - - - - - mdi-delete - - - - - - + + + + + + + + + + + {{ t("group") }} + {{ t("progress") }} + {{ t("submission") }} + + + mdi-pencil + + + + + + + + + + {{ g.name }} + mdi-menu-right + + + + + + + + + + + + + + + mdi-delete + + + + + + + + + + + diff --git a/package-lock.json b/package-lock.json index d1a3b3a7..51de0bd8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -107,6 +107,7 @@ "vue": "^3.5.13", "vue-i18n": "^11.1.2", "vue-router": "^4.5.0", + "vuedraggable": "^2.24.3", "vuetify": "^3.7.12", "wait-on": "^8.0.3" }, @@ -7599,6 +7600,12 @@ "node": ">= 6.0.0" } }, + "node_modules/sortablejs": { + "version": "1.10.2", + "resolved": "https://registry.npmjs.org/sortablejs/-/sortablejs-1.10.2.tgz", + "integrity": "sha512-YkPGufevysvfwn5rfdlGyrGjt7/CRHwvRPogD/lC+TnvcN29jDpCifKP+rBqf+LRldfXSTh+0CGLcSg0VIxq3A==", + "license": "MIT" + }, "node_modules/source-map-js": { "version": "1.2.1", "license": "BSD-3-Clause", @@ -8970,6 +8977,15 @@ "typescript": ">=5.0.0" } }, + "node_modules/vuedraggable": { + "version": "2.24.3", + "resolved": "https://registry.npmjs.org/vuedraggable/-/vuedraggable-2.24.3.tgz", + "integrity": "sha512-6/HDXi92GzB+Hcs9fC6PAAozK1RLt1ewPTLjK0anTYguXLAeySDmcnqE8IC0xa7shvSzRjQXq3/+dsZ7ETGF3g==", + "license": "MIT", + "dependencies": { + "sortablejs": "1.10.2" + } + }, "node_modules/vuetify": { "version": "3.8.2", "license": "MIT",