Skip to content

Commit 1d943e6

Browse files
authored
Merge pull request #30 from redlink-gmbh/MORE-Platform#442-jump-to-participant-from-clinician
MORE-Platform#442: add logic for direct jump to participant info dialog
2 parents ad081ef + 5bd3a13 commit 1d943e6

2 files changed

Lines changed: 32 additions & 2 deletions

File tree

src/components/ParticipantList.vue

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ Oesterreichische Vereinigung zur Foerderung der wissenschaftlichen Forschung).
55
Licensed under the Elastic License 2.0. */
66
<script setup lang="ts">
77
import { computed, ref, watch } from 'vue';
8+
import { useRoute } from 'vue-router';
89
import { useImportExportApi } from '@/composable/useApi';
910
1011
import {
@@ -64,6 +65,7 @@ Licensed under the Elastic License 2.0. */
6465
const { t } = useI18n();
6566
const { handleIndividualError } = useErrorHandling();
6667
const dialog = useDialog();
68+
const route = useRoute();
6769
const moreTableRef = ref();
6870
6971
const studyStore = useStudyStore();
@@ -259,6 +261,25 @@ Licensed under the Elastic License 2.0. */
259261
},
260262
);
261263
264+
const hasOpenedInitialDialog = ref(false);
265+
watch(
266+
[(): MoreParticipantListTableRow[] => participantsList.value, (): any => route.query.id],
267+
([newList, participantIdFromUrl]): void => {
268+
if (
269+
participantIdFromUrl &&
270+
newList.length > 0 &&
271+
!hasOpenedInitialDialog.value
272+
) {
273+
openParticipantInfoDialog(participantIdFromUrl as string);
274+
hasOpenedInitialDialog.value = true;
275+
setTimeout(() => {
276+
moreTableRef.value?.scrollToRow(participantIdFromUrl as string);
277+
}, 500);
278+
}
279+
},
280+
{ immediate: true },
281+
);
282+
262283
function getObservationGroupItem(id: number): MoreTableChoice | undefined {
263284
return observationGroupStatuses?.find(
264285
(groupStatus) => groupStatus.value === id.toString(),

src/components/shared/MoreTable.vue

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -319,8 +319,17 @@ Licensed under the Elastic License 2.0. */
319319
}
320320
}
321321
}
322+
323+
function scrollToRow(id: string | number): void {
324+
const element = document.getElementById(`row-${id}`);
325+
if (element) {
326+
element.scrollIntoView({ behavior: 'smooth', block: 'center' });
327+
}
328+
}
329+
322330
defineExpose({
323331
setRowToEditMode,
332+
scrollToRow,
324333
});
325334
</script>
326335

@@ -338,7 +347,7 @@ Licensed under the Elastic License 2.0. */
338347
</div>
339348

340349
<div
341-
class="actions table-actions ml-2.5 flex flex-row items-center justify-end gap-2 mb-2"
350+
class="actions table-actions mb-2 ml-2.5 flex flex-row items-center justify-end gap-2"
342351
>
343352
<slot
344353
name="tableActions"
@@ -518,7 +527,7 @@ Licensed under the Elastic License 2.0. */
518527
<div v-if="(data as any)[field] === null" class="placeholder">
519528
{{ column.placeholder ?? $t('global.labels.noValue') }}
520529
</div>
521-
<div v-else>
530+
<div v-else :id="rowId === field ? `row-${data[rowId]}` : ''">
522531
<span
523532
v-if="field === 'title'"
524533
class="align-center flex flex-row gap-1.5"

0 commit comments

Comments
 (0)