Lost Keys
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
import { Component, inject, LOCALE_ID } from '@angular/core';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
import { MAT_DIALOG_DATA, MatDialogModule, MatDialogRef } from '@angular/material/dialog';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { IKey } from '../../../../model/interface/key.interface';
|
||||
import { CommonModule, DatePipe } from '@angular/common';
|
||||
|
||||
@Component({
|
||||
selector: 'app-lost-key',
|
||||
standalone: true,
|
||||
imports: [MatDialogModule, MatButtonModule, MatIconModule, CommonModule],
|
||||
providers: [{ provide: LOCALE_ID, useValue: 'de-DE' }],
|
||||
templateUrl: './lost-key.component.html',
|
||||
styleUrl: './lost-key.component.scss'
|
||||
})
|
||||
export class LostKeyComponent {
|
||||
readonly dialogRef = inject(MatDialogRef<LostKeyComponent>);
|
||||
readonly key = inject<IKey>(MAT_DIALOG_DATA);
|
||||
|
||||
closeWithData() {
|
||||
this.dialogRef.close(new Date());
|
||||
}
|
||||
|
||||
closeFound() {
|
||||
this.dialogRef.close("");
|
||||
}
|
||||
|
||||
get loss(): Date | null {
|
||||
if (!this.key.keyLost) { return null }
|
||||
|
||||
return new Date(this.key.keyLost);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user