diff --git a/client/src/app/shared/models/users/user.ts b/client/src/app/shared/models/users/user.ts index aa2e17d15..75add5053 100644 --- a/client/src/app/shared/models/users/user.ts +++ b/client/src/app/shared/models/users/user.ts @@ -2,6 +2,11 @@ import { Searchable } from '../base/searchable'; import { SearchRepresentation } from '../../../core/services/search.service'; import { BaseModel } from '../base/base-model'; +/** + * Iterable pre selection of genders (sexes) + */ +export const genders = ['Female', 'Male', 'Diverse']; + /** * Representation of a user in contrast to the operator. * @ignore @@ -14,6 +19,7 @@ export class User extends BaseModel implements Searchable { public title: string; public first_name: string; public last_name: string; + public gender: string; public structure_level: string; public number: string; public about_me: string; diff --git a/client/src/app/site/agenda/components/speaker-list/speaker-list.component.html b/client/src/app/site/agenda/components/speaker-list/speaker-list.component.html index 77fd9058c..f21bdc378 100644 --- a/client/src/app/site/agenda/components/speaker-list/speaker-list.component.html +++ b/client/src/app/site/agenda/components/speaker-list/speaker-list.component.html @@ -4,9 +4,7 @@

List of speakers

@@ -68,6 +66,7 @@ {{ hasSpokenCount(item) + 1 }}. contribution + ({{ item.gender | translate }}) @@ -117,7 +116,6 @@ - @@ -166,7 +183,8 @@ matInput placeholder="{{ 'Username' | translate }}" formControlName="username" - [value]="user.username"/> + [value]="user.username" + /> @@ -177,7 +195,8 @@ matInput placeholder="{{ 'Comment' | translate }}" formControlName="comment" - [value]="user.comment"/> + [value]="user.comment" + /> Only for internal notes. @@ -187,7 +206,8 @@ + [value]="user.is_present" + > Is present @@ -199,7 +219,8 @@ matTooltip="{{ 'Designates whether this user should be treated as active. Unselect this instead of deleting the account.' | translate - }}"> + }}" + > Is active @@ -207,7 +228,8 @@ + matTooltip="{{ 'Designates whether this user should be treated as a committee.' | translate }}" + > Is a committee diff --git a/client/src/app/site/users/components/user-detail/user-detail.component.ts b/client/src/app/site/users/components/user-detail/user-detail.component.ts index fa3c3a7fe..23e0c4c1a 100644 --- a/client/src/app/site/users/components/user-detail/user-detail.component.ts +++ b/client/src/app/site/users/components/user-detail/user-detail.component.ts @@ -1,16 +1,18 @@ import { Component, OnInit } from '@angular/core'; import { ActivatedRoute, Router } from '@angular/router'; import { FormGroup, FormBuilder, Validators } from '@angular/forms'; +import { MatSnackBar } from '@angular/material'; +import { Title } from '@angular/platform-browser'; +import { TranslateService } from '@ngx-translate/core'; + +import { genders } from 'app/shared/models/users/user'; import { ViewUser } from '../../models/view-user'; import { UserRepositoryService } from '../../services/user-repository.service'; import { Group } from '../../../../shared/models/users/group'; import { DataStoreService } from '../../../../core/services/data-store.service'; import { OperatorService } from '../../../../core/services/operator.service'; import { BaseViewComponent } from '../../../base/base-view'; -import { TranslateService } from '@ngx-translate/core'; -import { MatSnackBar } from '@angular/material'; -import { Title } from '@angular/platform-browser'; import { PromptService } from '../../../../core/services/prompt.service'; /** @@ -62,6 +64,11 @@ export class UserDetailComponent extends BaseViewComponent implements OnInit { */ public groups: Group[]; + /** + * Hold the list of genders (sexes) publicly to dynamically iterate in the view + */ + public genderList = genders; + /** * Constructor for user * @@ -114,6 +121,7 @@ export class UserDetailComponent extends BaseViewComponent implements OnInit { /** * Checks, if the given user id matches with the operator ones. + * * @param userId The id to check, if it's the operator * @returns If the user is the operator */ @@ -178,6 +186,7 @@ export class UserDetailComponent extends BaseViewComponent implements OnInit { title: [''], first_name: [''], last_name: [''], + gender: [''], structure_level: [''], number: [''], about_me: [''], @@ -226,6 +235,7 @@ export class UserDetailComponent extends BaseViewComponent implements OnInit { this.personalInfoForm.get('first_name'), this.personalInfoForm.get('last_name'), this.personalInfoForm.get('email'), + this.personalInfoForm.get('gender'), this.personalInfoForm.get('structure_level'), this.personalInfoForm.get('number'), this.personalInfoForm.get('groups_id'), @@ -241,6 +251,7 @@ export class UserDetailComponent extends BaseViewComponent implements OnInit { allowedFormFields.push( this.personalInfoForm.get('username'), this.personalInfoForm.get('email'), + this.personalInfoForm.get('gender'), this.personalInfoForm.get('about_me') ); } diff --git a/client/src/app/site/users/models/view-user.ts b/client/src/app/site/users/models/view-user.ts index 12529b263..17fe55363 100644 --- a/client/src/app/site/users/models/view-user.ts +++ b/client/src/app/site/users/models/view-user.ts @@ -47,6 +47,10 @@ export class ViewUser extends BaseProjectableModel { return this.user ? this.user.email : null; } + public get gender(): string { + return this.user ? this.user.gender : null; + } + public get structure_level(): string { return this.user ? this.user.structure_level : null; } diff --git a/client/src/app/site/users/services/user-repository.service.ts b/client/src/app/site/users/services/user-repository.service.ts index b56925d2a..a19175259 100644 --- a/client/src/app/site/users/services/user-repository.service.ts +++ b/client/src/app/site/users/services/user-repository.service.ts @@ -64,6 +64,12 @@ export class UserRepositoryService extends BaseRepository { updateUser.username = viewUser.username; } + // if the update user does not have a gender-field, send gender as empty string. + // This allow to delete a previously selected gender + if (!updateUser.gender) { + updateUser.gender = ''; + } + return await this.dataSend.updateModel(updateUser); }