From 3ab9ec40de566b0552bf6710c032ab9b9be96ff4 Mon Sep 17 00:00:00 2001 From: Fahad Ali Date: Mon, 6 Jan 2025 14:51:59 +0000 Subject: [PATCH 01/20] Fields added for pom file and blob name --- .../Models/Submissions/Submission.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/EPR.RegulatorService.Frontend.Core/Models/Submissions/Submission.cs b/src/EPR.RegulatorService.Frontend.Core/Models/Submissions/Submission.cs index ad7631d0..dd387643 100644 --- a/src/EPR.RegulatorService.Frontend.Core/Models/Submissions/Submission.cs +++ b/src/EPR.RegulatorService.Frontend.Core/Models/Submissions/Submission.cs @@ -7,4 +7,6 @@ public class Submission : AbstractSubmission public string? ProducerType { get; set; } public Guid? ComplianceSchemeId { get; set; } public string? ActualSubmissionPeriod { get; set; } + public string PomFileName { get; set; } + public string PomBlobName { get; set; } } \ No newline at end of file From 1dda76a7f717d9360860b3d088a13ad8f2d5bff4 Mon Sep 17 00:00:00 2001 From: Idris Abu Date: Tue, 7 Jan 2025 13:21:56 +0000 Subject: [PATCH 02/20] UI and Controller changes --- .../Constants/PagePath.cs | 4 + .../Submissions/SubmissionsController.cs | 96 +++++++++++++++- .../Partials/_SubmissionDetails.cy.resx | 3 + .../Partials/_SubmissionDetails.en.resx | 5 +- .../PackagingDataFileDownload.cy.resx | 104 ++++++++++++++++++ .../PackagingDataFileDownload.en.resx | 104 ++++++++++++++++++ .../PackagingDataFileDownloadFailed.cy.resx | 104 ++++++++++++++++++ .../PackagingDataFileDownloadFailed.en.resx | 104 ++++++++++++++++++ .../SubmissionDetailsFileDownloadViewModel.cs | 20 ++++ .../Submissions/SubmissionDetailsViewModel.cs | 2 + .../Shared/Partials/_SubmissionDetails.cshtml | 22 ++++ .../PackagingDataFileDownload.cshtml | 27 +++++ .../PackagingDataFileDownloadFailed.cshtml | 46 ++++++++ 13 files changed, 639 insertions(+), 2 deletions(-) create mode 100644 src/EPR.RegulatorService.Frontend.Web/Resources/Views/Submissions/PackagingDataFileDownload.cy.resx create mode 100644 src/EPR.RegulatorService.Frontend.Web/Resources/Views/Submissions/PackagingDataFileDownload.en.resx create mode 100644 src/EPR.RegulatorService.Frontend.Web/Resources/Views/Submissions/PackagingDataFileDownloadFailed.cy.resx create mode 100644 src/EPR.RegulatorService.Frontend.Web/Resources/Views/Submissions/PackagingDataFileDownloadFailed.en.resx create mode 100644 src/EPR.RegulatorService.Frontend.Web/ViewModels/Submissions/SubmissionDetailsFileDownloadViewModel.cs create mode 100644 src/EPR.RegulatorService.Frontend.Web/Views/Submissions/PackagingDataFileDownload.cshtml create mode 100644 src/EPR.RegulatorService.Frontend.Web/Views/Submissions/PackagingDataFileDownloadFailed.cshtml diff --git a/src/EPR.RegulatorService.Frontend.Web/Constants/PagePath.cs b/src/EPR.RegulatorService.Frontend.Web/Constants/PagePath.cs index 6fd79bc0..03a48f15 100644 --- a/src/EPR.RegulatorService.Frontend.Web/Constants/PagePath.cs +++ b/src/EPR.RegulatorService.Frontend.Web/Constants/PagePath.cs @@ -33,6 +33,7 @@ public static class PagePath public const string EmailNominatedApprovedPerson = "email-nominated-approved-person"; public const string AccountPermissionsChanged = "account-permissions-changed"; public const string FileDownload = "file-download"; + public const string SubmissionsFileDownload = "submissions-file-download"; public const string OrganisationDetailsFileDownload = "organisation-details-file-download"; public const string OrganisationDetailsFileDownloadFailed = "organisation-details-file-download-failed"; public const string OrganisationDetailsFileDownloadSecurityWarning = "organisation-details-file-download-security-warning"; @@ -51,6 +52,9 @@ public static class PagePath public const string RegistrationSubmissionFileDownloadFailed = "registration-submission-download-failed"; public const string RegistrationSubmissionFileDownloadSecurityWarning = "registration-submission-download-security-warning"; public const string RegistrationSubmissionsFileDownload = "submission-file-download"; + public const string PackagingDataFileDownload = "packaging-data-file-download"; + public const string PackagingDataFileDownloadFailed = "packaging-data-file-download-failed"; + public const string PackagingDataFileDownloadSecurityWarning = "packaging-data-file-download-security-warning"; // Non journey paths public const string Accessibility = "accessibility"; diff --git a/src/EPR.RegulatorService.Frontend.Web/Controllers/Submissions/SubmissionsController.cs b/src/EPR.RegulatorService.Frontend.Web/Controllers/Submissions/SubmissionsController.cs index 7654de0b..51ea4f45 100644 --- a/src/EPR.RegulatorService.Frontend.Web/Controllers/Submissions/SubmissionsController.cs +++ b/src/EPR.RegulatorService.Frontend.Web/Controllers/Submissions/SubmissionsController.cs @@ -17,6 +17,10 @@ using System.Text.Json; using EPR.RegulatorService.Frontend.Web.Helpers; using RegulatorDecision = EPR.RegulatorService.Frontend.Core.Enums.RegulatorDecision; +using EPR.RegulatorService.Frontend.Core.Enums; +using EPR.RegulatorService.Frontend.Core.Models.FileDownload; +using EPR.RegulatorService.Frontend.Core.Models.Registrations; +using EPR.RegulatorService.Frontend.Web.ViewModels.Registrations; namespace EPR.RegulatorService.Frontend.Web.Controllers.Submissions { @@ -194,7 +198,9 @@ public async Task SubmissionDetails() RejectionReason = submission.Comments, ResubmissionRequired = submission.IsResubmissionRequired, PowerBiLogin = _externalUrlsOptions.PowerBiLogin, - PreviousRejectionComments = submission.PreviousRejectionComments + PreviousRejectionComments = submission.PreviousRejectionComments, + SubmissionFileName = submission.PomFileName, + SubmissionBlobName = submission.PomBlobName, }; await SaveSessionAndJourney(session, PagePath.Submissions, PagePath.SubmissionDetails); @@ -362,6 +368,75 @@ public async Task PrePageNotFound() PagePath.PageNotFoundPath, new {statusCode = 404, backLink = PagePath.Submissions}); } + + [HttpGet] + [Route(PagePath.SubmissionsFileDownload)] + public async Task SubmissionsFileDownload(string packagingDataSubmissionBlobName) + { + TempData["DownloadCompleted"] = false; + + return RedirectToAction(nameof(PackagingDataFileDownload), "Submissions"); + } + + + [HttpGet] + [Route(PagePath.PackagingDataFileDownload)] + public IActionResult PackagingDataFileDownload() + { + return View("PackagingDataFileDownload"); + } + + + [HttpGet] + public async Task FileDownloadInProgress() + { + var session = await _sessionManager.GetSessionAsync(HttpContext.Session); + var submission = session.RegulatorSubmissionSession.OrganisationSubmission; + var fileDownloadModel = CreateFileDownloadRequest(submission); + + if (fileDownloadModel == null) + { + return RedirectToAction(nameof(PackagingDataFileDownloadFailed)); + } + + var response = await _facadeService.GetFileDownload(fileDownloadModel); + + if (response.StatusCode == System.Net.HttpStatusCode.Forbidden) + { + return RedirectToAction(nameof(PackagingDataFileDownloadSecurityWarning)); + } + else if (response.IsSuccessStatusCode) + { + var fileStream = await response.Content.ReadAsStreamAsync(); + var contentDisposition = response.Content.Headers.ContentDisposition; + var fileName = contentDisposition?.FileNameStar ?? contentDisposition?.FileName ?? submission.PomFileName; + TempData["DownloadCompleted"] = true; + + return File(fileStream, "application/octet-stream", fileName); + } + else + { + return RedirectToAction(nameof(PackagingDataFileDownloadFailed)); + } + } + + + [HttpGet] + [Route(PagePath.PackagingDataFileDownloadFailed)] + public IActionResult PackagingDataFileDownloadFailed() + { + var model = new SubmissionDetailsFileDownloadViewModel(true, false); + return View("PackagingDataFileDownloadFailed", model); + } + + [HttpGet] + [Route(PagePath.PackagingDataFileDownloadSecurityWarning)] + public IActionResult PackagingDataFileDownloadSecurityWarning() + { + var model = new SubmissionDetailsFileDownloadViewModel(true, true); + return View("PackagingDataFileDownloadFailed", model); + } + public string FormatTimeAndDateForSubmission(DateTime timeAndDateOfSubmission) { string time = timeAndDateOfSubmission.ToString("h:mm", CultureInfo.CurrentCulture); @@ -370,6 +445,25 @@ public string FormatTimeAndDateForSubmission(DateTime timeAndDateOfSubmission) return $"{time}{ampm} on {date}"; } + private static FileDownloadRequest CreateFileDownloadRequest(Submission submission) + { + var fileDownloadModel = new FileDownloadRequest + { + SubmissionId = submission.SubmissionId, + SubmissionType = SubmissionType.Registration, + FileId = submission.FileId, + BlobName = submission.PomBlobName, + FileName = submission.PomFileName, + }; + + if (fileDownloadModel.FileId == null || fileDownloadModel.BlobName == null || fileDownloadModel.FileName == null) + { + return null; + } + + return fileDownloadModel; + } + private void SetBackLink(JourneySession session, string currentPagePath) => ViewBag.BackLinkToDisplay = session.RegulatorSubmissionSession.Journey.PreviousOrDefault(currentPagePath) ?? string.Empty; diff --git a/src/EPR.RegulatorService.Frontend.Web/Resources/Views/Shared/Partials/_SubmissionDetails.cy.resx b/src/EPR.RegulatorService.Frontend.Web/Resources/Views/Shared/Partials/_SubmissionDetails.cy.resx index 58d009f7..11fe244e 100644 --- a/src/EPR.RegulatorService.Frontend.Web/Resources/Views/Shared/Partials/_SubmissionDetails.cy.resx +++ b/src/EPR.RegulatorService.Frontend.Web/Resources/Views/Shared/Partials/_SubmissionDetails.cy.resx @@ -45,4 +45,7 @@ Chaiff {0} ddim ailgyflwyno nes bod y cyflwyniad yma wedi’i weithredu. + + W Packaging data + diff --git a/src/EPR.RegulatorService.Frontend.Web/Resources/Views/Shared/Partials/_SubmissionDetails.en.resx b/src/EPR.RegulatorService.Frontend.Web/Resources/Views/Shared/Partials/_SubmissionDetails.en.resx index 28e81a62..1b940fc7 100644 --- a/src/EPR.RegulatorService.Frontend.Web/Resources/Views/Shared/Partials/_SubmissionDetails.en.resx +++ b/src/EPR.RegulatorService.Frontend.Web/Resources/Views/Shared/Partials/_SubmissionDetails.en.resx @@ -147,4 +147,7 @@ submission period - \ No newline at end of file + + Packaging data + + diff --git a/src/EPR.RegulatorService.Frontend.Web/Resources/Views/Submissions/PackagingDataFileDownload.cy.resx b/src/EPR.RegulatorService.Frontend.Web/Resources/Views/Submissions/PackagingDataFileDownload.cy.resx new file mode 100644 index 00000000..09556a54 --- /dev/null +++ b/src/EPR.RegulatorService.Frontend.Web/Resources/Views/Submissions/PackagingDataFileDownload.cy.resx @@ -0,0 +1,104 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + W Packaging data file download + + diff --git a/src/EPR.RegulatorService.Frontend.Web/Resources/Views/Submissions/PackagingDataFileDownload.en.resx b/src/EPR.RegulatorService.Frontend.Web/Resources/Views/Submissions/PackagingDataFileDownload.en.resx new file mode 100644 index 00000000..3b681b8e --- /dev/null +++ b/src/EPR.RegulatorService.Frontend.Web/Resources/Views/Submissions/PackagingDataFileDownload.en.resx @@ -0,0 +1,104 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Packaging data file download + + diff --git a/src/EPR.RegulatorService.Frontend.Web/Resources/Views/Submissions/PackagingDataFileDownloadFailed.cy.resx b/src/EPR.RegulatorService.Frontend.Web/Resources/Views/Submissions/PackagingDataFileDownloadFailed.cy.resx new file mode 100644 index 00000000..01d51b17 --- /dev/null +++ b/src/EPR.RegulatorService.Frontend.Web/Resources/Views/Submissions/PackagingDataFileDownloadFailed.cy.resx @@ -0,0 +1,104 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Packaging Data Submission file download failed + + diff --git a/src/EPR.RegulatorService.Frontend.Web/Resources/Views/Submissions/PackagingDataFileDownloadFailed.en.resx b/src/EPR.RegulatorService.Frontend.Web/Resources/Views/Submissions/PackagingDataFileDownloadFailed.en.resx new file mode 100644 index 00000000..ee133106 --- /dev/null +++ b/src/EPR.RegulatorService.Frontend.Web/Resources/Views/Submissions/PackagingDataFileDownloadFailed.en.resx @@ -0,0 +1,104 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + W Packaging Data Submission file download failed + + diff --git a/src/EPR.RegulatorService.Frontend.Web/ViewModels/Submissions/SubmissionDetailsFileDownloadViewModel.cs b/src/EPR.RegulatorService.Frontend.Web/ViewModels/Submissions/SubmissionDetailsFileDownloadViewModel.cs new file mode 100644 index 00000000..70a20c85 --- /dev/null +++ b/src/EPR.RegulatorService.Frontend.Web/ViewModels/Submissions/SubmissionDetailsFileDownloadViewModel.cs @@ -0,0 +1,20 @@ +namespace EPR.RegulatorService.Frontend.Web.ViewModels.Submissions; + +using System.Diagnostics.CodeAnalysis; + +[ExcludeFromCodeCoverage] +public class SubmissionDetailsFileDownloadViewModel +{ + public bool DownloadFailed { get; set; } + public bool HasIssue { get; set; } + public Guid? SubmissionId { get; set; } + + public SubmissionDetailsFileDownloadViewModel() { } + + public SubmissionDetailsFileDownloadViewModel(bool downloadFailed, bool hasIssue, Guid? submissionId = null) + { + DownloadFailed = downloadFailed; + HasIssue = hasIssue; + SubmissionId = submissionId; + } +} diff --git a/src/EPR.RegulatorService.Frontend.Web/ViewModels/Submissions/SubmissionDetailsViewModel.cs b/src/EPR.RegulatorService.Frontend.Web/ViewModels/Submissions/SubmissionDetailsViewModel.cs index 9fd582d9..2fcd60ba 100644 --- a/src/EPR.RegulatorService.Frontend.Web/ViewModels/Submissions/SubmissionDetailsViewModel.cs +++ b/src/EPR.RegulatorService.Frontend.Web/ViewModels/Submissions/SubmissionDetailsViewModel.cs @@ -20,4 +20,6 @@ public class SubmissionDetailsViewModel public string RejectionReason { get; set; } public bool ResubmissionRequired { get; set; } public string PreviousRejectionComments { get; set; } + public string SubmissionFileName { get; set; } + public string SubmissionBlobName { get; set; } } \ No newline at end of file diff --git a/src/EPR.RegulatorService.Frontend.Web/Views/Shared/Partials/_SubmissionDetails.cshtml b/src/EPR.RegulatorService.Frontend.Web/Views/Shared/Partials/_SubmissionDetails.cshtml index 0120a21a..905f74f6 100644 --- a/src/EPR.RegulatorService.Frontend.Web/Views/Shared/Partials/_SubmissionDetails.cshtml +++ b/src/EPR.RegulatorService.Frontend.Web/Views/Shared/Partials/_SubmissionDetails.cshtml @@ -85,6 +85,28 @@ + @if (!string.IsNullOrEmpty(Model.SubmissionFileName)) + { +
+
+ @Localizer["SummaryList.PackagingData"] +
+
+ @Model.SubmissionFileName +
+ +
+ } + @if (!string.IsNullOrEmpty(Model.RejectionReason) && Model.Status != SubmissionStatus.Accepted) {
diff --git a/src/EPR.RegulatorService.Frontend.Web/Views/Submissions/PackagingDataFileDownload.cshtml b/src/EPR.RegulatorService.Frontend.Web/Views/Submissions/PackagingDataFileDownload.cshtml new file mode 100644 index 00000000..9d047d51 --- /dev/null +++ b/src/EPR.RegulatorService.Frontend.Web/Views/Submissions/PackagingDataFileDownload.cshtml @@ -0,0 +1,27 @@ +@{ + ViewData["Title"] = Localizer["PackagingDataFileDownload.Title"]; + var downloadCompleted = TempData["DownloadCompleted"] != null && (bool)TempData["DownloadCompleted"]; +} + +
+
+
+
+ +
+
+ @Html.ActionLink(SharedLocalizer["Link.BackToSubmissionDetails"].Value, + "SubmissionDetails", + "Submissions", + null, + new { @class = "govuk-body govuk-link govuk-link--no-visited-state" }) +
+
+ @if (!downloadCompleted) + { + + } +
+
+
+
diff --git a/src/EPR.RegulatorService.Frontend.Web/Views/Submissions/PackagingDataFileDownloadFailed.cshtml b/src/EPR.RegulatorService.Frontend.Web/Views/Submissions/PackagingDataFileDownloadFailed.cshtml new file mode 100644 index 00000000..b9108deb --- /dev/null +++ b/src/EPR.RegulatorService.Frontend.Web/Views/Submissions/PackagingDataFileDownloadFailed.cshtml @@ -0,0 +1,46 @@ +@using EPR.RegulatorService.Frontend.Web.ViewModels.Submissions + +@model SubmissionDetailsFileDownloadViewModel +@{ + ViewData["Title"] = Localizer["PackagingDataFileDownloadFailed.Title"]; +} + +
+
+
+
+ @if (Model.DownloadFailed && !Model.HasIssue) + { + +
+
+ @Html.ActionLink(SharedLocalizer["Link.BackToSubmissionDetails"].Value, + "SubmissionsDetails", + "Submissions", + null, + new { @class = "govuk-body govuk-link govuk-link--no-visited-state" }) +
+
+ } + else if (Model.HasIssue) + { + +
+
+ @Html.ActionLink(SharedLocalizer["Link.BackToSubmissionDetails"].Value, + "SubmissionDetails", + "Submissions", + null, + new { @class = "govuk-body govuk-link govuk-link--no-visited-state" }) +
+
+ } + else + { +

Invalid Request

+ } +
+
+
+
+ From a292c3fa1d280211955d4a4dbd1827e6cbfd8795 Mon Sep 17 00:00:00 2001 From: Idris Abu Date: Tue, 7 Jan 2025 14:22:48 +0000 Subject: [PATCH 03/20] corrected submission type for pom download --- .../Controllers/Submissions/SubmissionsController.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/EPR.RegulatorService.Frontend.Web/Controllers/Submissions/SubmissionsController.cs b/src/EPR.RegulatorService.Frontend.Web/Controllers/Submissions/SubmissionsController.cs index 51ea4f45..ababa3fd 100644 --- a/src/EPR.RegulatorService.Frontend.Web/Controllers/Submissions/SubmissionsController.cs +++ b/src/EPR.RegulatorService.Frontend.Web/Controllers/Submissions/SubmissionsController.cs @@ -450,7 +450,7 @@ private static FileDownloadRequest CreateFileDownloadRequest(Submission submissi var fileDownloadModel = new FileDownloadRequest { SubmissionId = submission.SubmissionId, - SubmissionType = SubmissionType.Registration, + SubmissionType = SubmissionType.Producer, FileId = submission.FileId, BlobName = submission.PomBlobName, FileName = submission.PomFileName, From 05acd93b630a51dcc6a18a68fcd5690e3cabb73b Mon Sep 17 00:00:00 2001 From: Idris Abu Date: Tue, 7 Jan 2025 19:10:59 +0000 Subject: [PATCH 04/20] Additional code changes for pom downoad --- .../Submissions/SubmissionsController.cs | 2 +- .../Resources/SharedResources.cy.resx | 3 + .../Resources/SharedResources.en.resx | 3 + .../_PomFileIsDownloadingVirusError.cy.resx | 113 ++++++++++++++++++ .../_PomFileIsDownloadingVirusError.en.resx | 113 ++++++++++++++++++ .../_PomFileNotDownloadingTryAgain.cy.resx | 113 ++++++++++++++++++ .../_PomFileNotDownloadingTryAgain.en.resx | 113 ++++++++++++++++++ .../_PomFileIsDownloadingVirusError.cshtml | 10 ++ .../_PomFileIsDownloadingVirusError.cshtml | 10 ++ .../_PomFileNotDownloadingTryAgain.cshtml | 10 ++ .../PackagingDataFileDownloadFailed.cshtml | 4 +- 11 files changed, 491 insertions(+), 3 deletions(-) create mode 100644 src/EPR.RegulatorService.Frontend.Web/Resources/Views/Shared/Partials/_PomFileIsDownloadingVirusError.cy.resx create mode 100644 src/EPR.RegulatorService.Frontend.Web/Resources/Views/Shared/Partials/_PomFileIsDownloadingVirusError.en.resx create mode 100644 src/EPR.RegulatorService.Frontend.Web/Resources/Views/Shared/Partials/_PomFileNotDownloadingTryAgain.cy.resx create mode 100644 src/EPR.RegulatorService.Frontend.Web/Resources/Views/Shared/Partials/_PomFileNotDownloadingTryAgain.en.resx create mode 100644 src/EPR.RegulatorService.Frontend.Web/Views/Shared/Partials/ManageApprovedUser/_PomFileIsDownloadingVirusError.cshtml create mode 100644 src/EPR.RegulatorService.Frontend.Web/Views/Shared/Partials/_PomFileIsDownloadingVirusError.cshtml create mode 100644 src/EPR.RegulatorService.Frontend.Web/Views/Shared/Partials/_PomFileNotDownloadingTryAgain.cshtml diff --git a/src/EPR.RegulatorService.Frontend.Web/Controllers/Submissions/SubmissionsController.cs b/src/EPR.RegulatorService.Frontend.Web/Controllers/Submissions/SubmissionsController.cs index ababa3fd..971f8b38 100644 --- a/src/EPR.RegulatorService.Frontend.Web/Controllers/Submissions/SubmissionsController.cs +++ b/src/EPR.RegulatorService.Frontend.Web/Controllers/Submissions/SubmissionsController.cs @@ -371,7 +371,7 @@ public async Task PrePageNotFound() [HttpGet] [Route(PagePath.SubmissionsFileDownload)] - public async Task SubmissionsFileDownload(string packagingDataSubmissionBlobName) + public async Task SubmissionsFileDownload() { TempData["DownloadCompleted"] = false; diff --git a/src/EPR.RegulatorService.Frontend.Web/Resources/SharedResources.cy.resx b/src/EPR.RegulatorService.Frontend.Web/Resources/SharedResources.cy.resx index 7365adc9..ff583f8b 100644 --- a/src/EPR.RegulatorService.Frontend.Web/Resources/SharedResources.cy.resx +++ b/src/EPR.RegulatorService.Frontend.Web/Resources/SharedResources.cy.resx @@ -345,4 +345,7 @@ W Export + + W Reject submission + diff --git a/src/EPR.RegulatorService.Frontend.Web/Resources/SharedResources.en.resx b/src/EPR.RegulatorService.Frontend.Web/Resources/SharedResources.en.resx index 45ef0169..97b79e9c 100644 --- a/src/EPR.RegulatorService.Frontend.Web/Resources/SharedResources.en.resx +++ b/src/EPR.RegulatorService.Frontend.Web/Resources/SharedResources.en.resx @@ -258,6 +258,9 @@ Try Again + + Reject submission + Go back to submission details diff --git a/src/EPR.RegulatorService.Frontend.Web/Resources/Views/Shared/Partials/_PomFileIsDownloadingVirusError.cy.resx b/src/EPR.RegulatorService.Frontend.Web/Resources/Views/Shared/Partials/_PomFileIsDownloadingVirusError.cy.resx new file mode 100644 index 00000000..7b4d210e --- /dev/null +++ b/src/EPR.RegulatorService.Frontend.Web/Resources/Views/Shared/Partials/_PomFileIsDownloadingVirusError.cy.resx @@ -0,0 +1,113 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Mae’r ffeil yma heb gael ei lawrlwytho. + + + Beth mae angen ichi ei wneud nesaf + + + Mae angen i chi wrthod cyflwyniad manylion y sefydliad a chyfarwyddo'r cynhyrchydd neu'r cynllun cydymffurfio i ailgyflwyno manylion eu sefydliad. + + + Roedd yna broblem wrth lawrlwytho'r ffeil yma + + diff --git a/src/EPR.RegulatorService.Frontend.Web/Resources/Views/Shared/Partials/_PomFileIsDownloadingVirusError.en.resx b/src/EPR.RegulatorService.Frontend.Web/Resources/Views/Shared/Partials/_PomFileIsDownloadingVirusError.en.resx new file mode 100644 index 00000000..267b9a28 --- /dev/null +++ b/src/EPR.RegulatorService.Frontend.Web/Resources/Views/Shared/Partials/_PomFileIsDownloadingVirusError.en.resx @@ -0,0 +1,113 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + This file can not be downloaded. + + + What you need to do next. + + + You need to reject the organisation details submission and instruct the producer or compliance scheme to resubmit their organisation details. + + + There is a problem with this file + + diff --git a/src/EPR.RegulatorService.Frontend.Web/Resources/Views/Shared/Partials/_PomFileNotDownloadingTryAgain.cy.resx b/src/EPR.RegulatorService.Frontend.Web/Resources/Views/Shared/Partials/_PomFileNotDownloadingTryAgain.cy.resx new file mode 100644 index 00000000..70352a9d --- /dev/null +++ b/src/EPR.RegulatorService.Frontend.Web/Resources/Views/Shared/Partials/_PomFileNotDownloadingTryAgain.cy.resx @@ -0,0 +1,113 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Mae’r ffeil yma heb gael ei lawrlwytho. + + + Beth mae angen ichi ei wneud nesaf + + + Bydd angen ichi lawrlwytho'r ffeil eto + + + Roedd yna broblem wrth lawrlwytho'r ffeil yma + + diff --git a/src/EPR.RegulatorService.Frontend.Web/Resources/Views/Shared/Partials/_PomFileNotDownloadingTryAgain.en.resx b/src/EPR.RegulatorService.Frontend.Web/Resources/Views/Shared/Partials/_PomFileNotDownloadingTryAgain.en.resx new file mode 100644 index 00000000..08226dfc --- /dev/null +++ b/src/EPR.RegulatorService.Frontend.Web/Resources/Views/Shared/Partials/_PomFileNotDownloadingTryAgain.en.resx @@ -0,0 +1,113 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + This file has not been downloaded. + + + What you need to do next + + + You will need to download the file again. + + + There was a problem downloading this file + + diff --git a/src/EPR.RegulatorService.Frontend.Web/Views/Shared/Partials/ManageApprovedUser/_PomFileIsDownloadingVirusError.cshtml b/src/EPR.RegulatorService.Frontend.Web/Views/Shared/Partials/ManageApprovedUser/_PomFileIsDownloadingVirusError.cshtml new file mode 100644 index 00000000..92fecd65 --- /dev/null +++ b/src/EPR.RegulatorService.Frontend.Web/Views/Shared/Partials/ManageApprovedUser/_PomFileIsDownloadingVirusError.cshtml @@ -0,0 +1,10 @@ +

@Localizer["OrganisationFileDownload.VirusPageTitle"]

+

@Localizer["OrganisationFileDownload.VirusPageInfo1"]

+

@Localizer["OrganisationFileDownload.VirusPageInfo2"]

+

@Localizer["OrganisationFileDownload.VirusPageInfo3"]

+ +
+ +
diff --git a/src/EPR.RegulatorService.Frontend.Web/Views/Shared/Partials/_PomFileIsDownloadingVirusError.cshtml b/src/EPR.RegulatorService.Frontend.Web/Views/Shared/Partials/_PomFileIsDownloadingVirusError.cshtml new file mode 100644 index 00000000..92fecd65 --- /dev/null +++ b/src/EPR.RegulatorService.Frontend.Web/Views/Shared/Partials/_PomFileIsDownloadingVirusError.cshtml @@ -0,0 +1,10 @@ +

@Localizer["OrganisationFileDownload.VirusPageTitle"]

+

@Localizer["OrganisationFileDownload.VirusPageInfo1"]

+

@Localizer["OrganisationFileDownload.VirusPageInfo2"]

+

@Localizer["OrganisationFileDownload.VirusPageInfo3"]

+ +
+ +
diff --git a/src/EPR.RegulatorService.Frontend.Web/Views/Shared/Partials/_PomFileNotDownloadingTryAgain.cshtml b/src/EPR.RegulatorService.Frontend.Web/Views/Shared/Partials/_PomFileNotDownloadingTryAgain.cshtml new file mode 100644 index 00000000..a8d70720 --- /dev/null +++ b/src/EPR.RegulatorService.Frontend.Web/Views/Shared/Partials/_PomFileNotDownloadingTryAgain.cshtml @@ -0,0 +1,10 @@ +

@Localizer["OrganisationFileDownload.TryAgainPageTitle"]

+

@Localizer["OrganisationFileDownload.TryAgainPageInfo1"]

+

@Localizer["OrganisationFileDownload.TryAgainPageInfo2"]

+

@Localizer["OrganisationFileDownload.TryAgainPageInfo3"]

+ +
+ +
diff --git a/src/EPR.RegulatorService.Frontend.Web/Views/Submissions/PackagingDataFileDownloadFailed.cshtml b/src/EPR.RegulatorService.Frontend.Web/Views/Submissions/PackagingDataFileDownloadFailed.cshtml index b9108deb..d9c2358f 100644 --- a/src/EPR.RegulatorService.Frontend.Web/Views/Submissions/PackagingDataFileDownloadFailed.cshtml +++ b/src/EPR.RegulatorService.Frontend.Web/Views/Submissions/PackagingDataFileDownloadFailed.cshtml @@ -11,7 +11,7 @@
@if (Model.DownloadFailed && !Model.HasIssue) { - +
@Html.ActionLink(SharedLocalizer["Link.BackToSubmissionDetails"].Value, @@ -24,7 +24,7 @@ } else if (Model.HasIssue) { - +
@Html.ActionLink(SharedLocalizer["Link.BackToSubmissionDetails"].Value, From 31b83ac779dee5cb75681e3c1f2d790403516c27 Mon Sep 17 00:00:00 2001 From: Idris Abu Date: Wed, 8 Jan 2025 12:11:27 +0000 Subject: [PATCH 05/20] Unit tests --- .../TestData/TestSubmission.cs | 4 +- .../Controllers/SubmissionControllerTests.cs | 168 ++++++++++++++++++ .../Web/Controllers/SubmissionDetailsTests.cs | 2 + 3 files changed, 173 insertions(+), 1 deletion(-) diff --git a/src/EPR.RegulatorService.Frontend.UnitTests/TestData/TestSubmission.cs b/src/EPR.RegulatorService.Frontend.UnitTests/TestData/TestSubmission.cs index a0789156..18d438d3 100644 --- a/src/EPR.RegulatorService.Frontend.UnitTests/TestData/TestSubmission.cs +++ b/src/EPR.RegulatorService.Frontend.UnitTests/TestData/TestSubmission.cs @@ -25,7 +25,9 @@ public static Submission GetTestSubmission() => FirstName = "Test", LastName = "User", Telephone = "0123 456 789", - ServiceRole = "Approved person" + ServiceRole = "Approved person", + PomBlobName = "A blob name", + PomFileName = "A Pom File.csv" }; } } \ No newline at end of file diff --git a/src/EPR.RegulatorService.Frontend.UnitTests/Web/Controllers/SubmissionControllerTests.cs b/src/EPR.RegulatorService.Frontend.UnitTests/Web/Controllers/SubmissionControllerTests.cs index 1c95bb3b..98dfd8d3 100644 --- a/src/EPR.RegulatorService.Frontend.UnitTests/Web/Controllers/SubmissionControllerTests.cs +++ b/src/EPR.RegulatorService.Frontend.UnitTests/Web/Controllers/SubmissionControllerTests.cs @@ -1,9 +1,12 @@ using EPR.RegulatorService.Frontend.Core.Models; +using EPR.RegulatorService.Frontend.Core.Models.FileDownload; +using EPR.RegulatorService.Frontend.Core.Models.Registrations; using EPR.RegulatorService.Frontend.Core.Models.Submissions; using EPR.RegulatorService.Frontend.Core.Sessions; using EPR.RegulatorService.Frontend.Web.Constants; using EPR.RegulatorService.Frontend.Web.Controllers.Submissions; using EPR.RegulatorService.Frontend.Web.ViewModels.Applications; +using EPR.RegulatorService.Frontend.Web.ViewModels.Registrations; using EPR.RegulatorService.Frontend.Web.ViewModels.Submissions; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; @@ -453,5 +456,170 @@ public async Task GivenSetOrResetFilterValuesInSession_WhenNotClearFilters_AndIs JourneySessionMock.RegulatorSubmissionSession.SearchSubmissionPeriods.Should().BeEquivalentTo(submissionFiltersModel.SearchSubmissionPeriods); JourneySessionMock.RegulatorSubmissionSession.CurrentPageNumber.Should().Be(DefaultPageNumber); } + + [TestMethod] + public async Task SubmissionsFileDownload_RedirectsToPackagingDataFileDownload() + { + // Act + var result = await _systemUnderTest.SubmissionsFileDownload(); + + // Assert + result.Should().NotBeNull(); + result.Should().BeOfType(); + var redirectResult = result as RedirectToActionResult; + redirectResult.ActionName.Should().Be("PackagingDataFileDownload"); + redirectResult.ControllerName.Should().Be("Submissions"); + } + + [TestMethod] + public void PackagingDataFileDownload_ReturnsViewWithViewModel() + { + // Act + var result = _systemUnderTest.PackagingDataFileDownload(); + + // Assert + result.Should().NotBeNull(); + result.Should().BeOfType(); + ((Microsoft.AspNetCore.Mvc.ViewResult)result).ViewName.Should().Be("PackagingDataFileDownload"); + } + + [TestMethod] + public void PackagingDataFileDownloadFailed_ReturnsViewWithViewModel() + { + // Act + var result = _systemUnderTest.PackagingDataFileDownloadFailed(); + + // Assert + result.Should().NotBeNull(); + result.Should().BeOfType(); + var viewResult = result as ViewResult; + viewResult.Model.Should().NotBeNull(); + viewResult.Model.Should().BeOfType(); + var model = (SubmissionDetailsFileDownloadViewModel)viewResult.Model; + model.DownloadFailed.Should().BeTrue(); + model.HasIssue.Should().BeFalse(); + viewResult.ViewName.Should().Be("PackagingDataFileDownloadFailed"); + } + + + [TestMethod] + public void PackagingDataFileDownloadSecurityWarning_ReturnsViewWithViewModel() + { + // Act + var result = _systemUnderTest.PackagingDataFileDownloadSecurityWarning(); + + // Assert + result.Should().NotBeNull(); + result.Should().BeOfType(); + var viewResult = result as ViewResult; + viewResult.Model.Should().NotBeNull(); + viewResult.Model.Should().BeOfType(); + var model = (SubmissionDetailsFileDownloadViewModel)viewResult.Model; + model.DownloadFailed.Should().BeTrue(); + model.HasIssue.Should().BeTrue(); + viewResult.ViewName.Should().Be("PackagingDataFileDownloadFailed"); + } + + + [TestMethod] + public async Task FileDownloadInProgress_ValidRequest_ReturnsFile() + { + // Arrange + var submission = _fixture.Create(); + var session = new JourneySession + { + RegulatorSubmissionSession = new RegulatorSubmissionSession + { + OrganisationSubmission = submission + } + }; + + _sessionManagerMock.Setup(x => x.GetSessionAsync(It.IsAny())).ReturnsAsync(session); + + using (var response = new HttpResponseMessage(System.Net.HttpStatusCode.OK) + { + Content = new StringContent("file content") + }) + { + response.Content.Headers.ContentDisposition = new System.Net.Http.Headers.ContentDispositionHeaderValue("attachment") + { + FileName = "testfile.txt" + }; + + _facadeServiceMock.Setup(x => x.GetFileDownload(It.IsAny())).ReturnsAsync(response); + + // Act + var result = await _systemUnderTest.FileDownloadInProgress(); + + // Assert + result.Should().NotBeNull(); + result.Should().BeOfType(); + var fileResult = result as FileStreamResult; + fileResult.ContentType.Should().Be("application/octet-stream"); + fileResult.FileDownloadName.Should().Be("testfile.txt"); + } + } + + [TestMethod] + public async Task FileDownloadInProgress_FileInfected_ReturnsRedirectToAction() + { + // Arrange + var submission = _fixture.Create(); + var session = new JourneySession + { + RegulatorSubmissionSession = new RegulatorSubmissionSession + { + OrganisationSubmission = submission + } + }; + + _sessionManagerMock.Setup(x => x.GetSessionAsync(It.IsAny())).ReturnsAsync(session); + + using var response = new HttpResponseMessage(System.Net.HttpStatusCode.Forbidden); + + _facadeServiceMock.Setup(x => x.GetFileDownload(It.IsAny())).ReturnsAsync(response); + + // Act + var result = await _systemUnderTest.FileDownloadInProgress(); + + // Assert + result.Should().NotBeNull(); + result.Should().BeOfType(); + var redirectResult = result as RedirectToActionResult; + redirectResult.ActionName.Should().Be("PackagingDataFileDownloadSecurityWarning"); + redirectResult.ControllerName.Should().BeNull(); + } + + + [TestMethod] + public async Task FileDownloadInProgress_DownloadFailed_ReturnsRedirectToAction() + { + // Arrange + var submission = _fixture.Create(); + var session = new JourneySession + { + RegulatorSubmissionSession = new RegulatorSubmissionSession + { + OrganisationSubmission = submission + } + }; + + _sessionManagerMock.Setup(x => x.GetSessionAsync(It.IsAny())).ReturnsAsync(session); + + using (var response = new HttpResponseMessage(System.Net.HttpStatusCode.BadRequest)) + { + _facadeServiceMock.Setup(x => x.GetFileDownload(It.IsAny())).ReturnsAsync(response); + + // Act + var result = await _systemUnderTest.FileDownloadInProgress(); + + // Assert + result.Should().NotBeNull(); + result.Should().BeOfType(); + var redirectResult = result as RedirectToActionResult; + redirectResult.ActionName.Should().Be("PackagingDataFileDownloadFailed"); + redirectResult.ControllerName.Should().BeNull(); + } + } } } \ No newline at end of file diff --git a/src/EPR.RegulatorService.Frontend.UnitTests/Web/Controllers/SubmissionDetailsTests.cs b/src/EPR.RegulatorService.Frontend.UnitTests/Web/Controllers/SubmissionDetailsTests.cs index 49bec584..11e13646 100644 --- a/src/EPR.RegulatorService.Frontend.UnitTests/Web/Controllers/SubmissionDetailsTests.cs +++ b/src/EPR.RegulatorService.Frontend.UnitTests/Web/Controllers/SubmissionDetailsTests.cs @@ -52,6 +52,8 @@ public async Task GivenOnSubmissionDetailsPage_WhenSubmissionDetailsHttpGetCalle model!.OrganisationName.Should().Be(submissionFromSession.OrganisationName); model.SubmissionId.Should().Be(submissionFromSession.SubmissionId); model.SubmittedBy.Should().Be($"{submissionFromSession.FirstName} {submissionFromSession.LastName}"); + model.SubmissionBlobName.Should().Be(submissionFromSession.PomBlobName); + model.SubmissionFileName.Should().Be(submissionFromSession.PomFileName); AssertBackLink(result, PagePath.Submissions); } From 5f4a8dd3cfc8c30f271d783210e7f670c894ff03 Mon Sep 17 00:00:00 2001 From: Idris Abu Date: Wed, 8 Jan 2025 12:56:54 +0000 Subject: [PATCH 06/20] Some tidy-up --- .../Partials/_PomFileIsDownloadingVirusError.cy.resx | 8 ++++---- .../Partials/_PomFileIsDownloadingVirusError.en.resx | 8 ++++---- .../_PomFileIsDownloadingVirusError.cshtml | 8 ++++---- .../Partials/_PomFileIsDownloadingVirusError.cshtml | 8 ++++---- .../Submissions/PackagingDataFileDownloadFailed.cshtml | 2 +- 5 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/EPR.RegulatorService.Frontend.Web/Resources/Views/Shared/Partials/_PomFileIsDownloadingVirusError.cy.resx b/src/EPR.RegulatorService.Frontend.Web/Resources/Views/Shared/Partials/_PomFileIsDownloadingVirusError.cy.resx index 7b4d210e..32d35015 100644 --- a/src/EPR.RegulatorService.Frontend.Web/Resources/Views/Shared/Partials/_PomFileIsDownloadingVirusError.cy.resx +++ b/src/EPR.RegulatorService.Frontend.Web/Resources/Views/Shared/Partials/_PomFileIsDownloadingVirusError.cy.resx @@ -98,16 +98,16 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + Mae’r ffeil yma heb gael ei lawrlwytho. - + Beth mae angen ichi ei wneud nesaf - + Mae angen i chi wrthod cyflwyniad manylion y sefydliad a chyfarwyddo'r cynhyrchydd neu'r cynllun cydymffurfio i ailgyflwyno manylion eu sefydliad. - + Roedd yna broblem wrth lawrlwytho'r ffeil yma diff --git a/src/EPR.RegulatorService.Frontend.Web/Resources/Views/Shared/Partials/_PomFileIsDownloadingVirusError.en.resx b/src/EPR.RegulatorService.Frontend.Web/Resources/Views/Shared/Partials/_PomFileIsDownloadingVirusError.en.resx index 267b9a28..72998e4d 100644 --- a/src/EPR.RegulatorService.Frontend.Web/Resources/Views/Shared/Partials/_PomFileIsDownloadingVirusError.en.resx +++ b/src/EPR.RegulatorService.Frontend.Web/Resources/Views/Shared/Partials/_PomFileIsDownloadingVirusError.en.resx @@ -98,16 +98,16 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + This file can not be downloaded. - + What you need to do next. - + You need to reject the organisation details submission and instruct the producer or compliance scheme to resubmit their organisation details. - + There is a problem with this file diff --git a/src/EPR.RegulatorService.Frontend.Web/Views/Shared/Partials/ManageApprovedUser/_PomFileIsDownloadingVirusError.cshtml b/src/EPR.RegulatorService.Frontend.Web/Views/Shared/Partials/ManageApprovedUser/_PomFileIsDownloadingVirusError.cshtml index 92fecd65..7ce824be 100644 --- a/src/EPR.RegulatorService.Frontend.Web/Views/Shared/Partials/ManageApprovedUser/_PomFileIsDownloadingVirusError.cshtml +++ b/src/EPR.RegulatorService.Frontend.Web/Views/Shared/Partials/ManageApprovedUser/_PomFileIsDownloadingVirusError.cshtml @@ -1,7 +1,7 @@ -

@Localizer["OrganisationFileDownload.VirusPageTitle"]

-

@Localizer["OrganisationFileDownload.VirusPageInfo1"]

-

@Localizer["OrganisationFileDownload.VirusPageInfo2"]

-

@Localizer["OrganisationFileDownload.VirusPageInfo3"]

+

@Localizer["PomFileDownload.VirusPageTitle"]

+

@Localizer["PomFileDownload.VirusPageInfo1"]

+

@Localizer["PomFileDownload.VirusPageInfo2"]

+

@Localizer["PomFileDownload.VirusPageInfo3"]

diff --git a/src/EPR.RegulatorService.Frontend.Web/Views/Shared/Partials/_ResubmissionDetails.cshtml b/src/EPR.RegulatorService.Frontend.Web/Views/Shared/Partials/_ResubmissionDetails.cshtml index 8c2b550f..b489cbdd 100644 --- a/src/EPR.RegulatorService.Frontend.Web/Views/Shared/Partials/_ResubmissionDetails.cshtml +++ b/src/EPR.RegulatorService.Frontend.Web/Views/Shared/Partials/_ResubmissionDetails.cshtml @@ -84,7 +84,26 @@ @Model.Email
- + @if (!string.IsNullOrEmpty(Model.SubmissionFileName)) + { +
+
+ @Localizer["SummaryList.PackagingData"] +
+
+ @Model.SubmissionFileName +
+ +
+ } @if (!string.IsNullOrEmpty(Model.PreviousRejectionComments) && Model.Status != SubmissionStatus.Accepted) {
From 2a9f8a3a7fa72242e63cd504575ffef7b24a01a9 Mon Sep 17 00:00:00 2001 From: Fahad Ali Date: Wed, 8 Jan 2025 17:47:33 +0000 Subject: [PATCH 08/20] test coverage added --- .../Controllers/SubmissionControllerTests.cs | 71 +++++++++++++++++++ 1 file changed, 71 insertions(+) diff --git a/src/EPR.RegulatorService.Frontend.UnitTests/Web/Controllers/SubmissionControllerTests.cs b/src/EPR.RegulatorService.Frontend.UnitTests/Web/Controllers/SubmissionControllerTests.cs index 0a71bb83..9b78a2b3 100644 --- a/src/EPR.RegulatorService.Frontend.UnitTests/Web/Controllers/SubmissionControllerTests.cs +++ b/src/EPR.RegulatorService.Frontend.UnitTests/Web/Controllers/SubmissionControllerTests.cs @@ -644,5 +644,76 @@ public async Task FileDownloadInProgress_DownloadFailed_ReturnsRedirectToAction( redirectResult.ControllerName.Should().BeNull(); } } + + [TestMethod] + public void FormatTimeAndDateForSubmission_ReturnsCorrectFormat_MorningTime() + { + // Arrange + + var inputDate = new DateTime(2025, 1, 8, 9, 30, 0); // 9:30 AM, 8th January 2025 + var expectedOutput = "9:30am on 08 January 2025"; + + // Act + var result = _systemUnderTest.FormatTimeAndDateForSubmission(inputDate); + + // Assert + result.Should().Be(expectedOutput); + } + + [TestMethod] + public void FormatTimeAndDateForSubmission_ReturnsCorrectFormat_AfternoonTime() + { + // Arrange + var inputDate = new DateTime(2025, 1, 8, 14, 15, 0); // 2:15 PM, 8th January 2025 + var expectedOutput = "2:15pm on 08 January 2025"; + + // Act + var result = _systemUnderTest.FormatTimeAndDateForSubmission(inputDate); + + // Assert + result.Should().Be(expectedOutput); + } + + [TestMethod] + public void FormatTimeAndDateForSubmission_ReturnsCorrectFormat_EdgeCaseMidnight() + { + // Arrange + var inputDate = new DateTime(2025, 1, 8, 0, 0, 0); // Midnight, 8th January 2025 + var expectedOutput = "12:00am on 08 January 2025"; + + // Act + var result = _systemUnderTest.FormatTimeAndDateForSubmission(inputDate); + + // Assert + result.Should().Be(expectedOutput); + } + + [TestMethod] + public void FormatTimeAndDateForSubmission_ReturnsCorrectFormat_EdgeCaseNoon() + { + // Arrange + var inputDate = new DateTime(2025, 1, 8, 12, 0, 0); // Noon, 8th January 2025 + var expectedOutput = "12:00pm on 08 January 2025"; + + // Act + var result = _systemUnderTest.FormatTimeAndDateForSubmission(inputDate); + + // Assert + result.Should().Be(expectedOutput); + } + + [TestMethod] + public void FormatTimeAndDateForSubmission_ReturnsCorrectFormat_LeapYear() + { + // Arrange + var inputDate = new DateTime(2024, 2, 29, 8, 45, 0); // 8:45 AM, 29th February 2024 (leap year) + var expectedOutput = "8:45am on 29 February 2024"; + + // Act + var result = _systemUnderTest.FormatTimeAndDateForSubmission(inputDate); + + // Assert + result.Should().Be(expectedOutput); + } } } \ No newline at end of file From e36a0cc3fce53197ddfb9a8c709fc7d7ae527844 Mon Sep 17 00:00:00 2001 From: Fahad Ali Date: Wed, 8 Jan 2025 18:06:01 +0000 Subject: [PATCH 09/20] test coverage added --- .../Controllers/SubmissionControllerTests.cs | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/src/EPR.RegulatorService.Frontend.UnitTests/Web/Controllers/SubmissionControllerTests.cs b/src/EPR.RegulatorService.Frontend.UnitTests/Web/Controllers/SubmissionControllerTests.cs index 9b78a2b3..0a4de204 100644 --- a/src/EPR.RegulatorService.Frontend.UnitTests/Web/Controllers/SubmissionControllerTests.cs +++ b/src/EPR.RegulatorService.Frontend.UnitTests/Web/Controllers/SubmissionControllerTests.cs @@ -645,6 +645,38 @@ public async Task FileDownloadInProgress_DownloadFailed_ReturnsRedirectToAction( } } + [TestMethod] + public async Task FileDownloadInProgress_DownloadFailed_ReturnsRedirectToActionXXXXXX() + { + // Arrange + var submission = _fixture.Create(); + submission.PomBlobName = null; + var session = new JourneySession + { + RegulatorSubmissionSession = new RegulatorSubmissionSession + { + OrganisationSubmission = submission + } + }; + + _sessionManagerMock.Setup(x => x.GetSessionAsync(It.IsAny())).ReturnsAsync(session); + + using (var response = new HttpResponseMessage(System.Net.HttpStatusCode.BadRequest)) + { + _facadeServiceMock.Setup(x => x.GetFileDownload(It.IsAny())).ReturnsAsync(response); + + // Act + var result = await _systemUnderTest.FileDownloadInProgress(); + + // Assert + result.Should().NotBeNull(); + result.Should().BeOfType(); + var redirectResult = result as RedirectToActionResult; + redirectResult.ActionName.Should().Be("PackagingDataFileDownloadFailed"); + redirectResult.ControllerName.Should().BeNull(); + } + } + [TestMethod] public void FormatTimeAndDateForSubmission_ReturnsCorrectFormat_MorningTime() { From a5738d788f831c2217965a31432c198af072caf9 Mon Sep 17 00:00:00 2001 From: Idris Abu Date: Thu, 9 Jan 2025 10:42:35 +0000 Subject: [PATCH 10/20] Resource file changes --- .../Views/Shared/Partials/_ResubmissionDetails.cy.resx | 3 +++ .../Views/Shared/Partials/_ResubmissionDetails.en.resx | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/EPR.RegulatorService.Frontend.Web/Resources/Views/Shared/Partials/_ResubmissionDetails.cy.resx b/src/EPR.RegulatorService.Frontend.Web/Resources/Views/Shared/Partials/_ResubmissionDetails.cy.resx index 55fb9ba7..e61c44d9 100644 --- a/src/EPR.RegulatorService.Frontend.Web/Resources/Views/Shared/Partials/_ResubmissionDetails.cy.resx +++ b/src/EPR.RegulatorService.Frontend.Web/Resources/Views/Shared/Partials/_ResubmissionDetails.cy.resx @@ -45,4 +45,7 @@ Chaiff {0} ddim ailgyflwyno nes bod y cyflwyniad yma wedi’i weithredu. + + W Packaging data + diff --git a/src/EPR.RegulatorService.Frontend.Web/Resources/Views/Shared/Partials/_ResubmissionDetails.en.resx b/src/EPR.RegulatorService.Frontend.Web/Resources/Views/Shared/Partials/_ResubmissionDetails.en.resx index 5ca049d2..8598dbbe 100644 --- a/src/EPR.RegulatorService.Frontend.Web/Resources/Views/Shared/Partials/_ResubmissionDetails.en.resx +++ b/src/EPR.RegulatorService.Frontend.Web/Resources/Views/Shared/Partials/_ResubmissionDetails.en.resx @@ -147,4 +147,7 @@ submission period - \ No newline at end of file + + Packaging data + + From 4d6c4981d46ff5b32b8d9d9a44523102fcf5fb04 Mon Sep 17 00:00:00 2001 From: Fahad Ali Date: Thu, 9 Jan 2025 11:54:31 +0000 Subject: [PATCH 11/20] feature flag added for Regulator FE changes --- .../Configs/FeatureFlags.cs | 2 ++ .../Shared/Partials/_RegulatorRegistrationFilters.cshtml | 5 ++++- .../Views/Shared/Partials/_RegulatorSubmissionFilters.cshtml | 4 +++- .../Views/_ViewImports.cshtml | 5 +++-- src/EPR.RegulatorService.Frontend.Web/appsettings.json | 3 ++- 5 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/EPR.RegulatorService.Frontend.Web/Configs/FeatureFlags.cs b/src/EPR.RegulatorService.Frontend.Web/Configs/FeatureFlags.cs index 45b2f410..d092836e 100644 --- a/src/EPR.RegulatorService.Frontend.Web/Configs/FeatureFlags.cs +++ b/src/EPR.RegulatorService.Frontend.Web/Configs/FeatureFlags.cs @@ -18,4 +18,6 @@ public static class FeatureFlags public const string RegistrationDataPeriodAndTime = "RegistrationDataPeriodAndTime"; public const string ManageRegistrationSubmissions = "ManageRegistrationSubmissions"; + + public const string RegulatorFE = "RegulatorFE"; } \ No newline at end of file diff --git a/src/EPR.RegulatorService.Frontend.Web/Views/Shared/Partials/_RegulatorRegistrationFilters.cshtml b/src/EPR.RegulatorService.Frontend.Web/Views/Shared/Partials/_RegulatorRegistrationFilters.cshtml index f7660779..639d6f37 100644 --- a/src/EPR.RegulatorService.Frontend.Web/Views/Shared/Partials/_RegulatorRegistrationFilters.cshtml +++ b/src/EPR.RegulatorService.Frontend.Web/Views/Shared/Partials/_RegulatorRegistrationFilters.cshtml @@ -155,7 +155,10 @@ } @Html.Hidden("isFilteredSearch", true) - + + + + @Html.ActionLink(SharedLocalizer["ClearFilters"].Value, "Registrations", diff --git a/src/EPR.RegulatorService.Frontend.Web/Views/Shared/Partials/_RegulatorSubmissionFilters.cshtml b/src/EPR.RegulatorService.Frontend.Web/Views/Shared/Partials/_RegulatorSubmissionFilters.cshtml index 3f61af32..659c82b9 100644 --- a/src/EPR.RegulatorService.Frontend.Web/Views/Shared/Partials/_RegulatorSubmissionFilters.cshtml +++ b/src/EPR.RegulatorService.Frontend.Web/Views/Shared/Partials/_RegulatorSubmissionFilters.cshtml @@ -154,7 +154,9 @@ } @Html.Hidden("isFilteredSearch", true) - + + +
diff --git a/src/EPR.RegulatorService.Frontend.Web/Views/_ViewImports.cshtml b/src/EPR.RegulatorService.Frontend.Web/Views/_ViewImports.cshtml index a09f6b2f..2e813a94 100644 --- a/src/EPR.RegulatorService.Frontend.Web/Views/_ViewImports.cshtml +++ b/src/EPR.RegulatorService.Frontend.Web/Views/_ViewImports.cshtml @@ -1,4 +1,4 @@ -@using EPR.RegulatorService.Frontend.Web +@using EPR.RegulatorService.Frontend.Web @using EPR.RegulatorService.Frontend.Web.ViewModels @using Microsoft.ApplicationInsights.AspNetCore @using Microsoft.AspNetCore.Mvc.Localization @@ -6,5 +6,6 @@ @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers @addTagHelper *, EPR.RegulatorService.Frontend.Web +@addTagHelper *, Microsoft.FeatureManagement.AspNetCore @inject IViewLocalizer Localizer -@inject IStringLocalizer SharedLocalizer \ No newline at end of file +@inject IStringLocalizer SharedLocalizer diff --git a/src/EPR.RegulatorService.Frontend.Web/appsettings.json b/src/EPR.RegulatorService.Frontend.Web/appsettings.json index 95f79660..0aec6819 100644 --- a/src/EPR.RegulatorService.Frontend.Web/appsettings.json +++ b/src/EPR.RegulatorService.Frontend.Web/appsettings.json @@ -148,7 +148,8 @@ "ManageApprovedUsers": false, "PomDataPeriodAndTime": true, "RegistrationDataPeriodAndTime": true, - "ManageRegistrationSubmissions": false + "ManageRegistrationSubmissions": false, + "RegulatorFE": false }, "PaymentFacadeApi": { "BaseUrl": "", From cc7fa5437eee62553136f14c1879af1939521fac Mon Sep 17 00:00:00 2001 From: Fahad Ali Date: Thu, 9 Jan 2025 12:24:25 +0000 Subject: [PATCH 12/20] Feature Flag name changed --- src/EPR.RegulatorService.Frontend.Web/Configs/FeatureFlags.cs | 2 +- .../Views/Shared/Partials/_RegulatorRegistrationFilters.cshtml | 2 +- .../Views/Shared/Partials/_RegulatorSubmissionFilters.cshtml | 2 +- src/EPR.RegulatorService.Frontend.Web/appsettings.json | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/EPR.RegulatorService.Frontend.Web/Configs/FeatureFlags.cs b/src/EPR.RegulatorService.Frontend.Web/Configs/FeatureFlags.cs index d092836e..2313bc1a 100644 --- a/src/EPR.RegulatorService.Frontend.Web/Configs/FeatureFlags.cs +++ b/src/EPR.RegulatorService.Frontend.Web/Configs/FeatureFlags.cs @@ -19,5 +19,5 @@ public static class FeatureFlags public const string ManageRegistrationSubmissions = "ManageRegistrationSubmissions"; - public const string RegulatorFE = "RegulatorFE"; + public const string MultiFeatureChanges = "MultiFeatureChanges"; } \ No newline at end of file diff --git a/src/EPR.RegulatorService.Frontend.Web/Views/Shared/Partials/_RegulatorRegistrationFilters.cshtml b/src/EPR.RegulatorService.Frontend.Web/Views/Shared/Partials/_RegulatorRegistrationFilters.cshtml index 639d6f37..e1323260 100644 --- a/src/EPR.RegulatorService.Frontend.Web/Views/Shared/Partials/_RegulatorRegistrationFilters.cshtml +++ b/src/EPR.RegulatorService.Frontend.Web/Views/Shared/Partials/_RegulatorRegistrationFilters.cshtml @@ -155,7 +155,7 @@ } @Html.Hidden("isFilteredSearch", true) - + diff --git a/src/EPR.RegulatorService.Frontend.Web/Views/Shared/Partials/_RegulatorSubmissionFilters.cshtml b/src/EPR.RegulatorService.Frontend.Web/Views/Shared/Partials/_RegulatorSubmissionFilters.cshtml index 659c82b9..37817e69 100644 --- a/src/EPR.RegulatorService.Frontend.Web/Views/Shared/Partials/_RegulatorSubmissionFilters.cshtml +++ b/src/EPR.RegulatorService.Frontend.Web/Views/Shared/Partials/_RegulatorSubmissionFilters.cshtml @@ -154,7 +154,7 @@ } @Html.Hidden("isFilteredSearch", true) - + diff --git a/src/EPR.RegulatorService.Frontend.Web/appsettings.json b/src/EPR.RegulatorService.Frontend.Web/appsettings.json index 0aec6819..53114bea 100644 --- a/src/EPR.RegulatorService.Frontend.Web/appsettings.json +++ b/src/EPR.RegulatorService.Frontend.Web/appsettings.json @@ -149,7 +149,7 @@ "PomDataPeriodAndTime": true, "RegistrationDataPeriodAndTime": true, "ManageRegistrationSubmissions": false, - "RegulatorFE": false + "MultiFeatureChanges": false }, "PaymentFacadeApi": { "BaseUrl": "", From 8f3ec1ad399862eb88e2f80c37ff6fe69d5cae59 Mon Sep 17 00:00:00 2001 From: Fahad Ali Date: Thu, 9 Jan 2025 14:49:09 +0000 Subject: [PATCH 13/20] feature flag added --- .../Partials/_ResubmissionDetails.cshtml | 249 ++++++++-------- .../Shared/Partials/_SubmissionDetails.cshtml | 267 +++++++++--------- 2 files changed, 261 insertions(+), 255 deletions(-) diff --git a/src/EPR.RegulatorService.Frontend.Web/Views/Shared/Partials/_ResubmissionDetails.cshtml b/src/EPR.RegulatorService.Frontend.Web/Views/Shared/Partials/_ResubmissionDetails.cshtml index b489cbdd..40982fa0 100644 --- a/src/EPR.RegulatorService.Frontend.Web/Views/Shared/Partials/_ResubmissionDetails.cshtml +++ b/src/EPR.RegulatorService.Frontend.Web/Views/Shared/Partials/_ResubmissionDetails.cshtml @@ -4,8 +4,8 @@ @using (Html.BeginForm("SubmissionDetails", "Submissions", FormMethod.Post)) { -
-
+
+

@Localizer["SummaryList.Title"] @if (!string.IsNullOrEmpty(Model.SubmissionPeriod)) @@ -14,143 +14,146 @@ @Localizer["SummaryList.ReSubmissionPeriodSuffix"] }

-
    -
  • - @switch (Model.Status) - { - case SubmissionStatus.Pending: - @SharedLocalizer["Tag.Pending"] - break; - case SubmissionStatus.Accepted: - @SharedLocalizer["Tag.Accepted"] - break; - case SubmissionStatus.Rejected: - @SharedLocalizer["Tag.Rejected"] - break; - } -
  • -
-
-
-
-
-
- @Localizer["SummaryList.SubTitle.TimeAndDateOfSubmission"] -
-
- @Model.FormattedTimeAndDateOfSubmission -
-
+
    +
  • + @switch (Model.Status) + { + case SubmissionStatus.Pending: + @SharedLocalizer["Tag.Pending"] + break; + case SubmissionStatus.Accepted: + @SharedLocalizer["Tag.Accepted"] + break; + case SubmissionStatus.Rejected: + @SharedLocalizer["Tag.Rejected"] + break; + } +
  • +
+
+
+
+
+
+ @Localizer["SummaryList.SubTitle.TimeAndDateOfSubmission"] +
+
+ @Model.FormattedTimeAndDateOfSubmission +
+
+ +
+
+ @Localizer["SummaryList.SubTitle.SubmittedBy"] +
+
+ @Model.SubmittedBy +
+
-
-
- @Localizer["SummaryList.SubTitle.SubmittedBy"] -
-
- @Model.SubmittedBy -
-
+
+
+ @Localizer["SummaryList.SubTitle.AccountRole"] +
+
+ @if (Model.AccountRole.Equals("Approved Person")) + { + @SharedLocalizer["Tag.ApprovedPerson"] + } + else + { + @SharedLocalizer["Tag.DelegatedPerson"] + } +
+
-
-
- @Localizer["SummaryList.SubTitle.AccountRole"] -
-
- @if (Model.AccountRole.Equals("Approved Person")) - { - @SharedLocalizer["Tag.ApprovedPerson"] - } - else - { - @SharedLocalizer["Tag.DelegatedPerson"] - } -
-
+
+
+ @Localizer["SummaryList.SubTitle.Telephone"] +
+
+ @Model.Telephone +
+
-
-
- @Localizer["SummaryList.SubTitle.Telephone"] -
-
- @Model.Telephone -
-
+
+
+ @Localizer["SummaryList.SubTitle.Email"] +
+
+ @Model.Email +
+
+ + @if (!string.IsNullOrEmpty(Model.SubmissionFileName)) + { +
+
+ @Localizer["SummaryList.PackagingData"] +
+
+ @Model.SubmissionFileName +
+ +
+ } +
-
-
- @Localizer["SummaryList.SubTitle.Email"] -
-
- @Model.Email -
-
- @if (!string.IsNullOrEmpty(Model.SubmissionFileName)) + @if (!string.IsNullOrEmpty(Model.PreviousRejectionComments) && Model.Status != SubmissionStatus.Accepted) {
- @Localizer["SummaryList.PackagingData"] + @Localizer["SummaryList.SubTitle.ReasonForRejection"]
- @Model.SubmissionFileName + @Model.PreviousRejectionComments
-
+ } + + @if (Model.Status == SubmissionStatus.Rejected) + { +
+
+ @Localizer["SummaryList.SubTitle.ResubmissionRequired"] +
+
+ @if (Model.ResubmissionRequired) + { + @SharedLocalizer["Yes"] + } + else + { + @SharedLocalizer["No"] + }
} - @if (!string.IsNullOrEmpty(Model.PreviousRejectionComments) && Model.Status != SubmissionStatus.Accepted) - { -
-
- @Localizer["SummaryList.SubTitle.ReasonForRejection"] -
-
- @Model.PreviousRejectionComments -
-
- } - @if (Model.Status == SubmissionStatus.Rejected) - { -
-
- @Localizer["SummaryList.SubTitle.ResubmissionRequired"] -
-
- @if (Model.ResubmissionRequired) - { - @SharedLocalizer["Yes"] - } - else +
+ @if (Model.Status == EnrolmentStatus.Pending) { - @SharedLocalizer["No"] +
@Localizer["SummaryList.Information.Text", Model.OrganisationName]
+
+ + + + +
} -
- } - - - @if (Model.Status == EnrolmentStatus.Pending) - { -
@Localizer["SummaryList.Information.Text", Model.OrganisationName]
-
- - - - -
- } -
-
+
} diff --git a/src/EPR.RegulatorService.Frontend.Web/Views/Shared/Partials/_SubmissionDetails.cshtml b/src/EPR.RegulatorService.Frontend.Web/Views/Shared/Partials/_SubmissionDetails.cshtml index 905f74f6..2a2e83a3 100644 --- a/src/EPR.RegulatorService.Frontend.Web/Views/Shared/Partials/_SubmissionDetails.cshtml +++ b/src/EPR.RegulatorService.Frontend.Web/Views/Shared/Partials/_SubmissionDetails.cshtml @@ -4,8 +4,8 @@ @using (Html.BeginForm("SubmissionDetails", "Submissions", FormMethod.Post)) { -
-
+
+

@Localizer["SummaryList.Title"] @if (!string.IsNullOrEmpty(Model.SubmissionPeriod)) @@ -14,145 +14,148 @@ @Localizer["SummaryList.SubmissionPeriodSuffix"] }

-
    -
  • - @switch (Model.Status) - { - case SubmissionStatus.Pending: - @SharedLocalizer["Tag.Pending"] - break; - case SubmissionStatus.Accepted: - @SharedLocalizer["Tag.Accepted"] - break; - case SubmissionStatus.Rejected: - @SharedLocalizer["Tag.Rejected"] - break; - } -
  • -
-
-
-
-
-
- @Localizer["SummaryList.SubTitle.TimeAndDateOfSubmission"] -
-
- @Model.FormattedTimeAndDateOfSubmission -
-
+
    +
  • + @switch (Model.Status) + { + case SubmissionStatus.Pending: + @SharedLocalizer["Tag.Pending"] + break; + case SubmissionStatus.Accepted: + @SharedLocalizer["Tag.Accepted"] + break; + case SubmissionStatus.Rejected: + @SharedLocalizer["Tag.Rejected"] + break; + } +
  • +
+
+
+
+
+
+ @Localizer["SummaryList.SubTitle.TimeAndDateOfSubmission"] +
+
+ @Model.FormattedTimeAndDateOfSubmission +
+
-
-
- @Localizer["SummaryList.SubTitle.SubmittedBy"] -
-
- @Model.SubmittedBy -
-
+
+
+ @Localizer["SummaryList.SubTitle.SubmittedBy"] +
+
+ @Model.SubmittedBy +
+
-
-
- @Localizer["SummaryList.SubTitle.AccountRole"] -
-
- @if (Model.AccountRole.Equals("Approved Person")) - { - @SharedLocalizer["Tag.ApprovedPerson"] - } - else - { - @SharedLocalizer["Tag.DelegatedPerson"] - } -
-
+
+
+ @Localizer["SummaryList.SubTitle.AccountRole"] +
+
+ @if (Model.AccountRole.Equals("Approved Person")) + { + @SharedLocalizer["Tag.ApprovedPerson"] + } + else + { + @SharedLocalizer["Tag.DelegatedPerson"] + } +
+
-
-
- @Localizer["SummaryList.SubTitle.Telephone"] -
-
- @Model.Telephone -
-
+
+
+ @Localizer["SummaryList.SubTitle.Telephone"] +
+
+ @Model.Telephone +
+
-
-
- @Localizer["SummaryList.SubTitle.Email"] -
-
- @Model.Email -
-
+
+
+ @Localizer["SummaryList.SubTitle.Email"] +
+
+ @Model.Email +
+
- @if (!string.IsNullOrEmpty(Model.SubmissionFileName)) - { -
-
- @Localizer["SummaryList.PackagingData"] -
-
- @Model.SubmissionFileName -
-
+ @Localizer["SummaryList.PackagingData"] +
+
+ @Model.SubmissionFileName +
+ -
- } + +
+ } + - @if (!string.IsNullOrEmpty(Model.RejectionReason) && Model.Status != SubmissionStatus.Accepted) - { -
-
- @Localizer["SummaryList.SubTitle.ReasonForRejection"] -
-
- @Model.RejectionReason -
-
- } - @if (Model.Status == SubmissionStatus.Rejected) - { -
-
- @Localizer["SummaryList.SubTitle.ResubmissionRequired"] -
-
- @if (Model.ResubmissionRequired ) - { - @SharedLocalizer["Yes"] - } - else + @if (!string.IsNullOrEmpty(Model.RejectionReason) && Model.Status != SubmissionStatus.Accepted) + { +
+
+ @Localizer["SummaryList.SubTitle.ReasonForRejection"] +
+
+ @Model.RejectionReason +
+
+ } + + @if (Model.Status == SubmissionStatus.Rejected) + { +
+
+ @Localizer["SummaryList.SubTitle.ResubmissionRequired"] +
+
+ @if (Model.ResubmissionRequired) + { + @SharedLocalizer["Yes"] + } + else + { + @SharedLocalizer["No"] + } +
+
+ } + + + @if (Model.Status == EnrolmentStatus.Pending) { - @SharedLocalizer["No"] +
@Localizer["SummaryList.Information.Text", Model.OrganisationName]
+
+ + + + +
} -
- } - - - @if (Model.Status == EnrolmentStatus.Pending) - { -
@Localizer["SummaryList.Information.Text", Model.OrganisationName]
-
- - - - -
- } -
-
+
} From d28bd8d4da4b0f7e2f24de9e030d3400556c3ae6 Mon Sep 17 00:00:00 2001 From: Fahad Ali Date: Fri, 10 Jan 2025 10:24:18 +0000 Subject: [PATCH 14/20] feature flag name changed --- src/EPR.RegulatorService.Frontend.Web/Configs/FeatureFlags.cs | 2 +- .../Views/Shared/Partials/_RegulatorRegistrationFilters.cshtml | 2 +- .../Views/Shared/Partials/_RegulatorSubmissionFilters.cshtml | 2 +- .../Views/Shared/Partials/_ResubmissionDetails.cshtml | 2 +- .../Views/Shared/Partials/_SubmissionDetails.cshtml | 2 +- src/EPR.RegulatorService.Frontend.Web/appsettings.json | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/EPR.RegulatorService.Frontend.Web/Configs/FeatureFlags.cs b/src/EPR.RegulatorService.Frontend.Web/Configs/FeatureFlags.cs index 2313bc1a..664129df 100644 --- a/src/EPR.RegulatorService.Frontend.Web/Configs/FeatureFlags.cs +++ b/src/EPR.RegulatorService.Frontend.Web/Configs/FeatureFlags.cs @@ -19,5 +19,5 @@ public static class FeatureFlags public const string ManageRegistrationSubmissions = "ManageRegistrationSubmissions"; - public const string MultiFeatureChanges = "MultiFeatureChanges"; + public const string EnableCsvDownload = "EnableCsvDownload"; } \ No newline at end of file diff --git a/src/EPR.RegulatorService.Frontend.Web/Views/Shared/Partials/_RegulatorRegistrationFilters.cshtml b/src/EPR.RegulatorService.Frontend.Web/Views/Shared/Partials/_RegulatorRegistrationFilters.cshtml index e1323260..9a6df510 100644 --- a/src/EPR.RegulatorService.Frontend.Web/Views/Shared/Partials/_RegulatorRegistrationFilters.cshtml +++ b/src/EPR.RegulatorService.Frontend.Web/Views/Shared/Partials/_RegulatorRegistrationFilters.cshtml @@ -155,7 +155,7 @@ } @Html.Hidden("isFilteredSearch", true) - + diff --git a/src/EPR.RegulatorService.Frontend.Web/Views/Shared/Partials/_RegulatorSubmissionFilters.cshtml b/src/EPR.RegulatorService.Frontend.Web/Views/Shared/Partials/_RegulatorSubmissionFilters.cshtml index 37817e69..c11a5357 100644 --- a/src/EPR.RegulatorService.Frontend.Web/Views/Shared/Partials/_RegulatorSubmissionFilters.cshtml +++ b/src/EPR.RegulatorService.Frontend.Web/Views/Shared/Partials/_RegulatorSubmissionFilters.cshtml @@ -154,7 +154,7 @@ } @Html.Hidden("isFilteredSearch", true) - + diff --git a/src/EPR.RegulatorService.Frontend.Web/Views/Shared/Partials/_ResubmissionDetails.cshtml b/src/EPR.RegulatorService.Frontend.Web/Views/Shared/Partials/_ResubmissionDetails.cshtml index 40982fa0..6bd4037c 100644 --- a/src/EPR.RegulatorService.Frontend.Web/Views/Shared/Partials/_ResubmissionDetails.cshtml +++ b/src/EPR.RegulatorService.Frontend.Web/Views/Shared/Partials/_ResubmissionDetails.cshtml @@ -84,7 +84,7 @@ @Model.Email
- + @if (!string.IsNullOrEmpty(Model.SubmissionFileName)) {
diff --git a/src/EPR.RegulatorService.Frontend.Web/Views/Shared/Partials/_SubmissionDetails.cshtml b/src/EPR.RegulatorService.Frontend.Web/Views/Shared/Partials/_SubmissionDetails.cshtml index 2a2e83a3..846357c8 100644 --- a/src/EPR.RegulatorService.Frontend.Web/Views/Shared/Partials/_SubmissionDetails.cshtml +++ b/src/EPR.RegulatorService.Frontend.Web/Views/Shared/Partials/_SubmissionDetails.cshtml @@ -85,7 +85,7 @@
- + @if (!string.IsNullOrEmpty(Model.SubmissionFileName)) {
diff --git a/src/EPR.RegulatorService.Frontend.Web/appsettings.json b/src/EPR.RegulatorService.Frontend.Web/appsettings.json index 53114bea..5593fcf9 100644 --- a/src/EPR.RegulatorService.Frontend.Web/appsettings.json +++ b/src/EPR.RegulatorService.Frontend.Web/appsettings.json @@ -149,7 +149,7 @@ "PomDataPeriodAndTime": true, "RegistrationDataPeriodAndTime": true, "ManageRegistrationSubmissions": false, - "MultiFeatureChanges": false + "EnableCsvDownload": false }, "PaymentFacadeApi": { "BaseUrl": "", From c9d6163388c3e0838055943ec8a8008e52500ea8 Mon Sep 17 00:00:00 2001 From: Idris Abu Date: Fri, 10 Jan 2025 19:16:14 +0000 Subject: [PATCH 15/20] Various UI changes --- .../Sessions/RejectSubmissionJourneyData.cs | 1 + .../Submissions/SubmissionsController.cs | 11 +- .../Resources/SharedResources.cy.resx | 5 +- .../_PomFileIsDownloadingVirusError.en.resx | 6 +- .../Partials/_ResubmissionDetails.cy.resx | 2 +- .../Partials/_SubmissionDetails.cy.resx | 2 +- .../Submissions/RejectSubmission.cy.resx | 3 + .../Submissions/RejectSubmission.en.resx | 3 + .../Submissions/SubmissionDetails.cy.resx | 3 + .../Submissions/SubmissionDetails.en.resx | 5 +- .../Submissions/RejectSubmissionViewModel.cs | 15 +- .../_PomFileIsDownloadingVirusError.cshtml | 1 + .../Shared/Partials/_SubmissionDetails.cshtml | 3 +- .../Views/Submissions/RejectSubmission.cshtml | 201 ++++++++++-------- .../Submissions/SubmissionDetails.cshtml | 2 +- 15 files changed, 155 insertions(+), 108 deletions(-) diff --git a/src/EPR.RegulatorService.Frontend.Core/Sessions/RejectSubmissionJourneyData.cs b/src/EPR.RegulatorService.Frontend.Core/Sessions/RejectSubmissionJourneyData.cs index cee17c24..386fc10e 100644 --- a/src/EPR.RegulatorService.Frontend.Core/Sessions/RejectSubmissionJourneyData.cs +++ b/src/EPR.RegulatorService.Frontend.Core/Sessions/RejectSubmissionJourneyData.cs @@ -3,4 +3,5 @@ namespace EPR.RegulatorService.Frontend.Core.Sessions; public class RejectSubmissionJourneyData { public string? SubmittedBy { get; set; } + public bool SubmissionRejected { get; set; } = false; } \ No newline at end of file diff --git a/src/EPR.RegulatorService.Frontend.Web/Controllers/Submissions/SubmissionsController.cs b/src/EPR.RegulatorService.Frontend.Web/Controllers/Submissions/SubmissionsController.cs index a3813b76..f622da26 100644 --- a/src/EPR.RegulatorService.Frontend.Web/Controllers/Submissions/SubmissionsController.cs +++ b/src/EPR.RegulatorService.Frontend.Web/Controllers/Submissions/SubmissionsController.cs @@ -211,7 +211,7 @@ public async Task SubmissionDetails() [HttpPost] [Route(PagePath.SubmissionDetails)] - public async Task SubmissionDetails(SubmissionDetailsViewModel model, string journeyType) + public async Task SubmissionDetails(SubmissionDetailsViewModel model, string journeyType, bool submissionRejected = false) { var session = await _sessionManager.GetSessionAsync(HttpContext.Session); @@ -227,7 +227,8 @@ public async Task SubmissionDetails(SubmissionDetailsViewModel mo session.RegulatorSubmissionSession.RejectSubmissionJourneyData = new RejectSubmissionJourneyData { - SubmittedBy = model.SubmittedBy + SubmittedBy = model.SubmittedBy, + SubmissionRejected = submissionRejected }; return await SaveSessionAndRedirect( @@ -296,6 +297,7 @@ public async Task AcceptSubmission(AcceptSubmissionViewModel mode return RedirectToAction("SubmissionDetails", "Submissions"); } + [HttpGet] [Route(PagePath.RejectSubmission)] public async Task RejectSubmission() @@ -304,7 +306,8 @@ public async Task RejectSubmission() var rejectSubmissionJourneyData = session.RegulatorSubmissionSession.RejectSubmissionJourneyData; var model = new RejectSubmissionViewModel { - SubmittedBy = rejectSubmissionJourneyData.SubmittedBy + SubmittedBy = rejectSubmissionJourneyData.SubmittedBy, + SubmissionRejected = rejectSubmissionJourneyData.SubmissionRejected }; await SaveSessionAndJourney(session, PagePath.SubmissionDetails, PagePath.RejectSubmission); @@ -313,6 +316,7 @@ public async Task RejectSubmission() return View(nameof(RejectSubmission), model); } + [HttpPost] [Route(PagePath.RejectSubmission)] public async Task RejectSubmission(RejectSubmissionViewModel model) @@ -323,6 +327,7 @@ public async Task RejectSubmission(RejectSubmissionViewModel mode if (!ModelState.IsValid) { model.SubmittedBy = session.RegulatorSubmissionSession.RejectSubmissionJourneyData.SubmittedBy; + model.SubmissionRejected = session.RegulatorSubmissionSession.RejectSubmissionJourneyData.SubmissionRejected; SetBackLink(session, PagePath.RejectSubmission); return View(nameof(RejectSubmission), model); diff --git a/src/EPR.RegulatorService.Frontend.Web/Resources/SharedResources.cy.resx b/src/EPR.RegulatorService.Frontend.Web/Resources/SharedResources.cy.resx index ff583f8b..bb3ca6f0 100644 --- a/src/EPR.RegulatorService.Frontend.Web/Resources/SharedResources.cy.resx +++ b/src/EPR.RegulatorService.Frontend.Web/Resources/SharedResources.cy.resx @@ -346,6 +346,9 @@ W Export - W Reject submission + Gwrthod y cyflwyniad + + + W Try Again diff --git a/src/EPR.RegulatorService.Frontend.Web/Resources/Views/Shared/Partials/_PomFileIsDownloadingVirusError.en.resx b/src/EPR.RegulatorService.Frontend.Web/Resources/Views/Shared/Partials/_PomFileIsDownloadingVirusError.en.resx index 72998e4d..bd1c6a98 100644 --- a/src/EPR.RegulatorService.Frontend.Web/Resources/Views/Shared/Partials/_PomFileIsDownloadingVirusError.en.resx +++ b/src/EPR.RegulatorService.Frontend.Web/Resources/Views/Shared/Partials/_PomFileIsDownloadingVirusError.en.resx @@ -99,13 +99,13 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - This file can not be downloaded. + This file cannot be downloaded. - What you need to do next. + What you need to do next - You need to reject the organisation details submission and instruct the producer or compliance scheme to resubmit their organisation details. + You will need to reject the packaging data submission and instruct the <br /> producer or compliance scheme to resubmit their packaging details. There is a problem with this file diff --git a/src/EPR.RegulatorService.Frontend.Web/Resources/Views/Shared/Partials/_ResubmissionDetails.cy.resx b/src/EPR.RegulatorService.Frontend.Web/Resources/Views/Shared/Partials/_ResubmissionDetails.cy.resx index e61c44d9..acea19be 100644 --- a/src/EPR.RegulatorService.Frontend.Web/Resources/Views/Shared/Partials/_ResubmissionDetails.cy.resx +++ b/src/EPR.RegulatorService.Frontend.Web/Resources/Views/Shared/Partials/_ResubmissionDetails.cy.resx @@ -46,6 +46,6 @@ Chaiff {0} ddim ailgyflwyno nes bod y cyflwyniad yma wedi’i weithredu. - W Packaging data + Data pecynwaith diff --git a/src/EPR.RegulatorService.Frontend.Web/Resources/Views/Shared/Partials/_SubmissionDetails.cy.resx b/src/EPR.RegulatorService.Frontend.Web/Resources/Views/Shared/Partials/_SubmissionDetails.cy.resx index 11fe244e..ad93e232 100644 --- a/src/EPR.RegulatorService.Frontend.Web/Resources/Views/Shared/Partials/_SubmissionDetails.cy.resx +++ b/src/EPR.RegulatorService.Frontend.Web/Resources/Views/Shared/Partials/_SubmissionDetails.cy.resx @@ -46,6 +46,6 @@ Chaiff {0} ddim ailgyflwyno nes bod y cyflwyniad yma wedi’i weithredu. - W Packaging data + Data pecynwaith diff --git a/src/EPR.RegulatorService.Frontend.Web/Resources/Views/Submissions/RejectSubmission.cy.resx b/src/EPR.RegulatorService.Frontend.Web/Resources/Views/Submissions/RejectSubmission.cy.resx index 8a1a7da9..ad95c12a 100644 --- a/src/EPR.RegulatorService.Frontend.Web/Resources/Views/Submissions/RejectSubmission.cy.resx +++ b/src/EPR.RegulatorService.Frontend.Web/Resources/Views/Submissions/RejectSubmission.cy.resx @@ -139,4 +139,7 @@ gwrthod y cyflwyniad yma Dewiswch ‘Oes’ os oes arnoch chi angen ailgyflwyniad + + Byddwn ni'n defnyddio'r wybodaeth yma mewn neges ebost at y bobl a gymeradwywyd a'r bobl a ddirprwywyd gan y sefydliad. Caiff ei hychwanegu hefyd at fanylion y cyflwyniad. + diff --git a/src/EPR.RegulatorService.Frontend.Web/Resources/Views/Submissions/RejectSubmission.en.resx b/src/EPR.RegulatorService.Frontend.Web/Resources/Views/Submissions/RejectSubmission.en.resx index f5bd4e69..40524381 100644 --- a/src/EPR.RegulatorService.Frontend.Web/Resources/Views/Submissions/RejectSubmission.en.resx +++ b/src/EPR.RegulatorService.Frontend.Web/Resources/Views/Submissions/RejectSubmission.en.resx @@ -138,4 +138,7 @@ Select yes if you require a resubmission + + We'll use this information in an email to the organisation's approved and delegated people. It will also be added to the submission details. + diff --git a/src/EPR.RegulatorService.Frontend.Web/Resources/Views/Submissions/SubmissionDetails.cy.resx b/src/EPR.RegulatorService.Frontend.Web/Resources/Views/Submissions/SubmissionDetails.cy.resx index 5cc19ebb..c95a8bab 100644 --- a/src/EPR.RegulatorService.Frontend.Web/Resources/Views/Submissions/SubmissionDetails.cy.resx +++ b/src/EPR.RegulatorService.Frontend.Web/Resources/Views/Submissions/SubmissionDetails.cy.resx @@ -138,4 +138,7 @@ Yn ôl i bob cais + + Power BI + diff --git a/src/EPR.RegulatorService.Frontend.Web/Resources/Views/Submissions/SubmissionDetails.en.resx b/src/EPR.RegulatorService.Frontend.Web/Resources/Views/Submissions/SubmissionDetails.en.resx index dc67d6ce..4d542d65 100644 --- a/src/EPR.RegulatorService.Frontend.Web/Resources/Views/Submissions/SubmissionDetails.en.resx +++ b/src/EPR.RegulatorService.Frontend.Web/Resources/Views/Submissions/SubmissionDetails.en.resx @@ -132,10 +132,13 @@ Packaging data + + Power BI + To view a summary of the packaging data and any previous submissions, Go back to all submissions - \ No newline at end of file + diff --git a/src/EPR.RegulatorService.Frontend.Web/ViewModels/Submissions/RejectSubmissionViewModel.cs b/src/EPR.RegulatorService.Frontend.Web/ViewModels/Submissions/RejectSubmissionViewModel.cs index e998d48e..f2bfc1d9 100644 --- a/src/EPR.RegulatorService.Frontend.Web/ViewModels/Submissions/RejectSubmissionViewModel.cs +++ b/src/EPR.RegulatorService.Frontend.Web/ViewModels/Submissions/RejectSubmissionViewModel.cs @@ -3,14 +3,25 @@ namespace EPR.RegulatorService.Frontend.Web.ViewModels.Submissions { - public class RejectSubmissionViewModel + public class RejectSubmissionViewModel : IValidatableObject { public string? SubmittedBy { get; set; } + public bool SubmissionRejected { get; set; } [CharacterCount("Error.RejectionReason", "Error.RejectionReasonTooLong", 500)] public string? ReasonForRejection { get; set; } - [Required(ErrorMessage = "Error.ResubmissionRequired")] public bool? IsResubmissionRequired { get; set; } + + public IEnumerable Validate(ValidationContext validationContext) + { + if (SubmissionRejected && IsResubmissionRequired == null) + { + yield return new ValidationResult( + "Error.ResubmissionRequired", + new[] { nameof(IsResubmissionRequired) } + ); + } + } } } diff --git a/src/EPR.RegulatorService.Frontend.Web/Views/Shared/Partials/_PomFileIsDownloadingVirusError.cshtml b/src/EPR.RegulatorService.Frontend.Web/Views/Shared/Partials/_PomFileIsDownloadingVirusError.cshtml index 8549f0af..1c8787c3 100644 --- a/src/EPR.RegulatorService.Frontend.Web/Views/Shared/Partials/_PomFileIsDownloadingVirusError.cshtml +++ b/src/EPR.RegulatorService.Frontend.Web/Views/Shared/Partials/_PomFileIsDownloadingVirusError.cshtml @@ -5,6 +5,7 @@ + diff --git a/src/EPR.RegulatorService.Frontend.Web/Views/Shared/Partials/_SubmissionDetails.cshtml b/src/EPR.RegulatorService.Frontend.Web/Views/Shared/Partials/_SubmissionDetails.cshtml index 2a2e83a3..f45552f2 100644 --- a/src/EPR.RegulatorService.Frontend.Web/Views/Shared/Partials/_SubmissionDetails.cshtml +++ b/src/EPR.RegulatorService.Frontend.Web/Views/Shared/Partials/_SubmissionDetails.cshtml @@ -103,9 +103,10 @@ { packagingDataSubmissionBlobName = Model.SubmissionBlobName }) -
+
+ }
diff --git a/src/EPR.RegulatorService.Frontend.Web/Views/Submissions/RejectSubmission.cshtml b/src/EPR.RegulatorService.Frontend.Web/Views/Submissions/RejectSubmission.cshtml index a4eac662..6b3c3fd2 100644 --- a/src/EPR.RegulatorService.Frontend.Web/Views/Submissions/RejectSubmission.cshtml +++ b/src/EPR.RegulatorService.Frontend.Web/Views/Submissions/RejectSubmission.cshtml @@ -15,103 +15,116 @@ @using (Html.BeginForm("RejectSubmission", "Submissions", FormMethod.Post)) { -
-
-
-
- @if (!ViewData.ModelState.IsValid) - { - @await Html.PartialAsync("Partials/Govuk/_ErrorSummary", errorsViewModel) - } -

@Localizer["RejectSubmission.Title"]

-

@Localizer["Description.Title", Model.SubmittedBy]

-
-
+
+
-
-
-
-
-

- -

- @if (reasonForRejectionErrorExists) - { - @await Html.PartialAsync("Partials/Govuk/_InlineError", reasonForRejectionError) - } - -
-
- You can enter up to 500 characters -
-
-
-
+ @if (!Model.SubmissionRejected) + { +
+
+ @if (!ViewData.ModelState.IsValid) + { + @await Html.PartialAsync("Partials/Govuk/_ErrorSummary", errorsViewModel) + } +

@Localizer["RejectSubmission.Title"]

+

@Localizer["Description.Title", Model.SubmittedBy]

+
+
+ } -
-
-
-
- -

- @Localizer["Subtitle.ResubmissionRequired"] -

-
- @if (isResubmissionErrorExists) - { - @await Html.PartialAsync("Partials/Govuk/_InlineError", isResubmissionError) - } -
-
- - + +
+
+
+
+

+ +

+ @if (Model.SubmissionRejected) + { +

@Localizer["RejectSubmission.UseOfInfoExplanation"]

+ } + @if (reasonForRejectionErrorExists) + { + @await Html.PartialAsync("Partials/Govuk/_InlineError", reasonForRejectionError) + } + +
+
+ You can enter up to 500 characters +
+
-
- - +
+ + @if (!Model.SubmissionRejected) + { +
+
+
+
+ +

+ @Localizer["Subtitle.ResubmissionRequired"] +

+
+ @if (isResubmissionErrorExists) + { + @await Html.PartialAsync("Partials/Govuk/_InlineError", isResubmissionError) + } +
+
+ + +
+
+ + +
+
+
+
+
-
-
-
-
-
-
-
- - @Html.ActionLink(SharedLocalizer["Cancel"], - "SubmissionDetails", - "Submissions", - null, - new { @class = "govuk-body govuk-link govuk-link--no-visited-state epr-horizontal-control epr-horizontal-control-link" }) -
-
-
-
+ } + +
+
+ + @Html.ActionLink(SharedLocalizer["Cancel"], + "SubmissionDetails", + "Submissions", + null, + new { @class = "govuk-body govuk-link govuk-link--no-visited-state epr-horizontal-control epr-horizontal-control-link" }) +
+
+
+
} diff --git a/src/EPR.RegulatorService.Frontend.Web/Views/Submissions/SubmissionDetails.cshtml b/src/EPR.RegulatorService.Frontend.Web/Views/Submissions/SubmissionDetails.cshtml index cdd2f5a8..c9a10607 100644 --- a/src/EPR.RegulatorService.Frontend.Web/Views/Submissions/SubmissionDetails.cshtml +++ b/src/EPR.RegulatorService.Frontend.Web/Views/Submissions/SubmissionDetails.cshtml @@ -34,7 +34,7 @@

@Model.OrganisationReferenceNumber

-

@Localizer["SubTitle.PackagingData"]

+

@Localizer["SubTitle.PowerBI"]

@Localizer["SubTitle.PackagingData.Text"] @SharedLocalizer["Link.LogIntoPowerBI"].

From 33653384f5280810ed35c4cf6e75dc3239fb9d30 Mon Sep 17 00:00:00 2001 From: Idris Abu Date: Mon, 13 Jan 2025 09:41:54 +0000 Subject: [PATCH 16/20] Changes to improve test coverage --- .../Web/Controllers/SubmissionControllerTests.cs | 16 ++++++++++++++++ .../Submissions/RejectSubmissionViewModel.cs | 2 ++ 2 files changed, 18 insertions(+) diff --git a/src/EPR.RegulatorService.Frontend.UnitTests/Web/Controllers/SubmissionControllerTests.cs b/src/EPR.RegulatorService.Frontend.UnitTests/Web/Controllers/SubmissionControllerTests.cs index 0a4de204..e63b1bd8 100644 --- a/src/EPR.RegulatorService.Frontend.UnitTests/Web/Controllers/SubmissionControllerTests.cs +++ b/src/EPR.RegulatorService.Frontend.UnitTests/Web/Controllers/SubmissionControllerTests.cs @@ -747,5 +747,21 @@ public void FormatTimeAndDateForSubmission_ReturnsCorrectFormat_LeapYear() // Assert result.Should().Be(expectedOutput); } + + [TestMethod] + public async Task Submissions_GetSessionIsNull_CreatesNewSessionAndReturnsView() + { + // Arrange + _sessionManagerMock.Setup(m => m.GetSessionAsync(It.IsAny())).ReturnsAsync((JourneySession)null); + + // Act + var result = await _systemUnderTest.Submissions(); + + // Assert + Assert.IsNotNull(result); + var viewResult = result as ViewResult; + Assert.IsNotNull(viewResult); + Assert.IsInstanceOfType(viewResult.Model, typeof(SubmissionsViewModel)); + } } } \ No newline at end of file diff --git a/src/EPR.RegulatorService.Frontend.Web/ViewModels/Submissions/RejectSubmissionViewModel.cs b/src/EPR.RegulatorService.Frontend.Web/ViewModels/Submissions/RejectSubmissionViewModel.cs index f2bfc1d9..e6b51afa 100644 --- a/src/EPR.RegulatorService.Frontend.Web/ViewModels/Submissions/RejectSubmissionViewModel.cs +++ b/src/EPR.RegulatorService.Frontend.Web/ViewModels/Submissions/RejectSubmissionViewModel.cs @@ -1,8 +1,10 @@ using EPR.RegulatorService.Frontend.Web.Attributes; using System.ComponentModel.DataAnnotations; +using System.Diagnostics.CodeAnalysis; namespace EPR.RegulatorService.Frontend.Web.ViewModels.Submissions { + [ExcludeFromCodeCoverage] public class RejectSubmissionViewModel : IValidatableObject { public string? SubmittedBy { get; set; } From bde1fbb80a1c147c624e6662c23542cc79bec97e Mon Sep 17 00:00:00 2001 From: Idris Abu Date: Mon, 13 Jan 2025 14:59:40 +0000 Subject: [PATCH 17/20] Styling change --- .../Views/Submissions/RejectSubmission.cshtml | 2 +- .../assets/scss/application.scss | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/EPR.RegulatorService.Frontend.Web/Views/Submissions/RejectSubmission.cshtml b/src/EPR.RegulatorService.Frontend.Web/Views/Submissions/RejectSubmission.cshtml index 6b3c3fd2..090c87aa 100644 --- a/src/EPR.RegulatorService.Frontend.Web/Views/Submissions/RejectSubmission.cshtml +++ b/src/EPR.RegulatorService.Frontend.Web/Views/Submissions/RejectSubmission.cshtml @@ -122,7 +122,7 @@ "SubmissionDetails", "Submissions", null, - new { @class = "govuk-body govuk-link govuk-link--no-visited-state epr-horizontal-control epr-horizontal-control-link" }) + new { @class = "govuk-body govuk-link govuk-link--no-visited-state epr-horizontal-control epr-horizontal-control-link add-left-space" })
diff --git a/src/EPR.RegulatorService.Frontend.Web/assets/scss/application.scss b/src/EPR.RegulatorService.Frontend.Web/assets/scss/application.scss index 5794c1ec..ee4f5906 100644 --- a/src/EPR.RegulatorService.Frontend.Web/assets/scss/application.scss +++ b/src/EPR.RegulatorService.Frontend.Web/assets/scss/application.scss @@ -456,3 +456,7 @@ table.cookies-table { } } } + +.add-left-space { + margin-left: 20px; +} From 861abf182b78f472b22efe93ecc59bdc4f040083 Mon Sep 17 00:00:00 2001 From: Idris Abu Date: Tue, 14 Jan 2025 11:23:20 +0000 Subject: [PATCH 18/20] Changed 'Try Again' to 'Try again' --- .../Resources/SharedResources.cy.resx | 3 +++ .../Resources/SharedResources.en.resx | 3 +++ .../Shared/Partials/_PomFileNotDownloadingTryAgain.cshtml | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/EPR.RegulatorService.Frontend.Web/Resources/SharedResources.cy.resx b/src/EPR.RegulatorService.Frontend.Web/Resources/SharedResources.cy.resx index bb3ca6f0..8c623d38 100644 --- a/src/EPR.RegulatorService.Frontend.Web/Resources/SharedResources.cy.resx +++ b/src/EPR.RegulatorService.Frontend.Web/Resources/SharedResources.cy.resx @@ -351,4 +351,7 @@ W Try Again + + W Try again + diff --git a/src/EPR.RegulatorService.Frontend.Web/Resources/SharedResources.en.resx b/src/EPR.RegulatorService.Frontend.Web/Resources/SharedResources.en.resx index 97b79e9c..c6e528d5 100644 --- a/src/EPR.RegulatorService.Frontend.Web/Resources/SharedResources.en.resx +++ b/src/EPR.RegulatorService.Frontend.Web/Resources/SharedResources.en.resx @@ -258,6 +258,9 @@ Try Again + + Try again + Reject submission diff --git a/src/EPR.RegulatorService.Frontend.Web/Views/Shared/Partials/_PomFileNotDownloadingTryAgain.cshtml b/src/EPR.RegulatorService.Frontend.Web/Views/Shared/Partials/_PomFileNotDownloadingTryAgain.cshtml index a8d70720..6d77cad5 100644 --- a/src/EPR.RegulatorService.Frontend.Web/Views/Shared/Partials/_PomFileNotDownloadingTryAgain.cshtml +++ b/src/EPR.RegulatorService.Frontend.Web/Views/Shared/Partials/_PomFileNotDownloadingTryAgain.cshtml @@ -5,6 +5,6 @@ From ccdb938521da1d3be1a1b20383f8661b52ba9da8 Mon Sep 17 00:00:00 2001 From: Idris Abu Date: Tue, 14 Jan 2025 12:00:40 +0000 Subject: [PATCH 19/20] Changed 'Added translation for 'Try again' --- .../Resources/SharedResources.cy.resx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/EPR.RegulatorService.Frontend.Web/Resources/SharedResources.cy.resx b/src/EPR.RegulatorService.Frontend.Web/Resources/SharedResources.cy.resx index 8c623d38..729ac6b6 100644 --- a/src/EPR.RegulatorService.Frontend.Web/Resources/SharedResources.cy.resx +++ b/src/EPR.RegulatorService.Frontend.Web/Resources/SharedResources.cy.resx @@ -349,9 +349,9 @@ Gwrthod y cyflwyniad - W Try Again + Rhowch gynnig arall arni - W Try again + Rhowch gynnig arall arni From 86bb425b8ba4c143461e4c33b30a50d13d2588f3 Mon Sep 17 00:00:00 2001 From: Fahad Ali Date: Fri, 17 Jan 2025 20:22:20 +0000 Subject: [PATCH 20/20] changes in view reverted --- .../Sessions/RejectSubmissionJourneyData.cs | 1 - .../Submissions/SubmissionsController.cs | 7 +- .../Submissions/RejectSubmissionViewModel.cs | 15 +-- .../Views/Submissions/RejectSubmission.cshtml | 125 ++++++++---------- 4 files changed, 60 insertions(+), 88 deletions(-) diff --git a/src/EPR.RegulatorService.Frontend.Core/Sessions/RejectSubmissionJourneyData.cs b/src/EPR.RegulatorService.Frontend.Core/Sessions/RejectSubmissionJourneyData.cs index 386fc10e..cee17c24 100644 --- a/src/EPR.RegulatorService.Frontend.Core/Sessions/RejectSubmissionJourneyData.cs +++ b/src/EPR.RegulatorService.Frontend.Core/Sessions/RejectSubmissionJourneyData.cs @@ -3,5 +3,4 @@ namespace EPR.RegulatorService.Frontend.Core.Sessions; public class RejectSubmissionJourneyData { public string? SubmittedBy { get; set; } - public bool SubmissionRejected { get; set; } = false; } \ No newline at end of file diff --git a/src/EPR.RegulatorService.Frontend.Web/Controllers/Submissions/SubmissionsController.cs b/src/EPR.RegulatorService.Frontend.Web/Controllers/Submissions/SubmissionsController.cs index f622da26..6ba55371 100644 --- a/src/EPR.RegulatorService.Frontend.Web/Controllers/Submissions/SubmissionsController.cs +++ b/src/EPR.RegulatorService.Frontend.Web/Controllers/Submissions/SubmissionsController.cs @@ -211,7 +211,7 @@ public async Task SubmissionDetails() [HttpPost] [Route(PagePath.SubmissionDetails)] - public async Task SubmissionDetails(SubmissionDetailsViewModel model, string journeyType, bool submissionRejected = false) + public async Task SubmissionDetails(SubmissionDetailsViewModel model, string journeyType) { var session = await _sessionManager.GetSessionAsync(HttpContext.Session); @@ -228,7 +228,6 @@ public async Task SubmissionDetails(SubmissionDetailsViewModel mo session.RegulatorSubmissionSession.RejectSubmissionJourneyData = new RejectSubmissionJourneyData { SubmittedBy = model.SubmittedBy, - SubmissionRejected = submissionRejected }; return await SaveSessionAndRedirect( @@ -307,7 +306,6 @@ public async Task RejectSubmission() var model = new RejectSubmissionViewModel { SubmittedBy = rejectSubmissionJourneyData.SubmittedBy, - SubmissionRejected = rejectSubmissionJourneyData.SubmissionRejected }; await SaveSessionAndJourney(session, PagePath.SubmissionDetails, PagePath.RejectSubmission); @@ -327,8 +325,7 @@ public async Task RejectSubmission(RejectSubmissionViewModel mode if (!ModelState.IsValid) { model.SubmittedBy = session.RegulatorSubmissionSession.RejectSubmissionJourneyData.SubmittedBy; - model.SubmissionRejected = session.RegulatorSubmissionSession.RejectSubmissionJourneyData.SubmissionRejected; - + SetBackLink(session, PagePath.RejectSubmission); return View(nameof(RejectSubmission), model); } diff --git a/src/EPR.RegulatorService.Frontend.Web/ViewModels/Submissions/RejectSubmissionViewModel.cs b/src/EPR.RegulatorService.Frontend.Web/ViewModels/Submissions/RejectSubmissionViewModel.cs index e6b51afa..84241528 100644 --- a/src/EPR.RegulatorService.Frontend.Web/ViewModels/Submissions/RejectSubmissionViewModel.cs +++ b/src/EPR.RegulatorService.Frontend.Web/ViewModels/Submissions/RejectSubmissionViewModel.cs @@ -5,25 +5,14 @@ namespace EPR.RegulatorService.Frontend.Web.ViewModels.Submissions { [ExcludeFromCodeCoverage] - public class RejectSubmissionViewModel : IValidatableObject + public class RejectSubmissionViewModel { public string? SubmittedBy { get; set; } - public bool SubmissionRejected { get; set; } [CharacterCount("Error.RejectionReason", "Error.RejectionReasonTooLong", 500)] public string? ReasonForRejection { get; set; } + [Required(ErrorMessage = "Error.ResubmissionRequired")] public bool? IsResubmissionRequired { get; set; } - - public IEnumerable Validate(ValidationContext validationContext) - { - if (SubmissionRejected && IsResubmissionRequired == null) - { - yield return new ValidationResult( - "Error.ResubmissionRequired", - new[] { nameof(IsResubmissionRequired) } - ); - } - } } } diff --git a/src/EPR.RegulatorService.Frontend.Web/Views/Submissions/RejectSubmission.cshtml b/src/EPR.RegulatorService.Frontend.Web/Views/Submissions/RejectSubmission.cshtml index 090c87aa..36791c9e 100644 --- a/src/EPR.RegulatorService.Frontend.Web/Views/Submissions/RejectSubmission.cshtml +++ b/src/EPR.RegulatorService.Frontend.Web/Views/Submissions/RejectSubmission.cshtml @@ -17,21 +17,16 @@ {
- - @if (!Model.SubmissionRejected) - { -
-
- @if (!ViewData.ModelState.IsValid) - { - @await Html.PartialAsync("Partials/Govuk/_ErrorSummary", errorsViewModel) - } -

@Localizer["RejectSubmission.Title"]

-

@Localizer["Description.Title", Model.SubmittedBy]

-
+
+
+ @if (!ViewData.ModelState.IsValid) + { + @await Html.PartialAsync("Partials/Govuk/_ErrorSummary", errorsViewModel) + } +

@Localizer["RejectSubmission.Title"]

+

@Localizer["Description.Title", Model.SubmittedBy]

- } - +
@@ -42,10 +37,6 @@ @Localizer["Subtitle.RejectionReason"] - @if (Model.SubmissionRejected) - { -

@Localizer["RejectSubmission.UseOfInfoExplanation"]

- } @if (reasonForRejectionErrorExists) { @await Html.PartialAsync("Partials/Govuk/_InlineError", reasonForRejectionError) @@ -59,59 +50,55 @@
- @if (!Model.SubmissionRejected) - { -
-
-
-
- -

- @Localizer["Subtitle.ResubmissionRequired"] -

-
- @if (isResubmissionErrorExists) - { - @await Html.PartialAsync("Partials/Govuk/_InlineError", isResubmissionError) - } -
-
- - -
-
- - -
+
+
+
+
+ +

+ @Localizer["Subtitle.ResubmissionRequired"] +

+
+ @if (isResubmissionErrorExists) + { + @await Html.PartialAsync("Partials/Govuk/_InlineError", isResubmissionError) + } +
+
+ +
-
-
+
+ + +
+
+
- - } +
@@ -122,7 +109,7 @@ "SubmissionDetails", "Submissions", null, - new { @class = "govuk-body govuk-link govuk-link--no-visited-state epr-horizontal-control epr-horizontal-control-link add-left-space" }) + new { @class = "govuk-body govuk-link govuk-link--no-visited-state epr-horizontal-control epr-horizontal-control-link" })