public async Task <OutcomeApplicationViewModel> GetOverviewViewModel(GetOutcomeOverviewRequest request) { var application = await _applicationApiClient.GetApplication(request.ApplicationId); var contact = await _applicationApiClient.GetContactForApplication(request.ApplicationId); var sequences = await _clarificationApiClient.GetClarificationSequences(request.ApplicationId); if (application is null || contact is null || sequences is null) { return(null); } var viewmodel = new OutcomeApplicationViewModel(application, contact, sequences); var savedOutcomes = await _clarificationApiClient.GetAllClarificationPageReviewOutcomes(request.ApplicationId, request.UserId); if (!(savedOutcomes is null) && savedOutcomes.Any()) { foreach (var sequence in viewmodel.Sequences) { foreach (var section in sequence.Sections) { if (string.IsNullOrEmpty(section.Status)) { section.Status = OverviewStatusService.GetOutcomeSectionStatus(savedOutcomes, sequence.SequenceNumber, section.SectionNumber); } } } } return(viewmodel); }
public async Task <ClarificationOutcomeViewModel> GetClarificationOutcomeViewModel(GetClarificationOutcomeRequest request) { var application = await _applicationApiClient.GetApplication(request.ApplicationId); var contact = await _applicationApiClient.GetContactForApplication(request.ApplicationId); var outcomes = await _clarificationApiClient.GetAllClarificationPageReviewOutcomes(request.ApplicationId, request.UserId); if (application is null || contact is null || outcomes is null) { return(null); } var unsetOutcomesCount = outcomes.Count(x => x.Status != ClarificationPageReviewStatus.Pass && x.Status != ClarificationPageReviewStatus.Fail); if (unsetOutcomesCount > 0) { return(null); } return(new ClarificationOutcomeViewModel(application, outcomes)); }
public async Task <ModeratorOutcomeViewModel> GetInModerationOutcomeViewModel(GetModeratorOutcomeRequest request) { var application = await _applicationApiClient.GetApplication(request.ApplicationId); var contact = await _applicationApiClient.GetContactForApplication(request.ApplicationId); // TODO: Is this needed? var savedOutcomes = await _moderationApiClient.GetAllModeratorPageReviewOutcomes(request.ApplicationId, request.UserId); if (application is null || contact is null || savedOutcomes is null) { return(null); } // Not sure if this check is required. You're going to have Clarification ones in here soon var unsetOutcomesCount = savedOutcomes.Count(x => x.Status != ModeratorPageReviewStatus.Pass && x.Status != ModeratorPageReviewStatus.Fail); if (unsetOutcomesCount > 0) { return(null); } return(new ModeratorOutcomeViewModel(application, savedOutcomes)); }
public async Task <ModeratorReviewAnswersViewModel> GetReviewAnswersViewModel(GetReviewAnswersRequest request) { var application = await _applicationApiClient.GetApplication(request.ApplicationId); var contact = await _applicationApiClient.GetContactForApplication(request.ApplicationId); var moderatorPage = await _moderationApiClient.GetModeratorPage(request.ApplicationId, request.SequenceNumber, request.SectionNumber, request.PageId); if (application is null || contact is null || moderatorPage is null) { return(null); } var viewModel = new ModeratorReviewAnswersViewModel { ApplicationId = application.ApplicationId, Ukprn = application.ApplyData.ApplyDetails.UKPRN, ApplyLegalName = application.ApplyData.ApplyDetails.OrganisationName, ApplicationRoute = application.ApplyData.ApplyDetails.ProviderRouteName, SubmittedDate = application.ApplyData.ApplyDetails.ApplicationSubmittedOn, ApplicantEmailAddress = contact.Email, SequenceNumber = moderatorPage.SequenceNumber, SectionNumber = moderatorPage.SectionNumber, PageId = moderatorPage.PageId, NextPageId = moderatorPage.NextPageId, Caption = moderatorPage.Caption, Heading = moderatorPage.Heading, GuidanceInformation = moderatorPage.GuidanceInformation != null ? new List <string>(moderatorPage.GuidanceInformation) : new List <string>(), Questions = moderatorPage.Questions != null ? new List <Question>(moderatorPage.Questions) : new List <Question>(), Answers = moderatorPage.Answers != null ? new List <Answer>(moderatorPage.Answers) : new List <Answer>(), TabularData = GetTabularDataFromQuestionsAndAnswers(moderatorPage.Questions, moderatorPage.Answers), SupplementaryInformation = await _supplementaryInformationService.GetSupplementaryInformation(application.ApplicationId, moderatorPage.PageId), BlindAssessmentOutcome = await _moderationApiClient.GetBlindAssessmentOutcome(application.ApplicationId, moderatorPage.SequenceNumber, moderatorPage.SectionNumber, moderatorPage.PageId) }; await SetPageReviewOutcome(request, viewModel); return(viewModel); }
public async Task <IActionResult> ViewApplication(Guid applicationId) { var application = await _applyApiClient.GetApplication(applicationId); if (application is null) { return(RedirectToAction(nameof(OpenApplications))); } var vm = await CreateRoatpFinancialApplicationViewModel(application); var contact = await _applyApiClient.GetContactForApplication(application.ApplicationId); vm.ApplicantEmailAddress = contact?.Email; if (vm.ApplicationStatus == ApplicationStatus.Removed || vm.ApplicationStatus == ApplicationStatus.Withdrawn) { return(View("~/Views/Roatp/Apply/Financial/Application_Closed.cshtml", vm)); } else { var financialReviewDetails = await _applyApiClient.GetFinancialReviewDetails(applicationId); switch (financialReviewDetails?.Status) { case FinancialReviewStatus.New: case FinancialReviewStatus.InProgress: case null: await _applyApiClient.StartFinancialReview(application.ApplicationId, HttpContext.User.UserDisplayName()); return(View("~/Views/Roatp/Apply/Financial/Application.cshtml", vm)); case FinancialReviewStatus.ClarificationSent: var clarificationVm = ConvertFinancialApplicationToFinancialClarificationViewModel(vm, vm.ClarificationComments); return(View("~/Views/Roatp/Apply/Financial/Application_Clarification.cshtml", clarificationVm)); case FinancialReviewStatus.Pass: case FinancialReviewStatus.Fail: default: return(View("~/Views/Roatp/Apply/Financial/Application_ReadOnly.cshtml", vm)); } } }
public async Task <ModeratorApplicationViewModel> GetOverviewViewModel(GetModeratorOverviewRequest request) { var application = await _applicationApiClient.GetApplication(request.ApplicationId); var contact = await _applicationApiClient.GetContactForApplication(request.ApplicationId); var sequences = await _moderationApiClient.GetModeratorSequences(request.ApplicationId); if (application is null || contact is null || sequences is null) { return(null); } var viewmodel = new ModeratorApplicationViewModel(application, contact, sequences, request.UserId); var savedOutcomes = await _moderationApiClient.GetAllModeratorPageReviewOutcomes(request.ApplicationId, request.UserId); if (savedOutcomes is null || !savedOutcomes.Any()) { viewmodel.IsReadyForModeratorConfirmation = false; }