Skip to content

Commit 893cf3b

Browse files
authored
Merge pull request #27 from redlink-gmbh/MORE-Platform#426-studymanager-fe-bugfixes
MORE-Platform#426 studymanager fe bugfixes
2 parents 5598748 + 3c0153f commit 893cf3b

11 files changed

Lines changed: 156 additions & 119 deletions

src/components/dialog/ComponentDialog.vue

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ Licensed under the Elastic License 2.0. */
7676
7777
const title = ref(component.title);
7878
const purpose = ref(component.purpose);
79+
const participantTitle = ref(component.participantTitle);
7980
const participantInfo = ref(component.participantInfo);
8081
const properties: Ref<Property<any>[]> = ref(
8182
factory.properties
@@ -255,7 +256,7 @@ Licensed under the Elastic License 2.0. */
255256
const returnComponent = {
256257
templateId: component.templateId,
257258
title: title.value,
258-
purpose: purpose.value,
259+
participantTitle: participantTitle.value,
259260
participantInfo: participantInfo.value,
260261
observationGroupIds: selectedObservationGroups.value?.length
261262
? selectedObservationGroups.value.map((id: string) => parseInt(id))
@@ -475,7 +476,10 @@ Licensed under the Elastic License 2.0. */
475476
@remove-scheduler="removeScheduler"
476477
/>
477478

478-
<div class="col-span-8 col-start-0">
479+
<div
480+
v-if="componentType === 'observation'"
481+
class="col-span-8 col-start-0"
482+
>
479483
<h5 class="mb-2">{{ $t('study.props.purpose') }}</h5>
480484
<Textarea
481485
v-model="purpose"
@@ -485,6 +489,23 @@ Licensed under the Elastic License 2.0. */
485489
:disabled="!editable"
486490
></Textarea>
487491
</div>
492+
<div
493+
v-if="componentType === 'goalTemplate'"
494+
class="col-span-8 mt-6 mb-3 h-[1px] w-full bg-gray-300"
495+
/>
496+
<div v-if="componentType === 'goalTemplate'" class="col-span-8 col-start-0">
497+
<h5 class="mb-2">{{ $t('study.props.participantTitle') }}*</h5>
498+
<InputText
499+
v-model="participantTitle"
500+
type="text"
501+
required
502+
:placeholder="$t('study.placeholder.participantTitle', {
503+
type: $t(`global.labels.${componentType}`),
504+
})"
505+
class="w-full"
506+
:disabled="!editable"
507+
></InputText>
508+
</div>
488509
<div class="col-span-8 col-start-0">
489510
<h5 :class="getError('participantInfo') ? 'mb-1' : 'mb-2'">
490511
{{ $t('study.props.participantInfo') }}*

src/components/dialog/InterventionDialog.vue

