Skip to content
Snippets Groups Projects

Replace cost unit endpoints for staff member

Merged Martin Mechtel requested to merge beta-4 into develop
3 files
+ 16
6
Compare changes
  • Side-by-side
  • Inline
Files
3
import { MAT_DIALOG_DATA } from '@angular/material/dialog';
import { Component, Inject } from '@angular/core';
import {
AfterViewInit, Component, ElementRef, Inject, ViewChild
} from '@angular/core';
import { FormGroup, FormBuilder, Validators } from '@angular/forms';
@Component({
@@ -9,7 +11,7 @@ import { FormGroup, FormBuilder, Validators } from '@angular/forms';
<mat-dialog-content fxLayout="column">
<form [formGroup]="editCostUnitForm" fxLayout="column">
<p>
Die Nummer der Kostenstelle besteht aus 5 Ziffern.
Die Nummer der Kostenstelle besteht aus 3 Ziffern (ggf. führende Nullen).
</p>
<mat-form-field>
<input matInput formControlName="key" type="text" placeholder="Titel" [value]="data.key"/>
@@ -30,10 +32,11 @@ import { FormGroup, FormBuilder, Validators } from '@angular/forms';
</mat-dialog-actions>
`
})
export class EditCostUnitDialogComponent {
export class EditCostUnitDialogComponent implements AfterViewInit {
editCostUnitForm: FormGroup;
saveButtonLabel: string;
title: string;
@ViewChild(HTMLInputElement) firstInputElement?: ElementRef;
constructor(private fb: FormBuilder,
@Inject(MAT_DIALOG_DATA) public data: any) {
@@ -41,8 +44,14 @@ export class EditCostUnitDialogComponent {
this.title = data.new ? 'Kostenstelle neu anlegen' : 'Kostenstelle ändern';
this.editCostUnitForm = this.fb.group({
key: this.fb.control(this.data.key,
[Validators.required, Validators.pattern(/^[0-9]{5}$/)]),
[Validators.required, Validators.pattern(/^[0-9]{3}$/)]),
label: this.fb.control(this.data.label, [Validators.required])
});
}
ngAfterViewInit(): void {
setTimeout(() => {
if (this.firstInputElement) this.firstInputElement.nativeElement.focus();
});
}
}
Loading