Sfoglia il codice sorgente

✨ show selected field's ID

jmacura 3 anni fa
parent
commit
855815a035

+ 5 - 0
src/app/calculator/calculator.component.html

@@ -3,6 +3,11 @@
   <div class="card-body">
     <div class="p-2 center-block">
       <!-- FIELD & INDEX SELECTION PART -->
+      <div [hidden]="noFieldSelected()">
+        <p>
+          {{ 'CALCULATOR.selectedField' | translate}} {{data.selectedFieldProperties?.['id_dpb'] ?? '?'}}
+        </p>
+      </div>
       <div [hidden]="!noFieldSelected()">
         <p class="p-1 text-info">{{ 'CALCULATOR.selectField' | translate}}</p>
       </div>

+ 6 - 1
src/app/calculator/calculator.component.ts

@@ -13,6 +13,7 @@ import {FieldService} from './field.service';
 export class CalculatorComponent implements HsPanelComponent {
   data: {
     selectedProduct: Index;
+    selectedFieldProperties: {[x: string]: any};
   };
   name: 'calculator';
   viewRef: ViewRef;
@@ -21,7 +22,11 @@ export class CalculatorComponent implements HsPanelComponent {
     public calcService: CalculatorService,
     private fieldService: FieldService,
     public hsLayoutService: HsLayoutService
-  ) {}
+  ) {
+    this.fieldService.fieldSelects.subscribe(({feature}) => {
+      this.data.selectedFieldProperties = feature.getProperties();
+    });
+  }
 
   isVisible(): boolean {
     return this.hsLayoutService.panelVisible('calculator');

+ 2 - 0
src/app/translations.json

@@ -6,6 +6,7 @@
       "panelHeader": "Výpočet indexů pole",
       "selectDate": "Chci datum",
       "selectField": "Pole vyberte kliknutím do mapy",
+      "selectedField": "Vybráno pole",
       "selectIndex": "Chci vypočítat index"
     }
   },
@@ -16,6 +17,7 @@
       "panelHeader": "Field calculation",
       "selectDate": "I want a datum",
       "selectField": "Select a field by clicking in the map",
+      "SelectedField": "Selected field",
       "selectIndex": "I want to calculate index"
     }
   }