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 { 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 { 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 { marketReportService } from '../../services/marketReportService'
|
||||||
|
import { useOfferWizardStore } from '../../stores/offerWizardStore'
|
||||||
import type { MarketReport, PropertyMarketSignal, SignalCategory } from '../../domain/marketReport'
|
import type { MarketReport, PropertyMarketSignal, SignalCategory } from '../../domain/marketReport'
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
@@ -220,6 +222,13 @@ export function PropertyMarketSignalsTab({ propertyId }: Props) {
|
|||||||
const [report, setReport] = useState<MarketReport | null>(null)
|
const [report, setReport] = useState<MarketReport | null>(null)
|
||||||
const [loading, setLoading] = useState(true)
|
const [loading, setLoading] = useState(true)
|
||||||
const [dialogOpen, setDialogOpen] = useState(false)
|
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(() => {
|
useEffect(() => {
|
||||||
let cancelled = false
|
let cancelled = false
|
||||||
@@ -251,16 +260,27 @@ export function PropertyMarketSignalsTab({ propertyId }: Props) {
|
|||||||
</Typography>
|
</Typography>
|
||||||
)}
|
)}
|
||||||
</Box>
|
</Box>
|
||||||
|
<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
|
<Button
|
||||||
variant="outlined"
|
variant="outlined"
|
||||||
size="small"
|
size="small"
|
||||||
startIcon={<FileText size={14} />}
|
startIcon={<FileText size={14} />}
|
||||||
onClick={() => showToast('PDF-Bericht wird generiert…', 'info')}
|
onClick={() => setDialogOpen(true)}
|
||||||
sx={{ textTransform: 'none', fontSize: '0.8125rem' }}
|
sx={{ textTransform: 'none', fontSize: '0.8125rem' }}
|
||||||
>
|
>
|
||||||
Bericht erstellen
|
Bericht erstellen
|
||||||
</Button>
|
</Button>
|
||||||
</Box>
|
</Box>
|
||||||
|
</Box>
|
||||||
|
|
||||||
{!report ? (
|
{!report ? (
|
||||||
<Alert severity="info" sx={{ fontSize: '0.8125rem' }}>
|
<Alert severity="info" sx={{ fontSize: '0.8125rem' }}>
|
||||||
@@ -288,6 +308,13 @@ export function PropertyMarketSignalsTab({ propertyId }: Props) {
|
|||||||
)
|
)
|
||||||
})
|
})
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
<BerichtDialog
|
||||||
|
open={dialogOpen}
|
||||||
|
onClose={() => setDialogOpen(false)}
|
||||||
|
report={report}
|
||||||
|
propertyId={propertyId}
|
||||||
|
/>
|
||||||
</Box>
|
</Box>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,12 @@
|
|||||||
import { useState } from 'react'
|
import { useState } from 'react'
|
||||||
|
import { useLocation } from 'react-router'
|
||||||
import { Box, Tab, Tabs, Typography } from '@mui/material'
|
import { Box, Tab, Tabs, Typography } from '@mui/material'
|
||||||
import { ActiveInquiriesTab, LatentInquiriesTab, OfferWizard } from '../../components/anfragencenter'
|
import { ActiveInquiriesTab, LatentInquiriesTab, OfferWizard } from '../../components/anfragencenter'
|
||||||
|
|
||||||
export default function 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 (
|
return (
|
||||||
<Box sx={{ display: 'flex', flexDirection: 'column', height: '100%', overflow: 'hidden' }}>
|
<Box sx={{ display: 'flex', flexDirection: 'column', height: '100%', overflow: 'hidden' }}>
|
||||||
<Box sx={{ borderBottom: '1px solid #e2e8f0', px: 3, bgcolor: 'white', flexShrink: 0 }}>
|
<Box sx={{ borderBottom: '1px solid #e2e8f0', px: 3, bgcolor: 'white', flexShrink: 0 }}>
|
||||||
|
|||||||
@@ -43,11 +43,11 @@ export const useOfferWizardStore = create<OfferWizardState>((set) => ({
|
|||||||
messageSubject: '',
|
messageSubject: '',
|
||||||
attachments: [],
|
attachments: [],
|
||||||
open: (needId, needTitle) =>
|
open: (needId, needTitle) =>
|
||||||
set({
|
set((s) => ({
|
||||||
isOpen: true,
|
isOpen: true,
|
||||||
selectedNeedId: needId,
|
selectedNeedId: needId,
|
||||||
needTitle,
|
needTitle,
|
||||||
selectedPropertyIds: [],
|
selectedPropertyIds: s.selectedPropertyIds,
|
||||||
currentStep: 'select_properties',
|
currentStep: 'select_properties',
|
||||||
offerDraftId: null,
|
offerDraftId: null,
|
||||||
editableFields: {},
|
editableFields: {},
|
||||||
@@ -55,7 +55,7 @@ export const useOfferWizardStore = create<OfferWizardState>((set) => ({
|
|||||||
messageDraft: '',
|
messageDraft: '',
|
||||||
messageSubject: '',
|
messageSubject: '',
|
||||||
attachments: [],
|
attachments: [],
|
||||||
}),
|
})),
|
||||||
close: () => set({ isOpen: false }),
|
close: () => set({ isOpen: false }),
|
||||||
toggleProperty: (id) =>
|
toggleProperty: (id) =>
|
||||||
set((s) => ({
|
set((s) => ({
|
||||||
|
|||||||
Reference in New Issue
Block a user