From c1031911fad03396b4e83fbbbb28b60aef9fd170 Mon Sep 17 00:00:00 2001 From: Ludwig Reiter Date: Wed, 8 May 2024 11:53:15 +0200 Subject: [PATCH 01/10] Add member number to user detail view --- client/src/app/domain/models/users/user.ts | 2 ++ .../repositories/users/user-repository.service.ts | 9 ++++++--- .../user-detail-view.component.html | 14 ++++++++++++++ .../user-detail-view/user-detail-view.component.ts | 1 + 4 files changed, 23 insertions(+), 3 deletions(-) diff --git a/client/src/app/domain/models/users/user.ts b/client/src/app/domain/models/users/user.ts index d90d88a2bc..efde0d5100 100644 --- a/client/src/app/domain/models/users/user.ts +++ b/client/src/app/domain/models/users/user.ts @@ -36,6 +36,7 @@ export class User extends BaseDecimalModel { public readonly default_vote_weight!: number; public readonly is_demo_user!: boolean; public readonly saml_id!: string; + public readonly member_number!: string; // Meeting and committee public meeting_ids!: Id[]; // (meeting/user_ids)[]; @@ -64,6 +65,7 @@ export class User extends BaseDecimalModel { `id`, `username`, `saml_id`, + `member_number`, `pronoun`, `title`, `first_name`, diff --git a/client/src/app/gateways/repositories/users/user-repository.service.ts b/client/src/app/gateways/repositories/users/user-repository.service.ts index d056099961..7364c5cb4e 100644 --- a/client/src/app/gateways/repositories/users/user-repository.service.ts +++ b/client/src/app/gateways/repositories/users/user-repository.service.ts @@ -107,7 +107,8 @@ export class UserRepositoryService extends BaseRepository { `is_physical_person`, `is_active`, `meeting_ids`, - `saml_id` + `saml_id`, + `member_number` ]; const filterableListFields: TypedFieldset = listFields.concat([ @@ -250,6 +251,7 @@ export class UserRepositoryService extends BaseRepository { first_name: partialUser.first_name, last_name: partialUser.last_name, username: partialUser.username, + member_number: partialUser.member_number, is_active: partialUser.is_active, is_physical_person: partialUser.is_physical_person, default_password: partialUser.default_password, @@ -263,7 +265,7 @@ export class UserRepositoryService extends BaseRepository { return partialPayload; } - public getTitle = (viewUser: ViewUser) => this.getFullName(viewUser); + public getTitle = (viewUser: ViewUser): string => this.getFullName(viewUser); /** * getter for the name @@ -525,7 +527,8 @@ export class UserRepositoryService extends BaseRepository { `comment`, `about_me`, `number`, - `structure_level` + `structure_level`, + `member_number` ]; return fields.includes(field); } diff --git a/client/src/app/site/modules/user-components/components/user-detail-view/user-detail-view.component.html b/client/src/app/site/modules/user-components/components/user-detail-view/user-detail-view.component.html index 40635a7418..eb04cae3ef 100644 --- a/client/src/app/site/modules/user-components/components/user-detail-view/user-detail-view.component.html +++ b/client/src/app/site/modules/user-components/components/user-detail-view/user-detail-view.component.html @@ -159,6 +159,14 @@

{{ 'Personal information' | translate }}

+
+ + {{ 'Membership number' | translate }} + + {{ 'Membership number must be unique' | translate }} + +
+
{{ 'active' | translate }} {{ 'natural person' | translate }} @@ -223,6 +231,12 @@

{{ 'Initial password' | translate }}

{{ user.default_password }}
+ +
+

{{ 'Membership number' | translate }}

+ {{ user.member_number }} +
+

{{ 'SSO Identification' | translate }}

diff --git a/client/src/app/site/modules/user-components/components/user-detail-view/user-detail-view.component.ts b/client/src/app/site/modules/user-components/components/user-detail-view/user-detail-view.component.ts index e110050eda..3d29432ff9 100644 --- a/client/src/app/site/modules/user-components/components/user-detail-view/user-detail-view.component.ts +++ b/client/src/app/site/modules/user-components/components/user-detail-view/user-detail-view.component.ts @@ -311,6 +311,7 @@ export class UserDetailViewComponent extends BaseUiComponent implements OnInit, email: [``, [createEmailValidator()]], last_email_sent: [``], default_password: [``], + member_number: [``], is_active: [true], is_physical_person: [true], ...this._additionalFormControls From 362e7fd40dfc3f2c7f3a4f6e2aac9ea2c332c52a Mon Sep 17 00:00:00 2001 From: Ludwig Reiter Date: Wed, 8 May 2024 12:35:24 +0200 Subject: [PATCH 02/10] add member number to account list (search, sort, view) --- .../user-detail-view/user-detail-view.component.html | 2 +- .../components/account-list/account-list.component.html | 3 ++- .../account-list-search/account-list-search.service.ts | 2 +- .../services/account-list-sort.service/account-sort.service.ts | 1 + 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/client/src/app/site/modules/user-components/components/user-detail-view/user-detail-view.component.html b/client/src/app/site/modules/user-components/components/user-detail-view/user-detail-view.component.html index eb04cae3ef..f3e4f3bc5b 100644 --- a/client/src/app/site/modules/user-components/components/user-detail-view/user-detail-view.component.html +++ b/client/src/app/site/modules/user-components/components/user-detail-view/user-detail-view.component.html @@ -232,7 +232,7 @@

{{ 'Initial password' | translate }}

-
+

{{ 'Membership number' | translate }}

{{ user.member_number }}
diff --git a/client/src/app/site/pages/organization/pages/accounts/pages/account-list/components/account-list/account-list.component.html b/client/src/app/site/pages/organization/pages/accounts/pages/account-list/components/account-list/account-list.component.html index 7dfa140a1c..5e376cddd8 100644 --- a/client/src/app/site/pages/organization/pages/accounts/pages/account-list/components/account-list/account-list.component.html +++ b/client/src/app/site/pages/organization/pages/accounts/pages/account-list/components/account-list/account-list.component.html @@ -63,7 +63,8 @@

{{ 'Accounts' | translate }}

{{ user.saml_id || user.username }} - · {{ user.email }} + · {{ user.email }}  + · {{ user.member_number }}
diff --git a/client/src/app/site/pages/organization/pages/accounts/pages/account-list/services/account-list-search/account-list-search.service.ts b/client/src/app/site/pages/organization/pages/accounts/pages/account-list/services/account-list-search/account-list-search.service.ts index 7f163881f6..7e9dbf9c87 100644 --- a/client/src/app/site/pages/organization/pages/accounts/pages/account-list/services/account-list-search/account-list-search.service.ts +++ b/client/src/app/site/pages/organization/pages/accounts/pages/account-list/services/account-list-search/account-list-search.service.ts @@ -9,6 +9,6 @@ import { AccountListServiceModule } from '../account-list-service.module'; }) export class AccountListSearchService extends ListSearchService { public constructor() { - super([`short_name`, `username`, `email`, `saml_id`], []); + super([`short_name`, `username`, `email`, `saml_id`, `member_number`], []); } } diff --git a/client/src/app/site/pages/organization/pages/accounts/pages/account-list/services/account-list-sort.service/account-sort.service.ts b/client/src/app/site/pages/organization/pages/accounts/pages/account-list/services/account-list-sort.service/account-sort.service.ts index 7e0943e3d9..066bf6316c 100644 --- a/client/src/app/site/pages/organization/pages/accounts/pages/account-list/services/account-list-sort.service/account-sort.service.ts +++ b/client/src/app/site/pages/organization/pages/accounts/pages/account-list/services/account-list-sort.service/account-sort.service.ts @@ -18,6 +18,7 @@ export class AccountSortService extends BaseSortListService { { property: [`first_name`, `last_name`], label: _(`Given name`) }, { property: [`last_name`, `first_name`], label: _(`Surname`) }, { property: `username`, label: _(`Username`) }, + { property: `member_number`, label: _(`Membership Number`) }, { property: `is_active`, label: _(`Is active`) }, { property: `default_vote_weight`, label: _(`Vote weight`) }, { property: `gender`, label: _(`Gender`) }, From bedc19b286814957da54f023375b32ad8deddf16 Mon Sep 17 00:00:00 2001 From: Ludwig Reiter Date: Mon, 13 May 2024 10:36:28 +0200 Subject: [PATCH 03/10] Allow export of the member number and update example export --- client/src/app/domain/models/users/user.export.ts | 1 + .../pages/accounts/export/csv-export-example.ts | 12 ++++++++---- .../pages/account-import/definitions/index.ts | 3 ++- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/client/src/app/domain/models/users/user.export.ts b/client/src/app/domain/models/users/user.export.ts index f55450a523..34295a9a60 100644 --- a/client/src/app/domain/models/users/user.export.ts +++ b/client/src/app/domain/models/users/user.export.ts @@ -10,4 +10,5 @@ export interface UserExport { gender?: string; default_vote_weight?: string | number; pronoun?: string; + member_number?: string; } diff --git a/client/src/app/site/pages/organization/pages/accounts/export/csv-export-example.ts b/client/src/app/site/pages/organization/pages/accounts/export/csv-export-example.ts index faa4b3bc43..9253868499 100644 --- a/client/src/app/site/pages/organization/pages/accounts/export/csv-export-example.ts +++ b/client/src/app/site/pages/organization/pages/accounts/export/csv-export-example.ts @@ -10,7 +10,8 @@ export const AccountCsvExportExample: UserExport[] = [ default_password: `initialPassword`, username: `mmustermann`, gender: `male`, - default_vote_weight: 1.0 + default_vote_weight: 1.0, + member_number: `123456` }, { first_name: `John`, @@ -20,18 +21,21 @@ export const AccountCsvExportExample: UserExport[] = [ email: `john.doe@email.com`, username: `jdoe`, gender: `diverse`, - default_vote_weight: 2.0 + default_vote_weight: 2.0, + member_number: `234` }, { first_name: `Julia`, last_name: `Bloggs`, username: `jbloggs`, gender: `female`, - default_vote_weight: 1.5 + default_vote_weight: 1.5, + member_number: `5678` }, { last_name: `Executive Board`, username: `executive`, - default_vote_weight: 2.5 + default_vote_weight: 2.5, + member_number: `6789` } ]; diff --git a/client/src/app/site/pages/organization/pages/accounts/pages/account-import/definitions/index.ts b/client/src/app/site/pages/organization/pages/accounts/pages/account-import/definitions/index.ts index fa1f9c6a3e..14ed912cd8 100644 --- a/client/src/app/site/pages/organization/pages/accounts/pages/account-import/definitions/index.ts +++ b/client/src/app/site/pages/organization/pages/accounts/pages/account-import/definitions/index.ts @@ -4,5 +4,6 @@ import { userHeadersAndVerboseNames } from 'src/app/domain/models/users/user.con export const accountHeadersAndVerboseNames: { [key in keyof User]?: string } = { ...userHeadersAndVerboseNames, - default_vote_weight: _(`Vote weight`) + default_vote_weight: _(`Vote weight`), + member_number: _(`Member number`) }; From 225f781fe080a3ca5fc255104dab4580df78260f Mon Sep 17 00:00:00 2001 From: Ludwig Reiter Date: Wed, 15 May 2024 07:47:21 +0200 Subject: [PATCH 04/10] Use middot --- .../components/account-list/account-list.component.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/src/app/site/pages/organization/pages/accounts/pages/account-list/components/account-list/account-list.component.html b/client/src/app/site/pages/organization/pages/accounts/pages/account-list/components/account-list/account-list.component.html index 5e376cddd8..6a947dda95 100644 --- a/client/src/app/site/pages/organization/pages/accounts/pages/account-list/components/account-list/account-list.component.html +++ b/client/src/app/site/pages/organization/pages/accounts/pages/account-list/components/account-list/account-list.component.html @@ -63,7 +63,7 @@

{{ 'Accounts' | translate }}

{{ user.saml_id || user.username }} - · {{ user.email }}  + · {{ user.email }}  · {{ user.member_number }}
From ed55d565159eb5141d61ee44f47f92c970608723 Mon Sep 17 00:00:00 2001 From: Ludwig Reiter Date: Thu, 16 May 2024 09:40:45 +0200 Subject: [PATCH 05/10] Remove not needed mat-error from member_number field --- .../components/user-detail-view/user-detail-view.component.html | 1 - 1 file changed, 1 deletion(-) diff --git a/client/src/app/site/modules/user-components/components/user-detail-view/user-detail-view.component.html b/client/src/app/site/modules/user-components/components/user-detail-view/user-detail-view.component.html index f3e4f3bc5b..02a00cb641 100644 --- a/client/src/app/site/modules/user-components/components/user-detail-view/user-detail-view.component.html +++ b/client/src/app/site/modules/user-components/components/user-detail-view/user-detail-view.component.html @@ -163,7 +163,6 @@

{{ 'Personal information' | translate }}

{{ 'Membership number' | translate }} - {{ 'Membership number must be unique' | translate }} From 971c07f39fa651c688a8eabc779ed128a1984af3 Mon Sep 17 00:00:00 2001 From: Ludwig Reiter Date: Thu, 16 May 2024 12:07:05 +0200 Subject: [PATCH 06/10] Add member number to participant export/import --- client/src/app/domain/models/users/user.constants.ts | 3 ++- .../export/participants-export-example.ts | 12 ++++++++---- .../participant-import.service.ts | 3 ++- .../pages/account-import/definitions/index.ts | 3 +-- 4 files changed, 13 insertions(+), 8 deletions(-) diff --git a/client/src/app/domain/models/users/user.constants.ts b/client/src/app/domain/models/users/user.constants.ts index 1b0a60cf69..dca1c1d2ee 100644 --- a/client/src/app/domain/models/users/user.constants.ts +++ b/client/src/app/domain/models/users/user.constants.ts @@ -13,5 +13,6 @@ export const userHeadersAndVerboseNames: { [key in keyof User]?: any } = { default_password: _(`Initial password`), is_active: _(`Active`), is_physical_person: _(`Natural person`), - saml_id: _(`SSO identification`) + saml_id: _(`SSO identification`), + member_number: _(`Member number`) }; diff --git a/client/src/app/site/pages/meetings/pages/participants/export/participants-export-example.ts b/client/src/app/site/pages/meetings/pages/participants/export/participants-export-example.ts index d40ce26a02..ad672ab298 100644 --- a/client/src/app/site/pages/meetings/pages/participants/export/participants-export-example.ts +++ b/client/src/app/site/pages/meetings/pages/participants/export/participants-export-example.ts @@ -13,7 +13,8 @@ export const participantsExportExample: any = [ pronoun: `Er`, default_structure_level: `Berlin`, default_vote_weight: 1.0, - group_ids: `Delegates, Staff` + group_ids: `Delegates, Staff`, + member_number: `123` }, { first_name: `John`, @@ -26,7 +27,8 @@ export const participantsExportExample: any = [ email: `john.doe@email.com`, username: `jdoe`, gender: `diverse`, - default_vote_weight: 2.0 + default_vote_weight: 2.0, + member_number: `135` }, { first_name: `Julia`, @@ -34,12 +36,14 @@ export const participantsExportExample: any = [ default_structure_level: `London`, username: `jbloggs`, gender: `female`, - default_vote_weight: 1.5 + default_vote_weight: 1.5, + member_number: `234` }, { last_name: `Executive Board`, is_present_in_meeting_ids: true, username: `executive`, - default_vote_weight: 2.5 + default_vote_weight: 2.5, + member_number: `55444` } ]; diff --git a/client/src/app/site/pages/meetings/pages/participants/pages/participant-import/services/participant-import.service/participant-import.service.ts b/client/src/app/site/pages/meetings/pages/participants/pages/participant-import/services/participant-import.service/participant-import.service.ts index 63230f11fe..7eb7ec1174 100644 --- a/client/src/app/site/pages/meetings/pages/participants/pages/participant-import/services/participant-import.service/participant-import.service.ts +++ b/client/src/app/site/pages/meetings/pages/participants/pages/participant-import/services/participant-import.service/participant-import.service.ts @@ -28,7 +28,8 @@ export class ParticipantImportService extends BaseBackendImportService { DuplicateImport: `Entry cannot be imported twice. This line will be ommitted`, ParsingErrors: `Some csv values could not be read correctly.`, FailedImport: `Imported user could not be imported.`, - vote_weight: `The vote weight has too many decimal places (max.: 6).` + vote_weight: `The vote weight has too many decimal places (max.: 6).`, + member_number: `The member number already exists in this meeting` }; public override readonly verboseSummaryTitles: { [title: string]: string } = { diff --git a/client/src/app/site/pages/organization/pages/accounts/pages/account-import/definitions/index.ts b/client/src/app/site/pages/organization/pages/accounts/pages/account-import/definitions/index.ts index 14ed912cd8..fa1f9c6a3e 100644 --- a/client/src/app/site/pages/organization/pages/accounts/pages/account-import/definitions/index.ts +++ b/client/src/app/site/pages/organization/pages/accounts/pages/account-import/definitions/index.ts @@ -4,6 +4,5 @@ import { userHeadersAndVerboseNames } from 'src/app/domain/models/users/user.con export const accountHeadersAndVerboseNames: { [key in keyof User]?: string } = { ...userHeadersAndVerboseNames, - default_vote_weight: _(`Vote weight`), - member_number: _(`Member number`) + default_vote_weight: _(`Vote weight`) }; From da6c2f30361802129cd6ffd9338a8c2348b58f3b Mon Sep 17 00:00:00 2001 From: Ludwig Reiter Date: Sat, 18 May 2024 08:40:43 +0200 Subject: [PATCH 07/10] Add member number filter to account list --- .../src/app/site/pages/meetings/view-models/view-user.ts | 4 ++++ .../accounts/services/common/account-filter.service.ts | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/client/src/app/site/pages/meetings/view-models/view-user.ts b/client/src/app/site/pages/meetings/view-models/view-user.ts index 2b18548750..574fe2e8a3 100644 --- a/client/src/app/site/pages/meetings/view-models/view-user.ts +++ b/client/src/app/site/pages/meetings/view-models/view-user.ts @@ -104,6 +104,10 @@ export class ViewUser extends BaseViewModel /* implements Searchable */ { return this.isPresentInMeeting(); } + public get hasMemberNumber(): boolean { + return !!this.member_number; + } + // Will be set by the repository public getName!: () => string; public getShortName!: () => string; diff --git a/client/src/app/site/pages/organization/pages/accounts/services/common/account-filter.service.ts b/client/src/app/site/pages/organization/pages/accounts/services/common/account-filter.service.ts index 2db87b1880..f54884bf39 100644 --- a/client/src/app/site/pages/organization/pages/accounts/services/common/account-filter.service.ts +++ b/client/src/app/site/pages/organization/pages/accounts/services/common/account-filter.service.ts @@ -164,6 +164,14 @@ export class AccountFilterService extends BaseFilterListService { label: this.translate.instant(`Same email`) } ] + }, + { + property: `hasMemberNumber`, + label: this.translate.instant(`Member number`), + options: [ + { condition: true, label: this.translate.instant(`Has a member number`) }, + { condition: [false, null], label: this.translate.instant(`Has no member number`) } + ] } ]; return staticFilterDefinitions.concat(nonStaticFilterDefinitions); From 7c560a667f699f9b7d081a4539dd83a5ceab8a73 Mon Sep 17 00:00:00 2001 From: Ludwig Reiter Date: Tue, 21 May 2024 10:28:15 +0200 Subject: [PATCH 08/10] Remove translate.instant from member number filter --- .../accounts/services/common/account-filter.service.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/client/src/app/site/pages/organization/pages/accounts/services/common/account-filter.service.ts b/client/src/app/site/pages/organization/pages/accounts/services/common/account-filter.service.ts index f54884bf39..3695514bf4 100644 --- a/client/src/app/site/pages/organization/pages/accounts/services/common/account-filter.service.ts +++ b/client/src/app/site/pages/organization/pages/accounts/services/common/account-filter.service.ts @@ -167,10 +167,10 @@ export class AccountFilterService extends BaseFilterListService { }, { property: `hasMemberNumber`, - label: this.translate.instant(`Member number`), + label: `Member number`, options: [ - { condition: true, label: this.translate.instant(`Has a member number`) }, - { condition: [false, null], label: this.translate.instant(`Has no member number`) } + { condition: true, label: `Has a member number` }, + { condition: [false, null], label: `Has no member number` } ] } ]; From 31d75b97632dd31f8bed333d53c6c857264df73e Mon Sep 17 00:00:00 2001 From: Ludwig Reiter Date: Wed, 29 May 2024 09:15:39 +0200 Subject: [PATCH 09/10] Update member_number payload if field is empty --- .../account-detail/account-detail.component.ts | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/client/src/app/site/pages/organization/pages/accounts/pages/account-detail/components/account-detail/account-detail.component.ts b/client/src/app/site/pages/organization/pages/accounts/pages/account-detail/components/account-detail/account-detail.component.ts index b0ffa9b6af..dbd0e017f2 100644 --- a/client/src/app/site/pages/organization/pages/accounts/pages/account-detail/components/account-detail/account-detail.component.ts +++ b/client/src/app/site/pages/organization/pages/accounts/pages/account-detail/components/account-detail/account-detail.component.ts @@ -279,13 +279,13 @@ export class AccountDetailComponent extends BaseComponent implements OnInit { } private async createUser(): Promise { - const payload = this.getPartialUserPayload(); + const payload = this.getPartialUserPayload(true); const identifiable = (await this.userController.create(payload))[0]; this.router.navigate([`..`, identifiable.id], { relativeTo: this.route }); } private async updateUser(): Promise { - const payload = this.getPartialUserPayload(); + const payload = this.getPartialUserPayload(false); if ( !( this.user.id === this.operator.operatorId && @@ -303,11 +303,18 @@ export class AccountDetailComponent extends BaseComponent implements OnInit { } } - private getPartialUserPayload(): any { + private getPartialUserPayload(isCreate: boolean): any { const payload = this.personalInfoFormValue; if (!this.operator.hasOrganizationPermissions(OML.can_manage_organization)) { payload[`committee_management_ids`] = undefined; } + if (payload.member_number === ``) { + if (isCreate) { + delete payload.member_number; + } else { + payload.member_number = null; + } + } return payload; } From ce1aaaefa99788ed42692a56988375a09addd6df Mon Sep 17 00:00:00 2001 From: Ludwig Reiter Date: Wed, 29 May 2024 10:40:50 +0200 Subject: [PATCH 10/10] Fix participant-detail --- .../participant-detail-view.component.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/client/src/app/site/pages/meetings/pages/participants/pages/participant-detail/components/participant-detail-view/participant-detail-view.component.ts b/client/src/app/site/pages/meetings/pages/participants/pages/participant-detail/components/participant-detail-view/participant-detail-view.component.ts index bf9135bea5..0a499dd587 100644 --- a/client/src/app/site/pages/meetings/pages/participants/pages/participant-detail/components/participant-detail-view/participant-detail-view.component.ts +++ b/client/src/app/site/pages/meetings/pages/participants/pages/participant-detail/components/participant-detail-view/participant-detail-view.component.ts @@ -340,6 +340,9 @@ export class ParticipantDetailViewComponent extends BaseMeetingComponent { private async createUser(): Promise { const partialUser = { ...this.personalInfoFormValue }; + if (partialUser.member_number === ``) { + delete partialUser.member_number; + } if (partialUser.is_present) { partialUser.is_present_in_meeting_ids = [this.activeMeetingId]; } @@ -367,6 +370,9 @@ export class ParticipantDetailViewComponent extends BaseMeetingComponent { .filter(id => !!id) : [] }; + if (payload.member_number === ``) { + payload.member_number = null; + } const title = _(`This action will remove you from one or more groups.`); const content = _( `This may diminish your ability to do things in this meeting and you may not be able to revert it by youself. Are you sure you want to do this?`