Compare commits
No commits in common. "45232be689ad5755c5365d5ef6483134e52fa65a" and "b84dc6c6e9288fb5d777b0b07ad59255d132464e" have entirely different histories.
45232be689
...
b84dc6c6e9
@ -119,49 +119,6 @@ app.use(PrimeVue, {
|
|||||||
darkModeSelector: '.app-dark',
|
darkModeSelector: '.app-dark',
|
||||||
cssLayer: false
|
cssLayer: false
|
||||||
}
|
}
|
||||||
},
|
|
||||||
locale: {
|
|
||||||
startsWith: 'Beginnt mit',
|
|
||||||
contains: 'Enthält',
|
|
||||||
notContains: 'Enthält nicht',
|
|
||||||
endsWith: 'Endet mit',
|
|
||||||
equals: 'Gleich',
|
|
||||||
notEquals: 'Nicht gleich',
|
|
||||||
noFilter: 'Kein Filter',
|
|
||||||
lt: 'Kleiner als',
|
|
||||||
lte: 'Kleiner oder gleich',
|
|
||||||
gt: 'Größer als',
|
|
||||||
gte: 'Größer oder gleich',
|
|
||||||
dateIs: 'Datum ist',
|
|
||||||
dateIsNot: 'Datum ist nicht',
|
|
||||||
dateBefore: 'Datum vor',
|
|
||||||
dateAfter: 'Datum nach',
|
|
||||||
clear: 'Löschen',
|
|
||||||
apply: 'Anwenden',
|
|
||||||
matchAll: 'Alle erfüllen',
|
|
||||||
matchAny: 'Mindestens eine',
|
|
||||||
addRule: 'Regel hinzufügen',
|
|
||||||
removeRule: 'Regel entfernen',
|
|
||||||
accept: 'Ja',
|
|
||||||
reject: 'Nein',
|
|
||||||
choose: 'Auswählen',
|
|
||||||
upload: 'Hochladen',
|
|
||||||
cancel: 'Abbrechen',
|
|
||||||
dayNames: ['Sonntag', 'Montag', 'Dienstag', 'Mittwoch', 'Donnerstag', 'Freitag', 'Samstag'],
|
|
||||||
dayNamesShort: ['So', 'Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa'],
|
|
||||||
dayNamesMin: ['So', 'Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa'],
|
|
||||||
monthNames: ['Januar', 'Februar', 'März', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember'],
|
|
||||||
monthNamesShort: ['Jan', 'Feb', 'Mär', 'Apr', 'Mai', 'Jun', 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Dez'],
|
|
||||||
today: 'Heute',
|
|
||||||
weekHeader: 'KW',
|
|
||||||
firstDayOfWeek: 1,
|
|
||||||
dateFormat: 'dd.mm.yy',
|
|
||||||
weak: 'Schwach',
|
|
||||||
medium: 'Mittel',
|
|
||||||
strong: 'Stark',
|
|
||||||
passwordPrompt: 'Passwort eingeben',
|
|
||||||
emptyFilterMessage: 'Keine Ergebnisse gefunden',
|
|
||||||
emptyMessage: 'Keine Optionen verfügbar'
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
app.use(ToastService);
|
app.use(ToastService);
|
||||||
|
|||||||
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="layout-footer">
|
<div class="layout-footer">
|
||||||
<a href="https://www.osdata.org" target="_blank" rel="noopener noreferrer" class="text-primary font-bold hover:underline">2025 © osdata.org</a>
|
SAKAI by
|
||||||
|
<a href="https://primevue.org" target="_blank" rel="noopener noreferrer" class="text-primary font-bold hover:underline">PrimeVue</a>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@ -1,30 +1,35 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="contact-management">
|
<div class="contact-management">
|
||||||
<div class="card">
|
<div class="flex justify-content-between align-items-center mb-4">
|
||||||
<div class="flex justify-between items-center mb-4">
|
<h1 class="text-3xl font-bold">Kontakte</h1>
|
||||||
<div class="font-semibold text-xl">Kontakte</div>
|
|
||||||
<Button label="Neuer Kontakt" icon="pi pi-plus" @click="openNewContactDialog" />
|
<Button label="Neuer Kontakt" icon="pi pi-plus" @click="openNewContactDialog" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<Card>
|
||||||
|
<template #content>
|
||||||
<DataTable
|
<DataTable
|
||||||
v-model:filters="filters"
|
v-model:filters="globalFilter"
|
||||||
:value="contacts"
|
:value="contacts"
|
||||||
:loading="loading"
|
:loading="loading"
|
||||||
:paginator="true"
|
paginator
|
||||||
:rows="10"
|
:rows="10"
|
||||||
:rowsPerPageOptions="[10, 25, 50, 100]"
|
:rowsPerPageOptions="[10, 25, 50]"
|
||||||
:rowHover="true"
|
:globalFilterFields="['companyName', 'city', 'email']"
|
||||||
:globalFilterFields="['companyName', 'city', 'email', 'phone']"
|
|
||||||
sortField="companyName"
|
sortField="companyName"
|
||||||
:sortOrder="1"
|
:sortOrder="1"
|
||||||
dataKey="id"
|
|
||||||
filterDisplay="menu"
|
|
||||||
showGridlines
|
|
||||||
paginatorTemplate="FirstPageLink PrevPageLink PageLinks NextPageLink LastPageLink CurrentPageReport RowsPerPageDropdown"
|
|
||||||
currentPageReportTemplate="Zeige {first} bis {last} von {totalRecords} Einträgen"
|
|
||||||
>
|
>
|
||||||
<template #header>
|
<template #header>
|
||||||
<div class="flex justify-between flex-wrap gap-2">
|
<div class="flex justify-content-between">
|
||||||
|
<IconField iconPosition="left">
|
||||||
|
<InputIcon>
|
||||||
|
<i class="pi pi-search" />
|
||||||
|
</InputIcon>
|
||||||
|
<InputText
|
||||||
|
v-model="globalFilter"
|
||||||
|
placeholder="Suchen..."
|
||||||
|
style="width: 300px"
|
||||||
|
/>
|
||||||
|
</IconField>
|
||||||
<div class="flex gap-2">
|
<div class="flex gap-2">
|
||||||
<Button
|
<Button
|
||||||
label="Alle"
|
label="Alle"
|
||||||
@ -45,19 +50,8 @@
|
|||||||
size="small"
|
size="small"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<IconField>
|
|
||||||
<InputIcon>
|
|
||||||
<i class="pi pi-search" />
|
|
||||||
</InputIcon>
|
|
||||||
<InputText
|
|
||||||
v-model="filters['global'].value"
|
|
||||||
placeholder="Suchen..."
|
|
||||||
/>
|
|
||||||
</IconField>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<template #empty>Keine Kontakte gefunden.</template>
|
|
||||||
<template #loading>Lade Kontakte. Bitte warten...</template>
|
|
||||||
|
|
||||||
<Column field="companyName" header="Firma" sortable style="min-width: 200px">
|
<Column field="companyName" header="Firma" sortable style="min-width: 200px">
|
||||||
<template #body="{ data }">
|
<template #body="{ data }">
|
||||||
@ -66,9 +60,6 @@
|
|||||||
Nr: {{ data.companyNumber }}
|
Nr: {{ data.companyNumber }}
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<template #filter="{ filterModel }">
|
|
||||||
<InputText v-model="filterModel.value" type="text" placeholder="Suche nach Firma" />
|
|
||||||
</template>
|
|
||||||
</Column>
|
</Column>
|
||||||
|
|
||||||
<Column field="city" header="Ort" sortable style="min-width: 150px">
|
<Column field="city" header="Ort" sortable style="min-width: 150px">
|
||||||
@ -80,9 +71,6 @@
|
|||||||
{{ data.country }}
|
{{ data.country }}
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<template #filter="{ filterModel }">
|
|
||||||
<InputText v-model="filterModel.value" type="text" placeholder="Suche nach Ort" />
|
|
||||||
</template>
|
|
||||||
</Column>
|
</Column>
|
||||||
|
|
||||||
<Column header="Ansprechpartner" style="min-width: 200px">
|
<Column header="Ansprechpartner" style="min-width: 200px">
|
||||||
@ -115,27 +103,13 @@
|
|||||||
</template>
|
</template>
|
||||||
</Column>
|
</Column>
|
||||||
|
|
||||||
<Column field="isActive" header="Status" dataType="boolean" style="min-width: 100px">
|
<Column header="Status" style="min-width: 100px">
|
||||||
<template #body="{ data }">
|
<template #body="{ data }">
|
||||||
<Tag
|
<Tag
|
||||||
:value="data.isActive ? 'Aktiv' : 'Inaktiv'"
|
:value="data.isActive ? 'Aktiv' : 'Inaktiv'"
|
||||||
:severity="data.isActive ? 'success' : 'danger'"
|
:severity="data.isActive ? 'success' : 'danger'"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
<template #filter="{ filterModel }">
|
|
||||||
<Select
|
|
||||||
v-model="filterModel.value"
|
|
||||||
:options="statusOptions"
|
|
||||||
optionLabel="label"
|
|
||||||
optionValue="value"
|
|
||||||
placeholder="Status wählen"
|
|
||||||
showClear
|
|
||||||
>
|
|
||||||
<template #option="slotProps">
|
|
||||||
<Tag :value="slotProps.option.label" :severity="slotProps.option.value ? 'success' : 'danger'" />
|
|
||||||
</template>
|
|
||||||
</Select>
|
|
||||||
</template>
|
|
||||||
</Column>
|
</Column>
|
||||||
|
|
||||||
<Column header="Kontakt" style="min-width: 200px">
|
<Column header="Kontakt" style="min-width: 200px">
|
||||||
@ -177,59 +151,77 @@
|
|||||||
</template>
|
</template>
|
||||||
</Column>
|
</Column>
|
||||||
|
|
||||||
|
<template #empty>Keine Kontakte gefunden.</template>
|
||||||
</DataTable>
|
</DataTable>
|
||||||
</div>
|
</template>
|
||||||
|
</Card>
|
||||||
|
|
||||||
<!-- Contact Dialog -->
|
<!-- Contact Dialog -->
|
||||||
<Dialog
|
<Dialog
|
||||||
v-model:visible="contactDialog"
|
v-model:visible="contactDialog"
|
||||||
:header="editingContact?.id ? 'Kontakt bearbeiten' : 'Neuer Kontakt'"
|
:header="editingContact?.id ? 'Kontakt bearbeiten' : 'Neuer Kontakt'"
|
||||||
:modal="true"
|
:modal="true"
|
||||||
:style="{ width: '1200px', maxHeight: '90vh' }"
|
:style="{ width: '1000px' }"
|
||||||
:closable="true"
|
:closable="true"
|
||||||
|
class="contact-dialog"
|
||||||
>
|
>
|
||||||
<div v-if="editingContact">
|
<div v-if="editingContact">
|
||||||
<!-- Basisdaten -->
|
<!-- Basisdaten -->
|
||||||
<Card class="mb-3">
|
<Card class="mb-3">
|
||||||
<template #title>
|
<template #title>
|
||||||
<div class="flex items-center gap-2">
|
<div class="flex align-items-center gap-2">
|
||||||
<i class="pi pi-building text-primary"></i>
|
<i class="pi pi-building text-primary"></i>
|
||||||
<span>Basisdaten</span>
|
<span>Basisdaten</span>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<template #content>
|
<template #content>
|
||||||
<div class="flex flex-col gap-4">
|
<div class="formgrid grid">
|
||||||
<div class="flex flex-col md:flex-row gap-4">
|
<div class="field col-12 md:col-8">
|
||||||
<div class="flex flex-col gap-2 w-full md:w-2/3">
|
<label for="companyName" class="block mb-2 font-medium">
|
||||||
<label for="companyName">Firmenname <span class="text-red-500">*</span></label>
|
Firmenname <span class="text-red-500">*</span>
|
||||||
|
</label>
|
||||||
<InputText
|
<InputText
|
||||||
id="companyName"
|
id="companyName"
|
||||||
v-model="editingContact.companyName"
|
v-model="editingContact.companyName"
|
||||||
:invalid="submitted && !editingContact.companyName"
|
class="w-full"
|
||||||
|
:class="{ 'p-invalid': submitted && !editingContact.companyName }"
|
||||||
/>
|
/>
|
||||||
<small v-if="submitted && !editingContact.companyName" class="text-red-500">
|
<small v-if="submitted && !editingContact.companyName" class="p-error">
|
||||||
Firmenname ist erforderlich
|
Firmenname ist erforderlich
|
||||||
</small>
|
</small>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="flex flex-col gap-2 w-full md:w-1/3">
|
<div class="field col-12 md:col-4">
|
||||||
<label for="companyNumber">Kundennummer</label>
|
<label for="companyNumber" class="block mb-2 font-medium">Kundennummer</label>
|
||||||
<InputText id="companyNumber" v-model="editingContact.companyNumber" />
|
<InputText id="companyNumber" v-model="editingContact.companyNumber" class="w-full" />
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="field col-12">
|
||||||
<div class="flex gap-4">
|
<div class="flex gap-4">
|
||||||
<div class="flex items-center gap-2">
|
<div class="field-checkbox mb-0">
|
||||||
<Checkbox inputId="isDebtor" v-model="editingContact.isDebtor" :binary="true" />
|
<Checkbox
|
||||||
<label for="isDebtor">Debitor</label>
|
inputId="isDebtor"
|
||||||
|
v-model="editingContact.isDebtor"
|
||||||
|
:binary="true"
|
||||||
|
/>
|
||||||
|
<label for="isDebtor" class="ml-2">Debitor</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex items-center gap-2">
|
<div class="field-checkbox mb-0">
|
||||||
<Checkbox inputId="isCreditor" v-model="editingContact.isCreditor" :binary="true" />
|
<Checkbox
|
||||||
<label for="isCreditor">Kreditor</label>
|
inputId="isCreditor"
|
||||||
|
v-model="editingContact.isCreditor"
|
||||||
|
:binary="true"
|
||||||
|
/>
|
||||||
|
<label for="isCreditor" class="ml-2">Kreditor</label>
|
||||||
|
</div>
|
||||||
|
<div class="field-checkbox mb-0">
|
||||||
|
<Checkbox
|
||||||
|
inputId="isActive"
|
||||||
|
v-model="editingContact.isActive"
|
||||||
|
:binary="true"
|
||||||
|
/>
|
||||||
|
<label for="isActive" class="ml-2">Aktiv</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex items-center gap-2">
|
|
||||||
<Checkbox inputId="isActive" v-model="editingContact.isActive" :binary="true" />
|
|
||||||
<label for="isActive">Aktiv</label>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -239,33 +231,31 @@
|
|||||||
<!-- Adresse -->
|
<!-- Adresse -->
|
||||||
<Card class="mb-3">
|
<Card class="mb-3">
|
||||||
<template #title>
|
<template #title>
|
||||||
<div class="flex items-center gap-2">
|
<div class="flex align-items-center gap-2">
|
||||||
<i class="pi pi-map-marker text-primary"></i>
|
<i class="pi pi-map-marker text-primary"></i>
|
||||||
<span>Adresse</span>
|
<span>Adresse</span>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<template #content>
|
<template #content>
|
||||||
<div class="flex flex-col gap-4">
|
<div class="formgrid grid">
|
||||||
<div class="flex flex-col gap-2">
|
<div class="field col-12">
|
||||||
<label for="street">Straße</label>
|
<label for="street" class="block mb-2 font-medium">Straße</label>
|
||||||
<InputText id="street" v-model="editingContact.street" />
|
<InputText id="street" v-model="editingContact.street" class="w-full" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="flex flex-col md:flex-row gap-4">
|
<div class="field col-12 md:col-3">
|
||||||
<div class="flex flex-col gap-2 w-full md:w-1/4">
|
<label for="zipCode" class="block mb-2 font-medium">PLZ</label>
|
||||||
<label for="zipCode">PLZ</label>
|
<InputText id="zipCode" v-model="editingContact.zipCode" class="w-full" />
|
||||||
<InputText id="zipCode" v-model="editingContact.zipCode" />
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="flex flex-col gap-2 w-full md:w-1/2">
|
<div class="field col-12 md:col-5">
|
||||||
<label for="city">Ort</label>
|
<label for="city" class="block mb-2 font-medium">Ort</label>
|
||||||
<InputText id="city" v-model="editingContact.city" />
|
<InputText id="city" v-model="editingContact.city" class="w-full" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="flex flex-col gap-2 w-full md:w-1/4">
|
<div class="field col-12 md:col-4">
|
||||||
<label for="country">Land</label>
|
<label for="country" class="block mb-2 font-medium">Land</label>
|
||||||
<InputText id="country" v-model="editingContact.country" />
|
<InputText id="country" v-model="editingContact.country" class="w-full" />
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@ -274,35 +264,31 @@
|
|||||||
<!-- Kontaktdaten -->
|
<!-- Kontaktdaten -->
|
||||||
<Card class="mb-3">
|
<Card class="mb-3">
|
||||||
<template #title>
|
<template #title>
|
||||||
<div class="flex items-center gap-2">
|
<div class="flex align-items-center gap-2">
|
||||||
<i class="pi pi-phone text-primary"></i>
|
<i class="pi pi-phone text-primary"></i>
|
||||||
<span>Kontaktdaten</span>
|
<span>Kontaktdaten</span>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<template #content>
|
<template #content>
|
||||||
<div class="flex flex-col gap-4">
|
<div class="formgrid grid">
|
||||||
<div class="flex flex-col md:flex-row gap-4">
|
<div class="field col-12 md:col-6">
|
||||||
<div class="flex flex-col gap-2 w-full">
|
<label for="phone" class="block mb-2 font-medium">Telefon</label>
|
||||||
<label for="phone">Telefon</label>
|
<InputText id="phone" v-model="editingContact.phone" class="w-full" />
|
||||||
<InputText id="phone" v-model="editingContact.phone" />
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="flex flex-col gap-2 w-full">
|
<div class="field col-12 md:col-6">
|
||||||
<label for="fax">Fax</label>
|
<label for="fax" class="block mb-2 font-medium">Fax</label>
|
||||||
<InputText id="fax" v-model="editingContact.fax" />
|
<InputText id="fax" v-model="editingContact.fax" class="w-full" />
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="flex flex-col md:flex-row gap-4">
|
<div class="field col-12 md:col-6">
|
||||||
<div class="flex flex-col gap-2 w-full">
|
<label for="email" class="block mb-2 font-medium">E-Mail</label>
|
||||||
<label for="email">E-Mail</label>
|
<InputText id="email" v-model="editingContact.email" type="email" class="w-full" />
|
||||||
<InputText id="email" v-model="editingContact.email" type="email" />
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="flex flex-col gap-2 w-full">
|
<div class="field col-12 md:col-6">
|
||||||
<label for="website">Website</label>
|
<label for="website" class="block mb-2 font-medium">Website</label>
|
||||||
<InputText id="website" v-model="editingContact.website" />
|
<InputText id="website" v-model="editingContact.website" class="w-full" />
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@ -311,21 +297,21 @@
|
|||||||
<!-- Steuerdaten -->
|
<!-- Steuerdaten -->
|
||||||
<Card class="mb-3">
|
<Card class="mb-3">
|
||||||
<template #title>
|
<template #title>
|
||||||
<div class="flex items-center gap-2">
|
<div class="flex align-items-center gap-2">
|
||||||
<i class="pi pi-calculator text-primary"></i>
|
<i class="pi pi-calculator text-primary"></i>
|
||||||
<span>Steuerdaten</span>
|
<span>Steuerdaten</span>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<template #content>
|
<template #content>
|
||||||
<div class="flex flex-col md:flex-row gap-4">
|
<div class="formgrid grid">
|
||||||
<div class="flex flex-col gap-2 w-full">
|
<div class="field col-12 md:col-6">
|
||||||
<label for="taxNumber">Steuernummer</label>
|
<label for="taxNumber" class="block mb-2 font-medium">Steuernummer</label>
|
||||||
<InputText id="taxNumber" v-model="editingContact.taxNumber" />
|
<InputText id="taxNumber" v-model="editingContact.taxNumber" class="w-full" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="flex flex-col gap-2 w-full">
|
<div class="field col-12 md:col-6">
|
||||||
<label for="vatNumber">USt-IdNr.</label>
|
<label for="vatNumber" class="block mb-2 font-medium">USt-IdNr.</label>
|
||||||
<InputText id="vatNumber" v-model="editingContact.vatNumber" />
|
<InputText id="vatNumber" v-model="editingContact.vatNumber" class="w-full" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@ -334,8 +320,8 @@
|
|||||||
<!-- Ansprechpartner -->
|
<!-- Ansprechpartner -->
|
||||||
<Card class="mb-3">
|
<Card class="mb-3">
|
||||||
<template #title>
|
<template #title>
|
||||||
<div class="flex items-center justify-between">
|
<div class="flex align-items-center justify-content-between">
|
||||||
<div class="flex items-center gap-2">
|
<div class="flex align-items-center gap-2">
|
||||||
<i class="pi pi-users text-primary"></i>
|
<i class="pi pi-users text-primary"></i>
|
||||||
<span>Ansprechpartner</span>
|
<span>Ansprechpartner</span>
|
||||||
</div>
|
</div>
|
||||||
@ -361,8 +347,8 @@
|
|||||||
class="mb-4"
|
class="mb-4"
|
||||||
>
|
>
|
||||||
<Divider v-if="index > 0" />
|
<Divider v-if="index > 0" />
|
||||||
<div class="flex flex-col gap-4">
|
<div class="formgrid grid">
|
||||||
<div class="flex justify-between items-center mb-3">
|
<div class="field col-12 flex justify-content-between align-items-center mb-3">
|
||||||
<h4 class="m-0 font-semibold">
|
<h4 class="m-0 font-semibold">
|
||||||
<i class="pi pi-user mr-2"></i>
|
<i class="pi pi-user mr-2"></i>
|
||||||
Ansprechpartner {{ index + 1 }}
|
Ansprechpartner {{ index + 1 }}
|
||||||
@ -378,85 +364,105 @@
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="flex flex-col md:flex-row gap-4">
|
<div class="field col-12 md:col-3">
|
||||||
<div class="flex flex-col gap-2 w-full md:w-1/4">
|
<label :for="'salutation-' + index" class="block mb-2 font-medium">
|
||||||
<label :for="'salutation-' + index">Anrede</label>
|
Anrede
|
||||||
|
</label>
|
||||||
<Dropdown
|
<Dropdown
|
||||||
:id="'salutation-' + index"
|
:id="'salutation-' + index"
|
||||||
v-model="person.salutation"
|
v-model="person.salutation"
|
||||||
:options="salutations"
|
:options="salutations"
|
||||||
placeholder="Wählen..."
|
placeholder="Wählen..."
|
||||||
|
class="w-full"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="flex flex-col gap-2 w-full md:w-1/4">
|
<div class="field col-12 md:col-3">
|
||||||
<label :for="'title-' + index">Titel</label>
|
<label :for="'title-' + index" class="block mb-2 font-medium">Titel</label>
|
||||||
<InputText :id="'title-' + index" v-model="person.title" />
|
<InputText :id="'title-' + index" v-model="person.title" class="w-full" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="flex flex-col gap-2 w-full md:w-1/4">
|
<div class="field col-12 md:col-3">
|
||||||
<label :for="'firstName-' + index">
|
<label :for="'firstName-' + index" class="block mb-2 font-medium">
|
||||||
Vorname <span class="text-red-500">*</span>
|
Vorname <span class="text-red-500">*</span>
|
||||||
</label>
|
</label>
|
||||||
<InputText
|
<InputText
|
||||||
:id="'firstName-' + index"
|
:id="'firstName-' + index"
|
||||||
v-model="person.firstName"
|
v-model="person.firstName"
|
||||||
:invalid="submitted && !person.firstName"
|
class="w-full"
|
||||||
|
:class="{ 'p-invalid': submitted && !person.firstName }"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="flex flex-col gap-2 w-full md:w-1/4">
|
<div class="field col-12 md:col-3">
|
||||||
<label :for="'lastName-' + index">
|
<label :for="'lastName-' + index" class="block mb-2 font-medium">
|
||||||
Nachname <span class="text-red-500">*</span>
|
Nachname <span class="text-red-500">*</span>
|
||||||
</label>
|
</label>
|
||||||
<InputText
|
<InputText
|
||||||
:id="'lastName-' + index"
|
:id="'lastName-' + index"
|
||||||
v-model="person.lastName"
|
v-model="person.lastName"
|
||||||
:invalid="submitted && !person.lastName"
|
class="w-full"
|
||||||
|
:class="{ 'p-invalid': submitted && !person.lastName }"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="field col-12 md:col-6">
|
||||||
|
<label :for="'position-' + index" class="block mb-2 font-medium">
|
||||||
|
Position
|
||||||
|
</label>
|
||||||
|
<InputText :id="'position-' + index" v-model="person.position" class="w-full" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="flex flex-col md:flex-row gap-4">
|
<div class="field col-12 md:col-6">
|
||||||
<div class="flex flex-col gap-2 w-full">
|
<label :for="'department-' + index" class="block mb-2 font-medium">
|
||||||
<label :for="'position-' + index">Position</label>
|
Abteilung
|
||||||
<InputText :id="'position-' + index" v-model="person.position" />
|
</label>
|
||||||
|
<InputText
|
||||||
|
:id="'department-' + index"
|
||||||
|
v-model="person.department"
|
||||||
|
class="w-full"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="flex flex-col gap-2 w-full">
|
<div class="field col-12 md:col-4">
|
||||||
<label :for="'department-' + index">Abteilung</label>
|
<label :for="'personPhone-' + index" class="block mb-2 font-medium">
|
||||||
<InputText :id="'department-' + index" v-model="person.department" />
|
Telefon
|
||||||
</div>
|
</label>
|
||||||
|
<InputText
|
||||||
|
:id="'personPhone-' + index"
|
||||||
|
v-model="person.phone"
|
||||||
|
class="w-full"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="flex flex-col md:flex-row gap-4">
|
<div class="field col-12 md:col-4">
|
||||||
<div class="flex flex-col gap-2 w-full">
|
<label :for="'mobile-' + index" class="block mb-2 font-medium">Mobil</label>
|
||||||
<label :for="'personPhone-' + index">Telefon</label>
|
<InputText :id="'mobile-' + index" v-model="person.mobile" class="w-full" />
|
||||||
<InputText :id="'personPhone-' + index" v-model="person.phone" />
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="flex flex-col gap-2 w-full">
|
<div class="field col-12 md:col-4">
|
||||||
<label :for="'mobile-' + index">Mobil</label>
|
<label :for="'personEmail-' + index" class="block mb-2 font-medium">
|
||||||
<InputText :id="'mobile-' + index" v-model="person.mobile" />
|
E-Mail
|
||||||
</div>
|
</label>
|
||||||
|
|
||||||
<div class="flex flex-col gap-2 w-full">
|
|
||||||
<label :for="'personEmail-' + index">E-Mail</label>
|
|
||||||
<InputText
|
<InputText
|
||||||
:id="'personEmail-' + index"
|
:id="'personEmail-' + index"
|
||||||
v-model="person.email"
|
v-model="person.email"
|
||||||
type="email"
|
type="email"
|
||||||
|
class="w-full"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="flex items-center gap-2">
|
<div class="field col-12">
|
||||||
|
<div class="field-checkbox mb-0">
|
||||||
<Checkbox
|
<Checkbox
|
||||||
:inputId="'isPrimary-' + index"
|
:inputId="'isPrimary-' + index"
|
||||||
v-model="person.isPrimary"
|
v-model="person.isPrimary"
|
||||||
:binary="true"
|
:binary="true"
|
||||||
/>
|
/>
|
||||||
<label :for="'isPrimary-' + index">Hauptansprechpartner</label>
|
<label :for="'isPrimary-' + index" class="ml-2">
|
||||||
|
Hauptansprechpartner
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -466,21 +472,19 @@
|
|||||||
<!-- Notizen -->
|
<!-- Notizen -->
|
||||||
<Card>
|
<Card>
|
||||||
<template #title>
|
<template #title>
|
||||||
<div class="flex items-center gap-2">
|
<div class="flex align-items-center gap-2">
|
||||||
<i class="pi pi-comment text-primary"></i>
|
<i class="pi pi-comment text-primary"></i>
|
||||||
<span>Notizen</span>
|
<span>Notizen</span>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<template #content>
|
<template #content>
|
||||||
<div class="flex flex-col gap-2">
|
|
||||||
<label for="notes">Interne Notizen zu diesem Kontakt</label>
|
|
||||||
<Textarea
|
<Textarea
|
||||||
id="notes"
|
id="notes"
|
||||||
v-model="editingContact.notes"
|
v-model="editingContact.notes"
|
||||||
|
class="w-full"
|
||||||
:rows="4"
|
:rows="4"
|
||||||
placeholder="Interne Notizen..."
|
placeholder="Interne Notizen zu diesem Kontakt..."
|
||||||
/>
|
/>
|
||||||
</div>
|
|
||||||
</template>
|
</template>
|
||||||
</Card>
|
</Card>
|
||||||
</div>
|
</div>
|
||||||
@ -515,7 +519,6 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { ref, onMounted } from 'vue'
|
import { ref, onMounted } from 'vue'
|
||||||
import { useToast } from 'primevue/usetoast'
|
import { useToast } from 'primevue/usetoast'
|
||||||
import { FilterMatchMode, FilterOperator } from '@primevue/core/api'
|
|
||||||
import DataTable from 'primevue/datatable'
|
import DataTable from 'primevue/datatable'
|
||||||
import Column from 'primevue/column'
|
import Column from 'primevue/column'
|
||||||
import Button from 'primevue/button'
|
import Button from 'primevue/button'
|
||||||
@ -529,7 +532,6 @@ import Dropdown from 'primevue/dropdown'
|
|||||||
import Divider from 'primevue/divider'
|
import Divider from 'primevue/divider'
|
||||||
import IconField from 'primevue/iconfield'
|
import IconField from 'primevue/iconfield'
|
||||||
import InputIcon from 'primevue/inputicon'
|
import InputIcon from 'primevue/inputicon'
|
||||||
import Select from 'primevue/select'
|
|
||||||
|
|
||||||
const toast = useToast()
|
const toast = useToast()
|
||||||
|
|
||||||
@ -542,19 +544,9 @@ const submitted = ref(false)
|
|||||||
const saving = ref(false)
|
const saving = ref(false)
|
||||||
const deleting = ref(false)
|
const deleting = ref(false)
|
||||||
const typeFilter = ref('all')
|
const typeFilter = ref('all')
|
||||||
const filters = ref({
|
const globalFilter = ref('')
|
||||||
global: { value: null, matchMode: FilterMatchMode.CONTAINS },
|
|
||||||
companyName: { operator: FilterOperator.AND, constraints: [{ value: null, matchMode: FilterMatchMode.STARTS_WITH }] },
|
|
||||||
city: { operator: FilterOperator.AND, constraints: [{ value: null, matchMode: FilterMatchMode.STARTS_WITH }] },
|
|
||||||
isActive: { value: null, matchMode: FilterMatchMode.EQUALS }
|
|
||||||
})
|
|
||||||
|
|
||||||
const salutations = ref(['Herr', 'Frau', 'Divers'])
|
const salutations = ref(['Herr', 'Frau', 'Divers'])
|
||||||
const statusOptions = ref([
|
|
||||||
{ label: 'Aktiv', value: true },
|
|
||||||
{ label: 'Inaktiv', value: false }
|
|
||||||
])
|
|
||||||
const typeOptions = ref(['Debitor', 'Kreditor'])
|
|
||||||
|
|
||||||
const emptyContact = () => ({
|
const emptyContact = () => ({
|
||||||
companyName: '',
|
companyName: '',
|
||||||
@ -596,20 +588,19 @@ onMounted(() => {
|
|||||||
const loadContacts = async () => {
|
const loadContacts = async () => {
|
||||||
loading.value = true
|
loading.value = true
|
||||||
try {
|
try {
|
||||||
// Alle Kontakte laden - API Platform unterstützt itemsPerPage Parameter
|
// API-Filter Parameter aufbauen
|
||||||
let url = '/api/contacts'
|
let url = '/api/contacts'
|
||||||
const params = new URLSearchParams()
|
const params = new URLSearchParams()
|
||||||
|
|
||||||
// Große Anzahl setzen, um alle Kontakte zu erhalten
|
|
||||||
params.append('itemsPerPage', '5000')
|
|
||||||
|
|
||||||
if (typeFilter.value === 'debtor') {
|
if (typeFilter.value === 'debtor') {
|
||||||
params.append('isDebtor', 'true')
|
params.append('isDebtor', 'true')
|
||||||
} else if (typeFilter.value === 'creditor') {
|
} else if (typeFilter.value === 'creditor') {
|
||||||
params.append('isCreditor', 'true')
|
params.append('isCreditor', 'true')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (params.toString()) {
|
||||||
url += '?' + params.toString()
|
url += '?' + params.toString()
|
||||||
|
}
|
||||||
|
|
||||||
const response = await fetch(url, {
|
const response = await fetch(url, {
|
||||||
credentials: 'include'
|
credentials: 'include'
|
||||||
@ -617,8 +608,8 @@ const loadContacts = async () => {
|
|||||||
if (!response.ok) throw new Error('Fehler beim Laden der Kontakte')
|
if (!response.ok) throw new Error('Fehler beim Laden der Kontakte')
|
||||||
const data = await response.json()
|
const data = await response.json()
|
||||||
|
|
||||||
// API Platform gibt hydra:member zurück
|
// API Platform gibt member zurück
|
||||||
contacts.value = data['hydra:member'] || data.member || []
|
contacts.value = data.member || []
|
||||||
|
|
||||||
console.log('Loaded contacts:', contacts.value.length, 'with filter:', typeFilter.value)
|
console.log('Loaded contacts:', contacts.value.length, 'with filter:', typeFilter.value)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
@ -1,821 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div class="contact-management">
|
|
||||||
<div class="card">
|
|
||||||
<div class="flex justify-between items-center mb-4">
|
|
||||||
<div class="font-semibold text-xl">Kontakte</div>
|
|
||||||
<Button label="Neuer Kontakt" icon="pi pi-plus" @click="openNewContactDialog" />
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<DataTable
|
|
||||||
v-model:filters="filters"
|
|
||||||
:value="contacts"
|
|
||||||
:loading="loading"
|
|
||||||
:paginator="true"
|
|
||||||
:rows="10"
|
|
||||||
:rowsPerPageOptions="[10, 25, 50, 100]"
|
|
||||||
:rowHover="true"
|
|
||||||
:globalFilterFields="['companyName', 'city', 'email', 'phone']"
|
|
||||||
sortField="companyName"
|
|
||||||
:sortOrder="1"
|
|
||||||
dataKey="id"
|
|
||||||
filterDisplay="menu"
|
|
||||||
showGridlines
|
|
||||||
paginatorTemplate="FirstPageLink PrevPageLink PageLinks NextPageLink LastPageLink CurrentPageReport RowsPerPageDropdown"
|
|
||||||
currentPageReportTemplate="Zeige {first} bis {last} von {totalRecords} Einträgen"
|
|
||||||
>
|
|
||||||
<template #header>
|
|
||||||
<div class="flex justify-between flex-wrap gap-2">
|
|
||||||
<div class="flex gap-2">
|
|
||||||
<Button
|
|
||||||
label="Alle"
|
|
||||||
:outlined="typeFilter !== 'all'"
|
|
||||||
@click="filterByType('all')"
|
|
||||||
size="small"
|
|
||||||
/>
|
|
||||||
<Button
|
|
||||||
label="Debitoren"
|
|
||||||
:outlined="typeFilter !== 'debtor'"
|
|
||||||
@click="filterByType('debtor')"
|
|
||||||
size="small"
|
|
||||||
/>
|
|
||||||
<Button
|
|
||||||
label="Kreditoren"
|
|
||||||
:outlined="typeFilter !== 'creditor'"
|
|
||||||
@click="filterByType('creditor')"
|
|
||||||
size="small"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<IconField>
|
|
||||||
<InputIcon>
|
|
||||||
<i class="pi pi-search" />
|
|
||||||
</InputIcon>
|
|
||||||
<InputText
|
|
||||||
v-model="filters['global'].value"
|
|
||||||
placeholder="Suchen..."
|
|
||||||
/>
|
|
||||||
</IconField>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
<template #empty>Keine Kontakte gefunden.</template>
|
|
||||||
<template #loading>Lade Kontakte. Bitte warten...</template>
|
|
||||||
|
|
||||||
<Column field="companyName" header="Firma" sortable style="min-width: 200px">
|
|
||||||
<template #body="{ data }">
|
|
||||||
<div class="font-semibold">{{ data.companyName }}</div>
|
|
||||||
<div class="text-sm text-500" v-if="data.companyNumber">
|
|
||||||
Nr: {{ data.companyNumber }}
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
<template #filter="{ filterModel }">
|
|
||||||
<InputText v-model="filterModel.value" type="text" placeholder="Suche nach Firma" />
|
|
||||||
</template>
|
|
||||||
</Column>
|
|
||||||
|
|
||||||
<Column field="city" header="Ort" sortable style="min-width: 150px">
|
|
||||||
<template #body="{ data }">
|
|
||||||
<div v-if="data.zipCode || data.city">
|
|
||||||
{{ data.zipCode }} {{ data.city }}
|
|
||||||
</div>
|
|
||||||
<div class="text-sm text-500" v-if="data.country">
|
|
||||||
{{ data.country }}
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
<template #filter="{ filterModel }">
|
|
||||||
<InputText v-model="filterModel.value" type="text" placeholder="Suche nach Ort" />
|
|
||||||
</template>
|
|
||||||
</Column>
|
|
||||||
|
|
||||||
<Column header="Ansprechpartner" style="min-width: 200px">
|
|
||||||
<template #body="{ data }">
|
|
||||||
<div v-if="data.contactPersons && data.contactPersons.length > 0">
|
|
||||||
<div
|
|
||||||
v-for="person in data.contactPersons.slice(0, 2)"
|
|
||||||
:key="person.id"
|
|
||||||
class="mb-1"
|
|
||||||
>
|
|
||||||
<div class="font-medium">
|
|
||||||
{{ person.firstName }} {{ person.lastName }}
|
|
||||||
<Tag v-if="person.isPrimary" value="Primär" severity="info" class="ml-1" />
|
|
||||||
</div>
|
|
||||||
<div class="text-sm text-500" v-if="person.email">
|
|
||||||
{{ person.email }}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<span v-else class="text-500">Keine Ansprechpartner</span>
|
|
||||||
</template>
|
|
||||||
</Column>
|
|
||||||
|
|
||||||
<Column header="Typ" style="min-width: 130px">
|
|
||||||
<template #body="{ data }">
|
|
||||||
<div class="flex gap-1">
|
|
||||||
<Tag v-if="data.isDebtor" value="Debitor" severity="success" />
|
|
||||||
<Tag v-if="data.isCreditor" value="Kreditor" severity="warning" />
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
</Column>
|
|
||||||
|
|
||||||
<Column field="isActive" header="Status" dataType="boolean" style="min-width: 100px">
|
|
||||||
<template #body="{ data }">
|
|
||||||
<Tag
|
|
||||||
:value="data.isActive ? 'Aktiv' : 'Inaktiv'"
|
|
||||||
:severity="data.isActive ? 'success' : 'danger'"
|
|
||||||
/>
|
|
||||||
</template>
|
|
||||||
<template #filter="{ filterModel }">
|
|
||||||
<Select
|
|
||||||
v-model="filterModel.value"
|
|
||||||
:options="statusOptions"
|
|
||||||
optionLabel="label"
|
|
||||||
optionValue="value"
|
|
||||||
placeholder="Status wählen"
|
|
||||||
showClear
|
|
||||||
>
|
|
||||||
<template #option="slotProps">
|
|
||||||
<Tag :value="slotProps.option.label" :severity="slotProps.option.value ? 'success' : 'danger'" />
|
|
||||||
</template>
|
|
||||||
</Select>
|
|
||||||
</template>
|
|
||||||
</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">
|
|
||||||
<template #body="{ data }">
|
|
||||||
<div class="flex gap-2">
|
|
||||||
<Button
|
|
||||||
icon="pi pi-pencil"
|
|
||||||
outlined
|
|
||||||
rounded
|
|
||||||
@click="editContact(data)"
|
|
||||||
size="small"
|
|
||||||
/>
|
|
||||||
<Button
|
|
||||||
icon="pi pi-trash"
|
|
||||||
outlined
|
|
||||||
rounded
|
|
||||||
severity="danger"
|
|
||||||
@click="confirmDelete(data)"
|
|
||||||
size="small"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
</Column>
|
|
||||||
|
|
||||||
</DataTable>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Contact Dialog -->
|
|
||||||
<Dialog
|
|
||||||
v-model:visible="contactDialog"
|
|
||||||
:header="editingContact?.id ? 'Kontakt bearbeiten' : 'Neuer Kontakt'"
|
|
||||||
:modal="true"
|
|
||||||
:style="{ width: '1200px' }"
|
|
||||||
:closable="true"
|
|
||||||
>
|
|
||||||
<div v-if="editingContact" class="flex flex-col gap-6">
|
|
||||||
|
|
||||||
<!-- Basisdaten -->
|
|
||||||
<div class="flex flex-col gap-4">
|
|
||||||
<div class="font-semibold text-xl flex items-center gap-2">
|
|
||||||
<i class="pi pi-building text-primary"></i>
|
|
||||||
<span>Basisdaten</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="flex flex-col md:flex-row gap-4">
|
|
||||||
<div class="flex flex-col gap-2 w-full md:w-2/3">
|
|
||||||
<label for="companyName">Firmenname <span class="text-red-500">*</span></label>
|
|
||||||
<InputText
|
|
||||||
id="companyName"
|
|
||||||
v-model="editingContact.companyName"
|
|
||||||
:invalid="submitted && !editingContact.companyName"
|
|
||||||
/>
|
|
||||||
<small v-if="submitted && !editingContact.companyName" class="text-red-500">
|
|
||||||
Firmenname ist erforderlich
|
|
||||||
</small>
|
|
||||||
</div>
|
|
||||||
<div class="flex flex-col gap-2 w-full md:w-1/3">
|
|
||||||
<label for="companyNumber">Kundennummer</label>
|
|
||||||
<InputText id="companyNumber" v-model="editingContact.companyNumber" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="flex gap-4">
|
|
||||||
<div class="flex items-center gap-2">
|
|
||||||
<Checkbox inputId="isDebtor" v-model="editingContact.isDebtor" :binary="true" />
|
|
||||||
<label for="isDebtor">Debitor</label>
|
|
||||||
</div>
|
|
||||||
<div class="flex items-center gap-2">
|
|
||||||
<Checkbox inputId="isCreditor" v-model="editingContact.isCreditor" :binary="true" />
|
|
||||||
<label for="isCreditor">Kreditor</label>
|
|
||||||
</div>
|
|
||||||
<div class="flex items-center gap-2">
|
|
||||||
<Checkbox inputId="isActive" v-model="editingContact.isActive" :binary="true" />
|
|
||||||
<label for="isActive">Aktiv</label>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<Divider />
|
|
||||||
|
|
||||||
<!-- Adresse -->
|
|
||||||
<div class="flex flex-col gap-4">
|
|
||||||
<div class="font-semibold text-xl flex items-center gap-2">
|
|
||||||
<i class="pi pi-map-marker text-primary"></i>
|
|
||||||
<span>Adresse</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="flex flex-col gap-2">
|
|
||||||
<label for="street">Straße</label>
|
|
||||||
<InputText id="street" v-model="editingContact.street" />
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="flex flex-col md:flex-row gap-4">
|
|
||||||
<div class="flex flex-col gap-2 w-full md:w-1/3">
|
|
||||||
<label for="zipCode">PLZ</label>
|
|
||||||
<InputText id="zipCode" v-model="editingContact.zipCode" />
|
|
||||||
</div>
|
|
||||||
<div class="flex flex-col gap-2 w-full md:w-1/3">
|
|
||||||
<label for="city">Ort</label>
|
|
||||||
<InputText id="city" v-model="editingContact.city" />
|
|
||||||
</div>
|
|
||||||
<div class="flex flex-col gap-2 w-full md:w-1/3">
|
|
||||||
<label for="country">Land</label>
|
|
||||||
<InputText id="country" v-model="editingContact.country" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<Divider />
|
|
||||||
|
|
||||||
<!-- Kontaktdaten -->
|
|
||||||
<div class="flex flex-col gap-4">
|
|
||||||
<div class="font-semibold text-xl flex items-center gap-2">
|
|
||||||
<i class="pi pi-phone text-primary"></i>
|
|
||||||
<span>Kontaktdaten</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="flex flex-col md:flex-row gap-4">
|
|
||||||
<div class="flex flex-col gap-2 w-full">
|
|
||||||
<label for="phone">Telefon</label>
|
|
||||||
<InputText id="phone" v-model="editingContact.phone" />
|
|
||||||
</div>
|
|
||||||
<div class="flex flex-col gap-2 w-full">
|
|
||||||
<label for="fax">Fax</label>
|
|
||||||
<InputText id="fax" v-model="editingContact.fax" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="flex flex-col md:flex-row gap-4">
|
|
||||||
<div class="flex flex-col gap-2 w-full">
|
|
||||||
<label for="email">E-Mail</label>
|
|
||||||
<InputText id="email" v-model="editingContact.email" type="email" />
|
|
||||||
</div>
|
|
||||||
<div class="flex flex-col gap-2 w-full">
|
|
||||||
<label for="website">Webseite</label>
|
|
||||||
<InputText id="website" v-model="editingContact.website" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<Divider />
|
|
||||||
|
|
||||||
<!-- Steuerdaten -->
|
|
||||||
<div class="flex flex-col gap-4">
|
|
||||||
<div class="font-semibold text-xl flex items-center gap-2">
|
|
||||||
<i class="pi pi-calculator text-primary"></i>
|
|
||||||
<span>Steuerdaten</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="flex flex-col md:flex-row gap-4">
|
|
||||||
<div class="flex flex-col gap-2 w-full">
|
|
||||||
<label for="taxNumber">Steuernummer</label>
|
|
||||||
<InputText id="taxNumber" v-model="editingContact.taxNumber" />
|
|
||||||
</div>
|
|
||||||
<div class="flex flex-col gap-2 w-full">
|
|
||||||
<label for="vatNumber">USt-IdNr.</label>
|
|
||||||
<InputText id="vatNumber" v-model="editingContact.vatNumber" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<Divider />
|
|
||||||
|
|
||||||
<!-- Ansprechpartner -->
|
|
||||||
<div class="flex flex-col gap-4">
|
|
||||||
<div class="flex items-center justify-between">
|
|
||||||
<div class="font-semibold text-xl flex items-center gap-2">
|
|
||||||
<i class="pi pi-users text-primary"></i>
|
|
||||||
<span>Ansprechpartner</span>
|
|
||||||
</div>
|
|
||||||
<Button
|
|
||||||
label="Hinzufügen"
|
|
||||||
icon="pi pi-plus"
|
|
||||||
size="small"
|
|
||||||
outlined
|
|
||||||
@click="addContactPerson"
|
|
||||||
:disabled="editingContact.contactPersons.length >= 2"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div v-if="editingContact.contactPersons.length === 0" class="text-center py-4 text-500">
|
|
||||||
<i class="pi pi-user-plus text-4xl mb-3"></i>
|
|
||||||
<p>Noch keine Ansprechpartner hinzugefügt</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div
|
|
||||||
v-for="(person, index) in editingContact.contactPersons"
|
|
||||||
:key="index"
|
|
||||||
class="flex flex-col gap-4 p-4 border border-surface rounded-lg"
|
|
||||||
>
|
|
||||||
<div class="flex justify-between items-center">
|
|
||||||
<h4 class="m-0 font-semibold flex items-center gap-2">
|
|
||||||
<i class="pi pi-user"></i>
|
|
||||||
Ansprechpartner {{ index + 1 }}
|
|
||||||
<Tag v-if="person.isPrimary" value="Primär" severity="info" />
|
|
||||||
</h4>
|
|
||||||
<Button
|
|
||||||
icon="pi pi-trash"
|
|
||||||
text
|
|
||||||
rounded
|
|
||||||
severity="danger"
|
|
||||||
@click="removeContactPerson(index)"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="flex flex-col md:flex-row gap-4">
|
|
||||||
<div class="flex flex-col gap-2 w-full md:w-1/3">
|
|
||||||
<label :for="'salutation' + index">Anrede</label>
|
|
||||||
<Dropdown
|
|
||||||
:id="'salutation' + index"
|
|
||||||
v-model="person.salutation"
|
|
||||||
:options="salutations"
|
|
||||||
placeholder="Auswählen"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div class="flex flex-col gap-2 w-full md:w-1/3">
|
|
||||||
<label :for="'title' + index">Titel</label>
|
|
||||||
<InputText :id="'title' + index" v-model="person.title" />
|
|
||||||
</div>
|
|
||||||
<div class="flex flex-col gap-2 w-full md:w-1/3">
|
|
||||||
<div class="flex items-center gap-2">
|
|
||||||
<Checkbox :inputId="'isPrimary' + index" v-model="person.isPrimary" :binary="true" />
|
|
||||||
<label :for="'isPrimary' + index">Primärer Kontakt</label>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="flex flex-col md:flex-row gap-4">
|
|
||||||
<div class="flex flex-col gap-2 w-full">
|
|
||||||
<label :for="'firstName' + index">Vorname <span class="text-red-500">*</span></label>
|
|
||||||
<InputText
|
|
||||||
:id="'firstName' + index"
|
|
||||||
v-model="person.firstName"
|
|
||||||
:invalid="submitted && !person.firstName"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div class="flex flex-col gap-2 w-full">
|
|
||||||
<label :for="'lastName' + index">Nachname <span class="text-red-500">*</span></label>
|
|
||||||
<InputText
|
|
||||||
:id="'lastName' + index"
|
|
||||||
v-model="person.lastName"
|
|
||||||
:invalid="submitted && !person.lastName"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="flex flex-col md:flex-row gap-4">
|
|
||||||
<div class="flex flex-col gap-2 w-full">
|
|
||||||
<label :for="'position' + index">Position</label>
|
|
||||||
<InputText :id="'position' + index" v-model="person.position" />
|
|
||||||
</div>
|
|
||||||
<div class="flex flex-col gap-2 w-full">
|
|
||||||
<label :for="'department' + index">Abteilung</label>
|
|
||||||
<InputText :id="'department' + index" v-model="person.department" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="flex flex-col md:flex-row gap-4">
|
|
||||||
<div class="flex flex-col gap-2 w-full">
|
|
||||||
<label :for="'personPhone' + index">Telefon</label>
|
|
||||||
<InputText :id="'personPhone' + index" v-model="person.phone" />
|
|
||||||
</div>
|
|
||||||
<div class="flex flex-col gap-2 w-full">
|
|
||||||
<label :for="'mobile' + index">Mobil</label>
|
|
||||||
<InputText :id="'mobile' + index" v-model="person.mobile" />
|
|
||||||
</div>
|
|
||||||
<div class="flex flex-col gap-2 w-full">
|
|
||||||
<label :for="'personEmail' + index">E-Mail</label>
|
|
||||||
<InputText :id="'personEmail' + index" v-model="person.email" type="email" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<Divider />
|
|
||||||
|
|
||||||
<!-- Notizen -->
|
|
||||||
<div class="flex flex-col gap-4">
|
|
||||||
<div class="font-semibold text-xl flex items-center gap-2">
|
|
||||||
<i class="pi pi-file-edit text-primary"></i>
|
|
||||||
<span>Notizen</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="flex flex-col gap-2">
|
|
||||||
<label for="notes">Interne Notizen</label>
|
|
||||||
<Textarea id="notes" v-model="editingContact.notes" rows="4" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
rounded
|
|
||||||
severity="danger"
|
|
||||||
@click="removeContactPerson(index)"
|
|
||||||
size="small"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="field col-12 md:col-3">
|
|
||||||
<label :for="'salutation-' + index" class="block mb-2 font-medium">
|
|
||||||
Anrede
|
|
||||||
</label>
|
|
||||||
<Dropdown
|
|
||||||
:id="'salutation-' + index"
|
|
||||||
v-model="person.salutation"
|
|
||||||
:options="salutations"
|
|
||||||
placeholder="Wählen..."
|
|
||||||
class="w-full"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="field col-12 md:col-3">
|
|
||||||
<label :for="'title-' + index" class="block mb-2 font-medium">Titel</label>
|
|
||||||
<InputText :id="'title-' + index" v-model="person.title" class="w-full" />
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="field col-12 md:col-3">
|
|
||||||
<label :for="'firstName-' + index" class="block mb-2 font-medium">
|
|
||||||
Vorname <span class="text-red-500">*</span>
|
|
||||||
</label>
|
|
||||||
<InputText
|
|
||||||
:id="'firstName-' + index"
|
|
||||||
v-model="person.firstName"
|
|
||||||
class="w-full"
|
|
||||||
:class="{ 'p-invalid': submitted && !person.firstName }"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="field col-12 md:col-3">
|
|
||||||
<label :for="'lastName-' + index" class="block mb-2 font-medium">
|
|
||||||
Nachname <span class="text-red-500">*</span>
|
|
||||||
</label>
|
|
||||||
<InputText
|
|
||||||
:id="'lastName-' + index"
|
|
||||||
v-model="person.lastName"
|
|
||||||
class="w-full"
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<Divider />
|
|
||||||
|
|
||||||
<!-- Notizen -->
|
|
||||||
<div class="flex flex-col gap-4">
|
|
||||||
<div class="font-semibold text-xl flex items-center gap-2">
|
|
||||||
<i class="pi pi-file-edit text-primary"></i>
|
|
||||||
<span>Notizen</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="flex flex-col gap-2">
|
|
||||||
<label for="notes">Interne Notizen</label>
|
|
||||||
<Textarea id="notes" v-model="editingContact.notes" rows="4" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<template #footer>
|
|
||||||
<Button label="Abbrechen" outlined @click="hideDialog" />
|
|
||||||
<Button label="Speichern" @click="saveContact" :loading="saving" />
|
|
||||||
</template>
|
|
||||||
</Dialog>
|
|
||||||
|
|
||||||
<!-- Delete Confirmation -->
|
|
||||||
<Dialog
|
|
||||||
v-model:visible="deleteDialog"
|
|
||||||
header="Bestätigung"
|
|
||||||
:modal="true"
|
|
||||||
:style="{ width: '450px' }"
|
|
||||||
>
|
|
||||||
<div class="flex align-items-center">
|
|
||||||
<i class="pi pi-exclamation-triangle mr-3" style="font-size: 2rem; color: var(--red-500)"></i>
|
|
||||||
<span v-if="editingContact">
|
|
||||||
Möchten Sie den Kontakt <b>{{ editingContact.companyName }}</b> wirklich löschen?
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<template #footer>
|
|
||||||
<Button label="Nein" outlined @click="deleteDialog = false" />
|
|
||||||
<Button label="Ja" severity="danger" @click="deleteContact" :loading="deleting" />
|
|
||||||
</template>
|
|
||||||
</Dialog>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script setup>
|
|
||||||
import { ref, onMounted } from 'vue'
|
|
||||||
import { useToast } from 'primevue/usetoast'
|
|
||||||
import { FilterMatchMode, FilterOperator } from '@primevue/core/api'
|
|
||||||
import DataTable from 'primevue/datatable'
|
|
||||||
import Column from 'primevue/column'
|
|
||||||
import Button from 'primevue/button'
|
|
||||||
import InputText from 'primevue/inputtext'
|
|
||||||
import Textarea from 'primevue/textarea'
|
|
||||||
import Dialog from 'primevue/dialog'
|
|
||||||
import Card from 'primevue/card'
|
|
||||||
import Tag from 'primevue/tag'
|
|
||||||
import Checkbox from 'primevue/checkbox'
|
|
||||||
import Dropdown from 'primevue/dropdown'
|
|
||||||
import Divider from 'primevue/divider'
|
|
||||||
import IconField from 'primevue/iconfield'
|
|
||||||
import InputIcon from 'primevue/inputicon'
|
|
||||||
import Select from 'primevue/select'
|
|
||||||
|
|
||||||
const toast = useToast()
|
|
||||||
|
|
||||||
const contacts = ref([])
|
|
||||||
const loading = ref(false)
|
|
||||||
const contactDialog = ref(false)
|
|
||||||
const deleteDialog = ref(false)
|
|
||||||
const editingContact = ref(null)
|
|
||||||
const submitted = ref(false)
|
|
||||||
const saving = ref(false)
|
|
||||||
const deleting = ref(false)
|
|
||||||
const typeFilter = ref('all')
|
|
||||||
const filters = ref({
|
|
||||||
global: { value: null, matchMode: FilterMatchMode.CONTAINS },
|
|
||||||
companyName: { operator: FilterOperator.AND, constraints: [{ value: null, matchMode: FilterMatchMode.STARTS_WITH }] },
|
|
||||||
city: { operator: FilterOperator.AND, constraints: [{ value: null, matchMode: FilterMatchMode.STARTS_WITH }] },
|
|
||||||
isActive: { value: null, matchMode: FilterMatchMode.EQUALS }
|
|
||||||
})
|
|
||||||
|
|
||||||
const salutations = ref(['Herr', 'Frau', 'Divers'])
|
|
||||||
const statusOptions = ref([
|
|
||||||
{ label: 'Aktiv', value: true },
|
|
||||||
{ label: 'Inaktiv', value: false }
|
|
||||||
])
|
|
||||||
const typeOptions = ref(['Debitor', 'Kreditor'])
|
|
||||||
|
|
||||||
const emptyContact = () => ({
|
|
||||||
companyName: '',
|
|
||||||
companyNumber: '',
|
|
||||||
street: '',
|
|
||||||
zipCode: '',
|
|
||||||
city: '',
|
|
||||||
country: 'Deutschland',
|
|
||||||
phone: '',
|
|
||||||
fax: '',
|
|
||||||
email: '',
|
|
||||||
website: '',
|
|
||||||
taxNumber: '',
|
|
||||||
vatNumber: '',
|
|
||||||
isDebtor: false,
|
|
||||||
isCreditor: false,
|
|
||||||
isActive: true,
|
|
||||||
notes: '',
|
|
||||||
contactPersons: []
|
|
||||||
})
|
|
||||||
|
|
||||||
const emptyContactPerson = () => ({
|
|
||||||
salutation: null,
|
|
||||||
title: '',
|
|
||||||
firstName: '',
|
|
||||||
lastName: '',
|
|
||||||
position: '',
|
|
||||||
department: '',
|
|
||||||
phone: '',
|
|
||||||
mobile: '',
|
|
||||||
email: '',
|
|
||||||
isPrimary: false
|
|
||||||
})
|
|
||||||
|
|
||||||
onMounted(() => {
|
|
||||||
loadContacts()
|
|
||||||
})
|
|
||||||
|
|
||||||
const loadContacts = async () => {
|
|
||||||
loading.value = true
|
|
||||||
try {
|
|
||||||
// Alle Kontakte laden - API Platform unterstützt itemsPerPage Parameter
|
|
||||||
let url = '/api/contacts'
|
|
||||||
const params = new URLSearchParams()
|
|
||||||
|
|
||||||
// Große Anzahl setzen, um alle Kontakte zu erhalten
|
|
||||||
params.append('itemsPerPage', '5000')
|
|
||||||
|
|
||||||
if (typeFilter.value === 'debtor') {
|
|
||||||
params.append('isDebtor', 'true')
|
|
||||||
} else if (typeFilter.value === 'creditor') {
|
|
||||||
params.append('isCreditor', 'true')
|
|
||||||
}
|
|
||||||
|
|
||||||
url += '?' + params.toString()
|
|
||||||
|
|
||||||
const response = await fetch(url, {
|
|
||||||
credentials: 'include'
|
|
||||||
})
|
|
||||||
if (!response.ok) throw new Error('Fehler beim Laden der Kontakte')
|
|
||||||
const data = await response.json()
|
|
||||||
|
|
||||||
// API Platform gibt hydra:member zurück
|
|
||||||
contacts.value = data['hydra:member'] || data.member || []
|
|
||||||
|
|
||||||
console.log('Loaded contacts:', contacts.value.length, 'with filter:', typeFilter.value)
|
|
||||||
} catch (error) {
|
|
||||||
console.error('Error loading contacts:', error)
|
|
||||||
toast.add({
|
|
||||||
severity: 'error',
|
|
||||||
summary: 'Fehler',
|
|
||||||
detail: 'Kontakte konnten nicht geladen werden',
|
|
||||||
life: 3000
|
|
||||||
})
|
|
||||||
} finally {
|
|
||||||
loading.value = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const filterByType = (type) => {
|
|
||||||
typeFilter.value = type
|
|
||||||
loadContacts()
|
|
||||||
}
|
|
||||||
|
|
||||||
const openNewContactDialog = () => {
|
|
||||||
editingContact.value = emptyContact()
|
|
||||||
submitted.value = false
|
|
||||||
contactDialog.value = true
|
|
||||||
}
|
|
||||||
|
|
||||||
const editContact = (contact) => {
|
|
||||||
editingContact.value = { ...contact }
|
|
||||||
// Ensure contactPersons is initialized
|
|
||||||
if (!editingContact.value.contactPersons) {
|
|
||||||
editingContact.value.contactPersons = []
|
|
||||||
}
|
|
||||||
submitted.value = false
|
|
||||||
contactDialog.value = true
|
|
||||||
}
|
|
||||||
|
|
||||||
const hideDialog = () => {
|
|
||||||
contactDialog.value = false
|
|
||||||
submitted.value = false
|
|
||||||
editingContact.value = null
|
|
||||||
}
|
|
||||||
|
|
||||||
const addContactPerson = () => {
|
|
||||||
if (editingContact.value.contactPersons.length < 2) {
|
|
||||||
editingContact.value.contactPersons.push(emptyContactPerson())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const removeContactPerson = (index) => {
|
|
||||||
editingContact.value.contactPersons.splice(index, 1)
|
|
||||||
}
|
|
||||||
|
|
||||||
const validateContact = () => {
|
|
||||||
if (!editingContact.value.companyName) {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
// Validate contact persons
|
|
||||||
for (const person of editingContact.value.contactPersons) {
|
|
||||||
if (!person.firstName || !person.lastName) {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
const saveContact = async () => {
|
|
||||||
submitted.value = true
|
|
||||||
|
|
||||||
if (!validateContact()) {
|
|
||||||
toast.add({
|
|
||||||
severity: 'warn',
|
|
||||||
summary: 'Validierung fehlgeschlagen',
|
|
||||||
detail: 'Bitte füllen Sie alle Pflichtfelder aus',
|
|
||||||
life: 3000
|
|
||||||
})
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
saving.value = true
|
|
||||||
try {
|
|
||||||
const url = editingContact.value.id
|
|
||||||
? `/api/contacts/${editingContact.value.id}`
|
|
||||||
: '/api/contacts'
|
|
||||||
|
|
||||||
const method = editingContact.value.id ? 'PUT' : 'POST'
|
|
||||||
|
|
||||||
const response = await fetch(url, {
|
|
||||||
method,
|
|
||||||
headers: {
|
|
||||||
'Content-Type': 'application/json'
|
|
||||||
},
|
|
||||||
credentials: 'include',
|
|
||||||
body: JSON.stringify(editingContact.value)
|
|
||||||
})
|
|
||||||
|
|
||||||
if (!response.ok) {
|
|
||||||
const error = await response.json()
|
|
||||||
throw new Error(error.message || 'Fehler beim Speichern')
|
|
||||||
}
|
|
||||||
|
|
||||||
toast.add({
|
|
||||||
severity: 'success',
|
|
||||||
summary: 'Erfolg',
|
|
||||||
detail: 'Kontakt wurde gespeichert',
|
|
||||||
life: 3000
|
|
||||||
})
|
|
||||||
|
|
||||||
hideDialog()
|
|
||||||
loadContacts()
|
|
||||||
} catch (error) {
|
|
||||||
console.error('Error saving contact:', error)
|
|
||||||
toast.add({
|
|
||||||
severity: 'error',
|
|
||||||
summary: 'Fehler',
|
|
||||||
detail: error.message || 'Kontakt konnte nicht gespeichert werden',
|
|
||||||
life: 3000
|
|
||||||
})
|
|
||||||
} finally {
|
|
||||||
saving.value = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const confirmDelete = (contact) => {
|
|
||||||
editingContact.value = contact
|
|
||||||
deleteDialog.value = true
|
|
||||||
}
|
|
||||||
|
|
||||||
const deleteContact = async () => {
|
|
||||||
deleting.value = true
|
|
||||||
try {
|
|
||||||
const response = await fetch(`/api/contacts/${editingContact.value.id}`, {
|
|
||||||
method: 'DELETE',
|
|
||||||
credentials: 'include'
|
|
||||||
})
|
|
||||||
|
|
||||||
if (!response.ok) throw new Error('Fehler beim Löschen')
|
|
||||||
|
|
||||||
toast.add({
|
|
||||||
severity: 'success',
|
|
||||||
summary: 'Erfolg',
|
|
||||||
detail: 'Kontakt wurde gelöscht',
|
|
||||||
life: 3000
|
|
||||||
})
|
|
||||||
|
|
||||||
deleteDialog.value = false
|
|
||||||
editingContact.value = null
|
|
||||||
loadContacts()
|
|
||||||
} catch (error) {
|
|
||||||
console.error('Error deleting contact:', error)
|
|
||||||
toast.add({
|
|
||||||
severity: 'error',
|
|
||||||
summary: 'Fehler',
|
|
||||||
detail: 'Kontakt konnte nicht gelöscht werden',
|
|
||||||
life: 3000
|
|
||||||
})
|
|
||||||
} finally {
|
|
||||||
deleting.value = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
.contact-management {
|
|
||||||
padding: 1rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.p-invalid {
|
|
||||||
border-color: var(--red-500);
|
|
||||||
}
|
|
||||||
|
|
||||||
.p-error {
|
|
||||||
color: var(--red-500);
|
|
||||||
font-size: 0.875rem;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@ -29,9 +29,6 @@ use Symfony\Component\Validator\Constraints as Assert;
|
|||||||
new Put(security: "is_granted('ROLE_USER')", stateless: false),
|
new Put(security: "is_granted('ROLE_USER')", stateless: false),
|
||||||
new Delete(security: "is_granted('ROLE_ADMIN')", stateless: false)
|
new Delete(security: "is_granted('ROLE_ADMIN')", stateless: false)
|
||||||
],
|
],
|
||||||
paginationClientItemsPerPage: true,
|
|
||||||
paginationItemsPerPage: 30,
|
|
||||||
paginationMaximumItemsPerPage: 5000,
|
|
||||||
normalizationContext: ['groups' => ['contact:read']],
|
normalizationContext: ['groups' => ['contact:read']],
|
||||||
denormalizationContext: ['groups' => ['contact:write']],
|
denormalizationContext: ['groups' => ['contact:write']],
|
||||||
order: ['companyName' => 'ASC']
|
order: ['companyName' => 'ASC']
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user