public WaterQualityManagementPlanVerificationGridSpec(Person currentPerson)
        {
            // Reusing permissions checks from WQMPs for WQMP Verifications
            var waterQualityManagementPlanManageFeature = new WaterQualityManagementPlanManageFeature();
            var waterQualityManagementPlanDeleteFeature = new WaterQualityManagementPlanDeleteFeature();

            var currentUserCanManage = waterQualityManagementPlanManageFeature.HasPermissionByPerson(currentPerson);

            ObjectNameSingular  = "Water Quality Management Plan O&M Verification";
            ObjectNamePlural    = "Water Quality Management Plan O&M Verifications";
            SaveFiltersInCookie = true;
            var isAnonymousOrUnassigned = currentPerson.IsAnonymousOrUnassigned();

            if (currentUserCanManage)
            {
                Add(string.Empty, x =>
                {
                    var userHasDeletePermission = waterQualityManagementPlanDeleteFeature
                                                  .HasPermission(currentPerson, x.WaterQualityManagementPlan).HasPermission;
                    return(DhtmlxGridHtmlHelpers.MakeDeleteIconAndLinkBootstrap(x.GetDeleteUrl(),
                                                                                userHasDeletePermission));
                }, 26,
                    DhtmlxGridColumnFilterType.None);
            }

            if (!isAnonymousOrUnassigned)
            {
                Add(string.Empty,
                    x => UrlTemplate.MakeHrefString(x.GetDetailUrl(), "View",
                                                    new Dictionary <string, string> {
                    { "class", "gridButton" }
                }), 60,
                    DhtmlxGridColumnFilterType.None);
            }
            Add("WQMP Name", x => x.WaterQualityManagementPlan.GetDisplayNameAsUrl(), 300, DhtmlxGridColumnFilterType.Text);
            Add("Jurisdiction", x => isAnonymousOrUnassigned ? new HtmlString(x.WaterQualityManagementPlan.StormwaterJurisdiction.GetOrganizationDisplayName()) : x.WaterQualityManagementPlan.StormwaterJurisdiction.GetDisplayNameAsDetailUrl(), 150);
            Add("Verification Date", x => x.VerificationDate, 150);
            Add("Last Edited Date", x => x.LastEditedDate, 150);
            Add("Last Edited By", x => x.LastEditedByPerson.GetFullNameFirstLast(), 150, DhtmlxGridColumnFilterType.SelectFilterStrict);
            Add("Type of Verification",
                x => x.WaterQualityManagementPlanVerifyType.WaterQualityManagementPlanVerifyTypeName, 150, DhtmlxGridColumnFilterType.SelectFilterStrict);
            Add("Visit Status", x => x.WaterQualityManagementPlanVisitStatus.WaterQualityManagementPlanVisitStatusName,
                150, DhtmlxGridColumnFilterType.SelectFilterStrict);
            Add("Verification Status",
                x => x.WaterQualityManagementPlanVerifyStatus?.WaterQualityManagementPlanVerifyStatusName, 200, DhtmlxGridColumnFilterType.SelectFilterStrict);
            Add("Source Control Condition", x => x.SourceControlCondition, 150);
            Add("Enforcement of Follow-up Actions", x => x.EnforcementOrFollowupActions, 150);
            Add("Draft or Finalized",
                x => x.IsDraft ? "Draft" : "Finalized", 100, DhtmlxGridColumnFilterType.SelectFilterStrict);
        }
