Added vuelidator to the project, implemented update of Employeeprofile

This commit is contained in:
Sockenklaus
2021-10-31 01:10:41 +02:00
parent 4a0a9c173b
commit 5a65b596ee
4 changed files with 305 additions and 88 deletions

View File

@@ -1,20 +1,23 @@
<script setup lang="ts">
import { ref } from 'vue'
import type { Ref } from 'vue'
import { toRef } from 'vue'
const isActive : Ref<boolean> = ref(false)
const props = defineProps(['isActive'])
const emit = defineEmits(['save', 'toggleEdit'])
const isActive = toRef(props, 'isActive')
function onEdit() {
isActive.value = true
emit('toggleEdit')
}
function onSave() {
emit('save')
}
function onCancel() {
isActive.value = false
emit('toggleEdit')
}
</script>
@@ -28,12 +31,12 @@ function onCancel() {
<button v-if="!isActive" type="button" @click="onEdit" class="btn btn-primary ms-auto">
<i class="bi bi-pen"></i>
Bearbeiten
Mitarbeiter bearbeiten
</button>
<button v-if="isActive" type="button" @click="onSave" class="btn btn-success ms-auto">
<i class="bi bi-save"></i>
Speichern
Mitarbeiter speichern
</button>
<button v-if="isActive" type="button" @click="onCancel" class="btn btn-outline-secondary ms-3">