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:
@@ -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>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
import { useState } from 'react'
|
||||
import { useLocation } from 'react-router'
|
||||
import { Box, Tab, Tabs, Typography } from '@mui/material'
|
||||
import { ActiveInquiriesTab, LatentInquiriesTab, OfferWizard } from '../../components/anfragencenter'
|
||||
|
||||
export default function Anfragencenter() {
|
||||
const [tab, setTab] = useState(0)
|
||||
const location = useLocation()
|
||||
const initialTab = (location.state as { tab?: number } | null)?.tab ?? 0
|
||||
const [tab, setTab] = useState(initialTab)
|
||||
return (
|
||||
<Box sx={{ display: 'flex', flexDirection: 'column', height: '100%', overflow: 'hidden' }}>
|
||||
<Box sx={{ borderBottom: '1px solid #e2e8f0', px: 3, bgcolor: 'white', flexShrink: 0 }}>
|
||||
|
||||
@@ -43,11 +43,11 @@ export const useOfferWizardStore = create<OfferWizardState>((set) => ({
|
||||
messageSubject: '',
|
||||
attachments: [],
|
||||
open: (needId, needTitle) =>
|
||||
set({
|
||||
set((s) => ({
|
||||
isOpen: true,
|
||||
selectedNeedId: needId,
|
||||
needTitle,
|
||||
selectedPropertyIds: [],
|
||||
selectedPropertyIds: s.selectedPropertyIds,
|
||||
currentStep: 'select_properties',
|
||||
offerDraftId: null,
|
||||
editableFields: {},
|
||||
@@ -55,7 +55,7 @@ export const useOfferWizardStore = create<OfferWizardState>((set) => ({
|
||||
messageDraft: '',
|
||||
messageSubject: '',
|
||||
attachments: [],
|
||||
}),
|
||||
})),
|
||||
close: () => set({ isOpen: false }),
|
||||
toggleProperty: (id) =>
|
||||
set((s) => ({
|
||||
|
||||
Reference in New Issue
Block a user