Merge pull request #5775 from tsiegleauq/more-powerful-vote-delegations

Add more dynamic vote delegations to user list
This commit is contained in:
Emanuel Schütze 2020-12-15 17:35:01 +01:00 committed by GitHub
commit 222a2ea581
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 37 additions and 8 deletions

View File

@ -174,6 +174,17 @@
[inputListValues]="users" [inputListValues]="users"
></os-search-value-selector> ></os-search-value-selector>
</mat-form-field> </mat-form-field>
<!-- Delegate Vote -->
<mat-form-field>
<os-search-value-selector
formControlName="vote_delegated_to_id"
[multiple]="false"
[includeNone]="true"
placeholder="{{ 'Voting right delegated to (proxy)' | translate }}"
[inputListValues]="users"
></os-search-value-selector>
</mat-form-field>
</div> </div>
<div *ngIf="isAllowed('manage')"> <div *ngIf="isAllowed('manage')">

View File

@ -177,6 +177,7 @@ export class UserDetailComponent extends BaseViewComponentDirective implements O
about_me: [''], about_me: [''],
groups_id: [''], groups_id: [''],
vote_delegated_from_users_id: [''], vote_delegated_from_users_id: [''],
vote_delegated_to_id: [''],
is_present: [true], is_present: [true],
is_committee: [false], is_committee: [false],
email: ['', Validators.email], email: ['', Validators.email],

View File

@ -48,10 +48,7 @@
<mat-icon matTooltip="{{ 'Is committee' | translate }}" *ngIf="user.is_committee"> <mat-icon matTooltip="{{ 'Is committee' | translate }}" *ngIf="user.is_committee">
account_balance account_balance
</mat-icon> </mat-icon>
<mat-icon <mat-icon matTooltip="{{ 'Inactive' | translate }}" *ngIf="!user.is_active && canSeeExtra">
matTooltip="{{ 'Inactive' | translate }}"
*ngIf="!user.is_active && canSeeExtra"
>
block block
</mat-icon> </mat-icon>
</div> </div>
@ -80,9 +77,13 @@
<os-icon-container icon="perm_identity">{{ user.number }}</os-icon-container> <os-icon-container icon="perm_identity">{{ user.number }}</os-icon-container>
</div> </div>
<div *ngIf="user.vote_delegated_to_id" class="spacer-top-5"> <div *ngIf="user.vote_delegated_to_id" class="spacer-top-5" matTooltip="{{ 'Voting right delegated to (proxy)' | translate }}">
<os-icon-container icon="forward" noWrap="true">{{ user.voteDelegatedTo }}</os-icon-container> <os-icon-container icon="forward" noWrap="true">{{ user.voteDelegatedTo }}</os-icon-container>
</div> </div>
<div *ngIf="user.vote_delegated_from_users_id?.length" class="spacer-top-5" matTooltip="{{ 'Delegation of vote (principals)' | translate }}">
<os-icon-container icon="undo" noWrap="true">{{ user.voteDelegationsFrom }}</os-icon-container>
</div>
</div> </div>
</div> </div>
@ -289,6 +290,15 @@
[inputListValues]="users" [inputListValues]="users"
></os-search-value-selector> ></os-search-value-selector>
</mat-form-field> </mat-form-field>
<mat-form-field>
<os-search-value-selector
[(ngModel)]="infoDialog.vote_delegated_to_id"
[multiple]="false"
[includeNone]="true"
placeholder="{{ 'Voting right delegated to (proxy)' | translate }}"
[inputListValues]="users"
></os-search-value-selector>
</mat-form-field>
<mat-form-field> <mat-form-field>
<mat-select placeholder="{{ 'Gender' | translate }}" [(ngModel)]="infoDialog.gender"> <mat-select placeholder="{{ 'Gender' | translate }}" [(ngModel)]="infoDialog.gender">
<mat-option>-</mat-option> <mat-option>-</mat-option>
@ -320,6 +330,7 @@
[mat-dialog-close]="{ [mat-dialog-close]="{
groups_id: infoDialog.groups_id, groups_id: infoDialog.groups_id,
vote_delegated_from_users_id: infoDialog.vote_delegated_from_users_id, vote_delegated_from_users_id: infoDialog.vote_delegated_from_users_id,
vote_delegated_to_id: infoDialog.vote_delegated_to_id,
gender: infoDialog.gender, gender: infoDialog.gender,
number: infoDialog.number, number: infoDialog.number,
structure_level: infoDialog.structure_level structure_level: infoDialog.structure_level

View File

@ -58,9 +58,14 @@ interface InfoDialog {
structure_level: string; structure_level: string;
/** /**
* Transfer voting rights * Transfer voting rights from
*/ */
vote_delegated_from_users_id: number[]; vote_delegated_from_users_id: number[];
/**
* Transfer voting rights to
*/
vote_delegated_to_id: number;
} }
/** /**
@ -264,7 +269,8 @@ export class UserListComponent extends BaseListViewComponent<ViewUser> implement
gender: user.gender, gender: user.gender,
structure_level: user.structure_level, structure_level: user.structure_level,
number: user.number, number: user.number,
vote_delegated_from_users_id: user.vote_delegated_from_users_id vote_delegated_from_users_id: user.vote_delegated_from_users_id,
vote_delegated_to_id: user.vote_delegated_to_id
}; };
const dialogRef = this.dialog.open(this.userInfoDialog, infoDialogSettings); const dialogRef = this.dialog.open(this.userInfoDialog, infoDialogSettings);
@ -277,7 +283,7 @@ export class UserListComponent extends BaseListViewComponent<ViewUser> implement
dialogRef.afterClosed().subscribe(result => { dialogRef.afterClosed().subscribe(result => {
if (result) { if (result) {
this.repo.update(result, user); this.repo.update(result, user).catch(this.raiseError);
} }
}); });
} }