public async Task <IActionResult> Sequence(Guid Id, int sequenceNo) { var sequence = await _qnaApiClient.GetSequenceBySequenceNo(Id, sequenceNo); var sections = await _qnaApiClient.GetSections(Id, sequence.Id); var applySection = new List <ApplySection>(); foreach (var section in sections) { applySection.Add(new ApplySection { SectionId = section.Id, SectionNo = section.SectionNo, Status = section.Status }); } var sequenceVm = new SequenceViewModel(sequence, Id, OrganisationName, sections, applySection, null); return(View(sequenceVm)); }
private async Task <List <Section> > GetFinancialSections(RoatpApply applicationFromAssessor) { const string CompanyFhaSectionTitle = "Organisation's financial health"; const string ParentCompanyFhaSectionTitle = "UK ultimate parent company's financial health"; var financialSections = new List <Section>(); var applicationId = applicationFromAssessor.ApplicationId; var applicationSequences = applicationFromAssessor.ApplyData?.Sequences; var roatpSequences = await _applyApiClient.GetRoatpSequences(); var financialSequences = roatpSequences.Where(x => x.Roles.Contains(Roles.ProviderRiskAssuranceTeam)); foreach (var sequence in financialSequences) { var qnaSequence = await _qnaApiClient.GetSequenceBySequenceNo(applicationId, sequence.Id); var qnaSections = await _qnaApiClient.GetSections(applicationId, qnaSequence.Id); foreach (var section in qnaSections) { var roatpSequence = roatpSequences.FirstOrDefault(x => x.Id == sequence.Id); if (!roatpSequence.ExcludeSections.Contains(section.SectionNo.ToString()) && IsRequiredSection(applicationSequences, section)) { // Ensure at least one active page is answered if (section.QnAData.Pages.Any(p => p.Active && p.Complete)) { // APR-1477 - adjust title for Assessor if (section.SequenceNo == RoatpQnaConstants.RoatpSequences.FinancialEvidence && section.SectionNo == RoatpQnaConstants.RoatpSections.FinancialEvidence.YourOrganisationsFinancialEvidence) { section.LinkTitle = CompanyFhaSectionTitle; section.Title = CompanyFhaSectionTitle; } else if (section.SequenceNo == RoatpQnaConstants.RoatpSequences.FinancialEvidence && section.SectionNo == RoatpQnaConstants.RoatpSections.FinancialEvidence.YourUkUltimateParentCompanysFinancialEvidence) { section.LinkTitle = ParentCompanyFhaSectionTitle; section.Title = ParentCompanyFhaSectionTitle; } // APR-1606 - Display in PageId order section.QnAData.Pages = section.QnAData.Pages.OrderBy(p => p.PageId).ToList(); financialSections.Add(section); } } } } return(financialSections); }
public async Task <IActionResult> Grade(FinancialApplicationViewModel vm) { var application = await _applyApiClient.GetApplication(vm.Id); if (application is null) { return(RedirectToAction(nameof(OpenApplications))); } if (ModelState.IsValid) { var financialSequence = await _qnaApiClient.GetSequenceBySequenceNo(application.ApplicationId, ApplyConst.FINANCIAL_SEQUENCE_NO); var financialSection = await _qnaApiClient.GetSectionBySectionNo(application.ApplicationId, ApplyConst.FINANCIAL_SEQUENCE_NO, ApplyConst.FINANCIAL_DETAILS_SECTION_NO); var grade = new FinancialGrade { ApplicationReference = application.ApplyData.Apply.ReferenceNumber, GradedBy = _contextAccessor.HttpContext.User.UserDisplayName(), GradedDateTime = DateTime.UtcNow, SelectedGrade = vm.Grade.SelectedGrade, FinancialDueDate = GetFinancialDueDate(vm), FinancialEvidences = GetFinancialEvidence(financialSequence, financialSection), InadequateMoreInformation = vm.Grade.InadequateMoreInformation }; await _applyApiClient.ReturnFinancialReview(vm.Id, grade); return(RedirectToAction(nameof(Evaluated), new { vm.Id })); } else { var newvm = await CreateFinancialApplicationViewModel(application, vm.Grade); return(View("~/Views/Apply/Financial/Application.cshtml", newvm)); } }