Skip to content

Commit

Permalink
Merge pull request #2188 from abilpraju-aot/bugfix/FWF-3577-draft
Browse files Browse the repository at this point in the history
added draft enable for create submission user
  • Loading branch information
arun-s-aot authored Aug 12, 2024
2 parents 0665d86 + b41095f commit ecb1148
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
Expand Up @@ -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());
Expand All @@ -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();
}
Expand Down

0 comments on commit ecb1148

Please sign in to comment.