-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: initial therapy response by variant table (#858)
* feat: initial therapy response by variant table * fix: typing of component
- Loading branch information
Showing
5 changed files
with
164 additions
and
1 deletion.
There are no files selected for viewing
91 changes: 91 additions & 0 deletions
91
packages/mtb/src/runtime/components/core/MQuerySummaryTherapyResponsesByVariant.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
<script lang="ts"> | ||
import { type PropType, defineComponent } from 'vue'; | ||
import { BTable } from 'bootstrap-vue-next'; | ||
import type { QueryTherapyResponseByVariant } from '../../domains'; | ||
import MTherapyResponseDistributionBar from './MTherapyResponseDistributionBar.vue'; | ||
export default defineComponent({ | ||
components: { | ||
MTherapyResponseDistributionBar, | ||
BTable, | ||
}, | ||
props: { | ||
items: { | ||
type: Object as PropType<QueryTherapyResponseByVariant[]>, | ||
required: true, | ||
}, | ||
busy: { | ||
type: Boolean, | ||
default: false, | ||
}, | ||
}, | ||
setup() { | ||
const fields = [ | ||
{ | ||
key: 'supportingVariant', label: 'Stützende Variante', thClass: 'text-left', tdClass: 'text-left', | ||
}, | ||
{ | ||
key: 'medicationClasses', label: 'Medikationsklasse', thClass: 'text-left', tdClass: 'text-left', | ||
}, | ||
{ | ||
key: 'medications', label: 'Medikation', thClass: 'text-left', tdClass: 'text-left', | ||
}, | ||
{ | ||
key: 'responseDistribution', label: 'Response Verteilung', thClass: 'text-center', tdClass: 'text-center align-middle', | ||
}, | ||
]; | ||
return { | ||
fields, | ||
}; | ||
}, | ||
}); | ||
</script> | ||
<template> | ||
<BTable | ||
:variant="'light'" | ||
:items="items" | ||
:fields="fields" | ||
:busy="busy" | ||
outlined | ||
> | ||
<template #cell(medicationClasses)="data"> | ||
<ul class="column"> | ||
<li | ||
v-for="(item,key) in data.item.medicationClasses" | ||
:key="key" | ||
> | ||
{{ item.display }} | ||
</li> | ||
</ul> | ||
</template> | ||
<template #cell(medications)="data"> | ||
<ul class="column"> | ||
<li | ||
v-for="(item,key) in data.item.medications" | ||
:key="key" | ||
> | ||
{{ item.display }} | ||
</li> | ||
</ul> | ||
</template> | ||
<template #cell(supportingVariants)="data"> | ||
<ul class="column"> | ||
<li | ||
v-for="(item,key) in data.item.supportingVariants" | ||
:key="key" | ||
> | ||
{{ item }} | ||
</li> | ||
</ul> | ||
</template> | ||
<template #cell(responseDistribution)="data"> | ||
<MTherapyResponseDistributionBar :distribution="data.item.responseDistribution" /> | ||
</template> | ||
</BTable> | ||
</template> | ||
<style scoped> | ||
.column { | ||
word-break: break-all; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
packages/mtb/src/runtime/pages/query/[id]/index/summary/therapy-responses-by-variant.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<!-- | ||
- Copyright (c) 2024. | ||
- Author Peter Placzek (tada5hi) | ||
- For the full copyright and license information, | ||
- view the LICENSE file that was distributed with this source code. | ||
--> | ||
<script lang="ts"> | ||
import { wrapFnWithBusyState } from '@authup/client-web-kit'; | ||
import { QueryEventBusEventName, injectQueryEventBus, useQueryFilterStore } from '@dnpm-dip/core'; | ||
import { | ||
type PropType, defineComponent, ref, | ||
} from 'vue'; | ||
import MQuerySummaryTherapyResponsesByVariant | ||
from '../../../../../components/core/MQuerySummaryTherapyResponsesByVariant.vue'; | ||
import { injectHTTPClient } from '../../../../../core/http-client'; | ||
import type { QuerySession, QueryTherapyResponse } from '../../../../../domains'; | ||
export default defineComponent({ | ||
components: { MQuerySummaryTherapyResponsesByVariant }, | ||
props: { | ||
entity: { | ||
type: Object as PropType<QuerySession>, | ||
required: true, | ||
}, | ||
}, | ||
setup(props) { | ||
const api = injectHTTPClient(); | ||
const queryEventBus = injectQueryEventBus(); | ||
const queryFilterStore = useQueryFilterStore(); | ||
const busy = ref(false); | ||
const items = ref<QueryTherapyResponse[]>([]); | ||
const load = wrapFnWithBusyState(busy, async () => { | ||
const response = await api.query.getTherapyResponsesByVariant(props.entity.id, queryFilterStore.buildURLRecord()); | ||
items.value = response.entries; | ||
}); | ||
Promise.resolve() | ||
.then(() => load()); | ||
queryEventBus.on(QueryEventBusEventName.SESSION_UPDATED, () => load()); | ||
queryEventBus.on(QueryEventBusEventName.FILTERS_COMMITED, () => load()); | ||
return { | ||
busy, | ||
items, | ||
}; | ||
}, | ||
}); | ||
</script> | ||
<template> | ||
<MQuerySummaryTherapyResponsesByVariant | ||
:busy="busy" | ||
:items="items" | ||
/> | ||
</template> |