Skip to content

Commit

Permalink
added draft enable for create submission user
Browse files Browse the repository at this point in the history
abilpraju-aot committed Aug 12, 2024
1 parent 78e6e1f commit b41095f
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions forms-flow-web/src/components/Application/List.js
Original file line number Diff line number Diff line change
@@ -34,7 +34,8 @@ export const ApplicationList = React.memo(() => {
const page = useSelector((state) => state.applications.activePage);
const tenantKey = useSelector((state) => state.tenants?.tenantId);
const redirectUrl = MULTITENANCY_ENABLED ? `/tenant/${tenantKey}/` : "/";

const userRoles = useSelector((state) => state.user.roles || []);
const create_submissions = userRoles.includes("create_submissions");

useEffect(() => {
dispatch(getAllApplicationStatus());
@@ -59,26 +60,31 @@ export const ApplicationList = React.memo(() => {
return <Loading />;
}


const headerList = () => {
return [
const headers = [
{
name: "Submissions",
count: totalApplications,
onClick: () => dispatch(push(`${redirectUrl}application`)),
icon: "list",
},
{
}
];

if (create_submissions) {
headers.push({
name: "Drafts",
count: draftCount,
onClick: () => dispatch(push(`${redirectUrl}draft`)),
icon: "edit",
},
];
});
}

return headers;
};

let headOptions = headerList();


if (!DRAFT_ENABLED) {
headOptions.pop();
}

0 comments on commit b41095f

Please sign in to comment.