feat: navigate from Marktsignale tab to Anfragencenter latente Anfragen

'Angebot erstellen' button in Marktsignale tab pre-selects the property
in the offer store and navigates to /supply/anfragen on the Latente
Anfragen tab. Also fixes offerWizardStore.open() to preserve
selectedPropertyIds so pre-selection survives the wizard open call.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Benjamin Sutter
2026-05-19 16:00:00 +02:00
parent c0f50344e0
commit 18f4b2b37a
3 changed files with 44 additions and 14 deletions
@@ -1,7 +1,9 @@
import { useEffect, useRef, useState } from 'react'
import { useNavigate } from 'react-router'
import { Alert, Box, Button, Chip, CircularProgress, Dialog, DialogContent, DialogTitle, LinearProgress, Typography } from '@mui/material'
import { BarChart2, Building2, CheckCircle, Download, FileText, Lightbulb, TrendingUp } from 'lucide-react'
import { BarChart2, Building2, CheckCircle, Download, FileText, Lightbulb, Send, TrendingUp } from 'lucide-react'
import { marketReportService } from '../../services/marketReportService'
import { useOfferWizardStore } from '../../stores/offerWizardStore'
import type { MarketReport, PropertyMarketSignal, SignalCategory } from '../../domain/marketReport'
interface Props {
@@ -220,6 +222,13 @@ export function PropertyMarketSignalsTab({ propertyId }: Props) {
const [report, setReport] = useState<MarketReport | null>(null)
const [loading, setLoading] = useState(true)
const [dialogOpen, setDialogOpen] = useState(false)
const navigate = useNavigate()
const setSelectedProperties = useOfferWizardStore(s => s.setSelectedProperties)
function handleAngebotErstellen() {
setSelectedProperties([propertyId])
navigate('/supply/anfragen', { state: { tab: 1 } })
}
useEffect(() => {
let cancelled = false
@@ -251,15 +260,26 @@ export function PropertyMarketSignalsTab({ propertyId }: Props) {
</Typography>
)}
</Box>
<Button
variant="outlined"
size="small"
startIcon={<FileText size={14} />}
onClick={() => showToast('PDF-Bericht wird generiert…', 'info')}
sx={{ textTransform: 'none', fontSize: '0.8125rem' }}
>
Bericht erstellen
</Button>
<Box sx={{ display: 'flex', gap: 1 }}>
<Button
variant="contained"
size="small"
startIcon={<Send size={14} />}
onClick={handleAngebotErstellen}
sx={{ textTransform: 'none', fontSize: '0.8125rem', bgcolor: '#1e3a5f', '&:hover': { bgcolor: '#16304d' } }}
>
Angebot erstellen
</Button>
<Button
variant="outlined"
size="small"
startIcon={<FileText size={14} />}
onClick={() => setDialogOpen(true)}
sx={{ textTransform: 'none', fontSize: '0.8125rem' }}
>
Bericht erstellen
</Button>
</Box>
</Box>
{!report ? (
@@ -288,6 +308,13 @@ export function PropertyMarketSignalsTab({ propertyId }: Props) {
)
})
)}
<BerichtDialog
open={dialogOpen}
onClose={() => setDialogOpen(false)}
report={report}
propertyId={propertyId}
/>
</Box>
)
}