feat: F030 Anfragencenter — Aktive & Latente Anfragen + Angebot-Wizard

Neuer Menüpunkt «Anfragencenter» (ehemals «Eingehende Bedarfe»):

Aktive Anfragen:
- Split-View: Anfrageliste (Liste/Grid-Toggle) + Chat-Detailansicht
- Chat-Verlauf mit Sender-Styling (Mieter links, Supply rechts)
- Antwortformular mit Betreff, Nachricht, Anhänge, Statuswechsel
- Zugehörige Property Card neben dem Chat

Latente Anfragen:
- Drei-Spalten-Layout: Need-Liste | Need-Detail | Eigene Objekte
- Need Cards mit AI-Zusammenfassung, Must-Haves, Präferenzen
- Eigene Portfolio-Objekte sortiert nach deterministischem Match-Score
- Checkbox-Selektion für Angebotsauswahl

Angebot-Wizard (4 Schritte):
- Schritt 1: Objekte auswählen (mit Score-Vorschau)
- Schritt 2: PDF-Vorschau + editierbare Textfelder
- Schritt 3: Angebot prüfen & bestätigen
- Schritt 4: Nachricht an Suchenden mit KI-generierter Mail

Architektur:
- Domain: Inquiry, LatentNeed, OfferDraft Types
- Provider: IInquiryProvider, ILatentNeedProvider, IOfferProvider + Mockups
- Services: inquiryService, latentNeedService, offerService
- Hooks: useInquiries, useLatentNeeds, useOffers (TanStack Query)
- Store: offerWizardStore (Zustand, lokaler Wizard-State)
- 27 neue Komponenten, alle Loading/Empty/Error States

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Benjamin Sutter
2026-05-18 18:03:05 +02:00
parent 05ac0083b2
commit c4c29ef7d3
51 changed files with 4000 additions and 1 deletions
+17
View File
@@ -0,0 +1,17 @@
import type { Inquiry, InquiryStatus, InquiryMessage } from '../domain/inquiry'
export interface InquiryFilters {
status?: InquiryStatus
propertyId?: string
organizationId?: string
}
export interface IInquiryProvider {
getAll(filters?: InquiryFilters): Promise<Inquiry[]>
getById(id: string): Promise<Inquiry | null>
updateStatus(id: string, status: InquiryStatus): Promise<Inquiry>
addMessage(
inquiryId: string,
msg: Omit<InquiryMessage, 'id' | 'inquiryId' | 'createdAt'>,
): Promise<Inquiry>
}
+12
View File
@@ -0,0 +1,12 @@
import type { LatentNeed } from '../domain/latentNeed'
import type { AssetType } from '../domain/enums'
export interface LatentNeedFilters {
assetType?: AssetType
status?: LatentNeed['status']
}
export interface ILatentNeedProvider {
getAll(filters?: LatentNeedFilters): Promise<LatentNeed[]>
getById(id: string): Promise<LatentNeed | null>
}
+17
View File
@@ -0,0 +1,17 @@
import type { OfferDraft, OfferEditableField, OfferStatus } from '../domain/offer'
export interface CreateOfferDraftInput {
needId: string
selectedPropertyIds: string[]
subject: string
message: string
editableFields: OfferEditableField[]
}
export interface IOfferProvider {
create(input: CreateOfferDraftInput): Promise<OfferDraft>
getById(id: string): Promise<OfferDraft | null>
updateField(id: string, fieldId: string, value: string): Promise<OfferDraft>
updateStatus(id: string, status: OfferStatus): Promise<OfferDraft>
setPdfUrl(id: string, pdfUrl: string): Promise<OfferDraft>
}
+43
View File
@@ -0,0 +1,43 @@
import type { IInquiryProvider, InquiryFilters } from './IInquiryProvider'
import type { Inquiry, InquiryStatus, InquiryMessage } from '../domain/inquiry'
import { mockInquiries } from '../mock-data/inquiries'
const store: Inquiry[] = mockInquiries.map(i => ({ ...i, thread: [...i.thread] }))
export const MockupInquiryProvider: IInquiryProvider = {
async getAll(filters?: InquiryFilters): Promise<Inquiry[]> {
let results = [...store]
if (filters?.status) results = results.filter(i => i.status === filters.status)
if (filters?.propertyId) results = results.filter(i => i.propertyId === filters.propertyId)
if (filters?.organizationId) results = results.filter(i => i.organizationId === filters.organizationId)
return results.sort((a, b) => (a.createdAt < b.createdAt ? 1 : -1))
},
async getById(id: string): Promise<Inquiry | null> {
return store.find(i => i.id === id) ?? null
},
async updateStatus(id: string, status: InquiryStatus): Promise<Inquiry> {
const idx = store.findIndex(i => i.id === id)
if (idx === -1) throw new Error(`Inquiry ${id} not found`)
store[idx] = { ...store[idx], status, updatedAt: new Date().toISOString() }
return store[idx]
},
async addMessage(
inquiryId: string,
msg: Omit<InquiryMessage, 'id' | 'inquiryId' | 'createdAt'>,
): Promise<Inquiry> {
const idx = store.findIndex(i => i.id === inquiryId)
if (idx === -1) throw new Error(`Inquiry ${inquiryId} not found`)
const message: InquiryMessage = {
id: crypto.randomUUID(),
inquiryId,
createdAt: new Date().toISOString(),
...msg,
}
store[idx] = {
...store[idx],
thread: [...store[idx].thread, message],
updatedAt: message.createdAt,
}
return store[idx]
},
}
+17
View File
@@ -0,0 +1,17 @@
import type { ILatentNeedProvider, LatentNeedFilters } from './ILatentNeedProvider'
import type { LatentNeed } from '../domain/latentNeed'
import { mockLatentNeeds } from '../mock-data/latentNeeds'
const store: LatentNeed[] = [...mockLatentNeeds]
export const MockupLatentNeedProvider: ILatentNeedProvider = {
async getAll(filters?: LatentNeedFilters): Promise<LatentNeed[]> {
let results = [...store]
if (filters?.assetType) results = results.filter(n => n.assetType === filters.assetType)
if (filters?.status) results = results.filter(n => n.status === filters.status)
return results.sort((a, b) => (a.createdAt < b.createdAt ? 1 : -1))
},
async getById(id: string): Promise<LatentNeed | null> {
return store.find(n => n.id === id) ?? null
},
}
+45
View File
@@ -0,0 +1,45 @@
import type { IOfferProvider, CreateOfferDraftInput } from './IOfferProvider'
import type { OfferDraft, OfferStatus } from '../domain/offer'
const store: OfferDraft[] = []
export const MockupOfferProvider: IOfferProvider = {
async create(input: CreateOfferDraftInput): Promise<OfferDraft> {
const now = new Date().toISOString()
const draft: OfferDraft = {
id: crypto.randomUUID(),
needId: input.needId,
selectedPropertyIds: input.selectedPropertyIds,
subject: input.subject,
message: input.message,
status: 'draft',
editableFields: input.editableFields,
createdAt: now,
updatedAt: now,
}
store.push(draft)
return draft
},
async getById(id: string): Promise<OfferDraft | null> {
return store.find(d => d.id === id) ?? null
},
async updateField(id: string, fieldId: string, value: string): Promise<OfferDraft> {
const idx = store.findIndex(d => d.id === id)
if (idx === -1) throw new Error(`OfferDraft ${id} not found`)
const fields = store[idx].editableFields.map(f => (f.id === fieldId ? { ...f, value } : f))
store[idx] = { ...store[idx], editableFields: fields, updatedAt: new Date().toISOString() }
return store[idx]
},
async updateStatus(id: string, status: OfferStatus): Promise<OfferDraft> {
const idx = store.findIndex(d => d.id === id)
if (idx === -1) throw new Error(`OfferDraft ${id} not found`)
store[idx] = { ...store[idx], status, updatedAt: new Date().toISOString() }
return store[idx]
},
async setPdfUrl(id: string, pdfUrl: string): Promise<OfferDraft> {
const idx = store.findIndex(d => d.id === id)
if (idx === -1) throw new Error(`OfferDraft ${id} not found`)
store[idx] = { ...store[idx], pdfUrl, updatedAt: new Date().toISOString() }
return store[idx]
},
}