-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: [DHIS2-11836] respect block entry form (#3759)
* feat: respect block entry form * feat: respect block entry form and authorities * fix: tooltip * feat: cypress test for disabled edit event button * fix: set tracker auto test restricted * fix: cypress test * feat: cy test for disabled button
- Loading branch information
Showing
11 changed files
with
80 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
src/core_modules/capture-core/components/WidgetEventEdit/constants/status.const.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// @flow | ||
|
||
export const eventStatuses = Object.freeze({ | ||
ACTIVE: 'ACTIVE', | ||
COMPLETED: 'COMPLETED', | ||
VISITED: 'VISITED', | ||
SCHEDULE: 'SCHEDULE', | ||
OVERDUE: 'OVERDUE', | ||
SKIPPED: 'SKIPPED', | ||
}); |
2 changes: 2 additions & 0 deletions
2
src/core_modules/capture-core/components/WidgetEventEdit/hooks/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
// @flow | ||
export { useAuthorities } from './useAuthorities'; |
27 changes: 27 additions & 0 deletions
27
src/core_modules/capture-core/components/WidgetEventEdit/hooks/useAuthorities.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// @flow | ||
import { useApiMetadataQuery } from 'capture-core/utils/reactQueryHelpers'; | ||
|
||
const auth = Object.freeze({ | ||
F_UNCOMPLETE_EVENT: 'F_UNCOMPLETE_EVENT', | ||
ALL: 'ALL', | ||
}); | ||
|
||
export const useAuthorities = () => { | ||
const queryKey = ['authorities']; | ||
const queryFn = { | ||
resource: 'me.json', | ||
params: { | ||
fields: 'authorities', | ||
}, | ||
}; | ||
const queryOptions = { | ||
select: ({ authorities }) => | ||
authorities && | ||
authorities.some(authority => authority === auth.ALL || authority === auth.F_UNCOMPLETE_EVENT), | ||
}; | ||
const { data } = useApiMetadataQuery<any>(queryKey, queryFn, queryOptions); | ||
|
||
return { | ||
canEditCompletedEvent: Boolean(data), | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters