do not allow to remove doc or evaluations if workflow is associated

This commit is contained in:
Julien Fastré 2022-03-07 00:29:11 +01:00
parent b2a61071bf
commit efbd9b0185
2 changed files with 15 additions and 2 deletions

View File

@ -26,7 +26,7 @@
></list-workflow-modal> ></list-workflow-modal>
</li> </li>
<li> <li v-if="canDelete">
<a class="btn btn-delete" @click="modal.showModal = true" :title="$t('action.delete')"></a> <a class="btn btn-delete" @click="modal.showModal = true" :title="$t('action.delete')"></a>
</li> </li>
</ul> </ul>
@ -98,6 +98,19 @@ export default {
pickedEvaluations() { pickedEvaluations() {
return this.$store.state.evaluationsPicked; return this.$store.state.evaluationsPicked;
}, },
canDelete() {
if (this.evaluation.workflows.length > 0) {
return false;
}
for (let doc of this.evaluation.documents) {
if (doc.workflows.length > 0) {
return false;
}
}
return true;
},
}, },
methods: { methods: {
removeEvaluation(e) { removeEvaluation(e) {

View File

@ -101,7 +101,7 @@
<li> <li>
<a :href="buildEditLink(d.storedObject)" class="btn btn-wopilink"></a> <a :href="buildEditLink(d.storedObject)" class="btn btn-wopilink"></a>
</li> </li>
<li> <li v-if="d.workflows.length === 0">
<a class="btn btn-delete" @click="removeDocument(d)"> <a class="btn btn-delete" @click="removeDocument(d)">
</a> </a>
</li> </li>