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hCgP,EAAgC,qBADpB,SACZA,GAAb,8DCDO,IAAMkB,EAAb,MAAM,QAOJhqB,YAAYiqB,EACAC,EACAC,EACAC,EACAC,EACAC,EACOhnB,EACAinB,EACA5mB,GAFAvD,qBACAA,wBACAA,qBACjBA,KAAI,GAA+C6pB,EACnD7pB,KAAI,GAA0C8pB,EAC9C9pB,KAAI,GAA0C+pB,EAE9C/pB,KAAKsG,SAAW0jB,EAAY3kB,OAAOkD,GAAKA,EAAE1G,MAAMuoB,MAC9CpX,OAAOxM,KAAOA,IACd0H,OAAIzH,GAAWA,EAAQuM,OAAOrH,IAAWA,EAAO0e,aAElDrqB,KAAK0G,UAAYujB,EAAa5kB,OAAOkD,GAAKA,EAAE1G,MAAMuoB,QAChDpX,KAAOxM,KAAOA,IACd0H,OAAIvH,GAAYA,EAASqM,OAAOhH,IAAYA,EAAQqe,aAEtDrqB,KAAK4G,aAAesjB,EAAgB7kB,OAAOkD,GAAKA,EAAE1G,MAAMuoB,MACtDpX,OAAOxM,KAAOA,MACd0H,KAAIrH,GAAeA,EAAYmM,OAAOhH,IAAYA,EAAQqe,2DA9BnDT,GAA2BvoB,4HAA3BuoB,EAA2BlQ,QAA3BkQ,EAA2B,qBADf,SACZA,GAAb,sCCnBO,IAAetc,EAAtB,MAAM,SAIUA,2BAAoB,uBACpBA,4BAA4B,iCAC5BA,iCAAiC,sCACjCA,oBAAoB,0BACpBA,0BAA0B,6BAK1BA,yBAAyB,4BAEzBA,qBAAqB,wBAffA,GAAtB","names":["ApReportsOverviewComponent","constructor","formStore","mapViewStore","routerStore","this","hideMapView","buildGrid","items","Id","Name","Description","Path","columns","ApDynGridPropertyColumnConfig","field","width","headerFilterable","filterable","title","ApDynGridEditColumnConfig","pager","ApDynGridPagerConfig","showReport","dataItem","navigate","i0","selectors","ctx","routes","path","component","canLoad","ApDeveloperGuard","data","login","layout","PageMode","TaskManagementReportComponent","ApReportsRoutes","RouterModule","ApReportsModule","imports","CommonModule","ApDynComponentModule","PDFExportModule","ApIconModule","ApTranslationModule","ApMapModule","ApUtilsModule","AgriportStoreModule","ApStatisticsModule","ChartModule","ctx_r14","mapStore","languageStore","loginStore","dataProviders","dateService","cropTypeStore","settingsStore","taskManagementStore","roundNumericService","translationStore","fertilizerStore","factorService","fieldStore","textProcessorService","ppCommonService","changeDetection","EventEmitter","Date","OlStyle","stroke","OlStyleStroke","color","asString","lineCap","fill","OlStyleFill","FindAll","c","idx","text","OlStyleText","ngOnInit","digitsAfterDecimal","FirstSetting","DigitsAfterDecimalPoint","currentFarm","Listen","l","farm","getValue","selectedFarm","selectedLanguage","currentDateTime","toFarmDate","exportDate","format","DateFormat","TimeFormat","taskManagementLayer","Layers","TaskManagementLayer","_subscriptions","push","drivers$","subscribe","d","drivers","machines$","machines","instruments$","instruments","MapFactoryStyler","customStyle","onCustomTaskMgmtMapStyle","length","sort","a","b","SourceItem","Position","firstItemFromPlans","itemsChunked","_","fieldsFirstPageCount","fieldsPerPageCount","forEach","reportName","replaceSpecialChars","o","planSummary","_a","Module","getExportBaseFilename","ngAfterViewInit","detectChanges","ngOnDestroy","s","unsubscribe","getModuleName","_b","isNFertilization","getFieldsCount","flat","getFieldsArea","reduce","AreaHa","getApplSumForAllFields","isNaN","ApplSum","getApplRate","item","ApplRate","toString","getProductNutrientExpr","productNutrientExp","ProductId","product","getFertilizer","i","_c","_d","content","contentOxyd","oxydKey","t","Element","_e","ShortKey","ContentP","calculate","ApElementOxydTypeEnum","ContentK","ContentMg","ContentCaO","ContentN","roundAsNumber","FindTranslationForSelectedLanguage","r","_f","_g","_h","getCropName","planBook","cropId","MainCropId","cropTypeNames","cropTypesNames","getExportDriverName","driver","Find","ExportDriver","ShortFullName","getExportMachineInstrument","machine","ExportMachine","instrument","ExportInstrument","NameWithSign","isApplModeVariable","ApplicationMode","ApApplicationMode","onRenderCompleted","renderedMaps","saveReport","isSaving","_report","export","then","group","exportPDF","paperSize","landscape","margin","ExportFormat","Key","TaskManagementConstants","SelectedExportTargetObject","sendReport","saveAs","setTimeout","exportDone","emit","getMapUrl","getMapFactoryUrl","styleData","currentMap","indexOf","map","style","clone","setText","getFieldName","Field","getElementExpression","ElementName","getProductHeader","getPpProductSumExpr","getAppliedProductSumExpr","FirstOrDefault","PpProductList","areaHa","isPpModule","ApLayerExportComponent","elem","domSanitizer","clearMapImage","initOlMap","source","OlVectorSource","exportLayersList","feature","C","S","M","sourceLayer","layer","getSource","getFeatures","find","f","V","H","getId","U","featureId","console","log","noData","F","renderCompleted","extent","te","getGeometry","getExtent","addFeature","vectorExportLayer","OlVectorLayer","setStyle","olStyle","L","getStyle","setSource","setVisible","Add","mapUrl","mapFactoryExportLayer","MapFactoryLayer","LayerGroupNames","APP_CONFIGURATION","legendGetter","Visibility","featureUrl","VectorLayer","declutter","feat","featureColorPropertyName","featureColorsArray","k","textProperty","font","textPropertyFont","getProperties","classPropertyName","Object","keys","filter","classValue","startsWith","ApDistributionClassColors","X","textValue","textPropertyFunction","textPropertyFunctionParam","method","textPropertyPrecision","toFixed","VectorSource","GeoJSON","url","tilesLoadComplete","overlayUrl","overlayTextPropertyName","OlMap","target","y","_exportMap","nativeElement","layers","controls","view","OlView","center","zoom","projection","MAP_PROJECTION","hookToMapEvents","R","T","_j","getView","_k","fit","size","Z","_l","getSize","padding","W","_m","renderSync","disableVectorLayerFill","setFill","undefined","on","tilesLoadingFunc","tilesLoadedFunc","onRenderComplete","saveTimeoutHandle","getPngFromOlMap","SaveTimeout","tilesLoading","tilesLoaded","un","once","tileRenderComplete","bind","forceCompletion","pngGenerated","elements","querySelectorAll","completeExport","mapCanvas","document","createElement","height","mapContext","getContext","canvas","opacity","parentNode","globalAlpha","Number","matrix","transform","match","split","CanvasRenderingContext2D","prototype","setTransform","apply","drawImage","mapImgSource","bypassSecurityTrustUrl","toDataURL","getLayers","dispose","setTarget","clearTimeout","q","_o","Y","_p","TextProcessorService","Map","RegExp","replacements","replacement","regex","replace","replaceSpecialNumbersInElements","_specialNumbersInElements","factory","baseInjector","BehaviorSubject","get","TranslationStore","ApDateService","GetRoundNumericService","SettingsStore","exportFormatsStore","ExportFormatsStore","exportTargetsStore","ExportTargetsStore","terminalsStore","TerminalsStore","userContactsStore","UserContactsStore","LoginStore","FertilizerStore","nutrientService","ApNutrientService","tooltipContentService","ApTooltipContentService","CropTypeStore","mapLayerTooltipStore","MapLayerTooltipStore","getStatus","summaryOrPlanBook","state","Status","class","ApColumnState","description","getApplicationModeText","getOperationModeText","OperationMode","getElementName","getAreaHaSum","GetCropTypeName","getProductTooltip","getProductContentInfoTooltip","getApplUnit","perHa","unit","ApplUnit","BaseUnit","getProductUnitBase","Unit","getProductGridHeader","getAlreadyExported","PlanBooks","p","ExportedAt","getFilteredExportFormats","exportFormatFilter","Contains","Translation","getExportTargets","selectedExportFormat","exportTargets","Array","AddRange","_getMailTargets","exportTargets$","next","getSelectedExportTarget","selectedExportTarget","selectedTarget","selectedExportTarget$","getExportTargetText","exportTarget","getNumberRounded","n","round","getNumberRoundedNumber","digits","getDate","date","toFarmDateFromUtcGetJsDate","plans","provider","JSON","stringify","getPlanNumberTooltip","PlanNumber","setSelectedGridIdFromPreviousPage","gridItemId","selectLegendItem","isSummary","param","isArray","nameOf","convertToTaskMgmtLegend","legend","id","LEGEND_IDS","selectionLists","subjects","values","updateValues","getLastValueElement","getFirstValueElement","getValueElementAt","getValuesList","addTerminals","mailTargets","targetIdCount","User","EMail","_buildHumanReadableExpr","Surname","Forename","UserContacts","IsActive","MailAddress","Lastname","Firstname","Terminals","Terminal","resultText","v","TaskManagementDataProviderBasicfert","TaskManagementDataProviderBase","injector","cropService","elementService","campaignYearService","legendScrollerService","baseFertilizationService","baseFertilizationCommonService","basicFertilisationSummariesStore","super","getComponentUrl","getFertilizerStatus","getFertilizerStatusDescription","getModuleText","getFieldById","FieldId","applicationDate","ApplDate","campaignYear","getCampaignYearByDate","cropRotation","getCropRotationByYear","CampaignYear","cropName","getCropNameFromCropRotationYield","getProductName","Prodname","OperationModesEnum","ApplicationModesEnum","getAppRateValue","getApplMin","getApplMax","getApplSum","planBooks","summaryOperationMode","g","u","Summary","applSum","planBookItem","planBookAppl","planBookOperationMode","K","element","getFertilizerLeadingElement","m","convertNutrientToGoods","getProductUnit","summary","applDate","dateToMoment","note","Remark","substring","filename","productName","getExportFormats","fertilizer","IsOrganic","GetElementStringByIElement","selectedLegendKey","elementShort","getElementShort","mapProviderBaseName","mapBaseName","ShortDescription","toLowerCase","getMapLegend","Statistic","summaryData","ElementId","OperationModeId","NUTRIENT_PLANNING","getMapLayerTooltip","getNutrientPlanningsLayerTooltip","setSelectedSummaryKey","TaskManagementNutrientLayer","Legend","legendItems","selectedLegendElement","value","selectedValue","selectionChange","Legends","TrackLegend","selectionKeys","generateSelectionKey","Split","deletePlannings","summaryOrPlanBooks","summaryId","deleteBasicFertilisationPlanBooks","x","changesSaveStatus","saved","valueToTake","ApplMax","ApplMin","TaskManagementDataProviderNfert","fertilizationManagementService","baseStatus","planSummaryOrPlanBook","includes","nMin","Math","min","nMax","nAvg","productId","A","N_PLANNING","Max","Min","Average","getNApplicationMapLayerTooltip","cropTypeShort","getDefaultCroptype","Shortname","of","TaskManagementDataProviderPsfert","cropTypesStore","getProductNames","isSprayingPlanBook","area","max","PP_APPLICATION_LEGEND","getPpApplicationMapLayerTooltip","isTooltip","appliedProducts","productListItem","pB","Any","ProductListDetails","getAppliedProductsExpr","sourcePlan","WorkType","WorkTypes","TaskManagementDataProviders","basicFertDataProvider","nFertDataProvider","psFertDataProvider","driverStore","machineStore","instrumentStore","roundNumericPipe","pipe","IsDeleted"],"sources":["./src/app/ap-reports/components/ap-reports-overview.component.ts","./src/app/ap-reports/ap-reports.routes.ts","./src/app/ap-reports/ap-reports.module.ts","./src/app/ap-reports/components/task-management-report/task-management-report.component.html","./src/app/ap-reports/components/task-management-report/task-management-report.component.ts","./src/app/map/export/ap-layer-export.component.ts","./src/app/services/common/text-processor.service.ts","./src/app/task-management/task-management-data-providers/task-management-data-provider.base.ts","./src/app/task-management/task-management-data-providers/task-management-data-provider.basicfert.ts","./src/app/task-management/task-management-data-providers/task-management-data-provider.nfert.ts","./src/app/task-management/task-management-data-providers/task-management-data-provider.psfert.ts","./src/app/task-management/task-management-data-providers/task-management-data-providers.ts","./src/app/task-management/task-management.constants.ts"],"sourcesContent":["import {Component} from '@angular/core';\nimport {ApDynGridColumnConfigBase} from '../../ap-dyngrids/config/ap-dyn-grid-column-config-base';\nimport {ApDynGridPagerConfigBase} from '../../ap-dyngrids/config/ap-dyn-grid-pager-config-base';\nimport {FormStore} from '../../stores/layout/form.store';\nimport {ApDynGridPropertyColumnConfig} from '../../ap-dyngrids/config/ap-dyn-grid-property-column-config';\nimport {ApDynGridEditColumnConfig} from '../../ap-dyngrids/config/ap-dyn-grid-edit-column-config';\nimport {ApDynGridPagerConfig} from '../../ap-dyngrids/config/ap-dyn-grid-pager-config';\nimport {MapViewStore} from '../../stores/layout/mapview.store';\nimport {RouterStore} from '../../stores/router/router.store';\n\n// import {routes} from '../ap-reports.routes';\n\ninterface IReportOverviewGridData {\n Id: number;\n Name: string;\n Description: string;\n Path: string;\n}\n\n@Component({\n selector: 'ap-reports-overview',\n template: `\n \n `,\n})\n\nexport class ApReportsOverviewComponent {\n\n public reportVisible = false;\n public subscriptions = [];\n public columns: ApDynGridColumnConfigBase[];\n public items: IReportOverviewGridData[];\n public pager: ApDynGridPagerConfigBase;\n\n constructor(private formStore: FormStore,\n private mapViewStore: MapViewStore,\n private routerStore: RouterStore) {\n this.mapViewStore.hideMapView();\n this.buildGrid();\n this.items = [\n {\n Id: 0,\n Name: 'TaskMananagement Report',\n Description: 'Report für den Export eines Auftrags',\n Path: 'task-management-report'\n }\n ];\n }\n\n buildGrid(): void {\n this.columns = [\n new ApDynGridPropertyColumnConfig({\n field: 'Name',\n width: 250,\n headerFilterable: true,\n filterable: true,\n title: 'Global__Name'\n }),\n new ApDynGridPropertyColumnConfig({\n field: 'Description',\n headerFilterable: true,\n filterable: true,\n title: 'Global__Description'\n }),\n new ApDynGridEditColumnConfig({})\n ];\n this.pager = new ApDynGridPagerConfig({});\n }\n\n /**\n * Handler for showing report previews\n */\n public showReport(dataItem: IReportOverviewGridData): void {\n this.routerStore.navigate(['administration/reports/' + dataItem.Path]);\n }\n}\n","import {Route, RouterModule} from '@angular/router';\nimport {PageMode} from '../ap-interface';\nimport {NgModule} from '@angular/core';\nimport {ApDeveloperGuard} from '../guards/ap-developer-guard';\nimport {ApReportsOverviewComponent} from './components/ap-reports-overview.component';\nimport {TaskManagementReportComponent} from './components/task-management-report/task-management-report.component';\n\nexport const routes: Route[] = [\n {\n path: 'overview',\n component: ApReportsOverviewComponent,\n canLoad: [ApDeveloperGuard],\n data: {\n login: true,\n layout: PageMode.HALFSCREEN,\n canLoad: [ApDeveloperGuard]\n },\n },\n {\n path: 'task-management-report',\n component: TaskManagementReportComponent,\n canLoad: [ApDeveloperGuard],\n data: {\n login: true,\n layout: PageMode.HALFSCREEN,\n canLoad: [ApDeveloperGuard]\n }\n }\n];\n\n@NgModule({\n imports: [\n RouterModule.forChild(routes)\n ],\n exports: [RouterModule]\n})\nexport class ApReportsRoutes {\n}\n","import {NgModule} from '@angular/core';\nimport {CommonModule} from '@angular/common';\nimport {TaskManagementReportComponent} from './components/task-management-report/task-management-report.component';\nimport {ApReportsOverviewComponent} from './components/ap-reports-overview.component';\nimport {ApDynComponentModule} from '../ap-dyncomponent/ap-dyncomponent.module';\nimport {ApReportsRoutes} from './ap-reports.routes';\nimport {PDFExportModule} from '@progress/kendo-angular-pdf-export';\nimport {ApIconModule} from '../icons/ap-icon.module';\nimport {ApTranslationModule} from '../translation/ap-translation.module';\nimport {ApMapModule} from '../map/ap-map.module';\nimport {ApUtilsModule} from '../ap-utils';\nimport {SoilSampleReportComponent} from './components/soil-sample-report/soil-sample-report.component';\nimport {AgriportStoreModule} from '../stores/stores.module';\nimport {ApStatisticsModule} from '../statistics/ap-statistics.module';\nimport {ChartModule} from '@progress/kendo-angular-charts';\n\n@NgModule({\n declarations: [ApReportsOverviewComponent, TaskManagementReportComponent, SoilSampleReportComponent],\n exports: [ApReportsOverviewComponent, TaskManagementReportComponent, SoilSampleReportComponent],\n imports: [\n CommonModule,\n ApReportsRoutes,\n ApDynComponentModule,\n PDFExportModule,\n ApIconModule,\n ApTranslationModule,\n ApMapModule,\n ApUtilsModule,\n AgriportStoreModule,\n ApStatisticsModule,\n ChartModule\n ],\n providers: []\n})\nexport class ApReportsModule {\n}\n","\n \n \n
\n
{{'Global__CustomerNumber' | translate}}: {{currentFarm.CustomerNumber}}
\n
{{'Global__Farm' | translate}}: {{currentFarm.FarmName}}
\n
\n \n
\n \n \"Agriport\"\n \n \n
\n
\n
\n \n
\n
{{'Nutrients_Ips_Pages__PlanningType' | translate}}
\n
{{getModuleName() | translate}}
\n
{{'Global__Task' | translate}}
\n
{{reportName}} ({{'Global__No_Short' | translate}} {{planSummary?.SourceItem?.PlanNumber}})
\n
{{'Nutrients_Pages_Popups__Distribution' | translate}}
\n
{{planSummary?.ProductName}}{{getProductNutrientExpr()}}
\n
{{isPpModule() ? '' : planSummary?.ApplicationModeText}}
\n
{{'Nutrients_DistributionAmount' | translate}}
\n
{{getApplSumForAllFields() | getRoundNumeric:0}}\n {{planSummary?.ProductUnit}} {{(isPpModule() ? 'Global__Water' : '') | translate}} {{getPpProductSumExpr()}}
\n
{{'AgriConnect__Count_Fields' | translate}} ({{'AgriConnect__TotalArea' | translate}})
\n
{{getFieldsCount()}} ({{getFieldsArea() | getRoundNumeric:2 }} {{'Base__UnitHa' | translate}})
\n
{{'Global__Worker' | translate}}
\n
{{getExportDriverName()}}
\n
{{'Base__Engine' | translate}} / {{'Docu_Ini__Tool' | translate}}
\n
{{getExportMachineInstrument()}}
\n
\n\n \n
\n
{{getElementExpression()}}
\n
{{planSummary?.ApplicationModeText}}
\n
\n\n \n
\n
{{'Global__Comment' | translate}}:
\n
\n
\n
\n\n \n
0 ? 'ap-report-page-break':''\">\n \n
\n \n
{{'AgriConnect_Position_Short' | translate}}
\n
{{'Global__Field' | translate}}
\n
{{'Global__Area' | translate}}
\n
{{'AgriConnect_Map' | translate}}
\n
{{getProductHeader()}}
\n
{{'Nutrients__StatisticsTitle' | translate}}
({{getProductHeader()}})
\n \n \n
{{item?.SourceItem?.Position}}
\n
\n
\n
{{getFieldName(item)}}
\n
{{getCropName(item)}}
\n
\n
{{'Task_Mgmt_Report_Applied_at' | translate}}:
\n {{'Global__Sum_Goods' | translate}}:
\n
\n
\n
\n
{{item?.SourceItem.AreaHa | getRoundNumeric:2}}
\n
{{'Base__UnitHa' | translate}}
\n
\n
\n
\n \n = (itemsChunk.length * i)\" [featureId]=\"item?.SourceItem.Id\" [sourceLayer]=\"taskManagementLayer\" [olStyle]=\"exportMapStyle\" [mapUrl]=\"getMapUrl(item)\" (renderCompleted)=\"onRenderCompleted()\" class=\"ap-reports-map\">\n
\n
\n
\n
{{item?.ApplSum | getRoundNumeric:0}}
\n
{{planSummary?.ProductUnit}}
\n
\n
\n
\n
\n
\n
\n
{{'MinShort' | translate}}:
\n
{{item?.ApplMin | getRoundNumeric:0}} {{item?.ProductUnitPerHa}}
\n
\n
\n
Ø:
\n
{{item?.ApplRate | getRoundNumeric:0}} {{item?.ProductUnitPerHa}}
\n
\n
\n
{{'MaxShort' | translate}}:
\n
{{item?.ApplMax | getRoundNumeric:0}} {{item?.ProductUnitPerHa}}
\n
\n
\n
{{'Global__EC' | translate}}:
\n
{{item?.SourceItem?.ECValue | getRoundNumeric:0}}
\n
\n
\n
\n
\n
{{'Nutrients_DistributionConst' | translate}}:
\n
{{this.getApplRate(item)}} {{item?.ProductUnitPerHa}}
\n
\n
\n
{{'Global__EC' | translate}}:
\n
{{item?.SourceItem?.ECValue}}
\n
\n
\n
\n
\n
\n
\n
\n
\n","import {\n AfterViewInit,\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n EventEmitter,\n Input,\n OnDestroy,\n OnInit,\n Output,\n ViewChild\n} from '@angular/core';\nimport {PDFExportComponent} from '@progress/kendo-angular-pdf-export';\nimport * as _ from 'lodash';\nimport {\n LanguageStore\n} from '../../../stores/translation/language.store';\nimport {\n ApDateService\n} from '../../../ap-core/services/ap-date-service';\nimport {LoginStore} from '../../../stores/login/login.store';\nimport {\n CropTypeStore\n} from '../../../stores/base-data/crop.types.store';\nimport {\n SettingsStore\n} from '../../../stores/base-data/settings.store';\nimport {\n GetRoundNumericService\n} from '../../../ap-utils/service/get-round-numeric.service';\nimport {MapStore} from '../../../stores/map/map.store';\nimport {ApBaseVectorLayer} from '../../../ap-map';\nimport OlStyle from 'ol/style/Style';\nimport OlStyleStroke from 'ol/style/Stroke';\nimport OlStyleFill from 'ol/style/Fill';\nimport OlStyleText from 'ol/style/Text';\nimport {\n TaskManagementDataProviders\n} from '../../../task-management/task-management-data-providers/task-management-data-providers';\nimport {ApStyleData} from '../../../map-factory/ap-style-data';\nimport {MapFactoryStyler} from '../../../map-factory/style';\nimport {Subscription} from 'rxjs';\nimport {asString} from 'ol/color';\nimport {exportPDF} from '@progress/kendo-drawing';\nimport {saveAs} from '@progress/kendo-file-saver';\nimport {PDFOptions} from '@progress/kendo-drawing/pdf';\nimport {\n FertilizerStore\n} from '../../../stores/base-data/fertilizer.store';\nimport {\n TranslationStore\n} from '../../../stores/translation/translation.store';\nimport {\n FactorService\n} from '../../../ap-utils/service/ap-factor.service';\nimport {ApElementOxydTypeEnum} from '../../../ap-interface';\nimport {FieldStore} from '../../../stores/farm/field.store';\nimport {\n ApApplicationMode\n} from '../../../ap-interface/enums/ap-application-mode.enums';\nimport {\n ITaskManagementPlanBookGridData,\n ITaskManagementPlanSummaryGridData\n} from '../../../task-management/task-management.types';\nimport {\n PpCommonService\n} from '../../../plant-protection/services/pp-common.service';\nimport IFarm = Data.Authentication.IFarm;\nimport IMachine = Data.DocuContext.Machine.IMachine;\nimport IInstrument = Data.DocuContext.Instrument.IInstrument;\nimport IDriver = Data.DocuContext.Driver.IDriver;\nimport TaskManagementModule = Data.TaskManagement.TaskManagementModule;\nimport {TextProcessorService} from '../../../services/common/text-processor.service';\nimport {TaskManagementConstants} from '../../../task-management/task-management.constants';\nimport {TaskManagementStore} from '../../../stores/task-management/task-management.store';\n\n@Component({\n selector: 'task-management-report',\n templateUrl: 'task-management-report.component.html',\n styleUrls: ['task-management-report.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class TaskManagementReportComponent implements OnInit, AfterViewInit, OnDestroy {\n @ViewChild('report', {static: true}) private _report: PDFExportComponent;\n @Input() planSummary: ITaskManagementPlanSummaryGridData;\n @Input() items: ITaskManagementPlanBookGridData[] = [];\n @Output() exportDone = new EventEmitter(true);\n public reportName = '';\n public firstItemFromPlans: ITaskManagementPlanBookGridData;\n public itemsChunked: ITaskManagementPlanBookGridData[][] = [];\n public currentDateTime: string;\n public currentFarm: IFarm;\n public taskManagementLayer: ApBaseVectorLayer;\n public digitsAfterDecimal: number;\n\n private readonly fieldsFirstPageCount = 3;\n private readonly fieldsPerPageCount = 5;\n private readonly color = [0, 0, 0, 1];\n private exportDate = new Date();\n private _subscriptions: Subscription[] = [];\n private drivers: IDriver[];\n private machines: IMachine[];\n private instruments: IInstrument[];\n public renderedMaps = 0;\n private isSaving = false;\n\n public readonly exportMapStyle = new OlStyle({\n stroke: new OlStyleStroke({\n color: asString(this.color),\n width: 2,\n lineCap: 'round'\n }),\n fill: new OlStyleFill({\n color: asString([...this.color.FindAll((c, idx) => idx < 3), 0.5]),\n }),\n text: new OlStyleText({\n text: ''\n })\n });\n\n public constructor(private mapStore: MapStore,\n private languageStore: LanguageStore,\n private loginStore: LoginStore,\n private dataProviders: TaskManagementDataProviders,\n private dateService: ApDateService,\n private cropTypeStore: CropTypeStore,\n private settingsStore: SettingsStore,\n private taskManagementStore: TaskManagementStore,\n private roundNumericService: GetRoundNumericService,\n private translationStore: TranslationStore,\n private fertilizerStore: FertilizerStore,\n private factorService: FactorService,\n private fieldStore: FieldStore,\n private textProcessorService: TextProcessorService,\n private ppCommonService: PpCommonService,\n private changeDetection: ChangeDetectorRef) {\n }\n\n ngOnInit(): void {\n this.digitsAfterDecimal = this.settingsStore.FirstSetting.DigitsAfterDecimalPoint;\n this.currentFarm = this.loginStore.Listen(l => l.farm).getValue().selectedFarm;\n const selectedLanguage = this.languageStore.Listen(l => l.selectedLanguage).getValue();\n this.currentDateTime = this.dateService.toFarmDate(this.exportDate).format(selectedLanguage.DateFormat + ' ' + selectedLanguage.TimeFormat);\n this.taskManagementLayer = this.mapStore.Layers.TaskManagementLayer;\n this._subscriptions.push(this.dataProviders.drivers$.subscribe(d =>\n this.drivers = d\n ));\n this._subscriptions.push(this.dataProviders.machines$.subscribe(d =>\n this.machines = d\n ));\n this._subscriptions.push(this.dataProviders.instruments$.subscribe(d =>\n this.instruments = d\n ));\n // Whenever taskmanagement is active => the styles of the map factory are modified a tiny bit => no text is shown\n // unsubscription is really important here in order to not change the style when another component is activated.\n this._subscriptions.push(MapFactoryStyler.Instance.customStyle.subscribe((customStyle) =>\n this.onCustomTaskMgmtMapStyle(customStyle)));\n\n if (!this.items || this.items.length <= 0) {\n return;\n }\n\n this.items = this.items.sort((a, b) => a.SourceItem.Position - b.SourceItem.Position);\n this.firstItemFromPlans = this.items[0];\n this.itemsChunked.push(_.take(this.items, this.fieldsFirstPageCount));\n _.chunk(\n _.drop(this.items, this.fieldsFirstPageCount), this.fieldsPerPageCount)\n .forEach(c => {\n this.itemsChunked.push(c);\n });\n\n this.reportName = this.textProcessorService.replaceSpecialChars(\n this.dataProviders[this.planSummary?.SourceItem.Module].getExportBaseFilename(this.planSummary.SourceItem,\n this.firstItemFromPlans.SourceItem)\n );\n }\n\n ngAfterViewInit(): void {\n this.changeDetection.detectChanges();\n }\n\n ngOnDestroy(): void {\n this._subscriptions.forEach(s => s.unsubscribe());\n }\n\n public getModuleName(): string {\n switch (this.planSummary?.SourceItem?.Module) {\n case TaskManagementModule.N_NFertilization:\n return 'Global__NFertilization';\n case TaskManagementModule.GD_BasicFertilization:\n return 'Global__BasicFertilization';\n case TaskManagementModule.PS_Fertilization:\n return 'Global__PlantProtection';\n default:\n return '';\n }\n }\n\n public isNFertilization(): boolean {\n return this.planSummary?.SourceItem?.Module === TaskManagementModule.N_NFertilization;\n }\n\n public getFieldsCount(): number {\n return this.itemsChunked?.flat().length;\n }\n\n public getFieldsArea(): number {\n return this.items?.reduce((a, b) => a + b.SourceItem.AreaHa, 0);\n }\n\n public getApplSumForAllFields(): number {\n return this.items?.reduce((a, b) => a + (isNaN(b.ApplSum) ? 0 : b.ApplSum), 0);\n }\n\n public getApplRate(item: ITaskManagementPlanBookGridData): string {\n if (!item?.ApplRate) {\n return ' ';\n }\n return item.ApplRate.toString();\n }\n\n public getProductNutrientExpr(): string {\n let productNutrientExp = '';\n if (this.planSummary?.SourceItem?.ProductId > 0) {\n const product = this.fertilizerStore.getFertilizer(this.planSummary?.SourceItem?.ProductId);\n if (product) {\n let content = 0;\n let contentOxyd = 0;\n let oxydKey = '';\n switch (this.planSummary.SourceItem.Element?.ShortKey) {\n case 'Global__NutrientP':\n content = product.ContentP;\n contentOxyd = this.factorService.calculate(content, ApElementOxydTypeEnum.P, ApElementOxydTypeEnum.P2O5);\n oxydKey = 'Global__NutrientP2O5';\n break;\n case 'Global__NutrientK':\n content = product.ContentK;\n contentOxyd = this.factorService.calculate(content, ApElementOxydTypeEnum.K, ApElementOxydTypeEnum.K2O);\n oxydKey = 'Global__NutrientK2O';\n break;\n case 'Global__NutrientMg':\n content = product.ContentMg;\n contentOxyd = this.factorService.calculate(content, ApElementOxydTypeEnum.Mg, ApElementOxydTypeEnum.MgO);\n oxydKey = 'Global__NutrientMgO';\n break;\n case 'Global__NutrientCaO':\n content = product.ContentCaO;\n break;\n case 'Global__NutrientN':\n content = product.ContentN;\n break;\n }\n\n if (content > 0) {\n content = this.roundNumericService.roundAsNumber(content, 0);\n productNutrientExp = `${content}% ${this.translationStore.FindTranslationForSelectedLanguage(this.planSummary?.SourceItem?.Element?.ShortKey)}`;\n }\n if (contentOxyd > 0 && oxydKey !== '') {\n contentOxyd = this.roundNumericService.roundAsNumber(contentOxyd, 0);\n productNutrientExp += `, ${contentOxyd}% ${this.translationStore.FindTranslationForSelectedLanguage(oxydKey)}`;\n }\n if (productNutrientExp !== '') {\n productNutrientExp = ` (${productNutrientExp})`;\n }\n }\n }\n\n return productNutrientExp;\n }\n\n public getCropName(planBook: ITaskManagementPlanBookGridData): string {\n if (!planBook) {\n return '';\n }\n const cropId = planBook.SourceItem?.MainCropId;\n const cropTypeNames = this.cropTypeStore.Listen(s => s.cropTypesNames).getValue();\n\n return cropId in cropTypeNames ? cropTypeNames[cropId] : '';\n }\n\n public getExportDriverName(): string {\n const driver = this.drivers.Find(d => d.Id === this.firstItemFromPlans?.SourceItem?.ExportDriver?.Id);\n return driver?.ShortFullName?.length > 0 ? driver.ShortFullName : '-';\n }\n\n public getExportMachineInstrument(): string {\n const machine = this.machines.Find(d => d.Id === this.firstItemFromPlans?.SourceItem?.ExportMachine?.Id);\n const instrument = this.instruments.Find(d => d.Id === this.firstItemFromPlans?.SourceItem?.ExportInstrument?.Id);\n\n return `${machine?.NameWithSign?.length > 0 ? machine.NameWithSign : '-'} /\n ${instrument?.Name?.length > 0 ? instrument.Name : '-'}`;\n }\n\n public isApplModeVariable(): boolean {\n return this.planSummary?.SourceItem?.ApplicationMode?.Id === ApApplicationMode.Variable;\n }\n\n public onRenderCompleted(): void {\n this.renderedMaps++;\n if (this.renderedMaps === this.getFieldsCount()) {\n this.saveReport();\n }\n }\n\n private saveReport(): void {\n // Lock for being executed twice.\n // Double execution might happen because render complete of Open layers\n // might get triggered again in rare cases.\n if (this.isSaving) {\n return;\n }\n this.isSaving = true;\n\n // do not use _report.saveAs() here because it works async, and we never know when its finished and\n // when to close the wizard\n this._report.export().then(group => {\n const options = {\n paperSize: this._report.paperSize,\n landscape: this._report.landscape,\n margin: this._report.margin\n } as PDFOptions;\n exportPDF(group, options).then(data => {\n if (this.firstItemFromPlans.SourceItem.ExportFormat.Key === TaskManagementConstants.EXPORT_FORMAT_PDF &&\n this.firstItemFromPlans.SelectedExportTargetObject.Key !== TaskManagementConstants.EXPORT_TARGET_DOWNLOAD) {\n this.taskManagementStore.sendReport(this.firstItemFromPlans.SourceItem, data, this.firstItemFromPlans.SelectedExportTargetObject.Key);\n } else {\n // pdf generated => saving it and closing wizard\n saveAs(data, `${this.reportName}.pdf`);\n }\n\n setTimeout(() => this.exportDone?.emit(), 0); // make sure it`s on top of the callstack and form is only closed when pdf is generated\n });\n });\n }\n\n public getMapUrl(item: ITaskManagementPlanBookGridData): string {\n if (!item) {\n return '';\n }\n return `${this.dataProviders[item.SourceItem.Module].getMapFactoryUrl([item.SourceItem])}`;\n }\n\n /**\n * Customization of MapFactoryLayer 'TaskManagementNutrientLayer'\n */\n private onCustomTaskMgmtMapStyle(styleData: ApStyleData): void {\n if (!this.items || this.items.length < 1 || !styleData) {\n return;\n }\n\n // Custom Style is triggered for every MapFactoryLayer =>\n // Check if the custom style applies for current map (e.g. nutrient planning_p)\n const currentMap = this.dataProviders[this.items[0].SourceItem.Module].getMapFactoryUrl([this.items[0].SourceItem]);\n if (currentMap.indexOf(styleData.map) < 0) {\n return;\n }\n\n // Hide labels by cloning current style and setting text to null\n // without cloning all maps using this style would be modified => but text should be hidden\n // only in pdf\n const customStyle = styleData.style.clone();\n customStyle.setText(null);\n styleData.style = customStyle;\n }\n\n getFieldName(item: ITaskManagementPlanBookGridData): string {\n if (!item?.Field) {\n return '';\n }\n return this.fieldStore.getFieldName(item.Field);\n }\n\n public getElementExpression(): string {\n // special case for plant protection. Its not related to specific elements => returning plant protection shortcut\n if (this.planSummary?.Module === TaskManagementModule.PS_Fertilization) {\n return this.translationStore.FindTranslationForSelectedLanguage('Task_Mgmt_PS');\n }\n // for all other modules showing the element\n return this.planSummary?.ElementName;\n }\n\n public getProductHeader(): string {\n return this.translationStore.FindTranslationForSelectedLanguage(\n this.planSummary?.Module === TaskManagementModule.PS_Fertilization ?\n 'Global__Water' :\n 'Global__Product');\n }\n\n /**\n * Method returns a preformatted text containing the applied plant protection products\n */\n public getPpProductSumExpr(): string {\n if (this.planSummary?.Module !== TaskManagementModule.PS_Fertilization) {\n return '';\n }\n return `\\n${this.ppCommonService.getAppliedProductSumExpr(\n this.items?.FirstOrDefault()?.SourceItem.PpProductList, {areaHa: this.getFieldsArea()})}`;\n }\n\n public isPpModule(): boolean {\n return this.planSummary?.Module === TaskManagementModule.PS_Fertilization;\n }\n}\n","import {\n AfterViewInit,\n Component,\n ElementRef,\n EventEmitter,\n Input,\n OnDestroy,\n Output,\n ViewChild,\n ViewEncapsulation\n} from '@angular/core';\nimport 'ol/ol.css';\nimport OlMap from 'ol/Map';\nimport OlView from 'ol/View';\nimport {ApBaseVectorLayer, ApDistributionClassColors, LayerGroupNames, MAP_PROJECTION} from '../../ap-map';\nimport {DomSanitizer, SafeUrl} from '@angular/platform-browser';\nimport {MapStore} from '../../stores/map/map.store';\nimport OlStyle from 'ol/style/Style';\nimport OlVectorSource from 'ol/source/Vector';\nimport {APP_CONFIGURATION} from '../../ap-core/config';\nimport {MapFactoryLayer} from '../../ap-map/layers/map-factory-layer';\nimport BaseLayer from 'ol/layer/Base';\nimport OlVectorLayer from 'ol/layer/Vector';\nimport VectorLayer from 'ol/layer/Vector';\nimport VectorSource from 'ol/source/Vector';\nimport JSONFeature from 'ol/format/JSONFeature';\nimport {GeoJSON} from 'ol/format';\nimport OlStyleFill from 'ol/style/Fill';\nimport OlStyleStroke from 'ol/style/Stroke';\nimport OlStyleText from 'ol/style/Text';\nimport {ApElementOxydTypeEnum} from '../../ap-interface';\n\n@Component({\n selector: 'ap-layer-export',\n template: `\n
\n \n `,\n styleUrls: ['ap-layer-export.component.scss'],\n encapsulation: ViewEncapsulation.None,\n})\n\nexport class ApLayerExportComponent implements AfterViewInit, OnDestroy {\n /**\n * Event is raised when the PNG is generated and rendered from open-layers map.\n */\n @Output()\n public renderCompleted = new EventEmitter();\n\n /**\n * source layer (containing vector features)\n */\n @Input()\n public sourceLayer: ApBaseVectorLayer;\n\n /**\n * feature id of the sourceLayer\n */\n @Input()\n public featureId: any;\n\n /**\n * style of the source layer\n */\n @Input()\n public olStyle: OlStyle;\n\n /**\n * (optional) Url for an additional map-server layer\n */\n @Input()\n public mapUrl: string;\n\n // featureUrl related properties\n @Input()\n public featureUrl!: string;\n\n @Input()\n public featureColorPropertyName: string;\n\n @Input()\n public featureColorsArray: Array = [];\n\n @Input()\n public textProperty: string;\n\n @Input()\n public textPropertyPrecision = 0;\n\n @Input()\n public textPropertyFont = 'bold 32px Titillium Web, sans-serif';\n\n @Input()\n public textPropertyFunction!: (value: number, elem: ApElementOxydTypeEnum, method: string) => number;\n\n @Input()\n textPropertyFunctionParam!: {elem: ApElementOxydTypeEnum, method: string};\n\n // overlayUrl related properties\n @Input()\n public overlayUrl!: string;\n\n @Input()\n public overlayTextPropertyName!: string;\n\n public map: OlMap;\n public mapImgSource: SafeUrl;\n public noData = false;\n public pngGenerated = false;\n private readonly SaveTimeout = 30000;\n private saveTimeoutHandle: any;\n private tilesLoading = 0;\n private tilesLoaded = 0;\n private tilesLoadComplete = false;\n private mapFactoryExportLayer: MapFactoryLayer;\n private vectorExportLayer: OlVectorLayer;\n\n @ViewChild('exportMap', {static: true}) private _exportMap: ElementRef;\n\n constructor(private elem: ElementRef,\n private mapStore: MapStore,\n private domSanitizer: DomSanitizer) {\n this.clearMapImage();\n }\n\n ngAfterViewInit(): void {\n this.initOlMap();\n }\n\n /**\n * Initializes the hidden map with the given features and optional vector-tiles layer\n */\n public initOlMap(): void {\n const source = new OlVectorSource();\n const exportLayersList: BaseLayer[] = [];\n const feature = this.sourceLayer?.layer?.getSource()?.getFeatures()?.find(f => f?.getId()?.toString() === this.featureId?.toString());\n if (!feature) {\n console.log(`ApLayerExport : no feature found by id ${this.featureId}`);\n // No feature found => nothing to draw\n this.noData = true;\n this.clearMapImage();\n this.renderCompleted?.emit();\n return;\n }\n\n // create virtual vector layer for export\n const extent = feature?.getGeometry().getExtent();\n source.addFeature(feature);\n this.vectorExportLayer = new OlVectorLayer();\n this.vectorExportLayer.setStyle(this.olStyle ? this.olStyle : this.sourceLayer?.layer?.getStyle());\n this.vectorExportLayer.setSource(source);\n this.vectorExportLayer.setVisible(true);\n exportLayersList.Add(this.vectorExportLayer);\n\n // if we have an optional map-factory layer => add it for export.\n if (this.mapUrl && this.mapUrl.length > 0) {\n this.mapFactoryExportLayer = new MapFactoryLayer('exportTileLayer', LayerGroupNames.NONE, APP_CONFIGURATION.MapFactory.Address, `${this.mapUrl}`, this.mapStore,\n { legendGetter: () => null });\n this.mapFactoryExportLayer.Visibility = true;\n exportLayersList.Add(this.mapFactoryExportLayer.layer);\n } else if (this.featureUrl && this.featureUrl.length > 0) {\n const layer = new VectorLayer({\n declutter: true,\n style: (feat) => {\n if (!this.featureColorPropertyName && this.featureColorsArray?.length === 0 && this.textProperty?.length > 0) {\n return [\n new OlStyle({\n stroke: new OlStyleStroke({\n color: '#000',\n width: 4\n }),\n fill: new OlStyleFill({\n color: '#000'\n }),\n text: new OlStyleText({\n font: this.textPropertyFont,\n text: feat.getProperties()[this.textProperty].toString(),\n })\n })\n ];\n }\n const classPropertyName = Object.keys(feat.getProperties()).filter(k => k === this.featureColorPropertyName);\n let color = 'rgba(240, 10, 0, 1)';\n\n if (classPropertyName && classPropertyName.length > 0) {\n const classValue = +feat.getProperties()[classPropertyName[0]];\n if (classPropertyName[0].startsWith('Class')) {\n switch (true) {\n case (classValue < 1):\n color = ApDistributionClassColors.getColorsFromValue(1);\n break;\n case (classValue < 2):\n color = ApDistributionClassColors.getColorsFromValue(2);\n break;\n case (classValue < 3):\n color = ApDistributionClassColors.getColorsFromValue(3);\n break;\n case (classValue < 4):\n color = ApDistributionClassColors.getColorsFromValue(4);\n break;\n case (classValue < 5):\n color = ApDistributionClassColors.getColorsFromValue(5);\n break;\n case (classValue < 6):\n color = ApDistributionClassColors.getColorsFromValue(6);\n break;\n case (classValue < 7):\n color = ApDistributionClassColors.getColorsFromValue(7);\n break;\n case (classValue < 8):\n color = ApDistributionClassColors.getColorsFromValue(8);\n break;\n case (classValue < 9):\n color = ApDistributionClassColors.getColorsFromValue(9);\n break;\n }\n }\n\n if (this.featureColorsArray && this.featureColorsArray.length > 0) {\n color = this.featureColorsArray[classValue - 1];\n }\n }\n\n const style = new OlStyle({\n fill: new OlStyleFill({\n color,\n })\n });\n\n if (this.textProperty?.length > 0) {\n let textValue = feat.getProperties()[this.textProperty].toString();\n if (this.textPropertyFunction) {\n textValue = this.textPropertyFunction(+textValue, this.textPropertyFunctionParam.elem, this.textPropertyFunctionParam.method);\n }\n\n if (this.textPropertyPrecision > 0) {\n textValue = (+textValue).toFixed(this.textPropertyPrecision);\n }\n\n style.setText(new OlStyleText({\n font: this.textPropertyFont,\n text: textValue,\n }));\n }\n\n return [style];\n },\n source: new VectorSource({\n format: new GeoJSON(),\n url: this.featureUrl,\n })\n });\n layer.setVisible(true);\n exportLayersList.Add(layer);\n } else {\n this.tilesLoadComplete = true;\n }\n\n // Overlay layer to display text from different mapfactory source on top of featureUrl layer or mapUrl layer\n if (this.overlayUrl && this.overlayUrl.length > 0) {\n const layer = new VectorLayer({\n declutter: true,\n style: (feat) => {\n const style = new OlStyle({\n fill: new OlStyleFill({\n color: '#000'\n })\n });\n\n if (this.overlayTextPropertyName?.length > 0) {\n let textValue = feat.getProperties()[this.overlayTextPropertyName].toString();\n\n if (this.textPropertyFunction) {\n textValue = this.textPropertyFunction(+textValue, this.textPropertyFunctionParam.elem, this.textPropertyFunctionParam.method);\n }\n\n if (this.textPropertyPrecision > 0) {\n textValue = (+textValue).toFixed(this.textPropertyPrecision);\n }\n\n style.setText(new OlStyleText({\n font: this.textPropertyFont,\n text: textValue,\n }));\n }\n\n return [style];\n },\n source: new VectorSource({\n format: new GeoJSON(),\n url: this.overlayUrl,\n })\n });\n\n layer.setVisible(true);\n exportLayersList.Add(layer);\n }\n\n this.map = new OlMap({\n target: this._exportMap?.nativeElement,\n layers: exportLayersList,\n controls: [],\n view: new OlView({\n center: [0, 0],\n zoom: 1,\n projection: MAP_PROJECTION\n })\n });\n\n // Hook to several events to get informed, when map is ready to be printed\n this.hookToMapEvents();\n\n if (extent) {\n this.map?.getView()?.fit(extent, {\n size: this.map?.getSize(),\n padding: [10, 10, 10, 10],\n });\n }\n this.map?.renderSync();\n }\n\n /**\n * Disables the filling of the vector layer:\n * If there is a mapFactory layer => no fill for vector layer\n * due to possible 0.5 opacity of mapFactoryLayer, the colors might change\n * if we use fill for vector layer\n * @private\n */\n private disableVectorLayerFill(): void {\n if (!this.olStyle) {\n return;\n }\n this.olStyle?.setFill(undefined);\n this.vectorExportLayer.setStyle(this.olStyle);\n }\n\n /**\n * Method handles several map events to recognize when the map and its layers have\n * been loaded / rendered completly.\n * Once all tiles are loaded => export png.\n */\n private hookToMapEvents(): void {\n // for tiles layer => check if all tiles loaded\n if (!!this.mapFactoryExportLayer) {\n this.mapFactoryExportLayer.layer.getSource().on('tileloadstart', () => this.tilesLoadingFunc());\n this.mapFactoryExportLayer.layer.getSource().on('tileloadend', () => this.tilesLoadedFunc());\n this.mapFactoryExportLayer.layer.getSource().on('tileloaderror', () => this.tilesLoadedFunc());\n }\n\n // for vector layer => rendercomplete\n this.map?.on('rendercomplete', () => this.onRenderComplete());\n\n // Fallback for map export. In some rare cases openlayers might crash which causes the map to freeze\n // => in those cases the pdf export would not work\n // => therefore we are exporting the map (as it is at this moment) to be able to provide a pdf document\n // => the timeoutHandle is cleared when pdf is generated to stop timer in case of success before timeout reached\n this.saveTimeoutHandle = setTimeout(() => {\n this.getPngFromOlMap(true);\n }, this.SaveTimeout);\n }\n\n private tilesLoadingFunc(): void {\n ++this.tilesLoading;\n }\n\n private tilesLoadedFunc(): void {\n ++this.tilesLoaded;\n if (this.tilesLoading === this.tilesLoaded) {\n this.mapFactoryExportLayer.layer.getSource().un('tileloadstart', () => this.tilesLoadingFunc());\n this.mapFactoryExportLayer.layer.getSource().un('tileloadend', () => this.tilesLoadedFunc());\n this.mapFactoryExportLayer.layer.getSource().un('tileloaderror', () => this.tilesLoadedFunc());\n this.disableVectorLayerFill(); // if mapFactory tiles are loaded => disable fill of Vector layer\n\n this.mapFactoryExportLayer.layer.once('postrender', this.tileRenderComplete.bind(this));\n // important to call renderSync on top of the callstack => otherwise the maps were not fully displayed\n setTimeout(() => this.map?.renderSync(), 0);\n }\n }\n\n // make sure the tiles are not only loaded....but also rendered completly:\n private tileRenderComplete(): void {\n this.tilesLoadComplete = true;\n this.getPngFromOlMap();\n }\n\n private onRenderComplete(): void {\n this.getPngFromOlMap();\n }\n\n /**\n * Generates the PNG image data from open-layer map\n * @param forceCompletion\n * @private\n */\n private getPngFromOlMap(forceCompletion = false): void {\n setTimeout(() => {\n // we already exported\n if (this.pngGenerated) {\n return;\n }\n const elements = this.elem.nativeElement.querySelectorAll('.ol-layer canvas');\n // timeout reached => we take it as it is (no map on export)\n if (!elements) {\n if (forceCompletion) {\n this.completeExport(null);\n }\n // try again later on next rendercomplete (vectors) or tilesloaded (mapfactory) event.\n return;\n }\n\n // check if all layers and tiles are loaded, but if timeout has been reached we take it as it is and continue\n if (this.mapFactoryExportLayer && !this.tilesLoadComplete && !forceCompletion) {\n return;\n }\n\n const mapCanvas = document.createElement('canvas');\n const size = this.map?.getSize();\n mapCanvas.width = !!size ? size[0] : 0;\n mapCanvas.height = !!size ? size[1] : 0;\n const mapContext = mapCanvas.getContext('2d');\n\n elements?.forEach(canvas => {\n if (canvas.width > 0 && canvas.height > 0) {\n const opacity = canvas.parentNode.style.opacity;\n mapContext.globalAlpha = opacity === '' ? 1 : Number(opacity);\n const transform = canvas.style.transform;\n const matrix = transform\n .match(/^matrix\\(([^\\(]*)\\)$/)[1]\n .split(',')\n .map(Number);\n CanvasRenderingContext2D.prototype.setTransform.apply(\n mapContext,\n matrix\n );\n mapContext.drawImage(canvas, 0, 0);\n }\n });\n\n this.map?.un('rendercomplete', () => this.onRenderComplete());\n this.completeExport(mapCanvas);\n }, 0);\n }\n\n /**\n * Finalizing the export with building image source, clearing timeout/events and emit final event.\n * @param mapCanvas\n * @private\n */\n private completeExport(mapCanvas: HTMLCanvasElement): void {\n if (!!mapCanvas && mapCanvas.height > 0 && mapCanvas.width > 0) {\n this.mapImgSource = this.domSanitizer.bypassSecurityTrustUrl(mapCanvas?.toDataURL());\n } else {\n this.clearMapImage();\n }\n\n this.map?.getLayers().forEach(layer => {\n // this.map?.removeLayer(layer);\n layer.dispose();\n });\n this.map?.setTarget(null);\n this.map?.dispose();\n\n this.pngGenerated = true;\n clearTimeout(this.saveTimeoutHandle); // clear and stop fallback-Timer.\n this.renderCompleted?.emit();\n }\n\n ngOnDestroy(): void {\n this.mapFactoryExportLayer?.layer?.un('postrender', this.tileRenderComplete);\n this.mapFactoryExportLayer?.layer?.getSource()?.un('tileloadstart', () => this.tilesLoadingFunc());\n this.mapFactoryExportLayer?.layer?.getSource()?.un('tileloadend', () => this.tilesLoadedFunc());\n this.mapFactoryExportLayer?.layer?.getSource()?.un('tileloaderror', () => this.tilesLoadedFunc());\n this.map?.un('rendercomplete', () => this.onRenderComplete());\n this.map?.un('rendercomplete', () => this.onRenderComplete());\n this.map?.setTarget(null);\n }\n\n /**\n * clears image with proper data value. Otherwise kendo export might not work properly.\n */\n private clearMapImage(): void {\n // we have to use this for empty image. Empty string does not work with kendo export\n this.mapImgSource = this.domSanitizer.bypassSecurityTrustUrl('data:,');\n }\n}\n","import {Injectable} from '@angular/core';\n\n@Injectable({\n providedIn: 'root'\n})\n\n/**\n * Service implementation to replace special characters wherever needed.\n */\nexport class TextProcessorService {\n\n private replacements = new Map([\n [new RegExp(/[ä]/g), 'ae'],\n [new RegExp(/[ö]/g), 'oe'],\n [new RegExp(/[ü]/g), 'ue'],\n [new RegExp(/[Ä]/g), 'Ae'],\n [new RegExp(/[Ö]/g), 'Oe'],\n [new RegExp(/[Ü]/g), 'Ue'],\n [new RegExp(/[ß]/g), 'ss'],\n [new RegExp(/[\\\\\\/:\\*\\?\"<>\\|\\.\\-]/g), '_'],\n [new RegExp(/\\s/g), '_'],\n [new RegExp(/[^a-zA-Z0-9_\\-]/g), ''] // everything else except letters, numbers and '_' '-'\n ]);\n\n private _specialNumbersInElements = new Map([\n [new RegExp(/[₀]/g), '0'],\n [new RegExp(/[₁]/g), '1'],\n [new RegExp(/[₂]/g), '2'],\n [new RegExp(/[₃]/g), '3'],\n [new RegExp(/[₄]/g), '4'],\n [new RegExp(/[₅]/g), '5'],\n [new RegExp(/[₆]/g), '6'],\n [new RegExp(/[₇]/g), '7'],\n [new RegExp(/[₈]/g), '8'],\n [new RegExp(/[₉]/g), '9']\n ]);\n\n /**\n * Replaces umlauts and other special characters.\n * Whitespaces will be removed as well.\n */\n public replaceSpecialChars(text: string): string {\n if (!text || text.length === 0) {\n return '';\n }\n this.replacements.forEach((replacement: string, regex: RegExp) => {\n text = text.replace(regex, replacement);\n });\n return text;\n }\n\n public replaceSpecialNumbersInElements(text: string): string {\n if (!text || text.length === 0) {\n return '';\n }\n this._specialNumbersInElements.forEach((replacement: string, regex: RegExp) => {\n text = text.replace(regex, replacement);\n });\n return text;\n }\n}\n","import {Injector} from '@angular/core';\nimport {TranslationStore} from '../../stores/translation/translation.store';\nimport {ApDateService} from '../../ap-core/services/ap-date-service';\nimport {GetRoundNumericService} from '../../ap-utils/service/get-round-numeric.service';\nimport {SettingsStore} from '../../stores/base-data/settings.store';\nimport {ExportFormatsStore} from '../../stores/common/export-formats.store';\nimport {ExportTargetsStore} from '../../stores/common/export-targets.store';\nimport {\n IExportFormatsComboData,\n IExportTargetsComboData\n} from '../components/wizard/wizard-ui-config/task-management-wizard-details.config';\nimport {BehaviorSubject, Observable} from 'rxjs';\nimport {TaskManagementConstants} from '../task-management.constants';\nimport {APP_CONFIGURATION} from '../../ap-core/config';\nimport {TerminalsStore} from '../../stores/base-data/terminals.store';\nimport {UserContactsStore} from '../../stores/base-data/user.contacts.store';\nimport {LoginStore} from '../../stores/login/login.store';\nimport {FertilizerStore} from '../../stores/base-data/fertilizer.store';\nimport {ILegend} from '../../stores/map/map.legend.store';\nimport {TextProcessorService} from '../../services/common/text-processor.service';\nimport {LEGEND_IDS} from '../../ap-interface/enums/ap-legend-ids.enum';\nimport {ApNutrientService} from '../../ap-utils/service/ap-nutrient.service';\nimport {ApTooltipContentService} from '../../ap-utils/service/ap-tooltip-content.service';\nimport {CropTypeStore} from '../../stores/base-data/crop.types.store';\nimport {nameOf} from '../../ap-core/utils/ap-name-of';\nimport {IGridStatus} from '../../ap-interface/interfaces/ap-grid-status.interface';\nimport {ApColumnState} from '../../ap-interface/enums/ap-column-state.enum';\nimport {MapLayerTooltipStore} from '../../stores/map/map.layer.tooltip.store';\nimport IGuid = System.IGuid;\nimport IExportFormat = Data.Common.IExportFormat;\nimport ITaskManagementPlanSummary = Data.TaskManagement.ITaskManagementPlanSummary;\nimport ITaskManagementPlanBook = Data.TaskManagement.ITaskManagementPlanBook;\n\nexport abstract class TaskManagementDataProviderBase {\n private exportTargets$ = new BehaviorSubject>(undefined);\n private selectedExportTarget$ = new BehaviorSubject(undefined);\n protected translationStore: TranslationStore;\n protected dateService: ApDateService;\n protected roundNumericService: GetRoundNumericService;\n protected settingsStore: SettingsStore;\n protected exportFormatsStore: ExportFormatsStore;\n protected exportTargetsStore: ExportTargetsStore;\n protected terminalsStore: TerminalsStore;\n protected userContactsStore: UserContactsStore;\n protected loginStore: LoginStore;\n protected fertilizerStore: FertilizerStore;\n protected textProcessorService: TextProcessorService;\n protected nutrientService: ApNutrientService;\n protected cropTypeStore: CropTypeStore;\n protected tooltipContentService: ApTooltipContentService;\n protected mapLayerTooltipStore: MapLayerTooltipStore;\n\n protected constructor(public baseInjector: Injector) {\n this.translationStore = baseInjector.get(TranslationStore);\n this.dateService = baseInjector.get(ApDateService);\n this.roundNumericService = baseInjector.get(GetRoundNumericService);\n this.settingsStore = baseInjector.get(SettingsStore);\n this.exportFormatsStore = baseInjector.get(ExportFormatsStore);\n this.exportTargetsStore = baseInjector.get(ExportTargetsStore);\n this.terminalsStore = baseInjector.get(TerminalsStore);\n this.userContactsStore = baseInjector.get(UserContactsStore);\n this.loginStore = baseInjector.get(LoginStore);\n this.fertilizerStore = baseInjector.get(FertilizerStore);\n this.textProcessorService = baseInjector.get(TextProcessorService);\n this.nutrientService = baseInjector.get(ApNutrientService);\n this.tooltipContentService = baseInjector.get(ApTooltipContentService);\n this.cropTypeStore = baseInjector.get(CropTypeStore);\n this.mapLayerTooltipStore = baseInjector.get(MapLayerTooltipStore);\n }\n\n public getStatus(summaryOrPlanBook: ITaskManagementPlanSummary | ITaskManagementPlanBook): IGridStatus {\n const state = summaryOrPlanBook.Status as number as ApColumnState;\n return {\n state,\n class: state === ApColumnState.Green\n ? 'ap-status-green'\n : state === ApColumnState.Yellow ? 'ap-status-yellow' : 'ap-status-red',\n description: ''\n };\n }\n\n public getApplicationModeText(summaryOrPlanBook: ITaskManagementPlanSummary | ITaskManagementPlanBook): string | undefined {\n if (!summaryOrPlanBook || !summaryOrPlanBook?.ApplicationMode?.Key) {\n return undefined;\n }\n return this.translationStore.FindTranslationForSelectedLanguage(summaryOrPlanBook.ApplicationMode.Key);\n }\n\n public getOperationModeText(summaryOrPlanBook: ITaskManagementPlanSummary | ITaskManagementPlanBook): string | undefined {\n if (!summaryOrPlanBook?.OperationMode?.Key) {\n return undefined;\n }\n return this.translationStore.FindTranslationForSelectedLanguage(summaryOrPlanBook.OperationMode.Key);\n }\n\n public getElementName(t: ITaskManagementPlanSummary | ITaskManagementPlanBook): string {\n return t && t.Element ? this.translationStore.FindTranslationForSelectedLanguage(t.Element?.ShortKey) : '-';\n }\n\n public getAreaHaSum(summaryOrPlanBook: ITaskManagementPlanSummary | ITaskManagementPlanBook): number {\n if (!summaryOrPlanBook) {\n return 0;\n }\n return summaryOrPlanBook.AreaHa;\n }\n\n public getCropName(t: ITaskManagementPlanBook): string {\n return this.cropTypeStore.GetCropTypeName(t.MainCropId) ?? '';\n }\n\n public getProductTooltip(t: ITaskManagementPlanSummary | ITaskManagementPlanBook): string {\n return this.tooltipContentService.getProductContentInfoTooltip(t.ProductId);\n }\n\n public getApplUnit(t: ITaskManagementPlanSummary | ITaskManagementPlanBook, perHa = false): string {\n let unit = 'Global__Unit_kg'; // fallback\n if (t?.ApplUnit && t.ApplUnit.BaseUnit) {\n unit = t.ApplUnit.BaseUnit.Key;\n } else if (t.ApplUnit) {\n unit = t.ApplUnit.Key;\n }\n // never '%/ha' => always only '%'\n if (unit === 'Global__Unit_Percent') {\n return this.translationStore.FindTranslationForSelectedLanguage(unit);\n }\n return this.translationStore.FindTranslationForSelectedLanguage(unit) +\n (perHa ? this.translationStore.FindTranslationForSelectedLanguage('Global__UnitPerHa') : '');\n }\n\n public getProductUnitBase(t: ITaskManagementPlanSummary | ITaskManagementPlanBook, perHa = false): string {\n const product = this.fertilizerStore.getFertilizer(t?.ProductId);\n let unit = 'Global__Unit_kg'; // fallback\n if (product && product.Unit && product.Unit.BaseUnit) {\n unit = product.Unit.BaseUnit.Key;\n } else if (product && product.Unit) {\n unit = product.Unit.Key;\n }\n // never '%/ha' => always only '%'\n if (unit === 'Global__Unit_Percent') {\n return this.translationStore.FindTranslationForSelectedLanguage(unit);\n }\n return this.translationStore.FindTranslationForSelectedLanguage(unit) +\n (perHa ? this.translationStore.FindTranslationForSelectedLanguage('Global__UnitPerHa') : '');\n }\n\n public getProductGridHeader(t: ITaskManagementPlanSummary): string {\n return this.translationStore.FindTranslationForSelectedLanguage('Global__Product') +\n ' [' + this.getProductUnitBase(t, true) + ']';\n }\n\n public getAlreadyExported(t: ITaskManagementPlanSummary): string {\n if (!t || !t.PlanBooks) {\n return '0/0';\n }\n return t.PlanBooks.filter(p => p.ExportedAt).length + '/' + t.PlanBooks.length;\n }\n\n public getFilteredExportFormats(exportFormatFilter: string[]): Array {\n return this.exportFormatsStore.Listen(s => s.data).getValue()\n .filter(f => exportFormatFilter.Contains(f.Key))\n .map((f) => {\n return {\n Id: f.Id,\n Key: f.Key,\n Description: f.Description,\n Translation: this.translationStore.FindTranslationForSelectedLanguage(f.Key)\n };\n });\n }\n\n public getExportTargets(selectedExportFormat?: IExportFormat): Observable> {\n const exportTargets = new Array();\n\n // for now only Download\n exportTargets.AddRange(\n this.exportTargetsStore.Listen(s => s.data).getValue()\n .filter(f => f.Key === TaskManagementConstants.EXPORT_TARGET_DOWNLOAD)\n .map((f) => {\n return {\n Id: f.Id,\n Key: f.Key,\n Description: f.Description,\n Translation: this.translationStore.FindTranslationForSelectedLanguage(f.Key)\n };\n }));\n\n if (selectedExportFormat?.Key === TaskManagementConstants.EXPORT_FORMAT_SHP_POLYGON ||\n selectedExportFormat?.Key === TaskManagementConstants.EXPORT_FORMAT_SHP_MULTIPOLYGON ||\n selectedExportFormat?.Key === TaskManagementConstants.EXPORT_FORMAT_ISO ||\n selectedExportFormat?.Key === TaskManagementConstants.EXPORT_FORMAT_PFBOX_RST) {\n exportTargets.AddRange(this._getMailTargets());\n }\n\n if (selectedExportFormat?.Key === TaskManagementConstants.EXPORT_FORMAT_PDF) {\n exportTargets.AddRange(this._getMailTargets(false));\n }\n\n this.exportTargets$.next(exportTargets);\n return this.exportTargets$;\n }\n\n public getSelectedExportTarget(selectedExportTarget?: string): Observable {\n let selectedTarget = this.exportTargets$.getValue()?.find(t => t.Key === selectedExportTarget);\n if (!selectedTarget && this.exportTargets$.getValue()) {\n selectedTarget = this.exportTargets$.getValue()[0];\n }\n\n if (selectedTarget) {\n this.selectedExportTarget$.next(selectedTarget);\n } else {\n // in order to reset target it is necessary to set it to null and\n // then to undefined (to skip 'distinctUntilChanged' hook)\n this.selectedExportTarget$.next(null);\n this.selectedExportTarget$.next(undefined);\n }\n return this.selectedExportTarget$;\n }\n\n public getExportTargetText(exportTarget: string): string {\n if (!exportTarget) {\n return '';\n }\n // try to translate or display the value itself (most likely an email)\n return this.translationStore.FindTranslationForSelectedLanguage(exportTarget);\n }\n\n public getNumberRounded(n: number, _?: number): string {\n if (!n) {\n return '0';\n }\n return this.roundNumericService.round(n, 0);\n // https://jira.agricon.de/browse/APV49-1985\n // return this.roundNumericService.round(n, digits);\n }\n\n public getNumberRoundedNumber(n: number, digits?: number): number {\n if (!n) {\n return 0;\n }\n if (digits === undefined) {\n digits = this.settingsStore.FirstSetting ? this.settingsStore.FirstSetting.DigitsAfterDecimalPoint : 2;\n }\n return this.roundNumericService.roundAsNumber(n, digits);\n }\n\n public getDate(date: Date): Date {\n if (!date) {\n return null;\n }\n return this.dateService.toFarmDateFromUtcGetJsDate(date);\n }\n\n public getMapFactoryUrl(plans: ITaskManagementPlanBook[], provider: string, map: string): string {\n return `${APP_CONFIGURATION.MapFactory.Address}/map/${provider}/${map}/{z}/{x}/{y}?params=${JSON.stringify(plans.map(p => p.Id))}`;\n }\n\n public getPlanNumberTooltip(summaryOrPlanBook: ITaskManagementPlanSummary | ITaskManagementPlanBook): string {\n return `${this.translationStore.FindTranslationForSelectedLanguage('Global__Task')}\n ${this.translationStore.FindTranslationForSelectedLanguage('Docu_Ini__Number')}:\n ${summaryOrPlanBook?.PlanNumber}`;\n }\n\n public setSelectedGridIdFromPreviousPage(gridItemId: IGuid | undefined): void {\n }\n\n public selectLegendItem(t: ITaskManagementPlanSummary | ITaskManagementPlanBook): void {\n // per default => do nothing\n }\n\n protected isSummary(param: ITaskManagementPlanSummary | ITaskManagementPlanBook | ITaskManagementPlanBook[]): boolean {\n return Array.isArray(param[nameOf('PlanBooks')]); // only summary has planbooks collection\n }\n\n protected convertToTaskMgmtLegend(legend: ILegend): ILegend {\n if (!legend) {\n return legend;\n }\n return {\n id: LEGEND_IDS.TASK_MANAGEMENT,\n title: legend.title,\n selectionLists: legend.selectionLists,\n subjects: legend.subjects,\n unit: legend.unit,\n values: legend.values,\n updateValues: legend.updateValues,\n getLastValueElement: legend.getLastValueElement,\n getFirstValueElement: legend.getFirstValueElement,\n getValueElementAt: legend.getValueElementAt,\n getValuesList: legend.getValuesList\n };\n }\n\n private _getMailTargets(addTerminals: boolean = true): Array {\n const mailTargets = new Array();\n\n let targetIdCount = 0;\n // add current user\n mailTargets.Add({\n Id: -1 * ++targetIdCount,\n Key: this.loginStore.User.EMail,\n Description: this.loginStore.User.EMail,\n Translation: this._buildHumanReadableExpr(this.loginStore.User.Surname,\n this.loginStore.User.Forename, this.loginStore.User.EMail)\n });\n\n // add user contacts:\n mailTargets.AddRange(this.userContactsStore.UserContacts\n .filter(_ => _.IsActive)\n .map(_ => {\n return {\n Id: -1 * ++targetIdCount,\n Key: _.MailAddress,\n Description: _.MailAddress,\n Translation: this._buildHumanReadableExpr(_.Lastname, _.Firstname, _.MailAddress)\n };\n }));\n\n if (addTerminals) {\n mailTargets.AddRange(this.terminalsStore.Terminals.map(_ => {\n return {\n Id: -1 * ++targetIdCount,\n Key: _.MailAddress,\n Description: _.MailAddress,\n Translation: this._buildHumanReadableExpr(_.Terminal, _.MailAddress)\n };\n }));\n }\n return mailTargets;\n }\n\n private _buildHumanReadableExpr(...values: string[]): string {\n if (!values || values.length === 0) {\n return '';\n }\n let resultText = '';\n values.forEach(v => {\n if (resultText?.length > 0 && v?.length > 0) {\n resultText = `${resultText}, `;\n }\n resultText = `${resultText}${v}`;\n });\n return resultText;\n }\n}\n","import {Injectable, Injector} from '@angular/core';\nimport {TaskManagementDataProviderBase} from './task-management-data-provider.base';\nimport {ITaskManagementDataProvider} from './task-management-data-provider.interface';\nimport {TaskManagementConstants} from '../task-management.constants';\nimport {\n IExportFormatsComboData\n} from '../components/wizard/wizard-ui-config/task-management-wizard-details.config';\nimport {ILegend} from '../../stores/map/map.legend.store';\nimport {MapStore} from '../../stores/map/map.store';\nimport {ApLegendScrollerService} from '../../map/components/layer-controller/ap-legend-scroller.service';\nimport {NUTRIENT_PLANNING} from '../../ap-map/layers/layer.legends';\nimport {GetElementService} from '../../ap-utils/service/ap-get-element.service';\nimport {BasicFertilisationSummariesStore} from '../../stores/taskmanagement/basic.fertilisation.summaries.store';\nimport {Observable} from 'rxjs';\nimport {FieldStore} from '../../stores/farm/field.store';\nimport {ApGetCropService} from '../../stores/services/ap-get-crop.service';\nimport {BaseFertilizationService} from '../../services/data/base-fertilization.service';\nimport {CampaignYearService} from '../../services/data/campaign-year.service';\nimport {BaseFertilizationCommonService} from '../../nutrient-management/service/base-fertilization-common.service';\nimport {BaseFertilizationPlansLegendData} from '../../ap-map/layers/types/nutrient-planning.types';\nimport {OperationModesEnum} from '../../stores/common/operation-modes.store';\nimport {ApplicationModesEnum} from '../../stores/common/appl-modes.store';\nimport {IGridStatus} from '../../ap-interface/interfaces/ap-grid-status.interface';\nimport {MapLayerTooltipFunction} from 'src/app/ap-map/layers/map-factory-layer';\nimport IGuid = System.IGuid;\nimport ITaskManagementPlanSummary = Data.TaskManagement.ITaskManagementPlanSummary;\nimport ITaskManagementPlanBook = Data.TaskManagement.ITaskManagementPlanBook;\n\n@Injectable({providedIn: 'root'})\nexport class TaskManagementDataProviderBasicfert extends TaskManagementDataProviderBase implements ITaskManagementDataProvider {\n private readonly mapProviderBaseName = 'pro_nutrient_planning_';\n private readonly mapBaseName = 'map_nutrient_planning_';\n\n constructor(injector: Injector,\n private mapStore: MapStore,\n private fieldStore: FieldStore,\n private cropService: ApGetCropService,\n private elementService: GetElementService,\n private campaignYearService: CampaignYearService,\n private legendScrollerService: ApLegendScrollerService,\n private baseFertilizationService: BaseFertilizationService,\n private baseFertilizationCommonService: BaseFertilizationCommonService,\n private basicFertilisationSummariesStore: BasicFertilisationSummariesStore) {\n super(injector);\n }\n\n public getComponentUrl(): string {\n return 'nutrients/planning';\n }\n\n public getStatus(summaryOrPlanBook: ITaskManagementPlanSummary | ITaskManagementPlanBook): IGridStatus {\n const baseStatus = super.getStatus(summaryOrPlanBook);\n return {\n state: baseStatus.state,\n class: this.nutrientService.getFertilizerStatus(summaryOrPlanBook.ApplicationMode, false)?.class,\n description: this.nutrientService.getFertilizerStatusDescription(summaryOrPlanBook.ApplicationMode, false)\n };\n }\n\n public getModuleText(_: ITaskManagementPlanSummary | ITaskManagementPlanBook): string {\n return this.translationStore.FindTranslationForSelectedLanguage('Task_Mgmt_GD');\n }\n\n public getCropName(summaryOrPlanBook: ITaskManagementPlanBook): string {\n const field = this.fieldStore.getFieldById(summaryOrPlanBook.FieldId);\n const applicationDate = new Date(summaryOrPlanBook.ApplDate);\n const campaignYear = this.campaignYearService.getCampaignYearByDate(applicationDate);\n const cropRotation = this.cropService.getCropRotationByYear(field?.Id, campaignYear.CampaignYear);\n const cropName = this.cropService.getCropNameFromCropRotationYield(cropRotation);\n return cropName ?? '';\n }\n\n public getProductName(summaryOrPlanBook: ITaskManagementPlanSummary | ITaskManagementPlanBook): string {\n if (!summaryOrPlanBook || summaryOrPlanBook.ProductId === 0) {\n return this.translationStore.FindTranslationForSelectedLanguage('Nutrient__PureNutrient');\n }\n const product = this.fertilizerStore.getFertilizer(summaryOrPlanBook.ProductId);\n if (!product) {\n return '-';\n }\n return product.Prodname;\n }\n\n public getOperationModeText(summaryOrPlanBook: ITaskManagementPlanSummary | ITaskManagementPlanBook): string {\n if (summaryOrPlanBook?.OperationMode?.Key) {\n return undefined;\n }\n // TODO: temporary work around because of changes for ApplicationMap in N-Fertilization module\n if (summaryOrPlanBook.OperationMode.Key === OperationModesEnum.ApplicationMap) {\n return this.translationStore.FindTranslationForSelectedLanguage(ApplicationModesEnum.Variable);\n }\n return this.translationStore.FindTranslationForSelectedLanguage(summaryOrPlanBook.OperationMode.Key);\n }\n\n public getApplRate(summaryOrPlanBook: ITaskManagementPlanSummary | ITaskManagementPlanBook): number | undefined {\n if (!summaryOrPlanBook) {\n return undefined;\n }\n // when displaying single planbooks (wizard) => show product rate\n if (!this.isSummary(summaryOrPlanBook)) {\n const planBook = summaryOrPlanBook as ITaskManagementPlanBook;\n return this.getAppRateValue(planBook, 'avg');\n }\n return summaryOrPlanBook.ApplRate;\n }\n\n public getApplMin(summaryOrPlanBook: ITaskManagementPlanSummary | ITaskManagementPlanBook): number | undefined {\n if (!summaryOrPlanBook || this.isSummary(summaryOrPlanBook)) {\n return undefined;\n }\n // when displaying single planbooks (wizard) => show product rate\n const planBook = summaryOrPlanBook as ITaskManagementPlanBook;\n return this.getAppRateValue(planBook, 'min');\n }\n\n public getApplMax(summaryOrPlanBook: ITaskManagementPlanSummary | ITaskManagementPlanBook): number | undefined {\n if (!summaryOrPlanBook || this.isSummary(summaryOrPlanBook)) {\n return undefined;\n }\n const planBook = summaryOrPlanBook as ITaskManagementPlanBook;\n return this.getAppRateValue(planBook, 'max');\n }\n\n /**\n * Method getApplSum calculates Sum of Application values based on either all planbooks provided in summary\n * or only one planBook when provided as second argument\n * @param summaryOrPlanBook Summary to take PlanBooks from or only one plan book\n */\n public getApplSum(summaryOrPlanBook: ITaskManagementPlanSummary | ITaskManagementPlanBook): number | undefined {\n if (!summaryOrPlanBook) {\n return undefined;\n }\n const planBooks = this.isSummary(summaryOrPlanBook)\n ? (summaryOrPlanBook as ITaskManagementPlanSummary).PlanBooks\n : [summaryOrPlanBook as ITaskManagementPlanBook];\n const summaryOperationMode = this.isSummary(summaryOrPlanBook)\n ? (summaryOrPlanBook as ITaskManagementPlanSummary)?.OperationMode?.Key as OperationModesEnum\n : (summaryOrPlanBook as ITaskManagementPlanBook)?.Summary?.OperationMode?.Key as OperationModesEnum;\n let applSum = 0;\n for (const planBookItem of planBooks) {\n let planBookAppl = 0;\n if (planBookItem.ProductId > 0) {\n const planBookOperationMode = planBookItem?.OperationMode?.Key as OperationModesEnum;\n // Workaround for summaries/planbooks with the wrong element (might be due to migration from 4.8)\n const element = summaryOperationMode === OperationModesEnum.Constant && planBookOperationMode === OperationModesEnum.Constant\n ? this.nutrientService.getFertilizerLeadingElement(planBookItem.ProductId)\n : planBookItem.Element?.Id;\n planBookAppl = this.nutrientService.convertNutrientToGoods(planBookItem.ProductId, element, planBookItem.ApplRate * planBookItem.AreaHa);\n } else {\n planBookAppl = planBookItem.ApplRate * planBookItem.AreaHa;\n }\n applSum += planBookAppl;\n }\n return applSum;\n }\n\n public getProductUnit(summaryOrPlanBook: ITaskManagementPlanSummary | ITaskManagementPlanBook, perHa = false): string {\n if (this.isSummary(summaryOrPlanBook) && summaryOrPlanBook.ApplUnit?.Id !== 1 && perHa) {\n // There are now only two units at the collective planning level: either kg or % planning.\n // In the case of % planning, the collective planning unit is used.\n // Otherwise, the unit is determined from the product: kg, m³, summaryOrPlanBook, ...\n // However, this is only needed when displaying average values. The total\n // is displayed in the product unit.\n return this.translationStore.FindTranslationForSelectedLanguage(summaryOrPlanBook.ApplUnit?.Key);\n }\n return super.getProductUnitBase(summaryOrPlanBook, perHa);\n }\n\n public getExportBaseFilename(summary: ITaskManagementPlanSummary, planBook: ITaskManagementPlanBook): string {\n const applDate = this.dateService.dateToMoment(planBook?.ApplDate ? planBook.ApplDate : new Date()).format('YYMMDD');\n const note = (summary?.Remark ? `${this.textProcessorService.replaceSpecialChars(summary.Remark.substring(0, 20))}` : '');\n let filename = `${applDate}${(note?.length > 0 ? '_' : '')}${note}`;\n const productName = this.getProductName(summary);\n if (!!productName && productName !== '-') {\n filename += `_${this.textProcessorService.replaceSpecialNumbersInElements(productName)}`;\n }\n return filename;\n }\n\n public getExportFormats(summaryOrPlanBook: ITaskManagementPlanSummary | ITaskManagementPlanBook): Array {\n if (!summaryOrPlanBook || !summaryOrPlanBook.ApplicationMode || !summaryOrPlanBook.OperationMode) {\n return [];\n }\n const fertilizer = this.fertilizerStore.getFertilizer(summaryOrPlanBook?.ProductId);\n const exportFormatFilter: string[] = [\n TaskManagementConstants.EXPORT_FORMAT_SHP_POLYGON,\n TaskManagementConstants.EXPORT_FORMAT_ISO\n ];\n if (!fertilizer || !fertilizer.IsOrganic) {\n // for organic fertilizers → no PFBox (due to conversion problems on the PfBox\n exportFormatFilter.push(TaskManagementConstants.EXPORT_FORMAT_PFBOX_RST);\n }\n exportFormatFilter.push(TaskManagementConstants.EXPORT_FORMAT_PDF);\n return super.getFilteredExportFormats(exportFormatFilter);\n }\n\n public getElementName(summaryOrPlanBook: ITaskManagementPlanSummary | ITaskManagementPlanBook): string {\n if (summaryOrPlanBook.ApplicationMode.Key === ApplicationModesEnum.Constant) {\n return '-';\n }\n return this.elementService.GetElementStringByIElement(summaryOrPlanBook.Element);\n }\n\n public getMapFactoryUrl(plans: ITaskManagementPlanBook[], selectedLegendKey?: string): string {\n if (!plans || plans.length < 1) {\n return '';\n }\n const elementShort = selectedLegendKey ? selectedLegendKey : this.getElementShort(plans[0]);\n return super.getMapFactoryUrl(plans, `${this.mapProviderBaseName}${elementShort}`, `${this.mapBaseName}${elementShort}`);\n }\n\n public getElementShort(planBook: ITaskManagementPlanBook | ITaskManagementPlanSummary): string {\n let elementShort = planBook?.Element?.ShortDescription?.toLowerCase();\n if (!elementShort || elementShort === '') {\n elementShort = 'p';\n } else if (elementShort === 'cao') {\n elementShort = 'ph';\n }\n return elementShort;\n }\n\n public getMapLegend(summary: ITaskManagementPlanSummary, _?: string): () => ILegend {\n if (!summary?.Statistic || !summary.Element?.Id) {\n return () => undefined;\n }\n const summaryData: BaseFertilizationPlansLegendData = {\n ProductId: summary.ProductId,\n ElementId: summary.Element.Id,\n Statistic: summary.Statistic,\n OperationModeId: summary.OperationMode.Id\n };\n return () => this.convertToTaskMgmtLegend(\n NUTRIENT_PLANNING(\n this.translationStore.FindTranslationForSelectedLanguage.bind(this.translationStore),\n this.elementService,\n this.baseFertilizationService,\n this.fertilizerStore,\n summaryData\n )\n );\n }\n\n public getMapLayerTooltip(): MapLayerTooltipFunction {\n return this.mapLayerTooltipStore.getNutrientPlanningsLayerTooltip();\n }\n\n public setSelectedGridIdFromPreviousPage(gridItemId: IGuid | undefined): void {\n this.baseFertilizationCommonService.setSelectedSummaryKey(gridItemId);\n }\n\n public selectLegendItem(summaryOrPlanBook: ITaskManagementPlanSummary | ITaskManagementPlanBook): void {\n // select correct legend nutrient:\n if (this.mapStore.Layers.TaskManagementNutrientLayer.Legend && this.mapStore.Layers.TaskManagementNutrientLayer?.Legend()?.selectionLists?.length > 0) {\n const legendItems = this.mapStore.Layers.TaskManagementNutrientLayer.Legend().selectionLists.FirstOrDefault();\n // Legend items using upper case values for products so we need case invariant comparison\n const selectedLegendElement = (legendItems.values as any[]).Find(_ => _.value.toLowerCase() === this.getElementShort(summaryOrPlanBook).toLowerCase());\n if (selectedLegendElement) {\n legendItems.selectedValue.next(selectedLegendElement);\n this.legendScrollerService.selectionChange.emit({\n legend: this.mapStore.Legends.TrackLegend,\n selectionKeys: this.legendScrollerService.generateSelectionKey(this.mapStore.Legends.TrackLegend).Split('_'),\n });\n }\n }\n }\n\n public deletePlannings(summaryOrPlanBooks: ITaskManagementPlanSummary | ITaskManagementPlanBook[]): void {\n const summaryId = this.isSummary(summaryOrPlanBooks)\n ? (summaryOrPlanBooks as ITaskManagementPlanSummary).Id\n : (summaryOrPlanBooks as ITaskManagementPlanBook[]).FirstOrDefault()?.Summary?.Id;\n const planBooks = this.isSummary(summaryOrPlanBooks)\n ? (summaryOrPlanBooks as ITaskManagementPlanSummary).PlanBooks ?? []\n : summaryOrPlanBooks as ITaskManagementPlanBook[];\n this.basicFertilisationSummariesStore.deleteBasicFertilisationPlanBooks(\n summaryId, planBooks.map(x => x.Id), true, true);\n }\n\n public changesSaveStatus(): Observable {\n return this.basicFertilisationSummariesStore.Listen(x => x.saved);\n }\n\n private getAppRateValue(planBook: ITaskManagementPlanBook, valueToTake: 'min' | 'max' | 'avg'): number {\n // Workaround for summaries/planbooks with the wrong element (might be due to migration from 4.8)\n const element = planBook.OperationMode?.Key === OperationModesEnum.Constant\n && planBook.OperationMode?.Key === OperationModesEnum.Constant\n ? this.nutrientService.getFertilizerLeadingElement(planBook.ProductId)\n : planBook.Element?.Id;\n const rate = valueToTake === 'avg'\n ? planBook.ApplRate\n : valueToTake === 'max' ? planBook.ApplMax : planBook.ApplMin;\n return this.nutrientService.convertNutrientToGoods(planBook.ProductId, element, rate);\n }\n}\n","import {Injectable, Injector} from '@angular/core';\nimport {Observable, of} from 'rxjs';\nimport {TaskManagementDataProviderBase} from './task-management-data-provider.base';\nimport {ITaskManagementDataProvider} from './task-management-data-provider.interface';\nimport {TaskManagementConstants} from '../task-management.constants';\nimport {\n IExportFormatsComboData\n} from '../components/wizard/wizard-ui-config/task-management-wizard-details.config';\nimport {ILegend} from '../../stores/map/map.legend.store';\nimport {OperationModesEnum} from '../../stores/common/operation-modes.store';\nimport {N_PLANNING} from '../../ap-map/layers/layer.legends';\nimport {TranslationStore} from '../../stores/translation/translation.store';\nimport {FertilizerStore} from '../../stores/base-data/fertilizer.store';\nimport {FertilizationManagementService} from '../../services/data/fertilization-management.service';\nimport {IGridStatus} from '../../ap-interface/interfaces/ap-grid-status.interface';\nimport {ApColumnState} from '../../ap-interface/enums/ap-column-state.enum';\nimport {MapLayerTooltipFunction} from '../../ap-map/layers/map-factory-layer';\nimport ITaskManagementPlanSummary = Data.TaskManagement.ITaskManagementPlanSummary;\nimport ITaskManagementPlanBook = Data.TaskManagement.ITaskManagementPlanBook;\n\n@Injectable({providedIn: 'root'})\nexport class TaskManagementDataProviderNfert extends TaskManagementDataProviderBase implements ITaskManagementDataProvider {\n private readonly mapProviderBaseName = 'pro_n_planning';\n private readonly mapBaseName = 'map_n_planning';\n\n constructor(injector: Injector,\n public translationStore: TranslationStore,\n public fertilizerStore: FertilizerStore,\n public fertilizationManagementService: FertilizationManagementService) {\n super(injector);\n }\n\n public getComponentUrl(): string {\n return 'n-fertilization/planning';\n }\n\n public getStatus(summaryOrPlanBook: ITaskManagementPlanSummary | ITaskManagementPlanBook): IGridStatus {\n const baseStatus = super.getStatus(summaryOrPlanBook);\n baseStatus.description = baseStatus.state === ApColumnState.Green\n ? 'N-Grün'\n : baseStatus.state === ApColumnState.Yellow\n ? 'N-Gelb'\n : 'N-Rot';\n return baseStatus;\n }\n\n public getModuleText(summaryOrPlanBook: ITaskManagementPlanSummary | ITaskManagementPlanBook): string {\n if (!summaryOrPlanBook) {\n return '';\n }\n return this.translationStore.FindTranslationForSelectedLanguage('Task_Mgmt_ND');\n }\n\n public getProductName(summaryOrPlanBook: ITaskManagementPlanSummary | ITaskManagementPlanBook): string {\n if (!summaryOrPlanBook?.OperationMode?.Key || summaryOrPlanBook.OperationMode.Key === OperationModesEnum.Bonitur) {\n return '-';\n }\n if (summaryOrPlanBook.ProductId === 0) {\n return this.translationStore.FindTranslationForSelectedLanguage('Nutrient__PureNutrient');\n }\n const product = this.fertilizerStore.getFertilizer(summaryOrPlanBook.ProductId);\n if (!product) {\n return '-';\n }\n return product.Prodname;\n }\n\n public getProductGridHeader(_: ITaskManagementPlanSummary): string {\n return `${this.translationStore.FindTranslationForSelectedLanguage('Global__NutrientN')}\n ${this.translationStore.FindTranslationForSelectedLanguage('Nutrients__kg_N_per_ha')}`;\n }\n\n public getApplRate(summaryOrPlanBook: ITaskManagementPlanSummary | ITaskManagementPlanBook): number | undefined {\n if (!summaryOrPlanBook) {\n return undefined;\n }\n return summaryOrPlanBook?.ApplRate;\n }\n\n public getApplMin(summaryOrPlanBook: ITaskManagementPlanSummary | ITaskManagementPlanBook): number | undefined {\n if (!summaryOrPlanBook || this.isSummary(summaryOrPlanBook)) {\n return undefined;\n }\n return (summaryOrPlanBook as ITaskManagementPlanBook)?.ApplMin;\n }\n\n public getApplMax(summaryOrPlanBook: ITaskManagementPlanSummary | ITaskManagementPlanBook): number | undefined {\n if (!summaryOrPlanBook || this.isSummary(summaryOrPlanBook)) {\n return undefined;\n }\n return (summaryOrPlanBook as ITaskManagementPlanBook)?.ApplMax;\n }\n\n public getApplSum(summaryOrPlanBook: ITaskManagementPlanSummary | ITaskManagementPlanBook | null): number | undefined {\n if (!summaryOrPlanBook) {\n return undefined;\n }\n // APV49-1517: For the N fertilization variants N fertilization and Rapeseed abs., please do not calculate the total.\n // This is only possible for N fertilization with the target value and spread map.\n if (summaryOrPlanBook.OperationMode?.Key !== OperationModesEnum.TargetValue\n && summaryOrPlanBook.OperationMode?.Key !== OperationModesEnum.ApplicationMap\n && summaryOrPlanBook.OperationMode?.Key !== OperationModesEnum.ApplicationMapAbsolute\n && summaryOrPlanBook.OperationMode?.Key !== OperationModesEnum.Constant\n ) {\n return undefined;\n }\n let applSum = 0;\n const planBooks = this.isSummary(summaryOrPlanBook)\n ? (summaryOrPlanBook as ITaskManagementPlanSummary).PlanBooks\n : [summaryOrPlanBook as ITaskManagementPlanBook];\n if (summaryOrPlanBook.OperationMode?.Key === OperationModesEnum.ApplicationMap\n || summaryOrPlanBook.OperationMode?.Key !== OperationModesEnum.ApplicationMapAbsolute) {\n for (const planBookItem of planBooks) {\n applSum += planBookItem.ApplRate * planBookItem.AreaHa;\n }\n } else {\n applSum = summaryOrPlanBook.ApplRate * summaryOrPlanBook.AreaHa;\n }\n if (summaryOrPlanBook.ProductId > 0) {\n applSum = this.nutrientService.convertNutrientToGoods(summaryOrPlanBook.ProductId, summaryOrPlanBook.Element?.Id, applSum);\n }\n return applSum;\n }\n\n public getProductUnit(planSummaryOrPlanBook: ITaskManagementPlanSummary | ITaskManagementPlanBook,\n perHa: boolean = false): string {\n // Special case for N:\n // The per hectare figure is always given in kg N/ha.\n // However, the totals refer to the actual product!\n if (perHa) {\n return this.translationStore.FindTranslationForSelectedLanguage('Global__Unit_kgN_ha');\n }\n // APV49-1517: For the N fertilization variants N fertilization and Rapeseed abs., please do not calculate the total.\n // This is only possible for N fertilization with a target value and a spread map.\n if (planSummaryOrPlanBook.OperationMode?.Key !== OperationModesEnum.TargetValue\n && planSummaryOrPlanBook.OperationMode?.Key !== OperationModesEnum.ApplicationMap\n && planSummaryOrPlanBook.OperationMode?.Key !== OperationModesEnum.ApplicationMapAbsolute\n && planSummaryOrPlanBook.OperationMode?.Key !== OperationModesEnum.Constant) {\n return '';\n }\n const product = this.fertilizerStore.getFertilizer(planSummaryOrPlanBook?.ProductId);\n let unit = 'Global__Unit_kg'; // fallback\n if (product && product.Unit && product.Unit.BaseUnit) {\n unit = product.Unit.BaseUnit.Key;\n } else if (product && product.Unit) {\n unit = product.Unit.Key;\n }\n return this.translationStore.FindTranslationForSelectedLanguage(unit);\n }\n\n public getElementName(_: ITaskManagementPlanSummary | ITaskManagementPlanBook): string {\n return this.translationStore.FindTranslationForSelectedLanguage('Global__NutrientN');\n }\n\n public getExportFormats(summaryOrPlanBook: ITaskManagementPlanSummary | ITaskManagementPlanBook): Array {\n if (!summaryOrPlanBook || !summaryOrPlanBook.ApplicationMode || !summaryOrPlanBook.OperationMode) {\n return [];\n }\n const exportFormatFilter = new Array();\n if ([\n OperationModesEnum.ApplicationMap,\n OperationModesEnum.ApplicationMapAbsolute,\n OperationModesEnum.Constant\n ].includes(summaryOrPlanBook.OperationMode.Key as OperationModesEnum)) {\n exportFormatFilter.AddRange([\n TaskManagementConstants.EXPORT_FORMAT_SHP_POLYGON,\n TaskManagementConstants.EXPORT_FORMAT_ISO,\n TaskManagementConstants.EXPORT_FORMAT_PFBOX_RST,\n TaskManagementConstants.EXPORT_FORMAT_PDF]\n );\n } else {\n exportFormatFilter.AddRange([\n TaskManagementConstants.EXPORT_FORMAT_PFBOX_RST,\n TaskManagementConstants.EXPORT_FORMAT_PDF]\n );\n }\n return super.getFilteredExportFormats(exportFormatFilter);\n\n }\n\n public getMapFactoryUrl(plans: ITaskManagementPlanBook[]): string {\n if (!plans || plans.length < 1) {\n return '';\n }\n return super.getMapFactoryUrl(plans, `${this.mapProviderBaseName}`, `${this.mapBaseName}`);\n }\n\n public getMapLegend(summary: ITaskManagementPlanSummary): () => ILegend {\n const nMin = summary.PlanBooks?.length > 0 ? Math.min(...summary.PlanBooks?.map(_ => _.ApplMin)) : 0;\n const nMax = summary.PlanBooks?.length > 0 ? Math.min(...summary.PlanBooks?.map(_ => _.ApplMax)) : 0;\n const nAvg = summary.PlanBooks?.length > 0 ?\n (summary.PlanBooks?.reduce((a, b) => a + b.ApplRate, 0) / summary.PlanBooks?.length) : 0;\n const productId = summary.PlanBooks?.length > 0 ? summary.PlanBooks[0].ProductId : -1;\n return () => this.convertToTaskMgmtLegend(N_PLANNING(this.translationStore.FindTranslationForSelectedLanguage.bind(this.translationStore), this.fertilizationManagementService, this.fertilizerStore, {\n Max: nMax,\n ElementId: 5,\n ProductId: productId,\n Min: nMin,\n Average: nAvg\n }));\n }\n\n public getMapLayerTooltip(): MapLayerTooltipFunction {\n return this.mapLayerTooltipStore.getNApplicationMapLayerTooltip();\n }\n\n public getExportBaseFilename(summary: ITaskManagementPlanSummary, planBook: ITaskManagementPlanBook): string {\n let cropTypeShort = '';\n if (planBook.MainCropId > 0) {\n cropTypeShort = this.translationStore.FindTranslationForSelectedLanguage(\n this.cropTypeStore.getDefaultCroptype(planBook.MainCropId)?.Shortname);\n }\n const applDate = this.dateService.dateToMoment(planBook?.ApplDate ? planBook.ApplDate : new Date()).format('YYMMDD');\n const note = (summary?.Remark ? `${this.textProcessorService.replaceSpecialChars(summary?.Remark.substring(0, 20))}` : '');\n let filename = `${applDate}${(note?.length > 0 ? '_' : '')}${note}`;\n const productName = this.getProductName(summary);\n if (!!productName && productName !== '-') {\n filename += `_${this.textProcessorService.replaceSpecialNumbersInElements(productName)}`;\n }\n if (cropTypeShort?.length > 0) {\n filename += `_${cropTypeShort}`;\n }\n return filename;\n }\n\n public deletePlannings(_: ITaskManagementPlanSummary | ITaskManagementPlanBook[]): void {\n }\n\n public changesSaveStatus(): Observable {\n return of(true);\n }\n}\n","import {Injectable, Injector} from '@angular/core';\nimport {Observable, of} from 'rxjs';\nimport {TaskManagementDataProviderBase} from './task-management-data-provider.base';\nimport {ITaskManagementDataProvider} from './task-management-data-provider.interface';\nimport {\n IExportFormatsComboData\n} from '../components/wizard/wizard-ui-config/task-management-wizard-details.config';\nimport {TaskManagementConstants} from '../task-management.constants';\nimport {ILegend} from '../../stores/map/map.legend.store';\nimport {PpCommonService} from '../../plant-protection/services/pp-common.service';\nimport {CropTypeStore} from '../../stores/base-data/crop.types.store';\nimport {WorkTypes} from '../../stores/base-data/worrktypes.store';\nimport {OperationModesEnum} from '../../stores/common/operation-modes.store';\nimport {PP_APPLICATION_LEGEND} from '../../ap-map/layers/layer.legends';\nimport {MapLayerTooltipFunction} from '../../ap-map/layers/map-factory-layer';\nimport ITaskManagementPlanBook = Data.TaskManagement.ITaskManagementPlanBook;\nimport ITaskManagementPlanSummary = Data.TaskManagement.ITaskManagementPlanSummary;\nimport IPlantProtectionProductList = Data.TaskManagement.IPlantProtectionProductList;\n\n@Injectable({providedIn: 'root'})\nexport class TaskManagementDataProviderPsfert extends TaskManagementDataProviderBase implements ITaskManagementDataProvider {\n private readonly mapProviderBaseName = 'pro_pp_application_map';\n private readonly mapBaseName = 'map_pp_application_map';\n\n constructor(private ppCommonService: PpCommonService,\n private cropTypesStore: CropTypeStore,\n injector: Injector) {\n super(injector);\n }\n\n public getComponentUrl(): string {\n return 'plant-protection/planning';\n }\n\n public getModuleText(_: ITaskManagementPlanSummary | ITaskManagementPlanBook): string {\n return this.translationStore.FindTranslationForSelectedLanguage('Task_Mgmt_PS');\n }\n\n public getOperationModeText(summaryOrPlanBook: ITaskManagementPlanSummary | ITaskManagementPlanBook): string {\n if (!summaryOrPlanBook || !summaryOrPlanBook?.OperationMode?.Key) {\n return null;\n }\n return this.translationStore.FindTranslationForSelectedLanguage(summaryOrPlanBook.OperationMode.Key);\n }\n\n public getProductName(summaryOrPlanBook: ITaskManagementPlanSummary | ITaskManagementPlanBook): string {\n return this.getProductNames(summaryOrPlanBook, false);\n }\n\n public getProductTooltip(summaryOrPlanBook: ITaskManagementPlanSummary | ITaskManagementPlanBook): string {\n return this.getProductNames(summaryOrPlanBook, true);\n }\n\n public getProductUnit(summaryOrPlanBook: ITaskManagementPlanSummary | ITaskManagementPlanBook, perHa = false): string {\n if (!this.isSprayingPlanBook(summaryOrPlanBook)) {\n return '';\n }\n // For plant protection the product is water, and therefore we always show l/ha\n return this.translationStore.FindTranslationForSelectedLanguage(perHa ? 'Unit_l_per_ha' : 'Api_Enums__Litre');\n }\n\n public getApplRate(summaryOrPlanBook: ITaskManagementPlanSummary | ITaskManagementPlanBook): number | undefined {\n if (!this.isSprayingPlanBook(summaryOrPlanBook)) {\n return undefined;\n }\n return summaryOrPlanBook?.ApplRate;\n }\n\n public getApplMin(summaryOrPlanBook: ITaskManagementPlanSummary | ITaskManagementPlanBook): number | undefined {\n if (this.isSummary(summaryOrPlanBook) || !this.isSprayingPlanBook(summaryOrPlanBook)) {\n return undefined;\n }\n return (summaryOrPlanBook as ITaskManagementPlanBook)?.ApplMin;\n }\n\n public getApplMax(summaryOrPlanBook: ITaskManagementPlanSummary | ITaskManagementPlanBook): number | undefined {\n if (this.isSummary(summaryOrPlanBook) || !this.isSprayingPlanBook(summaryOrPlanBook)) {\n return undefined;\n }\n return (summaryOrPlanBook as ITaskManagementPlanBook)?.ApplMax;\n }\n\n public getApplSum(summaryOrPlanBook: ITaskManagementPlanSummary | ITaskManagementPlanBook): number | undefined {\n if (!this.isSprayingPlanBook(summaryOrPlanBook)) {\n return undefined;\n }\n const area = this.getAreaHaSum(summaryOrPlanBook);\n if (area === 0) {\n return undefined;\n }\n return summaryOrPlanBook.ApplRate * area;\n }\n\n public getExportFormats(summaryOrPlanBook: ITaskManagementPlanSummary | ITaskManagementPlanBook): Array {\n if (!summaryOrPlanBook || !summaryOrPlanBook.OperationMode) {\n return [];\n }\n const exportFormatFilter = [\n TaskManagementConstants.EXPORT_FORMAT_PDF\n ];\n if (summaryOrPlanBook.OperationMode?.Key === OperationModesEnum.PpTarget\n || summaryOrPlanBook.OperationMode?.Key === OperationModesEnum.PpTargetMapPerField\n || summaryOrPlanBook.OperationMode?.Key === OperationModesEnum.PPTargetMapPerPlan) {\n exportFormatFilter.push(TaskManagementConstants.EXPORT_FORMAT_PFBOX_RST);\n }\n if (summaryOrPlanBook.OperationMode?.Key === OperationModesEnum.PpTargetMapPerField\n || summaryOrPlanBook.OperationMode?.Key === OperationModesEnum.PPTargetMapPerPlan) {\n exportFormatFilter.push(TaskManagementConstants.EXPORT_FORMAT_SHP_POLYGON);\n exportFormatFilter.push(TaskManagementConstants.EXPORT_FORMAT_ISO);\n }\n return super.getFilteredExportFormats(exportFormatFilter);\n }\n\n public getMapFactoryUrl(planBooks: ITaskManagementPlanBook[]): string {\n if (!planBooks || planBooks.length < 1) {\n return '';\n }\n return super.getMapFactoryUrl(planBooks, `${this.mapProviderBaseName}`, `${this.mapBaseName}`);\n }\n\n public getMapLegend(summary: ITaskManagementPlanSummary): () => ILegend {\n const nMin = summary.PlanBooks?.length > 0 ? Math.min(...summary.PlanBooks?.map(_ => _.ApplMin)) : 0;\n const nMax = summary.PlanBooks?.length > 0 ? Math.max(...summary.PlanBooks?.map(_ => _.ApplMax)) : 0;\n return () => this.convertToTaskMgmtLegend(PP_APPLICATION_LEGEND({Min: nMin, Max: nMax}));\n }\n\n public getMapLayerTooltip(): MapLayerTooltipFunction {\n return this.mapLayerTooltipStore.getPpApplicationMapLayerTooltip();\n }\n\n public getExportBaseFilename(summary: ITaskManagementPlanSummary, planBook: ITaskManagementPlanBook): string {\n const applDate = this.dateService.dateToMoment(planBook?.ApplDate ? planBook.ApplDate : new Date()).format('YYMMDD');\n const note = (summary?.Remark ? `${this.textProcessorService.replaceSpecialChars(summary.Remark.substring(0, 20))}` : '');\n let filename = `${applDate}_${(note?.length > 0 ? '_' : '')}${note}`;\n filename += `${this.translationStore.FindTranslationForSelectedLanguage('Task_Mgmt_PS')}`;\n if (planBook.MainCropId > 0) {\n const cropTypeShort = this.translationStore.FindTranslationForSelectedLanguage(\n this.cropTypesStore.getDefaultCroptype(planBook.MainCropId)?.Shortname);\n if (cropTypeShort?.length > 0) {\n filename += `_${cropTypeShort}`;\n }\n }\n return filename;\n }\n\n public deletePlannings(_: ITaskManagementPlanSummary | ITaskManagementPlanBook[]): void {\n }\n\n public changesSaveStatus(): Observable {\n return of(true);\n }\n\n private getProductNames(summaryOrPlanBook: ITaskManagementPlanSummary | ITaskManagementPlanBook, isTooltip?: boolean): string {\n let planBooks: ITaskManagementPlanBook[];\n if (this.isSummary(summaryOrPlanBook)) {\n planBooks = (summaryOrPlanBook as ITaskManagementPlanSummary)?.PlanBooks;\n } else {\n planBooks = [summaryOrPlanBook as ITaskManagementPlanBook];\n }\n const appliedProducts: IPlantProtectionProductList[] = [];\n for (const productListItem of planBooks.map(pB => pB.PpProductList).flat()) {\n if (!appliedProducts.Any(p => p.ProductListDetails?.Id === productListItem.ProductListDetails?.Id)) {\n appliedProducts.push(productListItem);\n }\n }\n return this.ppCommonService.getAppliedProductsExpr(appliedProducts, isTooltip);\n }\n\n private isSprayingPlanBook(summaryOrPlanBook: ITaskManagementPlanSummary | ITaskManagementPlanBook): boolean {\n const sourcePlan = this.isSummary(summaryOrPlanBook)\n ? (summaryOrPlanBook as ITaskManagementPlanSummary)?.PlanBooks?.FirstOrDefault()\n : summaryOrPlanBook as ITaskManagementPlanBook;\n return sourcePlan?.PpProductList?.FirstOrDefault()?.ProductListDetails?.WorkType === WorkTypes.Spraying;\n }\n}\n","import {Injectable} from '@angular/core';\nimport {TaskManagementDataProviderBasicfert} from './task-management-data-provider.basicfert';\nimport {TaskManagementDataProviderNfert} from './task-management-data-provider.nfert';\nimport {TaskManagementDataProviderPsfert} from './task-management-data-provider.psfert';\nimport {ITaskManagementDataProvider} from './task-management-data-provider.interface';\nimport {Observable} from 'rxjs';\nimport {DriverStore} from '../../stores/docu/driver.store';\nimport {MachineStore} from '../../stores/docu/machine.store';\nimport {InstrumentStore} from '../../stores/docu/instrument.store';\nimport {LanguageStore} from '../../stores/translation/language.store';\nimport {GetRoundNumericPipe} from '../../ap-utils';\nimport {SettingsStore} from '../../stores/base-data/settings.store';\nimport {filter, map} from 'rxjs/operators';\nimport TaskManagementModule = Data.TaskManagement.TaskManagementModule;\nimport IInstrument = Data.DocuContext.Instrument.IInstrument;\nimport IMachine = Data.DocuContext.Machine.IMachine;\nimport IDriver = Data.DocuContext.Driver.IDriver;\n\n@Injectable({providedIn: 'root'})\nexport class TaskManagementDataProviders {\n [module: number]: ITaskManagementDataProvider;\n\n public drivers$: Observable;\n public machines$: Observable;\n public instruments$: Observable;\n\n constructor(basicFertDataProvider: TaskManagementDataProviderBasicfert,\n nFertDataProvider: TaskManagementDataProviderNfert,\n psFertDataProvider: TaskManagementDataProviderPsfert,\n driverStore: DriverStore,\n machineStore: MachineStore,\n instrumentStore: InstrumentStore,\n public languageStore: LanguageStore,\n public roundNumericPipe: GetRoundNumericPipe,\n public settingsStore: SettingsStore) {\n this[TaskManagementModule.GD_BasicFertilization] = basicFertDataProvider;\n this[TaskManagementModule.N_NFertilization] = nFertDataProvider;\n this[TaskManagementModule.PS_Fertilization] = psFertDataProvider;\n\n this.drivers$ = driverStore.Listen(s => s.data).pipe(\n filter(d => !!d),\n map(drivers => drivers.filter(driver => !driver.IsDeleted)));\n\n this.machines$ = machineStore.Listen(s => s.data).pipe(\n filter(d => !!d),\n map(machines => machines.filter(machine => !machine.IsDeleted)));\n\n this.instruments$ = instrumentStore.Listen(s => s.data).pipe(\n filter(d => !!d),\n map(instruments => instruments.filter(machine => !machine.IsDeleted)));\n }\n}\n","export abstract class TaskManagementConstants {\n /*\n * Export formats\n */\n public static EXPORT_FORMAT_PDF = 'Task_Mgmt_Format_Pdf';\n public static EXPORT_FORMAT_SHP_POLYGON = 'Task_Mgmt_Format_Shape_Polygon';\n public static EXPORT_FORMAT_SHP_MULTIPOLYGON = 'Task_Mgmt_Format_Shape_Multipolygon';\n public static EXPORT_FORMAT_ISO = 'Task_Mgmt_Format_Isoxml';\n public static EXPORT_FORMAT_PFBOX_RST = 'Task_Mgmt_Format_PfBox_rst';\n\n /*\n * Export targets\n */\n public static EXPORT_TARGET_DOWNLOAD = 'Task_Mgmt_Target_Download';\n // public static EXPORT_TARGET_JD = 'Task_Mgmt_Target_JD'; - not implemented, yet\n public static EXPORT_TARGET_MAIL = 'Task_Mgmt_Target_Mail';\n}\n"],"sourceRoot":"webpack:///","file":"635.0f0b2c2ac8c71c8d.js"}