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C,OAAO,EACPC,OAAQC,mBAWP,IAAM8D,GAAb,MAAM,sDAAOA,4DALF,CACPC,eAAsB7H,KAEd6H,SAECD,GAAb,yFGsBO,IAAME,GAAb,MAAM,sDAAOA,6DAFA,GAAEC,SA/BJ,CACPC,KACAC,KACAC,KACAC,MACAC,MACAC,MACAC,MACAC,MACAC,MACAC,MACAC,MACAC,KACAC,OACAC,OACAC,OACAC,MACAC,KACApB,GACAqB,KACAC,OACAC,KACAC,OACAC,KACAC,OACAC,OACAC,OACAC,KACAC,KACAC,+BAIS7B,GAAb","names":["generateSlopeControls","parameters","values","y","slopeShown","ApDynformsConfigPlaceholder","slopeType","ApDynformsConfigNumerictextbox","key","label","infoText","value","ControlFactor","step","min","max","disabled","validators","ApDynformsValidator","validator","Validators","errorKey","ApDynformsConfigComboBox","options","slope","textField","nameOf","valueField","translate","t","_a","o","i","_b","FirstOrDefault","_c","Slope","ApplicationMapConfig","NApplicationMapConfigBase","constructor","translateService","nFertilizationPlantProtectionService","roundNumericPipe","super","this","formBuilder","formValues$","applicationSettings","isModalField","diagramTemplateRef","Parameter","min$","pipe","filter","x","Minimum","map","v","distinctUntilChanged","max$","Maximum","ApDynformsConfigFieldset","legend","useMaxWidth","before","config","ECStage","EcMin","EcMax","decimals","format","Threshold","Amount","Constant","value$","gridBuilderConfig","modeMode$","appSettingsParameters","applicationGroupColumns","push","ApDynGridPropertyColumnConfig","title","field","width","columnLoading","filterType","FilterType","cssClass","filterable","tooltip","dataItem","ErrorMessage","pipes","args","hide","applicationHalfViewGroupColumns","ApDynGridColumnHideConfig","selfHide","configNameTranslation","unitTranslation","headerExtraLines","ApDynGridGroupColumnConfig","groupColumns","updateFormValuesByParameters","selectedItems","scansByApplicationSettings","getValidBestScansByApplicationSettings","ScanData","growthStageMax","growthStages","getGrowStages","Max","Number","isFinite","DeadBioMass","c","deadBioMass","targetValue","recommendation","uniform","r","_minAllowed","l","_maxAllowed","u","s","a","_d","_e","_f","i0","factory","TargetRateConfig","agriportConstantsService","isRape","GetConstant","AgriportConstantsEnum","prev","next","ecStage","delay","result","text","TargetRate","ControlRange","range","Math","isNaN","NFertilizationConfig","nFertilizationService","nFertilizationCommonEntryService","formBuilderConfig","cropId","cropKey","isRapeCrop","formValues","AgriportConstantsService","getThreshold","curr","ApNFertilizationComponentService","mapStore","fieldStore","cropStore","fertilizerStore","languageStore","translationStore","nFertilizationStore","cropApplicationStore","dateService","nutrientService","fertilizerService","translationService","tooltipContentService","operationModeService","getPlanningDescription","planBook","token","MainCropId","ECValue","application","GetApplication","getDefaultCroptype","Eppocode","OperationMode","translation","FindTranslationForSelectedLanguage","ProductId","fertilizer","getFertilizer","getFertilizerProductName","e","ApplicationMode","Key","ApplicationDate","moment","SelectedLanguage","DateFormat","Summary","Title","Join","filterPlanBooks","planBooks","FieldGeomId","getProductIdByNContent","content","organic","productId","Fertilizer","f","ContentN","forEach","abs","IsOrganic","Id","getFieldApplicationRateValues","logfiles","baseFertPlanBooks","contentNPlanBooks","getContentNRelatedPlanBooks","length","applicationsRate","_getApplicationsRate","some","appl","getApplicationRateFromPlanBooks","applications","CropTypeId","OperationModeId","EcValue","singleRate","every","num","undefined","console","warn","getApplicationMinMax","sorted","Listen","cropEcSn","getValue","CropKeys","includes","sort","b","getPlanBooksFieldsCount","isBooked","nonDeletedPlanBooks","DeletedAt","filteredPlanBooks","BookedAt","showPlanBookStatisticOnMap","currentUrl","Layers","NApplicationMapLayer","clear","Clear","Legends","removeLegend","NPlanningLegend","ids","statistic","Reduce","target","ele","ApplicationMax","ElementId","Min","ApplicationMin","Average","ApplicationRate","onNPlanningChanged","emit","NPlanningLayerSourceInit","getApplicationDatesData","planBooksApplicationDates","_getPlanBookApplicationDates","uniqueApplicationDates","getUniqDates","DateSort","Tooltip","planBooksApplicationDatesTooltip","IsMoreThanOneUniqDate","NewestDate","getCropId","filteredData","pB","reduce","acc","el","k","getProductId","getSummaryWithPlanBooks","isBooking","summariesMap","summaryMap","item","id","toString","FilteredPlanBooks","TotalPlanBooks","Object","keys","getStatus","_isRecordValid","getFertilizerStatus","state","ApColumnState","class","description","getArea","getFieldGeomById","AreaHa","applyAdditionalStylesForFertilizationValues","_isDetailItemEfficiencyValid","tooltipForFertilizationValues","FertilizerEfficiency","farmDate","toFarmDate","Date","toDate","getDateMidnight","defaultCrop","operationMode","getOperationModeById","RapeFertilizationConfig","nFertilizationComponentService","BehaviorSubject","_ecMin$","_ecMax$","Appl","p","n","newMin","combineLatest","YieldExpectation","_getYieldExpectationOptions","disabled$","Potential","applicationRate","value3Text","value4Text","value6Text","static","avgNUptake","threshold","factor","thresholdValue","end","color","BoniturConfig","ApBaseWizardSteps","NFertilizationPlanningEntryService","BasePlanningEntryService","unitStore","loginStore","driverStore","machineStore","statisticStore","instrumentStore","campaignYearStore","applicationModesStore","operationModesStore","statisticService","fertilizationManagementService","nutrientManagementDateService","initData","summary","_summaryForCreate","setSubscriptions","_","Error","clearData","_isSaved","_isNewMode","createSummaryAndApplyValues","nPlanBooks","createSummaryCalled","createNewSummary","applySummaryToFormValues","componentData","Type","PlanningEntryComponentDataType","ObjectFactory","find","npb","ApGuidUtil","_planBookCommonData","_shouldDeselectFieldsOnClose","getSelectedFields","selectedYear","getSelectedCampaignYear","farmApplDate","getDateNoonToFarmTime","GetOutputDate","valueOf","DefaultEnd","operationModeObj","data","Find","applicationModeObj","_generateNSummary","SelectedFarmId","getUnit","_generateCommonPlanBookData","Unit","ApElementType","FertilizationDate","AdditionalValue","DeadBiomass","ExpectedYield","NMinPotential","Application","Note","product","Group","Product","_g","UserApplicationMaximum","UserApplicationMinimum","UserApplicationRate","UserApplicationConstant","Machine","getMachineById","ExportMachine","Instrument","getInstrumentById","ExportInstrument","Driver","getDriverById","ExportDriver","farmId","applMode","applDate","unit","planNumber","ecValue","FarmId","PlanNumber","ChangedAt","ChangedBy","CreatedAt","CreatedBy","DeletedBy","Version","applUnit","applConst","applMin","applMax","element","driverId","machineId","instrumentId","ApplicationConst","RasterStatistics","Element","Area","BookedBy","ExportFormat","ExportTarget","ExportedAt","ExportedBy","Factor","FieldId","Geom","PlannedArea","RasterId","SecondCropId","Status","TEnd","TStart","ValidFrom","ValidTo","JobInput","LogFileOperationMode","_componentData","generateOverviewStatistic","totalItems","emptyTitle","items","ColumnLoading","setStatisticData","ApStatsType","nStatItems","Module","PlanningWizardOverviewModuleStats","OperationModeKey","NContent","getFertilizerContentN","isApplicationMapOrAbsolute","_getTitleForStatistic","generateFieldStatistic","FieldName","Name","FieldNumber","Nr","FieldSubNumber","TNr","ScanDate","Created","ScanNUptakeAvg","NUptakeAvg","ScanNUptakeMin","NUptakeMin","ScanNUptakeMax","NUptakeMax","allItems","dataForTitles","Selected","z","generateFieldsAreaTitle","ApplicationMapAbsoluteConfig","areaWeightedAverage","targetRate","unitRate","weightedAverageTextInfoTranslationKey","_targetRateFormula","growthStageMin","amount","controlFactor","calculationResult","controlFactorDefining","UniformConfig","settingsStore","label$","productAmountLable","productAmountCalculation","FirstSetting","DigitsAfterDecimalPoint","unitKey","BaseUnit","perHa","constantValue","convertNutrientToGoods","GeneralConfig","fertilizerInorganicStore","fertilizerOrganicStore","getDocuFieldSet","currentFormValues","valuePrimitive","DefaultInstrument","DefaultDriver","getProductFieldSet","fertilizerOptions","OrganicFertilizer$","InorganicFertilizer$","inorganic","fert","Shortname","first","second","Prodname","localeCompare","_getDefaultGroup","_selectableProduct","Selectable","ApNFertilizationPlanningEntryComponent","cropRotationStore","cropService","cropTypeStore","generalConfig","formStore","mapViewStore","modalDialogStore","notifyStore","basicFertilisationSummariesStore","roundNumericService","routerStore","sensorStore","scanService","applicationSettingsService","nPlanningEntryService","nFertilizationCommonService","applicationSettingsStore","applicationMapAbsoluteConfig","uniformConfig","boniturConfig","targetRateConfig","applicationMapConfig","nFertilizationConfig","rapeFertilizationConfig","of","EventEmitter","ngOnInit","setComponentData","_gridBuilderSelectionGrid","ngAfterContentInit","setTimeout","loadSensorFieldData","_subscriptions","dynComponent","SelectedItems$","debounceTime","subscribe","_statisticUpdateRequested","_fieldSelection","gridSubject","caption$","grid","caption","gridPaging","setSelectedKeys","getSelectedFieldIds","_onCancelSelection","_onCloseForm","_onNextSelection","_currentStep","_selectFieldSubscriptions","unsubscribe","selectedFields","getSelectedItems","_selectedFields$","_isRapeCrop","CropId","_formBuilderGeneral","saveGridDescriptors","formPrevious","_formSubscriptions","loadGridDescriptors","_formValues","getForm","formNext","_gridBuilderOverview","_onBackOverview","_overviewSubscriptions","_clearMap","removeStatisticData","_onSaveOverview","_save","_generateStats","items$","canSave$","_canSaveCheck","ngOnDestroy","onEdit","dataItemProperty","_updateDataForSingleEdit","setModalDialogData","buttons","primary","disable","ModalDialogButtonDisable","show","formConfig","fieldSets","_getFieldSets","listenChanges","resultSubscription","_updateOverviewItems","_operationModeAppSetting","OperationModesEnum","fieldSets$","loading$","loading","historyLoading","Loading$","loadings","columns$","SelectedLanguage$","FirstSetting$","language","settings","setting","ApDynGridStatusColumnConfig","headerFilterable","mode","MapViewMode","sortIndex","groupIndex","groupDesc","GetRoundNumericPipeConfig","pager","ApDynGridPagerWizardConfig","ApDynGridPagerWizardButton","ApDynGridPagerWizardBreadcrumbsStepper","active","_activeItems","errorKeys$","EppoCode","addMessage","Level","Counter","ErrorKey","UserId","UserName","DisplayTimeout","Parameters","history","cropTypesNames","GetNeeds$","Year","Summaries$","Applications$","fields","cropRotation","year","cropTypes","needs","sensorFieldData","logFiles","bfSummaries","geom","getCurrentFieldGeom","fieldCrop","sensorData","pe","N","crop","defaultCropEppoCode","status","_getStatus","MainCrop","needValue","m","g","need","Value","BasicFertilisationPlanBooks","flat","alreadyApplied","calculateAlreadyAppliedFromContentNPlanBooks","bestScanData","getBestScanData","getDefaultBestScanStatus","StatusClass","StatusDesc","FieldSubnumber","NrTNr","getFieldNumberAndSubNumber","Crop","getCrop","Kind","FieldCropEc","C","A","getFieldCrop","Sum","DBW","NUptake","PlanBookId","M","we","PlanId","Remaining","F","calculateRemainingValue","_h","_selectedFieldsCropType","maxY$","FormValues$","previous","current","_operationModeAppSettings","chartData$","valuesOperationMode","controlRange","referenceValue","ReferenceValue","JSON","stringify","res","CurveCreator","noteValues$","get","setValue","Valid$","fs","dynForm","form","markAllAsTouched","nextDisabled$","tap","applicationMode","operationModeId","_updateOperationModeAppSettings","_cleanUpFormValues","_createForm","markAsTouched","_cleanUpFormValuesOnCropChanged","isApplicationMap","isOperationModeAnyOfMapsOrConstant","clearNPlanningStatistic","_createGridDataObjects","_initializeGridOverviewItem","_gridBuilderOverviewColumns","_createNPlanningJob","selectedFieldCrops","selectedFieldCrop","_cropForDetails","selectedLanguage","mapHide","mapMode","ApplicationSetting","concat","ApDynGridEditColumnConfig","initializeSubscription","nNeeds","GetNeeds","bfPlanBooks","Summaries","fieldNPlanningStatistic","_getNPlanningPlanBookData","fieldFromStore","getFieldById","ErrorText","HasError","roundAsNumber","Mean","_isRemainingValueCouldBeApplied","getAlreadyApplied","getStatusForItemOnOverviewStep","ApplicationModeKey","AvgAmount","ThresholdAbs","ControlFactorDescription","Duration","AvgNUptake","fieldGeomId","_nPlanBooks","operationModeFromForm","applicationModeFromForm","operationModeKey","getOperationModeForPlan","applicationModeKey","getApplicationModeForPlan","getSlope","controlFactorDescription","getControlFactorDescription","nPlanBook","CropTypeMapId","getCropTypeMapId","nUptake","Add","_createGeneral","operationModeAppSetting","crops","indexOf","classList","ApDynformsConfigTextbox","round","sum","ApDynformsConfigTextarea","rows","applicationModes","_getApplicationMode","groupByField","_getOperationModeForDetailsForm","ApDynformsConfigDatepicker","minDate","toJsDate","toFarmDateFromUtc","DefaultStart","maxDate","isFieldsForModal","copiedFormValues","applicationModeForm","_isVariablePossible","ApplicationModesEnum","growthStage","operationModeFromSummary","Q","Z","_j","PlanBooks","onApplicationSettingsTextWarning","_k","_l","_m","CropKey","_o","calculateAreaWeightedAverage","_p","getRawValue","values$","fieldSet","getFormValues","mainCropId","cropType","IsSensorCrop","CroptypeId","Text","Category","selectedFieldsData","ecValues","Ec","applicationMapAbsoluteSettings","getApplicationSettingsForEppoAndEcRange","applicationSetting","applicationSettingName","TranslationKey","applicationMapSettings","canSave","stat","url","counts","mostFrequentValue","highestCount","formsOperationMode","summaryApplicationMode","summaryOperationMode","getDateNoon","nPlanningPlanBookData","planId","planBookApplicationMode","planBookOperationMode","E","R","SaveNFertilizationPlanning","submitData","planBookGridItem","date","copiedPlanBookGridItem","copiedSubmitDataValue","_createNPlanningRasterJob","bestScan","minimum","maximum","appleRate","constant","nFertPlanId","ScanType","BestScanType","ppPlanId","satelliteId","SatId","CreateNPlanningRasterJob","NdPlanId","PpPlanId","AutumnScan","SatelliteScan","AppleRate","MapFactoryStyler","selectedFieldIds","selectedPlanFields","changeSelectedField","selectedFieldItems","zoomFarmFields","closeForm","selectors","ApDynComponentComponent","decls","ctx","NFertilizationOverviewMassEditAction","ApNFertilizationOverviewComponent","jobsStore","burgerMenuStore","campaignYear","showPointsOnMap","componentService","translationPipe","halfViewModeChange","halfViewMode$","FinishedNFertJobs$","LoadNFertilizationPlanningSummaries","LoadLogfiles","_gridBuilder","FormClose$","_applyClicked","_onApplyClicked","fieldCropsSaved","_invokeWhenFieldCropsUpdated","addControl","NFertilizationBurgerMenuComponent","removeControl","nLogInterpolationLegend","onCreate","openForm","component","logfilesLoading","planBooksLoading","_1","_2","_3","_4","_5","cA","getContentNPlanBooks","fieldApplications","mainCropDescription","Description","nApplied","_calculateAlreadyApplied","FieldCrop","SNr","NrSNr","Create","CropNote","Need","Total","N0","Scan","N1","N2","N3","N4","NApplied","Applications","_afterUpdateProcess","_showLatestRaster","template","PropertyTemplate","generateCropNoteTooltip","checkbox","ToReplace","ReplaceWith","details$","ApDynGridDetailsGridConfig","checkboxDisabled","columns","getProductContentInfoTooltip","sortDesc","dynCssClass","headerButtons","nextClicked","previousClicked","nextDisabled","previousDisabled","xlsExport","callback","ApUtilService","_clickToShowOnMap","bind","_isRasterStatisticDataPresent","_onShowSingleViewAndStatistics","ApDynGridPagerConfig","apply","listMassEditing","FieldMassEditAction","type","ApGridPagerType","name","onSubmit","iconButtons","icon","Icon","_onPdf","_onXls","event","object","copiedFieldCrops","EcValueToUpdate","saveFieldCrops","isUpdated","showSaveSuccessMessage","showSaveFailMessage","showRaster","dataCollection","Logfiles","NPlanBook","WorkArea","getMapViewMode","showMapView","getMapViewCurrentMenu","MapViewCurrentMenu","goIntoMapMenu","_selectItemsForGrid","filtered","_onShowAll","rasterStatistic","detailsItems","total","currentItem","AlreadyApplied","NRaster","zoomToExtent","isActive","applicationMap","Administration","other","fieldId","showAllRaster","fieldIds","dynGrid","pdfExportFileName","_generatePrintFilename","exportAsPdf","xlsExportFileName","exportAsXls","isCreateNewAllowed","ApRoleTypeService","User","option","index","ApNFertilizationBookingComponent","campaignYearService","updateComponent","_book","book","_getColumns","_getPager","skip","_updateItems","_editId","_loadDataFromStore","dialog","message","_isApplicationRateValid","_fieldSets","asyncValidators","_booking","BookPlanBooks","_updateData","UnBookPlanBooks","logfile","SourceItem","_formClose","comp","fieldGeom","fertilizerFactor","driver","machine","instrument","productAmount","calculateProductAmountN","gridStatus","_getGridStatus","Class","Desc","CropTypeName","GetCropTypeName","IsExported","ProductName","Applied","FertilizerAreaFactor","ApplicationRateFactor","getDateWithTimeFromMilliseconds","TotalMilliseconds","FieldGeom","planBookGridItems","planBookToUpdate","ApTimeSpanUtil","sortable","nextTitle","ApDynGridPagerWizardSection","showMassEdit","_getPagerFieldSets","selectedCampaignYear","campaignYearRange","getCampaignYearRange","StartYear","EndYear","ApDynformsConfigTimepicker","minSteps","secSteps","_getGoodsLabel","ApGetGeomService","getGeom","FieldGeoms","ApNFertilizationEditComponent","geomService","fertilizationCommonService","updateComponentData","_data","getGroup","_markFormAsTouched","_buildSelectionGrid","_buildSelectionPager","_setSelectionItems","_setSelectionSelectedItems","ngAfterViewInit","_onFormNext","_onFormBack","_selectionGridSubscription","_overViewGridSubscription","EC","Avg","_selectedItems","_setOverviewItems","deletePlanBooks","newPlanBooks","selectedItem","Contains","d","mainCrop","getFieldName","ShortFullName","NameWithSign","NNeeds","_buildFormAgronomy","CurrentDateFormat","_buildOverviewGrid","column","_onClose","breadCrumbsColumns","_onGridNext","_buildOverviewPager","_onGridBack","_onSave","PagerValues$","_setOverviewSelectedItems","selectedItemsForApplicationSettings","getApplicationSettings","cropIds","_getAreaWeightedAverage","detailsId","toISOString","UpdateNFertilizationPlanning","ApNFertilizationShowComponent","modalDialogPresets","_halfViewModeChange","_halfViewMode$","languageLoading","settingsLoading","tryCopyComponentData","fieldsToSelect","itemsToSelect","planBooksToShow","PlanBookIds","_getItems","_editPlanBook","_deletePlanBook","isBookedItem","IsBooked","nApplications","_getNApplication","nUpTakes","getNUpTakes","getStatusForApplication","productTotal","_getAmount","productTotalUnit","getFertilizerUnit","getStatusClassForApplication","getStatusDescriptionForApplication","ProductTotal","ProductTotalUnit","Efficiency","Absorption","Fertilization","itemToDelete","DeleteDialog","resultDelegate","dialogResult","ModalDialogButtonKeys","DeleteNFertilizationPlanBooks","nApplicationRange","getNApplications","areaHa","error","referenceCache","duplicateReferenceKeys","DataItem","NFertilizationPlansGridBuilderService","planningBookingGrid","ApplicationDateTooltip","ApplicationDateItalic","ProductTooltip","FieldsTooltip","headerStyle","ApplSum","ProductUnit","generateTooltipForAverageColumn","ApNFertilizationPlanningComponent","ndiStore","licenses","gridBuilder","nCommonService","_buildGrid","_onSelectedItemsChanged","routerStoreData","gridItems","gridItemsLoading","startsWith","queryParams","targetGridItem","targetComponent","action","TaskManagementAction","navigate","FieldIds","selectedKeys","gridOptions","_show","_export","_isBookProcessAvailable","_delete","pagerOptions","_deleteMany","PagerBuilder","NdiStatistics$","summaries","planBookApplicationDates","pb","getApplicationRateNameByApplication","getApplSum","ApplSumTooltip","Count","getOperationMode","getProductUnit","getFieldsCropsTooltip","then","planBooksIds","modalDialogSubscription","DeleteNFertilizationSummaries","statuses","Bookings$","_getGridItems","filteredApplications","maxItem","updateValues","firstPlanBook","_getNApplicationsWithArea","totalArea","totalAvgOnAreas","calculateProductAmountFromPlanBooks","_onShow","_onExport","_onReset","_pagerOnShow","_pagerOnExportShow","ApNFertilizationEntryBookingComponent","nApplication","ApNFertilizationLogfileEditComponent","constantsService","operationModeStore","logFile","Planning","GetPlanningById","getFieldSets","saveDisabled$","valid","valueChanges","controls","hasOwnProperty","_onFormValueChanges","isScanBoniturOperationMode","getIOperationModeByKey","LoggerId","getOperationModeByLoggerId","group","plannings$","resultList","getFieldNameById","WorkedArea","plannings","planning","WorkingWidth","onCancelClick","onSaveClick","_newPlanning","NContentAvg","SaveLogfiles","json","parse","DataSet","HeaderValuesString","GetOperationModeByLoggerId","GetApplicationMode","standard","Standard","NContentMin","NContentMax","referenceRate","ReferenceRate","Split","dateString","CurrentDateTimeFormat","split","getFieldByFieldGeomId","CropType","control","formValuesUpdateInProgress","inputsToUpdate","planningControlValue","val","ApDynformsComponent","ApNFertilizationLogfilesService","applicationModeService","fertilizationStore","showPointsOnMapService","log","toggleLogPointsOnMap","selectedMin","MAX_SAFE_INTEGER","selectedMax","showLegend","LogLegend","refreshLegend","showPoints","onAccept","Array","isArray","_getLogfiles","onReset","onReject","_getNPlanBookLogfiles","UpdateLogfiles","getEditFieldSets","Fertilizer$","fertilizers","generatePlanning","summaryLogs","_splitLogs","updateLogs","sLogs","ec","cont","cur","_getJson","dbmCount","_getApplicationModeId","dbm","aMax","aMin","_mergeLogs","merged","logs","area","_getProductIdByNContent","AgentContent","Replace","update","planningMap","_mapPlannings","SummaryId","Attachment","GetLogfilesByPlanBookId","summaryId","GetPlanningBySummaryId","cropKeys","agentContent","GetApplicationFromLogfile","operationModes","ck","aC","fieldMap","GetApplicationModeById","GetApplicationModeByKey","routes","path","nFertilizationLogfileService","nFertilization","settingStore","logfileService","_isSaving$","l0","l1","l2","l3","saving","l4","onLoadingStoresComplete","_selectedFieldIds","_getDataFromStore","ApDynGridStatusSwitchColumnConfig","readonly","defaultFilter","disableGreen","_logFileValid","_logBookingReady","stateChange","transform","_onEdit","LogStatus","_onBooking","_logBooked","_onReject","_onRemap","preselect","properties","remapLogfile","DatasetId","ca","DataSetType","DataSetName","filename","Substring","lastIndexOf","getPlanning","headerValues","parseInt","shift","logStatus","_logIsRejected","fieldName","LogStatusDesc","LogStatusClass","FieldArea","FileName","WorkedAreaRounded","AvgRounded","ValueRounded","getApplicationNScanRateName","getApplicationRateName","EcStage","ApNFertilizationLogfilesComponent","canActivate","ApPermissionGuard","login","layout","PageMode","getCropService","loadingStatuses","_selectionChange","nRestrictionsReportDownloadSuccess","downloadResult","_handleDownloadReportStatus","currentMenu","mapMenu","_onMapMenuChanged","fertilizationNeedValue","fnvs","baseFertSummaries","getCropType","secondCrop","nBalance","_getNBalanceDifference","removal","_getNBalance","remaining","FnvId","MainCropType","Removal","MainCropExpectedYield","Balance","MaxAllowance","_setFertilizationNeedValue","placeholder","_exportAsPdf","_exportAsXls","exportFileName","_getExportFilename","contentRows","row","SubNumber","_getReportColumnNames","reportData","Content","HeaderLabels","Rows","Header","bookName","downloadNRestrictionReport","nBalanceTitle","replace","customerExpr","SelectedFarm","Country","CustomerNumber","Any","notification","columnNames","Map","set","MainwdN","ExpectedYieldSecond","StrawHarvested","SecwdN","MsRatio","setFertilizationNeedValue","CampaignYear","ApNFertilizationNNeedComponent","ApNFertilizationRoutes","RouterModule","ApNFertilizationModule","imports","ReactiveFormsModule","ApCoreModule","ApIconModule","LayoutModule","ButtonModule","CommonModule","SplitButtonModule","InputsModule","ComboBoxModule","DateInputsModule","DropDownsModule","FormsModule","GridModule","ExcelModule","PDFModule","PDFExportModule","ApTranslationModule","ApUtilsModule","BodyModule","ApTooltipModule","PagerModule","ApResponsiveTextModule","SharedModule","HeaderModule","GroupModule","ApSectionHeaderModule","ApDynComponentModule","ApFieldManagementModule"],"sources":["./src/app/entry-components/ap-n-fertilization-entry-components/ap-n-fertilization-planning-configs/base/n-application-map-config.base.ts","./src/app/entry-components/ap-n-fertilization-entry-components/ap-n-fertilization-planning-configs/application-map.config.ts","./src/app/entry-components/ap-n-fertilization-entry-components/ap-n-fertilization-planning-configs/target-rate.config.ts","./src/app/entry-components/ap-n-fertilization-entry-components/ap-n-fertilization-planning-configs/n-fertilization.config.ts","./src/app/n-fertilization/services/ap-n-fertilization-component.service.ts","./src/app/entry-components/ap-n-fertilization-entry-components/ap-n-fertilization-planning-configs/rape-fertilization.config.ts","./src/app/entry-components/ap-n-fertilization-entry-components/helpers/curve-creator.ts","./src/app/entry-components/ap-n-fertilization-entry-components/ap-n-fertilization-planning-configs/bonitur.config.ts","./src/app/ap-utils/enums/ap-base-wizard-steps.ts","./src/app/entry-components/ap-n-fertilization-entry-components/services/n-fertilization-planning-entry.service.ts","./src/app/entry-components/ap-n-fertilization-entry-components/ap-n-fertilization-planning-configs/application-map-absolute.config.ts","./src/app/entry-components/ap-n-fertilization-entry-components/ap-n-fertilization-planning-configs/uniform.config.ts","./src/app/entry-components/ap-n-fertilization-entry-components/ap-n-fertilization-planning-configs/general.config.ts","./src/app/entry-components/ap-n-fertilization-entry-components/ap-n-fertilization-planning-entry.component.ts","./src/app/n-fertilization/types/n-fertilization-overview.types.ts","./src/app/n-fertilization/components/ap-n-fertilization-overview.component.ts","./src/app/n-fertilization/components/configs/pager-builder.ts","./src/app/entry-components/ap-n-fertilization-entry-components/ap-n-fertilization-booking.component.ts","./src/app/stores/services/ap-get-geom.service.ts","./src/app/entry-components/ap-n-fertilization-entry-components/ap-n-fertilization-edit.component.ts","./src/app/entry-components/ap-n-fertilization-entry-components/ap-n-fertilization-show.component.ts","./src/app/n-fertilization/components/configs/n-fertilization-plans-grid-builder.service.ts","./src/app/n-fertilization/components/ap-n-fertilization-planning.component.ts","./src/app/n-fertilization/components/ap-n-fertilization-booking.component.ts","./src/app/entry-components/ap-n-fertilization-entry-components/ap-n-fertilization-logfile-edit.component.ts","./src/app/n-fertilization/services/ap-n-fertilization-logfiles.service.ts","./src/app/n-fertilization/ap-n-fertilization.routes.ts","./src/app/n-fertilization/components/ap-n-fertilization-logfiles.component.ts","./src/app/n-fertilization/components/ap-n-fertilization-n-need.component.ts","./src/app/n-fertilization/ap-n-fertilization.module.ts"],"sourcesContent":["import {ApDynformsConfigPlaceholder} from '../../../../ap-dynforms/config/ap-dynforms-config-placeholder';\nimport {ApDynformsConfigNumerictextbox} from '../../../../ap-dynforms/config/ap-dynforms-config-numerictextbox';\nimport {ApDynformsConfigComboBox} from '../../../../ap-dynforms/config/ap-dynforms-config-combobox';\nimport {ApDynformsValidator} from '../../../../ap-dynforms/ap-dynforms-validator';\nimport {Validators} from '@angular/forms';\nimport {nameOf} from '../../../../ap-core/utils/ap-name-of';\nimport IApplicationSettingsParameters = Data.Agronomic.IApplicationSettingsParameters;\nimport ISlopeConfiguration = Data.Agronomic.ISlopeConfiguration;\n\n/**\n * Base class for n-fertilization ui configuration\n */\nexport class NApplicationMapConfigBase {\n /**\n * Generates the slope control depending on the application parameter settings\n * @param parameters agronomic parameter settings which applies for field's crop, ec-value, etc...\n * @param values the current form values\n * @protected\n */\n protected generateSlopeControls(parameters: IApplicationSettingsParameters, values: any): ApDynformsConfigPlaceholder | ApDynformsConfigNumerictextbox | ApDynformsConfigComboBox {\n if (parameters?.slopeShown !== true) {\n return new ApDynformsConfigPlaceholder();\n }\n if (parameters?.slopeType === 'numeric') {\n return new ApDynformsConfigNumerictextbox({\n key: 'ControlFactor',\n label: 'Nutrients__ControlFactor_kg_per_kg_N_uptake',\n infoText: 'Information__Variation_Factor',\n value: values['ControlFactor'],\n step: 0.1,\n min: -8,\n max: 8,\n disabled: !parameters.slopeShown,\n validators: [\n new ApDynformsValidator({validator: Validators.required, errorKey: ''}),\n ]\n });\n } else if (parameters?.slopeType === 'dropDown') {\n return new ApDynformsConfigComboBox({\n key: 'ControlFactor',\n label: 'Fertilisation__ControlCurve',\n options: parameters.slope,\n textField: nameOf('Key'),\n valueField: nameOf('Slope'),\n translate: true,\n value: values['ControlFactor'] ?? parameters?.slope?.FirstOrDefault()?.Slope,\n validators: [\n new ApDynformsValidator({validator: Validators.required, errorKey: ''}),\n ]\n });\n }\n return new ApDynformsConfigPlaceholder();\n }\n}\n","import {ApDynformsConfigFieldset} from '../../../ap-dynforms/config/ap-dynforms-config-fieldset';\nimport {\n ApDynGridPropertyColumnConfig,\n FilterType\n} from '../../../ap-dyngrids/config/ap-dyn-grid-property-column-config';\nimport {\n ApDynGridColumnConfigBase,\n ApDynGridColumnHideConfig,\n} from '../../../ap-dyngrids/config/ap-dyn-grid-column-config-base';\nimport {\n ApDynGridGroupColumnConfig\n} from '../../../ap-dyngrids/config/ap-dyn-grid-group-column-config';\nimport {\n ApDynformsConfigNumerictextbox\n} from '../../../ap-dynforms/config/ap-dynforms-config-numerictextbox';\nimport {Observable} from 'rxjs';\nimport {distinctUntilChanged, filter, map} from 'rxjs/operators';\nimport {ApDynformsValidator} from '../../../ap-dynforms/ap-dynforms-validator';\nimport {Validators} from '@angular/forms';\nimport {GetRoundNumericPipe} from '../../../ap-utils';\nimport {Injectable} from '@angular/core';\nimport {NApplicationMapConfigBase} from './base/n-application-map-config.base';\nimport {INFertilizationPlanFieldToSelectGridItem} from '../types/n-fertilization-planning-entry.types';\nimport {\n NFertilizationPlantProtectionService\n} from '../../../services/data/n-fertilization-plant-protection.service';\nimport {\n GetGrowthStageData\n} from '../../../types/n-fertilization-plant-protection.types';\nimport {ApTranslationService} from '../../../ap-utils/service/ap-translation.service';\nimport IApplicationSettings = Data.Agronomic.IApplicationSettings;\nimport IApplicationSettingsParameters = Data.Agronomic.IApplicationSettingsParameters;\n\n@Injectable()\nexport class ApplicationMapConfig extends NApplicationMapConfigBase {\n private _minAllowed = 0;\n private _maxAllowed = 250;\n\n constructor(private translateService: ApTranslationService,\n private nFertilizationPlantProtectionService: NFertilizationPlantProtectionService,\n private roundNumericPipe: GetRoundNumericPipe) {\n super();\n }\n\n public formBuilder(values: any, formValues$: Observable, applicationSettings: IApplicationSettings | undefined,\n isModalField: boolean, diagramTemplateRef?: any): ApDynformsConfigFieldset[] {\n const parameters = applicationSettings.Parameter;\n const min$ = formValues$.pipe(\n filter(x => x['Minimum'] != null && x['Minimum'] >= 0),\n map((v) => v['Minimum']),\n distinctUntilChanged()\n );\n const max$ = formValues$.pipe(\n filter(x => x['Maximum'] != null && x['Maximum'] >= 0),\n map((v) => v['Maximum']),\n distinctUntilChanged()\n );\n return [\n new ApDynformsConfigFieldset({\n key: 'Agronomy',\n legend: 'Global__Agronomy',\n useMaxWidth: isModalField,\n before: diagramTemplateRef,\n config: [\n new ApDynformsConfigNumerictextbox({\n key: 'ECStage',\n label: 'Global__ECStage',\n value: values['ECStage'],\n min: applicationSettings.EcMin,\n max: applicationSettings.EcMax,\n decimals: 0,\n format: 'n0',\n step: 1,\n validators: [\n new ApDynformsValidator({validator: Validators.required, errorKey: 'Settings__Msg_Vali_Value_Required'}),\n ]\n }),\n this.generateSlopeControls(parameters, values),\n new ApDynformsConfigNumerictextbox({\n key: 'Threshold',\n label: 'Global__Threshold_Percent',\n value: values['Threshold'],\n min: 0,\n max: 100,\n step: 1,\n format: 'n0',\n validators: [\n new ApDynformsValidator({validator: Validators.required, errorKey: ''}),\n ]\n })\n ]\n }),\n new ApDynformsConfigFieldset({\n legend: 'Nutrients_Pages_Popups__Amount',\n key: 'Amount',\n useMaxWidth: isModalField,\n config: [\n new ApDynformsConfigNumerictextbox({\n key: 'Amount',\n label: 'N__TargetRate_kg_N_per_ha',\n value: values['Amount'],\n min: min$,\n max: max$,\n step: 1,\n format: 'n0',\n validators: [\n new ApDynformsValidator({validator: Validators.required, errorKey: ''}),\n ]\n }),\n new ApDynformsConfigNumerictextbox({\n key: 'Constant',\n label: 'Nutrients__Constant_Amount_kg_N_per_ha',\n value: values['Constant'],\n min: min$,\n max: max$,\n step: 1,\n format: 'n0',\n validators: [\n new ApDynformsValidator({validator: Validators.required, errorKey: ''}),\n ]\n }),\n new ApDynformsConfigNumerictextbox({\n key: 'Minimum',\n label: 'Nutrients__Minimum_kg_n_per_ha',\n value: values['Minimum'],\n value$: min$,\n min: 0,\n max: max$,\n step: 1,\n format: 'n0',\n validators: [\n new ApDynformsValidator({validator: Validators.required, errorKey: ''}),\n ]\n }),\n new ApDynformsConfigNumerictextbox({\n key: 'Maximum',\n label: 'Nutrients__Maximum_kg_n_per_ha',\n value: values['Maximum'],\n value$: max$,\n min: min$,\n max: 250,\n step: 1,\n format: 'n0',\n validators: [\n new ApDynformsValidator({validator: Validators.required, errorKey: ''}),\n ]\n })\n ],\n })\n ];\n }\n\n public gridBuilderConfig(modeMode$: Observable, appSettingsParameters: IApplicationSettingsParameters = null): ApDynGridColumnConfigBase[] {\n const applicationGroupColumns = [];\n applicationGroupColumns.push(\n new ApDynGridPropertyColumnConfig({\n title: 'Global__Average_Amount',\n field: 'Amount',\n width: 50,\n columnLoading: 'ColumnLoading',\n filterType: FilterType.NUMBER,\n cssClass: 'right',\n filterable: true,\n tooltip: (dataItem) => dataItem['ErrorMessage'],\n pipes: [{\n pipe: this.roundNumericPipe,\n args: [0]\n }]\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__Threshold',\n field: 'ThresholdAbs',\n width: 50,\n columnLoading: 'ColumnLoading',\n filterType: FilterType.NUMBER,\n cssClass: 'right',\n filterable: true,\n tooltip: (dataItem) => dataItem['ErrorMessage'],\n pipes: [{\n pipe: this.roundNumericPipe,\n args: [0]\n }]\n })\n );\n\n if (appSettingsParameters == null || (appSettingsParameters.slopeShown && appSettingsParameters.slopeType === 'numeric')) {\n applicationGroupColumns.push(\n new ApDynGridPropertyColumnConfig({\n title: 'N__RateSlope',\n field: 'ControlFactor',\n width: 50,\n columnLoading: 'ColumnLoading',\n filterType: FilterType.NUMBER,\n cssClass: 'right',\n filterable: true,\n tooltip: (dataItem) => dataItem['ErrorMessage']\n })\n );\n } else if (appSettingsParameters.slopeShown && appSettingsParameters.slopeType === 'dropDown') {\n applicationGroupColumns.push(\n new ApDynGridPropertyColumnConfig({\n title: 'N__RateSlope',\n field: 'ControlFactorDescription',\n width: 50,\n columnLoading: 'ColumnLoading',\n filterable: true,\n tooltip: (dataItem) => dataItem['ErrorMessage']\n })\n );\n }\n\n applicationGroupColumns.push(\n new ApDynGridPropertyColumnConfig({\n title: 'Global__RateConst',\n field: 'Constant',\n hide: true,\n width: 50,\n columnLoading: 'ColumnLoading',\n filterType: FilterType.NUMBER,\n cssClass: 'right',\n filterable: true,\n tooltip: (dataItem) => dataItem['ErrorMessage'],\n pipes: [{\n pipe: this.roundNumericPipe,\n args: [0]\n }]\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__Min',\n field: 'Minimum',\n hide: true,\n width: 50,\n columnLoading: 'ColumnLoading',\n filterType: FilterType.NUMBER,\n cssClass: 'right',\n filterable: true,\n tooltip: (dataItem) => dataItem['ErrorMessage'],\n pipes: [{\n pipe: this.roundNumericPipe,\n args: [0]\n }]\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__Max',\n field: 'Maximum',\n hide: true,\n width: 50,\n columnLoading: 'ColumnLoading',\n filterType: FilterType.NUMBER,\n cssClass: 'right',\n filterable: true,\n tooltip: (dataItem) => dataItem['ErrorMessage'],\n pipes: [{\n pipe: this.roundNumericPipe,\n args: [0]\n }]\n }),\n );\n const applicationHalfViewGroupColumns = [];\n applicationHalfViewGroupColumns.push(\n new ApDynGridPropertyColumnConfig({\n title: 'Global__Threshold',\n field: 'ThresholdAbs',\n width: 50,\n hide: new ApDynGridColumnHideConfig({\n selfHide: modeMode$\n }),\n columnLoading: 'ColumnLoading',\n filterType: FilterType.NUMBER,\n cssClass: 'right',\n filterable: true,\n tooltip: (dataItem) => dataItem['ErrorMessage'],\n pipes: [{\n pipe: this.roundNumericPipe,\n args: [0]\n }]\n }),\n );\n\n if (appSettingsParameters == null || (appSettingsParameters.slopeShown && appSettingsParameters.slopeType === 'numeric')) {\n applicationHalfViewGroupColumns.push(\n new ApDynGridPropertyColumnConfig({\n title: 'N__RateSlope',\n field: 'ControlFactor',\n width: 50,\n columnLoading: 'ColumnLoading',\n hide: new ApDynGridColumnHideConfig({\n selfHide: modeMode$\n }),\n filterType: FilterType.NUMBER,\n cssClass: 'right',\n filterable: true,\n tooltip: (dataItem) => dataItem['ErrorMessage']\n })\n );\n } else if (appSettingsParameters.slopeShown && appSettingsParameters.slopeType === 'dropDown') {\n applicationHalfViewGroupColumns.push(\n new ApDynGridPropertyColumnConfig({\n title: 'N__RateSlope',\n field: 'ControlFactorDescription',\n hide: new ApDynGridColumnHideConfig({\n selfHide: modeMode$\n }),\n width: 50,\n columnLoading: 'ColumnLoading',\n filterable: true,\n tooltip: (dataItem) => dataItem['ErrorMessage']\n })\n );\n }\n const configNameTranslation = this.translateService.translate('Global__AppFile');\n const unitTranslation = this.translateService.translate('Nutrients__kg_N_per_ha');\n return [\n new ApDynGridPropertyColumnConfig({\n title: 'AvgNUptakeShort',\n field: 'AvgNUptake',\n headerExtraLines: [\n 'Nutrients__kg_N_per_ha'\n ],\n width: 80,\n filterType: FilterType.NUMBER,\n cssClass: 'right',\n filterable: true,\n pipes: [{\n pipe: this.roundNumericPipe,\n args: [0]\n }]\n }),\n new ApDynGridGroupColumnConfig({\n title: `${configNameTranslation} ${unitTranslation}`,\n hide: true,\n groupColumns: applicationGroupColumns\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__Average_Amount',\n field: 'Amount',\n width: 50,\n hide: new ApDynGridColumnHideConfig({\n selfHide: modeMode$\n }),\n columnLoading: 'ColumnLoading',\n filterType: FilterType.NUMBER,\n cssClass: 'right',\n filterable: true,\n tooltip: (dataItem) => dataItem['ErrorMessage'],\n pipes: [{\n pipe: this.roundNumericPipe,\n args: [0]\n }]\n }),\n new ApDynGridGroupColumnConfig({\n groupColumns: applicationHalfViewGroupColumns\n })\n ];\n }\n\n public updateFormValuesByParameters(values: any, selectedItems: INFertilizationPlanFieldToSelectGridItem[],\n applicationSettings: IApplicationSettings | undefined): void {\n const parameters = applicationSettings.Parameter;\n const scansByApplicationSettings = this.nFertilizationPlantProtectionService.getValidBestScansByApplicationSettings(\n selectedItems.map(x => x.ScanData), applicationSettings);\n const growthStages = this.nFertilizationPlantProtectionService.getGrowStages(\n scansByApplicationSettings.map(x => ({ScanData: x} as GetGrowthStageData))\n );\n const growthStageMax = growthStages.Max();\n if (!Number.isFinite(values['Threshold'])) {\n values['Threshold'] = 20;\n }\n if (!Number.isFinite(values['ECStage']) || values['ECStage'] !== growthStageMax) {\n values['ECStage'] = growthStageMax;\n }\n if (!Number.isFinite(values['DeadBioMass']) && Number.isFinite(parameters?.deadBioMass)) {\n values['DeadBioMass'] = parameters.deadBioMass;\n } else {\n values['DeadBioMass'] = 0;\n }\n if (!Number.isFinite(values['Amount'])) {\n values['Amount'] = parameters?.targetValue ?? parameters.recommendation;\n }\n if (!Number.isFinite(values['Constant'])) {\n values['Constant'] = parameters?.uniform;\n }\n if (!Number.isFinite(values['Minimum'])) {\n values['Minimum'] = parameters?.min ?? this._minAllowed;\n }\n if (!Number.isFinite(values['Maximum'])) {\n values['Maximum'] = parameters?.max ?? this._maxAllowed;\n }\n if (!Number.isFinite(values['ControlFactor'])) {\n values['ControlFactor'] = parameters?.slope?.FirstOrDefault()?.Slope ?? 1;\n }\n }\n}\n","import {ApDynformsConfigFieldset} from '../../../ap-dynforms/config/ap-dynforms-config-fieldset';\nimport {ApDynformsConfigComboBox} from '../../../ap-dynforms/config/ap-dynforms-config-combobox';\nimport {ApDynGridColumnConfigBase} from '../../../ap-dyngrids/config/ap-dyn-grid-column-config-base';\nimport {ApDynGridPropertyColumnConfig} from '../../../ap-dyngrids/config/ap-dyn-grid-property-column-config';\nimport {ApDynformsConfigNumerictextbox} from '../../../ap-dynforms/config/ap-dynforms-config-numerictextbox';\nimport {delay, distinctUntilChanged, filter, map} from 'rxjs/operators';\nimport {ApDynformsValidator} from '../../../ap-dynforms/ap-dynforms-validator';\nimport {Validators} from '@angular/forms';\nimport {AgriportConstantsService} from '../../../services/common/agriport-constants.service';\nimport {Observable} from 'rxjs';\nimport {Injectable, TemplateRef} from '@angular/core';\nimport {ApDynGridGroupColumnConfig} from '../../../ap-dyngrids/config/ap-dyn-grid-group-column-config';\nimport {GetRoundNumericPipe} from '../../../ap-utils';\nimport {AgriportConstantsEnum} from '../../../ap-interface/enums/ap-agriport-constants.enum';\n\n@Injectable()\nexport class TargetRateConfig {\n private _minAllowed = 0;\n private _maxAllowed = 250;\n\n constructor(private roundNumericPipe: GetRoundNumericPipe,\n private agriportConstantsService: AgriportConstantsService) {\n }\n\n public formBuilder(values: any, formValues$: Observable, isRape: boolean, isModalField: boolean, diagramTemplateRef?: TemplateRef): ApDynformsConfigFieldset[] {\n return [\n new ApDynformsConfigFieldset({\n key: 'Agronomy',\n legend: 'Global__Agronomy',\n before: diagramTemplateRef,\n useMaxWidth: isModalField,\n config: [\n new ApDynformsConfigNumerictextbox({\n key: 'ECStage',\n label: 'Global__ECStage',\n value: values['ECStage'],\n decimals: 0,\n format: 'n0',\n step: 1,\n min: +this.agriportConstantsService.GetConstant(AgriportConstantsEnum.EcMin),\n max: +this.agriportConstantsService.GetConstant(AgriportConstantsEnum.EcMax),\n validators: [\n new ApDynformsValidator({validator: Validators.required, errorKey: 'Settings__Msg_Vali_Value_Required'}),\n ]\n }),\n new ApDynformsConfigComboBox({\n key: 'ControlFactor',\n label: 'Fertilisation__ControlCurve',\n value: values['ControlFactor'],\n value$: formValues$.pipe(\n map((v) => v['ECStage']),\n filter((v) => isRape || !!v),\n distinctUntilChanged((prev, next) => prev === next),\n map((ecStage) => {\n if (isRape) {\n return 1;\n } else if (ecStage < +this.agriportConstantsService.GetConstant('EC_QUALITY_MIN')) {\n return 1;\n } else if (ecStage > +this.agriportConstantsService.GetConstant('EC_YIELD_MAX')) {\n return -1;\n }\n return undefined;\n }),\n filter((v) => isRape || v != null),\n delay(0)\n ),\n options: formValues$.pipe(\n map((v) => v['ECStage']),\n filter((v) => isRape || !!v),\n distinctUntilChanged(),\n map((ecStage) => {\n const result = [];\n if (isRape) {\n result.push({value: 1, text: 'Global__Yield_Oriented'});\n } else {\n if (ecStage >= +this.agriportConstantsService.GetConstant('EC_QUALITY_MIN')) {\n result.push({value: -1, text: 'Global__Quality_Oriented'});\n }\n if (ecStage <= +this.agriportConstantsService.GetConstant('EC_YIELD_MAX')) {\n result.push({value: 1, text: 'Global__Yield_Oriented'});\n }\n }\n return result;\n }),\n ),\n textField: 'text',\n valueField: 'value',\n translate: true,\n validators: [\n new ApDynformsValidator({validator: Validators.required, errorKey: 'Settings__Msg_Vali_Value_Required'}),\n ]\n }),\n new ApDynformsConfigNumerictextbox({\n key: 'Threshold',\n label: 'Global__Threshold_Percent',\n value: values['Threshold'] ?? 20,\n format: 'n0',\n min: 0,\n max: 100,\n validators: [\n new ApDynformsValidator({validator: Validators.required, errorKey: 'Settings__Msg_Vali_Value_Required'}),\n ]\n })\n ]\n }),\n new ApDynformsConfigFieldset({\n legend: 'Nutrients_Pages_Popups__Amount',\n key: 'Amount',\n useMaxWidth: isModalField,\n config: [\n new ApDynformsConfigNumerictextbox({\n key: 'TargetRate',\n label: 'Fertilisation__TargetRate_Nutrient_kg_N_per_ha',\n value: values['TargetRate'],\n min: formValues$.pipe(\n map((v) => v['ControlRange']),\n distinctUntilChanged((prev, next) => prev === next),\n map((range) => range ? Math.max(0, range) : 0),\n delay(0)\n ),\n max: this._maxAllowed,\n validators: [\n new ApDynformsValidator({validator: Validators.required, errorKey: 'Settings__Msg_Vali_Value_Required'}),\n ]\n }),\n new ApDynformsConfigNumerictextbox({\n key: 'ControlRange',\n label: 'Global__Control_Range_kg_N_per_ha',\n value: values['ControlRange'],\n min: this._minAllowed,\n max: formValues$.pipe(\n filter(v => v['TargetRate'] && v['TargetRate'] >= 0),\n map(v => v['TargetRate'])\n ),\n validators: [\n new ApDynformsValidator({validator: Validators.required, errorKey: 'Settings__Msg_Vali_Value_Required'}),\n ]\n }),\n new ApDynformsConfigNumerictextbox({\n key: 'Minimum',\n label: 'Nutrients__Minimum_kg_n_per_ha',\n value: values['Minimum'],\n disabled: true,\n min: this._minAllowed,\n step: 1,\n format: 'n0',\n value$: formValues$.pipe(\n filter((v) => !isNaN(v['TargetRate']) && !isNaN(v['ControlRange'])),\n map((v) => {\n return +v['TargetRate'] - +v['ControlRange'];\n })\n )\n }),\n new ApDynformsConfigNumerictextbox({\n key: 'Maximum',\n label: 'Nutrients__Maximum_kg_n_per_ha',\n value: values['Maximum'],\n disabled: true,\n min: this._minAllowed,\n step: 1,\n format: 'n0',\n value$: formValues$.pipe(\n filter((v) => !isNaN(v['TargetRate']) && !isNaN(v['ControlRange'])),\n map((v) => +v['TargetRate'] + +v['ControlRange'])\n )\n }),\n new ApDynformsConfigNumerictextbox({\n key: 'Constant',\n label: 'Nutrients__Constant_Amount_kg_N_per_ha',\n value: values['TargetRate'],\n value$: formValues$.pipe(map(v => v['TargetRate'])),\n disabled: true,\n min: formValues$.pipe(\n filter(x => x['Minimum'] != null && x['Minimum'] >= 0),\n map(v => v['Minimum'])\n ),\n max: formValues$.pipe(\n filter(x => x['Maximum'] != null && x['Maximum'] >= 0),\n map(v => v['Maximum'])\n ),\n step: 1,\n format: 'n0',\n validators: [\n new ApDynformsValidator({validator: Validators.required, errorKey: 'Settings__Msg_Vali_Value_Required'}),\n ]\n })\n ]\n })\n ];\n }\n\n public gridBuilderConfig(): ApDynGridColumnConfigBase[] {\n return [\n new ApDynGridPropertyColumnConfig({\n title: 'Global__Control_Function',\n field: 'ControlFactorDescription',\n hide: true,\n width: 90\n }),\n new ApDynGridGroupColumnConfig({\n title: 'Global__KgNPerHa',\n groupColumns: [\n new ApDynGridPropertyColumnConfig({\n title: 'AgriConnect_View__TargetRate',\n field: 'TargetRate',\n width: 50\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__Threshold',\n field: 'Threshold',\n hide: true,\n width: 50\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__RateConst',\n field: 'Constant',\n hide: true,\n width: 50,\n pipes: [{\n pipe: this.roundNumericPipe,\n args: [0]\n }]\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__Min',\n field: 'Minimum',\n width: 50,\n pipes: [{\n pipe: this.roundNumericPipe,\n args: [0]\n }]\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__Max',\n field: 'Maximum',\n width: 50,\n pipes: [{\n pipe: this.roundNumericPipe,\n args: [0]\n }]\n })\n ]\n })\n ];\n }\n}\n","import {ApDynformsConfigFieldset} from '../../../ap-dynforms/config/ap-dynforms-config-fieldset';\nimport {ApDynformsConfigComboBox} from '../../../ap-dynforms/config/ap-dynforms-config-combobox';\nimport {ApDynGridPropertyColumnConfig} from '../../../ap-dyngrids/config/ap-dyn-grid-property-column-config';\nimport {ApDynformsConfigNumerictextbox} from '../../../ap-dynforms/config/ap-dynforms-config-numerictextbox';\nimport {delay, distinctUntilChanged, filter, map} from 'rxjs/operators';\nimport {ApDynformsValidator} from '../../../ap-dynforms/ap-dynforms-validator';\nimport {Validators} from '@angular/forms';\nimport {AgriportConstantsService} from '../../../services/common/agriport-constants.service';\nimport {Observable} from 'rxjs';\nimport {Injectable, TemplateRef} from '@angular/core';\nimport {ApDynGridGroupColumnConfig} from '../../../ap-dyngrids/config/ap-dyn-grid-group-column-config';\nimport {ApDynGridColumnConfigBase} from '../../../ap-dyngrids/config/ap-dyn-grid-column-config-base';\nimport {GetRoundNumericPipe} from '../../../ap-utils';\nimport {NFertilizationCommonEntryService} from '../services/n-fertilization-common-entry.service';\nimport {NFertilizationService} from '../../../services/data/n-fertilization.service';\nimport {AgriportConstantsEnum} from '../../../ap-interface/enums/ap-agriport-constants.enum';\n\n@Injectable()\nexport class NFertilizationConfig {\n constructor(private nFertilizationService: NFertilizationService,\n private agriportConstantsService: AgriportConstantsService,\n private nFertilizationCommonEntryService: NFertilizationCommonEntryService,\n private roundNumericPipe: GetRoundNumericPipe) {\n }\n\n public formBuilderConfig(values: any, formValues$: Observable, cropId: number | undefined, cropKey: number | undefined,\n isModalField: boolean, diagramTemplateRef?: TemplateRef): ApDynformsConfigFieldset[] {\n const min$ = formValues$.pipe(\n filter(x => x['Minimum'] != null && x['Minimum'] >= 0),\n map(v => v['Minimum'])\n );\n const max$ = formValues$.pipe(\n filter(x => x['Maximum'] != null && x['Maximum'] >= 0),\n map(v => v['Maximum'])\n );\n const isRape = this.nFertilizationService.isRapeCrop([cropId]);\n return [\n new ApDynformsConfigFieldset({\n key: 'Agronomy',\n legend: 'Global__Agronomy',\n before: diagramTemplateRef,\n useMaxWidth: isModalField,\n config: [\n new ApDynformsConfigNumerictextbox({\n key: 'ECStage',\n label: 'Global__ECStage',\n value: values['ECStage'],\n min: +this.agriportConstantsService.GetConstant(AgriportConstantsEnum.EcMin),\n max: +this.agriportConstantsService.GetConstant(AgriportConstantsEnum.EcMax),\n decimals: 0,\n format: 'n0',\n step: 1,\n validators: [\n new ApDynformsValidator({validator: Validators.required, errorKey: 'Settings__Msg_Vali_Value_Required'}),\n ]\n }),\n new ApDynformsConfigComboBox({\n key: 'ControlFactor',\n label: 'Fertilisation__ControlCurve',\n value: values['ControlFactor'],\n value$: formValues$.pipe(\n map((formValues) => formValues['ECStage']),\n filter(ecStage => ecStage != null),\n distinctUntilChanged(),\n map((ecStage) => {\n if (isRape) {\n return 1;\n } else {\n if (ecStage < +AgriportConstantsService.GetConstant('EC_QUALITY_MIN')) {\n return 1;\n } else if (ecStage > +AgriportConstantsService.GetConstant('EC_YIELD_MAX')) {\n return -1;\n }\n return undefined;\n }\n }),\n filter((v) => !!v),\n delay(0)\n ),\n options: formValues$.pipe(\n map((formValues) => formValues['ECStage']),\n filter(ecStage => ecStage != null),\n distinctUntilChanged(),\n map((ecStage) => {\n const result = [];\n if (isRape) {\n result.push({value: 1, text: 'Global__Yield_Oriented'});\n } else {\n if (ecStage >= +AgriportConstantsService.GetConstant('EC_QUALITY_MIN')) {\n result.push({value: -1, text: 'Global__Quality_Oriented'});\n }\n if (ecStage <= +AgriportConstantsService.GetConstant('EC_YIELD_MAX')) {\n result.push({value: 1, text: 'Global__Yield_Oriented'});\n }\n }\n return result;\n })\n ),\n textField: 'text',\n valueField: 'value',\n translate: true,\n validators: [\n new ApDynformsValidator({validator: Validators.required, errorKey: 'Settings__Msg_Vali_Value_Required'}),\n ]\n }),\n new ApDynformsConfigNumerictextbox({\n key: 'Threshold',\n label: 'Global__Threshold_SN',\n value: values['Threshold'] ?? this.nFertilizationCommonEntryService.getThreshold(values['ECStage'], cropKey),\n value$: formValues$.pipe(\n filter(formValues => formValues['ECStage'] != null),\n distinctUntilChanged((prev, curr) => prev['ECStage'] === curr['ECStage']),\n map((formValues: any) => this.nFertilizationCommonEntryService.getThreshold(formValues['ECStage'], cropKey))\n ),\n format: 'n0',\n min: 0,\n validators: [\n new ApDynformsValidator({validator: Validators.required, errorKey: 'Settings__Msg_Vali_Value_Required'}),\n ]\n })\n ]\n }),\n new ApDynformsConfigFieldset({\n legend: 'Nutrients_Pages_Popups__Amount',\n key: 'Amount',\n useMaxWidth: isModalField,\n config: [\n new ApDynformsConfigNumerictextbox({\n key: 'Amount',\n label: 'Global__Reference_Quantity_kg_N_per_ha',\n value: values['Amount'],\n min: min$,\n max: max$,\n step: 1,\n format: 'n0',\n validators: [\n new ApDynformsValidator({validator: Validators.required, errorKey: 'Settings__Msg_Vali_Value_Required'}),\n ]\n }),\n new ApDynformsConfigNumerictextbox({\n key: 'Constant',\n label: 'Nutrients__Constant_Amount_kg_N_per_ha',\n value: values['Constant'],\n min: min$,\n max: max$,\n step: 1,\n format: 'n0',\n validators: [\n new ApDynformsValidator({validator: Validators.required, errorKey: 'Settings__Msg_Vali_Value_Required'}),\n ]\n }),\n new ApDynformsConfigNumerictextbox({\n key: 'Minimum',\n label: 'Nutrients__Minimum_kg_n_per_ha',\n infoText: 'NFertilizationMinimumAdjustmentInfoText',\n value: values['Minimum'],\n value$: min$,\n min: 0,\n max: max$,\n step: 1,\n format: 'n0',\n validators: [\n new ApDynformsValidator({validator: Validators.required, errorKey: 'Settings__Msg_Vali_Value_Required'}),\n ]\n }),\n new ApDynformsConfigNumerictextbox({\n key: 'Maximum',\n label: 'Nutrients__Maximum_kg_n_per_ha',\n infoText: 'NFertilizationMaximumAdjustmentInfoText',\n value: values['Maximum'],\n value$: max$,\n min: min$,\n max: 250,\n step: 1,\n format: 'n0',\n validators: [\n new ApDynformsValidator({validator: Validators.required, errorKey: 'Settings__Msg_Vali_Value_Required'}),\n ]\n })\n ]\n })\n ];\n }\n\n public gridBuilderConfig(): ApDynGridColumnConfigBase[] {\n return [\n new ApDynGridPropertyColumnConfig({\n title: 'Global__Control_Function',\n field: 'ControlFactorDescription',\n hide: true,\n width: 50\n }),\n new ApDynGridGroupColumnConfig({\n title: 'Global__KgNPerHa',\n groupColumns: [\n new ApDynGridPropertyColumnConfig({\n title: 'AgriConnect_View__Reference',\n field: 'Amount',\n width: 50\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__Threshold',\n field: 'Threshold',\n hide: true,\n width: 50\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__RateConst',\n field: 'Constant',\n hide: true,\n width: 50,\n pipes: [{\n pipe: this.roundNumericPipe,\n args: [0]\n }]\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__Min',\n field: 'Minimum',\n width: 50,\n pipes: [{\n pipe: this.roundNumericPipe,\n args: [0]\n }]\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__Max',\n field: 'Maximum',\n width: 50,\n pipes: [{\n pipe: this.roundNumericPipe,\n args: [0]\n }]\n })\n ]\n })\n ];\n }\n}\n","import {Injectable} from '@angular/core';\nimport {TranslationStore} from '../../stores/translation/translation.store';\nimport * as moment from 'moment';\nimport {LanguageStore} from '../../stores/translation/language.store';\nimport {FertilizerStore} from '../../stores/base-data/fertilizer.store';\nimport {CropApplicationStore} from '../../stores/task-management/crop-application.store';\nimport {CropTypeStore} from '../../stores/base-data/crop.types.store';\nimport {NFertilizationStore} from '../../stores/n-fertilization/n-fertilization.store';\nimport {FertilizerService} from '../../services/data/fertilizer.service';\nimport {NFertilizationService} from '../../services/data/n-fertilization.service';\nimport {GetOperationModeService} from '../../ap-utils/service/ap-get-operationmode.service';\nimport {MapStore} from '../../stores/map/map.store';\nimport {ApDateService, DateSort} from '../../ap-core/services/ap-date-service';\nimport {ApTooltipContentService} from '../../ap-utils/service/ap-tooltip-content.service';\nimport {ApNutrientService} from '../../ap-utils/service/ap-nutrient.service';\nimport {ApTranslationService} from '../../ap-utils/service/ap-translation.service';\nimport {FieldStore} from '../../stores/farm/field.store';\nimport {ApplicationDatesData, ISummaryWithPlanBooks} from '../types/n-fertilization-common.types';\nimport {IGridStatus} from '../../ap-interface/interfaces/ap-grid-status.interface';\nimport {ApColumnState} from '../../ap-interface/enums/ap-column-state.enum';\nimport INFertilizationPlanBook = Data.TaskManagement.INFertilizationPlanBook;\nimport IDatasetFieldMap = Data.Sensor.IDatasetFieldMap;\nimport IField = Data.FieldManagement.IField;\nimport IBasicFertilisationPlanBooks = Data.TaskManagement.IBasicFertilisationPlanBooks;\n\n@Injectable({providedIn: 'root'})\nexport class ApNFertilizationComponentService {\n constructor(private mapStore: MapStore,\n private fieldStore: FieldStore,\n private cropStore: CropTypeStore,\n private fertilizerStore: FertilizerStore,\n private languageStore: LanguageStore,\n private translationStore: TranslationStore,\n private nFertilizationStore: NFertilizationStore,\n private cropApplicationStore: CropApplicationStore,\n private dateService: ApDateService,\n private nutrientService: ApNutrientService,\n private fertilizerService: FertilizerService,\n private translationService: ApTranslationService,\n private nFertilizationService: NFertilizationService,\n private tooltipContentService: ApTooltipContentService,\n private operationModeService: GetOperationModeService) {\n }\n\n public getPlanningDescription(planBook: INFertilizationPlanBook): string {\n const token = [];\n if (planBook.MainCropId && planBook.ECValue) {\n const application = this.cropApplicationStore.GetApplication(\n this.cropStore.getDefaultCroptype(planBook.MainCropId).Eppocode, planBook.ECValue, planBook.OperationMode);\n const translation = this.translationStore.FindTranslationForSelectedLanguage('Global__N_ApplNum');\n token.push(`${application} ${translation}`);\n }\n if (!!planBook.ProductId || planBook.ProductId === 0) {\n const fertilizer = this.fertilizerStore.getFertilizer(planBook.ProductId);\n token.push(this.fertilizerService.getFertilizerProductName(fertilizer));\n }\n if (planBook?.ApplicationMode?.Key === 'Global__RateConst') {\n token.push(this.translationStore.FindTranslationForSelectedLanguage('Global__RateConst'));\n } else if (planBook?.ApplicationMode?.Key === 'Global__RateVariable') {\n token.push(this.translationStore.FindTranslationForSelectedLanguage('Global__RateVariable'));\n }\n if (planBook.ApplicationDate) {\n token.push(moment(planBook.ApplicationDate).format(this.languageStore.SelectedLanguage.DateFormat));\n }\n if (planBook.Summary?.Title) {\n token.push(planBook.Summary.Title);\n }\n return token.Join(' ');\n }\n\n public filterPlanBooks(values: IDatasetFieldMap, planBooks: INFertilizationPlanBook[]): INFertilizationPlanBook[] {\n return planBooks.filter(planBook => planBook.FieldGeomId === values.FieldGeomId);\n }\n\n public getProductIdByNContent(content: number): number {\n let min = 100 - content;\n let organic: boolean;\n let productId = 0;\n this.fertilizerStore.Fertilizer.filter(f => f.ContentN > 0).forEach((f) => {\n if (!(min < Math.abs(f.ContentN * (f.IsOrganic ? 0.1 : 1) - content))) {\n min = Math.abs(f.ContentN - content);\n productId = f.Id;\n organic = f.IsOrganic;\n } else if (min === Math.abs(f.ContentN - content) && organic && !f.IsOrganic) {\n productId = f.Id;\n organic = f.IsOrganic;\n }\n });\n return productId;\n }\n\n public getFieldApplicationRateValues(field: IField, planBooks: INFertilizationPlanBook[], logfiles: IDatasetFieldMap[], baseFertPlanBooks: IBasicFertilisationPlanBooks[]): boolean[] {\n const contentNPlanBooks = this.nFertilizationService.getContentNRelatedPlanBooks(field, planBooks, logfiles, baseFertPlanBooks);\n if (!contentNPlanBooks || contentNPlanBooks.length <= 0) {\n return [];\n }\n const applicationsRate = this._getApplicationsRate(contentNPlanBooks);\n return [\n applicationsRate.some(appl => appl === 0),\n applicationsRate.some(appl => appl === -1),\n applicationsRate.some(appl => appl === 1),\n applicationsRate.some(appl => appl === 2),\n applicationsRate.some(appl => appl === 3),\n applicationsRate.some(appl => appl === 4),\n ];\n }\n\n public getApplicationRateFromPlanBooks(planBooks: INFertilizationPlanBook[]): number | undefined {\n if (!planBooks || planBooks.length <= 0) {\n return undefined;\n }\n const applications = planBooks.map(x => ({\n CropTypeId: x.MainCropId,\n OperationModeId: x.OperationMode.Id,\n EcValue: x.ECValue\n }));\n const applicationsRate = this._getApplicationsRate(applications);\n const singleRate = applicationsRate[0];\n if (!Number.isFinite(singleRate)) {\n return undefined;\n }\n const areRatesTheSame = applicationsRate.every(num => num === undefined || num === singleRate);\n if (!areRatesTheSame) {\n console.warn('N-Planbooks from Summary have more then one Rate');\n return undefined;\n }\n return singleRate;\n }\n\n public getApplicationMinMax(cropKey: number, application: number | null | undefined): { min: number, max: number } {\n if (application === null || application === undefined) {\n return {min: undefined, max: undefined};\n }\n const applications = this.nFertilizationStore.Listen((s) => s.cropEcSn).getValue();\n const sorted = applications.filter((a) => a.CropKeys.includes(cropKey)).sort((a, b) => a.EcMin - b.EcMin);\n if (sorted.length > application) {\n return {min: sorted[application].EcMin, max: sorted[application].EcMax};\n }\n return {min: undefined, max: undefined};\n }\n\n public getPlanBooksFieldsCount(planBooks: INFertilizationPlanBook[], isBooked: boolean): string {\n if (!planBooks || planBooks.length <= 0) {\n return '0/0';\n }\n const nonDeletedPlanBooks = planBooks.filter(x => !x.DeletedAt);\n const filteredPlanBooks = planBooks.filter(x => isBooked ? x.BookedAt : !x.BookedAt);\n return filteredPlanBooks.length + '/' + nonDeletedPlanBooks.length;\n }\n\n public showPlanBookStatisticOnMap(planBooks: INFertilizationPlanBook[], currentUrl: string): void {\n if (!currentUrl) {\n return;\n }\n this.mapStore.Layers.NApplicationMapLayer.clear();\n this.mapStore.Layers.Clear();\n this.mapStore.Legends.removeLegend(this.mapStore.Legends.NPlanningLegend);\n const ids = planBooks.map(x => x.Id);\n if (ids.length === 0) {\n return;\n }\n // TODO this is missing in the data model\n const statistic = {\n Max: planBooks.Reduce((target, ele) => {\n if (ele.ApplicationMax > target) {\n return ele.ApplicationMax;\n }\n return target;\n }, 0),\n ElementId: 5,\n ProductId: planBooks.FirstOrDefault().ProductId,\n Min: planBooks.Reduce((target, ele) => {\n return target < ele.ApplicationMin ? target : ele.ApplicationMin;\n }, planBooks.FirstOrDefault().ApplicationMin),\n Average: planBooks.FirstOrDefault().ApplicationRate\n };\n this.mapStore.Legends.onNPlanningChanged.emit(statistic);\n this.mapStore.Layers.NPlanningLayerSourceInit(currentUrl, ids);\n }\n\n public getApplicationDatesData(planBooks: INFertilizationPlanBook[]): ApplicationDatesData | null {\n const planBooksApplicationDates = this._getPlanBookApplicationDates(planBooks);\n const uniqueApplicationDates = this.dateService.getUniqDates(planBooksApplicationDates, DateSort.Ascending);\n return {\n Tooltip: this.tooltipContentService.planBooksApplicationDatesTooltip(uniqueApplicationDates.map(x => ({ApplicationDate: x}))),\n IsMoreThanOneUniqDate: uniqueApplicationDates.length > 1,\n NewestDate: uniqueApplicationDates[uniqueApplicationDates.length - 1]\n };\n }\n\n public getCropId(planBooks: INFertilizationPlanBook[]): number | undefined {\n const filteredData = planBooks.map(pB => pB.MainCropId).reduce((acc, el) => {\n acc.k[el] = acc.k[el] ? acc.k[el] + 1 : 1;\n acc.max = acc.max ? acc.max < acc.k[el] ? el : acc.max : el;\n return acc;\n }, {k: {}, max: undefined});\n return filteredData.max;\n }\n\n public getProductId(planBooks: INFertilizationPlanBook[]): number | undefined {\n const filteredData = planBooks.map(pB => pB.ProductId).reduce((acc, el) => {\n acc.k[el] = acc.k[el] ? acc.k[el] + 1 : 1;\n acc.max = acc.max ? acc.max < acc.k[el] ? el : acc.max : el;\n return acc;\n }, {k: {}, max: undefined});\n return filteredData.max;\n }\n\n public getSummaryWithPlanBooks(planBooks: INFertilizationPlanBook[], isBooking: boolean): ISummaryWithPlanBooks[] {\n const summariesMap = planBooks.reduce((summaryMap, item) => {\n const id = item.Summary?.Id?.toString() ?? undefined;\n if (id === undefined) {\n return summaryMap;\n }\n if (summaryMap[id] === undefined) {\n summaryMap[id] = {Summary: item.Summary, FilteredPlanBooks: [], TotalPlanBooks: []};\n }\n if (!item.DeletedAt && ((isBooking && item.BookedAt) || (!isBooking && !item.BookedAt))) {\n summaryMap[id].FilteredPlanBooks.push(item);\n }\n summaryMap[id].TotalPlanBooks.push(item);\n return summaryMap;\n }, {} as Record);\n return Object.keys(summariesMap).map((key) => summariesMap[key]);\n }\n\n public getStatus(s: ISummaryWithPlanBooks): IGridStatus {\n if (!this._isRecordValid(s)) {\n return {\n state: ApColumnState.Red,\n class: 'ap-status-red',\n description: 'Global__Corrupted_Planning_Data'\n };\n }\n return this.nutrientService.getFertilizerStatus(s.Summary.ApplicationMode, false);\n }\n\n public getArea(planBooks: INFertilizationPlanBook[]): number {\n return planBooks.reduce((a, b) => a + (this.fieldStore.getFieldGeomById(b.FieldGeomId)?.AreaHa ?? 0), 0);\n }\n\n public applyAdditionalStylesForFertilizationValues(dataItem: { FertilizerEfficiency: number | undefined }): string {\n return this._isDetailItemEfficiencyValid(dataItem) ? ' italic' : '';\n }\n\n public tooltipForFertilizationValues(dataItem: { FertilizerEfficiency: number | undefined }): string {\n if (!this._isDetailItemEfficiencyValid(dataItem)) {\n return '';\n }\n const nEffectivenessTranslation = this.translationService.translate('Settings__Lbl_NEffectiveness');\n return `${nEffectivenessTranslation}: ${dataItem.FertilizerEfficiency}%`;\n }\n\n private _isDetailItemEfficiencyValid(dataItem: { FertilizerEfficiency: number | undefined }): boolean {\n return Number.isFinite(dataItem.FertilizerEfficiency)\n && dataItem.FertilizerEfficiency >= 0\n && dataItem.FertilizerEfficiency < 100;\n }\n\n private _isRecordValid(s: ISummaryWithPlanBooks): boolean {\n return !!s.Summary?.ApplicationMode?.Key && !!s.Summary?.OperationMode?.Key && s.FilteredPlanBooks?.length > 0;\n }\n\n private _getPlanBookApplicationDates(planBooks: INFertilizationPlanBook[]): Date[] {\n if (!planBooks || planBooks.length <= 0) {\n return [];\n }\n const planBooksApplicationDates = planBooks.filter(x => x.ApplicationDate)\n .map(x => x.ApplicationDate);\n return planBooksApplicationDates.map(x => {\n const farmDate = this.dateService.toFarmDate(new Date(x)).toDate();\n return this.dateService.getDateMidnight(farmDate);\n });\n }\n\n private _getApplicationsRate(applications: {\n CropTypeId: number,\n OperationModeId: number,\n EcValue: number\n }[]): (number | undefined)[] {\n return applications.map(application => {\n const defaultCrop = this.cropStore.getDefaultCroptype(application.CropTypeId);\n const operationMode = this.operationModeService.getOperationModeById(application.OperationModeId);\n return this.cropApplicationStore.GetApplication(defaultCrop?.Eppocode, application.EcValue, operationMode);\n });\n }\n}\n","import {ApDynformsConfigFieldset} from '../../../ap-dynforms/config/ap-dynforms-config-fieldset';\nimport {ApDynformsConfigComboBox} from '../../../ap-dynforms/config/ap-dynforms-config-combobox';\nimport {\n ApDynGridPropertyColumnConfig\n} from '../../../ap-dyngrids/config/ap-dyn-grid-property-column-config';\nimport {\n ApDynformsConfigNumerictextbox\n} from '../../../ap-dynforms/config/ap-dynforms-config-numerictextbox';\nimport {delay, distinctUntilChanged, filter, map} from 'rxjs/operators';\nimport {ApDynformsValidator} from '../../../ap-dynforms/ap-dynforms-validator';\nimport {Validators} from '@angular/forms';\nimport {BehaviorSubject, combineLatest, Observable} from 'rxjs';\nimport {ApDynGridGroupColumnConfig} from '../../../ap-dyngrids/config/ap-dyn-grid-group-column-config';\nimport {ApDynGridColumnConfigBase} from '../../../ap-dyngrids/config/ap-dyn-grid-column-config-base';\nimport {\n ApNFertilizationComponentService\n} from '../../../n-fertilization/services/ap-n-fertilization-component.service';\nimport {GetRoundNumericPipe} from '../../../ap-utils';\nimport {Injectable} from '@angular/core';\nimport {ApTranslationService} from '../../../ap-utils/service/ap-translation.service';\nimport {NFertilizationCommonEntryService} from '../services/n-fertilization-common-entry.service';\n\n@Injectable()\nexport class RapeFertilizationConfig {\n private _minAllowed = 0;\n private _maxAllowed = 250;\n private _ecMin$ = new BehaviorSubject(undefined);\n private _ecMax$ = new BehaviorSubject(undefined);\n\n constructor(private translationService: ApTranslationService,\n private nFertilizationComponentService: ApNFertilizationComponentService,\n private nFertilizationCommonEntryService: NFertilizationCommonEntryService,\n private roundNumericPipe: GetRoundNumericPipe) {\n }\n\n public formBuilderConfig(values: any, formValues$: Observable, cropKey: number | undefined,\n isModalField: boolean): ApDynformsConfigFieldset[] {\n this._ecMin$.next(undefined);\n this._ecMax$.next(undefined);\n const min$ = formValues$.pipe(\n filter(x => x['Minimum'] != null && x['Minimum'] >= 0),\n map((v) => v['Minimum'])\n );\n const max$ = formValues$.pipe(\n filter(x => x['Maximum'] != null && x['Maximum'] >= 0),\n map((v) => v['Maximum'])\n );\n return [\n new ApDynformsConfigFieldset({\n key: 'Agronomy',\n legend: 'Global__Agronomy',\n useMaxWidth: isModalField,\n config: [\n new ApDynformsConfigComboBox({\n key: 'Appl',\n label: 'Global__N_ApplNum',\n value: values['Appl'],\n value$: formValues$.pipe(\n filter(formValues => formValues && Object.keys(formValues).length > 0),\n distinctUntilChanged((p, n) => p['Appl'] === n['Appl']),\n filter((formValues) => formValues['Appl'] != null),\n map((formValues) => {\n const newMin = +this.nFertilizationComponentService.getApplicationMinMax(311, formValues['Appl']).min;\n const max = +this.nFertilizationComponentService.getApplicationMinMax(311, formValues['Appl']).max;\n // ensure that min is always smaller than max\n if (newMin > this._ecMax$.value) {\n // set max first\n this._ecMax$.next(max);\n this._ecMin$.next(newMin);\n } else { // newMax < this._min$.value)\n // set min first\n this._ecMin$.next(newMin);\n this._ecMax$.next(max);\n }\n return formValues['Appl'];\n }),\n ),\n options: [\n {value: 1, text: 'AgriConnect_ApplNum_1'},\n {value: 2, text: 'AgriConnect_ApplNum_2'}\n ],\n valueField: 'value',\n textField: 'text',\n translate: true,\n validators: [\n new ApDynformsValidator({validator: Validators.required, errorKey: 'Settings__Msg_Vali_Value_Required'}),\n ]\n }),\n new ApDynformsConfigNumerictextbox({\n key: 'ECStage',\n label: 'Global__ECStage',\n format: 'n0',\n value: values['ECStage'],\n value$: combineLatest([formValues$, this._ecMin$, this._ecMax$]).pipe(\n filter(([, min, max]) => min != null && max != null),\n map(([formValues]) => formValues),\n distinctUntilChanged((p, n) => p['Appl'] === n['Appl']),\n filter((v) => v['Appl'] != null),\n delay(10),\n map((formValues) => {\n if (formValues['ECStage'] == null ||\n formValues['ECStage'] < this._ecMin$.getValue() ||\n formValues['ECStage'] > this._ecMax$.getValue()) {\n return this._ecMin$.getValue();\n }\n return formValues['ECStage'];\n })\n ),\n min: this._ecMin$,\n max: this._ecMax$,\n step: 1,\n validators: [\n new ApDynformsValidator({validator: Validators.required, errorKey: 'Settings__Msg_Vali_Value_Required'}),\n ]\n }),\n new ApDynformsConfigNumerictextbox({\n key: 'Threshold',\n label: 'Global__Threshold_SN',\n format: 'n0',\n value: values['Threshold'],\n value$: formValues$.pipe(\n filter(formValues => formValues['ECStage'] != null),\n distinctUntilChanged((prev, curr) => prev['ECStage'] === curr['ECStage']),\n map(formValues => this.nFertilizationCommonEntryService.getThreshold(formValues['ECStage'], cropKey))\n ),\n min: 0,\n max: 100,\n validators: [\n new ApDynformsValidator({validator: Validators.required, errorKey: 'Settings__Msg_Vali_Value_Required'}),\n ]\n }),\n new ApDynformsConfigComboBox({\n key: 'YieldExpectation',\n label: 'Docu_Ini__YieldExpectation',\n value: values['YieldExpectation'] ?? 4,\n options: formValues$.pipe(\n distinctUntilChanged((prev, curr) => prev['Appl'] === curr['Appl']),\n map(formValues => this._getYieldExpectationOptions(formValues['Appl']))\n ),\n infoText: 'Global_Yield_Expectation_Text_Info',\n textField: 'text',\n valueField: 'value',\n validators: [\n new ApDynformsValidator({validator: Validators.required, errorKey: 'Settings__Msg_Vali_Value_Required'}),\n ]\n }),\n new ApDynformsConfigComboBox({\n key: 'DeadBioMass',\n label: 'Global__ExtinctBiomass',\n value: values['DeadBioMass'] ?? 0,\n options: [\n {value: 0, text: '0 %'},\n {value: 10, text: '10 %'},\n {value: 20, text: '20 %'},\n {value: 30, text: '30 %'},\n {value: 40, text: '40 %'},\n ],\n disabled$: formValues$.pipe(\n distinctUntilChanged((p, n) => p['Appl'] === n['Appl']),\n map((v) => v['Appl'] !== 1)\n ),\n textField: 'text',\n valueField: 'value',\n validators: [\n new ApDynformsValidator({validator: Validators.required, errorKey: 'Settings__Msg_Vali_Value_Required'}),\n ]\n }),\n new ApDynformsConfigComboBox({\n key: 'Potential',\n label: 'Global__N_MineralPot',\n value: values['Potential'] ?? 1,\n disabled$: formValues$.pipe(\n distinctUntilChanged((p, n) => p['Appl'] === n['Appl']),\n map((v) => v['Appl'] !== 2)\n ),\n textField: 'text',\n valueField: 'value',\n translate: true,\n options: [\n {value: 0, text: 'AgriConnect_MineralPot_Low'},\n {value: 1, text: 'AgriConnect_MineralPot_Medium'},\n {value: 2, text: 'AgriConnect_MineralPot_High'}\n ]\n })\n ]\n }),\n new ApDynformsConfigFieldset({\n legend: 'Nutrients_Pages_Popups__Amount',\n key: 'Amount',\n useMaxWidth: isModalField,\n config: [\n new ApDynformsConfigNumerictextbox({\n key: 'Minimum',\n label: 'Nutrients__Minimum_kg_n_per_ha',\n infoText: 'RapeFertilizationMinimumAdjustmentInfoText',\n value: values['Minimum'],\n value$: min$,\n min: this._minAllowed,\n max: max$,\n step: 1,\n format: 'n0',\n validators: [\n new ApDynformsValidator({validator: Validators.required, errorKey: 'Settings__Msg_Vali_Value_Required'}),\n ]\n }),\n new ApDynformsConfigNumerictextbox({\n key: 'Maximum',\n label: 'Nutrients__Maximum_kg_n_per_ha',\n infoText: 'RapeFertilizationMaximumAdjustmentInfoText',\n value: values['Maximum'],\n value$: max$,\n min: min$,\n max: this._maxAllowed,\n step: 1,\n format: 'n0',\n validators: [\n new ApDynformsValidator({validator: Validators.required, errorKey: 'Settings__Msg_Vali_Value_Required'}),\n ]\n }),\n new ApDynformsConfigNumerictextbox({\n key: 'Constant',\n label: 'Nutrients__Constant_Amount_kg_N_per_ha',\n value: values['Constant'],\n min: min$,\n max: max$,\n step: 1,\n format: 'n0',\n validators: [\n new ApDynformsValidator({validator: Validators.required, errorKey: 'Settings__Msg_Vali_Value_Required'}),\n ]\n })\n ],\n })\n ];\n }\n\n public gridBuilderConfig(): ApDynGridColumnConfigBase[] {\n return [\n new ApDynGridPropertyColumnConfig({\n title: 'Global__Control_Function',\n field: 'ControlFactor',\n hide: true,\n width: 50\n }),\n new ApDynGridGroupColumnConfig({\n title: 'Global__KgNPerHa',\n groupColumns: [\n new ApDynGridPropertyColumnConfig({\n title: 'AgriConnect_View__Reference',\n field: 'Reference',\n width: 50\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__Threshold',\n field: 'Threshold',\n hide: true,\n width: 50\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__RateConst',\n field: 'Constant',\n hide: true,\n width: 50,\n pipes: [{\n pipe: this.roundNumericPipe,\n args: [0]\n }]\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__Min',\n field: 'Minimum',\n width: 50,\n pipes: [{\n pipe: this.roundNumericPipe,\n args: [0]\n }]\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__Max',\n field: 'Maximum',\n width: 50,\n pipes: [{\n pipe: this.roundNumericPipe,\n args: [0]\n }]\n })\n ]\n })\n ];\n }\n\n private _getYieldExpectationOptions(applicationRate: number | undefined): { value: number, text: string }[] {\n const value3Text = this.translationService.translate('Osr_YieldExpectation_Value3');\n const value4Text = this.translationService.translate('Osr_YieldExpectation_Value4');\n const value6Text = this.translationService.translate('Osr_YieldExpectation_Value6');\n if (applicationRate === 2) {\n return [\n {value: 3, text: `${value3Text} (${this.translationService.translate('Osr_YieldExpectation_Value3_2ndRate')})`},\n {value: 4, text: `${value4Text} (${this.translationService.translate('Osr_YieldExpectation_Value4_2ndRate')})`},\n {value: 6, text: `${value6Text} (${this.translationService.translate('Osr_YieldExpectation_Value6_2ndRate')})`}\n ];\n }\n return [\n {value: 3, text: value3Text},\n {value: 4, text: value4Text},\n {value: 6, text: value6Text}\n ];\n }\n}\n","export class CurveCreator {\n static createCurve(avgNUptake: number, value: number, threshold: number, min: number, max: number, factor: number): number[][] {\n if (value === undefined || threshold === undefined || Number.isNaN(threshold) || min === undefined ||\n max === undefined || Number.isNaN(min) || Number.isNaN(max) || factor === undefined) {\n return [[0, 0], [avgNUptake * 2, 0]];\n }\n const result = [];\n factor = (max - min) / 8 * factor;\n const n = value + factor * avgNUptake;\n const thresholdValue = -factor * threshold + n;\n if (thresholdValue > max) {\n result.push([0, min]);\n result.push([min * threshold / max, min]);\n result.push([threshold, max]);\n result.push([(max - n) / -factor, max]);\n } else if (thresholdValue < min) {\n result.push([0, min]);\n result.push([(min - n) / -factor, min]);\n } else {\n if (threshold !== 0) {\n result.push([0, min]);\n result.push([min * threshold / thresholdValue, min]);\n }\n result.push([threshold, thresholdValue]);\n }\n\n const end = -factor * avgNUptake * 2 + n;\n if (end < min) {\n result.push([(min - n) / -factor, min]);\n result.push([avgNUptake * 2, min]);\n } else if (end > max) {\n result.push([(max - n) / -factor, max]);\n result.push([avgNUptake * 2, max]);\n } else {\n result.push([avgNUptake * 2, end]);\n }\n return result;\n }\n\n static createNotes(avgNUptake: number, threshold: number): {\n value: number;\n color: string;\n label: string;\n }[] {\n const result = [\n {\n value: threshold,\n color: 'blue',\n label: 'Global__Threshold'\n }\n ];\n result.push({\n value: avgNUptake,\n color: 'green',\n label: 'AvgNUptakeShort'\n });\n return result;\n }\n}\n","import {ApDynformsConfigFieldset} from '../../../ap-dynforms/config/ap-dynforms-config-fieldset';\nimport {ApDynformsValidator} from '../../../ap-dynforms/ap-dynforms-validator';\nimport {Validators} from '@angular/forms';\nimport {ApDynformsConfigNumerictextbox} from '../../../ap-dynforms/config/ap-dynforms-config-numerictextbox';\nimport {AgriportConstantsService} from '../../../services/common/agriport-constants.service';\nimport {ApDynformsConfigPlaceholder} from '../../../ap-dynforms/config/ap-dynforms-config-placeholder';\nimport {Injectable} from '@angular/core';\nimport {AgriportConstantsEnum} from '../../../ap-interface/enums/ap-agriport-constants.enum';\n\n@Injectable()\nexport class BoniturConfig {\n constructor(private agriportConstantsService: AgriportConstantsService) {\n }\n\n public formBuilder(values: any, isModalField: boolean): ApDynformsConfigFieldset[] {\n return [\n new ApDynformsConfigFieldset({\n key: 'Agronomy',\n legend: 'Global__Agronomy',\n useMaxWidth: isModalField,\n config: [\n new ApDynformsConfigNumerictextbox({\n key: 'ECStage',\n label: 'Global__ECStage',\n value: values['ECStage'],\n decimals: 0,\n format: 'n0',\n step: 1,\n min: +this.agriportConstantsService.GetConstant(AgriportConstantsEnum.EcMin),\n max: +this.agriportConstantsService.GetConstant(AgriportConstantsEnum.EcMax),\n validators: [\n new ApDynformsValidator({validator: Validators.required, errorKey: 'Settings__Msg_Vali_Value_Required'}),\n ]\n }),\n new ApDynformsConfigPlaceholder({})\n ]\n })\n ];\n }\n}\n","export enum ApBaseWizardSteps {\n Selection = 'Selection',\n Details = 'Details',\n Overview = 'Overview'\n}\n","import {Injectable} from '@angular/core';\nimport {\n PlanningEntryComponentDataType\n} from '../../ap-nutrients-management-entry-components/ap-nutrient-planning-configs/nutrient-planning-types';\nimport {\n ApDynComponentComponent\n} from '../../../ap-dyncomponent/ap-dyncomponent.component';\nimport {\n BasePlanningEntryService\n} from '../../ap-nutrients-management-entry-components/ap-nutrient-planning-configs/base-planning-entry-service';\nimport {ObjectFactory} from 'ts-tooling';\nimport {ApGuidUtil} from '../../../ap-utils';\nimport {\n ApElementType\n} from '../../../ap-interface/enums/ap-elements-type.enum';\nimport {\n UnitsStore\n} from '../../../stores/common/units.store';\nimport {LoginStore} from '../../../stores/login/login.store';\nimport {DriverStore} from '../../../stores/docu/driver.store';\nimport {\n MachineStore\n} from '../../../stores/docu/machine.store';\nimport {\n InstrumentStore\n} from '../../../stores/docu/instrument.store';\nimport {\n FertilizerStore\n} from '../../../stores/base-data/fertilizer.store';\nimport {\n CampaignYearStore\n} from '../../../stores/login/campaignyear.store';\nimport {\n ApplicationModesEnum,\n ApplModesStore\n} from '../../../stores/common/appl-modes.store';\nimport {\n OperationModesEnum,\n OperationModesStore\n} from '../../../stores/common/operation-modes.store';\nimport {\n ApDateService\n} from '../../../ap-core/services/ap-date-service';\nimport {\n ApNutrientManagementDateService\n} from '../../../ap-utils/service/ap-nutrient-management-date.service';\nimport {\n INFertilizationPlanFieldToSelectGridItem,\n NPlanningEntryComponentData\n} from '../types/n-fertilization-planning-entry.types';\nimport {\n IPlanningWizardOverviewStatsItem,\n PlanningWizardOverviewModuleStats\n} from '../../../statistics/components/charts/planning-wizard-overview-stats/ap-planning-wizard-overview-stats-types';\nimport {ApStatsType} from '../../../ap-interface';\nimport {\n ApTranslationService\n} from '../../../ap-utils/service/ap-translation.service';\nimport {\n StatisticStore\n} from '../../../stores/statistic/statistic.store';\nimport {\n FertilizationManagementService\n} from '../../../services/data/fertilization-management.service';\nimport {\n NFertilizationCommonEntryService\n} from './n-fertilization-common-entry.service';\nimport {\n StatisticService\n} from '../../../services/data/statistic.service';\nimport {\n IFieldScanDataStatsTableItem\n} from '../../../statistics/components/charts/field-scan-data-table-stats/ap-field-scan-data-table-stats.types';\nimport INFertilizationSummary = Data.TaskManagement.INFertilizationSummary;\nimport IGuid = System.IGuid;\nimport INFertilizationPlanBook = Data.TaskManagement.INFertilizationPlanBook;\nimport IUnit = Data.Common.IUnit;\nimport IApplicationMode = Data.Common.IApplicationMode;\nimport IOperationMode = Data.Common.IOperationMode;\n\n@Injectable()\nexport class NFertilizationPlanningEntryService extends BasePlanningEntryService {\n private _summaryForCreate: INFertilizationSummary | undefined;\n private _planBookCommonData: INFertilizationPlanBook | undefined;\n\n constructor(private unitStore: UnitsStore,\n private loginStore: LoginStore,\n private driverStore: DriverStore,\n private machineStore: MachineStore,\n private statisticStore: StatisticStore,\n private instrumentStore: InstrumentStore,\n private fertilizerStore: FertilizerStore,\n private campaignYearStore: CampaignYearStore,\n private applicationModesStore: ApplModesStore,\n private operationModesStore: OperationModesStore,\n private dateService: ApDateService,\n private statisticService: StatisticService,\n private translationService: ApTranslationService,\n private fertilizationManagementService: FertilizationManagementService,\n private nutrientManagementDateService: ApNutrientManagementDateService,\n private nFertilizationCommonEntryService: NFertilizationCommonEntryService) {\n super();\n }\n\n private createSummaryCalled = false;\n\n public initData(): void {\n super.initData();\n }\n\n public get summary(): INFertilizationSummary | undefined {\n return this._summaryForCreate;\n }\n\n public setSubscriptions(_: ApDynComponentComponent): void {\n throw new Error('Method not implemented.');\n }\n\n public clearData(): void {\n this._summaryForCreate = null;\n this._isSaved = false;\n this._isNewMode = false;\n }\n\n public createSummaryAndApplyValues(application: ApplicationModesEnum, operationMode: OperationModesEnum,\n nPlanBooks: Data.TaskManagement.INFertilizationPlanBook[] | undefined, formValues: {}): void {\n if (this.createSummaryCalled) {\n return;\n }\n if (application) {\n this.createNewSummary(application, operationMode, nPlanBooks);\n this.applySummaryToFormValues(formValues);\n this.createSummaryCalled = true;\n }\n }\n\n protected createNewSummary(application: ApplicationModesEnum, operationMode: OperationModesEnum, nPlanBooks: INFertilizationPlanBook[]): void {\n this._isNewMode = this.componentData.Type === PlanningEntryComponentDataType.Create;\n if (this.componentData.Summary) {\n const planBook = ObjectFactory.Copy(nPlanBooks.find(npb => !npb.BookedAt));\n this._summaryForCreate = this.componentData.Summary;\n this._summaryForCreate.Id = ApGuidUtil.generateNewGuid();\n this._planBookCommonData = planBook;\n this._planBookCommonData.Id = ApGuidUtil.generateNewGuid();\n } else {\n this._isNewMode = true;\n this._shouldDeselectFieldsOnClose = super.getSelectedFields.length > 0;\n const selectedYear = this.campaignYearStore.getSelectedCampaignYear();\n const farmApplDate = this.dateService.getDateNoonToFarmTime(this.nutrientManagementDateService.GetOutputDate()) ?? new Date(Math.min(new Date().valueOf(), new Date(selectedYear.DefaultEnd).valueOf()));\n const operationModeObj = this.operationModesStore.Listen(s => s.data).getValue().Find((o) => o.Key === operationMode);\n const applicationModeObj = this.applicationModesStore.Listen(s => s.data).getValue().Find((o) => o.Key === application);\n this._summaryForCreate = this._generateNSummary(ApGuidUtil.generateNewGuid(), '', this.loginStore.SelectedFarmId,\n applicationModeObj, farmApplDate, operationModeObj, this.unitStore.getUnit('kgN/ha'), null, 0);\n this._planBookCommonData = this._generateCommonPlanBookData(ApGuidUtil.generateNewGuid(), this.loginStore.SelectedFarmId,\n 0, this._summaryForCreate.Unit, applicationModeObj, null, null, null,\n farmApplDate, operationModeObj, ApElementType.N, null, null, null);\n }\n }\n\n // Temporary method until full refactoring of NFert component. FormValues assigning will be deprecated then\n protected applySummaryToFormValues(formValues: {}): void {\n formValues['FertilizationDate'] = new Date(this.summary.ApplicationDate);\n formValues['DeadBioMass'] = this.summary.AdditionalValue?.DeadBiomass;\n formValues['YieldExpectation'] = this.summary.AdditionalValue?.ExpectedYield;\n formValues['Potential'] = this.summary.AdditionalValue?.NMinPotential;\n formValues['Application'] = this.summary.ApplicationMode?.Key;\n formValues['OperationMode'] = this.summary.OperationMode?.Key;\n formValues['ControlFactor'] = this.summary.Slope; // : this._isRape() ? 1 : ,\n formValues['Note'] = this.summary.Title;\n\n // getProductFieldSet\n const product = this.fertilizerStore.getFertilizer(this._planBookCommonData.ProductId);\n if (product) {\n formValues['Group'] = product.IsOrganic ? 1 : 0;\n formValues['Product'] = this._planBookCommonData.ProductId;\n }\n\n // TargetRate\n formValues['ECStage'] = this._planBookCommonData.ECValue;\n\n if (this.summary.ApplicationMode?.Key !== 'Global__RateConst') {\n if (this.summary.OperationMode?.Key !== 'OpMode_TargetRateN') {\n // Normal mode\n formValues['Maximum'] = this.summary.UserApplicationMaximum;\n formValues['Minimum'] = this.summary.UserApplicationMinimum;\n formValues['Amount'] = this.summary.UserApplicationRate;\n formValues['Threshold'] = this.summary.Threshold;\n formValues['Constant'] = this.summary.UserApplicationConstant;\n } else {\n // TargetRateN mode\n formValues['TargetRate'] = this.summary.UserApplicationRate;\n formValues['ControlRange'] = this.summary.UserApplicationMaximum - this.summary.UserApplicationRate;\n formValues['Threshold'] = this.summary.Threshold;\n }\n } else {\n // Global__RateConst mode\n formValues['Constant'] = this.summary.UserApplicationConstant;\n }\n\n formValues['Machine'] = this.machineStore.getMachineById(this._planBookCommonData.ExportMachine);\n formValues['Instrument'] = this.instrumentStore.getInstrumentById(this._planBookCommonData.ExportInstrument);\n formValues['Driver'] = this.driverStore.getDriverById(this._planBookCommonData.ExportDriver);\n }\n\n private _generateNSummary(id: IGuid, title: string, farmId: number, applMode: IApplicationMode, applDate: Date,\n operationMode: IOperationMode, unit: IUnit, planNumber: number | null, ecValue: number): INFertilizationSummary {\n\n return {\n Id: id,\n Title: title,\n FarmId: farmId,\n OperationMode: operationMode,\n PlanNumber: planNumber,\n AdditionalValue: undefined,\n ApplicationDate: applDate,\n ApplicationMode: applMode,\n ECValue: ecValue,\n Unit: unit,\n Slope: 0,\n Threshold: 0,\n UserApplicationConstant: 0,\n UserApplicationMaximum: 0,\n UserApplicationMinimum: 0,\n UserApplicationRate: 0,\n ChangedAt: undefined,\n ChangedBy: 0,\n CreatedAt: undefined,\n CreatedBy: 0,\n DeletedAt: undefined,\n DeletedBy: 0,\n Version: 0\n };\n }\n\n private _generateCommonPlanBookData(id: IGuid, farmId: number, productId: number | null, applUnit: IUnit,\n applMode: IApplicationMode, applConst: number | null, applMin: number | null, applMax: number | null,\n applDate: Date, operationMode: IOperationMode, element: ApElementType, driverId: IGuid | null, machineId: IGuid | null,\n instrumentId: IGuid | null): INFertilizationPlanBook {\n return {\n Id: id,\n FarmId: farmId,\n ProductId: productId,\n Unit: applUnit,\n ApplicationMode: applMode,\n ApplicationConst: applConst,\n ApplicationMin: applMin,\n ApplicationMax: applMax,\n ApplicationDate: applDate,\n OperationMode: operationMode,\n RasterStatistics: [],\n Element: element,\n ExportDriver: driverId,\n ExportMachine: machineId,\n ExportInstrument: instrumentId,\n // Empty properties\n ApplicationRate: 0,\n Area: 0,\n BookedAt: undefined,\n BookedBy: 0,\n ChangedAt: undefined,\n ChangedBy: 0,\n CreatedAt: undefined,\n CreatedBy: 0,\n DeletedAt: undefined,\n DeletedBy: 0,\n ECValue: 0,\n ExportFormat: 0,\n ExportTarget: '',\n ExportedAt: undefined,\n ExportedBy: 0,\n Factor: 0,\n FieldGeomId: undefined,\n FieldId: undefined,\n Geom: undefined,\n MainCropId: 0,\n Note: '',\n PlannedArea: 0,\n RasterId: undefined,\n SecondCropId: 0,\n Slope: 0,\n Status: undefined,\n Summary: undefined,\n TEnd: undefined,\n TStart: undefined,\n Threshold: 0,\n ValidFrom: undefined,\n ValidTo: undefined,\n Version: 0,\n JobInput: '',\n LogFileOperationMode: null\n };\n }\n\n public get componentData(): NPlanningEntryComponentData {\n return this._componentData as NPlanningEntryComponentData;\n }\n\n public generateOverviewStatistic(operationMode: OperationModesEnum, selectedItems: any[], totalItems: any[]): void {\n const emptyTitle = `${this.translationService.translate(operationMode)}\n ${this.translationService.translate('Nutrients__StatisticsTitle')}`;\n const items = !!selectedItems && selectedItems.length > 0 ? selectedItems : totalItems;\n if (!items || items.length <= 0 || items.some(x => x.ColumnLoading)) {\n this.statisticStore.setStatisticData(\n [], ApStatsType.PlanningWizardOverviewStats, '', emptyTitle\n );\n return;\n }\n const nStatItems: IPlanningWizardOverviewStatsItem[] = items.map(item => ({\n Module: PlanningWizardOverviewModuleStats.NFertilization,\n OperationModeKey: item.OperationMode,\n NContent: this.fertilizationManagementService.getFertilizerContentN(item?.ProductId),\n Area: item?.Area,\n Min: this.nFertilizationCommonEntryService.isApplicationMapOrAbsolute(item?.OperationMode) ? item?.Minimum : item?.Constant,\n Max: this.nFertilizationCommonEntryService.isApplicationMapOrAbsolute(item?.OperationMode) ? item?.Maximum : item?.Constant,\n Average: this.nFertilizationCommonEntryService.isApplicationMapOrAbsolute(item?.OperationMode) ? item?.Amount : item?.Constant,\n ProductId: item?.ProductId\n }));\n const title = this._getTitleForStatistic(items, totalItems);\n this.statisticStore.setStatisticData(\n nStatItems, ApStatsType.PlanningWizardOverviewStats, title, emptyTitle\n );\n }\n\n public generateFieldStatistic(items: INFertilizationPlanFieldToSelectGridItem[]): void {\n const emptyTitle = this.translationService.translate('Global__latest_Sensor_reading');\n if (!items || items.length <= 0) {\n this.statisticStore.setStatisticData(\n [], ApStatsType.FieldScanDataTableStats, '', emptyTitle\n );\n return;\n }\n const nStatItems: IFieldScanDataStatsTableItem[] = items.map(item => ({\n FieldName: item?.Name,\n Area: item?.Area,\n FieldNumber: item?.Nr?.toString(),\n FieldSubNumber: item?.TNr?.toString(),\n ScanDate: item?.ScanData?.Created,\n ScanNUptakeAvg: item?.ScanData?.NUptakeAvg,\n ScanNUptakeMin: item?.ScanData?.NUptakeMin,\n ScanNUptakeMax: item?.ScanData?.NUptakeMax\n }));\n const title = this._getTitleForStatistic(items, items);\n this.statisticStore.setStatisticData(\n nStatItems, ApStatsType.FieldScanDataTableStats, title, emptyTitle\n );\n }\n\n private _getTitleForStatistic(selectedItems: any[], allItems: any[]): string {\n const dataForTitles = allItems.map(x => ({\n AreaHa: x.Area,\n Selected: selectedItems.some(z => z.Id === x.Id)\n }));\n return this.statisticService.generateFieldsAreaTitle(dataForTitles);\n }\n}\n","import {Observable} from 'rxjs';\nimport {\n ApDynformsConfigFieldset\n} from '../../../ap-dynforms/config/ap-dynforms-config-fieldset';\nimport {distinctUntilChanged, filter, map} from 'rxjs/operators';\nimport {\n ApDynformsConfigNumerictextbox\n} from '../../../ap-dynforms/config/ap-dynforms-config-numerictextbox';\nimport {ApDynformsValidator} from '../../../ap-dynforms/ap-dynforms-validator';\nimport {Validators} from '@angular/forms';\nimport {\n ApDynformsConfigComboBox\n} from '../../../ap-dynforms/config/ap-dynforms-config-combobox';\nimport {\n ApDynformsConfigPlaceholder\n} from '../../../ap-dynforms/config/ap-dynforms-config-placeholder';\nimport {Injectable} from '@angular/core';\nimport {GetRoundNumericPipe} from '../../../ap-utils';\nimport {\n ApDynGridColumnConfigBase,\n ApDynGridColumnHideConfig\n} from '../../../ap-dyngrids/config/ap-dyn-grid-column-config-base';\nimport {\n ApDynGridPropertyColumnConfig,\n FilterType\n} from '../../../ap-dyngrids/config/ap-dyn-grid-property-column-config';\nimport {\n ApDynGridGroupColumnConfig\n} from '../../../ap-dyngrids/config/ap-dyn-grid-group-column-config';\nimport {NFertilizationCommonEntryService} from '../services/n-fertilization-common-entry.service';\nimport {NApplicationMapConfigBase} from './base/n-application-map-config.base';\nimport {\n NFertilizationPlantProtectionService\n} from '../../../services/data/n-fertilization-plant-protection.service';\nimport {INFertilizationPlanFieldToSelectGridItem} from '../types/n-fertilization-planning-entry.types';\nimport {\n GetGrowthStageData\n} from '../../../types/n-fertilization-plant-protection.types';\nimport {ApTranslationService} from '../../../ap-utils/service/ap-translation.service';\nimport IApplicationSettings = Data.Agronomic.IApplicationSettings;\nimport IApplicationSettingsParameters = Data.Agronomic.IApplicationSettingsParameters;\n\n@Injectable()\nexport class ApplicationMapAbsoluteConfig extends NApplicationMapConfigBase {\n private _minAllowed = 0;\n private _maxAllowed = 260;\n\n constructor(private translateService: ApTranslationService,\n private nFertilizationCommonEntryService: NFertilizationCommonEntryService,\n private nFertilizationPlantProtectionService: NFertilizationPlantProtectionService,\n private roundNumericPipe: GetRoundNumericPipe) {\n super();\n }\n\n public formBuilder(values: any, formValues$: Observable, areaWeightedAverage: number, cropKey: number | undefined,\n applicationSettings: IApplicationSettings, isModalField: boolean, diagramTemplateRef?: any): ApDynformsConfigFieldset[] {\n const parameters = applicationSettings.Parameter;\n const min$ = formValues$.pipe(\n filter(x => x['Minimum'] != null && x['Minimum'] >= 0),\n map((v) => v['Minimum']),\n distinctUntilChanged()\n );\n const max$ = formValues$.pipe(\n filter(x => x['Maximum'] != null && x['Maximum'] >= 0),\n map((v) => v['Maximum']),\n distinctUntilChanged()\n );\n const targetRate = this.translateService.translate('Calculated_Target_Rate');\n const unitRate = this.translateService.translate('Unit_Rate');\n const weightedAverageTextInfoTranslationKey = parameters?.deadBioMass != null\n ? 'Information_Calculated_Target_Rate'\n : 'Information_Calculated_Target_Rate_Without_DeadBioMass';\n return [\n new ApDynformsConfigFieldset({\n key: 'Agronomy',\n legend: 'Global__Agronomy',\n before: diagramTemplateRef,\n useMaxWidth: isModalField,\n config: [\n new ApDynformsConfigNumerictextbox({\n key: 'ECStage',\n label: 'Global__ECStage',\n value: values['ECStage'],\n min: applicationSettings.EcMin,\n max: applicationSettings.EcMax,\n decimals: 0,\n format: 'n0',\n step: 1,\n validators: [\n new ApDynformsValidator({validator: Validators.required, errorKey: 'Settings__Msg_Vali_Value_Required'}),\n ]\n }),\n parameters?.deadBioMass != null\n ? new ApDynformsConfigComboBox({\n key: 'DeadBioMass',\n label: 'Global__ExtinctBiomass',\n value: values['DeadBioMass'],\n options: [\n {value: 0, text: '0%'},\n {value: 10, text: '10%'},\n {value: 20, text: '20%'},\n {value: 30, text: '30%'},\n {value: 40, text: '40%'},\n {value: 50, text: '50%'},\n {value: 60, text: '60%'}\n ],\n textField: 'text',\n valueField: 'value',\n validators: [\n new ApDynformsValidator({validator: Validators.required, errorKey: 'Settings__Msg_Vali_Value_Required'}),\n ]\n })\n : new ApDynformsConfigPlaceholder(),\n new ApDynformsConfigNumerictextbox({\n key: 'Threshold',\n label: 'Global__Threshold_kg_NUptake_per_ha',\n value: values['Threshold'],\n value$: formValues$.pipe(\n filter(formValues => formValues['ECStage'] != null),\n distinctUntilChanged((prev, curr) => prev['ECStage'] === curr['ECStage']),\n map(formValues => this.nFertilizationCommonEntryService.getThreshold(formValues['ECStage'], cropKey))\n ),\n min: 0,\n max: 100,\n format: 'n0',\n step: 1,\n validators: [\n new ApDynformsValidator({validator: Validators.required, errorKey: 'Settings__Msg_Vali_Value_Required'}),\n ]\n }),\n this.generateSlopeControls(parameters, values)\n ]\n }),\n new ApDynformsConfigFieldset({\n legend: 'Nutrients_Pages_Popups__Amount',\n key: 'Amount',\n useMaxWidth: isModalField,\n config: [\n new ApDynformsConfigNumerictextbox({\n key: 'Amount',\n label: 'N__SetPoint_kg_N_per_ha',\n infoText: 'Infotext_nominal_n_uptake',\n value: values['Amount'],\n min: this._minAllowed,\n max: this._maxAllowed,\n step: 1,\n format: 'n0',\n validators: [\n new ApDynformsValidator({validator: Validators.required, errorKey: ''}),\n ]\n }),\n new ApDynformsConfigNumerictextbox({\n key: 'AreaWeightedAverage',\n label: `${targetRate} ${unitRate}`,\n value: areaWeightedAverage,\n value$: formValues$.pipe(\n map(formValues => this._targetRateFormula(formValues['Amount'], formValues['ControlFactor'],\n formValues['DeadBioMass'], areaWeightedAverage, parameters))\n ),\n infoText: weightedAverageTextInfoTranslationKey,\n format: 'n0',\n disabled: true,\n validators: [\n new ApDynformsValidator({validator: Validators.required, errorKey: ''})\n ]\n }),\n new ApDynformsConfigNumerictextbox({\n key: 'Constant',\n label: 'Nutrients__Constant_Amount_kg_N_per_ha',\n value: values['Constant'],\n min: min$,\n max: max$,\n step: 1,\n format: 'n0',\n validators: [\n new ApDynformsValidator({validator: Validators.required, errorKey: ''}),\n ]\n }),\n new ApDynformsConfigPlaceholder(),\n new ApDynformsConfigNumerictextbox({\n key: 'Minimum',\n label: 'Nutrients__Minimum_kg_n_per_ha',\n value: values['Minimum'],\n value$: min$,\n min: this._minAllowed,\n max: max$,\n step: 1,\n format: 'n0',\n validators: [\n new ApDynformsValidator({validator: Validators.required, errorKey: ''}),\n ]\n }),\n new ApDynformsConfigNumerictextbox({\n key: 'Maximum',\n label: 'Nutrients__Maximum_kg_n_per_ha',\n value: values['Maximum'],\n value$: max$,\n min: min$,\n max: this._maxAllowed,\n step: 1,\n format: 'n0',\n validators: [\n new ApDynformsValidator({validator: Validators.required, errorKey: ''}),\n ]\n })\n ]\n })\n ];\n }\n\n public gridBuilderConfig(modeMode$: Observable, appSettingsParameters: IApplicationSettingsParameters = null): ApDynGridColumnConfigBase[] {\n const applicationGroupColumns = [];\n applicationGroupColumns.push(\n new ApDynGridPropertyColumnConfig({\n title: 'Global__Average_Amount',\n field: 'Amount',\n width: 50,\n columnLoading: 'ColumnLoading',\n filterType: FilterType.NUMBER,\n cssClass: 'right',\n filterable: true,\n tooltip: (dataItem) => dataItem['ErrorMessage'],\n pipes: [{\n pipe: this.roundNumericPipe,\n args: [0]\n }]\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__Threshold',\n field: 'Threshold',\n width: 50,\n columnLoading: 'ColumnLoading',\n filterType: FilterType.NUMBER,\n cssClass: 'right',\n filterable: true,\n tooltip: (dataItem) => dataItem['ErrorMessage']\n })\n );\n\n if (appSettingsParameters == null || (appSettingsParameters.slopeShown && appSettingsParameters.slopeType === 'numeric')) {\n applicationGroupColumns.push(\n new ApDynGridPropertyColumnConfig({\n title: 'N__RateSlope',\n field: 'ControlFactor',\n width: 50,\n columnLoading: 'ColumnLoading',\n filterType: FilterType.NUMBER,\n cssClass: 'right',\n filterable: true,\n tooltip: (dataItem) => dataItem['ErrorMessage']\n }),\n );\n } else if (appSettingsParameters.slopeShown && appSettingsParameters.slopeType === 'dropDown') {\n applicationGroupColumns.push(\n new ApDynGridPropertyColumnConfig({\n title: 'N__RateSlope',\n field: 'ControlFactorDescription',\n width: 50,\n columnLoading: 'ColumnLoading',\n filterable: true,\n tooltip: (dataItem) => dataItem['ErrorMessage']\n })\n );\n }\n\n applicationGroupColumns.push(\n new ApDynGridPropertyColumnConfig({\n title: 'Global__RateConst',\n field: 'Constant',\n hide: true,\n width: 50,\n columnLoading: 'ColumnLoading',\n filterType: FilterType.NUMBER,\n cssClass: 'right',\n filterable: true,\n tooltip: (dataItem) => dataItem['ErrorMessage'],\n pipes: [{\n pipe: this.roundNumericPipe,\n args: [0]\n }]\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__Min',\n field: 'Minimum',\n hide: true,\n width: 50,\n columnLoading: 'ColumnLoading',\n filterType: FilterType.NUMBER,\n cssClass: 'right',\n filterable: true,\n tooltip: (dataItem) => dataItem['ErrorMessage'],\n pipes: [{\n pipe: this.roundNumericPipe,\n args: [0]\n }]\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__Max',\n field: 'Maximum',\n hide: true,\n width: 50,\n columnLoading: 'ColumnLoading',\n filterType: FilterType.NUMBER,\n cssClass: 'right',\n filterable: true,\n tooltip: (dataItem) => dataItem['ErrorMessage'],\n pipes: [{\n pipe: this.roundNumericPipe,\n args: [0]\n }]\n })\n );\n\n const applicationHalfViewGroupColumns = [];\n applicationHalfViewGroupColumns.push(\n new ApDynGridPropertyColumnConfig({\n title: 'Global__Threshold',\n field: 'Threshold',\n width: 50,\n hide: new ApDynGridColumnHideConfig({\n selfHide: modeMode$\n }),\n columnLoading: 'ColumnLoading',\n filterType: FilterType.NUMBER,\n cssClass: 'right',\n filterable: true,\n tooltip: (dataItem) => dataItem['ErrorMessage']\n }),\n );\n if (appSettingsParameters == null || (appSettingsParameters.slopeShown && appSettingsParameters.slopeType === 'numeric')) {\n applicationHalfViewGroupColumns.push(\n new ApDynGridPropertyColumnConfig({\n title: 'N__RateSlope',\n field: 'ControlFactor',\n width: 50,\n columnLoading: 'ColumnLoading',\n hide: new ApDynGridColumnHideConfig({\n selfHide: modeMode$\n }),\n filterType: FilterType.NUMBER,\n cssClass: 'right',\n filterable: true,\n tooltip: (dataItem) => dataItem['ErrorMessage']\n })\n );\n } else if (appSettingsParameters.slopeShown && appSettingsParameters.slopeType === 'dropDown') {\n applicationHalfViewGroupColumns.push(\n new ApDynGridPropertyColumnConfig({\n title: 'N__RateSlope',\n field: 'ControlFactorDescription',\n hide: new ApDynGridColumnHideConfig({\n selfHide: modeMode$\n }),\n width: 50,\n columnLoading: 'ColumnLoading',\n filterable: true,\n tooltip: (dataItem) => dataItem['ErrorMessage']\n })\n );\n }\n const configNameTranslation = this.translateService.translate('Global__AppFile');\n const unitTranslation = this.translateService.translate('Nutrients__kg_N_per_ha');\n return [\n new ApDynGridPropertyColumnConfig({\n title: 'AvgNUptakeShort',\n field: 'AvgNUptake',\n headerExtraLines: [\n 'Nutrients__kg_N_per_ha'\n ],\n width: 80,\n hide: true,\n filterType: FilterType.NUMBER,\n cssClass: 'right',\n filterable: true,\n pipes: [{\n pipe: this.roundNumericPipe,\n args: [0]\n }]\n }),\n new ApDynGridGroupColumnConfig({\n title: `${configNameTranslation} ${unitTranslation}`,\n hide: true,\n groupColumns: applicationGroupColumns\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__Average_Amount',\n field: 'Amount',\n width: 50,\n hide: new ApDynGridColumnHideConfig({\n selfHide: modeMode$\n }),\n columnLoading: 'ColumnLoading',\n filterType: FilterType.NUMBER,\n cssClass: 'right',\n filterable: true,\n tooltip: (dataItem) => dataItem['ErrorMessage'],\n pipes: [{\n pipe: this.roundNumericPipe,\n args: [0]\n }]\n }),\n new ApDynGridGroupColumnConfig({\n groupColumns: applicationHalfViewGroupColumns\n })\n ];\n }\n\n public updateFormValuesByParameters(values: any, selectedItems: INFertilizationPlanFieldToSelectGridItem[],\n cropKey: number | undefined, applicationSettings: IApplicationSettings | undefined): void {\n const parameters = applicationSettings.Parameter;\n const scansByApplicationSettings = this.nFertilizationPlantProtectionService.getValidBestScansByApplicationSettings(\n selectedItems.map(x => x.ScanData), applicationSettings);\n const growthStages = this.nFertilizationPlantProtectionService.getGrowStages(\n scansByApplicationSettings.map(x => ({ScanData: x} as GetGrowthStageData))\n );\n const growthStageMax = growthStages.Max();\n const growthStageMin = growthStages.Min();\n if (!Number.isFinite(values['Threshold'])) {\n values['Threshold'] = this.nFertilizationCommonEntryService.getThreshold(growthStageMin, cropKey);\n }\n if (!Number.isFinite(values['ECStage']) || values['ECStage'] !== growthStageMax) {\n values['ECStage'] = growthStageMax;\n }\n if (!Number.isFinite(values['DeadBioMass']) && Number.isFinite(parameters?.deadBioMass)) {\n values['DeadBioMass'] = parameters.deadBioMass;\n } else {\n values['DeadBioMass'] = 0;\n }\n if (!Number.isFinite(values['Amount'])) {\n values['Amount'] = parameters?.recommendation ?? parameters?.targetValue;\n }\n if (!Number.isFinite(values['Constant'])) {\n values['Constant'] = parameters?.uniform;\n }\n if (!Number.isFinite(values['Minimum'])) {\n values['Minimum'] = parameters?.min ?? this._minAllowed;\n }\n if (!Number.isFinite(values['Maximum'])) {\n values['Maximum'] = parameters?.max ?? this._maxAllowed;\n }\n if (!Number.isFinite(values['ControlFactor'])) {\n values['ControlFactor'] = parameters?.slope?.FirstOrDefault()?.Slope ?? 1;\n }\n }\n\n private _targetRateFormula(amount: number | undefined, controlFactor: number | undefined, deadBioMass: number | undefined,\n areaWeightedAverage: number, parameters: IApplicationSettingsParameters): number {\n if (!amount) {\n return 0;\n }\n let calculationResult = amount;\n if (deadBioMass > 0) {\n const deadBioMassDefining = deadBioMass ?? parameters.deadBioMass;\n const deadBioMassResult = Number.isFinite(deadBioMassDefining) ? deadBioMass / 2 : 1;\n calculationResult = calculationResult + deadBioMassResult;\n }\n const controlFactorDefining = controlFactor ?? parameters.slope?.FirstOrDefault()?.Slope;\n const controlFactorResult = Number.isFinite(controlFactorDefining) ? controlFactorDefining : 1;\n calculationResult = calculationResult - (areaWeightedAverage * controlFactorResult);\n return calculationResult > 0 ? calculationResult : 0;\n }\n}\n","import {Injectable} from '@angular/core';\nimport {ApDynformsConfigFieldset} from '../../../ap-dynforms/config/ap-dynforms-config-fieldset';\nimport {ApDynformsConfigNumerictextbox} from '../../../ap-dynforms/config/ap-dynforms-config-numerictextbox';\nimport {ApDynformsValidator} from '../../../ap-dynforms/ap-dynforms-validator';\nimport {Validators} from '@angular/forms';\nimport {AgriportConstantsEnum} from '../../../ap-interface/enums/ap-agriport-constants.enum';\nimport {AgriportConstantsService} from '../../../services/common/agriport-constants.service';\nimport {ApDynGridColumnConfigBase} from '../../../ap-dyngrids/config/ap-dyn-grid-column-config-base';\nimport {\n ApDynGridPropertyColumnConfig,\n FilterType\n} from '../../../ap-dyngrids/config/ap-dyn-grid-property-column-config';\nimport {GetRoundNumericPipe} from '../../../ap-utils';\nimport {Observable} from 'rxjs';\nimport {ApDynformsConfigPlaceholder} from '../../../ap-dynforms/config/ap-dynforms-config-placeholder';\nimport {map} from 'rxjs/operators';\nimport {SettingsStore} from '../../../stores/base-data/settings.store';\nimport {ApNutrientService} from '../../../ap-utils/service/ap-nutrient.service';\nimport {ApElementType} from '../../../ap-interface/enums/ap-elements-type.enum';\nimport {FertilizerStore} from '../../../stores/base-data/fertilizer.store';\nimport {ApTranslationService} from '../../../ap-utils/service/ap-translation.service';\n\n@Injectable()\nexport class UniformConfig {\n constructor(private settingsStore: SettingsStore,\n private fertilizerStore: FertilizerStore,\n private nutrientService: ApNutrientService,\n private translationService: ApTranslationService,\n private agriportConstantsService: AgriportConstantsService,\n private roundNumericPipe: GetRoundNumericPipe) {\n }\n\n /**\n * Builds the form configuration for the uniform application mode\n * Creates a fieldset with EC stage, constant amount, and product amount fields\n * @param formValues Current form values\n * @param formValues$ Observable of form values\n * @param isModalField Indicates if the form is for a modal dialog\n * @returns Configured fieldset for uniform application\n * @public\n */\n public formBuilder(formValues: any, formValues$: Observable, isModalField: boolean): ApDynformsConfigFieldset {\n return new ApDynformsConfigFieldset({\n legend: 'Nutrients_Pages_Popups__Amount',\n key: 'Amount',\n useMaxWidth: isModalField,\n config: [\n new ApDynformsConfigNumerictextbox({\n key: 'ECStage',\n label: 'Global__ECStage',\n value: formValues['ECStage'],\n decimals: 0,\n format: 'n0',\n step: 1,\n min: 0,\n max: +this.agriportConstantsService.GetConstant(AgriportConstantsEnum.EcMax),\n validators: [\n new ApDynformsValidator({validator: Validators.required, errorKey: 'Settings__Msg_Vali_Value_Required'}),\n ]\n }),\n new ApDynformsConfigPlaceholder(),\n new ApDynformsConfigNumerictextbox({\n key: 'Constant',\n label: 'Nutrients__Constant_Amount_kg_N_per_ha',\n infoText: 'Info_Uniform_NF',\n value: formValues['Constant'],\n decimals: 0,\n format: 'n0',\n step: 1,\n min: 1,\n max: 250,\n validators: [\n new ApDynformsValidator({validator: Validators.required, errorKey: 'Settings__Msg_Vali_Value_Required'}),\n ]\n }),\n new ApDynformsConfigNumerictextbox({\n key: 'ProductAmount',\n label: 'Global__Product',\n label$: formValues$.pipe(map(values => this.productAmountLable(values['Product']))),\n value: this.productAmountCalculation(formValues['Constant'], formValues['Product']),\n value$: formValues$.pipe(map(values => this.productAmountCalculation(values['Constant'], values['Product']))),\n format: 'n0',\n step: 1,\n decimals: this.settingsStore.FirstSetting.DigitsAfterDecimalPoint,\n disabled: true,\n validators: [\n new ApDynformsValidator({validator: Validators.required, errorKey: 'Settings__Msg_Vali_Value_Required'}),\n ]\n })\n ]\n });\n }\n\n /**\n * Generates grid column configuration for the uniform application mode\n * Creates a column for the constant rate with specific formatting\n * @returns Array of grid column configurations\n * @public\n */\n public gridBuilderConfig(): ApDynGridColumnConfigBase[] {\n return [\n new ApDynGridPropertyColumnConfig({\n title: 'Global__RateConst',\n field: 'Constant',\n columnLoading: 'ColumnLoading',\n width: 90,\n cssClass: 'right',\n filterType: FilterType.NUMBER,\n pipes: [{\n pipe: this.roundNumericPipe,\n args: [0]\n }]\n }),\n ];\n }\n\n /**\n * Generates a product amount label based on the selected product's unit\n * Combines the main product label with its unit of measurement\n * @param productId ID of the selected product\n * @returns Formatted product label with unit\n * @private\n */\n private productAmountLable(productId: number | undefined): string {\n const fertilizer = this.fertilizerStore.getFertilizer(productId);\n const unitKey = fertilizer?.Unit?.Key ?? fertilizer?.Unit?.BaseUnit?.Key;\n if (!unitKey) {\n return 'Global__Product';\n }\n const perHa = this.translationService.translate('Global__Unit_ha');\n const mainTitle = this.translationService.translate('Global__Product');\n return `${mainTitle} [${this.translationService.translate(unitKey)}/${perHa}]`;\n }\n\n /**\n * Calculates the product amount based on the constant value and selected product\n * Converts the nitrogen (N) nutrient amount to product quantity\n * @param constantValue Constant application rate\n * @param productId ID of the selected product\n * @returns Calculated product amount\n * @private\n */\n private productAmountCalculation(constantValue: number | undefined,\n productId: number | undefined): number {\n if (!Number.isFinite(constantValue) || !Number.isFinite(productId)) {\n return 0;\n }\n return this.nutrientService.convertNutrientToGoods(productId, ApElementType.N, constantValue);\n }\n}\n","import {Injectable} from '@angular/core';\nimport {ApDynformsConfigFieldset} from '../../../ap-dynforms/config/ap-dynforms-config-fieldset';\nimport {ApDynformsConfigComboBox} from '../../../ap-dynforms/config/ap-dynforms-config-combobox';\nimport {delay, filter, map} from 'rxjs/operators';\nimport {DriverStore} from '../../../stores/docu/driver.store';\nimport {MachineStore} from '../../../stores/docu/machine.store';\nimport {InstrumentStore} from '../../../stores/docu/instrument.store';\nimport {ApDynformsValidator} from '../../../ap-dynforms/ap-dynforms-validator';\nimport {Validators} from '@angular/forms';\nimport {BehaviorSubject, combineLatest, Observable} from 'rxjs';\nimport {TranslationStore} from '../../../stores/translation/translation.store';\nimport {FertilizerStore} from '../../../stores/base-data/fertilizer.store';\nimport {FertilizerInorganicStore} from '../../../stores/base-data/fertilizer.inorganic.store';\nimport {FertilizerOrganicStore} from '../../../stores/base-data/fertilizer.organic.store';\nimport {CombinedFertilizer} from '../../../types/common-types';\nimport IDriver = Data.DocuContext.Driver.IDriver;\nimport IMachine = Data.DocuContext.Machine.IMachine;\nimport IInstrument = Data.DocuContext.Instrument.IInstrument;\n\n@Injectable({\n providedIn: 'root'\n})\nexport class GeneralConfig {\n constructor(private driverStore: DriverStore,\n private fertilizerInorganicStore: FertilizerInorganicStore,\n private fertilizerOrganicStore: FertilizerOrganicStore,\n private fertilizerStore: FertilizerStore,\n private instrumentStore: InstrumentStore,\n private machineStore: MachineStore,\n private translationStore: TranslationStore) {\n }\n\n public getDocuFieldSet(formValues: { Driver?: IDriver, Machine?: IMachine, Instrument?: IInstrument },\n formValues$: Observable, currentFormValues: () => any, isModalField: boolean): ApDynformsConfigFieldset {\n return new ApDynformsConfigFieldset({\n key: 'Docu',\n legend: 'Global__Documentation',\n useMaxWidth: isModalField,\n config: [\n new ApDynformsConfigComboBox({\n key: 'Machine',\n label: 'Settings__Lbl_Menu_Devices',\n textField: 'NameWithSign',\n valueField: 'Id',\n valuePrimitive: false,\n value: formValues.Machine ?? null,\n options: this.machineStore.Listen(s => s.data),\n sort: 1\n }),\n new ApDynformsConfigComboBox({\n key: 'Instrument',\n label: 'Docu_Ini__Tool',\n textField: 'Name',\n valueField: 'Id',\n valuePrimitive: false,\n value: formValues.Instrument ?? null,\n value$: formValues$.pipe(\n filter(values => values['Machine'] || values['Instrument']),\n map(values => {\n if (values['Instrument']) {\n return values['Instrument'];\n }\n if (currentFormValues['Instrument']) {\n return currentFormValues['Instrument'];\n }\n if (values['Machine'].DefaultInstrument) {\n return values['Machine'].DefaultInstrument;\n }\n return null;\n })\n ),\n options: this.instrumentStore.Listen(s => s.data),\n sort: 1\n }),\n new ApDynformsConfigComboBox({\n key: 'Driver',\n label: 'Docu_Ini__Motorist',\n textField: 'ShortFullName',\n valueField: 'Id',\n valuePrimitive: false,\n value: formValues.Driver ?? null,\n value$: formValues$.pipe(\n filter(values => values['Machine'] || values['Driver']),\n map(values => {\n if (values['Driver']) {\n return values['Driver'];\n }\n if (currentFormValues['Driver']) {\n return currentFormValues['Driver'];\n }\n if (values['Machine'].DefaultDriver) {\n return values['Machine'].DefaultDriver;\n }\n return null;\n })\n ),\n options: this.driverStore.Listen(s => s.data),\n sort: 1\n })\n ]\n });\n }\n\n public getProductFieldSet(formValues: { Group?: number, Product?: number },\n formValues$: BehaviorSubject): ApDynformsConfigFieldset {\n const fertilizerOptions = combineLatest([\n formValues$,\n this.fertilizerStore.OrganicFertilizer$,\n this.fertilizerStore.InorganicFertilizer$\n ]).pipe(map(([values, organic, inorganic]) => {\n let fert: CombinedFertilizer[] = [];\n switch (values['Group']) {\n case -1:\n return [{\n Id: 0,\n Shortname: this.translationStore.FindTranslationForSelectedLanguage('Nutrients_Pages__PureNutrient')\n }];\n case 0:\n fert = inorganic.filter((i) => i.ContentN > 0);\n break;\n case 1:\n fert = organic.filter((o) => o.ContentN > 0);\n break;\n }\n return fert.sort((first, second) => {\n if (first.Prodname == null) {\n return 1;\n }\n if (second.Prodname == null) {\n return -1;\n }\n return first.Prodname.localeCompare(second.Prodname);\n });\n }));\n return new ApDynformsConfigFieldset({\n key: 'Product',\n legend: 'Global__Product',\n config: [\n new ApDynformsConfigComboBox({\n key: 'Group',\n label: 'Global__Lbl_Group',\n options: [\n // {key: -1, text: 'Croptype_Not_Specified'},\n {key: 0, text: 'Nutrients_Pages_Popups__Inorganic'},\n {key: 1, text: 'Nutrients_Pages_Popups__Organic'},\n ],\n textField: 'text',\n valueField: 'key',\n translate: true,\n valuePrimitive: true,\n value: formValues.Group ?? this._getDefaultGroup(),\n validators: [\n new ApDynformsValidator({validator: Validators.required, errorKey: 'Settings__Msg_Vali_Value_Required'}),\n ]\n }),\n new ApDynformsConfigComboBox({\n key: 'Product',\n label: 'Global__Product',\n valueField: 'Id',\n textField: 'Prodname',\n valuePrimitive: true,\n value: null,\n options: fertilizerOptions,\n value$: combineLatest([\n formValues$,\n this.fertilizerStore.OrganicFertilizer$,\n this.fertilizerStore.InorganicFertilizer$,\n fertilizerOptions\n ]).pipe(\n filter(([values]) => {\n return values['Group'] === formValues.Group || values['Group'] === -1;\n }),\n map(([values]) => {\n return values['Group'] === -1 ? 0 : this._selectableProduct(formValues['Product']);\n }),\n delay(1),\n ),\n validators: [\n new ApDynformsValidator({validator: Validators.required, errorKey: 'Settings__Msg_Vali_Value_Required'}),\n ]\n })\n ]\n });\n }\n\n private _getDefaultGroup(): number {\n if (this.fertilizerInorganicStore.Listen(s => s.data).getValue().filter((i) => i.Selectable && i.ContentN > 0).length === 0 &&\n this.fertilizerOrganicStore.Listen(s => s.data).getValue().filter((o) => o.Selectable && o.ContentN > 0).length !== 0) {\n return 1;\n }\n return 0;\n }\n\n private _selectableProduct(productId: number): number {\n const fertilizer = this.fertilizerStore.getFertilizer(productId);\n if (!fertilizer) {\n return null;\n }\n if (fertilizer.Selectable === true) {\n return productId;\n }\n return null;\n }\n}\n","import {\n AfterContentInit,\n ChangeDetectionStrategy,\n Component,\n EventEmitter,\n OnDestroy,\n OnInit,\n TemplateRef,\n ViewChild\n} from '@angular/core';\nimport {BehaviorSubject, combineLatest, Observable, of, Subscription} from 'rxjs';\nimport {\n ApDynformsConfigFieldset\n} from '../../ap-dynforms/config/ap-dynforms-config-fieldset';\nimport {\n ApDynGridColumnConfigBase,\n ApDynGridColumnHideConfig\n} from '../../ap-dyngrids/config/ap-dyn-grid-column-config-base';\nimport {\n ApDynGridPagerWizardBreadcrumbsStepper,\n ApDynGridPagerWizardButton,\n ApDynGridPagerWizardConfig\n} from '../../ap-dyngrids/config/ap-dyn-grid-pager-wizard-config';\nimport {\n ApDynComponentComponent\n} from '../../ap-dyncomponent/ap-dyncomponent.component';\nimport {\n debounceTime,\n delay,\n distinctUntilChanged,\n filter,\n map,\n tap\n} from 'rxjs/operators';\nimport {\n ApDynformsConfigTextbox\n} from '../../ap-dynforms/config/ap-dynforms-config-textbox';\nimport {\n ApDynformsConfigComboBox\n} from '../../ap-dynforms/config/ap-dynforms-config-combobox';\nimport {\n ApDynformsConfigDatepicker\n} from '../../ap-dynforms/config/ap-dynforms-config-datepicker';\nimport {\n ApDynGridStatusColumnConfig\n} from '../../ap-dyngrids/config/ap-dyn-grid-status-column-config';\nimport {\n ApDynGridPropertyColumnConfig,\n FilterType\n} from '../../ap-dyngrids/config/ap-dyn-grid-property-column-config';\nimport {\n MapViewMode\n} from '../../ap-interface';\nimport {\n ApDynGridGroupColumnConfig\n} from '../../ap-dyngrids/config/ap-dyn-grid-group-column-config';\nimport {\n FieldStore\n} from '../../stores/farm/field.store';\nimport {\n MapViewStore\n} from '../../stores/layout/mapview.store';\nimport {\n LanguageStore\n} from '../../stores/translation/language.store';\nimport {\n CropRotationStore\n} from '../../stores/farm/crop.rotation.store';\nimport {\n CampaignYearStore\n} from '../../stores/login/campaignyear.store';\nimport {\n CropTypeStore\n} from '../../stores/base-data/crop.types.store';\nimport {\n ApDynGridEditColumnConfig\n} from '../../ap-dyngrids/config/ap-dyn-grid-edit-column-config';\nimport {\n FormStore\n} from '../../stores/layout/form.store';\nimport {\n ApGuidUtil,\n GetRoundNumericPipe\n} from '../../ap-utils';\nimport {\n SettingsStore\n} from '../../stores/base-data/settings.store';\nimport {\n GetRoundNumericService\n} from '../../ap-utils/service/get-round-numeric.service';\nimport {\n Validators\n} from '@angular/forms';\nimport {\n ApDynformsValidator\n} from '../../ap-dynforms/ap-dynforms-validator';\nimport {\n ApplicationMapConfig\n} from './ap-n-fertilization-planning-configs/application-map.config';\nimport {\n TargetRateConfig\n} from './ap-n-fertilization-planning-configs/target-rate.config';\nimport {\n NFertilizationConfig\n} from './ap-n-fertilization-planning-configs/n-fertilization.config';\nimport {\n RapeFertilizationConfig\n} from './ap-n-fertilization-planning-configs/rape-fertilization.config';\nimport {\n ApDynformsConfigTextarea\n} from '../../ap-dynforms/config/ap-dynforms-config-textarea';\nimport {\n CurveCreator\n} from './helpers/curve-creator';\nimport {\n ObjectFactory\n} from 'ts-tooling';\nimport {\n TranslationStore\n} from '../../stores/translation/translation.store';\nimport {\n NFertilizationStore\n} from '../../stores/n-fertilization/n-fertilization.store';\nimport {\n ApGetCropService\n} from '../../stores/services/ap-get-crop.service';\nimport {\n LoginStore\n} from '../../stores/login/login.store';\nimport {\n BoniturConfig\n} from './ap-n-fertilization-planning-configs/bonitur.config';\nimport {\n ModalDialogStore\n} from '../../stores/dialog/modal.dialog.store';\nimport {\n IModalDialogData,\n ModalDialogButtonDisable\n} from '../../ap-interface/interfaces/ap-modaldialog-data.interface';\nimport {\n OperationModesEnum,\n OperationModesStore\n} from '../../stores/common/operation-modes.store';\nimport {\n ApplicationModesEnum,\n ApplModesStore\n} from '../../stores/common/appl-modes.store';\nimport {\n GeneralConfig\n} from './ap-n-fertilization-planning-configs/general.config';\nimport {\n ApDateService\n} from '../../ap-core/services/ap-date-service';\nimport {\n UnitsStore\n} from '../../stores/common/units.store';\nimport {\n NotifyStore\n} from '../../stores/dialog/notify.store';\nimport {\n MapStore\n} from '../../stores/map/map.store';\nimport {\n RouterStore\n} from '../../stores/router/router.store';\nimport {\n IGridStatus\n} from '../../ap-interface/interfaces/ap-grid-status.interface';\nimport {\n StatisticStore\n} from '../../stores/statistic/statistic.store';\nimport {\n NFertilizationService\n} from '../../services/data/n-fertilization.service';\nimport {\n INFertilizationPlanFieldToSelectGridItem,\n INFertilizationPlanningPlanBookData,\n NPlanningEntryComponentData\n} from './types/n-fertilization-planning-entry.types';\nimport {\n ApBaseWizardSteps\n} from '../../ap-utils/enums/ap-base-wizard-steps';\nimport {\n BasicFertilisationSummariesStore\n} from '../../stores/taskmanagement/basic.fertilisation.summaries.store';\nimport {\n SensorStore\n} from '../../stores/sensor/sensor.store';\nimport {\n MapFactoryStyler\n} from '../../map-factory/style';\nimport {\n NFertilizationPlanningEntryService\n} from './services/n-fertilization-planning-entry.service';\nimport {\n ApElementType\n} from '../../ap-interface/enums/ap-elements-type.enum';\nimport {\n ApplicationMapAbsoluteConfig\n} from './ap-n-fertilization-planning-configs/application-map-absolute.config';\nimport {\n ApplicationSettingsStore\n} from '../../stores/agronomic/application-settings-store.service';\nimport {\n NFertilizationCommonEntryService\n} from './services/n-fertilization-common-entry.service';\nimport {\n nameOf\n} from '../../ap-core/utils/ap-name-of';\nimport {\n IOperationModeAppSetting\n} from '../../types/application-settings.types';\nimport {\n ScanService\n} from '../../services/data/scan.service';\nimport {\n BestScanData,\n BestScanType\n} from '../../types/scan.types';\nimport {NFertilizationPlantProtectionService} from '../../services/data/n-fertilization-plant-protection.service';\nimport {ApNFertilizationCommonService} from '../../n-fertilization/services/ap-n-fertilization.common.service';\nimport {ApplicationSettingsService} from '../../services/data/application-settings.service';\nimport {\n GetRoundNumericPipeConfig\n} from '../../ap-utils/pipes/configs/get-round-numeric.pipe.config';\nimport {\n UniformConfig\n} from './ap-n-fertilization-planning-configs/uniform.config';\nimport INFertilizationPlanBook = Data.TaskManagement.INFertilizationPlanBook;\nimport INFertilizationSummary = Data.TaskManagement.INFertilizationSummary;\nimport ICropTypes = Data.BaseData.ICropTypes;\nimport ApValidationLevel = Data.Api.Validation.ApValidationLevel;\nimport ISensorFieldData = Data.Sensor.ISensorFieldData;\nimport IGuid = System.IGuid;\nimport INPlanningData = Data.NFertilization.INPlanningData;\nimport ScanType = Data.NDI.Enums.ScanType;\n\n@Component({\n selector: 'ap-n-fertilization-planning',\n template: `\n \n
\n
\n \n
\n
\n \n \n
\n
\n \n
\n
\n
\n \n \n \n `,\n providers: [\n ApplicationMapConfig,\n ApplicationMapAbsoluteConfig,\n RapeFertilizationConfig,\n NFertilizationConfig,\n TargetRateConfig,\n BoniturConfig,\n UniformConfig,\n NFertilizationPlanningEntryService\n ],\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class ApNFertilizationPlanningEntryComponent implements OnInit, AfterContentInit, OnDestroy {\n @ViewChild(ApDynComponentComponent, {static: true}) public dynComponent: ApDynComponentComponent;\n @ViewChild('diagram', {static: false}) public diagramTemplateRef: TemplateRef;\n\n public data: NPlanningEntryComponentData;\n caption$ = new BehaviorSubject('Nutrients__SelectFieldsTitle');\n errorKeys$ = new BehaviorSubject([]);\n columns$: Observable = of([]);\n fieldSets$ = new BehaviorSubject([]);\n items$ = new BehaviorSubject(undefined);\n pager: ApDynGridPagerWizardConfig;\n chartData$: Observable;\n noteValues$: Observable<{ value: number, color?: string }[]>;\n breadCrumbsColumns = ['Global__Selection', 'Global__Details', 'Admin_Pages__Overview'];\n loading$: Observable;\n canSave$ = new BehaviorSubject(false);\n formNext = new EventEmitter();\n formPrevious = new EventEmitter();\n nextDisabled$ = new BehaviorSubject(true);\n maxY$: Observable;\n\n private _statisticUpdateRequested = new EventEmitter();\n private _currentStep = ApBaseWizardSteps.Selection;\n private _onCancelSelection = new EventEmitter();\n private _onNextSelection = new EventEmitter();\n private _onBackOverview = new EventEmitter();\n private _onSaveOverview = new EventEmitter();\n private _selectedFields$ = new BehaviorSubject([]);\n private _formValues = {};\n private _isRapeCrop: boolean;\n private _cropForDetails: string;\n private _selectedFieldsCropType: ICropTypes | undefined;\n private _operationModeAppSetting: IOperationModeAppSetting | undefined;\n private _operationModeAppSettings: IOperationModeAppSetting[] = [];\n private _nPlanBooks: INFertilizationPlanningPlanBookData[];\n private _subscriptions: Subscription[] = [];\n private _selectFieldSubscriptions: Subscription[] = [];\n private _formSubscriptions: Subscription[] = [];\n private _overviewSubscriptions: Subscription[] = [];\n\n constructor(private applicationModesStore: ApplModesStore,\n private campaignYearStore: CampaignYearStore,\n private cropRotationStore: CropRotationStore,\n private cropService: ApGetCropService,\n private cropTypeStore: CropTypeStore,\n private dateService: ApDateService,\n private fieldStore: FieldStore,\n private generalConfig: GeneralConfig,\n private formStore: FormStore,\n private languageStore: LanguageStore,\n private loginStore: LoginStore,\n private mapViewStore: MapViewStore,\n private modalDialogStore: ModalDialogStore,\n private notifyStore: NotifyStore,\n private nFertilizationStore: NFertilizationStore,\n private operationModesStore: OperationModesStore,\n private basicFertilisationSummariesStore: BasicFertilisationSummariesStore,\n private roundNumericPipe: GetRoundNumericPipe,\n private roundNumericService: GetRoundNumericService,\n private settingsStore: SettingsStore,\n private translationStore: TranslationStore,\n private unitStore: UnitsStore,\n private mapStore: MapStore,\n private routerStore: RouterStore,\n private nFertilizationService: NFertilizationService,\n private sensorStore: SensorStore,\n private statisticStore: StatisticStore,\n private scanService: ScanService,\n private applicationSettingsService: ApplicationSettingsService,\n private nPlanningEntryService: NFertilizationPlanningEntryService,\n private nFertilizationCommonService: ApNFertilizationCommonService,\n private nFertilizationCommonEntryService: NFertilizationCommonEntryService,\n private nFertilizationPlantProtectionService: NFertilizationPlantProtectionService,\n private applicationSettingsStore: ApplicationSettingsStore,\n private applicationMapAbsoluteConfig: ApplicationMapAbsoluteConfig,\n private uniformConfig: UniformConfig,\n private boniturConfig: BoniturConfig,\n private targetRateConfig: TargetRateConfig,\n private applicationMapConfig: ApplicationMapConfig,\n private nFertilizationConfig: NFertilizationConfig,\n private rapeFertilizationConfig: RapeFertilizationConfig) {\n }\n\n public ngOnInit(): void {\n this.nPlanningEntryService.setComponentData(this.data);\n this.nPlanningEntryService.initData();\n this._gridBuilderSelectionGrid();\n }\n\n public ngAfterContentInit(): void {\n setTimeout(() => this.sensorStore.loadSensorFieldData());\n this._subscriptions.push(this.dynComponent.SelectedItems$.pipe(debounceTime(250)).subscribe(() => {\n this._statisticUpdateRequested?.emit();\n }));\n this._subscriptions.push(this.dynComponent.SelectedItems$.subscribe(() => {\n this._fieldSelection();\n }));\n this._subscriptions.push(\n combineLatest([\n this.dynComponent.gridSubject,\n this.caption$,\n ]).pipe(\n filter(([grid, caption]) => !!grid && caption === 'Nutrients__SelectFieldsTitle')\n ).subscribe(([grid]) => {\n grid.gridPaging.setSelectedKeys(this.fieldStore.getSelectedFieldIds());\n })\n );\n this._subscriptions.push(this._onCancelSelection.subscribe(() => this._onCloseForm()));\n this._subscriptions.push(this._onNextSelection.subscribe(() => {\n this._currentStep = ApBaseWizardSteps.Details;\n this._selectFieldSubscriptions.forEach(x => x?.unsubscribe());\n const selectedFields = this.dynComponent.getSelectedItems() as INFertilizationPlanFieldToSelectGridItem[];\n this._selectedFields$.next(selectedFields);\n this._isRapeCrop = this.nFertilizationService.isRapeCrop(selectedFields.map(x => x.CropId));\n this._formBuilderGeneral();\n this._selectFieldSubscriptions.forEach(x => x.unsubscribe());\n this.dynComponent.saveGridDescriptors('Selection');\n }));\n this._subscriptions.push(this.formPrevious.subscribe(() => {\n this._currentStep = ApBaseWizardSteps.Selection;\n this._formSubscriptions.forEach(x => x?.unsubscribe());\n this._gridBuilderSelectionGrid();\n this.dynComponent.loadGridDescriptors('Selection');\n this._formValues = ObjectFactory.Merge(this._formValues, this.dynComponent.getForm().value);\n }));\n this._subscriptions.push(this.formNext.subscribe(() => {\n this._currentStep = ApBaseWizardSteps.Overview;\n this._formSubscriptions.forEach(x => x?.unsubscribe());\n this._formValues = ObjectFactory.Merge(this._formValues, this.dynComponent.getForm().value);\n this._gridBuilderOverview();\n this.dynComponent.loadGridDescriptors('Overview');\n }));\n this._subscriptions.push(this._onBackOverview.subscribe(() => {\n this._currentStep = ApBaseWizardSteps.Details;\n this._overviewSubscriptions.forEach(x => x?.unsubscribe());\n this._clearMap();\n this._formBuilderGeneral();\n this.dynComponent.saveGridDescriptors('Overview');\n this.statisticStore.removeStatisticData();\n }));\n this._subscriptions.push(this._onSaveOverview.subscribe(() => {\n this._save();\n this._onCloseForm();\n }));\n this._subscriptions.push(this._statisticUpdateRequested.pipe(debounceTime(100)).subscribe(() => {\n this._generateStats();\n }));\n this._subscriptions.push(this.items$.subscribe(_ => this._statisticUpdateRequested.emit()));\n this._subscriptions.push(this.canSave$.subscribe(value => {\n this._canSaveCheck(value);\n }));\n }\n\n public ngOnDestroy(): void {\n this._subscriptions.forEach(s => s?.unsubscribe());\n this._selectFieldSubscriptions.forEach(x => x?.unsubscribe());\n this._formSubscriptions.forEach(x => x?.unsubscribe());\n this._overviewSubscriptions.forEach(x => x?.unsubscribe());\n }\n\n public onEdit(dataItem: any): void {\n dataItem = ObjectFactory.Copy(dataItem);\n // workaround for our lovely problem in n-fertilization\n // the dataItem from the grid contains '-' text values for numeric columns\n // as it is passed to the form those strings cannot be parsed as number and\n // this leads to a client error when editing a single row\n // ==> replace all '-' with undefined before passing it to the modalDialog\n for (const dataItemProperty of Object.keys(dataItem)) {\n if (dataItem[dataItemProperty] === '-') {\n dataItem[dataItemProperty] = undefined;\n }\n }\n this._updateDataForSingleEdit(dataItem);\n this.modalDialogStore.setModalDialogData({\n buttons: [\n {\n key: 'cancel',\n text: 'Global__Cancel',\n primary: false\n },\n {\n key: 'apply',\n text: 'Global__Ok',\n primary: true,\n disable: ModalDialogButtonDisable.FormInvalid,\n }\n ],\n show: true,\n title: this.translationStore.FindTranslationForSelectedLanguage('Docu_Ini__Edit'),\n formConfig: {\n fieldSets: this._getFieldSets(dataItem, this.modalDialogStore.listenChanges()),\n values: dataItem\n },\n values: dataItem\n } as IModalDialogData);\n const resultSubscription = this.modalDialogStore.Listen(s => s.result)\n .subscribe((result) => {\n if (result?.key === 'apply') {\n this._updateOverviewItems({ids: [dataItem['Id']], value: result.formValues});\n this._clearMap();\n resultSubscription.unsubscribe();\n } else if (result?.key === 'cancel' || result?.key === '') {\n resultSubscription.unsubscribe();\n }\n });\n }\n\n private _updateDataForSingleEdit(dataItem: any): void {\n if (this.nFertilizationCommonEntryService.isApplicationMapOrAbsolute(this._operationModeAppSetting?.OperationMode)) {\n dataItem['Minimum'] = this._formValues['Minimum'];\n dataItem['Maximum'] = this._formValues['Maximum'];\n dataItem['Constant'] = this._formValues['Constant'];\n dataItem['Threshold'] = this._formValues['Threshold'];\n if (this._operationModeAppSetting?.OperationMode === OperationModesEnum.ApplicationMapAbsolute) {\n dataItem['DeadBioMass'] = this._formValues['DeadBioMass'];\n dataItem['Amount'] = this._formValues['Amount'];\n }\n }\n }\n\n private _gridBuilderSelectionGrid(): void {\n this.caption$.next('Nutrients__SelectFieldsTitle');\n this.fieldSets$.next([]);\n this.loading$ = combineLatest([\n this.fieldStore.Listen((s) => s.loading),\n this.cropRotationStore.Listen((s) => s.historyLoading),\n this.campaignYearStore.Listen((s) => s.loading),\n this.cropTypeStore.Listen((s) => s.loading),\n this.sensorStore.Listen((s) => s.loading),\n this.applicationSettingsStore.Loading$\n ]).pipe(\n map((loadings) => loadings.some(l => l))\n );\n this.columns$ = combineLatest([\n this.languageStore.SelectedLanguage$,\n this.settingsStore.FirstSetting$\n ]).pipe(\n filter(([language, settings]) => !!language && !!settings),\n map(([language, settings]) => ({language, setting: settings})),\n map((p) => [\n new ApDynGridStatusColumnConfig({\n field: nameOf('Status'),\n class: nameOf('StatusClass'),\n description: nameOf('StatusDesc'),\n filterable: true\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Docu_Ini__Number',\n field: nameOf('Nr'),\n width: 60,\n hide: true,\n filterable: true,\n filterType: FilterType.NUMBER,\n cssClass: 'right',\n headerFilterable: true\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Docu_Ini_Subnumber',\n field: nameOf('TNr'),\n width: 60,\n hide: true,\n filterable: true,\n filterType: FilterType.NUMBER,\n cssClass: 'right',\n headerFilterable: true\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Docu_Ini__Number',\n field: nameOf('NrTNr'),\n width: 70,\n filterable: true,\n headerFilterable: true,\n hide: new ApDynGridColumnHideConfig({\n selfHide: this.mapViewStore.Listen(s => s.mode).pipe(map((mode) => mode === MapViewMode.HIDE))\n })\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Docu_Ini__Name',\n field: nameOf('Name'),\n width: 180,\n filterable: true,\n sortIndex: 0,\n headerFilterable: true\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Docu_Ini__Area',\n field: nameOf('Area'),\n width: 60,\n filterable: true,\n headerFilterable: true,\n filterType: FilterType.NUMBER,\n cssClass: 'right',\n tooltip: (dataItem) => dataItem['Area'],\n pipes: [{\n pipe: this.roundNumericPipe,\n args: [p.setting.DigitsAfterDecimalPoint]\n }]\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__Crop',\n field: nameOf('Crop'),\n width: 100,\n filterable: true,\n headerFilterable: true,\n groupIndex: 0,\n groupDesc: true\n }),\n new ApDynGridStatusColumnConfig({\n field: `${nameOf('ScanData')}.${nameOf('Status')}.${nameOf('state')}`,\n class: `${nameOf('ScanData')}.${nameOf('Status')}.${nameOf('class')}`,\n description: `${nameOf('ScanData')}.${nameOf('Status')}.${nameOf('description')}`,\n filterable: true,\n hide: new ApDynGridColumnHideConfig({\n selfHide: this.mapViewStore.Listen(s => s.mode).pipe(map((mode) => mode === MapViewMode.HIDE))\n })\n }),\n new ApDynGridGroupColumnConfig({\n title: 'Global__latest_Sensor_reading',\n hide: true,\n groupColumns: [\n new ApDynGridStatusColumnConfig({\n field: `${nameOf('ScanData')}.${nameOf('Status')}.${nameOf('state')}`,\n class: `${nameOf('ScanData')}.${nameOf('Status')}.${nameOf('class')}`,\n description: `${nameOf('ScanData')}.${nameOf('Status')}.${nameOf('description')}`,\n filterable: true\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__EC',\n field: `${nameOf('ScanData')}.${nameOf('Ec')}`,\n cssClass: 'right',\n filterType: FilterType.NUMBER,\n width: 40,\n filterable: true\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__Date',\n field: `${nameOf('ScanData')}.${nameOf('Created')}`,\n format: p.language.DateFormat,\n width: 80,\n filterable: true\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__AvgShort',\n field: `${nameOf('ScanData')}.${nameOf('NUptakeAvg')}`,\n width: 60,\n cssClass: 'right',\n pipes: [{\n pipe: this.roundNumericPipe,\n args: [p.setting.DigitsAfterDecimalPoint, GetRoundNumericPipeConfig.NullToEmptyReplaceConfig]\n }],\n filterType: FilterType.NUMBER,\n filterable: true\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__Min',\n field: `${nameOf('ScanData')}.${nameOf('NUptakeMin')}`,\n width: 60,\n filterable: true,\n cssClass: 'right',\n pipes: [{\n pipe: this.roundNumericPipe,\n args: [p.setting.DigitsAfterDecimalPoint, GetRoundNumericPipeConfig.NullToEmptyReplaceConfig]\n }],\n filterType: FilterType.NUMBER,\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__Max',\n field: `${nameOf('ScanData')}.${nameOf('NUptakeMax')}`,\n width: 60,\n filterable: true,\n cssClass: 'right',\n pipes: [{\n pipe: this.roundNumericPipe,\n args: [p.setting.DigitsAfterDecimalPoint, GetRoundNumericPipeConfig.NullToEmptyReplaceConfig]\n }],\n filterType: FilterType.NUMBER,\n }),\n ]\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Nutrients__Remaining',\n field: nameOf('Remaining'),\n width: 60,\n cssClass: 'right',\n filterType: FilterType.NUMBER,\n hide: true,\n pipes: [{\n pipe: this.roundNumericPipe,\n args: [p.setting.DigitsAfterDecimalPoint, GetRoundNumericPipeConfig.NullToEmptyReplaceConfig]\n }]\n }),\n ]),\n );\n this.pager = new ApDynGridPagerWizardConfig(\n new ApDynGridPagerWizardButton('Global__Cancel', this._onCancelSelection),\n new ApDynGridPagerWizardBreadcrumbsStepper(\n ['Global__Selection', 'Global__Details', 'Admin_Pages__Overview'], 0),\n new ApDynGridPagerWizardButton('Global_Next_With_Arrow', this._onNextSelection, {\n active: this._activeItems()\n })\n );\n this._selectFieldSubscriptions.push(\n combineLatest([\n this._activeItems(),\n this.dynComponent.SelectedItems$\n ]).pipe(\n debounceTime(10)\n ).subscribe(([active, items]) => {\n this.errorKeys$.next(active ? [] : items.map((item) => item['Id']));\n if (!active && items.length > 1 &&\n items.some((i) => i['EppoCode'] !== items[0]['EppoCode'])) {\n this.notifyStore.addMessage({\n Level: ApValidationLevel.Error,\n Counter: 1,\n ErrorKey: 'Global__Various_Crop_Selected',\n UserId: null,\n UserName: null,\n DisplayTimeout: 5,\n Parameters: null\n });\n }\n })\n );\n this._selectFieldSubscriptions.push(\n combineLatest([\n this.fieldStore.Listen(s => s.data),\n this.cropRotationStore.Listen(s => s.history),\n this.campaignYearStore.Listen(s => s.selectedYear),\n this.cropTypeStore.Listen(s => s.cropTypesNames),\n this.nFertilizationStore.GetNeeds$(this.campaignYearStore.getSelectedCampaignYear().Year),\n this.sensorStore.Listen(s => s.data),\n this.nFertilizationStore.Listen(x => x.planBooks),\n this.nFertilizationStore.Listen(x => x.logfiles),\n this.basicFertilisationSummariesStore.Summaries$,\n this.applicationSettingsStore.Applications$\n ]).pipe(\n filter(([fields, cropRotation]) => fields.length !== 0 && Object.keys(cropRotation).length !== 0),\n map(([fields, cropRotation, year, cropTypes, needs, sensorFieldData, planBooks, logFiles, bfSummaries, _]) => fields.map((field) => {\n const geom = this.fieldStore.getCurrentFieldGeom(field);\n const fieldCrop = cropRotation[field.Id as string];\n const sensorData = sensorFieldData?.Find(x => x?.FieldGeomId === geom?.Id) as ISensorFieldData;\n let crop: any;\n let cropId: any;\n let defaultCropEppoCode: string | null;\n const status: IGridStatus = this._getStatus(fieldCrop[year.Year].MainCrop, sensorData);\n if (fieldCrop) {\n cropId = fieldCrop[year.Year].MainCrop;\n defaultCropEppoCode = this.cropTypeStore.getDefaultCroptype(cropId)?.Eppocode;\n crop = cropTypes[fieldCrop[year.Year].MainCrop];\n }\n const needValue = needs.Find((need) => need.FieldId === field.Id)?.Value ?? null;\n const baseFertPlanBooks = bfSummaries.map(x => x.BasicFertilisationPlanBooks).flat();\n const alreadyApplied = this.nFertilizationService.calculateAlreadyAppliedFromContentNPlanBooks(field, planBooks, logFiles, baseFertPlanBooks);\n const bestScanData = this.scanService.getBestScanData(field, this.getDefaultBestScanStatus());\n return {\n Id: field.Id,\n Status: status.state,\n StatusClass: status.class,\n StatusDesc: status.description,\n Nr: field.FieldNumber,\n TNr: field.FieldSubnumber,\n NrTNr: this.fieldStore.getFieldNumberAndSubNumber(field),\n Name: field.FieldName,\n Area: geom ? geom.AreaHa : undefined,\n Crop: crop,\n CropId: cropId,\n EppoCode: defaultCropEppoCode,\n SecondCropId: (this.cropService.getCrop(field, false, 'object') as ICropTypes)?.Id,\n Geom: geom,\n Kind: null,\n Application: null,\n FieldCropEc: this.cropService.getFieldCrop(field)?.EcValue ?? undefined,\n Sum: null,\n DBW: needValue,\n NUptake: null,\n PlanBookId: bestScanData?.PlanId ?? ApGuidUtil.getEmptyGuid(),\n Remaining: this.nFertilizationService.calculateRemainingValue(alreadyApplied, needValue) ?? '-',\n ScanData: bestScanData\n } as INFertilizationPlanFieldToSelectGridItem;\n })),\n ).subscribe((items) => this.items$.next(items))\n );\n }\n\n private _formBuilderGeneral(): void {\n const cropId = this._selectedFields$.getValue()[0].CropId;\n this._selectedFieldsCropType = this.cropTypeStore.getDefaultCroptype(cropId);\n this.caption$.next('Global__Details');\n this.columns$ = of([]);\n this.maxY$ = this.dynComponent.FormValues$.pipe(\n distinctUntilChanged((previous, current) =>\n current['Maximum'] === previous['Maximum'] &&\n current['ControlRange'] === previous['ControlRange'] &&\n current['TargetRate'] === previous['TargetRate']),\n map((v) => {\n const operationMode = this._operationModeAppSettings.FirstOrDefault(x => x.Id === v['OperationMode'])?.OperationMode;\n return operationMode === OperationModesEnum.ApplicationMap ? v['ControlRange'] + v['TargetRate'] : v['Maximum'];\n })\n );\n this.chartData$ = this.dynComponent.FormValues$.pipe(\n map((values) => {\n const valuesOperationMode = this._operationModeAppSettings.FirstOrDefault(x => x.Id === values['OperationMode'])?.OperationMode;\n return ({\n amount: values['Amount'] !== '' ? values['Amount'] : undefined,\n threshold: values['Threshold'] !== '' ? values['Threshold'] : undefined,\n min: values['Minimum'] !== '' ? values['Minimum'] : undefined,\n max: values['Maximum'] !== '' ? values['Maximum'] : undefined,\n factor: values['ControlFactor'] !== '' ? values['ControlFactor'] : undefined,\n targetRate: values['TargetRate'] !== '' ? values['TargetRate'] : undefined,\n controlRange: values['ControlRange'] !== '' ? values['ControlRange'] : undefined,\n referenceValue: values['ReferenceValue'] !== '' ? values['ReferenceValue'] : undefined,\n operationMode: valuesOperationMode != null ? valuesOperationMode : undefined,\n });\n }),\n distinctUntilChanged((x, y) => JSON.stringify(x) === JSON.stringify(y)),\n map((values) => {\n const avgNUptake =\n this._selectedFields$.getValue().reduce((res, f) => res + f.NUptake, 0)\n / this._selectedFields$.getValue().length;\n if (this.nFertilizationCommonEntryService.isApplicationMapOrAbsolute(values.operationMode)) {\n return CurveCreator.createCurve(\n avgNUptake, values.amount, values.threshold, values.min, values.max, values.factor);\n } else if (values.operationMode === OperationModesEnum.TargetValue) {\n const min = values.targetRate - values.controlRange;\n const max = values.targetRate + values.controlRange;\n return CurveCreator.createCurve(\n avgNUptake, values.targetRate, values.threshold * avgNUptake / 100, min, max, values.factor);\n } else if (values.operationMode === OperationModesEnum.NFertilization) {\n return CurveCreator.createCurve(\n 18, values.amount, 6, values.min, values.max, values.factor);\n }\n return undefined;\n }),\n );\n this.noteValues$ = this.dynComponent.FormValues$.pipe(\n map((values) => {\n const valuesOperationMode = this._operationModeAppSettings.FirstOrDefault(x => x.Id === values['OperationMode'])?.OperationMode;\n return ({\n threshold: values['Threshold'] !== '' ? values['Threshold'] : undefined,\n operationMode: valuesOperationMode != null ? valuesOperationMode : undefined\n });\n }),\n distinctUntilChanged((x, y) => JSON.stringify(x) === JSON.stringify(y)),\n map((values) => {\n const avgNUptake =\n this._selectedFields$.getValue().reduce((res, f) => res + f.NUptake, 0)\n / this._selectedFields$.getValue().length;\n if (values.operationMode === OperationModesEnum.TargetValue) {\n values.threshold *= avgNUptake / 100;\n } else if (values.operationMode === OperationModesEnum.NFertilization) {\n return CurveCreator.createNotes(18, values.threshold ? 6 : undefined);\n }\n return CurveCreator.createNotes(avgNUptake, values.threshold);\n }),\n );\n this._formSubscriptions.push(\n this.dynComponent.FormValues$.pipe(\n distinctUntilChanged((previous, current) => previous['Group'] === current['Group']),\n ).subscribe(() => {\n const product = this.dynComponent?.getForm()?.get('Product');\n if (product) {\n product.setValue(undefined);\n }\n })\n );\n this._formSubscriptions.push(\n combineLatest([\n this.dynComponent.Valid$,\n this.fieldSets$\n ]).pipe(\n filter(([, fs]) => fs.length !== 0),\n debounceTime(10),\n delay(1),\n map(([v]) => !v)\n ).subscribe((disable) => {\n this.dynComponent.dynForm.form.markAllAsTouched();\n this.nextDisabled$.next(disable);\n }\n )\n );\n this._formSubscriptions.push(\n combineLatest([\n this.dynComponent.FormValues$,\n this.fieldSets$\n ]).pipe(\n debounceTime(100),\n filter(([values, fieldSets]) => fieldSets.length !== 0 && Object.keys(values).length !== 0),\n tap(([values, _]) => {\n if (!this._formValues['Application'] || !this._formValues['OperationMode']) {\n this._formValues = ObjectFactory.Copy(values);\n }\n }),\n filter(([values, _]) => {\n return !!values['Application'] && !!values['OperationMode'] && !!this._formValues['Application'] && !!this._formValues['OperationMode']\n && (this._formValues['Application'] !== values['Application'] || this._formValues['OperationMode'] !== values['OperationMode']);\n }),\n map(([values, _]) => values),\n distinctUntilChanged((previous, current) => {\n return (!previous['Application'] || !previous['OperationMode'])\n || (previous['Application'] === current['Application'] && previous['OperationMode'] === current['OperationMode'])\n || (this._formValues['Application'] === current['Application'] && this._formValues['OperationMode'] === current['OperationMode']);\n }),\n tap((values) => {\n this._operationModeAppSetting = undefined;\n const applicationMode = values['Application'] as ApplicationModesEnum;\n const operationModeId = values['OperationMode'] as string;\n if (applicationMode !== this._formValues['Application']) {\n this._updateOperationModeAppSettings(applicationMode);\n this._operationModeAppSetting = this._operationModeAppSettings?.find(x => x.ApplicationMode === applicationMode);\n } else {\n this._operationModeAppSetting = this._operationModeAppSettings?.find(x => x.Id === operationModeId);\n }\n values['OperationMode'] = this._operationModeAppSetting.Id;\n if (this.nFertilizationCommonEntryService.isApplicationMapOrAbsolute(this._operationModeAppSetting?.OperationMode)) {\n this._cleanUpFormValues(values);\n }\n this._formValues = ObjectFactory.Copy(values);\n }),\n tap(() => {\n if (this.nFertilizationCommonEntryService.isApplicationMapOrAbsolute(this._operationModeAppSetting?.OperationMode)) {\n return;\n }\n if (!!this._formValues['ControlRange']) {\n this._formValues['Minimum'] = this._formValues['TargetRate'] - this._formValues['ControlRange'];\n this._formValues['Maximum'] = this._formValues['TargetRate'] + this._formValues['ControlRange'];\n }\n this._formValues['DeadBioMass'] = 0;\n this._formValues['Minimum'] = 0;\n if (this._isRapeCrop) {\n this._formValues['ControlFactor'] = 1;\n this._formValues['Maximum'] = 120;\n if (this._operationModeAppSetting?.OperationMode === OperationModesEnum.ApplicationMap) {\n this._formValues['Amount'] = 160;\n }\n } else {\n this._formValues['Maximum'] = 120;\n this._formValues['ControlFactor'] = 2;\n }\n }),\n map(() => {\n return this._createForm(this._formValues['Application'] as ApplicationModesEnum, this._operationModeAppSetting);\n }),\n ).subscribe(fieldSets => {\n this.fieldSets$.next(fieldSets);\n setTimeout(() => this.dynComponent.dynForm.markAsTouched());\n })\n );\n this._cleanUpFormValuesOnCropChanged();\n this.fieldSets$.next(\n this._createForm(this._formValues['Application'] as ApplicationModesEnum, this._operationModeAppSetting)\n );\n this._statisticUpdateRequested.emit();\n }\n\n private _gridBuilderOverview(): void {\n const operationMode = this._operationModeAppSetting.OperationMode;\n const isApplicationMap = this.nFertilizationPlantProtectionService.isOperationModeAnyOfMapsOrConstant(operationMode);\n this.fieldSets$.next([]);\n this.caption$.next('Admin_Pages__Overview');\n this.nFertilizationStore.clearNPlanningStatistic();\n this._createGridDataObjects(isApplicationMap);\n this._initializeGridOverviewItem(isApplicationMap, true);\n this._gridBuilderOverviewColumns(isApplicationMap);\n if (isApplicationMap) {\n this._createNPlanningJob();\n }\n this._statisticUpdateRequested.emit();\n }\n\n private _activeItems(): Observable {\n return this.dynComponent.SelectedItems$.pipe(\n delay(1),\n map((items) =>\n items.length !== 0 &&\n items.every(_ => _?.Status >= 0) &&\n items.every((i) => i['EppoCode'] === items[0]['EppoCode'])\n )\n );\n }\n\n private _cleanUpFormValuesOnCropChanged(): void {\n const selectedFieldCrops = this._selectedFields$.getValue().map(x => x.Crop);\n const selectedFieldCrop = !selectedFieldCrops || selectedFieldCrops.length <= 0 ? '' : selectedFieldCrops[0];\n if (this._cropForDetails && this._cropForDetails !== selectedFieldCrop) {\n this._formValues['Machine'] = undefined;\n this._formValues['Driver'] = undefined;\n this._formValues['Group'] = undefined;\n this._formValues['Instrument'] = undefined;\n this._formValues['OperationMode'] = undefined;\n this._formValues['Application'] = undefined;\n this._cleanUpFormValues(this._formValues);\n }\n this._cropForDetails = selectedFieldCrop;\n }\n\n private _cleanUpFormValues(formValues: any): void {\n formValues['Amount'] = undefined;\n formValues['Threshold'] = undefined;\n formValues['DeadBioMass'] = undefined;\n formValues['Minimum'] = undefined;\n formValues['Maximum'] = undefined;\n formValues['Product'] = undefined;\n formValues['Constant'] = undefined;\n formValues['ControlFactor'] = undefined;\n formValues['TargetRate'] = undefined;\n formValues['ControlRange'] = undefined;\n formValues['ReferenceValue'] = undefined;\n }\n\n private _gridBuilderOverviewColumns(isApplicationMap: boolean): void {\n if (isApplicationMap) {\n this._overviewSubscriptions.push(this.items$\n .pipe(debounceTime(10))\n .subscribe((items) => this.canSave$.next((items.every((i) => !i['ColumnLoading'] && !i['ErrorMessage']))))\n );\n } else {\n this.canSave$.next(true);\n }\n\n this.pager = new ApDynGridPagerWizardConfig(\n new ApDynGridPagerWizardButton('Global_Back_With_Arrow', this._onBackOverview),\n new ApDynGridPagerWizardBreadcrumbsStepper(['Global__Selection', 'Global__Details', 'Admin_Pages__Overview'], 2),\n new ApDynGridPagerWizardButton('Global__Save', this._onSaveOverview, {active: this.canSave$, id: 'button_save'}),\n );\n\n this.columns$ = combineLatest([\n this.languageStore.Listen(s => s.selectedLanguage),\n this.settingsStore.Listen(s => s.data)\n ]).pipe(\n filter(([language, settings]) => !!language && settings.length !== 0),\n map(([language, settings]) => ({language, setting: settings[0]})),\n map((p) => {\n const mapHide = this.mapViewStore.Listen(s => s.mode).pipe(\n map((mapMode) => mapMode === MapViewMode.HIDE));\n let result: ApDynGridColumnConfigBase[] = [\n new ApDynGridStatusColumnConfig({\n field: `Status.${nameOf('state')}`,\n class: `Status.${nameOf('class')}`,\n description: `Status.${nameOf('description')}`,\n filterable: true\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Docu_Ini__Number',\n field: 'Nr',\n width: 60,\n hide: true,\n filterType: FilterType.NUMBER,\n cssClass: 'right',\n headerFilterable: true\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Docu_Ini_Subnumber',\n field: 'TNr',\n width: 60,\n hide: true,\n filterType: FilterType.NUMBER,\n cssClass: 'right',\n headerFilterable: true\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Docu_Ini__Number',\n field: 'NrTNr',\n width: 70,\n headerFilterable: true,\n hide: new ApDynGridColumnHideConfig({\n selfHide: mapHide\n })\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Docu_Ini__Name',\n field: 'Name',\n width: 150,\n cssClass: 'left',\n sortIndex: 0,\n headerFilterable: true\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Docu_Ini__Area',\n field: 'Area',\n width: 60,\n headerFilterable: true,\n tooltip: (dataItem) => dataItem['Area'],\n cssClass: 'right',\n filterType: FilterType.NUMBER,\n pipes: [{\n pipe: this.roundNumericPipe,\n args: [this.settingsStore.FirstSetting.DigitsAfterDecimalPoint]\n }]\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__Crop',\n field: 'Crop',\n width: 80,\n hide: true,\n headerFilterable: true\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__EC',\n field: 'ECStage',\n width: 50,\n hide: true,\n cssClass: 'right',\n filterType: FilterType.NUMBER,\n })\n ];\n const appSettingsParameters = this._operationModeAppSetting?.ApplicationSetting?.Parameter;\n switch (this._operationModeAppSetting?.OperationMode) {\n case OperationModesEnum.ApplicationMap:\n result = result.concat(this.applicationMapConfig.gridBuilderConfig(mapHide, appSettingsParameters));\n break;\n case OperationModesEnum.ApplicationMapAbsolute:\n result = result.concat(this.applicationMapAbsoluteConfig.gridBuilderConfig(mapHide, appSettingsParameters));\n break;\n case OperationModesEnum.TargetValue:\n result = result.concat(this.targetRateConfig.gridBuilderConfig());\n break;\n case OperationModesEnum.NFertilization:\n result = result.concat(this.nFertilizationConfig.gridBuilderConfig());\n break;\n case OperationModesEnum.RapeFertilization:\n result = result.concat(this.rapeFertilizationConfig.gridBuilderConfig());\n break;\n case OperationModesEnum.Constant:\n result = result.concat(this.uniformConfig.gridBuilderConfig());\n break;\n }\n result = result.concat([\n new ApDynGridPropertyColumnConfig({\n title: 'Base__SortItemDate',\n field: 'Date',\n format: p.language.DateFormat,\n hide: true,\n width: 90\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Nutrients__Remaining',\n field: 'Remaining',\n width: 90,\n hide: true,\n cssClass: 'right',\n filterType: FilterType.NUMBER,\n pipes: [{\n pipe: this.roundNumericPipe,\n args: [this.settingsStore.FirstSetting.DigitsAfterDecimalPoint, GetRoundNumericPipeConfig.NullToEmptyReplaceConfig]\n }]\n }),\n new ApDynGridGroupColumnConfig({\n title: 'agrioptions_resources',\n hide: true,\n groupColumns: [\n new ApDynGridPropertyColumnConfig({\n field: 'Machine.NameWithSign',\n title: 'Base__Engine',\n width: 100,\n hide: true,\n }),\n new ApDynGridPropertyColumnConfig({\n field: 'Instrument.Name',\n title: 'AgriConnect_Ini__Tool',\n width: 100,\n hide: true\n }),\n new ApDynGridPropertyColumnConfig({\n field: 'Driver.ShortFullName',\n title: 'Docu_Ini__Motorist',\n width: 100,\n hide: true\n })\n ]\n }),\n new ApDynGridEditColumnConfig({})\n ]);\n return result;\n }));\n }\n\n private _initializeGridOverviewItem(isApplicationMap: boolean, initializeSubscription: boolean): void {\n const nNeeds = this.nFertilizationStore.GetNeeds(this.campaignYearStore.getSelectedCampaignYear().Year);\n const planBooks = this.nFertilizationStore.Listen(x => x.planBooks).getValue();\n const logFiles = this.nFertilizationStore.Listen(x => x.logfiles).getValue();\n const bfPlanBooks = this.basicFertilisationSummariesStore.Summaries.map(x => x.BasicFertilisationPlanBooks).flat();\n if (isApplicationMap && initializeSubscription) {\n this._overviewSubscriptions.push(\n combineLatest([\n this.nFertilizationStore.Listen(s => s.fieldNPlanningStatistic),\n this._selectedFields$,\n ]).subscribe(([fieldNPlanningStatistic, fields]) => {\n this.items$.next(fields.map((field) => {\n const planBook = this._getNPlanningPlanBookData(field.Geom?.Id);\n const needValue = nNeeds.find((need) => need.FieldId === field.Id)?.Value;\n const fieldFromStore = this.fieldStore.getFieldById(field.Id);\n let alreadyApplied = this.nFertilizationService.calculateAlreadyAppliedFromContentNPlanBooks(\n fieldFromStore, planBooks, logFiles, bfPlanBooks);\n const statistic = fieldNPlanningStatistic?.filter(x => x.FieldGeomId === field.Geom.Id) ?? [];\n if (statistic && statistic.length > 0) {\n planBook.ColumnLoading = false;\n if (statistic[0].ErrorText !== null) {\n planBook.HasError = true;\n planBook.ErrorMessage = statistic[0].ErrorText;\n } else {\n planBook.HasError = false;\n planBook.ErrorMessage = '';\n planBook.Amount = this.roundNumericService.roundAsNumber(statistic[0].Mean);\n planBook.Minimum = this.roundNumericService.roundAsNumber(statistic[0].Min);\n planBook.Maximum = this.roundNumericService.roundAsNumber(statistic[0].Max);\n planBook.PlanId = statistic[0].PlanId;\n if (this._isRemainingValueCouldBeApplied(planBook.OperationModeKey)) {\n alreadyApplied += this.nFertilizationService.getAlreadyApplied(statistic[0].Mean, planBook.ProductId);\n }\n }\n }\n return {\n ...field,\n Id: field.Id,\n Status: this.nFertilizationPlantProtectionService.getStatusForItemOnOverviewStep(planBook.OperationModeKey as OperationModesEnum),\n PlanId: planBook.PlanId,\n OperationMode: planBook.OperationModeKey,\n ApplicationMode: planBook.ApplicationModeKey,\n ErrorMessage: planBook.HasError ? planBook.ErrorMessage : '',\n AvgAmount: planBook.AvgAmount,\n ProductId: planBook.ProductId,\n Threshold: planBook.HasError ? '-' : planBook.Threshold,\n ThresholdAbs: planBook.HasError ? '-' : planBook.ThresholdAbs,\n Constant: planBook.HasError ? '-' : planBook.Constant,\n Minimum: planBook.HasError ? '-' : planBook.Minimum,\n Maximum: planBook.HasError ? '-' : planBook.Maximum,\n Amount: planBook.HasError ? '-' : planBook.Amount,\n ControlFactor: planBook.HasError ? '-' : planBook.ControlFactor,\n ControlFactorDescription: planBook.ControlFactorDescription,\n ECStage: planBook.ECStage,\n TargetRate: planBook.TargetRate,\n ControlRange: planBook.ControlRange,\n ReferenceValue: planBook.ReferenceValue,\n DeadBioMass: planBook.DeadBioMass,\n Driver: planBook.Driver,\n Machine: planBook.Machine,\n Instrument: planBook.Instrument,\n Duration: planBook.Duration,\n Date: planBook.FertilizationDate,\n Remaining: this.nFertilizationService.calculateRemainingValue(alreadyApplied, needValue ?? null),\n ColumnLoading: planBook.ColumnLoading,\n AvgNUptake: planBook.ScanData?.NUptakeAvg\n };\n }));\n })\n );\n } else {\n const selectedFields = this._selectedFields$.getValue();\n this.items$.next(selectedFields.map((field) => {\n const planBook = this._getNPlanningPlanBookData(field.Geom?.Id);\n const needValue = nNeeds.find((need) => need.FieldId === field.Id)?.Value;\n const fieldFromStore = this.fieldStore.getFieldById(field.Id);\n let alreadyApplied = this.nFertilizationService.calculateAlreadyAppliedFromContentNPlanBooks(\n fieldFromStore, planBooks, logFiles, bfPlanBooks);\n if (this._isRemainingValueCouldBeApplied(planBook.OperationModeKey)) {\n alreadyApplied += this.nFertilizationService.getAlreadyApplied(planBook.Constant, planBook.ProductId);\n }\n return {\n ...field,\n Id: field.Id,\n Status: this.nFertilizationPlantProtectionService.getStatusForItemOnOverviewStep(planBook.OperationModeKey as OperationModesEnum),\n ErrorMessage: '',\n PlanId: planBook.PlanId,\n OperationMode: planBook.OperationModeKey,\n ApplicationMode: planBook.ApplicationModeKey,\n AvgAmount: planBook.AvgAmount,\n ProductId: planBook.ProductId,\n Threshold: planBook.Threshold,\n ThresholdAbs: planBook.ThresholdAbs,\n ControlFactor: planBook.ControlFactor,\n ControlFactorDescription: this.translationStore.FindTranslationForSelectedLanguage(planBook.ControlFactorDescription),\n Constant: planBook.Constant,\n Minimum: planBook.ControlRange ? planBook.TargetRate - planBook.ControlRange : planBook.Minimum,\n Maximum: planBook.ControlRange ? planBook.TargetRate + planBook.ControlRange : planBook.Maximum,\n ECStage: planBook.ECStage,\n TargetRate: planBook.TargetRate,\n ControlRange: planBook.ControlRange,\n ReferenceValue: planBook.ReferenceValue,\n Amount: planBook.Amount,\n DeadBioMass: planBook.DeadBioMass,\n Driver: planBook.Driver,\n Machine: planBook.Machine,\n Instrument: planBook.Instrument,\n Duration: planBook.Duration,\n Date: planBook.FertilizationDate,\n Remaining: this.nFertilizationService.calculateRemainingValue(alreadyApplied, needValue ?? null),\n ColumnLoading: false,\n AvgNUptake: 0\n };\n }));\n }\n }\n\n private _getNPlanningPlanBookData(fieldGeomId: IGuid): INFertilizationPlanningPlanBookData {\n return this._nPlanBooks.Find(_ => _.FieldGeomId === fieldGeomId);\n }\n\n private _createGridDataObjects(isApplicationMap: boolean): void {\n this._nPlanBooks = [];\n const selectedFields = this._selectedFields$.getValue();\n selectedFields.map((field) => {\n const operationModeFromForm = this._operationModeAppSetting?.OperationMode;\n const applicationModeFromForm = this._formValues['Application'] as ApplicationModesEnum;\n const operationModeKey = this.nFertilizationPlantProtectionService.getOperationModeForPlan(operationModeFromForm,\n field.ScanData, this._operationModeAppSetting?.ApplicationSetting);\n const applicationModeKey = this.nFertilizationPlantProtectionService.getApplicationModeForPlan(operationModeKey,\n applicationModeFromForm, field.ScanData);\n const slope = this.nFertilizationPlantProtectionService.getSlope(operationModeKey, this._formValues['ControlFactor'],\n this._isRapeCrop, this._operationModeAppSetting?.ApplicationSetting);\n const controlFactorDescription = this.nFertilizationPlantProtectionService.getControlFactorDescription(operationModeKey,\n slope, this._operationModeAppSetting?.ApplicationSetting, false);\n const nPlanBook = {\n PlanId: isApplicationMap ? ApGuidUtil.generateNewGuid() : ApGuidUtil.getEmptyGuid(),\n FieldGeomId: field?.Geom?.Id,\n FieldId: field.Id,\n OperationModeKey: operationModeKey,\n ApplicationModeKey: applicationModeKey,\n ProductId: !this._formValues['Product'] ? 0 : this._formValues['Product'],\n CropTypeMapId: this.cropTypeStore.getCropTypeMapId(field.CropId),\n Minimum: this._formValues['Minimum'],\n Maximum: this._formValues['Maximum'],\n Threshold: this._formValues['Threshold'] ?? this._formValues['Constant'],\n ThresholdAbs: undefined,\n ControlFactor: slope,\n Amount: this._formValues['Amount'],\n nUptake: this.nFertilizationCommonEntryService.nUptake(operationModeKey, field.ScanData),\n AvgAmount: this._formValues['AvgAmount'],\n ECStage: this._formValues['ECStage'],\n Constant: this._formValues['Constant'],\n DeadBioMass: this._formValues['DeadBioMass'],\n TargetRate: this._formValues['TargetRate'],\n ControlRange: this._formValues['ControlRange'],\n ReferenceValue: this._formValues['ReferenceValue'],\n Driver: this._formValues['Driver'],\n Machine: this._formValues['Machine'],\n Instrument: this._formValues['Instrument'],\n Duration: this._formValues['Duration'],\n FertilizationDate: this._formValues['FertilizationDate'],\n ControlFactorDescription: controlFactorDescription,\n ColumnLoading: true,\n HasError: false,\n ErrorMessage: '',\n ScanData: field.ScanData,\n } as INFertilizationPlanningPlanBookData;\n if (nPlanBook.OperationModeKey === OperationModesEnum.TargetValue) {\n nPlanBook.Minimum = nPlanBook.TargetRate - nPlanBook.ControlRange;\n nPlanBook.Maximum = nPlanBook.TargetRate + nPlanBook.ControlRange;\n nPlanBook.Constant = nPlanBook.TargetRate;\n }\n if (nPlanBook.OperationModeKey === OperationModesEnum.ApplicationMap) {\n nPlanBook.ThresholdAbs = nPlanBook.ScanData.NUptakeAvg * (nPlanBook.Threshold / 100);\n }\n this._nPlanBooks.Add(nPlanBook);\n });\n }\n\n private _createGeneral(operationModeAppSetting: IOperationModeAppSetting, applicationMode: ApplicationModesEnum): ApDynformsConfigFieldset[] {\n const result: ApDynformsConfigFieldset[] = [];\n const crops = this._selectedFields$.getValue()\n .map((f) => f.Crop)\n .filter((v, i, a) => !!v && a.indexOf(v) === i);\n result.Add(new ApDynformsConfigFieldset({\n key: 'Information',\n legend: 'Global__Information',\n classList: 'ap-error-no-border',\n config: [\n new ApDynformsConfigTextbox({\n key: 'Count_Fields',\n label: 'AgriConnect__Count_Fields',\n disabled: true,\n value: this._selectedFields$.getValue().length\n }),\n new ApDynformsConfigTextbox({\n key: 'TotalArea',\n label: 'Nutrients__TotalArea_ha',\n disabled: true,\n value: this.roundNumericService.round(this._selectedFields$.getValue()\n .filter((f) => !!f.Area).reduce((sum, o) => sum + o.Area, 0),\n this.settingsStore.FirstSetting.DigitsAfterDecimalPoint)\n }),\n new ApDynformsConfigTextarea({\n key: 'Crops',\n label: 'Settings__Lbl_Menu_Croptypes',\n disabled: true,\n rows: crops.length > 1 ? 2 : 1,\n value: crops.length ? crops.reduce((a, b) => a === '' ? b : `${a}\\n${b}`, '') : '-'\n })\n ]\n }));\n const applicationModes = this._getApplicationMode();\n const selectedYear = this.campaignYearStore.getSelectedCampaignYear();\n result.Add(new ApDynformsConfigFieldset({\n key: 'General',\n legend: 'Global__General_Information',\n config: [\n new ApDynformsConfigComboBox({\n key: 'Application',\n label: 'Nutrients_ClientClasses__Application',\n options: applicationModes,\n valueField: 'key',\n textField: 'text',\n value: applicationMode,\n translate: true,\n validators: [\n new ApDynformsValidator({validator: Validators.required, errorKey: 'Settings__Msg_Vali_Value_Required'}),\n ]\n }),\n new ApDynformsConfigComboBox({\n key: 'OperationMode',\n label: 'Global__OperationMode',\n valueField: nameOf('Id'),\n textField: nameOf('Text'),\n infoText: 'Infotext__NF_OperationMode',\n options: this._operationModeAppSettings,\n groupByField: nameOf('Category'),\n value: this._getOperationModeForDetailsForm(operationModeAppSetting)?.Id,\n translate: true,\n validators: [\n new ApDynformsValidator({validator: Validators.required})\n ]\n }),\n new ApDynformsConfigDatepicker({\n key: 'FertilizationDate',\n label: 'Nutrients__FertilizationDate',\n minDate: this.dateService.toJsDate(this.dateService.toFarmDateFromUtc(selectedYear.DefaultStart)),\n maxDate: this.dateService.toJsDate(this.dateService.toFarmDateFromUtc(selectedYear.DefaultEnd)),\n value: this._formValues['FertilizationDate']\n ? this._formValues['FertilizationDate']\n : new Date(Math.min(new Date().valueOf(), new Date(selectedYear.DefaultEnd).valueOf()))\n }),\n new ApDynformsConfigTextbox({\n key: 'Note',\n label: 'Global__Note',\n value: this._formValues['Note']\n })\n ]\n }));\n if (operationModeAppSetting?.OperationMode !== OperationModesEnum.Bonitur) {\n result.Add(this.generalConfig.getProductFieldSet(this._formValues, this.dynComponent.FormValues$));\n }\n return result;\n }\n\n private _getOperationModeForDetailsForm(operationModeAppSetting: IOperationModeAppSetting): IOperationModeAppSetting {\n if (this._operationModeAppSettings.length === 0) {\n return undefined;\n }\n if (this._operationModeAppSettings.length === 1) {\n return this._operationModeAppSettings[0];\n }\n if (operationModeAppSetting) {\n return operationModeAppSetting;\n }\n return this._operationModeAppSettings.FirstOrDefault(x => x.Id === this._formValues['OperationMode']);\n }\n\n private _createForm(application: ApplicationModesEnum | undefined,\n operationModeAppSetting: IOperationModeAppSetting | undefined): ApDynformsConfigFieldset[] {\n const isFieldsForModal = false;\n const selectedFields = this._selectedFields$.getValue();\n const copiedFormValues = ObjectFactory.Copy(this._formValues);\n // Define which application mode we should to take.\n // From parameters, from summary or select default\n let applicationModeForm = application\n ?? ((this.nPlanningEntryService.componentData.Summary?.ApplicationMode?.Key as ApplicationModesEnum)\n ?? (this._isVariablePossible() ? ApplicationModesEnum.Variable : ApplicationModesEnum.Constant));\n this._updateOperationModeAppSettings(applicationModeForm);\n // Define which operation mode settings we should to take.\n // In case it's null from parameters we need to take if from summary (operation mode and growth stage)\n // Or select default in case summary do not have any info\n if (!operationModeAppSetting) {\n const growthStage = copiedFormValues['EcValue']\n ?? this.nPlanningEntryService.componentData.Summary?.ECValue\n ?? undefined;\n const operationModeFromSummary = this.nPlanningEntryService.componentData.Summary?.OperationMode?.Key as OperationModesEnum;\n operationModeAppSetting = this._operationModeAppSettings.find(x => x.OperationMode === operationModeFromSummary\n && x.ApplicationSetting?.EcMin <= growthStage && x.ApplicationSetting?.EcMax >= growthStage);\n if (!operationModeAppSetting) {\n applicationModeForm = this._isVariablePossible() ? ApplicationModesEnum.Variable : ApplicationModesEnum.Constant;\n this._updateOperationModeAppSettings(applicationModeForm);\n operationModeAppSetting = this._operationModeAppSettings.find(x => x.ApplicationMode === applicationModeForm);\n }\n } else {\n operationModeAppSetting = this._operationModeAppSettings.find(x => x.Id === operationModeAppSetting.Id);\n if (!operationModeAppSetting) {\n operationModeAppSetting = this._operationModeAppSettings.find(x => x.ApplicationMode === applicationModeForm);\n }\n }\n this._operationModeAppSetting = operationModeAppSetting;\n this.nPlanningEntryService.createSummaryAndApplyValues(applicationModeForm, operationModeAppSetting.OperationMode,\n this.data?.PlanBooks, copiedFormValues);\n let result = this._createGeneral(operationModeAppSetting, applicationModeForm);\n if (applicationModeForm === ApplicationModesEnum.Variable) {\n if (this.nFertilizationCommonEntryService.isApplicationMapOrAbsolute(operationModeAppSetting.OperationMode)) {\n this.nFertilizationPlantProtectionService.onApplicationSettingsTextWarning(\n selectedFields.map(x => x.ScanData),\n this._operationModeAppSetting?.ApplicationSetting);\n }\n switch (operationModeAppSetting.OperationMode) {\n case OperationModesEnum.ApplicationMap:\n this.applicationMapConfig.updateFormValuesByParameters(copiedFormValues,\n selectedFields, this._operationModeAppSetting?.ApplicationSetting);\n result = result.concat(\n this.applicationMapConfig.formBuilder(\n copiedFormValues,\n this.dynComponent.FormValues$.pipe(delay(0)),\n this._operationModeAppSetting?.ApplicationSetting,\n isFieldsForModal,\n this.diagramTemplateRef\n )\n );\n break;\n case OperationModesEnum.ApplicationMapAbsolute:\n this.applicationMapAbsoluteConfig.updateFormValuesByParameters(copiedFormValues,\n selectedFields, this._selectedFieldsCropType.CropKey, this._operationModeAppSetting?.ApplicationSetting);\n const areaWeightedAverage = this.nFertilizationCommonService.calculateAreaWeightedAverage(\n selectedFields.map(x => ({Area: x.Area, Average: x.ScanData.NUptakeAvg}))\n );\n result = result.concat(\n this.applicationMapAbsoluteConfig.formBuilder(\n copiedFormValues,\n this.dynComponent.FormValues$.pipe(delay(0)),\n areaWeightedAverage,\n this._selectedFieldsCropType.CropKey,\n this._operationModeAppSetting?.ApplicationSetting,\n isFieldsForModal,\n this.diagramTemplateRef\n )\n );\n break;\n case OperationModesEnum.TargetValue:\n result = result.concat(\n this.targetRateConfig.formBuilder(\n copiedFormValues, this.dynComponent.FormValues$,\n this._isRapeCrop,\n isFieldsForModal, this.diagramTemplateRef\n )\n );\n break;\n case OperationModesEnum.NFertilization:\n result = result.concat(\n this.nFertilizationConfig.formBuilderConfig(\n copiedFormValues, this.dynComponent.FormValues$, this._selectedFieldsCropType.Id,\n this._selectedFieldsCropType.CropKey, isFieldsForModal, this.diagramTemplateRef\n )\n );\n break;\n case OperationModesEnum.RapeFertilization:\n result = result.concat(this.rapeFertilizationConfig.formBuilderConfig(copiedFormValues,\n this.dynComponent.FormValues$, this._selectedFieldsCropType.CropKey, isFieldsForModal));\n break;\n case OperationModesEnum.Bonitur:\n result = result.concat(this.boniturConfig.formBuilder(copiedFormValues, isFieldsForModal));\n break;\n }\n } else if (application === ApplicationModesEnum.Constant) {\n result.Add(this.uniformConfig.formBuilder(copiedFormValues, this.dynComponent.FormValues$,\n isFieldsForModal));\n }\n result.Add(this.generalConfig.getDocuFieldSet(\n copiedFormValues,\n this.dynComponent.FormValues$,\n this.dynComponent.dynForm.form.getRawValue,\n isFieldsForModal));\n return result;\n }\n\n private _getFieldSets(dataItem: any, values$: Observable): ApDynformsConfigFieldset[] {\n let fieldSet = [];\n const isFieldsForModal = true;\n const operationMode = dataItem['OperationMode'] as OperationModesEnum;\n const copiedFormValues = ObjectFactory.Copy(this._formValues);\n switch (operationMode) {\n case OperationModesEnum.ApplicationMap:\n fieldSet = fieldSet.concat(\n this.applicationMapConfig.formBuilder(\n copiedFormValues,\n values$.pipe(delay(0)),\n this._operationModeAppSetting?.ApplicationSetting,\n isFieldsForModal\n )\n );\n break;\n case OperationModesEnum.ApplicationMapAbsolute:\n const selectedItems = this._selectedFields$.getValue();\n const areaWeightedAverage = this.nFertilizationCommonService.calculateAreaWeightedAverage(\n selectedItems.map(x => ({Area: x.Area, Average: x.ScanData.NUptakeAvg}))\n );\n fieldSet = fieldSet.concat(\n this.applicationMapAbsoluteConfig.formBuilder(\n copiedFormValues,\n values$.pipe(delay(0)),\n areaWeightedAverage,\n this._selectedFieldsCropType.CropKey,\n this._operationModeAppSetting?.ApplicationSetting,\n isFieldsForModal\n )\n );\n break;\n case OperationModesEnum.TargetValue:\n fieldSet = fieldSet.concat(\n this.targetRateConfig.formBuilder(copiedFormValues, values$.pipe(delay(0)), this._isRapeCrop, isFieldsForModal)\n );\n break;\n case OperationModesEnum.NFertilization:\n fieldSet = fieldSet.concat(\n this.nFertilizationConfig.formBuilderConfig(copiedFormValues, values$.pipe(delay(0)),\n this._selectedFieldsCropType.Id, this._selectedFieldsCropType.CropKey, isFieldsForModal)\n );\n break;\n case OperationModesEnum.RapeFertilization:\n fieldSet = fieldSet.concat(this.rapeFertilizationConfig.formBuilderConfig(copiedFormValues,\n values$.pipe(delay(0)), this._selectedFieldsCropType.CropKey, isFieldsForModal));\n break;\n case OperationModesEnum.Bonitur:\n fieldSet = fieldSet.concat(this.boniturConfig.formBuilder(copiedFormValues, isFieldsForModal));\n break;\n case OperationModesEnum.Constant:\n fieldSet = fieldSet.concat(this.uniformConfig.formBuilder(copiedFormValues, this.dynComponent.FormValues$,\n isFieldsForModal));\n break;\n }\n fieldSet.Add(\n this.generalConfig.getDocuFieldSet(\n copiedFormValues,\n values$.pipe(delay(0)),\n this.modalDialogStore.getFormValues,\n true\n )\n );\n return fieldSet;\n }\n\n private _getStatus(mainCropId: number, sensorData: ISensorFieldData): IGridStatus {\n const cropType = this.cropTypeStore.getDefaultCroptype(mainCropId);\n const result = {state: undefined, class: undefined, description: undefined} as IGridStatus;\n // Calculate status => APV49-2363\n if (cropType && cropType.IsSensorCrop === true && (!sensorData || sensorData?.CropKey < 1 || cropType.CropKey === sensorData?.CropKey)) {\n result.state = 1;\n result.class = 'ap-status-green';\n result.description = 'Global__Variable_Planning_Possible';\n } else if (!cropType || cropType?.Id < 0) {\n result.state = 0;\n result.class = 'ap-status-yellow';\n result.description = 'Global__No_Var_Planning_Crop';\n } else if (cropType && !cropType?.IsSensorCrop) {\n result.state = 0;\n result.class = 'ap-status-yellow';\n result.description = 'Global__No_Var_Planning_SensorCrop';\n // APV49-2586: Spezielles Handling für den Fall, dass Fruch != Sensorfrucht\n // Gelber Status mit Hinweis, dennoch soll variable Planung möglich sein → State = 1\n } else if (cropType && sensorData && cropType.Id !== sensorData.CroptypeId) {\n result.state = 1;\n result.class = 'ap-status-yellow';\n result.description = 'Global__Crop_not_equals_SensorCrop';\n } else {\n result.state = -1;\n result.class = 'ap-status-red';\n result.description = '';\n }\n return result;\n }\n\n private _getApplicationMode(): any[] {\n const result = [\n {key: ApplicationModesEnum.Constant, text: ApplicationModesEnum.Constant},\n ];\n if (this._isVariablePossible()) {\n result.push(\n {key: ApplicationModesEnum.Variable, text: ApplicationModesEnum.Variable}\n );\n }\n return result;\n }\n\n private _updateOperationModeAppSettings(applicationMode: ApplicationModesEnum): void {\n this._operationModeAppSettings = [];\n if (applicationMode === ApplicationModesEnum.Constant) {\n this._operationModeAppSettings.push({\n Id: OperationModesEnum.Constant,\n OperationMode: OperationModesEnum.Constant,\n ApplicationMode: ApplicationModesEnum.Constant,\n Text: OperationModesEnum.Constant,\n Category: 'OperationMode_Group_Map',\n ApplicationSetting: undefined\n });\n return;\n }\n if (applicationMode !== ApplicationModesEnum.Variable) {\n return;\n }\n this._operationModeAppSettings = [{\n Id: OperationModesEnum.Bonitur,\n OperationMode: OperationModesEnum.Bonitur,\n ApplicationMode: ApplicationModesEnum.Variable,\n Text: OperationModesEnum.Bonitur,\n Category: 'OperationMode_Group_Task',\n ApplicationSetting: undefined\n }];\n if (this._isRapeCrop) {\n this._operationModeAppSettings.push({\n Id: OperationModesEnum.RapeFertilization,\n OperationMode: OperationModesEnum.RapeFertilization,\n ApplicationMode: ApplicationModesEnum.Variable,\n Text: OperationModesEnum.RapeFertilization,\n Category: 'OperationMode_Group_Task',\n ApplicationSetting: undefined\n });\n }\n this._operationModeAppSettings.push({\n Id: OperationModesEnum.NFertilization,\n OperationMode: OperationModesEnum.NFertilization,\n ApplicationMode: ApplicationModesEnum.Variable,\n Text: OperationModesEnum.NFertilization,\n Category: 'OperationMode_Group_Task',\n ApplicationSetting: undefined\n });\n this._operationModeAppSettings.push({\n Id: OperationModesEnum.TargetValue,\n OperationMode: OperationModesEnum.TargetValue,\n ApplicationMode: ApplicationModesEnum.Variable,\n Text: OperationModesEnum.TargetValue,\n Category: 'OperationMode_Group_Task',\n ApplicationSetting: undefined\n });\n const selectedFieldsData = this._selectedFields$.getValue();\n if (selectedFieldsData.some(x => x.ScanData.Status.state === 1)) {\n const ecValues = selectedFieldsData.map(x => x?.ScanData?.Ec);\n const applicationMapAbsoluteSettings = this.applicationSettingsService.getApplicationSettingsForEppoAndEcRange(\n OperationModesEnum.ApplicationMapAbsolute,\n selectedFieldsData[0].EppoCode, ecValues\n );\n for (const applicationSetting of applicationMapAbsoluteSettings) {\n const applicationSettingName = applicationSetting.TranslationKey != null ?\n ` (${this.translationStore.FindTranslationForSelectedLanguage(applicationSetting.TranslationKey)})` : '';\n this._operationModeAppSettings.push({\n Id: `${OperationModesEnum.ApplicationMapAbsolute}-${applicationSetting.Id}`,\n OperationMode: OperationModesEnum.ApplicationMapAbsolute,\n ApplicationMode: ApplicationModesEnum.Variable,\n Text: `${this.translationStore.FindTranslationForSelectedLanguage(OperationModesEnum.ApplicationMapAbsolute)}${applicationSettingName}`,\n Category: 'OperationMode_Group_Map',\n ApplicationSetting: applicationSetting\n });\n }\n const applicationMapSettings = this.applicationSettingsService.getApplicationSettingsForEppoAndEcRange(\n OperationModesEnum.ApplicationMap,\n selectedFieldsData[0].EppoCode, ecValues\n );\n for (const applicationSetting of applicationMapSettings) {\n const applicationSettingName = applicationSetting.TranslationKey != null ?\n ` (${this.translationStore.FindTranslationForSelectedLanguage(applicationSetting.TranslationKey)})` : '';\n this._operationModeAppSettings.push({\n Id: `${OperationModesEnum.ApplicationMap}-${applicationSetting.Id}`,\n OperationMode: OperationModesEnum.ApplicationMap,\n ApplicationMode: ApplicationModesEnum.Variable,\n Text: `${this.translationStore.FindTranslationForSelectedLanguage(OperationModesEnum.ApplicationMap)}${applicationSettingName}`,\n Category: 'OperationMode_Group_Map',\n ApplicationSetting: applicationSetting\n });\n }\n }\n return;\n }\n\n private _canSaveCheck(canSave: boolean): void {\n if (canSave && this.nFertilizationPlantProtectionService.isOperationModeAnyOfMapsOrConstant(this._operationModeAppSetting.OperationMode)) {\n const stat = this.nFertilizationStore.Listen(s => s.fieldNPlanningStatistic).getValue();\n if (stat === null || stat.length === 0) {\n return;\n }\n const ids = stat.map(_ => _.PlanId);\n this.mapStore.Layers.NPlanningLayerSourceInit(this.routerStore.Listen(s => s.url).getValue(), ids);\n const statistic = {\n Max: stat.Reduce((target, ele) => {\n if (ele.Max > target) {\n return ele.Max;\n }\n return target;\n }, 0),\n ElementId: 5,\n ProductId: this._formValues['Product'],\n Min: stat.Reduce((target, ele) => {\n return target < ele.Min ? target : ele.Min;\n }, stat.FirstOrDefault().Min),\n Average: stat.Reduce((target, ele) => {\n if (target < ele.Mean) {\n return ele.Mean;\n }\n return target;\n }, 0)\n };\n if (statistic.Average === 0) {\n this._clearMap();\n } else {\n this.mapStore.Legends.onNPlanningChanged.emit(statistic);\n }\n }\n }\n\n private _save(): void {\n const counts = this.items$.getValue().reduce((acc, item) => {\n if (item['ECStage'] in acc) {\n acc[item['ECStage']]++;\n } else {\n acc[item['ECStage']] = 1;\n }\n return acc;\n }, {});\n let mostFrequentValue = null;\n let highestCount = 0;\n for (const value in counts) {\n if (counts[value] > highestCount) {\n highestCount = counts[value];\n mostFrequentValue = value;\n }\n }\n const formsOperationMode = this._operationModeAppSetting?.OperationMode;\n const summaryApplicationMode = this.applicationModesStore.Listen(s => s.data).getValue().Find((a) => a.Key === this._formValues['Application']);\n const summaryOperationMode = this.operationModesStore.Listen(s => s.data).getValue().Find((o) => o.Key === formsOperationMode);\n // Do the _summaryForEdit plain or simple in file\n const summary = {\n ApplicationDate: this.dateService.getDateNoon(this._formValues['FertilizationDate']),\n AdditionalValue: {\n DeadBiomass: this._formValues['DeadBioMass'] ?? null,\n ExpectedYield: this._formValues['YieldExpectation'] ?? null,\n NMinPotential: this._formValues['Potential'] ?? null\n },\n ApplicationMode: summaryApplicationMode,\n ECValue: mostFrequentValue,\n OperationMode: summaryOperationMode,\n Slope: this.nFertilizationPlantProtectionService.getSlope(formsOperationMode, this._formValues['ControlFactor'],\n this._isRapeCrop, this._operationModeAppSetting?.ApplicationSetting),\n Threshold: this._formValues['Threshold'],\n Title: this._formValues['Note'],\n Unit: this.unitStore.getUnit('kgN/ha'),\n UserApplicationConstant: summaryOperationMode.Key === OperationModesEnum.TargetValue\n ? this._formValues['TargetRate'] : this._formValues['Constant'],\n UserApplicationMaximum: summaryApplicationMode.Key !== ApplicationModesEnum.Constant\n ? summaryOperationMode.Key !== OperationModesEnum.TargetValue\n ? this._formValues['Maximum']\n : this._formValues['TargetRate'] + this._formValues['ControlRange']\n : this._formValues['Constant'],\n UserApplicationMinimum: summaryApplicationMode.Key !== ApplicationModesEnum.Constant\n ? summaryOperationMode.Key !== OperationModesEnum.TargetValue\n ? this._formValues['Minimum']\n : this._formValues['TargetRate'] - this._formValues['ControlRange']\n : this._formValues['Constant'],\n UserApplicationRate: summaryApplicationMode.Key !== ApplicationModesEnum.Constant\n ? summaryOperationMode.Key !== OperationModesEnum.TargetValue\n ? this._formValues['Amount']\n : this._formValues['TargetRate']\n : this._formValues['Constant'],\n FarmId: this.loginStore.SelectedFarmId,\n } as INFertilizationSummary;\n const fields = this._selectedFields$.getValue();\n const planBooks = this.items$.getValue().map((item) => {\n const field = fields.find((f) => f.Id === item.Id);\n const nPlanningPlanBookData = this._getNPlanningPlanBookData(field.Geom.Id);\n const planId = item.PlanId !== undefined ? item.PlanId : ApGuidUtil.getEmptyGuid();\n const planBookApplicationMode = this.applicationModesStore.Listen(s => s.data).getValue().Find((a) => a.Key === item.ApplicationMode);\n const planBookOperationMode = this.operationModesStore.Listen(s => s.data).getValue().Find((o) => o.Key === item.OperationMode);\n return {\n Id: planId,\n ProductId: !this._formValues['Product'] ? 0 : this._formValues['Product'],\n ApplicationMode: planBookApplicationMode,\n OperationMode: planBookOperationMode,\n FieldGeomId: field.Geom.Id,\n MainCropId: field.CropId,\n ApplicationDate: this.dateService.getDateNoon(item['Date']),\n ApplicationConst: item['Constant'],\n ApplicationMax: planBookApplicationMode.Key === ApplicationModesEnum.Constant ? item['Constant'] : item['Maximum'],\n ApplicationMin: planBookApplicationMode.Key === ApplicationModesEnum.Constant ? item['Constant'] : item['Minimum'],\n ApplicationRate: item['TargetRate']\n ? item['TargetRate']\n : (planBookApplicationMode.Key === ApplicationModesEnum.Constant ? item['Constant'] : item['Amount']),\n ECValue: item['ECStage'],\n Element: ApElementType.N,\n Factor: 1,\n Slope: nPlanningPlanBookData.ControlFactor,\n SecondCropId: field.SecondCropId,\n Summary: summary,\n Threshold: nPlanningPlanBookData.Threshold,\n FarmId: this.loginStore.SelectedFarmId,\n FieldId: item.Id,\n ExportDriver: item['Driver']?.Id ?? null,\n ExportMachine: item['Machine']?.Id ?? null,\n ExportInstrument: item['Instrument']?.Id ?? null,\n Geom: this.fieldStore.getCurrentFieldGeom(field.Id.toString())?.Geom,\n Unit: this.unitStore.getUnit('kgN/ha'),\n } as INFertilizationPlanBook;\n });\n this.nFertilizationStore.SaveNFertilizationPlanning(planBooks);\n }\n\n private _isRemainingValueCouldBeApplied(operationModeKey: string): boolean {\n return this.nFertilizationCommonEntryService.isApplicationMapOrAbsolute(operationModeKey as OperationModesEnum)\n || operationModeKey === OperationModesEnum.Constant\n || operationModeKey === OperationModesEnum.TargetValue;\n }\n\n private _updateOverviewItems(submitData: { ids: any[], value: any }): void {\n this.items$.getValue().forEach((planBookGridItem) => {\n if (submitData.ids.includes(planBookGridItem.Id)) {\n const date = planBookGridItem.Date;\n const copiedPlanBookGridItem = ObjectFactory.Copy(planBookGridItem);\n const copiedSubmitDataValue = ObjectFactory.Copy(submitData.value);\n planBookGridItem = ObjectFactory.Merge(copiedPlanBookGridItem, copiedSubmitDataValue);\n planBookGridItem.Date = date;\n if (planBookGridItem['OperationMode'] === OperationModesEnum.TargetValue) {\n planBookGridItem['Minimum'] = planBookGridItem['TargetRate'] - planBookGridItem['ControlRange'];\n planBookGridItem['Maximum'] = planBookGridItem['TargetRate'] + planBookGridItem['ControlRange'];\n planBookGridItem['Constant'] = planBookGridItem['TargetRate'];\n }\n const planBook = this._getNPlanningPlanBookData(planBookGridItem['Geom']?.Id);\n planBook.ErrorMessage = '';\n planBook.HasError = false;\n planBook.ECStage = Number.isFinite(planBookGridItem['ECStage']) ? planBookGridItem['ECStage'] : planBook.ECStage;\n planBook.Minimum = Number.isFinite(planBookGridItem['Minimum']) ? planBookGridItem['Minimum'] : planBook.Minimum;\n planBook.Maximum = Number.isFinite(planBookGridItem['Maximum']) ? planBookGridItem['Maximum'] : planBook.Maximum;\n planBook.Threshold = Number.isFinite(planBookGridItem['Threshold']) ? planBookGridItem['Threshold'] : planBook.Threshold;\n planBook.ControlFactor = Number.isFinite(planBookGridItem['ControlFactor']) ? planBookGridItem['ControlFactor'] : planBook.ControlFactor;\n planBook.ControlFactorDescription = this.nFertilizationPlantProtectionService.getControlFactorDescription(\n this._operationModeAppSetting?.OperationMode, planBook.ControlFactor,\n this._operationModeAppSetting?.ApplicationSetting, false);\n planBook.Amount = Number.isFinite(planBookGridItem['TargetRate']) ? planBookGridItem['TargetRate'] : planBookGridItem['Amount'];\n planBook.Constant = planBookGridItem['Constant'];\n planBook.DeadBioMass = planBookGridItem['DeadBioMass'];\n planBook.Driver = planBookGridItem['Driver'];\n planBook.Instrument = planBookGridItem['Instrument'];\n planBook.Machine = planBookGridItem['Machine'];\n if (this._operationModeAppSetting?.OperationMode === OperationModesEnum.TargetValue) {\n planBook.ControlRange = Number.isFinite(planBookGridItem['ControlRange']) ? planBookGridItem['ControlRange'] : planBook.ControlRange;\n planBook.TargetRate = Number.isFinite(planBookGridItem['TargetRate']) ? planBookGridItem['TargetRate'] : planBook.TargetRate;\n }\n if (planBook.OperationModeKey === OperationModesEnum.ApplicationMap) {\n planBook.ThresholdAbs = planBook.ScanData.NUptakeAvg * (planBook.Threshold / 100);\n }\n if (this.nFertilizationPlantProtectionService.isOperationModeAnyOfMapsOrConstant(this._operationModeAppSetting?.OperationMode)) {\n planBook.ColumnLoading = true;\n this._initializeGridOverviewItem(true, false);\n this._createNPlanningRasterJob(\n planBook.PlanId,\n planBook.ScanData,\n planBook.FieldGeomId,\n this.applicationModesStore.Listen(s => s.data).getValue().Find((a) => a.Key === planBookGridItem['ApplicationMode']).Id,\n planBook.nUptake ?? null,\n planBook.Minimum,\n planBook.Maximum,\n planBook.ThresholdAbs ?? planBook.Threshold,\n planBook.ControlFactor,\n planBook.Amount,\n planBook.Constant,\n planBook.DeadBioMass\n );\n } else {\n this._initializeGridOverviewItem(false, false);\n }\n }\n });\n }\n\n private _createNPlanningRasterJob(planId: IGuid, bestScan: BestScanData, fieldGeomId: IGuid, applicationMode: number,\n nUptake: number | undefined, minimum: number, maximum: number, threshold: number,\n slope: number, appleRate: number, constant: number, deadBioMass: number): void {\n const nFertPlanId = bestScan?.ScanType === BestScanType.NFertilizationSensor\n ? bestScan.PlanId : ApGuidUtil.getEmptyGuid();\n const ppPlanId = bestScan?.ScanType === BestScanType.PlantProtectionSensor\n ? bestScan.PlanId : ApGuidUtil.getEmptyGuid();\n const satelliteId = bestScan?.ScanType === BestScanType.SatelliteScan\n ? bestScan.SatId : ApGuidUtil.getEmptyGuid();\n const satelliteScanType = bestScan?.ScanType === BestScanType.SatelliteScan && bestScan?.SatelliteScan === ScanType.Autumn\n ? ScanType.Autumn : ScanType.Regular;\n const planningData: INPlanningData = {\n PlanId: planId,\n NdPlanId: nFertPlanId,\n PpPlanId: ppPlanId,\n SatId: satelliteId,\n AutumnScan: satelliteScanType,\n NUptake: nUptake ?? null,\n FieldGeomId: fieldGeomId,\n ApplicationMode: applicationMode,\n Minimum: minimum,\n Maximum: maximum,\n Constant: constant,\n Slope: slope,\n DeadBioMass: deadBioMass,\n Threshold: threshold,\n AppleRate: appleRate\n };\n this.nFertilizationStore.CreateNPlanningRasterJob(planningData);\n }\n\n private _createNPlanningJob(): void {\n this._clearMap();\n this._nPlanBooks.forEach((item) => {\n const applicationMode = this.applicationModesStore.Listen(s => s.data).getValue().Find((a) => a.Key === item.ApplicationModeKey);\n this._createNPlanningRasterJob(\n item.PlanId,\n item.ScanData,\n item.FieldGeomId,\n applicationMode.Id,\n item.nUptake ?? null,\n item.Minimum,\n item.Maximum,\n item.ThresholdAbs ?? item.Threshold,\n item.ControlFactor,\n item.OperationModeKey === OperationModesEnum.Constant\n ? 0\n : item.TargetRate ? item.TargetRate : item.Amount,\n item.Constant,\n item.DeadBioMass\n );\n });\n }\n\n private _clearMap(): void {\n MapFactoryStyler.Instance.clearStyleCache();\n this.mapStore.Layers.NApplicationMapLayer.clear();\n this.mapStore.Layers.Clear();\n this.mapStore.Legends.removeLegend(this.mapStore.Legends.NPlanningLegend);\n }\n\n private _fieldSelection(): void {\n if (this._currentStep === ApBaseWizardSteps.Selection) {\n let selectedFieldIds: string[];\n const selectedFieldItems = (this.dynComponent.getSelectedItems() as INFertilizationPlanFieldToSelectGridItem[]);\n if (selectedFieldItems?.length > 0) {\n selectedFieldIds = selectedFieldItems.map(x => x.Id.toString());\n this.fieldStore.changeSelectedField(selectedFieldIds);\n } else {\n this.fieldStore.zoomFarmFields();\n }\n return;\n }\n if (this._currentStep === ApBaseWizardSteps.Overview) {\n let selectedFieldIds: string[];\n const selectedPlanFields = this.dynComponent.getSelectedItems();\n if (selectedPlanFields?.length > 0) {\n selectedFieldIds = selectedPlanFields.map(x => x.Id.toString());\n } else {\n selectedFieldIds = this.dynComponent.items.map(x => x.Id.toString());\n }\n this.fieldStore.changeSelectedField(selectedFieldIds);\n }\n }\n\n private _generateStats(): void {\n if (this._currentStep === ApBaseWizardSteps.Selection) {\n // TODO: Wir brauchen hier ein vernünftiges Model für die items. Bis zum refactoring verwenden wir hier any.\n let items = this.dynComponent.getSelectedItems() as INFertilizationPlanFieldToSelectGridItem[];\n if (!items || items.length <= 0) {\n // fallback => use all if nothing is selected\n items = this.dynComponent.items as INFertilizationPlanFieldToSelectGridItem[];\n }\n // put it on top of callstack to avoid lagging when user changes the selection\n setTimeout(() => {\n this.nPlanningEntryService.generateFieldStatistic(items);\n });\n return;\n }\n if (this._currentStep === ApBaseWizardSteps.Details) {\n // put it on top of callstack to avoid lagging when user changes the selection\n setTimeout(() => {\n this.nPlanningEntryService.generateFieldStatistic(this._selectedFields$.getValue());\n });\n return;\n }\n if (this._currentStep === ApBaseWizardSteps.Overview\n && this.nFertilizationPlantProtectionService.isOperationModeAnyOfMapsOrConstant(this._operationModeAppSetting?.OperationMode)) {\n // put it on top of callstack to avoid lagging when user changes the selection\n setTimeout(() => {\n this.nPlanningEntryService.generateOverviewStatistic(this._operationModeAppSetting?.OperationMode,\n this.dynComponent.getSelectedItems(), this.dynComponent.items);\n });\n return;\n }\n this.statisticStore.removeStatisticData();\n }\n\n private _isVariablePossible(): boolean {\n return this._selectedFields$?.getValue()?.some((f) => f.Status === 1) ?? false;\n }\n\n private _onCloseForm(): void {\n this._clearMap();\n this.statisticStore.removeStatisticData();\n setTimeout(() => this.formStore.closeForm(), 1);\n }\n\n private getDefaultBestScanStatus(): IGridStatus {\n return {\n state: -1,\n class: 'ap-status-grey',\n description: ''\n };\n }\n}\n","import IGuid = System.IGuid;\n\nexport interface INFertilizationOverviewGridDetailsItem {\n Id: IGuid;\n PlanBookId: IGuid;\n FieldId: IGuid;\n Status: number;\n StatusClass: string | null;\n StatusDesc: string | null;\n ProductName: string;\n ProductId: number | null;\n CropKey: number | null;\n WorkArea: number;\n Administration: string;\n Application: number;\n EC: number;\n Date: Date;\n MidnightDate: Date;\n ProductTotal: number | null;\n ProductTotalUnit: string;\n FertilizerEfficiency: number | null;\n AlreadyApplied: number | null;\n Absorption: IGridDetailsItemContentRange | null;\n Fertilization: IGridDetailsItemContentRange | null;\n}\n\nexport interface IGridDetailsItemContentRange {\n Min: number;\n Max: number;\n Avg: number;\n}\n\nexport enum NFertilizationOverviewMassEditAction {\n Edit = 0\n}\n","import {\n AfterContentInit,\n ChangeDetectionStrategy,\n Component,\n EventEmitter,\n OnDestroy,\n OnInit,\n ViewChild\n} from '@angular/core';\nimport {BehaviorSubject, combineLatest, Observable, of, Subscription} from 'rxjs';\nimport {Create, ObjectFactory} from 'ts-tooling';\nimport {\n ApDynGridColumnConfigBase,\n ApDynGridColumnHideConfig\n} from '../../ap-dyngrids/config/ap-dyn-grid-column-config-base';\nimport {\n ApDynGridStatusColumnConfig\n} from '../../ap-dyngrids/config/ap-dyn-grid-status-column-config';\nimport {\n ApDynGridPropertyColumnConfig,\n FilterType,\n PropertyTemplate\n} from '../../ap-dyngrids/config/ap-dyn-grid-property-column-config';\nimport {\n ApDynGridGroupColumnConfig\n} from '../../ap-dyngrids/config/ap-dyn-grid-group-column-config';\nimport {\n ApDynGridEditColumnConfig\n} from '../../ap-dyngrids/config/ap-dyn-grid-edit-column-config';\nimport {\n ApDynGridDetailsBaseConfig\n} from '../../ap-dyngrids/config/details/ap-dyn-grid-details-base-config';\nimport {\n ApDynGridDetailsGridConfig\n} from '../../ap-dyngrids/config/details/ap-dyn-grid-details-grid-config';\nimport {\n FieldStore\n} from '../../stores/farm/field.store';\nimport {debounceTime, filter, map} from 'rxjs/operators';\nimport {\n CropRotationStore\n} from '../../stores/farm/crop.rotation.store';\nimport {\n CropTypeStore\n} from '../../stores/base-data/crop.types.store';\nimport {\n LanguageStore\n} from '../../stores/translation/language.store';\nimport {\n CampaignYearStore\n} from '../../stores/login/campaignyear.store';\nimport {ApGridPagerType, ApStatsType, IGridPagerData, MapViewCurrentMenu, MapViewMode} from '../../ap-interface';\nimport {\n MapViewStore\n} from '../../stores/layout/mapview.store';\nimport {\n ApTranslationPipe\n} from '../../translation/pipes/ap-translation.pipe';\nimport {\n ApDynGridPagerConfig,\n IDynGridWizardChoiceData\n} from '../../ap-dyngrids/config/ap-dyn-grid-pager-config';\nimport {\n Icon\n} from '../../ap-interface/enums/layout/icon.enum';\nimport {\n NFertilizationBurgerMenuComponent\n} from '../../entry-components/burger-menu-entry-components/n-fertilization-burger-menu.component';\nimport {\n BurgerMenuStore\n} from '../../stores/map/burger.menu.store';\nimport {\n SettingsStore\n} from '../../stores/base-data/settings.store';\nimport {\n FormStore\n} from '../../stores/layout/form.store';\nimport {\n ApNFertilizationPlanningEntryComponent\n} from '../../entry-components/ap-n-fertilization-entry-components/ap-n-fertilization-planning-entry.component';\nimport {\n ApDynComponentComponent\n} from '../../ap-dyncomponent/ap-dyncomponent.component';\nimport {\n NFertilizationStore\n} from '../../stores/n-fertilization/n-fertilization.store';\nimport {\n ApNFertilizationComponentService\n} from '../services/ap-n-fertilization-component.service';\nimport {\n ApUtilService\n} from '../../ap-utils/service/ap-util.service';\nimport {\n ApShowPointsOnMapService\n} from '../../ap-utils/service/ap-show-points-on-map.service';\nimport {\n ApDateService\n} from '../../ap-core/services/ap-date-service';\nimport {\n ApTranslationService\n} from '../../ap-utils/service/ap-translation.service';\nimport {\n CropApplicationStore\n} from '../../stores/task-management/crop-application.store';\nimport {\n MapStore\n} from '../../stores/map/map.store';\nimport {\n StatisticStore\n} from '../../stores/statistic/statistic.store';\nimport {\n ApNFertilizationCommonService\n} from '../services/ap-n-fertilization.common.service';\nimport {GetRoundNumericPipe} from '../../ap-utils';\nimport {\n ApTooltipContentService\n} from '../../ap-utils/service/ap-tooltip-content.service';\nimport {\n ApGetCropService\n} from '../../stores/services/ap-get-crop.service';\nimport {\n FieldMassEditAction\n} from '../../field-management/components/field-overview.component';\nimport {\n ApDynformsConfigFieldset\n} from '../../ap-dynforms/config/ap-dynforms-config-fieldset';\nimport {\n ApDynformsConfigNumerictextbox\n} from '../../ap-dynforms/config/ap-dynforms-config-numerictextbox';\nimport {\n ApDynformsValidator\n} from '../../ap-dynforms/ap-dynforms-validator';\nimport {Validators} from '@angular/forms';\nimport {\n ApDynformsConfigPlaceholder\n} from '../../ap-dynforms/config/ap-dynforms-config-placeholder';\nimport {\n NotifyStore\n} from '../../stores/dialog/notify.store';\nimport {\n INFertilizationOverviewGridDetailsItem,\n NFertilizationOverviewMassEditAction\n} from '../types/n-fertilization-overview.types';\nimport {\n BasicFertilisationSummariesStore\n} from '../../stores/taskmanagement/basic.fertilisation.summaries.store';\nimport {\n JobsStore\n} from '../../stores/administration/jobs.store';\nimport {\n AgriportConstantsService\n} from '../../services/common/agriport-constants.service';\nimport {\n NFertilizationLogfileStatsData\n} from '../../statistics/components/charts/n-fertilization-logfile-stats/n-fertilization-logfile-stats.types';\nimport {\n PlanningEntryComponentDataType\n} from '../../entry-components/ap-nutrients-management-entry-components/ap-nutrient-planning-configs/nutrient-planning-types';\nimport {\n ApRoleTypeService\n} from '../../services/common/ap-role-type.service';\nimport {\n LoginStore\n} from '../../stores/login/login.store';\nimport {\n GetRoundNumericPipeConfig\n} from '../../ap-utils/pipes/configs/get-round-numeric.pipe.config';\nimport IFieldCrop = Data.FieldManagement.IFieldCrop;\nimport IGuid = System.IGuid;\n\n/**\n * Component for the n fertilization overview\n */\n@Component({\n selector: 'ap-n-fertilization-overview',\n template: `\n \n \n `,\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class ApNFertilizationOverviewComponent implements OnInit, AfterContentInit, OnDestroy {\n @ViewChild(ApDynComponentComponent, {static: true}) dynComponent: ApDynComponentComponent;\n\n public loading$: Observable = of(true);\n public columns$: Observable;\n public details$: Observable;\n public items$ = new BehaviorSubject([]);\n public pager: ApDynGridPagerConfig;\n public halfViewMode$ = new BehaviorSubject(0);\n public halfViewModeChange = new EventEmitter();\n\n private _applyClicked = new EventEmitter();\n private _subscriptions: Subscription[] = [];\n private _afterUpdateProcess = false;\n\n constructor(private jobsStore: JobsStore,\n private burgerMenuStore: BurgerMenuStore,\n private campaignYear: CampaignYearStore,\n private cropApplicationStore: CropApplicationStore,\n private cropRotationStore: CropRotationStore,\n private cropTypeStore: CropTypeStore,\n private dateService: ApDateService,\n private fieldStore: FieldStore,\n private formStore: FormStore,\n private notifyStore: NotifyStore,\n private languageStore: LanguageStore,\n private mapStore: MapStore,\n private mapViewStore: MapViewStore,\n private settingsStore: SettingsStore,\n private statisticStore: StatisticStore,\n private nFertilizationStore: NFertilizationStore,\n private basicFertilisationSummariesStore: BasicFertilisationSummariesStore,\n private showPointsOnMap: ApShowPointsOnMapService,\n private translationService: ApTranslationService,\n private cropService: ApGetCropService,\n private componentService: ApNFertilizationComponentService,\n private nFertilizationCommonService: ApNFertilizationCommonService,\n private tooltipContentService: ApTooltipContentService,\n private agriportConstantsService: AgriportConstantsService,\n private translationPipe: ApTranslationPipe,\n private roundNumericPipe: GetRoundNumericPipe,\n private loginStore: LoginStore) {\n }\n\n public ngOnInit(): void {\n this._subscriptions.push(this.halfViewModeChange.subscribe(() => {\n if (this.halfViewMode$.value) {\n this.halfViewMode$.next(0);\n } else {\n this.halfViewMode$.next(1);\n }\n }));\n this._subscriptions.push(combineLatest([\n this.campaignYear.Listen(s => s.selectedYear),\n this.jobsStore.FinishedNFertJobs$\n ]).pipe(debounceTime(100)).subscribe(() => {\n this.showPointsOnMap.clear();\n this.nFertilizationStore.LoadNFertilizationPlanningSummaries();\n this.nFertilizationStore.LoadLogfiles();\n }));\n this.statisticStore.removeStatisticData();\n this.statisticStore.setStatisticData([], ApStatsType.NFertilizationLogfileStats, '', 'Admin_Pages__Overview');\n this._gridBuilder();\n }\n\n public ngAfterContentInit(): void {\n this._subscriptions.push(this.dynComponent.SelectedItems$.subscribe((items) => {\n this.fieldStore.changeSelectedField(items.map((item) => item.Id));\n }));\n this._subscriptions.push(combineLatest([\n this.dynComponent.gridSubject,\n this.formStore.FormClose$\n ]).pipe(filter(([grid]) => !!grid))\n .subscribe(([grid]) => grid.gridPaging.setSelectedKeys(this.fieldStore.getSelectedFieldIds()))\n );\n this._subscriptions.push(this._applyClicked.subscribe((e) => this._onApplyClicked(e)));\n this._subscriptions.push(this.fieldStore.Listen(x => x.fieldCropsSaved)\n .subscribe(x => this._invokeWhenFieldCropsUpdated(x)));\n this.burgerMenuStore.addControl('Global__NitrogenFertilization', NFertilizationBurgerMenuComponent);\n }\n\n public ngOnDestroy(): void {\n this.burgerMenuStore.removeControl('Global__NitrogenFertilization');\n this._subscriptions.forEach((s) => s.unsubscribe());\n this.fieldStore.changeSelectedField([]);\n this.showPointsOnMap.clear();\n this.statisticStore.removeStatisticData();\n this.mapStore.Layers.Clear();\n this.mapStore.Legends.removeLegend(this.mapStore.Legends.nLogInterpolationLegend);\n this.mapStore.Legends.removeLegend(this.mapStore.Legends.NPlanningLegend);\n }\n\n public onCreate(): void {\n this.statisticStore.removeStatisticData();\n this.mapStore.Layers.Clear();\n this.mapStore.Legends.removeLegend(this.mapStore.Legends.nLogInterpolationLegend);\n this.mapStore.Legends.removeLegend(this.mapStore.Legends.NPlanningLegend);\n this.formStore.openForm({\n component: ApNFertilizationPlanningEntryComponent, data: {\n Summary: undefined,\n Type: PlanningEntryComponentDataType.Create\n }\n });\n }\n\n private _gridBuilder(): void {\n this.loading$ = combineLatest([\n this.fieldStore.Listen(s => s.loading),\n this.cropApplicationStore.Listen(s => s.loading),\n this.nFertilizationStore.Listen(s => s.loading),\n this.nFertilizationStore.Listen(s => s.logfilesLoading),\n this.nFertilizationStore.Listen(s => s.planBooksLoading),\n this.cropRotationStore.Listen(s => s.historyLoading)\n ]).pipe(\n map((loadings) => loadings.some(l => !!l))\n );\n\n this._subscriptions.push(combineLatest([\n this.fieldStore.Listen(s => s.data),\n this.cropRotationStore.Listen(s => s.history),\n this.campaignYear.Listen(s => s.selectedYear),\n this.nFertilizationStore.Listen(s => s.planBooks),\n this.nFertilizationStore.Listen(s => s.logfiles),\n this.basicFertilisationSummariesStore.Summaries$,\n this.nFertilizationStore.GetNeeds$(this.campaignYear.getSelectedCampaignYear().Year),\n this.cropApplicationStore.Listen(s => s.data)\n ]).pipe(\n filter(([fields, cropRotation, _1, _2, _3, _4, _5, cA]) => (fields?.length ?? 0) !== 0 && Object.keys(cropRotation).length !== 0 && cA.length !== 0),\n map(([fields, cropRotation, campaignYear, planBooks, logfiles, bfSummaries, needs, _1]) => fields.filter((field) => !!field).map((field) => {\n const geom = this.fieldStore.getCurrentFieldGeom(field);\n const crop = cropRotation[field.Id as string][campaignYear?.Year] ?? null;\n const baseFertPlanBooks = bfSummaries.map(x => x.BasicFertilisationPlanBooks).flat();\n const applications = this.nFertilizationCommonService.getContentNPlanBooks(field, planBooks, logfiles, baseFertPlanBooks);\n const fieldApplications = this.componentService.getFieldApplicationRateValues(field, planBooks, logfiles, baseFertPlanBooks);\n const mainCropDescription = this.cropTypeStore.getDefaultCroptype(crop?.MainCrop)?.Description;\n const fieldCrop = mainCropDescription ? this.cropService.getFieldCrop(field) : null;\n const nApplied = this._calculateAlreadyApplied(applications);\n return {\n Id: field.Id,\n Status: 1,\n StatusClass: 'ap-status-green',\n StatusDesc: '',\n FieldCrop: fieldCrop,\n Nr: field.FieldNumber,\n SNr: field.FieldSubnumber,\n NrSNr: this.fieldStore.getFieldNumberAndSubNumber(field),\n Name: field.FieldName,\n Area: Create(geom?.AreaHa, 0),\n Crop: mainCropDescription,\n EcValue: fieldCrop?.EcValue,\n CropNote: fieldCrop?.Note,\n Sum: '-',\n Need: needs.Find((n) => n.FieldId === field.Id)?.Value ?? '-',\n Total: '-',\n N0: fieldApplications[0],\n Scan: fieldApplications[1],\n N1: fieldApplications[2],\n N2: fieldApplications[3],\n N3: fieldApplications[4],\n N4: fieldApplications[5],\n NApplied: nApplied,\n Applications: applications,\n };\n }))\n ).subscribe((items) => {\n this.items$.next(items);\n if (!this._afterUpdateProcess) {\n this.statisticStore.setStatisticData(items, ApStatsType.Planning, '');\n this._showLatestRaster(items.map((i) => i.Applications).flat());\n } else {\n this._afterUpdateProcess = false;\n }\n }));\n\n this.columns$ = this.settingsStore.Listen(s => s.data).pipe(\n map((settings) => settings[0]),\n filter((setting) => !!setting),\n map(() => [\n new ApDynGridStatusColumnConfig({\n field: 'Status',\n class: 'StatusClass',\n description: 'StatusDesc',\n filterable: true\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__NumberAbbr',\n field: 'Nr',\n hide: true,\n width: 40,\n filterable: true,\n filterType: FilterType.NUMBER,\n cssClass: 'right',\n headerFilterable: true\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__FieldPartShort',\n field: 'SNr',\n hide: true,\n width: 40,\n filterable: true,\n filterType: FilterType.NUMBER,\n cssClass: 'right',\n headerFilterable: true\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__NumberAbbr',\n field: 'NrSNr',\n width: 75,\n filterable: true,\n hide: new ApDynGridColumnHideConfig({\n mapHide: false,\n selfHide: this.mapViewStore.Listen(s => s.mode).pipe(map((m) => m !== MapViewMode.NORMAL)),\n }),\n headerFilterable: true\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__Name',\n field: 'Name',\n cssClass: 'left',\n width: 180,\n filterable: true,\n sortIndex: 0,\n headerFilterable: true\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Docu_Ini__Area',\n field: 'Area',\n width: 40,\n filterable: true,\n cssClass: 'right',\n filterType: FilterType.NUMBER,\n template: PropertyTemplate.NUMBER,\n headerFilterable: true\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__Crop',\n field: 'Crop',\n width: 100,\n filterable: true,\n headerFilterable: true\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'ECStageShort',\n field: 'EcValue',\n hide: true,\n width: 40,\n cssClass: 'right',\n filterable: true,\n headerFilterable: true,\n filterType: FilterType.NUMBER\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__Fieldcrop_Notes',\n field: 'CropNote',\n tooltip: (item: any) => this.tooltipContentService.generateCropNoteTooltip(item['CropNote']),\n hide: true,\n width: 100,\n filterable: true,\n headerFilterable: true\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__N0',\n field: 'N0',\n checkbox: true,\n hide: true,\n width: 20,\n filterable: false\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__Scan',\n field: 'Scan',\n checkbox: true,\n hide: true,\n width: 20,\n filterable: false\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__N1',\n field: 'N1',\n checkbox: true,\n hide: true,\n width: 20,\n filterable: false\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__N2',\n field: 'N2',\n checkbox: true,\n hide: true,\n width: 20,\n filterable: false\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__N3',\n field: 'N3',\n checkbox: true,\n hide: true,\n width: 20,\n filterable: false\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__N4',\n field: 'N4',\n checkbox: true,\n hide: true,\n width: 20,\n filterable: false\n }),\n new ApDynGridPropertyColumnConfig({\n field: 'NApplied',\n title: 'Nutrients__already_applied',\n headerExtraLines: ['[kg N / ha]'],\n width: 60,\n cssClass: 'right',\n filterType: FilterType.NUMBER,\n template: PropertyTemplate.NUMBER,\n filterable: true,\n hide: true,\n pipes: [{\n pipe: this.roundNumericPipe,\n args: [0, {ToReplace: [0], ReplaceWith: ''}]\n }]\n }),\n new ApDynGridEditColumnConfig({\n disabled: true\n })\n ]));\n this.details$ = combineLatest([\n this.languageStore.Listen(s => s.selectedLanguage),\n this.settingsStore.Listen(s => s.data)\n ]).pipe(\n filter(([, settings]) => settings.length !== 0),\n map(([language]) =>\n new ApDynGridDetailsGridConfig({\n field: 'Applications',\n checkboxDisabled: true,\n hide: (dataItem) => dataItem.Applications.length === 0,\n columns: [\n new ApDynGridStatusColumnConfig({\n field: 'Status',\n class: 'StatusClass',\n description: 'StatusDesc',\n filterable: true\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__Product',\n field: 'ProductName',\n headerFilterable: true,\n width: 100,\n filterable: true,\n tooltip: (dataItem: INFertilizationOverviewGridDetailsItem) => this.tooltipContentService.getProductContentInfoTooltip(dataItem.ProductId)\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global_Application_Date',\n field: 'MidnightDate',\n format: language.DateFormat,\n sortIndex: 0,\n sortDesc: true,\n filterable: true,\n width: 80\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__N_ApplNum',\n field: 'Administration',\n filterable: true,\n width: 70,\n pipes: [{\n pipe: this.translationPipe,\n args: []\n }]\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__ECStageShort',\n field: 'EC',\n cssClass: 'right',\n filterType: FilterType.NUMBER,\n filterable: true,\n width: 60\n }),\n new ApDynGridGroupColumnConfig({\n title: 'N__ChartTitleX',\n width: 225,\n hide: true,\n groupColumns: [\n new ApDynGridPropertyColumnConfig({\n title: 'Global__Avg_Symbol',\n field: 'Absorption.Avg',\n width: 75,\n cssClass: 'right',\n filterType: FilterType.NUMBER,\n filterable: true,\n pipes: [{\n pipe: this.roundNumericPipe,\n args: [0, GetRoundNumericPipeConfig.NullToEmptyReplaceConfig]\n }]\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__Min',\n field: 'Absorption.Min',\n width: 75,\n cssClass: 'right',\n filterType: FilterType.NUMBER,\n filterable: true,\n pipes: [{\n pipe: this.roundNumericPipe,\n args: [0, GetRoundNumericPipeConfig.NullToEmptyReplaceConfig]\n }]\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__Max',\n field: 'Absorption.Max',\n width: 75,\n cssClass: 'right',\n filterType: FilterType.NUMBER,\n filterable: true,\n pipes: [{\n pipe: this.roundNumericPipe,\n args: [0, GetRoundNumericPipeConfig.NullToEmptyReplaceConfig]\n }]\n })\n ]\n }),\n new ApDynGridGroupColumnConfig({\n title: 'Global__Nsensor_Unit',\n width: 225,\n hide: true,\n groupColumns: [\n new ApDynGridPropertyColumnConfig({\n title: 'Global__Avg_Symbol',\n field: 'Fertilization.Avg',\n cssClass: 'right',\n dynCssClass: (dataItem) => this.componentService.applyAdditionalStylesForFertilizationValues(dataItem),\n tooltip: (dataItem) => this.componentService.tooltipForFertilizationValues(dataItem),\n filterType: FilterType.NUMBER,\n filterable: true,\n width: 75,\n pipes: [{\n pipe: this.roundNumericPipe,\n args: [0, GetRoundNumericPipeConfig.NullToEmptyReplaceConfig]\n }]\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__Min',\n field: 'Fertilization.Min',\n width: 75,\n cssClass: 'right',\n dynCssClass: (dataItem) => this.componentService.applyAdditionalStylesForFertilizationValues(dataItem),\n tooltip: (dataItem) => this.componentService.tooltipForFertilizationValues(dataItem),\n filterType: FilterType.NUMBER,\n filterable: true,\n pipes: [{\n pipe: this.roundNumericPipe,\n args: [0, GetRoundNumericPipeConfig.NullToEmptyReplaceConfig]\n }]\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__Max',\n field: 'Fertilization.Max',\n width: 75,\n cssClass: 'right',\n dynCssClass: (dataItem) => this.componentService.applyAdditionalStylesForFertilizationValues(dataItem),\n tooltip: (dataItem) => this.componentService.tooltipForFertilizationValues(dataItem),\n filterType: FilterType.NUMBER,\n filterable: true,\n pipes: [{\n pipe: this.roundNumericPipe,\n args: [0, GetRoundNumericPipeConfig.NullToEmptyReplaceConfig]\n }]\n })\n ]\n }),\n new ApDynGridGroupColumnConfig({\n title: this.halfViewMode$.pipe(map((m) => m === 0 ? 'N__ChartTitleX' : 'Global__Nsensor_Unit')),\n hide: new ApDynGridColumnHideConfig({\n mapHide: false,\n selfHide: this.mapViewStore.Listen(s => s.mode).pipe(map((m) => m !== MapViewMode.NORMAL)),\n }),\n headerButtons: {\n nextClicked: this.halfViewModeChange,\n previousClicked: this.halfViewModeChange,\n nextDisabled: of(false),\n previousDisabled: of(false)\n },\n xlsExport: false,\n width: 225,\n groupColumns: [\n new ApDynGridPropertyColumnConfig({\n title: 'Global__Avg_Symbol',\n field: 'Absorption.Avg',\n cssClass: 'right',\n filterType: FilterType.NUMBER,\n filterable: true,\n width: 75,\n hide: new ApDynGridColumnHideConfig({\n mapHide: false,\n selfHide: this.halfViewMode$.pipe(map((m) => m === 1))\n }),\n pipes: [{\n pipe: this.roundNumericPipe,\n args: [0, GetRoundNumericPipeConfig.NullToEmptyReplaceConfig]\n }]\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__Min',\n field: 'Absorption.Min',\n cssClass: 'right',\n filterType: FilterType.NUMBER,\n filterable: true,\n width: 75,\n hide: new ApDynGridColumnHideConfig({\n mapHide: false,\n selfHide: this.halfViewMode$.pipe(map((m) => m === 1))\n }),\n pipes: [{\n pipe: this.roundNumericPipe,\n args: [0, GetRoundNumericPipeConfig.NullToEmptyReplaceConfig]\n }]\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__Max',\n field: 'Absorption.Max',\n cssClass: 'right',\n filterType: FilterType.NUMBER,\n filterable: true,\n width: 75,\n hide: new ApDynGridColumnHideConfig({\n mapHide: false,\n selfHide: this.halfViewMode$.pipe(map((m) => m === 1))\n }),\n pipes: [{\n pipe: this.roundNumericPipe,\n args: [0, GetRoundNumericPipeConfig.NullToEmptyReplaceConfig]\n }]\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__Avg_Symbol',\n field: 'Fertilization.Avg',\n cssClass: 'right',\n dynCssClass: (dataItem) => this.componentService.applyAdditionalStylesForFertilizationValues(dataItem),\n tooltip: (dataItem) => this.componentService.tooltipForFertilizationValues(dataItem),\n filterType: FilterType.NUMBER,\n filterable: true,\n width: 75,\n hide: new ApDynGridColumnHideConfig({\n mapHide: false,\n selfHide: this.halfViewMode$.pipe(map((m) => m === 0))\n }),\n pipes: [{\n pipe: this.roundNumericPipe,\n args: [0, GetRoundNumericPipeConfig.NullToEmptyReplaceConfig]\n }]\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__Min',\n field: 'Fertilization.Min',\n cssClass: 'right',\n dynCssClass: (dataItem) => this.componentService.applyAdditionalStylesForFertilizationValues(dataItem),\n tooltip: (dataItem) => this.componentService.tooltipForFertilizationValues(dataItem),\n filterType: FilterType.NUMBER,\n filterable: true,\n width: 75,\n hide: new ApDynGridColumnHideConfig({\n mapHide: false,\n selfHide: this.halfViewMode$.pipe(map((m) => m === 0))\n }),\n pipes: [{\n pipe: this.roundNumericPipe,\n args: [0, GetRoundNumericPipeConfig.NullToEmptyReplaceConfig]\n }]\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__Max',\n field: 'Fertilization.Max',\n cssClass: 'right',\n dynCssClass: (dataItem) => this.componentService.applyAdditionalStylesForFertilizationValues(dataItem),\n tooltip: (dataItem) => this.componentService.tooltipForFertilizationValues(dataItem),\n filterType: FilterType.NUMBER,\n filterable: true,\n width: 75,\n hide: new ApDynGridColumnHideConfig({\n mapHide: false,\n selfHide: this.halfViewMode$.pipe(map((m) => m === 0))\n }),\n pipes: [{\n pipe: this.roundNumericPipe,\n args: [0, GetRoundNumericPipeConfig.NullToEmptyReplaceConfig]\n }]\n })\n ]\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__Sum_Goods',\n field: 'ProductTotal',\n hide: true,\n width: 90,\n cssClass: 'right',\n filterType: FilterType.NUMBER,\n filterable: true,\n pipes: [{\n pipe: this.roundNumericPipe,\n args: [0, GetRoundNumericPipeConfig.NullToEmptyReplaceConfig]\n }]\n }),\n new ApDynGridPropertyColumnConfig({\n title: '',\n field: 'ProductTotalUnit',\n width: 50,\n hide: true\n }),\n new ApDynGridEditColumnConfig({\n data: [\n {\n text: 'Global__RateView',\n callback: ApUtilService.createEventEmitter(this._clickToShowOnMap.bind(this), this._subscriptions),\n disabled: (dataItem) => !this._isRasterStatisticDataPresent(dataItem)\n },\n {\n text: 'Global__SingleFieldView',\n callback: ApUtilService.createEventEmitter(this._onShowSingleViewAndStatistics.bind(this), this._subscriptions),\n disabled: (dataItem) => !this._isRasterStatisticDataPresent(dataItem)\n }\n ]\n })\n ]\n })\n )\n );\n this.pager = new ApDynGridPagerConfig({\n apply: this._applyClicked,\n listMassEditing: [\n {\n id: FieldMassEditAction.EditMainCrop,\n type: ApGridPagerType.None,\n name: this.translationService.translate('Global__Edit'),\n onSubmit: this._applyClicked,\n formConfig: [\n new ApDynformsConfigFieldset({\n key: 'OverviewDetailsFieldSet',\n config: [\n new ApDynformsConfigNumerictextbox({\n key: 'EcValueToUpdate',\n label: 'ECStageShort',\n min: +this.agriportConstantsService.GetConstant('GS_GLOBAL_MIN'),\n max: +this.agriportConstantsService.GetConstant('GS_GLOBAL_MAX'),\n decimals: 0,\n format: 'n0',\n validators: [\n new ApDynformsValidator({validator: Validators.required, errorKey: ''})\n ]\n }),\n new ApDynformsConfigPlaceholder()\n ]\n })\n ]\n } as IDynGridWizardChoiceData\n ],\n iconButtons: [\n {\n icon: Icon.PDF,\n callback: ApUtilService.createEventEmitter(this._onPdf.bind(this), this._subscriptions),\n tooltip: 'Global__Save_PDF'\n },\n {\n icon: Icon.XLS,\n callback: ApUtilService.createEventEmitter(this._onXls.bind(this), this._subscriptions),\n tooltip: 'Global__Save_EXCEL'\n }\n ]\n });\n }\n\n private _onApplyClicked(event: IGridPagerData): void {\n if (!event) {\n return;\n }\n if (event.object.id === NFertilizationOverviewMassEditAction.Edit) {\n const selectedFieldCrops = this.dynComponent.getSelectedItems()\n .filter(x => x['FieldCrop'])\n .map(x => x['FieldCrop'] as IFieldCrop);\n if (!selectedFieldCrops || selectedFieldCrops.length <= 0) {\n return;\n }\n const copiedFieldCrops = ObjectFactory.Copy(selectedFieldCrops);\n copiedFieldCrops.forEach(fieldCrop => {\n fieldCrop.EcValue = event.value ?? event.form['EcValueToUpdate'];\n });\n this.fieldStore.saveFieldCrops(copiedFieldCrops);\n }\n }\n\n private _invokeWhenFieldCropsUpdated(isUpdated: boolean | undefined): void {\n if (isUpdated === undefined) {\n return;\n }\n this._afterUpdateProcess = true;\n if (isUpdated) {\n this.notifyStore.showSaveSuccessMessage();\n } else {\n this.notifyStore.showSaveFailMessage();\n }\n }\n\n private _onShowSingleViewAndStatistics(dataItem: INFertilizationOverviewGridDetailsItem): void {\n if (!dataItem) {\n return;\n }\n if (!!dataItem.FieldId && !!dataItem.PlanBookId) {\n this.showPointsOnMap.showRaster(dataItem.FieldId.toString(), dataItem.PlanBookId.toString(), 'nd');\n }\n const dataCollection: NFertilizationLogfileStatsData[] = [];\n if (!!dataItem.PlanBookId) {\n const logFiles = this.nFertilizationStore.Logfiles?.filter(x => x.Status === 1 && !!x.NPlanBook?.Id && x.NPlanBook?.Id === dataItem.PlanBookId) ?? [];\n if (logFiles.length > 0) {\n const planBook = this.nFertilizationStore.PlanBooks.find(x => x.Id === dataItem.PlanBookId);\n const data: NFertilizationLogfileStatsData = {\n PlanBookId: planBook.Id,\n Area: dataItem.WorkArea,\n Logfiles: logFiles,\n RasterStatistics: planBook.RasterStatistics\n };\n dataCollection.push(data);\n }\n }\n this.statisticStore.removeStatisticData();\n this.statisticStore.setStatisticData(dataCollection, ApStatsType.NFertilizationLogfileStats, undefined);\n if (this.mapViewStore.getMapViewMode() !== MapViewMode.NORMAL) {\n this.mapViewStore.showMapView();\n }\n if (this.mapViewStore.getMapViewCurrentMenu() !== MapViewCurrentMenu.MAP) {\n this.mapViewStore.goIntoMapMenu();\n }\n if (!!dataItem.FieldId) {\n this._selectItemsForGrid([dataItem.FieldId.toString()]);\n }\n }\n\n private _showLatestRaster(applications: INFertilizationOverviewGridDetailsItem[]): void {\n const filtered = applications.filter((a) => a.CropKey != null);\n const max = filtered.map((a) => a.Date.valueOf()).Max();\n this._onShowAll(filtered.Find((application) => application.Date.valueOf() === max));\n }\n\n private _isRasterStatisticDataPresent(dataItem: INFertilizationOverviewGridDetailsItem): boolean {\n if (!dataItem) {\n return false;\n }\n const planBook = this.nFertilizationStore.PlanBooks.find(x => x.Id === dataItem.PlanBookId);\n const rasterStatistic = planBook?.RasterStatistics ?? [];\n return rasterStatistic.length > 1 && (!!rasterStatistic[0] || !!rasterStatistic[1]);\n }\n\n private _calculateAlreadyApplied(detailsItems: INFertilizationOverviewGridDetailsItem[]): number | undefined {\n if (!detailsItems || detailsItems.length <= 0) {\n return undefined;\n }\n return detailsItems.reduce((total, currentItem) => total + currentItem.AlreadyApplied, 0);\n }\n\n private _clickToShowOnMap(dataItem: INFertilizationOverviewGridDetailsItem): void {\n if (!dataItem) {\n return;\n }\n this._onShowAll(dataItem);\n this.mapStore.Layers.NRaster.zoomToExtent();\n }\n\n private _onShowAll(dataItem: INFertilizationOverviewGridDetailsItem): void {\n if (!dataItem) {\n return;\n }\n if (this.showPointsOnMap.isActive(dataItem.FieldId.toString(), dataItem.PlanBookId.toString())) {\n this.showPointsOnMap.showRaster(dataItem.FieldId.toString(), dataItem.PlanBookId.toString(), 'nd');\n return;\n }\n const applicationMap: { [fieldId: string]: any } = {[dataItem.FieldId.toString()]: dataItem};\n this.items$.value\n .map((item) => item.Applications as INFertilizationOverviewGridDetailsItem[])\n .flat()\n .filter((application) => application.FieldId !== dataItem.FieldId\n && application.CropKey === dataItem.CropKey && application.Application === dataItem.Application\n && application.Administration === dataItem.Administration)\n .forEach((other: INFertilizationOverviewGridDetailsItem) => {\n const fieldId = other.FieldId.toString();\n if (applicationMap[fieldId] !== undefined) {\n if (other.Date.valueOf() > applicationMap[fieldId].Date.valueOf()) {\n applicationMap[fieldId] = other;\n }\n } else {\n applicationMap[fieldId] = other;\n }\n });\n this.showPointsOnMap.showAllRaster(Object.values(applicationMap), 'nd');\n }\n\n private _selectItemsForGrid(fieldIds: IGuid[]): void {\n if (!fieldIds) {\n return;\n }\n this.dynComponent.dynGrid.gridPaging.setSelectedKeys(fieldIds);\n this.fieldStore.changeSelectedField(fieldIds.map(x => x.toString()));\n }\n\n private _onPdf(): void {\n this.dynComponent.dynGrid.pdfExportFileName = this._generatePrintFilename();\n this.dynComponent.dynGrid.exportAsPdf();\n }\n\n private _onXls(): void {\n this.dynComponent.dynGrid.xlsExportFileName = this._generatePrintFilename();\n this.dynComponent.dynGrid.exportAsXls();\n }\n\n private _generatePrintFilename(): string {\n return `${this.dateService.toFarmDate(new Date()).format('YYYY-MM-DD')}_` +\n `${this.translationService.translate('Global__NitrogenFertilization')}_` +\n `${this.translationService.translate('Admin_Pages__Overview')}`;\n }\n\n public isCreateNewAllowed(): boolean {\n return ApRoleTypeService.hasDeveloperRole(this.loginStore.User);\n }\n}\n","import {ApDynGridPagerConfig, IDynGridWizardChoiceData} from '../../../ap-dyngrids/config/ap-dyn-grid-pager-config';\nimport {ApGridPagerType} from '../../../ap-interface/enums';\nimport {Icon} from '../../../ap-interface/enums/layout/icon.enum';\nimport {EventEmitter} from '@angular/core';\n\nexport class PagerBuilder {\n static PlanningBookingPager(options: {text: string, callback: EventEmitter}[]): ApDynGridPagerConfig {\n return new ApDynGridPagerConfig({\n listMassEditing: options.map((option, index) =>\n ({\n id: index,\n name: option.text,\n type: ApGridPagerType.None,\n onSubmit: option.callback\n } as IDynGridWizardChoiceData)),\n iconButtons: [\n {icon: Icon.PDF, callback: undefined},\n {icon: Icon.XLS, callback: undefined},\n ]\n });\n }\n}\n","import {AfterContentInit, Component, OnDestroy, OnInit, ViewChild} from '@angular/core';\nimport {BehaviorSubject, Subscription} from 'rxjs';\nimport {\n ApDynGridColumnConfigBase,\n ApDynGridColumnHideConfig\n} from '../../ap-dyngrids/config/ap-dyn-grid-column-config-base';\nimport {\n ApDynGridStatusColumnConfig\n} from '../../ap-dyngrids/config/ap-dyn-grid-status-column-config';\nimport {\n ApDynGridPropertyColumnConfig\n} from '../../ap-dyngrids/config/ap-dyn-grid-property-column-config';\nimport {\n ApDynGridEditColumnConfig\n} from '../../ap-dyngrids/config/ap-dyn-grid-edit-column-config';\nimport {\n ApDynGridGroupColumnConfig\n} from '../../ap-dyngrids/config/ap-dyn-grid-group-column-config';\nimport {\n LanguageStore\n} from '../../stores/translation/language.store';\nimport {filter, map, skip} from 'rxjs/operators';\nimport {MapViewMode} from '../../ap-interface';\nimport {\n MapViewStore\n} from '../../stores/layout/mapview.store';\nimport {\n ApUtilService\n} from '../../ap-utils/service/ap-util.service';\nimport {\n FormStore\n} from '../../stores/layout/form.store';\nimport {\n FieldStore\n} from '../../stores/farm/field.store';\nimport {\n FertilizerStore\n} from '../../stores/base-data/fertilizer.store';\nimport {\n CropTypeStore\n} from '../../stores/base-data/crop.types.store';\nimport {\n ApDynGridPagerWizardButton,\n ApDynGridPagerWizardConfig,\n ApDynGridPagerWizardSection\n} from '../../ap-dyngrids/config/ap-dyn-grid-pager-wizard-config';\nimport {\n ApDynformsConfigFieldset\n} from '../../ap-dynforms/config/ap-dynforms-config-fieldset';\nimport {\n ApDynformsConfigNumerictextbox\n} from '../../ap-dynforms/config/ap-dynforms-config-numerictextbox';\nimport {\n ApDynformsConfigPlaceholder\n} from '../../ap-dynforms/config/ap-dynforms-config-placeholder';\nimport {\n ApDynformsConfigDatepicker\n} from '../../ap-dynforms/config/ap-dynforms-config-datepicker';\nimport {\n ModalDialogStore\n} from '../../stores/dialog/modal.dialog.store';\nimport {\n IModalDialogData,\n ModalDialogButtonDisable\n} from '../../ap-interface/interfaces/ap-modaldialog-data.interface';\nimport {\n CampaignYearStore\n} from '../../stores/login/campaignyear.store';\nimport {\n ApTranslationService\n} from '../../ap-utils/service/ap-translation.service';\nimport {\n NFertilizationStore\n} from '../../stores/n-fertilization/n-fertilization.store';\nimport {\n ApDynComponentComponent\n} from '../../ap-dyncomponent/ap-dyncomponent.component';\nimport {\n ApDynformsConfigComboBox\n} from '../../ap-dynforms/config/ap-dynforms-config-combobox';\nimport {\n DriverStore\n} from '../../stores/docu/driver.store';\nimport {\n MachineStore\n} from '../../stores/docu/machine.store';\nimport {\n InstrumentStore\n} from '../../stores/docu/instrument.store';\nimport {ObjectFactory} from 'ts-tooling';\nimport {\n GetRoundNumericService\n} from '../../ap-utils/service/get-round-numeric.service';\nimport {\n INFertilizationBookingGridData\n} from './ap-n-fertilization-booking-configs/n-fertilization-booking-types';\nimport {ApTimeSpanUtil, GetRoundNumericPipe} from '../../ap-utils';\nimport {\n CombinedFertilizer\n} from '../../types/common-types';\nimport {\n FertilizerService\n} from '../../services/data/fertilizer.service';\nimport {\n ApDynformsConfigTimepicker\n} from '../../ap-dynforms/config/ap-dynforms-config-timepicker';\nimport {\n CampaignYearService\n} from '../../services/data/campaign-year.service';\nimport {\n ApDateService\n} from '../../ap-core/services/ap-date-service';\nimport {\n FertilizationManagementService\n} from '../../services/data/fertilization-management.service';\nimport IGuid = System.IGuid;\nimport INFertilizationPlanBook = Data.TaskManagement.INFertilizationPlanBook;\nimport IDatasetFieldMap = Data.Sensor.IDatasetFieldMap;\nimport TaskManagementStatus = Data.TaskManagement.TaskManagementStatus;\n\n@Component({\n selector: 'ap-n-fertilization-booking',\n template: `\n \n \n `,\n styles: []\n})\nexport class ApNFertilizationBookingComponent implements OnInit, AfterContentInit, OnDestroy {\n @ViewChild(ApDynComponentComponent, {static: true}) dynComponent: ApDynComponentComponent;\n public items$ = new BehaviorSubject([]);\n public pager: ApDynGridPagerWizardConfig;\n public columns: ApDynGridColumnConfigBase[];\n public caption: string;\n\n private _book = true;\n private _editId: IGuid;\n private _subscriptions: Subscription[] = [];\n\n constructor(private campaignYearStore: CampaignYearStore,\n private cropTypeStore: CropTypeStore,\n private driverStore: DriverStore,\n private fertilizerStore: FertilizerStore,\n private fieldStore: FieldStore,\n private formStore: FormStore,\n private instrumentStore: InstrumentStore,\n private languageStore: LanguageStore,\n private machineStore: MachineStore,\n private mapViewStore: MapViewStore,\n private modalDialogStore: ModalDialogStore,\n private nFertilizationStore: NFertilizationStore,\n private roundNumericService: GetRoundNumericService,\n private translationService: ApTranslationService,\n private fertilizerService: FertilizerService,\n private campaignYearService: CampaignYearService,\n private dateService: ApDateService,\n private fertilizationManagementService: FertilizationManagementService,\n private roundNumericPipe: GetRoundNumericPipe) {\n }\n\n public ngOnInit(): void {\n const data = this.formStore.Listen(s => s.updateComponent).getValue().data;\n this._book = data.book;\n this.caption = data.book ? 'Global__Booking' : 'Global__Reset';\n this.columns = this._getColumns();\n this.pager = this._getPager();\n }\n\n public ngAfterContentInit(): void {\n this._subscriptions.push(this.modalDialogStore.Listen(s => s.result).pipe(skip(1)).subscribe((result) => {\n if (result.key === 'apply') {\n this._updateItems({ids: [this._editId], value: result.formValues});\n }\n }));\n this._loadDataFromStore();\n }\n\n public ngOnDestroy(): void {\n this._subscriptions.forEach(s => s.unsubscribe());\n }\n\n public onEdit(data: INFertilizationBookingGridData): void {\n const dialog = {\n title: this.translationService.translate('Admin_Pages_Popups__Book'),\n message: !this._isApplicationRateValid(data.ApplicationRate) ? 'Global__ApplicationRateZero_Dialog_Message' : null,\n show: true,\n buttons: [\n {\n key: 'cancel',\n text: 'Global__Cancel',\n primary: false\n },\n {\n key: 'apply',\n text: 'Global__Ok',\n primary: true,\n disable: ModalDialogButtonDisable.FormInvalid,\n }\n ],\n formConfig: {\n fieldSets: this._fieldSets(data),\n validators: undefined,\n asyncValidators: undefined,\n values: ObjectFactory.Copy(data)\n }\n } as IModalDialogData;\n this._editId = data.Id;\n this.modalDialogStore.setModalDialogData(dialog);\n }\n\n private _booking(): void {\n if (this._book) {\n const selectedItems = this.dynComponent.getSelectedItems() as INFertilizationBookingGridData[];\n this.nFertilizationStore.BookPlanBooks(this._updateData(selectedItems));\n } else {\n this.nFertilizationStore.UnBookPlanBooks(\n this.dynComponent.getSelectedItems().map((planBookGridItem: INFertilizationBookingGridData) => {\n return {\n logfile: undefined,\n planBook: planBookGridItem.SourceItem\n };\n }\n ));\n }\n this._formClose();\n }\n\n private _formClose(): void {\n this.formStore.closeForm();\n }\n\n private _loadDataFromStore(): void {\n this._subscriptions.push(this.formStore.Listen(s => s.updateComponent).pipe(\n map((comp) => comp.data.dataItem['PlanBooks']),\n map((planBooks: INFertilizationPlanBook[]) => {\n return planBooks.filter((planBook) => !planBook.BookedBy === this._book).map((planBook) => {\n const applicationRate = planBook.ApplicationRate ?? 0;\n const field = this.fieldStore.getFieldById(planBook.FieldId);\n const fieldGeom = this.fieldStore.getCurrentFieldGeom(field);\n const fertilizer = this.fertilizerStore.getFertilizer(planBook.ProductId);\n const fertilizerFactor = this.fertilizationManagementService.getFertilizerContentN(planBook.ProductId);\n const driver = this.driverStore.getDriverById(planBook.ExportDriver);\n const machine = this.machineStore.getMachineById(planBook.ExportMachine);\n const instrument = this.instrumentStore.getInstrumentById(planBook.ExportInstrument);\n const productAmount = this.fertilizationManagementService.calculateProductAmountN(planBook.ProductId, applicationRate, fieldGeom.AreaHa, planBook.Factor);\n const gridStatus = this._getGridStatus(planBook.Status);\n return {\n Id: planBook.Id,\n FieldId: field.Id,\n Status: planBook.Status,\n StatusClass: gridStatus.Class,\n StatusDesc: gridStatus.Desc,\n FieldName: field.FieldName,\n Nr: field.FieldNumber,\n TNr: field.FieldSubnumber,\n NrTNr: this.fieldStore.getFieldNumberAndSubNumber(field),\n Driver: driver,\n Machine: machine,\n Instrument: instrument,\n FertilizationDate: new Date(planBook.ApplicationDate),\n CropTypeName: this.cropTypeStore.GetCropTypeName(planBook.MainCropId),\n IsExported: !!planBook.ExportedBy,\n ProductName: this.fertilizerService.getFertilizerProductName(fertilizer),\n ApplicationRate: applicationRate,\n Average: applicationRate * (planBook.Factor ?? 0),\n Applied: productAmount ?? 0,\n FertilizerAreaFactor: fertilizerFactor / (fieldGeom?.AreaHa ?? 1),\n ApplicationRateFactor: planBook.Factor ?? 1,\n Duration: this.dateService.getDateWithTimeFromMilliseconds(planBook.TEnd?.TotalMilliseconds ?? 0),\n FieldGeom: fieldGeom,\n Fertilizer: fertilizer,\n SourceItem: planBook\n } as INFertilizationBookingGridData;\n });\n })\n ).subscribe((items: INFertilizationBookingGridData[]) => {\n this.items$.next(items);\n setTimeout(() => this.dynComponent.dynGrid.gridPaging.setSelectedKeys(items.map(x => x.Id)));\n }));\n }\n\n // FF: Fix calculation of Application_Rate and content calculation of organic fertilizer\n private _updateData(planBookGridItems: INFertilizationBookingGridData[]): {\n planBook: INFertilizationPlanBook,\n logfile: IDatasetFieldMap\n }[] {\n return planBookGridItems.map(planBookGridItem => {\n const planBookToUpdate = ObjectFactory.Copy(planBookGridItem.SourceItem);\n if (planBookToUpdate) {\n planBookToUpdate.TStart = ApTimeSpanUtil.getEmptyTimeSpan();\n planBookToUpdate.TEnd = ApTimeSpanUtil.getTimeSpanFromDate(planBookGridItem.Duration, true);\n planBookToUpdate.ExportDriver = planBookGridItem.Driver?.Id;\n planBookToUpdate.ExportMachine = planBookGridItem.Machine?.Id;\n planBookToUpdate.ExportInstrument = planBookGridItem.Instrument?.Id;\n planBookToUpdate.ApplicationDate = this.dateService.getDateNoon(planBookGridItem.FertilizationDate);\n planBookToUpdate.Factor = planBookGridItem.ApplicationRateFactor;\n }\n return {planBook: planBookToUpdate, logfile: undefined};\n });\n }\n\n private _updateItems(submitData: { ids: IGuid[], value: any }): void {\n this.items$.next(this.items$.getValue().map((item: INFertilizationBookingGridData) => {\n if (submitData.ids.includes(item.Id)) {\n if (!!submitData.value.FertilizationDate) {\n item.FertilizationDate = new Date(submitData.value.FertilizationDate);\n }\n if (!!submitData.value.Duration) {\n item.Duration = submitData.value.Duration;\n }\n if (!!submitData.value.Driver) {\n item.Driver = submitData.value.Driver;\n }\n if (!!submitData.value.Instrument) {\n item.Instrument = submitData.value.Instrument;\n }\n if (!!submitData.value.Machine) {\n item.Machine = submitData.value.Machine;\n }\n if (submitData.value.Average) {\n item.Applied = submitData.value.Applied;\n item.Average = this.roundNumericService.roundAsNumber(submitData.value.Average);\n if (this._isApplicationRateValid(item.ApplicationRate)) {\n item.ApplicationRateFactor = item.Average / item.ApplicationRate;\n } else {\n item.ApplicationRateFactor = 1;\n }\n }\n }\n return item;\n }));\n }\n\n private _getColumns(): ApDynGridColumnConfigBase[] {\n return [\n new ApDynGridStatusColumnConfig({\n field: 'Status',\n class: 'StatusClass',\n description: 'StatusDesc',\n filterable: true\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Docu_Ini__Number',\n field: 'Nr',\n width: 60,\n hide: true\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Docu_Ini_Subnumber',\n field: 'TNr',\n width: 60,\n hide: true\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Docu_Ini__Number',\n field: 'NrTNr',\n width: 70,\n hide: new ApDynGridColumnHideConfig({\n selfHide: this.mapViewStore.Listen(s => s.mode).pipe(map((mapMode) => mapMode === MapViewMode.HIDE))\n })\n }),\n new ApDynGridPropertyColumnConfig({\n field: 'FieldName',\n title: 'Docu_Ini__Field',\n headerFilterable: true,\n width: 180,\n filterable: true\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__Area',\n field: 'FieldGeom.AreaHa',\n headerFilterable: true,\n width: 60,\n format: 'n3'\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__CropType',\n field: 'CropTypeName',\n filterable: true,\n width: 100,\n headerFilterable: true,\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__Average_Amount',\n headerExtraLines: ['Global__KgNPerHa'],\n field: 'Average',\n width: 60,\n pipes: [{\n pipe: this.roundNumericPipe,\n args: [0]\n }]\n }),\n new ApDynGridGroupColumnConfig({\n title: 'Global__Product',\n groupColumns: [\n new ApDynGridPropertyColumnConfig({\n field: 'ProductName',\n title: 'Docu_Ini__Name',\n width: 100\n }),\n new ApDynGridPropertyColumnConfig({\n field: 'Applied',\n title: 'Global__Sum_Goods',\n cssClass: 'right',\n width: 60,\n format: 'n',\n pipes: [{\n pipe: this.roundNumericPipe,\n args: [0]\n }]\n }),\n new ApDynGridPropertyColumnConfig({\n field: 'Fertilizer.Unit.Description',\n title: '',\n width: 40,\n filterable: false,\n sortable: false\n }),\n ]\n }),\n new ApDynGridPropertyColumnConfig({\n field: 'FertilizationDate',\n title: 'Nutrients__FertilizationDate',\n hide: true,\n width: 80,\n filterable: true,\n format: this.languageStore.Listen(s => s.selectedLanguage).getValue().DateFormat,\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Docu_Ini__Duration',\n field: 'Duration',\n width: 60,\n format: 'HH:mm',\n hide: true\n }),\n new ApDynGridGroupColumnConfig({\n title: 'agrioptions_resources',\n hide: true,\n groupColumns: [\n new ApDynGridPropertyColumnConfig({\n field: 'Machine.NameWithSign',\n title: 'Base__Engine',\n width: 100,\n hide: true,\n }),\n new ApDynGridPropertyColumnConfig({\n field: 'Instrument.Name',\n title: 'AgriConnect_Ini__Tool',\n width: 100,\n hide: true\n }),\n new ApDynGridPropertyColumnConfig({\n field: 'Driver.ShortFullName',\n title: 'Docu_Ini__Motorist',\n width: 100,\n hide: true\n })\n ]\n }),\n new ApDynGridEditColumnConfig({})\n ];\n }\n\n private _getPager(): ApDynGridPagerWizardConfig {\n const nextTitle = this._book ? 'Admin_Pages_Popups__Book' : 'Global__Reset';\n return new ApDynGridPagerWizardConfig(\n new ApDynGridPagerWizardButton('Global_Back_With_Arrow', ApUtilService.createEventEmitter(this._formClose.bind(this), this._subscriptions)),\n new ApDynGridPagerWizardSection(),\n new ApDynGridPagerWizardButton(nextTitle, ApUtilService.createEventEmitter(this._booking.bind(this), this._subscriptions),\n {active: this.dynComponent.SelectedItems$.pipe(map((items) => items.length !== 0))}),\n {\n formConfig: {\n showMassEdit: false,\n onSubmit: ApUtilService.createEventEmitter(this._updateItems.bind(this), this._subscriptions),\n config: this._getPagerFieldSets()\n }\n }\n );\n }\n\n private _getPagerFieldSets(): ApDynformsConfigFieldset[] {\n const selectedCampaignYear = this.campaignYearStore.getSelectedCampaignYear().Year;\n const campaignYearRange = this.campaignYearService.getCampaignYearRange(selectedCampaignYear);\n return [\n new ApDynformsConfigFieldset({\n key: 'Time',\n legend: 'Docu_Ini__Time',\n useMaxWidth: true,\n config: [\n new ApDynformsConfigDatepicker({\n key: 'FertilizationDate',\n label: 'Nutrients__FertilizationDate',\n minDate: campaignYearRange.StartYear,\n maxDate: campaignYearRange.EndYear,\n }),\n new ApDynformsConfigTimepicker({\n key: 'Duration',\n label: 'Docu_Ini__Duration',\n format: 'HH:mm',\n minSteps: 5,\n secSteps: 60\n })\n ]\n }),\n new ApDynformsConfigFieldset({\n key: 'Resources',\n legend: 'Settings__Lbl_Menu_Resources',\n useMaxWidth: true,\n config: [\n new ApDynformsConfigComboBox({\n key: 'Machine',\n label: 'Settings__Lbl_Menu_Devices',\n textField: 'NameWithSign',\n valueField: 'Id',\n options: this.machineStore.Listen(s => s.data),\n value: null,\n valuePrimitive: false,\n sort: 1\n }),\n new ApDynformsConfigComboBox({\n key: 'Instrument',\n label: 'Docu_Ini__Tool',\n textField: 'Name',\n valueField: 'Id',\n options: this.instrumentStore.Listen(s => s.data),\n value: null,\n valuePrimitive: false,\n sort: 1\n }),\n new ApDynformsConfigComboBox({\n key: 'Driver',\n label: 'Docu_Ini__Motorist',\n textField: 'ShortFullName',\n valueField: 'Id',\n options: this.driverStore.Listen(s => s.data),\n value: null,\n valuePrimitive: false,\n sort: 1\n }),\n new ApDynformsConfigPlaceholder()\n ]\n })\n ];\n }\n\n private _fieldSets(dataItem: INFertilizationBookingGridData): ApDynformsConfigFieldset[] {\n const selectedCampaignYear = this.campaignYearStore.getSelectedCampaignYear().Year;\n const campaignYearRange = this.campaignYearService.getCampaignYearRange(selectedCampaignYear);\n return [\n new ApDynformsConfigFieldset({\n key: 'Agronomy',\n legend: 'Global__Agronomy',\n useMaxWidth: true,\n config: [\n new ApDynformsConfigNumerictextbox({\n key: 'Average',\n label: 'Nutrients__Average_Amount_Nutrient_kg_N_per_ha',\n value$: this.modalDialogStore.listenChanges().pipe(\n filter(values => values && (values['Applied'] >= 0 || values['Average'] >= 0)),\n map(values => this._isApplicationRateValid(dataItem.ApplicationRate) ? values['Applied'] * dataItem.FertilizerAreaFactor : values['Average'])\n ),\n value: dataItem.Average * dataItem.FertilizerAreaFactor,\n min: 0,\n disabled: true\n }),\n new ApDynformsConfigNumerictextbox({\n key: 'Applied',\n label: this._getGoodsLabel(dataItem.Fertilizer),\n value$: this.modalDialogStore.listenChanges().pipe(\n filter(values => values && (values['Average'] >= 0 || values['Applied'] >= 0)),\n map(values => !this._isApplicationRateValid(dataItem.ApplicationRate) ? values['Average'] / dataItem.FertilizerAreaFactor : values['Applied'])\n ),\n min: 0,\n value: dataItem.Applied,\n decimals: 0,\n disabled: !this._isApplicationRateValid(dataItem.ApplicationRate)\n }),\n ]\n }),\n new ApDynformsConfigFieldset({\n key: 'Time',\n legend: 'Docu_Ini__Time',\n useMaxWidth: true,\n config: [\n new ApDynformsConfigDatepicker({\n key: 'FertilizationDate',\n label: 'Nutrients__FertilizationDate',\n value$: this.modalDialogStore.listenChanges().pipe(\n filter(values => values && values['FertilizationDate']),\n map(values => values['FertilizationDate'])\n ),\n value: dataItem.FertilizationDate,\n minDate: campaignYearRange.StartYear,\n maxDate: campaignYearRange.EndYear\n }),\n new ApDynformsConfigTimepicker({\n key: 'Duration',\n label: 'Docu_Ini__Duration',\n format: 'HH:mm',\n value: dataItem.Duration,\n minSteps: 5,\n secSteps: 60\n })\n ]\n }),\n new ApDynformsConfigFieldset({\n key: 'Resources',\n legend: 'Settings__Lbl_Menu_Resources',\n useMaxWidth: true,\n config: [\n new ApDynformsConfigComboBox({\n key: 'Machine',\n label: 'Settings__Lbl_Menu_Devices',\n textField: 'NameWithSign',\n valueField: 'Id',\n valuePrimitive: false,\n value: dataItem.Machine,\n value$: this.modalDialogStore.listenChanges().pipe(\n filter(values => values['Machine']),\n map(values => values['Machine'])\n ),\n options: this.machineStore.Listen(s => s.data),\n sort: 1\n }),\n new ApDynformsConfigComboBox({\n key: 'Instrument',\n label: 'Docu_Ini__Tool',\n textField: 'Name',\n valueField: 'Id',\n valuePrimitive: false,\n value: dataItem.Instrument,\n value$: this.modalDialogStore.listenChanges().pipe(\n filter(values => values['Machine'] || values['Instrument']),\n map(values => {\n if (values['Instrument']) {\n return values['Instrument'];\n }\n const formValues = this.modalDialogStore.getFormValues();\n if (formValues['Instrument']) {\n return formValues['Instrument'];\n }\n if (values['Machine'].DefaultInstrument) {\n return values['Machine'].DefaultInstrument;\n }\n return null;\n })\n ),\n options: this.instrumentStore.Listen(s => s.data),\n sort: 1\n }),\n new ApDynformsConfigComboBox({\n key: 'Driver',\n label: 'Docu_Ini__Motorist',\n textField: 'ShortFullName',\n valueField: 'Id',\n valuePrimitive: false,\n value: dataItem.Driver,\n value$: this.modalDialogStore.listenChanges().pipe(\n filter(values => values['Machine'] || values['Driver']),\n map(values => {\n if (values['Driver']) {\n return values['Driver'];\n }\n const formValues = this.modalDialogStore.getFormValues();\n if (formValues['Driver']) {\n return formValues['Driver'];\n }\n if (values['Machine'].DefaultDriver) {\n return values['Machine'].DefaultDriver;\n }\n return null;\n })\n ),\n options: this.driverStore.Listen(s => s.data),\n sort: 1\n }),\n new ApDynformsConfigPlaceholder()\n ]\n }),\n ];\n }\n\n private _isApplicationRateValid(applicationRate: number | null): boolean {\n return applicationRate && applicationRate > 0;\n }\n\n private _getGridStatus(status: TaskManagementStatus): { Class: string, Desc: string } {\n switch (status) {\n case TaskManagementStatus.Green:\n return {Class: 'ap-status-green', Desc: ''};\n case TaskManagementStatus.Yellow:\n return {Class: 'ap-status-yellow', Desc: ''};\n case TaskManagementStatus.Red:\n return {Class: 'ap-status-red', Desc: ''};\n }\n }\n\n private _getGoodsLabel(fertilizer: CombinedFertilizer): string {\n switch (fertilizer?.Unit?.Description) {\n case 'm³':\n return 'Global__GoodsSpread_m3';\n case 'l':\n return 'Global__GoodsSpread_l';\n case 't':\n return 'Global__GoodsSpread_t';\n default:\n return 'Global__GoodsSpread_kg';\n }\n }\n}\n","import {Injectable} from '@angular/core';\nimport {CampaignYearStore} from '../login/campaignyear.store';\nimport IField = Data.FieldManagement.IField;\nimport IFieldGeom = Data.FieldManagement.IFieldGeom;\n\n@Injectable({\n providedIn: 'root'\n})\nexport class ApGetGeomService {\n\n constructor(private campaignYearStore: CampaignYearStore) {\n }\n\n getGeom(field: IField): IFieldGeom {\n return field.FieldGeoms.Find((geom) =>\n geom.ValidFrom <= this.campaignYearStore.getSelectedCampaignYear().DefaultStart &&\n geom.ValidTo >= this.campaignYearStore.getSelectedCampaignYear().DefaultEnd);\n }\n}\n","import {AfterViewInit, Component, EventEmitter, OnDestroy, OnInit, ViewChild} from '@angular/core';\nimport {\n FormStore\n} from '../../stores/layout/form.store';\nimport {BehaviorSubject, combineLatest, debounceTime, Observable, Subscription} from 'rxjs';\nimport {\n ApDynGridColumnConfigBase,\n ApDynGridColumnHideConfig\n} from '../../ap-dyngrids/config/ap-dyn-grid-column-config-base';\nimport {\n delay,\n filter,\n map\n} from 'rxjs/operators';\nimport {\n ApplicationMapConfig\n} from './ap-n-fertilization-planning-configs/application-map.config';\nimport {\n TargetRateConfig\n} from './ap-n-fertilization-planning-configs/target-rate.config';\nimport {\n NFertilizationConfig\n} from './ap-n-fertilization-planning-configs/n-fertilization.config';\nimport {\n RapeFertilizationConfig\n} from './ap-n-fertilization-planning-configs/rape-fertilization.config';\nimport {\n LanguageStore\n} from '../../stores/translation/language.store';\nimport {\n SettingsStore\n} from '../../stores/base-data/settings.store';\nimport {\n GetRoundNumericPipe\n} from '../../ap-utils';\nimport {\n MapViewStore\n} from '../../stores/layout/mapview.store';\nimport {\n ApDynGridPagerWizardBreadcrumbsStepper,\n ApDynGridPagerWizardButton,\n ApDynGridPagerWizardConfig\n} from '../../ap-dyngrids/config/ap-dyn-grid-pager-wizard-config';\nimport {\n ApUtilService\n} from '../../ap-utils/service/ap-util.service';\nimport {\n ApDynComponentComponent\n} from '../../ap-dyncomponent/ap-dyncomponent.component';\nimport {\n ApDynGridPagerConfigBase\n} from '../../ap-dyngrids/config/ap-dyn-grid-pager-config-base';\nimport {\n ApDynformsConfigFieldset\n} from '../../ap-dynforms/config/ap-dynforms-config-fieldset';\nimport {\n BoniturConfig\n} from './ap-n-fertilization-planning-configs/bonitur.config';\nimport {\n CropTypeStore\n} from '../../stores/base-data/crop.types.store';\nimport {\n ObjectFactory\n} from 'ts-tooling';\nimport {\n ApDynGridPropertyColumnConfig,\n FilterType\n} from '../../ap-dyngrids/config/ap-dyn-grid-property-column-config';\nimport {\n MapViewMode\n} from '../../ap-interface';\nimport {\n ApDynGridEditColumnConfig\n} from '../../ap-dyngrids/config/ap-dyn-grid-edit-column-config';\nimport {\n ApDynGridStatusColumnConfig\n} from '../../ap-dyngrids/config/ap-dyn-grid-status-column-config';\nimport {\n FieldStore\n} from '../../stores/farm/field.store';\nimport {\n IModalDialogData,\n ModalDialogButtonDisable\n} from '../../ap-interface/interfaces/ap-modaldialog-data.interface';\nimport {\n TranslationStore\n} from '../../stores/translation/translation.store';\nimport {\n ModalDialogStore\n} from '../../stores/dialog/modal.dialog.store';\nimport {\n NFertilizationStore\n} from '../../stores/n-fertilization/n-fertilization.store';\nimport {\n ApDynGridGroupColumnConfig\n} from '../../ap-dyngrids/config/ap-dyn-grid-group-column-config';\nimport {\n CampaignYearStore\n} from '../../stores/login/campaignyear.store';\nimport {\n ApGetCropService\n} from '../../stores/services/ap-get-crop.service';\nimport {\n CropRotationStore\n} from '../../stores/farm/crop.rotation.store';\nimport {\n ApGetGeomService\n} from '../../stores/services/ap-get-geom.service';\nimport {\n LoginStore\n} from '../../stores/login/login.store';\nimport {\n OperationModesEnum\n} from '../../stores/common/operation-modes.store';\nimport {\n MachineStore\n} from '../../stores/docu/machine.store';\nimport {\n DriverStore\n} from '../../stores/docu/driver.store';\nimport {\n InstrumentStore\n} from '../../stores/docu/instrument.store';\nimport {\n GeneralConfig\n} from './ap-n-fertilization-planning-configs/general.config';\nimport {\n FertilizerStore\n} from '../../stores/base-data/fertilizer.store';\nimport {\n ApDynformsConfigDatepicker\n} from '../../ap-dynforms/config/ap-dynforms-config-datepicker';\nimport {\n ApDynformsConfigTextbox\n} from '../../ap-dynforms/config/ap-dynforms-config-textbox';\nimport {\n ApDateService\n} from '../../ap-core/services/ap-date-service';\nimport {\n ApNFertilizationCommonService\n} from '../../n-fertilization/services/ap-n-fertilization.common.service';\nimport {\n SensorStore\n} from '../../stores/sensor/sensor.store';\nimport {\n ApplicationMapAbsoluteConfig\n} from './ap-n-fertilization-planning-configs/application-map-absolute.config';\nimport {\n ApplicationSettingsService\n} from '../../services/data/application-settings.service';\nimport {\n NFertilizationService\n} from '../../services/data/n-fertilization.service';\nimport {\n UniformConfig\n} from './ap-n-fertilization-planning-configs/uniform.config';\nimport INFertilizationPlanBook = Data.TaskManagement.INFertilizationPlanBook;\nimport INFertilizationSummary = Data.TaskManagement.INFertilizationSummary;\nimport TaskManagementStatus = Data.TaskManagement.TaskManagementStatus;\nimport ICropTypes = Data.BaseData.ICropTypes;\nimport IGuid = System.IGuid;\nimport ISensorFieldData = Data.Sensor.ISensorFieldData;\n\ntype SelectedItem = {\n FieldId: IGuid,\n PlanBookId: IGuid\n};\n\n// This component currently not in use\n@Component({\n selector: 'ap-n-fertilization-edit',\n template: `\n \n
\n
\n \n
\n
\n \n \n
\n
\n \n
\n
\n
\n `,\n styles: [],\n providers: [\n ApplicationMapConfig,\n ApplicationMapAbsoluteConfig,\n RapeFertilizationConfig,\n NFertilizationConfig,\n TargetRateConfig,\n BoniturConfig,\n UniformConfig\n ]\n})\nexport class ApNFertilizationEditComponent implements OnInit, AfterViewInit, OnDestroy {\n @ViewChild(ApDynComponentComponent, {static: true}) dynComponent: ApDynComponentComponent;\n public columns$ = new BehaviorSubject(undefined);\n public fieldSets$ = new BehaviorSubject([]);\n public items$ = new BehaviorSubject([]);\n public loading$: Observable;\n public pager: ApDynGridPagerConfigBase;\n public nextDisabled$ = new BehaviorSubject(false);\n public formNext = new EventEmitter();\n public formPrevious = new EventEmitter();\n public caption: string;\n public breadCrumbsColumns = ['Global__Selection', 'Global__Details', 'Admin_Pages__Overview'];\n\n private _data: any;\n private _selectedFields$ = new BehaviorSubject([]);\n private _overViewGridSubscription: Subscription[] = [];\n private _selectionGridSubscription: Subscription[] = [];\n private _selectedItems: SelectedItem[];\n private _subscriptions: Subscription[] = [];\n\n constructor(private campaignYearStore: CampaignYearStore,\n private cropRotationStore: CropRotationStore,\n private cropService: ApGetCropService,\n private cropTypeStore: CropTypeStore,\n private driverStore: DriverStore,\n private fertilizerStore: FertilizerStore,\n private fieldStore: FieldStore,\n private formStore: FormStore,\n private generalConfig: GeneralConfig,\n private geomService: ApGetGeomService,\n private instrumentStore: InstrumentStore,\n private languageStore: LanguageStore,\n private loginStore: LoginStore,\n private machineStore: MachineStore,\n private mapViewStore: MapViewStore,\n private modalDialogStore: ModalDialogStore,\n private nFertilizationStore: NFertilizationStore,\n private sensorStore: SensorStore,\n private roundNumericPipe: GetRoundNumericPipe,\n private settingsStore: SettingsStore,\n private translationStore: TranslationStore,\n private dateService: ApDateService,\n private applicationSettingsService: ApplicationSettingsService,\n private fertilizationCommonService: ApNFertilizationCommonService,\n private nFertilizationService: NFertilizationService,\n private applicationMapAbsoluteConfig: ApplicationMapAbsoluteConfig,\n private uniformConfig: UniformConfig,\n private boniturConfig: BoniturConfig,\n private targetRateConfig: TargetRateConfig,\n private applicationMapConfig: ApplicationMapConfig,\n private nFertilizationConfig: NFertilizationConfig,\n private rapeFertilizationConfig: RapeFertilizationConfig) {\n }\n\n ngOnInit(): void {\n const updateComponentData = this.formStore.Listen(s => s.updateComponent).getValue().data;\n this._data = ObjectFactory.Copy(updateComponentData);\n this._data.dataItem['FertilizationDate'] = this._data.dataItem['FertilizationDate'];\n this._data.dataItem['Product'] = this.fertilizerStore.getFertilizer(this._data.dataItem['ProductId']);\n this._data.dataItem['Group'] = this.fertilizerStore.getGroup(this._data.dataItem['ProductId']);\n this.caption = 'Docu_Ini__Edit';\n this.loading$ = combineLatest([\n this.fieldStore.Listen(s => s.loading),\n this.cropRotationStore.Listen(s => s.historyLoading)\n ]).pipe(\n map((loadings) => loadings.some(l => l))\n );\n this._markFormAsTouched();\n this._buildSelectionGrid();\n this._buildSelectionPager();\n this._setSelectionItems();\n this._setSelectionSelectedItems();\n }\n\n ngAfterViewInit(): void {\n this._subscriptions.push(this.formNext.subscribe(() => this._onFormNext()));\n this._subscriptions.push(this.formPrevious.subscribe(() => this._onFormBack()));\n this._subscriptions.push(this.dynComponent.SelectedItems$.subscribe(items => {\n this.fieldStore.changeSelectedField(items.map(item => item.FieldId.toString()));\n }));\n }\n\n ngOnDestroy(): void {\n this._selectionGridSubscription.forEach(s => s.unsubscribe());\n this._overViewGridSubscription.forEach(s => s.unsubscribe());\n this._subscriptions.forEach(s => s.unsubscribe());\n }\n\n public onEdit(dataItem: any): void {\n this.modalDialogStore.setModalDialogData({\n buttons: [\n {\n key: 'cancel',\n text: 'Global__Cancel',\n primary: false\n },\n {\n key: 'apply',\n text: 'Global__Ok',\n primary: true,\n disable: ModalDialogButtonDisable.FormInvalid,\n }\n ],\n show: true,\n title: this.translationStore.FindTranslationForSelectedLanguage('Docu_Ini__Edit'),\n formConfig: {\n fieldSets: this._getFieldSets(this.modalDialogStore.listenChanges(), [dataItem]),\n values: dataItem,\n },\n values: dataItem\n } as IModalDialogData);\n const resultSubscription = this.modalDialogStore.Listen(s => s.result)\n .subscribe((result) => {\n if (result?.key === 'apply') {\n this._updateOverviewItems({ids: [dataItem['Id']], value: ObjectFactory.Copy(result.formValues)});\n resultSubscription.unsubscribe();\n } else if (result?.key === 'cancel') {\n resultSubscription.unsubscribe();\n }\n });\n }\n\n private _markFormAsTouched(): void {\n setTimeout(() =>\n this._subscriptions.push(this.dynComponent.FormValues$\n .pipe(debounceTime(100), delay(1))\n .subscribe((values) => {\n this.nextDisabled$.next(values['Product'] === null);\n this.dynComponent.dynForm.markAsTouched();\n })\n ), 1);\n }\n\n private _setSelectionItems(): void {\n this._selectionGridSubscription.push(combineLatest([\n this.fieldStore.Listen(s => s.data).pipe(\n map((fields) =>\n fields.filter((f) =>\n this.cropService.getCrop(f, true, 'object')?.Id === this._data['CropId'])),\n ),\n this.cropRotationStore.Listen(s => s.history),\n this.campaignYearStore.Listen(s => s.selectedYear),\n this.cropTypeStore.Listen(s => s.cropTypesNames),\n this.nFertilizationStore.GetNeeds$(this.campaignYearStore.getSelectedCampaignYear().Year),\n this.sensorStore.Listen(s => s.data)\n ]).pipe(\n filter(([fields, cropRotation]) =>\n fields.length !== 0 && Object.keys(cropRotation).length !== 0),\n map(([fields, cropRotation, year, cropTypes, needs, sensorFieldData]) => fields.map((field) => {\n const geom = this.fieldStore.getCurrentFieldGeom(field);\n const fieldCrop = cropRotation[field.Id as string];\n const needValue = needs.find(n => n.FieldId === field.Id);\n const sensorData = sensorFieldData?.Find(_ => _?.FieldGeomId === geom?.Id) as ISensorFieldData;\n let crop: any;\n let cropId: number;\n let status = {\n state: -1,\n class: 'ap-status-red',\n description: 'Global__Inactive',\n };\n if (fieldCrop) {\n cropId = fieldCrop[year.Year].MainCrop;\n status = this._getStatus(cropId);\n crop = cropTypes[cropId];\n }\n return {\n Id: field.Id,\n FieldId: field.Id,\n Status: status.state,\n StatusClass: status.class,\n StatusDesc: status.description,\n Nr: field.FieldNumber,\n TNr: field.FieldSubnumber,\n NrTNr: this.fieldStore.getFieldNumberAndSubNumber(field),\n Name: field.FieldName,\n Area: geom ? geom.AreaHa : undefined,\n Crop: crop,\n CropId: cropId,\n SecondCropId: (this.cropService.getCrop(field, false, 'object') as ICropTypes)?.Id,\n Geom: geom,\n Kind: '',\n EC: '-',\n Application: '-',\n Date: sensorData?.Created ?? '-',\n Avg: sensorData?.Avg ?? '-',\n Min: sensorData?.Min ?? '-',\n Max: sensorData?.Max ?? '-',\n Sum: '-',\n Remaining: needValue?.Value ?? '-',\n NUptake: '-',\n };\n })),\n ).subscribe((items) => this.items$.next(items)));\n\n this._selectedItems = this._data.PlanBooks.map((pB: any) => ({PlanBookId: pB.FieldId, FieldId: pB.FieldId}));\n }\n\n private _setOverviewItems(): void {\n let planBooks: INFertilizationPlanBook[] = this._data['PlanBooks'];\n const summary: INFertilizationSummary = this._data['PlanBooks'][0].Summary;\n\n const deletePlanBooks = this.nFertilizationStore.Listen(s => s.planBooks).getValue()\n .filter((planBook) =>\n planBook.Summary.Id === summary.Id && planBook.DeletedBy && this._selectedItems.some(x => x.PlanBookId === planBook.Id)\n );\n const newPlanBooks = this._selectedItems\n .filter((selectedItem: SelectedItem) =>\n !planBooks.concat(deletePlanBooks).map((planBook) => planBook.FieldId).Contains(selectedItem.FieldId)\n )\n .map((selectedItem: SelectedItem) => {\n const field = this.fieldStore.getFieldById(selectedItem.FieldId);\n const geom = this.fieldStore.getCurrentFieldGeom(field);\n return {\n FieldGeomId: this.geomService.getGeom(field).Id,\n MainCropId: this.cropService.getCrop(field, true, 'object')?.Id,\n ApplicationMin: summary.UserApplicationMinimum,\n ApplicationRate: summary.UserApplicationRate,\n Summary: summary,\n ECValue: summary.ECValue,\n Slope: summary.Slope,\n Threshold: summary.Threshold,\n ApplicationMax: summary.UserApplicationMaximum,\n ApplicationConst: summary.UserApplicationConstant,\n ApplicationDate: this.dateService.toFarmDateFromUtc(summary.ApplicationDate).toDate(),\n FieldId: field.Id,\n ProductId: planBooks[0].ProductId,\n FarmId: summary.FarmId,\n ApplicationMode: summary.ApplicationMode,\n Area: geom.AreaHa,\n Element: 5,\n OperationMode: summary.OperationMode,\n SecondCropId: this.cropService.getCrop(field, false, 'object')?.Id,\n ValidFrom: planBooks[0].ValidFrom,\n ValidTo: planBooks[0].ValidTo,\n Version: 0,\n Status: TaskManagementStatus.Yellow,\n } as INFertilizationPlanBook;\n });\n\n planBooks = planBooks\n .filter((planBook) => this._selectedItems.some(x => x.PlanBookId === planBook.Id))\n .concat(newPlanBooks)\n .concat(deletePlanBooks);\n\n this.items$.next(planBooks.filter(x => this.fieldStore.getFieldById(x.FieldId)).map((planBook: INFertilizationPlanBook): any => {\n const field = this.fieldStore.getFieldById(planBook.FieldId);\n const geom = this.fieldStore.getCurrentFieldGeom(field);\n const driver = this.driverStore.Listen(s => s.data).getValue().find((d) => d.Id === planBook.ExportDriver);\n const machine = this.machineStore.Listen(s => s.data).getValue().find((m) => m.Id === planBook.ExportMachine);\n const instrument = this.instrumentStore.Listen(s => s.data).getValue().find((i) => i.Id === planBook.ExportInstrument);\n const nNeeds = this.nFertilizationStore.GetNeeds$(this.campaignYearStore.getSelectedCampaignYear().Year);\n const mainCrop = this.cropTypeStore.getDefaultCroptype(planBook.MainCropId);\n return {\n ...planBook,\n StatusClass: ['ap-status-red', 'ap-status-yellow', 'ap-status-green'][planBook.Status + 1],\n Name: this.fieldStore.getFieldName(field),\n Nr: field.FieldNumber,\n TNr: field.FieldSubnumber,\n NrTNr: this.fieldStore.getFieldNumberAndSubNumber(field),\n FieldId: field.Id,\n Crop: mainCrop?.Description ?? '',\n Date: this.dateService.toFarmDateFromUtc(planBook.ApplicationDate).toDate(),\n Area: geom.AreaHa,\n EppoCode: mainCrop?.Eppocode ?? '',\n Constant: planBook.ApplicationConst,\n Minimum: planBook.ApplicationMin,\n Maximum: planBook.ApplicationMax,\n Threshold: planBook.Threshold,\n ControlFactor: planBook.Summary.Slope,\n ECStage: planBook.ECValue,\n ReferenceValue: planBook.ApplicationRate,\n Amount: planBook.ApplicationRate * planBook.Factor,\n TargetRate: (planBook.ApplicationMin + planBook.ApplicationMax) / 2,\n ControlRange: (planBook.ApplicationMax - planBook.ApplicationMin) / 2,\n ExportDriver: planBook.ExportDriver,\n ExportMachine: planBook.ExportMachine,\n ExportInstrument: planBook.ExportInstrument,\n Driver: driver?.ShortFullName,\n Machine: machine?.NameWithSign,\n Instrument: instrument?.Name,\n NNeeds: nNeeds,\n ControlFactorDescription: this.translationStore.FindTranslationForSelectedLanguage(\n planBook.Summary.Slope === 1 ? 'Global__Yield_Oriented' : 'Global__Quality_Oriented'),\n ColumnLoading: false\n };\n }));\n }\n\n private _buildFormAgronomy(values$: Observable, currentFormValues: () => any): void {\n this.caption = 'Global__Details';\n this.columns$.next(undefined);\n this.fieldSets$.next([\n this.generalConfig.getProductFieldSet({\n Group: this._data['Group'],\n Product: this._data['ProductId']\n }, this.dynComponent.FormValues$),\n new ApDynformsConfigFieldset({\n key: 'General',\n legend: 'Global__General_Information',\n config: [\n new ApDynformsConfigDatepicker({\n key: 'FertilizationDate',\n label: 'Nutrients__FertilizationDate',\n minDate: this.campaignYearStore.Listen(s => s.selectedYear).pipe(\n filter((year) => !!year),\n map((year) => new Date(year.DefaultStart))\n ),\n maxDate: this.campaignYearStore.Listen(s => s.selectedYear).pipe(\n filter((year) => !!year),\n map((year) => new Date(year.DefaultEnd))\n ),\n value: this._data['FertilizationDate']\n }),\n new ApDynformsConfigTextbox({\n key: 'Note',\n label: 'Global__Note',\n value: this._data['Note']\n })\n ]\n }),\n this.generalConfig.getDocuFieldSet(this._data, values$, currentFormValues, true),\n ]);\n }\n\n public _buildSelectionGrid(): void {\n this._selectionGridSubscription.push(combineLatest([\n this.languageStore.Listen(s => s.selectedLanguage),\n this.settingsStore.Listen(s => s.data)\n ]).pipe(\n filter(([language, settings]) => !!language && settings.length !== 0),\n map(([language, settings]) => ({language, setting: settings[0]})),\n map((p) => [\n new ApDynGridStatusColumnConfig({\n field: 'Status',\n class: 'StatusClass',\n description: 'StatusDesc',\n filterable: true\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Docu_Ini__Number',\n field: 'Nr',\n width: 60,\n hide: true,\n filterType: FilterType.NUMBER,\n cssClass: 'right',\n filterable: true\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Docu_Ini_Subnumber',\n field: 'TNr',\n width: 60,\n hide: true,\n filterType: FilterType.NUMBER,\n cssClass: 'right',\n filterable: true\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Docu_Ini__Number',\n field: 'NrTNr',\n width: 70,\n filterable: true,\n hide: new ApDynGridColumnHideConfig({\n selfHide: this.mapViewStore.Listen(s => s.mode).pipe(map((mode) => mode === MapViewMode.HIDE))\n })\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Docu_Ini__Name',\n field: 'Name',\n width: 150,\n filterable: true,\n sortIndex: 0,\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Docu_Ini__Area',\n field: 'Area',\n width: 100,\n filterable: true,\n tooltip: (dataItem) => dataItem['Area'],\n pipes: [{\n pipe: this.roundNumericPipe,\n args: [p.setting.DigitsAfterDecimalPoint]\n }]\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__Crop',\n field: 'Crop',\n width: 80,\n filterable: true\n }),\n new ApDynGridGroupColumnConfig({\n title: 'Global__latest_Sensor_reading',\n hide: true,\n groupColumns: [\n new ApDynGridPropertyColumnConfig({\n title: 'Global__EC',\n field: 'EC',\n width: 50,\n filterable: true\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__Application',\n field: 'Application',\n width: 80,\n filterable: true\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__Date',\n field: 'Date',\n format: this.languageStore.CurrentDateFormat,\n width: 70,\n filterable: true\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__AvgShort',\n field: 'Avg',\n width: 60,\n filterable: true\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__Min',\n field: 'Min',\n width: 60,\n filterable: true\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__Max',\n field: 'Max',\n width: 60,\n filterable: true\n })\n ]\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Nutrients__Remaining_Unit',\n field: 'Remaining',\n width: 60,\n filterable: true\n }),\n new ApDynGridGroupColumnConfig({\n title: 'agrioptions_resources',\n hide: true,\n groupColumns: [\n new ApDynGridPropertyColumnConfig({\n field: 'Machine',\n title: 'Base__Engine',\n width: 100,\n hide: true,\n }),\n new ApDynGridPropertyColumnConfig({\n field: 'Instrument',\n title: 'AgriConnect_Ini__Tool',\n width: 100,\n hide: true\n }),\n new ApDynGridPropertyColumnConfig({\n field: 'Driver',\n title: 'Docu_Ini__Motorist',\n width: 100,\n hide: true\n }),\n ]\n }),\n ]),\n ).subscribe(columns => this.columns$.next(columns)));\n }\n\n private _buildOverviewGrid(): void {\n this._overViewGridSubscription.push(combineLatest([\n this.languageStore.Listen(s => s.selectedLanguage),\n this.settingsStore.Listen(s => s.data)\n ]).pipe(\n filter(([language, settings]) => !!language && settings.length !== 0),\n map(([language, settings]) => ({language, setting: settings[0]})),\n map((p) => {\n const mapHide = this.mapViewStore.Listen(s => s.mode).pipe(\n map((mapMode) => mapMode === MapViewMode.HIDE));\n let result: ApDynGridColumnConfigBase[] = [\n new ApDynGridStatusColumnConfig({\n field: 'Status',\n class: 'StatusClass',\n description: 'StatusDesc',\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Docu_Ini__Number',\n field: 'Nr',\n width: 60,\n hide: true,\n filterType: FilterType.NUMBER,\n cssClass: 'right'\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Docu_Ini_Subnumber',\n field: 'TNr',\n width: 60,\n hide: true,\n filterType: FilterType.NUMBER,\n cssClass: 'right'\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Docu_Ini__Number',\n field: 'NrTNr',\n width: 70,\n hide: new ApDynGridColumnHideConfig({\n selfHide: mapHide\n })\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Docu_Ini__Name',\n field: 'Name',\n width: 150,\n cssClass: 'left',\n sortIndex: 0,\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Docu_Ini__Area',\n field: 'Area',\n width: 60,\n tooltip: (dataItem) => dataItem['Area'],\n pipes: [{\n pipe: this.roundNumericPipe,\n args: [p.setting.DigitsAfterDecimalPoint]\n }],\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__Crop',\n field: 'Crop',\n width: 80,\n hide: true\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__EC',\n field: 'ECStage',\n width: 50,\n hide: true\n })\n ];\n\n switch (this._data['OperationModeKey']) {\n case OperationModesEnum.ApplicationMap:\n result = result.concat(this.applicationMapConfig.gridBuilderConfig(mapHide));\n break;\n case OperationModesEnum.ApplicationMapAbsolute:\n result = result.concat(this.applicationMapAbsoluteConfig.gridBuilderConfig(mapHide));\n break;\n case OperationModesEnum.TargetValue:\n result = result.concat(this.targetRateConfig.gridBuilderConfig());\n break;\n case OperationModesEnum.NFertilization:\n result = result.concat(this.nFertilizationConfig.gridBuilderConfig());\n break;\n case OperationModesEnum.RapeFertilization:\n result = result.concat(this.rapeFertilizationConfig.gridBuilderConfig());\n break;\n case OperationModesEnum.Constant:\n result = result.concat(this.uniformConfig.gridBuilderConfig());\n break;\n }\n\n result = result.concat([\n new ApDynGridPropertyColumnConfig({\n title: 'Base__SortItemDate',\n field: 'Date',\n format: p.language.DateFormat,\n hide: true,\n width: 90\n }),\n new ApDynGridGroupColumnConfig({\n title: 'agrioptions_resources',\n hide: true,\n groupColumns: [\n new ApDynGridPropertyColumnConfig({\n field: 'Machine',\n title: 'Base__Engine',\n width: 100,\n hide: true,\n }),\n new ApDynGridPropertyColumnConfig({\n field: 'Instrument',\n title: 'AgriConnect_Ini__Tool',\n width: 100,\n hide: true\n }),\n new ApDynGridPropertyColumnConfig({\n field: 'Driver',\n title: 'Docu_Ini__Motorist',\n width: 100,\n hide: true\n }),\n ]\n }),\n new ApDynGridEditColumnConfig({})\n ]);\n\n return result;\n })\n ).subscribe(column => this.columns$.next(column)));\n }\n\n private _buildSelectionPager(): void {\n this.pager = new ApDynGridPagerWizardConfig(\n new ApDynGridPagerWizardButton('Global_Back_With_Arrow', ApUtilService.createEventEmitter(this._onClose.bind(this), this._selectionGridSubscription)),\n new ApDynGridPagerWizardBreadcrumbsStepper(this.breadCrumbsColumns, 0),\n new ApDynGridPagerWizardButton('Global_Next_With_Arrow', ApUtilService.createEventEmitter(this._onGridNext.bind(this), this._selectionGridSubscription), {\n active: this.dynComponent.SelectedItems$.pipe(\n map((items) => items.length !== 0),\n delay(0)\n )\n })\n );\n }\n\n private _buildOverviewPager(): void {\n this.pager = new ApDynGridPagerWizardConfig(\n new ApDynGridPagerWizardButton('Global_Back_With_Arrow', ApUtilService.createEventEmitter(this._onGridBack.bind(this), this._overViewGridSubscription)),\n new ApDynGridPagerWizardBreadcrumbsStepper(this.breadCrumbsColumns, 2),\n new ApDynGridPagerWizardButton('Global__Save', ApUtilService.createEventEmitter(this._onSave.bind(this), this._overViewGridSubscription)),\n {\n formConfig: {\n config: this._getFieldSets(this.dynComponent.PagerValues$, null),\n onSubmit: ApUtilService.createEventEmitter(this._updateOverviewItems.bind(this), this._overViewGridSubscription)\n }\n }\n );\n }\n\n private _setSelectionSelectedItems(): void {\n this._selectionGridSubscription.push(\n combineLatest([\n this.dynComponent.gridSubject,\n this.items$\n ]).pipe(\n filter(([grid]) => grid !== undefined),\n ).subscribe(\n ([grid]) => {\n grid.gridPaging.setSelectedKeys(this._selectedItems);\n }\n )\n );\n }\n\n private _setOverviewSelectedItems(): void {\n this._overViewGridSubscription.push(\n this.dynComponent.gridSubject.subscribe(grid => grid?.gridPaging?.setSelectedKeys([]))\n );\n }\n\n private _getFieldSets(values$: Observable, dataItem: any[] | null = null): ApDynformsConfigFieldset[] {\n let fieldSet = [];\n const operationMode = this._data['OperationModeKey'];\n const selectedItems = !!dataItem && dataItem.length > 0 ? dataItem : this.dynComponent.getSelectedItems();\n const selectedItemsForApplicationSettings = selectedItems.map(x => ({\n EcValue: x.ECStage,\n EppoCode: x.EppoCode\n }));\n const applicationSettings = this.applicationSettingsService.getApplicationSettings(\n operationMode, selectedItemsForApplicationSettings[0].EppoCode);\n const cropIds = this._data['PlanBooks'].map((x: any) => x.MainCropId);\n const cropType = this.cropTypeStore.getDefaultCroptype(cropIds[0]);\n switch (operationMode) {\n case OperationModesEnum.ApplicationMap:\n fieldSet = fieldSet.concat(\n this.applicationMapConfig.formBuilder(\n this._data,\n values$.pipe(delay(0)),\n applicationSettings,\n true\n )\n );\n break;\n case OperationModesEnum.ApplicationMapAbsolute:\n fieldSet = fieldSet.concat(\n this.applicationMapAbsoluteConfig.formBuilder(\n this._data,\n values$.pipe(delay(0)),\n this._getAreaWeightedAverage(),\n cropType.CropKey,\n applicationSettings,\n true\n )\n );\n break;\n case OperationModesEnum.TargetValue:\n fieldSet = fieldSet.concat(this.targetRateConfig.formBuilder(this._data, values$.pipe(delay(0)),\n this.nFertilizationService.isRapeCrop(cropIds),\n true));\n break;\n case OperationModesEnum.NFertilization:\n fieldSet = fieldSet.concat(this.nFertilizationConfig.formBuilderConfig(\n this._data, values$.pipe(delay(0)), cropType.Id, cropType.CropKey, true));\n break;\n case OperationModesEnum.RapeFertilization:\n fieldSet = fieldSet.concat(this.rapeFertilizationConfig.formBuilderConfig(this._data,\n values$.pipe(delay(0)), cropType.CropKey, true));\n break;\n case OperationModesEnum.Bonitur:\n fieldSet = fieldSet.concat(this.boniturConfig.formBuilder(this._data, true));\n break;\n case OperationModesEnum.Constant:\n fieldSet = fieldSet.concat(this.uniformConfig.formBuilder(this._data, values$.pipe(delay(0)),\n true));\n }\n return fieldSet;\n }\n\n private _getStatus(detailsId: number): { state: number, class: string, description: string } {\n const cropType = this.cropTypeStore.getDefaultCroptype(detailsId);\n const result = {state: undefined, class: undefined, description: undefined};\n if (cropType && cropType.IsSensorCrop) {\n result.state = 1;\n result.class = 'ap-status-green';\n result.description = 'Global__Active';\n } else if (cropType) {\n result.state = 0;\n result.class = 'ap-status-yellow';\n result.description = 'Global__Inactive';\n } else {\n result.state = -1;\n result.class = 'ap-status-red';\n result.description = 'Global__Inactive';\n }\n\n return result;\n }\n\n private _getAreaWeightedAverage(): number {\n const selectedFields = this._selectedFields$.getValue().map(item => ({Area: item.Area, Average: item.Avg}));\n return this.fertilizationCommonService.calculateAreaWeightedAverage(selectedFields);\n }\n\n private _onFormBack(): void {\n this.fieldSets$.next([]);\n this._setSelectionItems();\n this._setSelectionSelectedItems();\n this._buildSelectionGrid();\n this._buildSelectionPager();\n }\n\n private _onGridBack(): void {\n this._overViewGridSubscription.forEach(s => s.unsubscribe());\n this.fieldStore.changeSelectedField(this._selectedItems.map(x => x.FieldId.toString()));\n this._buildFormAgronomy(this.dynComponent.dynForm.FormValues$, this.dynComponent.dynForm.form.getRawValue);\n }\n\n private _onFormNext(): void {\n const value = this.dynComponent.dynForm.form.value;\n this._data['Product'] = value.Product;\n this._data['Group'] = value.Group;\n this._data['Driver'] = value.Driver;\n this._data['Machine'] = value.Machine;\n this._data['Instrument'] = value.Instrument;\n this._data['FertilizationDate'] = value.FertilizationDate;\n this._data['Note'] = value.Note;\n\n this.fieldSets$.next([]);\n\n this._buildOverviewGrid();\n this._buildOverviewPager();\n this._setOverviewItems();\n\n setTimeout(() => this._setOverviewSelectedItems(), 1);\n }\n\n private _onGridNext(): void {\n this._selectionGridSubscription.forEach(s => s.unsubscribe());\n this._selectedItems = this.dynComponent.getSelectedItems().map((item: any) => ({\n PlanBookId: item.Id,\n FieldId: item.FieldId\n }));\n this._selectedFields$.next(this.dynComponent.getSelectedItems());\n this.fieldStore.changeSelectedField(this._selectedItems.map(x => x.FieldId.toString()));\n this._buildFormAgronomy(this.dynComponent.dynForm.FormValues$, this.dynComponent.dynForm.form.getRawValue);\n }\n\n private _onClose(): void {\n this.fieldStore.changeSelectedField([]);\n this.formStore.closeForm();\n }\n\n private _onSave(): void {\n const planBooks = this.items$.getValue().map((field) => {\n const summary: INFertilizationSummary = ObjectFactory.Copy(field['Summary']);\n summary.ApplicationDate = this._data['FertilizationDate']?.toISOString();\n summary.Title = this._data['Note'];\n return {\n ProductId: this._data['Product'],\n ApplicationMode: field['ApplicationMode'],\n OperationMode: field['OperationMode'],\n FieldGeomId: field['FieldGeomId'],\n MainCropId: field['MainCropId'],\n ApplicationConst: field['Constant'],\n ApplicationDate: field['Date'],\n ApplicationMax: field['Maximum'],\n ApplicationMin: field['Minimum'],\n ApplicationRate: field['OperationMode'].Key !== 'Global__RateConst' ? field['OperationMode'].Key !== 'OpMode_TargetRateN' ? field['Amount'] : field['TargetRate'] : field['Constant'],\n ECValue: field['ECStage'],\n Element: 5,\n Slope: field['Slope'],\n SecondCropId: field['SecondCropId'],\n Threshold: field['Threshold'],\n FieldId: field['FieldId'],\n Geom: undefined,\n Summary: summary,\n Status: field['Status'],\n Area: field['Area'],\n Id: field['PlanBookId'],\n Note: field['Note'],\n ExportDriver: this._data['Driver']?.Id ?? null,\n ExportMachine: this._data['Machine']?.Id ?? null,\n ExportInstrument: this._data['Instrument']?.Id ?? null,\n FarmId: this.loginStore.SelectedFarmId,\n } as INFertilizationPlanBook;\n });\n this.nFertilizationStore.UpdateNFertilizationPlanning(planBooks);\n this.fieldStore.changeSelectedField([]);\n this.formStore.closeForm();\n }\n\n private _updateOverviewItems(submitData: { ids: any[], value: any }): void {\n this.items$.next(this.items$.getValue().map((item) => {\n if (submitData.ids.includes(item.Id)) {\n const date = item['Date'];\n item = ObjectFactory.Merge(ObjectFactory.Copy(item), submitData.value);\n item['Date'] = date;\n if (item['OperationModeKey'] === OperationModesEnum.TargetValue) {\n item['Minimum'] = item['TargetRate'] - item['ControlRange'];\n item['Maximum'] = item['TargetRate'] + item['ControlRange'];\n }\n }\n return item;\n }));\n }\n}\n","import {AfterViewInit, Component, EventEmitter, OnDestroy, OnInit, ViewChild} from '@angular/core';\nimport {BehaviorSubject, combineLatest, Observable, of, Subscription} from 'rxjs';\nimport {\n ApDynGridColumnConfigBase,\n ApDynGridColumnHideConfig\n} from '../../ap-dyngrids/config/ap-dyn-grid-column-config-base';\nimport {\n ApDynGridPagerConfigBase\n} from '../../ap-dyngrids/config/ap-dyn-grid-pager-config-base';\nimport {ObjectFactory} from 'ts-tooling';\nimport {filter, map} from 'rxjs/operators';\nimport {\n CropTypeStore\n} from '../../stores/base-data/crop.types.store';\nimport {MapViewMode} from '../../ap-interface';\nimport {\n ApDynGridStatusColumnConfig\n} from '../../ap-dyngrids/config/ap-dyn-grid-status-column-config';\nimport {\n ApDynGridPropertyColumnConfig,\n FilterType,\n PropertyTemplate\n} from '../../ap-dyngrids/config/ap-dyn-grid-property-column-config';\nimport {\n ApDynGridGroupColumnConfig\n} from '../../ap-dyngrids/config/ap-dyn-grid-group-column-config';\nimport {\n ApDynGridPagerWizardButton,\n ApDynGridPagerWizardConfig,\n ApDynGridPagerWizardSection\n} from '../../ap-dyngrids/config/ap-dyn-grid-pager-wizard-config';\nimport {\n ApUtilService\n} from '../../ap-utils/service/ap-util.service';\nimport {\n FieldStore\n} from '../../stores/farm/field.store';\nimport {\n FormStore\n} from '../../stores/layout/form.store';\nimport {\n LanguageStore\n} from '../../stores/translation/language.store';\nimport {\n SettingsStore\n} from '../../stores/base-data/settings.store';\nimport {\n MapViewStore\n} from '../../stores/layout/mapview.store';\nimport {\n DriverStore\n} from '../../stores/docu/driver.store';\nimport {\n InstrumentStore\n} from '../../stores/docu/instrument.store';\nimport {\n MachineStore\n} from '../../stores/docu/machine.store';\nimport {GetRoundNumericPipe} from '../../ap-utils';\nimport {\n ApDateService\n} from '../../ap-core/services/ap-date-service';\nimport {\n ApDynComponentComponent\n} from '../../ap-dyncomponent/ap-dyncomponent.component';\nimport {\n ApNFertilizationShowComponentData,\n INFertilizationShowGridItem\n} from './ap-n-fertilization-show-configs/ap-n-fertilization-show-types';\nimport {\n ApDynGridEditColumnConfig\n} from '../../ap-dyngrids/config/ap-dyn-grid-edit-column-config';\nimport {\n ModalDialogStore\n} from '../../stores/dialog/modal.dialog.store';\nimport {\n ModalDialogButtonKeys,\n ModalDialogPresets\n} from '../../stores/dialog/modal.dialog.presets';\nimport {\n NFertilizationStore\n} from '../../stores/n-fertilization/n-fertilization.store';\nimport {\n IModalDialogResult\n} from '../../ap-interface/interfaces/ap-modaldialog-data.interface';\nimport {\n ApNFertilizationComponentService\n} from '../../n-fertilization/services/ap-n-fertilization-component.service';\nimport {\n ApNFertilizationCommonService\n} from '../../n-fertilization/services/ap-n-fertilization.common.service';\nimport {\n FertilizerStore\n} from '../../stores/base-data/fertilizer.store';\nimport {\n NFertilizationService\n} from '../../services/data/n-fertilization.service';\nimport {\n FertilizerService\n} from '../../services/data/fertilizer.service';\nimport {\n IContentNRelatedPlanBookStatisticValue\n} from '../../types/n-fertilization.types';\nimport {\n FertilizationManagementService\n} from '../../services/data/fertilization-management.service';\nimport {\n OperationModesEnum\n} from '../../stores/common/operation-modes.store';\nimport {\n GetRoundNumericPipeConfig\n} from '../../ap-utils/pipes/configs/get-round-numeric.pipe.config';\nimport INFertilizationPlanBook = Data.TaskManagement.INFertilizationPlanBook;\n\n@Component({\n selector: 'ap-n-fertilization-show',\n template: `\n \n `\n})\nexport class ApNFertilizationShowComponent implements OnInit, AfterViewInit, OnDestroy {\n @ViewChild(ApDynComponentComponent, {static: true}) dynComponent: ApDynComponentComponent;\n public columns$: Observable = of([]);\n public items$ = new BehaviorSubject([]);\n public loading$: Observable = of(false);\n public pager: ApDynGridPagerConfigBase;\n\n private _data: ApNFertilizationShowComponentData;\n private _subscriptions: Subscription[] = [];\n private _halfViewMode$ = new BehaviorSubject(0);\n private _halfViewModeChange = new EventEmitter();\n\n constructor(private fertilizerStore: FertilizerStore,\n private cropTypeStore: CropTypeStore,\n private fieldStore: FieldStore,\n private formStore: FormStore,\n private languageStore: LanguageStore,\n private settingsStore: SettingsStore,\n private mapViewStore: MapViewStore,\n private driverStore: DriverStore,\n private instrumentStore: InstrumentStore,\n private machineStore: MachineStore,\n private modalDialogStore: ModalDialogStore,\n private modalDialogPresets: ModalDialogPresets,\n private nFertilizationStore: NFertilizationStore,\n private dateService: ApDateService,\n private fertilizerService: FertilizerService,\n private nFertilizationService: NFertilizationService,\n private nFertilizationCommonService: ApNFertilizationCommonService,\n private fertilizationManagementService: FertilizationManagementService,\n private nFertilizationComponentService: ApNFertilizationComponentService,\n private roundNumericPipe: GetRoundNumericPipe) {\n }\n\n public ngOnInit(): void {\n this._subscriptions.push(this._halfViewModeChange.subscribe(() => {\n if (this._halfViewMode$.value) {\n this._halfViewMode$.next(0);\n } else {\n this._halfViewMode$.next(1);\n }\n }));\n this.loading$ = combineLatest([\n this.languageStore.Listen(s => s.loading),\n this.settingsStore.Listen(s => s.loading),\n this.nFertilizationStore.Listen(s => s.loading)\n ]).pipe(\n map(([languageLoading, settingsLoading]) => languageLoading || settingsLoading)\n );\n const updateComponentData = this.formStore.Listen(s => s.updateComponent).getValue().data;\n this._data = this.tryCopyComponentData(updateComponentData);\n this.columns$ = this._getColumns();\n this.pager = this._getPager();\n }\n\n public ngAfterViewInit(): void {\n this._subscriptions.push(\n this.dynComponent.SelectedItems$.subscribe((items: INFertilizationShowGridItem[]) => {\n const fieldsToSelect: string[] = items.map(x => x.FieldId.toString());\n this.fieldStore.changeSelectedField(fieldsToSelect);\n })\n );\n this._subscriptions.push(\n this.items$.subscribe((items: INFertilizationShowGridItem[]): void => {\n const itemsToSelect = items.map(x => x.Id);\n this.dynComponent.dynGrid?.gridPaging?.setSelectedKeys(itemsToSelect);\n })\n );\n this._subscriptions.push(\n this.nFertilizationStore.Listen(x => x.planBooks).pipe(\n map(planBooks => {\n const planBooksToShow = this._data?.PlanBookIds ?? [];\n return planBooks.filter(x => planBooksToShow.some(id => x.Id === id) && this.fieldStore.getFieldById(x.FieldId));\n })\n ).subscribe(items => {\n if (!items || items.length <= 0) {\n this.items$.next([]);\n this._onClose();\n return;\n }\n setTimeout(() => this.items$.next(this._getItems(items)), 0);\n })\n );\n }\n\n public ngOnDestroy(): void {\n this._subscriptions.forEach(x => x.unsubscribe());\n }\n\n private _onClose(): void {\n this.fieldStore.changeSelectedField([]);\n this.formStore.closeForm();\n }\n\n private _getColumns(): Observable {\n return combineLatest([\n this.languageStore.Listen(s => s.selectedLanguage),\n this.settingsStore.Listen(s => s.data)\n ]).pipe(\n filter(([language, settings]) => !!language && settings.length !== 0),\n map(([language, settings]) => ({language, setting: settings[0]})),\n map((p) => {\n const mapHide = this.mapViewStore.Listen(s => s.mode).pipe(\n map((mapMode) => mapMode === MapViewMode.HIDE)\n );\n return [\n new ApDynGridStatusColumnConfig({\n field: 'Status',\n class: 'StatusClass',\n description: 'StatusDesc'\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Docu_Ini__Number',\n field: 'Nr',\n width: 60,\n hide: true,\n filterType: FilterType.NUMBER,\n cssClass: 'right'\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Docu_Ini_Subnumber',\n field: 'TNr',\n width: 60,\n hide: true,\n filterType: FilterType.NUMBER,\n cssClass: 'right'\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Docu_Ini__Number',\n field: 'NrTNr',\n width: 70,\n hide: new ApDynGridColumnHideConfig({\n selfHide: mapHide\n })\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Docu_Ini__Name',\n field: 'Name',\n width: 180,\n cssClass: 'left',\n sortIndex: 0\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Docu_Ini__Area',\n field: 'Area',\n width: 60,\n tooltip: (dataItem) => dataItem['Area'],\n template: PropertyTemplate.NUMBER,\n filterType: FilterType.NUMBER,\n filterable: true,\n pipes: [{\n pipe: this.roundNumericPipe,\n args: [p.setting.DigitsAfterDecimalPoint]\n }]\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__Crop',\n field: 'Crop',\n width: 100,\n hide: true\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__ECStageShort',\n field: 'ECStage',\n width: 40,\n hide: true,\n template: PropertyTemplate.NUMBER,\n filterType: FilterType.NUMBER,\n filterable: true\n }),\n new ApDynGridGroupColumnConfig({\n title: 'N__ChartTitleX',\n width: 225,\n hide: true,\n groupColumns: [\n new ApDynGridPropertyColumnConfig({\n title: 'Global__Avg_Symbol',\n field: 'Absorption.Average',\n width: 75,\n cssClass: 'right',\n filterType: FilterType.NUMBER,\n filterable: true,\n pipes: [{\n pipe: this.roundNumericPipe,\n args: [0, GetRoundNumericPipeConfig.NullToEmptyReplaceConfig]\n }]\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__Min',\n field: 'Absorption.Min',\n width: 75,\n cssClass: 'right',\n filterType: FilterType.NUMBER,\n filterable: true,\n pipes: [{\n pipe: this.roundNumericPipe,\n args: [0, GetRoundNumericPipeConfig.NullToEmptyReplaceConfig]\n }]\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__Max',\n field: 'Absorption.Max',\n width: 75,\n cssClass: 'right',\n filterType: FilterType.NUMBER,\n filterable: true,\n pipes: [{\n pipe: this.roundNumericPipe,\n args: [0, GetRoundNumericPipeConfig.NullToEmptyReplaceConfig]\n }]\n })\n ]\n }),\n new ApDynGridGroupColumnConfig({\n title: 'Global__Nsensor_Unit',\n width: 225,\n hide: true,\n groupColumns: [\n new ApDynGridPropertyColumnConfig({\n title: 'Global__Avg_Symbol',\n field: 'Fertilization.Average',\n cssClass: 'right',\n dynCssClass: (dataItem) => this.nFertilizationComponentService.applyAdditionalStylesForFertilizationValues(dataItem),\n tooltip: (dataItem) => this.nFertilizationComponentService.tooltipForFertilizationValues(dataItem),\n filterType: FilterType.NUMBER,\n filterable: true,\n width: 75,\n pipes: [{\n pipe: this.roundNumericPipe,\n args: [0, GetRoundNumericPipeConfig.NullToEmptyReplaceConfig]\n }]\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__Min',\n field: 'Fertilization.Min',\n width: 75,\n cssClass: 'right',\n dynCssClass: (dataItem) => this.nFertilizationComponentService.applyAdditionalStylesForFertilizationValues(dataItem),\n tooltip: (dataItem) => this.nFertilizationComponentService.tooltipForFertilizationValues(dataItem),\n filterType: FilterType.NUMBER,\n filterable: true,\n pipes: [{\n pipe: this.roundNumericPipe,\n args: [0, GetRoundNumericPipeConfig.NullToEmptyReplaceConfig]\n }]\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__Max',\n field: 'Fertilization.Max',\n width: 75,\n cssClass: 'right',\n dynCssClass: (dataItem) => this.nFertilizationComponentService.applyAdditionalStylesForFertilizationValues(dataItem),\n tooltip: (dataItem) => this.nFertilizationComponentService.tooltipForFertilizationValues(dataItem),\n filterType: FilterType.NUMBER,\n filterable: true,\n pipes: [{\n pipe: this.roundNumericPipe,\n args: [0, GetRoundNumericPipeConfig.NullToEmptyReplaceConfig]\n }]\n })\n ]\n }),\n new ApDynGridGroupColumnConfig({\n title: this._halfViewMode$.pipe(map((m) => m === 0 ? 'N__ChartTitleX' : 'Global__Nsensor_Unit')),\n hide: new ApDynGridColumnHideConfig({\n mapHide: false,\n selfHide: this.mapViewStore.Listen(s => s.mode).pipe(map((m) => m !== MapViewMode.NORMAL)),\n }),\n headerButtons: {\n nextClicked: this._halfViewModeChange,\n previousClicked: this._halfViewModeChange,\n nextDisabled: of(false),\n previousDisabled: of(false)\n },\n xlsExport: false,\n width: 225,\n groupColumns: [\n new ApDynGridPropertyColumnConfig({\n title: 'Global__Avg_Symbol',\n field: 'Absorption.Average',\n cssClass: 'right',\n filterType: FilterType.NUMBER,\n filterable: true,\n width: 75,\n hide: new ApDynGridColumnHideConfig({\n mapHide: false,\n selfHide: this._halfViewMode$.pipe(map((m) => m === 1))\n }),\n pipes: [{\n pipe: this.roundNumericPipe,\n args: [0, GetRoundNumericPipeConfig.NullToEmptyReplaceConfig]\n }]\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__Min',\n field: 'Absorption.Min',\n cssClass: 'right',\n filterType: FilterType.NUMBER,\n filterable: true,\n width: 75,\n hide: new ApDynGridColumnHideConfig({\n mapHide: false,\n selfHide: this._halfViewMode$.pipe(map((m) => m === 1))\n }),\n pipes: [{\n pipe: this.roundNumericPipe,\n args: [0, GetRoundNumericPipeConfig.NullToEmptyReplaceConfig]\n }]\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__Max',\n field: 'Absorption.Max',\n cssClass: 'right',\n filterType: FilterType.NUMBER,\n filterable: true,\n width: 75,\n hide: new ApDynGridColumnHideConfig({\n mapHide: false,\n selfHide: this._halfViewMode$.pipe(map((m) => m === 1))\n }),\n pipes: [{\n pipe: this.roundNumericPipe,\n args: [0, GetRoundNumericPipeConfig.NullToEmptyReplaceConfig]\n }]\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__Avg_Symbol',\n field: 'Fertilization.Average',\n cssClass: 'right',\n dynCssClass: (dataItem) => this.nFertilizationComponentService.applyAdditionalStylesForFertilizationValues(dataItem),\n tooltip: (dataItem) => this.nFertilizationComponentService.tooltipForFertilizationValues(dataItem),\n filterType: FilterType.NUMBER,\n filterable: true,\n width: 75,\n hide: new ApDynGridColumnHideConfig({\n mapHide: false,\n selfHide: this._halfViewMode$.pipe(map((m) => m === 0))\n }),\n pipes: [{\n pipe: this.roundNumericPipe,\n args: [0, GetRoundNumericPipeConfig.NullToEmptyReplaceConfig]\n }]\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__Min',\n field: 'Fertilization.Min',\n cssClass: 'right',\n dynCssClass: (dataItem) => this.nFertilizationComponentService.applyAdditionalStylesForFertilizationValues(dataItem),\n tooltip: (dataItem) => this.nFertilizationComponentService.tooltipForFertilizationValues(dataItem),\n filterType: FilterType.NUMBER,\n filterable: true,\n width: 75,\n hide: new ApDynGridColumnHideConfig({\n mapHide: false,\n selfHide: this._halfViewMode$.pipe(map((m) => m === 0))\n }),\n pipes: [{\n pipe: this.roundNumericPipe,\n args: [0, GetRoundNumericPipeConfig.NullToEmptyReplaceConfig]\n }]\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__Max',\n field: 'Fertilization.Max',\n cssClass: 'right',\n dynCssClass: (dataItem) => this.nFertilizationComponentService.applyAdditionalStylesForFertilizationValues(dataItem),\n tooltip: (dataItem) => this.nFertilizationComponentService.tooltipForFertilizationValues(dataItem),\n filterType: FilterType.NUMBER,\n filterable: true,\n width: 75,\n hide: new ApDynGridColumnHideConfig({\n mapHide: false,\n selfHide: this._halfViewMode$.pipe(map((m) => m === 0))\n }),\n pipes: [{\n pipe: this.roundNumericPipe,\n args: [0, GetRoundNumericPipeConfig.NullToEmptyReplaceConfig]\n }]\n })\n ]\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__Sum_Goods',\n field: 'ProductTotal',\n hide: true,\n width: 90,\n cssClass: 'right',\n filterType: FilterType.NUMBER,\n filterable: true,\n pipes: [{\n pipe: this.roundNumericPipe,\n args: [0, GetRoundNumericPipeConfig.NullToEmptyReplaceConfig]\n }]\n }),\n new ApDynGridPropertyColumnConfig({\n title: '',\n field: 'ProductTotalUnit',\n width: 50,\n hide: true\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Base__SortItemDate',\n field: 'Date',\n format: p.language.DateFormat,\n hide: true,\n width: 80\n }),\n new ApDynGridGroupColumnConfig({\n title: 'agrioptions_resources',\n hide: true,\n groupColumns: [\n new ApDynGridPropertyColumnConfig({\n field: 'Duration',\n title: 'Docu_Ini__Duration',\n format: 'HH:mm',\n width: 60,\n hide: true\n }),\n new ApDynGridPropertyColumnConfig({\n field: 'Machine.NameWithSign',\n title: 'Base__Engine',\n width: 100,\n hide: true,\n }),\n new ApDynGridPropertyColumnConfig({\n field: 'Instrument.Name',\n title: 'AgriConnect_Ini__Tool',\n width: 100,\n hide: true\n }),\n new ApDynGridPropertyColumnConfig({\n field: 'Driver.ShortFullName',\n title: 'Docu_Ini__Motorist',\n width: 100,\n hide: true\n })\n ]\n }),\n new ApDynGridEditColumnConfig({\n data: [\n {\n text: 'Global__Edit',\n callback: ApUtilService.createEventEmitter(this._editPlanBook.bind(this), this._subscriptions),\n disabled: true\n },\n {\n text: 'Global__Delete',\n callback: ApUtilService.createEventEmitter(this._deletePlanBook.bind(this), this._subscriptions),\n disabled: (dataItem: INFertilizationShowGridItem) => !!dataItem?.SourceItem?.BookedAt\n }\n ]\n })\n ];\n })\n );\n }\n\n private _getPager(): ApDynGridPagerWizardConfig {\n return new ApDynGridPagerWizardConfig(\n new ApDynGridPagerWizardButton('Global_Back_With_Arrow', ApUtilService.createEventEmitter(this._onClose.bind(this), this._subscriptions)),\n new ApDynGridPagerWizardSection(),\n new ApDynGridPagerWizardSection(),\n {\n formConfig: undefined\n }\n );\n }\n\n private _getItems(planBooks: INFertilizationPlanBook[]): INFertilizationShowGridItem[] {\n return planBooks.filter(planBook => {\n const isDeletedItem = planBook.DeletedBy !== null || planBook.DeletedAt !== null;\n const isBookedItem = planBook.BookedBy !== null || planBook.BookedAt !== null;\n return !isDeletedItem && (this._data.IsBooked ? isBookedItem : !isBookedItem);\n }).map(planBook => {\n const nApplications = this._getNApplication(planBook, this._data.IsBooked);\n const nUpTakes = this.nFertilizationService.getNUpTakes(planBook.RasterStatistics);\n const field = this.fieldStore.getFieldById(planBook.FieldId);\n const geom = this.fieldStore.getCurrentFieldGeom(field);\n const cropType = this.cropTypeStore.getDefaultCroptype(planBook.MainCropId);\n const status = this.nFertilizationCommonService.getStatusForApplication(nApplications, nUpTakes,\n planBook.ECValue, cropType?.Eppocode, planBook.OperationMode);\n const driver = this.driverStore.getDriverById(planBook.ExportDriver);\n const machine = this.machineStore.getMachineById(planBook.ExportMachine);\n const instrument = this.instrumentStore.getInstrumentById(planBook.ExportInstrument);\n const fertilizer = this.fertilizerStore.getFertilizer(planBook.ProductId);\n const productTotal = this._getAmount(planBook, geom.AreaHa, this._data.IsBooked);\n const productTotalUnit = this.fertilizerService.getFertilizerUnit(fertilizer, false);\n return {\n Id: planBook.Id,\n Status: status,\n StatusClass: this.nFertilizationCommonService.getStatusClassForApplication(status),\n StatusDesc: this.nFertilizationCommonService.getStatusDescriptionForApplication(null, status, planBook.OperationMode),\n Name: this.fieldStore.getFieldName(field),\n Nr: field.FieldNumber,\n TNr: field.FieldSubnumber,\n NrTNr: this.fieldStore.getFieldNumberAndSubNumber(field),\n FieldId: field.Id,\n Crop: cropType?.Description ?? '',\n Date: this.dateService.toFarmDateFromUtc(planBook.ApplicationDate).toDate(),\n Area: geom.AreaHa,\n ECStage: planBook.ECValue,\n ProductTotal: productTotal,\n ProductTotalUnit: Number.isFinite(productTotal) && productTotalUnit ? productTotalUnit : '-',\n FertilizerEfficiency: fertilizer?.Efficiency,\n Absorption: nUpTakes,\n Fertilization: nApplications,\n Duration: this.dateService.getDateWithTimeFromMilliseconds(planBook.TEnd?.TotalMilliseconds ?? 0),\n Driver: driver,\n Machine: machine,\n Instrument: instrument,\n SourceItem: planBook\n } as INFertilizationShowGridItem;\n });\n }\n\n private _deletePlanBook(itemToDelete: INFertilizationShowGridItem): void {\n this.modalDialogStore.setModalDialogData(this.modalDialogPresets.DeleteDialog({\n resultDelegate: (dialogResult: IModalDialogResult): void => {\n if (dialogResult?.key === ModalDialogButtonKeys.Delete) {\n this.nFertilizationStore.DeleteNFertilizationPlanBooks([itemToDelete.SourceItem]);\n }\n }\n }));\n }\n\n private _getNApplication(planBook: INFertilizationPlanBook, isBooked: boolean): IContentNRelatedPlanBookStatisticValue | undefined {\n if (isBooked) {\n const nApplicationRange = this.nFertilizationService.getNApplications(planBook.RasterStatistics);\n if (nApplicationRange) {\n return {\n Min: nApplicationRange.Min,\n Max: nApplicationRange.Max,\n Average: nApplicationRange.Average\n };\n }\n return undefined;\n }\n const factor = Number.isFinite(planBook.Factor) && planBook.Factor > 0 ? planBook.Factor : 1;\n return {\n Min: planBook.ApplicationMin * factor,\n Max: planBook.ApplicationMax * factor,\n Average: planBook.ApplicationRate * factor\n };\n }\n\n private _getAmount(planBook: INFertilizationPlanBook, areaHa: number, isBooked: boolean): number | undefined {\n if (!planBook || !areaHa) {\n return undefined;\n }\n if (isBooked) {\n const nApplicationRange = this.nFertilizationService.getNApplications(planBook.RasterStatistics);\n return nApplicationRange?.Average;\n }\n switch (planBook.OperationMode?.Key) {\n case OperationModesEnum.Constant:\n case OperationModesEnum.ApplicationMap:\n case OperationModesEnum.TargetValue:\n return this.fertilizationManagementService.calculateProductAmountN(planBook.ProductId,\n planBook.ApplicationRate, areaHa, planBook.Factor);\n default:\n return undefined;\n }\n }\n\n\n private _editPlanBook(_: INFertilizationShowGridItem): void {\n }\n\n /**\n * Method with extended error handling while serializing the component's data.\n * Needed for further analysis of APV49-3984\n * @param updateComponentData\n * @private\n */\n private tryCopyComponentData(updateComponentData: any): ApNFertilizationShowComponentData {\n try {\n return ObjectFactory.Copy(updateComponentData);\n } catch (error) {\n let referenceCache = [];\n const duplicateReferenceKeys: string[] = [];\n JSON.stringify(updateComponentData, (key, value) => {\n if (typeof value === 'object' && value !== null) {\n if (referenceCache.includes(value)) {\n duplicateReferenceKeys.push(key);\n return;\n }\n referenceCache.push(value);\n }\n return value;\n });\n referenceCache = null;\n throw new Error(`Error while copy object with SummaryId '${updateComponentData?.DataItem?.Id}',\n duplicateReferenceKeys: ${JSON.stringify(duplicateReferenceKeys)}: ${error.message}`);\n }\n }\n}\n","import {Injectable} from '@angular/core';\nimport {\n ApDynGridStatusColumnConfig\n} from '../../../ap-dyngrids/config/ap-dyn-grid-status-column-config';\nimport {\n ApDynGridPropertyColumnConfig,\n FilterType,\n PropertyTemplate\n} from '../../../ap-dyngrids/config/ap-dyn-grid-property-column-config';\nimport {\n ApDynGridGroupColumnConfig\n} from '../../../ap-dyngrids/config/ap-dyn-grid-group-column-config';\nimport {\n ApDynGridEditColumnConfig\n} from '../../../ap-dyngrids/config/ap-dyn-grid-edit-column-config';\nimport {\n ApDynGridColumnConfigBase,\n ApDynGridColumnHideConfig\n} from '../../../ap-dyngrids/config/ap-dyn-grid-column-config-base';\nimport {LanguageStore} from '../../../stores/translation/language.store';\nimport {\n ApTranslationService\n} from '../../../ap-utils/service/ap-translation.service';\nimport {GetRoundNumericPipe} from '../../../ap-utils';\nimport {\n DropDownButtonData\n} from '../../../ap-dyngrids/config/ap-dyn-grid-button-column-config';\nimport {\n GetRoundNumericPipeConfig\n} from '../../../ap-utils/pipes/configs/get-round-numeric.pipe.config';\nimport {\n INFertilizationPlanningGridItem\n} from '../../types/ap-n-fertilization-planning-types';\nimport {\n OperationModesEnum\n} from '../../../stores/common/operation-modes.store';\nimport {\n NFertilizationService\n} from '../../../services/data/n-fertilization.service';\nimport {nameOf} from '../../../ap-core/utils/ap-name-of';\nimport {INFertilizationPlanBaseGridItem} from '../../types/n-fertilization-common.types';\nimport {\n IGridStatus\n} from '../../../ap-interface/interfaces/ap-grid-status.interface';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class NFertilizationPlansGridBuilderService {\n constructor(private languageStore: LanguageStore,\n private translationService: ApTranslationService,\n private nFertilizationService: NFertilizationService,\n private roundNumericPipe: GetRoundNumericPipe) {\n }\n\n public planningBookingGrid(options: DropDownButtonData[]): ApDynGridColumnConfigBase[] {\n return [\n new ApDynGridStatusColumnConfig({\n field: `${nameOf('Status')}.${nameOf('state')}`,\n class: `${nameOf('Status')}.${nameOf('class')}`,\n description: `${nameOf('Status')}.${nameOf('description')}`,\n title: 'Global__Status',\n filterable: true\n }),\n new ApDynGridPropertyColumnConfig({\n field: nameOf('ApplicationDate'),\n title: 'Nutrients__FertilizationDate',\n tooltip: (dataItem: INFertilizationPlanBaseGridItem) => dataItem.ApplicationDateTooltip,\n dynCssClass: (dataItem: INFertilizationPlanBaseGridItem) => dataItem.ApplicationDateItalic ? ' italic' : '',\n sortIndex: 1,\n sortDesc: true,\n hide: true,\n width: 80,\n filterable: true,\n headerFilterable: true,\n format: this.languageStore.SelectedLanguage.DateFormat,\n template: PropertyTemplate.DATE\n }),\n new ApDynGridPropertyColumnConfig({\n field: nameOf('Product'),\n title: 'Global__Product',\n width: 100,\n filterable: true,\n headerFilterable: true,\n tooltip: (dataItem: INFertilizationPlanBaseGridItem) => dataItem.ProductTooltip\n }),\n new ApDynGridPropertyColumnConfig({\n field: nameOf('Crop'),\n title: 'Global__Crop',\n width: 100,\n filterable: true,\n headerFilterable: true\n }),\n new ApDynGridPropertyColumnConfig({\n field: nameOf('Appl'),\n title: 'Global__N_ApplNum',\n width: 60,\n filterable: true,\n headerFilterable: true\n }),\n new ApDynGridPropertyColumnConfig({\n field: 'Count',\n title: 'Base__Fields',\n hide: true,\n width: 60,\n tooltip: (dataItem: INFertilizationPlanBaseGridItem) => dataItem.FieldsTooltip,\n cssClass: 'right',\n filterType: FilterType.NUMBER,\n filterable: true,\n headerFilterable: true\n }),\n new ApDynGridPropertyColumnConfig({\n field: nameOf('Area'),\n title: 'Docu_Ini__Area',\n hide: true,\n width: 60,\n cssClass: 'right',\n filterType: FilterType.NUMBER,\n filterable: true,\n headerFilterable: true,\n template: PropertyTemplate.NUMBER\n }),\n new ApDynGridGroupColumnConfig({\n title: `${this.translationService.translate('Global__Sum')} ${this.translationService.translate('Product')}`,\n headerStyle: {'text-align': 'center'},\n hide: new ApDynGridColumnHideConfig({\n mapHide: true\n }),\n groupColumns: [\n new ApDynGridPropertyColumnConfig({\n field: nameOf('ApplSum'),\n tooltip: (dataItem: INFertilizationPlanBaseGridItem) => `${dataItem.ApplSum ?? 0} ${dataItem.ProductUnit}`,\n hide: new ApDynGridColumnHideConfig({\n mapHide: true\n }),\n width: 60,\n cssClass: 'right',\n filterType: FilterType.NUMBER,\n pipes: [{\n pipe: this.roundNumericPipe,\n args: [0, GetRoundNumericPipeConfig.NullToEmptyReplaceConfig]\n }]\n }),\n new ApDynGridPropertyColumnConfig({\n field: nameOf('ProductUnit'),\n hide: new ApDynGridColumnHideConfig({\n mapHide: true\n }),\n width: 40,\n filterable: true,\n headerFilterable: true\n })]\n }),\n new ApDynGridPropertyColumnConfig({\n field: nameOf('OperationMode'),\n title: 'Global__OperationMode',\n width: 100,\n filterable: true,\n headerFilterable: true\n }),\n new ApDynGridGroupColumnConfig({\n title: 'Nutrients__kg_N_per_ha',\n hide: true,\n groupColumns: [\n new ApDynGridPropertyColumnConfig({\n field: nameOf('Avg'),\n title: 'Global__Avg_Symbol',\n width: 60,\n cssClass: 'right',\n tooltip: (dataItem: INFertilizationPlanBaseGridItem) => this.generateTooltipForAverageColumn(dataItem),\n filterType: FilterType.NUMBER,\n filterable: true,\n headerFilterable: true,\n template: PropertyTemplate.NUMBER,\n pipes: [{\n pipe: this.roundNumericPipe,\n args: [0]\n }]\n }),\n new ApDynGridPropertyColumnConfig({\n field: nameOf('Min'),\n title: 'Global__Min',\n width: 60,\n cssClass: 'right',\n filterType: FilterType.NUMBER,\n filterable: true,\n headerFilterable: true,\n template: PropertyTemplate.NUMBER,\n pipes: [{\n pipe: this.roundNumericPipe,\n args: [0]\n }]\n }),\n new ApDynGridPropertyColumnConfig({\n field: nameOf('Max'),\n title: 'Global__Max',\n width: 60,\n cssClass: 'right',\n filterType: FilterType.NUMBER,\n filterable: true,\n headerFilterable: true,\n template: PropertyTemplate.NUMBER,\n pipes: [{\n pipe: this.roundNumericPipe,\n args: [0]\n }]\n })\n ]\n }),\n new ApDynGridPropertyColumnConfig({\n field: nameOf('Note'),\n title: 'Global__Note',\n filterable: true,\n headerFilterable: true,\n width: 100\n }),\n new ApDynGridEditColumnConfig({\n data: options\n })\n ];\n }\n\n private generateTooltipForAverageColumn(dataItem: INFertilizationPlanBaseGridItem): string | undefined {\n if (dataItem.OperationModeKey === OperationModesEnum.NFertilization) {\n return this.translationService.translate('Fertilisation__ReferenceValue_kg_N_per_ha');\n }\n const isRape = this.nFertilizationService.isRapeCrop([dataItem.CropId]);\n if ((dataItem.OperationModeKey === OperationModesEnum.Constant || dataItem.OperationModeKey === OperationModesEnum.TargetValue)\n || ((dataItem.OperationModeKey === OperationModesEnum.ApplicationMapAbsolute || dataItem.OperationModeKey === OperationModesEnum.ApplicationMap) && !isRape)) {\n return this.translationService.translate('Fertilisation__TargetRate_Nutrient_kg_N_per_ha');\n }\n if (dataItem.OperationModeKey === OperationModesEnum.RapeFertilization\n || ((dataItem.OperationModeKey === OperationModesEnum.ApplicationMapAbsolute || dataItem.OperationModeKey === OperationModesEnum.ApplicationMap) && isRape)) {\n return this.translationService.translate('N__SetPoint_kg_N_per_ha');\n }\n return undefined;\n }\n}\n","import {AfterViewInit, Component, OnDestroy, OnInit, ViewChild} from '@angular/core';\nimport {ApDynComponentComponent} from '../../ap-dyncomponent/ap-dyncomponent.component';\nimport {\n ApDynGridColumnConfigBase\n} from '../../ap-dyngrids/config/ap-dyn-grid-column-config-base';\nimport {combineLatest, Observable, Subscription} from 'rxjs';\nimport {\n ApDynGridPagerConfigBase\n} from '../../ap-dyngrids/config/ap-dyn-grid-pager-config-base';\nimport {PagerBuilder} from './configs/pager-builder';\nimport {FormStore} from '../../stores/layout/form.store';\nimport {\n NFertilizationStore\n} from '../../stores/n-fertilization/n-fertilization.store';\nimport {CampaignYearStore} from '../../stores/login/campaignyear.store';\nimport {filter, first, map, skip} from 'rxjs/operators';\nimport {FieldStore} from '../../stores/farm/field.store';\nimport {CropTypeStore} from '../../stores/base-data/crop.types.store';\nimport {\n NFertilizationPlansGridBuilderService\n} from './configs/n-fertilization-plans-grid-builder.service';\nimport {\n ApNFertilizationBookingComponent\n} from '../../entry-components/ap-n-fertilization-entry-components/ap-n-fertilization-booking.component';\nimport {ApUtilService} from '../../ap-utils/service/ap-util.service';\nimport {FertilizerStore} from '../../stores/base-data/fertilizer.store';\nimport {\n ApNFertilizationEditComponent\n} from '../../entry-components/ap-n-fertilization-entry-components/ap-n-fertilization-edit.component';\nimport {ModalDialogStore} from '../../stores/dialog/modal.dialog.store';\nimport {ModalDialogPresets} from '../../stores/dialog/modal.dialog.presets';\nimport {RouterStore} from '../../stores/router/router.store';\nimport {\n CropApplicationStore\n} from '../../stores/task-management/crop-application.store';\nimport {MapStore} from '../../stores/map/map.store';\nimport {ApNFertilizationCommonService} from '../services/ap-n-fertilization.common.service';\nimport {\n ApTooltipContentService\n} from '../../ap-utils/service/ap-tooltip-content.service';\nimport {TaskManagementAction} from '../../task-management/task-management.types';\nimport {\n ApNFertilizationShowComponent\n} from '../../entry-components/ap-n-fertilization-entry-components/ap-n-fertilization-show.component';\nimport {FertilizerService} from '../../services/data/fertilizer.service';\nimport {\n DropDownButtonData\n} from '../../ap-dyngrids/config/ap-dyn-grid-button-column-config';\nimport {NFertilizationService} from '../../services/data/n-fertilization.service';\nimport {StatisticStore} from '../../stores/statistic/statistic.store';\nimport {ApNFertilizationComponentService} from '../services/ap-n-fertilization-component.service';\nimport {ISummaryWithPlanBooks} from '../types/n-fertilization-common.types';\nimport {ObjectFactory} from 'ts-tooling';\nimport {\n PlanningEntryComponentDataType\n} from '../../entry-components/ap-nutrients-management-entry-components/ap-nutrient-planning-configs/nutrient-planning-types';\nimport {INFertilizationPlanningGridItem} from '../types/ap-n-fertilization-planning-types';\nimport {\n ApNFertilizationShowComponentData\n} from '../../entry-components/ap-n-fertilization-entry-components/ap-n-fertilization-show-configs/ap-n-fertilization-show-types';\nimport {\n ApNFertilizationPlanningEntryComponent\n} from '../../entry-components/ap-n-fertilization-entry-components/ap-n-fertilization-planning-entry.component';\nimport {OperationModesEnum, OperationModesStore} from '../../stores/common/operation-modes.store';\nimport {LicenseStore} from '../../stores/farm/license.store';\nimport {NdiStore} from '../../stores/ndi/ndi.store';\nimport {SensorStore} from '../../stores/sensor/sensor.store';\n\n@Component({\n selector: 'ap-n-fertilization-planning',\n template: `\n \n \n `,\n styles: []\n})\nexport class ApNFertilizationPlanningComponent implements OnInit, AfterViewInit, OnDestroy {\n @ViewChild(ApDynComponentComponent) dynComponent: ApDynComponentComponent;\n columns: ApDynGridColumnConfigBase[] = [];\n items$: Observable;\n loading$: Observable;\n pager: ApDynGridPagerConfigBase;\n\n private _subscriptions: Subscription[] = [];\n\n constructor(private fertilizerStore: FertilizerStore,\n private ndiStore: NdiStore,\n private formStore: FormStore,\n private licenses: LicenseStore,\n private sensorStore: SensorStore,\n private campaignYearStore: CampaignYearStore,\n private operationModesStore: OperationModesStore,\n private cropApplicationStore: CropApplicationStore,\n private cropTypeStore: CropTypeStore,\n private fieldStore: FieldStore,\n private gridBuilder: NFertilizationPlansGridBuilderService,\n private modalDialogPresets: ModalDialogPresets,\n private modalDialogStore: ModalDialogStore,\n private nFertilizationStore: NFertilizationStore,\n private routerStore: RouterStore,\n private mapStore: MapStore,\n private statisticStore: StatisticStore,\n private nCommonService: ApNFertilizationCommonService,\n private tooltipContentService: ApTooltipContentService,\n private nFertilizationService: NFertilizationService,\n private nFertilizationComponentService: ApNFertilizationComponentService,\n private fertilizerService: FertilizerService) {\n }\n\n public ngOnInit(): void {\n this.loading$ = combineLatest([\n this.nFertilizationStore.Listen(s => s.logfilesLoading),\n this.nFertilizationStore.Listen(s => s.loading),\n this.nFertilizationStore.Listen(s => s.planBooksLoading),\n this.cropApplicationStore.Listen(s => s.loading),\n this.sensorStore.Loading$,\n this.ndiStore.Loading$,\n this.licenses.Loading$,\n this.operationModesStore.Loading$\n ]).pipe(\n map((loadings) => loadings.some((x) => x))\n );\n this._subscriptions.push(this.campaignYearStore.Listen(s => s.selectedYear).subscribe(() => {\n this.nFertilizationStore.LoadNFertilizationPlanningSummaries();\n }));\n this._buildGrid();\n }\n\n public ngAfterViewInit(): void {\n this._subscriptions.push(this.dynComponent.SelectedItems$.subscribe((items) => {\n this._onSelectedItemsChanged(items);\n }));\n this._subscriptions.push(combineLatest([\n this.routerStore.Listen(s => s),\n this.items$,\n this.nFertilizationStore.Listen(s => s.loading)\n ]).pipe(\n filter(([routerStoreData, gridItems, gridItemsLoading]) =>\n routerStoreData.url?.startsWith('/n-fertilization/planning') && routerStoreData.queryParams['id'] !== undefined && gridItems?.length !== 0 && !gridItemsLoading),\n first(),\n ).subscribe(([routerStoreData, gridItems]) => {\n const targetGridItem = gridItems.find(_ => _.Id === routerStoreData.queryParams['id']);\n const targetComponent = routerStoreData.queryParams['action'] === TaskManagementAction.Booking ?\n ApNFertilizationBookingComponent : ApNFertilizationEditComponent;\n setTimeout(() => {\n this.formStore.openForm({\n component: targetComponent,\n data: {dataItem: targetGridItem, book: true}\n });\n if (routerStoreData.queryParams['url']) {\n this._subscriptions.push(this.formStore.FormClose$.subscribe(() => this.routerStore.navigate([routerStoreData.queryParams['url']])));\n }\n }, 0);\n }));\n this._subscriptions.push(this.formStore.FormClose$.subscribe(() => {\n // trigger refresh of selection and map after entryComponent (e.g. 'NEW') closed\n setTimeout(() => this._onSelectedItemsChanged(this.dynComponent?.getSelectedItems()), 1);\n }));\n }\n\n private _onSelectedItemsChanged(items: any[]): void {\n const fieldIds = items.map((item) => item.FieldIds).flat();\n this.fieldStore.changeSelectedField(fieldIds.filter((v, i, a) => a.indexOf(v) === i));\n const planBooks = items.map((item) => item.PlanBooks.filter((x: any) => !x.DeletedAt && !x.BookedBy)).flat();\n const currentUrl = this.routerStore.Listen(s => s.url).getValue();\n this.nFertilizationComponentService.showPlanBookStatisticOnMap(planBooks, currentUrl);\n }\n\n public ngOnDestroy(): void {\n this._subscriptions.forEach(s => s.unsubscribe());\n this.statisticStore.removeStatisticData();\n this.mapStore.Layers.Clear();\n this.mapStore.Legends.removeLegend(this.mapStore.Legends.NPlanningLegend);\n }\n\n public onCreate(): void {\n this.statisticStore.removeStatisticData();\n this.mapStore.Layers.Clear();\n this.mapStore.Legends.removeLegend(this.mapStore.Legends.NPlanningLegend);\n if (this.dynComponent.dynGrid.gridPaging.selectedKeys.length !== 0) {\n const selectedItem = (this.dynComponent.dynGrid.gridPaging.items.find(x => x.Id === this.dynComponent.dynGrid.gridPaging.selectedKeys[0]) as INFertilizationPlanningGridItem);\n this.formStore.openForm({\n component: ApNFertilizationPlanningEntryComponent,\n data: {\n Summary: ObjectFactory.Copy(selectedItem?.Summary),\n PlanBooks: ObjectFactory.Copy(selectedItem?.PlanBooks),\n Type: PlanningEntryComponentDataType.Edit\n }\n });\n } else {\n this.formStore.openForm({\n component: ApNFertilizationPlanningEntryComponent,\n data: {\n Summary: undefined,\n Type: PlanningEntryComponentDataType.Create\n }\n });\n }\n }\n\n private _buildGrid(): void {\n const gridOptions: DropDownButtonData[] = [\n {\n text: 'Global__Show',\n callback: ApUtilService.createEventEmitter(this._show.bind(this), this._subscriptions),\n },\n /* vorrübergehend deaktiviert\n {\n text: 'Global__Edit',\n callback: ApUtilService.createEventEmitter(this._edit.bind(this), this._subscriptions)\n },*/\n {\n text: 'Task_Mgmt_Export',\n callback: ApUtilService.createEventEmitter(this._export.bind(this), this._subscriptions),\n },\n {\n text: 'Global__Booking',\n callback: ApUtilService.createEventEmitter(this._book.bind(this), this._subscriptions),\n disabled: (item) => !this._isBookProcessAvailable(item['OperationModeKey'])\n },\n {\n text: 'Global__Delete',\n callback: ApUtilService.createEventEmitter(this._delete.bind(this), this._subscriptions),\n }\n ];\n\n this.columns = this.gridBuilder.planningBookingGrid(gridOptions);\n const pagerOptions = [\n {\n text: 'Global__Delete',\n callback: ApUtilService.createEventEmitter(this._deleteMany.bind(this), this._subscriptions)\n },\n ];\n this.pager = PagerBuilder.PlanningBookingPager(pagerOptions);\n\n this.items$ = combineLatest([\n this.nFertilizationStore.Listen(x => x.planBooks),\n this.cropTypeStore.Listen(s => s.cropTypesNames),\n this.fieldStore.Listen(s => s.data),\n this.cropApplicationStore.Listen(s => s.data),\n this.ndiStore.NdiStatistics$\n ]).pipe(\n filter(([planBooks, cropTypesNames, fields, applications, _]) =>\n !!planBooks && !!cropTypesNames && !!fields && !!applications && applications.length !== 0),\n map(([planBooks, cropTypesNames]) => {\n const summaries = this.nFertilizationComponentService.getSummaryWithPlanBooks(planBooks, false);\n return summaries.filter(x => x.FilteredPlanBooks && x.FilteredPlanBooks.length > 0)\n .map((s: ISummaryWithPlanBooks) => {\n const operationMode = s.Summary?.OperationMode;\n const cropId = this.nFertilizationComponentService.getCropId(s.FilteredPlanBooks);\n const productId = this.nFertilizationComponentService.getProductId(s.FilteredPlanBooks);\n const fertilizer = this.fertilizerStore.getFertilizer(productId);\n const applicationRate = this.nFertilizationComponentService.getApplicationRateFromPlanBooks(s.FilteredPlanBooks);\n const planBookApplicationDates = this.nFertilizationComponentService.getApplicationDatesData(s.FilteredPlanBooks);\n return {\n Id: s.Summary?.Id,\n Summary: s.Summary,\n Status: this.nFertilizationComponentService.getStatus(s),\n FieldIds: s.FilteredPlanBooks.map((pb) => pb.FieldId),\n Crop: cropTypesNames[cropId ?? ''],\n CropId: cropId,\n Appl: this.nFertilizationService.getApplicationRateNameByApplication(applicationRate),\n ApplSum: this.nCommonService.getApplSum(s.FilteredPlanBooks),\n ApplSumTooltip: this.nCommonService.getApplSum(s.FilteredPlanBooks),\n Count: this.nFertilizationComponentService.getPlanBooksFieldsCount(s.TotalPlanBooks, false),\n Area: this.nFertilizationComponentService.getArea(s.FilteredPlanBooks),\n OperationMode: this.nCommonService.getOperationMode(operationMode),\n OperationModeKey: operationMode?.Key ?? '',\n Product: this.fertilizerService.getFertilizerProductName(fertilizer),\n ProductId: productId,\n ProductUnit: this.nCommonService.getProductUnit(s.FilteredPlanBooks.FirstOrDefault()),\n ProductTooltip: this.tooltipContentService.getProductContentInfoTooltip(productId),\n Avg: s.Summary?.UserApplicationRate,\n Min: s.Summary?.UserApplicationMinimum,\n Max: s.Summary?.UserApplicationMaximum,\n ApplicationDate: planBookApplicationDates.NewestDate,\n ApplicationDateTooltip: planBookApplicationDates.Tooltip,\n ApplicationDateItalic: planBookApplicationDates.IsMoreThanOneUniqDate,\n Note: s.Summary?.Title,\n PlanBooks: s.FilteredPlanBooks,\n PlanNumber: s.Summary?.PlanNumber,\n FieldsTooltip: this.tooltipContentService.getFieldsCropsTooltip(s.FilteredPlanBooks)\n } as INFertilizationPlanningGridItem;\n });\n })\n );\n }\n\n private _isBookProcessAvailable(operationModeKey: string | undefined): boolean {\n const operationMode = operationModeKey as OperationModesEnum;\n if (!operationMode) {\n return false;\n }\n const operationModesAvailableForBookProcess = [\n OperationModesEnum.Constant,\n OperationModesEnum.ApplicationMap,\n OperationModesEnum.ApplicationMapAbsolute\n ];\n return operationModesAvailableForBookProcess.includes(operationMode);\n }\n\n private _book(dataItem: INFertilizationPlanningGridItem): void {\n this.formStore.openForm({component: ApNFertilizationBookingComponent, data: {dataItem, book: true}});\n }\n\n private _export(dataItem: INFertilizationPlanningGridItem): void {\n this.routerStore.navigate(['task-management/overview'], {\n id: dataItem.Summary.Id,\n url: 'n-fertilization/planning'\n }).then();\n }\n\n private _show(dataItem: INFertilizationPlanningGridItem): void {\n const planBooksIds = dataItem.PlanBooks.map(x => x.Id);\n if (!planBooksIds) {\n return;\n }\n\n const currentUrl = this.routerStore.Listen(s => s.url).getValue();\n this.nFertilizationComponentService.showPlanBookStatisticOnMap(dataItem.PlanBooks, currentUrl);\n\n const componentData: ApNFertilizationShowComponentData = {\n PlanBookIds: planBooksIds,\n IsBooked: false\n };\n this.formStore.openForm({component: ApNFertilizationShowComponent, data: componentData});\n }\n\n private _delete(dataItem: INFertilizationPlanningGridItem): void {\n this.modalDialogStore.setModalDialogData(this.modalDialogPresets.DeleteDialog());\n const modalDialogSubscription = this.modalDialogStore.Listen(s => s.result)\n .pipe(skip(1))\n .subscribe((result) => {\n modalDialogSubscription.unsubscribe();\n if (result.key === 'delete') {\n this.nFertilizationStore.DeleteNFertilizationSummaries([dataItem.Summary]);\n }\n });\n }\n\n private _deleteMany(): any {\n this.nFertilizationStore.DeleteNFertilizationSummaries(\n this.dynComponent.getSelectedItems().map((item: INFertilizationPlanningGridItem) => item.Summary)\n );\n }\n\n /* removed for now\n private _edit(dataItem: any): void {\n this.formStore.openForm({component: ApNFertilizationEditComponent, data: {dataItem}});\n }*/\n}\n","import {AfterContentInit, Component, OnDestroy, OnInit, ViewChild} from '@angular/core';\nimport {\n ApDynComponentComponent\n} from '../../ap-dyncomponent/ap-dyncomponent.component';\nimport {\n ApDynGridColumnConfigBase\n} from '../../ap-dyngrids/config/ap-dyn-grid-column-config-base';\nimport {BehaviorSubject, combineLatest, Observable, of, Subscription} from 'rxjs';\nimport {PagerBuilder} from './configs/pager-builder';\nimport {\n ApDynGridPagerConfigBase\n} from '../../ap-dyngrids/config/ap-dyn-grid-pager-config-base';\nimport {\n NFertilizationPlansGridBuilderService\n} from './configs/n-fertilization-plans-grid-builder.service';\nimport {\n NFertilizationStore\n} from '../../stores/n-fertilization/n-fertilization.store';\nimport {filter, map} from 'rxjs/operators';\nimport {\n FertilizerStore\n} from '../../stores/base-data/fertilizer.store';\nimport {\n CropTypeStore\n} from '../../stores/base-data/crop.types.store';\nimport {FieldStore} from '../../stores/farm/field.store';\nimport {\n CampaignYearStore\n} from '../../stores/login/campaignyear.store';\nimport {\n ApUtilService\n} from '../../ap-utils/service/ap-util.service';\nimport {\n FormStore\n} from '../../stores/layout/form.store';\nimport {\n RouterStore\n} from '../../stores/router/router.store';\nimport {\n ApNFertilizationBookingComponent as ApNFertilizationEntryBookingComponent\n} from '../../entry-components/ap-n-fertilization-entry-components/ap-n-fertilization-booking.component';\nimport {\n CropApplicationStore\n} from '../../stores/task-management/crop-application.store';\nimport {\n ApNFertilizationCommonService\n} from '../services/ap-n-fertilization.common.service';\nimport {\n ApTooltipContentService\n} from '../../ap-utils/service/ap-tooltip-content.service';\nimport {\n ApNFertilizationShowComponent\n} from '../../entry-components/ap-n-fertilization-entry-components/ap-n-fertilization-show.component';\nimport {\n FertilizerService\n} from '../../services/data/fertilizer.service';\nimport {\n NFertilizationService\n} from '../../services/data/n-fertilization.service';\nimport {\n INFertilizationBookingGridItem,\n PlanBookNApplicationRateWithArea\n} from '../types/ap-n-fertilization-booking-types';\nimport {\n ApNFertilizationComponentService\n} from '../services/ap-n-fertilization-component.service';\nimport {MapStore} from '../../stores/map/map.store';\nimport {\n ApShowPointsOnMapService\n} from '../../ap-utils/service/ap-show-points-on-map.service';\nimport {\n CropTypeNames,\n ISummaryWithPlanBooks\n} from '../types/n-fertilization-common.types';\nimport {\n ApNFertilizationShowComponentData\n} from '../../entry-components/ap-n-fertilization-entry-components/ap-n-fertilization-show-configs/ap-n-fertilization-show-types';\nimport INFertilizationPlanBook = Data.TaskManagement.INFertilizationPlanBook;\n\n@Component({\n selector: 'ap-n-fertilization-booking',\n template: `\n \n \n `,\n styles: []\n})\nexport class ApNFertilizationBookingComponent implements OnInit, AfterContentInit, OnDestroy {\n @ViewChild(ApDynComponentComponent, {static: true}) dynComponent: ApDynComponentComponent;\n public columns: ApDynGridColumnConfigBase[] = [];\n public loading$: Observable = of(true);\n public items$ = new BehaviorSubject([]);\n public pager: ApDynGridPagerConfigBase;\n\n private _subscriptions: Subscription[] = [];\n\n constructor(private mapStore: MapStore,\n private campaignYearStore: CampaignYearStore,\n private cropApplicationStore: CropApplicationStore,\n private cropTypeStore: CropTypeStore,\n private fertilizerStore: FertilizerStore,\n private formStore: FormStore,\n private fieldStore: FieldStore,\n private gridBuilder: NFertilizationPlansGridBuilderService,\n private nFertilizationStore: NFertilizationStore,\n private routerStore: RouterStore,\n private nCommonService: ApNFertilizationCommonService,\n private tooltipContentService: ApTooltipContentService,\n private fertilizerService: FertilizerService,\n private showPointsOnMap: ApShowPointsOnMapService,\n private nFertilizationComponentService: ApNFertilizationComponentService,\n private nFertilizationService: NFertilizationService) {\n }\n\n public ngOnInit(): void {\n this.loading$ = combineLatest([\n this.nFertilizationStore.Listen(s => s.planBooksLoading),\n this.cropTypeStore.Listen(s => s.loading),\n this.fieldStore.Listen(s => s.loading),\n this.cropApplicationStore.Listen(s => s.loading)\n ]).pipe(\n map(statuses => statuses.some(x => x))\n );\n this.pager = this._getPager();\n this.columns = this._getColumns();\n }\n\n public ngAfterContentInit(): void {\n this._subscriptions.push(this.campaignYearStore.Listen(s => s.selectedYear).subscribe(() => {\n this.nFertilizationStore.LoadNFertilizationPlanningSummaries();\n }));\n this._subscriptions.push(\n combineLatest([\n this.nFertilizationStore.Bookings$(),\n this.cropTypeStore.Listen(s => s.cropTypesNames),\n this.fieldStore.Listen(s => s.data)\n ]).pipe(\n filter(([planBooks, cropTypesNames, fields]) => !!planBooks && !!cropTypesNames && !!fields),\n map(([planBooks, cropTypesNames]) => this._getGridItems(planBooks, cropTypesNames)),\n ).subscribe((items) => this.items$.next(items))\n );\n this._subscriptions.push(this.dynComponent.SelectedItems$.subscribe((items: INFertilizationBookingGridItem[]): void => {\n this.showPointsOnMap.clear();\n const applications = items.map(x => x.Applications).flat();\n const fieldIds = applications.map(x => x.FieldId);\n this.fieldStore.changeSelectedField(fieldIds.map(x => x.toString()));\n const filteredApplications = applications.filter(x => x.CropKey);\n if (filteredApplications.length > 0) {\n const max = filteredApplications.map((a) => a.Date.valueOf()).Max();\n const maxItem = filteredApplications.Find((application) => application.Date.valueOf() === max);\n this.showPointsOnMap.showAllRaster(filteredApplications, 'nd');\n this.mapStore.Legends.nLogInterpolationLegend.updateValues(maxItem.CropKey, maxItem.EcValue);\n }\n }));\n }\n\n public ngOnDestroy(): void {\n this._subscriptions.forEach(s => s.unsubscribe());\n this.fieldStore.changeSelectedField([]);\n this.showPointsOnMap.clear();\n this.mapStore.Layers.Clear();\n this.mapStore.Legends.removeLegend(this.mapStore.Legends.nLogInterpolationLegend);\n this.mapStore.Legends.removeLegend(this.mapStore.Legends.NPlanningLegend);\n }\n\n private _getGridItems(planBooks: INFertilizationPlanBook[], cropTypesNames: CropTypeNames): INFertilizationBookingGridItem[] {\n const summaries = this.nFertilizationComponentService.getSummaryWithPlanBooks(planBooks, true);\n return summaries.filter(x => x.FilteredPlanBooks && x.FilteredPlanBooks.length > 0)\n .map((s: ISummaryWithPlanBooks) => {\n const operationMode = s.Summary?.OperationMode;\n const cropId = this.nFertilizationComponentService.getCropId(s.FilteredPlanBooks) ?? '';\n const productId = this.nFertilizationComponentService.getProductId(s.FilteredPlanBooks);\n const firstPlanBook = s.FilteredPlanBooks[0];\n const fertilizer = this.fertilizerStore.getFertilizer(firstPlanBook?.ProductId);\n const nApplications = this._getNApplicationsWithArea(s.FilteredPlanBooks);\n const totalArea = nApplications.reduce((prev, current) => prev + current.AreaHa, 0);\n const totalAvgOnAreas = nApplications.reduce((prev, current) => prev + current.Avg * current.AreaHa, 0);\n const planBookApplicationDates = this.nFertilizationComponentService.getApplicationDatesData(s.FilteredPlanBooks);\n const applicationRate = this.nFertilizationComponentService.getApplicationRateFromPlanBooks(s.FilteredPlanBooks);\n return {\n Id: s.Summary?.Id,\n Summary: s.Summary,\n Status: this.nFertilizationComponentService.getStatus(s),\n FieldIds: s.FilteredPlanBooks.map((pb) => pb.FieldId),\n Count: this.nFertilizationComponentService.getPlanBooksFieldsCount(s.TotalPlanBooks, true),\n Crop: cropTypesNames[+cropId],\n CropId: cropId,\n Appl: this.nFertilizationService.getApplicationRateNameByApplication(applicationRate),\n ApplSum: this.nFertilizationService.calculateProductAmountFromPlanBooks(s.FilteredPlanBooks),\n Area: this.nFertilizationComponentService.getArea(s.FilteredPlanBooks),\n OperationMode: this.nCommonService.getOperationMode(operationMode),\n OperationModeKey: operationMode?.Key ?? '',\n Product: this.fertilizerService.getFertilizerProductName(fertilizer),\n ProductId: productId,\n ProductUnit: this.nCommonService.getProductUnit(firstPlanBook),\n ProductTooltip: this.tooltipContentService.getProductContentInfoTooltip(firstPlanBook?.ProductId),\n Avg: totalAvgOnAreas / totalArea,\n Min: nApplications.reduce((prev, current) => prev < current.Min ? current.Min : prev, 0),\n Max: nApplications.reduce((prev, current) => prev > current.Max ? prev : current.Max, 0),\n ApplicationDate: planBookApplicationDates.NewestDate,\n ApplicationDateTooltip: planBookApplicationDates.Tooltip,\n ApplicationDateItalic: planBookApplicationDates.IsMoreThanOneUniqDate,\n Note: s.Summary.Title,\n PlanBooks: s.FilteredPlanBooks,\n FieldsTooltip: this.tooltipContentService.getFieldsCropsTooltip(s.FilteredPlanBooks),\n Applications: nApplications\n } as INFertilizationBookingGridItem;\n });\n }\n\n private _getColumns(): ApDynGridColumnConfigBase[] {\n return this.gridBuilder.planningBookingGrid([\n {\n text: 'Global__Show',\n callback: ApUtilService.createEventEmitter(this._onShow.bind(this), this._subscriptions)\n },\n {\n text: 'Global__Export',\n callback: ApUtilService.createEventEmitter(this._onExport.bind(this), this._subscriptions)\n },\n {\n text: 'Global__Reset',\n callback: ApUtilService.createEventEmitter(this._onReset.bind(this), this._subscriptions)\n },\n ]);\n }\n\n private _getPager(): ApDynGridPagerConfigBase {\n return PagerBuilder.PlanningBookingPager([\n {\n text: 'Global__Show',\n callback: ApUtilService.createEventEmitter(this._pagerOnShow.bind(this), this._subscriptions)\n },\n {\n text: 'Global__Export',\n callback: ApUtilService.createEventEmitter(this._pagerOnExportShow.bind(this), this._subscriptions)\n },\n ]);\n }\n\n private _pagerOnShow(pager: any): void {\n if (!pager?.items || pager.items.length <= 0) {\n return;\n }\n this._onShow(pager.items[0]);\n }\n\n private _pagerOnExportShow(pager: any): void {\n if (!pager?.items || pager.items.length <= 0) {\n return;\n }\n this._onExport(pager.items[0]);\n }\n\n private _onShow(dataItem: INFertilizationBookingGridItem): void {\n const planBooksIds = dataItem.PlanBooks.map(x => x.Id);\n if (!planBooksIds) {\n return;\n }\n const componentData: ApNFertilizationShowComponentData = {\n PlanBookIds: planBooksIds,\n IsBooked: true\n };\n this.formStore.openForm({component: ApNFertilizationShowComponent, data: componentData});\n }\n\n private _onExport(dataItem: INFertilizationBookingGridItem): void {\n this.routerStore.navigate(['task-management/overview'], {\n id: dataItem.Summary.Id,\n url: 'n-fertilization/planning'\n }).then();\n }\n\n private _onReset(dataItem: INFertilizationBookingGridItem): void {\n this.formStore.openForm({component: ApNFertilizationEntryBookingComponent, data: {dataItem, book: false}});\n }\n\n private _getNApplicationsWithArea(planBooks: INFertilizationPlanBook[]): PlanBookNApplicationRateWithArea[] {\n const statistic: PlanBookNApplicationRateWithArea[] = [];\n planBooks.forEach(planBook => {\n const fieldGeom = this.fieldStore.getFieldGeomById(planBook.FieldGeomId);\n const nApplication = this.nFertilizationService.getNApplications(planBook.RasterStatistics);\n const cropType = this.cropTypeStore.getDefaultCroptype(planBook.MainCropId);\n statistic.push({\n PlanBookId: planBook.Id.toString(),\n FieldId: planBook.FieldId.toString(),\n Min: nApplication ? nApplication.Min : planBook.ApplicationMin,\n Max: nApplication ? nApplication.Max : planBook.ApplicationMax,\n Avg: nApplication ? nApplication.Average : planBook.ApplicationRate * planBook.Factor,\n AreaHa: fieldGeom?.AreaHa ?? 0,\n Date: new Date(planBook.ApplicationDate),\n CropKey: cropType?.CropKey,\n EcValue: planBook.ECValue\n });\n });\n return statistic;\n }\n}\n","import {AfterViewInit, Component, OnDestroy, OnInit, ViewChild} from '@angular/core';\nimport {\n ApDynformsConfigFieldset\n} from '../../ap-dynforms/config/ap-dynforms-config-fieldset';\nimport {BehaviorSubject, Subscription} from 'rxjs';\nimport {\n FormStore\n} from '../../stores/layout/form.store';\nimport {\n ApDynformsConfigNumerictextbox\n} from '../../ap-dynforms/config/ap-dynforms-config-numerictextbox';\nimport {\n ApDynformsConfigComboBox\n} from '../../ap-dynforms/config/ap-dynforms-config-combobox';\nimport {distinctUntilChanged, filter, map} from 'rxjs/operators';\nimport {\n NFertilizationStore\n} from '../../stores/n-fertilization/n-fertilization.store';\nimport {\n ApNFertilizationComponentService\n} from '../../n-fertilization/services/ap-n-fertilization-component.service';\nimport {ObjectFactory} from 'ts-tooling';\nimport {\n FertilizerStore\n} from '../../stores/base-data/fertilizer.store';\nimport {\n LanguageStore\n} from '../../stores/translation/language.store';\nimport {\n ApDynformsValidator\n} from '../../ap-dynforms/ap-dynforms-validator';\nimport {Validators} from '@angular/forms';\nimport {\n DriverStore\n} from '../../stores/docu/driver.store';\nimport {\n InstrumentStore\n} from '../../stores/docu/instrument.store';\nimport {\n MachineStore\n} from '../../stores/docu/machine.store';\nimport {\n AgriportConstantsService\n} from '../../services/common/agriport-constants.service';\nimport {\n GeneralConfig\n} from './ap-n-fertilization-planning-configs/general.config';\nimport {\n TranslationStore\n} from '../../stores/translation/translation.store';\nimport {\n GetOperationModeService\n} from '../../ap-utils/service/ap-get-operationmode.service';\nimport {\n ApDateService\n} from '../../ap-core/services/ap-date-service';\nimport {\n ApDynformsConfigTextbox\n} from '../../ap-dynforms/config/ap-dynforms-config-textbox';\nimport {\n SettingsStore\n} from '../../stores/base-data/settings.store';\nimport {\n GetRoundNumericService\n} from '../../ap-utils/service/get-round-numeric.service';\nimport {\n FieldStore\n} from '../../stores/farm/field.store';\nimport {\n ApDynformsComponent\n} from '../../ap-dynforms/ap-dynforms.component';\nimport {\n NFertilizationLogfilesGridData\n} from '../../n-fertilization/components/ap-n-fertilization-logfiles.component';\nimport {\n UnitsStore\n} from '../../stores/common/units.store';\nimport {\n OperationModesEnum, OperationModesStore\n} from '../../stores/common/operation-modes.store';\nimport IDatasetFieldMap = Data.Sensor.IDatasetFieldMap;\nimport INFertilizationPlanBook = Data.TaskManagement.INFertilizationPlanBook;\nimport INFertilizationSummary = Data.TaskManagement.INFertilizationSummary;\n\n@Component({\n selector: 'ap-n-fertilization-logfile-edit',\n template: `\n \n
\n \n \n
\n \n `,\n styles: []\n})\nexport class ApNFertilizationLogfileEditComponent implements OnInit, AfterViewInit, OnDestroy {\n // @ViewChild(ApDynComponentComponent, {static: true}) dynComponent: ApDynComponentComponent;\n @ViewChild(ApDynformsComponent, {static: true}) public dynForm: ApDynformsComponent;\n\n fieldSets$ = new BehaviorSubject([]);\n saveDisabled$ = new BehaviorSubject(false);\n logFile: IDatasetFieldMap;\n private _subscriptions: Subscription[] = [];\n private formValuesUpdateInProgress = false;\n\n constructor(private componentService: ApNFertilizationComponentService,\n private constantsService: AgriportConstantsService,\n private dateService: ApDateService,\n private driverStore: DriverStore,\n private fertilizerStore: FertilizerStore,\n private fieldStore: FieldStore,\n private formBuilder: GeneralConfig,\n private formStore: FormStore,\n private instrumentStore: InstrumentStore,\n private languageStore: LanguageStore,\n private machineStore: MachineStore,\n private nFertilizationStore: NFertilizationStore,\n private operationModeService: GetOperationModeService,\n private operationModeStore: OperationModesStore,\n private roundNumericService: GetRoundNumericService,\n private settings: SettingsStore,\n private translationStore: TranslationStore,\n private unitStore: UnitsStore) {\n }\n\n ngOnDestroy(): void {\n this._subscriptions.forEach((s) => s.unsubscribe());\n }\n\n ngOnInit(): void {\n this.logFile = ObjectFactory.Copy(this.formStore.Listen(s => s.updateComponent).getValue().data.SourceItem);\n const dataItem = ObjectFactory.Copy(this.formStore.Listen(s => s.updateComponent).getValue().data);\n dataItem['Planning'] = this.nFertilizationStore.GetPlanningById(dataItem['Planning']?.Id);\n // TODO: cannot use previous type NFertilizationLogfilesGridData->Planning, align\n // Problem is in grid assigning, ap-n-fertilization-logfiles.component.ts:586\n // (Assigning Planning object content from different places)\n\n this._subscriptions.push(this.dynForm.FormValues$.pipe(\n distinctUntilChanged((previous, current) => JSON.stringify(previous) === JSON.stringify(current)))\n .subscribe((values) => dataItem.Ec = values['Ec']));\n\n this.fieldSets$.next(this.getFieldSets(dataItem as NFertilizationLogfilesGridData));\n }\n\n ngAfterViewInit(): void {\n setTimeout(() => {\n this.dynForm.form.markAllAsTouched();\n this.saveDisabled$.next(!this.dynForm.form.valid);\n }, 0);\n\n this._subscriptions.push(this.dynForm.form.valueChanges.subscribe(() => {\n this.saveDisabled$.next(!this.dynForm.form.valid);\n }));\n\n for (const key in this.dynForm.form.controls) {\n if (!this.dynForm.form.controls.hasOwnProperty(key)) {\n continue;\n }\n this._subscriptions.push(this.dynForm.form.controls[key].valueChanges.subscribe((v) => {\n this._onFormValueChanges(key, v);\n }));\n }\n }\n\n private getFieldSets(dataItem: NFertilizationLogfilesGridData): ApDynformsConfigFieldset[] {\n let productId = dataItem.Planning?.ProductId;\n const isScanBoniturOperationMode = dataItem.OperationMode === this.operationModeStore.getIOperationModeByKey(OperationModesEnum.Bonitur)?.LoggerId.toString();\n const operationMode = this.operationModeService.getOperationModeByLoggerId(+dataItem.OperationMode);\n let group = -1;\n if (productId == null) {\n if (dataItem.NContent === 100) {\n productId = 0;\n } else {\n productId = this.componentService.getProductIdByNContent(dataItem.NContent);\n group = this.fertilizerStore.getGroup(productId);\n }\n } else {\n group = this.fertilizerStore.getGroup(productId);\n }\n\n const plannings$ = this.nFertilizationStore.Listen(s => s.planBooks).pipe(\n map((planBooks) => {\n const resultList = [];\n resultList.push({\n Id: '0',\n Note: `(${this.translationStore.FindTranslationForSelectedLanguage('Global__New_Planning')})`\n });\n const filteredPlanBooks = this.componentService.filterPlanBooks(this.logFile, planBooks)\n .filter(pb => pb.LogFileOperationMode === operationMode.LoggerId)\n .map((planBook) => {\n const result = ObjectFactory.Copy(planBook);\n result.Note = this.componentService.getPlanningDescription(planBook);\n return result;\n });\n resultList.push(...filteredPlanBooks);\n return resultList;\n }),\n );\n\n return [\n new ApDynformsConfigFieldset({\n key: 'Global__General_Information',\n legend: 'Global__General_Information',\n config: [\n new ApDynformsConfigTextbox({\n key: 'FieldName',\n label: 'Global__FieldName',\n disabled: true,\n value: this.fieldStore.getFieldNameById(dataItem?.FieldGeomId)\n }),\n new ApDynformsConfigTextbox({\n key: 'FieldArea',\n label: 'Global_Traversed_Area',\n disabled: true,\n value: this.roundNumericService.round(dataItem?.WorkedArea, this.settings.FirstSetting.DigitsAfterDecimalPoint)\n }),\n ]\n }),\n new ApDynformsConfigFieldset({\n key: 'Logfile',\n legend: 'N__Logfile',\n config: [\n new ApDynformsConfigNumerictextbox({\n key: 'Ec',\n label: 'Global__ECStageShort',\n value: dataItem.SourceItem.Ec,\n validators: [\n new ApDynformsValidator({validator: Validators.required, errorKey: ''}),\n ],\n decimals: 0,\n min: +this.constantsService.GetConstant('EC_MIN'),\n max: +this.constantsService.GetConstant('EC_MAX'),\n }),\n new ApDynformsConfigComboBox({\n key: 'Planning',\n label: 'Global__Planning',\n valuePrimitive: false,\n valueField: 'Id',\n textField: 'Note',\n value$: plannings$.pipe(\n map((plannings) =>\n plannings.find((planning) => planning.Id === dataItem.Planning?.Id)\n )\n ),\n options: plannings$,\n validators: [\n new ApDynformsValidator({validator: Validators.required, errorKey: ''}),\n ]\n }),\n new ApDynformsConfigNumerictextbox({\n key: 'WorkingWidth',\n label: 'Docu_Ini__WorkingWidth_m',\n value: dataItem.WorkingWidth,\n min: 0,\n max: 100,\n }),\n new ApDynformsConfigNumerictextbox({\n key: 'NContent',\n label: 'Global__N_Content_Percent',\n value: dataItem.NContent,\n min: 0,\n max: 100,\n disabled: true\n }),\n new ApDynformsConfigNumerictextbox({\n key: 'NContentAvg',\n label: 'Nutrients__Average_Amount_kg_N_per_ha',\n value: dataItem.Amount?.Avg,\n value$: this.dynForm.FormValues$.pipe(\n map((value) => this.roundNumericService.roundAsNumber(value['Amount'], this.settings.FirstSetting.DigitsAfterDecimalPoint)),\n distinctUntilChanged(),\n filter(() => dataItem?.WorkedArea !== 0),\n map((value) => value / dataItem?.WorkedArea),\n ),\n disabled: true\n }),\n new ApDynformsConfigNumerictextbox({\n key: 'Amount',\n label: 'Nutrients_Pages_Popups__Amount_kg_N',\n value: this.roundNumericService.roundAsNumber(dataItem.Amount?.Value, this.settings.FirstSetting.DigitsAfterDecimalPoint),\n step: 1,\n min: 0,\n max: this.roundNumericService.roundAsNumber(200 * dataItem?.WorkedArea),\n validators: [\n new ApDynformsValidator({validator: Validators.required, errorKey: ''}),\n ]\n })\n ]\n }),\n isScanBoniturOperationMode ? undefined : this.formBuilder.getProductFieldSet({\n Product: productId,\n Group: group\n }, this.dynForm.FormValues$),\n new ApDynformsConfigFieldset({\n key: 'Documentation',\n legend: 'Global__Documentation',\n config: [\n new ApDynformsConfigComboBox({\n key: 'Machine',\n label: 'AgriConnect__Engine',\n value$: this.dynForm.FormValues$.pipe(\n distinctUntilChanged((p, n) => p['Planning']?.Id === n['Planning']?.Id),\n map((v) => v['Planning']?.ExportMachine),\n ),\n disabled$: this.dynForm.FormValues$.pipe(map((values) => !values['Planning'])),\n valueField: 'Id',\n textField: 'NameWithSign',\n sort: 1,\n options: this.machineStore.Listen(s => s.data)\n }),\n new ApDynformsConfigComboBox({\n key: 'Instrument',\n label: 'AgriConnect_Ini__Tool',\n value$: this.dynForm.FormValues$.pipe(\n distinctUntilChanged((p, n) => p['Planning']?.Id === n['Planning']?.Id),\n map((v) => v['Planning']?.ExportInstrument),\n ),\n disabled$: this.dynForm.FormValues$.pipe(map((values) => !values['Planning'])),\n valueField: 'Id',\n textField: 'Name',\n sort: 1,\n options: this.instrumentStore.Listen(s => s.data)\n }),\n new ApDynformsConfigComboBox({\n key: 'Driver',\n value$: this.dynForm.FormValues$.pipe(\n distinctUntilChanged((p, n) => p['Planning']?.Id === n['Planning']?.Id),\n map((v) => v['Planning']?.ExportDriver),\n ),\n label: 'Docu_Ini__Motorist',\n disabled$: this.dynForm.FormValues$.pipe(map((values) => !values['Planning'])),\n valueField: 'Id',\n textField: 'ShortFullName',\n sort: 1,\n options: this.driverStore.Listen(s => s.data)\n }),\n ]\n })\n ];\n }\n\n onCancelClick(): void {\n this.formStore.closeForm();\n }\n\n onSaveClick(): void {\n if (this.dynForm.form.valid) {\n this._save();\n this.formStore.closeForm();\n } else {\n this.dynForm.markAsTouched();\n }\n }\n\n _save(): void {\n const values = this.dynForm.form.getRawValue();\n if (values['Planning'].Id === '0') {\n this.logFile.NPlanBook = this._newPlanning();\n } else {\n this.logFile.NPlanBook = values['Planning'];\n }\n this.logFile.NPlanBook.ExportDriver = values.Driver;\n this.logFile.NPlanBook.ExportMachine = values.Machine;\n this.logFile.NPlanBook.ExportInstrument = values.Instrument;\n this.logFile.NPlanBook.ProductId = values.Product ?? 0;\n this.logFile.NContent = values.Amount;\n this.logFile.Ec = values.Ec;\n this.logFile.WorkingWidth = values.WorkingWidth;\n this.logFile.Amount = values['Amount'];\n this.logFile.Factor = this.logFile.NContentAvg ? values['Amount'] / (this.logFile.NContentAvg * this.logFile.Area) : 1.0;\n\n this.nFertilizationStore.SaveLogfiles([this.logFile]);\n }\n\n _newPlanning(): INFertilizationPlanBook {\n\n const json = JSON.parse(this.logFile.DataSet.HeaderValuesString);\n const threshold = json['Relative cutoff'];\n const operationMode = this.operationModeService.GetOperationModeByLoggerId(+json['OperationMode']);\n const applicationMode = this.operationModeService.GetApplicationMode(operationMode);\n const standard = json['Standard'] ? +json['Standard'] : (this.logFile.NContentMin + this.logFile.NContentMax) / 2;\n const referenceRate = json['ReferenceRate'] != null ? json['ReferenceRate'].Split(' ')[0] : undefined;\n const applicationRate = referenceRate ? +referenceRate : standard;\n const dateString = this.dateService.toFarmDate(new Date()).format(this.languageStore.CurrentDateTimeFormat);\n\n const summary = {\n Id: undefined,\n ECValue: this.logFile.Ec,\n OperationMode: operationMode,\n ApplicationMode: applicationMode,\n ApplicationDate: this.logFile.DataSet.Created,\n AdditionalValue: {\n DeadBiomass: json['DeadBiomass'] != null ? json['DeadBiomass'].split(' ')[0] : undefined,\n ExpectedYield: undefined,\n NMinPotential: undefined\n },\n FarmId: this.logFile.FarmId,\n Title: `${this.translationStore.FindTranslationForSelectedLanguage('Global__New_Planning')} ${dateString}`,\n Version: 0,\n UserApplicationConstant: standard,\n UserApplicationMaximum: json['Maximum'] ? +json['Maximum'] : this.logFile.NContentMax,\n UserApplicationMinimum: json['Minimum'] ? +json['Minimum'] : this.logFile.NContentMin,\n UserApplicationRate: applicationRate,\n Unit: this.unitStore.getUnit('kgN/ha'),\n Slope: 1,\n } as INFertilizationSummary;\n\n return {\n Id: undefined,\n ApplicationMode: applicationMode,\n Note: '',\n Summary: summary,\n ApplicationDate: this.logFile.DataSet.Created,\n FieldId: this.fieldStore.getFieldByFieldGeomId(this.logFile.FieldGeomId)?.Id,\n Status: 0,\n OperationMode: operationMode,\n ECValue: this.logFile.Ec,\n FieldGeomId: this.logFile.FieldGeomId,\n Area: this.logFile.Area,\n ApplicationConst: standard,\n ApplicationMax: json['Maximum'] ? +json['Maximum'] : this.logFile.NContentMax,\n ApplicationMin: json['Minimum'] ? +json['Minimum'] : this.logFile.NContentMin,\n ApplicationRate: applicationRate,\n Threshold: threshold,\n Version: 0,\n FarmId: this.logFile.FarmId,\n Element: 5,\n MainCropId: this.logFile.CropType,\n Geom: this.fieldStore.getFieldGeomById(this.logFile.FieldGeomId)?.Geom,\n Unit: this.unitStore.getUnit('kgN/ha'),\n Slope: 1,\n Factor: 1,\n } as INFertilizationPlanBook;\n }\n\n private _onFormValueChanges(control: string, _: any): void {\n if (!control || this.formValuesUpdateInProgress) {\n return;\n }\n\n const inputsToUpdate: { [key: string]: any } = {};\n const planningControlValue = this.dynForm?.form?.get('Planning')?.value;\n\n switch (control) {\n case 'Planning':\n if (planningControlValue) {\n inputsToUpdate['Product'] = planningControlValue.ProductId ?? '';\n inputsToUpdate['Group'] = planningControlValue.ProductId ? this.fertilizerStore.getGroup(planningControlValue.ProductId) : 0;\n }\n break;\n case 'Group':\n if (!inputsToUpdate.hasOwnProperty('Product')) {\n inputsToUpdate['Product'] = '';\n }\n break;\n }\n\n if (Object.keys(inputsToUpdate).length > 0) {\n this.formValuesUpdateInProgress = true;\n try {\n Object.keys(inputsToUpdate).forEach(val => {\n const c = this.dynForm.form.get(val);\n if (c !== null && c.value !== inputsToUpdate[val]) {\n c.setValue(inputsToUpdate[val]);\n }\n }\n );\n } catch {\n }\n\n this.formValuesUpdateInProgress = false;\n }\n }\n}\n","import {Injectable} from '@angular/core';\nimport {ApShowPointsOnMapService} from '../../ap-utils/service/ap-show-points-on-map.service';\nimport {TranslationStore} from '../../stores/translation/translation.store';\nimport {ApDynformsConfigFieldset} from '../../ap-dynforms/config/ap-dynforms-config-fieldset';\nimport {map} from 'rxjs/operators';\nimport {ApDynformsConfigNumerictextbox} from '../../ap-dynforms/config/ap-dynforms-config-numerictextbox';\nimport {NFertilizationStore} from '../../stores/n-fertilization/n-fertilization.store';\nimport {ObjectFactory} from 'ts-tooling';\nimport {ApDynformsConfigComboBox} from '../../ap-dynforms/config/ap-dynforms-config-combobox';\nimport {FertilizerStore} from '../../stores/base-data/fertilizer.store';\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 {MapStore} from '../../stores/map/map.store';\nimport {ApDateService} from '../../ap-core/services/ap-date-service';\nimport {GetApplicationModeService} from '../../ap-utils/service/ap-get-applicationmode.service';\nimport {GetOperationModeService} from '../../ap-utils/service/ap-get-operationmode.service';\nimport {CropApplicationStore} from '../../stores/task-management/crop-application.store';\nimport {ApDynformsConfigTextbox} from '../../ap-dynforms/config/ap-dynforms-config-textbox';\nimport {FieldStore} from '../../stores/farm/field.store';\nimport {CropTypeStore} from '../../stores/base-data/crop.types.store';\nimport {ApplicationModesEnum} from '../../stores/common/appl-modes.store';\nimport {UnitsStore} from '../../stores/common/units.store';\nimport IGuid = System.IGuid;\nimport IDatasetFieldMap = Data.Sensor.IDatasetFieldMap;\nimport INFertilizationPlanBook = Data.TaskManagement.INFertilizationPlanBook;\nimport INFertilizationSummary = Data.TaskManagement.INFertilizationSummary;\nimport IApplicationMode = Data.Common.IApplicationMode;\n\n@Injectable({\n providedIn: 'root'\n})\nexport class ApNFertilizationLogfilesService {\n private static _getJson(log: IDatasetFieldMap): any {\n return JSON.parse(log.DataSet.HeaderValuesString);\n }\n\n constructor(private applicationModeService: GetApplicationModeService,\n private cropApplicationStore: CropApplicationStore,\n private cropTypeStore: CropTypeStore,\n private dateService: ApDateService,\n private driverStore: DriverStore,\n private fertilizationStore: FertilizerStore,\n private fieldStore: FieldStore,\n private instrumentStore: InstrumentStore,\n private languageStore: LanguageStore,\n private mapStore: MapStore,\n private machineStore: MachineStore,\n private unitStore: UnitsStore,\n private nFertilizationStore: NFertilizationStore,\n private translationStore: TranslationStore,\n private operationModeService: GetOperationModeService,\n private showPointsOnMapService: ApShowPointsOnMapService) {\n }\n\n public toggleLogPointsOnMap(selectedItems: any[], farmId: number): void {\n let selectedMin = Number.MAX_SAFE_INTEGER;\n let selectedMax = 0;\n let showLegend = true;\n\n if (selectedItems && selectedItems?.length > 0) {\n for (const d of selectedItems) {\n // check min and max of the other selected items and adjust min/max boundaries\n if (d?.SourceItem?.NUptakeMin < selectedMin) {\n selectedMin = d?.SourceItem?.NUptakeMin;\n }\n if (d?.SourceItem?.NUptakeMax > selectedMax) {\n selectedMax = d?.SourceItem?.NUptakeMax;\n }\n }\n }\n\n // if there is no or invalid data we hide the legend\n if (selectedMin === Number.MAX_SAFE_INTEGER || !isFinite(selectedMax) || !isFinite(selectedMin)) {\n showLegend = false;\n }\n\n // finally update legend values/titles/colors and reload map considering\n // the new min/max boundaries and the corresponding changed colors.\n // To make this work properly the MapFactoryStyler cache needs to be cleared\n // everytime the min/max is recalculated\n this.mapStore.Legends.LogLegend.updateValues(selectedMin, selectedMax);\n this.mapStore.Legends.refreshLegend(this.mapStore.Legends.LogLegend, showLegend);\n this.showPointsOnMapService.showPoints(selectedItems, farmId);\n }\n\n public onAccept(dataItem: any | any[]): void {\n if (!Array.isArray(dataItem)) {\n dataItem = [dataItem];\n }\n this.nFertilizationStore.BookPlanBooks(\n this._getLogfiles(dataItem).map((log) => ({planBook: log.NPlanBook, logfile: log}))\n );\n }\n\n public onReset(dataItem: any | any[]): void {\n if (!Array.isArray(dataItem)) {\n dataItem = [dataItem];\n }\n this.nFertilizationStore.UnBookPlanBooks(\n this._getLogfiles(dataItem).map((log) => ({planBook: log.NPlanBook, logfile: log}))\n );\n }\n\n public onReject(dataItem: any | any[]): void {\n if (!Array.isArray(dataItem)) {\n dataItem = [dataItem];\n }\n const logFiles = this._getLogfiles(dataItem).map((log) => {\n log = ObjectFactory.Copy(log);\n log.Status = -1;\n if (!!log?.NPlanBook?.BookedBy &&\n this._getNPlanBookLogfiles(log.NPlanBook?.Id).filter(l => l.Id !== log.Id).every(l => l.Status < 1)) {\n this.nFertilizationStore.UnBookPlanBooks([{planBook: log.NPlanBook, logfile: log}]);\n return null;\n }\n return log;\n }).filter(log => !!log);\n this.nFertilizationStore.UpdateLogfiles(logFiles);\n }\n\n public getEditFieldSets(): ApDynformsConfigFieldset[] {\n return [\n new ApDynformsConfigFieldset({\n key: 'Logfile',\n legend: 'N__Logfile',\n config: [\n new ApDynformsConfigNumerictextbox({\n key: 'WorkingWidth',\n label: 'Docu_Ini__WorkingWidth_m',\n min: 0,\n max: 100,\n }),\n new ApDynformsConfigTextbox({\n key: 'Note',\n label: 'Global__Note',\n })\n ]\n }),\n new ApDynformsConfigFieldset({\n key: 'Planning',\n legend: 'Global__Planning',\n config: [\n new ApDynformsConfigComboBox({\n key: 'Planning.ProductId',\n label: 'Global__Product',\n valueField: 'Id',\n textField: 'Prodname',\n options: this.fertilizationStore.Fertilizer$.pipe(\n map((fertilizers) => [\n {\n Id: 0,\n ContentN: 100,\n Prodname: this.translationStore.FindTranslationForSelectedLanguage('Nutrient__PureNutrient')\n },\n ...fertilizers\n ]),\n ),\n }),\n new ApDynformsConfigComboBox({\n key: 'Driver',\n label: 'Docu_Ini__Motorist',\n valueField: 'Id',\n textField: 'ShortFullName',\n options: this.driverStore.Listen(s => s.data)\n }),\n new ApDynformsConfigComboBox({\n key: 'Machine',\n label: 'AgriConnect__Engine',\n valueField: 'Id',\n textField: 'NameWithSign',\n options: this.machineStore.Listen(s => s.data)\n }),\n new ApDynformsConfigComboBox({\n key: 'Attachment',\n label: 'AgriConnect_Ini__Tool',\n valueField: 'Id',\n textField: 'Name',\n options: this.instrumentStore.Listen(s => s.data)\n })\n ]\n })\n ];\n }\n\n public generatePlanning(items: any[]): void {\n const logFiles = this._getLogfiles(items).filter((log) => !log.NPlanBook);\n const summaryLogs = this._splitLogs(logFiles);\n const updateLogs = [];\n\n summaryLogs.forEach((sLogs, i) => {\n const ec = sLogs.Reduce((cont, cur) => cont < cur.Ec ? cont : cur.Ec, undefined);\n let standard = sLogs.Reduce((_, log) => {\n const json = ApNFertilizationLogfilesService._getJson(log);\n return json['Standard'] ? +json['Standard'] : (log.NContentMin + log.NContentMax) / 2 * log.Area;\n }, 0) / sLogs.map(log => log.Area).Sum();\n const applicationRate = sLogs.Reduce((sum, log) => {\n const json = ApNFertilizationLogfilesService._getJson(log);\n return sum + (json['ReferenceRate'] ? +(json['ReferenceRate'].Split(' ')[0]) : standard) * log.Area;\n }, 0) / sLogs.map(log => log.Area).Sum();\n const dateString = this.dateService.toFarmDate(new Date()).format(this.languageStore.CurrentDateTimeFormat);\n const dbmCount = sLogs.filter(l => ApNFertilizationLogfilesService._getJson(l)['DeadBiomass'] !== undefined).length;\n const logFile = sLogs[0];\n const operationMode = this.operationModeService.GetOperationModeByLoggerId(+ApNFertilizationLogfilesService._getJson(logFile)['OperationMode']);\n const applicationMode = this._getApplicationModeId(logFile);\n const unit = this.unitStore.getUnit('kgN/ha');\n const summary = {\n Id: undefined,\n ECValue: ec,\n OperationMode: operationMode,\n ApplicationMode: applicationMode,\n ApplicationDate: sLogs.Reduce((min, l) => min < l.DataSet.Created ? min : l.DataSet.Created, undefined),\n AdditionalValue: sLogs.Reduce((current, log) => {\n const json = ApNFertilizationLogfilesService._getJson(log);\n if (json['DeadBiomass'] === undefined) {\n return current;\n }\n const dbm = dbmCount === 0 ? undefined : json['DeadBiomass'] / dbmCount;\n return {\n DeadBiomass: current.DeadBiomass ? current.DeadBiomass + dbm : dbm,\n ExpectedYield: undefined,\n NMinPotential: undefined\n };\n }, {DeadBiomass: undefined, ExpectedYield: undefined, NMinPotential: undefined}),\n FarmId: sLogs[0].FarmId,\n Title: `${this.translationStore.FindTranslationForSelectedLanguage('Global__New_Planning')} ${dateString}`,\n Version: i,\n UserApplicationConstant: standard,\n UserApplicationMaximum: sLogs.Reduce((aMax, log) => {\n const json = ApNFertilizationLogfilesService._getJson(log);\n const max = json['Maximum'] ? +json['Maximum'] : log.NContentMax;\n return aMax > max ? aMax : max;\n }, undefined),\n UserApplicationMinimum: sLogs.Reduce((aMin, log) => {\n const json = ApNFertilizationLogfilesService._getJson(log);\n const min = json['Minimum'] ? +json['Minimum'] : log.NContentMin;\n return aMin > min ? aMin : min;\n }, undefined),\n UserApplicationRate: applicationRate ?? 0,\n Unit: unit\n } as INFertilizationSummary;\n this._mergeLogs(sLogs).forEach((merged, n) => {\n merged.logs.forEach((log) => {\n const fieldId = this.fieldStore.getFieldByFieldGeomId(log.FieldGeomId)?.Id;\n if (fieldId == null) {\n return;\n }\n const json = ApNFertilizationLogfilesService._getJson(log);\n standard = json['Standard'] ? +json['Standard'] : (log.NContentMin + log.NContentMax) / 2;\n log.NPlanBook = {\n Id: undefined,\n ApplicationMode: applicationMode,\n Note: '',\n Summary: summary,\n ApplicationDate: log.DataSet.Created,\n FieldId: fieldId,\n Status: 0,\n OperationMode: operationMode,\n ECValue: log.Ec,\n FieldGeomId: log.FieldGeomId,\n Area: merged.area,\n ApplicationConst: standard,\n ProductId: this._getProductIdByNContent(json['AgentContent'] ? +json['AgentContent']?.split(' ')[0].Replace(',', '.') : null),\n ApplicationMax: json['Maximum'] ? +json['Maximum'] : log.NContentMax,\n ApplicationMin: json['Minimum'] ? +json['Minimum'] : log.NContentMin,\n ApplicationRate: (json['ReferenceRate'] ? +(json['ReferenceRate'].Split(' ')[0]) : standard),\n Threshold: json['Relative cutoff'],\n Unit: unit,\n Version: n,\n FarmId: log.FarmId,\n Element: 5,\n MainCropId: log.CropType,\n Geom: this.fieldStore.getFieldGeomById(log.FieldGeomId)?.Geom,\n } as unknown as INFertilizationPlanBook;\n updateLogs.push(log);\n });\n });\n });\n if (updateLogs.length !== 0) {\n this.nFertilizationStore.UpdateLogfiles(updateLogs);\n }\n }\n\n public update(items: any | any[], values: any): void {\n if (!Array.isArray(items)) {\n items = [items];\n }\n const logFiles = this._getLogfiles(items)\n .filter(logs => !!logs.FieldGeomId)\n .map((log) => {\n log = ObjectFactory.Copy(log);\n if (values['WorkingWidth']) {\n log.WorkingWidth = values['WorkingWidth'];\n }\n return log;\n });\n const planningMap = this._mapPlannings(logFiles, values['Planning']['SummaryId']);\n logFiles.forEach((log) => {\n if (planningMap[log.Id.toString()]) {\n log.NPlanBook = planningMap[log.Id.toString()];\n }\n\n if (!log.NPlanBook) {\n return;\n }\n\n if (values['Planning']['ProductId'] != null) {\n log.NPlanBook.ProductId = values['Planning']['ProductId'];\n }\n\n if (values['Driver']) {\n log.NPlanBook.ExportDriver = values['Driver'];\n }\n\n if (values['Machine']) {\n log.NPlanBook.ExportMachine = values['Machine'];\n }\n\n if (values['Attachment']) {\n log.NPlanBook.ExportInstrument = values['Attachment'];\n }\n\n if (values['Note'] != null) {\n log.NPlanBook.Summary.Title = values['Note'];\n }\n });\n this.nFertilizationStore.UpdateLogfiles(logFiles.filter(log => !!log && !!log.NPlanBook));\n }\n\n private _getLogfiles(items: any[]): IDatasetFieldMap[] {\n const ids = items.map((item) => item['Id']);\n return this.nFertilizationStore.Listen((s) => s.logfiles).getValue()\n .filter((log) => ids.some((id) => id === log.Id.toString()))\n .map((log) => {\n log = ObjectFactory.Copy(log);\n log.NPlanBook = items.find((item) => item['Id'] === log.Id)?.NPlanBook;\n return log;\n });\n }\n\n private _getNPlanBookLogfiles(id: string | IGuid): IDatasetFieldMap[] {\n return this.nFertilizationStore.GetLogfilesByPlanBookId(id.toString());\n }\n\n private _mapPlannings(logs: IDatasetFieldMap[], summaryId: string): { [key: string]: INFertilizationPlanBook } {\n const result = {};\n\n if (summaryId != null) {\n const plannings = this.nFertilizationStore.GetPlanningBySummaryId(summaryId);\n logs.forEach((l) => result[l.Id.toString()] = plannings.Find((pB) => pB.FieldGeomId === l.FieldGeomId));\n return result;\n }\n\n return result;\n }\n\n private _splitLogs(logs: IDatasetFieldMap[]): IDatasetFieldMap[][] {\n const result: IDatasetFieldMap[][] = [];\n const cropKeys = logs.map(l => this.cropTypeStore.getDefaultCroptype(l.CropType).CropKey).filter((v, i, a) => a.indexOf(v) === i);\n const agentContent = logs.map(l => ApNFertilizationLogfilesService._getJson(l)['AgentContent']).filter((v, i, a) => a.indexOf(v) === i);\n const application = logs.map(l => this.cropApplicationStore.GetApplicationFromLogfile(l)).filter((v, i, a) => a.indexOf(v) === i);\n const operationModes = logs.map(l => ApNFertilizationLogfilesService._getJson(l)['OperationMode']).filter((v, i, a) => a.indexOf(v) === i);\n\n cropKeys.forEach((ck) => {\n agentContent.forEach((aC) => {\n application.forEach((a) => {\n operationModes.forEach((o) => {\n const item = logs.filter(l => this.cropApplicationStore.GetApplicationFromLogfile(l) === a &&\n ApNFertilizationLogfilesService._getJson(l)['AgentContent'] === aC && ck === this.cropTypeStore.getDefaultCroptype(l.CropType)?.CropKey &&\n o === ApNFertilizationLogfilesService._getJson(l)['OperationMode']);\n if (item.length !== 0) {\n result.push(item);\n }\n });\n });\n });\n });\n\n return result;\n }\n\n private _getProductIdByNContent(content: number): number {\n if (!content) {\n return 0;\n }\n let min = 100 - content;\n let productId = 0;\n this.fertilizationStore.Fertilizer.filter(f => f.ContentN > 0).forEach((f) => {\n if (!(min < Math.abs(f.ContentN - content))) {\n min = Math.abs(f.ContentN - content);\n productId = f.Id;\n }\n });\n return productId;\n }\n\n private _mergeLogs(sLogs: IDatasetFieldMap[]): { area: number, logs: IDatasetFieldMap[] }[] {\n const fieldMap: { [fieldId: string]: { area: number, logs: IDatasetFieldMap[] } } = {};\n for (const log of sLogs) {\n const id = log.FieldGeomId as string;\n if (fieldMap[id]) {\n fieldMap[id].logs.push(log);\n fieldMap[id].area += log.Area;\n } else {\n fieldMap[id] = {area: log.Area, logs: [log]};\n }\n }\n return Object.keys(fieldMap).map((key) => fieldMap[key]);\n }\n\n private _getApplicationModeId(logFile: IDatasetFieldMap): IApplicationMode | null {\n const applicationMode = this.applicationModeService.GetApplicationModeById(logFile.ApplicationMode);\n if (applicationMode) {\n return applicationMode;\n }\n const operationModeId = +ApNFertilizationLogfilesService._getJson(logFile)['OperationMode'];\n const operationMode = this.operationModeService.getOperationModeByLoggerId(operationModeId);\n if (!operationMode) {\n return null;\n }\n return this.applicationModeService.GetApplicationModeByKey(ApplicationModesEnum.Variable);\n }\n\n\n}\n","import {Route, RouterModule} from '@angular/router';\nimport {NgModule} from '@angular/core';\nimport {PageMode} from '../ap-interface';\nimport {ApNFertilizationOverviewComponent} from './components/ap-n-fertilization-overview.component';\nimport {ApPermissionGuard} from '../guards/ap-permission-guard.service';\nimport {ApNFertilizationPlanningComponent} from './components/ap-n-fertilization-planning.component';\nimport {ApNFertilizationBookingComponent} from './components/ap-n-fertilization-booking.component';\nimport {ApNFertilizationLogfilesComponent} from './components/ap-n-fertilization-logfiles.component';\nimport {ApNFertilizationNNeedComponent} from './components/ap-n-fertilization-n-need.component';\n\nconst routes: Route[] = [\n {\n path: 'logfiles',\n component: ApNFertilizationLogfilesComponent,\n canActivate: [ApPermissionGuard],\n data: {\n login: true,\n layout: PageMode.HALFSCREEN\n },\n },\n {\n path: 'overview',\n component: ApNFertilizationOverviewComponent,\n canActivate: [ApPermissionGuard],\n data: {\n login: true,\n layout: PageMode.HALFSCREEN\n },\n },\n {\n path: 'n-need',\n component: ApNFertilizationNNeedComponent,\n canActivate: [ApPermissionGuard],\n data: {\n login: true,\n layout: PageMode.HALFSCREEN\n },\n },\n {\n path: 'booking',\n component: ApNFertilizationBookingComponent,\n canActivate: [ApPermissionGuard],\n data: {\n login: true,\n layout: PageMode.HALFSCREEN\n },\n },\n {\n path: 'planning',\n component: ApNFertilizationPlanningComponent,\n canActivate: [ApPermissionGuard],\n data: {\n login: true,\n layout: PageMode.HALFSCREEN\n },\n }\n];\n\n@NgModule({\n imports: [\n RouterModule.forChild(routes)\n ],\n exports: [RouterModule]\n})\nexport class ApNFertilizationRoutes {\n}\n","import {AfterViewInit, Component, OnDestroy, OnInit, ViewChild} from '@angular/core';\nimport {\n ApDynComponentComponent\n} from '../../ap-dyncomponent/ap-dyncomponent.component';\nimport {\n ApDynGridColumnConfigBase\n} from '../../ap-dyngrids/config/ap-dyn-grid-column-config-base';\nimport {\n ApDynGridEditColumnConfig\n} from '../../ap-dyngrids/config/ap-dyn-grid-edit-column-config';\nimport {\n ApDynGridPropertyColumnConfig,\n FilterType,\n PropertyTemplate\n} from '../../ap-dyngrids/config/ap-dyn-grid-property-column-config';\nimport {filter, map} from 'rxjs/operators';\nimport {\n NFertilizationStore\n} from '../../stores/n-fertilization/n-fertilization.store';\nimport {BehaviorSubject, combineLatest, Observable, of, Subscription} from 'rxjs';\nimport {FieldStore} from '../../stores/farm/field.store';\nimport {CampaignYearStore} from '../../stores/login/campaignyear.store';\nimport {LanguageStore} from '../../stores/translation/language.store';\nimport {GetRoundNumericPipe} from '../../ap-utils';\nimport {SettingsStore} from '../../stores/base-data/settings.store';\nimport {ApUtilService} from '../../ap-utils/service/ap-util.service';\nimport {\n ApShowPointsOnMapService\n} from '../../ap-utils/service/ap-show-points-on-map.service';\nimport {\n ApDynGridPagerConfigBase\n} from '../../ap-dyngrids/config/ap-dyn-grid-pager-config-base';\nimport {\n ApDynGridPagerConfig,\n IGridPagerSubmitData\n} from '../../ap-dyngrids/config/ap-dyn-grid-pager-config';\nimport {ApGridPagerType} from '../../ap-interface';\nimport {TranslationStore} from '../../stores/translation/translation.store';\nimport {\n ApNFertilizationLogfilesService\n} from '../services/ap-n-fertilization-logfiles.service';\nimport {\n ApDynGridGroupColumnConfig\n} from '../../ap-dyngrids/config/ap-dyn-grid-group-column-config';\nimport {FertilizerStore} from '../../stores/base-data/fertilizer.store';\nimport {\n ApDynGridStatusSwitchColumnConfig,\n IStateChange\n} from '../../ap-dyngrids/config/ap-dyn-grid-status-switch-column.config';\nimport {\n ApDynformsConfigFieldset\n} from '../../ap-dynforms/config/ap-dynforms-config-fieldset';\nimport {FormStore} from '../../stores/layout/form.store';\nimport {\n ApNFertilizationLogfileEditComponent\n} from '../../entry-components/ap-n-fertilization-entry-components/ap-n-fertilization-logfile-edit.component';\nimport {DriverStore} from '../../stores/docu/driver.store';\nimport {ApDateService} from '../../ap-core/services/ap-date-service';\nimport {CropTypeStore} from '../../stores/base-data/crop.types.store';\nimport {\n CropApplicationStore\n} from '../../stores/task-management/crop-application.store';\nimport {\n GetRoundNumericService\n} from '../../ap-utils/service/get-round-numeric.service';\nimport {\n ApDynGridStatusColumnConfig\n} from '../../ap-dyngrids/config/ap-dyn-grid-status-column-config';\nimport {ObjectFactory} from 'ts-tooling';\nimport {FertilizerService} from '../../services/data/fertilizer.service';\nimport {\n NFertilizationService\n} from '../../services/data/n-fertilization.service';\nimport {MapFactoryStyler} from '../../map-factory/style';\nimport {LoginStore} from '../../stores/login/login.store';\nimport {OperationModesEnum, OperationModesStore} from '../../stores/common/operation-modes.store';\nimport {LogfileService} from '../../services/data/logfiles.service';\nimport IDatasetFieldMap = Data.Sensor.IDatasetFieldMap;\nimport IGuid = System.IGuid;\nimport IDriver = Data.DocuContext.Driver.IDriver;\n\nexport interface NFertilizationLogfilesGridData {\n Id: number;\n SourceItem: IDatasetFieldMap;\n DatasetId: IGuid;\n NContent: number;\n OperationMode: string;\n ApplicationMode: number;\n Status: number;\n StatusDesc: string;\n StatusClass: string;\n LogStatus: number;\n LogStatusDesc: string;\n LogStatusClass: string;\n Factor: number;\n FieldId: IGuid;\n FieldName: string;\n FieldGeomId: IGuid;\n FieldArea: number;\n FileName: string;\n Date: Date;\n Crop: string;\n Ec: number;\n FarmId: number;\n WorkedArea: number;\n WorkedAreaRounded: number;\n WorkingWidth: number;\n Amount: {\n Avg: number;\n AvgRounded: number;\n Value: number;\n ValueRounded: number;\n };\n NPlanBook: Data.TaskManagement.INFertilizationPlanBook;\n Appl: string;\n Planning: {\n Id: IGuid;\n SummaryId: IGuid;\n Date: Date;\n ProductId: number;\n Product: string;\n Note: string;\n Driver: IDriver;\n };\n}\n\n@Component({\n selector: 'ap-n-fertilization-logfiles',\n template: `\n \n \n `,\n styles: []\n})\nexport class ApNFertilizationLogfilesComponent implements OnInit, AfterViewInit, OnDestroy {\n @ViewChild(ApDynComponentComponent, {static: true}) dynComponent: ApDynComponentComponent;\n public items$: Observable = of([]);\n public loading$: Observable = of(true);\n public columns: ApDynGridColumnConfigBase[] = [];\n public fieldSets: ApDynformsConfigFieldset[];\n public pager: ApDynGridPagerConfigBase;\n\n private _isSaving$ = new BehaviorSubject(false);\n private _selectedFieldIds = new BehaviorSubject([]);\n private _subscriptions: Array = [];\n\n constructor(private nFertilizationLogfileService: ApNFertilizationLogfilesService,\n private campaignYearStore: CampaignYearStore,\n private loginStore: LoginStore,\n private cropApplicationStore: CropApplicationStore,\n private cropTypeStore: CropTypeStore,\n private driverStore: DriverStore,\n private fertilizerStore: FertilizerStore,\n private fieldStore: FieldStore,\n private showPointsOnMapService: ApShowPointsOnMapService,\n private languageStore: LanguageStore,\n private nFertilization: NFertilizationStore,\n private formStore: FormStore,\n private roundNumericPipe: GetRoundNumericPipe,\n private roundNumericService: GetRoundNumericService,\n private settingStore: SettingsStore,\n private translationStore: TranslationStore,\n private dateService: ApDateService,\n private nFertilizationService: NFertilizationService,\n private fertilizerService: FertilizerService,\n private operationModeStore: OperationModesStore,\n private logfileService: LogfileService) {\n }\n\n public ngOnInit(): void {\n this.loading$ = combineLatest([\n this.nFertilization.Listen(s => s.logfilesLoading),\n this.nFertilization.Listen(s => s.loading),\n this.fieldStore.Listen(s => s.loading),\n this.cropApplicationStore.Listen(s => s.loading),\n this._isSaving$,\n this.nFertilization.Listen(s => s.planBooksLoading)\n ]).pipe(map(([l0, l1, l2, l3, saving, l4]) => {\n return l0 || l1 || l2 || l3 || saving || l4;\n }));\n\n this._gridBuilder();\n }\n\n public ngAfterViewInit(): void {\n this._subscriptions.push(this.campaignYearStore.Listen(s => s.selectedYear).subscribe(() => setTimeout(() => {\n this.nFertilization.LoadNFertilizationPlanningSummaries();\n this.nFertilization.LoadLogfiles();\n })));\n this._subscriptions.push(this.campaignYearStore.onLoadingStoresComplete.subscribe(() => {\n this.showPointsOnMapService.clear();\n }));\n this._subscriptions.push(this.loading$.subscribe(loading => {\n if (!loading) {\n this.dynComponent.dynGrid.gridPaging.setSelectedKeys([]);\n }\n }));\n\n this._subscriptions.push(this.dynComponent.SelectedItems$.pipe(\n map((items) => items.map((item) => item.FieldId).filter((v, i, a) => a.indexOf(v) === i)),\n ).subscribe((ids) => {\n this._selectedFieldIds.next(ids);\n this.fieldStore.changeSelectedField(ids);\n }));\n setTimeout(() => this._getDataFromStore(), 1);\n this._subscriptions.push(this.dynComponent.SelectedItems$.subscribe(selectedItems => {\n MapFactoryStyler.Instance.clearStyleCache();\n this.nFertilizationLogfileService.toggleLogPointsOnMap(selectedItems, this.loginStore.SelectedFarmId);\n }));\n }\n\n public ngOnDestroy(): void {\n this.showPointsOnMapService.clear();\n this._subscriptions.forEach(s => s.unsubscribe());\n }\n\n private _gridBuilder(): void {\n this.fieldSets = undefined;\n this.columns = [\n new ApDynGridStatusColumnConfig({\n field: 'Status',\n class: 'StatusClass',\n description: 'StatusDesc',\n groupDesc: true\n }),\n new ApDynGridStatusSwitchColumnConfig({\n field: 'LogStatus',\n readonly: true,\n filterable: true,\n defaultFilter: 0,\n disableGreen: (item) => !this._logFileValid(item.SourceItem) || !this._logBookingReady(item.SourceItem),\n stateChange: ApUtilService.createEventEmitter(\n (event: IStateChange) => {\n if (event.state === -1) {\n this.nFertilizationLogfileService.onReject(event.item);\n } else if (event.state === 0) {\n this.nFertilizationLogfileService.onReset(event.item);\n } else if (event.state === 1) {\n this.nFertilizationLogfileService.onAccept(event.item);\n }\n }, this._subscriptions),\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__FieldName',\n field: 'FieldName',\n width: 180,\n headerFilterable: true,\n filterable: true\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global_ha_Unit',\n field: 'FieldArea',\n width: 60,\n headerFilterable: true,\n cssClass: 'right',\n filterType: FilterType.NUMBER,\n pipes: [{\n pipe: this.roundNumericPipe,\n args: [this.settingStore.FirstSetting.DigitsAfterDecimalPoint]\n }]\n }),\n new ApDynGridGroupColumnConfig({\n title: 'N__Logfile',\n groupColumns: [\n new ApDynGridPropertyColumnConfig({\n title: 'Global__Filename',\n field: 'FileName',\n width: 100,\n filterable: true,\n headerFilterable: true,\n hide: true\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__Date',\n field: 'Date',\n format: this.languageStore.SelectedLanguage.DateFormat,\n width: 80,\n filterable: true,\n headerFilterable: true,\n sortIndex: 0,\n sortDesc: true\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__Crop',\n field: 'Crop',\n width: 100,\n headerFilterable: true,\n filterable: true\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__ECStageShort',\n field: 'Ec',\n width: 40,\n cssClass: 'right',\n filterType: FilterType.NUMBER,\n filterable: true,\n headerFilterable: true,\n hide: true\n }),\n new ApDynGridPropertyColumnConfig({\n field: 'Appl',\n title: 'Global__N_ApplNum',\n width: 40,\n headerFilterable: true,\n filterable: true\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Docu_Ini__Area',\n field: 'WorkedAreaRounded',\n tooltip: (dataItem) => this.roundNumericPipe.transform(dataItem['WorkedArea'], 4),\n width: 60,\n hide: true,\n cssClass: 'right',\n filterType: FilterType.NUMBER,\n headerFilterable: true,\n filterable: true,\n pipes: [{\n pipe: this.roundNumericPipe,\n args: [this.settingStore.FirstSetting.DigitsAfterDecimalPoint]\n }]\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__Average_Amount',\n field: 'Amount.AvgRounded',\n headerExtraLines: ['Global__KgNPerHa'],\n tooltip: (dataItem) => this.roundNumericPipe.transform(dataItem['Amount']['Avg']),\n width: 60,\n cssClass: 'right',\n filterType: FilterType.NUMBER,\n headerFilterable: true,\n filterable: true,\n pipes: [{\n pipe: this.roundNumericPipe,\n args: [this.settingStore.FirstSetting.DigitsAfterDecimalPoint]\n }]\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__Sum',\n field: 'Amount.ValueRounded',\n headerExtraLines: ['Global__Unit_kgN'],\n width: 60,\n cssClass: 'right',\n dynCssClass: (dataItem: any) => dataItem['Factor'] !== 1.0 ? ' italic bold' : '',\n filterType: FilterType.NUMBER,\n headerFilterable: true,\n filterable: true,\n hide: true,\n tooltip: (dataItem) => this.roundNumericPipe.transform(dataItem['Amount']['Value']),\n pipes: [{\n pipe: this.roundNumericPipe,\n args: [this.settingStore.FirstSetting.DigitsAfterDecimalPoint]\n }]\n })\n ]\n }),\n new ApDynGridGroupColumnConfig({\n title: 'Global__Planning',\n hide: true,\n groupColumns: [\n new ApDynGridPropertyColumnConfig({\n title: 'Global__Product',\n field: 'Planning.Product',\n width: 100,\n headerFilterable: true,\n filterable: true\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__Date',\n field: 'Planning.Date',\n format: this.languageStore.SelectedLanguage.DateFormat,\n width: 80,\n headerFilterable: true,\n filterable: true,\n filterType: FilterType.DATE,\n template: PropertyTemplate.DATE\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Docu_Ini__Motorist',\n field: 'Planning.Driver.ShortFullName',\n width: 100,\n headerFilterable: true,\n filterable: true\n }),\n ]\n }),\n new ApDynGridEditColumnConfig({\n data: [\n {\n text: 'Global__Edit',\n callback: ApUtilService.createEventEmitter(this._onEdit.bind(this), this._subscriptions),\n disabled: (item) => item.LogStatus === 1 || item.Status === -1\n },\n {\n text: 'Global__Booking',\n callback: ApUtilService.createEventEmitter(this._onBooking.bind(this), this._subscriptions),\n disabled: (item) => !this._logFileValid(item.SourceItem) || !this._logBookingReady(item.SourceItem) || this._logBooked(item.SourceItem)\n },\n {\n text: 'Global__Reject',\n callback: ApUtilService.createEventEmitter(this._onReject.bind(this), this._subscriptions),\n disabled: false\n },\n {\n text: 'Global__Logfile_Remap',\n callback: ApUtilService.createEventEmitter(this._onRemap.bind(this), this._subscriptions),\n disabled: (item) => item.LogStatus === 1\n }\n ]\n })\n ];\n\n this.pager = new ApDynGridPagerConfig({\n preselect: false,\n listMassEditing: [\n {\n id: 0,\n name: this.translationStore.FindTranslationForSelectedLanguage('Docu_Ini__Edit'),\n type: ApGridPagerType.None,\n formConfig: this.nFertilizationLogfileService.getEditFieldSets(),\n disabled: (properties) => properties.selectedItems.some((item) => item.Status !== 1 || item.LogStatus !== 0),\n values: [],\n onSubmit: ApUtilService.createEventEmitter(\n (event: IGridPagerSubmitData) => {\n this._isSaving$.next(true);\n this.nFertilizationLogfileService.update(event.items, event.form.value);\n }\n , this._subscriptions)\n },\n {\n id: 4,\n name: this.translationStore.FindTranslationForSelectedLanguage('Global__Generate_Planning'),\n type: ApGridPagerType.None,\n disabled: (properties) => properties.selectedItems.some((item) => item.Status !== 0) ||\n properties.selectedItems.every((item: any) => item.NPlanBook != null),\n values: [],\n onSubmit: ApUtilService.createEventEmitter(\n (event: IGridPagerSubmitData) => this.nFertilizationLogfileService.generatePlanning(event.items), this._subscriptions)\n },\n {\n id: 1,\n name: this.translationStore.FindTranslationForSelectedLanguage('Admin_Pages_Popups__Book'),\n type: ApGridPagerType.None,\n disabled: (properties) =>\n properties.selectedItems.some((item: any) => !this._logFileValid(item.SourceItem) || !this._logBookingReady(item.SourceItem)) ||\n properties.selectedItems.every((item: any) => this._logBooked(item.SourceItem)),\n values: [],\n onSubmit: ApUtilService.createEventEmitter(\n (event: IGridPagerSubmitData) => {\n this._isSaving$.next(true);\n this.nFertilizationLogfileService.onAccept(event.items.filter((item) => !this._logBooked(item.SourceItem)));\n }, this._subscriptions)\n },\n {\n id: 5,\n name: this.translationStore.FindTranslationForSelectedLanguage('Global__Reset'),\n type: ApGridPagerType.None,\n disabled: (properties) =>\n properties.selectedItems.some((item: any) => item.LogStatus === 0),\n values: [],\n onSubmit: ApUtilService.createEventEmitter(\n (event: IGridPagerSubmitData) => {\n this._isSaving$.next(true);\n this.nFertilizationLogfileService.onReset(event.items);\n }, this._subscriptions)\n },\n {\n id: 2,\n name: this.translationStore.FindTranslationForSelectedLanguage('Global__Reject'),\n type: ApGridPagerType.None,\n values: [],\n onSubmit: ApUtilService.createEventEmitter(\n (event: IGridPagerSubmitData) => {\n this._isSaving$.next(true);\n this.nFertilizationLogfileService.onReject(event.items);\n }, this._subscriptions)\n },\n {\n id: 3,\n name: this.translationStore.FindTranslationForSelectedLanguage('Global__Logfile_Remap'),\n type: ApGridPagerType.None,\n disabled: (properties) => properties.selectedItems.some((item: any) => this._logBooked(item.SourceItem)),\n values: [],\n onSubmit: ApUtilService.createEventEmitter(\n (event: IGridPagerSubmitData) => {\n this._onRemap(event.items);\n }, this._subscriptions)\n },\n ],\n });\n }\n\n private _onEdit(dataItem: any): void {\n this.formStore.openForm({component: ApNFertilizationLogfileEditComponent, data: dataItem});\n }\n\n private _onBooking(dataItem: any): void {\n this._isSaving$.next(true);\n this.nFertilizationLogfileService.onAccept(dataItem.SourceItem);\n }\n\n private _onReject(dataItem: any): void {\n this._isSaving$.next(true);\n this.nFertilizationLogfileService.onReject([dataItem]);\n }\n\n private _onRemap(dataItem: any | any[]): void {\n if (Array.isArray(dataItem)) {\n this.nFertilization.remapLogfile(dataItem.map((d) => d['DatasetId']));\n } else {\n this.nFertilization.remapLogfile(dataItem['DatasetId']);\n }\n }\n\n private _getDataFromStore(): void {\n this.items$ = combineLatest([\n this.nFertilization.Listen(s => s.logfiles),\n this.fieldStore.Listen(s => s.data),\n this.cropApplicationStore.Listen(s => s.data),\n this.nFertilization.Listen(s => s.planBooks),\n this.nFertilization.Listen(s => s.planBooksLoading)\n ]).pipe(\n filter(([, fields, ca, , planBooksLoading]) => !!fields && fields.length !== 0 && ca.length !== 0 && !planBooksLoading),\n map(([logfiles, , , planBooks]) => {\n this._isSaving$.next(false);\n return logfiles\n .filter((logfile) => logfile?.DataSet?.DataSetType?.DataSetName === 'Yara N-Sensor')\n .map((logfile) => {\n logfile = ObjectFactory.Copy(logfile);\n const filename = logfile.DataSet.DataSetName.Substring(0, logfile.DataSet.DataSetName.lastIndexOf('.'));\n const planning = logfile.NPlanBook ?? this.logfileService.getPlanning(logfile, planBooks);\n if (planning) {\n logfile.NPlanBook = planning;\n }\n const headerValues = JSON.parse(logfile.DataSet.HeaderValuesString);\n const content = !!headerValues['AgentContent'] ? Number.parseInt(headerValues['AgentContent'].split(' ').shift(), 0) : null;\n const value = logfile.NContentAvg * logfile.Area;\n const status = !this._logFileValid(logfile) ? -1 : this._logBookingReady(logfile) ? 1 : 0;\n const logStatus = this._logIsRejected(logfile) ? -1 : this._logBooked(logfile) ? 1 : 0;\n const driver = this.driverStore.getDriverById(planning?.ExportDriver);\n const fieldId = this.fieldStore.getFieldByFieldGeomId(logfile.FieldGeomId)?.Id;\n const fieldName = this.fieldStore.getFieldNameById(fieldId, 'Global__UnknownFieldName');\n const fertilizer = this.fertilizerStore.getFertilizer(planning?.ProductId);\n const operationMode = headerValues['OperationMode']?.toString();\n return {\n Id: logfile.Id,\n SourceItem: logfile,\n DatasetId: logfile.DataSet.Id,\n NContent: content,\n OperationMode: operationMode,\n ApplicationMode: logfile.ApplicationMode,\n Status: status,\n StatusDesc: status === 1 ? 'Global__Logfile_Ok' : status === -1 ? 'Global__Logfile_Field_Geom_Error' : 'Global__Logfile_Action_Needed',\n StatusClass: status === 1 ? 'ap-status-green' : status === -1 ? 'ap-status-red' : 'ap-status-yellow',\n LogStatus: logStatus,\n LogStatusDesc: logStatus === 1 ? 'Admin_Pages_Popups__Book' : logStatus === -1 ? 'Global__Reject' : 'Global__Reset',\n LogStatusClass: logStatus === 1 ? 'ap-status-green' : logStatus === -1 ? 'ap-status-red' : 'ap-status-yellow',\n Factor: logfile.Factor,\n FieldId: fieldId,\n FieldName: fieldName,\n FieldGeomId: logfile.FieldGeomId,\n FieldArea: this.fieldStore.getFieldGeomById(logfile.FieldGeomId)?.AreaHa ?? logfile.Area,\n FileName: filename,\n Date: this.dateService.getDateMidnight(logfile.DataSet.Created),\n Crop: this.translationStore.FindTranslationForSelectedLanguage(this.cropTypeStore.getDefaultCroptype(logfile.CropType)?.Description),\n Ec: logfile.Ec,\n FarmId: logfile.FarmId,\n WorkedArea: logfile.Area,\n WorkedAreaRounded: this.roundNumericService.roundAsNumber(logfile.Area),\n WorkingWidth: logfile.WorkingWidth ? logfile.WorkingWidth : JSON.parse(logfile.DataSet.HeaderValuesString)['WorkingWidth'],\n Amount: {\n Avg: logfile.NContentAvg,\n AvgRounded: this.roundNumericService.roundAsNumber(logfile.NContentAvg ?? value),\n Value: logfile.Amount ?? value,\n ValueRounded: this.roundNumericService.roundAsNumber(logfile.Amount ?? value) ?? 0,\n },\n NPlanBook: planning,\n Appl: operationMode === this.operationModeStore.getIOperationModeByKey(OperationModesEnum.Bonitur)?.LoggerId.toString()\n ? this.nFertilizationService.getApplicationNScanRateName()\n : this.nFertilizationService.getApplicationRateName(this.cropTypeStore.getDefaultCroptype(logfile.CropType)?.Eppocode, logfile.Ec),\n Planning: {\n Id: planning?.Id,\n SummaryId: planning?.Summary?.Id,\n Date: planning?.ApplicationDate ? this.dateService.getDateMidnight(planning.ApplicationDate) : null,\n ProductId: planning?.ProductId,\n Product: this.fertilizerService.getFertilizerProductName(fertilizer),\n Note: planning?.Summary?.Title,\n Driver: driver\n }\n } as NFertilizationLogfilesGridData;\n });\n }\n ),\n );\n }\n\n private _logFileValid(item: IDatasetFieldMap): boolean {\n const json = JSON.parse(item.DataSet.HeaderValuesString);\n return !!this.fieldStore.getFieldByFieldGeomId(item?.FieldGeomId) &&\n !!item.CropType && !!json['CropType'] &&\n item.Ec != null && json['EcStage'] != null &&\n item.ApplicationMode != null && json['ApplicationMode'] != null;\n }\n\n private _logBookingReady(item: IDatasetFieldMap): boolean {\n if (!item?.NPlanBook || item?.NPlanBook?.ProductId == null) {\n return false;\n }\n const fertilizer = this.fertilizerStore.getFertilizer(item?.NPlanBook?.ProductId);\n if (!fertilizer?.Selectable && item?.NPlanBook?.ProductId !== 0) {\n return false;\n }\n return item?.Ec > 9 && item?.Ec < 70 && item?.WorkingWidth >= 10 && item?.WorkingWidth <= 100;\n }\n\n private _logIsRejected(item: IDatasetFieldMap): boolean {\n return item?.Status === -1;\n }\n\n private _logBooked(item: IDatasetFieldMap): boolean {\n return item?.Status === 1 && item?.NPlanBook?.BookedBy != null;\n }\n}\n","import {AfterContentInit, Component, EventEmitter, OnDestroy, OnInit, ViewChild} from '@angular/core';\nimport {\n ApDynComponentComponent\n} from '../../ap-dyncomponent/ap-dyncomponent.component';\nimport {\n ApDynGridColumnConfigBase,\n ApDynGridColumnHideConfig\n} from '../../ap-dyngrids/config/ap-dyn-grid-column-config-base';\nimport {\n ApDynGridPropertyColumnConfig,\n FilterType,\n PropertyTemplate\n} from '../../ap-dyngrids/config/ap-dyn-grid-property-column-config';\nimport {\n ApDynGridStatusColumnConfig\n} from '../../ap-dyngrids/config/ap-dyn-grid-status-column-config';\nimport {combineLatest, Observable, of, Subscription} from 'rxjs';\nimport {FieldStore} from '../../stores/farm/field.store';\nimport {debounceTime, delay, map} from 'rxjs/operators';\nimport {\n ApGetCropService\n} from '../../stores/services/ap-get-crop.service';\nimport {\n ApDynGridPagerConfig,\n IGridPagerCallBackData\n} from '../../ap-dyngrids/config/ap-dyn-grid-pager-config';\nimport {ApGridPagerType, ApStatsType, MapViewCurrentMenu, MapViewMode} from '../../ap-interface';\nimport {\n ApUtilService\n} from '../../ap-utils/service/ap-util.service';\nimport {\n NFertilizationStore\n} from '../../stores/n-fertilization/n-fertilization.store';\nimport {\n Icon\n} from '../../ap-interface/enums/layout/icon.enum';\nimport {\n CampaignYearStore\n} from '../../stores/login/campaignyear.store';\nimport {\n GetRoundNumericService\n} from '../../ap-utils/service/get-round-numeric.service';\nimport {\n MapViewStore\n} from '../../stores/layout/mapview.store';\nimport {LoginStore} from '../../stores/login/login.store';\nimport {\n ApDateService\n} from '../../ap-core/services/ap-date-service';\nimport {\n ApTranslationService\n} from '../../ap-utils/service/ap-translation.service';\nimport {\n NotifyStore\n} from '../../stores/dialog/notify.store';\nimport {GetRoundNumericPipe} from '../../ap-utils';\nimport {\n SettingsStore\n} from '../../stores/base-data/settings.store';\nimport {\n INFertilizerNNeedGridItem\n} from '../types/ap-n-fertilization-n-need-types';\nimport {\n NFertilizationService\n} from '../../services/data/n-fertilization.service';\nimport {\n StatisticStore\n} from '../../stores/statistic/statistic.store';\nimport {\n ApDynGridGroupColumnConfig\n} from '../../ap-dyngrids/config/ap-dyn-grid-group-column-config';\nimport {\n BasicFertilisationSummariesStore\n} from '../../stores/taskmanagement/basic.fertilisation.summaries.store';\nimport {\n StatisticService\n} from '../../services/data/statistic.service';\nimport IContentRow = Agriport.Excel.Factory.InputData.NRestriction.IContentRow;\nimport IReportData = Agriport.Excel.Factory.InputData.NRestriction.IReportData;\nimport ICropTypes = Data.BaseData.ICropTypes;\nimport IFieldCrop = Data.FieldManagement.IFieldCrop;\nimport IApValidationResult = Data.Api.Validation.IApValidationResult;\nimport ApValidationLevel = Data.Api.Validation.ApValidationLevel;\n\n@Component({\n selector: 'ap-n-fertilization-p-need',\n template: `\n \n \n `,\n styles: []\n})\nexport class ApNFertilizationNNeedComponent implements OnInit, AfterContentInit, OnDestroy {\n @ViewChild(ApDynComponentComponent, {static: true}) dynComponent: ApDynComponentComponent;\n public items$: Observable = of([]);\n public loading$: Observable = of(true);\n public columns: ApDynGridColumnConfigBase[] = [];\n public pager: ApDynGridPagerConfig;\n public exportFileName = '';\n\n private _statisticUpdateRequested = new EventEmitter();\n private _subscriptions: Subscription[] = [];\n\n constructor(private campaignYearStore: CampaignYearStore,\n private fieldStore: FieldStore,\n private loginStore: LoginStore,\n private mapViewStore: MapViewStore,\n private notifyStore: NotifyStore,\n private settingsStore: SettingsStore,\n private statisticStore: StatisticStore,\n private nFertilizationStore: NFertilizationStore,\n private basicFertilisationSummariesStore: BasicFertilisationSummariesStore,\n private dateService: ApDateService,\n private getCropService: ApGetCropService,\n private statisticService: StatisticService,\n private translationService: ApTranslationService,\n private roundNumericService: GetRoundNumericService,\n private nFertilizationService: NFertilizationService,\n private roundNumericPipe: GetRoundNumericPipe) {\n }\n\n public ngOnInit(): void {\n this.loading$ = combineLatest([\n this.fieldStore.Listen((s) => s.loading),\n this.nFertilizationStore.Listen((s) => s.logfilesLoading),\n this.nFertilizationStore.Listen(s => s.planBooksLoading),\n this.settingsStore.Listen(x => x.loading),\n this.basicFertilisationSummariesStore.Listen(x => x.loading)\n ]).pipe(\n map((loadingStatuses) => loadingStatuses.some(x => x))\n );\n this.fieldStore.changeSelectedField([]);\n this.columns = this._getColumns();\n this.pager = this._getPager();\n this.items$ = this._getItems();\n }\n\n public ngAfterContentInit(): void {\n this._subscriptions.push(\n this.dynComponent.SelectedItems$.pipe(\n debounceTime(100),\n delay(1)\n ).subscribe(ids => this._selectionChange(ids))\n );\n this._subscriptions.push(\n this.nFertilizationStore.Listen(x => x.nRestrictionsReportDownloadSuccess).subscribe(downloadResult => {\n this._handleDownloadReportStatus(downloadResult);\n })\n );\n this._subscriptions.push(\n this._statisticUpdateRequested.pipe(debounceTime(100)).subscribe(_ => this._generateStats())\n );\n this._subscriptions.push(\n this.mapViewStore.Listen(s => s.currentMenu).subscribe(mapMenu => this._onMapMenuChanged(mapMenu))\n );\n this.nFertilizationStore.LoadNFertilizationPlanningSummaries();\n this.nFertilizationStore.LoadLogfiles();\n }\n\n public ngOnDestroy(): void {\n this._subscriptions.forEach(s => s.unsubscribe());\n this._statisticUpdateRequested?.unsubscribe();\n this.fieldStore.changeSelectedField([]);\n this.statisticStore.removeStatisticData();\n }\n\n private _getItems(): Observable {\n return combineLatest([\n this.fieldStore.Listen((s) => s.data),\n this.nFertilizationStore.Listen((s) => s.fertilizationNeedValue),\n this.nFertilizationStore.Listen(s => s.planBooks),\n this.nFertilizationStore.Listen(s => s.logfiles),\n this.basicFertilisationSummariesStore.Summaries$\n ]).pipe(\n map(([fields, fnvs, planBooks, logFiles, baseFertSummaries]) => {\n return fields.map(field => {\n const fieldCrop = this.getCropService.getFieldCrop(field);\n const fieldGeom = this.fieldStore.getCurrentFieldGeom(field);\n const mainCrop = this.getCropService.getCropType(fieldCrop, true);\n const secondCrop = this.getCropService.getCropType(fieldCrop, false);\n const needValue = fnvs.find((v) => v.FieldId === field.Id);\n const baseFertPlanBooks = baseFertSummaries.map(x => x.BasicFertilisationPlanBooks).flat();\n const alreadyApplied = this.nFertilizationService.calculateAlreadyAppliedFromContentNPlanBooks(field, planBooks, logFiles, baseFertPlanBooks);\n const nBalance = this._getNBalanceDifference(alreadyApplied, fieldCrop, mainCrop, secondCrop);\n const removal = this._getNBalance(fieldCrop, mainCrop, secondCrop);\n const remaining = this.nFertilizationService.calculateRemainingValue(alreadyApplied, needValue?.Value);\n return {\n Id: field.Id,\n FnvId: needValue?.Id,\n Status: 1,\n StatusClass: 'ap-status-green',\n StatusDesc: 'Global__Active',\n MainCropType: mainCrop?.Description ?? '',\n Nr: field.FieldNumber,\n SNr: field.FieldSubnumber,\n NrSNr: this.fieldStore.getFieldNumberAndSubNumber(field),\n Name: field.FieldName,\n Area: fieldGeom?.AreaHa ?? 0,\n Removal: removal ? removal * -1 : 0,\n MainCropExpectedYield: fieldCrop?.ExpectedYield,\n AlreadyApplied: alreadyApplied ?? 0,\n Balance: nBalance ?? 0,\n MaxAllowance: needValue?.Value ?? 0,\n Remaining: remaining ?? 0\n } as INFertilizerNNeedGridItem;\n });\n })\n );\n }\n\n private _getColumns(): ApDynGridColumnConfigBase[] {\n return [\n new ApDynGridStatusColumnConfig({\n field: 'Status',\n class: 'StatusClass',\n description: 'StatusDesc'\n }),\n new ApDynGridPropertyColumnConfig({\n field: 'Nr',\n title: 'Global__NumberAbbr',\n width: 60,\n filterable: true,\n headerFilterable: true,\n hide: true,\n filterType: FilterType.NUMBER,\n cssClass: 'right'\n }),\n new ApDynGridPropertyColumnConfig({\n field: 'SNr',\n title: 'Global__FieldPartShort',\n width: 60,\n filterable: true,\n headerFilterable: true,\n hide: true,\n filterType: FilterType.NUMBER,\n cssClass: 'right'\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__NumberAbbr',\n field: 'NrSNr',\n filterable: true,\n headerFilterable: true,\n hide: new ApDynGridColumnHideConfig({\n mapHide: false,\n selfHide: this.mapViewStore.Listen(s => s.mode).pipe(map((m) => m !== MapViewMode.NORMAL)),\n }),\n width: 75\n }),\n new ApDynGridPropertyColumnConfig({\n field: 'Name',\n title: 'Global__Name',\n cssClass: 'left',\n width: 180,\n filterable: true,\n headerFilterable: true,\n sortIndex: 1\n }),\n new ApDynGridPropertyColumnConfig({\n field: 'Area',\n title: 'Global_ha_Unit',\n width: 60,\n cssClass: 'right',\n filterType: FilterType.NUMBER,\n filterable: true,\n headerFilterable: true,\n template: PropertyTemplate.NUMBER,\n tooltip: dataItem => dataItem.Area,\n pipes: [{\n pipe: this.roundNumericPipe,\n args: [this.settingsStore.FirstSetting.DigitsAfterDecimalPoint, {ToReplace: [0], ReplaceWith: ''}]\n }]\n }),\n new ApDynGridPropertyColumnConfig({\n field: 'MainCropType',\n title: 'Global__Crop',\n width: 100,\n filterable: true,\n headerFilterable: true\n }),\n new ApDynGridPropertyColumnConfig({\n field: 'MainCropExpectedYield',\n title: 'Nutrients_Pages_Popups__YieldUnit',\n width: 60,\n cssClass: 'right',\n filterType: FilterType.NUMBER,\n template: PropertyTemplate.NUMBER,\n filterable: true,\n hide: true,\n tooltip: dataItem => dataItem.MainCropExpectedYield,\n pipes: [{\n pipe: this.roundNumericPipe,\n args: [0, {ToReplace: [0], ReplaceWith: ''}]\n }]\n }),\n new ApDynGridGroupColumnConfig({\n title: 'Nutrients__kg_N_per_ha',\n groupColumns: [\n new ApDynGridPropertyColumnConfig({\n field: 'Removal',\n title: 'Settings__Label_Detraction',\n width: 60,\n cssClass: 'right',\n filterType: FilterType.NUMBER,\n template: PropertyTemplate.NUMBER,\n filterable: true,\n headerFilterable: true,\n tooltip: dataItem => dataItem.Removal,\n pipes: [{\n pipe: this.roundNumericPipe,\n args: [0]\n }]\n }),\n new ApDynGridPropertyColumnConfig({\n field: 'AlreadyApplied',\n title: 'Nutrients__already_applied',\n width: 60,\n cssClass: 'right',\n filterType: FilterType.NUMBER,\n template: PropertyTemplate.NUMBER,\n filterable: true,\n headerFilterable: true,\n tooltip: dataItem => dataItem.AlreadyApplied,\n pipes: [{\n pipe: this.roundNumericPipe,\n args: [0]\n }]\n }),\n new ApDynGridPropertyColumnConfig({\n field: 'Balance',\n title: 'Global__Balance',\n width: 60,\n cssClass: 'right',\n filterType: FilterType.NUMBER,\n template: PropertyTemplate.NUMBER,\n filterable: true,\n headerFilterable: true,\n tooltip: dataItem => dataItem.Balance,\n pipes: [{\n pipe: this.roundNumericPipe,\n args: [0]\n }]\n }),\n new ApDynGridPropertyColumnConfig({\n field: 'MaxAllowance',\n title: 'Nutrients__Need_FNV',\n width: 60,\n cssClass: 'right',\n filterType: FilterType.NUMBER,\n filterable: true,\n headerFilterable: true,\n hide: true,\n pipes: [{\n pipe: this.roundNumericPipe,\n args: [this.settingsStore.FirstSetting.DigitsAfterDecimalPoint, {ToReplace: [0], ReplaceWith: ''}]\n }]\n }),\n new ApDynGridPropertyColumnConfig({\n field: 'Remaining',\n title: 'Nutrients__Remaining',\n width: 60,\n cssClass: 'right',\n filterType: FilterType.NUMBER,\n filterable: true,\n headerFilterable: true,\n hide: true,\n pipes: [{\n pipe: this.roundNumericPipe,\n args: [this.settingsStore.FirstSetting.DigitsAfterDecimalPoint, {ToReplace: [0], ReplaceWith: ''}]\n }]\n })\n ]\n })\n ];\n }\n\n private _getPager(): ApDynGridPagerConfig {\n return new ApDynGridPagerConfig({\n listMassEditing: [\n {\n id: 0,\n name: 'Nutrients__Set_FNV',\n type: ApGridPagerType.Numeric,\n onSubmit: ApUtilService.createEventEmitter(this._setFertilizationNeedValue.bind(this), this._subscriptions),\n placeholder: 'Nutrients__kg_N_per_ha'\n }\n ],\n iconButtons: [\n {\n icon: Icon.PDF,\n callback: ApUtilService.createEventEmitter(this._exportAsPdf.bind(this), this._subscriptions),\n tooltip: 'Global__Save_PDF'\n },\n {\n icon: Icon.XLS,\n callback: ApUtilService.createEventEmitter(this._exportAsXls.bind(this), this._subscriptions),\n tooltip: 'Global__Save_EXCEL'\n },\n ]\n });\n }\n\n private _exportAsPdf(): void {\n this.exportFileName = this._getExportFilename();\n this.dynComponent.dynGrid.exportAsPdf();\n }\n\n private _exportAsXls(): void {\n const contentRows: IContentRow[] = [];\n const rows = this.dynComponent.getSelectedItems();\n rows.forEach(row => {\n const a = row as INFertilizerNNeedGridItem;\n if (a) {\n contentRows.push({\n Number: a.Nr.toString(),\n SubNumber: a.SNr.toString(),\n Name: a.Name,\n Area: this.roundNumericService.round(a.Area),\n MainCropType: a.MainCropType,\n MainCropExpectedYield: this.roundNumericPipe.transform(a.MainCropExpectedYield?.toString(), 0, {\n ToReplace: [0],\n ReplaceWith: ''\n }),\n Removal: this.roundNumericService.round(a.Removal, 0),\n AlreadyApplied: this.roundNumericService.round(a.AlreadyApplied, 0),\n Balance: this.roundNumericService.round(a.Balance, 0),\n MaxAllowance: this.roundNumericPipe.transform(a.MaxAllowance.toString(), 0, {\n ToReplace: [0],\n ReplaceWith: ''\n }),\n Remaining: this.roundNumericPipe.transform(a.Remaining.toString(), 0, {ToReplace: [0], ReplaceWith: ''})\n });\n }\n });\n\n const columns = this._getReportColumnNames();\n const reportData: IReportData = {\n Content: {\n HeaderLabels: [\n columns.get('Number'),\n columns.get('SubNumber'),\n columns.get('Name'),\n columns.get('Area'),\n columns.get('MainCropType'),\n columns.get('MainCropExpectedYield'),\n columns.get('Removal'),\n columns.get('AlreadyApplied'),\n columns.get('Balance'),\n columns.get('MaxAllowance'),\n columns.get('Remaining'),\n ],\n Rows: contentRows,\n },\n Header: {\n Number: columns.get('Number'),\n SubNumber: columns.get('SubNumber'),\n Name: columns.get('Name'),\n Area: columns.get('Area'),\n MainCropType: columns.get('MainCropType'),\n MainCropExpectedYield: columns.get('MainCropExpectedYield'),\n Removal: columns.get('Removal'),\n AlreadyApplied: columns.get('AlreadyApplied'),\n Balance: columns.get('Balance'),\n MaxAllowance: columns.get('MaxAllowance'),\n Remaining: columns.get('Remaining')\n }\n };\n const bookName = this._getExportFilename();\n this.nFertilizationStore.downloadNRestrictionReport(bookName, `${bookName}.xlsx`, reportData);\n }\n\n private _getExportFilename(): string {\n const nBalanceTitle = this.translationService.translate('Global__N_Need').replace(' ', '_');\n const customerExpr = `${this.loginStore.SelectedFarm?.Country?.Id}${this.loginStore.SelectedFarm?.CustomerNumber}`;\n const dateExpr = this.dateService.toFarmDate(new Date()).format('YYMMDD');\n return `${dateExpr}_${nBalanceTitle}_${customerExpr}`;\n }\n\n private _selectionChange(items: INFertilizerNNeedGridItem[]): void {\n this.fieldStore.changeSelectedField(items.filter(x => x.Id).map(x => x.Id as string));\n this._statisticUpdateRequested.emit();\n }\n\n private _onMapMenuChanged(mapMenu: MapViewCurrentMenu): void {\n if (mapMenu === MapViewCurrentMenu.STATS) {\n this._statisticUpdateRequested.emit();\n }\n }\n\n private _generateStats(): void {\n if (this.mapViewStore.getMapViewCurrentMenu() !== MapViewCurrentMenu.STATS) {\n return;\n }\n // put it on top of callstack to avoid lagging when user changes the selection\n setTimeout(() => {\n const emptyTitle = `${this.translationService.translate('Nutrients__StatisticsTitle')}\n ${this.translationService.translate('Global__N_Need')}`;\n let items = this.dynComponent.getSelectedItems() as INFertilizerNNeedGridItem[];\n if (!items.Any()) {\n items = this.dynComponent.items as INFertilizerNNeedGridItem[];\n }\n if (!items?.Any()) {\n this.statisticStore.setStatisticData([], ApStatsType.NFertilizationNNeedStats, '', emptyTitle);\n return;\n }\n const title = this._getTitleForStatistic(items);\n this.statisticStore.setStatisticData(items, ApStatsType.NFertilizationNNeedStats, title, emptyTitle);\n }, 0);\n }\n\n private _getTitleForStatistic(selectedItems: INFertilizerNNeedGridItem[]): string {\n const totalItems = this.dynComponent.items as INFertilizerNNeedGridItem[];\n const dataForTitles = totalItems.map(x => ({\n AreaHa: x.Area,\n Selected: selectedItems.some(z => z.Id === x.Id)\n }));\n return this.statisticService.generateFieldsAreaTitle(dataForTitles);\n }\n\n private _handleDownloadReportStatus(downloadResult: boolean | undefined): void {\n if (downloadResult === undefined) {\n return;\n }\n const notification = {\n DisplayTimeout: 5,\n Level: ApValidationLevel.Success,\n ErrorKey: 'Global__Report_DownloadSuccess'\n } as IApValidationResult;\n if (!downloadResult) {\n notification.Level = ApValidationLevel.Error;\n notification.ErrorKey = 'Global__Report_DownloadFail';\n }\n this.notifyStore.addMessage(notification);\n }\n\n private _getReportColumnNames(): Map {\n const columnNames = new Map();\n columnNames.set('Number', this.translationService.translate('Global__NumberAbbr'));\n columnNames.set('SubNumber', this.translationService.translate('Global__FieldPartShort'));\n columnNames.set('Name', this.translationService.translate('Global__Name'));\n columnNames.set('Area', this.translationService.translate('Global_ha_Unit'));\n columnNames.set('MainCropType', this.translationService.translate('Global__Crop'));\n columnNames.set('MainCropExpectedYield', this.translationService.translate('Nutrients_Pages_Popups__YieldUnit'));\n columnNames.set('Removal', this.translationService.translate('Settings__Label_Detraction'));\n columnNames.set('AlreadyApplied', this.translationService.translate('Nutrients__already_applied'));\n columnNames.set('Balance', this.translationService.translate('Global__Balance'));\n columnNames.set('MaxAllowance', this.translationService.translate('Nutrients__Need_FNV'));\n columnNames.set('Remaining', this.translationService.translate('Nutrients__Remaining'));\n return columnNames;\n }\n\n private _getNBalanceDifference(alreadyApplied: number | null, fieldCrop: IFieldCrop | null, mainCrop: ICropTypes | null, secondCrop: ICropTypes | null): number | null {\n const nBalance = this._getNBalance(fieldCrop, mainCrop, secondCrop);\n if (nBalance == null) {\n return null;\n }\n if (alreadyApplied === null) {\n alreadyApplied = 0;\n }\n alreadyApplied -= nBalance;\n return alreadyApplied;\n }\n\n private _getNBalance(fieldCrop: IFieldCrop | null, mainCrop: ICropTypes | null, secondCrop: ICropTypes | null): number | null {\n if (!fieldCrop || !mainCrop || fieldCrop.ExpectedYield <= 0) {\n return null;\n }\n let result = mainCrop.MainwdN * fieldCrop.ExpectedYield;\n if (secondCrop && fieldCrop.ExpectedYieldSecond) {\n result += secondCrop.MainwdN * fieldCrop.ExpectedYieldSecond;\n }\n if (fieldCrop.StrawHarvested && fieldCrop.ExpectedYield) {\n result += mainCrop.SecwdN * mainCrop.ExpectedYield * mainCrop.MsRatio;\n }\n return result;\n }\n\n private _setFertilizationNeedValue(data: IGridPagerCallBackData): void {\n this.nFertilizationStore.setFertilizationNeedValue(data.items.map(item => ({\n Id: item['FnvId'],\n FieldId: item.Id,\n CampaignYear: this.campaignYearStore.getSelectedCampaignYear().Year,\n Value: this.roundNumericService.roundAsNumber(data.value, 0)\n })));\n }\n}\n","import {FormsModule, ReactiveFormsModule} from '@angular/forms';\nimport {ApCoreModule} from '../ap-core/ap-core.module';\nimport {ApIconModule} from '../icons/ap-icon.module';\nimport {LayoutModule} from '@progress/kendo-angular-layout';\nimport {\n ButtonModule,\n SplitButtonModule\n} from '@progress/kendo-angular-buttons';\nimport {CommonModule} from '@angular/common';\nimport {InputsModule} from '@progress/kendo-angular-inputs';\nimport {\n ComboBoxModule,\n DropDownsModule\n} from '@progress/kendo-angular-dropdowns';\nimport {NgModule} from '@angular/core';\nimport {DateInputsModule} from '@progress/kendo-angular-dateinputs';\nimport {ApTranslationModule} from '../translation/ap-translation.module';\nimport {ApNFertilizationRoutes} from './ap-n-fertilization.routes';\nimport {\n BodyModule,\n ExcelModule,\n GridModule,\n GroupModule,\n HeaderModule,\n PagerModule,\n PDFModule,\n SharedModule\n} from '@progress/kendo-angular-grid';\nimport {PDFExportModule} from '@progress/kendo-angular-pdf-export';\nimport {ApNFertilizationOverviewComponent} from './components/ap-n-fertilization-overview.component';\nimport {ApUtilsModule} from '../ap-utils';\nimport {ApTooltipModule} from '../ap-tooltip/ap-tooltip.module';\nimport {ApResponsiveTextModule} from '../ap-responsive-text/ap-responsive-text.module';\nimport {ApSectionHeaderModule} from '../ap-section-header/ap-section-header.module';\nimport {ApNFertilizationLogfilesComponent} from './components/ap-n-fertilization-logfiles.component';\nimport {ApNFertilizationNNeedComponent} from './components/ap-n-fertilization-n-need.component';\nimport {ApNFertilizationPlanningComponent} from './components/ap-n-fertilization-planning.component';\nimport {ApNFertilizationBookingComponent} from './components/ap-n-fertilization-booking.component';\nimport {ApDynComponentModule} from '../ap-dyncomponent/ap-dyncomponent.module';\nimport {ApFieldManagementModule} from '../field-management/ap-field-management.module';\n\n\n@NgModule({\n declarations: [\n ApNFertilizationOverviewComponent,\n ApNFertilizationLogfilesComponent,\n ApNFertilizationNNeedComponent,\n ApNFertilizationPlanningComponent,\n ApNFertilizationBookingComponent,\n ],\n exports: [\n ApNFertilizationOverviewComponent,\n ],\n imports: [\n ReactiveFormsModule,\n ApCoreModule,\n ApIconModule,\n LayoutModule,\n ButtonModule,\n CommonModule,\n SplitButtonModule,\n InputsModule,\n ComboBoxModule,\n DateInputsModule,\n DropDownsModule,\n FormsModule,\n GridModule,\n ExcelModule,\n PDFModule,\n PDFExportModule,\n ApTranslationModule,\n ApNFertilizationRoutes,\n ApUtilsModule,\n BodyModule,\n ApTooltipModule,\n PagerModule,\n ApResponsiveTextModule,\n SharedModule,\n HeaderModule,\n GroupModule,\n ApSectionHeaderModule,\n ApDynComponentModule,\n ApFieldManagementModule\n ],\n providers: [],\n})\nexport class ApNFertilizationModule {\n}\n"],"sourceRoot":"webpack:///","file":"602.d1024b3d198c8a19.js"}