revert(contacts): Titel-Feld wieder raus, nur Anrede (Herr/Frau/Divers)

Sync-Probleme durch zusammengesetzten PREFIX vermeiden.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Stefan Hacker 2026-04-13 09:52:23 +02:00
parent 655b789e06
commit 1eba5d0adc
1 changed files with 2 additions and 28 deletions

View File

@ -177,14 +177,9 @@
<div class="field-row">
<div class="field" style="max-width:130px">
<label>Anrede</label>
<Select v-model="contactForm._salutation" :options="salutationOptions"
<Select v-model="contactForm.prefix" :options="salutationOptions"
showClear placeholder="" />
</div>
<div class="field" style="max-width:160px">
<label>Titel</label>
<Select v-model="contactForm._title" :options="titleOptions"
editable showClear placeholder="" />
</div>
<div class="field">
<label>Vorname</label>
<InputText v-model="contactForm.first_name" fluid />
@ -416,25 +411,10 @@ const urlTypes = [
{ label: 'Sonstige', value: 'other' },
]
const salutationOptions = ['Herr', 'Frau', 'Divers']
const titleOptions = ['Dr.', 'Dr. med.', 'Dr.-Ing.', 'Prof.', 'Prof. Dr.', 'Dipl.-Ing.', 'Dipl.-Kfm.', 'Mag.', 'M.Sc.', 'B.Sc.']
function splitPrefix(prefix) {
// "Herr Dr." -> { salutation: 'Herr', title: 'Dr.' }
const s = (prefix || '').trim()
if (!s) return { salutation: '', title: '' }
for (const sal of salutationOptions) {
if (s === sal) return { salutation: sal, title: '' }
if (s.startsWith(sal + ' ')) return { salutation: sal, title: s.slice(sal.length + 1).trim() }
}
return { salutation: '', title: s }
}
function joinPrefix(salutation, title) {
return [salutation, title].filter(x => x && x.trim()).join(' ').trim()
}
function emptyContact() {
return {
prefix: '', _salutation: '', _title: '',
prefix: '',
first_name: '', middle_name: '', last_name: '', suffix: '',
display_name: '', nickname: '',
organization: '', department: '', job_title: '',
@ -617,11 +597,8 @@ async function openEditContact(row) {
editingContactId.value = row.id
const res = await apiClient.get(`/contacts/${row.id}`)
const c = res.data
const split = splitPrefix(c.prefix)
Object.assign(contactForm, emptyContact(), {
prefix: c.prefix || '',
_salutation: split.salutation,
_title: split.title,
first_name: c.first_name || '',
middle_name: c.middle_name || '',
last_name: c.last_name || '',
@ -662,9 +639,6 @@ function onPhotoSelected(ev) {
async function saveContact() {
const payload = { ...contactForm }
payload.prefix = joinPrefix(contactForm._salutation, contactForm._title)
delete payload._salutation
delete payload._title
payload.categories = categoriesString.value.split(',').map(s => s.trim()).filter(Boolean)
// Drop empty sub-rows
payload.emails = payload.emails.filter(e => e.value.trim())