Changes
This commit is contained in:
@@ -9,7 +9,7 @@ const _useDashboard = () => {
|
||||
defineShortcuts({
|
||||
'g-h': () => router.push('/'),
|
||||
'g-i': () => router.push('/inbox'),
|
||||
'g-u': () => router.push('/users'),
|
||||
'g-u': () => router.push('/profiles'),
|
||||
'g-s': () => router.push('/settings'),
|
||||
'?': () => isHelpSlideoverOpen.value = true,
|
||||
n: () => isNotificationsSlideoverOpen.value = !isNotificationsSlideoverOpen.value
|
||||
|
||||
@@ -329,6 +329,10 @@ let links = [
|
||||
label: "Nummernkreise",
|
||||
to: "/settings/numberRanges",
|
||||
icon: "i-heroicons-clipboard-document-list"
|
||||
},{
|
||||
label: "Mitarbeiter",
|
||||
to: "/settings/profiles",
|
||||
icon: "i-heroicons-clipboard-document-list"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -423,7 +427,7 @@ const footerLinks = [/*{
|
||||
<UDashboardPanel :width="250" :resizable="{ min: 200, max: 300 }" collapsible>
|
||||
<UDashboardNavbar class="!border-transparent" :ui="{ left: 'flex-1' }">
|
||||
<template #left>
|
||||
<TenantDropdown />
|
||||
<TenantDropdown class="w-full" />
|
||||
</template>
|
||||
</UDashboardNavbar>
|
||||
|
||||
|
||||
@@ -39,6 +39,9 @@ const resources = {
|
||||
},
|
||||
invoices: {
|
||||
label: "Rechnungen"
|
||||
},
|
||||
quotes: {
|
||||
label: "Angebote"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
97
spaces/pages/settings/profiles/create.vue
Normal file
97
spaces/pages/settings/profiles/create.vue
Normal file
@@ -0,0 +1,97 @@
|
||||
<script setup>
|
||||
const router = useRouter()
|
||||
const route = useRoute()
|
||||
const dataStore = useDataStore()
|
||||
|
||||
const itemInfo = ref({})
|
||||
|
||||
const createProfile = async () => {
|
||||
let data = {
|
||||
fullName: `${itemInfo.value.firstName} ${itemInfo.value.lastName}`,
|
||||
...itemInfo.value
|
||||
}
|
||||
|
||||
await dataStore.createNewItem("profiles", data)
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<UDashboardNavbar title="Mitarbeiter erstellen">
|
||||
<template #right>
|
||||
<UButton
|
||||
color="rose"
|
||||
@click="router.push(`/settings/profiles`)"
|
||||
>
|
||||
Abbrechen
|
||||
</UButton>
|
||||
<UButton
|
||||
@click="createProfile"
|
||||
>
|
||||
Erstellen
|
||||
</UButton>
|
||||
</template>
|
||||
</UDashboardNavbar>
|
||||
|
||||
<UForm
|
||||
class="p-5"
|
||||
>
|
||||
<UFormGroup
|
||||
label="Anrede"
|
||||
>
|
||||
<UInput
|
||||
required
|
||||
v-model="itemInfo.salutation"
|
||||
/>
|
||||
</UFormGroup>
|
||||
<UFormGroup
|
||||
label="Vorname"
|
||||
>
|
||||
<UInput
|
||||
required
|
||||
v-model="itemInfo.firstName"
|
||||
/>
|
||||
</UFormGroup>
|
||||
<UFormGroup
|
||||
label="Nachname"
|
||||
>
|
||||
<UInput
|
||||
required
|
||||
v-model="itemInfo.lastName"
|
||||
/>
|
||||
</UFormGroup>
|
||||
<UFormGroup
|
||||
label="Mitarbeiter Nummer"
|
||||
>
|
||||
<UInput
|
||||
v-model="itemInfo.employeeNumber"
|
||||
/>
|
||||
</UFormGroup>
|
||||
<UFormGroup
|
||||
label="E-Mail"
|
||||
>
|
||||
<UInput
|
||||
v-model="itemInfo.email"
|
||||
/>
|
||||
</UFormGroup>
|
||||
<UFormGroup
|
||||
label="Handynummer"
|
||||
>
|
||||
<UInput
|
||||
v-model="itemInfo.mobileTel"
|
||||
/>
|
||||
</UFormGroup>
|
||||
<UFormGroup
|
||||
label="Festnetznummer"
|
||||
>
|
||||
<UInput
|
||||
v-model="itemInfo.fixedTel"
|
||||
/>
|
||||
</UFormGroup>
|
||||
</UForm>
|
||||
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
45
spaces/pages/settings/profiles/index.vue
Normal file
45
spaces/pages/settings/profiles/index.vue
Normal file
@@ -0,0 +1,45 @@
|
||||
<script setup>
|
||||
const dataStore = useDataStore()
|
||||
const router = useRouter()
|
||||
|
||||
|
||||
const templateColumns = [
|
||||
{
|
||||
key: 'fullName',
|
||||
label: "Name:",
|
||||
sortable: true
|
||||
},
|
||||
{
|
||||
key: "email",
|
||||
label: "E-Mail:",
|
||||
sortable: true
|
||||
}
|
||||
]
|
||||
const selectedColumns = ref(templateColumns)
|
||||
const columns = computed(() => templateColumns.filter((column) => selectedColumns.value.includes(column)))
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<UDashboardNavbar title="Benutzer Einstellungen">
|
||||
<template #right>
|
||||
<UButton
|
||||
@click="router.push(`/settings/profiles/create`)"
|
||||
>
|
||||
+ Mitarbeiter
|
||||
</UButton>
|
||||
</template>
|
||||
</UDashboardNavbar>
|
||||
|
||||
<UTable
|
||||
:rows="dataStore.profiles"
|
||||
@select="(item) => router.push(`/settings/profiles/show/${item.id}`)"
|
||||
:columns="columns"
|
||||
>
|
||||
|
||||
</UTable>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
113
spaces/pages/settings/profiles/show/[id].vue
Normal file
113
spaces/pages/settings/profiles/show/[id].vue
Normal file
@@ -0,0 +1,113 @@
|
||||
<script setup>
|
||||
const dataStore = useDataStore()
|
||||
const route = useRoute()
|
||||
|
||||
const itemInfo = ref({})
|
||||
|
||||
const setupPage = () => {
|
||||
if(route.params.id) itemInfo.value = dataStore.getProfileById(route.params.id)
|
||||
}
|
||||
|
||||
setupPage()
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<UDashboardNavbar
|
||||
:title="itemInfo.fullName"
|
||||
>
|
||||
</UDashboardNavbar>
|
||||
|
||||
<UTabs
|
||||
class="p-5"
|
||||
:items="[
|
||||
{
|
||||
label: 'Informationen'
|
||||
},{
|
||||
label: 'Zeiterfassung'
|
||||
},{
|
||||
label: 'Vertragsdaten'
|
||||
}
|
||||
]"
|
||||
>
|
||||
<template #item="{item}">
|
||||
<UCard class="mt-5">
|
||||
<div v-if="item.label === 'Informationen'">
|
||||
<Toolbar>
|
||||
<UButton
|
||||
@click="dataStore.updateItem('profiles',itemInfo)"
|
||||
>
|
||||
Speichern
|
||||
</UButton>
|
||||
</Toolbar>
|
||||
<InputGroup class="w-full">
|
||||
<UFormGroup
|
||||
label="Anrede"
|
||||
class="w-60"
|
||||
>
|
||||
<UInput
|
||||
v-model="itemInfo.salutation"
|
||||
/>
|
||||
</UFormGroup>
|
||||
<UFormGroup
|
||||
label="Vorname"
|
||||
class="flex-auto"
|
||||
>
|
||||
<UInput
|
||||
v-model="itemInfo.firstName"
|
||||
/>
|
||||
</UFormGroup>
|
||||
<UFormGroup
|
||||
label="Nachname"
|
||||
class="flex-auto"
|
||||
>
|
||||
<UInput
|
||||
v-model="itemInfo.lastName"
|
||||
/>
|
||||
</UFormGroup>
|
||||
</InputGroup><InputGroup class="w-full">
|
||||
<UFormGroup
|
||||
label="Mitarbeiternummer"
|
||||
class="w-60"
|
||||
>
|
||||
<UInput
|
||||
v-model="itemInfo.employeeNumber"
|
||||
/>
|
||||
</UFormGroup>
|
||||
</InputGroup>
|
||||
</div>
|
||||
<div v-if="item.label === 'Vertragsdaten'">
|
||||
<Toolbar>
|
||||
<UButton
|
||||
@click="dataStore.updateItem('profiles',itemInfo)"
|
||||
>
|
||||
Speichern
|
||||
</UButton>
|
||||
</Toolbar>
|
||||
<InputGroup class="w-full">
|
||||
<UFormGroup
|
||||
label="Wöchentliche Arbeitszeit"
|
||||
class="flex-auto"
|
||||
>
|
||||
<UInput
|
||||
v-model="itemInfo.weeklyWorkingHours"
|
||||
/>
|
||||
</UFormGroup>
|
||||
<UFormGroup
|
||||
label="Urlaubstage"
|
||||
class="flex-auto"
|
||||
>
|
||||
<UInput
|
||||
v-model="itemInfo.annualPaidLeaveDays"
|
||||
/>
|
||||
</UFormGroup>
|
||||
</InputGroup>
|
||||
</div>
|
||||
</UCard>
|
||||
</template>
|
||||
</UTabs>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
@@ -102,6 +102,11 @@ export const useDataStore = defineStore('data', () => {
|
||||
label: "Termine",
|
||||
labelSingle: "Termin"
|
||||
},
|
||||
profiles: {
|
||||
label: "Mitarbeiter",
|
||||
labelSingle: "Mitarbeiter",
|
||||
redirect: true
|
||||
}
|
||||
}
|
||||
|
||||
const documentTypesForCreation = ref({
|
||||
@@ -236,7 +241,7 @@ export const useDataStore = defineStore('data', () => {
|
||||
])
|
||||
|
||||
async function initializeData (userId) {
|
||||
let profile = (await supabase.from("profiles").select().eq("id",userId).single()).data
|
||||
let profile = (await supabase.from("profiles").select().eq("user",userId).single()).data
|
||||
|
||||
currentTenant.value = profile.tenant
|
||||
|
||||
@@ -419,16 +424,23 @@ export const useDataStore = defineStore('data', () => {
|
||||
}
|
||||
|
||||
async function updateItem (dataType, data) {
|
||||
|
||||
const {tenants, ...newData} = data
|
||||
|
||||
|
||||
|
||||
|
||||
const {data:supabaseData,error: supabaseError} = await supabase
|
||||
.from(dataType)
|
||||
.update(data)
|
||||
.eq('id',data.id)
|
||||
.update(newData)
|
||||
.eq('id',newData.id)
|
||||
.select()
|
||||
|
||||
if(supabaseError) {
|
||||
console.log(supabaseError)
|
||||
} else if(supabaseData) {
|
||||
await eval(dataType + '.value[' + dataType + '.value.findIndex(i => i.id === ' + JSON.stringify(data.id) + ')] = ' + JSON.stringify(supabaseData[0]))
|
||||
if(dataType === 'profiles') await fetchProfiles()
|
||||
toast.add({title: `${dataTypes[dataType].labelSingle} gespeichert`})
|
||||
if(dataTypes[dataType].redirect) await router.push(`/${dataType}/show/${data.id}`)
|
||||
return supabaseData
|
||||
@@ -509,7 +521,7 @@ export const useDataStore = defineStore('data', () => {
|
||||
}
|
||||
|
||||
async function fetchProfiles () {
|
||||
profiles.value = (await supabase.from("profiles").select('* , tenants (id, name)')/*.eq("tenant", currentTenant.value)*/.order("fullName")).data
|
||||
profiles.value = (await supabase.from("profiles").select('* , tenants (id, name)').eq("tenant", currentTenant.value).order("fullName")).data
|
||||
}
|
||||
async function fetchBankAccounts () {
|
||||
bankAccounts.value = (await supabase.from("bankaccounts").select().eq('tenant', currentTenant.value)).data
|
||||
|
||||
Reference in New Issue
Block a user