Lines changed: 84 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -43,21 +43,22 @@ Licensed under the Elastic License 2.0. */
4343
const triggerData: Trigger = dialogRef.value.data?.triggerData;
4444
const groupStates: MoreTableChoice[] =
4545
dialogRef.value.data?.groupStates || [];
46-
const observationGroupStates: MoreTableChoice[] = observationGroupStore.observationGroups.map(
47-
(observationGroup) =>
48-
({
49-
label: observationGroup.title,
50-
value: observationGroup.observationGroupId?.toString(),
51-
}) as MoreTableChoice,
52-
);
46+
const observationGroupStates: MoreTableChoice[] =
47+
observationGroupStore.observationGroups.map(
48+
(observationGroup) =>
49+
({
50+
label: observationGroup.title,
51+
value: observationGroup.observationGroupId?.toString(),
52+
}) as MoreTableChoice,
53+
);
5354
const groupPlaceholder =
5455
dialogRef.value.data?.groupPlaceholder ||
5556
t('global.placeholder.entireStudy');
5657
const actionFactories = dialogRef.value.data?.actionFactories;
5758
const triggerFactories = dialogRef.value.data?.triggerFactories;
5859
const selectedObservationGroups = ref(
59-
intervention.observationGroupIds?.map((id: number) => id.toString()) ?? []
60-
)
60+
intervention.observationGroupIds?.map((id: number) => id.toString()) ?? [],
61+
);
6162
6263
let propInputError: string = '';
6364
@@ -244,7 +245,11 @@ Licensed under the Elastic License 2.0. */
244245
trigger: {},
245246
actions: [],
246247
studyGroupId: studyGroupId.value,
247-
observationGroupIds: selectedObservationGroups.value?.length ? selectedObservationGroups.value.map((id: string) => parseInt(id)) : [],
248+
observationGroupIds: selectedObservationGroups.value?.length
249+
? selectedObservationGroups.value.map((id: string) =>
250+
parseInt(id),
251+
)
252+
: [],
248253
schedule: intervention.schedule,
249254
} as Intervention;
250255
@@ -394,7 +399,7 @@ Licensed under the Elastic License 2.0. */
394399
:class="{ 'gap-y-2': !editable }"
395400
@submit.prevent="save()"
396401
>
397-
<div class="col-start-0 col-span-8 mt-2" :class="{ 'pb-4': !editable }">
402+
<div class="col-span-8 col-start-0 mt-2" :class="{ 'pb-4': !editable }">
398403
<h5>{{ $t('intervention.dialog.label.interventionTitle') }}*</h5>
399404
<div v-if="getError('title')" class="error error-label col-span-8 mb-2">
400405
{{ getError('title') }}
@@ -409,7 +414,7 @@ Licensed under the Elastic License 2.0. */
409414
></InputText>
410415
</div>
411416

412-
<div class="col-start-0 col-span-8">
417+
<div class="col-span-8 col-start-0">
413418
<h5 class="mb-2">{{ $t('study.props.purpose') }}</h5>
414419
<Textarea
415420
v-model="purpose"
@@ -420,7 +425,7 @@ Licensed under the Elastic License 2.0. */
420425
></Textarea>
421426
</div>
422427
<div
423-
class="section-group col-start-0 col-span-8 mt-4 grid grid-cols-2 items-end lg:grid-cols-3"
428+
class="section-group col-span-8 col-start-0 mt-4 grid grid-cols-2 items-end lg:grid-cols-3"
424429
>
425430
<h5 class="col-span-2">{{ $t('intervention.props.trigger') }}*</h5>
426431
<div class="col-span-3 col-start-3" :class="{ 'text-end': !editable }">
@@ -467,7 +472,7 @@ Licensed under the Elastic License 2.0. */
467472
>
468473
{{ getTriggerTypeDescription(triggerType) }}
469474
</div>
470-
<div class="col-start-0 col-span-3">
475+
<div class="col-span-3 col-start-0">
471476
<div v-if="triggerJsonError && editable" class="error mb-4">
472477
{{ triggerJsonError }}
473478
</div>
@@ -488,7 +493,7 @@ Licensed under the Elastic License 2.0. */
488493
</div>
489494
</div>
490495

491-
<div class="section-group col-start-0 col-span-8 mt-8 grid grid-cols-9">
496+
<div class="section-group col-span-8 col-start-0 mt-8 grid grid-cols-9">
492497
<div class="col-span-9 grid grid-cols-2 items-end lg:grid-cols-3">
493498
<h5 class="lg:col-span-2">{{ $t('intervention.props.action') }}*</h5>
494499
<Button
@@ -528,7 +533,7 @@ Licensed under the Elastic License 2.0. */
528533
<div
529534
v-for="(action, index) in actionsArray"
530535
:key="index"
531-
class="col-start-0 js-action col-span-9"
536+
class="js-action col-span-9 col-start-0"
532537
:class="{ 'mb-4': index < actionsArray.length - 1 }"
533538
>
534539
<hr v-if="index !== 0" class="my-4" />
@@ -570,38 +575,46 @@ Licensed under the Elastic License 2.0. */
570575
</div>
571576
</div>
572577

