From ac15b2018d07e8c79e97b4d3084f0388fe43e717 Mon Sep 17 00:00:00 2001 From: Peter Bastiani Date: Tue, 3 Jun 2025 12:15:14 +0200 Subject: [PATCH] AW-6806 Allow delete --- .../components/selected-item/selected-item.component.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/projects/common-map/src/fm-map/components/selected-item/selected-item.component.ts b/projects/common-map/src/fm-map/components/selected-item/selected-item.component.ts index 0fd6b69..4062a98 100644 --- a/projects/common-map/src/fm-map/components/selected-item/selected-item.component.ts +++ b/projects/common-map/src/fm-map/components/selected-item/selected-item.component.ts @@ -2,7 +2,7 @@ import {Component, Injectable, Input, Directive} from '@angular/core'; import {Location} from '@angular/common'; import {Store} from '@ngrx/store'; import * as mapReducers from '../../reducers/map.reducer'; -import {AppConfig, commonReducers, IItem, ItemTypeService} from '@farmmaps/common'; +import {AppConfig, commonReducers, IItem, ItemService, ItemTypeService} from '@farmmaps/common'; import * as mapActions from '../../actions/map.actions'; import {Router} from '@angular/router'; import { IItemLayer } from '../../models/item.layer'; @@ -15,7 +15,7 @@ export abstract class AbstractSelectedItemComponent { @Input() parentItem: IItem; @Input() itemLayer: IItemLayer; @Input() overlayLayers: Array; - constructor(public store: Store, public itemTypeService: ItemTypeService, private location: Location, public router: Router) { + constructor(public store: Store, public itemTypeService: ItemTypeService, public itemService: ItemService, private location: Location, public router: Router) { } handleOnView(item: IItem) { @@ -37,6 +37,11 @@ export abstract class AbstractSelectedItemComponent { return false; } + handleOnDelete(item: IItem) { + this.itemService.deleteItem(item.code); + return false; + } + handleAddAsLayer(item: IItem,layerIndex = -1) { this.store.dispatch(new mapActions.AddLayer(item,layerIndex)); return false;