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KyzC,mBACtBjV,GACFx+B,KAAKgyC,UAAUxT,GAIXiV,mBACN,MAAMvjC,EAAgBlQ,KAAKqM,aAAa0Q,mBACxC,OAAK7M,GAAiBA,EAAc/B,QAAU,EACrC,KAEF+B,EAAc,GAGfmjC,SAASlpC,IACVA,EAASqqB,WAAarqB,EAASqqB,UAAUrmB,QAAU,GAGxDnO,KAAK+L,UAAUgE,SAAS,CACtBC,UAAWu9B,GACXpsC,KAAM,CACJwrC,SAAUxiC,EAASqqB,UACnBqY,UAAU,KAKRkF,QAAQ5nC,IACTA,EAASqqB,WAAarqB,EAASqqB,UAAUrmB,QAAU,GAGxDnO,KAAK+L,UAAUgE,SAAS,CACtBC,UAAW4iC,GACXzxC,KAAM,CACJwrC,SAAUxiC,EAASqqB,aAKjBwd,UAAU7nC,GAChBupC,QAAQzkC,IAAI9E,GACZupC,QAAQC,KAAK,yEA7HJC,GAAkB9rC,kFAAlB8rC,EAAkBpmC,8EAClBC,IAAuB,sNAdhC3F,oDAAiBA,mCAA6B,4BAA7BA,CAA6B,sBAA7BA,CAA6B,mCAA7BA,CAA6B,gBAA7BA,CAA6B,oBAA7BA,CAA6B,0BAA7BA,CAA6B,eAA7BA,CAA6B,iEAarC8rC,GAAb,GDFIb,YAAa,CAACC,MACd7xC,KAAM,CACJ8xC,OAAO,EACPC,OAAQC,mBAWP,IAAMU,GAAb,MAAM,sDAAOA,4DALF,CACPC,eAAsBjB,KAEdiB,SAECD,GAAb,mBE/BO,IAAME,GAAb,MAAM,sDAAOA,6DAFA,GAAEC,SALJ,CACPC,KACAJ,GACAK,SAISH,GAAb","names":["PpLogfileEditWizardUiProvider","constructor","cropTypeStore","driverStore","instrumentStore","machineStore","planBookStore","productStore","roundNumericPipe","unitService","translationPipe","this","EventEmitter","getProductList","ApDynGridPropertyColumnConfig","field","nameOf","String","width","cssClass","pipes","pipe","args","ApDynGridButtonColumnConfig","tooltip","callback","deleteProduct","isStandardIcon","standardIcon","getLogfileFieldset","data","ApDynformsConfigFieldset","key","legend","config","ApDynformsConfigNumerictextbox","label","value","Ec","disabled","WorkingWidth","min","ApDynformsConfigDatepicker","Date","t","DataSet","_a","Created","getProductsFieldset","values$","plannings","selectedPlannings$","templateRef","product$","delay","map","v","Listen","s","find","p","Id","Product","distinctUntilChanged","previous","current","ApDynformsConfigPlaceholder","ApDynformsConfigComboBox","options","valueField","textField","a","l","PlantProtectionPlanBook","_b","ApDynformsConfigTextarea","_getLogfileProducts","join","rows","ApDynformsConfigTemplate","combineLatest","products","values","filter","product","Selectable","ProductDetails","details","EcMin","EcMax","EppoCrop","GetEppoCode","CropType","f","ProductItem","_setDefaultLable","label$","_setLableByProduct","value$","h","d","getDefaultCroptype","Eppocode","AmountMax","step","_getProduct","max","undefined","merge","AvgProduct","ApDynformsConfigButton","addProduct","disabledButton$","of","getDocuFieldset","plan$","Plan","valuePrimitive","i","ExportDriver","skip","n","ExportMachine","r","_c","ExportInstrument","json","JSON","parse","HeaderValuesString","Agents","agent","Name","AStd","Unit","productDetails","getUnitWithLabelKey","i0","factory","PpLogfileEditWizardProvider","commonService","plantProtectionStore","translationService","translationStore","uiProvider","unitStore","BehaviorSubject","productColumns","onInit","_buildFieldSets","_setProducts","_subscriptions","push","subscribe","_addProduct","_deleteProduct","onDestroy","forEach","unsubscribe","fieldSets","dynForm","formValues$","_getPlannings","productList$","headerValues","planBooks","resultList","DisplayName","FindTranslationForSelectedLanguage","planBook","FieldGeomId","LogfileOperationMode","OperationMode","getPlanningDescription","dataItem","form","getRawValue","productItem","getProducts","unit","_getUnit","next","ApplRate","ButtonIconName","get","setValue","e","Key","setTimeout","valueChanges","planning","_setProduct","ExternalProductId","item","replace","getUnit","ProductList","getUnitWithUnit","ProductRate","PpLogfileEditComponent","provider","planProtectionStore","formStore","ngOnInit","ObjectFactory","updateComponent","getValue","SourceItem","dynComponent","plantProtectionProductListTemplate","ngOnDestroy","close","closeForm","save","logEdit","DatasetFieldMapId","PlanId","Products","ProductId","Rate","DriverId","Driver","MachineId","Machine","InstrumentId","Instrument","setPlanningToLogfile","selectors","ApDynComponentComponent","ctx","PpLogfileService","store","fieldStore","mapStore","showPointsOnMapService","logfiles","saving","logBookingReady","length","logIsRejected","Status","logBooked","BookedBy","onAccept","Array","isArray","_hidePoints","bookPlanBooks","logFile","onReset","unBookPlanBooks","_getLogfiles","log","onReject","logFiles","areLogfilesValid","getLogfilesByPlanBookId","every","updateLogfiles","onRemap","remapLogfile","logFileValid","getFieldByFieldGeomId","EcStage","ApplicationMode","onEdit","openForm","component","toggleLogPointsOnMap","selectedItems","farmId","selectedMin","Number","MAX_SAFE_INTEGER","selectedMax","showLegend","NUptakeMin","NUptakeMax","_d","isFinite","Legends","LogLegend","updateValues","refreshLegend","showPoints","DatasetId","getPlanning","pb","DeletedBy","Any","Math","abs","ApplicationDate","valueOf","AgriportConstantsService","sort","FindAll","pl","Find","FirstOrDefault","onClearSelection","emit","items","ids","some","id","toString","PpLogfilesGridConfig","languageStore","service","settingStore","getGridColumns","subscriptions","ApDynGridStatusColumnConfig","class","description","groupDesc","ApDynGridStatusSwitchColumnConfig","readonly","filterable","defaultFilter","disableGreen","Planning","stateChange","ApUtilService","event","state","title","dynCssClass","headerFilterable","filterType","FilterType","FirstSetting","DigitsAfterDecimalPoint","ApDynGridGroupColumnConfig","groupColumns","hide","format","SelectedLanguage","DateFormat","sortIndex","sortDesc","multiline","headerExtraLines","transform","Water","template","PropertyTemplate","ApDynGridEditColumnConfig","text","bind","LogStatus","PpLogfilesComponent","cropStore","loginStore","gridConfig","campaignYearStore","columns","pager","ApDynGridPagerConfig","ngAfterViewInit","_getDataFromStore","SelectedItems$","FieldId","indexOf","changeSelectedField","MapFactoryStyler","SelectedFarmId","dynGrid","gridPaging","setSelectedKeys","loading$","logfilesLoading","logfile","fieldGeom","getFieldGeomById","y","status","_getLogStatus","productList","g","StatusClass","StatusDesc","FieldName","getFieldNameById","Crop","GetCropTypeName","FieldArea","AreaHa","FileName","DataSetName","NContentAvg","Note","Summary","Title","getDriverById","items$","selectedYear","_loadDataFromStore","loadLogfiles","loadPlanBooks","loadPlantProtectionProducts","PpNoDataValue","PpColumnSwitchValue","PpOverviewMassEditAction","PpPlanningWizardSelectionService","statisticStore","statisticService","getEppoCodeFromSelectedFields","eppoCodes","x","EppoCode","generateFieldStatistic","totalItems","setStatisticData","ApStatsType","nStatItems","Area","FieldNumber","Nr","FieldSubNumber","TNr","ScanDate","ScanData","ScanNUptakeAvg","NUptakeAvg","ScanNUptakeMin","_e","ScanNUptakeMax","_f","getTitleForStatistic","allItems","dataForTitles","Selected","z","generateFieldsAreaTitle","PpPlanningWizardSelectionProvider","ndiStore","sensorStore","notifyStore","settingsStore","cropRotationStore","plantProtectionPlanBookStore","scanService","cropService","ppPlanningWizardSelectionService","selectionGridColumnsUiProvider","init","caption$","fieldSets$","errorKeys","handleStateChange","isContinueActive","_caption$","_fieldSets$","_errorKeys","_handleStateChange","_isContinueActive","_dynComponent","updateCaption","onGridSelectionChanged","eppoCode","isValidSelection","ApColumnState","isValidCropsSelection","addMessage","Level","Counter","ErrorKey","UserId","UserName","DisplayTimeout","Parameters","onGenerateStatistic","getSelectedItems","buildDataItems","history","cropTypesNames","NdiStatistics$","fields","cropRotation","Object","keys","year","cropTypes","sensorFieldData","_","_1","geom","getCurrentFieldGeom","fieldCrop","sensorData","sfd","M","crop","cropId","defaultCropEppoCode","Year","MainCrop","bestScanData","getBestScanData","getDefaultBestScanStatus","getStatus","FieldSubnumber","NrTNr","getFieldNumberAndSubNumber","CropId","SecondCropId","getCrop","Geom","PlanBookId","ApGuidUtil","tap","gridItems","getGridColumnConfig","_detailsData","selectedLanguage","language","settings","setting","generateGridColumns","getPagerConfig","breadCrumbsColumns","ApDynGridPagerWizardConfig","ApDynGridPagerWizardButton","PpWizardStates","ApDynGridPagerWizardBreadcrumbsStepper","active","onLeave","selectedKeys","k","updateFieldSets","mainCropId","cropType","result","IsSensorCrop","CropKey","CroptypeId","ApDynGridColumnConfigBase","super","ApDynGridColumnControlType","iconClass","icon","getTooltip","ApIconType","PpPlanningWizardDetailsProvider","dateService","workTypesStore","cropTypesStore","plantProtectionProductStore","roundNumericService","agriportConstantsService","applicationSettingsService","nFertilizationPlantProtectionService","detailsCommonUiProvider","detailsUniformUiProvider","detailsTargetRateUiProvider","detailsTargetRateMapPerFieldUiProvider","detailsTargetRateMapPerPlanUiProvider","productsTemplateRef","productListItems$","_responsiveData","PreselectedProductDetail$","AddProductButtonDisabled$","PreselectValidProducts$","PreselectedMaxProductRate$","PreselectedMinProductRate$","ProductListItems$","MaxWaterRange$","PpConstants","MinWaterAvg$","_operationModeAppSettings","_addProductCallback","_dynForm","_productsTemplateRef","_selectedGridData","onFormValueChanges","valueChangesArgs","_uiResponsiveProperties","Exists","control","_dataResponsiveProperties","updateDetailsData","_hideMinMaxColumns$","FormData","OperationModeKey","OperationModesEnum","NUptakeAverage","calculateNUptakeAreaWightedAverage","WaterAvg","WaterRange","updateWaterMinMaxValues","PreProductId","PreAvgAmount","PreMaxAmount","PreMinAmount","WorkType","WorkTypes","onApplicationSettingsTextWarning","OperationModeAppSetting","ApplicationSetting","ECStage","getMaxGrowthStageFromFields","updateValidProducts","patchForm","_g","_h","_j","_k","_l","b","getMachineById","_m","DefaultDriver","_o","P","_p","_q","F","S","_r","DefaultInstrument","_s","A","_t","_u","C","_v","L","_w","_x","$","_y","ce","J","_z","_0","calculateProductMinRate","he","pe","_2","calculateProductMaxRate","me","ve","_3","_4","He","_5","Ke","_6","je","_7","qe","_8","Je","_9","et","Qe","Xe","_10","_11","_12","formData","WaterMin","WaterMax","triggerValidation","patchValue","emitEvent","markAsTouched","buildItem","getOperationModeAppSettings","_validWorkTypes","getValidWorkTypes","endOfCampaignYear","toJsDate","toFarmDateFromUtc","getSelectedCampaignYear","DefaultEnd","cropName","_eppoCodes","EppoGroups","AddRange","totalArea","round","reduce","sum","Create","selectedOperationSetting","getOperationModeAppSettingsOrDefault","nUptakeAverage","TotalArea","CountFields","ControlFactor","getControlFactor","Threshold","WaterSetZeroAtMin","getProductListColumns","style","fontWeight","generateProductNameTooltip","fontSize","ApDynGridColumnHideConfig","selfHide","ApDynGridIconColumnConfig","GrowthStageDefined","selectableProducts","getSelectableProducts","validProducts","ppProduct","validDetails","Contains","ProductListItem","validProduct","findMaxProductDetail","SortBy","ListSortOrder","DeletedAt","UseByDate","getDateMidnight","selectedProducts","productToAdd","avgAmount","maxAmount","minWater","maxWater","avgWater","productDetail","productToAddGridItem","ProductListDetails","EffectiveRange","EppoHarmfulOrganism","FarmId","ProductName","generateProductName","Min","Max","UnitExpr","translate","maxDetail","preselectedProductDetails","roundAsNumber","minProductOfProductMax","GetConstant","AgriportConstantsEnum","selectedWorkTypeIdsByProduct","flat","w","Category","WorkTypeCategory","productName","generatedFieldSets","createGeneralFieldset","createUniformFieldset","createTargetRateFieldset","createTargetRateMapPerFieldFieldset","createTargetRateMapPerPlanFieldset","createProductsFieldset","Add","createDocuFieldSet","_items","_breadCrumbsColumns","applicationSettings","Parameter","slopeType","slope","Slope","defaultSlope","SlopeLevel","operationModeAppSettings","ApplicationModesEnum","Text","TrueForAll","ppTargetApplicationSettings","getApplicationSettings","fieldsWithValidScanData","getFieldsWithValidScanData","ppTargetMapPerFieldApplicationSettings","ppTargetMapPerAvgMapApplicationSettings","operationModeEnum","existingOperationModeAppSetting","scanData","scansByApplicationSettings","getValidBestScansByApplicationSettings","growthStages","getGrowStages","selectedFieldsAreaAndAverage","Average","calculateAreaWeightedAverage","Ingredients","parsedIngredients","fieldsTooltip","ingredient","index","PpPlanningBookingDataService","routerStore","cropApplicationStore","plantProtectionPlanBooksStore","nutrientService","ppCommonService","showPointsOnMap","tooltipContentService","isBooking","_isBooked","sensor","summaries","_getSummaryWithPlanBooks","FilteredPlanBooks","summaryWithPlanBooks","summary","filteredPlanBooks","totalPlanBooks","TotalPlanBooks","area","nUptakesByArea","getSensorFieldData","_getCropTypeId","appliedProducts","getDistinctProductsOfPlanBooks","isWorkTypeSpraying","planBookApplicationDates","getApplicationDatesData","getFertilizerStatus","getFertilizerStatusDescription","FieldIds","Appl","getApplNumName","getApplNumFromSummary","ApplSum","getTotalWaterAmountBasedOnOperationMode","ApplUnit","Count","_getValidPlansCountPerTotalPlansCount","OperationModeKeyTrans","ProductNames","getAppliedProductsExpr","ProductNamesTooltip","ProductsSum","getAppliedProductSumExpr","areaHa","withoutProdName","ProductsSumTooltip","isTooltip","Avg","UserApplicationRate","UserApplicationMinimum","UserApplicationMaximum","NewestDate","ApplicationDateTooltip","Tooltip","ApplicationDateItalic","IsMoreThanOneUniqDate","PlanBooks","PlanNumber","FieldsTooltip","getFieldsCropsTooltip","getLoading$","loading","subscribeLoad","loadSensorFieldData","subscribeSelection","Layers","PpApplicationMapLayer","clear","fieldIds","pB","isValidBooking","isValidPlanning","showPlanBooksInMap","showRaster","showAllRaster","planBooksIds","statistic","Reduce","target","ele","ApplicationMax","ApplicationMin","onPPApplicationChanged","PPApplicationLayerSourceInit","url","destroy","summariesMap","summaryMap","BookedAt","nonDeletedPlanBooks","MainCropId","acc","el","PpPlanningWizardStatisticService","generateOverviewStats","selectionData","productListGridItems","statData","calculateStatData","generateStatOverviewTable","DetailsData","generateStatOverviewChart","statTitle","statOverviewItems","NUptakeAreaWeightedAvg","ProductAreaWeightedAvg","buildProductExpr","useBaseUnit","ProductSum","chartConfigs","chartConfig","GenericChartConfig","pannable","zoomable","transitions","paddingLeftRight","xAxisConfig","noteField","tooltipDelegate","createTooltipText","yAxisConfig","GenericYAxisConfig","type","yAxisConfigs","seriesConfig","GenericSeriesConfig","lineWidth","markerVisible","generateSeriesData","seriesConfigs","addStatisticData","hasMaxBreak","hasMinBreak","previousWaterAmount","nUptake","NUptakeStepSize","seriesData","GenericSeriesData","xValue","yValue","note","defaultItem","productsAvg","productsSum","itemsWaterAreaAndAverage","SelectionData","PlanBook","ApplicationRate","waterAreaWeighted","productListGridItem","productListItem","itemsProductAreaAndAverage","productItemWithRateForField","productWithSum","productWithAreaWeightedAvg","SlopeForJob","nUptakeLabel","water","PpPlanningWizardOverviewProvider","mapViewStore","operationModesStore","applicationModesStore","unitsStore","ppDataService","plantProtectionService","ppPlanningWizardStatisticService","overviewGridColumnsUiProvider","_items$","detailsData","_productListData","defaultGridItems","generateDefaultGridItems","isOperationModeAnyOfMaps","createPPPlanningJob","asObservable","fieldPPPlanningStatistic","ppStatistics","gridItem","columnLoading","errorMessage","ErrorText","Mean","selectedProduct","SelectedProducts","ProductsTooltip","ColumnLoading","ErrorMessage","HasError","mapHide","mode","mapMode","MapViewMode","overviewColumns","getCommonColumns","getUniformSprayingColumns","getTargetRateColumns","getCommonEndColumns","selectedFieldIds","selectedPlanbooks","clearPPPlanningStatistic","getPlanBooks","getPlanBooksForSaving","selectionItem","getNUptakeAverageForJob","slopeForCalculations","getSlopeForCalculation","ApplicationModes","o","OperationModes","getStatusForItemOnOverviewStep","NameWithSign","getInstrumentById","ShortFullName","NUptakeAverageForJob","additionalValues","ZeroRate","selectedItem","applicationModeEnum","getApplicationModeFromOperationMode","applicationMode","getDateNoon","AdditionalValue","EcValue","u","UserApplicationConstant","operationModeForPlanEnum","getOperationModeForPlan","applicationModeForPlanEnum","getApplicationModeForPlan","operationModeForPlan","getIOperationModeByKey","applicationModeForPlan","AdditionalValues","ApplicationConst","CampaignYear","Element","ApElementType","Factor","PlannedArea","TEnd","ApTimeSpanUtil","TStart","RasterId","RasterStatistics","JobInput","Statistic","ValidFrom","ValidTo","CreatedAt","UpdatedAt","UpdatedBy","ExportedAt","ExportedBy","ExportFormat","ExportTarget","CreatedBy","ChangedAt","ChangedBy","Version","clearMap","_createPPPlanningRasterJob","planId","bestScan","fieldGeomId","applicationModeId","minimum","maximum","threshold","appleRate","constant","deadBioMass","nFertPlanId","ScanType","BestScanType","ppPlanId","satelliteId","SatId","CreatePPPlanningRasterJob","NdPlanId","PpPlanId","AutumnScan","SatelliteScan","NUptake","Minimum","Maximum","Constant","DeadBioMass","AppleRate","Clear","removeLegend","NPlanningLegend","PpApplicationLegend","PpPlanningWizardComponent","wizardSelectionProvider","wizardDetailsProvider","wizardOverviewProvider","Observable","handleStateChangeAction","_stateModel","initDetails","initOverview","initSave","initSelection","initLeave","loaded","ngAfterContentInit","historyLoading","loadings","errorKeys$","formValueChanges","valuesChangesArgs","_activeWizardStep","pristine","dirty","touched","_statisticUpdateRequested","debounceTime","getMapViewCurrentMenu","MapViewCurrentMenu","getMapViewMode","_activeProvider","currentMenu","mapMenu","removeStatisticData","newState","overviewData","oldState","saveGridDescriptors","loadGridDescriptors","buildUi","selectedIds","getSelectedFieldIds","_oldState","productListColumns","_itemSubscription","savePlanBooks","wizardProvider","columns$","PpOverviewGridConfig","getMainGridColumns","m","stringify","generateCropNoteTooltip","CropNote","getDetailsGridColumns","onShowPerPlanView","onShowPerFieldView","ApDynGridDetailsGridConfig","checkboxDisabled","Applications","CurrentDateFormat","ToReplace","ReplaceWith","_detailsColumnSwitch$","c","xlsExport","headerButtons","nextClicked","switchColumn","previousClicked","nextDisabled","previousDisabled","breakHeaderLine","WorkArea","PpOverviewComponent","fieldService","ppOverviewGridConfig","loadingItems","isLoading","_buildItems","_buildPager","_buildGrid","gridSubject","FormClose$","grid","_onShowAll","zoomFarmFields","_applyClicked","_onApplyClicked","fieldCropsSaved","_invokeWhenFieldCropsUpdated","onCreate","detailsColumns","applications","_getApplications","mainCrop","parseMainCrop","getFieldCrop","FieldCrop","getOverviewItemStatus","SNr","NrSNr","getPpApplications","nUptakeValues","Band","waterValues","getDetailItemStatus","ApplNum","ApplDate","getGeomStatus","SelectedCampaignYear","apply","listMassEditing","FieldMassEditAction","ApGridPagerType","name","onSubmit","formConfig","decimals","validators","ApDynformsValidator","validator","Validators","errorKey","iconButtons","Icon","_onPdf","_onXls","object","selectedFieldCrops","copiedFieldCrops","EcValueToUpdate","saveFieldCrops","isUpdated","showSaveSuccessMessage","showSaveFailMessage","pdfExportFileName","_generatePrintFilename","exportAsPdf","xlsExportFileName","exportAsXls","toFarmDate","rasterData","relatedPlanBooks","fieldIdString","applicationMap","other","fieldId","PpPlanShowComponent","_getPager","_buildDataItems","fieldsToSelect","itemsToSelect","DataItem","gridData","IsBooked","Description","ControlFactorExpr","showPpPlanningColumns","_getCommonColumns","_getUniformSprayingColumns","_getTargetRateColumns","_getCommonEndColumns","_onClose","ApDynGridPagerWizardSection","PpPlanBookingComponent","modalDialogStore","componentCaption","_getGridLoading","_getGridColumns","_getGridPager","_setGridItems","dialog","show","buttons","primary","disable","ModalDialogButtonDisable","_getModalFieldSets","asyncValidators","resultSubscription","_updateOverviewItems","formValues","setModalDialogData","SelectedLanguage$","FirstSetting$","ProductAveragesTooltip","ProductSumTooltip","WaterSumTooltip","buttonTitle","_booking","showMassEdit","_getPagerFieldSets","getFieldById","driver","machine","instrument","waterSum","getWaterAmountBasedOnOperationMode","waterUnit","FieldNumberWithSubnumber","ProductAverages","WaterRate","getApplicationValue","WaterSum","toDate","Duration","getDateWithTimeFromMilliseconds","TotalMilliseconds","campaignYearStart","DefaultStart","campaignYearEnd","useMaxWidth","minDate","maxDate","ApDynformsConfigTimepicker","minSteps","secSteps","listenChanges","getFormValues","submitData","includes","updatedPlanBooks","_updateData","dataToSend","itemsToUpdate","row","copiedSourceItem","getUtc","PpPlanningBookingGridConfig","dropDownActions","headerStyle","getGridPager","option","PpPlanningComponent","dataService","modalDialogPresets","_onShow","_onExport","_onBook","_onDelete","pagerOptions","_onDeleteMany","navigate","then","DeleteDialog","resultDelegate","dialogResult","ModalDialogButtonKeys","deleteSummaries","PpPlanBookingShowComponent","routes","path","canActivate","ApPermissionGuard","login","layout","PageMode","roleTypeService","_onReset","_pagerOnShow","_pagerOnReset","_pagerOnExport","_getSelectedItem","console","warn","PpBookingComponent","PlantProtectionRoutes","RouterModule","PlantProtectionModule","imports","CommonModule","ApDynComponentModule"],"sources":["./src/app/entry-components/plant-protection-entry-components/logfile-edit-wizard/config/pp-logfile-edit-wizard.ui-provider.ts","./src/app/entry-components/plant-protection-entry-components/logfile-edit-wizard/config/pp-logfile-edit-wizard.provider.ts","./src/app/entry-components/plant-protection-entry-components/pp-logfile-edit.component.ts","./src/app/plant-protection/services/pp-logfile.service.ts","./src/app/plant-protection/configs/pp-logfiles-grid.config.ts","./src/app/plant-protection/components/pp-logfiles.component.ts","./src/app/plant-protection/types/pp-planning-booking.types.ts","./src/app/plant-protection/types/pp-overview.types.ts","./src/app/entry-components/plant-protection-entry-components/planning-wizard/services/pp-planning-wizard-selection.service.ts","./src/app/entry-components/plant-protection-entry-components/planning-wizard/configs/pp-planning-wizard-selection.provider.ts","./src/app/ap-dyngrids/config/ap-dyn-grid-icon-column-config.ts","./src/app/icons/ap-icon-type.ts","./src/app/entry-components/plant-protection-entry-components/planning-wizard/configs/pp-planning-wizard-details.provider.ts","./src/app/plant-protection/services/pp-planning-booking-data.service.ts","./src/app/entry-components/plant-protection-entry-components/planning-wizard/services/pp-planning-wizard-statistic.service.ts","./src/app/entry-components/plant-protection-entry-components/planning-wizard/configs/pp-planning-wizard-overview.provider.ts","./src/app/entry-components/plant-protection-entry-components/planning-wizard/pp-planning-wizard.component.ts","./src/app/plant-protection/configs/pp-overview-grid.config.ts","./src/app/plant-protection/components/pp-overview.component.ts","./src/app/entry-components/plant-protection-entry-components/pp-plan-show.component.ts","./src/app/entry-components/plant-protection-entry-components/pp-plan-booking.component.ts","./src/app/plant-protection/configs/pp-planning-booking-grid.config.ts","./src/app/plant-protection/components/pp-planning.component.ts","./src/app/entry-components/plant-protection-entry-components/pp-plan-booking-show.component.ts","./src/app/plant-protection/plant-protection.routes.ts","./src/app/plant-protection/components/pp-booking.component.ts","./src/app/plant-protection/plant-protection.module.ts"],"sourcesContent":["import {ApDynformsConfigFieldset} from '../../../../ap-dynforms/config/ap-dynforms-config-fieldset';\nimport {\n ApDynformsConfigNumerictextbox\n} from '../../../../ap-dynforms/config/ap-dynforms-config-numerictextbox';\nimport {\n ApDynformsConfigTextarea\n} from '../../../../ap-dynforms/config/ap-dynforms-config-textarea';\nimport {\n ApDynformsConfigDatepicker\n} from '../../../../ap-dynforms/config/ap-dynforms-config-datepicker';\nimport {\n ApDynformsConfigComboBox\n} from '../../../../ap-dynforms/config/ap-dynforms-config-combobox';\nimport {DriverStore} from '../../../../stores/docu/driver.store';\nimport {InstrumentStore} from '../../../../stores/docu/instrument.store';\nimport {MachineStore} from '../../../../stores/docu/machine.store';\nimport {EventEmitter, Injectable, TemplateRef} from '@angular/core';\nimport {nameOf} from '../../../../ap-core/utils/ap-name-of';\nimport {ILogFileEditWizard, IPpLogEditProductListGridItem} from '../pp-logfile-edit-wizard.types';\nimport {combineLatest, merge, Observable, of} from 'rxjs';\nimport {delay, distinctUntilChanged, map, skip} from 'rxjs/operators';\nimport {\n ApDynformsConfigPlaceholder\n} from '../../../../ap-dynforms/config/ap-dynforms-config-placeholder';\nimport {\n ApDynformsConfigButton\n} from '../../../../ap-dynforms/config/ap-dynforms-config-button';\nimport {\n ApDynGridPropertyColumnConfig\n} from '../../../../ap-dyngrids/config/ap-dyn-grid-property-column-config';\nimport {\n ApDynGridButtonColumnConfig\n} from '../../../../ap-dyngrids/config/ap-dyn-grid-button-column-config';\nimport {\n ApDynGridColumnConfigBase\n} from '../../../../ap-dyngrids/config/ap-dyn-grid-column-config-base';\nimport {GetRoundNumericPipe} from '../../../../ap-utils';\nimport {\n ApDynformsConfigTemplate\n} from '../../../../ap-dynforms/config/ap-dynforms-config-template';\nimport {\n PlantProtectionProductStore\n} from '../../../../stores/base-data/plantprotection.product.store';\nimport {IDisplayName} from '../../../../types/common-types';\nimport {\n PlantProtectionPlanBookStore\n} from '../../../../stores/plant-protection/plant-protection-planbook.store';\nimport {CropTypeStore} from '../../../../stores/base-data/crop.types.store';\nimport {ApTranslationPipe} from '../../../../translation/pipes/ap-translation.pipe';\nimport {UnitService} from '../../../../services/data/unit.service';\nimport IInstrument = Data.DocuContext.Instrument.IInstrument;\nimport IDatasetFieldMap = Data.Sensor.IDatasetFieldMap;\nimport IPlantProtectionSensorLogHeaderData = Data.Import.IPlantProtectionSensorLogHeaderData;\nimport IPlantProtectionPlanBook = Data.TaskManagement.IPlantProtectionPlanBook;\nimport IDriver = Data.DocuContext.Driver.IDriver;\nimport IMachine = Data.DocuContext.Machine.IMachine;\nimport IPlantProtectionProduct = Data.BaseData.IPlantProtectionProduct;\nimport IPlantProtectionProductDetails = Data.BaseData.IPlantProtectionProductDetails;\n\n@Injectable({providedIn: 'root'})\nexport class PpLogfileEditWizardUiProvider {\n public addProduct = new EventEmitter();\n public deleteProduct = new EventEmitter();\n\n constructor(\n private cropTypeStore: CropTypeStore,\n private driverStore: DriverStore,\n private instrumentStore: InstrumentStore,\n private machineStore: MachineStore,\n private planBookStore: PlantProtectionPlanBookStore,\n private productStore: PlantProtectionProductStore,\n private roundNumericPipe: GetRoundNumericPipe,\n private unitService: UnitService,\n private translationPipe: ApTranslationPipe) {\n }\n\n public getProductList(): ApDynGridColumnConfigBase[] {\n return [\n new ApDynGridPropertyColumnConfig({\n field: `${nameOf('ProductItem')}.${String(nameOf('ProductName'))}`,\n }),\n new ApDynGridPropertyColumnConfig({\n field: nameOf('ApplRate'),\n width: 60,\n cssClass: 'right',\n pipes: [{\n pipe: this.roundNumericPipe,\n args: []\n }]\n }),\n new ApDynGridPropertyColumnConfig({\n field: nameOf('Unit'),\n pipes: [{\n pipe: this.translationPipe,\n args: []\n }],\n width: 60\n }),\n new ApDynGridButtonColumnConfig(\n {\n tooltip: 'Global__Delete',\n callback: this.deleteProduct,\n isStandardIcon: true,\n standardIcon: nameOf('ButtonIconName')\n }\n )];\n }\n\n public getLogfileFieldset(data: IDatasetFieldMap): ApDynformsConfigFieldset {\n return new ApDynformsConfigFieldset({\n key: 'Logfile',\n legend: 'N__Logfile',\n config: [\n new ApDynformsConfigNumerictextbox({\n key: nameOf('Ec'),\n label: 'Global__ECStageShort',\n value: data.Ec,\n disabled: true\n }),\n new ApDynformsConfigNumerictextbox({\n key: nameOf('WorkingWidth'),\n label: 'Docu_Ini__WorkingWidth_m',\n value: data.WorkingWidth,\n min: 0\n }),\n new ApDynformsConfigDatepicker({\n key: nameOf('Date'),\n label: 'Nutrients__FertilizationDate',\n value: new Date(data.DataSet?.Created),\n disabled: true\n })\n ]\n });\n }\n\n public getProductsFieldset(data: IDatasetFieldMap,\n values$: Observable,\n plannings: Observable,\n selectedPlannings$: Observable,\n templateRef: TemplateRef): ApDynformsConfigFieldset {\n const product$ = values$.pipe(\n delay(1),\n map((v): IPlantProtectionProduct => this.productStore.Listen(s => s.data).value.find((p) => p.Id === v.Product)),\n distinctUntilChanged((previous, current) => previous?.Id === current?.Id),\n );\n\n return new ApDynformsConfigFieldset({\n key: 'Products',\n legend: 'Global__Products',\n config: [\n new ApDynformsConfigPlaceholder({}),\n new ApDynformsConfigComboBox({\n key: nameOf('Plan'),\n label: 'Global__Plannings',\n options: plannings,\n valueField: 'Id',\n textField: 'DisplayName',\n value: data.PlantProtectionPlanBook?.Id ?? null\n }),\n new ApDynformsConfigTextarea({\n key: nameOf('LogfileProducts'),\n label: 'Global__Logfiles',\n value: this._getLogfileProducts(data).join('\\n'),\n disabled: true,\n rows: 4\n }),\n new ApDynformsConfigTemplate({\n key: nameOf('PlanningProducts'),\n value: templateRef\n }),\n new ApDynformsConfigPlaceholder({}),\n new ApDynformsConfigComboBox({\n key: nameOf('Product'),\n label: 'Global__Product',\n options: combineLatest([\n this.productStore.Listen((s) => s.data),\n selectedPlannings$\n ]).pipe(\n map(([products, values]) =>\n products.filter((product) => product.Selectable &&\n product.ProductDetails.find((details) =>\n details.EcMin <= data.Ec && details.EcMax >= data.Ec &&\n details.EppoCrop === this.cropTypeStore.GetEppoCode(data.CropType)) != null &&\n values.find((value) => value.ProductItem?.Id === product.Id) == null\n )\n )\n ),\n valueField: nameOf('Id') as string,\n textField: nameOf('ProductName') as string\n }),\n new ApDynformsConfigPlaceholder({}),\n new ApDynformsConfigNumerictextbox({\n key: nameOf('Maximum'),\n label: this._setDefaultLable('Global__Maximum'),\n label$: product$.pipe(\n map((product) => this._setLableByProduct('Global__Maximum', data, product))\n ),\n disabled: true,\n value$: product$.pipe(\n map((product) => {\n if (product == null) {\n return undefined;\n }\n return product?.ProductDetails?.find((d) =>\n d.EcMin <= data.Ec && d.EcMax >= data.Ec && this.cropTypeStore.getDefaultCroptype(data.CropType).Eppocode === d.EppoCrop)?.AmountMax;\n }))\n }),\n new ApDynformsConfigPlaceholder({}),\n new ApDynformsConfigNumerictextbox({\n key: nameOf('AvgProduct'),\n label: this._setDefaultLable('Global__Product_avg'),\n label$: product$.pipe(\n map((product) => this._setLableByProduct('Global__Product_avg', data, product))\n ),\n step: product$.pipe(\n map((product) => {\n return product ? (this._getProduct(data, product)?.AmountMax >= 100 ? 10 : 1) : 1;\n })),\n min: 0,\n max: product$.pipe(\n delay(10),\n map((product) => {\n return product ? this._getProduct(data, product)?.AmountMax : undefined;\n })),\n value$: merge(\n product$.pipe(map(() => undefined)),\n values$.pipe(map((value) => value.AvgProduct))\n )\n }),\n new ApDynformsConfigPlaceholder({}),\n new ApDynformsConfigButton({\n key: 'productButton',\n value: 'Transfer',\n callback: this.addProduct,\n disabledButton$: merge(values$.pipe(\n map((values) => values.Product == null || values.AvgProduct == null)\n ), of(true))\n })\n ]\n });\n }\n\n public getDocuFieldset(data: IDatasetFieldMap, values$: Observable): ApDynformsConfigFieldset {\n const plan$ = values$.pipe(\n map((v): IPlantProtectionPlanBook => this.planBookStore.Listen(s => s.data).value.find((p) => p.Id === v.Plan)),\n distinctUntilChanged((previous, current) => previous?.Id === current?.Id),\n );\n\n return new ApDynformsConfigFieldset({\n key: 'Docu',\n legend: 'Global__Documentation',\n config: [\n new ApDynformsConfigComboBox({\n key: 'Driver',\n label: 'Global__Worker',\n options: this.driverStore.Listen(s => s.data),\n textField: nameOf('FullName') as string,\n valueField: nameOf('Id') as string,\n valuePrimitive: true,\n value: data.PlantProtectionPlanBook?.ExportDriver,\n value$: plan$.pipe(\n skip(1),\n map((p) => p?.ExportDriver)\n )\n }),\n new ApDynformsConfigComboBox({\n key: 'Machine',\n label: 'Docu_Ini__Engine',\n options: this.machineStore.Listen(s => s.data),\n textField: nameOf('NameWithSign') as string,\n valueField: nameOf('Id') as string,\n valuePrimitive: true,\n value: data.PlantProtectionPlanBook?.ExportMachine,\n value$: plan$.pipe(\n skip(1),\n map((p) => p?.ExportMachine)\n )\n }),\n new ApDynformsConfigComboBox({\n key: 'Instrument',\n label: 'AgriConnect_Ini__Tool',\n options: this.instrumentStore.Listen(s => s.data),\n textField: nameOf('Name') as string,\n valueField: nameOf('Id') as string,\n valuePrimitive: true,\n value: data.PlantProtectionPlanBook?.ExportInstrument,\n value$: plan$.pipe(\n skip(1),\n map((p) => p?.ExportInstrument)\n )\n }),\n ]\n });\n }\n\n private _getLogfileProducts(data: IDatasetFieldMap): string[] {\n const json: IPlantProtectionSensorLogHeaderData = JSON.parse(data.DataSet.HeaderValuesString);\n if (json?.Agents) {\n return json.Agents.map((agent) => agent?.Name + ' ' + agent?.AStd + ' ' + agent?.Unit);\n }\n return [];\n }\n\n private _getProduct(data: IDatasetFieldMap, product: IPlantProtectionProduct | null): IPlantProtectionProductDetails {\n return product?.ProductDetails?.find(d =>\n d.EcMin <= data.Ec && d.EcMax >= data.Ec && this.cropTypeStore.getDefaultCroptype(data.CropType).Eppocode === d.EppoCrop);\n }\n\n private _setLableByProduct(key: string, data: IDatasetFieldMap, product: IPlantProtectionProduct | null): string {\n const productDetails = this._getProduct(data, product);\n if (!productDetails) {\n return this._setDefaultLable(key);\n }\n return this.unitService.getUnitWithLabelKey(productDetails.Unit, key);\n }\n\n private _setDefaultLable(key: string): string {\n return this.unitService.getUnitWithLabelKey(null, key);\n }\n}\n","import {Injectable, TemplateRef} from '@angular/core';\nimport {\n ApDynformsConfigFieldset\n} from '../../../../ap-dynforms/config/ap-dynforms-config-fieldset';\nimport {PpLogfileEditWizardUiProvider} from './pp-logfile-edit-wizard.ui-provider';\nimport {BehaviorSubject, Observable, of, Subscription} from 'rxjs';\nimport {\n ApDynGridPagerConfigBase\n} from '../../../../ap-dyngrids/config/ap-dyn-grid-pager-config-base';\nimport {ILogFileEditWizard, IPpLogEditProductListGridItem} from '../pp-logfile-edit-wizard.types';\nimport {\n PlantProtectionPlanBookStore\n} from '../../../../stores/plant-protection/plant-protection-planbook.store';\nimport {distinctUntilChanged, map} from 'rxjs/operators';\nimport {TranslationStore} from '../../../../stores/translation/translation.store';\nimport {\n PpCommonService\n} from '../../../../plant-protection/services/pp-common.service';\nimport {\n ApDynGridColumnConfigBase\n} from '../../../../ap-dyngrids/config/ap-dyn-grid-column-config-base';\nimport {ApDynformsComponent} from '../../../../ap-dynforms/ap-dynforms.component';\nimport {IDisplayName} from '../../../../types/common-types';\nimport {\n PlantProtectionProductStore\n} from '../../../../stores/base-data/plantprotection.product.store';\nimport {CropTypeStore} from '../../../../stores/base-data/crop.types.store';\nimport {ApTranslationService} from '../../../../ap-utils/service/ap-translation.service';\nimport {UnitsStore} from '../../../../stores/common/units.store';\nimport {nameOf} from '../../../../ap-core/utils/ap-name-of';\nimport IDatasetFieldMap = Data.Sensor.IDatasetFieldMap;\nimport IPlantProtectionProduct = Data.BaseData.IPlantProtectionProduct;\nimport IPlantProtectionPlanBook = Data.TaskManagement.IPlantProtectionPlanBook;\nimport IPlantProtectionSensorLogHeaderData = Data.Import.IPlantProtectionSensorLogHeaderData;\n\n@Injectable({providedIn: 'root'})\nexport class PpLogfileEditWizardProvider {\n public fieldSets: ApDynformsConfigFieldset[];\n public loading$: Observable = of(false);\n public pager: ApDynGridPagerConfigBase;\n public data: IDatasetFieldMap;\n public dynForm: ApDynformsComponent;\n public productColumns: ApDynGridColumnConfigBase[];\n public productList$ = new BehaviorSubject([]);\n\n private _subscriptions: Subscription[] = [];\n\n constructor(private commonService: PpCommonService,\n private cropTypeStore: CropTypeStore,\n private plantProtectionStore: PlantProtectionPlanBookStore,\n private productStore: PlantProtectionProductStore,\n private translationService: ApTranslationService,\n private translationStore: TranslationStore,\n private uiProvider: PpLogfileEditWizardUiProvider,\n private unitStore: UnitsStore) {\n this.productColumns = this.uiProvider.getProductList();\n }\n\n public onInit(templateRef: TemplateRef): void {\n this._buildFieldSets(templateRef);\n this._setProducts();\n this._subscriptions.push(this.uiProvider.addProduct.subscribe(() => this._addProduct()));\n this._subscriptions.push(this.uiProvider.deleteProduct.subscribe((value) => this._deleteProduct(value)));\n }\n\n public onDestroy(): void {\n this._subscriptions.forEach((s) => s.unsubscribe());\n }\n\n private _buildFieldSets(templateRef: TemplateRef): void {\n this.fieldSets = [\n this.uiProvider.getLogfileFieldset(this.data),\n this.uiProvider.getProductsFieldset(this.data, this.dynForm.formValues$, this._getPlannings(), this.productList$, templateRef),\n this.uiProvider.getDocuFieldset(this.data, this.dynForm.formValues$),\n ];\n }\n\n private _getPlannings(): Observable {\n const headerValues: IPlantProtectionSensorLogHeaderData = JSON.parse(this.data.DataSet.HeaderValuesString);\n return this.plantProtectionStore.Listen((s) => s.data)\n .pipe(map((planBooks) => {\n const resultList = [];\n resultList.push({\n Id: null,\n DisplayName: `(${this.translationStore.FindTranslationForSelectedLanguage('Global__New_Planning')})`\n });\n resultList.push(...planBooks\n .filter((planBook) => planBook.FieldGeomId === this.data.FieldGeomId &&\n planBook.LogfileOperationMode === +headerValues.OperationMode)\n .map((planBook) => {\n return {\n Id: planBook.Id as string,\n DisplayName: this.commonService.getPlanningDescription(planBook)\n };\n }));\n return resultList;\n }));\n }\n\n private _addProduct(): void {\n const dataItem = this.dynForm.form.getRawValue() as ILogFileEditWizard;\n const productItem = this.productStore.getProducts().find((p) => p.Id === dataItem.Product);\n const unit = this._getUnit(productItem);\n const newItem: IPpLogEditProductListGridItem = {\n ProductItem: productItem,\n ApplRate: dataItem.AvgProduct,\n Unit: unit,\n ButtonIconName: 'delete'\n };\n this.productList$.next([...this.productList$.value, newItem]);\n this.dynForm.form.get(nameOf('Product')).setValue(undefined);\n }\n\n private _deleteProduct(dataItem: IPpLogEditProductListGridItem): void {\n this.productList$.next(this.productList$.value.filter((p) => p.ProductItem.Id !== dataItem.ProductItem.Id));\n }\n\n private _getUnit(product: IPlantProtectionProduct): string {\n const details = product?.ProductDetails.find((d) =>\n d.EcMin <= this.data.Ec && d.EcMax >= this.data.Ec && this.cropTypeStore.GetEppoCode(this.data.CropType) === d.EppoCrop);\n return details?.Unit?.Key;\n }\n\n private _setProducts(): void {\n setTimeout(() => {\n this._subscriptions.push(this.dynForm.form.valueChanges.pipe(\n distinctUntilChanged((previous: ILogFileEditWizard, current: ILogFileEditWizard) => previous.Plan === current.Plan),\n map((data: ILogFileEditWizard) =>\n this.plantProtectionStore.Listen((s) => s.data)\n .value.find((p) => p.Id === data.Plan)),\n ).subscribe((planning: IPlantProtectionPlanBook) => {\n this._setProduct(planning);\n }));\n const values: ILogFileEditWizard = this.dynForm.form.value;\n this._setProduct(this.plantProtectionStore.Listen((s) => s.data)\n .value.find((p) => p.Id === values.Plan));\n });\n }\n\n private _setProduct(planning: IPlantProtectionPlanBook): void {\n if (planning === undefined) {\n const json: IPlantProtectionSensorLogHeaderData = JSON.parse(this.data.DataSet.HeaderValuesString);\n if (json?.Agents) {\n this.productList$.next(json?.Agents\n .map((product) => ({\n Product: product,\n ProductItem: this.productStore.Listen((s) => s.data)\n .value.find((value) => value.ExternalProductId === product.Id)\n }))\n .filter((item) => item.ProductItem != null)\n .map((item): IPpLogEditProductListGridItem => {\n return {\n ProductItem: item.ProductItem,\n ApplRate: +item.Product.AStd.replace(',', '.'),\n Unit: this.unitStore.getUnit(item.Product.Unit)?.Key ?? item.Product.Unit,\n ButtonIconName: 'delete'\n };\n }) ?? []);\n }\n } else {\n this.productList$.next(planning?.ProductList.map((product): IPpLogEditProductListGridItem => {\n const unit = this.unitStore.getUnitWithUnit(product.Unit.Id).Key;\n return {\n ProductItem: product.Product,\n ApplRate: product.ProductRate,\n Unit: unit,\n ButtonIconName: 'delete'\n };\n }) ?? []);\n }\n }\n}\n","import {\n Component,\n OnDestroy,\n OnInit,\n TemplateRef,\n ViewChild\n} from '@angular/core';\nimport {ApDynComponentComponent} from '../../ap-dyncomponent/ap-dyncomponent.component';\nimport {\n PpLogfileEditWizardProvider\n} from './logfile-edit-wizard/config/pp-logfile-edit-wizard.provider';\nimport {ObjectFactory} from 'ts-tooling';\nimport {FormStore} from '../../stores/layout/form.store';\nimport {ILogFileEditWizard} from './logfile-edit-wizard/pp-logfile-edit-wizard.types';\nimport {\n PlantProtectionPlanBookStore\n} from '../../stores/plant-protection/plant-protection-planbook.store';\nimport IPlantProtectionLogEdit = Data.PlantProtection.IPlantProtectionLogEdit;\nimport IPlantProtectionLogEditProduct = Data.PlantProtection.IPlantProtectionLogEditProduct;\n\n@Component({\n selector: 'pp-plan-edit',\n template: `\n \n
\n
\n \n
\n
\n \n
\n
\n
\n \n \n \n \n `,\n styles: []\n})\nexport class PpLogfileEditComponent implements OnInit, OnDestroy {\n @ViewChild(ApDynComponentComponent, {static: true}) dynComponent: ApDynComponentComponent;\n @ViewChild('plantProtectionProductListTemplate', {static: true}) public plantProtectionProductListTemplate: TemplateRef;\n\n constructor(public provider: PpLogfileEditWizardProvider,\n private planProtectionStore: PlantProtectionPlanBookStore,\n private formStore: FormStore) {\n }\n\n ngOnInit(): void {\n this.provider.data = ObjectFactory.Copy(this.formStore.Listen(s => s.updateComponent).getValue().data.SourceItem);\n this.provider.dynForm = this.dynComponent.dynForm;\n this.provider.onInit(this.plantProtectionProductListTemplate);\n }\n\n ngOnDestroy(): void {\n this.provider.onDestroy();\n }\n\n public close(): void {\n this.formStore.closeForm();\n }\n\n public save(): void {\n const values: ILogFileEditWizard = this.dynComponent.dynForm.form.value;\n this.provider.data.WorkingWidth = values.WorkingWidth;\n const logEdit: IPlantProtectionLogEdit = {\n DatasetFieldMapId: this.provider.data.Id,\n PlanId: values.Plan,\n WorkingWidth: values.WorkingWidth,\n Products: this.provider.productList$.getValue().map((item): IPlantProtectionLogEditProduct => ({\n ProductId: item.ProductItem?.Id,\n Rate: item.ApplRate,\n Unit: item.Unit\n })),\n DriverId: values.Driver,\n MachineId: values.Machine,\n InstrumentId: values.Instrument\n };\n this.planProtectionStore.setPlanningToLogfile(logEdit);\n this.formStore.closeForm();\n }\n}\n","import {EventEmitter, Injectable} from '@angular/core';\nimport {ObjectFactory} from 'ts-tooling';\nimport {PlantProtectionPlanBookStore} from '../../stores/plant-protection/plant-protection-planbook.store';\nimport {FieldStore} from '../../stores/farm/field.store';\nimport {MapStore} from '../../stores/map/map.store';\nimport {ApShowPointsOnMapService} from '../../ap-utils/service/ap-show-points-on-map.service';\nimport {FormStore} from '../../stores/layout/form.store';\nimport {BehaviorSubject} from 'rxjs';\nimport {\n PpLogfileEditComponent\n} from '../../entry-components/plant-protection-entry-components/pp-logfile-edit.component';\nimport {IPpLogfileGridItem} from '../types/pp-logfile.types';\nimport IDatasetFieldMap = Data.Sensor.IDatasetFieldMap;\nimport IPlantProtectionPlanBook = Data.TaskManagement.IPlantProtectionPlanBook;\nimport IPlantProtectionSensorLogHeaderData = Data.Import.IPlantProtectionSensorLogHeaderData;\nimport {AgriportConstantsService} from '../../services/common/agriport-constants.service';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class PpLogfileService {\n public saving = new BehaviorSubject(false);\n public onClearSelection = new EventEmitter();\n\n constructor(private store: PlantProtectionPlanBookStore,\n private fieldStore: FieldStore,\n private formStore: FormStore,\n private mapStore: MapStore,\n private showPointsOnMapService: ApShowPointsOnMapService) {\n this.store.Listen((s) => s.logfiles).subscribe(() => {\n this.saving.next(false);\n });\n }\n\n public logBookingReady(item: IDatasetFieldMap): boolean {\n return item?.PlantProtectionPlanBook?.ProductList.length > 0 && item?.Ec > 9 && item?.Ec < 70 && item?.WorkingWidth >= 10 && item?.WorkingWidth <= 100;\n }\n\n public logIsRejected(item: IDatasetFieldMap): boolean {\n return item?.Status === -1;\n }\n\n public logBooked(item: IDatasetFieldMap): boolean {\n return item?.Status === 1 && item?.PlantProtectionPlanBook?.BookedBy != null;\n }\n\n public onAccept(dataItem: IPpLogfileGridItem | IPpLogfileGridItem[]): void {\n if (!Array.isArray(dataItem)) {\n dataItem = [dataItem];\n }\n this._hidePoints(dataItem);\n this.saving.next(true);\n this.store.bookPlanBooks(dataItem.map((item) =>\n ({planBook: item.SourceItem.PlantProtectionPlanBook, logFile: item.SourceItem}))\n );\n }\n\n public onReset(dataItem: any | any[]): void {\n if (!Array.isArray(dataItem)) {\n dataItem = [dataItem];\n }\n this._hidePoints(dataItem);\n this.saving.next(true);\n this.store.unBookPlanBooks(\n this._getLogfiles(dataItem).map((log) =>\n ({planBook: log.PlantProtectionPlanBook, logFile: log}))\n );\n }\n\n public onReject(dataItem: any): void {\n if (!Array.isArray(dataItem)) {\n dataItem = [dataItem];\n }\n this._hidePoints(dataItem);\n const logFiles = this._getLogfiles(dataItem).map((log) => {\n log = ObjectFactory.Copy(log);\n log.Status = -1;\n const areLogfilesValid = this.store.getLogfilesByPlanBookId(log.PlantProtectionPlanBook?.Id)\n .filter(l => l.Id !== log.Id)\n .every(l => l.Status < 1);\n if (!!log?.PlantProtectionPlanBook?.BookedBy && areLogfilesValid) {\n this.store.unBookPlanBooks([{planBook: log.PlantProtectionPlanBook, logFile: log}]);\n return null;\n }\n log.PlantProtectionPlanBook = null;\n return log;\n }).filter(log => !!log);\n this.saving.next(true);\n this.store.updateLogfiles(logFiles);\n }\n\n public onRemap(dataItem: IPpLogfileGridItem | IPpLogfileGridItem[]): void {\n this._hidePoints(dataItem);\n this.saving.next(true);\n if (Array.isArray(dataItem)) {\n this.store.remapLogfile(dataItem.map((item) => item.SourceItem));\n } else {\n this.store.remapLogfile([dataItem.SourceItem]);\n }\n }\n\n public 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 public onEdit(dataItem: any): void {\n this.formStore.openForm({component: PpLogfileEditComponent, data: dataItem});\n }\n\n public toggleLogPointsOnMap(selectedItems: IPpLogfileGridItem[], 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?.map(d => {\n return {\n DatasetId: d.SourceItem.DataSet.Id as string,\n FieldGeomId: d.SourceItem.FieldGeomId as string\n };\n }), farmId);\n }\n\n public getPlanning(dataItem: IDatasetFieldMap): IPlantProtectionPlanBook {\n const headerValues: IPlantProtectionSensorLogHeaderData = JSON.parse(dataItem.DataSet.HeaderValuesString);\n const planBooks = this.store.Listen(s => s.data).getValue();\n const sorted = planBooks\n .filter((pb) => {\n return pb.DeletedBy == null &&\n pb.FieldGeomId === dataItem.FieldGeomId &&\n pb.LogfileOperationMode === +headerValues.OperationMode &&\n pb.ProductList.Any(\n (product) => headerValues.Agents.Any(\n (agent) => product.Product?.ExternalProductId === agent.Id)) &&\n Math.abs(new Date(pb.ApplicationDate).valueOf() - new Date(dataItem.DataSet.Created).valueOf()) <\n +AgriportConstantsService.GetConstant('PLAN_DATE_DELTA') * 24 * 60 * 60 * 1000;\n })\n .sort((pb) =>\n pb.ProductList.FindAll(pl => headerValues.Agents.Find(agent => agent.Id === pl.Product.ExternalProductId) != null).length\n );\n return sorted.FirstOrDefault();\n }\n\n private _hidePoints(dataItem: IPpLogfileGridItem | IPpLogfileGridItem[]): void {\n this.onClearSelection.emit();\n }\n\n private _getLogfiles(items: any[]): IDatasetFieldMap[] {\n const ids = items.map((item) => item['Id']);\n return this.store.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.PlantProtectionPlanBook = items.find((item) => item['Id'] === log.Id)?.SourceItem.PlantProtectionPlanBook;\n return log;\n });\n }\n}\n","import {Injectable} from '@angular/core';\nimport {\n ApDynGridColumnConfigBase\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 ApDynGridStatusSwitchColumnConfig,\n IStateChange\n} from '../../ap-dyngrids/config/ap-dyn-grid-status-switch-column.config';\nimport {ApUtilService} from '../../ap-utils/service/ap-util.service';\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 {GetRoundNumericPipe} from '../../ap-utils';\nimport {Subscription} from 'rxjs';\nimport {LanguageStore} from '../../stores/translation/language.store';\nimport {SettingsStore} from '../../stores/base-data/settings.store';\nimport {PpLogfileService} from '../services/pp-logfile.service';\nimport {nameOf} from '../../ap-core/utils/ap-name-of';\nimport {IPpLogfileGridItem, IPpLogfileGridItemPlanning} from '../types/pp-logfile.types';\nimport {ApTranslationPipe} from '../../translation/pipes/ap-translation.pipe';\nimport IDriver = Data.DocuContext.Driver.IDriver;\n\n@Injectable({\n providedIn: 'root'\n})\nexport class PpLogfilesGridConfig {\n public constructor(private languageStore: LanguageStore,\n private roundNumericPipe: GetRoundNumericPipe,\n private service: PpLogfileService,\n private settingStore: SettingsStore,\n private translationPipe: ApTranslationPipe) {\n }\n\n public getGridColumns(subscriptions: Subscription[]): ApDynGridColumnConfigBase[] {\n return [\n new ApDynGridStatusColumnConfig({\n field: nameOf('Status'),\n class: nameOf('StatusClass'),\n description: nameOf('StatusDesc'),\n groupDesc: true\n }),\n new ApDynGridStatusSwitchColumnConfig({\n field: nameOf('LogStatus'),\n readonly: true,\n filterable: true,\n defaultFilter: 0,\n disableGreen: (item: IPpLogfileGridItem) => {\n if (item == null || item.SourceItem == null || item.Planning == null) {\n return false;\n }\n item.SourceItem.PlantProtectionPlanBook = item.Planning.SourceItem;\n return !this.service.logFileValid(item.SourceItem) || !this.service.logBookingReady(item.SourceItem);\n },\n stateChange: ApUtilService.createEventEmitter(\n (event: IStateChange) => {\n if (event.state === -1) {\n this.service.onReject(event.item);\n } else if (event.state === 0) {\n this.service.onReset(event.item);\n } else if (event.state === 1) {\n this.service.onAccept(event.item);\n }\n }, subscriptions),\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__FieldName',\n field: nameOf('FieldName'),\n dynCssClass: (item) => item[nameOf('FieldName')] === 'Global__UnknownFieldName' ? ' italic' : '',\n width: 180,\n headerFilterable: true,\n filterable: true,\n pipes: [\n {\n pipe: this.translationPipe,\n args: []\n }\n ]\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global_ha_Unit',\n field: nameOf('FieldArea'),\n width: 60,\n headerFilterable: true,\n cssClass: 'right',\n dynCssClass: (item) => item[nameOf('FieldName')] === 'Global__UnknownFieldName' ? ' italic' : '',\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: nameOf('FileName'),\n width: 100,\n filterable: true,\n headerFilterable: true,\n hide: true\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__Date',\n field: nameOf('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: nameOf('Crop'),\n width: 100,\n headerFilterable: true,\n filterable: true\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__ECStageShort',\n field: nameOf('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 title: 'Global__Products',\n field: `${nameOf('Products')}`,\n width: 100,\n headerFilterable: true,\n filterable: true,\n multiline: true\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Avg_Water',\n field: `${nameOf('Water')}`,\n headerExtraLines: ['Unit_l_per_ha'],\n width: 70,\n cssClass: 'right',\n filterType: FilterType.NUMBER,\n headerFilterable: true,\n filterable: true,\n hide: true,\n tooltip: (dataItem: IPpLogfileGridItem) => this.roundNumericPipe.transform(dataItem.Water),\n pipes: [{\n pipe: this.roundNumericPipe,\n args: [0]\n }]\n })\n ]\n }),\n new ApDynGridGroupColumnConfig({\n title: 'Global__Planning',\n hide: true,\n groupColumns: [\n new ApDynGridPropertyColumnConfig({\n title: 'Global__Note',\n field: `${nameOf('Planning')}.${nameOf('Note')}`,\n width: 100,\n headerFilterable: true,\n filterable: true\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__Date',\n field: `${nameOf('Planning')}.${nameOf('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: `${nameOf('Planning')}.${nameOf('Driver')}.${nameOf('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.service.onEdit.bind(this.service), subscriptions),\n // is red is not booked\n disabled: (item: IPpLogfileGridItem) => item.Status === -1 || item.LogStatus !== 0\n },\n {\n text: 'Global__Booking',\n callback: ApUtilService.createEventEmitter(this.service.onAccept.bind(this.service), subscriptions),\n disabled: (item: IPpLogfileGridItem) => {\n if (item == null || item.SourceItem == null || item.Planning == null) {\n return false;\n }\n item.SourceItem.PlantProtectionPlanBook = item.Planning.SourceItem;\n return !this.service.logFileValid(item.SourceItem) || !this.service.logBookingReady(item.SourceItem) || this.service.logBooked(item.SourceItem);\n }\n },\n {\n text: 'Global__Reject',\n callback: ApUtilService.createEventEmitter(this.service.onReject.bind(this.service), subscriptions),\n },\n {\n text: 'Global__Logfile_Remap',\n callback: ApUtilService.createEventEmitter(this.service.onRemap.bind(this.service), subscriptions),\n disabled: (item: IPpLogfileGridItem) => item.LogStatus === 1\n }\n ]\n })\n ];\n }\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 {PpLogfilesGridConfig} from '../configs/pp-logfiles-grid.config';\nimport {BehaviorSubject, combineLatest, Observable, of, Subscription} from 'rxjs';\nimport {map} from 'rxjs/operators';\nimport {IPpLogfileGridItem} from '../types/pp-logfile.types';\nimport {\n PlantProtectionPlanBookStore\n} from '../../stores/plant-protection/plant-protection-planbook.store';\nimport {FieldStore} from '../../stores/farm/field.store';\nimport {\n CropTypeStore\n} from '../../stores/base-data/crop.types.store';\nimport {DriverStore} from '../../stores/docu/driver.store';\nimport {PpLogfileService} from '../services/pp-logfile.service';\nimport {LoginStore} from '../../stores/login/login.store';\nimport {\n PlantProtectionProductStore\n} from '../../stores/base-data/plantprotection.product.store';\nimport {\n ApDynGridPagerConfigBase\n} from '../../ap-dyngrids/config/ap-dyn-grid-pager-config-base';\nimport {\n ApDynGridPagerConfig\n} from '../../ap-dyngrids/config/ap-dyn-grid-pager-config';\nimport IDatasetFieldMap = Data.Sensor.IDatasetFieldMap;\nimport {MapFactoryStyler} from '../../map-factory/style';\nimport {\n CampaignYearStore\n} from '../../stores/login/campaignyear.store';\n\n@Component({\n selector: 'plant-protection-logfiles',\n template: `\n \n \n `,\n styles: []\n})\nexport class PpLogfilesComponent implements OnInit, AfterViewInit, OnDestroy {\n @ViewChild(ApDynComponentComponent) dynComponent: ApDynComponentComponent;\n public columns: ApDynGridColumnConfigBase[] = [];\n public items$ = new BehaviorSubject([]);\n public loading$: Observable = of(true);\n public pager: ApDynGridPagerConfigBase;\n private _subscriptions: Subscription[] = [];\n\n constructor(private store: PlantProtectionPlanBookStore,\n private cropStore: CropTypeStore,\n private driverStore: DriverStore,\n private fieldStore: FieldStore,\n private loginStore: LoginStore,\n private gridConfig: PpLogfilesGridConfig,\n private campaignYearStore: CampaignYearStore,\n private productStore: PlantProtectionProductStore,\n private service: PpLogfileService) {\n }\n\n public ngOnInit(): void {\n this.columns = this.gridConfig.getGridColumns(this._subscriptions);\n this.pager = new ApDynGridPagerConfig({});\n }\n\n public ngAfterViewInit(): void {\n this._getDataFromStore();\n this._subscriptions.push(this.dynComponent.SelectedItems$.pipe(\n map((items: IPpLogfileGridItem[]) =>\n items.map((item) =>\n item.FieldId as string).filter((v, i, a) => a.indexOf(v) === i)),\n ).subscribe((ids) => {\n this.fieldStore.changeSelectedField(ids);\n }));\n this._subscriptions.push(this.dynComponent.SelectedItems$.subscribe(selectedItems => {\n MapFactoryStyler.Instance.clearStyleCache();\n this.service.toggleLogPointsOnMap(selectedItems, this.loginStore.SelectedFarmId);\n }));\n // to have same behavior like in n-fertilization we clear selection after user actions (e.g. after accept, reject etc.)\n this._subscriptions.push(this.service.onClearSelection.subscribe(() =>\n this.dynComponent.dynGrid.gridPaging.setSelectedKeys([])));\n }\n\n public ngOnDestroy(): void {\n this._subscriptions.forEach((s) => s.unsubscribe());\n }\n\n private _getDataFromStore(): void {\n this.loading$ = this.store.Listen((s) => s.logfilesLoading);\n this._subscriptions.push(combineLatest([\n this.store.Listen((s) => s.logfiles),\n this.store.Listen((s) => s.data),\n this.fieldStore.Listen((s) => s.data),\n ]).pipe(\n map(([logfiles, planBooks]) => {\n return logfiles.map((logfile) => {\n const field = this.fieldStore.getFieldByFieldGeomId(logfile.FieldGeomId);\n const fieldGeom = this.fieldStore.getFieldGeomById(logfile.FieldGeomId);\n const planning = logfile.Status !== -1\n ? planBooks.find((pb) => pb.Id === logfile.PlantProtectionPlanBook?.Id) ?? this.service.getPlanning(logfile)\n : undefined;\n const status = this._getLogStatus(logfile);\n const headerValues = JSON.parse(logfile.DataSet.HeaderValuesString);\n const productList = headerValues?.Agents.map((v: any) => v.Name).join('\\n');\n const result: IPpLogfileGridItem = {\n Id: logfile.Id as string,\n SourceItem: logfile,\n Status: status.Status,\n StatusClass: status.StatusClass,\n StatusDesc: status.StatusDesc,\n LogStatus: status.LogStatus,\n FieldName: field != null ? this.fieldStore.getFieldNameById(field?.Id) : 'Global__UnknownFieldName',\n FieldId: field?.Id,\n Date: new Date(logfile?.DataSet?.Created),\n Crop: this.cropStore.GetCropTypeName(logfile.CropType),\n FieldArea: fieldGeom?.AreaHa,\n FileName: logfile?.DataSet?.DataSetName,\n Ec: logfile.Ec,\n Water: logfile.NContentAvg,\n Products: productList,\n Planning: {\n SourceItem: planning,\n Date: planning?.ApplicationDate,\n Note: planning?.Summary?.Title,\n Driver: this.driverStore.getDriverById(planning?.ExportDriver)\n }\n };\n return result;\n });\n })\n ).subscribe(items => this.items$.next(items)));\n\n this._subscriptions.push(this.campaignYearStore.Listen(s => s.selectedYear).subscribe(() => setTimeout(() => {\n this._loadDataFromStore();\n })));\n }\n\n private _loadDataFromStore(): void {\n this.store.loadLogfiles();\n this.store.loadPlanBooks();\n this.productStore.loadPlantProtectionProducts(false, false);\n }\n\n private _getLogStatus(logfile: IDatasetFieldMap): {\n Status: number,\n StatusClass: string,\n StatusDesc: string,\n LogStatus: number\n } {\n const status = this.service.logBookingReady(logfile) ? 1 : !this.service.logFileValid(logfile) ? -1 : 0;\n const logStatus = this.service.logIsRejected(logfile) ? -1 : this.service.logBooked(logfile) ? 1 : 0;\n return {\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 };\n }\n}\n","import IPlantProtectionSummary = Data.TaskManagement.IPlantProtectionSummary;\nimport IGuid = System.IGuid;\nimport IPlantProtectionPlanBook = Data.TaskManagement.IPlantProtectionPlanBook;\n\nexport const PpNoDataValue = -999;\n\nexport interface IPpPlanningBookingGridItem {\n Id: IGuid;\n Summary: IPlantProtectionSummary;\n Status: number;\n StatusClass: string;\n StatusDesc: string;\n FieldIds: IGuid[];\n Count: string;\n Crop: string;\n CropId: any;\n Appl: string;\n ApplSum: number;\n Area: number;\n OperationMode: string;\n OperationModeKey: string;\n OperationModeKeyTrans: string;\n ProductNames: string;\n ProductNamesTooltip: string;\n ProductsSum: string;\n ProductsSumTooltip: string;\n ApplUnit: string;\n Avg: number;\n Min: number;\n Max: number;\n NUptakeAverage: number;\n ApplicationDate: Date;\n ApplicationDateTooltip: string;\n ApplicationDateItalic: boolean;\n Note: string;\n PlanBooks: IPlantProtectionPlanBook[];\n FieldsTooltip: string;\n}\n\nexport interface ISummaryWithPlanBooks {\n Summary: IPlantProtectionSummary;\n FilteredPlanBooks: IPlantProtectionPlanBook[];\n TotalPlanBooks: IPlantProtectionPlanBook[];\n}\n","import {IGridStatus} from '../../ap-interface/interfaces/ap-grid-status.interface';\nimport IGuid = System.IGuid;\nimport IFieldCrop = Data.FieldManagement.IFieldCrop;\n\nexport interface IPpOverviewGridItem {\n Id: IGuid;\n FieldCrop: IFieldCrop | null;\n Status: IGridStatus;\n Nr: number;\n SNr: number;\n NrSNr: string;\n Name: string;\n Area: number;\n Crop: string;\n EcValue: number;\n CropNote: string;\n Applications: IPpOverviewDetailsGridItem[];\n}\n\nexport interface IPpOverviewDetailsGridItem {\n Id: IGuid;\n FieldId: IGuid;\n Status: IGridStatus;\n ApplNum: string;\n OperationMode: string;\n WorkArea: number;\n ApplDate: Date;\n Ec: number;\n NUptakeAvg: number;\n NUptakeMin: number;\n NUptakeMax: number;\n WaterAvg: number;\n WaterMin: number;\n WaterMax: number;\n Products: string;\n ProductsTooltip: string;\n CropKey: number;\n PlanId: string;\n}\n\nexport enum PpColumnSwitchValue {\n Water,\n NUptake\n}\n\nexport enum PpOverviewMassEditAction {\n Edit = 0\n}\n","import {IPpPlanningWizardSelectionGridData} from '../pp-planning-wizard.types';\nimport {\n IFieldScanDataStatsTableItem\n} from '../../../../statistics/components/charts/field-scan-data-table-stats/ap-field-scan-data-table-stats.types';\nimport {ApStatsType} from '../../../../ap-interface';\nimport {Injectable} from '@angular/core';\nimport {StatisticStore} from '../../../../stores/statistic/statistic.store';\nimport {StatisticService} from '../../../../services/data/statistic.service';\n\n@Injectable({providedIn: 'root'})\nexport class PpPlanningWizardSelectionService {\n constructor(private statisticStore: StatisticStore,\n private statisticService: StatisticService) {\n }\n\n /**\n * Extracts the first EPPO code from the selected fields\n * Used for determining the crop type when multiple fields are selected\n * @param data Array of selected field data\n * @returns The first valid EPPO code found in the selected fields, or undefined if no EPPO codes are present\n * @public\n */\n public getEppoCodeFromSelectedFields(data: IPpPlanningWizardSelectionGridData[]): string | undefined {\n const eppoCodes = data.filter(x => !!x.EppoCode)\n .map(x => x.EppoCode);\n if (eppoCodes.length === 0) {\n return undefined;\n }\n return eppoCodes[0];\n }\n\n /**\n * Generates field statistics for selected or total items\n * This method:\n * - Handles cases with no selected or total items\n * - Uses all items if no items are selected\n * - Transforms grid data into statistical table items\n * - Sets statistic data in the statistic store\n * @param selectedItems Currently selected grid items\n * @param totalItems All available grid items\n */\n public generateFieldStatistic(selectedItems: IPpPlanningWizardSelectionGridData[],\n totalItems: IPpPlanningWizardSelectionGridData[]): void {\n if (selectedItems?.length <= 0 && totalItems?.length <= 0) {\n this.statisticStore.setStatisticData(\n [], ApStatsType.FieldScanDataTableStats, '', 'Global__latest_Sensor_reading'\n );\n return;\n }\n if (selectedItems?.length <= 0) {\n selectedItems = totalItems;\n }\n const nStatItems: IFieldScanDataStatsTableItem[] = selectedItems.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(selectedItems, totalItems);\n this.statisticStore.setStatisticData(\n nStatItems, ApStatsType.FieldScanDataTableStats, title, 'Global__latest_Sensor_reading'\n );\n }\n\n /**\n * Generates a title for field statistics based on selected and total items\n * This method:\n * - Transforms items into a format suitable for title generation\n * - Marks items as selected or not\n * - Uses statistic service to generate an area-based title\n * @param selectedItems Currently selected grid items\n * @param allItems All available grid items\n * @returns A generated title string for the statistics\n * @private\n */\n private getTitleForStatistic(selectedItems: IPpPlanningWizardSelectionGridData[],\n allItems: IPpPlanningWizardSelectionGridData[]): 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 {\n IPpPlanningWizardDetailsData,\n IPpPlanningWizardSelectionGridData,\n IPpWizardProvider,\n PpWizardStates\n} from '../pp-planning-wizard.types';\nimport {BehaviorSubject, combineLatest, Observable} from 'rxjs';\nimport {\n ApDynGridColumnConfigBase\n} from '../../../../ap-dyngrids/config/ap-dyn-grid-column-config-base';\nimport {\n ApDynGridPagerConfigBase\n} from '../../../../ap-dyngrids/config/ap-dyn-grid-pager-config-base';\nimport {\n ApDynformsConfigFieldset\n} from '../../../../ap-dynforms/config/ap-dynforms-config-fieldset';\nimport {\n filter,\n map,\n tap\n} from 'rxjs/operators';\nimport {\n EventEmitter,\n Injectable\n} from '@angular/core';\nimport {\n LanguageStore\n} from '../../../../stores/translation/language.store';\nimport {\n SettingsStore\n} from '../../../../stores/base-data/settings.store';\nimport {\n ApGuidUtil\n} from '../../../../ap-utils';\nimport {\n ApDynGridPagerWizardBreadcrumbsStepper,\n ApDynGridPagerWizardButton,\n ApDynGridPagerWizardConfig\n} from '../../../../ap-dyngrids/config/ap-dyn-grid-pager-wizard-config';\nimport {\n NotifyStore\n} from '../../../../stores/dialog/notify.store';\nimport {\n IGridStatus\n} from '../../../../ap-interface/interfaces/ap-grid-status.interface';\nimport {\n CropRotationStore\n} from '../../../../stores/farm/crop.rotation.store';\nimport {\n FieldStore\n} from '../../../../stores/farm/field.store';\nimport {\n CampaignYearStore\n} from '../../../../stores/login/campaignyear.store';\nimport {\n CropTypeStore\n} from '../../../../stores/base-data/crop.types.store';\nimport {\n PlantProtectionPlanBookStore\n} from '../../../../stores/plant-protection/plant-protection-planbook.store';\nimport {\n ApGetCropService\n} from '../../../../stores/services/ap-get-crop.service';\nimport {\n ApDynComponentComponent\n} from '../../../../ap-dyncomponent/ap-dyncomponent.component';\nimport {\n SensorStore\n} from '../../../../stores/sensor/sensor.store';\nimport {\n ScanService\n} from '../../../../services/data/scan.service';\nimport {\n NdiStore\n} from '../../../../stores/ndi/ndi.store';\nimport {\n PpPlanningWizardSelectionService\n} from '../services/pp-planning-wizard-selection.service';\nimport {\n ObjectFactory\n} from 'ts-tooling';\nimport {\n ApColumnState\n} from '../../../../ap-interface/enums/ap-column-state.enum';\nimport {\n SelectionGridColumnsUiProvider\n} from './ui-providers/selection.grid-columns.ui-provider';\nimport ApValidationLevel = Data.Api.Validation.ApValidationLevel;\nimport ICropTypes = Data.BaseData.ICropTypes;\nimport ISensorFieldData = Data.Sensor.ISensorFieldData;\n\n// ATTENTION: injectable 'root' is very convenient in here because we can inject all needed stores.\n// BUT: This will reuse THE SAME instance of the provider every time. Therefor we need to carefully handle the 'onDestroy' method!\n@Injectable({providedIn: 'root'})\nexport class PpPlanningWizardSelectionProvider implements IPpWizardProvider {\n private _caption$: BehaviorSubject;\n private _fieldSets$: BehaviorSubject;\n private _errorKeys: BehaviorSubject;\n private _handleStateChange: EventEmitter;\n private _isContinueActive: BehaviorSubject;\n private _dynComponent: ApDynComponentComponent;\n\n constructor(private ndiStore: NdiStore,\n private fieldStore: FieldStore,\n private sensorStore: SensorStore,\n private notifyStore: NotifyStore,\n private languageStore: LanguageStore,\n private settingsStore: SettingsStore,\n private cropTypeStore: CropTypeStore,\n private cropRotationStore: CropRotationStore,\n private campaignYearStore: CampaignYearStore,\n private plantProtectionPlanBookStore: PlantProtectionPlanBookStore,\n private scanService: ScanService,\n private cropService: ApGetCropService,\n private ppPlanningWizardSelectionService: PpPlanningWizardSelectionService,\n private selectionGridColumnsUiProvider: SelectionGridColumnsUiProvider) {\n }\n\n /**\n * Initializes this wizard step's provider instance with necessary dependencies\n * and components required for the wizard functionality\n * @param caption$ Observable for the wizard step caption\n * @param fieldSets$ Observable for form field sets configuration\n * @param errorKeys Observable for tracking validation error keys\n * @param handleStateChange Event emitter to manage wizard state transitions\n * @param isContinueActive Observable controlling the continue button state\n * @param dynComponent Reference to the dynamic component instance\n * @public\n */\n public init(caption$: BehaviorSubject,\n fieldSets$: BehaviorSubject,\n errorKeys: BehaviorSubject,\n handleStateChange: EventEmitter,\n isContinueActive: BehaviorSubject,\n dynComponent: ApDynComponentComponent): void {\n this._caption$ = caption$;\n this._fieldSets$ = fieldSets$;\n this._errorKeys = errorKeys;\n this._handleStateChange = handleStateChange;\n this._isContinueActive = isContinueActive;\n this._dynComponent = dynComponent;\n }\n\n /**\n * Updates the caption for the selection wizard step\n * Sets the translation key for the step title\n * @public\n */\n public updateCaption(): void {\n this._caption$.next('Nutrients__SelectFieldsTitle');\n }\n\n /**\n * Whenever grid selection changes we might need to perform some validations...\n * @param items selected items\n * @public\n */\n public onGridSelectionChanged(items: IPpPlanningWizardSelectionGridData[]): void {\n this.fieldStore.changeSelectedField(items.map((item) => item?.Id?.toString()));\n const eppoCode = this.ppPlanningWizardSelectionService.getEppoCodeFromSelectedFields(items);\n const isValidSelection = items.length !== 0 && items.every(i => i?.Status.state >= ApColumnState.Yellow);\n const isValidCropsSelection = items?.length > 0 && items.every((i) => i?.EppoCode === eppoCode);\n this._isContinueActive.next(isValidSelection && isValidCropsSelection);\n if (!isValidCropsSelection && items.length > 0) {\n this._errorKeys.next(items.map(i => i.Id?.toString()));\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 } else {\n this._errorKeys.next([]);\n }\n }\n\n /**\n * Generates field statistics for the current grid selection\n * Determines which items to use for statistic generation based on current grid state\n * @public\n */\n public onGenerateStatistic(): void {\n const totalItems = (this._dynComponent?.items as IPpPlanningWizardSelectionGridData[]) ?? [];\n let selectedItems = (this._dynComponent?.getSelectedItems() as IPpPlanningWizardSelectionGridData[]) ?? [];\n if (selectedItems.length === 0) {\n selectedItems = totalItems;\n }\n this.ppPlanningWizardSelectionService.generateFieldStatistic(selectedItems, totalItems);\n }\n\n /**\n * Builds dataItems for the selection wizard step\n * Combines data from multiple stores to create grid items with field, crop, and sensor information\n * Calculates status for each field based on crop compatibility and sensor data\n * @returns Observable of grid data items for the selection grid\n * @public\n */\n public buildDataItems(): Observable {\n return 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.sensorStore.Listen(s => s.data),\n this.plantProtectionPlanBookStore.Listen(s => s.data),\n this.ndiStore.NdiStatistics$\n ]).pipe(\n filter(([fields, cropRotation]) => fields.length !== 0 && Object.keys(cropRotation).length !== 0),\n map(([fields, cropRotation, year, cropTypes, sensorFieldData, _, _1]) => fields.map((field) => {\n const geom = this.fieldStore.getCurrentFieldGeom(field);\n const fieldCrop = cropRotation[field.Id as string];\n const sensorData = sensorFieldData?.Find(sfd => sfd?.FieldGeomId === geom?.Id) as ISensorFieldData;\n let crop: any;\n let cropId: any;\n let defaultCropEppoCode: string | null;\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 bestScanData = this.scanService.getBestScanData(field, this.getDefaultBestScanStatus());\n return {\n Id: field.Id,\n Status: this.getStatus(fieldCrop[year.Year].MainCrop, sensorData),\n Nr: field.FieldNumber,\n TNr: field.FieldSubnumber,\n NrTNr: this.fieldStore.getFieldNumberAndSubNumber(field),\n Name: field.FieldName,\n Area: 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 PlanBookId: bestScanData.PlanId ?? ApGuidUtil.getEmptyGuid(),\n ScanData: bestScanData,\n } as IPpPlanningWizardSelectionGridData;\n })),\n tap((gridItems: IPpPlanningWizardSelectionGridData[]) => {\n const selectedItems = (this._dynComponent?.getSelectedItems() as IPpPlanningWizardSelectionGridData[]) ?? [];\n this.ppPlanningWizardSelectionService.generateFieldStatistic(selectedItems, gridItems);\n })\n );\n }\n\n /**\n * Creates the wizard selection (1st step) grid columns configuration\n * Builds a dynamic column configuration based on current language and system settings\n * @param _detailsData Unused details data parameter (maintained for interface compliance)\n * @returns Observable of column configuration array for the selection grid\n * @public\n */\n public getGridColumnConfig(_detailsData: IPpPlanningWizardDetailsData): 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) => this.selectionGridColumnsUiProvider.generateGridColumns(p.setting, p.language))\n );\n }\n\n /**\n * Creates a pager configuration for the selection wizard step\n * Configures navigation buttons and breadcrumb stepper for the wizard\n * @param breadCrumbsColumns Array of wizard states for breadcrumb navigation\n * @returns Configured pager object for the wizard\n * @public\n */\n public getPagerConfig(breadCrumbsColumns: PpWizardStates[]): ApDynGridPagerConfigBase {\n return new ApDynGridPagerWizardConfig(\n new ApDynGridPagerWizardButton('Global__Cancel', this._handleStateChange, {value: PpWizardStates.Cancel}),\n new ApDynGridPagerWizardBreadcrumbsStepper(breadCrumbsColumns, 0),\n new ApDynGridPagerWizardButton('Global__Next', this._handleStateChange,\n {active: this._isContinueActive, value: PpWizardStates.Details}));\n }\n\n /**\n * Leaves the selection wizard step and updates selected fields\n * This method:\n * - Updates the selected fields in the field store\n * - Returns copy of the currently selected grid items\n * @returns Array of selected planning wizard selection grid data\n * @public\n */\n public onLeave(): IPpPlanningWizardSelectionGridData[] {\n this.fieldStore.changeSelectedField(this._dynComponent.dynGrid.gridPaging.selectedKeys?.map(k => k.toString()));\n const selectedFields = this._dynComponent.dynGrid.gridPaging.selectedItems as IPpPlanningWizardSelectionGridData[];\n return ObjectFactory.Copy(selectedFields);\n }\n\n /**\n * Clears field sets for the selection wizard step\n * Resets the field sets observable to an empty array\n * @public\n */\n public updateFieldSets(): void {\n this._fieldSets$.next([]);\n }\n\n /**\n * Cleanup method for the provider when destroyed\n * Currently empty, but can be used for additional cleanup if needed\n * @public\n */\n public onDestroy(): void {\n this.fieldStore.changeSelectedField([]);\n }\n\n /**\n * Determines the status of a field based on crop type and sensor data\n * Evaluates field status considering:\n * - Crop type\n * - Sensor crop compatibility\n * - Sensor data availability\n * @param mainCropId ID of the main crop\n * @param sensorData Sensor field data\n * @returns Grid status object with state, class, and description\n * @private\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 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 = -1;\n result.class = 'ap-status-red';\n result.description = 'Global__CropGroup_Nothing';\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 } 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 /**\n * Provides a default grid status for best scan\n * @returns Default grid status with grey state and empty description\n * @private\n */\n private getDefaultBestScanStatus(): IGridStatus {\n return {\n state: ApColumnState.Red,\n class: 'ap-status-grey',\n description: ''\n };\n }\n}\n","import {\n ApDynGridColumnConfigBase,\n ApDynGridColumnControlType,\n ApDynGridColumnHideConfig,\n IPipeDefinition\n} from './ap-dyn-grid-column-config-base';\nimport {ApIconType} from '../../icons/ap-icon-type';\n\n/**\n * DynGrid config which allows embedding icons within our grid.\n * To see all available icons see class ApIconSelectorComponent.ts\n */\nexport class ApDynGridIconColumnConfig extends ApDynGridColumnConfigBase {\n\n public type = ApDynGridColumnControlType.Icon;\n public title: string;\n public tooltip: (dataItem: any) => string;\n /**\n * The unique icon id. See ApIconSelectorComponent.ts to find all available id's\n */\n public icon: (dataItem: any) => ApIconType;\n /**\n * Custom css class for styling the icon\n */\n public iconClass: (dataItem: any) => string;\n\n constructor(options: {\n hide?: boolean | ApDynGridColumnHideConfig,\n sortIndex?: number,\n sortDesc?: boolean,\n groupIndex?: number,\n groupDesc?: boolean,\n headerStyle?: any,\n style?: any,\n width?: number,\n pdfExport?: boolean,\n xlsExport?: boolean,\n enable?: boolean,\n cssClass?: 'left' | 'right' | 'center',\n dynCssClass?: (dataItem: any) => string,\n pipes?: IPipeDefinition[],\n tooltipPipes?: IPipeDefinition[],\n defaultFilter?: any,\n field?: string,\n sortable?: boolean,\n title?: string,\n tooltip?: (dataItem: any) => string,\n iconClass?: (dataItem: any) => string\n icon?: (dataItem: any) => ApIconType\n }) {\n super(options);\n this.title = options.title ? options.title : ' ';\n this.iconClass = options.iconClass ?\n (dataItem) => dataItem === undefined ?\n undefined : options.iconClass(dataItem) : () => undefined;\n this.icon = options.icon ?\n (dataItem) => dataItem === undefined ?\n undefined : options.icon(dataItem) : () => undefined;\n this.tooltip = options.tooltip ? super.getTooltip(options.tooltip) : () => undefined;\n }\n\n}\n","export enum ApIconType {\n ApDashboardIcon = 'ap-dashboard-icon',\n ApBaseDataIcon = 'ap-basedata-icon',\n ApUploadIcon = 'ap-upload-icon',\n ApFungiDetectIcon = 'ap-fungidetect-icon',\n ApDatabaseIcon = 'ap-database-icon',\n ApFileIcon = 'ap-file-icon',\n ApMapIcon = 'ap-map-icon',\n ApDocumentationIcon = 'ap-documentation-icon',\n ApContectIcon = 'ap-contact-icon',\n ApLegalIcon = 'ap-legal-icon',\n ApImprintIcon = 'ap-imprint-icon',\n ApAgreementIcon = 'ap-agreement-icon',\n ApExclamationCircleIcon = 'ap-exclamation-circle-icon',\n ApExclamationCircleSolidIcon = 'ap-exclamation-circle-solid-icon',\n ApCheckCircleIcon = 'ap-check-circle-icon',\n ApCheckCircleSolidIcon = 'ap-check-circle-solid-icon',\n ApTimesCircleIcon = 'ap-times-circle-icon',\n ApTimesCircleSolidIcon = 'ap-times-circle-solid-icon',\n ApBanSolidIcon = 'ap-ban-solid-icon',\n ApIconAdministration = 'ap-icon-administration',\n ApIconBaseFertilization = 'ap-icon-base-fertilization',\n ApIconBooking = 'ap-icon-booking',\n ApIconCollapse = 'ap-icon-collapse',\n ApIconEvaluation = 'ap-icon-evaluation',\n ApIconFieldWorks = 'ap-icon-field-works',\n ApIconFields = 'ap-icon-fields',\n ApIconImport = 'ap-icon-import',\n ApIconNFertilization = 'ap-icon-n-fertilization',\n ApIconPlantProtection = 'ap-icon-plant-protection',\n ApIconSeeding = 'ap-icon-seeding',\n ApIconSettings = 'ap-icon-settings',\n ApIconTasks = 'ap-icon-tasks',\n ApIconFarmRecords = 'ap-icon-farm-records',\n ApInfoIconRound = 'ap-info-icon-round'\n}\n","import {BehaviorSubject, Observable, of, Subscription} from 'rxjs';\nimport {\n ApDynformsConfigFieldset\n} from 'src/app/ap-dynforms/config/ap-dynforms-config-fieldset';\nimport {\n ApDynGridColumnConfigBase,\n ApDynGridColumnHideConfig\n} from 'src/app/ap-dyngrids/config/ap-dyn-grid-column-config-base';\nimport {\n ApDynGridPagerConfigBase\n} from 'src/app/ap-dyngrids/config/ap-dyn-grid-pager-config-base';\nimport {\n IPpPlanningWizardDetailsData,\n IPpPlanningWizardDetailsFormData,\n IPpPlanningWizardDetailsResponsiveData,\n IPpPlanningWizardSelectionGridData,\n IPpProductListGridItem,\n IPpWizardProvider,\n PpConstants,\n PpWizardStates,\n SlopeLevel\n} from '../pp-planning-wizard.types';\nimport {OperationModesEnum} from '../../../../stores/common/operation-modes.store';\nimport {\n GetRoundNumericService\n} from '../../../../ap-utils/service/get-round-numeric.service';\nimport {SettingsStore} from '../../../../stores/base-data/settings.store';\nimport {ApDateService} from '../../../../ap-core/services/ap-date-service';\nimport {CampaignYearStore} from '../../../../stores/login/campaignyear.store';\nimport {nameOf} from '../../../../ap-core/utils/ap-name-of';\nimport {ApDynformsComponent} from '../../../../ap-dynforms/ap-dynforms.component';\nimport {EventEmitter, Injectable, TemplateRef} from '@angular/core';\nimport {\n ApDynGridPropertyColumnConfig\n} from '../../../../ap-dyngrids/config/ap-dyn-grid-property-column-config';\nimport {\n ApDynGridButtonColumnConfig\n} from '../../../../ap-dyngrids/config/ap-dyn-grid-button-column-config';\nimport {ApUtilService} from '../../../../ap-utils/service/ap-util.service';\nimport {DetailsTargetRateUiProvider} from './ui-providers/details.target-rate.ui-provider';\nimport {DetailsUniformUiProvider} from './ui-providers/details.uniform.ui-provider';\nimport {\n PlantProtectionProductStore\n} from '../../../../stores/base-data/plantprotection.product.store';\nimport {\n ApTranslationService\n} from '../../../../ap-utils/service/ap-translation.service';\nimport {MachineStore} from '../../../../stores/docu/machine.store';\nimport {Create, ListSortOrder, ObjectFactory} from 'ts-tooling';\nimport {DetailsCommonUiProvider} from './ui-providers/details.common.ui-provider';\nimport {WorkTypeCategory, WorkTypes, WorkTypesStore} from '../../../../stores/base-data/worrktypes.store';\nimport {CropTypeStore} from '../../../../stores/base-data/crop.types.store';\nimport {GetRoundNumericPipe} from '../../../../ap-utils';\nimport {LoginStore} from '../../../../stores/login/login.store';\nimport {\n ApDynGridIconColumnConfig\n} from '../../../../ap-dyngrids/config/ap-dyn-grid-icon-column-config';\nimport {ApIconType} from '../../../../icons/ap-icon-type';\nimport {\n DetailsTargetRateMapPerFieldUiProvider\n} from './ui-providers/details.target-rate-map-per-field.ui-provider';\nimport {\n NFertilizationPlantProtectionService\n} from '../../../../services/data/n-fertilization-plant-protection.service';\nimport {\n ApplicationSettingsService\n} from '../../../../services/data/application-settings.service';\nimport {\n GetGrowthStageData\n} from '../../../../types/n-fertilization-plant-protection.types';\nimport {PpPlanningWizardSelectionService} from '../services/pp-planning-wizard-selection.service';\nimport {\n DetailsTargetRateMapPerPlanUiProvider\n} from './ui-providers/details.target-rate-map-per-plan.ui-provider';\nimport {\n ApColumnState\n} from '../../../../ap-interface/enums/ap-column-state.enum';\nimport {ApplicationModesEnum} from '../../../../stores/common/appl-modes.store';\nimport {IOperationModeAppSetting} from '../../../../types/application-settings.types';\nimport {\n AgriportConstantsService\n} from '../../../../services/common/agriport-constants.service';\nimport {\n AgriportConstantsEnum\n} from '../../../../ap-interface/enums/ap-agriport-constants.enum';\nimport IWorktypes = Data.BaseData.IWorktypes;\nimport IPlantProtectionProduct = Data.BaseData.IPlantProtectionProduct;\nimport IPlantProtectionProductDetails = Data.BaseData.IPlantProtectionProductDetails;\nimport IPlantProtectionProductListDetails = Data.TaskManagement.IPlantProtectionProductListDetails;\nimport IApplicationSettings = Data.Agronomic.IApplicationSettings;\n\n// ATTENTION: injectable 'root' is very convenient in here because we can inject all needed stores.\n// BUT: This will reuse THE SAME instance of the provider every time. Therefor we need to carefully handle the 'onDestroy' method!\n@Injectable({providedIn: 'root'})\nexport class PpPlanningWizardDetailsProvider implements IPpWizardProvider {\n\n /**\n * More or less fixed data variables\n * (They are only set once on initialization)\n */\n private _eppoCodes: string[] = [];\n private _dynForm: ApDynformsComponent;\n private _productsTemplateRef: TemplateRef;\n private _subscriptions: Subscription[] = [];\n private _validWorkTypes: IWorktypes[] = [];\n private _addProductCallback: EventEmitter;\n private _selectedGridData: IPpPlanningWizardSelectionGridData[];\n private _operationModeAppSettings: IOperationModeAppSetting[];\n private _hideMinMaxColumns$: BehaviorSubject = new BehaviorSubject(false);\n\n /**\n * These values might change during the lifetime of this wizard(step)\n */\n private _detailsData: IPpPlanningWizardDetailsData = undefined;\n private _caption$: BehaviorSubject;\n private _fieldSets$: BehaviorSubject;\n /**\n * Variable to keep track of all responsive values.\n * These values might change due to user input (or subsequent logic)\n */\n private _responsiveData: IPpPlanningWizardDetailsResponsiveData;\n\n /**\n * form properties which might trigger the ui to rebuild or other values to change\n */\n private _uiResponsiveProperties = [\n nameOf('OperationModeKey'),\n nameOf('WorkType')\n ];\n private _dataResponsiveProperties = [\n nameOf('WorkType'),\n nameOf('ECStage'),\n nameOf('WaterAvg'),\n nameOf('WaterRange'),\n nameOf('PreProductId'),\n nameOf('PreAvgAmount'),\n nameOf('Machine')\n ];\n\n constructor(private settingsStore: SettingsStore,\n private dateService: ApDateService,\n private campaignYearStore: CampaignYearStore,\n private machineStore: MachineStore,\n private workTypesStore: WorkTypesStore,\n private cropTypesStore: CropTypeStore,\n private loginStore: LoginStore,\n private plantProtectionProductStore: PlantProtectionProductStore,\n private translationService: ApTranslationService,\n private roundNumericService: GetRoundNumericService,\n private agriportConstantsService: AgriportConstantsService,\n private applicationSettingsService: ApplicationSettingsService,\n private ppPlanningWizardSelectionService: PpPlanningWizardSelectionService,\n private nFertilizationPlantProtectionService: NFertilizationPlantProtectionService,\n private detailsCommonUiProvider: DetailsCommonUiProvider,\n private detailsUniformUiProvider: DetailsUniformUiProvider,\n private detailsTargetRateUiProvider: DetailsTargetRateUiProvider,\n private detailsTargetRateMapPerFieldUiProvider: DetailsTargetRateMapPerFieldUiProvider,\n private detailsTargetRateMapPerPlanUiProvider: DetailsTargetRateMapPerPlanUiProvider,\n private roundNumericPipe: GetRoundNumericPipe) {\n }\n\n /**\n * Initializes this wizard step's provider instance\n * @public\n */\n public init(caption$: BehaviorSubject,\n fieldSets$: BehaviorSubject,\n dynForm: ApDynformsComponent,\n productsTemplateRef: TemplateRef,\n productListItems$: BehaviorSubject): void {\n this._responsiveData = {\n PreselectedProductDetail$: new BehaviorSubject(undefined),\n AddProductButtonDisabled$: new BehaviorSubject(true),\n PreselectValidProducts$: new BehaviorSubject([]),\n PreselectedMaxProductRate$: new BehaviorSubject(0),\n PreselectedMinProductRate$: new BehaviorSubject(0),\n ProductListItems$: productListItems$,\n MaxWaterRange$: new BehaviorSubject(PpConstants.MAX_WATER),\n MinWaterAvg$: new BehaviorSubject(0)\n };\n this._operationModeAppSettings = [];\n this._addProductCallback = ApUtilService.createEventEmitter(this.addProduct.bind(this), this._subscriptions);\n this._caption$ = caption$;\n this._fieldSets$ = fieldSets$;\n this._dynForm = dynForm;\n this._productsTemplateRef = productsTemplateRef;\n }\n\n /**\n * Generates field statistics for the currently selected grid data\n * Calls the planning wizard selection service to create statistical information about the selected fields\n * @public\n */\n public onGenerateStatistic(): void {\n if (!this._selectedGridData) {\n return;\n }\n this.ppPlanningWizardSelectionService.generateFieldStatistic(this._selectedGridData, this._selectedGridData);\n }\n\n /**\n * Main method for handling user input.\n * Depending on the changed form values other values get changed or the ui is rebuilt\n * @param valueChangesArgs eventArgs from form's valueChanged event\n * @public\n */\n public onFormValueChanges(valueChangesArgs: { control: string; value: any }): void {\n /**\n * we need to update UI, Data or Observables only after user changed certain properties:\n */\n if (!this._uiResponsiveProperties.Exists(p => p === valueChangesArgs.control) &&\n !this._dataResponsiveProperties.Exists(p => p === valueChangesArgs.control)) {\n return;\n }\n\n /**\n * retrieve current values from the form\n * and modify its values if needed or rebuild UI if needed\n * also set operation mode app settings and control factor\n */\n this.updateDetailsData();\n\n /**\n * User changes 'OperationMode'\n * => hiding min and max columns for product data in case if operation mode is Constant\n * => calculating nuptake average\n */\n if (valueChangesArgs.control === nameOf('OperationModeKey')) {\n this._hideMinMaxColumns$.next(this._detailsData.FormData.OperationModeKey === OperationModesEnum.Constant);\n this._detailsData.FormData.NUptakeAverage = this.calculateNUptakeAreaWightedAverage(this._selectedGridData,\n this._detailsData.FormData.OperationModeKey);\n }\n\n /**\n * User changes 'OperationMode'\n * => define it`s operation key which is used for comparison on different steps and form changes\n */\n if (valueChangesArgs.control === nameOf('OperationModeKey') ||\n valueChangesArgs.control === nameOf('WorkType')) {\n // set defaults if values are not defined, yet\n this._detailsData.FormData.WaterAvg ??= 200;\n this._detailsData.FormData.WaterRange ??= 100;\n this.updateWaterMinMaxValues(this._detailsData.FormData);\n }\n\n /**\n * User changes 'OperationMode' or 'EC-value', ...\n * => reset product data because this depends on operationMode and EC\n */\n if (valueChangesArgs.control === nameOf('OperationModeKey') ||\n valueChangesArgs.control === nameOf('ECStage') ||\n valueChangesArgs.control === nameOf('WorkType') ||\n valueChangesArgs.control === nameOf('WaterAvg') ||\n valueChangesArgs.control === nameOf('WaterRange')) {\n this._responsiveData?.ProductListItems$.next([]);\n this._responsiveData?.PreselectedProductDetail$.next(undefined);\n\n this._detailsData.FormData.PreProductId = undefined;\n this._detailsData.FormData.PreAvgAmount = undefined;\n this._detailsData.FormData.PreMaxAmount = undefined;\n this._detailsData.FormData.PreMinAmount = undefined;\n\n // Reset workType to 'spraying' if it's not a uniform planning\n if (valueChangesArgs.value !== OperationModesEnum.Constant) {\n this._detailsData.FormData.WorkType = WorkTypes.Spraying;\n }\n\n // Only when changing control mode\n if (valueChangesArgs.control === nameOf('OperationModeKey')\n && (this._detailsData?.FormData.OperationModeKey === OperationModesEnum.PpTargetMapPerField\n || this._detailsData?.FormData.OperationModeKey === OperationModesEnum.PPTargetMapPerPlan)\n ) {\n this.nFertilizationPlantProtectionService.onApplicationSettingsTextWarning(\n this._selectedGridData.map(x => x.ScanData),\n this._detailsData.OperationModeAppSetting.ApplicationSetting);\n if (!Number.isFinite(this._detailsData.FormData.ECStage)) {\n this._detailsData.FormData.ECStage = this.getMaxGrowthStageFromFields(this._selectedGridData,\n this._detailsData.OperationModeAppSetting.ApplicationSetting);\n }\n }\n\n this.updateValidProducts(this._detailsData.FormData);\n this.patchForm();\n }\n\n /**\n * User updates the used machine\n * => update driver/instrument with the default values if not set by user already\n */\n if (valueChangesArgs.control === nameOf('Machine')\n && this._detailsData?.FormData.Machine?.toString()?.length > 0) {\n this._detailsData.FormData.Driver = this._detailsData.FormData.Driver?.toString()?.length > 0\n ? this._detailsData.FormData.Driver\n : this.machineStore.getMachineById(this._detailsData.FormData.Machine)?.DefaultDriver?.Id;\n this._detailsData.FormData.Instrument = this._detailsData.FormData.Instrument?.toString()?.length > 0\n ? this._detailsData.FormData.Instrument\n : this.machineStore.getMachineById(this._detailsData.FormData.Machine)?.DefaultInstrument?.Id;\n this.patchForm();\n }\n\n /**\n * User updates water values (applies for ps-target only)\n * => update min/max fields according to user input\n */\n if (valueChangesArgs.control === nameOf('WaterAvg')\n || valueChangesArgs.control === nameOf('WaterRange')) {\n if (this._detailsData?.FormData.OperationModeKey === OperationModesEnum.PpTarget\n || this._detailsData?.FormData.OperationModeKey === OperationModesEnum.PpTargetMapPerField\n || this._detailsData?.FormData.OperationModeKey === OperationModesEnum.PPTargetMapPerPlan) {\n this.updateWaterMinMaxValues(this._detailsData.FormData);\n this.patchForm();\n }\n }\n\n /**\n * User selected a product for adding it to the product selection grid\n * - reset the amount input for the newly selected product\n * - update the max amount limit\n * - update the product avg/max labels\n */\n if (valueChangesArgs.control === nameOf('PreProductId')) {\n this._responsiveData?.PreselectedMinProductRate$.next(0);\n this._responsiveData?.PreselectedMaxProductRate$.next(0);\n this._responsiveData?.PreselectedProductDetail$.next(this._responsiveData.PreselectValidProducts$.value\n .FirstOrDefault(p => p.Id === this._detailsData.FormData.PreProductId)?.ProductDetails?.FirstOrDefault());\n this._detailsData.FormData.PreAvgAmount = undefined;\n this._detailsData.FormData.PreMinAmount = this.calculateProductMinRate(this._detailsData.FormData,\n this._responsiveData?.PreselectedProductDetail$?.value);\n this._detailsData.FormData.PreMaxAmount = this.calculateProductMaxRate(this._detailsData.FormData,\n this._responsiveData?.PreselectedProductDetail$?.value);\n this._responsiveData?.PreselectedMaxProductRate$.next(this._detailsData.FormData.PreMaxAmount ?? 0);\n this._responsiveData?.PreselectedMinProductRate$.next(this._detailsData.FormData.PreMinAmount ?? 0);\n this.patchForm();\n }\n\n /**\n * Update behaviour subjects for product template\n * - the 'add product to list' button according to a selected product and avg value\n * - preselected product's detail to update the product labels and max values\n */\n this._responsiveData?.AddProductButtonDisabled$.next(!(this._detailsData.FormData.PreProductId != null && this._detailsData.FormData.PreAvgAmount > 0)\n || this._responsiveData?.ProductListItems$?.value?.length >= PpConstants.MAX_SELECTABLE_PRODUCTS);\n\n /**\n * if user did not change anything which effects the ui (rebuild fieldSets)\n * => we can exit here\n */\n if (!this._uiResponsiveProperties.Exists(p => p === valueChangesArgs.control)) {\n return;\n }\n\n /**\n * Update UI according to new values of the form\n * and patch the values again for the updated form\n */\n this.updateFieldSets();\n this.patchForm(true); // trigger validations after rebuilding UI\n }\n\n /**\n * Updates minimum and maximum water values based on average and range\n * Updates related BehaviorSubjects for UI constraints\n * @param formData Current form data object\n * @private\n */\n private updateWaterMinMaxValues(formData: IPpPlanningWizardDetailsFormData): void {\n formData.WaterMin = formData.WaterAvg <= 0 ? undefined : +formData.WaterAvg - +(formData.WaterRange ?? 0);\n formData.WaterMax = formData.WaterAvg <= 0 ? undefined : +formData.WaterAvg + +(formData.WaterRange ?? 0);\n this._responsiveData?.MaxWaterRange$.next(Math.min(formData.WaterAvg ?? PpConstants.MAX_WATER, PpConstants.MAX_WATER));\n this._responsiveData?.MinWaterAvg$.next(Math.max(formData.WaterRange ?? 0, 0));\n }\n\n /**\n * Method applies current data transfer object (formDto) to the reactive form\n * without emitting new events to avoid triggering onFormValueChanges again.\n * @param triggerValidation true to trigger validations for the whole form\n * @private\n */\n private patchForm(triggerValidation?: boolean): void {\n setTimeout(() => {\n this._dynForm.form.patchValue(this._detailsData.FormData, {emitEvent: false});\n if (triggerValidation) {\n setTimeout(() => this._dynForm.markAsTouched(), 0);\n }\n }, 0);\n }\n\n /**\n * Builds the INITIAL details form data object which is used to patch values to the fieldSets\n * @param data the items which were selected by user in selection wizard step\n * @public\n */\n public buildItem(data: IPpPlanningWizardSelectionGridData[]): IPpPlanningWizardDetailsData {\n this._selectedGridData = data;\n this._operationModeAppSettings = this.getOperationModeAppSettings(data);\n this._validWorkTypes = this.getValidWorkTypes();\n this.ppPlanningWizardSelectionService.generateFieldStatistic(data, data);\n const endOfCampaignYear = this.dateService.toJsDate(\n this.dateService.toFarmDateFromUtc(this.campaignYearStore.getSelectedCampaignYear().DefaultEnd)\n );\n const cropName = data?.FirstOrDefault()?.Crop ?? '-';\n const cropType = this.cropTypesStore.getDefaultCroptype(data?.FirstOrDefault()?.CropId);\n // update current eppoCodes defined by the crop of the selected fields\n // - new planning allows fields with the same crops, only\n // - crop has a main eppoCode\n // - crop may be part of hierarchical eppo groups (e.g. Winter Wheat is part of the group of (general) Wheat)\n this._eppoCodes = [];\n if (cropType != null) {\n if (cropType.Eppocode?.length > 0) {\n this._eppoCodes.push(cropType.Eppocode);\n }\n if (cropType.EppoGroups?.length > 0) {\n this._eppoCodes.AddRange(cropType.EppoGroups.filter(e => e?.length > 0));\n }\n }\n // In case the user changed the crop while navigating back to the selection grid\n // we need to reset the product selection\n if (this._detailsData?.FormData.Crop !== cropName) {\n this._responsiveData?.ProductListItems$?.next([]);\n this._responsiveData?.PreselectValidProducts$.next([]);\n if (this._detailsData?.FormData.ECStage > 0) {\n this._detailsData.FormData.ECStage = undefined;\n }\n }\n const totalArea = this.roundNumericService.round(\n data.reduce((sum, s) => sum + Create(s?.Area, 0), 0),\n this.settingsStore.FirstSetting.DigitsAfterDecimalPoint\n );\n const selectedOperationSetting = this.getOperationModeAppSettingsOrDefault(\n this._detailsData?.FormData?.OperationModeKey);\n const nUptakeAverage = this.calculateNUptakeAreaWightedAverage(data, selectedOperationSetting?.OperationMode);\n // apply changes to already existing formData\n // the user navigated back/forward through the wizard, and we\n // want to keep the previous values as much as possible\n if (!!this._detailsData) {\n this._detailsData.FormData.TotalArea = totalArea;\n this._detailsData.FormData.CountFields = data?.length;\n this._detailsData.FormData.Crop = cropName; // new pp planning only allowed for ONE distinct crop\n this._detailsData.FormData.OperationModeKey = selectedOperationSetting?.OperationMode;\n this._detailsData.FormData.NUptakeAverage = nUptakeAverage;\n this._detailsData.FormData.PreProductId = undefined;\n this._detailsData.ControlFactor = this.getControlFactor(selectedOperationSetting?.ApplicationSetting);\n this._detailsData.OperationModeAppSetting = selectedOperationSetting;\n } else {\n this._detailsData = {\n FormData: {\n TotalArea: totalArea,\n CountFields: data?.length,\n Crop: cropName, // new pp planning only allowed for ONE distinct crop\n OperationModeKey: selectedOperationSetting?.OperationMode,\n WorkType: WorkTypes.Spraying,\n ApplicationDate: new Date(Math.min(new Date().valueOf(), endOfCampaignYear.valueOf())),\n NUptakeAverage: nUptakeAverage,\n ECStage: this.getMaxGrowthStageFromFields(data, selectedOperationSetting?.ApplicationSetting),\n Note: '',\n Threshold: undefined,\n WaterAvg: undefined,\n WaterMax: undefined,\n WaterMin: undefined,\n WaterRange: undefined,\n WaterSetZeroAtMin: false,\n PreProductId: undefined,\n PreAvgAmount: undefined,\n PreMaxAmount: undefined,\n PreMinAmount: undefined,\n Instrument: undefined,\n Driver: undefined,\n Machine: undefined\n },\n ControlFactor: this.getControlFactor(selectedOperationSetting?.ApplicationSetting),\n OperationModeAppSetting: selectedOperationSetting\n };\n }\n return this._detailsData;\n }\n\n /**\n * Creates columns for the product grid (on details form)\n * @public\n */\n public getProductListColumns(): ApDynGridColumnConfigBase[] {\n return [\n new ApDynGridPropertyColumnConfig({\n field: nameOf('ProductName'),\n style: {fontWeight: 'bold'},\n tooltip: (dataItem: IPpProductListGridItem) => this.generateProductNameTooltip(dataItem)\n }),\n new ApDynGridPropertyColumnConfig({\n field: nameOf('Min'),\n width: 60,\n cssClass: 'right',\n style: {fontSize: '12px'},\n hide: new ApDynGridColumnHideConfig({\n selfHide: this._hideMinMaxColumns$\n }),\n pipes: [{\n pipe: this.roundNumericPipe,\n args: [this.settingsStore.FirstSetting?.DigitsAfterDecimalPoint]\n }]\n }),\n new ApDynGridPropertyColumnConfig({\n field: nameOf('ApplRate'),\n width: 60,\n cssClass: 'right',\n style: {fontWeight: 'bold'},\n pipes: [{\n pipe: this.roundNumericPipe,\n args: [this.settingsStore.FirstSetting?.DigitsAfterDecimalPoint]\n }]\n }),\n new ApDynGridPropertyColumnConfig({\n field: nameOf('Max'),\n width: 60,\n cssClass: 'right',\n style: {fontSize: '12px'},\n hide: new ApDynGridColumnHideConfig({\n selfHide: this._hideMinMaxColumns$\n }),\n pipes: [{\n pipe: this.roundNumericPipe,\n args: [this.settingsStore.FirstSetting?.DigitsAfterDecimalPoint]\n }]\n }),\n new ApDynGridPropertyColumnConfig({\n field: nameOf('UnitExpr'),\n width: 60\n }),\n new ApDynGridIconColumnConfig({\n cssClass: 'center',\n tooltip: (dataItem: IPpProductListGridItem) => dataItem?.GrowthStageDefined === false ? 'NO_GROWTH_STAGE_DEFINED' : '',\n iconClass: () => 'ap-icon-medium',\n icon: (dataItem: IPpProductListGridItem) => dataItem?.GrowthStageDefined === false ? ApIconType.ApInfoIconRound : undefined,\n width: 40\n }),\n new ApDynGridButtonColumnConfig(\n {\n tooltip: 'Global__Delete',\n callback: ApUtilService.createEventEmitter(this.deleteProduct.bind(this), this._subscriptions),\n isStandardIcon: true,\n standardIcon: nameOf('ButtonIconName')\n }\n )];\n }\n\n /**\n * Whenever conditions changes (Ec-value, worktype, etc...)\n * the product selection needs an update. This method updates the source\n * of the corresponding comboBox\n * @private\n */\n private updateValidProducts(formData: IPpPlanningWizardDetailsFormData): void {\n /**\n * basic condition to show products\n */\n if (formData.ECStage == null || formData.ECStage < 0) {\n this._responsiveData?.PreselectValidProducts$.next([]);\n return;\n }\n\n /**\n * if the workType is spraying\n * the water field is mandatory to be able to choose a product\n */\n if (formData.WorkType === WorkTypes.Spraying\n && (this._detailsData.FormData.WaterAvg == null || formData.WaterAvg <= 0)) {\n this._responsiveData?.PreselectValidProducts$.next([]);\n return;\n }\n\n /**\n * PS-target product conditions:\n * - workType: spray (because it's mixed with water)\n * - all water fields (avg and range) are mandatory\n * - matching the field's crop (field eppoCode == product eppoCode)\n * - matching EC value\n */\n if ((formData.OperationModeKey === OperationModesEnum.PpTarget\n || formData.OperationModeKey === OperationModesEnum.PpTargetMapPerField\n || formData.OperationModeKey === OperationModesEnum.PPTargetMapPerPlan) &&\n (formData.WaterRange == null || formData.WaterRange <= 0)) {\n this._responsiveData?.PreselectValidProducts$.next([]);\n return;\n }\n\n /**\n * Finally find the matching products\n */\n const selectableProducts = this.getSelectableProducts();\n const validProducts: IPlantProtectionProduct[] = [];\n for (const ppProduct of selectableProducts) {\n const validDetails = ppProduct.ProductDetails\n .filter(d => formData.ECStage >= d.EcMin &&\n formData.ECStage <= d.EcMax &&\n this._eppoCodes?.Contains(d.EppoCrop) &&\n d.WorkType?.Id === formData.WorkType &&\n !this._responsiveData?.ProductListItems$?.value?.Any(p =>\n p.ProductListItem?.Product?.Id === d.ProductId)\n );\n if (validDetails?.length <= 0) {\n continue;\n }\n\n // here we create a copy of the original product to\n // be able to have a ONLY ONE product detail which actually applies for this planning\n const validProduct = ObjectFactory.Copy(ppProduct);\n validProduct.ProductDetails = [this.findMaxProductDetail(validDetails)];\n validProducts.push(validProduct);\n }\n this._responsiveData?.PreselectValidProducts$.next(validProducts?.SortBy([nameOf('ProductName')], [ListSortOrder.ASC]));\n }\n\n /**\n * Products which are selectable (without any restriction on eppoCodes, ...)\n * These products are valid in the matter of:\n * - Selectable\n * - not deleted\n * - product's permission is still valid\n * @private\n */\n private getSelectableProducts(): IPlantProtectionProduct[] {\n return this.plantProtectionProductStore.Listen(p => p.data).getValue()\n .filter(p => p.Selectable && p.DeletedAt == null &&\n new Date(p.UseByDate) >= this.dateService.getDateMidnight(new Date()));\n }\n\n /**\n * Adds a new product to the product selection grid based on the currently selected product and amount\n * Validates the product can be added, creates a grid item with appropriate properties,\n * updates the product list, and resets the form fields for the next product selection\n * @public\n */\n public addProduct(): void {\n this.updateDetailsData();\n const selectedProducts = this._responsiveData?.ProductListItems$.getValue();\n const productToAdd = this._responsiveData?.PreselectValidProducts$.getValue()\n .FirstOrDefault(p => p.Id === this._detailsData.FormData.PreProductId);\n const avgAmount = +this._detailsData.FormData.PreAvgAmount;\n const maxAmount = +this._detailsData.FormData.PreMaxAmount;\n\n const minWater = +this._detailsData.FormData.WaterMin;\n const maxWater = +this._detailsData.FormData.WaterMax;\n const avgWater = +this._detailsData.FormData.WaterAvg;\n\n if (!productToAdd || selectedProducts.Any(p => p?.ProductListItem?.Product?.Id === productToAdd.Id) ||\n avgAmount <= 0 || maxAmount <= 0) {\n return;\n }\n\n // We need to map from product's details to product list details\n // It might seem weird, but we need to save the current product details as\n // a simplified version attached to the created planBook.\n // Reason: The original product details might change over time\n // by re-importing BVL product data (external product source from the government)\n const productDetail = productToAdd?.ProductDetails?.FirstOrDefault();\n const productListDetail: IPlantProtectionProductListDetails = {\n Id: productDetail?.Id,\n AmountMax: productDetail?.AmountMax,\n WorkType: productDetail?.WorkType?.Id,\n EcMax: productDetail?.EcMax,\n EcMin: productDetail?.EcMin,\n EppoCrop: productDetail?.EppoCrop,\n EffectiveRange: productDetail?.EffectiveRange?.Id,\n EppoHarmfulOrganism: productDetail?.EppoHarmfulOrganism\n };\n const productToAddGridItem: IPpProductListGridItem = {\n ProductListItem: {\n ProductListDetails: productListDetail,\n Product: productToAdd,\n ProductRate: avgAmount,\n FarmId: this.loginStore.SelectedFarmId,\n PlanId: undefined,\n Id: undefined,\n Unit: productDetail?.Unit\n },\n ProductName: this.generateProductName(productToAdd, productDetail),\n Min: Number.isFinite(avgWater) ? minWater * avgAmount / avgWater : undefined,\n Max: Number.isFinite(avgWater) ? maxWater * avgAmount / avgWater : undefined,\n ApplRate: avgAmount,\n UnitExpr: this.translationService.translate(productDetail?.Unit?.Key),\n GrowthStageDefined: productDetail?.GrowthStageDefined,\n ButtonIconName: 'delete'\n };\n\n this._responsiveData?.ProductListItems$.next([...selectedProducts, ...[productToAddGridItem]]);\n\n this._detailsData.FormData.PreProductId = undefined;\n this._detailsData.FormData.PreAvgAmount = undefined;\n this._detailsData.FormData.PreMaxAmount = undefined;\n this._detailsData.FormData.PreMinAmount = undefined;\n this.patchForm();\n this._responsiveData?.PreselectedProductDetail$.next(undefined);\n this._responsiveData?.AddProductButtonDisabled$.next(true);\n this.updateValidProducts(this._detailsData.FormData);\n }\n\n /**\n * Removes a product from the grid when the delete button is clicked\n * Updates the grid data source and refreshes the valid products list\n * @param dataItem The product item to be deleted from the grid\n * @public\n */\n public deleteProduct(dataItem: IPpProductListGridItem): void {\n this.updateDetailsData();\n const selectedProducts = this._responsiveData?.ProductListItems$.getValue();\n this._responsiveData?.ProductListItems$.next(selectedProducts.filter(p => p.ProductListItem?.Product?.Id !== dataItem?.ProductListItem?.Product?.Id));\n this.updateValidProducts(this._detailsData.FormData);\n }\n\n /**\n * Finds the most suitable detail of the product\n * In general there is only one product detail for an eppo-code, EC and worktype\n * combination => but in case of BVL data inconsistencies we take the details with the largest amount\n * @param productDetails\n * @private\n */\n private findMaxProductDetail(productDetails: IPlantProtectionProductDetails[]): IPlantProtectionProductDetails {\n if (!productDetails || productDetails?.length <= 0) {\n return undefined;\n }\n let maxDetail: IPlantProtectionProductDetails;\n for (const productDetail of productDetails) {\n if (!maxDetail || maxDetail.AmountMax < productDetail?.AmountMax) {\n maxDetail = productDetail;\n }\n }\n return maxDetail;\n }\n\n /**\n * Calculates the maximum rate of a product based on the current operation mode\n * For constant mode: returns the product's maximum amount\n * For target modes: calculates based on water average and maximum values\n * @param formData Current form data containing operation mode and water parameters\n * @param preselectedProductDetails Details of the selected product\n * @returns The calculated maximum rate or undefined if conditions aren't met\n * @private\n */\n private calculateProductMaxRate(formData: IPpPlanningWizardDetailsFormData,\n preselectedProductDetails: IPlantProtectionProductDetails | undefined): number | undefined {\n // no product selected\n if (!preselectedProductDetails) {\n return undefined;\n }\n const maxAmount = +preselectedProductDetails.AmountMax;\n switch (formData.OperationModeKey) {\n case OperationModesEnum.Constant:\n return maxAmount;\n case OperationModesEnum.PpTarget:\n case OperationModesEnum.PpTargetMapPerField:\n case OperationModesEnum.PPTargetMapPerPlan:\n if (!Number.isFinite(formData.WaterAvg) || formData.WaterAvg <= 0\n || !Number.isFinite(formData.WaterMax) || formData.WaterMax <= 0) {\n return undefined;\n }\n const calculationResult = maxAmount * +formData.WaterAvg / +formData.WaterMax;\n return this.roundNumericService.roundAsNumber(calculationResult, 3);\n default:\n return undefined;\n }\n }\n\n /**\n * Calculates the minimum rate of a product based on the current form data\n * Uses a predefined constant to determine the minimum product rate relative to the maximum rate\n * Calculation takes into account water average and minimum values\n * @param formData Current form data containing water and product parameters\n * @param preselectedProductDetails\n * @returns The calculated minimum rate or undefined if conditions aren't met\n * @private\n */\n private calculateProductMinRate(formData: IPpPlanningWizardDetailsFormData,\n preselectedProductDetails: IPlantProtectionProductDetails | undefined): number | undefined {\n // no product selected\n if (!preselectedProductDetails) {\n return undefined;\n }\n const minProductOfProductMax = +this.agriportConstantsService.GetConstant(AgriportConstantsEnum.PpMinProductOfProductMax);\n const maxAmount = +preselectedProductDetails.AmountMax;\n switch (formData.OperationModeKey) {\n case OperationModesEnum.Constant:\n return maxAmount * minProductOfProductMax;\n case OperationModesEnum.PpTarget:\n case OperationModesEnum.PpTargetMapPerField:\n case OperationModesEnum.PPTargetMapPerPlan:\n if (!Number.isFinite(formData.WaterAvg) || formData.WaterAvg <= 0\n || !Number.isFinite(formData.WaterMin) || formData.WaterMin <= 0\n || formData.WaterAvg < formData.WaterMin) {\n return undefined;\n }\n const calculationResult = maxAmount * minProductOfProductMax * +formData.WaterAvg / +formData.WaterMin;\n return this.roundNumericService.roundAsNumber(calculationResult, 3);\n default:\n return undefined;\n }\n }\n\n /**\n * Leaving the details wizard step.\n * Extract the current form's value to be able to restore them once the user comes back.\n * Returns copy of form data object.\n * @public\n */\n public onLeave(): IPpPlanningWizardDetailsData {\n this._selectedGridData = undefined;\n this.ppPlanningWizardSelectionService.generateFieldStatistic([], []);\n this.updateDetailsData();\n return ObjectFactory.Copy(this._detailsData);\n }\n\n /**\n * Finds all worktypes with the following conditions:\n * - it is a plant protection worktype\n * - its 'spray' worktype (we always need this, because it's the default)\n * - or it's a worktype of the selectable products of the farm\n * @private\n */\n private getValidWorkTypes(): IWorktypes[] {\n const selectedWorkTypeIdsByProduct = this.getSelectableProducts()\n .map(p => p.ProductDetails)\n .flat().map(d => d.WorkType?.Id);\n\n return this.workTypesStore.Listen(s => s.data).getValue()\n .filter(w => w.Category === WorkTypeCategory.PlantProtection &&\n (w.Id === WorkTypes.Spraying || selectedWorkTypeIdsByProduct.Contains(w.Id)));\n }\n\n /**\n * Creates a display name for a product by combining product name and effective range\n * @param product The plant protection product\n * @param productDetail The specific detail of the product\n * @returns Formatted product name string\n * @private\n */\n private generateProductName(product: IPlantProtectionProduct,\n productDetail: IPlantProtectionProductDetails | undefined): string {\n const productName = this.translationService.translate(product.ProductName);\n if (!!productDetail?.EffectiveRange?.Key) {\n const effectiveRange = this.translationService.translate(productDetail?.EffectiveRange?.Key);\n return `${effectiveRange} | ${productName}`;\n }\n return productName;\n }\n\n /**\n * Updates the UI caption when user navigates to the details step\n * Sets the caption to a generic \"Details\" label\n * @public\n */\n public updateCaption(): void {\n this._caption$.next('Global__Details');\n }\n\n /**\n * Rebuilds the form field sets based on the current operation mode\n * Adds common fields first, then specific fields based on the operation mode\n * Includes product selection and documentation fields when an operation mode is selected\n * @public\n */\n public updateFieldSets(): void {\n const generatedFieldSets = this.detailsCommonUiProvider.createGeneralFieldset(\n this._detailsData?.FormData?.OperationModeKey, this._operationModeAppSettings, this._validWorkTypes);\n switch (this._detailsData?.FormData?.OperationModeKey) {\n case OperationModesEnum.Constant:\n generatedFieldSets.AddRange(this.detailsUniformUiProvider.createUniformFieldset(this._detailsData?.FormData));\n break;\n case OperationModesEnum.PpTarget:\n generatedFieldSets.AddRange(this.detailsTargetRateUiProvider.createTargetRateFieldset(this._responsiveData));\n break;\n case OperationModesEnum.PpTargetMapPerField:\n generatedFieldSets.AddRange(this.detailsTargetRateMapPerFieldUiProvider.createTargetRateMapPerFieldFieldset(\n this._responsiveData));\n break;\n case OperationModesEnum.PPTargetMapPerPlan:\n generatedFieldSets.AddRange(this.detailsTargetRateMapPerPlanUiProvider.createTargetRateMapPerPlanFieldset(\n this._responsiveData));\n break;\n }\n if (this._detailsData?.FormData?.OperationModeKey?.length > 0) {\n generatedFieldSets.AddRange(this.detailsCommonUiProvider.createProductsFieldset(this._productsTemplateRef,\n this._responsiveData, this._addProductCallback));\n generatedFieldSets.Add(this.detailsCommonUiProvider.createDocuFieldSet());\n }\n this._fieldSets$.next(generatedFieldSets);\n }\n\n /**\n * Handles cleanup when the component is destroyed\n * Unsubscribes from all subscriptions and resets data variables\n * @public\n */\n public onDestroy(): void {\n this._responsiveData = undefined;\n this._detailsData = undefined;\n this._selectedGridData = undefined;\n this._subscriptions?.forEach(s => s.unsubscribe());\n this._subscriptions = [];\n }\n\n /**\n * Handler for grid selection changes\n * Implementation of interface method (currently empty)\n * @param _items Selected grid items\n * @public\n */\n public onGridSelectionChanged(_items: IPpPlanningWizardSelectionGridData[]): void {\n // only for interface => nothing to do here\n }\n\n /**\n * Returns grid column configuration\n * Implementation of interface method\n * @returns Observable with empty array (no columns defined in this provider)\n * @public\n */\n public getGridColumnConfig(): Observable {\n return of([]);\n }\n\n /**\n * Returns pager configuration for the grid\n * Implementation of interface method\n * @param _breadCrumbsColumns Array of wizard states for breadcrumbs\n * @returns Undefined as no pager configuration is needed\n * @public\n */\n public getPagerConfig(_breadCrumbsColumns: PpWizardStates[]): ApDynGridPagerConfigBase {\n return undefined;\n }\n\n /**\n * Updates the details data object with current form values\n * Sets the form data from raw form values, updates operation mode settings,\n * and recalculates control factor based on current application settings\n * @private\n */\n private updateDetailsData(): void {\n this._detailsData.FormData = this._dynForm.form.getRawValue() as IPpPlanningWizardDetailsFormData;\n this._detailsData.OperationModeAppSetting = this._operationModeAppSettings.find(x => x.OperationMode === this._detailsData.FormData.OperationModeKey);\n this._detailsData.ControlFactor = this.getControlFactor(this._detailsData.OperationModeAppSetting?.ApplicationSetting);\n }\n\n /**\n * Determines the control factor based on provided application settings\n * For numeric slope types, returns the first slope value\n * For dropdown slope types, returns the medium slope level or falls back to first slope value\n * @param applicationSettings The application settings containing slope parameters\n * @returns The calculated control factor or default (-1) if no valid slope type is found\n * @private\n */\n private getControlFactor(applicationSettings: IApplicationSettings | undefined): number {\n const defaultSlope = -1;\n switch (applicationSettings?.Parameter?.slopeType) {\n case 'numeric':\n return applicationSettings.Parameter.slope[0]?.Slope ?? defaultSlope;\n case 'dropDown':\n return applicationSettings.Parameter.slope?.find(x => x.Key === SlopeLevel.Medium)?.Slope\n ?? applicationSettings.Parameter.slope[0]?.Slope\n ?? defaultSlope;\n default:\n return defaultSlope;\n }\n }\n\n /**\n * Gets available operation mode settings based on field status\n * Different operation modes require fields with specific statuses\n * Adds special application settings for Agricon roles when scan data is available\n * @param data Selected field data\n * @returns Array of available operation mode application settings\n * @private\n */\n private getOperationModeAppSettings(data: IPpPlanningWizardSelectionGridData[]): IOperationModeAppSetting[] {\n if (!data) {\n return undefined;\n }\n const operationModeAppSettings: IOperationModeAppSetting[] = [];\n if (data.every(s => s.Status.state >= ApColumnState.Yellow)) {\n operationModeAppSettings.push({\n Id: OperationModesEnum.Constant,\n OperationMode: OperationModesEnum.Constant,\n ApplicationMode: ApplicationModesEnum.Constant,\n Text: OperationModesEnum.Constant,\n Category: 'OperationMode_Group_Task',\n ApplicationSetting: undefined\n });\n }\n if (data.TrueForAll(s => s.Status.state >= ApColumnState.Green)) {\n const eppoCode = this.ppPlanningWizardSelectionService.getEppoCodeFromSelectedFields(data);\n const ppTargetApplicationSettings = this.applicationSettingsService.getApplicationSettings(\n OperationModesEnum.PpTarget, eppoCode);\n operationModeAppSettings.push({\n Id: OperationModesEnum.PpTarget,\n Text: OperationModesEnum.PpTarget,\n OperationMode: OperationModesEnum.PpTarget,\n ApplicationMode: ApplicationModesEnum.Variable,\n Category: 'OperationMode_Group_Task',\n ApplicationSetting: ppTargetApplicationSettings\n });\n }\n const fieldsWithValidScanData = this.getFieldsWithValidScanData(data);\n if (fieldsWithValidScanData.length > 0) {\n const eppoCode = this.ppPlanningWizardSelectionService.getEppoCodeFromSelectedFields(data);\n const ppTargetMapPerFieldApplicationSettings = this.applicationSettingsService.getApplicationSettings(\n OperationModesEnum.PpTargetMapPerField, eppoCode);\n if (!!ppTargetMapPerFieldApplicationSettings) {\n operationModeAppSettings.push({\n Id: OperationModesEnum.PpTargetMapPerField,\n Text: OperationModesEnum.PpTargetMapPerField,\n OperationMode: OperationModesEnum.PpTargetMapPerField,\n ApplicationMode: ApplicationModesEnum.Variable,\n Category: 'OperationMode_Group_Map',\n ApplicationSetting: ppTargetMapPerFieldApplicationSettings\n });\n }\n const ppTargetMapPerAvgMapApplicationSettings = this.applicationSettingsService.getApplicationSettings(\n OperationModesEnum.PPTargetMapPerPlan, eppoCode);\n if (!!ppTargetMapPerAvgMapApplicationSettings) {\n operationModeAppSettings.push({\n Id: OperationModesEnum.PPTargetMapPerPlan,\n Text: OperationModesEnum.PPTargetMapPerPlan,\n OperationMode: OperationModesEnum.PPTargetMapPerPlan,\n ApplicationMode: ApplicationModesEnum.Variable,\n Category: 'OperationMode_Group_Map',\n ApplicationSetting: ppTargetMapPerAvgMapApplicationSettings\n });\n }\n }\n return operationModeAppSettings;\n }\n\n /**\n * Gets the operation mode setting by key or returns a default if not found\n * When only one operation mode is available, returns that one\n * @param operationModeEnum The operation mode key to search for\n * @returns Matching operation mode setting or default\n * @private\n */\n private getOperationModeAppSettingsOrDefault(operationModeEnum: OperationModesEnum | undefined): IOperationModeAppSetting | undefined {\n let existingOperationModeAppSetting: IOperationModeAppSetting | undefined;\n if (!!operationModeEnum) {\n existingOperationModeAppSetting = this._operationModeAppSettings.find(x => x.OperationMode === this._detailsData?.FormData?.OperationModeKey);\n }\n return this._operationModeAppSettings?.length === 1\n ? this._operationModeAppSettings[0]\n : existingOperationModeAppSetting;\n }\n\n /**\n * Determines the maximum growth stage across all selected fields\n * Uses scan data and application settings to calculate appropriate growth stage\n * @param data Selected field data containing scan information\n * @param applicationSettings Application settings to use for validation\n * @returns The maximum growth stage value or undefined if not determinable\n * @private\n */\n private getMaxGrowthStageFromFields(data: IPpPlanningWizardSelectionGridData[],\n applicationSettings: IApplicationSettings): number | undefined {\n if (!applicationSettings) {\n return undefined;\n }\n const scanData = this.getFieldsWithValidScanData(data).map(x => x.ScanData);\n if (!scanData || scanData.length === 0) {\n return undefined;\n }\n const scansByApplicationSettings = this.nFertilizationPlantProtectionService.getValidBestScansByApplicationSettings(\n scanData, applicationSettings);\n const growthStages = this.nFertilizationPlantProtectionService.getGrowStages(\n scansByApplicationSettings.map(x => ({ScanData: x} as GetGrowthStageData))\n );\n return growthStages.Max();\n }\n\n /**\n * Calculates the area-weighted average N-uptake value for selected fields\n * Returns undefined if no valid data is available\n * Uses only fields with valid scan data for the calculation\n * @param data Array of planning wizard selection grid data\n * @param operationModeEnum Definition of operation mode\n * @returns Calculated area-weighted N-uptake average or undefined\n * @private\n */\n private calculateNUptakeAreaWightedAverage(data: IPpPlanningWizardSelectionGridData[],\n operationModeEnum: OperationModesEnum): number | undefined {\n if (operationModeEnum === OperationModesEnum.Constant || !data || data.length === 0) {\n return undefined;\n }\n const selectedFieldsAreaAndAverage = this.getFieldsWithValidScanData(data)\n .map(item => ({\n Area: Create(item.Area, 0),\n Average: item.ScanData.NUptakeAvg\n }));\n return this.nFertilizationPlantProtectionService.calculateAreaWeightedAverage(selectedFieldsAreaAndAverage);\n }\n\n /**\n * Retrieves fields from the provided data that have valid scan data\n * Valid scan data requires the scan status to be Green\n * @param data Array of planning wizard selection grid data\n * @returns Filtered array containing only fields with valid scan data\n * @private\n */\n private getFieldsWithValidScanData(data: IPpPlanningWizardSelectionGridData[]): IPpPlanningWizardSelectionGridData[] {\n return data?.filter(x => !!x.ScanData && x.ScanData.Status.state === ApColumnState.Green) ?? [];\n }\n\n /**\n * Generates a tooltip displaying the ingredients of a product\n * Parses the ingredients from the product's JSON-encoded ingredients list\n * Creates a grid-style tooltip with each ingredient on a separate row\n * @param dataItem The product list grid item containing product information\n * @returns An HTML string representing the ingredients tooltip, or undefined if no ingredients are available\n * @private\n */\n private generateProductNameTooltip(dataItem: IPpProductListGridItem): string | undefined {\n if (!dataItem?.ProductListItem?.Product?.Ingredients) {\n return undefined;\n }\n const parsedIngredients = JSON.parse(dataItem.ProductListItem.Product.Ingredients) as string[];\n if (!Array.isArray(parsedIngredients) || parsedIngredients.length === 0) {\n return undefined;\n }\n let fieldsTooltip = '
';\n parsedIngredients.forEach((ingredient, index) => {\n fieldsTooltip += `
${ingredient}
`;\n });\n fieldsTooltip += '
';\n return fieldsTooltip;\n }\n}\n","import {Injectable} from '@angular/core';\nimport {IPpPlanningBookingGridItem, ISummaryWithPlanBooks, PpNoDataValue} from '../types/pp-planning-booking.types';\nimport {FieldStore} from '../../stores/farm/field.store';\nimport {\n ApTooltipContentService\n} from '../../ap-utils/service/ap-tooltip-content.service';\nimport {combineLatest, Observable, Subscription} from 'rxjs';\nimport {filter, map} from 'rxjs/operators';\nimport {\n PlantProtectionPlanBookStore\n} from '../../stores/plant-protection/plant-protection-planbook.store';\nimport {\n CropTypeStore\n} from '../../stores/base-data/crop.types.store';\nimport {\n ApDynComponentComponent\n} from '../../ap-dyncomponent/ap-dyncomponent.component';\nimport {CampaignYearStore} from '../../stores/login/campaignyear.store';\nimport {\n ApTranslationService\n} from '../../ap-utils/service/ap-translation.service';\nimport {\n ApNutrientService\n} from '../../ap-utils/service/ap-nutrient.service';\nimport {\n CropApplicationStore\n} from '../../stores/task-management/crop-application.store';\nimport {PpCommonService} from './pp-common.service';\nimport IPlantProtectionPlanBook = Data.TaskManagement.IPlantProtectionPlanBook;\nimport {SensorStore} from '../../stores/sensor/sensor.store';\nimport {\n GetRoundNumericService\n} from '../../ap-utils/service/get-round-numeric.service';\nimport {SettingsStore} from '../../stores/base-data/settings.store';\nimport {MapStore} from '../../stores/map/map.store';\nimport {RouterStore} from '../../stores/router/router.store';\nimport {\n ApShowPointsOnMapService\n} from '../../ap-utils/service/ap-show-points-on-map.service';\n\n/**\n * Service for plant protection planning and booking components.\n * Plant-Protection -> Plans\n * Plant-Protection -> Records\n */\n@Injectable({\n providedIn: 'root'\n})\nexport class PpPlanningBookingDataService {\n\n private _subscriptions: Subscription[] = [];\n private _isBooked = false;\n\n constructor(private fieldStore: FieldStore,\n private cropTypeStore: CropTypeStore,\n private sensorStore: SensorStore,\n private mapStore: MapStore,\n private routerStore: RouterStore,\n private cropApplicationStore: CropApplicationStore,\n private plantProtectionPlanBooksStore: PlantProtectionPlanBookStore,\n private campaignYearStore: CampaignYearStore,\n private translationService: ApTranslationService,\n private roundNumericService: GetRoundNumericService,\n private settingsStore: SettingsStore,\n private nutrientService: ApNutrientService,\n private ppCommonService: PpCommonService,\n private showPointsOnMap: ApShowPointsOnMapService,\n private tooltipContentService: ApTooltipContentService) {\n }\n\n /**\n * Initializes the service to be used for plannings or bookings\n * @param isBooking indicates if it is used for bookings\n */\n public init(isBooking: boolean): void {\n this._isBooked = isBooking;\n }\n\n /**\n * Builds the dataItems for the main grid of planning and booking component\n */\n public buildDataItems(): Observable {\n return combineLatest([\n this.plantProtectionPlanBooksStore.Listen(s => s.data),\n this.cropTypeStore.Listen(s => s.cropTypesNames),\n this.fieldStore.Listen(s => s.data),\n this.sensorStore.Listen(s => s.data),\n this.cropApplicationStore.Listen(s => s.data)\n ]).pipe(\n filter(([planBooks, cropTypesNames, fields, sensor, _]) =>\n !!planBooks && !!cropTypesNames && !!fields && !!sensor),\n map(([planBooks, cropTypesNames, fields, sensor]) => {\n const summaries = this._getSummaryWithPlanBooks(planBooks, this._isBooked);\n return summaries.filter(x => x.FilteredPlanBooks && x.FilteredPlanBooks.length > 0)\n .map(summaryWithPlanBooks => {\n const summary = summaryWithPlanBooks.Summary;\n const filteredPlanBooks = summaryWithPlanBooks.FilteredPlanBooks;\n const totalPlanBooks = summaryWithPlanBooks.TotalPlanBooks;\n const area = filteredPlanBooks.reduce((a, b) => a + (this.fieldStore.getFieldGeomById(b.FieldGeomId)?.AreaHa ?? 0), 0);\n const nUptakesByArea = filteredPlanBooks.map(pb =>\n (this.sensorStore.getSensorFieldData(pb.FieldGeomId)?.NUptakeAvg ?? 0) * (this.fieldStore.getFieldGeomById(pb.FieldGeomId)?.AreaHa ?? 0));\n const nUptakeAverage = this.roundNumericService.roundAsNumber((nUptakesByArea.reduce((a, b) => a + b, 0) / area), this.settingsStore.FirstSetting.DigitsAfterDecimalPoint);\n const cropId = this._getCropTypeId(filteredPlanBooks);\n const appliedProducts = this.ppCommonService.getDistinctProductsOfPlanBooks(filteredPlanBooks);\n const isWorkTypeSpraying = this.ppCommonService.isWorkTypeSpraying(filteredPlanBooks?.FirstOrDefault());\n const planBookApplicationDates = this.ppCommonService.getApplicationDatesData(filteredPlanBooks);\n return {\n Id: summary.Id,\n Summary: undefined,\n Products: undefined,\n Status: this.nutrientService.getFertilizerStatus(summary.ApplicationMode, this._isBooked)?.state,\n StatusClass: this.nutrientService.getFertilizerStatus(summary.ApplicationMode, this._isBooked)?.class,\n StatusDesc: this.nutrientService.getFertilizerStatusDescription(summary.ApplicationMode, this._isBooked),\n FieldIds: filteredPlanBooks.map(pb => pb.FieldId),\n Crop: cropTypesNames[+cropId ?? ''],\n CropId: cropId,\n Appl: this.ppCommonService.getApplNumName(this.ppCommonService.getApplNumFromSummary(summary)),\n ApplSum: isWorkTypeSpraying ? this.ppCommonService.getTotalWaterAmountBasedOnOperationMode(filteredPlanBooks) : PpNoDataValue,\n ApplUnit: isWorkTypeSpraying ? this.translationService.translate('Api_Enums__Litre') : undefined,\n Count: this._getValidPlansCountPerTotalPlansCount(totalPlanBooks),\n Area: area,\n OperationMode: this.translationService.translate(summary.ApplicationMode?.Key),\n OperationModeKey: summary.OperationMode.Key,\n OperationModeKeyTrans: this.translationService.translate(summary.OperationMode.Key),\n ProductNames: this.ppCommonService.getAppliedProductsExpr(appliedProducts),\n ProductNamesTooltip: this.ppCommonService.getAppliedProductsExpr(appliedProducts, true),\n ProductsSum: isWorkTypeSpraying ? this.ppCommonService.getAppliedProductSumExpr(appliedProducts, {\n areaHa: area,\n withoutProdName: true\n }) : undefined,\n ProductsSumTooltip: isWorkTypeSpraying ? this.ppCommonService.getAppliedProductSumExpr(appliedProducts, {\n areaHa: area,\n isTooltip: true\n }) : undefined,\n Avg: isWorkTypeSpraying ? summary.UserApplicationRate : PpNoDataValue,\n Min: isWorkTypeSpraying ? summary.UserApplicationMinimum : PpNoDataValue,\n Max: isWorkTypeSpraying ? summary.UserApplicationMaximum : PpNoDataValue,\n NUptakeAverage: nUptakeAverage,\n ApplicationDate: planBookApplicationDates.NewestDate,\n ApplicationDateTooltip: planBookApplicationDates.Tooltip,\n ApplicationDateItalic: planBookApplicationDates.IsMoreThanOneUniqDate,\n Note: summary?.Title,\n PlanBooks: filteredPlanBooks,\n PlanNumber: summary?.PlanNumber,\n FieldsTooltip: this.tooltipContentService.getFieldsCropsTooltip(filteredPlanBooks)\n };\n });\n }\n )\n );\n }\n\n /**\n * Gets the loading indicator observable combined from all required stores\n */\n public getLoading$(): Observable {\n return combineLatest([\n this.plantProtectionPlanBooksStore.Listen(s => s.loading),\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(items => items.some(x => x)\n )\n );\n }\n\n /**\n * Initializes and triggers load of planBooks\n */\n public subscribeLoad(): void {\n this._subscriptions.push(this.campaignYearStore.Listen(s => s.selectedYear).subscribe(() => {\n this.plantProtectionPlanBooksStore.loadPlanBooks();\n this.sensorStore.loadSensorFieldData();\n }));\n }\n\n /**\n * Initializes and triggers actions on selectionChange within the grid (dynComponent)\n * @param dynComponent the component's grid encapsulated in a dynComponent\n */\n public subscribeSelection(dynComponent: ApDynComponentComponent): void {\n this._subscriptions.push(dynComponent.SelectedItems$.subscribe((items: IPpPlanningBookingGridItem[]) => {\n this.mapStore.Layers.PpApplicationMapLayer.clear();\n const fieldIds = items.map((item) => item.FieldIds.map(f => f?.toString())).flat();\n this.fieldStore.changeSelectedField(fieldIds.filter((v, i, a) => a.indexOf(v) === i));\n const planBooks = items.map(item => item.PlanBooks).flat()\n .filter(pB => (this._isBooked ? this.isValidBooking(pB) : this.isValidPlanning(pB)));\n this.showPlanBooksInMap(planBooks);\n const showRaster = planBooks.map((pb) => ({\n FieldId: pb.FieldId.toString(),\n PlanBookId: pb.Id.toString()\n }));\n this.showPointsOnMap.showAllRaster(showRaster, 'pp');\n }));\n }\n\n public showPlanBooksInMap(planBooks: IPlantProtectionPlanBook[]): void {\n const planBooksIds = planBooks.map(x => x.Id);\n if (planBooksIds.length === 0) {\n return;\n }\n\n this.mapStore.Layers.PpApplicationMapLayer.clear();\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 Min: planBooks.Reduce((target, ele) => {\n return target < ele.ApplicationMin ? target : ele.ApplicationMin;\n }, planBooks.FirstOrDefault().ApplicationMin)\n };\n this.mapStore.Legends.onPPApplicationChanged.emit(statistic);\n this.mapStore.Layers.PPApplicationLayerSourceInit(this.routerStore.Listen(s => s.url).getValue(), planBooksIds);\n }\n\n public destroy(): void {\n this._subscriptions.forEach(s => s.unsubscribe());\n }\n\n private _getSummaryWithPlanBooks(planBooks: IPlantProtectionPlanBook[], 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) {\n if (isBooking ? item.BookedAt : !item.BookedAt) {\n summaryMap[id].FilteredPlanBooks.push(item);\n }\n summaryMap[id].TotalPlanBooks.push(item);\n }\n return summaryMap;\n }, {} as Record);\n return Object.keys(summariesMap).map((key) => summariesMap[key]);\n }\n\n private _getValidPlansCountPerTotalPlansCount(planBooks: IPlantProtectionPlanBook[]): string {\n if (!planBooks || planBooks.length <= 0) {\n return '0/0';\n }\n const nonDeletedPlanBooks = planBooks.filter(x => !x.DeletedAt);\n const filteredPlanBooks = nonDeletedPlanBooks.filter(p => this._isBooked ? p.BookedAt : !p.BookedAt);\n return filteredPlanBooks.length + '/' + nonDeletedPlanBooks.length;\n }\n\n private isValidBooking(planBook: IPlantProtectionPlanBook): boolean {\n return planBook.BookedAt && !planBook.DeletedAt;\n }\n\n private isValidPlanning(planBook: IPlantProtectionPlanBook): boolean {\n return !planBook.BookedAt && !planBook.DeletedAt;\n }\n\n private _getCropTypeId(planBooks: IPlantProtectionPlanBook[]): number {\n return 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}).max;\n }\n}\n","import {Injectable} from '@angular/core';\nimport {\n StatisticStore\n} from '../../../../stores/statistic/statistic.store';\nimport {\n StatisticService\n} from '../../../../services/data/statistic.service';\nimport {\n GetRoundNumericService\n} from '../../../../ap-utils/service/get-round-numeric.service';\nimport {\n PpCommonService\n} from '../../../../plant-protection/services/pp-common.service';\nimport {\n NFertilizationPlantProtectionService\n} from '../../../../services/data/n-fertilization-plant-protection.service';\nimport {\n IPpOverviewStatValues,\n IPpPlanningWizardOverviewGridData,\n IPpPlanningWizardSelectionGridData,\n IPpProductListGridItem\n} from '../pp-planning-wizard.types';\nimport {ApStatsType} from '../../../../ap-interface';\nimport {\n ApPpPlanningWizardOverviewStatsItem\n} from '../../../../statistics/components/charts/plant-protection/types/ap-pp-planning-wizard-overview-stats.types';\nimport {\n OperationModesEnum\n} from '../../../../stores/common/operation-modes.store';\nimport {\n GenericChartConfig,\n GenericSeriesConfig,\n GenericSeriesData,\n GenericYAxisConfig\n} from '../../../../statistics/components/charts/ap-generic-chart.types';\nimport {\n nameOf\n} from '../../../../ap-core/utils/ap-name-of';\nimport {Create, ObjectFactory} from 'ts-tooling';\nimport {\n ApTranslationService\n} from '../../../../ap-utils/service/ap-translation.service';\nimport IPlantProtectionProductList = Data.TaskManagement.IPlantProtectionProductList;\n\n@Injectable({providedIn: 'root'})\nexport class PpPlanningWizardStatisticService {\n constructor(private statisticStore: StatisticStore,\n private statisticService: StatisticService,\n private translationService: ApTranslationService,\n private roundNumericService: GetRoundNumericService,\n private ppCommonService: PpCommonService,\n private nFertilizationPlantProtectionService: NFertilizationPlantProtectionService) {\n }\n\n /**\n * Generates the statistic charts for the overview step\n * @private\n */\n public generateOverviewStats(items: IPpPlanningWizardOverviewGridData[],\n selectionData: IPpPlanningWizardSelectionGridData[],\n productListGridItems: IPpProductListGridItem[]): void {\n // collect all necessary data in order to show statistics\n const statData = this.calculateStatData(items, productListGridItems);\n // Generate upper statistic table\n this.generateStatOverviewTable(statData, selectionData, items);\n // Only in case of PPTargetMapPerPlan => Showing additional chart(s)\n if (items?.FirstOrDefault()?.DetailsData?.OperationModeAppSetting?.OperationMode === OperationModesEnum.PPTargetMapPerPlan) {\n this.generateStatOverviewChart(statData);\n }\n }\n\n /**\n * Generates a general statistic table which gives an overview of applied n/product/water etc.\n * @param statData the collected statistic data\n * @param selectionData the data from selection step of the wizard\n * @param items the overview grid items\n * @private\n */\n private generateStatOverviewTable(statData: IPpOverviewStatValues, selectionData: IPpPlanningWizardSelectionGridData[], items: IPpPlanningWizardOverviewGridData[]): void {\n const dataForTitles = selectionData.map(x => ({\n AreaHa: x.Area,\n Selected: items.some(z => z.Id === x.Id)\n }));\n const statTitle = this.statisticService.generateFieldsAreaTitle(dataForTitles);\n const statOverviewItems: ApPpPlanningWizardOverviewStatsItem[] = [\n {\n key: this.translationService.translate('AvgNUptakeShort'),\n value: statData.NUptakeAreaWeightedAvg ? `${this.roundNumericService.roundAsNumber(statData.NUptakeAreaWeightedAvg, 0)} ${this.translationService.translate('Unit_Rate')}` : '-'\n },\n {\n key: this.translationService.translate('Global__Avg_Water'),\n value: `${statData.WaterAvg} ${this.translationService.translate('Api_Enums__Litre')}`\n },\n {\n key: this.translationService.translate('Global__Min_Water'),\n value: `${statData.WaterMin} ${this.translationService.translate('Api_Enums__Litre')}`\n },\n {\n key: this.translationService.translate('Global__Max_Water'),\n value: `${statData.WaterMax} ${this.translationService.translate('Api_Enums__Litre')}`\n },\n {\n key: this.translationService.translate('Nutrients__Average_Amount_Goods'),\n value: statData.ProductAreaWeightedAvg?.map(p => this.ppCommonService.buildProductExpr(p, {useBaseUnit: true}))?.join('\\n')\n },\n {\n key: this.translationService.translate('Global__Sum_Goods'),\n value: statData.ProductSum?.map(p => this.ppCommonService.buildProductExpr(p, {useBaseUnit: true}))?.join('\\n')\n }\n ];\n\n // provide items for statistic store\n this.statisticStore.setStatisticData(\n statOverviewItems, ApStatsType.PpPlanningWizardOverviewStats, statTitle, statTitle\n );\n }\n\n /**\n * Generates a water/n-uptake chart for PPTargetMapPerPlan\n * @param statData the collected statistic data\n * @private\n */\n private generateStatOverviewChart(statData: IPpOverviewStatValues): void {\n // configure chart and its axes\n const chartConfigs: GenericChartConfig[] = [];\n const chartConfig = new GenericChartConfig();\n chartConfig.pannable = false;\n chartConfig.zoomable = false;\n chartConfig.transitions = false;\n chartConfig.paddingLeftRight = 30;\n chartConfig.xAxisConfig.min = statData.NUptakeMin;\n chartConfig.xAxisConfig.max = statData.NUptakeMax;\n chartConfig.xAxisConfig.title = this.translationService.translate('N__ChartTitleX');\n chartConfig.noteField = nameOf('note');\n chartConfig.tooltipDelegate = (dataItem, _) => {\n const seriesData = dataItem as GenericSeriesData;\n if (!seriesData) {\n return '';\n }\n return this.createTooltipText(seriesData);\n };\n\n const yAxisConfig = new GenericYAxisConfig();\n yAxisConfig.type = 'numeric';\n yAxisConfig.min = 0;\n chartConfig.yAxisConfigs.push(yAxisConfig);\n\n // generate series data points\n const seriesConfig = new GenericSeriesConfig();\n seriesConfig.type = 'scatterLine';\n seriesConfig.lineWidth = 3;\n seriesConfig.markerVisible = false;\n seriesConfig.style = 'normal';\n this.generateSeriesData(statData, seriesConfig);\n chartConfig.seriesConfigs.push(seriesConfig);\n chartConfigs.push(chartConfig);\n\n // add chart to statistic store\n this.statisticStore.addStatisticData(\n chartConfigs, ApStatsType.GenericChart, this.translationService.translate('Global__Water'), ''\n );\n }\n\n /**\n * Generates chart series data points\n * @param statData the current statistic basedata\n * @param seriesConfig the series config which holds data points\n * @private\n */\n private generateSeriesData(statData: IPpOverviewStatValues, seriesConfig: GenericSeriesConfig): void {\n let hasMaxBreak = false;\n let hasMinBreak = false;\n let previousWaterAmount = -1;\n for (let nUptake = statData.NUptakeMin; nUptake <= statData.NUptakeMax; nUptake = nUptake + statData.NUptakeStepSize) {\n const seriesData = new GenericSeriesData();\n seriesData.xValue = this.roundNumericService.roundAsNumber(nUptake, 0);\n seriesData.yValue = statData.Slope * nUptake + (statData.WaterAvg - statData.Slope * statData.NUptakeAreaWeightedAvg);\n if (seriesData.yValue < statData.WaterMin) {\n seriesData.yValue = statData.WaterMin;\n }\n if (seriesData.yValue > statData.WaterMax) {\n seriesData.yValue = statData.WaterMax;\n if (!hasMaxBreak) {\n seriesConfig.seriesData[seriesConfig.seriesData.length - 1].note = this.createTooltipText(\n seriesConfig.seriesData[seriesConfig.seriesData.length - 1]);\n hasMaxBreak = true;\n }\n }\n if (previousWaterAmount !== -1 && previousWaterAmount !== seriesData.yValue && !hasMinBreak) {\n seriesConfig.seriesData[seriesConfig.seriesData.length - 1].note = this.createTooltipText(\n seriesConfig.seriesData[seriesConfig.seriesData.length - 1]);\n hasMinBreak = true;\n }\n if (Math.round(statData.NUptakeAreaWeightedAvg) === nUptake) {\n seriesData.yValue = this.roundNumericService.roundAsNumber(statData.WaterAvg);\n seriesData.note = this.createTooltipText(seriesData, 'Nutrients__Average_Amount_Nutrient_kg_N_per_ha');\n }\n previousWaterAmount = seriesData.yValue;\n seriesConfig.seriesData.push(seriesData);\n }\n }\n\n /**\n * Collects and calculates all the data which is required in order to show the statistics\n * @param items the current overview grid items\n * @param productListGridItems the currently selected product grid items\n * @private\n */\n private calculateStatData(items: IPpPlanningWizardOverviewGridData[], productListGridItems: IPpProductListGridItem[]): IPpOverviewStatValues {\n const defaultItem = items?.FirstOrDefault();\n const productsAvg: IPlantProtectionProductList[] = [];\n const productsSum: IPlantProtectionProductList[] = [];\n\n // calculate area weighted water average...\n const itemsWaterAreaAndAverage = items\n .map(item => ({\n Area: Create(item.SelectionData?.Area, 0),\n Average: item.PlanBook.ApplicationRate\n }));\n const waterAreaWeighted = this.nFertilizationPlantProtectionService.calculateAreaWeightedAverage(itemsWaterAreaAndAverage);\n\n // calculate area weighted product average and product sum\n for (const productListGridItem of productListGridItems) {\n const productListItem = productListGridItem.ProductListItem;\n const itemsProductAreaAndAverage = items\n .map(item => {\n // find the matching 'SelectedProduct' which contains pre-calculated productRate (per ha) for this field\n const productItemWithRateForField = item.PlanBook\n .ProductList?.FirstOrDefault(p => p?.Product?.Id === productListItem?.Product?.Id);\n return ({\n Area: Create(item.SelectionData?.Area, 0),\n Average: productItemWithRateForField?.ProductRate ?? 0// already calculated productRate per field (done in wizard overview)\n });\n });\n\n // calculate product sum based on pre-calculated rate per ha\n const productWithSum = ObjectFactory.Copy(productListItem);\n productWithSum.ProductRate = itemsProductAreaAndAverage.reduce((sum, a) => sum + a.Area * a.Average, 0);\n productsSum.push(productWithSum);\n\n // calculate area weighted product average\n const productWithAreaWeightedAvg = ObjectFactory.Copy(productListItem);\n productWithAreaWeightedAvg.ProductRate = this.nFertilizationPlantProtectionService.calculateAreaWeightedAverage(itemsProductAreaAndAverage);\n productsAvg.push(productWithAreaWeightedAvg);\n }\n\n return {\n NUptakeMin: this.roundNumericService.roundAsNumber(items.map(x => x.SelectionData?.ScanData?.NUptakeMin)?.Min() ?? 0, 0),\n NUptakeMax: this.roundNumericService.roundAsNumber(items.map(x => x.SelectionData?.ScanData?.NUptakeMax)?.Max() ?? 0, 0),\n NUptakeStepSize: 1,\n NUptakeAreaWeightedAvg: defaultItem.DetailsData.FormData.NUptakeAverage,\n Slope: defaultItem.SlopeForJob * -1,\n WaterAvg: this.roundNumericService.roundAsNumber(waterAreaWeighted ?? 0, 0),\n WaterMin: this.roundNumericService.roundAsNumber(defaultItem.PlanBook?.Summary?.UserApplicationMinimum ?? 0, 0),\n WaterMax: this.roundNumericService.roundAsNumber(defaultItem.PlanBook?.Summary?.UserApplicationMaximum ?? 0, 0),\n ProductSum: productsSum,\n ProductAreaWeightedAvg: productsAvg\n };\n }\n\n /**\n * Generates chart's tooltip and note text\n * @param seriesData the seriesData item\n * @param nUptakeLabel optional n-Uptake label\n * @private\n */\n private createTooltipText(seriesData: GenericSeriesData, nUptakeLabel?: string): string {\n const nUptake = this.roundNumericService.roundAsNumber(seriesData.xValue, 0);\n const water = this.roundNumericService.roundAsNumber(seriesData.yValue, 0);\n return `${this.translationService.translate('Global__Water')}: ${water} \\n ${this.translationService.translate(nUptakeLabel ?? 'N__ChartTitleX')}: ${nUptake}`;\n }\n}\n","import {\n IPpPlanningWizardDetailsData,\n IPpPlanningWizardOverviewGridData,\n IPpPlanningWizardSelectionGridData,\n IPpProductListGridItem,\n IPpWizardProvider,\n PpWizardStates\n} from '../pp-planning-wizard.types';\nimport {BehaviorSubject, combineLatest, Observable} from 'rxjs';\nimport {\n ApDynGridColumnConfigBase\n} from '../../../../ap-dyngrids/config/ap-dyn-grid-column-config-base';\nimport {\n ApDynGridPagerConfigBase\n} from '../../../../ap-dyngrids/config/ap-dyn-grid-pager-config-base';\nimport {\n ApDynformsConfigFieldset\n} from '../../../../ap-dynforms/config/ap-dynforms-config-fieldset';\nimport {\n EventEmitter,\n Injectable\n} from '@angular/core';\nimport {\n ApDynGridPagerWizardBreadcrumbsStepper,\n ApDynGridPagerWizardButton,\n ApDynGridPagerWizardConfig\n} from '../../../../ap-dyngrids/config/ap-dyn-grid-pager-wizard-config';\nimport {\n filter,\n map\n} from 'rxjs/operators';\nimport {\n MapViewMode\n} from '../../../../ap-interface';\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 ApGuidUtil,\n ApTimeSpanUtil\n} from '../../../../ap-utils';\nimport {\n GetRoundNumericService\n} from '../../../../ap-utils/service/get-round-numeric.service';\nimport {\n MachineStore\n} from '../../../../stores/docu/machine.store';\nimport {\n InstrumentStore\n} from '../../../../stores/docu/instrument.store';\nimport {\n DriverStore\n} from '../../../../stores/docu/driver.store';\nimport {\n WorkTypes\n} from '../../../../stores/base-data/worrktypes.store';\nimport {\n PpCommonService\n} from '../../../../plant-protection/services/pp-common.service';\nimport {\n OperationModesEnum,\n OperationModesStore\n} from '../../../../stores/common/operation-modes.store';\nimport {\n MapFactoryStyler\n} from '../../../../map-factory/style';\nimport {\n PlantProtectionPlanBookStore\n} from '../../../../stores/plant-protection/plant-protection-planbook.store';\nimport {\n MapStore\n} from '../../../../stores/map/map.store';\nimport {\n ApplicationModesEnum,\n ApplModesStore\n} from '../../../../stores/common/appl-modes.store';\nimport {\n LoginStore\n} from '../../../../stores/login/login.store';\nimport {\n UnitsStore\n} from '../../../../stores/common/units.store';\nimport {\n ApDateService\n} from '../../../../ap-core/services/ap-date-service';\nimport {\n CampaignYearStore\n} from '../../../../stores/login/campaignyear.store';\nimport {\n ObjectFactory\n} from 'ts-tooling';\nimport {\n BestScanData,\n BestScanType\n} from '../../../../types/scan.types';\nimport {\n NFertilizationPlantProtectionService\n} from '../../../../services/data/n-fertilization-plant-protection.service';\nimport {\n ApDynComponentComponent\n} from '../../../../ap-dyncomponent/ap-dyncomponent.component';\nimport {\n FieldStore\n} from '../../../../stores/farm/field.store';\nimport {\n PlantProtectionService\n} from '../../../../services/data/plant-protection.service';\nimport {\n ApElementType\n} from '../../../../ap-interface/enums/ap-elements-type.enum';\nimport {\n PpPlanningBookingDataService\n} from '../../../../plant-protection/services/pp-planning-booking-data.service';\nimport {\n OverviewGridColumnsUiProvider\n} from './ui-providers/overview.grid-columns.ui-provider';\nimport {\n ApColumnState\n} from '../../../../ap-interface/enums/ap-column-state.enum';\nimport {\n PpPlanningWizardStatisticService\n} from '../services/pp-planning-wizard-statistic.service';\nimport IGuid = System.IGuid;\nimport INPlanningData = Data.NFertilization.INPlanningData;\nimport IPlantProtectionPlanBook = Data.TaskManagement.IPlantProtectionPlanBook;\nimport IPlantProtectionSummary = Data.TaskManagement.IPlantProtectionSummary;\nimport TaskManagementStatus = Data.TaskManagement.TaskManagementStatus;\nimport IPlantProtectionProductList = Data.TaskManagement.IPlantProtectionProductList;\nimport ScanType = Data.NDI.Enums.ScanType;\n\n// ATTENTION: injectable 'root' is very convenient in here because we can inject all needed stores.\n// BUT: This will reuse THE SAME instance of the provider every time. Therefor we need to carefully handle the 'onDestroy' method!\n@Injectable({providedIn: 'root'})\nexport class PpPlanningWizardOverviewProvider implements IPpWizardProvider {\n private _caption$: BehaviorSubject;\n private _fieldSets$: BehaviorSubject;\n private _handleStateChange: EventEmitter;\n private _isContinueActive: BehaviorSubject;\n private _dynComponent: ApDynComponentComponent;\n private _items$: BehaviorSubject;\n private _selectedGridData: IPpPlanningWizardSelectionGridData[];\n private _productListData: IPpProductListGridItem[];\n\n constructor(private languageStore: LanguageStore,\n private settingsStore: SettingsStore,\n private mapViewStore: MapViewStore,\n private machineStore: MachineStore,\n private instrumentStore: InstrumentStore,\n private campaignYearStore: CampaignYearStore,\n private driverStore: DriverStore,\n private mapStore: MapStore,\n private plantProtectionPlanBookStore: PlantProtectionPlanBookStore,\n private loginStore: LoginStore,\n private fieldStore: FieldStore,\n private operationModesStore: OperationModesStore,\n private applicationModesStore: ApplModesStore,\n private unitsStore: UnitsStore,\n private dateService: ApDateService,\n private ppCommonService: PpCommonService,\n private ppDataService: PpPlanningBookingDataService,\n private roundNumericService: GetRoundNumericService,\n private plantProtectionService: PlantProtectionService,\n private ppPlanningWizardStatisticService: PpPlanningWizardStatisticService,\n private nFertilizationPlantProtectionService: NFertilizationPlantProtectionService,\n private overviewGridColumnsUiProvider: OverviewGridColumnsUiProvider) {\n }\n\n /**\n * Initializes the wizard step provider\n * Sets up required observables and event handlers\n * @param caption$ Observable for the step caption\n * @param fieldSets$ Observable for form field sets\n * @param handleStateChange Event emitter for state changes\n * @param isContinueActive Observable for continue button state\n * @param dynComponent Reference to the dynamic component\n * @public\n */\n public init(caption$: BehaviorSubject,\n fieldSets$: BehaviorSubject,\n handleStateChange: EventEmitter,\n isContinueActive: BehaviorSubject,\n dynComponent: ApDynComponentComponent): void {\n this._caption$ = caption$;\n this._fieldSets$ = fieldSets$;\n this._handleStateChange = handleStateChange;\n this._isContinueActive = isContinueActive;\n this._dynComponent = dynComponent;\n this._items$ = new BehaviorSubject([]);\n }\n\n /**\n * Determines if continue button should be active and updates observable\n * Updates the grid items with data from plant protection plan book statistics\n * Maps statistics to grid items and updates water-related values\n * Sets loading state and error messages for each grid item\n * @param selectionData Selected field data\n * @param detailsData Details configuration data\n * @param selectedProducts Products selected for application\n * @returns Observable of grid items with updated statistics\n * @public\n */\n public buildDataItems(selectionData: IPpPlanningWizardSelectionGridData[], detailsData: IPpPlanningWizardDetailsData,\n selectedProducts: IPpProductListGridItem[]): Observable {\n this._selectedGridData = selectionData;\n this._productListData = selectedProducts;\n // pre-fill our planBook and gridItems with the values from selection and details\n const defaultGridItems = this.generateDefaultGridItems(selectionData, detailsData, selectedProducts);\n if (this.nFertilizationPlantProtectionService.isOperationModeAnyOfMaps(detailsData.FormData.OperationModeKey)) {\n this.createPPPlanningJob(defaultGridItems);\n }\n this._items$.next(defaultGridItems);\n\n // ... and in case the operationMode required a statistic to be read => update our default values\n return combineLatest([\n this._items$.asObservable(),\n this.plantProtectionPlanBookStore.Listen(s => s.fieldPPPlanningStatistic)\n ]).pipe(\n map(([gridItems, ppStatistics]) => gridItems.map((gridItem) => {\n let columnLoading = this.nFertilizationPlantProtectionService.isOperationModeAnyOfMaps(\n gridItem.DetailsData?.FormData.OperationModeKey);\n let errorMessage = '';\n if (ppStatistics && ppStatistics.length > 0) {\n const statistic = ppStatistics?.filter(x => x.FieldGeomId === gridItem.SelectionData.Geom.Id) ?? [];\n if (statistic && statistic.length > 0) {\n columnLoading = false;\n if (!!statistic[0].ErrorText && statistic[0].ErrorText !== '') {\n errorMessage = statistic[0].ErrorText;\n gridItem.PlanBook.ApplicationRate = -1;\n gridItem.PlanBook.ApplicationMin = -1;\n gridItem.PlanBook.ApplicationMax = -1;\n } else {\n gridItem.PlanBook.ApplicationRate = this.roundNumericService.roundAsNumber(statistic[0].Mean, 0);\n gridItem.PlanBook.ApplicationMin = this.roundNumericService.roundAsNumber(statistic[0].Min, 0);\n gridItem.PlanBook.ApplicationMax = this.roundNumericService.roundAsNumber(statistic[0].Max, 0);\n // Update planBook's productList to have individual productRate per field\n gridItem.PlanBook.ProductList.forEach(productListItem => {\n const selectedProduct = gridItem.SelectedProducts.FirstOrDefault(x => x.ProductListItem.Product.Id === productListItem.Product.Id);\n const productRate = gridItem.PlanBook.ApplicationRate * selectedProduct.ProductListItem.ProductRate / gridItem.DetailsData.FormData.WaterAvg;\n productListItem.ProductRate = this.roundNumericService.roundAsNumber(productRate);\n });\n gridItem.Products = this.ppCommonService.getAppliedProductsExpr(gridItem.PlanBook.ProductList);\n gridItem.ProductsTooltip = this.ppCommonService.getAppliedProductsExpr(gridItem.PlanBook.ProductList, true);\n }\n }\n }\n gridItem.ColumnLoading = columnLoading;\n gridItem.ErrorMessage = errorMessage;\n gridItem.HasError = errorMessage !== '';\n return gridItem;\n })\n )\n );\n }\n\n /**\n * Creates and configures grid columns based on the operation mode\n * Combines language and settings data to build appropriate columns\n * @param detailsData Details configuration data containing operation mode\n * @returns Observable of grid column configurations\n * @public\n */\n public getGridColumnConfig(detailsData: IPpPlanningWizardDetailsData): 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(() => {\n const mapHide = this.mapViewStore.Listen(s => s.mode).pipe(\n map((mapMode) => mapMode === MapViewMode.HIDE));\n const overviewColumns: ApDynGridColumnConfigBase[] = this.overviewGridColumnsUiProvider.getCommonColumns(mapHide);\n switch (detailsData.FormData.OperationModeKey) {\n case OperationModesEnum.Constant:\n if (detailsData.FormData.WorkType === WorkTypes.Spraying) {\n overviewColumns.Add(this.overviewGridColumnsUiProvider.getUniformSprayingColumns());\n }\n break;\n case OperationModesEnum.PpTarget:\n case OperationModesEnum.PpTargetMapPerField:\n case OperationModesEnum.PPTargetMapPerPlan:\n overviewColumns.AddRange(this.overviewGridColumnsUiProvider.getTargetRateColumns());\n break;\n }\n overviewColumns.AddRange(this.overviewGridColumnsUiProvider.getCommonEndColumns());\n return overviewColumns;\n })\n );\n }\n\n /**\n * Creates grid pager configuration for the overview wizard step\n * Sets up back button, breadcrumb stepper, and save button\n * @param breadCrumbsColumns Array of wizard states for breadcrumb navigation\n * @returns Configured grid pager for the wizard\n * @public\n */\n public getPagerConfig(breadCrumbsColumns: PpWizardStates[]): ApDynGridPagerConfigBase {\n return new ApDynGridPagerWizardConfig(\n new ApDynGridPagerWizardButton('Global_Back_With_Arrow', this._handleStateChange, {value: PpWizardStates.Details}),\n new ApDynGridPagerWizardBreadcrumbsStepper(\n breadCrumbsColumns, 2),\n new ApDynGridPagerWizardButton('Global__Save', this._handleStateChange,\n {active: this._isContinueActive, value: PpWizardStates.Save}));\n }\n\n /**\n * Handles grid selection changes and updates selected fields\n * Updates the field store with selected field IDs\n * Shows selected plan books in the map\n * @param selectedItems Currently selected grid items\n * @public\n */\n public onGridSelectionChanged(selectedItems: IPpPlanningWizardOverviewGridData[]): void {\n let selectedFieldIds: string[];\n let selectedPlanbooks: IPlantProtectionPlanBook[];\n if (selectedItems?.length > 0) {\n selectedFieldIds = selectedItems.map(x => x.SelectionData.Id.toString());\n selectedPlanbooks = selectedItems.filter(x => !x.ColumnLoading).map(x => x.PlanBook);\n } else {\n const allItems = this._dynComponent.items as IPpPlanningWizardOverviewGridData[];\n selectedFieldIds = allItems.map(x => x.SelectionData.Id.toString());\n selectedPlanbooks = allItems.filter(x => !x.ColumnLoading).map(x => x.PlanBook);\n }\n this.fieldStore.changeSelectedField(selectedFieldIds);\n this.ppDataService.showPlanBooksInMap(selectedPlanbooks);\n }\n\n /**\n * Generates overview statistics for the current wizard step\n * Uses the current selection, details, and product data to create statistics\n * @public\n */\n public onGenerateStatistic(): void {\n if (!this._selectedGridData || !this._productListData) {\n return;\n }\n this.ppPlanningWizardStatisticService.generateOverviewStats(\n this._items$.getValue() as IPpPlanningWizardOverviewGridData[],\n this._selectedGridData,\n this._productListData\n );\n }\n\n /**\n * Updates the caption text for the current wizard step\n * Sets the caption to 'Admin_Pages__Overview'\n * @public\n */\n public updateCaption(): void {\n this._caption$.next('Admin_Pages__Overview');\n }\n\n /**\n * Clears field sets for the overview step\n * Sets field sets observable to an empty array\n * @public\n */\n public updateFieldSets(): void {\n this._fieldSets$.next([]);\n }\n\n /**\n * Performs cleanup when leaving the overview wizard step\n * Clears raster statistic data and returns a copy of current grid items\n * @returns Array of current overview grid items\n * @public\n */\n public onLeave(): IPpPlanningWizardOverviewGridData[] {\n this._selectedGridData = undefined;\n this._productListData = undefined;\n this.plantProtectionPlanBookStore.clearPPPlanningStatistic();\n return ObjectFactory.Copy(this._items$.getValue());\n }\n\n /**\n * Cleans up provider resources when component is destroyed\n * Currently empty, but can be extended for additional cleanup\n * @public\n */\n public onDestroy(): void {\n }\n\n /**\n * Creates grid items for the overview step from selected data\n * Calculates weighted averages, control factors, and sets up operation modes\n * Prepares plan books for each selected field\n * @param selectionData Selected field data\n * @param detailsData Details configuration data\n * @param selectedProducts Products selected for application\n * @returns Array of grid items for the overview step\n * @private\n */\n private generateDefaultGridItems(selectionData: IPpPlanningWizardSelectionGridData[],\n detailsData: IPpPlanningWizardDetailsData,\n selectedProducts: IPpProductListGridItem[]): IPpPlanningWizardOverviewGridData[] {\n const getPlanBooks = this.getPlanBooksForSaving(detailsData, selectionData,\n selectedProducts?.map(p => p.ProductListItem));\n return selectionData.map(selectionItem => {\n const nUptakeAverage = this.getNUptakeAverageForJob(detailsData, selectionItem);\n const slopeForCalculations = this.plantProtectionService.getSlopeForCalculation(\n detailsData.ControlFactor, detailsData.FormData.WaterAvg, nUptakeAverage);\n const planBook = getPlanBooks.find(p => p.FieldGeomId === selectionItem?.Geom?.Id);\n if (slopeForCalculations === 0) {\n planBook.ApplicationMode = this.applicationModesStore.ApplicationModes.find(o => o.Key === ApplicationModesEnum.Constant);\n planBook.OperationMode = this.operationModesStore.OperationModes.find(o => o.Key === OperationModesEnum.Constant);\n }\n return {\n Id: selectionItem.Id,\n Status: this.nFertilizationPlantProtectionService.getStatusForItemOnOverviewStep(planBook.OperationMode.Key as OperationModesEnum),\n SelectionData: selectionItem,\n DetailsData: detailsData,\n SelectedProducts: selectedProducts,\n PlanBook: planBook,\n Machine: this.machineStore.getMachineById(detailsData.FormData.Machine)?.NameWithSign,\n Instrument: this.instrumentStore.getInstrumentById(detailsData.FormData.Instrument)?.Name,\n Driver: this.driverStore.getDriverById(detailsData.FormData.Driver)?.ShortFullName,\n Products: this.ppCommonService.getAppliedProductsExpr(selectedProducts?.map(p => p.ProductListItem)),\n ProductsTooltip: this.ppCommonService.getAppliedProductsExpr(selectedProducts?.map(p => p.ProductListItem), true),\n SlopeForJob: slopeForCalculations,\n NUptakeAverageForJob: nUptakeAverage,\n ColumnLoading: this.nFertilizationPlantProtectionService.isOperationModeAnyOfMaps(detailsData.FormData.OperationModeKey),\n ErrorMessage: '',\n HasError: false\n } as IPpPlanningWizardOverviewGridData;\n });\n }\n\n /**\n * Prepares plan books for saving based on wizard details\n * @param detailsData Wizard details data\n * @param selectionData Selected field data\n * @param productList Selected product list\n * @returns Array of plant protection plan books\n * @private\n */\n private getPlanBooksForSaving(detailsData: IPpPlanningWizardDetailsData, selectionData: IPpPlanningWizardSelectionGridData[],\n productList: IPlantProtectionProductList[]): IPlantProtectionPlanBook[] {\n const additionalValues = {\n ZeroRate: detailsData.FormData.WaterSetZeroAtMin === true\n };\n if (this.nFertilizationPlantProtectionService.isOperationModeAnyOfMaps(detailsData.FormData.OperationModeKey)) {\n if (detailsData.FormData.WaterSetZeroAtMin) {\n if (Number.isFinite(detailsData.ControlFactor)) {\n const selectedItem = selectionData.find(x => x.ScanData.Status.state === ApColumnState.Green);\n detailsData.FormData.Threshold = Math.round(selectedItem.ScanData.NUptakeAvg + (detailsData.FormData.WaterAvg - detailsData.FormData.WaterMin) / detailsData.ControlFactor);\n if (detailsData.FormData.Threshold < 0) {\n detailsData.FormData.Threshold = 0;\n }\n }\n } else {\n detailsData.FormData.Threshold = 0;\n }\n }\n const applicationModeEnum = this.nFertilizationPlantProtectionService.getApplicationModeFromOperationMode(\n detailsData.FormData.OperationModeKey);\n const applicationMode = this.applicationModesStore.Listen(a => a.data).getValue()\n .Find(a => a.Key === applicationModeEnum);\n const summary = {\n ApplicationDate: this.dateService.getDateNoon(detailsData.FormData.ApplicationDate),\n AdditionalValue: additionalValues,\n ApplicationMode: applicationMode,\n EcValue: detailsData.FormData.ECStage,\n OperationMode: this.operationModesStore.OperationModes.find(o => o.Key === detailsData.FormData.OperationModeKey),\n Slope: detailsData.ControlFactor,\n Title: detailsData.FormData.Note,\n Unit: this.unitsStore.Listen(u => u.data).value.FirstOrDefault(u => u.Key === 'Global__Unit_l_ha'),\n UserApplicationConstant: detailsData.FormData.WaterAvg,\n UserApplicationMaximum: detailsData.FormData.OperationModeKey === OperationModesEnum.Constant\n ? detailsData.FormData.WaterAvg : detailsData.FormData.WaterMax,\n UserApplicationMinimum: detailsData.FormData.OperationModeKey === OperationModesEnum.Constant\n ? detailsData.FormData.WaterAvg : detailsData.FormData.WaterMin,\n UserApplicationRate: detailsData.FormData.WaterAvg,\n FarmId: this.loginStore.SelectedFarmId\n } as IPlantProtectionSummary;\n return selectionData.map((selectionItem) => {\n const operationModeForPlanEnum = this.nFertilizationPlantProtectionService.getOperationModeForPlan(\n detailsData.FormData.OperationModeKey, selectionItem.ScanData, detailsData.OperationModeAppSetting?.ApplicationSetting);\n const applicationModeForPlanEnum = this.nFertilizationPlantProtectionService.getApplicationModeForPlan(\n detailsData.FormData.OperationModeKey, applicationMode.Key as ApplicationModesEnum, selectionItem.ScanData);\n const operationModeForPlan = this.operationModesStore.getIOperationModeByKey(operationModeForPlanEnum);\n const applicationModeForPlan = this.applicationModesStore.Listen(a => a.data).getValue()\n .Find(a => a.Key === applicationModeForPlanEnum);\n return {\n Id: ApGuidUtil.generateNewGuid(),\n AdditionalValues: additionalValues,\n ApplicationConst: summary.UserApplicationConstant,\n ApplicationDate: summary.ApplicationDate,\n ApplicationMax: summary.UserApplicationMaximum,\n ApplicationMin: summary.UserApplicationMinimum,\n ApplicationMode: applicationModeForPlan,\n ApplicationRate: summary.UserApplicationRate,\n CampaignYear: this.campaignYearStore.getSelectedCampaignYear()?.Year,\n EcValue: summary.EcValue,\n Element: ApElementType.N, // nitrogen\n ExportDriver: detailsData.FormData.Driver,\n ExportInstrument: detailsData.FormData.Instrument,\n ExportMachine: detailsData.FormData.Machine,\n FarmId: summary.FarmId,\n FieldGeomId: selectionItem?.Geom?.Id,\n FieldId: selectionItem?.Id,\n Geom: selectionItem?.Geom?.Geom,\n MainCropId: selectionItem?.CropId,\n Note: detailsData.FormData.Note,\n OperationMode: operationModeForPlan,\n ProductList: ObjectFactory.Copy(productList),\n SecondCropId: selectionItem?.SecondCropId,\n Slope: detailsData.ControlFactor,\n Status: TaskManagementStatus.Green,\n Summary: summary,\n Unit: summary.Unit,\n Threshold: detailsData.FormData.Threshold,\n Factor: 1,\n Area: 0,\n PlannedArea: 0,\n TEnd: ApTimeSpanUtil.getEmptyTimeSpan(),\n TStart: ApTimeSpanUtil.getEmptyTimeSpan(),\n RasterId: ApGuidUtil.getEmptyGuid(),\n RasterStatistics: [],\n JobInput: null,\n Statistic: null,\n ValidFrom: null,\n ValidTo: null,\n BookedBy: null,\n BookedAt: null,\n DeletedAt: null,\n CreatedAt: null,\n UpdatedAt: null,\n DeletedBy: null,\n UpdatedBy: null,\n ExportedAt: null,\n ExportedBy: null,\n ExportFormat: null,\n ExportTarget: null,\n CreatedBy: null,\n ChangedAt: null,\n ChangedBy: null,\n Version: 0,\n LogfileOperationMode: null\n } as IPlantProtectionPlanBook;\n });\n }\n\n /**\n * Determines the N-uptake average value to use for job creation\n * Returns the overall N-uptake average for target map per plan mode,\n * otherwise returns the scan data's N-uptake average\n * @param detailsData Details configuration containing operation mode\n * @param selectionData Selected field data containing scan information\n * @returns N-uptake average value or undefined\n * @private\n */\n private getNUptakeAverageForJob(detailsData: IPpPlanningWizardDetailsData,\n selectionData: IPpPlanningWizardSelectionGridData): number | undefined {\n // If field does not have scan data it means it cannot use n-uptake values.\n if (!selectionData?.ScanData) {\n return undefined;\n }\n if (detailsData.FormData.OperationModeKey === OperationModesEnum.PPTargetMapPerPlan) {\n return detailsData.FormData.NUptakeAverage;\n }\n return selectionData.ScanData.NUptakeAvg;\n }\n\n /**\n * Creates planning jobs for all grid items\n * Clears existing map data and creates new raster jobs\n * @param gridItems Overview grid items to create jobs for\n * @private\n */\n private createPPPlanningJob(gridItems: IPpPlanningWizardOverviewGridData[]): void {\n this.clearMap();\n gridItems.forEach((item: IPpPlanningWizardOverviewGridData) => {\n this._createPPPlanningRasterJob(\n item.PlanBook.Id,\n item.SelectionData?.ScanData,\n item.PlanBook.FieldGeomId,\n item.PlanBook.ApplicationMode.Id,\n item.NUptakeAverageForJob,\n item.DetailsData.FormData.WaterSetZeroAtMin ? 0 : item.PlanBook.ApplicationMin,\n item.PlanBook.ApplicationMax,\n item.PlanBook.Threshold,\n item.SlopeForJob,\n item.PlanBook.ApplicationRate,\n item.PlanBook.ApplicationConst,\n 0\n );\n });\n }\n\n /**\n * Creates a single plant protection planning raster job\n * @param planId Unique identifier for the plan\n * @param bestScan Best scan data\n * @param fieldGeomId Field geometry identifier\n * @param applicationModeId Application mode identifier\n * @param nUptake Nitrogen uptake value\n * @param minimum Minimum application rate\n * @param maximum Maximum application rate\n * @param threshold Threshold value\n * @param slope Slope factor\n * @param appleRate Apple rate\n * @param constant Constant application rate\n * @param deadBioMass Dead biomass value\n * @private\n */\n private _createPPPlanningRasterJob(planId: IGuid, bestScan: BestScanData | undefined, fieldGeomId: IGuid,\n applicationModeId: number, nUptake: number | undefined, minimum: number,\n maximum: number, threshold: number, slope: number, appleRate: number,\n 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: applicationModeId,\n Minimum: minimum,\n Maximum: maximum,\n Constant: constant,\n Slope: slope,\n DeadBioMass: deadBioMass,\n Threshold: threshold,\n AppleRate: appleRate\n };\n this.plantProtectionPlanBookStore.CreatePPPlanningRasterJob(planningData);\n }\n\n /**\n * Clears map-related data and layers\n * Removes legends and clears style cache\n * @private\n */\n private clearMap(): void {\n this.plantProtectionPlanBookStore.clearPPPlanningStatistic();\n MapFactoryStyler.Instance.clearStyleCache();\n this.mapStore.Layers.Clear();\n this.mapStore.Legends.removeLegend(this.mapStore.Legends.NPlanningLegend);\n this.mapStore.Legends.removeLegend(this.mapStore.Legends.PpApplicationLegend);\n }\n}\n","import {\n AfterContentInit,\n ChangeDetectionStrategy,\n Component,\n EventEmitter,\n OnDestroy,\n OnInit,\n TemplateRef,\n ViewChild\n} from '@angular/core';\n\nimport {BehaviorSubject, combineLatest, Observable, of, Subscription} from 'rxjs';\nimport {\n ApDynGridColumnConfigBase\n} from '../../../ap-dyngrids/config/ap-dyn-grid-column-config-base';\nimport {\n ApDynformsConfigFieldset\n} from '../../../ap-dynforms/config/ap-dynforms-config-fieldset';\nimport {\n ApDynComponentComponent\n} from '../../../ap-dyncomponent/ap-dyncomponent.component';\nimport {\n IPpPlanningWizardDetailsData,\n IPpPlanningWizardOverviewGridData,\n IPpPlanningWizardSelectionGridData,\n IPpProductListGridItem,\n IPpWizardProvider,\n PpWizardStates\n} from './pp-planning-wizard.types';\nimport {ApUtilService} from '../../../ap-utils/service/ap-util.service';\nimport {\n PpPlanningWizardSelectionProvider\n} from './configs/pp-planning-wizard-selection.provider';\nimport {\n PpPlanningWizardDetailsProvider\n} from './configs/pp-planning-wizard-details.provider';\nimport {\n PpPlanningWizardOverviewProvider\n} from './configs/pp-planning-wizard-overview.provider';\nimport {\n ApDynGridPagerConfigBase\n} from '../../../ap-dyngrids/config/ap-dyn-grid-pager-config-base';\nimport {CampaignYearStore} from '../../../stores/login/campaignyear.store';\nimport {\n PlantProtectionProductStore\n} from '../../../stores/base-data/plantprotection.product.store';\nimport {FormStore} from '../../../stores/layout/form.store';\nimport {debounceTime, map} from 'rxjs/operators';\nimport {FieldStore} from '../../../stores/farm/field.store';\nimport {CropRotationStore} from '../../../stores/farm/crop.rotation.store';\nimport {CropTypeStore} from '../../../stores/base-data/crop.types.store';\nimport {\n PlantProtectionPlanBookStore\n} from '../../../stores/plant-protection/plant-protection-planbook.store';\nimport {SensorStore} from '../../../stores/sensor/sensor.store';\nimport {\n OperationModesEnum\n} from '../../../stores/common/operation-modes.store';\nimport {MapViewCurrentMenu, MapViewMode} from '../../../ap-interface';\nimport {MapViewStore} from '../../../stores/layout/mapview.store';\nimport {StatisticStore} from '../../../stores/statistic/statistic.store';\n\n@Component({\n selector: 'plant-protection-planning-wizard',\n template: `\n \n
\n
\n \n
\n
\n \n \n
\n
\n \n
\n
\n
\n \n \n \n
\n \n
\n
\n `,\n styles: [\n '.pp-product-list { height: 120px; display: block; }'\n ],\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class PpPlanningWizardComponent implements OnInit, AfterContentInit, OnDestroy {\n @ViewChild(ApDynComponentComponent, {static: true}) public dynComponent: ApDynComponentComponent;\n @ViewChild('plantProtectionProductListTemplate', {static: true}) public plantProtectionProductListTemplate: TemplateRef;\n\n private _subscriptions: Subscription[] = [];\n private _stateModel: { [oldState: string]: { [newState: string]: (oldState: PpWizardStates) => void } } = {};\n private _activeWizardStep: PpWizardStates = PpWizardStates.Selection;\n private _isContinueActive = new BehaviorSubject(false);\n private _itemSubscription: Subscription;\n private _statisticUpdateRequested = new EventEmitter();\n\n public wizardSteps = PpWizardStates;\n public caption$ = new BehaviorSubject('Nutrients__SelectFieldsTitle');\n public errorKeys$ = new BehaviorSubject([]);\n public columns$: Observable = of([]);\n public fieldSets$ = new BehaviorSubject([]);\n public items$ = new Observable(undefined);\n public pager: ApDynGridPagerConfigBase;\n public productListColumns: ApDynGridColumnConfigBase[] = [];\n public productListItems$: BehaviorSubject = new BehaviorSubject([]);\n public loading$: Observable;\n public handleStateChangeAction: EventEmitter;\n public selectionData: IPpPlanningWizardSelectionGridData[];\n public detailsData: IPpPlanningWizardDetailsData;\n public overviewData: IPpPlanningWizardOverviewGridData[];\n\n public breadCrumbsColumns = [\n PpWizardStates.Selection,\n PpWizardStates.Details,\n PpWizardStates.Overview\n ];\n\n constructor(private wizardSelectionProvider: PpPlanningWizardSelectionProvider,\n private wizardDetailsProvider: PpPlanningWizardDetailsProvider,\n private wizardOverviewProvider: PpPlanningWizardOverviewProvider,\n private fieldStore: FieldStore,\n private cropRotationStore: CropRotationStore,\n private cropTypeStore: CropTypeStore,\n private sensorStore: SensorStore,\n private campaignYearStore: CampaignYearStore,\n private plantProtectionProductStore: PlantProtectionProductStore,\n private plantProtectionPlanBookStore: PlantProtectionPlanBookStore,\n private formStore: FormStore,\n private mapViewStore: MapViewStore,\n private statisticStore: StatisticStore) {\n this.handleStateChangeAction = ApUtilService.createEventEmitter(this.handleStateChange.bind(this), this._subscriptions);\n /*\n * Setup of plant protection wizard state machine...\n */\n this._stateModel[PpWizardStates.Cancel] = {};\n this._stateModel[PpWizardStates.Selection] = {};\n this._stateModel[PpWizardStates.Details] = {};\n this._stateModel[PpWizardStates.Overview] = {};\n this._stateModel[PpWizardStates.Save] = {};\n // Definition of actions when state changes: [oldState][newState] => (action) executed\n this._stateModel[PpWizardStates.Selection][PpWizardStates.Details] = this.initDetails.bind(this); // user continues from selection to details\n this._stateModel[PpWizardStates.Details][PpWizardStates.Overview] = this.initOverview.bind(this); // user switches from details to overview-tab\n this._stateModel[PpWizardStates.Overview][PpWizardStates.Save] = this.initSave.bind(this); // user clicks export in overview\n this._stateModel[PpWizardStates.Overview][PpWizardStates.Details] = this.initDetails.bind(this); // user goes back to details from overview\n this._stateModel[PpWizardStates.Details][PpWizardStates.Selection] = this.initSelection.bind(this); // user navigates from details back to selection\n this._stateModel[PpWizardStates.Selection][PpWizardStates.Cancel] = this.initLeave.bind(this); // leaving wizard\n this._stateModel[PpWizardStates.Save][PpWizardStates.Details] = this.initDetails.bind(this); // after failed export user goes back to details\n this._stateModel[PpWizardStates.Save][PpWizardStates.Save] = this.initSave.bind(this); // export retry by user\n }\n\n public ngOnInit(): void {\n this.sensorStore.loadSensorFieldData();\n if (!this.plantProtectionProductStore.Listen(s => s.loaded).value) {\n this.plantProtectionProductStore.loadPlantProtectionProducts(true);\n }\n }\n\n public ngAfterContentInit(): void {\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.plantProtectionProductStore.Listen(s => s.loading)\n ]).pipe(\n map((loadings) => loadings.some((l) => l))\n );\n // Wizard step's provider configuration setup:\n this.wizardSelectionProvider.init(\n this.caption$,\n this.fieldSets$,\n this.errorKeys$,\n this.handleStateChangeAction,\n this._isContinueActive,\n this.dynComponent);\n this.wizardDetailsProvider.init(\n this.caption$,\n this.fieldSets$,\n this.dynComponent.dynForm,\n this.plantProtectionProductListTemplate,\n this.productListItems$);\n this.wizardOverviewProvider.init(\n this.caption$,\n this.fieldSets$,\n this.handleStateChangeAction,\n this._isContinueActive,\n this.dynComponent);\n this._subscriptions.push(this.dynComponent.dynForm.formValueChanges.subscribe(valuesChangesArgs => {\n if (this._activeWizardStep !== PpWizardStates.Details || this.dynComponent.dynForm.form.pristine ||\n (!this.dynComponent.dynForm.form.dirty && !this.dynComponent.dynForm.form.touched)) {\n return;\n }\n this.wizardDetailsProvider.onFormValueChanges(valuesChangesArgs);\n }));\n this.initSelection(PpWizardStates.Initial);\n this._subscriptions.push(\n this._statisticUpdateRequested.pipe(debounceTime(100)).subscribe(_ => {\n if (this.mapViewStore.getMapViewCurrentMenu() !== MapViewCurrentMenu.STATS ||\n this.mapViewStore.getMapViewMode() === MapViewMode.HIDE) {\n return;\n }\n this._activeProvider().onGenerateStatistic();\n })\n );\n this._subscriptions.push(this.items$.subscribe(_ => this._statisticUpdateRequested.emit()));\n this._subscriptions.push(\n combineLatest([\n this.mapViewStore.Listen(s => s.mode),\n this.mapViewStore.Listen(s => s.currentMenu)\n ]).subscribe(([mapMode, mapMenu]) => {\n if (mapMode !== MapViewMode.HIDE && mapMenu === MapViewCurrentMenu.STATS) {\n this._statisticUpdateRequested.emit();\n }\n }\n )\n );\n // Handle subscriptions in one place and forward them to the corresponding\n // wizard provider which is currently in charge of the action\n this._subscriptions.push(this.dynComponent.SelectedItems$.subscribe(items => {\n this._activeProvider()?.onGridSelectionChanged(items);\n this._statisticUpdateRequested.emit();\n }));\n }\n\n public ngOnDestroy(): void {\n this.statisticStore.removeStatisticData();\n this._subscriptions.forEach(s => s.unsubscribe());\n this.wizardSelectionProvider.onDestroy();\n this.wizardDetailsProvider.onDestroy();\n this.wizardOverviewProvider.onDestroy();\n }\n\n /**\n * Handles the state transitions between the wizard steps\n * and performs the corresponding actions defined in the wizard stateMachine/Model\n * @param newState the new wizard step. The user might have navigated back or forward\n * @private\n */\n private handleStateChange(newState: PpWizardStates): void {\n switch (this._activeWizardStep) {\n case PpWizardStates.Selection:\n this.selectionData = this.wizardSelectionProvider.onLeave();\n break;\n case PpWizardStates.Details:\n this.detailsData = this.wizardDetailsProvider.onLeave();\n break;\n case PpWizardStates.Overview:\n this.overviewData = this.wizardOverviewProvider.onLeave();\n break;\n }\n const oldState = this._activeWizardStep;\n this._activeWizardStep = newState;\n this.dynComponent.saveGridDescriptors(oldState);\n if (this._stateModel[oldState][newState]) {\n this._stateModel[oldState][newState](oldState);\n }\n // in order to restore sort/filter after user navigated through the wizard\n // we need to save and restore the grid descriptor for each wizard step\n this.dynComponent.loadGridDescriptors(newState);\n }\n\n /**\n * Handles whatever needs to happen when wizard switches to Selection\n * @param oldState indicates what the previous wizard step was (where the user comes from)\n * @private\n */\n private initSelection(oldState: PpWizardStates): void {\n this.items$ = this.wizardSelectionProvider.buildDataItems();\n this.buildUi(this.wizardSelectionProvider);\n // preselect currently selected fields (set by calling component)\n // or use previously selected field id's in case user came back from details step\n const selectedIds = oldState === PpWizardStates.Initial ?\n this.fieldStore.getSelectedFieldIds() :\n this.selectionData?.map(s => s.Id?.toString());\n if (selectedIds?.length > 0) {\n setTimeout(() => this.dynComponent.dynGrid?.gridPaging?.setSelectedKeys(selectedIds), 0);\n }\n }\n\n /**\n * Handles whatever needs to happen when wizard switches to Details\n * @param _oldState indicates what the previous wizard step was (where the user comes from)\n * @private\n */\n private initDetails(_oldState: PpWizardStates): void {\n this.productListColumns = this.wizardDetailsProvider.getProductListColumns();\n this.detailsData = this.wizardDetailsProvider.buildItem(this.selectionData);\n setTimeout(() => this.dynComponent.dynForm.form.patchValue(this.detailsData.FormData), 0);\n this.buildUi(this.wizardDetailsProvider);\n // trigger initial validations. Do not trigger validations if user\n setTimeout(() => this.dynComponent.dynForm.markAsTouched(), 0);\n }\n\n /**\n * Handles whatever needs to happen when wizard switches to Overview\n * @param _oldState indicates what the previous wizard step was (where the user comes from)\n * @private\n */\n private initOverview(_oldState: PpWizardStates): void {\n this.items$ = this.wizardOverviewProvider.buildDataItems(this.selectionData, this.detailsData, this.productListItems$?.value);\n this.buildUi(this.wizardOverviewProvider);\n if (this.detailsData.FormData.OperationModeKey === OperationModesEnum.PpTargetMapPerField\n || this.detailsData.FormData.OperationModeKey === OperationModesEnum.PPTargetMapPerPlan) {\n this._itemSubscription?.unsubscribe();\n this._itemSubscription = this.items$.pipe(\n debounceTime(10)\n ).subscribe((items: IPpPlanningWizardOverviewGridData[]) => {\n this._isContinueActive.next((items).every((i) => !i.ColumnLoading && !i.ErrorMessage));\n this._statisticUpdateRequested.emit();\n });\n } else {\n this._isContinueActive.next(true);\n }\n this._statisticUpdateRequested.emit();\n }\n\n /**\n * Handles whatever needs to happen when save is clicked\n * @private\n */\n private initSave(): void {\n const planBooks = this.overviewData.map(x => x.PlanBook);\n this.plantProtectionPlanBookStore.savePlanBooks(planBooks);\n setTimeout(() => this.formStore.closeForm(), 1);\n }\n\n /**\n * Handles whatever needs to happen when leaving the wizard\n * @private\n */\n private initLeave(): void {\n setTimeout(() => this.formStore.closeForm(), 1);\n }\n\n /**\n * Generic function to generate/build UI depending on current wizard state.\n * @param wizardProvider The provider for the current wizard step\n * @private\n */\n private buildUi(wizardProvider: IPpWizardProvider): void {\n if (!wizardProvider) {\n return;\n }\n wizardProvider.updateCaption();\n wizardProvider.updateFieldSets();\n this.columns$ = wizardProvider.getGridColumnConfig(this.detailsData);\n this.pager = wizardProvider.getPagerConfig(this.breadCrumbsColumns);\n }\n\n /**\n * Determines the active wizard provider based on current wizard step\n * @returns The active wizard provider for the current step\n * @private\n */\n private _activeProvider(): IPpWizardProvider {\n switch (this._activeWizardStep) {\n case PpWizardStates.Selection:\n return this.wizardSelectionProvider;\n case PpWizardStates.Details:\n return this.wizardDetailsProvider;\n case PpWizardStates.Overview:\n return this.wizardOverviewProvider;\n default:\n return undefined;\n }\n }\n}\n","import {LanguageStore} from '../../stores/translation/language.store';\nimport {\n SettingsStore\n} from '../../stores/base-data/settings.store';\nimport {GetRoundNumericPipe} from '../../ap-utils';\nimport {\n ApTranslationService\n} from '../../ap-utils/service/ap-translation.service';\nimport {Injectable} from '@angular/core';\nimport {\n ApDynGridColumnConfigBase,\n ApDynGridColumnHideConfig\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 {\n ApDynGridStatusColumnConfig\n} from '../../ap-dyngrids/config/ap-dyn-grid-status-column-config';\nimport {MapViewStore} from '../../stores/layout/mapview.store';\nimport {MapViewMode} from '../../ap-interface';\nimport {map} from 'rxjs/operators';\nimport {\n ApDynGridDetailsGridConfig\n} from '../../ap-dyngrids/config/details/ap-dyn-grid-details-grid-config';\nimport {\n ApDynGridGroupColumnConfig\n} from '../../ap-dyngrids/config/ap-dyn-grid-group-column-config';\nimport {BehaviorSubject, of, Subscription} from 'rxjs';\nimport {nameOf} from '../../ap-core/utils/ap-name-of';\nimport {IPpOverviewDetailsGridItem, IPpOverviewGridItem, PpColumnSwitchValue} from '../types/pp-overview.types';\nimport {\n GetRoundNumericService\n} from '../../ap-utils/service/get-round-numeric.service';\nimport {\n ApUtilService\n} from '../../ap-utils/service/ap-util.service';\nimport {PpNoDataValue} from '../types/pp-planning-booking.types';\nimport {\n ApTooltipContentService\n} from '../../ap-utils/service/ap-tooltip-content.service';\nimport {\n IGridStatus\n} from '../../ap-interface/interfaces/ap-grid-status.interface';\n\n/**\n * Service for grid configuration of plant protection overview\n * Plant-Protection -> overview\n */\n@Injectable({\n providedIn: 'root'\n})\nexport class PpOverviewGridConfig {\n private _subscriptions: Array = [];\n private _detailsColumnSwitch$: BehaviorSubject =\n new BehaviorSubject(PpColumnSwitchValue.Water);\n\n constructor(private languageStore: LanguageStore,\n private settingsStore: SettingsStore,\n private roundNumericPipe: GetRoundNumericPipe,\n private mapViewStore: MapViewStore,\n private tooltipContentService: ApTooltipContentService,\n private roundNumericService: GetRoundNumericService,\n private translationService: ApTranslationService) {\n }\n\n public getMainGridColumns(): 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 filterable: true\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__NumberAbbr',\n field: nameOf('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: nameOf('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: nameOf('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: nameOf('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: nameOf('Area'),\n width: 60,\n filterable: true,\n cssClass: 'right',\n filterType: FilterType.NUMBER,\n template: PropertyTemplate.NUMBER,\n headerFilterable: true,\n tooltip: (dataItem: IPpOverviewGridItem) => this.roundNumericService.stringify(dataItem.Area, 4),\n pipes: [{\n pipe: this.roundNumericPipe,\n args: [this.settingsStore.FirstSetting.DigitsAfterDecimalPoint]\n }]\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__Crop',\n field: nameOf('Crop'),\n width: 100,\n filterable: true,\n headerFilterable: true\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__ECStageShort',\n field: nameOf('EcValue'),\n cssClass: 'right',\n filterType: FilterType.NUMBER,\n filterable: true,\n width: 40\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__Fieldcrop_Notes',\n field: nameOf('CropNote'),\n tooltip: (dataItem: IPpOverviewGridItem) => this.tooltipContentService.generateCropNoteTooltip(dataItem?.CropNote),\n width: 100\n }),\n new ApDynGridEditColumnConfig({\n disabled: true\n })\n ];\n }\n\n public getDetailsGridColumns(onShowPerPlanView: (value: IPpOverviewDetailsGridItem) => void,\n onShowPerFieldView: (value: IPpOverviewDetailsGridItem) => void): ApDynGridDetailsGridConfig {\n return new ApDynGridDetailsGridConfig({\n field: 'Applications',\n checkboxDisabled: true,\n hide: (dataItem) => !(dataItem?.Applications?.length > 0),\n columns: [\n new ApDynGridStatusColumnConfig({\n field: `${nameOf('Status')}.${nameOf('state')}`,\n class: `${nameOf('Status')}.${nameOf('class')}`,\n description: `${nameOf('Status')}.${nameOf('description')}`,\n filterable: true\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global_Application_Date',\n field: nameOf('ApplDate'),\n format: this.languageStore.CurrentDateFormat,\n sortIndex: 0,\n hide: true,\n sortDesc: true,\n filterable: true,\n width: 80\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__ECStageShort',\n field: nameOf('Ec'),\n cssClass: 'right',\n filterType: FilterType.NUMBER,\n filterable: true,\n width: 40\n }),\n new ApDynGridGroupColumnConfig({\n title: 'N__ChartTitleX',\n width: 150,\n hide: true,\n groupColumns: [\n new ApDynGridPropertyColumnConfig({\n title: 'Global__Avg_Symbol',\n field: nameOf('NUptakeAvg'),\n width: 50,\n cssClass: 'right',\n filterType: FilterType.NUMBER,\n filterable: true,\n pipes: [{\n pipe: this.roundNumericPipe,\n args: [0, {ToReplace: [PpNoDataValue], ReplaceWith: ''}]\n }]\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__Min',\n field: nameOf('NUptakeMin'),\n width: 50,\n cssClass: 'right',\n filterType: FilterType.NUMBER,\n filterable: true,\n pipes: [{\n pipe: this.roundNumericPipe,\n args: [0, {ToReplace: [PpNoDataValue], ReplaceWith: ''}]\n }]\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__Max',\n field: nameOf('NUptakeMax'),\n width: 50,\n cssClass: 'right',\n filterType: FilterType.NUMBER,\n filterable: true,\n pipes: [{\n pipe: this.roundNumericPipe,\n args: [0, {ToReplace: [PpNoDataValue], ReplaceWith: ''}]\n }]\n }),\n ]\n }),\n new ApDynGridGroupColumnConfig({\n title: `${this.translationService.translate('Global__Water')} [${this.translationService.translate('Unit_l_per_ha')}]`,\n width: 150,\n hide: true,\n groupColumns: [\n new ApDynGridPropertyColumnConfig({\n title: 'Global__Avg_Symbol',\n field: nameOf('WaterAvg'),\n cssClass: 'right',\n filterType: FilterType.NUMBER,\n filterable: true,\n width: 50,\n pipes: [{\n pipe: this.roundNumericPipe,\n args: [0, {ToReplace: [PpNoDataValue], ReplaceWith: ''}]\n }]\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__Min',\n field: nameOf('WaterMin'),\n width: 50,\n cssClass: 'right',\n filterType: FilterType.NUMBER,\n filterable: true,\n pipes: [{\n pipe: this.roundNumericPipe,\n args: [0, {ToReplace: [PpNoDataValue], ReplaceWith: ''}]\n }]\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__Max',\n field: nameOf('WaterMax'),\n width: 50,\n cssClass: 'right',\n filterType: FilterType.NUMBER,\n filterable: true,\n pipes: [{\n pipe: this.roundNumericPipe,\n args: [0, {ToReplace: [PpNoDataValue], ReplaceWith: ''}]\n }]\n }),\n ]\n }),\n new ApDynGridGroupColumnConfig({\n title: this._detailsColumnSwitch$.pipe(map((c) => c === PpColumnSwitchValue.Water ?\n `${this.translationService.translate('Global__Water')} [${this.translationService.translate('Unit_l_per_ha')}]` :\n 'N__ChartTitleX')),\n hide: new ApDynGridColumnHideConfig({\n mapHide: false,\n selfHide: this.mapViewStore.Listen(s => s.mode).pipe(map((m) => m !== MapViewMode.NORMAL)),\n }),\n xlsExport: false,\n width: 150,\n headerButtons: {\n nextClicked: ApUtilService.createEventEmitter(this.switchColumn.bind(this), this._subscriptions),\n previousClicked: ApUtilService.createEventEmitter(this.switchColumn.bind(this), this._subscriptions),\n nextDisabled: of(false),\n previousDisabled: of(false)\n },\n groupColumns: [\n new ApDynGridPropertyColumnConfig({\n title: 'Global__Avg_Symbol',\n field: nameOf('NUptakeAvg'),\n cssClass: 'right',\n filterType: FilterType.NUMBER,\n filterable: true,\n width: 50,\n hide: new ApDynGridColumnHideConfig({\n mapHide: false,\n selfHide: this._detailsColumnSwitch$.pipe(map((c) => c !== PpColumnSwitchValue.NUptake))\n }),\n pipes: [{\n pipe: this.roundNumericPipe,\n args: [0, {ToReplace: [PpNoDataValue], ReplaceWith: ''}]\n }]\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__Min',\n field: nameOf('NUptakeMin'),\n cssClass: 'right',\n filterType: FilterType.NUMBER,\n filterable: true,\n width: 50,\n hide: new ApDynGridColumnHideConfig({\n mapHide: false,\n selfHide: this._detailsColumnSwitch$.pipe(map((c) => c !== PpColumnSwitchValue.NUptake))\n }),\n pipes: [{\n pipe: this.roundNumericPipe,\n args: [0, {ToReplace: [PpNoDataValue], ReplaceWith: ''}]\n }]\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__Max',\n field: nameOf('NUptakeMax'),\n cssClass: 'right',\n filterType: FilterType.NUMBER,\n filterable: true,\n width: 50,\n hide: new ApDynGridColumnHideConfig({\n mapHide: false,\n selfHide: this._detailsColumnSwitch$.pipe(map((c) => c !== PpColumnSwitchValue.NUptake))\n }),\n pipes: [{\n pipe: this.roundNumericPipe,\n args: [0, {ToReplace: [PpNoDataValue], ReplaceWith: ''}]\n }]\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__Avg_Symbol',\n field: nameOf('WaterAvg'),\n cssClass: 'right',\n filterType: FilterType.NUMBER,\n filterable: true,\n width: 50,\n hide: new ApDynGridColumnHideConfig({\n mapHide: false,\n selfHide: this._detailsColumnSwitch$.pipe(map((c) => c !== PpColumnSwitchValue.Water))\n }),\n pipes: [{\n pipe: this.roundNumericPipe,\n args: [0, {ToReplace: [PpNoDataValue], ReplaceWith: ''}]\n }]\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__Min',\n field: nameOf('WaterMin'),\n cssClass: 'right',\n filterType: FilterType.NUMBER,\n filterable: true,\n width: 50,\n hide: new ApDynGridColumnHideConfig({\n mapHide: false,\n selfHide: this._detailsColumnSwitch$.pipe(map((c) => c !== PpColumnSwitchValue.Water))\n }),\n pipes: [{\n pipe: this.roundNumericPipe,\n args: [0, {ToReplace: [PpNoDataValue], ReplaceWith: ''}]\n }]\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__Max',\n field: nameOf('WaterMax'),\n cssClass: 'right',\n filterType: FilterType.NUMBER,\n filterable: true,\n width: 50,\n hide: new ApDynGridColumnHideConfig({\n mapHide: false,\n selfHide: this._detailsColumnSwitch$.pipe(map((c) => c !== PpColumnSwitchValue.Water))\n }),\n pipes: [{\n pipe: this.roundNumericPipe,\n args: [0, {ToReplace: [PpNoDataValue], ReplaceWith: ''}]\n }]\n })\n ]\n }),\n new ApDynGridPropertyColumnConfig({\n title: `${this.translationService.translate('Global_Worked_Area')} [${this.translationService.translate('Unit_ha')}]`,\n breakHeaderLine: true,\n field: nameOf('WorkArea'),\n filterable: true,\n width: 78,\n hide: true,\n cssClass: 'right',\n filterType: FilterType.NUMBER,\n template: PropertyTemplate.NUMBER,\n tooltip: (dataItem: IPpOverviewDetailsGridItem) => this.roundNumericService.stringify(dataItem.WorkArea, 4),\n pipes: [{\n pipe: this.roundNumericPipe,\n args: [this.settingsStore.FirstSetting.DigitsAfterDecimalPoint]\n }]\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__Products',\n field: nameOf('Products'),\n width: 400,\n hide: true,\n filterable: true,\n headerFilterable: true,\n tooltip: (dataItem: IPpOverviewDetailsGridItem) => dataItem?.ProductsTooltip\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__Products',\n field: nameOf('Products'),\n width: 120,\n filterable: true,\n headerFilterable: true,\n tooltip: (dataItem: IPpOverviewDetailsGridItem) => dataItem?.ProductsTooltip,\n hide: new ApDynGridColumnHideConfig({\n mapHide: false,\n selfHide: this.mapViewStore.Listen(s => s.mode).pipe(map((m) => m !== MapViewMode.NORMAL)),\n }),\n }),\n new ApDynGridEditColumnConfig({\n data: [\n {\n text: 'ShowMapPpOverviewPerPlan',\n callback: ApUtilService.createEventEmitter(onShowPerPlanView, this._subscriptions),\n },\n {\n text: 'Global__SingleFieldView',\n callback: ApUtilService.createEventEmitter(onShowPerFieldView, this._subscriptions),\n }\n ]\n })\n ]\n });\n }\n\n public destroy(): void {\n this._subscriptions.forEach(d => d.unsubscribe());\n }\n\n private switchColumn(): void {\n this._detailsColumnSwitch$.next(this._detailsColumnSwitch$.value === PpColumnSwitchValue.NUptake ?\n PpColumnSwitchValue.Water : PpColumnSwitchValue.NUptake);\n }\n}\n","import {AfterViewInit, Component, EventEmitter, 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, Subscription} from 'rxjs';\nimport {\n CampaignYearStore\n} from '../../stores/login/campaignyear.store';\nimport {\n ApDynGridDetailsGridConfig\n} from '../../ap-dyngrids/config/details/ap-dyn-grid-details-grid-config';\nimport {\n PpNoDataValue\n} from '../types/pp-planning-booking.types';\nimport {\n ApDynGridPagerConfigBase\n} from '../../ap-dyngrids/config/ap-dyn-grid-pager-config-base';\nimport {IPpOverviewDetailsGridItem, IPpOverviewGridItem, PpOverviewMassEditAction} from '../types/pp-overview.types';\nimport {PpCommonService} from '../services/pp-common.service';\nimport {\n PpOverviewGridConfig\n} from '../configs/pp-overview-grid.config';\nimport {filter, map} from 'rxjs/operators';\nimport {\n CropTypeStore\n} from '../../stores/base-data/crop.types.store';\nimport {FieldStore} from '../../stores/farm/field.store';\nimport {\n ApDynGridPagerConfig,\n IDynGridWizardChoiceData\n} from '../../ap-dyngrids/config/ap-dyn-grid-pager-config';\nimport {\n FieldService\n} from '../../field-management/components/field.service';\nimport {\n ApGetCropService\n} from '../../stores/services/ap-get-crop.service';\nimport {\n GetRoundNumericService\n} from '../../ap-utils/service/get-round-numeric.service';\nimport {\n Icon\n} from '../../ap-interface/enums/layout/icon.enum';\nimport {\n ApUtilService\n} from '../../ap-utils/service/ap-util.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 ApNutrientService\n} from '../../ap-utils/service/ap-nutrient.service';\nimport {\n PpPlanningWizardComponent\n} from '../../entry-components/plant-protection-entry-components/planning-wizard/pp-planning-wizard.component';\nimport {\n FormStore\n} from '../../stores/layout/form.store';\nimport {ApGridPagerType, IGridPagerData} from '../../ap-interface';\nimport {ObjectFactory} from 'ts-tooling';\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 PlantProtectionPlanBookStore\n} from '../../stores/plant-protection/plant-protection-planbook.store';\nimport {\n AgriportConstantsService\n} from '../../services/common/agriport-constants.service';\nimport {\n ApShowPointsOnMapService\n} from '../../ap-utils/service/ap-show-points-on-map.service';\nimport {\n PlantProtectionService\n} from '../../services/data/plant-protection.service';\nimport {\n IGridStatus\n} from '../../ap-interface/interfaces/ap-grid-status.interface';\nimport IField = Data.FieldManagement.IField;\nimport IPlantProtectionPlanBook = Data.TaskManagement.IPlantProtectionPlanBook;\nimport IFieldGeom = Data.FieldManagement.IFieldGeom;\n\n@Component({\n selector: 'plant-protection-overview',\n template: `\n \n \n `,\n styles: []\n})\nexport class PpOverviewComponent implements OnInit, AfterViewInit, OnDestroy {\n @ViewChild(ApDynComponentComponent) dynComponent: ApDynComponentComponent;\n public columns: ApDynGridColumnConfigBase[] = [];\n public detailsColumns: ApDynGridDetailsGridConfig;\n public items$ = new BehaviorSubject([]);\n public loading$: Observable;\n public pager: ApDynGridPagerConfigBase;\n\n private _applyClicked = new EventEmitter();\n private _subscriptions: Array = [];\n\n constructor(private campaignYearStore: CampaignYearStore,\n private cropTypeStore: CropTypeStore,\n private fieldStore: FieldStore,\n private notifyStore: NotifyStore,\n private formStore: FormStore,\n private cropService: ApGetCropService,\n private ppCommonService: PpCommonService,\n private fieldService: FieldService,\n private dateService: ApDateService,\n private nutrientService: ApNutrientService,\n private translationService: ApTranslationService,\n private roundNumericService: GetRoundNumericService,\n private ppOverviewGridConfig: PpOverviewGridConfig,\n private agriportConstantsService: AgriportConstantsService,\n private plantProtectionPlanBooksStore: PlantProtectionPlanBookStore,\n private showPointsOnMap: ApShowPointsOnMapService,\n private plantProtectionService: PlantProtectionService) {\n }\n\n public ngOnInit(): void {\n this.loading$ = combineLatest([\n this.plantProtectionPlanBooksStore.Listen(s => s.loading),\n this.cropTypeStore.Listen(s => s.loading),\n this.fieldStore.Listen(s => s.loading)\n ]).pipe(\n map(loadingItems => loadingItems.some(isLoading => isLoading))\n );\n this._subscriptions.push(this.campaignYearStore.Listen(s => s.selectedYear).subscribe(() => {\n this.plantProtectionPlanBooksStore.loadPlanBooks();\n }));\n this._subscriptions.push(this._buildItems().subscribe((items) => {\n this.items$.next(items);\n }));\n this.pager = this._buildPager();\n this._buildGrid();\n }\n\n public ngAfterViewInit(): void {\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.dynComponent.SelectedItems$.subscribe(items => {\n this.fieldStore.changeSelectedField(items.map(x => x.Id.toString()));\n if (items.length === 0) {\n this._onShowAll(this.items$.value);\n this.fieldStore.zoomFarmFields();\n } else if (items.length > 1) {\n this._onShowAll(items);\n }\n }));\n this._subscriptions.push(this._applyClicked.subscribe((e) => this._onApplyClicked(e)));\n this._subscriptions.push(this.fieldStore.Listen(x => x.fieldCropsSaved).subscribe(x => {\n this._invokeWhenFieldCropsUpdated(x);\n }));\n }\n\n public ngOnDestroy(): void {\n this.showPointsOnMap.clear();\n this.ppOverviewGridConfig?.destroy();\n this._subscriptions.forEach(d => d.unsubscribe());\n }\n\n /**\n * Opens the pp planning wizard\n * the preselection is handled in dynForm's selection change already\n */\n public onCreate(): void {\n this.formStore.openForm({component: PpPlanningWizardComponent, data: null});\n }\n\n private _buildGrid(): void {\n this.columns = this.ppOverviewGridConfig.getMainGridColumns();\n this.detailsColumns = this.ppOverviewGridConfig.getDetailsGridColumns(\n this.onShowPerPlanView.bind(this),\n this.onShowPerFieldView.bind(this)\n );\n }\n\n /**\n * Build the main grid items\n */\n private _buildItems(): Observable {\n return combineLatest([\n this.plantProtectionPlanBooksStore.Listen(s => s.data),\n this.fieldStore.Listen(s => s.data),\n this.cropTypeStore.Listen(s => s.cropTypesNames)\n ]).pipe(\n filter(([planBooks, fields, cropTypesNames]) =>\n !!planBooks && !!fields && !!cropTypesNames),\n map(([planBooks, fields]) => {\n return fields.map(field => {\n const geom = this.fieldStore.getCurrentFieldGeom(field);\n const applications = this._getApplications(field, planBooks);\n const mainCrop = this.cropService.parseMainCrop(field);\n const fieldCrop = mainCrop ? this.cropService.getFieldCrop(field) : null;\n // initialize a variable of the target type to keep it type-safe.\n // A cast (\"as\") does not ensure type safety\n const mainItem: IPpOverviewGridItem = {\n Id: field.Id,\n FieldCrop: fieldCrop,\n Status: this.getOverviewItemStatus(geom),\n Nr: field.FieldNumber,\n SNr: field.FieldSubnumber,\n NrSNr: this.fieldStore.getFieldNumberAndSubNumber(field),\n Name: field?.FieldName,\n Area: geom ? geom.AreaHa : undefined,\n Crop: mainCrop,\n EcValue: fieldCrop?.EcValue,\n CropNote: fieldCrop?.Note,\n Applications: applications\n };\n return mainItem;\n });\n }));\n }\n\n /**\n * Builds the details/applications data for each main row\n */\n private _getApplications(field: IField, planBooks: IPlantProtectionPlanBook[]): IPpOverviewDetailsGridItem[] {\n const result: IPpOverviewDetailsGridItem[] = [];\n if (!planBooks || planBooks.length <= 0 || !field) {\n return result;\n }\n result.AddRange(this.plantProtectionService.getPpApplications(field, planBooks)\n .map(planBook => {\n const fieldGeom = this.fieldStore.getFieldGeomById(planBook.FieldGeomId);\n const area = this.roundNumericService.roundAsNumber(fieldGeom?.AreaHa ?? 0, 4);\n const appliedProducts = this.ppCommonService.getDistinctProductsOfPlanBooks([planBook]);\n const isWorkTypeSpraying = this.ppCommonService.isWorkTypeSpraying(planBook);\n const nUptakeValues = planBook.RasterStatistics.Find(s => s.Band === 0);\n const waterValues = planBook.RasterStatistics.Find(s => s.Band === 1);\n const detailItem: IPpOverviewDetailsGridItem = {\n Id: planBook.Id,\n FieldId: field.Id,\n Status: this.getDetailItemStatus(planBook),\n ApplNum: this.ppCommonService.getApplNumName(this.ppCommonService.getApplNumFromSummary(planBook.Summary)),\n OperationMode: this.translationService.translate(planBook.OperationMode?.Key),\n WorkArea: area,\n ApplDate: new Date(planBook.ApplicationDate),\n Ec: planBook.EcValue,\n NUptakeAvg: nUptakeValues?.Mean ?? PpNoDataValue,\n NUptakeMin: nUptakeValues?.Min ?? PpNoDataValue,\n NUptakeMax: nUptakeValues?.Max ?? PpNoDataValue,\n WaterAvg: waterValues?.Mean ?? isWorkTypeSpraying ? planBook.ApplicationRate : PpNoDataValue,\n WaterMin: waterValues?.Min ?? isWorkTypeSpraying ? planBook.ApplicationMin : PpNoDataValue,\n WaterMax: waterValues?.Max ?? isWorkTypeSpraying ? planBook.ApplicationMax : PpNoDataValue,\n Products: this.ppCommonService.getAppliedProductsExpr(appliedProducts, false, '; '),\n ProductsTooltip: this.ppCommonService.getAppliedProductsExpr(appliedProducts, true),\n CropKey: planBook.MainCropId,\n PlanId: planBook.Id as string,\n };\n return detailItem;\n }));\n return result;\n }\n\n private getOverviewItemStatus(fieldGeom: IFieldGeom | undefined): IGridStatus {\n const status = this.fieldService.getGeomStatus(fieldGeom, this.campaignYearStore.SelectedCampaignYear);\n return {\n state: status,\n class: status === 1 ? 'ap-status-green' : 'ap-status-red',\n description: '',\n };\n }\n\n private getDetailItemStatus(planBook: IPlantProtectionPlanBook | undefined): IGridStatus {\n const status = this.nutrientService.getFertilizerStatus(planBook?.Summary?.ApplicationMode, false);\n status.description = this.nutrientService.getFertilizerStatusDescription(planBook?.Summary?.ApplicationMode, false);\n return status;\n }\n\n private _buildPager(): ApDynGridPagerConfig {\n return 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 === PpOverviewMassEditAction.Edit) {\n const selectedFieldCrops = (this.dynComponent.getSelectedItems() as IPpOverviewGridItem[])\n .filter(x => x.FieldCrop)\n .map(x => x.FieldCrop);\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 if (isUpdated) {\n this.notifyStore.showSaveSuccessMessage();\n } else {\n this.notifyStore.showSaveFailMessage();\n }\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__Plant_Protection')}_` +\n `${this.translationService.translate('Admin_Pages__Overview')}`;\n }\n\n private onShowPerPlanView(dataItem: IPpOverviewDetailsGridItem): void {\n const summary = this.plantProtectionPlanBooksStore.PlanBooks.find(x => x.Id === dataItem?.PlanId)?.Summary;\n if (!summary) {\n return;\n }\n const relatedPlanBooks = this.plantProtectionPlanBooksStore.PlanBooks.filter(x => x.Summary.Id === summary.Id && !!x.BookedAt);\n const rasterData = relatedPlanBooks.map(x => ({\n FieldId: x.FieldId.toString(),\n PlanBookId: x.Id.toString()\n }));\n this.showPointsOnMap.showAllRaster(rasterData, 'pp');\n this.dynComponent.dynGrid.gridPaging.setSelectedKeys(rasterData.map(x => x.FieldId));\n }\n\n private onShowPerFieldView(dataItem: IPpOverviewDetailsGridItem): void {\n if (!dataItem?.FieldId || !dataItem?.PlanId) {\n return;\n }\n const fieldIdString = dataItem.FieldId.toString();\n this.showPointsOnMap.showRaster(fieldIdString, dataItem.PlanId.toString(), 'pp');\n this.dynComponent.dynGrid.gridPaging.setSelectedKeys([fieldIdString]);\n }\n\n private _onShowAll(items: IPpOverviewGridItem[], applicationMap: { [fieldId: string]: any } = {}): void {\n if (!items) {\n return;\n }\n items\n .map((i) => i.Applications as IPpOverviewDetailsGridItem[])\n .flat()\n .forEach((other: IPpOverviewDetailsGridItem) => {\n const fieldId = other.FieldId.toString();\n if (applicationMap[fieldId] !== undefined) {\n if (other.ApplDate.valueOf() > applicationMap[fieldId].ApplDate.valueOf()) {\n applicationMap[fieldId] = other;\n }\n } else {\n applicationMap[fieldId] = other;\n }\n });\n const showRaster = Object.keys(applicationMap).map((key) => ({\n FieldId: key,\n PlanBookId: applicationMap[key].PlanId\n }));\n this.showPointsOnMap.showAllRaster(showRaster, 'pp');\n }\n}\n","import {AfterViewInit, Component, OnDestroy, OnInit, ViewChild} from '@angular/core';\nimport {\n ApDynComponentComponent\n} from '../../ap-dyncomponent/ap-dyncomponent.component';\nimport {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 {\n CropTypeStore\n} from '../../stores/base-data/crop.types.store';\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 IPpPlanningBookingGridItem\n} from '../../plant-protection/types/pp-planning-booking.types';\nimport {\n PpConstants\n} from './planning-wizard/pp-planning-wizard.types';\nimport {filter, map} from 'rxjs/operators';\nimport {MapViewMode} from '../../ap-interface';\nimport {\n ApDynGridPropertyColumnConfig,\n FilterType\n} from '../../ap-dyngrids/config/ap-dyn-grid-property-column-config';\nimport {\n nameOf\n} from '../../ap-core/utils/ap-name-of';\nimport {\n ApDynGridGroupColumnConfig\n} from '../../ap-dyngrids/config/ap-dyn-grid-group-column-config';\nimport {\n GetRoundNumericService\n} from '../../ap-utils/service/get-round-numeric.service';\nimport {\n ApTranslationService\n} from '../../ap-utils/service/ap-translation.service';\nimport {\n OperationModesEnum\n} from '../../stores/common/operation-modes.store';\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 ApDynGridStatusColumnConfig\n} from '../../ap-dyngrids/config/ap-dyn-grid-status-column-config';\nimport {\n PpCommonService\n} from '../../plant-protection/services/pp-common.service';\nimport {\n ApNutrientService\n} from '../../ap-utils/service/ap-nutrient.service';\nimport IGuid = System.IGuid;\n\nexport interface IPpPlanningShowGridItem {\n Id: IGuid;\n FieldId: IGuid;\n Status: number;\n StatusClass: string;\n StatusDesc: string;\n Nr: number;\n TNr: number;\n NrTNr: string;\n Name: string;\n Area: number;\n Crop: string;\n ECStage: number;\n ApplicationDate: Date;\n WaterAvg: number;\n WaterMin: number;\n WaterMax: number;\n Products: string;\n ProductsTooltip: string;\n Machine: string;\n Instrument: string;\n Driver: string;\n ControlFactorExpr: string;\n}\n\n@Component({\n selector: 'pp-planning-show',\n template: `\n \n \n `\n})\nexport class PpPlanShowComponent implements OnInit, AfterViewInit, OnDestroy {\n @ViewChild(ApDynComponentComponent, {static: true}) dynComponent: ApDynComponentComponent;\n public data: { DataItem: IPpPlanningBookingGridItem, IsBooked: boolean };\n public columns$: Observable = of([]);\n public items$: Observable = of([]);\n public loading$: Observable = of(false);\n public pager: ApDynGridPagerConfigBase;\n private _subscriptions: Subscription[] = [];\n\n constructor(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 roundNumericService: GetRoundNumericService,\n private translationService: ApTranslationService,\n private driverStore: DriverStore,\n private instrumentStore: InstrumentStore,\n private machineStore: MachineStore,\n private ppCommonService: PpCommonService,\n private nutrientService: ApNutrientService,\n private roundNumericPipe: GetRoundNumericPipe) {\n this.loading$ = combineLatest([\n this.fieldStore.Listen(s => s.loading),\n this.cropTypeStore.Listen(s => s.loading)\n ]).pipe(map((loadings) => loadings.some((l) => l)));\n }\n\n public ngOnInit(): void {\n this.pager = this._getPager();\n this.columns$ = this._buildGrid();\n this.items$ = this._buildDataItems();\n }\n\n public ngAfterViewInit(): void {\n this._subscriptions.push(\n this.dynComponent.SelectedItems$.subscribe((items: IPpPlanningShowGridItem[]) => {\n const fieldsToSelect: string[] = items.map(i => i.FieldId?.toString());\n if (fieldsToSelect?.length > 0) {\n this.fieldStore.changeSelectedField(fieldsToSelect);\n }\n })\n );\n this._subscriptions.push(\n this.items$.subscribe((items: IPpPlanningShowGridItem[]): void => {\n const itemsToSelect = items.map(i => i.Id);\n this.dynComponent.dynGrid.gridPaging.setSelectedKeys(itemsToSelect);\n })\n );\n }\n\n public ngOnDestroy(): void {\n this._subscriptions.forEach(s => s.unsubscribe());\n }\n\n /**\n * Build overview data items\n */\n private _buildDataItems(): Observable {\n if (!this.data || this.data?.DataItem?.PlanBooks?.length <= 0) {\n return of([]);\n }\n\n return combineLatest([\n this.cropTypeStore.Listen(s => s.data),\n this.fieldStore.Listen(s => s.data)\n ]).pipe(\n filter(([cropTypesNames, fields]) =>\n !!cropTypesNames && !!fields),\n map(([cropTypes, fields]) => {\n const gridData = new Array();\n const planBooks = this.data?.DataItem?.PlanBooks?.filter(p =>\n this.data?.IsBooked ? p.BookedAt !== null : p.BookedAt === null);\n for (const planBook of planBooks) {\n if (planBook == null) {\n continue;\n }\n const field = fields.FirstOrDefault(f => f.Id === planBook.FieldId);\n gridData.push({\n Id: planBook?.Id,\n FieldId: field?.Id,\n Status: this.nutrientService.getFertilizerStatus(planBook.ApplicationMode, this.data?.IsBooked)?.state,\n StatusClass: this.nutrientService.getFertilizerStatus(planBook.ApplicationMode, this.data?.IsBooked)?.class,\n StatusDesc: this.nutrientService.getFertilizerStatusDescription(planBook.ApplicationMode, this.data?.IsBooked),\n Nr: field?.FieldNumber,\n TNr: field?.FieldSubnumber,\n NrTNr: field != null ? this.fieldStore.getFieldNumberAndSubNumber(field) : '',\n Name: field?.FieldName,\n Area: planBook.PlannedArea / 10000,\n Crop: this.translationService.translate(cropTypes?.FirstOrDefault(c => c.Id === planBook.MainCropId)?.Description),\n ECStage: planBook.EcValue,\n ApplicationDate: new Date(planBook.ApplicationDate),\n WaterAvg: planBook.ApplicationRate,\n WaterMax: planBook.ApplicationMax,\n WaterMin: planBook.ApplicationMin,\n Machine: this.machineStore.getMachineById(planBook.ExportMachine)?.NameWithSign,\n Instrument: this.instrumentStore.getInstrumentById(planBook.ExportInstrument)?.Name,\n Driver: this.driverStore.getDriverById(planBook.ExportDriver)?.ShortFullName,\n Products: this.ppCommonService.getAppliedProductsExpr(planBook.ProductList), // selectedProducts?.map(p => this.buildProductExpr(p))?.join(', '),\n ProductsTooltip: this.ppCommonService.getAppliedProductsExpr(planBook.ProductList, true), // this.ppCommonService.getAppliedProductsExpr(selectedProducts),\n ControlFactorExpr: this.translationService.translate(PpConstants.PpControlFactors.FirstOrDefault(c => c.Id === planBook.Slope)?.Key)\n });\n }\n return gridData;\n }));\n }\n\n private _buildGrid(): 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(() => {\n const mapHide = this.mapViewStore.Listen(s => s.mode).pipe(\n map((mapMode) => mapMode === MapViewMode.HIDE));\n const isWorkTypeSpraying = this.ppCommonService.isWorkTypeSpraying(this.data?.DataItem?.PlanBooks?.FirstOrDefault());\n const showPpPlanningColumns: ApDynGridColumnConfigBase[] = this._getCommonColumns(mapHide);\n switch (this.data?.DataItem?.OperationModeKey) {\n case OperationModesEnum.Constant:\n if (isWorkTypeSpraying) {\n showPpPlanningColumns.Add(this._getUniformSprayingColumns());\n }\n break;\n case OperationModesEnum.PpTarget:\n showPpPlanningColumns.AddRange(this._getTargetRateColumns());\n break;\n }\n showPpPlanningColumns.AddRange(this._getCommonEndColumns());\n return showPpPlanningColumns;\n }));\n }\n\n /**\n * Creates grid column configs for uniform operationMode with work type 'spraying'\n * @private\n */\n private _getUniformSprayingColumns(): ApDynGridColumnConfigBase {\n return new ApDynGridPropertyColumnConfig({\n title: `${this.translationService.translate('Global__AvgShort')} ${this.translationService.translate('Global__Water')} [${this.translationService.translate('Unit_l_per_ha')}]`,\n field: `${nameOf('WaterAvg')}`,\n width: 100,\n filterable: true,\n headerFilterable: true,\n cssClass: 'right',\n filterType: FilterType.NUMBER,\n });\n }\n\n /**\n * Creates grid column configs for target rate operationMode\n * @private\n */\n private _getTargetRateColumns(): ApDynGridColumnConfigBase[] {\n return [\n new ApDynGridPropertyColumnConfig({\n title: 'RateSlope',\n field: `${nameOf('ControlFactorExpr')}`,\n hide: true,\n width: 80\n }),\n new ApDynGridGroupColumnConfig({\n title: `${this.translationService.translate('Global__Water')} [${this.translationService.translate('Unit_l_per_ha')}]`,\n groupColumns: [\n new ApDynGridPropertyColumnConfig({\n title: 'Global__AvgShort',\n field: `${nameOf('WaterAvg')}`,\n width: 50,\n cssClass: 'right',\n filterType: FilterType.NUMBER,\n pipes: [{\n pipe: this.roundNumericPipe,\n args: [0]\n }]\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__Min',\n field: `${nameOf('WaterMin')}`,\n width: 50,\n cssClass: 'right',\n filterType: FilterType.NUMBER,\n pipes: [{\n pipe: this.roundNumericPipe,\n args: [0]\n }]\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__Max',\n field: `${nameOf('WaterMax')}`,\n width: 50,\n cssClass: 'right',\n filterType: FilterType.NUMBER,\n pipes: [{\n pipe: this.roundNumericPipe,\n args: [0]\n }]\n })\n ]\n })\n ];\n }\n\n /**\n * Creates grid column configs which are common for all operation modes.\n * @param mapHide\n * @private\n */\n private _getCommonColumns(mapHide: Observable): ApDynGridColumnConfigBase[] {\n return [\n new ApDynGridStatusColumnConfig({\n field: nameOf('Status'),\n class: nameOf('StatusClass'),\n description: nameOf('StatusDesc'),\n title: '',\n filterable: true\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Docu_Ini__Number',\n field: `${nameOf('Nr')}`,\n width: 40,\n hide: 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: 40,\n hide: 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: 50,\n headerFilterable: true,\n hide: new ApDynGridColumnHideConfig({\n selfHide: mapHide\n })\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Docu_Ini__Name',\n field: `${nameOf('Name')}`,\n width: 110,\n cssClass: 'left',\n sortIndex: 0,\n headerFilterable: true\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Docu_Ini__Area',\n field: `${nameOf('Area')}`,\n width: 50,\n headerFilterable: true,\n tooltip: (dataItem) => this.roundNumericService.stringify((dataItem as IPpPlanningShowGridItem)?.Area, 4),\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: `${nameOf('Crop')}`,\n width: 80,\n hide: true,\n headerFilterable: true\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__EC',\n field: `${nameOf('ECStage')}`,\n width: 50,\n hide: true,\n cssClass: 'right',\n filterType: FilterType.NUMBER,\n })];\n }\n\n /**\n * Creates grid column configs for the common last columns\n * @private\n */\n private _getCommonEndColumns(): ApDynGridColumnConfigBase[] {\n return [\n new ApDynGridPropertyColumnConfig({\n title: 'Global__Products',\n field: nameOf('Products'),\n width: 200,\n tooltip: (dataItem) => (dataItem as IPpPlanningShowGridItem)?.ProductsTooltip,\n multiline: true,\n filterable: true,\n headerFilterable: true\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Base__SortItemDate',\n field: `${nameOf('ApplicationDate')}`,\n format: this.languageStore?.CurrentDateFormat,\n hide: true,\n width: 70\n }),\n new ApDynGridGroupColumnConfig({\n title: 'agrioptions_resources',\n hide: true,\n groupColumns: [\n new ApDynGridPropertyColumnConfig({\n field: nameOf('Machine'),\n title: 'Base__Engine',\n width: 120,\n hide: true,\n }),\n new ApDynGridPropertyColumnConfig({\n field: nameOf('Instrument'),\n title: 'AgriConnect_Ini__Tool',\n width: 100,\n hide: true\n }),\n new ApDynGridPropertyColumnConfig({\n field: nameOf('Driver'),\n title: 'Docu_Ini__Motorist',\n width: 100,\n hide: true\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 _onClose(): void {\n this.formStore.closeForm();\n }\n}\n","import {AfterViewInit, Component, OnDestroy, OnInit, ViewChild} from '@angular/core';\nimport {\n ApDynComponentComponent\n} from '../../ap-dyncomponent/ap-dyncomponent.component';\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 ApDynGridPagerWizardButton,\n ApDynGridPagerWizardConfig,\n ApDynGridPagerWizardSection\n} from '../../ap-dyngrids/config/ap-dyn-grid-pager-wizard-config';\nimport {\n ApDynGridStatusColumnConfig\n} from '../../ap-dyngrids/config/ap-dyn-grid-status-column-config';\nimport {\n nameOf\n} from '../../ap-core/utils/ap-name-of';\nimport {\n ApDynGridPropertyColumnConfig,\n FilterType,\n PropertyTemplate\n} from '../../ap-dyngrids/config/ap-dyn-grid-property-column-config';\nimport {\n GetRoundNumericService\n} from '../../ap-utils/service/get-round-numeric.service';\nimport {\n FieldStore\n} from '../../stores/farm/field.store';\nimport {filter, map, skip} from 'rxjs/operators';\nimport {ApTimeSpanUtil, GetRoundNumericPipe} from '../../ap-utils';\nimport {ObjectFactory} from 'ts-tooling';\nimport {\n SettingsStore\n} from '../../stores/base-data/settings.store';\nimport {\n IPpEntryPlanBookingGridItem,\n IPpPlanBookingComponentData\n} from './plan-booking/pp-plan-booking.types';\nimport {\n ApDynGridGroupColumnConfig\n} from '../../ap-dyngrids/config/ap-dyn-grid-group-column-config';\nimport {\n LanguageStore\n} from '../../stores/translation/language.store';\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 ApDynformsConfigFieldset\n} from '../../ap-dynforms/config/ap-dynforms-config-fieldset';\nimport {\n ApDynformsConfigDatepicker\n} from '../../ap-dynforms/config/ap-dynforms-config-datepicker';\nimport {\n ApDynformsConfigTimepicker\n} from '../../ap-dynforms/config/ap-dynforms-config-timepicker';\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 {\n MachineStore\n} from '../../stores/docu/machine.store';\nimport {\n InstrumentStore\n} from '../../stores/docu/instrument.store';\nimport {\n DriverStore\n} from '../../stores/docu/driver.store';\nimport {\n CampaignYearStore\n} from '../../stores/login/campaignyear.store';\nimport {\n LoginStore\n} from '../../stores/login/login.store';\nimport {\n IModalDialogData,\n ModalDialogButtonDisable\n} from '../../ap-interface/interfaces/ap-modaldialog-data.interface';\nimport {\n ModalDialogStore\n} from '../../stores/dialog/modal.dialog.store';\nimport {\n ApTranslationService\n} from '../../ap-utils/service/ap-translation.service';\nimport {\n ApDateService\n} from '../../ap-core/services/ap-date-service';\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 PlantProtectionPlanBookStore\n} from '../../stores/plant-protection/plant-protection-planbook.store';\nimport {\n PpNoDataValue\n} from '../../plant-protection/types/pp-planning-booking.types';\nimport {\n PpCommonService\n} from '../../plant-protection/services/pp-common.service';\nimport {\n ApNutrientService\n} from '../../ap-utils/service/ap-nutrient.service';\nimport IPlantProtectionPlanBook = Data.TaskManagement.IPlantProtectionPlanBook;\n\n@Component({\n selector: 'pp-plan-booking',\n template: `\n \n \n `,\n styles: []\n})\nexport class PpPlanBookingComponent implements OnInit, AfterViewInit, OnDestroy {\n @ViewChild(ApDynComponentComponent, {static: true}) public dynComponent: ApDynComponentComponent;\n public data: IPpPlanBookingComponentData;\n public items$ = new BehaviorSubject([]);\n public columns$: Observable = of([]);\n public loading$: Observable = of(false);\n public pager: ApDynGridPagerWizardConfig;\n public componentCaption: string;\n\n private _subscriptions: Subscription[] = [];\n\n constructor(private formStore: FormStore,\n private fieldStore: FieldStore,\n private loginStore: LoginStore,\n private driverStore: DriverStore,\n private mapViewStore: MapViewStore,\n private machineStore: MachineStore,\n private settingsStore: SettingsStore,\n private languageStore: LanguageStore,\n private cropTypeStore: CropTypeStore,\n private instrumentStore: InstrumentStore,\n private modalDialogStore: ModalDialogStore,\n private campaignYearStore: CampaignYearStore,\n private plantProtectionPlanBookStore: PlantProtectionPlanBookStore,\n private dateService: ApDateService,\n private ppCommonService: PpCommonService,\n private nutrientService: ApNutrientService,\n private translationService: ApTranslationService,\n private roundNumericService: GetRoundNumericService,\n private roundNumericPipe: GetRoundNumericPipe) {\n }\n\n public ngOnInit(): void {\n this.componentCaption = this.data.IsBooked ? 'Global__Reset' : 'Global__Bookings';\n this.loading$ = this._getGridLoading();\n this.columns$ = this._getGridColumns();\n this.pager = this._getGridPager();\n this._setGridItems();\n }\n\n public ngAfterViewInit(): void {\n this._subscriptions.push(\n this.dynComponent.SelectedItems$.subscribe((items: IPpEntryPlanBookingGridItem[]) => {\n const fieldsToSelect: string[] = items.filter(x => x.FieldId).map(i => i.FieldId.toString());\n this.fieldStore.changeSelectedField(fieldsToSelect);\n })\n );\n this._subscriptions.push(\n this.items$.subscribe((items: IPpEntryPlanBookingGridItem[]): void => {\n const itemsToSelect = items.map(i => i.Id);\n setTimeout(() => this.dynComponent.dynGrid.gridPaging.setSelectedKeys(itemsToSelect));\n })\n );\n }\n\n public ngOnDestroy(): void {\n this._subscriptions.forEach(s => s.unsubscribe());\n }\n\n public onEdit(dataItem: IPpEntryPlanBookingGridItem): void {\n const dialog = {\n title: this.translationService.translate('Global__Edit'),\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._getModalFieldSets(dataItem),\n validators: undefined,\n asyncValidators: undefined,\n values: ObjectFactory.Copy(dataItem)\n }\n } as IModalDialogData;\n const resultSubscription = this.modalDialogStore.Listen(s => s.result)\n .pipe(skip(1))\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 this.modalDialogStore.setModalDialogData(dialog);\n }\n\n private _getGridLoading(): Observable {\n return combineLatest([\n this.fieldStore.Listen(x => x.loading),\n this.settingsStore.Listen(x => x.loading),\n this.languageStore.Listen(x => x.loading),\n this.driverStore.Listen(x => x.loading),\n this.instrumentStore.Listen(x => x.loading),\n this.machineStore.Listen(x => x.loading)\n ]).pipe(\n map((loadings) => loadings.some((x) => x))\n );\n }\n\n private _getGridColumns(): Observable {\n return combineLatest([\n this.languageStore.SelectedLanguage$,\n this.settingsStore.FirstSetting$\n ]).pipe(\n filter(([language, settings]) => !!language && !!settings),\n map(([language, settings]) => [\n new ApDynGridStatusColumnConfig({\n field: nameOf('Status'),\n class: nameOf('StatusClass'),\n description: nameOf('StatusDesc'),\n title: '',\n filterable: true\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Docu_Ini__Number',\n field: `${nameOf('FieldNumber')}`,\n hide: true,\n width: 40,\n cssClass: 'right',\n filterType: FilterType.NUMBER,\n headerFilterable: true\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Docu_Ini_Subnumber',\n field: `${nameOf('FieldSubnumber')}`,\n width: 40,\n hide: true,\n filterType: FilterType.NUMBER,\n cssClass: 'right',\n headerFilterable: true\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Docu_Ini__Number',\n field: `${nameOf('FieldNumberWithSubnumber')}`,\n hide: new ApDynGridColumnHideConfig({\n mapHide: false,\n selfHide: this.mapViewStore.Listen(s => s.mode).pipe(map((m) => m !== MapViewMode.NORMAL)),\n }),\n width: 50,\n headerFilterable: true\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Docu_Ini__Name',\n field: `${nameOf('FieldName')}`,\n width: 110,\n cssClass: 'left',\n sortIndex: 0,\n headerFilterable: true\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Docu_Ini__Area',\n field: `${nameOf('Area')}`,\n width: 50,\n headerFilterable: true,\n tooltip: (dataItem: IPpEntryPlanBookingGridItem) => this.roundNumericService.stringify(dataItem?.Area, 4),\n cssClass: 'right',\n filterType: FilterType.NUMBER,\n pipes: [{\n pipe: this.roundNumericPipe,\n args: [settings.DigitsAfterDecimalPoint]\n }]\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__Crop',\n field: `${nameOf('Crop')}`,\n width: 80,\n hide: true,\n headerFilterable: true\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__EC',\n field: `${nameOf('EcValue')}`,\n width: 50,\n hide: true,\n cssClass: 'right',\n filterType: FilterType.NUMBER\n }),\n new ApDynGridGroupColumnConfig({\n title: 'Global__Product',\n groupColumns: [\n new ApDynGridPropertyColumnConfig({\n title: 'Global__Avg_Symbol',\n field: `${nameOf('ProductAverages')}`,\n tooltip: (dataItem: IPpEntryPlanBookingGridItem) => dataItem?.ProductAveragesTooltip,\n width: 150,\n multiline: true,\n filterable: true\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__Sum',\n field: `${nameOf('ProductSum')}`,\n tooltip: (dataItem: IPpEntryPlanBookingGridItem) => dataItem?.ProductSumTooltip,\n width: 80,\n multiline: true,\n filterable: true\n })\n ]\n }),\n new ApDynGridGroupColumnConfig({\n title: 'Global__Water',\n hide: true,\n groupColumns: [\n new ApDynGridPropertyColumnConfig({\n title: 'Global__Avg_Symbol',\n field: `${nameOf('WaterRate')}`,\n hide: true,\n width: 60,\n cssClass: 'right',\n filterType: FilterType.NUMBER,\n template: PropertyTemplate.NUMBER,\n pipes: [{\n pipe: this.roundNumericPipe,\n args: [0, {ToReplace: [PpNoDataValue, undefined], ReplaceWith: ''}]\n }]\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__Sum',\n field: `${nameOf('WaterSum')}`,\n tooltip: (dataItem: IPpEntryPlanBookingGridItem) => dataItem?.WaterSumTooltip,\n hide: true,\n cssClass: 'right',\n filterType: FilterType.NUMBER,\n template: PropertyTemplate.NUMBER,\n width: 60,\n pipes: [{\n pipe: this.roundNumericPipe,\n args: [0, {ToReplace: [PpNoDataValue, undefined], ReplaceWith: ''}]\n }]\n })\n ]\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global_Application_Date',\n field: `${nameOf('ApplicationDate')}`,\n hide: true,\n width: 80,\n filterable: true,\n format: language.DateFormat,\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Duration',\n field: `${nameOf('Duration')}`,\n format: 'HH:mm',\n hide: true,\n width: 80,\n filterable: true\n }),\n new ApDynGridGroupColumnConfig({\n title: 'agrioptions_resources',\n hide: true,\n groupColumns: [\n new ApDynGridPropertyColumnConfig({\n title: 'Base__Engine',\n field: 'Machine.NameWithSign',\n hide: true,\n width: 100\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'AgriConnect_Ini__Tool',\n field: 'Instrument.Name',\n hide: true,\n width: 100\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Docu_Ini__Motorist',\n field: 'Driver.ShortFullName',\n hide: true,\n width: 100\n })\n ]\n }),\n new ApDynGridEditColumnConfig({})\n ])\n );\n }\n\n private _getGridPager(): ApDynGridPagerWizardConfig {\n const buttonTitle = this.data.IsBooked ? 'Global__Reset' : 'Admin_Pages_Popups__Book';\n return new ApDynGridPagerWizardConfig(\n new ApDynGridPagerWizardButton('Global__Cancel', ApUtilService.createEventEmitter(this._onClose.bind(this), this._subscriptions)),\n new ApDynGridPagerWizardSection(),\n new ApDynGridPagerWizardButton(buttonTitle, 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._updateOverviewItems.bind(this), this._subscriptions),\n config: this._getPagerFieldSets()\n }\n }\n );\n }\n\n private _setGridItems(): void {\n let items = this.data.DataItem?.filter(x => !x.DeletedAt);\n if (this.data.IsBooked) {\n items = items.filter(x => x.BookedBy);\n } else {\n items = items.filter(x => !x.BookedBy);\n }\n const gridItems: IPpEntryPlanBookingGridItem[] = items.map(planBook => {\n const field = this.fieldStore.getFieldById(planBook.FieldId);\n const geom = this.fieldStore.getFieldGeomById(planBook.FieldGeomId);\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 isWorkTypeSpraying = this.ppCommonService.isWorkTypeSpraying(planBook);\n const waterSum = isWorkTypeSpraying ? this.ppCommonService.getWaterAmountBasedOnOperationMode(planBook) : PpNoDataValue;\n const waterUnit = isWorkTypeSpraying ? this.translationService.translate('Api_Enums__Litre') : undefined;\n const area = geom?.AreaHa ?? 0;\n const item: IPpEntryPlanBookingGridItem = {\n Id: planBook.Id,\n Status: this.nutrientService.getFertilizerStatus(planBook.ApplicationMode, this.data?.IsBooked)?.state,\n StatusClass: this.nutrientService.getFertilizerStatus(planBook.ApplicationMode, this.data?.IsBooked)?.class,\n StatusDesc: this.nutrientService.getFertilizerStatusDescription(planBook.ApplicationMode, this.data?.IsBooked),\n FieldId: field?.Id,\n FieldName: field?.FieldName,\n FieldNumber: field?.FieldNumber,\n FieldSubnumber: field?.FieldSubnumber,\n FieldNumberWithSubnumber: this.fieldStore.getFieldNumberAndSubNumber(field),\n Area: area,\n EcValue: planBook.EcValue,\n Crop: this.cropTypeStore.getDefaultCroptype(planBook.MainCropId)?.Description ?? '',\n ProductAverages: this.ppCommonService.getAppliedProductsExpr(planBook.ProductList),\n ProductAveragesTooltip: this.ppCommonService.getAppliedProductsExpr(planBook.ProductList, true),\n ProductSum: isWorkTypeSpraying ? this.ppCommonService.getAppliedProductSumExpr(planBook.ProductList, {\n areaHa: area,\n withoutProdName: true\n }) : undefined,\n ProductSumTooltip: isWorkTypeSpraying ? this.ppCommonService.getAppliedProductSumExpr(planBook.ProductList, {\n areaHa: area,\n isTooltip: true\n }) : undefined,\n WaterRate: isWorkTypeSpraying ? this.ppCommonService.getApplicationValue(planBook) : PpNoDataValue,\n WaterSum: isWorkTypeSpraying ? this.ppCommonService.getWaterAmountBasedOnOperationMode(planBook) : PpNoDataValue,\n WaterSumTooltip: isWorkTypeSpraying && waterSum >= 0 ? `${waterSum ?? 0} ${waterUnit}` : '',\n ApplicationDate: this.dateService.toFarmDate(planBook.ApplicationDate).toDate(),\n Duration: this.dateService.getDateWithTimeFromMilliseconds(planBook.TEnd?.TotalMilliseconds ?? 0),\n Driver: driver,\n Machine: machine,\n Instrument: instrument,\n SourceItem: planBook\n };\n return item;\n });\n setTimeout(() => this.items$.next(gridItems), 10);\n }\n\n private _getPagerFieldSets(): ApDynformsConfigFieldset[] {\n const campaignYearStart = new Date(this.campaignYearStore.getSelectedCampaignYear().DefaultStart);\n const campaignYearEnd = new Date(this.campaignYearStore.getSelectedCampaignYear().DefaultEnd);\n return [\n new ApDynformsConfigFieldset({\n legend: 'Docu_Ini__Time',\n key: 'Time',\n useMaxWidth: true,\n config: [\n new ApDynformsConfigDatepicker({\n key: 'ApplicationDate',\n label: 'Global_Application_Date',\n minDate: campaignYearStart,\n maxDate: campaignYearEnd,\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 legend: 'agrioptions_resources',\n key: 'Resources',\n useMaxWidth: true,\n config: [\n new ApDynformsConfigComboBox({\n key: 'Machine',\n label: 'Base__Engine',\n options: this.machineStore.Listen(_ => _.data),\n textField: 'NameWithSign',\n valueField: 'Id',\n valuePrimitive: false,\n value: null,\n sort: 1\n }),\n new ApDynformsConfigComboBox({\n key: 'Instrument',\n label: 'Docu_Ini__Tool',\n options: this.instrumentStore.Listen(s => s.data),\n textField: 'Name',\n valueField: 'Id',\n valuePrimitive: false,\n value: null,\n sort: 1\n }),\n new ApDynformsConfigComboBox({\n key: 'Driver',\n label: 'Docu_Ini__Motorist',\n options: this.driverStore.Listen(_ => _.data),\n textField: 'ShortFullName',\n valueField: 'Id',\n valuePrimitive: false,\n value: null,\n sort: 1\n }),\n new ApDynformsConfigPlaceholder()\n ],\n })\n ];\n }\n\n private _getModalFieldSets(dataItem: IPpEntryPlanBookingGridItem): ApDynformsConfigFieldset[] {\n const campaignYearStart = new Date(this.campaignYearStore.getSelectedCampaignYear().DefaultStart);\n const campaignYearEnd = new Date(this.campaignYearStore.getSelectedCampaignYear().DefaultEnd);\n return [\n new ApDynformsConfigFieldset({\n legend: 'Docu_Ini__Time',\n key: 'EditTime',\n useMaxWidth: true,\n config: [\n new ApDynformsConfigDatepicker({\n key: 'ApplicationDate',\n label: 'Global_Application_Date',\n value: dataItem.ApplicationDate,\n minDate: campaignYearStart,\n maxDate: campaignYearEnd\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 legend: 'agrioptions_resources',\n key: 'EditResources',\n useMaxWidth: true,\n config: [\n new ApDynformsConfigComboBox({\n key: 'Machine',\n label: 'Base__Engine',\n textField: 'NameWithSign',\n valueField: 'Id',\n valuePrimitive: false,\n value: dataItem.Machine,\n options: this.machineStore.Listen(_ => _.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(_ => _.data),\n sort: 1\n }),\n new ApDynformsConfigPlaceholder()\n ],\n })\n ];\n }\n\n private _updateOverviewItems(submitData: { ids: any[], value: any }): void {\n this.items$.next(this.items$.getValue().map((planBook: IPpEntryPlanBookingGridItem) => {\n if (submitData.ids.includes(planBook.Id)) {\n if (!!submitData.value.ApplicationDate) {\n planBook.ApplicationDate = new Date(submitData.value.ApplicationDate);\n }\n if (!!submitData.value.Duration) {\n planBook.Duration = submitData.value.Duration;\n }\n if (!!submitData.value.Driver) {\n planBook.Driver = submitData.value.Driver;\n }\n if (!!submitData.value.Instrument) {\n planBook.Instrument = submitData.value.Instrument;\n }\n if (!!submitData.value.Machine) {\n planBook.Machine = submitData.value.Machine;\n }\n }\n return planBook;\n }));\n }\n\n private _booking(): void {\n const selectedItems = this.dynComponent.getSelectedItems() as IPpEntryPlanBookingGridItem[];\n const updatedPlanBooks = this._updateData(selectedItems);\n if (updatedPlanBooks && updatedPlanBooks.length > 0) {\n const dataToSend = updatedPlanBooks.map(planBook => ({planBook, logFile: undefined}));\n if (this.data.IsBooked) {\n this.plantProtectionPlanBookStore.unBookPlanBooks(dataToSend);\n } else {\n this.plantProtectionPlanBookStore.bookPlanBooks(dataToSend);\n }\n }\n this._onClose();\n }\n\n private _updateData(itemsToUpdate: IPpEntryPlanBookingGridItem[]): IPlantProtectionPlanBook[] {\n if (!itemsToUpdate || itemsToUpdate.length <= 0) {\n return [];\n }\n return itemsToUpdate.map(row => {\n const selectedItem = ObjectFactory.Copy(row as IPpEntryPlanBookingGridItem);\n const copiedSourceItem = ObjectFactory.Copy(selectedItem.SourceItem);\n if (!copiedSourceItem) {\n return null;\n }\n copiedSourceItem.BookedAt = !this.data.IsBooked ? this.dateService.getUtc() : null;\n copiedSourceItem.BookedBy = !this.data.IsBooked ? this.loginStore.UserId : null;\n copiedSourceItem.TStart = ApTimeSpanUtil.getEmptyTimeSpan();\n copiedSourceItem.TEnd = ApTimeSpanUtil.getTimeSpanFromDate(selectedItem.Duration, true);\n copiedSourceItem.ApplicationDate = this.dateService.getDateNoon(selectedItem.ApplicationDate);\n copiedSourceItem.ExportDriver = selectedItem.Driver?.Id;\n copiedSourceItem.ExportMachine = selectedItem.Machine?.Id;\n copiedSourceItem.ExportInstrument = selectedItem.Instrument?.Id;\n return copiedSourceItem;\n }).filter(x => !!x);\n }\n\n private _onClose(): void {\n this.formStore.closeForm();\n }\n}\n","import {ApDynGridColumnConfigBase} 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 {LanguageStore} from '../../stores/translation/language.store';\nimport {GetRoundNumericPipe} from '../../ap-utils';\nimport {\n ApTranslationService\n} from '../../ap-utils/service/ap-translation.service';\nimport {\n DropDownButtonData\n} from '../../ap-dyngrids/config/ap-dyn-grid-button-column-config';\nimport {EventEmitter, Injectable} from '@angular/core';\nimport {\n ApDynGridPagerConfig,\n IDynGridWizardChoiceData\n} from '../../ap-dyngrids/config/ap-dyn-grid-pager-config';\nimport {ApGridPagerType} from '../../ap-interface';\nimport {Icon} from '../../ap-interface/enums/layout/icon.enum';\nimport {SettingsStore} from '../../stores/base-data/settings.store';\nimport {nameOf} from '../../ap-core/utils/ap-name-of';\nimport {IPpPlanningBookingGridItem, PpNoDataValue} from '../types/pp-planning-booking.types';\nimport {\n IPpEntryPlanBookingGridItem\n} from '../../entry-components/plant-protection-entry-components/plan-booking/pp-plan-booking.types';\n\n/**\n * Service for grid configuration of plant protection\n * Plant-Protection -> Plans\n * Plant-Protection -> Records\n */\n@Injectable({\n providedIn: 'root'\n})\nexport class PpPlanningBookingGridConfig {\n\n constructor(private languageStore: LanguageStore,\n private settingsStore: SettingsStore,\n private roundNumericPipe: GetRoundNumericPipe,\n private translationService: ApTranslationService) {\n }\n\n public getGridColumns(dropDownActions: DropDownButtonData[]): ApDynGridColumnConfigBase[] {\n return [\n new ApDynGridStatusColumnConfig({\n title: 'Global__Status',\n field: nameOf('Status'),\n class: 'StatusClass',\n description: 'StatusDesc',\n filterable: true\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global_Application_Date',\n field: nameOf('ApplicationDate'),\n tooltip: (dataItem) => dataItem.ApplicationDateTooltip,\n dynCssClass: (dataItem) => dataItem.ApplicationDateItalic ? ' italic' : '',\n sortIndex: 1,\n sortDesc: true,\n width: 80,\n filterable: true,\n headerFilterable: true,\n format: this.languageStore.Listen(s => s.selectedLanguage).getValue().DateFormat,\n template: PropertyTemplate.DATE\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__Crop',\n field: nameOf('Crop'),\n width: 100,\n headerFilterable: true,\n filterable: true\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Base__Fields',\n field: nameOf('Count'),\n hide: true,\n width: 50,\n tooltip: (dataItem) => dataItem?.FieldsTooltip,\n cssClass: 'right',\n filterType: FilterType.NUMBER,\n filterable: true\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Docu_Ini__Area',\n field: nameOf('Area'),\n hide: true,\n width: 50,\n cssClass: 'right',\n filterType: FilterType.NUMBER,\n filterable: true,\n headerFilterable: true,\n pipes: [{\n pipe: this.roundNumericPipe,\n args: [this.settingsStore.FirstSetting?.DigitsAfterDecimalPoint]\n }]\n }),\n new ApDynGridGroupColumnConfig({\n title: `${this.translationService.translate('Global__Products')}`,\n groupColumns: [\n new ApDynGridPropertyColumnConfig({\n title: 'AvgShort',\n field: nameOf('ProductNames'),\n width: 180,\n multiline: true,\n filterable: true,\n headerFilterable: true,\n tooltip: (dataItem: IPpPlanningBookingGridItem) => dataItem?.ProductNamesTooltip\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__Sum',\n field: nameOf('ProductsSum'),\n width: 100,\n multiline: true,\n filterable: true,\n headerFilterable: true,\n tooltip: (dataItem: IPpPlanningBookingGridItem) => dataItem?.ProductsSumTooltip\n })\n ]\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__OperationMode',\n field: nameOf('OperationModeKeyTrans'),\n width: 80,\n multiline: false,\n filterable: true,\n headerFilterable: true,\n hide: true,\n tooltip: (dataItem: IPpPlanningBookingGridItem) => dataItem?.OperationModeKeyTrans\n }),\n new ApDynGridGroupColumnConfig({\n title: `${this.translationService.translate('Global__Water')} [${this.translationService.translate('Unit_l_per_ha')}]`,\n hide: true,\n groupColumns: [\n new ApDynGridPropertyColumnConfig({\n title: 'Global__Avg_Symbol',\n field: nameOf('Avg'),\n width: 60,\n cssClass: 'right', filterType: FilterType.NUMBER, filterable: true,\n template: PropertyTemplate.NUMBER,\n headerFilterable: true,\n pipes: [{\n pipe: this.roundNumericPipe,\n args: [0, {ToReplace: [PpNoDataValue], ReplaceWith: ''}]\n }]\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__Min',\n field: nameOf('Min'),\n width: 60,\n cssClass: 'right',\n filterType: FilterType.NUMBER,\n filterable: true,\n template: PropertyTemplate.NUMBER,\n headerFilterable: true,\n pipes: [{\n pipe: this.roundNumericPipe,\n args: [0, {ToReplace: [PpNoDataValue], ReplaceWith: ''}]\n }]\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__Max',\n field: nameOf('Max'),\n width: 60,\n cssClass: 'right',\n filterType: FilterType.NUMBER,\n filterable: true,\n template: PropertyTemplate.NUMBER,\n headerFilterable: true,\n pipes: [{\n pipe: this.roundNumericPipe,\n args: [0, {ToReplace: [PpNoDataValue], ReplaceWith: ''}]\n }]\n })\n ]\n }),\n new ApDynGridGroupColumnConfig({\n title: `${this.translationService.translate('Global__Sum')} ${this.translationService.translate('Global__Water')}`,\n headerStyle: {'text-align': 'center'},\n hide: true,\n groupColumns: [\n new ApDynGridPropertyColumnConfig({\n field: nameOf('ApplSum'),\n tooltip: (dataItem) => dataItem?.ApplSum >= 0 ? `${dataItem?.ApplSum ?? 0} ${dataItem?.ApplUnit}` : '',\n hide: true,\n width: 60,\n cssClass: 'right',\n filterType: FilterType.NUMBER,\n headerFilterable: true,\n pipes: [{\n pipe: this.roundNumericPipe,\n args: [0, {ToReplace: [PpNoDataValue], ReplaceWith: ''}]\n }]\n }),\n new ApDynGridPropertyColumnConfig({\n field: nameOf('ApplUnit'),\n hide: true,\n width: 60,\n filterable: true,\n headerFilterable: true\n })\n ]\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__Note',\n field: nameOf('Note'),\n width: 100,\n filterable: true,\n headerFilterable: true\n }),\n new ApDynGridEditColumnConfig({\n data: dropDownActions\n })\n ];\n }\n\n public getGridPager(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 {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 {Observable, Subscription} from 'rxjs';\nimport {\n ApDynGridPagerConfigBase\n} from '../../ap-dyngrids/config/ap-dyn-grid-pager-config-base';\nimport {IPpPlanningBookingGridItem} from '../types/pp-planning-booking.types';\nimport {\n DropDownButtonData\n} from '../../ap-dyngrids/config/ap-dyn-grid-button-column-config';\nimport {ApUtilService} from '../../ap-utils/service/ap-util.service';\nimport {PpPlanningBookingGridConfig} from '../configs/pp-planning-booking-grid.config';\nimport {PpPlanningBookingDataService} from '../services/pp-planning-booking-data.service';\nimport {\n PpPlanningWizardComponent\n} from '../../entry-components/plant-protection-entry-components/planning-wizard/pp-planning-wizard.component';\nimport {FormStore} from '../../stores/layout/form.store';\nimport {RouterStore} from '../../stores/router/router.store';\nimport {WorkTypes} from '../../stores/base-data/worrktypes.store';\nimport {ModalDialogStore} from '../../stores/dialog/modal.dialog.store';\nimport {ModalDialogButtonKeys, ModalDialogPresets} from '../../stores/dialog/modal.dialog.presets';\nimport {\n IModalDialogResult\n} from '../../ap-interface/interfaces/ap-modaldialog-data.interface';\nimport {ApGuidUtil} from '../../ap-utils';\nimport {\n PpPlanShowComponent\n} from '../../entry-components/plant-protection-entry-components/pp-plan-show.component';\nimport {\n PpPlanBookingComponent\n} from '../../entry-components/plant-protection-entry-components/pp-plan-booking.component';\nimport {OperationModesEnum} from '../../stores/common/operation-modes.store';\nimport {\n PlantProtectionPlanBookStore\n} from '../../stores/plant-protection/plant-protection-planbook.store';\nimport {SensorStore} from '../../stores/sensor/sensor.store';\nimport {MapStore} from '../../stores/map/map.store';\n\n@Component({\n selector: 'plant-protection-planning',\n template: `\n \n \n `,\n styles: []\n})\nexport class PpPlanningComponent implements OnInit, AfterViewInit, OnDestroy {\n @ViewChild(ApDynComponentComponent) dynComponent: ApDynComponentComponent;\n public columns: ApDynGridColumnConfigBase[] = [];\n public items$: Observable;\n public loading$: Observable;\n public pager: ApDynGridPagerConfigBase;\n\n private _subscriptions: Subscription[] = [];\n\n constructor(private dataService: PpPlanningBookingDataService,\n private formStore: FormStore,\n private sensorStore: SensorStore,\n private modalDialogStore: ModalDialogStore,\n private modalDialogPresets: ModalDialogPresets,\n private routerStore: RouterStore,\n private mapStore: MapStore,\n private plantProtectionPlanBookStore: PlantProtectionPlanBookStore,\n private gridConfig: PpPlanningBookingGridConfig) {\n }\n\n public ngOnInit(): void {\n this.dataService.init(false);\n this.loading$ = this.dataService.getLoading$();\n this.items$ = this.dataService.buildDataItems();\n this.dataService.subscribeLoad();\n this._buildGrid();\n }\n\n public ngAfterViewInit(): void {\n this.dataService.subscribeSelection(this.dynComponent);\n }\n\n public ngOnDestroy(): void {\n this.dataService.destroy();\n this._subscriptions.forEach(s => s.unsubscribe());\n }\n\n private _buildGrid(): void {\n const dropDownActions: DropDownButtonData[] = [\n {\n text: 'Global__Show',\n callback: ApUtilService.createEventEmitter(this._onShow.bind(this), this._subscriptions)\n },\n {\n text: 'Task_Mgmt_Export',\n callback: ApUtilService.createEventEmitter(this._onExport.bind(this), this._subscriptions),\n disabled: (item: IPpPlanningBookingGridItem) => {\n return item.PlanBooks?.FirstOrDefault()?.ProductList?.FirstOrDefault()?.ProductListDetails?.WorkType !== WorkTypes.Spraying;\n }\n },\n {\n text: 'Global__Booking',\n callback: ApUtilService.createEventEmitter(this._onBook.bind(this), this._subscriptions)\n },\n {\n text: 'Global__Delete',\n callback: ApUtilService.createEventEmitter(this._onDelete.bind(this), this._subscriptions)\n }\n ];\n\n this.columns = this.gridConfig.getGridColumns(dropDownActions);\n const pagerOptions = [\n {\n text: 'Global__Delete',\n callback: ApUtilService.createEventEmitter(this._onDeleteMany.bind(this), this._subscriptions)\n },\n ];\n this.pager = this.gridConfig.getGridPager(pagerOptions);\n }\n\n /**\n * Opens the pp planning wizard.\n * The preselection is handled in dynForm's selection change already\n */\n public onCreate(): void {\n this.mapStore.Layers.PpApplicationMapLayer.clear();\n this.formStore.openForm({component: PpPlanningWizardComponent, data: null});\n }\n\n private _onShow(dataItem: IPpPlanningBookingGridItem): void {\n this.formStore.openForm({component: PpPlanShowComponent, data: {DataItem: dataItem, IsBooked: false}});\n }\n\n private _onExport(dataItem: any): void {\n this.routerStore.navigate(['task-management/overview'], {\n id: dataItem.Id,\n url: 'plant-protection/planning'\n }).then();\n }\n\n private _onBook(dataItem: IPpPlanningBookingGridItem): void {\n if (!dataItem.PlanBooks || dataItem.PlanBooks.length <= 0) {\n return;\n }\n this.formStore.openForm({\n component: PpPlanBookingComponent,\n data: {\n DataItem: dataItem.PlanBooks,\n IsBooked: false\n }\n });\n }\n\n private _onDelete(dataItem: IPpPlanningBookingGridItem): void {\n this.modalDialogStore.setModalDialogData(this.modalDialogPresets.DeleteDialog({\n resultDelegate: (dialogResult: IModalDialogResult): void => {\n if (dialogResult?.key !== ModalDialogButtonKeys.Delete ||\n dataItem?.Id == null ||\n dataItem?.Id === ApGuidUtil.getEmptyGuid()) {\n return;\n }\n this.plantProtectionPlanBookStore.deleteSummaries([dataItem?.Id]);\n }\n }));\n }\n\n private _onDeleteMany(): void {\n this.plantProtectionPlanBookStore.deleteSummaries(\n this.dynComponent.getSelectedItems().map((item: IPpPlanningBookingGridItem) => item?.Id));\n }\n}\n","import {AfterViewInit, Component, OnDestroy, OnInit, ViewChild} from '@angular/core';\nimport {\n ApDynComponentComponent\n} from '../../ap-dyncomponent/ap-dyncomponent.component';\nimport {\n IPpEntryPlanBookingGridItem\n} from './plan-booking/pp-plan-booking.types';\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 ApDynGridPagerWizardButton,\n ApDynGridPagerWizardConfig,\n ApDynGridPagerWizardSection\n} from '../../ap-dyngrids/config/ap-dyn-grid-pager-wizard-config';\nimport {\n FormStore\n} from '../../stores/layout/form.store';\nimport {\n FieldStore\n} from '../../stores/farm/field.store';\nimport {\n DriverStore\n} from '../../stores/docu/driver.store';\nimport {\n MapViewStore\n} from '../../stores/layout/mapview.store';\nimport {\n MachineStore\n} from '../../stores/docu/machine.store';\nimport {\n SettingsStore\n} from '../../stores/base-data/settings.store';\nimport {\n LanguageStore\n} from '../../stores/translation/language.store';\nimport {\n CropTypeStore\n} from '../../stores/base-data/crop.types.store';\nimport {\n InstrumentStore\n} from '../../stores/docu/instrument.store';\nimport {\n ApDateService\n} from '../../ap-core/services/ap-date-service';\nimport {\n PpCommonService\n} from '../../plant-protection/services/pp-common.service';\nimport {\n ApNutrientService\n} from '../../ap-utils/service/ap-nutrient.service';\nimport {\n ApTranslationService\n} from '../../ap-utils/service/ap-translation.service';\nimport {\n GetRoundNumericService\n} from '../../ap-utils/service/get-round-numeric.service';\nimport {GetRoundNumericPipe} from '../../ap-utils';\nimport {\n PpNoDataValue\n} from '../../plant-protection/types/pp-planning-booking.types';\nimport {\n ApUtilService\n} from '../../ap-utils/service/ap-util.service';\nimport {\n nameOf\n} from '../../ap-core/utils/ap-name-of';\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 {filter, map} from 'rxjs/operators';\nimport {MapViewMode} from '../../ap-interface';\nimport {\n ApDynGridStatusColumnConfig\n} from '../../ap-dyngrids/config/ap-dyn-grid-status-column-config';\nimport {\n IPpEntryPlanBookingShowGridItem,\n IPpPlanBookingShowComponentData\n} from './plan-booking/pp-plan-booking-show.types';\n\n@Component({\n selector: 'pp-plan-booking-show',\n template: `\n \n \n `,\n styles: []\n})\nexport class PpPlanBookingShowComponent implements OnInit, AfterViewInit, OnDestroy {\n @ViewChild(ApDynComponentComponent, {static: true}) public dynComponent: ApDynComponentComponent;\n public data: IPpPlanBookingShowComponentData;\n public items$ = new BehaviorSubject([]);\n public columns$: Observable = of([]);\n public loading$: Observable = of(false);\n public pager: ApDynGridPagerWizardConfig;\n\n private _subscriptions: Subscription[] = [];\n\n constructor(private formStore: FormStore,\n private fieldStore: FieldStore,\n private driverStore: DriverStore,\n private mapViewStore: MapViewStore,\n private machineStore: MachineStore,\n private settingsStore: SettingsStore,\n private languageStore: LanguageStore,\n private cropTypeStore: CropTypeStore,\n private instrumentStore: InstrumentStore,\n private dateService: ApDateService,\n private ppCommonService: PpCommonService,\n private nutrientService: ApNutrientService,\n private translationService: ApTranslationService,\n private roundNumericService: GetRoundNumericService,\n private roundNumericPipe: GetRoundNumericPipe) {\n }\n\n public ngOnInit(): void {\n this.loading$ = this._getGridLoading();\n this.columns$ = this._getGridColumns();\n this.pager = this._getGridPager();\n this._setGridItems();\n }\n\n public ngAfterViewInit(): void {\n this._subscriptions.push(\n this.dynComponent.SelectedItems$.subscribe((items: IPpEntryPlanBookingShowGridItem[]) => {\n const fieldsToSelect: string[] = items.filter(x => x.FieldId).map(i => i.FieldId.toString());\n this.fieldStore.changeSelectedField(fieldsToSelect);\n })\n );\n this._subscriptions.push(\n this.items$.subscribe((items: IPpEntryPlanBookingShowGridItem[]): void => {\n const itemsToSelect = items.map(i => i.Id);\n setTimeout(() => this.dynComponent.dynGrid.gridPaging.setSelectedKeys(itemsToSelect));\n })\n );\n }\n\n public ngOnDestroy(): void {\n this._subscriptions.forEach(s => s.unsubscribe());\n }\n\n private _getGridLoading(): Observable {\n return combineLatest([\n this.fieldStore.Listen(x => x.loading),\n this.settingsStore.Listen(x => x.loading),\n this.languageStore.Listen(x => x.loading),\n this.driverStore.Listen(x => x.loading),\n this.instrumentStore.Listen(x => x.loading),\n this.machineStore.Listen(x => x.loading)\n ]).pipe(\n map((loadings) => loadings.some((x) => x))\n );\n }\n\n private _getGridColumns(): Observable {\n return combineLatest([\n this.languageStore.SelectedLanguage$,\n this.settingsStore.FirstSetting$\n ]).pipe(\n filter(([language, settings]) => !!language && !!settings),\n map(([language, settings]) => [\n new ApDynGridStatusColumnConfig({\n field: nameOf('Status'),\n class: nameOf('StatusClass'),\n description: nameOf('StatusDesc'),\n title: '',\n filterable: true\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Docu_Ini__Number',\n field: `${nameOf('FieldNumber')}`,\n hide: true,\n width: 40,\n cssClass: 'right',\n filterType: FilterType.NUMBER,\n headerFilterable: true\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Docu_Ini_Subnumber',\n field: `${nameOf('FieldSubnumber')}`,\n width: 40,\n hide: true,\n filterType: FilterType.NUMBER,\n cssClass: 'right',\n headerFilterable: true\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Docu_Ini__Number',\n field: `${nameOf('FieldNumberWithSubnumber')}`,\n hide: new ApDynGridColumnHideConfig({\n mapHide: false,\n selfHide: this.mapViewStore.Listen(s => s.mode).pipe(map((m) => m !== MapViewMode.NORMAL)),\n }),\n width: 50,\n headerFilterable: true\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Docu_Ini__Name',\n field: `${nameOf('FieldName')}`,\n width: 110,\n cssClass: 'left',\n sortIndex: 0,\n headerFilterable: true\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Docu_Ini__Area',\n field: `${nameOf('Area')}`,\n width: 50,\n headerFilterable: true,\n tooltip: (dataItem: IPpEntryPlanBookingGridItem) => this.roundNumericService.stringify(dataItem?.Area ?? 0, 4),\n cssClass: 'right',\n filterType: FilterType.NUMBER,\n pipes: [{\n pipe: this.roundNumericPipe,\n args: [settings.DigitsAfterDecimalPoint]\n }]\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__Crop',\n field: `${nameOf('Crop')}`,\n width: 80,\n hide: true,\n headerFilterable: true\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__EC',\n field: `${nameOf('EcValue')}`,\n width: 50,\n hide: true,\n cssClass: 'right',\n filterType: FilterType.NUMBER\n }),\n new ApDynGridGroupColumnConfig({\n title: 'Global__Product',\n groupColumns: [\n new ApDynGridPropertyColumnConfig({\n title: 'Global__Avg_Symbol',\n field: `${nameOf('ProductAverages')}`,\n tooltip: (dataItem: IPpEntryPlanBookingGridItem) => dataItem?.ProductAveragesTooltip,\n width: 150,\n multiline: true,\n filterable: true\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__Sum',\n field: `${nameOf('ProductSum')}`,\n tooltip: (dataItem: IPpEntryPlanBookingGridItem) => dataItem?.ProductSumTooltip,\n width: 80,\n multiline: true,\n filterable: true\n })\n ]\n }),\n new ApDynGridGroupColumnConfig({\n title: 'Global__Water',\n hide: true,\n groupColumns: [\n new ApDynGridPropertyColumnConfig({\n title: 'Global__Avg_Symbol',\n field: `${nameOf('WaterRate')}`,\n hide: true,\n width: 60,\n cssClass: 'right',\n filterType: FilterType.NUMBER,\n template: PropertyTemplate.NUMBER,\n pipes: [{\n pipe: this.roundNumericPipe,\n args: [0, {ToReplace: [PpNoDataValue, undefined], ReplaceWith: ''}]\n }]\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global__Sum',\n field: `${nameOf('WaterSum')}`,\n tooltip: (dataItem: IPpEntryPlanBookingGridItem) => dataItem?.WaterSumTooltip,\n hide: true,\n cssClass: 'right',\n filterType: FilterType.NUMBER,\n template: PropertyTemplate.NUMBER,\n width: 60,\n pipes: [{\n pipe: this.roundNumericPipe,\n args: [0, {ToReplace: [PpNoDataValue, undefined], ReplaceWith: ''}]\n }]\n })\n ]\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Global_Application_Date',\n field: `${nameOf('ApplicationDate')}`,\n hide: true,\n width: 80,\n filterable: true,\n format: language.DateFormat,\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Duration',\n field: `${nameOf('Duration')}`,\n format: 'HH:mm',\n hide: true,\n width: 80,\n filterable: true\n }),\n new ApDynGridGroupColumnConfig({\n title: 'agrioptions_resources',\n hide: true,\n groupColumns: [\n new ApDynGridPropertyColumnConfig({\n title: 'Base__Engine',\n field: 'Machine.NameWithSign',\n hide: true,\n width: 100\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'AgriConnect_Ini__Tool',\n field: 'Instrument.Name',\n hide: true,\n width: 100\n }),\n new ApDynGridPropertyColumnConfig({\n title: 'Docu_Ini__Motorist',\n field: 'Driver.ShortFullName',\n hide: true,\n width: 100\n })\n ]\n })\n ])\n );\n }\n\n private _getGridPager(): ApDynGridPagerWizardConfig {\n return new ApDynGridPagerWizardConfig(\n new ApDynGridPagerWizardButton('Global__Cancel', ApUtilService.createEventEmitter(this._onClose.bind(this), this._subscriptions)),\n new ApDynGridPagerWizardSection(),\n new ApDynGridPagerWizardSection()\n );\n }\n\n private _setGridItems(): void {\n const gridItems: IPpEntryPlanBookingShowGridItem[] = this.data.DataItem?.filter(x => !!x.BookedBy).map(planBook => {\n const field = this.fieldStore.getFieldById(planBook.FieldId);\n const geom = this.fieldStore.getFieldGeomById(planBook.FieldGeomId);\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 isWorkTypeSpraying = this.ppCommonService.isWorkTypeSpraying(planBook);\n const waterSum = isWorkTypeSpraying ? this.ppCommonService.getWaterAmountBasedOnOperationMode(planBook) : PpNoDataValue;\n const waterUnit = isWorkTypeSpraying ? this.translationService.translate('Api_Enums__Litre') : undefined;\n const area = geom?.AreaHa ?? 0;\n const item: IPpEntryPlanBookingShowGridItem = {\n Id: planBook.Id,\n Status: this.nutrientService.getFertilizerStatus(planBook.ApplicationMode, true)?.state,\n StatusClass: this.nutrientService.getFertilizerStatus(planBook.ApplicationMode, true)?.class,\n StatusDesc: this.nutrientService.getFertilizerStatusDescription(planBook.ApplicationMode, true),\n FieldId: field?.Id,\n FieldName: field?.FieldName,\n FieldNumber: field?.FieldNumber,\n FieldSubnumber: field?.FieldSubnumber,\n FieldNumberWithSubnumber: this.fieldStore.getFieldNumberAndSubNumber(field),\n Area: geom?.AreaHa,\n EcValue: planBook.EcValue,\n Crop: this.cropTypeStore.getDefaultCroptype(planBook.MainCropId)?.Description ?? '',\n ProductAverages: this.ppCommonService.getAppliedProductsExpr(planBook.ProductList),\n ProductAveragesTooltip: this.ppCommonService.getAppliedProductsExpr(planBook.ProductList, true),\n ProductSum: isWorkTypeSpraying ? this.ppCommonService.getAppliedProductSumExpr(planBook.ProductList, {\n areaHa: area,\n withoutProdName: true\n }) : undefined,\n ProductSumTooltip: isWorkTypeSpraying ? this.ppCommonService.getAppliedProductSumExpr(planBook.ProductList, {\n areaHa: area,\n isTooltip: true\n }) : undefined,\n WaterRate: isWorkTypeSpraying ? this.ppCommonService.getApplicationValue(planBook) : PpNoDataValue,\n WaterSum: isWorkTypeSpraying ? this.ppCommonService.getWaterAmountBasedOnOperationMode(planBook) : PpNoDataValue,\n WaterSumTooltip: isWorkTypeSpraying && waterSum >= 0 ? `${waterSum ?? 0} ${waterUnit}` : '',\n ApplicationDate: this.dateService.toFarmDate(planBook.ApplicationDate).toDate(),\n Duration: this.dateService.getDateWithTimeFromMilliseconds(planBook.TEnd?.TotalMilliseconds ?? 0),\n Driver: driver,\n Machine: machine,\n Instrument: instrument\n };\n return item;\n });\n setTimeout(() => this.items$.next(gridItems), 10);\n }\n\n private _onClose(): void {\n this.formStore.closeForm();\n }\n}\n","import {NgModule} from '@angular/core';\nimport {Route, RouterModule} from '@angular/router';\nimport {ApPermissionGuard} from '../guards/ap-permission-guard.service';\nimport {PageMode} from '../ap-interface/enums';\nimport {PpLogfilesComponent} from './components/pp-logfiles.component';\nimport {PpOverviewComponent} from './components/pp-overview.component';\nimport {PpPlanningComponent} from './components/pp-planning.component';\nimport {PpBookingComponent} from './components/pp-booking.component';\n\nconst routes: Route[] = [\n {\n path: 'logfiles',\n component: PpLogfilesComponent,\n canActivate: [ApPermissionGuard],\n data: {\n login: true,\n layout: PageMode.HALFSCREEN\n },\n },\n {\n path: 'overview',\n component: PpOverviewComponent,\n canActivate: [ApPermissionGuard],\n data: {\n login: true,\n layout: PageMode.HALFSCREEN\n },\n },\n {\n path: 'planning',\n component: PpPlanningComponent,\n canActivate: [ApPermissionGuard],\n data: {\n login: true,\n layout: PageMode.HALFSCREEN\n },\n },\n {\n path: 'booking',\n component: PpBookingComponent,\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 PlantProtectionRoutes {\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 {Observable, Subscription} from 'rxjs';\nimport {\n ApDynGridPagerConfigBase\n} from '../../ap-dyngrids/config/ap-dyn-grid-pager-config-base';\nimport {IPpPlanningBookingGridItem} from '../types/pp-planning-booking.types';\nimport {ApUtilService} from '../../ap-utils/service/ap-util.service';\nimport {PpPlanningBookingGridConfig} from '../configs/pp-planning-booking-grid.config';\nimport {PpPlanningBookingDataService} from '../services/pp-planning-booking-data.service';\nimport {\n PpPlanBookingComponent\n} from '../../entry-components/plant-protection-entry-components/pp-plan-booking.component';\nimport {FormStore} from '../../stores/layout/form.store';\nimport {\n DropDownButtonData\n} from '../../ap-dyngrids/config/ap-dyn-grid-button-column-config';\nimport {LoginStore} from '../../stores/login/login.store';\nimport {ApRoleTypeService} from '../../services/common/ap-role-type.service';\nimport {\n PpPlanBookingShowComponent\n} from '../../entry-components/plant-protection-entry-components/pp-plan-booking-show.component';\n\n@Component({\n selector: 'plant-protection-booking',\n template: `\n \n \n `,\n styles: []\n})\nexport class PpBookingComponent implements OnInit, AfterViewInit, OnDestroy {\n @ViewChild(ApDynComponentComponent) dynComponent: ApDynComponentComponent;\n public columns: ApDynGridColumnConfigBase[] = [];\n public items$: Observable;\n public loading$: Observable;\n public pager: ApDynGridPagerConfigBase;\n\n private _subscriptions: Subscription[] = [];\n\n constructor(private formStore: FormStore,\n private loginStore: LoginStore,\n private roleTypeService: ApRoleTypeService,\n private dataService: PpPlanningBookingDataService,\n private gridConfig: PpPlanningBookingGridConfig) {\n }\n\n public ngOnInit(): void {\n this.dataService.init(true);\n this.loading$ = this.dataService.getLoading$();\n this.items$ = this.dataService.buildDataItems();\n this.dataService.subscribeLoad();\n this._buildGrid();\n }\n\n public ngAfterViewInit(): void {\n this.dataService.subscribeSelection(this.dynComponent);\n }\n\n public ngOnDestroy(): void {\n this.dataService.destroy();\n this._subscriptions.forEach(s => s.unsubscribe());\n }\n\n private _buildGrid(): void {\n const dropDownActions: DropDownButtonData[] = [\n {\n text: 'Global__Show',\n callback: ApUtilService.createEventEmitter(this._onShow.bind(this), this._subscriptions),\n disabled: false\n },\n {\n text: 'Global__Reset',\n callback: ApUtilService.createEventEmitter(this._onReset.bind(this), this._subscriptions),\n disabled: false\n },\n {\n text: 'Global__Export',\n callback: ApUtilService.createEventEmitter(this._onExport.bind(this), this._subscriptions),\n disabled: true\n }\n ];\n\n this.columns = this.gridConfig.getGridColumns(dropDownActions);\n this.pager = this.gridConfig.getGridPager([\n {\n text: 'Global__Show',\n callback: ApUtilService.createEventEmitter(this._pagerOnShow.bind(this), this._subscriptions),\n },\n {\n text: 'Global__Reset',\n callback: ApUtilService.createEventEmitter(this._pagerOnReset.bind(this), this._subscriptions),\n },\n {\n text: 'Global__Export',\n callback: ApUtilService.createEventEmitter(this._pagerOnExport.bind(this), this._subscriptions)\n }\n ]);\n }\n\n private _pagerOnShow(): void {\n const selectedItem = this._getSelectedItem();\n if (selectedItem) {\n this._onShow(selectedItem);\n }\n }\n\n private _pagerOnReset(): void {\n const selectedItem = this._getSelectedItem();\n if (selectedItem) {\n this._onReset(selectedItem);\n }\n }\n\n private _pagerOnExport(): void {\n const selectedItem = this._getSelectedItem();\n if (selectedItem) {\n this._onExport(selectedItem);\n }\n }\n\n private _getSelectedItem(): IPpPlanningBookingGridItem | null {\n const selectedItems = this.dynComponent.getSelectedItems() as IPpPlanningBookingGridItem[];\n if (!selectedItems || selectedItems.length <= 0) {\n return null;\n }\n return selectedItems[0];\n }\n\n private _onReset(dataItem: IPpPlanningBookingGridItem): void {\n if (!dataItem.PlanBooks || dataItem.PlanBooks.length <= 0) {\n return;\n }\n this.formStore.openForm({\n component: PpPlanBookingComponent,\n data: {\n DataItem: dataItem.PlanBooks,\n IsBooked: true\n }\n });\n }\n\n private _onShow(dataItem: IPpPlanningBookingGridItem): void {\n if (!dataItem.PlanBooks || dataItem.PlanBooks.length <= 0) {\n return;\n }\n this.formStore.openForm({\n component: PpPlanBookingShowComponent,\n data: {\n DataItem: dataItem.PlanBooks\n }\n });\n }\n\n private _onExport(dataItem: IPpPlanningBookingGridItem): void {\n console.log(dataItem);\n console.warn('Method not implemented.');\n }\n}\n","import {NgModule} from '@angular/core';\nimport {CommonModule} from '@angular/common';\nimport {PpLogfilesComponent} from './components/pp-logfiles.component';\nimport {PpOverviewComponent} from './components/pp-overview.component';\nimport {PpPlanningComponent} from './components/pp-planning.component';\nimport {PpBookingComponent} from './components/pp-booking.component';\nimport {PlantProtectionRoutes} from './plant-protection.routes';\nimport {ApDynComponentModule} from '../ap-dyncomponent/ap-dyncomponent.module';\n\n@NgModule({\n declarations: [\n PpLogfilesComponent,\n PpOverviewComponent,\n PpPlanningComponent,\n PpBookingComponent\n ],\n imports: [\n CommonModule,\n PlantProtectionRoutes,\n ApDynComponentModule\n ],\n providers: []\n})\nexport class PlantProtectionModule {\n}\n"],"sourceRoot":"webpack:///","file":"530.d243522c6d66eea1.js"}