@@ -1,10 +1,13 @@
|
|||||||
<template>
|
<template>
|
||||||
<EmployeeFormControls
|
|
||||||
class="mb-5"
|
<EmployeeFormControls
|
||||||
:isActive="editEmployee || createUser"
|
class="mb-5"
|
||||||
@save="submitForm"
|
:isActive="editEmployee || createUser"
|
||||||
@toggleEdit="toggleEdit"
|
:isNew="isNew"
|
||||||
/>
|
@save="submitForm"
|
||||||
|
@toggleEdit="toggleEdit"
|
||||||
|
/>
|
||||||
|
|
||||||
<form class="text-start" @keyup.enter="submitForm">
|
<form class="text-start" @keyup.enter="submitForm">
|
||||||
<div class="row mb-5">
|
<div class="row mb-5">
|
||||||
<div class="col pe-5">
|
<div class="col pe-5">
|
||||||
@@ -161,7 +164,8 @@
|
|||||||
|
|
||||||
<EmployeeFormControls
|
<EmployeeFormControls
|
||||||
class="mt-5"
|
class="mt-5"
|
||||||
:isActive="editEmployee || createUser"
|
:isActive="editEmployee || createUser"
|
||||||
|
:isNew="isNew"
|
||||||
@save="submitForm"
|
@save="submitForm"
|
||||||
@toggleEdit="toggleEdit"
|
@toggleEdit="toggleEdit"
|
||||||
/>
|
/>
|
||||||
@@ -256,6 +260,13 @@ const labelUserEnabled = computed(() => {
|
|||||||
return userEnabled ? 'Benutzerinformationen' : 'Kein Benutzer vorhanden'
|
return userEnabled ? 'Benutzerinformationen' : 'Kein Benutzer vorhanden'
|
||||||
})
|
})
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
const isNew = computed(() => {
|
||||||
|
return props.id ? false : true
|
||||||
|
})
|
||||||
/**
|
/**
|
||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1,12 +1,14 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
|
||||||
import { toRef } from 'vue'
|
import { toRefs } from 'vue'
|
||||||
|
|
||||||
|
const props = defineProps<{
|
||||||
const props = defineProps(['isActive'])
|
isActive: boolean,
|
||||||
|
isNew: boolean
|
||||||
|
}>()
|
||||||
const emit = defineEmits(['save', 'toggleEdit'])
|
const emit = defineEmits(['save', 'toggleEdit'])
|
||||||
|
|
||||||
const isActive = toRef(props, 'isActive')
|
const { isActive } = toRefs(props)
|
||||||
|
|
||||||
function onEdit() {
|
function onEdit() {
|
||||||
emit('toggleEdit')
|
emit('toggleEdit')
|
||||||
@@ -23,8 +25,9 @@ function onCancel() {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|
||||||
<div class="d-flex">
|
<div class="d-flex">
|
||||||
<router-link type="button" :to="{name: 'Home'}" class="btn btn-outline-secondary">
|
<router-link type="button" :to="{name: 'Employees/Index'}" class="btn btn-outline-secondary">
|
||||||
<i class="bi bi-chevron-left"></i>
|
<i class="bi bi-chevron-left"></i>
|
||||||
Zurück
|
Zurück
|
||||||
</router-link>
|
</router-link>
|
||||||
@@ -35,7 +38,7 @@ function onCancel() {
|
|||||||
<i class="bi bi-save"></i>
|
<i class="bi bi-save"></i>
|
||||||
Mitarbeiter speichern
|
Mitarbeiter speichern
|
||||||
</button>
|
</button>
|
||||||
<button v-if="isActive" type="button" @click="onCancel" class="btn btn-outline-secondary ms-3">
|
<button v-if="isActive && !isNew" type="button" @click="onCancel" class="btn btn-outline-secondary ms-3">
|
||||||
<i class="bi bi-x-lg"></i>
|
<i class="bi bi-x-lg"></i>
|
||||||
Abbrechen
|
Abbrechen
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
20
src/components/Employees/IndexControls.vue
Normal file
20
src/components/Employees/IndexControls.vue
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
<template>
|
||||||
|
<div class="d-flex mb-4">
|
||||||
|
<router-link type="button" :to="{name: 'Home'}" class="btn btn-outline-secondary">
|
||||||
|
<i class="bi bi-chevron-left"></i>
|
||||||
|
Zurück
|
||||||
|
</router-link>
|
||||||
|
|
||||||
|
<router-link type="button" :to="{name: 'Employees/New'}" class="btn btn-success ms-auto">
|
||||||
|
<i class="bi bi-save"></i>
|
||||||
|
Neuer Mitarbeiter
|
||||||
|
</router-link>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
</style>
|
||||||
@@ -2,7 +2,6 @@
|
|||||||
<nav class="nav justify-content-center border-bottom mb-4 pb-2 d-flex">
|
<nav class="nav justify-content-center border-bottom mb-4 pb-2 d-flex">
|
||||||
<router-link class="nav-link" :to="{name: 'Home'}">Home</router-link>
|
<router-link class="nav-link" :to="{name: 'Home'}">Home</router-link>
|
||||||
<router-link v-if="userStore.isAdmin" :to="{name: 'Employees/Index'}" class="nav-link">Mitarbeiter</router-link>
|
<router-link v-if="userStore.isAdmin" :to="{name: 'Employees/Index'}" class="nav-link">Mitarbeiter</router-link>
|
||||||
<router-link v-if="userStore.isAdmin" :to="{name: 'Employees/New'}" class="nav-link">Neuer Mitarbeiter</router-link>
|
|
||||||
<div class="ms-auto"></div>
|
<div class="ms-auto"></div>
|
||||||
<router-link
|
<router-link
|
||||||
v-if="userStore.isLoggedIn"
|
v-if="userStore.isLoggedIn"
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ export default defineStore('employees', () => {
|
|||||||
}
|
}
|
||||||
)).data
|
)).data
|
||||||
|
|
||||||
Object.assign(state.meta, data.meta)
|
_assign(state.meta, data.meta)
|
||||||
state.rows = _cloneDeep(data.data)
|
state.rows = _cloneDeep(data.data)
|
||||||
|
|
||||||
_assign(state.columns, fetchColumns())
|
_assign(state.columns, fetchColumns())
|
||||||
|
|||||||
@@ -37,8 +37,6 @@ export const useSettings = defineStore({
|
|||||||
headers: user.header
|
headers: user.header
|
||||||
})
|
})
|
||||||
|
|
||||||
console.log(result)
|
|
||||||
|
|
||||||
result.data.forEach((element) => {
|
result.data.forEach((element) => {
|
||||||
this.settings[_camelCase(element.key)] = JSON.parse(element.value)
|
this.settings[_camelCase(element.key)] = JSON.parse(element.value)
|
||||||
})
|
})
|
||||||
@@ -67,7 +65,6 @@ export const useSettings = defineStore({
|
|||||||
settings.push({key: _kebabCase(key), value: JSON.stringify(value)})
|
settings.push({key: _kebabCase(key), value: JSON.stringify(value)})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
console.log(settings)
|
|
||||||
const result = await axios.post('settings',
|
const result = await axios.post('settings',
|
||||||
{
|
{
|
||||||
settings
|
settings
|
||||||
@@ -75,7 +72,6 @@ export const useSettings = defineStore({
|
|||||||
{
|
{
|
||||||
headers: user.header
|
headers: user.header
|
||||||
})
|
})
|
||||||
console.log(result)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
@update-columns-selected="updateColumnsSelected"
|
@update-columns-selected="updateColumnsSelected"
|
||||||
/>
|
/>
|
||||||
|
<IndexControls />
|
||||||
|
|
||||||
<SimpleSearch
|
<SimpleSearch
|
||||||
:columns="settings.employeesIndexColumnsSelected"
|
:columns="settings.employeesIndexColumnsSelected"
|
||||||
@@ -57,6 +58,7 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import SimpleSearch from '@/components/Employees/SimpleSearch.vue';
|
import SimpleSearch from '@/components/Employees/SimpleSearch.vue';
|
||||||
import IndexSettingsModal from '@/components/Employees/IndexSettingsModal.vue';
|
import IndexSettingsModal from '@/components/Employees/IndexSettingsModal.vue';
|
||||||
|
import IndexControls from '@/components/Employees/IndexControls.vue';
|
||||||
import VPaginator from '@/components/VPaginator.vue';
|
import VPaginator from '@/components/VPaginator.vue';
|
||||||
import { onMounted, reactive, computed } from 'vue'
|
import { onMounted, reactive, computed } from 'vue'
|
||||||
import { useRouter } from 'vue-router'
|
import { useRouter } from 'vue-router'
|
||||||
@@ -77,6 +79,7 @@ const sort_by = reactive({
|
|||||||
})
|
})
|
||||||
|
|
||||||
onMounted(async () =>{
|
onMounted(async () =>{
|
||||||
|
console.log("Employees Index onMounted")
|
||||||
await store.fetchFromApi()
|
await store.fetchFromApi()
|
||||||
await settingsStore.fetchFromApi()
|
await settingsStore.fetchFromApi()
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user