Example #1
0
        public GridJsonNetJObjectResult <WbsElementObligationItemBudget> ContractualObligationIndexGridJsonData()
        {
            var gridSpec = new ContractualInvoiceGridSpec(CurrentFirmaSession);
            var obligationItemBudgets    = HttpRequestStorage.DatabaseEntities.WbsElementObligationItemBudgets.ToList();
            var gridJsonNetJObjectResult = new GridJsonNetJObjectResult <WbsElementObligationItemBudget>(obligationItemBudgets, gridSpec);

            return(gridJsonNetJObjectResult);
        }
Example #2
0
        public GridJsonNetJObjectResult <WbsElementObligationItemBudget> ContractualInvoiceGridJsonData(CostAuthorityPrimaryKey costAuthorityPrimaryKey)
        {
            var gridSpec                 = new ContractualInvoiceGridSpec(CurrentFirmaSession);
            var costAuthority            = costAuthorityPrimaryKey.EntityObject;
            var obligationItemBudgets    = costAuthority.WbsElementObligationItemBudgets.ToList();
            var gridJsonNetJObjectResult = new GridJsonNetJObjectResult <WbsElementObligationItemBudget>(obligationItemBudgets, gridSpec);

            return(gridJsonNetJObjectResult);
        }
Example #3
0
        public GridJsonNetJObjectResult <WbsElementObligationItemBudget> VendorContractualInvoiceGridJsonData(VendorPrimaryKey vendorPrimaryKey)
        {
            var gridSpec = new ContractualInvoiceGridSpec(CurrentFirmaSession);
            var vendor   = vendorPrimaryKey.EntityObject;
            var obligationItemBudgets    = vendor.ObligationItems.SelectMany(oi => oi.WbsElementObligationItemBudgets).ToList();
            var gridJsonNetJObjectResult = new GridJsonNetJObjectResult <WbsElementObligationItemBudget>(obligationItemBudgets, gridSpec);

            return(gridJsonNetJObjectResult);
        }
