public ObligationRequestDetailViewData(FirmaSession currentFirmaSession,
                                               ProjectFirmaModels.Models.ObligationRequest obligationRequest,
                                               bool userCanInteractWithSubmissionNotes,
                                               EntityNotesViewData obligationRequestNotesViewData) : base(currentFirmaSession)
        {
            PageTitle         = $"Obligation Request: {obligationRequest.GetObligationRequestNumber()}";
            EntityName        = "Obligation Request Detail";
            ObligationRequest = obligationRequest;
            IndexUrl          = SitkaRoute <ObligationRequestController> .BuildUrlFromExpression(c => c.ObligationRequestIndex());

            EditObligationRequestBasicsUrl = SitkaRoute <ObligationRequestController> .BuildUrlFromExpression(c => c.Edit(obligationRequest));

            EditRequisitionInformationUrl = SitkaRoute <ObligationRequestController> .BuildUrlFromExpression(c => c.EditRequisitionInformation(obligationRequest));

            UserCanEditObligationRequest       = new ObligationRequestCreateFeature().HasPermissionByFirmaSession(currentFirmaSession);
            UserCanEditRequisitionInformation  = new ObligationRequestCreateFeature().HasPermissionByFirmaSession(currentFirmaSession);
            UserCanInteractWithSubmissionNotes = userCanInteractWithSubmissionNotes;
            ObligationRequestNotesViewData     = obligationRequestNotesViewData;

            // Potential Matches
            PotentialMatches = obligationRequest.CostAuthorityObligationRequests
                               .SelectMany(x => x.CostAuthorityObligationRequestPotentialObligationNumberMatches).ToList();
            PotentialMatchesGridName    = "potentialMatchesGrid";
            PotentialMatchesGridSpec    = new CostAuthorityObligationRequestPotentialObligationNumberMatchGridSpec(currentFirmaSession);
            PotentialMatchesGridDataUrl = SitkaRoute <ObligationRequestController> .BuildUrlFromExpression(cac => cac.PotentialObligationRequestMatchesJsonData(obligationRequest));

            ShowPotentialMatches = obligationRequest.ObligationNumber == null &&
                                   obligationRequest.Agreement == null &&
                                   PotentialMatches.Any();

            var costAuthorityIDList = obligationRequest.Agreement != null
                ? obligationRequest.Agreement.AgreementCostAuthorities
                                      .Select(x => x.CostAuthorityID).ToList()
                : new List <int>();

            // Match Status
            MatchStatus = GetMatchStatus(obligationRequest, PotentialMatches);

            // Unmatch Dialog
            string unmatchUrl = SitkaRoute <ObligationRequestController> .BuildUrlFromExpression(x => x.ConfirmObligationRequestUnmatch(obligationRequest));

            var extraCssClassesForAButton = new List <string>()
            {
                "btn", "btn-sm", "btn-firma"
            };

            UnmatchObligationRequestButtonHtml =
                ModalDialogFormHelper.MakeConfirmDialogLink("Unmatch", unmatchUrl, "Unmatch Obligation Request", "Unmatch", extraCssClassesForAButton, true);

            CostAuthorityObligationRequestGridName = "costAuthorityObligationRequestGrid";
            CostAuthorityObligationRequestGridSpec = new CostAuthorityObligationRequestGridSpec(CurrentFirmaSession, obligationRequest.ObligationRequestStatus == ObligationRequestStatus.Draft, costAuthorityIDList)
            {
                ObjectNameSingular  = $"{FieldDefinitionEnum.CostAuthorityWorkBreakdownStructure.ToType().GetFieldDefinitionLabel()} associated with {FieldDefinitionEnum.ObligationRequest.ToType().GetFieldDefinitionLabel()} {obligationRequest.ObligationRequestID.ToString("D4")}",
                ObjectNamePlural    = $"{FieldDefinitionEnum.CostAuthorityWorkBreakdownStructure.ToType().GetFieldDefinitionLabelPluralized()} associated with {FieldDefinitionEnum.ObligationRequest.ToType().GetFieldDefinitionLabel()} {obligationRequest.ObligationRequestID.ToString("D4")}",
                SaveFiltersInCookie = true
            };
            CostAuthorityObligationRequestGridDataUrl = SitkaRoute <ObligationRequestController> .BuildUrlFromExpression(cac => cac.CostAuthorityObligationRequestsJsonData(obligationRequest));
        }
示例#2
0
        public CostAuthorityObligationRequestPotentialObligationNumberMatchGridSpec(FirmaSession currentFirmaSession)
        {
            Add(string.Empty, x => ModalDialogFormHelper.MakeInfoIconLink(x.GetPotentialMatchDetailUrl(), "View Details of Potential Match", true), 30, DhtmlxGridColumnFilterType.None);

            Add(FieldDefinitionEnum.Obligation.ToType().ToGridHeaderString(), pm => UrlTemplate.MakeHrefString(pm.ObligationNumber.GetDetailUrl(), pm.ObligationNumber.ObligationNumberKey), 100, DhtmlxGridColumnFilterType.Text);
            Add("Total of All Obligation Item Budgets", pm => pm.ObligationNumber.GetWbsElementObligationItemBudgets().Sum(y => y.UnexpendedBalance).ToStringCurrency(), 100, DhtmlxGridColumnFilterType.Numeric);
            Add("Obligation Item Budget Count", pm => pm.ObligationNumber.GetWbsElementObligationItemBudgets().Count.ToString(), 60, DhtmlxGridColumnFilterType.Numeric);
            Add(FieldDefinitionEnum.CostAuthorityWorkBreakdownStructure.ToType().ToGridHeaderString(), a => a.CostAuthorityObligationRequest.CostAuthority.GetDetailLinkUsingCostAuthorityWorkBreakdownStructure(), 200, DhtmlxGridColumnFilterType.Text);
            Add("Confirm Match", x => ModalDialogFormHelper.MakeConfirmDialogLink("Confirm this match", x.GetPotentialMatchConfirmUrl(), "Confirm Match", null, true), 120, DhtmlxGridColumnFilterType.None);
        }