Skip to content

Commit

Permalink
Merge pull request #1336 from BLSQ/IA-3042_submission_perm_in_forms
Browse files Browse the repository at this point in the history
IA-3042: fix submissions perm in form table
  • Loading branch information
quang-le authored May 30, 2024
2 parents fac3a02 + 731adca commit a341f7f
Showing 1 changed file with 15 additions and 25 deletions.
40 changes: 15 additions & 25 deletions hat/assets/js/apps/Iaso/domains/forms/config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { createInstance } from '../../instances/actions';
import * as Permission from '../../../utils/permissions.ts';
import { BreakWordCell } from '../../../components/Cells/BreakWordCell.tsx';
import { useCurrentUser } from '../../../utils/usersUtils.ts';
import { DisplayIfUserHasPerm } from '../../../components/DisplayIfUserHasPerm.tsx';

export const baseUrl = baseUrls.forms;

Expand Down Expand Up @@ -223,22 +224,22 @@ export const useFormsTableColumns = ({
)}
{!showDeleted && (
<>
{userHasPermission(
Permission.SUBMISSIONS,
user,
) && (
<DisplayIfUserHasPerm
permissions={[Permission.SUBMISSIONS]}
>
<IconButton
url={`${urlToInstances}`}
tooltipMessage={
MESSAGES.viewInstances
}
overrideIcon={FormatListBulleted}
/>
)}
{userHasPermission(
Permission.SUBMISSIONS,
user,
) && (
</DisplayIfUserHasPerm>
<DisplayIfUserHasPerm
permissions={[
Permission.SUBMISSIONS_UPDATE,
]}
>
<CreateSubmissionModal
titleMessage={
MESSAGES.instanceCreationDialogTitle
Expand Down Expand Up @@ -267,21 +268,15 @@ export const useFormsTableColumns = ({
.org_unit_type_ids
}
/>
)}
{userHasPermission(
Permission.FORMS,
user,
) && (
</DisplayIfUserHasPerm>
<DisplayIfUserHasPerm
permissions={[Permission.FORMS]}
>
<IconButton
url={`/${baseUrls.formDetail}/formId/${settings.row.original.id}`}
icon="edit"
tooltipMessage={MESSAGES.edit}
/>
)}
{userHasPermission(
Permission.FORMS,
user,
) && (
<IconButton
// eslint-disable-next-line max-len
url={`/${baseUrls.mappings}/formId/${settings.row.original.id}/order/form_version__form__name,form_version__version_id,mapping__mapping_type/pageSize/20/page/1`}
Expand All @@ -290,11 +285,6 @@ export const useFormsTableColumns = ({
MESSAGES.dhis2Mappings
}
/>
)}
{userHasPermission(
Permission.FORMS,
user,
) && (
<DeleteDialog
titleMessage={
MESSAGES.deleteFormTitle
Expand All @@ -305,7 +295,7 @@ export const useFormsTableColumns = ({
).then(closeDialog)
}
/>
)}
</DisplayIfUserHasPerm>
</>
)}
</section>
Expand Down

0 comments on commit a341f7f

Please sign in to comment.