diff --git a/src/app/core/common-components/entity-subrecord/entity-subrecord/entity-subrecord.component.html b/src/app/core/common-components/entity-subrecord/entity-subrecord/entity-subrecord.component.html index 3394e79e00..487abc8be4 100644 --- a/src/app/core/common-components/entity-subrecord/entity-subrecord/entity-subrecord.component.html +++ b/src/app/core/common-components/entity-subrecord/entity-subrecord/entity-subrecord.component.html @@ -110,7 +110,7 @@ entity: rec.record, operation: 'delete' }" - (click)="delete(rec)" + (click)="entityRemoveService.remove(rec.record)" angulartics2On="click" [angularticsCategory]="rec?.record?.getType()" angularticsAction="subrecord_inlineedit_delete" diff --git a/src/app/core/common-components/entity-subrecord/entity-subrecord/entity-subrecord.component.ts b/src/app/core/common-components/entity-subrecord/entity-subrecord/entity-subrecord.component.ts index 3a31468442..e63338eb51 100644 --- a/src/app/core/common-components/entity-subrecord/entity-subrecord/entity-subrecord.component.ts +++ b/src/app/core/common-components/entity-subrecord/entity-subrecord/entity-subrecord.component.ts @@ -24,10 +24,7 @@ import { } from "../../entity-form/entity-form.service"; import { LoggingService } from "../../../logging/logging.service"; import { AnalyticsService } from "../../../analytics/analytics.service"; -import { - EntityRemoveService, - RemoveResult, -} from "../../../entity/entity-remove.service"; +import { EntityRemoveService } from "../../../entity/entity-remove.service"; import { EntityMapperService } from "../../../entity/entity-mapper/entity-mapper.service"; import { tableSort } from "./table-sort"; import { @@ -166,7 +163,7 @@ export class EntitySubrecordComponent implements OnChanges { private router: Router, private analyticsService: AnalyticsService, private loggingService: LoggingService, - private entityRemoveService: EntityRemoveService, + public entityRemoveService: EntityRemoveService, private entityMapper: EntityMapperService, private filterService: FilterService, ) { @@ -388,28 +385,6 @@ export class EntitySubrecordComponent implements OnChanges { row.formGroup = null; } - /** - * Delete the given entity from the database (after explicit user confirmation). - * @param row The entity to be deleted. - */ - delete(row: TableRow) { - this.entityRemoveService - .remove(row.record, { - deletedEntityInformation: $localize`:Record deleted info:Record deleted`, - dialogText: $localize`:Delete confirmation message:Are you sure you want to delete this record?`, - }) - .subscribe((result) => { - switch (result) { - case RemoveResult.REMOVED: - this.removeFromDataTable(row.record); - break; - case RemoveResult.UNDONE: - this.records.unshift(row.record); - this.initFormGroups(); - } - }); - } - private removeFromDataTable(deleted: T) { // use setter so datasource is also updated this.records = this.records.filter( diff --git a/src/app/core/entity-details/entity-details/entity-details.component.html b/src/app/core/entity-details/entity-details/entity-details.component.html index 58b3b4f011..9c03c4f7fe 100644 --- a/src/app/core/entity-details/entity-details/entity-details.component.html +++ b/src/app/core/entity-details/entity-details/entity-details.component.html @@ -41,7 +41,7 @@