Skip to content

Commit

Permalink
Merge pull request #113 from hpi-sam/86-n00-personnel-list
Browse files Browse the repository at this point in the history
#86 frontend: add personnel list and material list
  • Loading branch information
JoshuaRiewesell authored Mar 26, 2024
2 parents 521c98b + 267f037 commit 2452117
Show file tree
Hide file tree
Showing 17 changed files with 450 additions and 279 deletions.
60 changes: 60 additions & 0 deletions frontend/src/assets/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,63 @@ button:active {
background-color: var(--green);
}

.popup-overlay {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.5);
display: flex;
justify-content: center;
align-items: center;
text-align: center;
z-index: 1;
}

.list {
margin-top: 30px;
margin-left: 30px;
margin-right: 30px;
}

.listItem {
position: relative;
background-color: #FFFFFF;
border: 1px solid rgb(209, 213, 219);
display: flex;
align-items: center;
text-align: left;
margin-top: -1px;
}

.listItemButton {
position: relative;
background-color: #FFFFFF;
border: none;
display: flex;
align-items: center;
font-size: 1.25rem;
padding: .75rem 1rem;
padding-left: 0;
text-align: left;
height: 50px;
width: 100%;
}

.listItemAddButton {
text-align: center;
position: relative;
background-color: #FFFFFF;
border: 1px solid rgb(209, 213, 219);
box-sizing: border-box;
width: 100%;
font-size: 1.25rem;
line-height: 1.25rem;
padding: .75rem 1rem;
margin-top: -1px;
}

.listItemId, .listItemName {
padding: .75rem 1rem;
}
62 changes: 15 additions & 47 deletions frontend/src/components/screensTrainer/ScreenExerciseCreation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import TopBarTrainer from "@/components/widgets/TopBarTrainer.vue"
import {svg} from "@/assets/Svg"
import {setArea} from "@/components/screensTrainer/ScreenResourceCreation.vue"
import AreaPopup from '../widgets/AreaPopup.vue'
import DeleteItemPopup from '../widgets/DeleteItemPopup.vue'
const exerciseStore = useExerciseStore()
Expand All @@ -32,21 +32,27 @@
socketTrainer.areaAdd()
}
function deleteArea(){
socketTrainer.areaDelete(currentArea.value)
}
const showPopup = ref(false)
</script>

<template>
<AreaPopup v-if="showPopup" :area-name="currentArea" @close-popup="showPopup=false" />
<DeleteItemPopup v-if="showPopup" :name="currentArea" @close-popup="showPopup=false" @delete="deleteArea" />
<TopBarTrainer />
<div id="list">
<div class="list">
<div
v-for="area in areas"
:key="area.areaName"
class="listitem"
class="listItem"
:class="{ 'selected': currentArea === area.areaName }"
>
<button class="areaButton" @click="openArea(area.areaName)">
{{ area.areaName }}
<button class="listItemButton" @click="openArea(area.areaName)">
<div class="listItemName">
{{ area.areaName }}
</div>
</button>
<button class="settingsButton" @click="openPopup(area.areaName)">
<svg
Expand All @@ -59,7 +65,7 @@
</svg>
</button>
</div>
<button id="addAreaButton" @click="addArea()">
<button class="listItemAddButton" @click="addArea()">
Bereich hinzufügen
</button>
</div>
Expand All @@ -70,33 +76,8 @@
</template>

