mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-10 08:44:58 +00:00
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:
@@ -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>
|
||||
|
@@ -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,
|
||||
|
Reference in New Issue
Block a user