AW-6806 Allow delete
Some checks failed
FarmMaps.Develop/FarmMapsLib/pipeline/head There was a failure building this commit

This commit is contained in:
Peter (extern) 2025-06-03 12:15:14 +02:00
parent fe73f615ad
commit ac15b2018d

View File

@ -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<IItemLayer>;
constructor(public store: Store<mapReducers.State | commonReducers.State>, public itemTypeService: ItemTypeService, private location: Location, public router: Router) {
constructor(public store: Store<mapReducers.State | commonReducers.State>, 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;