xxx
This commit is contained in:
@@ -0,0 +1 @@
|
||||
<div class="delete icon-btn-sm" (click)="delete()" matTooltip="Löschen" [matTooltipShowDelay]="600"></div>
|
||||
@@ -0,0 +1,23 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { AgDeleteCylinderComponent } from './ag-delete-cylinder.component';
|
||||
|
||||
describe('AgDeleteCylinderComponent', () => {
|
||||
let component: AgDeleteCylinderComponent;
|
||||
let fixture: ComponentFixture<AgDeleteCylinderComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
imports: [AgDeleteCylinderComponent]
|
||||
})
|
||||
.compileComponents();
|
||||
|
||||
fixture = TestBed.createComponent(AgDeleteCylinderComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,47 @@
|
||||
import { Component } from '@angular/core';
|
||||
import { AgBaseComponentComponent } from '../ag-base-component/ag-base-component.component';
|
||||
import { DeleteCylinderComponent } from '../../../../modules/cylinder/components/delete-cylinder/delete-cylinder.component';
|
||||
import { MatTooltipModule } from '@angular/material/tooltip';
|
||||
|
||||
@Component({
|
||||
selector: 'app-ag-delete-cylinder',
|
||||
standalone: true,
|
||||
imports: [MatTooltipModule],
|
||||
templateUrl: './ag-delete-cylinder.component.html',
|
||||
styleUrl: './ag-delete-cylinder.component.scss'
|
||||
})
|
||||
export class AgDeleteCylinderComponent extends AgBaseComponentComponent {
|
||||
|
||||
|
||||
delete() {
|
||||
const ref = this.dialog.open(DeleteCylinderComponent, {
|
||||
data: this.params.data,
|
||||
autoFocus: false
|
||||
})
|
||||
|
||||
ref.afterClosed().subscribe({
|
||||
next: n => {
|
||||
if (n) {
|
||||
this.deleteThisCylinder();
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
deleteThisCylinder() {
|
||||
this.api.deleteCylinder(this.params.data)
|
||||
.pipe(
|
||||
this.toast.observe({
|
||||
loading: 'Löschen...',
|
||||
success: 'Gelöscht!',
|
||||
error: 'Konnte nicht gelöscht werden'
|
||||
})
|
||||
).subscribe({
|
||||
next: () => {
|
||||
const rows = this.params.api.getGridOption("rowData")?.filter(r => r.id != this.params.data.id);
|
||||
this.params.api.setGridOption("rowData", rows);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user