Exemplo n.º 2
0
        public WaterQualityManagementPlanIndexGridSpec(Person currentPerson)
        {
            var fieldDefinitionWaterQualityManagementPlan = FieldDefinitionType.WaterQualityManagementPlan;
            var waterQualityManagementPlanLabelSingular   =
                fieldDefinitionWaterQualityManagementPlan.GetFieldDefinitionLabel();

            ObjectNameSingular  = waterQualityManagementPlanLabelSingular;
            ObjectNamePlural    = fieldDefinitionWaterQualityManagementPlan.GetFieldDefinitionLabelPluralized();
            SaveFiltersInCookie = true;

            var waterQualityManagementPlanDeleteFeature = new WaterQualityManagementPlanDeleteFeature();
            var qualityManagementPlanManageFeature      = new WaterQualityManagementPlanManageFeature();
            var isAnonymousOrUnassigned = currentPerson.IsAnonymousOrUnassigned();

            Add(string.Empty, x => DhtmlxGridHtmlHelpers.MakeDeleteIconAndLinkBootstrap(x.GetDeleteUrl(),
                                                                                        waterQualityManagementPlanDeleteFeature.HasPermission(currentPerson, x).HasPermission), 26,
                DhtmlxGridColumnFilterType.None);
            Add(string.Empty,
                x => DhtmlxGridHtmlHelpers.MakeEditIconAsModalDialogLinkBootstrap(new ModalDialogForm(x.GetEditUrl(),
                                                                                                      ModalDialogFormHelper.DefaultDialogWidth,
                                                                                                      $"Edit {waterQualityManagementPlanLabelSingular}"),
                                                                                  qualityManagementPlanManageFeature.HasPermission(currentPerson, x).HasPermission),
                26, DhtmlxGridColumnFilterType.None);
            Add("Name", x => x.GetDisplayNameAsUrl(), 300, DhtmlxGridColumnFilterType.Text);
            Add("Jurisdiction", x => isAnonymousOrUnassigned ? new HtmlString(x.StormwaterJurisdiction.GetOrganizationDisplayName()) : x.StormwaterJurisdiction.GetDisplayNameAsDetailUrl(), 150);
            Add("Priority", x => x.WaterQualityManagementPlanPriority?.WaterQualityManagementPlanPriorityDisplayName,
                100, DhtmlxGridColumnFilterType.SelectFilterStrict);
            Add("Status", x => x.WaterQualityManagementPlanStatus?.WaterQualityManagementPlanStatusDisplayName, 100,
                DhtmlxGridColumnFilterType.SelectFilterStrict);
            Add("Development Type",
                x => x.WaterQualityManagementPlanDevelopmentType?.WaterQualityManagementPlanDevelopmentTypeDisplayName,
                100, DhtmlxGridColumnFilterType.SelectFilterStrict);
            Add("Land Use", x => x.WaterQualityManagementPlanLandUse?.WaterQualityManagementPlanLandUseDisplayName, 100,
                DhtmlxGridColumnFilterType.SelectFilterStrict);
            Add("Permit Term",
                x => x.WaterQualityManagementPlanPermitTerm?.WaterQualityManagementPlanPermitTermDisplayName, 100,
                DhtmlxGridColumnFilterType.SelectFilterStrict);
            Add("Approval Date", x => x.ApprovalDate, 120);
            Add("Date of Construction", x => x.DateOfContruction, 120);
            Add(FieldDefinitionType.HydromodificationApplies.ToGridHeaderString(), x => x.HydromodificationAppliesType?.HydromodificationAppliesTypeDisplayName, 130,
                DhtmlxGridColumnFilterType.SelectFilterStrict);
            Add("Hydrologic Subarea", x => x.HydrologicSubarea?.HydrologicSubareaName, 120,
                DhtmlxGridColumnFilterType.SelectFilterStrict);

            if (!currentPerson.IsAnonymousOrUnassigned())
            {
                Add("Maintenance Contact Organization", x => x.MaintenanceContactOrganization, 120);
                Add("Maintenance Contact Name", x => x.MaintenanceContactName, 100);
                Add("Maintenance Contact Address", x => x.MaintenanceContactAddressToString(), 200);
                Add("Maintenance Contact Phone", x => x.MaintenanceContactPhone, 70);
            }

            Add("# of Inventoried BMPs", x => currentPerson.GetInventoriedBMPsForWQMP(x).Count(), 100);
            Add("# of Simplified BMPs", x => x.QuickBMPs.Count, 100);
            Add("Modeling Approach", x => x.WaterQualityManagementPlanModelingApproach.WaterQualityManagementPlanModelingApproachDisplayName,
                100, DhtmlxGridColumnFilterType.SelectFilterStrict);
            Add(FieldDefinitionType.FullyParameterized.ToGridHeaderString("Fully Parameterized?"), x => x.IsFullyParameterized() ? new HtmlString("Yes") : new HtmlString("No"), 120);
            Add("# of Documents", x => x.WaterQualityManagementPlanDocuments.Count, 100);
            Add(FieldDefinitionType.HasAllRequiredDocuments.ToGridHeaderString(),
                x => x.HasAllRequiredDocuments()
                    ? BootstrapHtmlHelpers.MakeGlyphIconWithHiddenText("glyphicon-ok-circle", "Yes")
                    : new HtmlString("<span style='display:none;'>No</span>")
                , 100, DhtmlxGridColumnFilterType.SelectFilterHtmlStrict, DhtmlxGridColumnAlignType.Center);
            Add("Record Number", x => x.RecordNumber, 150);
            Add("Recorded Parcel Acreage", x => x.RecordedWQMPAreaInAcres, 100);
            Add("Calculated Parcel Acreage", x => Math.Round(x.CalculateParcelAcreageTotal(), 1), 100);
            Add("Latest O&M Verification",
                x => currentPerson.IsAnonymousOrUnassigned() ? new HtmlString(x.GetLatestOandMVerificationDate().IsNullOrWhiteSpace()
                    ? "N/A" : x.GetLatestOandMVerificationDate()) :new HtmlString(!x.GetLatestOandMVerificationDate().IsNullOrWhiteSpace()
                    ? $"<a href=\"{x.GetLatestOandMVerificationUrl()}\" alt=\"{x.GetLatestOandMVerificationDate()}\" title=\"{x.GetLatestOandMVerificationDate()}\" >{x.GetLatestOandMVerificationDate()}</a>"
                    : "N/A"), 100);
            Add(FieldDefinitionType.TrashCaptureStatus.ToGridHeaderString(),
                x => x.TrashCaptureStatusType.TrashCaptureStatusTypeDisplayName, 130,
                DhtmlxGridColumnFilterType.SelectFilterStrict);
        }