public GeospatialAreaPerformanceMeasureTargetGridSpec(FirmaSession currentFirmaSession, ProjectFirmaModels.Models.PerformanceMeasure performanceMeasure)
        {
            var userHasManagePermissions = new GeospatialAreaPerformanceMeasureTargetManageFeature().HasPermissionByFirmaSession(currentFirmaSession);

            if (userHasManagePermissions)
            {
                Add(string.Empty, x => DhtmlxGridHtmlHelpers.MakeDeleteIconAndLinkBootstrap(x.GetDeleteGeospatialAreaPerformanceMeasureTargetUrl(performanceMeasure), true), 30, DhtmlxGridColumnFilterType.None);
                Add(string.Empty, x => ModalDialogFormHelper.MakeEditIconLink(x.GetEditGeospatialAreaPerformanceMeasureTargetUrl(performanceMeasure), $"Edit {FieldDefinitionEnum.PerformanceMeasure.ToType().GetFieldDefinitionLabelPluralized()} Target for {x.GeospatialAreaShortName}", 1000, true, null), 30, DhtmlxGridColumnFilterType.None);
            }

            Add("Geospatial Layer", x => x.GeospatialAreaType.GeospatialAreaTypeName, 200, DhtmlxGridColumnFilterType.SelectFilterStrict);
            Add(FieldDefinitionEnum.GeospatialArea.ToType().ToGridHeaderString(), a => a.GetDisplayNameAsUrl(), 400, DhtmlxGridColumnFilterType.SelectFilterHtmlStrict);
            Add("Target Value", a => a.GetTargetValueDisplayForGrid(performanceMeasure), 350, DhtmlxGridColumnFilterType.SelectFilterStrict);
        }
