Add more dynamic vote delegations to user list

The user list now shows vote delegations from and to in every form and
preview
This commit is contained in:
Sean 2020-12-15 16:40:27 +01:00
parent acd33b8207
commit cb73f52345
4 changed files with 37 additions and 8 deletions

View File

@ -174,6 +174,17 @@
[inputListValues]="users"
></os-search-value-selector>
</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 *ngIf="isAllowed('manage')">

View File

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

View File

@ -48,10 +48,7 @@
<mat-icon matTooltip="{{ 'Is committee' | translate }}" *ngIf="user.is_committee">
account_balance
</mat-icon>
<mat-icon
matTooltip="{{ 'Inactive' | translate }}"
*ngIf="!user.is_active && canSeeExtra"
>
<mat-icon matTooltip="{{ 'Inactive' | translate }}" *ngIf="!user.is_active && canSeeExtra">
block
</mat-icon>
</div>
@ -80,9 +77,13 @@
<os-icon-container icon="perm_identity">{{ user.number }}</os-icon-container>
</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>
</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>
@ -289,6 +290,15 @@
[inputListValues]="users"
></os-search-value-selector>
</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-select placeholder="{{ 'Gender' | translate }}" [(ngModel)]="infoDialog.gender">
<mat-option>-</mat-option>
@ -320,6 +330,7 @@
[mat-dialog-close]="{
groups_id: infoDialog.groups_id,
vote_delegated_from_users_id: infoDialog.vote_delegated_from_users_id,
vote_delegated_to_id: infoDialog.vote_delegated_to_id,
gender: infoDialog.gender,
number: infoDialog.number,
structure_level: infoDialog.structure_level

View File

@ -58,9 +58,14 @@ interface InfoDialog {
structure_level: string;
/**
* Transfer voting rights
* Transfer voting rights from
*/
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,
structure_level: user.structure_level,
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);
@ -277,7 +283,7 @@ export class UserListComponent extends BaseListViewComponent<ViewUser> implement
dialogRef.afterClosed().subscribe(result => {
if (result) {
this.repo.update(result, user);
this.repo.update(result, user).catch(this.raiseError);
}
});
}