From 93b3416d2cedb973208f07706cc2ca3d3a9086e9 Mon Sep 17 00:00:00 2001 From: Hermes Agent Date: Mon, 28 Sep 2026 11:10:17 +0200 Subject: [PATCH] Removed duplicate filter in settings page Improved Rule value handling --- .../src/lib/formatters.ts | 9 +- .../src/pages/SettingsPage.tsx | 107 +----------------- 2 files changed, 9 insertions(+), 107 deletions(-) diff --git a/PostFundManagement.ConsoleUI/src/lib/formatters.ts b/PostFundManagement.ConsoleUI/src/lib/formatters.ts index c32f66d..7067efc 100644 --- a/PostFundManagement.ConsoleUI/src/lib/formatters.ts +++ b/PostFundManagement.ConsoleUI/src/lib/formatters.ts @@ -582,14 +582,15 @@ export const USER_ROLE_OPTIONS = [ { value: 'Supervisor', label: 'Supervisor' }, { value: 'Manager', label: 'Manager' }, { value: 'Contributor', label: 'Contributor' }, + { value: 'Unassigned', label: 'Unassigned' }, ]; export const getUserRoleBadge = (role?: string | number | UserRole | null) => { - if (role === null || role === undefined || role === '') { + if (role === null || role === undefined || role === '' || String(role).trim().toLowerCase() === 'null' || String(role).trim().toLowerCase() === 'unassigned') { return { - label: 'Contributor', - className: 'bg-emerald-500/15 text-emerald-300 border-emerald-500/30', - dot: 'bg-emerald-400', + label: 'Unassigned', + className: 'bg-slate-800/80 text-slate-400 border-slate-700/80 shadow-xs', + dot: 'bg-slate-500', }; } diff --git a/PostFundManagement.ConsoleUI/src/pages/SettingsPage.tsx b/PostFundManagement.ConsoleUI/src/pages/SettingsPage.tsx index b3cde36..0d2a8ee 100644 --- a/PostFundManagement.ConsoleUI/src/pages/SettingsPage.tsx +++ b/PostFundManagement.ConsoleUI/src/pages/SettingsPage.tsx @@ -47,8 +47,6 @@ import { getUserSyncRecord, getInvites, sendInvite, - getApplicantInvite, - getApplicantInvites, getOrganisations, getAwards, getContracts, @@ -131,10 +129,11 @@ export const SettingsPage: React.FC = () => { const filteredUsers = useMemo(() => { return usersList.filter((u) => { + const roleLabel = getUserRoleBadge(u.role).label; const matchRole = userRoleFilter === 'all' || - (u.role && String(u.role).toLowerCase() === userRoleFilter.toLowerCase()) || - (!u.role && userRoleFilter.toLowerCase() === 'contributor'); + roleLabel.toLowerCase() === userRoleFilter.toLowerCase() || + (u.role && String(u.role).toLowerCase() === userRoleFilter.toLowerCase()); return matchRole; }); }, [usersList, userRoleFilter]); @@ -198,9 +197,6 @@ export const SettingsPage: React.FC = () => { // 2. Communications & Invites State // ========================================== const [isSendInviteModalOpen, setIsSendInviteModalOpen] = useState(false); - const [applicantSearchId, setApplicantSearchId] = useState(''); - const [applicantInvitesResults, setApplicantInvitesResults] = useState(null); - const [searchingApplicant, setSearchingApplicant] = useState(false); // Invite Form State const [inviteOrgId, setInviteOrgId] = useState(''); @@ -266,37 +262,6 @@ export const SettingsPage: React.FC = () => { }, }); - const handleSearchApplicantInvites = async (e?: React.FormEvent) => { - if (e) e.preventDefault(); - if (!applicantSearchId.trim()) return; - try { - setSearchingApplicant(true); - const res = await getApplicantInvites(applicantSearchId.trim()); - setApplicantInvitesResults(res); - success('Lookup Complete', `Retrieved ${res.length} invitation records for applicant.`); - } catch (err: any) { - toastError('Lookup Error', err); - setApplicantInvitesResults([]); - } finally { - setSearchingApplicant(false); - } - }; - - const handleLookupSingleApplicantInvite = async () => { - if (!applicantSearchId.trim()) return; - try { - setSearchingApplicant(true); - const res = await getApplicantInvite(applicantSearchId.trim()); - setApplicantInvitesResults(res ? [res] : []); - success('Primary Invite Found', `Retrieved primary invitation for applicant.`); - } catch (err: any) { - toastError('Lookup Error', err); - setApplicantInvitesResults([]); - } finally { - setSearchingApplicant(false); - } - }; - // ========================================== // 3. Email Gateway & Notifications State // ========================================== @@ -908,71 +873,7 @@ export const SettingsPage: React.FC = () => { {/* TAB 2: Communications & Invites */} {/* ============================================================== */} {activeTab === 'invites' && ( -
- {/* Applicant Invites Lookup */} -
-

Applicant Invitations Lookup

-

- Query invitations dispatched to a specific candidate or grantee using their unique Applicant User UUID. -

-
- setApplicantSearchId(e.target.value)} - placeholder="Enter Applicant User ID (UUID)..." - className="flex-1 px-3 py-2 text-xs bg-slate-900/80 border border-slate-700/80 rounded-xl text-white placeholder-slate-500 font-mono focus:outline-none focus:ring-2 focus:ring-blue-500/50" - /> - - -
- - {applicantInvitesResults && ( -
- - Lookup Results ({applicantInvitesResults.length} matches): - - {applicantInvitesResults.length === 0 ? ( -

No invitations found for this applicant UUID.

- ) : ( -
- {applicantInvitesResults.map((inv, idx) => ( -
-
- {inv.message} -
- Org #{inv.organisationId} • Award #{inv.awardId} • Contract #{inv.contractId} -
-
- - {getNotificationPlatformLabel(inv.platform)} - -
- ))} -
- )} -
- )} -
- +
{/* Standardized Toolbar & Filter Bar directly above Sent Invitations Table */}
{/* Filters on the left */}