add download file types and report types to add-edit project dialog

This commit is contained in:
Dan Percic 2021-04-12 16:22:15 +03:00
parent 125e840504
commit 25ce348be6
3 changed files with 46 additions and 2 deletions

View File

@ -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

View File

@ -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
};
}

View File

@ -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!",