Filter out document from attachment list if it is the same as the workflow document

This commit is contained in:
Julie Lenaerts 2025-07-24 17:19:51 +02:00
parent 376497b704
commit c4d5984b92
7 changed files with 39 additions and 9 deletions

View File

@ -0,0 +1,6 @@
kind: Feature
body: Only allow delete of attachment on workflows that are not final
time: 2025-07-24T16:15:56.042884578+02:00
custom:
Issue: ""
SchemaChange: No schema change

View File

@ -0,0 +1,6 @@
kind: Feature
body: Move up signature buttons on index workflow page for easier access
time: 2025-07-24T16:16:28.609598883+02:00
custom:
Issue: ""
SchemaChange: No schema change

View File

@ -0,0 +1,6 @@
kind: Feature
body: Filter out document from attachment list if it is the same as the workflow document
time: 2025-07-24T17:20:13.118537573+02:00
custom:
Issue: ""
SchemaChange: No schema change

View File

@ -1,6 +1,6 @@
import {fetchResults, makeFetch} from "ChillMainAssets/lib/api/apiMethods";
import { GenericDocForAccompanyingPeriod } from "ChillDocStoreAssets/types/generic_doc";
import {Address, EntityWorkflow} from "ChillMainAssets/types";
import {EntityWorkflow} from "ChillMainAssets/types";
export function fetch_generic_docs_by_accompanying_period(
periodId: number,

View File

@ -25,7 +25,7 @@ export interface GenericDoc {
type: "doc_store_generic_doc";
uniqueKey: string;
key: string;
identifiers: object;
identifiers: { id: number; };
context: "person" | "accompanying-period";
doc_date: DateTime;
metadata: GenericDocMetadata;

View File

@ -1,13 +1,12 @@
<script setup lang="ts">
import {
GenericDoc,
GenericDocForAccompanyingPeriod,
} from "ChillDocStoreAssets/types/generic_doc";
import {GenericDoc, GenericDocForAccompanyingPeriod,} from "ChillDocStoreAssets/types/generic_doc";
import PickGenericDocItem from "ChillMainAssets/vuejs/WorkflowAttachment/Component/PickGenericDocItem.vue";
import { fetch_generic_docs_by_accompanying_period } from "ChillDocStoreAssets/js/generic-doc-api";
import { computed, onMounted, ref } from "vue";
import {fetch_generic_docs_by_accompanying_period} from "ChillDocStoreAssets/js/generic-doc-api";
import {computed, onMounted, ref} from "vue";
import {EntityWorkflow} from "ChillMainAssets/types";
interface PickGenericDocProps {
workflow: EntityWorkflow | null;
accompanyingPeriodId: number;
pickedList: GenericDocForAccompanyingPeriod[];
toRemove: GenericDocForAccompanyingPeriod[];
@ -36,9 +35,19 @@ const isPicked = (genericDoc: GenericDocForAccompanyingPeriod): boolean =>
) !== -1;
onMounted(async () => {
genericDocs.value = await fetch_generic_docs_by_accompanying_period(
const fetchedGenericDocs = await fetch_generic_docs_by_accompanying_period(
props.accompanyingPeriodId,
);
const documentClasses = [
"Chill\\DocStoreBundle\\Entity\\AccompanyingCourseDocument",
"Chill\\PersonBundle\\Entity\\AccompanyingPeriod\\AccompanyingPeriodWorkEvaluationDocument",
"Chill\\DocStoreBundle\\Entity\\PersonDocument"
];
genericDocs.value = fetchedGenericDocs.filter(doc =>
!documentClasses.includes(props.workflow?.relatedEntityClass || '') ||
props.workflow?.relatedEntityId !== doc.identifiers.id
);
loaded.value = true;
});

View File

@ -3,8 +3,10 @@ import Modal from "ChillMainAssets/vuejs/_components/Modal.vue";
import { computed, ref, useTemplateRef } from "vue";
import PickGenericDoc from "ChillMainAssets/vuejs/WorkflowAttachment/Component/PickGenericDoc.vue";
import { GenericDocForAccompanyingPeriod } from "ChillDocStoreAssets/types/generic_doc";
import {EntityWorkflow} from "ChillMainAssets/types";
interface PickGenericDocModalProps {
workflow: EntityWorkflow | null;
accompanyingPeriodId: number;
toRemove: GenericDocForAccompanyingPeriod[];
}
@ -80,6 +82,7 @@ defineExpose({ openModal, closeModal });
</template>
<template v-slot:body>
<pick-generic-doc
:workflow="props.workflow"
:accompanying-period-id="props.accompanyingPeriodId"
:to-remove="props.toRemove"
:picked-list="pickeds"