<div class="spacer"></div>
<div *ngIf="item;let item">
  <div class="card border-0">
    <div class="card-body">
      <fm-back-button></fm-back-button>
      <div class="card menu-card">
        <h2 *ngIf="parentOfItemType('vnd.farmmaps.itemtype.cropfield')">{{parentItem.name}}</h2>
        <h1>{{item.name}}</h1>
      </div>
      <div class="legend-container" *ngIf="item?.data.layers;let layers">
        <div class="card menu-card">
          <div *ngIf="layers.length>1">
            <select (change)="onLayerChanged($event.target.value)">
              <option *ngFor="let l of layers;" [value]="l.index" [selected]="itemLayer.layerIndex == l.index">{{l.name}}</option>
            </select>
          </div>
          <fm-map-layer-legend [showTitle]="layers.length==1" [layer]="layer(layers,itemLayer.layerIndex)" [histogramenabled]="true"></fm-map-layer-legend>
        </div>
      </div>
      <div class="card menu-card">
        <ul class="p-0 mt-2">
          <li *ngIf="item.isEditable"><a href="#" class="mt-1 mr-1" (click)="handleOnEdit(item)" ><i class="fal fa-pencil" aria-hidden="true" i18n-title title="Edit"></i>&nbsp;<span i18n>Edit</span></a></li>
          <ng-container *ngIf="itemTypeService.isLayer(item)">
            <li *ngIf="!getItemLayer(item,itemLayer.layerIndex)"><a   href="#" (click)="handleAddAsLayer(item,itemLayer.layerIndex)" ><i class="fas fa-layer-olus" aria-hidden="true" i18n-title title="Add as layer"></i>&nbsp;<span i18n>Add as overlay</span></a></li>
            <li *ngIf="getItemLayer(item,itemLayer.layerIndex)"><a  href="#" (click)="handleRemoveLayer(item,itemLayer.layerIndex)" ><i class="fas fa-layer-minus" aria-hidden="true" i18n-title title="Remove overlay"></i>&nbsp;<span i18n>Remove overlay</span></a></li>
          </ng-container>
        </ul>
      </div>
      <fm-map-zoom-to-show-alert [layer]="itemLayer?.layer"></fm-map-zoom-to-show-alert>
    </div>
  </div>
</div>
