Pull request #198: Updates

Merge in RED/ui from updates to master

* commit '8d66627dfc72f55672f08959e72c28eade5fc9c9':
  Fix
  RED-1444
  RED-1467
  RED-1474
This commit is contained in:
Adina Teudan 2021-06-03 13:55:38 +02:00
commit 276d3d7099
13 changed files with 72 additions and 32 deletions

View File

@ -49,6 +49,10 @@
></textarea>
</div>
<mat-checkbox class="watermark" color="primary" formControlName="watermarkEnabled">
{{ 'add-dossier-dialog.form.watermark' | translate }}
</mat-checkbox>
<div class="due-date">
<mat-checkbox
(change)="hasDueDate = !hasDueDate"

View File

@ -1,7 +1,11 @@
@import '../../../../../assets/styles/red-variables';
.watermark {
margin-top: 24px;
}
.due-date {
margin-top: 16px;
margin-top: 8px;
min-height: 34px;
display: flex;
flex-direction: row;

View File

@ -23,26 +23,32 @@ export class AddDossierDialogComponent {
public dialogRef: MatDialogRef<AddDossierDialogComponent>
) {
this._filterInvalidDossierTemplates();
this.dossierForm = this._formBuilder.group({
dossierName: [null, Validators.required],
dossierTemplateId: [null, Validators.required],
downloadFileTypes: [null],
reportTypes: [null, Validators.required],
description: [null],
dueDate: [null]
});
this.dossierForm = this._formBuilder.group(
{
dossierName: [null, Validators.required],
dossierTemplateId: [null, Validators.required],
downloadFileTypes: [null],
reportTypes: [null],
description: [null],
dueDate: [null],
watermarkEnabled: [true]
},
{
validators: control =>
control.value.reportTypes?.length > 0 ||
control.value.downloadFileTypes?.length > 0
? null
: { downloadPackage: true }
}
);
}
get reportTypesLength() {
return this.dossierForm.controls['reportTypes']?.value?.length
? this.dossierForm.controls['reportTypes'].value.length
: 0;
return this.dossierForm.controls['reportTypes']?.value?.length || 0;
}
get downloadFileTypesLength() {
return this.dossierForm.controls['downloadFileTypes']?.value?.length
? this.dossierForm.controls['downloadFileTypes'].value.length
: 0;
return this.dossierForm.controls['downloadFileTypes']?.value?.length || 0;
}
get disabled() {
@ -109,7 +115,8 @@ export class AddDossierDialogComponent {
dueDate: this.hasDueDate ? this.dossierForm.get('dueDate').value : undefined,
dossierTemplateId: this.dossierForm.get('dossierTemplateId').value,
downloadFileTypes: this.dossierForm.get('downloadFileTypes').value,
reportTypes: this.dossierForm.get('reportTypes').value
reportTypes: this.dossierForm.get('reportTypes').value,
watermarkEnabled: this.dossierForm.get('watermarkEnabled').value
};
}
}

View File

