Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add member number #3654

Merged
merged 10 commits into from
May 29, 2024
3 changes: 2 additions & 1 deletion client/src/app/domain/models/users/user.constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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`)
};
1 change: 1 addition & 0 deletions client/src/app/domain/models/users/user.export.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ export interface UserExport {
gender?: string;
default_vote_weight?: string | number;
pronoun?: string;
member_number?: string;
}
2 changes: 2 additions & 0 deletions client/src/app/domain/models/users/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export class User extends BaseDecimalModel<User> {
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)[];
Expand Down Expand Up @@ -64,6 +65,7 @@ export class User extends BaseDecimalModel<User> {
`id`,
`username`,
`saml_id`,
`member_number`,
`pronoun`,
`title`,
`first_name`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,8 @@ export class UserRepositoryService extends BaseRepository<ViewUser, User> {
`is_physical_person`,
`is_active`,
`meeting_ids`,
`saml_id`
`saml_id`,
`member_number`
];

const filterableListFields: TypedFieldset<User> = listFields.concat([
Expand Down Expand Up @@ -250,6 +251,7 @@ export class UserRepositoryService extends BaseRepository<ViewUser, User> {
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,
Expand All @@ -263,7 +265,7 @@ export class UserRepositoryService extends BaseRepository<ViewUser, User> {
return partialPayload;
}

public getTitle = (viewUser: ViewUser) => this.getFullName(viewUser);
public getTitle = (viewUser: ViewUser): string => this.getFullName(viewUser);

/**
* getter for the name
Expand Down Expand Up @@ -525,7 +527,8 @@ export class UserRepositoryService extends BaseRepository<ViewUser, User> {
`comment`,
`about_me`,
`number`,
`structure_level`
`structure_level`,
`member_number`
];
return fields.includes(field);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,13 @@ <h2>{{ 'Personal information' | translate }}</h2>
</mat-form-field>
</div>

<div *ngIf="isAllowed('update')">
<mat-form-field class="width-16p force-min-width">
<mat-label>{{ 'Membership number' | translate }}</mat-label>
<input type="text" matInput formControlName="member_number" />
</mat-form-field>
</div>

<div *ngIf="isAllowed('seeName')">
<mat-checkbox formControlName="is_active" *ngIf="!isSelf">{{ 'active' | translate }}</mat-checkbox>
<mat-checkbox formControlName="is_physical_person">{{ 'natural person' | translate }}</mat-checkbox>
Expand Down Expand Up @@ -223,6 +230,12 @@ <h4>{{ 'Initial password' | translate }}</h4>
<span>{{ user.default_password }}</span>
</div>

<!-- Membership number-->
<div *ngIf="user.member_number">
<h4>{{ 'Membership number' | translate }}</h4>
<span>{{ user.member_number }}</span>
</div>

<!-- SAML id -->
<div *ngIf="user.saml_id">
<h4>{{ 'SSO Identification' | translate }}</h4>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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`,
Expand All @@ -26,20 +27,23 @@ export const participantsExportExample: any = [
email: `[email protected]`,
username: `jdoe`,
gender: `diverse`,
default_vote_weight: 2.0
default_vote_weight: 2.0,
member_number: `135`
},
{
first_name: `Julia`,
last_name: `Bloggs`,
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`
}
];
Original file line number Diff line number Diff line change
Expand Up @@ -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 } = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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`,
Expand All @@ -20,18 +21,21 @@ export const AccountCsvExportExample: UserExport[] = [
email: `[email protected]`,
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`
}
];
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ <h2>{{ 'Accounts' | translate }}</h2>
</div>
<div class="meta-info user-subtitle ellipsis-overflow">
{{ user.saml_id || user.username }}
<ng-container *ngIf="user.email">· {{ user.email }}</ng-container>
<ng-container *ngIf="user.email">&middot; {{ user.email }}&nbsp;</ng-container>
<ng-container *ngIf="user.member_number">&middot; {{ user.member_number }}</ng-container>
</div>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ import { AccountListServiceModule } from '../account-list-service.module';
})
export class AccountListSearchService extends ListSearchService<ViewUser> {
public constructor() {
super([`short_name`, `username`, `email`, `saml_id`], []);
super([`short_name`, `username`, `email`, `saml_id`, `member_number`], []);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export class AccountSortService extends BaseSortListService<ViewUser> {
{ 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`) },
Expand Down
Loading