From 7dc7e77c622f5e7a19f8fda272a0ec7895090bfe Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Wed, 13 Aug 2025 10:56:53 +0200 Subject: [PATCH] WIP enable moving documents to evaluations - Add new button and logic in `DocumentsList.vue` for moving documents - Implement `moveDocumentToEvaluation` method in `FormEvaluation.vue` - Ensure duplication and moving actions are mutually exclusive - Add event for moving documents to evaluations --- .../components/DocumentsList.vue | 26 ++++++++--- .../components/FormEvaluation.vue | 43 ++++++++++++------- 2 files changed, 49 insertions(+), 20 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/components/DocumentsList.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/components/DocumentsList.vue index b295f2ba6..abe797824 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/components/DocumentsList.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/components/DocumentsList.vue @@ -267,17 +267,33 @@ const emit = defineEmits([ const showAccompanyingPeriodSelector = ref(false); const selectedEvaluation = ref(null); -const selectedDocument = ref(null); +const selectedDocumentToDuplicate = ref(null); +const selectedDocumentToMove = ref(null); const prepareDocumentDuplicationToWork = (d) => { - selectedDocument.value = d; - showAccompanyingPeriodSelector.value = true; + selectedDocumentToDuplicate.value = d; + /** ensure selectedDocumentToMove is null */ + selectedDocumentToMove.value = null; + + showAccompanyingPeriodSelector.value = true; +}; + +const prepareDocumentMoveToWork = (d) => { + selectedDocumentToMove.value = d; + /** ensure selectedDocumentToDuplicate is null */ + selectedDocumentToDuplicate.value = null; + + showAccompanyingPeriodSelector.value = true; }; watch(selectedEvaluation, (val) => { + if (selectedDocumentToDuplicate.value) { emit("duplicateDocumentToEvaluation", { - evaluation: val, - document: selectedDocument.value, + evaluation: val, + document: selectedDocumentToDuplicate.value, }); + } else { + console.log('this is the document to move', selectedDocumentToMove.value); + } }); diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/components/FormEvaluation.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/components/FormEvaluation.vue index bbd26da5d..ba762228f 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/components/FormEvaluation.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/components/FormEvaluation.vue @@ -20,21 +20,20 @@ - + { + console.log("new document", response); + toast.open({ message: trans(DOCUMENT_DUPLICATE_TO_EVALUATION_SUCCESS) }); + }) + .catch((error) => { + console.log(error); + }); +} + function onStatusDocumentChanged(newStatus) { store.commit("statusDocumentChanged", { key: props.evaluation.key,