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
This commit is contained in:
2025-08-13 10:56:53 +02:00
parent 9d58904969
commit 7dc7e77c62
2 changed files with 49 additions and 20 deletions

View File

@@ -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;
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,
document: selectedDocumentToDuplicate.value,
});
} else {
console.log('this is the document to move', selectedDocumentToMove.value);
}
});
</script>

View File

@@ -28,9 +28,8 @@
@inputDocumentTitle="onInputDocumentTitle"
@removeDocument="removeDocument"
@duplicateDocument="duplicateDocument"
@duplicate-document-to-evaluation="
duplicateDocumentToEvaluation
"
@duplicate-document-to-evaluation="duplicateDocumentToEvaluation"
@move-document-to-evaluation="moveDocumentToEvaluation"
@statusDocumentChanged="onStatusDocumentChanged"
@goToGenerateWorkflow="goToGenerateWorkflowEvaluationDocument"
@goToGenerateNotification="goToGenerateDocumentNotification"
@@ -259,6 +258,20 @@ function duplicateDocumentToEvaluation({ evaluation, document }) {
});
}
function moveDocumentToEvaluation({ evaluation, document }) {
const url = `/api/1.0/person/accompanying-course-work-evaluation-document/${document.id}/evaluation/${evaluation.id}/duplicate`;
// console.log('document id', document.id, 'evaluation id', evaluation.id)
makeFetch("POST", url)
.then((response) => {
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,