{"version":3,"mappings":"mHAAO,IAAKA,EASX,MATD,OAAYA,QAAI,KACdA,gBACAA,cACAA,gBACAA,cACAA,uBACAA,iBACAA,YACAA,gBARUA,EAAZ,IAAYA,GASX,6sBCoBM,IAAMC,GAAb,MAAM,QACJC,eAGAC,UAAUC,EAAoBC,GAC5B,MAAMC,EAA2B,CAC/BC,GAAI,KACJC,WAAYJ,EACZK,KAAML,EAAWM,YACjBC,QAAS,GACTC,KAAM,EACNC,aAAc,GACdC,SAAU,GACVC,WAAY,GACZC,KAAM,GACNC,sBAAuB,GACvBC,wBAAyB,GACzBC,gBAAgB,EAChBC,YAAa,KACbC,OAAQ,EACRC,WAAY,GACZC,UAAW,MAGbC,cAAOC,KAAKpB,GAAgBqB,IAAIC,IAC1BrB,EAASsB,eAAeD,GAC1BrB,EAASqB,GAAQtB,EAAesB,GAEhCE,QAAQC,KAAK,wBAA0BH,EAAO,8DAI3CrB,gDAhCEL,gCAA2B8B,QAA3B9B,EAA2B,qBAF1B,SAEDA,GAAb,uGC+KM+B,gBAAMA,SAAiBA,oCAAjBA,gFAnCL,IAAKC,EAQX,MARD,OAAYA,QAAmB,KAC7BA,iCACAA,uCACAA,qCACAA,yCACAA,iCACAA,uCACAA,mCAPUA,EAAZ,IAAYA,GAQX,GA+BM,IAAMC,GAAb,MAAM,QA8BJhC,YAAoBiC,EACAC,EACDC,EACCC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,IA5BAC,kBACAA,oBACDA,yBACCA,iBACAA,qBACAA,sBACAA,oBACAA,wBACAA,2BACAA,qBACAA,gBACAA,oBACAA,mBACAA,sBACAA,yBACAA,uBACAA,2BACAA,yBACAA,uBACAA,sBACAA,iCACAA,4BACAA,oBACAA,iBACAA,yBACAA,qBACAA,6BACAA,8BACAA,oBAvDJA,sBAAsB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ZA,GAAb","names":["Icon","FieldGridDataFactoryService","constructor","CreateNew","sourceItem","templateObject","newField","Id","SourceItem","Geom","DefaultGeom","LandUse","Area","AreaOriginal","MainCrop","SecondCrop","Note","MainCropExpectedYield","SecondCropExpectedYield","StrawHarvested","StatusClass","Status","StatusDesc","PackageId","Object","keys","map","prop","hasOwnProperty","console","warn","factory","i0","FieldMassEditAction","FieldOverviewComponent","fieldStore","fieldService","campaignYearStore","formStore","cropTypeStore","permissionPipe","mapViewStore","roundNumericPipe","roundNumericService","settingsStore","mapStore","landUseStore","loginStore","languageStore","translationStore","statisticStore","modalDialogPresets","modalDialogStore","getCropService","cropStatistic","parameterDefinitionStore","parameterValueStore","dateService","jobStore","statisticService","fieldFactory","fieldGridDataFactory","tooltipContentService","notifyStore","this","undefined","of","ApPermissions","EventEmitter","BehaviorSubject","ngOnInit","goIntoMapMenuSync","fieldsLoadingOrSaving$","combineLatest","Listen","s","loading","saving","pipe","_gridBuilder","_onSelectionChanged","dynComponent","SelectedItems$","subscribe","d","_selectionChange","items$","_getItems","ngAfterContentInit","Editor","ClearMergeFieldResult","_subscriptions","push","_applyClickedEvent","e","_onApplyClicked","saved","_onFiledStoreSaved","fieldCropsSaved","_fieldCropSaved","_onEditEvent","onEdit","_onSplitEvent","_onSplit","_onDeleteEvent","_openDeleteDialog","_onDownloadPackageEvent","_onDownloadPackageId","x","mergeFieldResult","mergeResult","_onMerge","gridInitialized","dynGrid","gridPager","gridMultiSelect","formValueChanges","v","_onFormValuesChange","items","_onSelectedItems","FormClose$","CloseEditor","result","skip","c","_modalDialogOkClicked","_preparePlanBookCheckDialog","data","landUse","_landuse","fieldPlanBooksResult","planBooks","_checkForPlanBooksOnDelete","setModalDialogData","ExistPlanBooksDialog","confirmKey","title","message","deleteFields","_deleteFieldIds","clearFieldPlanBooksResult","ngOnDestroy","removeStatisticData","forEach","unsubscribe","_a","selectedCrops","item","FieldCrops","Find","crop","isSelectedCampaignYear","length","every","_","a","CroptypeId","_mainCropId$","next","CroptypeSecondId","_secondCropId$","controlValue","previousValue","_currentMultiSelectFormValue","control","value","_mainCropMassEditChanged$","PreviousValue","CurrentValue","_secondCropMassEditChanged$","Fields$","filter","fields","field","selectedCampaignYear","SelectedCampaignYear","geom","getCurrentFieldGeom","adminArea","Create","i","AdminArea","area","status","getGeomStatus","pack","t","FieldGeomPackages","E","Year","mainCrop","parseMainCrop","fieldCrop","getFieldCrop","b","NrSNr","getFieldNumberAndSubNumber","roundAsNumber","FirstSetting","DigitsAfterDecimalPoint","toString","parseSecondCrop","CropData","parseMainCropExpectedYield","parseSecondCropExpectedYield","parseStrawHarvested","S","Creation","CreatedAt","toFarmDateFromUtcGetJsDate","IsoDateTimeFormat","selectedItems","r","itemsToSelect","changeSelectedField","zoomFarmFields","_createStatistic","mergeResultJSON","JSON","parse","type","addMessage","DisplayTimeout","Level","ErrorKey","ShowMapGoIn","gridSelectedKeys","getSelectedFieldIds","emptyRecord","FieldName","FindTranslationForSelectedLanguage","MergeNewFieldName","FieldNumber","FieldSubnumber","openForm","component","ApMergeFieldComponent","CurrentItem","getSelectedItems","AllItems","concat","geomIds","fieldsToIgnoreInSnap","editFields","PrepareModifyMergedField","coordinates","setTimeout","Layers","PolygonEditLayer","clearSelection","clear","closeForm","showSaveSuccessMessage","showSaveFailMessage","packageId","MapFactoryRequestor","then","download","catch","err","$event","fieldOriginal","SplitFieldData","MainCropYieldUnit","_b","ExpectedYield","o","_c","SecondCropYieldUnit","_d","ExpectedYieldSecond","RemoveResidues","l","n","_e","_f","p","_g","ApSplitFieldComponent","OldField","FieldOne","FieldTwo","PrepareSplitField","ApEditFieldComponent","PrepareOpenEditBar","onCreate","OpenCreateForm","columns$","transform","User$","SelectedLanguage$","permission","user","language","ApDynGridStatusColumnConfig","showHeaderTitle","class","description","pending","BlockedFieldIdsBuWsvCeIrRbFieldRaster$","pendingTooltip","BlockedFieldIdsBuWsvCeIrRbFieldRasterTooltip$","ApDynGridPropertyColumnConfig","filterable","hide","filterType","FilterType","cssClass","headerFilterable","width","ApDynGridColumnHideConfig","mapHide","selfHide","mode","m","MapViewMode","sortIndex","sortDesc","tooltip","dataItem","pipes","args","ApDynGridGroupColumnConfig","groupColumns","checkbox","generateCropNoteTooltip","ToReplace","ReplaceWith","format","DateFormat","ApDynGridEditColumnConfig","options","text","callback","disabled","IsHighestCampaignYear","classList","ApRoleTypeService","Add","pager$","ApDynGridPagerConfig","listMassEditing","_fillWizardChoiceData","apply","hasPermission","preselect","asObservable","selectedYear","crops","id","EditMainCrop","ApGridPagerType","name","onSubmit","onChoiceSelect","ApUtilService","getValue","formConfig","ApDynformsConfigFieldset","key","config","ApDynformsConfigComboBox","valueField","textField","valuePrimitive","label","Selected","validators","ApDynformsValidator","validator","Validators","errorKey","value$","itemTemplate","comboBoxCropTypeItem","ApDynformsConfigNumerictextbox","min","cropValueChange","originalCropFromSelectedFields","mainCrops","ObjectFactory","CropTypes","ApDynformsConfigCheckbox","ApDynformsConfigPlaceholder","ResetMainCrop","EditSecondCrop","ResetSecondCrop","UpdateCropNote","values","DeleteFields","MergeFields","dataForTitles","totalItems","AreaHa","some","z","generateFieldsAreaTitle","setStatisticData","gatherFieldCropsChartData","ApStatsType","addSelection","selectFromSelection","event","object","Counter","UserId","UserName","Parameters","fieldsAmount","_massEditPagerData","applyMassEditAction","availableCroptypes","saveField","cropType","ct","expectedYield","MainCrop_YieldUnit","ValueNotSet","Cropkey","CropKey","FieldId","FarmId","DefaultStart","DefaultEnd","cropTypeSecond","SecondCrop_YieldUnit","MainSecondCropType","MergeFieldGeometries","copiedFieldCrops","filedCrop","saveFieldCrops","_updateParameter","definition","getParameterDefinitionById","parameterValues","RefId","DefinitionId","SelectedFarm","ValidFrom","Date","getDefaultStart","form","getFullYear","Valid","TypeId","ValueBoolean","Value","ValueListKey","ValueNumber","ValueString","ValueTimestamp","updateParameterValues","fieldList","slice","join","DeleteDialog","checkFieldsPlanBook","selectors","ApDynComponentComponent","ctx","PlantProtectionService","getPpApplications","ppPlanBooks","pb","BookedAt","getSlopeForCalculation","slope","AvgWater","nUptake","Number","isFinite"],"sources":["./src/app/ap-interface/enums/layout/icon.enum.ts","./src/app/factories/field-grid-data-factory.service.ts","./src/app/field-management/components/field-overview.component.ts","./src/app/services/data/plant-protection.service.ts"],"sourcesContent":["export enum Icon {\n Delete = 'delete',\n Edit = 'Edit',\n Print = 'print',\n Save = 'save',\n Source = 'source-code',\n XLS = 'file-xls',\n PDF = 'pdf',\n Shape = 'shape'\n}\n","import {Injectable} from '@angular/core';\nimport {IGridData} from '../ap-interface';\nimport {StatusClass} from '../types/common-types';\nimport IField = Data.FieldManagement.IField;\nimport IGuid = System.IGuid;\nimport IFieldGeom = Data.FieldManagement.IFieldGeom;\n\nexport interface IFieldGridData extends IGridData {\n Id: IGuid;\n SourceItem: IField;\n Geom: IFieldGeom;\n LandUse: string;\n Area: number;\n AreaOriginal: string;\n MainCrop: string;\n SecondCrop: string;\n Note: string;\n MainCropExpectedYield: string;\n SecondCropExpectedYield: string;\n StrawHarvested: boolean;\n StatusClass: StatusClass;\n Status: number;\n StatusDesc: string;\n PackageId: IGuid;\n}\n\n@Injectable({\n providedIn: 'root'\n})\nexport class FieldGridDataFactoryService {\n constructor() {\n }\n\n CreateNew(sourceItem: IField, templateObject?: any): IFieldGridData {\n const newField: IFieldGridData = {\n Id: null,\n SourceItem: sourceItem,\n Geom: sourceItem.DefaultGeom,\n LandUse: '',\n Area: 0,\n AreaOriginal: '',\n MainCrop: '',\n SecondCrop: '',\n Note: '',\n MainCropExpectedYield: '',\n SecondCropExpectedYield: '',\n StrawHarvested: false,\n StatusClass: null,\n Status: 0,\n StatusDesc: '',\n PackageId: null,\n };\n\n Object.keys(templateObject).map(prop => {\n if (newField.hasOwnProperty(prop)) {\n newField[prop] = templateObject[prop];\n } else {\n console.warn('There is no property ' + prop + ' in IField interface. Please check your input parameter.');\n }\n });\n\n return newField;\n }\n}\n","import {AfterContentInit, Component, EventEmitter, OnDestroy, OnInit, TemplateRef, ViewChild} from '@angular/core';\nimport {BehaviorSubject, combineLatest, Observable, of, Subscription} from 'rxjs';\nimport {ApGridPagerType, ApStatsType, IGridPagerData, MapViewMode} from '../../ap-interface';\nimport {ApPermissions} from 'invoker-transport';\nimport {\n ApDynComponentComponent\n} from '../../ap-dyncomponent/ap-dyncomponent.component';\nimport {\n ApDynGridColumnConfigBase,\n ApDynGridColumnHideConfig\n} from '../../ap-dyngrids/config/ap-dyn-grid-column-config-base';\nimport {\n ApDynGridPagerConfigBase\n} from '../../ap-dyngrids/config/ap-dyn-grid-pager-config-base';\nimport {\n ApDynGridPagerConfig,\n IDynGridWizardChoiceData\n} from '../../ap-dyngrids/config/ap-dyn-grid-pager-config';\nimport {\n ApDynGridPropertyColumnConfig,\n FilterType\n} from '../../ap-dyngrids/config/ap-dyn-grid-property-column-config';\nimport {\n ApDynGridEditColumnConfig\n} from '../../ap-dyngrids/config/ap-dyn-grid-edit-column-config';\nimport {GetRoundNumericPipe} from '../../ap-utils';\nimport {Validators} from '@angular/forms';\nimport {\n IModalDialogResult\n} from '../../ap-interface/interfaces/ap-modaldialog-data.interface';\nimport {\n CropTypeStore\n} from '../../stores/base-data/crop.types.store';\nimport {\n SettingsStore\n} from '../../stores/base-data/settings.store';\nimport {\n FieldStore\n} from '../../stores/farm/field.store';\nimport {filter, map, skip} from 'rxjs/operators';\nimport {\n LandUseStore\n} from '../../stores/base-data/landuse.store';\nimport {\n StatisticStore\n} from '../../stores/statistic/statistic.store';\nimport {\n FormStore\n} from '../../stores/layout/form.store';\nimport {\n MapViewStore\n} from '../../stores/layout/mapview.store';\nimport {\n ModalDialogStore\n} from '../../stores/dialog/modal.dialog.store';\nimport {\n TranslationStore\n} from '../../stores/translation/translation.store';\nimport {\n MapStore\n} from '../../stores/map/map.store';\nimport {\n GetPermissionPipe\n} from '../../ap-permission/pipes/get-permission.pipe';\nimport {\n ParameterDefinitionStore\n} from '../../stores/parameter/parameter.definition.store';\nimport {\n GetRoundNumericService\n} from '../../ap-utils/service/get-round-numeric.service';\nimport {\n CampaignYearStore\n} from '../../stores/login/campaignyear.store';\nimport {\n LoginStore\n} from '../../stores/login/login.store';\nimport {\n ParameterValuesStore\n} from '../../stores/parameter/parameter.values.store';\nimport {\n ApDynformsConfigFieldset\n} from '../../ap-dynforms/config/ap-dynforms-config-fieldset';\nimport {\n ApDynformsValidator\n} from '../../ap-dynforms/ap-dynforms-validator';\nimport {\n ApDynformsConfigComboBox\n} from '../../ap-dynforms/config/ap-dynforms-config-combobox';\nimport {\n ApDynformsConfigNumerictextbox\n} from '../../ap-dynforms/config/ap-dynforms-config-numerictextbox';\nimport {\n ApDynformsConfigCheckbox\n} from '../../ap-dynforms/config/ap-dynforms-config-checkbox';\nimport {\n ApDynformsConfigPlaceholder\n} from '../../ap-dynforms/config/ap-dynforms-config-placeholder';\nimport {Create, ObjectFactory} from 'ts-tooling';\nimport {\n ApGetCropService\n} from '../../stores/services/ap-get-crop.service';\nimport {\n ModalDialogPresets\n} from '../../stores/dialog/modal.dialog.presets';\nimport {\n ApUtilService\n} from '../../ap-utils/service/ap-util.service';\nimport {\n ApDynGridStatusColumnConfig\n} from '../../ap-dyngrids/config/ap-dyn-grid-status-column-config';\nimport {\n JobsStore\n} from '../../stores/administration/jobs.store';\nimport * as download from 'downloadjs';\nimport {\n MapFactoryRequestor\n} from '../../map-factory/map-factory-requestor';\nimport {\n ApGetCropStatisticService\n} from '../../stores/services/ap-get-crop-statistic.service';\nimport {\n ApEditFieldComponent\n} from '../../entry-components/ap-field-management-entry-components/ap-edit-field.component';\nimport {\n LanguageStore\n} from '../../stores/translation/language.store';\nimport {\n ApDateService\n} from '../../ap-core/services/ap-date-service';\nimport {\n ApMergeFieldComponent,\n MergeNewFieldName\n} from '../../entry-components/ap-field-management-entry-components/ap-merge-field.component';\nimport {\n FieldFactoryService\n} from '../../factories/field-factory.service';\nimport {\n FieldGridDataFactoryService,\n IFieldGridData\n} from '../../factories/field-grid-data-factory.service';\nimport {\n NotifyStore\n} from '../../stores/dialog/notify.store';\nimport {\n ApSplitFieldComponent,\n SplitFieldData\n} from '../../entry-components/ap-field-management-entry-components/ap-split-field.component';\nimport {FieldService} from './field.service';\nimport {\n ApRoleTypeService\n} from '../../services/common/ap-role-type.service';\nimport {\n ApDynGridGroupColumnConfig\n} from '../../ap-dyngrids/config/ap-dyn-grid-group-column-config';\nimport {\n ApTooltipContentService\n} from '../../ap-utils/service/ap-tooltip-content.service';\nimport {\n StatisticService\n} from '../../services/data/statistic.service';\nimport IParameterValue = Data.Parameter.IParameterValue;\nimport IField = Data.FieldManagement.IField;\nimport ILanduse = Data.BaseData.ILanduse;\nimport ParameterType = Data.Parameter.Enums.ParameterType;\nimport IFieldCrop = Data.FieldManagement.IFieldCrop;\nimport IGuid = System.IGuid;\nimport IApValidationResult = Data.Api.Validation.IApValidationResult;\nimport ApValidationLevel = Data.Api.Validation.ApValidationLevel;\n\nexport enum FieldMassEditAction {\n EditMainCrop = 0,\n EditSecondCrop = 1,\n ResetMainCrop = 2,\n ResetSecondCrop = 3,\n MergeFields = 4,\n UpdateCropNote = 5,\n DeleteFields = 6\n}\n\ntype PreviousCurrentValue = {\n PreviousValue: number;\n CurrentValue: number\n};\n\n/**\n * Component for the field overview\n */\n@Component({\n selector: 'ap-field-overview',\n template: `\n \n \n \n {{ Description }}\n \n `\n})\nexport class FieldOverviewComponent implements OnInit, AfterContentInit, OnDestroy {\n @ViewChild(ApDynComponentComponent, {static: true}) dynComponent: ApDynComponentComponent;\n @ViewChild('ComboBoxCropTypeItem', {static: true}) comboBoxCropTypeItem: TemplateRef;\n public readonly ValueNotSet: number = undefined;\n\n public fieldsLoadingOrSaving$ = of(false);\n public items$: Observable = of([]);\n public columns$: Observable = of([]);\n public pager$: Observable;\n public filter: string;\n public caption: string;\n public ApPermissions = ApPermissions;\n\n private _currentMultiSelectFormValue = {};\n private _subscriptions: Array = [];\n private _landuse: ILanduse[];\n private _onSelectionChanged: Subscription;\n private _deleteFieldIds: any;\n private _checkForPlanBooksOnDelete = false;\n private _applyClickedEvent = new EventEmitter();\n private _onEditEvent = new EventEmitter();\n private _onSplitEvent = new EventEmitter();\n private _onDeleteEvent = new EventEmitter();\n private _onDownloadPackageEvent = new EventEmitter();\n private _mainCropId$ = new BehaviorSubject(undefined);\n private _secondCropId$ = new BehaviorSubject(undefined);\n private _mainCropMassEditChanged$ = new BehaviorSubject(undefined);\n private _secondCropMassEditChanged$ = new BehaviorSubject(undefined);\n private _massEditPagerData: IGridPagerData;\n\n constructor(private fieldStore: FieldStore,\n private fieldService: FieldService,\n public campaignYearStore: CampaignYearStore,\n private formStore: FormStore,\n private cropTypeStore: CropTypeStore,\n private permissionPipe: GetPermissionPipe,\n private mapViewStore: MapViewStore,\n private roundNumericPipe: GetRoundNumericPipe,\n private roundNumericService: GetRoundNumericService,\n private settingsStore: SettingsStore,\n private mapStore: MapStore,\n private landUseStore: LandUseStore,\n private loginStore: LoginStore,\n private languageStore: LanguageStore,\n private translationStore: TranslationStore,\n private statisticStore: StatisticStore,\n private modalDialogPresets: ModalDialogPresets,\n private modalDialogStore: ModalDialogStore,\n private getCropService: ApGetCropService,\n private cropStatistic: ApGetCropStatisticService,\n private parameterDefinitionStore: ParameterDefinitionStore,\n private parameterValueStore: ParameterValuesStore,\n private dateService: ApDateService,\n private jobStore: JobsStore,\n private statisticService: StatisticService,\n private fieldFactory: FieldFactoryService,\n private fieldGridDataFactory: FieldGridDataFactoryService,\n private tooltipContentService: ApTooltipContentService,\n private notifyStore: NotifyStore) {\n }\n\n public ngOnInit(): void {\n this.mapViewStore.goIntoMapMenuSync();\n this.fieldsLoadingOrSaving$ = combineLatest([\n this.fieldStore.Listen(s => s.loading),\n this.fieldStore.Listen(s => s.saving)\n ]).pipe(\n map(([loading, saving]) => loading || saving)\n );\n this._gridBuilder();\n this._onSelectionChanged = this.dynComponent.SelectedItems$.subscribe(d => this._selectionChange(d));\n this.items$ = this._getItems();\n }\n\n public ngAfterContentInit(): void {\n this.mapStore.Editor.ClearMergeFieldResult();\n this._subscriptions.push(this._applyClickedEvent.subscribe((e) => this._onApplyClicked(e)));\n this._subscriptions.push(this.fieldStore.Listen(s => s.saved).subscribe(saved => this._onFiledStoreSaved(saved)));\n this._subscriptions.push(this.fieldStore.Listen(s => s.fieldCropsSaved).subscribe(saved => this._fieldCropSaved(saved)));\n this._subscriptions.push(this._onEditEvent.subscribe((e: IFieldGridData) => this.onEdit(e)));\n this._subscriptions.push(this._onSplitEvent.subscribe((e: IFieldGridData) => this._onSplit(e)));\n this._subscriptions.push(this._onDeleteEvent.subscribe((e: IFieldGridData) => this._openDeleteDialog([e])));\n this._subscriptions.push(this._onDownloadPackageEvent.subscribe((e: IFieldGridData) => this._onDownloadPackageId(e.PackageId)));\n this._subscriptions.push(this.mapStore.Listen(x => x.mergeFieldResult).subscribe((mergeResult) => this._onMerge(mergeResult)));\n this._subscriptions.push(this.dynComponent.gridInitialized.subscribe((): void => {\n this._subscriptions.push(this.dynComponent.dynGrid.gridPager.gridMultiSelect.formValueChanges.subscribe(v => this._onFormValuesChange(v)));\n }));\n this._subscriptions.push(this.dynComponent.SelectedItems$.subscribe((items: any[]): void => this._onSelectedItems(items)));\n this._subscriptions.push(this.formStore.FormClose$.subscribe(() => this.mapStore.Editor.CloseEditor(this.fieldStore)));\n this._subscriptions.push(this.modalDialogStore.Listen(s => s.result).pipe(skip(1)).subscribe(c => {\n this._modalDialogOkClicked(c);\n }));\n this._subscriptions.push(this._preparePlanBookCheckDialog());\n this._subscriptions.push(this.landUseStore.Listen(s => s.data).subscribe(landUse => {\n this._landuse = landUse;\n }));\n }\n\n private _preparePlanBookCheckDialog(): Subscription {\n return this.fieldStore.Listen(s => s.fieldPlanBooksResult).subscribe(planBooks => {\n if (planBooks != null) {\n if (this._checkForPlanBooksOnDelete) {\n if (planBooks === true) {\n this.modalDialogStore.setModalDialogData(this.modalDialogPresets.ExistPlanBooksDialog(\n {\n confirmKey: 'confirmFieldOverview',\n title: 'HdrConfirm',\n message: 'Global__Dialog_Message_CheckPlanBooks'\n }));\n } else {\n this.fieldStore.deleteFields(this._deleteFieldIds);\n }\n }\n this._checkForPlanBooksOnDelete = false;\n this.fieldStore.clearFieldPlanBooksResult();\n }\n });\n }\n\n public ngOnDestroy(): void {\n this.statisticStore.removeStatisticData();\n this._subscriptions.forEach(d => d.unsubscribe());\n this._onSelectionChanged?.unsubscribe();\n }\n\n private _onSelectedItems(items: any[]): void {\n const selectedCrops: IFieldCrop[] = items.map((item: IFieldGridData) => item.SourceItem.FieldCrops.Find((crop) => this.campaignYearStore.isSelectedCampaignYear(crop)));\n if (selectedCrops.length !== 0 && selectedCrops.every((v, _, a) => !!v && !!a[0] && v.CroptypeId === a[0].CroptypeId)) {\n this._mainCropId$.next(selectedCrops[0].CroptypeId);\n } else {\n this._mainCropId$.next(undefined);\n }\n if (selectedCrops.length !== 0 && selectedCrops.every((v, _, a) => !!v && !!a[0] && v.CroptypeSecondId === a[0].CroptypeSecondId)) {\n this._secondCropId$.next(selectedCrops[0].CroptypeSecondId);\n } else {\n this._secondCropId$.next(undefined);\n }\n }\n\n private _onFormValuesChange(controlValue: { control: string, value: any }): void {\n const previousValue = this._currentMultiSelectFormValue[controlValue.control];\n this._currentMultiSelectFormValue[controlValue.control] = controlValue.value;\n if (controlValue.control === 'MainCrop') {\n this._mainCropMassEditChanged$.next({PreviousValue: previousValue, CurrentValue: controlValue.value});\n }\n if (controlValue.control === 'SecondCrop') {\n this._secondCropMassEditChanged$.next({PreviousValue: previousValue, CurrentValue: controlValue.value});\n }\n }\n\n private _getItems(): Observable {\n return this.fieldStore.Fields$.pipe(\n filter(fields => !!fields),\n map(fields => {\n return fields.map(field => {\n const selectedCampaignYear = this.campaignYearStore.SelectedCampaignYear;\n const geom = this.fieldStore.getCurrentFieldGeom(field);\n const adminArea = Create(geom?.AdminArea, 0);\n const area = adminArea > 0 ? adminArea / 10000 : '-';\n const status = this.fieldService.getGeomStatus(geom, selectedCampaignYear);\n const pack = geom?.FieldGeomPackages?.Find(_ => _?.Year === selectedCampaignYear.Year);\n const mainCrop = this.getCropService.parseMainCrop(field);\n const fieldCrop = mainCrop ? this.getCropService.getFieldCrop(field) : null;\n return {\n Id: field.Id,\n Status: status,\n StatusClass: status === 1 ? 'ap-status-green' : 'ap-status-red',\n StatusDesc: '',\n SourceItem: field,\n Geom: geom,\n Note: fieldCrop?.Note,\n NrSNr: this.fieldStore.getFieldNumberAndSubNumber(field),\n LandUse: '', // not yet available. Maybe in future we take it from wsv_raster_meta_data\n Area: area === '-' ? undefined : this.roundNumericService.roundAsNumber(area, this.settingsStore.FirstSetting.DigitsAfterDecimalPoint),\n AreaOriginal: area === '-' ? undefined : area.toString(10),\n MainCrop: mainCrop,\n SecondCrop: this.getCropService.parseSecondCrop(field),\n CropData: fieldCrop,\n MainCropExpectedYield: this.getCropService.parseMainCropExpectedYield(field),\n SecondCropExpectedYield: this.getCropService.parseSecondCropExpectedYield(field),\n StrawHarvested: this.getCropService.parseStrawHarvested(field),\n PackageId: pack?.PackageId,\n Creation: geom?.CreatedAt ? this.dateService.toFarmDateFromUtcGetJsDate(geom?.CreatedAt, this.languageStore.IsoDateTimeFormat) : null,\n } as IFieldGridData;\n });\n })\n );\n }\n\n private _selectionChange(selectedItems: IFieldGridData[]): void {\n if (this.dynComponent.items?.length <= 0 && selectedItems?.length <= 0) {\n return;\n }\n let itemsToSelect: IFieldGridData[] = selectedItems;\n if (itemsToSelect && itemsToSelect.length > 0) {\n this.fieldStore.changeSelectedField(itemsToSelect.map(x => x.Id?.toString()));\n } else {\n itemsToSelect = this.dynComponent.items as IFieldGridData[];\n this.fieldStore.changeSelectedField([]);\n this.fieldStore.zoomFarmFields();\n }\n this._createStatistic(itemsToSelect);\n }\n\n private _onMerge(mergeResult: string): void {\n if (mergeResult != null && this.dynComponent != null) {\n const mergeResultJSON = JSON.parse(mergeResult);\n if (mergeResultJSON.type !== 'Polygon') {\n const message = {\n DisplayTimeout: 10,\n Level: Data.Api.Validation.ApValidationLevel.Warning,\n ErrorKey: 'Field__Merge_Error_Distance'\n } as IApValidationResult;\n this.notifyStore.addMessage(message);\n return;\n }\n this.fieldService.ShowMapGoIn();\n const gridSelectedKeys = this.fieldStore.getSelectedFieldIds();\n const emptyRecord: IFieldGridData = this.fieldGridDataFactory.CreateNew(\n this.fieldFactory.CreateNew({\n FieldName: this.translationStore.FindTranslationForSelectedLanguage(MergeNewFieldName),\n FieldNumber: '0',\n FieldSubnumber: '0'\n }),\n {Id: -1}\n );\n this.formStore.openForm({\n component: ApMergeFieldComponent, data: {\n CurrentItem: this.dynComponent.getSelectedItems()[0],\n AllItems: this.dynComponent.getSelectedItems().concat(emptyRecord),\n gridSelectedKeys,\n }\n });\n\n this.mapStore.Editor.ClearMergeFieldResult();\n const geomIds: IGuid[] = (this.dynComponent.getSelectedItems() as IFieldGridData[]).map(value => value.Geom.Id);\n this.fieldStore.fieldsToIgnoreInSnap = [geomIds[1].toString()];\n this.fieldStore.editFields([geomIds[0]]);\n this.mapStore.Editor.PrepareModifyMergedField(geomIds, mergeResultJSON.coordinates, this.fieldStore);\n }\n }\n\n private _onFiledStoreSaved(saved: boolean): void {\n if (saved) {\n setTimeout(() => this.mapStore.Layers.PolygonEditLayer.clearSelection(), 1);\n this.mapStore.Layers.PolygonEditLayer.clear();\n this.formStore.closeForm();\n }\n }\n\n private _fieldCropSaved(saved: boolean | undefined): void {\n if (saved === undefined) {\n return;\n }\n if (saved) {\n this.notifyStore.showSaveSuccessMessage();\n } else {\n this.notifyStore.showSaveFailMessage();\n }\n }\n\n private _onDownloadPackageId(packageId: IGuid): void {\n MapFactoryRequestor.getPackage(packageId).then(d => {\n download(d, `${packageId}.zip`, 'application/zip');\n }).catch(err => console.warn(`download of package ${packageId} fails`, err));\n }\n\n private _onSplit($event: any): void {\n if (!$event.SourceItem) {\n console.warn('No source item!');\n return;\n }\n const geom = this.fieldStore.getCurrentFieldGeom($event.SourceItem);\n const fieldOriginal = new SplitFieldData($event.SourceItem.FieldName, $event.SourceItem.FieldNumber, $event.SourceItem.FieldSubnumber);\n fieldOriginal.Id = $event.SourceItem.Id;\n fieldOriginal.MainCrop = $event.CropData?.CroptypeId;\n fieldOriginal.MainCropYieldUnit = $event.CropData?.ExpectedYield;\n fieldOriginal.SecondCrop = $event.CropData?.CroptypeSecondId;\n fieldOriginal.SecondCropYieldUnit = $event.CropData?.ExpectedYieldSecond;\n fieldOriginal.RemoveResidues = $event.CropData?.StrawHarvested ?? false;\n fieldOriginal.Note = $event.CropData?.Note;\n\n this.formStore.openForm({\n component: ApSplitFieldComponent, data: {\n OldField: fieldOriginal,\n FieldOne: new SplitFieldData($event.SourceItem.FieldName, $event.SourceItem.FieldNumber, $event.SourceItem.FieldSubnumber),\n FieldTwo: new SplitFieldData($event.SourceItem.FieldName, $event.SourceItem.FieldNumber, $event.SourceItem.FieldSubnumber)\n }\n });\n this.mapStore.Editor.PrepareSplitField(geom.Id, this.fieldStore);\n }\n\n public onEdit($event: any): void {\n const geom = this.fieldStore.getCurrentFieldGeom($event.SourceItem);\n if (!$event.SourceItem || !geom) {\n console.warn(`no source item or default geom`);\n return;\n }\n this.fieldService.ShowMapGoIn();\n const gridSelectedKeys = this.fieldStore.getSelectedFieldIds();\n this.formStore.openForm({\n component: ApEditFieldComponent, data: {\n SourceItem: $event.SourceItem,\n gridSelectedKeys,\n }\n });\n this.fieldStore.editFields([geom.Id]);\n this.fieldStore.changeSelectedField([$event.SourceItem.Id]);\n this.mapStore.Editor.PrepareOpenEditBar();\n }\n\n public onCreate(): void {\n this.fieldService.OpenCreateForm();\n }\n\n private _gridBuilder(): void {\n this.columns$ =\n combineLatest([\n this.permissionPipe.transform(ApPermissions.EDIT_FIELDS),\n this.loginStore.User$,\n this.languageStore.SelectedLanguage$,\n ]).pipe(map(([permission, user, language]) => [\n new ApDynGridStatusColumnConfig({\n field: 'Status',\n showHeaderTitle: false,\n class: 'StatusClass',\n description: 'StatusDesc',\n pending: this.jobStore.BlockedFieldIdsBuWsvCeIrRbFieldRaster$,\n pendingTooltip: this.jobStore.BlockedFieldIdsBuWsvCeIrRbFieldRasterTooltip$,\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__NumberAbbr',\n field: 'SourceItem.FieldNumber',\n filterable: true,\n hide: true,\n filterType: FilterType.NUMBER,\n cssClass: 'right',\n headerFilterable: true,\n width: 40\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__FieldPartShort',\n field: 'SourceItem.FieldSubnumber',\n filterable: true,\n hide: true,\n filterType: FilterType.NUMBER,\n cssClass: 'right',\n headerFilterable: true,\n width: 40\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__NumberAbbr',\n field: 'NrSNr',\n filterable: true,\n hide: new ApDynGridColumnHideConfig({\n mapHide: false,\n selfHide: this.mapViewStore.Listen(s => s.mode).pipe(map((m) => m !== MapViewMode.NORMAL)),\n }),\n width: 75,\n headerFilterable: true\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__FieldName',\n field: 'SourceItem.FieldName',\n filterable: true,\n headerFilterable: true,\n sortIndex: 0,\n sortDesc: false,\n width: 120,\n cssClass: 'left'\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__Area_Unit',\n field: 'Area',\n headerFilterable: true,\n width: 60,\n tooltip: (dataItem) => dataItem['AreaOriginal'],\n filterType: FilterType.NUMBER,\n cssClass: 'right',\n pipes: [{\n pipe: this.roundNumericPipe,\n args: [this.settingsStore.FirstSetting.DigitsAfterDecimalPoint]\n }]\n }),\n new ApDynGridGroupColumnConfig({\n title: 'MainCrop',\n groupColumns: [\n new ApDynGridPropertyColumnConfig({\n title: 'MainCrop',\n field: 'MainCrop',\n filterable: true,\n headerFilterable: true,\n width: 100\n }),\n new ApDynGridPropertyColumnConfig({\n field: 'MainCropExpectedYield',\n title: 'Global__YieldUnit',\n headerFilterable: true,\n width: 60,\n cssClass: 'right',\n filterType: FilterType.NUMBER,\n hide: true,\n pipes: [{\n pipe: this.roundNumericPipe,\n args: [this.settingsStore.FirstSetting.DigitsAfterDecimalPoint]\n }]\n }),\n new ApDynGridPropertyColumnConfig({\n field: 'StrawHarvested',\n title: 'Nutrients_Pages__StrawRemoved',\n hide: true,\n checkbox: true,\n width: 40\n }),\n new ApDynGridPropertyColumnConfig({\n field: 'Note',\n title: 'Global__Fieldcrop_Notes',\n tooltip: (dataItem) => this.tooltipContentService.generateCropNoteTooltip(dataItem['Note']),\n width: 120\n })\n ]\n }),\n new ApDynGridGroupColumnConfig({\n title: 'SecondCrop',\n groupColumns: [\n new ApDynGridPropertyColumnConfig({\n title: 'SecondCrop',\n field: 'SecondCrop',\n filterable: true,\n headerFilterable: true,\n width: 100\n }),\n new ApDynGridPropertyColumnConfig({\n field: 'SecondCropExpectedYield',\n title: 'Global__YieldUnit',\n hide: true,\n headerFilterable: true,\n width: 60,\n cssClass: 'right',\n filterType: FilterType.NUMBER,\n pipes: [{\n pipe: this.roundNumericPipe,\n args: [this.settingsStore.FirstSetting.DigitsAfterDecimalPoint, {ToReplace: [''], ReplaceWith: ''}]\n }]\n })\n ]\n }),\n new ApDynGridPropertyColumnConfig({\n field: 'SourceItem.Soilgroups',\n title: 'Nutrients_Pages__SoilGroup',\n filterable: true,\n hide: true,\n headerFilterable: true,\n width: 80,\n cssClass: 'right',\n filterType: FilterType.NUMBER\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__FieldGeom_Creation_Date',\n field: 'Creation',\n format: `${language.DateFormat} HH:mm`,\n width: 80,\n hide: true\n }),\n new ApDynGridEditColumnConfig({\n data: (() => {\n const options = [\n {\n text: 'Global__Edit',\n callback: this._onEditEvent,\n disabled: () => !this.campaignYearStore.IsHighestCampaignYear\n },\n {\n text: 'Global__Delete',\n classList: 'delete',\n callback: this._onDeleteEvent,\n disabled: () => !this.campaignYearStore.IsHighestCampaignYear\n },\n {\n text: 'Global__Split',\n callback: this._onSplitEvent,\n disabled: () => !this.campaignYearStore.IsHighestCampaignYear\n }\n ];\n\n if (ApRoleTypeService.hasAgriconRole(user)) {\n options.Add({\n text: 'Global__Download',\n callback: this._onDownloadPackageEvent,\n disabled: () => false\n });\n }\n return options;\n })(),\n disabled: !permission,\n }\n )\n ]));\n\n this.pager$ = this.permissionPipe.transform(ApPermissions.EDIT_FIELDS).pipe(\n map((permission) => new ApDynGridPagerConfig({\n listMassEditing: this._fillWizardChoiceData(),\n apply: this._applyClickedEvent,\n hasPermission: permission,\n preselect: false\n })));\n }\n\n private _fillWizardChoiceData(): IDynGridWizardChoiceData[] | Observable {\n return combineLatest([\n this.cropTypeStore.Listen(s => s.data).asObservable(),\n this.campaignYearStore.Listen(s => s.selectedYear)\n ]).pipe(map(([crops]) => {\n const result = [\n {\n id: FieldMassEditAction.EditMainCrop,\n type: ApGridPagerType.None,\n name: this.translationStore.FindTranslationForSelectedLanguage('MainCrop'),\n onSubmit: this._applyClickedEvent,\n onChoiceSelect: ApUtilService.createEventEmitter(() => {\n const value = this._mainCropId$.getValue();\n this._mainCropId$.next(undefined);\n this._mainCropId$.next(value);\n }, this._subscriptions),\n formConfig: [\n new ApDynformsConfigFieldset({\n key: 'MainCropFieldSet',\n config: [\n new ApDynformsConfigComboBox({\n key: 'MainCrop',\n valueField: 'Id',\n textField: 'Description',\n valuePrimitive: true,\n label: 'MainCrop',\n options: this._mainCropId$.pipe(\n map((id) => crops.filter((c) => c.Selected || c.Id === id))\n ),\n validators: [\n new ApDynformsValidator({validator: Validators.required, errorKey: ''}),\n ],\n value: this._mainCropId$.getValue(),\n value$: this._mainCropId$,\n itemTemplate: this.comboBoxCropTypeItem,\n }),\n new ApDynformsConfigNumerictextbox({\n key: 'MainCrop_YieldUnit',\n label: 'Global__YieldUnit',\n min: 0,\n validators: [\n new ApDynformsValidator({validator: Validators.required, errorKey: ''}),\n ],\n value$: this._mainCropMassEditChanged$.pipe(map((cropValueChange) => {\n const originalCropFromSelectedFields = this._mainCropId$.getValue(); // undefined if they have different crops\n if (!cropValueChange?.PreviousValue && cropValueChange && cropValueChange.CurrentValue && cropValueChange.CurrentValue === originalCropFromSelectedFields) {\n const mainCrops = this.dynComponent.getSelectedItems()?.map((item) => ObjectFactory.Get(item, 'SourceItem.FieldCrops.0') as IFieldCrop);\n if (mainCrops.length !== 0 && mainCrops.every((c) => c?.ExpectedYield === mainCrops[0].ExpectedYield)) {\n return mainCrops[0].ExpectedYield;\n }\n return undefined;\n } else {\n return this.cropTypeStore.CropTypes.Find(c => c?.Id === cropValueChange?.CurrentValue)?.ExpectedYield;\n }\n }))\n }),\n new ApDynformsConfigCheckbox({\n key: 'RemoveResidues',\n label: 'Nutrients_Pages_Popups__RemoveResidues',\n value$: this.dynComponent.SelectedItems$.pipe(map((items) => {\n const mainCrops = items.map((item) => ObjectFactory.Get(item, 'SourceItem.FieldCrops.0') as IFieldCrop);\n if (mainCrops.length !== 0 && mainCrops.every((v, _, a) =>\n !!v && !!a[0] && v.StrawHarvested === a[0].StrawHarvested)) {\n return mainCrops[0].StrawHarvested;\n }\n return undefined;\n }))\n }),\n new ApDynformsConfigPlaceholder(),\n ]\n })\n ]\n } as IDynGridWizardChoiceData,\n {\n id: FieldMassEditAction.ResetMainCrop,\n type: ApGridPagerType.None,\n name: this.translationStore.FindTranslationForSelectedLanguage('CropRotation__MainCrop_remove'), // 'Global__Reset_MainCrop'),\n onSubmit: this._applyClickedEvent,\n } as IDynGridWizardChoiceData,\n {\n id: FieldMassEditAction.EditSecondCrop,\n type: ApGridPagerType.None,\n name: this.translationStore.FindTranslationForSelectedLanguage('SecondCrop'),\n onSubmit: this._applyClickedEvent,\n onChoiceSelect: ApUtilService.createEventEmitter(() => {\n const value = this._secondCropId$.getValue();\n this._secondCropId$.next(undefined);\n this._secondCropId$.next(value);\n }, this._subscriptions),\n formConfig: [\n new ApDynformsConfigFieldset({\n key: 'SecondCropFieldSet',\n config: [\n new ApDynformsConfigComboBox({\n key: 'SecondCrop',\n valueField: 'Id',\n textField: 'Description',\n valuePrimitive: true,\n label: 'SecondCrop',\n options: this._secondCropId$.pipe(\n map((id) => crops.filter((c) => c.Selected || c.Id === id))\n ),\n validators: [\n new ApDynformsValidator({validator: Validators.required, errorKey: ''}),\n ],\n value$: this._secondCropId$,\n itemTemplate: this.comboBoxCropTypeItem,\n }),\n new ApDynformsConfigNumerictextbox({\n key: 'SecondCrop_YieldUnit',\n label: 'Global__Yield_Removal_Unit',\n min: 0,\n validators: [\n new ApDynformsValidator({validator: Validators.required, errorKey: ''}),\n ],\n value$: this._secondCropMassEditChanged$.pipe(map((cropValueChange) => {\n const originalCropFromSelectedFields = this._secondCropId$.getValue(); // undefined if they have different crops\n if (!cropValueChange?.PreviousValue && cropValueChange && cropValueChange.CurrentValue && cropValueChange.CurrentValue === originalCropFromSelectedFields) {\n const mainCrops = this.dynComponent.getSelectedItems()?.map((item) => ObjectFactory.Get(item, 'SourceItem.FieldCrops.0') as IFieldCrop);\n if (mainCrops.length !== 0 && mainCrops.every((c) => c?.ExpectedYieldSecond === mainCrops[0].ExpectedYieldSecond)) {\n return mainCrops[0].ExpectedYieldSecond;\n }\n return undefined;\n } else {\n // if we have valid croptype => default is 0 for second croptype\n return this.cropTypeStore.CropTypes.Find(c => c?.Id === cropValueChange?.CurrentValue)?.Id > 0 ? 0 : undefined;\n }\n }))\n }),\n ]\n })\n ]\n } as IDynGridWizardChoiceData,\n {\n id: FieldMassEditAction.ResetSecondCrop,\n type: ApGridPagerType.None,\n name: this.translationStore.FindTranslationForSelectedLanguage('CropRotation__SecondCrop_remove'),\n onSubmit: this._applyClickedEvent,\n } as IDynGridWizardChoiceData,\n {\n id: FieldMassEditAction.UpdateCropNote,\n name: this.translationStore.FindTranslationForSelectedLanguage('Global__Fieldcrop_Notes'),\n type: ApGridPagerType.Text,\n values: null,\n onSubmit: this._applyClickedEvent\n } as IDynGridWizardChoiceData,\n {\n id: FieldMassEditAction.DeleteFields,\n name: this.translationStore.FindTranslationForSelectedLanguage('Base__MapMenuItemEdit_DeleteToolTip'),\n type: ApGridPagerType.None,\n values: null,\n onSubmit: this._applyClickedEvent\n } as IDynGridWizardChoiceData\n ];\n\n if (this.campaignYearStore.IsHighestCampaignYear) {\n result.push({\n id: FieldMassEditAction.MergeFields,\n type: ApGridPagerType.None,\n name: 'Field__Merge',\n onSubmit: this._applyClickedEvent\n } as IDynGridWizardChoiceData);\n }\n\n return result;\n }));\n }\n\n private _createStatistic(selectedItems: IFieldGridData[]): void {\n const totalItems = this.dynComponent.items as IFieldGridData[];\n const dataForTitles = totalItems.map(x => ({\n AreaHa: x.Area,\n Selected: selectedItems.some(z => z.Id === x.Id)\n }));\n const title = this.statisticService.generateFieldsAreaTitle(dataForTitles);\n this.statisticStore.setStatisticData(\n this.cropStatistic.gatherFieldCropsChartData(selectedItems.map(x => x.SourceItem)),\n ApStatsType.MainSecondCrop, title, ''\n );\n this.statisticStore.addSelection([{\n text: this.campaignYearStore.SelectedCampaignYear.Year.toString(),\n value: this.campaignYearStore.SelectedCampaignYear.Year\n }]);\n this.statisticStore.selectFromSelection(this.campaignYearStore.SelectedCampaignYear.Year);\n }\n\n private _onApplyClicked(event: IGridPagerData): void {\n if (!event.object) {\n this.notifyStore.addMessage({\n Level: ApValidationLevel.Warning,\n Counter: 1,\n ErrorKey: 'Something went wrong',\n UserId: null,\n UserName: null,\n DisplayTimeout: 3,\n Parameters: null\n });\n return;\n }\n\n const fieldsAmount = this.dynComponent.getSelectedItems().length;\n if (fieldsAmount > 10) {\n this._massEditPagerData = event;\n this.modalDialogStore.setModalDialogData(this.modalDialogPresets.ExistPlanBooksDialog(\n {\n confirmKey: 'confirmMassEdit',\n title: 'HdrConfirm',\n message: this.translationStore.FindTranslationForSelectedLanguage('Global_Message_Edit_Fields_Number', [fieldsAmount.toString()])\n }));\n } else {\n this.applyMassEditAction(event);\n }\n }\n\n private applyMassEditAction(event: IGridPagerData): void {\n const availableCroptypes = this.cropTypeStore.Listen((s) => s.data).getValue();\n\n switch (event.object.id) {\n case FieldMassEditAction.EditMainCrop: { // Hauptfrucht aktualisieren\n const fields = this.dynComponent.getSelectedItems().map((item) => item['SourceItem'] as IField);\n this.fieldStore.saveField(ObjectFactory.Copy(fields).map((field) => {\n const geom = this.fieldStore.getCurrentFieldGeom(field);\n const crop = field.FieldCrops.Find((c) => this.campaignYearStore.isSelectedCampaignYear(c));\n const cropType = availableCroptypes.Find((ct) => ct?.Id === this._currentMultiSelectFormValue['MainCrop']);\n let expectedYield = this._currentMultiSelectFormValue['MainCrop_YieldUnit'];\n // if value has not been changed by customer => use old value\n // the value is not set because the selected fields have different expected yields\n if (expectedYield === this.ValueNotSet) {\n expectedYield = crop ? crop.ExpectedYield : null;\n }\n if (crop) {\n crop.CroptypeId = cropType ? cropType.Id : null;\n crop.Cropkey = cropType ? cropType.CropKey : null;\n crop.ExpectedYield = expectedYield; // cropType ? this.currentMultiSelectFormValue['MainCrop_YieldUnit'] : null;\n crop.StrawHarvested = this._currentMultiSelectFormValue['RemoveResidues'];\n } else {\n field.FieldCrops.push({\n FieldId: field.Id,\n AdminArea: Create(geom?.AdminArea, 0),\n AreaHa: Create(geom?.AreaHa, 0),\n CroptypeId: cropType ? cropType.Id : null,\n Cropkey: cropType ? cropType.CropKey : null,\n ExpectedYield: expectedYield, // cropType ? this.currentMultiSelectFormValue['MainCrop_YieldUnit'] : null,\n StrawHarvested: this._currentMultiSelectFormValue['RemoveResidues'],\n FarmId: field.FarmId,\n } as unknown as IFieldCrop);\n }\n return field;\n }), this.campaignYearStore.SelectedCampaignYear.DefaultStart, this.campaignYearStore.SelectedCampaignYear.DefaultEnd);\n break;\n }\n case FieldMassEditAction.EditSecondCrop: { // Nebenfrucht aktualisieren\n const cropTypeSecond = availableCroptypes.Find((ct) => ct?.Id === this._currentMultiSelectFormValue['SecondCrop']);\n const fields = this.dynComponent.getSelectedItems().map((item) => item['SourceItem'] as IField);\n this.fieldStore.saveField(ObjectFactory.Copy(fields).map((field) => {\n const geom = this.fieldStore.getCurrentFieldGeom(field);\n const crop = field.FieldCrops.Find((c) => this.campaignYearStore.isSelectedCampaignYear(c));\n if (crop) {\n crop.CroptypeSecondId = cropTypeSecond ? cropTypeSecond.Id : null;\n crop.ExpectedYieldSecond = cropTypeSecond ? this._currentMultiSelectFormValue['SecondCrop_YieldUnit'] : null;\n crop.MainSecondCropType = cropTypeSecond ? cropTypeSecond.CropKey : null;\n } else {\n field.FieldCrops.push({\n FieldId: field.Id,\n AdminArea: Create(geom?.AdminArea, 0),\n AreaHa: Create(geom?.AreaHa, 0),\n CroptypeSecondId: cropTypeSecond ? cropTypeSecond.Id : null,\n MainSecondCropType: cropTypeSecond ? cropTypeSecond.CropKey : null,\n ExpectedYieldSecond: cropTypeSecond ? this._currentMultiSelectFormValue['SecondCrop_YieldUnit'] : null,\n StrawHarvested: this._currentMultiSelectFormValue['RemoveResidues'],\n FarmId: field.FarmId,\n } as unknown as IFieldCrop);\n }\n return field;\n }), this.campaignYearStore.SelectedCampaignYear.DefaultStart, this.campaignYearStore.SelectedCampaignYear.DefaultEnd);\n break;\n }\n case FieldMassEditAction.ResetMainCrop: {\n const fields = this.dynComponent.getSelectedItems().map((item) => item['SourceItem'] as IField);\n this.fieldStore.saveField(ObjectFactory.Copy(fields).map((field) => {\n const crop = field.FieldCrops.Find((c) => this.campaignYearStore.isSelectedCampaignYear(c));\n if (crop) {\n crop.CroptypeId = null;\n crop.Cropkey = null;\n crop.ExpectedYield = null;\n }\n return field;\n }), this.campaignYearStore.SelectedCampaignYear.DefaultStart, this.campaignYearStore.SelectedCampaignYear.DefaultEnd);\n break;\n }\n case FieldMassEditAction.ResetSecondCrop: {\n const fields = this.dynComponent.getSelectedItems().map((item) => item['SourceItem'] as IField);\n this.fieldStore.saveField(ObjectFactory.Copy(fields).map((field) => {\n const crop = field.FieldCrops.Find((c) => this.campaignYearStore.isSelectedCampaignYear(c));\n if (crop) {\n crop.CroptypeSecondId = null;\n crop.MainSecondCropType = null;\n crop.ExpectedYieldSecond = null;\n }\n return field;\n }), this.campaignYearStore.SelectedCampaignYear.DefaultStart, this.campaignYearStore.SelectedCampaignYear.DefaultEnd);\n break;\n }\n case FieldMassEditAction.MergeFields: {\n if (this.dynComponent.getSelectedItems().length !== 2) {\n const message = {\n DisplayTimeout: 10,\n Level: Data.Api.Validation.ApValidationLevel.Warning,\n ErrorKey: 'Field__Error_Two_Fields'\n } as IApValidationResult;\n this.notifyStore.addMessage(message);\n break;\n }\n this.mapStore.Editor.MergeFieldGeometries(\n (this.dynComponent.getSelectedItems()[0] as IFieldGridData).Geom.Id,\n (this.dynComponent.getSelectedItems()[1] as IFieldGridData).Geom.Id\n );\n break;\n }\n case FieldMassEditAction.UpdateCropNote: {\n const selectedItems = this.dynComponent.getSelectedItems() as IFieldGridData[];\n if (!selectedItems) {\n return;\n }\n const copiedFieldCrops = selectedItems.filter(x => x.MainCrop)\n .map(item => ObjectFactory.Copy(this.getCropService.getFieldCrop(item.SourceItem)));\n if (!copiedFieldCrops || copiedFieldCrops.length <= 0) {\n return;\n }\n copiedFieldCrops.forEach(filedCrop => {\n filedCrop.Note = event.value;\n });\n this.fieldStore.saveFieldCrops(copiedFieldCrops);\n break;\n }\n case FieldMassEditAction.DeleteFields: {\n const selectedItems = this.dynComponent.getSelectedItems() as IFieldGridData[];\n if (!selectedItems) {\n return;\n }\n this._openDeleteDialog(selectedItems);\n break;\n }\n default:\n this._updateParameter(event);\n break;\n }\n }\n\n private _updateParameter(event: any): void {\n const definition = this.parameterDefinitionStore.getParameterDefinitionById(event.object.id);\n const ids = this.dynComponent.getSelectedItems().map((item) => item.Id);\n const parameterValues = ids.map((id) => {\n const result = {\n RefId: id,\n DefinitionId: definition.Id,\n FarmId: this.loginStore.SelectedFarm.Id,\n ValidFrom: new Date(this.campaignYearStore.getDefaultStart(event.form.Date.getFullYear())),\n Valid: true,\n } as IParameterValue;\n switch (definition.TypeId) {\n case ParameterType.Boolean:\n result.ValueBoolean = event.form.Value === 1;\n break;\n case ParameterType.List:\n result.ValueListKey = event.form.Value;\n break;\n case ParameterType.Number:\n result.ValueNumber = event.form.Value;\n break;\n case ParameterType.Text:\n result.ValueString = event.form.Value;\n break;\n case ParameterType.TimeStamp:\n result.ValueTimestamp = event.form.Value;\n break;\n }\n result.ValidFrom = new Date(this.campaignYearStore.getDefaultStart(event.form.Date.getFullYear()));\n return result;\n });\n\n this.parameterValueStore.updateParameterValues(parameterValues);\n }\n\n private _openDeleteDialog(selectedItems: IFieldGridData[]): void {\n this._deleteFieldIds = selectedItems.map(x => x.Id);\n let message = 'Global_Message_Delete_Field';\n if (selectedItems.length > 1) {\n const fieldList = '\\n\\n' +\n selectedItems.slice(0, 10).map(x => `${x.SourceItem.FieldNumber} ${x.SourceItem.FieldSubnumber} ${x.SourceItem.FieldName}`).join('\\n') +\n (selectedItems.length > 10 ? '\\n...' : '');\n message = this.translationStore.FindTranslationForSelectedLanguage('Global_Message_Delete_Fields_Number', [selectedItems.length.toString()]) + fieldList;\n }\n\n this.modalDialogStore.setModalDialogData(this.modalDialogPresets.DeleteDialog(\n {title: 'Global__DeleteField', message}));\n }\n\n private _modalDialogOkClicked(result: IModalDialogResult): void {\n if (result?.key === 'confirmFieldOverview') {\n this.fieldStore.deleteFields(this._deleteFieldIds);\n } else if (result?.key === 'delete') {\n this.fieldStore.clearFieldPlanBooksResult();\n this._checkForPlanBooksOnDelete = true;\n this.fieldStore.checkFieldsPlanBook(this._deleteFieldIds);\n } else if (result?.key === 'confirmMassEdit') {\n this.applyMassEditAction(this._massEditPagerData);\n }\n }\n}\n","import {Injectable} from '@angular/core';\nimport IField = Data.FieldManagement.IField;\nimport IPlantProtectionPlanBook = Data.TaskManagement.IPlantProtectionPlanBook;\n\n@Injectable({providedIn: 'root'})\nexport class PlantProtectionService {\n /**\n * Filters plant protection applications for a specific field.\n * @param field - The field to get plant protection applications. Must have an Id property.\n * @param ppPlanBooks - Array of plant protection plan books to filter from.\n * @returns Filtered array of plant protection plan books that match the field ID and have a BookedAt value.\n * Returns an empty array if the field parameter is falsy.\n * @public\n */\n public getPpApplications(field: IField, ppPlanBooks: IPlantProtectionPlanBook[]): IPlantProtectionPlanBook[] {\n if (!field) {\n return [];\n }\n return ppPlanBooks.filter(pb => !!pb && pb.FieldId === field.Id && !!pb.BookedAt);\n }\n\n /**\n * Calculates a slope factor for application rate based on water average, slope, and nitrogen uptake\n * This method determines the calculation slope by:\n * - Checking if all input parameters are valid finite numbers\n * - Returning 0 if slope invalid or undefined or slope value if slope is present but there is no avgWater or nUptake\n * - Computing slope as: (Average Water * Slope) / Nitrogen Uptake\n * Typical use cases include adjusting application rates in precision agriculture\n * based on water availability, crop-specific slope, and nitrogen uptake\n * @param slope Control factor or slope value (e.g., from application settings)\n * @param AvgWater Average water availability or water rate\n * @param nUptake Nitrogen uptake value from crop scans or measurements\n * @returns Calculated slope factor, or 0 if inputs are invalid\n */\n public getSlopeForCalculation(slope?: number, AvgWater?: number, nUptake?: number): number {\n if (!Number.isFinite(slope)) {\n return 0;\n }\n if (!Number.isFinite(AvgWater) || !Number.isFinite(nUptake)) {\n return slope;\n }\n return AvgWater * slope / nUptake;\n }\n}\n"],"sourceRoot":"webpack:///","file":"974.ef7dcacef5994d11.js"}