Beispiel #2
0
        public DetailViewData(FirmaSession currentFirmaSession,
                              ProjectFirmaModels.Models.PerformanceMeasure performanceMeasure,
                              PerformanceMeasureChartViewData performanceMeasureChartViewData,
                              EntityNotesViewData entityNotesViewData,
                              bool userHasPerformanceMeasureManagePermissions, bool isAdmin) : base(currentFirmaSession)
        {
            PageTitle  = performanceMeasure.PerformanceMeasureDisplayName;
            EntityName = "PerformanceMeasure Detail";

            PerformanceMeasure = performanceMeasure;
            PerformanceMeasureChartViewData = performanceMeasureChartViewData;
            EntityNotesViewData             = entityNotesViewData;
            UserHasPerformanceMeasureOverviewManagePermissions = userHasPerformanceMeasureManagePermissions;
            IsAdmin = isAdmin;

            EditPerformanceMeasureUrl = SitkaRoute <PerformanceMeasureController> .BuildUrlFromExpression(c => c.Edit(performanceMeasure));

            EditSubcategoriesAndOptionsUrl = SitkaRoute <PerformanceMeasureController> .BuildUrlFromExpression(c => c.EditSubcategoriesAndOptions(performanceMeasure));

            var performanceMeasuresExternallySourced = HttpRequestStorage.Tenant.ArePerformanceMeasuresExternallySourced;

            CanEditImportanceAndAdditionalInformation = !performanceMeasuresExternallySourced;
            EditImportanceUrl = SitkaRoute <PerformanceMeasureController> .BuildUrlFromExpression(c => c.EditPerformanceMeasureRichText(performanceMeasure, EditRtfContent.PerformanceMeasureRichTextType.Importance));

            EditAdditionalInformationUrl = SitkaRoute <PerformanceMeasureController> .BuildUrlFromExpression(c => c.EditPerformanceMeasureRichText(performanceMeasure, EditRtfContent.PerformanceMeasureRichTextType.AdditionalInformation));

            EditCriticalDefinitionsUrl = SitkaRoute <PerformanceMeasureController> .BuildUrlFromExpression(c => c.EditPerformanceMeasureRichText(performanceMeasure, EditRtfContent.PerformanceMeasureRichTextType.CriticalDefinitions));

            EditProjectReportingUrl = SitkaRoute <PerformanceMeasureController> .BuildUrlFromExpression(c => c.EditPerformanceMeasureRichText(performanceMeasure, EditRtfContent.PerformanceMeasureRichTextType.ProjectReporting));

            IndexUrl = SitkaRoute <PerformanceMeasureController> .BuildUrlFromExpression(c => c.Index());

            var associatePerformanceMeasureTaxonomyLevel = MultiTenantHelpers.GetAssociatePerformanceMeasureTaxonomyLevel();

            TaxonomyTierDisplayNamePluralized = associatePerformanceMeasureTaxonomyLevel.GetFieldDefinition().GetFieldDefinitionLabelPluralized();
            UserHasTaxonomyTierPerformanceMeasureManagePermissions = new TaxonomyTierPerformanceMeasureManageFeature().HasPermission(currentFirmaSession, performanceMeasure).HasPermission;
            EditTaxonomyTiersUrl = SitkaRoute <TaxonomyTierPerformanceMeasureController> .BuildUrlFromExpression(c => c.Edit(performanceMeasure));

            RelatedTaxonomyTiersViewData = new RelatedTaxonomyTiersViewData(performanceMeasure, associatePerformanceMeasureTaxonomyLevel, true);

            // Hide GeoSpatialArea panel on tenants where performance measures are externally sourced
            ShowGeoSpatialAreaPanel = !performanceMeasuresExternallySourced;
            CanAddGeospatialArea    = new GeospatialAreaPerformanceMeasureTargetManageFeature().HasPermissionByFirmaSession(currentFirmaSession);

            PerformanceMeasureReportedValuesGridSpec = new PerformanceMeasureReportedValuesGridSpec(performanceMeasure)
            {
                ObjectNameSingular  = $"{FieldDefinitionEnum.ReportedValue.ToType().GetFieldDefinitionLabel()} for {FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabel()}",
                ObjectNamePlural    = $"{FieldDefinitionEnum.ReportedValue.ToType().GetFieldDefinitionLabelPluralized()} for {FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabelPluralized()}",
                SaveFiltersInCookie = true
            };

            PerformanceMeasureReportedValuesGridName    = "performanceMeasuresReportedValuesFromPerformanceMeasureGrid";
            PerformanceMeasureReportedValuesGridDataUrl = SitkaRoute <PerformanceMeasureController> .BuildUrlFromExpression(tc => tc.PerformanceMeasureReportedValuesGridJsonData(performanceMeasure));

            PerformanceMeasureExpectedGridSpec = new PerformanceMeasureExpectedGridSpec(performanceMeasure)
            {
                ObjectNameSingular  = $"{FieldDefinitionEnum.ExpectedValue.ToType().GetFieldDefinitionLabel()} for {FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabel()}",
                ObjectNamePlural    = $"{FieldDefinitionEnum.ExpectedValue.ToType().GetFieldDefinitionLabelPluralized()} for {FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabelPluralized()}",
                SaveFiltersInCookie = true
            };

            PerformanceMeasureExpectedsGridName    = "performanceMeasuresExpectedValuesFromPerformanceMeasureGrid";
            PerformanceMeasureExpectedsGridDataUrl = SitkaRoute <PerformanceMeasureController> .BuildUrlFromExpression(tc => tc.PerformanceMeasureExpectedsGridJsonData(performanceMeasure));

            GeospatialAreaPerformanceMeasureTargetGridSpec = new GeospatialAreaPerformanceMeasureTargetGridSpec(currentFirmaSession, performanceMeasure)
            {
                ObjectNameSingular  = $"{FieldDefinitionEnum.GeospatialArea.ToType().GetFieldDefinitionLabel()} Target for {performanceMeasure.GetDisplayName()}",
                ObjectNamePlural    = $"{FieldDefinitionEnum.GeospatialArea.ToType().GetFieldDefinitionLabel()} Targets for {performanceMeasure.GetDisplayName()}",
                SaveFiltersInCookie = true
            };

            GeospatialAreaPerformanceMeasureTargetGridName    = "geospatialAreaPerformanceMeasuresTargetsGrid";
            GeospatialAreaPerformanceMeasureTargetGridDataUrl = SitkaRoute <PerformanceMeasureController> .BuildUrlFromExpression(tc => tc.GeospatialAreaPerformanceMeasureTargetsGridJsonData(performanceMeasure));

            AddGeospatialAreaPerformanceMeasureTargetDialogTitle = $"Add {FieldDefinitionEnum.GeospatialArea.ToType().GetFieldDefinitionLabelPluralized()} to {performanceMeasure.GetDisplayName()}";
            AddGeospatialAreaPerformanceMeasureTargetText        = $"{BootstrapHtmlHelpers.MakeGlyphIcon("glyphicon-plus")} Add {FieldDefinitionEnum.GeospatialArea.ToType().GetFieldDefinitionLabel()}";
            AddGeospatialAreaPerformanceMeasureTargetUrl         = SitkaRoute <GeospatialAreaPerformanceMeasureTargetController> .BuildUrlFromExpression(x => x.AddGeospatialAreaToPerformanceMeasure(performanceMeasure));

            EditPerformanceMeasureTargetUrl = SitkaRoute <PerformanceMeasureController> .BuildUrlFromExpression(pmc => pmc.EditPerformanceMeasureReportedValues(performanceMeasure));

            FieldDefinitionForPerformanceMeasure                  = FieldDefinitionEnum.PerformanceMeasure.ToType();
            FieldDefinitionForPerformanceMeasureType              = FieldDefinitionEnum.PerformanceMeasureType.ToType();
            FieldDefinitionForPerformanceMeasureSubcategory       = FieldDefinitionEnum.PerformanceMeasureSubcategory.ToType();
            FieldDefinitionForPerformanceMeasureSubcategoryOption = FieldDefinitionEnum.PerformanceMeasureSubcategoryOption.ToType();
            FieldDefinitionForProject = FieldDefinitionEnum.Project.ToType();
        }