fee pages
This commit is contained in:
@ -19,18 +19,20 @@
|
||||
</div><div>
|
||||
<mat-form-field appearance="outline">
|
||||
<mat-label>Betrag (€)</mat-label>
|
||||
<input matInput type="number" name="amount" [(ngModel)]="overheadAdvance.amount"/>
|
||||
<input matInput type="number" name="amount" [(ngModel)]="overheadAdvance.amount" [readonly]="readonly"/>
|
||||
</mat-form-field>
|
||||
</div><div>
|
||||
<mat-form-field appearance="outline">
|
||||
<mat-label>Beginn</mat-label>
|
||||
<input matInput name="startdate" [(ngModel)]="overheadAdvance.startdate" [matDatepicker]="startdatepicker"/>
|
||||
<mat-datepicker-toggle matSuffix [for]="startdatepicker"></mat-datepicker-toggle>
|
||||
<input matInput name="startdate" [(ngModel)]="overheadAdvance.startdate" [matDatepicker]="startdatepicker" [readonly]="readonly"/>
|
||||
<mat-datepicker-toggle matSuffix [for]="startdatepicker" [disabled]="readonly"></mat-datepicker-toggle>
|
||||
<mat-datepicker #startdatepicker></mat-datepicker>
|
||||
</mat-form-field>
|
||||
<mat-form-field appearance="outline">
|
||||
<mat-label>Ende</mat-label>
|
||||
<input matInput name="enddate" [(ngModel)]="overheadAdvance.enddate"/>
|
||||
<input matInput name="enddate" [(ngModel)]="overheadAdvance.enddate" [matDatepicker]="enddatepicker"/>
|
||||
<mat-datepicker-toggle matSuffix [for]="enddatepicker"></mat-datepicker-toggle>
|
||||
<mat-datepicker #enddatepicker></mat-datepicker>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<button #submitButton type="submit" mat-raised-button color="primary">Speichern</button>
|
||||
|
@ -15,6 +15,7 @@ export class OverheadAdvanceDetailsComponent implements OnInit {
|
||||
@ViewChild('submitButton') submitButton: MatButton
|
||||
|
||||
overheadAdvance: OverheadAdvance = NULL_OverheadAdvance
|
||||
readonly: boolean
|
||||
|
||||
constructor(
|
||||
private overheadAdvanceService: OverheadAdvanceService,
|
||||
@ -26,8 +27,10 @@ export class OverheadAdvanceDetailsComponent implements OnInit {
|
||||
async getOverheadAdvance(): Promise<void> {
|
||||
try {
|
||||
const id = +this.route.snapshot.paramMap.get('id')
|
||||
this.readonly = false
|
||||
if (id != 0) {
|
||||
this.overheadAdvance = await this.overheadAdvanceService.getOverheadAdvance(id)
|
||||
this.readonly = true
|
||||
}
|
||||
} catch (err) {
|
||||
this.messageService.add(JSON.stringify(err, undefined, 4))
|
||||
@ -39,6 +42,12 @@ export class OverheadAdvanceDetailsComponent implements OnInit {
|
||||
this.submitButton.disabled = true
|
||||
this.messageService.add("saveOverheadAdvance")
|
||||
this.messageService.add(JSON.stringify(this.overheadAdvance, undefined, 4))
|
||||
if (this.overheadAdvance.enddate == null) {
|
||||
this.overheadAdvance.enddate = ''
|
||||
}
|
||||
if (this.overheadAdvance.startdate == null) {
|
||||
this.overheadAdvance.startdate = ''
|
||||
}
|
||||
if (this.overheadAdvance.id == 0) {
|
||||
this.messageService.add("about to insert new overheadAdvance")
|
||||
this.overheadAdvance = await this.overheadAdvanceService.postOverheadAdvance(this.overheadAdvance)
|
||||
@ -56,6 +65,7 @@ export class OverheadAdvanceDetailsComponent implements OnInit {
|
||||
|
||||
|
||||
ngOnInit(): void {
|
||||
this.getOverheadAdvance()
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user