Merge pull request #6050 from tsiegleauq/assignment-analog-general-selection
Add General x to analog polls
This commit is contained in:
commit
7cf22b86ab
@ -49,7 +49,7 @@
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr *ngIf="isPercentBaseEntitled" class="entitled-users-row">
|
||||
<tr *ngIf="isPercentBaseEntitled && poll.entitled_users_at_stop" class="entitled-users-row">
|
||||
<td>{{ 'Entitled users' | translate }}</td>
|
||||
<td class="result">
|
||||
<div class="single-result">
|
||||
|
@ -149,7 +149,7 @@
|
||||
<os-sorting-list
|
||||
[input]="assignment.assignment_related_users"
|
||||
[live]="true"
|
||||
[count]="assignment.number_poll_candidates"
|
||||
[count]="true"
|
||||
[enable]="hasPerms('manage')"
|
||||
(sortEvent)="onSortingChange($event)"
|
||||
>
|
||||
|
@ -12,12 +12,12 @@
|
||||
<!-- Candidates Values -->
|
||||
<div formGroupName="options">
|
||||
<div *ngFor="let option of options" class="votes-grid">
|
||||
<div>
|
||||
<div class="candidate">
|
||||
<span *ngIf="option.user">{{ option.user.getFullName() }}</span>
|
||||
<i *ngIf="!option.user">{{ unknownUserLabel | translate }}</i>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<div class="amount">
|
||||
<div *ngFor="let value of analogPollValues" [formGroupName]="option.user_id">
|
||||
<os-check-input
|
||||
[placeholder]="voteValueVerbose[value] | translate"
|
||||
@ -31,21 +31,10 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Sum Values -->
|
||||
<div *ngFor="let value of sumValues" class="votes-grid">
|
||||
<div></div>
|
||||
<os-check-input
|
||||
[placeholder]="generalValueVerbose[value] | translate"
|
||||
[checkboxValue]="-1"
|
||||
inputType="number"
|
||||
[checkboxLabel]="'majority' | translate"
|
||||
[formControlName]="value"
|
||||
></os-check-input>
|
||||
</div>
|
||||
|
||||
<!-- Global Values -->
|
||||
<div>
|
||||
<div class="votes-grid">
|
||||
<os-check-input
|
||||
class="amount"
|
||||
*ngIf="globalYesEnabled"
|
||||
placeholder="{{ PollPropertyVerbose.global_yes | translate }}"
|
||||
[checkboxValue]="-1"
|
||||
@ -53,8 +42,11 @@
|
||||
[checkboxLabel]="'majority' | translate"
|
||||
formControlName="amount_global_yes"
|
||||
></os-check-input>
|
||||
</div>
|
||||
|
||||
<div class="votes-grid">
|
||||
<os-check-input
|
||||
class="amount"
|
||||
*ngIf="globalNoEnabled"
|
||||
placeholder="{{ PollPropertyVerbose.global_no | translate }}"
|
||||
[checkboxValue]="-1"
|
||||
@ -62,8 +54,11 @@
|
||||
[checkboxLabel]="'majority' | translate"
|
||||
formControlName="amount_global_no"
|
||||
></os-check-input>
|
||||
</div>
|
||||
|
||||
<div class="votes-grid">
|
||||
<os-check-input
|
||||
class="amount"
|
||||
*ngIf="globalAbstainEnabled"
|
||||
placeholder="{{ PollPropertyVerbose.global_abstain | translate }}"
|
||||
[checkboxValue]="-1"
|
||||
@ -72,6 +67,18 @@
|
||||
formControlName="amount_global_abstain"
|
||||
></os-check-input>
|
||||
</div>
|
||||
|
||||
<!-- Sum Values -->
|
||||
<div *ngFor="let value of sumValues" class="votes-grid">
|
||||
<os-check-input
|
||||
class="amount"
|
||||
[placeholder]="generalValueVerbose[value] | translate"
|
||||
[checkboxValue]="-1"
|
||||
inputType="number"
|
||||
[checkboxLabel]="'majority' | translate"
|
||||
[formControlName]="value"
|
||||
></os-check-input>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<!-- Publish Check -->
|
||||
|
@ -4,6 +4,16 @@
|
||||
margin-bottom: 10px;
|
||||
align-items: baseline;
|
||||
grid-template-columns: auto max-content;
|
||||
grid-template-areas: 'candidate amount';
|
||||
|
||||
.candidate {
|
||||
grid-area: candidate;
|
||||
}
|
||||
|
||||
.amount {
|
||||
grid-area: amount;
|
||||
}
|
||||
|
||||
.mat-form-field {
|
||||
width: 100%;
|
||||
}
|
||||
|
@ -228,7 +228,7 @@ export class AssignmentPollService extends PollService {
|
||||
totalByBase = poll.votesvalid;
|
||||
break;
|
||||
case AssignmentPollPercentBase.Entitled:
|
||||
totalByBase = poll.entitled_users_at_stop.length;
|
||||
totalByBase = poll?.entitled_users_at_stop?.length || 0;
|
||||
break;
|
||||
case AssignmentPollPercentBase.Cast:
|
||||
totalByBase = poll.votescast;
|
||||
|
@ -59,7 +59,7 @@
|
||||
|
||||
<ng-container formGroupName="votes_amount" *ngIf="isEVotingSelected">
|
||||
<!-- Min Amount of Votes -->
|
||||
<mat-form-field *ngIf="showAmountAndGlobal(data)">
|
||||
<mat-form-field *ngIf="showMinMaxVotes(data)">
|
||||
<input
|
||||
type="number"
|
||||
matInput
|
||||
@ -75,7 +75,7 @@
|
||||
</mat-form-field>
|
||||
|
||||
<!-- Max Amount of Votes -->
|
||||
<mat-form-field *ngIf="showAmountAndGlobal(data)">
|
||||
<mat-form-field *ngIf="showMinMaxVotes(data)">
|
||||
<input
|
||||
type="number"
|
||||
matInput
|
||||
@ -89,7 +89,7 @@
|
||||
</div>
|
||||
|
||||
<!-- Amount of Votes and global options -->
|
||||
<div class="global-options" *ngIf="isEVotingSelected && showAmountAndGlobal(data)">
|
||||
<div class="global-options">
|
||||
<mat-checkbox formControlName="global_yes">
|
||||
{{ PollPropertyVerbose.global_yes | translate }}
|
||||
</mat-checkbox>
|
||||
|
@ -215,7 +215,7 @@ export class PollFormComponent<T extends ViewBasePoll, S extends PollService>
|
||||
this.pollTypeControl.disable();
|
||||
}
|
||||
|
||||
public showAmountAndGlobal(data: any): boolean {
|
||||
public showMinMaxVotes(data: any): boolean {
|
||||
const selectedPollMethod: AssignmentPollMethod = this.pollMethodControl.value;
|
||||
return (selectedPollMethod === 'Y' || selectedPollMethod === 'N') && (!data || !data.state || data.isCreated);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user