573-
<div class="col-start-0 col-span-8">
578+
<div class="col-span-8 col-start-0">
574579
<h5 v-if="editable" class="pb-2 font-bold">
575-
{{ editable ? $t('study.dialog.label.chooseGroups') : $t('study.props.groups') }}
580+
{{
581+
editable
582+
? $t('study.dialog.label.chooseGroups')
583+
: $t('study.props.groups')
584+
}}
576585
</h5>
577586
<div v-if="editable" class="mb-2">
578-
{{ $t('study.dialog.description.howToCreateGroups', {for: $t('intervention.plural')}) }}
587+
{{
588+
$t('study.dialog.description.howToCreateGroups', {
589+
for: $t('intervention.plural'),
590+
})
591+
}}
579592
</div>
580593
<div class="flex gap-5">
581-
<div>
582-
<div class="mb-1">{{ $t('studyGroup.plural')}}</div>
594+
<div>
595+
<div class="mb-1">{{ $t('studyGroup.plural') }}</div>
583596
<Dropdown
584-
v-model="studyGroupId"
585-
:options="groupStates"
586-
option-label="label"
587-
option-value="value"
588-
:disabled="!editable"
589-
class="w-fit"
590-
:class="{ 'dropdown-has-value': studyGroupId }"
591-
:placeholder="
592-
studyGroupId
593-
? getLabelForChoiceValue(studyGroupId as number, groupStates)
594-
: groupPlaceholder
595-
? (groupPlaceholder as string)
596-
: $t('global.placeholder.entireStudy')
597-
"
598-
>
599-
<template #option="optionProps">
600-
<div class="p-select-car-option">
601-
<span>{{ optionProps.option.label }}</span>
602-
</div>
603-
</template>
604-
</Dropdown>
597+
v-model="studyGroupId"
598+
:options="groupStates"
599+
option-label="label"
600+
option-value="value"
601+
:disabled="!editable"
602+
class="w-fit"
603+
:class="{ 'dropdown-has-value': studyGroupId }"
604+
:placeholder="
605+
studyGroupId
606+
? getLabelForChoiceValue(studyGroupId as number, groupStates)
607+
: groupPlaceholder
608+
? (groupPlaceholder as string)
609+
: $t('global.placeholder.entireStudy')
610+
"
611+
>
612+
<template #option="optionProps">
613+
<div class="p-select-car-option">
614+
<span>{{ optionProps.option.label }}</span>
615+
</div>
616+
</template>
617+
</Dropdown>
605618
</div>
606619
<div>
607620
<div class="mb-1">{{ $t('observationGroup.plural') }}</div>
@@ -611,27 +624,35 @@ Licensed under the Elastic License 2.0. */
611624
:disabled="!editable"
612625
option-label="label"
613626
option-value="value"
614-
:placeholder="$t('global.placeholder.chooseDropdownOptionDefault')"
627+
:placeholder="
628+
$t('global.placeholder.chooseDropdownOptionDefault')
629+
"
615630
:show-toggle-all="false"
616631
class="z-top custom-multiselect-root"
617632
:panel-class="'custom-multiselect-panel'"
618633
>
619634
<template #value="{ value }">
620-
<span v-if="value?.length > 0">{{ value.map((item: string) => observationGroupStates.find(
621-
(group: MoreTableChoice) => group.value === item
622-
)?.label).join(', ') }}</span>
635+
<span v-if="value?.length > 0">{{
636+
value
637+
.map(
638+
(item: string) =>
639+
observationGroupStates.find(
640+
(group: MoreTableChoice) => group.value === item,
641+
)?.label,
642+
)
643+
.join(', ')
644+
}}</span>
623645
<span v-else class="text-gray-400">
624-
{{ $t('global.placeholder.chooseDropdownOptionDefault') }}
625-
</span>
646+
{{ $t('global.placeholder.chooseDropdownOptionDefault') }}
647+
</span>
626648
</template>
627-
628649
</MultiSelect>
629650
</div>
630651
</div>
631652
</div>
632653

633654
<div
634-
class="col-start-0 buttons col-span-8 mt-1 flex flex-row items-center justify-end text-right"
655+
class="buttons col-span-8 col-start-0 mt-1 flex flex-row items-center justify-end text-right"
635656
>
636657
<Button class="btn-gray" @click="cancel()">
637658
<span v-if="editable">{{ $t('global.labels.cancel') }}</span>
@@ -650,22 +671,22 @@ Licensed under the Elastic License 2.0. */
650671
</template>
651672

