Correction des redirections
This commit is contained in:
@@ -27,7 +27,7 @@ const STATUT_FG = {
|
||||
cloture: 'var(--text-muted)',
|
||||
};
|
||||
|
||||
export default function InvMensuelTable({ rows, allRembs, allReinvests, year }) {
|
||||
export default function InvMensuelTable({ rows, allRembs, allReinvests, year, originFrom }) {
|
||||
const navigate = useNavigate();
|
||||
const currentYear = new Date().getFullYear();
|
||||
const currentMonth = new Date().getMonth() + 1;
|
||||
@@ -142,7 +142,7 @@ export default function InvMensuelTable({ rows, allRembs, allReinvests, year })
|
||||
{grid.map(({ inv, months }) => (
|
||||
<tr key={inv.id} className="tip-row-plat"
|
||||
style={{ cursor: 'pointer' }}
|
||||
onClick={() => navigate(`/investissements/${inv.id}`)}>
|
||||
onClick={() => navigate(`/investissements/${inv.id}`, originFrom ? { state: { from: originFrom } } : undefined)}>
|
||||
|
||||
<td className="tip-td-name" style={{ whiteSpace: 'normal', maxWidth: '40ch', wordBreak: 'break-word' }}>
|
||||
{inv.nom_projet || '—'}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useCallback, useEffect, useRef, useState } from 'react';
|
||||
import { NavLink, Outlet, useNavigate } from 'react-router-dom';
|
||||
import { NavLink, Outlet, useLocation, useNavigate } from 'react-router-dom';
|
||||
import { api } from '../api.js';
|
||||
import { useInvestisseur } from '../context/InvestisseurContext.jsx';
|
||||
import { useUi } from '../context/UiContext.jsx';
|
||||
@@ -64,6 +64,7 @@ const IconPanelExpand = () => (
|
||||
/* ── Recherche rapide de projet ─────────────────────────────── */
|
||||
function ProjectSearch() {
|
||||
const navigate = useNavigate();
|
||||
const location = useLocation();
|
||||
const { activeId, activeView } = useInvestisseur();
|
||||
const [query, setQuery] = useState('');
|
||||
const [allInv, setAllInv] = useState([]);
|
||||
@@ -118,9 +119,25 @@ function ProjectSearch() {
|
||||
setActiveIdx(-1);
|
||||
}, [results.length, query]); /* eslint-disable-line */
|
||||
|
||||
const PAGE_LABELS = {
|
||||
'/': 'Tableau de bord',
|
||||
'/investissements': 'Investissements',
|
||||
'/remboursements': 'Remboursements',
|
||||
'/depots-retraits': 'Dépôts / Retraits',
|
||||
'/2778-sd': 'Fiscalité',
|
||||
'/plateformes': 'Plateformes',
|
||||
'/taxreport': 'Fiscalité',
|
||||
'/settings': 'Paramètres',
|
||||
'/compte': 'Mon compte',
|
||||
'/admin': 'Administration',
|
||||
};
|
||||
const currentLabel = PAGE_LABELS[location.pathname] ?? 'Recherche';
|
||||
|
||||
const goTo = (inv) => {
|
||||
setQuery(''); setOpen(false);
|
||||
navigate(`/investissements/${inv.id}`);
|
||||
navigate(`/investissements/${inv.id}`, {
|
||||
state: { from: { path: location.pathname, search: location.search, label: currentLabel } },
|
||||
});
|
||||
};
|
||||
|
||||
const handleKeyDown = (e) => {
|
||||
|
||||
Reference in New Issue
Block a user