-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: implement action menu * chore: export `IProps` * feat: enable keyboard navigation * feat: implement `Dropdown` component * feat: make dropdownMenu keyboard accessible * feat: make dropdownMenu close on click outside and esc * fix: make some props optional * fix: close menu on ouside click * feat: create actionMenu * feat: add `Update`, `Print`, `Issue`, `Delete` items * feat: implement delete declaration * feat: redirect to home after deleting draft * feat: add label for assigned to someone else * refactor: move actionItems * amend: add missing props * feat: add scope and other checks for: correct record * feat: add scope and other checks for: archive declaration * feat: add scope and other checks for: reinstate declaration * refactor: restructure types * feat: add scope and other checks for: review * chore: add todo * feat: add scope and other checks for: update declaration * feat: add scope and other checks for: print declaration * chore: remove console.log * feat: add scope and other checks for: issue certificate * feat: add scope and other checks for: delete declaration * refactor: change order of items * wip * Revert "wip" This reverts commit b25bfa1. * feat: implement unassign button * fix: font and color * fix: keyDown behaviour * chore: remove record audit buttons * refactor: use dropdownMenu to refactor toggleMenu * chore: remove action from component * chore: deprecate toggleMenu * feat: move self unassign to actionMenu * chore: dont unassign from download button * chore: remove unused imports * chore: update changelog * fix: RA will see "correct record" button * fix: add id in dropdown menu * refactor: `isDownloadable` logic * refactor: remove types from actionMessages * refactor: use `useIntl` and `useDispatch` hooks instead of props drilling * refactor: dont pass assignment to unassign comp * refactor: use `offsetX` and `offsetY` instead of `offset_x` and `offset_y` * refactor: use `<Button>` instead of `<PrimaryButton>` * refactor: remove unnecessary `<div>`s * feat: use `anchor` and `popover` api to toggle the dropdown visivility * fix: focus * chore: remove as string * refactor: early return if condition fails * refactor: move declaration status logic into declarations/utils * refactor: change type of status to `SUBMISSION_STATUS` * fix: handle multiple dropdown * fix: styles * fix: position options and story * fix: close dropdown on action click * refactor: align EVENT in common with Event in client * refactor: pass id directly to provider * test: add unit test for view action * test: cover all statuses for view action * test: add tests for review action * test: add tests for update action * test: add tests for archive action * test: add tests for reinstate action * test: add tests for print action * test: add tests for issue action * test: refactor: centralize scoeps * test: add test for not having scope * test: add tests for correct action * test: add tests for delete action * test: add tests for unassign action * test: add tests for assignment text * fix: unhandled errors * chore: remove old tests * fix: use EVENT.Birth instead of "Birth" * fix: use EVENT.Birth instead of "Birth" * fix: eventToggle id in test * fix: eventToggle id in test * fix: ids in UserList.test * fix: ids in UserAudit.test * fix: import Event * fix: remove unassign test from download button * fix: ids in ProfileMenu.test * fix: import Event * fix: import Event --------- Co-authored-by: Riku Rouvila <[email protected]>
- Loading branch information
Showing
38 changed files
with
3,968 additions
and
769 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
/* | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. | ||
* | ||
* OpenCRVS is also distributed under the terms of the Civil Registration | ||
* & Healthcare Disclaimer located at http://opencrvs.org/license. | ||
* | ||
* Copyright (C) The OpenCRVS Authors located at https://github.com/opencrvs/opencrvs-core/blob/master/AUTHORS. | ||
*/ | ||
|
||
import { EVENT_STATUS } from '@client/workqueue' | ||
import { SUBMISSION_STATUS } from '.' | ||
|
||
export const isPendingCorrection = (status?: SUBMISSION_STATUS) => | ||
status === EVENT_STATUS.CORRECTION_REQUESTED | ||
|
||
export const isReviewableDeclaration = (status?: SUBMISSION_STATUS) => | ||
status && [EVENT_STATUS.DECLARED, EVENT_STATUS.VALIDATED].includes(status) | ||
|
||
export const isUpdatableDeclaration = (status?: SUBMISSION_STATUS) => | ||
status && | ||
[ | ||
SUBMISSION_STATUS.DRAFT, | ||
EVENT_STATUS.IN_PROGRESS, | ||
EVENT_STATUS.REJECTED | ||
].includes(status) | ||
|
||
export const isPrintable = (status?: SUBMISSION_STATUS) => | ||
status && | ||
[SUBMISSION_STATUS.REGISTERED, SUBMISSION_STATUS.ISSUED].includes(status) | ||
|
||
export const isCertified = (status?: SUBMISSION_STATUS) => | ||
status === SUBMISSION_STATUS.CERTIFIED | ||
|
||
export const isRecordOrDeclaration = (status?: SUBMISSION_STATUS) => | ||
status | ||
? [ | ||
SUBMISSION_STATUS.REGISTERED, | ||
SUBMISSION_STATUS.CORRECTION_REQUESTED, | ||
SUBMISSION_STATUS.CERTIFIED | ||
].includes(status) | ||
? 'record' | ||
: 'declaration' | ||
: '' | ||
|
||
export const canBeCorrected = (status?: SUBMISSION_STATUS) => | ||
status && | ||
[ | ||
SUBMISSION_STATUS.REGISTERED, | ||
SUBMISSION_STATUS.CERTIFIED, | ||
SUBMISSION_STATUS.ISSUED | ||
].includes(status) | ||
|
||
export const isArchivable = (status?: SUBMISSION_STATUS) => | ||
status && | ||
[ | ||
SUBMISSION_STATUS.IN_PROGRESS, | ||
SUBMISSION_STATUS.DECLARED, | ||
SUBMISSION_STATUS.VALIDATED, | ||
SUBMISSION_STATUS.REJECTED | ||
].includes(status) | ||
|
||
export const isArchived = (status?: SUBMISSION_STATUS) => | ||
status === SUBMISSION_STATUS.ARCHIVED |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
/* | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. | ||
* | ||
* OpenCRVS is also distributed under the terms of the Civil Registration | ||
* & Healthcare Disclaimer located at http://opencrvs.org/license. | ||
* | ||
* Copyright (C) The OpenCRVS Authors located at https://github.com/opencrvs/opencrvs-core/blob/master/AUTHORS. | ||
*/ | ||
import { defineMessages } from 'react-intl' | ||
|
||
const messagesToDefine = { | ||
action: { | ||
defaultMessage: 'Action', | ||
description: 'Label for action button in dropdown menu', | ||
id: 'action.action' | ||
}, | ||
assignedTo: { | ||
defaultMessage: 'Assigned to {name} at {officeName}', | ||
description: 'Label for assignee', | ||
id: 'action.assignee' | ||
}, | ||
view: { | ||
defaultMessage: 'View {recordOrDeclaration}', | ||
description: 'Label for view button in dropdown menu', | ||
id: 'action.view' | ||
}, | ||
correctRecord: { | ||
defaultMessage: 'Correct Record', | ||
description: 'Label for correct record button in dropdown menu', | ||
id: 'action.correct' | ||
}, | ||
archiveRecord: { | ||
defaultMessage: 'Archive Record', | ||
description: 'Label for archive record button in dropdown menu', | ||
id: 'action.archive' | ||
}, | ||
reinstateRecord: { | ||
defaultMessage: 'Reinstate Record', | ||
description: 'Label for reinstate record button in dropdown menu', | ||
id: 'action.reinstate' | ||
}, | ||
reviewCorrection: { | ||
defaultMessage: 'Review correction request', | ||
description: 'Label for review correction request button in dropdown menu', | ||
id: 'action.review.correction' | ||
}, | ||
reviewDeclaration: { | ||
defaultMessage: | ||
'Review {isDuplicate, select, true{potential duplicate} other{declaration}}', | ||
description: 'Label for review record button in dropdown menu', | ||
id: 'action.review.declaration' | ||
}, | ||
updateDeclaration: { | ||
defaultMessage: 'Update declaration', | ||
description: 'Label for update record button in dropdown menu', | ||
id: 'action.update' | ||
}, | ||
printDeclaration: { | ||
defaultMessage: 'Print certified copy', | ||
description: 'Label for print certified copy in dropdown menu', | ||
id: 'action.print' | ||
}, | ||
issueCertificate: { | ||
defaultMessage: 'Issue certificate', | ||
description: 'Label for issue certificate in dropdown menu', | ||
id: 'action.issue' | ||
} | ||
} | ||
export const messages = defineMessages(messagesToDefine) |
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
Oops, something went wrong.