add download and report types to ruleSet edit

This commit is contained in:
Dan Percic 2021-04-12 16:32:48 +03:00
parent 25ce348be6
commit 07111210fd
3 changed files with 44 additions and 2 deletions

View File

@ -10,6 +10,34 @@
<input formControlName="name" name="name" type="text" placeholder="{{ 'add-edit-project-template.form.name-placeholder' | translate }}" />
</div>
<div class="red-input-group required w-400">
<mat-form-field floatLabel="always">
<mat-label>{{ 'add-edit-project-template.form.download-file-types.label' | translate }}</mat-label>
<mat-select formControlName="downloadFileTypes" style="width: 100%;" multiple>
<mat-option
*ngFor="let type of downloadTypesEnum"
[value]="type"
>
{{ humanize(type) }}
</mat-option>
</mat-select>
</mat-form-field>
</div>
<div class="red-input-group required w-400">
<mat-form-field floatLabel="always">
<mat-label>{{ 'add-edit-project-template.form.report-types.label' | translate }}</mat-label>
<mat-select formControlName="reportTypes" style="width: 100%;" multiple>
<mat-option
*ngFor="let type of reportTypesEnum"
[value]="type"
>
{{ humanize(type) }}
</mat-option>
</mat-select>
</mat-form-field>
</div>
<div class="red-input-group w-400">
<label translate="add-edit-project-template.form.description"></label>
<textarea

View File

@ -13,6 +13,8 @@ import { RuleSetControllerService, RuleSetModel } from '@redaction/red-ui-http';
export class AddEditRuleSetDialogComponent {
public ruleSetForm: FormGroup;
public hasValidFrom: boolean;
public downloadTypesEnum = Object.values(RuleSetModel.DownloadFileTypesEnum);
public reportTypesEnum = Object.values(RuleSetModel.ReportTypesEnum);
constructor(
private readonly _appStateService: AppStateService,
@ -25,7 +27,9 @@ export class AddEditRuleSetDialogComponent {
name: [this.ruleSet?.name, Validators.required],
description: [this.ruleSet?.description],
validFrom: [this.ruleSet?.validFrom],
validTo: [this.ruleSet?.validTo]
validTo: [this.ruleSet?.validTo],
downloadFileTypes: [this.ruleSet?.downloadFileTypes],
reportTypes: [this.ruleSet?.reportTypes]
});
this.hasValidFrom = !!this.ruleSet?.validFrom && !!this.ruleSet?.validTo;
}
@ -49,6 +53,10 @@ export class AddEditRuleSetDialogComponent {
return false;
}
public humanize(value: string): string {
return value[0].toUpperCase() + value.substr(1).toLowerCase().replace(new RegExp('_', 'g'), ' ');
}
async saveRuleSet() {
const ruleSet = {
ruleSetId: this.ruleSet?.ruleSetId,

View File

@ -669,7 +669,13 @@
"name-placeholder": "Enter Name",
"description": "Description",
"description-placeholder": "Enter Description",
"valid-from": "Valid from"
"valid-from": "Valid from",
"download-file-types": {
"label": "Download file types"
},
"report-types": {
"label": "Report types"
}
},
"save": "Save Project Template"
},