Example #4
0
        public GridJsonNetJObjectResult <WbsElementObligationItemBudget> ContractualObligationByObligationItemGridJsonData(ObligationItemPrimaryKey obligationItemPrimaryKey)
        {
            var gridSpec                 = new ContractualInvoiceGridSpec(CurrentFirmaSession);
            var obligationItem           = obligationItemPrimaryKey.EntityObject;
            var obligationItemBudgets    = obligationItem.GetWbsElementObligationItemBudgetsSorted();
            var gridJsonNetJObjectResult = new GridJsonNetJObjectResult <WbsElementObligationItemBudget>(obligationItemBudgets, gridSpec);

            return(gridJsonNetJObjectResult);
        }
        public GridJsonNetJObjectResult <WbsElementObligationItemBudget> ContractualInvoiceGridOnBudgetObjectCodeDetailJsonData(BudgetObjectCodePrimaryKey budgetObjectCodePrimaryKey)
        {
            var gridSpec                 = new ContractualInvoiceGridSpec(CurrentFirmaSession);
            var budgetObjectCode         = budgetObjectCodePrimaryKey.EntityObject;
            var obligationItemBudgets    = budgetObjectCode.WbsElementObligationItemBudgets.ToList();
            var gridJsonNetJObjectResult = new GridJsonNetJObjectResult <WbsElementObligationItemBudget>(obligationItemBudgets, gridSpec);

            return(gridJsonNetJObjectResult);
        }
        public GridJsonNetJObjectResult <WbsElementObligationItemBudget> ContractualInvoiceGridOnFundDetailJsonData(FundingSourcePrimaryKey fundingSourcePrimaryKey)
        {
            var gridSpec                 = new ContractualInvoiceGridSpec(CurrentFirmaSession);
            var fundingSource            = fundingSourcePrimaryKey.EntityObject;
            var obligationItemBudgets    = fundingSource.WbsElementObligationItemBudgets.ToList();
            var gridJsonNetJObjectResult = new GridJsonNetJObjectResult <WbsElementObligationItemBudget>(obligationItemBudgets, gridSpec);

            return(gridJsonNetJObjectResult);
        }
        /*
         * public ObligationItemBudgetGridSpec ObligationItemBudgetGridSpec { get; }
         * public string ObligationItemBudgetGridName { get; }
         * public string ObligationItemBudgetGridDataUrl { get; }
         */

        public CostAuthorityDetailViewData(FirmaSession currentFirmaSession,
                                           ProjectFirmaModels.Models.CostAuthority costAuthority) : base(currentFirmaSession)
        {
            CostAuthority = costAuthority;

            PageTitle  = $"{FieldDefinitionEnum.CostAuthorityWorkBreakdownStructure.ToType().GetFieldDefinitionLabel()}: {costAuthority.CostAuthorityWorkBreakdownStructure}";
            EntityName = $"{FieldDefinitionEnum.CostAuthorityWorkBreakdownStructure.ToType().GetFieldDefinitionLabel()} Detail";

            UserHasCostAuthorityManagePermissions = new CostAuthorityManageFeature().HasPermissionByPerson(CurrentPerson);
            IsAdmin = new FirmaAdminFeature().HasPermissionByFirmaSession(currentFirmaSession);

            IndexUrl = SitkaRoute <CostAuthorityController> .BuildUrlFromExpression(ca => ca.CostAuthorityIndex());

            AgreementIndexUrl = SitkaRoute <AgreementController> .BuildUrlFromExpression(ac => ac.AgreementIndex());

            FieldDefinitionForAgreement = FieldDefinitionEnum.Agreement.ToType();
            FieldDefinitionForProject   = FieldDefinitionEnum.Project.ToType();
            FieldDefinitionForCostAuthorityWorkBreakdownStructure = FieldDefinitionEnum.CostAuthorityWorkBreakdownStructure.ToType();

            BasicProjectInfoProjectGridName = "costAuthorityProjectListGrid";
            BasicProjectInfoGridSpec        = new BasicProjectInfoGridSpec(CurrentFirmaSession, true, CostAuthority)
            {
                ObjectNameSingular  = $"{FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabel()} associated with {FieldDefinitionEnum.CostAuthorityWorkBreakdownStructure.ToType().GetFieldDefinitionLabel()} {costAuthority.CostAuthorityWorkBreakdownStructure}",
                ObjectNamePlural    = $"{FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabelPluralized()} associated with {FieldDefinitionEnum.CostAuthorityWorkBreakdownStructure.ToType().GetFieldDefinitionLabel()} {costAuthority.CostAuthorityWorkBreakdownStructure}",
                SaveFiltersInCookie = true
            };
            BasicProjectInfoProjectGridDataUrl = SitkaRoute <CostAuthorityController> .BuildUrlFromExpression(cac => cac.CostAuthorityProjectsGridJsonData(costAuthority));

            AgreementGridName = "costAuthorityAgreementListGrid";
            AgreementGridSpec = new AgreementGridSpec(CurrentFirmaSession)
            {
                ObjectNameSingular  = $"{FieldDefinitionEnum.Agreement.ToType().GetFieldDefinitionLabel()} associated with {FieldDefinitionEnum.CostAuthorityWorkBreakdownStructure.ToType().GetFieldDefinitionLabel()} {costAuthority.CostAuthorityWorkBreakdownStructure}",
                ObjectNamePlural    = $"{FieldDefinitionEnum.Agreement.ToType().GetFieldDefinitionLabelPluralized()} associated with {FieldDefinitionEnum.CostAuthorityWorkBreakdownStructure.ToType().GetFieldDefinitionLabel()} {costAuthority.CostAuthorityWorkBreakdownStructure}",
                SaveFiltersInCookie = true
            };
            AgreementGridDataUrl = SitkaRoute <CostAuthorityController> .BuildUrlFromExpression(cac => cac.CostAuthorityAgreementGridJsonData(costAuthority));

            HasPnBudgetViewPermission = new PnBudgetViewFeature().HasPermissionByFirmaSession(currentFirmaSession);

            PnBudgetGridName    = "PnBudgetsGrid";
            PnBudgetGridSpec    = new PnBudgetGridSpec(currentFirmaSession);
            PnBudgetGridDataUrl = SitkaRoute <PnBudgetController> .BuildUrlFromExpression(c => c.PnBudgetsForCostAuthorityGridJsonData(costAuthority.CostAuthorityWorkBreakdownStructure));

            HasObligationViewPermission = new ObligationViewFeature().HasPermissionByFirmaSession(currentFirmaSession);

            ContractualInvoiceGridName    = "contractualInvoiceGrid";
            ContractualInvoiceGridSpec    = new ContractualInvoiceGridSpec(currentFirmaSession);
            ContractualInvoiceGridDataUrl = SitkaRoute <CostAuthorityController> .BuildUrlFromExpression(cac => cac.ContractualInvoiceGridJsonData(costAuthority));

            //ObligationItemBudgetGridName = "obligationItemBudgets";
            //ObligationItemBudgetGridSpec = new ObligationItemBudgetGridSpec(currentFirmaSession);
            //ObligationItemBudgetGridDataUrl = SitkaRoute<CostAuthorityController>.BuildUrlFromExpression(oc => oc.ObligationItemBudgetGridJsonData(costAuthority));
        }
        public ObligationItemDetailViewData(FirmaSession currentFirmaSession,
                                            ProjectFirmaModels.Models.ObligationItem obligationItem) : base(currentFirmaSession)
        {
            PageTitle  = $"{FieldDefinitionEnum.ObligationItem.ToType().FieldDefinitionDisplayName}: {obligationItem.GetDisplayName()}";
            EntityName = $"{FieldDefinitionEnum.ObligationItem.ToType().FieldDefinitionDisplayName} Detail";

            ObligationItem         = obligationItem;
            ObligationItemIndexUrl = SitkaRoute <ObligationItemController> .BuildUrlFromExpression(c => c.ObligationItemIndex());

            ContractualInvoiceGridName    = "contractualInvoiceGrid";
            ContractualInvoiceGridSpec    = new ContractualInvoiceGridSpec(currentFirmaSession);
            ContractualInvoiceGridDataUrl = SitkaRoute <ObligationController> .BuildUrlFromExpression(oc => oc.ContractualObligationByObligationItemGridJsonData(ObligationItem));
        }