652673
<style scoped>
653-
@import '../../styles/components/moreTable-dialogs.css';
674+
@import '../../styles/components/moreTable-dialogs.css';
654675
655-
:deep(.dropdown-btn .p-select-label) {
656-
color: white!important;
657-
}
676+
:deep(.dropdown-btn .p-select-label) {
677+
color: white !important;
678+
}
658679
659-
.dropdown-btn {
660-
background-color: var(--primary-color);
661-
color: white;
662-
:deep(.p-select-label),
663-
:deep(.p-select-trigger-icon) {
680+
.dropdown-btn {
681+
background-color: var(--primary-color);
664682
color: white;
683+
:deep(.p-select-label),
684+
:deep(.p-select-trigger-icon) {
685+
color: white;
686+
}
665687
}
666-
}
667688
668-
.dialog #interventionDialogForm .section-group .section-content {
669-
border: 1px solid var(--bluegray-50);
670-
}
689+
.dialog #interventionDialogForm .section-group .section-content {
690+
border: 1px solid var(--bluegray-50);
691+
}
671692
</style>

src/components/dialog/shared/BooleanPropertyInput.vue

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,7 @@ Licensed under the Elastic License 2.0. */
3131
watch(
3232
() => props.property.value,
3333
() => {
34-
if (props.isPartOfTemplate) {
35-
emit('onBooleanChange', props.property.value);
36-
}
34+
emit('onBooleanChange', props.property.value);
3735
},
3836
);
3937
</script>

src/components/dialog/shared/IntegerPropertyInput.vue

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,7 @@ Licensed under the Elastic License 2.0. */
3636
watch(
3737
() => props.property.value,
3838
() => {
39-
if (props.isPartOfTemplate) {
40-
emit('onInputChange', props.property);
41-
}
39+
emit('onInputChange', props.property);
4240
},
4341
);
4442
</script>

src/components/dialog/shared/IntegerRangePropertyInput.vue

Lines changed: 18 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -36,38 +36,34 @@
3636
watch(
3737
() => props.property.value?.lower,
3838
(newLower) => {
39-
if (
40-
newLower !== undefined &&
41-
newLower !== null &&
42-
props.property.value?.upper !== undefined &&
43-
props.property.value.upper !== null
44-
) {
45-
if (newLower > props.property.value.upper) {
46-
props.property.value.upper = newLower;
39+
if (newLower !== undefined && newLower !== null) {
40+
if (
41+
props.property.value?.upper !== undefined &&
42+
props.property.value.upper !== null
43+
) {
44+
if (newLower > props.property.value.upper) {
45+
props.property.value.upper = newLower;
46+
}
4747
}
4848
}
49-
if (props.isPartOfTemplate) {
50-
emit('onInputChange', props.property);
51-
}
49+
emit('onInputChange', props.property);
5250
},
5351
);
5452
5553
watch(
5654
() => props.property.value?.upper,
5755
(newUpper) => {
58-
if (
59-
newUpper !== undefined &&
60-
newUpper !== null &&
61-
props.property.value?.lower !== undefined &&
62-
props.property.value.lower !== null
63-
) {
64-
if (newUpper < props.property.value.lower) {
65-
props.property.value.lower = newUpper;
56+
if (newUpper !== undefined && newUpper !== null) {
57+
if (
58+
props.property.value?.lower !== undefined &&
59+
props.property.value.lower !== null
60+
) {
61+
if (newUpper < props.property.value.lower) {
62+
props.property.value.lower = newUpper;
63+
}
6664
}
6765
}
68-
if (props.isPartOfTemplate) {
69-
emit('onInputChange', props.property);
70-
}
66+
emit('onInputChange', props.property);
7167
},
7268
);
7369
</script>

src/components/dialog/shared/StringListPropertyInput.vue

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,7 @@ Licensed under the Elastic License 2.0. */
4747
watch(
4848
() => props.property.value,
4949
() => {
50-
if (props.isPartOfTemplate) {
51-
emit('onInputChange', props.property);
52-
}
50+
emit('onInputChange', props.property);
5351
},
5452
{ deep: true, immediate: true },
5553
);

0 commit comments

Comments
 (0)