From 2cdb563747ba9e69c6617c691ea68ebe68c9adcc Mon Sep 17 00:00:00 2001 From: Jan Date: Tue, 21 May 2024 15:32:40 +0200 Subject: [PATCH] CM-809: update group_code (#77) * CM-809: update group_code * CM-809: display group code --- src/actions.js | 3 ++- src/components/GroupFilter.js | 8 ++++++++ src/components/GroupHeadPanel.js | 6 +++--- src/components/GroupSearcher.js | 4 ++-- src/components/dialogs/IndividualsUploadDialog.js | 2 +- src/translations/en.json | 3 ++- 6 files changed, 18 insertions(+), 8 deletions(-) diff --git a/src/actions.js b/src/actions.js index 10eb12a..b6719c9 100644 --- a/src/actions.js +++ b/src/actions.js @@ -50,7 +50,7 @@ const INDIVIDUAL_FULL_PROJECTION = [ const GROUP_INDIVIDUAL_FULL_PROJECTION = [ 'id', 'individual {id, firstName, lastName, dob}', - 'group {id}', + 'group {id, code}', 'role', 'isDeleted', 'dateCreated', @@ -60,6 +60,7 @@ const GROUP_INDIVIDUAL_FULL_PROJECTION = [ const GROUP_FULL_PROJECTION = [ 'id', + 'code', 'isDeleted', 'head {firstName, lastName}', 'dateCreated', diff --git a/src/components/GroupFilter.js b/src/components/GroupFilter.js index 449b33d..c2005d2 100644 --- a/src/components/GroupFilter.js +++ b/src/components/GroupFilter.js @@ -26,6 +26,14 @@ function GroupFilter({ return ( + + + this.updateAttribute('id', v)} - value={group?.id ?? EMPTY_STRING} + label="group.code" + onChange={(v) => this.updateAttribute('code', v)} + value={group?.code ?? EMPTY_STRING} /> diff --git a/src/components/GroupSearcher.js b/src/components/GroupSearcher.js index adf71e1..1100419 100644 --- a/src/components/GroupSearcher.js +++ b/src/components/GroupSearcher.js @@ -114,7 +114,7 @@ function GroupSearcher({ const headers = () => { const headers = [ - 'group.id', + 'group.code', 'group.head', ]; if (rights.includes(RIGHT_GROUP_UPDATE)) { @@ -125,7 +125,7 @@ function GroupSearcher({ const itemFormatters = () => { const formatters = [ - (group) => group.id, + (group) => group.code, (group) => (group?.head ? `${group?.head?.firstName} ${group?.head?.lastName}` : formatMessage(intl, 'group', 'noHeadSpecified')), diff --git a/src/components/dialogs/IndividualsUploadDialog.js b/src/components/dialogs/IndividualsUploadDialog.js index bc2ed46..2a675ad 100644 --- a/src/components/dialogs/IndividualsUploadDialog.js +++ b/src/components/dialogs/IndividualsUploadDialog.js @@ -65,7 +65,7 @@ function IndividualsUploadDialog({ try { const fileHeaders = await getHeadersFromCSV(selectedFile); const filteredHeaders = fileHeaders.filter( - (header) => header !== 'recipient_info' && header !== 'group_id', + (header) => header !== 'recipient_info' && header !== 'group_code', ); setHeaders(filteredHeaders); } catch (error) { diff --git a/src/translations/en.json b/src/translations/en.json index aa8aedd..d67254a 100644 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -143,6 +143,7 @@ "group": { "id": "ID", "head": "Head", + "code": "Code", "noHeadSpecified": "head not specified", "individual.firstName": "Individual First Name", "individual.lastName": "Individual Last Name", @@ -246,5 +247,5 @@ "changeGroupButtonTooltip": "Move to another group.", "moveToNewGroup": "New Group", "createGroupFromColumns": "Create groups from column:", - "groupAggregationInfo": "To specify recipients include header 'recipient_info' with possible values: '1' - head, '2' - recipient, '0' or empty - not a recipient." + "groupAggregationInfo": "To specify recipients include header 'recipient_info' with possible values: '1' - head, '0' or empty - recipient." } \ No newline at end of file