From 83361a76e0a14d0eccdaec664c9491afd8ac919a Mon Sep 17 00:00:00 2001 From: Senthamilselvi Date: Thu, 6 Nov 2025 13:57:06 +0530 Subject: [PATCH] table search no submission found solved --- .../dashboard/SubmissionHistory.jsx | 50 ++--- .../src/pages/Admin/Validations.jsx | 182 ++++++++++-------- 2 files changed, 123 insertions(+), 109 deletions(-) diff --git a/ipi-survey-platform/src/components/dashboard/SubmissionHistory.jsx b/ipi-survey-platform/src/components/dashboard/SubmissionHistory.jsx index 454831d..402acfa 100644 --- a/ipi-survey-platform/src/components/dashboard/SubmissionHistory.jsx +++ b/ipi-survey-platform/src/components/dashboard/SubmissionHistory.jsx @@ -100,15 +100,13 @@ export const SubmissionHistory = ({ history = [], loading = false, error = '' }) }, [history]); const filtered = normalizedHistory.filter((entry) => { - const term = searchTerm.trim().toLowerCase(); - return ( - !term || - entry.survey_name.toLowerCase().includes(term) || - entry.year.toString().includes(term) || - entry.quarter.toLowerCase().includes(term) || - entry.status.toLowerCase().includes(term) + 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', @@ -154,7 +152,7 @@ export const SubmissionHistory = ({ history = [], loading = false, error = '' }) return ( <> -
+

Submission History @@ -210,22 +208,26 @@ export const SubmissionHistory = ({ history = [], loading = false, error = '' })
Loading submissions...
+ ) : filtered.length === 0 ? ( +
+ No Submission Found +
) : ( -
-
- +
+
+
)} diff --git a/ipi-survey-platform/src/pages/Admin/Validations.jsx b/ipi-survey-platform/src/pages/Admin/Validations.jsx index d80da9b..c587f16 100644 --- a/ipi-survey-platform/src/pages/Admin/Validations.jsx +++ b/ipi-survey-platform/src/pages/Admin/Validations.jsx @@ -142,19 +142,23 @@ const ManageSubmissions = () => { const statusOptions = React.useMemo(() => ['All', ...new Set(submissions.map((i) => i.status))], [submissions]); const filtered = React.useMemo(() => { + const term = search.trim().toLowerCase(); + return submissions.filter((item) => { - const matchSearch = - !search || - item.establishment?.toLowerCase().includes(search.toLowerCase()) || - item.submittedBy?.toLowerCase().includes(search.toLowerCase()); + const allValues = Object.values(item) + .map((v) => String(v ?? '').toLowerCase()) + .join(' '); + + const matchSearch = !term || allValues.includes(term); const matchYear = !year || year === 'All' || item.year === year; const matchQuarter = !quarter || quarter === 'All' || item.quarter === quarter; const matchEmirate = !emirate || emirate === 'All' || item.emirate === emirate; const matchStatus = !status || status === 'All' || item.status === status; + return matchSearch && matchYear && matchQuarter && matchEmirate && matchStatus; }); }, [submissions, search, year, quarter, emirate, status]); - + const summaryCounts = React.useMemo( () => ({ total: submissions.length, @@ -353,87 +357,95 @@ const ManageSubmissions = () => { -
-
{ - if (columnIndex === 7) - return ( -
- {value} -
- ); +
+ {toolbar} + + {filtered.length === 0 ? ( +
+ No Submission Found +
+ ) : ( +
{ + if (columnIndex === 7) + return ( +
+ {value} +
+ ); + + if (columnIndex === 10) { + const item = value; + return ( +
+
+ + navigate(`/admin/validations/${item.id}`, { + state: { actionType: 'approve' }, + }) + } + /> + + Approve + +
+ +
+ + navigate(`/admin/validations/${item.id}`, { + state: { actionType: 'reject' }, + }) + } + /> + + Reject + +
+ +
+ + navigate(`/admin/validations/${item.id}`, { + state: { actionType: 'view' }, + }) + } + /> + + View + +
+
+ ); + } + + return value; + }} + /> + )} + - if (columnIndex === 10) { - const item = value; - return ( -
-
- - navigate(`/admin/validations/${item.id}`, { - state: { actionType: 'approve' }, - }) - } - /> - - Approve - -
- -
- - navigate(`/admin/validations/${item.id}`, { - state: { actionType: 'reject' }, - }) - } - /> - - Reject - -
- -
- - navigate(`/admin/validations/${item.id}`, { - state: { actionType: 'view' }, - }) - } - /> - - View - -
-
- ); - } - - return value; - }} - /> -