mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-12 13:24:25 +00:00
AccompanyingCourseWorkEdit: replace document by a new one (working now)
This commit is contained in:
parent
dbe186547f
commit
6eac6044cd
@ -297,10 +297,6 @@ export default {
|
|||||||
this.$store.commit('addDocument', {key: this.evaluation.key, document: document});
|
this.$store.commit('addDocument', {key: this.evaluation.key, document: document});
|
||||||
},
|
},
|
||||||
replaceDocument(oldDocument, storedObject) {
|
replaceDocument(oldDocument, storedObject) {
|
||||||
|
|
||||||
console.log(oldDocument);
|
|
||||||
console.log(storedObject);
|
|
||||||
//console.log(oldDocument) how to get the old document?
|
|
||||||
let document = {
|
let document = {
|
||||||
type: 'accompanying_period_work_evaluation_document',
|
type: 'accompanying_period_work_evaluation_document',
|
||||||
storedObject: storedObject,
|
storedObject: storedObject,
|
||||||
|
@ -213,27 +213,28 @@ const store = createStore({
|
|||||||
}));
|
}));
|
||||||
},
|
},
|
||||||
removeDocument(state, {key, document}) {
|
removeDocument(state, {key, document}) {
|
||||||
let evaluations = state.evaluationsPicked.find(e => e.key === key);
|
let evaluation = state.evaluationsPicked.find(e => e.key === key);
|
||||||
|
|
||||||
if (evaluations === undefined) {
|
if (evaluation === undefined) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
evaluations.documents = evaluations.documents.filter(d => d.key !== document.key);
|
evaluation.documents = evaluation.documents.filter(d => d.key !== document.key);
|
||||||
},
|
},
|
||||||
replaceDocument(state, payload) {
|
replaceDocument(state, payload) {
|
||||||
console.log('payload', payload)
|
let evaluation = state.evaluationsPicked.find(e => e.key === payload.key);
|
||||||
console.log(state.evaluationsPicked)
|
if (evaluation === undefined) {
|
||||||
let evaluations = state.evaluationsPicked.find(e => e.key === payload.key);
|
|
||||||
console.log(evaluations)
|
|
||||||
if (evaluations === undefined) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Add document with map
|
let newDocument = Object.assign(
|
||||||
evaluations.documents = evaluations.documents.map(d => d.key === payload.oldDocument.key ? payload.document : d); //TODO no key on documents!
|
payload.document, {
|
||||||
console.log(evaluations)
|
key: evaluation.documents.length + 1,
|
||||||
|
workflows_availables: state.work.workflows_availables_evaluation_documents,
|
||||||
|
workflows: [],
|
||||||
|
}
|
||||||
|
);
|
||||||
|
evaluation.documents = evaluation.documents.map(d => d.id === payload.oldDocument.id ? newDocument : d);
|
||||||
},
|
},
|
||||||
addEvaluation(state, evaluation) {
|
addEvaluation(state, evaluation) {
|
||||||
let e = {
|
let e = {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user