Pull request #149: add download file types and report types to add-edit project dialog
Merge in RED/ui from RED-1281 to master * commit '07111210fd651f06017435a2f0b18ff451a49acc': add download and report types to ruleSet edit add download file types and report types to add-edit project dialog
This commit is contained in:
commit
b82592de24
@ -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
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -32,6 +32,34 @@
|
||||
</mat-form-field>
|
||||
</div>
|
||||
|
||||
<div class="red-input-group required w-400">
|
||||
<mat-form-field floatLabel="always">
|
||||
<mat-label>{{ 'project-listing.add-edit-dialog.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>{{ 'project-listing.add-edit-dialog.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="project-listing.add-edit-dialog.form.description.label"></label>
|
||||
<textarea
|
||||
|
||||
@ -14,6 +14,8 @@ import * as moment from 'moment';
|
||||
export class AddEditProjectDialogComponent {
|
||||
public projectForm: FormGroup;
|
||||
public hasDueDate: boolean;
|
||||
public downloadTypesEnum = Object.values(RuleSetModel.DownloadFileTypesEnum);
|
||||
public reportTypesEnum = Object.values(RuleSetModel.ReportTypesEnum);
|
||||
|
||||
constructor(
|
||||
private readonly _appStateService: AppStateService,
|
||||
@ -24,6 +26,8 @@ export class AddEditProjectDialogComponent {
|
||||
this.projectForm = this._formBuilder.group({
|
||||
projectName: [this.project?.projectName, Validators.required],
|
||||
ruleSet: [{ value: this.project?.ruleSetId, disabled: this.project?.hasFiles }, Validators.required],
|
||||
downloadFileTypes: [this.project?.project?.downloadFileTypes],
|
||||
reportTypes: [this.project?.project?.reportTypes],
|
||||
description: [this.project?.description],
|
||||
dueDate: [this.project?.dueDate]
|
||||
});
|
||||
@ -34,6 +38,10 @@ export class AddEditProjectDialogComponent {
|
||||
return this._appStateService.ruleSets;
|
||||
}
|
||||
|
||||
public humanize(value: string): string {
|
||||
return value[0].toUpperCase() + value.substr(1).toLowerCase().replace(new RegExp('_', 'g'), ' ');
|
||||
}
|
||||
|
||||
public get changed() {
|
||||
if (!this.project) {
|
||||
return true;
|
||||
@ -83,7 +91,9 @@ export class AddEditProjectDialogComponent {
|
||||
projectName: this.projectForm.get('projectName').value,
|
||||
description: this.projectForm.get('description').value,
|
||||
dueDate: this.hasDueDate ? this.projectForm.get('dueDate').value : undefined,
|
||||
ruleSetId: this.projectForm.get('ruleSet').value
|
||||
ruleSetId: this.projectForm.get('ruleSet').value,
|
||||
downloadFileTypes: this.projectForm.get('downloadFileTypes').value,
|
||||
reportTypes: this.projectForm.get('reportTypes').value
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@ -144,7 +144,13 @@
|
||||
"placeholder": "Enter Description"
|
||||
},
|
||||
"due-date": "Due Date",
|
||||
"template": "Project Template"
|
||||
"template": "Project Template",
|
||||
"download-file-types": {
|
||||
"label": "Download file types"
|
||||
},
|
||||
"report-types": {
|
||||
"label": "Report types"
|
||||
}
|
||||
},
|
||||
"errors": {
|
||||
"project-already-exists": "Project with this name already exists!",
|
||||
@ -663,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"
|
||||
},
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user