Archive
This commit is contained in:
@@ -10,11 +10,15 @@ import { MatButtonModule } from '@angular/material/button';
|
||||
import { MatDialog, MatDialogModule } from '@angular/material/dialog';
|
||||
import { CreateKeyComponent } from './create/create.component';
|
||||
import { AgOpenHandoutComponent } from '../../shared/ag-grid/components/ag-open-handout/ag-open-handout.component';
|
||||
import { AgDeleteKeyComponent } from '../../shared/ag-grid/components/ag-delete-key/ag-delete-key.component';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { ArchiveComponent } from './components/archive/archive.component';
|
||||
import { AgLoadingComponent } from '../../shared/ag-grid/components/ag-loading/ag-loading.component';
|
||||
|
||||
@Component({
|
||||
selector: 'app-keys',
|
||||
standalone: true,
|
||||
imports: [AgGridAngular, MatButtonModule, MatDialogModule],
|
||||
imports: [AgGridAngular, MatButtonModule, MatDialogModule, MatIconModule],
|
||||
providers: [DatePipe],
|
||||
templateUrl: './keys.component.html',
|
||||
styleUrl: './keys.component.scss'
|
||||
@@ -70,9 +74,24 @@ export class KeysComponent {
|
||||
, cellRenderer: (data: any) => data.value ? this.datePipe.transform(new Date(data.value)) : '-'
|
||||
, tooltipValueGetter: (data: any) => this.datePipe.transform(new Date(data.value), 'medium')
|
||||
}
|
||||
|
||||
,{
|
||||
colId: 'delete'
|
||||
, headerName: 'Löschen'
|
||||
, width: 120
|
||||
, cellRenderer: AgDeleteKeyComponent
|
||||
// , onCellClicked: (event) => { this.deleteKey(event.data.id)}
|
||||
}
|
||||
],
|
||||
loading: true,
|
||||
rowHeight: 36,
|
||||
loadingOverlayComponent: AgLoadingComponent
|
||||
}
|
||||
|
||||
deleteKey(id: string) {
|
||||
this.api.deleteKey(id).subscribe({
|
||||
next: n => console.log(n)
|
||||
})
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
@@ -118,6 +137,31 @@ export class KeysComponent {
|
||||
}
|
||||
|
||||
openCreateKey() {
|
||||
this.dialog.open(CreateKeyComponent)
|
||||
this.dialog.open(CreateKeyComponent).afterClosed().subscribe({
|
||||
next: key => {
|
||||
if (key) {
|
||||
let d = [...this.gridApi.getGridOption("rowData") || [], key];
|
||||
this.gridApi.setGridOption("rowData", d);
|
||||
this.loadKeys();
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
openArchive() {
|
||||
this.dialog.open(ArchiveComponent, {
|
||||
maxHeight: "calc(100vh - 24px)",
|
||||
maxWidth: "calc(100vw - 24px)",
|
||||
width: "50vw",
|
||||
minWidth: "300px",
|
||||
height: "70vh",
|
||||
disableClose: true
|
||||
}).afterClosed().subscribe({
|
||||
next: changed => {
|
||||
if (changed) {
|
||||
this.loadKeys();
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user