-
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.
#90 frontend: add ActionSelection and ActionConfig
- Loading branch information
1 parent
bc258dc
commit 3f137e3
Showing
5 changed files
with
154 additions
and
10 deletions.
There are no files selected for viewing
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
65 changes: 57 additions & 8 deletions
65
frontend/src/components/screensPatient/pagesAction/PageActionSelection.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 |
---|---|---|
@@ -1,14 +1,63 @@ | ||
<script setup lang="ts"> | ||
import socketPatient from '@/sockets/SocketPatient' | ||
import { ref } from 'vue' | ||
import { useAvailablesStore } from '@/stores/Availables' | ||
import ActionConfig from '@/components/widgets/ActionConfig.vue' | ||
function actionAdd(actionName: string) { | ||
socketPatient.actionAdd(actionName) | ||
const availablesStore = useAvailablesStore() | ||
const availableActions = ref(availablesStore.actions) | ||
const currentAction = ref('Keine Aktion ausgewählt') | ||
function filteredActions(actionType: string) { | ||
return availableActions.value.filter(action => action.actionType === actionType) | ||
} | ||
function getTypeLabel(actionType: string) { | ||
switch (actionType) { | ||
case 'treatment': | ||
return 'Behandlung' | ||
case 'lab': | ||
return 'Labor' | ||
default: | ||
return 'Sonstiges' | ||
} | ||
} | ||
function openAction(actionName: string) { | ||
currentAction.value = actionName | ||
showAction.value = true | ||
} | ||
const showAction = ref(false) | ||
</script> | ||
|
||
<template> | ||
<h1>ActionSelection</h1> | ||
<button @click="actionAdd('stabile-seitenlage')"> | ||
Fügt eine Test-Aktion hinzu | ||
</button> | ||
</template> | ||
<ActionConfig v-if="showAction" :current-action="currentAction" @close-action="showAction=false" /> | ||
<div v-if="!showAction"> | ||
<h1>Wähle eine Aktion</h1> | ||
<div | ||
v-for="actionTyp in availablesStore.getActionTypes" | ||
:key="actionTyp" | ||
class="list" | ||
> | ||
<h2>{{ getTypeLabel(actionTyp) }}</h2> | ||
<div | ||
v-for="action in filteredActions(actionTyp)" | ||
:key="action.actionName" | ||
class="listItem" | ||
> | ||
<button class="listItemButton" @click="openAction(action.actionName)"> | ||
<div class="listItemName"> | ||
{{ action.actionName }} | ||
</div> | ||
</button> | ||
</div> | ||
</div> | ||
</div> | ||
</template> | ||
<style scoped> | ||
h1 { | ||
text-align: center; | ||
margin-top: 30px; | ||
} | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
<script setup lang="ts"> | ||
const emit = defineEmits(['close-action']) | ||
const props = defineProps({ | ||
currentAction: { | ||
type: String, | ||
default: "Kein Name angegeben" | ||
} | ||
}) | ||
</script> | ||
|
||
<template> | ||
<div class="flex-container"> | ||
<div> | ||
<h1>{{ props.currentAction }}</h1> | ||
<button class="close-button" @click="emit('close-action')"> | ||
X | ||
</button> | ||
</div> | ||
<button class="main-button"> | ||
Aktion ausführen | ||
</button> | ||
</div> | ||
</template> | ||
|
||
<style scoped> | ||
h1 { | ||
text-align: center; | ||
margin-top: 30px; | ||
} | ||
.flex-container { | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: space-between; | ||
height: 100%; | ||
position: relative; | ||
} | ||
.close-button { | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
position: absolute; | ||
align-self: flex-end; | ||
background-color: #FFFFFF; | ||
border: 1px solid rgb(209, 213, 219); | ||
border-radius: .5rem; | ||
top: 1rem; | ||
right: 1rem; | ||
width: 3rem; | ||
height: 3rem; | ||
font-size: 1.25rem; | ||
line-height: 1.25rem; | ||
padding: .75rem 1rem; | ||
box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05); | ||
} | ||
.main-button { | ||
align-self: center; | ||
background-color: #FFFFFF; | ||
border: 1px solid rgb(209, 213, 219); | ||
border-radius: .5rem; | ||
width: calc(100% - 2rem); | ||
font-size: 1.25rem; | ||
line-height: 1.25rem; | ||
padding: .75rem 1rem; | ||
margin: 1rem; | ||
text-align: center; | ||
box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05); | ||
} | ||
</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