From f32e105363bfb9f84bfdcbe8c638bdb9788ee784 Mon Sep 17 00:00:00 2001 From: OluwatobiAwe Date: Wed, 26 Oct 2022 08:09:28 +0100 Subject: [PATCH 1/2] TD 574 Fix --- .../Controllers/SupervisorController/Supervisor.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/DigitalLearningSolutions.Web/Controllers/SupervisorController/Supervisor.cs b/DigitalLearningSolutions.Web/Controllers/SupervisorController/Supervisor.cs index 06c2b6c612..0e4121958f 100644 --- a/DigitalLearningSolutions.Web/Controllers/SupervisorController/Supervisor.cs +++ b/DigitalLearningSolutions.Web/Controllers/SupervisorController/Supervisor.cs @@ -917,6 +917,13 @@ public IActionResult NominateSupervisor(int supervisorDelegateId, ReturnPageQuer var superviseDelegate = supervisorService.GetSupervisorDelegateDetailsById(supervisorDelegateId, GetAdminID(), 0); var model = new SupervisorDelegateViewModel(superviseDelegate, returnPageQuery); + if (TempData["NominateSupervisorError"] != null) + { + if (Convert.ToBoolean(TempData["NominateSupervisorError"].ToString())) + { + ModelState.AddModelError("ActionConfirmed", "Nominated supervisor not confirmed"); + } + } return View("NominateSupervisor", model); } [HttpPost] @@ -939,7 +946,9 @@ public IActionResult ConfirmNominateSupervisor(SupervisorDelegateViewModel super } else { - return View("NominateSupervisor", supervisorDelegate); + TempData["NominateSupervisorError"] = true; + return RedirectToAction("NominateSupervisor", new { supervisorDelegateId = supervisorDelegate.Id, returnPageQuery = supervisorDelegate.ReturnPageQuery }); + } } } From ef805e80e1025c64e24eb6b5be2d491b3d05402e Mon Sep 17 00:00:00 2001 From: OluwatobiAwe Date: Fri, 28 Oct 2022 11:52:59 +0100 Subject: [PATCH 2/2] update --- .../Controllers/SupervisorController/Supervisor.cs | 5 +++-- .../Views/Supervisor/NominateSupervisor.cshtml | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/DigitalLearningSolutions.Web/Controllers/SupervisorController/Supervisor.cs b/DigitalLearningSolutions.Web/Controllers/SupervisorController/Supervisor.cs index 0e4121958f..91f837b093 100644 --- a/DigitalLearningSolutions.Web/Controllers/SupervisorController/Supervisor.cs +++ b/DigitalLearningSolutions.Web/Controllers/SupervisorController/Supervisor.cs @@ -921,7 +921,8 @@ public IActionResult NominateSupervisor(int supervisorDelegateId, ReturnPageQuer { if (Convert.ToBoolean(TempData["NominateSupervisorError"].ToString())) { - ModelState.AddModelError("ActionConfirmed", "Nominated supervisor not confirmed"); + ModelState.AddModelError("ActionConfirmed", "Please tick the checkbox to confirm you wish to perform this action"); + } } return View("NominateSupervisor", model); @@ -948,7 +949,7 @@ public IActionResult ConfirmNominateSupervisor(SupervisorDelegateViewModel super { TempData["NominateSupervisorError"] = true; return RedirectToAction("NominateSupervisor", new { supervisorDelegateId = supervisorDelegate.Id, returnPageQuery = supervisorDelegate.ReturnPageQuery }); - + } } } diff --git a/DigitalLearningSolutions.Web/Views/Supervisor/NominateSupervisor.cshtml b/DigitalLearningSolutions.Web/Views/Supervisor/NominateSupervisor.cshtml index ce50ea6517..94ca3b3039 100644 --- a/DigitalLearningSolutions.Web/Views/Supervisor/NominateSupervisor.cshtml +++ b/DigitalLearningSolutions.Web/Views/Supervisor/NominateSupervisor.cshtml @@ -5,7 +5,7 @@ @{ var errorHasOccurred = !ViewData.ModelState.IsValid; ViewData["Application"] = "Supervisor"; - ViewData["Title"] = (errorHasOccurred ? "Error: " : "") + "Confirm Nominated supervisor"; + ViewData["Title"] = "Confirm Nominated supervisor"; ViewData["HeaderPath"] = $"{Configuration["AppRootPath"]}/Supervisor/MyStaff"; ViewData["HeaderPathName"] = "My Staff"; }