@ -1,6 +1,6 @@
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
import { DossierTemplateModel } from '@redaction/red-ui-http';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { FormBuilder, FormGroup } from '@angular/forms';
import { AppStateService } from '../../../../../state/app-state.service';
import { DossierWrapper } from '../../../../../state/model/dossier.wrapper';
import { EditDossierSectionInterface } from '../edit-dossier-section.interface';
@ -25,15 +25,11 @@ export class EditDossierDownloadPackageComponent implements OnInit, EditDossierS
) {}
get reportTypesLength() {
return this.dossierForm.controls['reportTypes']?.value?.length
? this.dossierForm.controls['reportTypes'].value.length
: 0;
return this.dossierForm.controls['reportTypes']?.value?.length || 0;
}
get downloadFileTypesLength() {
return this.dossierForm.controls['downloadFileTypes']?.value?.length
? this.dossierForm.controls['downloadFileTypes'].value.length
: 0;
return this.dossierForm.controls['downloadFileTypes']?.value?.length || 0;
}
get changed() {
@ -62,10 +58,19 @@ export class EditDossierDownloadPackageComponent implements OnInit, EditDossierS
}
ngOnInit() {
this.dossierForm = this._formBuilder.group({
reportTypes: [this.dossierWrapper.dossier.reportTypes, Validators.required],
downloadFileTypes: [this.dossierWrapper.dossier.downloadFileTypes]
});
this.dossierForm = this._formBuilder.group(
{
reportTypes: [this.dossierWrapper.dossier.reportTypes],
downloadFileTypes: [this.dossierWrapper.dossier.downloadFileTypes]
},
{
validators: control =>
control.value.reportTypes?.length > 0 ||
control.value.downloadFileTypes?.length > 0
? null
: { downloadPackage: true }
}
);
}
async save() {

View File

@ -45,6 +45,10 @@
></textarea>
</div>
<mat-checkbox class="watermark" color="primary" formControlName="watermarkEnabled">
{{ 'edit-dossier-dialog.general-info.form.watermark' | translate }}
</mat-checkbox>
<div class="due-date">
<mat-checkbox
(change)="hasDueDate = !hasDueDate"

View File

@ -1,7 +1,11 @@
@import '../../../../../../assets/styles/red-variables';
.watermark {
margin-top: 24px;
}
.due-date {
margin-top: 16px;
margin-top: 8px;
min-height: 34px;
display: flex;
flex-direction: row;

View File

@ -67,7 +67,8 @@ export class EditDossierGeneralInfoComponent implements OnInit, EditDossierSecti
Validators.required
],
description: [this.dossierWrapper.description],
dueDate: [this.dossierWrapper.dueDate]
dueDate: [this.dossierWrapper.dueDate],
watermarkEnabled: [this.dossierWrapper.watermarkEnabled]
});
this.hasDueDate = !!this.dossierWrapper.dueDate;
}
@ -77,6 +78,7 @@ export class EditDossierGeneralInfoComponent implements OnInit, EditDossierSecti
dossierName: this.dossierWrapper.dossierName,
dossierTemplateId: this.dossierWrapper.dossierTemplateId,
description: this.dossierWrapper.description,
watermarkEnabled: this.dossierWrapper.watermarkEnabled,
dueDate: this.dossierWrapper.dueDate
});
}
@ -86,6 +88,7 @@ export class EditDossierGeneralInfoComponent implements OnInit, EditDossierSecti
...this.dossierWrapper.dossier,
dossierName: this.dossierForm.get('dossierName').value,
description: this.dossierForm.get('description').value,
watermarkEnabled: this.dossierForm.get('watermarkEnabled').value,
dueDate: this.hasDueDate ? this.dossierForm.get('dueDate').value : undefined,
dossierTemplateId: this.dossierForm.get('dossierTemplateId').value
};

View File

@ -56,6 +56,7 @@
<!-- ></redaction-circle-button>-->
<redaction-file-download-btn
[disabled]="areSomeEntitiesSelected"
[dossier]="activeDossier"
[file]="allEntities"
tooltipPosition="below"
@ -64,9 +65,10 @@
<redaction-circle-button
(action)="reanalyseDossier()"
*ngIf="permissionsService.displayReanalyseBtn()"
[disabled]="areSomeEntitiesSelected"
[tooltipClass]="'small ' + (areSomeEntitiesSelected ? '' : 'warn')"
[tooltip]="'dossier-overview.new-rule.toast.actions.reanalyse-all'"
icon="red:refresh"
tooltipClass="warn small"
tooltipPosition="below"
type="warn"
></redaction-circle-button>

View File

@ -30,7 +30,7 @@ button {
}
}
&.warn {
&.warn:not([disabled]) {
background-color: $yellow-2;
&:hover {

View File

@ -1,6 +1,6 @@
<redaction-circle-button
(action)="downloadFiles($event)"
[disabled]="!canDownloadFiles"
[disabled]="disabled || !canDownloadFiles"
[tooltipClass]="tooltipClass"
[tooltipPosition]="tooltipPosition"
[tooltip]="

View File

@ -20,6 +20,7 @@ export class FileDownloadBtnComponent {
@Input() tooltipPosition: 'above' | 'below' | 'before' | 'after' = 'above';
@Input() type: 'default' | 'primary' | 'warn' | 'dark-bg' = 'default';
@Input() tooltipClass: string;
@Input() disabled = false;
constructor(
@Inject(BASE_HREF) private readonly _baseHref: string,

View File

@ -90,6 +90,10 @@ export class DossierWrapper {
return this.dossier.memberIds.length;
}
get watermarkEnabled(): boolean {
return this.dossier.watermarkEnabled;
}
hasStatus(status: string) {
return this._files.find(f => f.status === status);
}

View File

@ -151,6 +151,7 @@
"label": "Description",
"placeholder": "Enter Description"
},
"watermark": "Watermark application on redacted documents",
"due-date": "Due Date",
"template": "Dossier Template"
},
@ -191,6 +192,7 @@
"label": "Description",
"placeholder": "Enter Description"
},
"watermark": "Watermark application on redacted documents",
"due-date": "Due Date",
"template": "Dossier Template"
}