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:
@@ -0,0 +1,50 @@
|
||||
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query'
|
||||
import { inquiryService } from '../services/inquiryService'
|
||||
import type { InquiryFilters } from '../provider/IInquiryProvider'
|
||||
import type { InquiryStatus, Attachment } from '../domain/inquiry'
|
||||
|
||||
export function useActiveInquiries(filters?: InquiryFilters) {
|
||||
return useQuery({
|
||||
queryKey: ['inquiries', 'active', filters ?? {}],
|
||||
queryFn: () => inquiryService.getActiveInquiries(filters),
|
||||
select: (res) => res.data ?? [],
|
||||
})
|
||||
}
|
||||
|
||||
export function useInquiryById(id: string) {
|
||||
return useQuery({
|
||||
queryKey: ['inquiry', id],
|
||||
queryFn: () => inquiryService.getInquiryById(id),
|
||||
enabled: !!id,
|
||||
select: (res) => res.data ?? null,
|
||||
})
|
||||
}
|
||||
|
||||
export function useSendInquiryReply() {
|
||||
const qc = useQueryClient()
|
||||
return useMutation({
|
||||
mutationFn: ({
|
||||
inquiryId,
|
||||
payload,
|
||||
}: {
|
||||
inquiryId: string
|
||||
payload: { subject?: string; body: string; attachments?: Attachment[] }
|
||||
}) => inquiryService.sendInquiryReply(inquiryId, payload),
|
||||
onSuccess: (_data, { inquiryId }) => {
|
||||
qc.invalidateQueries({ queryKey: ['inquiry', inquiryId] })
|
||||
qc.invalidateQueries({ queryKey: ['inquiries'] })
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
export function useUpdateInquiryStatus() {
|
||||
const qc = useQueryClient()
|
||||
return useMutation({
|
||||
mutationFn: ({ id, status }: { id: string; status: InquiryStatus }) =>
|
||||
inquiryService.updateInquiryStatus(id, status),
|
||||
onSuccess: (_data, { id }) => {
|
||||
qc.invalidateQueries({ queryKey: ['inquiry', id] })
|
||||
qc.invalidateQueries({ queryKey: ['inquiries'] })
|
||||
},
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
import { useQuery } from '@tanstack/react-query'
|
||||
import { latentNeedService } from '../services/latentNeedService'
|
||||
import type { LatentNeedFilters } from '../provider/ILatentNeedProvider'
|
||||
|
||||
export function usePublicNeeds(filters?: LatentNeedFilters) {
|
||||
return useQuery({
|
||||
queryKey: ['latent-needs', filters ?? {}],
|
||||
queryFn: () => latentNeedService.getPublicNeeds(filters),
|
||||
select: (res) => res.data ?? [],
|
||||
})
|
||||
}
|
||||
|
||||
export function useLatentNeedById(id: string | null) {
|
||||
return useQuery({
|
||||
queryKey: ['latent-need', id],
|
||||
queryFn: () => latentNeedService.getNeedById(id!),
|
||||
enabled: !!id,
|
||||
select: (res) => res.data ?? null,
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
import { useMutation } from '@tanstack/react-query'
|
||||
import { offerService } from '../services/offerService'
|
||||
import type { AssetType } from '../domain/enums'
|
||||
|
||||
export function useCreateOfferDraft() {
|
||||
return useMutation({
|
||||
mutationFn: (input: {
|
||||
needId: string
|
||||
selectedPropertyIds: string[]
|
||||
needTitle: string
|
||||
location: string
|
||||
assetType: AssetType
|
||||
sizeRange: { min: number; max: number }
|
||||
}) =>
|
||||
offerService.createOfferDraft(
|
||||
input.needId,
|
||||
input.selectedPropertyIds,
|
||||
input.needTitle,
|
||||
input.location,
|
||||
input.assetType,
|
||||
input.sizeRange,
|
||||
),
|
||||
})
|
||||
}
|
||||
|
||||
export function useUpdateOfferField() {
|
||||
return useMutation({
|
||||
mutationFn: (input: { offerDraftId: string; fieldId: string; value: string }) =>
|
||||
offerService.updateOfferField(input.offerDraftId, input.fieldId, input.value),
|
||||
})
|
||||
}
|
||||
|
||||
export function useMarkOfferChecked() {
|
||||
return useMutation({
|
||||
mutationFn: (offerDraftId: string) => offerService.markOfferChecked(offerDraftId),
|
||||
})
|
||||
}
|
||||
|
||||
export function useGeneratePdfPreview() {
|
||||
return useMutation({
|
||||
mutationFn: (offerDraftId: string) => offerService.generatePdfPreview(offerDraftId),
|
||||
})
|
||||
}
|
||||
|
||||
export function useSendOffer() {
|
||||
return useMutation({
|
||||
mutationFn: (offerDraftId: string) => offerService.sendOffer(offerDraftId),
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user