finished approver assign
This commit is contained in:
parent
b52ce1499f
commit
858d0bd511
@ -30,7 +30,7 @@
|
||||
|
||||
<redaction-circle-button
|
||||
(action)="assign($event)"
|
||||
*ngIf="canAssign"
|
||||
*ngIf="canAssign && screen === 'project-overview'"
|
||||
icon="red:assign"
|
||||
[tooltip]="assignTooltip"
|
||||
[tooltipPosition]="tooltipPosition"
|
||||
@ -39,7 +39,7 @@
|
||||
|
||||
<redaction-circle-button
|
||||
(action)="assignToMe($event)"
|
||||
*ngIf="canAssignToSelf"
|
||||
*ngIf="canAssignToSelf && screen === 'project-overview'"
|
||||
icon="red:assign-me"
|
||||
tooltip="project-overview.assign-me"
|
||||
[tooltipPosition]="tooltipPosition"
|
||||
@ -80,7 +80,7 @@
|
||||
<!-- Back to review -->
|
||||
<redaction-circle-button
|
||||
(action)="setFileUnderReview($event, true)"
|
||||
*ngIf="canUndoApproval"
|
||||
*ngIf="canSetToUnderReview"
|
||||
[tooltipPosition]="tooltipPosition"
|
||||
[type]="buttonType"
|
||||
icon="red:undo"
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
|
||||
<form (submit)="saveUsers()" [formGroup]="usersForm">
|
||||
<div class="dialog-content">
|
||||
<div class="red-input-group w-300">
|
||||
<div class="red-input-group w-300 required">
|
||||
<mat-form-field floatLabel="always">
|
||||
<mat-label>{{ 'assign-' + data.mode + '-owner.dialog.single-user' | translate }}</mat-label>
|
||||
<mat-select formControlName="singleUser">
|
||||
|
||||
@ -4,7 +4,7 @@ import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
|
||||
import { AppStateService } from '@state/app-state.service';
|
||||
import { UserService } from '@services/user.service';
|
||||
import { NotificationService, NotificationType } from '@services/notification.service';
|
||||
import { FormBuilder, FormGroup } from '@angular/forms';
|
||||
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
|
||||
import { FileStatusWrapper } from '@models/file/file-status.wrapper';
|
||||
import { ProjectWrapper } from '@state/model/project.wrapper';
|
||||
|
||||
@ -105,9 +105,12 @@ export class AssignReviewerApproverDialogComponent {
|
||||
uniqueReviewers.add(file.currentReviewer);
|
||||
}
|
||||
}
|
||||
const singleUser = uniqueReviewers.size === 1 ? uniqueReviewers.values().next().value : this.userService.userId;
|
||||
let singleUser = uniqueReviewers.size === 1 ? uniqueReviewers.values().next().value : this.userService.userId;
|
||||
|
||||
singleUser = this.singleUsersSelectOptions.indexOf(singleUser) >= 0 ? singleUser : this.singleUsersSelectOptions[0];
|
||||
|
||||
this.usersForm = this._formBuilder.group({
|
||||
singleUser: [singleUser]
|
||||
singleUser: [singleUser, Validators.required]
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -79,20 +79,20 @@
|
||||
size="small"
|
||||
></redaction-initials-avatar>
|
||||
</mat-select-trigger>
|
||||
<mat-option *ngFor="let reviewerId of this.appStateService.activeProject.memberIds" [value]="reviewerId">
|
||||
<redaction-initials-avatar [userId]="reviewerId" [withName]="true" size="small"></redaction-initials-avatar>
|
||||
<mat-option *ngFor="let userId of singleUsersSelectOptions" [value]="userId">
|
||||
<redaction-initials-avatar [userId]="userId" [withName]="true" size="small"></redaction-initials-avatar>
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
</div>
|
||||
</form>
|
||||
</ng-container>
|
||||
|
||||
<div *ngIf="permissionsService.canAssignUser()" class="assign-actions-wrapper">
|
||||
<div *ngIf="permissionsService.canAssignUser() || permissionsService.canAssignToSelf()" class="assign-actions-wrapper">
|
||||
<redaction-circle-button
|
||||
(action)="editingReviewer = true"
|
||||
*ngIf="!editingReviewer && permissionsService.canAssignUser() && appStateService.activeFile.currentReviewer"
|
||||
icon="red:edit"
|
||||
tooltip="file-preview.assign-reviewer"
|
||||
[tooltip]="assignTooltip"
|
||||
tooltipPosition="below"
|
||||
>
|
||||
</redaction-circle-button>
|
||||
|
||||
@ -90,6 +90,14 @@ export class FilePreviewScreenComponent implements OnInit, OnDestroy, OnAttach,
|
||||
});
|
||||
}
|
||||
|
||||
get singleUsersSelectOptions() {
|
||||
return this.appStateService.activeFile?.isUnderApproval ? this.appStateService.activeProject.approverIds : this.appStateService.activeProject.memberIds;
|
||||
}
|
||||
|
||||
get assignTooltip() {
|
||||
return this.appStateService.activeFile.isUnderApproval ? 'project-overview.assign-approver' : 'project-overview.assign-reviewer';
|
||||
}
|
||||
|
||||
get annotations(): AnnotationWrapper[] {
|
||||
return this.annotationData ? this.annotationData.visibleAnnotations : [];
|
||||
}
|
||||
@ -341,6 +349,8 @@ export class FilePreviewScreenComponent implements OnInit, OnDestroy, OnAttach,
|
||||
}
|
||||
|
||||
async fileActionPerformed(action: string) {
|
||||
this.editingReviewer = false;
|
||||
|
||||
switch (action) {
|
||||
case 'delete':
|
||||
await this._router.navigate([`/main/projects/${this.projectId}`]);
|
||||
|
||||
@ -107,7 +107,7 @@ export class PermissionsService {
|
||||
|
||||
const precondition = this.isProjectMember() && !fileStatus.isProcessing && !fileStatus.isError && !fileStatus.isExcluded && !fileStatus.isApproved;
|
||||
if (precondition) {
|
||||
if (fileStatus.isUnassigned && !this.isApprover()) {
|
||||
if ((fileStatus.isUnassigned || fileStatus.isUnderReview) && !this.isApprover()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -122,7 +122,9 @@ export class PermissionsService {
|
||||
return false;
|
||||
}
|
||||
|
||||
const precondition = this.isProjectMember() && !fileStatus.isProcessing && !fileStatus.isError && !fileStatus.isExcluded && !fileStatus.isApproved;
|
||||
const precondition =
|
||||
this.isProjectMember() && !fileStatus.isProcessing && !fileStatus.isError && !fileStatus.isExcluded && !fileStatus.isApproved && this.isApprover();
|
||||
|
||||
if (precondition) {
|
||||
if ((fileStatus.isUnassigned || fileStatus.isUnderReview) && this._appStateService.activeProject.hasMoreThanOneReviewer) {
|
||||
return true;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user