Example #9
0
        /*
         * public ObligationItemBudgetGridSpec ObligationItemBudgetGridSpec { get; }
         * public string ObligationItemBudgetGridName { get; }
         * public string ObligationItemBudgetGridDataUrl { get; }
         */

        public BudgetObjectCodeDetailViewData(FirmaSession currentFirmaSession, ProjectFirmaModels.Models.BudgetObjectCode budgetObjectCode) : base(currentFirmaSession)
        {
            PageTitle  = $"Budget Object Code: {budgetObjectCode.GetDisplayName()}";
            EntityName = "Budget Object Code Detail";

            BudgetObjectCode         = budgetObjectCode;
            BudgetObjectCodeIndexUrl = SitkaRoute <BudgetObjectCodeController> .BuildUrlFromExpression(c => c.BudgetObjectCodeIndex());

            ContractualInvoiceGridName        = "budgetObjectCodeItemInvoices";
            ContractualInvoiceGridSpec        = new ContractualInvoiceGridSpec(currentFirmaSession);
            ContractualItemInvoiceGridDataUrl = SitkaRoute <BudgetObjectCodeController> .BuildUrlFromExpression(fc => fc.ContractualInvoiceGridOnBudgetObjectCodeDetailJsonData(budgetObjectCode));

            //ObligationItemBudgetGridName = "budgetObjectCodeItemBudgets";
            //ObligationItemBudgetGridSpec = new ObligationItemBudgetGridSpec(currentFirmaSession);
            //ObligationItemBudgetGridDataUrl = SitkaRoute<BudgetObjectCodeController>.BuildUrlFromExpression(fc => fc.ObligationItemBudgetGridOnBudgetObjectCodeDetailJsonData(budgetObjectCode));
        }
Example #10
0
        //public ObligationItemBudgetGridSpec ObligationItemBudgetGridSpec { get; }
        //public string ObligationItemBudgetGridName { get; }
        //public string ObligationItemBudgetGridDataUrl { get; }


        public VendorDetailViewData(FirmaSession currentFirmaSession,
                                    ProjectFirmaModels.Models.Vendor vendor) : base(currentFirmaSession)
        {
            Vendor         = vendor;
            PageTitle      = vendor.GetDisplayName();
            EntityName     = $"{FieldDefinitionEnum.Vendor.ToType().GetFieldDefinitionLabel()}";
            VendorIndexUrl = SitkaRoute <VendorController> .BuildUrlFromExpression(c => c.Index());

            /*
             * ObligationItemInvoiceGridName = "obligationItemInvoices";
             * ContractualInvoiceGridSpec = new ContractualInvoiceGridSpec(currentFirmaSession);
             * ObligationItemInvoiceGridDataUrl = SitkaRoute<VendorController>.BuildUrlFromExpression(oc => oc.VendorObligationItemInvoiceGridJsonData(vendor));
             */

            ContractualInvoiceGridName    = "contractualInvoiceGrid";
            ContractualInvoiceGridSpec    = new ContractualInvoiceGridSpec(currentFirmaSession);
            ContractualInvoiceGridDataUrl = SitkaRoute <VendorController> .BuildUrlFromExpression(oc => oc.VendorContractualInvoiceGridJsonData(vendor));
        }
