Skip to content

Commit

Permalink
feat: added searchable statusus
Browse files Browse the repository at this point in the history
  • Loading branch information
gurjmatharu committed May 13, 2022
1 parent a686675 commit b01d730
Showing 1 changed file with 20 additions and 6 deletions.
26 changes: 20 additions & 6 deletions app/pages/cif/projects.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,24 @@ export const ProjectsQuery = graphql`
}
}
}
allProjectStatuses {
edges {
node {
name
}
}
}
}
`;

export function Projects({ preloadedQuery }: RelayProps<{}, projectsQuery>) {
const { allProjects, allCifUsers, pendingNewProjectRevision, session } =
usePreloadedQuery(ProjectsQuery, preloadedQuery);
const {
allProjects,
allCifUsers,
allProjectStatuses,
pendingNewProjectRevision,
session,
} = usePreloadedQuery(ProjectsQuery, preloadedQuery);
const router = useRouter();

const tableFilters = useMemo(
Expand All @@ -88,9 +100,11 @@ export function Projects({ preloadedQuery }: RelayProps<{}, projectsQuery>) {
orderByPrefix: "OPERATOR_BY_OPERATOR_ID__TRADE_NAME",
}),
new TextFilter("Proposal Reference", "proposalReference"),
new TextFilter("Status", "status", {
orderByPrefix: "PROJECT_STATUS_BY_PROJECT_STATUS_ID__NAME",
}),
new SearchableDropdownFilter(
"Status",
"status",
allProjectStatuses.edges.map((e) => e.node.name)
),
new SearchableDropdownFilter(
"Project Managers",
"projectManagers",
Expand All @@ -99,7 +113,7 @@ export function Projects({ preloadedQuery }: RelayProps<{}, projectsQuery>) {
new SortOnlyFilter("Funding Request", "totalFundingRequest"),
new NoHeaderFilter(),
],
[allCifUsers]
[allCifUsers.edges, allProjects.edges]
);

const [createProject, isCreatingProject] = useCreateProjectMutation();
Expand Down

0 comments on commit b01d730

Please sign in to comment.