Handout management
This commit is contained in:
@@ -0,0 +1 @@
|
||||
<div class="handover icon-btn-sm" (click)="openDialog()"></div>
|
||||
@@ -0,0 +1,11 @@
|
||||
:host {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-direction: column;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.handover {
|
||||
background-image: url('../../../../../assets/img/handover.svg');
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
import { Component, HostBinding, inject } from '@angular/core';
|
||||
import { ICellRendererAngularComp } from 'ag-grid-angular';
|
||||
import { ICellRendererParams } from 'ag-grid-community';
|
||||
import { IKey } from '../../../../model/interface/key.interface';
|
||||
import { MatDialog, MatDialogModule } from '@angular/material/dialog';
|
||||
import { HandoverDialogComponent } from '../../../../modules/keys/components/handover-dialog/handover-dialog.component';
|
||||
|
||||
@Component({
|
||||
selector: 'app-ag-open-handout',
|
||||
standalone: true,
|
||||
imports: [MatDialogModule],
|
||||
templateUrl: './ag-open-handout.component.html',
|
||||
styleUrl: './ag-open-handout.component.scss'
|
||||
})
|
||||
export class AgOpenHandoutComponent implements ICellRendererAngularComp {
|
||||
private dialog: MatDialog = inject(MatDialog);
|
||||
key!: IKey;
|
||||
params!: ICellRendererParams<any, any, any>;
|
||||
|
||||
agInit(params: ICellRendererParams<any, any, any>): void {
|
||||
this.params = params;
|
||||
this.key = params.data;
|
||||
}
|
||||
refresh(params: ICellRendererParams<any, any, any>): boolean {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
openDialog() {
|
||||
this.dialog.open(HandoverDialogComponent, {
|
||||
data: this.key,
|
||||
autoFocus: false,
|
||||
maxWidth: '100vw',
|
||||
maxHeight: '100vh'
|
||||
}).afterClosed().subscribe({
|
||||
next: n => {
|
||||
if (n != null) {
|
||||
this.key.handedOut = n;
|
||||
this.params.api.refreshCells();
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -43,4 +43,21 @@ export class ApiService {
|
||||
postKeySystem(keySystem: any) {
|
||||
return this.http.post('api/key/system', keySystem);
|
||||
}
|
||||
|
||||
handoverKey(data: any) {
|
||||
return this.http.post(`api/key/${data.key.id}/handover`, data);
|
||||
}
|
||||
|
||||
getHandovers(keyID: string): Observable<any[]> {
|
||||
return this.http.get<any[]>(`api/key/${keyID}/handover`);
|
||||
}
|
||||
|
||||
createCustomer(data: { name: string, system: any}) {
|
||||
return this.http.post('api/customer', data);
|
||||
}
|
||||
|
||||
getCustomers(): Observable<any[]> {
|
||||
return this.http.get<any[]>('api/customer')
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user