Example #11
0
        //public ObligationItemBudgetGridSpec ObligationItemBudgetGridSpec { get; }
        //public string ObligationItemBudgetGridName { get; }
        //public string ObligationItemBudgetGridDataUrl { get; }


        public DetailViewData(FirmaSession currentFirmaSession, ProjectFirmaModels.Models.FundingSource fundingSource, ViewGoogleChartViewData viewGoogleChartViewData, GridSpec <ProjectFirmaModels.Models.ProjectFundingSourceBudget> projectFundingSourceBudgetGridSpec, DisplayFundingSourceCustomAttributesViewData displayFundingSourceCustomAttributeTypesViewData)
            : base(currentFirmaSession)
        {
            ViewGoogleChartViewData = viewGoogleChartViewData;
            FundingSource           = fundingSource;
            PageTitle  = fundingSource.GetDisplayName();
            EntityName = $"{FieldDefinitionEnum.FundingSource.ToType().GetFieldDefinitionLabel()}";
            UserHasFundingSourceManagePermissions = new FundingSourceEditFeature().HasPermission(currentFirmaSession, fundingSource).HasPermission;
            UserHasFundingSourceCustomAttributeManagePermissions    = new FundingSourceCustomAttributeEditFeature().HasPermission(currentFirmaSession, fundingSource).HasPermission;
            UserHasProjectFundingSourceExpenditureManagePermissions = new FirmaAdminFeature().HasPermissionByFirmaSession(currentFirmaSession);
            EditFundingSourceUrl = fundingSource.GetEditUrl();

            EditFundingSourceCustomAttributesUrl = SitkaRoute <FundingSourceCustomAttributesController> .BuildUrlFromExpression(c => c.EditFundingSourceCustomAttributesForFundingSource(fundingSource));

            var projectFundingSourceExpenditures = FundingSource.ProjectFundingSourceExpenditures.ToList();

            CalendarYearsForProjectExpenditures = projectFundingSourceExpenditures.CalculateCalendarYearRangeForExpenditures(fundingSource);

            ProjectCalendarYearExpendituresGridSpec = new ProjectCalendarYearExpendituresGridSpec(CalendarYearsForProjectExpenditures)
            {
                ObjectNameSingular  = $"{FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabel()}",
                ObjectNamePlural    = $"{FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabelPluralized()}",
                SaveFiltersInCookie = true
            };

            ProjectCalendarYearExpendituresGridName    = "projectsCalendarYearExpendituresFromFundingSourceGrid";
            ProjectCalendarYearExpendituresGridDataUrl = SitkaRoute <FundingSourceController> .BuildUrlFromExpression(tc => tc.ProjectCalendarYearExpendituresGridJsonData(fundingSource));

            ManageFundingSourcesUrl = SitkaRoute <FundingSourceController> .BuildUrlFromExpression(c => c.Index());

            ProjectFundingSourceBudgetGridSpec    = projectFundingSourceBudgetGridSpec;
            ProjectFundingSourceBudgetGridName    = "projectsFundingSourceRequestsFromFundingSourceGrid";
            ProjectFundingSourceBudgetGridDataUrl = SitkaRoute <FundingSourceController> .BuildUrlFromExpression(tc => tc.ProjectFundingSourceBudgetGridJsonData(fundingSource));

            DisplayFundingSourceCustomAttributeTypesViewData = displayFundingSourceCustomAttributeTypesViewData;

            ContractualInvoiceGridName    = "fundingSourceContractualInvoicesGrid";
            ContractualInvoiceGridSpec    = new ContractualInvoiceGridSpec(currentFirmaSession);
            ContractualInvoiceGridDataUrl = SitkaRoute <FundingSourceController> .BuildUrlFromExpression(fc => fc.ContractualInvoiceGridOnFundDetailJsonData(fundingSource));

            //ObligationItemBudgetGridName = "fundingSourceContractualInvoicesGrid";
            //ObligationItemBudgetGridSpec = new ObligationItemBudgetGridSpec(currentFirmaSession);
            //ObligationItemBudgetGridDataUrl = SitkaRoute<FundingSourceController>.BuildUrlFromExpression(fc => fc.ObligationItemBudgetGridOnFundDetailJsonData(fundingSource));
        }
