From 54f6fbef6ecb99d6f846f83d1c2d7279c7450782 Mon Sep 17 00:00:00 2001 From: kevwhitt-hee Date: Mon, 20 Jan 2025 17:19:38 +0000 Subject: [PATCH 1/2] Sets up controller, view and navigation for print layout --- .../FrameworksController/Frameworks.cs | 11 +++++++ .../Developer/FrameworkPrintLayout.cshtml | 31 +++++++++++++++++++ .../Frameworks/Developer/_Structure.cshtml | 1 + 3 files changed, 43 insertions(+) create mode 100644 DigitalLearningSolutions.Web/Views/Frameworks/Developer/FrameworkPrintLayout.cshtml diff --git a/DigitalLearningSolutions.Web/Controllers/FrameworksController/Frameworks.cs b/DigitalLearningSolutions.Web/Controllers/FrameworksController/Frameworks.cs index bdaa3d4e20..a66d5c46b0 100644 --- a/DigitalLearningSolutions.Web/Controllers/FrameworksController/Frameworks.cs +++ b/DigitalLearningSolutions.Web/Controllers/FrameworksController/Frameworks.cs @@ -716,6 +716,17 @@ public IActionResult ViewFramework(string tabname, int frameworkId, int? framewo return View("Developer/Framework", model); } + [Route("/Framework/{frameworkId}/Structure/PrintLayout")] + public IActionResult PrintLayout(int frameworkId) { + var adminId = GetAdminId(); + var detailFramework = frameworkService.GetFrameworkDetailByFrameworkId(frameworkId, adminId); + var routeData = new Dictionary { { "frameworkId", detailFramework?.ID.ToString() } }; + var model = new FrameworkViewModel() + { + DetailFramework = detailFramework, + }; + return View("Developer/FrameworkPrintLayout", model); + } [ResponseCache(CacheProfileName = "Never")] public IActionResult InsertFramework() { diff --git a/DigitalLearningSolutions.Web/Views/Frameworks/Developer/FrameworkPrintLayout.cshtml b/DigitalLearningSolutions.Web/Views/Frameworks/Developer/FrameworkPrintLayout.cshtml new file mode 100644 index 0000000000..5d94c62025 --- /dev/null +++ b/DigitalLearningSolutions.Web/Views/Frameworks/Developer/FrameworkPrintLayout.cshtml @@ -0,0 +1,31 @@ +@using DigitalLearningSolutions.Web.ViewModels.Frameworks; +@model FrameworkViewModel; +@{ + ViewData["Title"] = Model.DetailFramework.FrameworkName; + ViewData["Application"] = "Framework Service"; + ViewData["HeaderPathName"] = "Framework Service"; +} + +@section NavMenuItems { + +} +@section NavBreadcrumbs { + +} +
+ +
+

+ @Model.DetailFramework.FrameworkName +

+
+
diff --git a/DigitalLearningSolutions.Web/Views/Frameworks/Developer/_Structure.cshtml b/DigitalLearningSolutions.Web/Views/Frameworks/Developer/_Structure.cshtml index 849b5121ba..f6d566ad64 100644 --- a/DigitalLearningSolutions.Web/Views/Frameworks/Developer/_Structure.cshtml +++ b/DigitalLearningSolutions.Web/Views/Frameworks/Developer/_Structure.cshtml @@ -82,6 +82,7 @@ else Add @Model.VocabSingular().ToLower() group Add ungrouped @Model.VocabSingular().ToLower() Bulk upload/update @Model.VocabPlural().ToLower() + View for print } From 968c78b4d81bc5f2c1b219a7d986cf39ded7dd16 Mon Sep 17 00:00:00 2001 From: kevwhitt-hee Date: Tue, 21 Jan 2025 16:48:11 +0000 Subject: [PATCH 2/2] TD-5263 Implements "view for print" option for frameworks --- .../FrameworksController/Frameworks.cs | 3 + .../Styles/frameworks/frameworksShared.scss | 34 ++++++ .../Styles/layout.scss | 6 ++ .../Developer/FrameworkPrintLayout.cshtml | 100 +++++++++++++++++- .../Frameworks/Developer/_Structure.cshtml | 2 +- .../Views/Shared/_CookieConsentPartial.cshtml | 4 +- .../Views/Shared/_Layout.cshtml | 2 +- .../Shared/_UserFeedbackBarPartial.cshtml | 4 +- 8 files changed, 147 insertions(+), 8 deletions(-) diff --git a/DigitalLearningSolutions.Web/Controllers/FrameworksController/Frameworks.cs b/DigitalLearningSolutions.Web/Controllers/FrameworksController/Frameworks.cs index a66d5c46b0..ffb9460299 100644 --- a/DigitalLearningSolutions.Web/Controllers/FrameworksController/Frameworks.cs +++ b/DigitalLearningSolutions.Web/Controllers/FrameworksController/Frameworks.cs @@ -725,6 +725,9 @@ public IActionResult PrintLayout(int frameworkId) { { DetailFramework = detailFramework, }; + model.FrameworkCompetencyGroups = frameworkService.GetFrameworkCompetencyGroups(frameworkId).ToList(); + model.CompetencyFlags = frameworkService.GetCompetencyFlagsByFrameworkId(frameworkId, null, selected: true); + model.FrameworkCompetencies = frameworkService.GetFrameworkCompetenciesUngrouped(frameworkId); return View("Developer/FrameworkPrintLayout", model); } [ResponseCache(CacheProfileName = "Never")] diff --git a/DigitalLearningSolutions.Web/Styles/frameworks/frameworksShared.scss b/DigitalLearningSolutions.Web/Styles/frameworks/frameworksShared.scss index a6cd8f8277..b452ab9178 100644 --- a/DigitalLearningSolutions.Web/Styles/frameworks/frameworksShared.scss +++ b/DigitalLearningSolutions.Web/Styles/frameworks/frameworksShared.scss @@ -251,3 +251,37 @@ h1.truncate-overflow::after { .float-right{ float:right; } +@media print { + + address, p, .nhsuk-body-m, ol, ul, td, .nhsuk-tag { + font-size: 12px !important; + } + + h1 { + font-size: 20px !important; + break-after: avoid; + } + + h2 { + font-size: 18px !important; + break-after: avoid; + } + + h3, table { + break-after: avoid; + break-before: auto; + } + + h3 { + font-size: 16px !important; + } + + h4, th { + font-size: 14px !important; + } + + tr { + break-inside: avoid; + page-break-inside: avoid; + } +} diff --git a/DigitalLearningSolutions.Web/Styles/layout.scss b/DigitalLearningSolutions.Web/Styles/layout.scss index 7e252f49ed..c0ef2ada6a 100644 --- a/DigitalLearningSolutions.Web/Styles/layout.scss +++ b/DigitalLearningSolutions.Web/Styles/layout.scss @@ -398,3 +398,9 @@ nav, .nhsuk-header__navigation, #header-navigation { .field-validation-valid { display: none !important; } + +@media print { + .no-print { + display: none; + } +} diff --git a/DigitalLearningSolutions.Web/Views/Frameworks/Developer/FrameworkPrintLayout.cshtml b/DigitalLearningSolutions.Web/Views/Frameworks/Developer/FrameworkPrintLayout.cshtml index 5d94c62025..69ec377b44 100644 --- a/DigitalLearningSolutions.Web/Views/Frameworks/Developer/FrameworkPrintLayout.cshtml +++ b/DigitalLearningSolutions.Web/Views/Frameworks/Developer/FrameworkPrintLayout.cshtml @@ -4,6 +4,7 @@ ViewData["Title"] = Model.DetailFramework.FrameworkName; ViewData["Application"] = "Framework Service"; ViewData["HeaderPathName"] = "Framework Service"; + int groupNum = 0; } @section NavMenuItems { @@ -14,7 +15,7 @@
  1. Frameworks
  2. -
  3. Framework @ViewContext.RouteData.Values["tabname"]
  4. +
  5. Framework structure
  6. Print layout

Back to Framework

@@ -27,5 +28,100 @@

@Model.DetailFramework.FrameworkName

-
+ @if (!String.IsNullOrEmpty(Model.DetailFramework.Description)) + { +
+
+

+ Framework description + +

+

+ @(Html.Raw(Model.DetailFramework.Description)) +

+
+
+ } +

Framework @Model.VocabPlural().ToLower()

+ + @if (Model.FrameworkCompetencyGroups != null) + { + if (Model.FrameworkCompetencyGroups.Any()) + { + @foreach (var frameworkCompetencyGroup in Model.FrameworkCompetencyGroups) + { + groupNum++; +

@frameworkCompetencyGroup.Name

+ if (frameworkCompetencyGroup.Description != null) + { +

+ @frameworkCompetencyGroup.Description +

+ } + + int compNum = 0; + if (frameworkCompetencyGroup.FrameworkCompetencies[0] != null) + { + + + + + + + + + @foreach (var frameworkCompetency in frameworkCompetencyGroup.FrameworkCompetencies) + { + compNum++; + + + + + } + +
+ @Model.VocabSingular() + + Date and Signature +
+ @frameworkCompetency.Name + + + @if (frameworkCompetency.Description != null) + { +

+ @Html.Raw(frameworkCompetency.Description) +

+ } +
+ +
+ } + } + } + } + @if (Model.FrameworkCompetencies != null) + { + if (Model.FrameworkCompetencies.Any()) + { + groupNum++; + int compNum = 0; +

Ungrouped competencies

+ foreach (var frameworkCompetency in Model.FrameworkCompetencies) + { + compNum++; +
+

@frameworkCompetency.Name

+ + @if (frameworkCompetency.Description != null) + { +

+ @frameworkCompetency.Description +

+ } +
+ } + } + } + diff --git a/DigitalLearningSolutions.Web/Views/Frameworks/Developer/_Structure.cshtml b/DigitalLearningSolutions.Web/Views/Frameworks/Developer/_Structure.cshtml index f6d566ad64..ca13087c27 100644 --- a/DigitalLearningSolutions.Web/Views/Frameworks/Developer/_Structure.cshtml +++ b/DigitalLearningSolutions.Web/Views/Frameworks/Developer/_Structure.cshtml @@ -82,7 +82,7 @@ else Add @Model.VocabSingular().ToLower() group Add ungrouped @Model.VocabSingular().ToLower() Bulk upload/update @Model.VocabPlural().ToLower() - View for print + View for print } diff --git a/DigitalLearningSolutions.Web/Views/Shared/_CookieConsentPartial.cshtml b/DigitalLearningSolutions.Web/Views/Shared/_CookieConsentPartial.cshtml index 9500f932e9..bffbbc36f8 100644 --- a/DigitalLearningSolutions.Web/Views/Shared/_CookieConsentPartial.cshtml +++ b/DigitalLearningSolutions.Web/Views/Shared/_CookieConsentPartial.cshtml @@ -9,7 +9,7 @@ @if (showCookieBanner == null && validateCookieBannerViaTempData == null) // [BY] Show cookie banner when the value is null. if the user consent yes or no then we dont display the banner { -