From 31883f8689d8d53a4280c70df9c665b1686f1344 Mon Sep 17 00:00:00 2001 From: Malini Date: Sat, 8 Nov 2025 12:52:18 +0530 Subject: [PATCH] bug fixed --- .../dashboard/SubmissionHistory.jsx | 19 +++++---- .../src/pages/History/History.jsx | 5 ++- .../src/pages/Overview/Overview.jsx | 42 ++++++++++++++++++- 3 files changed, 54 insertions(+), 12 deletions(-) diff --git a/ipi-survey-platform/src/components/dashboard/SubmissionHistory.jsx b/ipi-survey-platform/src/components/dashboard/SubmissionHistory.jsx index b6b55b6..648c7f1 100644 --- a/ipi-survey-platform/src/components/dashboard/SubmissionHistory.jsx +++ b/ipi-survey-platform/src/components/dashboard/SubmissionHistory.jsx @@ -36,11 +36,11 @@ const getStatusBadge = (status) => { Submitted ); - } else if (normalized === 'resubmitted') { + } else if (normalized === 'resubmitted') { return ( Resubmitted - + ); } else if (['pending', 'under review', 'in-progress'].includes(normalized)) { return ( @@ -102,7 +102,6 @@ const downloadCsv = (data) => { URL.revokeObjectURL(url); }; - export const SubmissionHistory = ({ history = [], loading = false, error = '' }) => { const [searchTerm, setSearchTerm] = React.useState(''); const [selectedSubmission, setSelectedSubmission] = React.useState(null); @@ -110,6 +109,10 @@ export const SubmissionHistory = ({ history = [], loading = false, error = '' }) const pageSize = 10; const navigate = useNavigate(); + const handleViewDetails = (submission) => { + navigate('/overview', { state: { selectedSubmission: submission } }); + }; + const normalizedHistory = React.useMemo(() => { if (!Array.isArray(history)) return []; return history.map((entry, index) => ({ @@ -126,11 +129,11 @@ export const SubmissionHistory = ({ history = [], loading = false, error = '' }) const filtered = normalizedHistory.filter((entry) => { const term = searchTerm.trim().toLowerCase().replace(/\s+/g, ''); if (!term) return true; - + return Object.values(entry).some((val) => String(val).toLowerCase().replace(/\s+/g, '').includes(term) ); - }); + }); const tableHeaders = [ 'Survey Name', @@ -152,7 +155,7 @@ export const SubmissionHistory = ({ history = [], loading = false, error = '' }) {item.submission_on}, productsLabel, + setSelectedSubmission(null)} /> + + + ); + } + if (loading) { return (