Handout management

This commit is contained in:
Bastian Wagner
2024-10-20 14:49:42 +02:00
parent 5e2b900b18
commit aa9abdd512
37 changed files with 754 additions and 67 deletions

View File

@@ -9,6 +9,7 @@ import { HotToastService } from '@ngxpert/hot-toast';
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';
@Component({
selector: 'app-keys',
@@ -32,7 +33,12 @@ export class KeysComponent {
localeText: AG_GRID_LOCALE_DE,
rowData: [],
columnDefs: [
{ field: 'handedOut' , headerName: 'Ausgegeben', width: 100,editable: true, filter: true, headerTooltip: 'Ausgegeben' },
{
cellRenderer: AgOpenHandoutComponent,
width: 100,
headerName: 'Übergabe'
},
{ field: 'handedOut' , headerName: 'Ausgegeben', width: 100, editable: false, filter: false, headerTooltip: 'Ausgegeben' },
{ field: 'name' , headerName: 'Name', flex: 1, editable: true, sort: 'asc', filter: true },
{ field: 'nr' , headerName: 'Schlüsselnummer', flex: 1, editable: true, filter: true },
{ field: 'cylinder' , headerName: 'Zylinder', flex: 1, editable: true, filter: true, cellRenderer: (data: any) => {return data.value?.name}, cellEditor: 'agSelectCellEditor',
@@ -60,9 +66,10 @@ export class KeysComponent {
, type: 'date'
, cellRenderer: (data: any) => data.value ? this.datePipe.transform(new Date(data.value)) : '-'
, tooltipValueGetter: (data: any) => this.datePipe.transform(new Date(data.value), 'medium')
},
}
],
loading: true,
rowHeight: 48,
}
ngOnInit(): void {
@@ -71,7 +78,6 @@ export class KeysComponent {
this.cylinders = n;
}
})
this.api.postKeySystem({ name: 'Development' }).subscribe()
}
loadKeys() {
@@ -79,7 +85,6 @@ export class KeysComponent {
this.api.getKeys().subscribe(res => {
this.gridApi.setGridOption("rowData", res);
this.gridApi.setGridOption("loading", false);
res.map((r: any) => console.log(r.updatedAt))
})
}
@@ -91,8 +96,6 @@ export class KeysComponent {
cellEditEnd(event: CellEditingStoppedEvent) {
const key: IKey = event.data;
console.log(event)
if (!event.valueChanged || event.newValue == event.oldValue) { return; }
this.gridApi.setGridOption("loading", true);