Example #12
0
        public DetailViewData(FirmaSession currentFirmaSession, ProjectFirmaModels.Models.Project project,
                              List <ProjectStage> projectStages,
                              ProjectBasicsViewData projectBasicsViewData, ProjectLocationSummaryViewData projectLocationSummaryViewData,
                              ProjectBudgetSummaryViewData projectBudgetSummaryViewData,
                              ProjectBudgetsAnnualViewData projectBudgetsAnnualViewData,
                              ProjectBudgetsAnnualByCostTypeViewData projectBudgetsAnnualByCostTypeViewData,
                              ProjectAgreementDetailViewData projectAgreementDetailViewData,
                              TechnicalAssistanceRequestsDetailViewData technicalAssistanceRequestDetailViewData,
                              PerformanceMeasureExpectedSummaryViewData performanceMeasureExpectedSummaryViewData,
                              PerformanceMeasureReportedValuesGroupedViewData performanceMeasureReportedValuesGroupedViewData,
                              ProjectExpendituresDetailViewData projectExpendituresDetailViewData,
                              ProjectExpendituresByCostTypeDetailViewData projectExpendituresByCostTypeDetailViewData,
                              ImageGalleryViewData imageGalleryViewData, EntityNotesViewData projectNotesViewData,
                              EntityNotesViewData internalNotesViewData,
                              EntityExternalLinksViewData entityExternalLinksViewData,
                              ProjectBasicsTagsViewData projectBasicsTagsViewData, bool userHasProjectAdminPermissions,
                              bool userHasEditProjectPermissions,
                              bool userHasEditProjectAgreementPermissions,
                              bool userHasProjectUpdatePermissions,
                              bool userHasPerformanceMeasureActualManagePermissions, string mapFormID,
                              string editProjectCustomAttributesUrl,
                              string editSimpleProjectLocationUrl, string editDetailedProjectLocationUrl,
                              string editProjectOrganizationsUrl, string editPerformanceMeasureExpectedsUrl,
                              string editPerformanceMeasureActualsUrl, string editReportedExpendituresUrl,
                              bool reportFinancialsByCostType, AuditLogsGridSpec auditLogsGridSpec, string auditLogsGridDataUrl,
                              string editExternalLinksUrl, ProjectNotificationGridSpec projectNotificationGridSpec,
                              string projectNotificationGridName, string projectNotificationGridDataUrl, bool userCanEditProposal,
                              ProjectOrganizationsDetailViewData projectOrganizationsDetailViewData,
                              ProjectPotentialPartnerDetailViewData projectPotentialPartnerDetailViewData,
                              List <ProjectFirmaModels.Models.ClassificationSystem> classificationSystems,
                              string editProjectBoundingBoxFormID, List <GeospatialAreaType> geospatialAreaTypes,
                              DisplayProjectCustomAttributesViewData displayProjectCustomAttributeTypesViewData,
                              ProjectContactsDetailViewData projectContactsDetailViewData, string editProjectContactsUrl,
                              string editExpectedFundingUrl, ProjectTimelineDisplayViewData projectTimelineDisplayViewData,
                              bool userHasProjectTimelinePermissions, List <ProjectEvaluation> projectEvaluationsUserHasAccessTo,
                              bool userHasStartUpdateWorkflowPermission,
                              ActionItemsDisplayViewData actionItemsDisplayViewData,
                              bool userCanViewActionItems,
                              ProjectRunningBalanceObligationsAndExpendituresViewData projectRunningBalanceObligationsAndExpendituresViewData,
                              ProjectBalanceBurnUpViewData projectBalanceBurnUpViewData)
            : base(currentFirmaSession, project)
        {
            PageTitle       = project.GetDisplayName();
            BreadCrumbTitle = $"{FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabel()} Detail";
            ProjectStages   = projectStages;

            EditProjectUrl = project.GetEditUrl();
            UserHasProjectAdminPermissions                   = userHasProjectAdminPermissions;
            UserHasEditProjectPermissions                    = userHasEditProjectPermissions;
            UserHasEditProjectAgreementPermissions           = userHasEditProjectAgreementPermissions;
            UserHasPerformanceMeasureActualManagePermissions = userHasPerformanceMeasureActualManagePermissions;
            UserHasProjectTimelinePermissions                = userHasProjectTimelinePermissions;
            CanLaunchProjectOrProposalWizard                 = userHasStartUpdateWorkflowPermission;
            WithdrawUrl = SitkaRoute <ProjectCreateController> .BuildUrlFromExpression(c => c.Withdraw(project));

            var projectAlerts          = new List <string>();
            var proposedProjectListUrl = SitkaRoute <ProjectController> .BuildUrlFromExpression(c => c.Proposed());

            var backToAllProposalsText = "Back to all Proposals";
            var pendingProjectsListUrl = SitkaRoute <ProjectController> .BuildUrlFromExpression(c => c.Pending());

            var backToAllPendingProjectsText = $"Back to all Pending {FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabelPluralized()}";

            var currentPerson = currentFirmaSession.Person;

            if (project.IsRejected())
            {
                var projectApprovalStatus = project.ProjectApprovalStatus;
                ProjectUpdateButtonText =
                    projectApprovalStatus == ProjectApprovalStatus.Draft ||
                    projectApprovalStatus == ProjectApprovalStatus.Returned
                        ? $"Edit Pending {FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabel()}"
                        : $"Review Pending {FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabel()}";
                ProjectWizardUrl = SitkaRoute <ProjectCreateController> .BuildUrlFromExpression(x => x.EditBasics(project.ProjectID));

                if (project.IsProposal())
                {
                    ProjectListUrl     = proposedProjectListUrl;
                    BackToProjectsText = backToAllProposalsText;
                }
                else if (project.IsPendingProject())
                {
                    ProjectListUrl     = pendingProjectsListUrl;
                    BackToProjectsText = backToAllPendingProjectsText;
                }

                if (userHasProjectAdminPermissions || currentPerson.CanStewardProject(project))
                {
                    projectAlerts.Add(
                        $"This {FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabel()} was rejected and can no longer be edited. It can be deleted, or preserved for archival purposes.");
                }
            }
            else if (project.IsProposal())
            {
                var projectApprovalStatus = project.ProjectApprovalStatus;
                ProjectUpdateButtonText =
                    projectApprovalStatus == ProjectApprovalStatus.Draft ||
                    projectApprovalStatus == ProjectApprovalStatus.Returned
                        ? "Edit Proposal"
                        : "Review Proposal";
                ProjectWizardUrl = SitkaRoute <ProjectCreateController> .BuildUrlFromExpression(x => x.EditBasics(project.ProjectID));

                ProjectListUrl     = proposedProjectListUrl;
                BackToProjectsText = backToAllProposalsText;
                if ((projectApprovalStatus == ProjectApprovalStatus.Draft || projectApprovalStatus == ProjectApprovalStatus.Returned) && (userHasProjectAdminPermissions || userHasStartUpdateWorkflowPermission))
                {
                    projectAlerts.Add(
                        $"This {FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabel()} is in the Proposal stage. Any edits to this {FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabel()} must be made using the Add New {FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabel()} workflow.");
                }
                else if (projectApprovalStatus == ProjectApprovalStatus.PendingApproval)
                {
                    if (userHasProjectAdminPermissions || currentPerson.IsPersonAProjectOwnerWhoCanStewardProjects() && currentPerson.CanStewardProject(project))
                    {
                        projectAlerts.Add($"This {FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabel()} has been submitted and is awaiting review.");
                    }
                    else if (userHasStartUpdateWorkflowPermission)
                    {
                        projectAlerts.Add($"This {FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabel()} has been submitted, no change can be made.");
                        CanLaunchProjectOrProposalWizard = false;
                        ShowWithdrawProjectButton        = true;
                    }
                }
            }
            else if (project.IsPendingProject())
            {
                var projectApprovalStatus = project.ProjectApprovalStatus;
                ProjectUpdateButtonText =
                    projectApprovalStatus == ProjectApprovalStatus.Draft ||
                    projectApprovalStatus == ProjectApprovalStatus.Returned
                        ? $"Edit Pending {FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabel()}"
                        : $"Review Pending {FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabel()}";
                ProjectWizardUrl = SitkaRoute <ProjectCreateController> .BuildUrlFromExpression(x => x.EditBasics(project.ProjectID));

                ProjectListUrl     = pendingProjectsListUrl;
                BackToProjectsText = backToAllPendingProjectsText;
                if ((projectApprovalStatus == ProjectApprovalStatus.Draft || projectApprovalStatus == ProjectApprovalStatus.Returned) && (userHasProjectAdminPermissions || userHasStartUpdateWorkflowPermission))
                {
                    projectAlerts.Add(
                        $"This {FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabel()} is pending. Any edits to this {FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabel()} must be made using the Add New {FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabel()} workflow.");
                }
                else if (projectApprovalStatus == ProjectApprovalStatus.PendingApproval)
                {
                    if (userHasProjectAdminPermissions || currentPerson.IsPersonAProjectOwnerWhoCanStewardProjects() && currentPerson.CanStewardProject(project))
                    {
                        projectAlerts.Add($"This {FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabel()} has been submitted and is awaiting review.");
                    }
                    else if (userHasStartUpdateWorkflowPermission)
                    {
                        projectAlerts.Add($"This {FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabel()} is pending, no change can be made.");
                        CanLaunchProjectOrProposalWizard = false;
                        ShowWithdrawProjectButton        = true;
                    }
                }
            }
            else
            {
                var latestUpdateState = project.GetLatestUpdateStateResilientToDuplicateUpdateBatches();
                ProjectUpdateButtonText =
                    latestUpdateState == ProjectUpdateState.Submitted ||
                    latestUpdateState == ProjectUpdateState.Returned
                        ? "Review Update"
                        : $"Update {FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabel()}";
                ProjectWizardUrl   = project.GetProjectUpdateUrl();
                ProjectListUrl     = FullProjectListUrl;
                BackToProjectsText = $"Back to all {FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabelPluralized()}";


                if (currentPerson.IsPersonAProjectOwnerWhoCanStewardProjects())
                {
                    if (currentPerson.CanStewardProject(project))
                    {
                        projectAlerts.Add(
                            $"You are a {FieldDefinitionEnum.ProjectSteward.ToType().GetFieldDefinitionLabel()} for this {FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabel()}. You may edit this {FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabel()} by using the <i class=\"glyphicon glyphicon-edit\"></i> icon on each panel.<br/>");
                    }
                    else
                    {
                        projectAlerts.Add(
                            $"You are a {FieldDefinitionEnum.ProjectSteward.ToType().GetFieldDefinitionLabel()}, but not for this {FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabel()}. You may only edit {FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabelPluralized()} that are associated with your {FieldDefinitionEnum.ProjectStewardshipArea.ToType().GetFieldDefinitionLabel()}.");
                    }
                }
            }

            if (ProjectModelExtensions.GetLatestNotApprovedUpdateBatch(project) != null)
            {
                if (userHasEditProjectPermissions)
                {
                    projectAlerts.Add($"This {FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabel()} has an Update in progress. Changes made through this page will be overwritten when the Update is approved.");
                }
                else
                {
                    projectAlerts.Add($"This {FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabel()} has an Update in progress.");
                }
            }

            ProjectAlerts = projectAlerts;

            ProjectBasicsViewData     = projectBasicsViewData;
            ProjectBasicsTagsViewData = projectBasicsTagsViewData;

            EditProjectCustomAttributesUrl = editProjectCustomAttributesUrl;

            ProjectLocationSummaryViewData = projectLocationSummaryViewData;
            MapFormID = mapFormID;
            EditSimpleProjectLocationUrl   = editSimpleProjectLocationUrl;
            EditDetailedProjectLocationUrl = editDetailedProjectLocationUrl;

            EditProjectBoundingBoxUrl = SitkaRoute <ProjectLocationController> .BuildUrlFromExpression(c => c.EditProjectBoundingBox(project));

            EditProjectBoundingBoxFormID = editProjectBoundingBoxFormID;

            EditProjectOrganizationsUrl = editProjectOrganizationsUrl;

            PerformanceMeasureExpectedSummaryViewData = performanceMeasureExpectedSummaryViewData;
            EditPerformanceMeasureExpectedsUrl        = editPerformanceMeasureExpectedsUrl;

            PerformanceMeasureReportedValuesGroupedViewData = performanceMeasureReportedValuesGroupedViewData;
            EditPerformanceMeasureActualsUrl = editPerformanceMeasureActualsUrl;

            ProjectBudgetSummaryViewData           = projectBudgetSummaryViewData;
            ProjectBudgetsAnnualViewData           = projectBudgetsAnnualViewData;
            ProjectBudgetsAnnualByCostTypeViewData = projectBudgetsAnnualByCostTypeViewData;
            ProjectAgreementDetailViewData         = projectAgreementDetailViewData;
            EditTechnicalAssistanceRequestsUrl     = SitkaRoute <TechnicalAssistanceRequestController> .BuildUrlFromExpression(c => c.EditTechnicalAssistanceRequestsForProject(project));

            TechnicalAssistanceRequestDetailViewData = technicalAssistanceRequestDetailViewData;
            EditExpectedFundingUrl = editExpectedFundingUrl;

            // TODO: Set to something real
            AssociateProjectAgreementUrl = SitkaRoute <ProjectAssociatedCostAuthoritiesController> .BuildUrlFromExpression(c => c.EditProjectAssociatedCostAuthorities(project));

            ProjectExpendituresDetailViewData           = projectExpendituresDetailViewData;
            ProjectExpendituresByCostTypeDetailViewData = projectExpendituresByCostTypeDetailViewData;
            EditReportedExpendituresUrl = editReportedExpendituresUrl;
            GeospatialAreaTypes         = geospatialAreaTypes;
            DisplayProjectCustomAttributeTypesViewData = displayProjectCustomAttributeTypesViewData;
            EditExternalLinksUrl = editExternalLinksUrl;
            ImageGalleryViewData = imageGalleryViewData;

            ProjectNotesViewData  = projectNotesViewData;
            InternalNotesViewData = internalNotesViewData;

            EntityExternalLinksViewData = entityExternalLinksViewData;

            ProjectUpdateBatchGridSpec = new ProjectUpdateBatchGridSpec
            {
                ObjectNameSingular  = $"{FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabel()} Update",
                ObjectNamePlural    = $"{FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabel()} Updates",
                SaveFiltersInCookie = true
            };
            ProjectUpdateBatchGridName    = "projectUpdateBatch";
            ProjectUpdateBatchGridDataUrl =
                SitkaRoute <ProjectController> .BuildUrlFromExpression(x =>
                                                                       x.ProjectUpdateBatchGridJsonData(project.ProjectID));

            ReportFinancialsByCostType = reportFinancialsByCostType;

            AuditLogsGridSpec    = auditLogsGridSpec;
            AuditLogsGridName    = "projectAuditLogsGrid";
            AuditLogsGridDataUrl = auditLogsGridDataUrl;

            ProjectNotificationGridSpec        = projectNotificationGridSpec;
            ProjectNotificationGridName        = projectNotificationGridName;
            ProjectNotificationGridDataUrl     = projectNotificationGridDataUrl;
            ProjectOrganizationsDetailViewData = projectOrganizationsDetailViewData;

            // Potential Partner panel
            ProjectPotentialPartnerDetailViewData = projectPotentialPartnerDetailViewData;

            ProjectContactsDetailViewData = projectContactsDetailViewData;
            EditProjectContactsUrl        = editProjectContactsUrl;

            EditProjectGeospatialAreaFormID = ProjectGeospatialAreaController.GetEditProjectGeospatialAreasFormID();

            ProjectStewardCannotEditUrl =
                SitkaRoute <ProjectController> .BuildUrlFromExpression(c => c.ProjectStewardCannotEdit());

            ProjectStewardCannotEditPendingApprovalUrl =
                SitkaRoute <ProjectController> .BuildUrlFromExpression(c =>
                                                                       c.ProjectStewardCannotEditPendingApproval(project));

            ClassificationSystems = classificationSystems;

            ProjectAttachmentsDetailViewData = new ProjectAttachmentsDetailViewData(
                EntityAttachment.CreateFromProjectAttachment(project.ProjectAttachments),
                SitkaRoute <ProjectAttachmentController> .BuildUrlFromExpression(x => x.New(project)),
                project.ProjectName,
                new ProjectEditAsAdminFeature().HasPermission(currentFirmaSession, project).HasPermission,
                project.GetAllAttachmentTypes().ToList(),
                currentFirmaSession);

            ProjectTimelineDisplayViewData = projectTimelineDisplayViewData;

            ProjectEvaluationsUserHasAccessTo = projectEvaluationsUserHasAccessTo;

            ShowFactSheetButton = OfferProjectFactSheetLinkFeature.OfferProjectFactSheetLink(currentFirmaSession, project);

            ActionItemsDisplayViewData = actionItemsDisplayViewData;
            UserCanViewActionItems     = userCanViewActionItems;

            /*
             * //Obligations:
             * ObligationItemInvoiceGridName = "obligationItemInvoices";
             * ContractualInvoiceGridSpec = new ContractualInvoiceGridSpec(currentFirmaSession);
             * ObligationItemInvoiceGridDataUrl = SitkaRoute<ProjectController>.BuildUrlFromExpression(oc => oc.ObligationItemInvoiceGridJsonData(project));
             */
            //public ContractualInvoiceGridSpec ContractualInvoiceGridSpec { get; }
            //public string ContractualInvoiceGridName { get; }
            //public string ContractualInvoiceGridDataUrl { get; }

            ContractualInvoiceGridName    = "obligationItemBudgets";
            ContractualInvoiceGridSpec    = new ContractualInvoiceGridSpec(currentFirmaSession);
            ContractualInvoiceGridDataUrl = SitkaRoute <ProjectController> .BuildUrlFromExpression(oc => oc.ContractualInvoiceGridJsonData(project));

            // Project Running Balance (New Version)
            ProjectRunningBalanceObligationsAndExpendituresViewData = projectRunningBalanceObligationsAndExpendituresViewData;
            ProjectBalanceBurnUpViewData = projectBalanceBurnUpViewData;
        }