<style scoped>
#list {
.list {
margin-top: 90px;
margin-left: 30px;
margin-right: 30px;
}
.listitem {
position: relative;
background-color: #FFFFFF;
border: 1px solid rgb(209, 213, 219);
display: flex;
align-items: center;
text-align: left;
margin-top: -1px;
}
.areaButton {
position: relative;
background-color: #FFFFFF;
border: none;
display: flex;
align-items: center;
font-size: 1.25rem;
padding: .75rem 1rem;
text-align: left;
height: 50px;
width: 100%;
}
.settingsButton {
Expand All @@ -106,20 +87,7 @@
background-color: rgb(243, 244, 246);
}
#addAreaButton {
text-align: center;
position: relative;
background-color: #FFFFFF;
border: 1px solid rgb(209, 213, 219);
box-sizing: border-box;
width: 100%;
font-size: 1.25rem;
line-height: 1.25rem;
padding: .75rem 1rem;
margin-top: -1px;
}
.selected .areaButton {
.selected .listItemButton {
filter: brightness(90%);
}
</style>
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
<script setup lang="ts">
import {computed} from 'vue'
import {computed, ref} from 'vue'
import {useExerciseStore} from '@/stores/Exercise'
import ToggleSwitchForListItems from '@/components/widgets/ToggleSwitchForListItems.vue'
import DeleteItemPopup from '@/components/widgets/DeleteItemPopup.vue'
import socketTrainer from '@/sockets/SocketTrainer'
import AddMaterialPopup from '@/components/widgets/AddMaterialPopup.vue'
const props = defineProps({
currentArea: {
Expand All @@ -12,12 +16,81 @@
const exerciseStore = useExerciseStore()
const currentAreaData = computed(() => exerciseStore.getArea(props.currentArea))
const currentMaterialName = ref('No Material Name')
const currentMaterialType = ref('No Material Type')
const showDeletePopup = ref(false)
const showAddPopup = ref(false)
function openDeletePopup(materialName: string) {
currentMaterialName.value = materialName
showDeletePopup.value = true
}
function openAddPopup(materialType: string) {
currentMaterialType.value = materialType
showAddPopup.value = true
}
function deleteMaterial(){
socketTrainer.materialDelete(currentMaterialName.value)
}
const devices = computed(() => {
return currentAreaData.value?.material.filter(material => material.materialType === 'device') || []
})
const bloodList = computed(() => {
return currentAreaData.value?.material.filter(material => material.materialType === 'blood') || []
})
</script>

<template>
<h1>Patienten</h1>
{{ currentAreaData?.devices }}
</template>

<style scoped>
</style>
<DeleteItemPopup
v-if="showDeletePopup"
:name="currentMaterialName"
@delete="deleteMaterial"
@close-popup="showDeletePopup=false"
/>
<AddMaterialPopup
v-if="showAddPopup"
:material-type="currentMaterialType"
:current-area="props.currentArea"
@close-popup="showAddPopup=false"
/>
<div class="list">
<div
v-for="device in devices as Material[]"
:key="device.materialName"
class="listItem"
>
<button class="listItemButton" @click="openDeletePopup(device.materialName)">
<div class="listItemName">
{{ device.materialName }}
</div>
</button>
<ToggleSwitchForListItems default="active" />
</div>
<button v-if="currentAreaData" class="listItemAddButton" @click="openAddPopup('device')">
Gerät hinzufügen
</button>
</div>
<div class="list">
<div
v-for="blood in bloodList as Material[]"
:key="blood.materialName"
class="listItem"
>
<button class="listItemButton" @click="openDeletePopup(blood.materialName)">
<div class="listItemName">
{{ blood.materialName }}
</div>
</button>
<ToggleSwitchForListItems default="active" />
</div>
<button v-if="currentAreaData" class="listItemAddButton" @click="openAddPopup('blood')">
Blut hinzufügen
</button>
</div>
</template>
Original file line number Diff line number Diff line change
Expand Up @@ -47,74 +47,25 @@
<template>
<EditPatientPopup v-if="showEditPatientPopup" :patient-id="currentPatientId" @close-popup="showEditPatientPopup=false" />
<AddPatientPopup v-if="showAddPatientPopup" :area-name="currentArea" :patient-name="newPatientName" @close-popup="showAddPatientPopup=false" />
<div id="list">
<div class="list">
<div
v-for="patient in currentAreaData?.patients"
:key="patient.patientName"
class="listitem"
class="listItem"
>
<button class="patientButton" @click="editPatient(patient.patientId)">
<div class="patientId">
<button class="listItemButton" @click="editPatient(patient.patientId)">
<div class="listItemId">
{{ patient.patientId.toString().padStart(3, '0') }}
</div>
<TriageForListItems :patient-code="patient.patientCode" />
<div class="patientName">
<div class="listItemName">
{{ patient.patientName }}
</div>
</button>
<ToggleSwitchForListItems default="active" />
</div>
<button v-if="currentAreaData" id="addPatientButton" @click="addPatient()">
<button v-if="currentAreaData" class="listItemAddButton" @click="addPatient()">
Patient hinzufügen
</button>
</div>
</template>

<style scoped>
#list {
margin-top: 30px;
margin-left: 30px;
margin-right: 30px;
}
.listitem {
position: relative;
background-color: #FFFFFF;
border: 1px solid rgb(209, 213, 219);
display: flex;
align-items: center;
text-align: left;
margin-top: -1px;
}
.patientButton {
position: relative;
background-color: #FFFFFF;
border: none;
display: flex;
align-items: center;
font-size: 1.25rem;
padding: .75rem 1rem;
padding-left: 0;
text-align: left;
height: 50px;
width: 100%;
}
#addPatientButton {
text-align: center;
position: relative;
background-color: #FFFFFF;
border: 1px solid rgb(209, 213, 219);
box-sizing: border-box;
width: 100%;
font-size: 1.25rem;
line-height: 1.25rem;
padding: .75rem 1rem;
margin-top: -1px;
}
.patientId, .patientName {
padding: .75rem 1rem;
}
</style>
</template>
Loading

0 comments on commit 2452117

Please sign in to comment.