feat: enhance contact management UI with additional contact details and improve error handling
This commit is contained in:
parent
45232be689
commit
9effaeba0a
@ -20,6 +20,8 @@
|
|||||||
dataKey="id"
|
dataKey="id"
|
||||||
filterDisplay="menu"
|
filterDisplay="menu"
|
||||||
showGridlines
|
showGridlines
|
||||||
|
scrollable
|
||||||
|
scrollHeight="flex"
|
||||||
paginatorTemplate="FirstPageLink PrevPageLink PageLinks NextPageLink LastPageLink CurrentPageReport RowsPerPageDropdown"
|
paginatorTemplate="FirstPageLink PrevPageLink PageLinks NextPageLink LastPageLink CurrentPageReport RowsPerPageDropdown"
|
||||||
currentPageReportTemplate="Zeige {first} bis {last} von {totalRecords} Einträgen"
|
currentPageReportTemplate="Zeige {first} bis {last} von {totalRecords} Einträgen"
|
||||||
>
|
>
|
||||||
@ -105,6 +107,39 @@
|
|||||||
<span v-else class="text-500">Keine Ansprechpartner</span>
|
<span v-else class="text-500">Keine Ansprechpartner</span>
|
||||||
</template>
|
</template>
|
||||||
</Column>
|
</Column>
|
||||||
|
<Column header="Telefon" style="min-width: 150px">
|
||||||
|
<template #body="{ data }">
|
||||||
|
<div v-if="data.phone">
|
||||||
|
<i class="pi pi-phone mr-1"></i>
|
||||||
|
{{ data.phone }}
|
||||||
|
</div>
|
||||||
|
<span v-else class="text-500">---</span>
|
||||||
|
</template>
|
||||||
|
</Column>
|
||||||
|
|
||||||
|
<Column header="E-Mail" style="min-width: 200px">
|
||||||
|
<template #body="{ data }">
|
||||||
|
<div v-if="data.email">
|
||||||
|
<a :href="'mailto:' + data.email" class="text-primary">
|
||||||
|
<i class="pi pi-envelope mr-1"></i>
|
||||||
|
{{ data.email }}
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<span v-else class="text-500">---</span>
|
||||||
|
</template>
|
||||||
|
</Column>
|
||||||
|
|
||||||
|
<Column header="Website" style="min-width: 200px">
|
||||||
|
<template #body="{ data }">
|
||||||
|
<div v-if="data.website">
|
||||||
|
<a :href="data.website" target="_blank" class="text-primary">
|
||||||
|
<i class="pi pi-globe mr-1"></i>
|
||||||
|
{{ data.website }}
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<span v-else class="text-500">---</span>
|
||||||
|
</template>
|
||||||
|
</Column>
|
||||||
|
|
||||||
<Column header="Typ" style="min-width: 130px">
|
<Column header="Typ" style="min-width: 130px">
|
||||||
<template #body="{ data }">
|
<template #body="{ data }">
|
||||||
@ -138,23 +173,6 @@
|
|||||||
</template>
|
</template>
|
||||||
</Column>
|
</Column>
|
||||||
|
|
||||||
<Column header="Kontakt" style="min-width: 200px">
|
|
||||||
<template #body="{ data }">
|
|
||||||
<div class="flex flex-column gap-1">
|
|
||||||
<div v-if="data.phone" class="text-sm">
|
|
||||||
<i class="pi pi-phone mr-1"></i> {{ data.phone }}
|
|
||||||
</div>
|
|
||||||
<div v-if="data.email" class="text-sm">
|
|
||||||
<i class="pi pi-envelope mr-1"></i> {{ data.email }}
|
|
||||||
</div>
|
|
||||||
<div v-if="data.website" class="text-sm">
|
|
||||||
<i class="pi pi-globe mr-1"></i>
|
|
||||||
<a :href="data.website" target="_blank">{{ data.website }}</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
</Column>
|
|
||||||
|
|
||||||
<Column :exportable="false" style="min-width: 120px">
|
<Column :exportable="false" style="min-width: 120px">
|
||||||
<template #body="{ data }">
|
<template #body="{ data }">
|
||||||
<div class="flex gap-2">
|
<div class="flex gap-2">
|
||||||
@ -619,8 +637,6 @@ const loadContacts = async () => {
|
|||||||
|
|
||||||
// API Platform gibt hydra:member zurück
|
// API Platform gibt hydra:member zurück
|
||||||
contacts.value = data['hydra:member'] || data.member || []
|
contacts.value = data['hydra:member'] || data.member || []
|
||||||
|
|
||||||
console.log('Loaded contacts:', contacts.value.length, 'with filter:', typeFilter.value)
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error loading contacts:', error)
|
console.error('Error loading contacts:', error)
|
||||||
toast.add({
|
toast.add({
|
||||||
@ -718,7 +734,17 @@ const saveContact = async () => {
|
|||||||
|
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
const error = await response.json()
|
const error = await response.json()
|
||||||
throw new Error(error.message || 'Fehler beim Speichern')
|
|
||||||
|
// API Platform liefert Validierungsfehler in 'violations' Array
|
||||||
|
if (error.violations && error.violations.length > 0) {
|
||||||
|
const errorMessages = error.violations
|
||||||
|
.map(v => `${v.propertyPath}: ${v.message}`)
|
||||||
|
.join('\n')
|
||||||
|
throw new Error(errorMessages)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fallback für andere Fehlerformate
|
||||||
|
throw new Error(error['hydra:description'] || error.message || error.detail || 'Fehler beim Speichern')
|
||||||
}
|
}
|
||||||
|
|
||||||
toast.add({
|
toast.add({
|
||||||
@ -736,7 +762,7 @@ const saveContact = async () => {
|
|||||||
severity: 'error',
|
severity: 'error',
|
||||||
summary: 'Fehler',
|
summary: 'Fehler',
|
||||||
detail: error.message || 'Kontakt konnte nicht gespeichert werden',
|
detail: error.message || 'Kontakt konnte nicht gespeichert werden',
|
||||||
life: 3000
|
life: 5000
|
||||||
})
|
})
|
||||||
} finally {
|
} finally {
|
||||||
saving.value = false
|
saving.value = false
|
||||||
|
|||||||
@ -291,7 +291,7 @@ class Contact
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function isDebtor(): bool
|
public function getIsDebtor(): bool
|
||||||
{
|
{
|
||||||
return $this->isDebtor;
|
return $this->isDebtor;
|
||||||
}
|
}
|
||||||
@ -303,7 +303,7 @@ class Contact
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function isCreditor(): bool
|
public function getIsCreditor(): bool
|
||||||
{
|
{
|
||||||
return $this->isCreditor;
|
return $this->isCreditor;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user