From 186bbe7bdc3741d6b530f9dde7247a00f8d6d8e7 Mon Sep 17 00:00:00 2001
From: Glenn-Clarke <152421975+Glenn-Clarke@users.noreply.github.com>
Date: Tue, 1 Oct 2024 15:34:13 +0100
Subject: [PATCH 1/9] PC-NONE: Update flow link
---
.github/pull_request_template.md | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md
index bde72c3e..405a1dac 100644
--- a/.github/pull_request_template.md
+++ b/.github/pull_request_template.md
@@ -16,7 +16,7 @@ Add a brief description of the change(s) you have made
- [ ] I have checked there are no unintentional line ending changes
- [ ] I have added tests where applicable
- [ ] If I have made any changes to the code, I have used the IDE auto-formatter on it
-- [ ] If I have made any changes to website flow, I have updated the [Flow Miro Board](https://miro.com/app/board/uXjVK6F2rKo=/)
+- [ ] If I have made any changes to website flow, I have updated the [Flow Miro Board](https://miro.com/app/board/uXjVK4BNrG0=/)
- [ ] If I have made any changes to website flow, I have checked forward and back behaviour is still consistent
- [ ] If I have made any changes to content strings or resource files, I have followed [the documentation](https://github.com/UKGovernmentBEIS/beis-simple-energy-advice-beta/blob/main/docs/LocalisationDocumentation.md)
@@ -24,4 +24,4 @@ Add a brief description of the change(s) you have made
\ No newline at end of file
+-->
From 8795fed1459987b1d9cc8cb0ccff174b4a3feb7e Mon Sep 17 00:00:00 2001
From: Glenn Clarke
Date: Wed, 27 Nov 2024 12:24:05 +0000
Subject: [PATCH 2/9] PC-577: Add Solar PV question to service flow & request
to BRE API
---
.../ExternalServices/Bre/BreRequest.cs | 6 +-
.../Bre/RecommendationService.cs | 16 +++-
.../Models/Enums/QuestionFlowStep.cs | 1 +
.../Models/Enums/SolarElectricPanels.cs | 14 +++
.../Models/PropertyData.cs | 2 +
.../PropertyDataUpdater.cs | 12 +++
.../Enum/SolarElectricPanels.Designer.cs | 89 ++++++++++++++++++
.../Enum/SolarElectricPanels.cy.resx | 23 +++++
.../Resources/Enum/SolarElectricPanels.resx | 30 ++++++
.../SeaPublicWebsite.BusinessLogic.csproj | 4 +
.../Services/QuestionFlowService.cs | 23 ++++-
.../20241126150816_AddSolarPVAnswer.cs | 25 +++++
.../Migrations/SeaDbContextModelSnapshot.cs | 3 +
SeaPublicWebsite.UnitTests/BreApi.cs | 3 +-
.../Controllers/EnergyEfficiencyController.cs | 34 +++++++
.../SolarElectricPanelsViewModel.cs | 16 ++++
.../Resources/ErrorMessages.Designer.cs | 9 ++
.../Resources/ErrorMessages.cy.resx | 3 +
SeaPublicWebsite/Resources/ErrorMessages.resx | 3 +
.../Resources/SharedResources.cy.resx | 16 ++++
.../Resources/SharedResources.resx | 16 ++++
SeaPublicWebsite/Services/AnswerService.cs | 10 ++
.../EnergyEfficiency/AnswerSummary.cshtml | 30 ++++++
.../SolarElectricPanels.cshtml | 94 +++++++++++++++++++
24 files changed, 477 insertions(+), 5 deletions(-)
create mode 100644 SeaPublicWebsite.BusinessLogic/Models/Enums/SolarElectricPanels.cs
create mode 100644 SeaPublicWebsite.BusinessLogic/Resources/Enum/SolarElectricPanels.Designer.cs
create mode 100644 SeaPublicWebsite.BusinessLogic/Resources/Enum/SolarElectricPanels.cy.resx
create mode 100644 SeaPublicWebsite.BusinessLogic/Resources/Enum/SolarElectricPanels.resx
create mode 100644 SeaPublicWebsite.Data/Migrations/20241126150816_AddSolarPVAnswer.cs
create mode 100644 SeaPublicWebsite/Models/EnergyEfficiency/SolarElectricPanelsViewModel.cs
create mode 100644 SeaPublicWebsite/Views/EnergyEfficiency/SolarElectricPanels.cshtml
diff --git a/SeaPublicWebsite.BusinessLogic/ExternalServices/Bre/BreRequest.cs b/SeaPublicWebsite.BusinessLogic/ExternalServices/Bre/BreRequest.cs
index eeb037d7..63133849 100644
--- a/SeaPublicWebsite.BusinessLogic/ExternalServices/Bre/BreRequest.cs
+++ b/SeaPublicWebsite.BusinessLogic/ExternalServices/Bre/BreRequest.cs
@@ -34,6 +34,8 @@ public class BreRequest
public int? roof_type { get; set; }
+ public bool? pv_panel { get; set; }
+
public int wall_type { get; set; }
public int glazing_type { get; set; }
@@ -57,7 +59,8 @@ public BreRequest(
int[] breNormalDaysOffHours,
decimal? breTemperature,
BreFloorType? breFloorType,
- bool? breOutsideSpace
+ bool? breOutsideSpace,
+ bool? brePvPanels
)
{
property_type = ((int) brePropertyType).ToString();
@@ -67,6 +70,7 @@ public BreRequest(
wall_type = (int) breWallType;
//no input for floor_type in BRE API
roof_type = (int?) breRoofType;
+ pv_panel = brePvPanels;
glazing_type = (int) breGlazingType;
//no input for outdoor heater space in BRE API
heating_system = (int) breHeatingSystem;
diff --git a/SeaPublicWebsite.BusinessLogic/ExternalServices/Bre/RecommendationService.cs b/SeaPublicWebsite.BusinessLogic/ExternalServices/Bre/RecommendationService.cs
index c3573f4b..b2b63344 100644
--- a/SeaPublicWebsite.BusinessLogic/ExternalServices/Bre/RecommendationService.cs
+++ b/SeaPublicWebsite.BusinessLogic/ExternalServices/Bre/RecommendationService.cs
@@ -162,6 +162,8 @@ private static BreRequest CreateRequest(PropertyData propertyData)
bool? breOutsideSpace = GetBreOutsideSpace(propertyData.HasOutdoorSpace);
+ bool? brePvPanels = GetBrePvPanels(propertyData.SolarElectricPanels);
+
BreRequest request = new(
brePropertyType: brePropertyType,
breBuiltForm: breBuiltForm,
@@ -177,7 +179,8 @@ private static BreRequest CreateRequest(PropertyData propertyData)
breNormalDaysOffHours: breNormalDaysOffHours,
breTemperature: propertyData.Temperature,
breFloorType: breFloorType,
- breOutsideSpace: breOutsideSpace
+ breOutsideSpace: breOutsideSpace,
+ brePvPanels: brePvPanels
);
return request;
@@ -540,5 +543,16 @@ private static bool GetBreOutsideSpace(HasOutdoorSpace? hasOutdoorSpace)
_ => throw new ArgumentOutOfRangeException()
};
}
+
+ private static bool? GetBrePvPanels(SolarElectricPanels? solarElectricPanels)
+ {
+ return solarElectricPanels switch
+ {
+ SolarElectricPanels.Yes => true,
+ SolarElectricPanels.No => false,
+ SolarElectricPanels.DoNotKnow => null,
+ _ => throw new ArgumentOutOfRangeException()
+ };
+ }
}
}
\ No newline at end of file
diff --git a/SeaPublicWebsite.BusinessLogic/Models/Enums/QuestionFlowStep.cs b/SeaPublicWebsite.BusinessLogic/Models/Enums/QuestionFlowStep.cs
index 7c59965d..3b7cf507 100644
--- a/SeaPublicWebsite.BusinessLogic/Models/Enums/QuestionFlowStep.cs
+++ b/SeaPublicWebsite.BusinessLogic/Models/Enums/QuestionFlowStep.cs
@@ -24,6 +24,7 @@ public enum QuestionFlowStep
FloorConstruction,
FloorInsulated,
RoofConstruction,
+ SolarElectricPanels,
LoftSpace,
LoftAccess,
RoofInsulated,
diff --git a/SeaPublicWebsite.BusinessLogic/Models/Enums/SolarElectricPanels.cs b/SeaPublicWebsite.BusinessLogic/Models/Enums/SolarElectricPanels.cs
new file mode 100644
index 00000000..6d855881
--- /dev/null
+++ b/SeaPublicWebsite.BusinessLogic/Models/Enums/SolarElectricPanels.cs
@@ -0,0 +1,14 @@
+using System.ComponentModel.DataAnnotations;
+
+namespace SeaPublicWebsite.BusinessLogic.Models.Enums
+{
+ public enum SolarElectricPanels
+ {
+ [Display(ResourceType = typeof(Resources.Enum.SolarElectricPanels), Description = nameof(Resources.Enum.SolarElectricPanels.Yes))]
+ Yes,
+ [Display(ResourceType = typeof(Resources.Enum.SolarElectricPanels), Description = nameof(Resources.Enum.SolarElectricPanels.No))]
+ No,
+ [Display(ResourceType = typeof(Resources.Enum.SolarElectricPanels), Description = nameof(Resources.Enum.SolarElectricPanels.DoNotKnow))]
+ DoNotKnow
+ }
+}
\ No newline at end of file
diff --git a/SeaPublicWebsite.BusinessLogic/Models/PropertyData.cs b/SeaPublicWebsite.BusinessLogic/Models/PropertyData.cs
index b27f20e3..2e18a4b8 100644
--- a/SeaPublicWebsite.BusinessLogic/Models/PropertyData.cs
+++ b/SeaPublicWebsite.BusinessLogic/Models/PropertyData.cs
@@ -37,6 +37,7 @@ public class PropertyData
public FloorConstruction? FloorConstruction { get; set; }
public FloorInsulated? FloorInsulated { get; set; }
public RoofConstruction? RoofConstruction { get; set; }
+ public SolarElectricPanels? SolarElectricPanels { get; set; }
public LoftSpace? LoftSpace { get; set; }
public LoftAccess? LoftAccess { get; set; }
public RoofInsulated? RoofInsulated { get; set; }
@@ -140,6 +141,7 @@ public void ResetUnusedFields()
if (!HasRoof())
{
RoofConstruction = null;
+ SolarElectricPanels = null;
}
if (RoofConstruction is not Enums.RoofConstruction.Mixed and not Enums.RoofConstruction.Pitched)
diff --git a/SeaPublicWebsite.BusinessLogic/PropertyDataUpdater.cs b/SeaPublicWebsite.BusinessLogic/PropertyDataUpdater.cs
index aaa7d418..78077a80 100644
--- a/SeaPublicWebsite.BusinessLogic/PropertyDataUpdater.cs
+++ b/SeaPublicWebsite.BusinessLogic/PropertyDataUpdater.cs
@@ -226,6 +226,18 @@ public QuestionFlowStep UpdateRoofConstruction(
entryPoint);
}
+ public QuestionFlowStep UpdateSolarElectricPanels(
+ PropertyData propertyData,
+ SolarElectricPanels? solarElectricPanels,
+ QuestionFlowStep? entryPoint)
+ {
+ return UpdatePropertyData(
+ p => { p.SolarElectricPanels = solarElectricPanels; },
+ propertyData,
+ QuestionFlowStep.SolarElectricPanels,
+ entryPoint);
+ }
+
public QuestionFlowStep UpdateLoftSpace(
PropertyData propertyData,
LoftSpace? loftSpace,
diff --git a/SeaPublicWebsite.BusinessLogic/Resources/Enum/SolarElectricPanels.Designer.cs b/SeaPublicWebsite.BusinessLogic/Resources/Enum/SolarElectricPanels.Designer.cs
new file mode 100644
index 00000000..4c40ccfe
--- /dev/null
+++ b/SeaPublicWebsite.BusinessLogic/Resources/Enum/SolarElectricPanels.Designer.cs
@@ -0,0 +1,89 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by a tool.
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+namespace SeaPublicWebsite.BusinessLogic.Resources.Enum {
+ using System;
+
+
+ ///
+ /// A strongly-typed resource class, for looking up localized strings, etc.
+ ///
+ // This class was auto-generated by the StronglyTypedResourceBuilder
+ // class via a tool like ResGen or Visual Studio.
+ // To add or remove a member, edit your .ResX file then rerun ResGen
+ // with the /str option, or rebuild your VS project.
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ public class SolarElectricPanels {
+
+ private static global::System.Resources.ResourceManager resourceMan;
+
+ private static global::System.Globalization.CultureInfo resourceCulture;
+
+ [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+ internal SolarElectricPanels() {
+ }
+
+ ///
+ /// Returns the cached ResourceManager instance used by this class.
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ public static global::System.Resources.ResourceManager ResourceManager {
+ get {
+ if (object.ReferenceEquals(resourceMan, null)) {
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SeaPublicWebsite.BusinessLogic.Resources.Enum.SolarElectricPanels", typeof(SolarElectricPanels).Assembly);
+ resourceMan = temp;
+ }
+ return resourceMan;
+ }
+ }
+
+ ///
+ /// Overrides the current thread's CurrentUICulture property for all
+ /// resource lookups using this strongly typed resource class.
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ public static global::System.Globalization.CultureInfo Culture {
+ get {
+ return resourceCulture;
+ }
+ set {
+ resourceCulture = value;
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to I don't know.
+ ///
+ public static string DoNotKnow {
+ get {
+ return ResourceManager.GetString("DoNotKnow", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to No.
+ ///
+ public static string No {
+ get {
+ return ResourceManager.GetString("No", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Yes.
+ ///
+ public static string Yes {
+ get {
+ return ResourceManager.GetString("Yes", resourceCulture);
+ }
+ }
+ }
+}
diff --git a/SeaPublicWebsite.BusinessLogic/Resources/Enum/SolarElectricPanels.cy.resx b/SeaPublicWebsite.BusinessLogic/Resources/Enum/SolarElectricPanels.cy.resx
new file mode 100644
index 00000000..00b04580
--- /dev/null
+++ b/SeaPublicWebsite.BusinessLogic/Resources/Enum/SolarElectricPanels.cy.resx
@@ -0,0 +1,23 @@
+
+
+ text/microsoft-resx
+
+
+ 1.3
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ Oes
+
+
+ Nac oes
+
+
+ Ddim yn gwybod
+
+
\ No newline at end of file
diff --git a/SeaPublicWebsite.BusinessLogic/Resources/Enum/SolarElectricPanels.resx b/SeaPublicWebsite.BusinessLogic/Resources/Enum/SolarElectricPanels.resx
new file mode 100644
index 00000000..115020b0
--- /dev/null
+++ b/SeaPublicWebsite.BusinessLogic/Resources/Enum/SolarElectricPanels.resx
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 1.3
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ Yes
+
+
+ No
+
+
+ I don't know
+
+
\ No newline at end of file
diff --git a/SeaPublicWebsite.BusinessLogic/SeaPublicWebsite.BusinessLogic.csproj b/SeaPublicWebsite.BusinessLogic/SeaPublicWebsite.BusinessLogic.csproj
index 83f3a309..cc81a71f 100644
--- a/SeaPublicWebsite.BusinessLogic/SeaPublicWebsite.BusinessLogic.csproj
+++ b/SeaPublicWebsite.BusinessLogic/SeaPublicWebsite.BusinessLogic.csproj
@@ -135,6 +135,10 @@
PublicResXFileCodeGenerator
BreBuiltForm.Designer.cs
+
+ PublicResXFileCodeGenerator
+ SolarElectricPanels.Designer.cs
+
diff --git a/SeaPublicWebsite.BusinessLogic/Services/QuestionFlowService.cs b/SeaPublicWebsite.BusinessLogic/Services/QuestionFlowService.cs
index 830b1f36..12d3b543 100644
--- a/SeaPublicWebsite.BusinessLogic/Services/QuestionFlowService.cs
+++ b/SeaPublicWebsite.BusinessLogic/Services/QuestionFlowService.cs
@@ -43,6 +43,7 @@ public QuestionFlowStep PreviousStep(
QuestionFlowStep.FloorConstruction => FloorConstructionBackDestination(propertyData, entryPoint),
QuestionFlowStep.FloorInsulated => FloorInsulatedBackDestination(entryPoint),
QuestionFlowStep.RoofConstruction => RoofConstructionBackDestination(propertyData, entryPoint),
+ QuestionFlowStep.SolarElectricPanels => SolarElectricPanelsBackDestination(entryPoint),
QuestionFlowStep.LoftSpace => LoftSpaceBackDestination(entryPoint),
QuestionFlowStep.LoftAccess => LoftAccessBackDestination(entryPoint),
QuestionFlowStep.RoofInsulated => RoofInsulatedBackDestination(entryPoint),
@@ -85,6 +86,7 @@ public QuestionFlowStep NextStep(QuestionFlowStep page, PropertyData propertyDat
QuestionFlowStep.FloorConstruction => FloorConstructionForwardDestination(propertyData, entryPoint),
QuestionFlowStep.FloorInsulated => FloorInsulatedForwardDestination(propertyData, entryPoint),
QuestionFlowStep.RoofConstruction => RoofConstructionForwardDestination(propertyData, entryPoint),
+ QuestionFlowStep.SolarElectricPanels => SolarElectricPanelsForwardDestination(propertyData, entryPoint),
QuestionFlowStep.LoftSpace => LoftSpaceForwardDestination(propertyData, entryPoint),
QuestionFlowStep.LoftAccess => LoftAccessForwardDestination(propertyData, entryPoint),
QuestionFlowStep.RoofInsulated => RoofInsulatedForwardDestination(entryPoint),
@@ -304,12 +306,19 @@ private QuestionFlowStep RoofConstructionBackDestination(PropertyData propertyDa
_ => QuestionFlowStep.WallConstruction
};
}
+
+ private QuestionFlowStep SolarElectricPanelsBackDestination(QuestionFlowStep? entryPoint)
+ {
+ return entryPoint is QuestionFlowStep.SolarElectricPanels
+ ? QuestionFlowStep.AnswerSummary
+ : QuestionFlowStep.RoofConstruction;
+ }
private QuestionFlowStep LoftSpaceBackDestination(QuestionFlowStep? entryPoint)
{
return entryPoint is QuestionFlowStep.LoftSpace
? QuestionFlowStep.AnswerSummary
- : QuestionFlowStep.RoofConstruction;
+ : QuestionFlowStep.SolarElectricPanels;
}
private QuestionFlowStep LoftAccessBackDestination(QuestionFlowStep? entryPoint)
@@ -338,7 +347,7 @@ private QuestionFlowStep GlazingTypeBackDestination(PropertyData propertyData, Q
return propertyData switch
{
{ RoofConstruction: RoofConstruction.Flat }
- => QuestionFlowStep.RoofConstruction,
+ => QuestionFlowStep.SolarElectricPanels,
{ LoftSpace: not LoftSpace.Yes }
=> QuestionFlowStep.LoftSpace,
{ LoftAccess: not LoftAccess.Yes }
@@ -669,6 +678,16 @@ private QuestionFlowStep FloorInsulatedForwardDestination(PropertyData propertyD
}
private QuestionFlowStep RoofConstructionForwardDestination(PropertyData propertyData, QuestionFlowStep? entryPoint)
+ {
+ if (entryPoint is not null)
+ {
+ return QuestionFlowStep.AnswerSummary;
+ }
+
+ return QuestionFlowStep.SolarElectricPanels;
+ }
+
+ private QuestionFlowStep SolarElectricPanelsForwardDestination(PropertyData propertyData, QuestionFlowStep? entryPoint)
{
if (propertyData.RoofConstruction is RoofConstruction.Mixed or RoofConstruction.Pitched)
{
diff --git a/SeaPublicWebsite.Data/Migrations/20241126150816_AddSolarPVAnswer.cs b/SeaPublicWebsite.Data/Migrations/20241126150816_AddSolarPVAnswer.cs
new file mode 100644
index 00000000..34cc4fa5
--- /dev/null
+++ b/SeaPublicWebsite.Data/Migrations/20241126150816_AddSolarPVAnswer.cs
@@ -0,0 +1,25 @@
+using Microsoft.EntityFrameworkCore.Migrations;
+
+#nullable disable
+
+namespace SeaPublicWebsite.Data.Migrations
+{
+ public partial class AddSolarPVAnswer : Migration
+ {
+ protected override void Up(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.AddColumn(
+ name: "SolarElectricPanels",
+ table: "PropertyData",
+ type: "integer",
+ nullable: true);
+ }
+
+ protected override void Down(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.DropColumn(
+ name: "SolarElectricPanels",
+ table: "PropertyData");
+ }
+ }
+}
diff --git a/SeaPublicWebsite.Data/Migrations/SeaDbContextModelSnapshot.cs b/SeaPublicWebsite.Data/Migrations/SeaDbContextModelSnapshot.cs
index 271a2b04..0bdde940 100644
--- a/SeaPublicWebsite.Data/Migrations/SeaDbContextModelSnapshot.cs
+++ b/SeaPublicWebsite.Data/Migrations/SeaDbContextModelSnapshot.cs
@@ -208,6 +208,9 @@ protected override void BuildModel(ModelBuilder modelBuilder)
b.Property("SearchForEpc")
.HasColumnType("integer");
+ b.Property("SolarElectricPanels")
+ .HasColumnType("integer");
+
b.Property("SolidWallsInsulated")
.HasColumnType("integer");
diff --git a/SeaPublicWebsite.UnitTests/BreApi.cs b/SeaPublicWebsite.UnitTests/BreApi.cs
index d141c7d8..fc3e612c 100644
--- a/SeaPublicWebsite.UnitTests/BreApi.cs
+++ b/SeaPublicWebsite.UnitTests/BreApi.cs
@@ -26,7 +26,8 @@ public void BreRequestMeasuresShouldBeTrue()
breNormalDaysOffHours: null,
breTemperature: null,
breFloorType: BreFloorType.DontKnow,
- breOutsideSpace: true
+ breOutsideSpace: true,
+ brePvPanels: false
);
// Assert
diff --git a/SeaPublicWebsite/Controllers/EnergyEfficiencyController.cs b/SeaPublicWebsite/Controllers/EnergyEfficiencyController.cs
index 179f793a..be99370f 100644
--- a/SeaPublicWebsite/Controllers/EnergyEfficiencyController.cs
+++ b/SeaPublicWebsite/Controllers/EnergyEfficiencyController.cs
@@ -806,6 +806,39 @@ public async Task RoofConstruction_Post(RoofConstructionViewModel
return RedirectToNextStep(nextStep, viewModel.Reference, viewModel.EntryPoint);
}
+
+ [HttpGet("solar-electric-panels/{reference}")]
+ public async Task SolarElectricPanels_Get(string reference, QuestionFlowStep? entryPoint = null)
+ {
+ var propertyData = await propertyDataStore.LoadPropertyDataAsync(reference);
+
+ var viewModel = new SolarElectricPanelsViewModel
+ {
+ SolarElectricPanels = propertyData.SolarElectricPanels,
+ Reference = propertyData.Reference,
+ Epc = propertyData.Epc,
+ EntryPoint = entryPoint,
+ BackLink = GetBackUrl(QuestionFlowStep.SolarElectricPanels, propertyData, entryPoint)
+ };
+
+ return View("SolarElectricPanels", viewModel);
+ }
+
+ [HttpPost("solar-electric-panels/{reference}")]
+ public async Task SolarElectricPanels_Post(SolarElectricPanelsViewModel viewModel)
+ {
+ if (!ModelState.IsValid)
+ {
+ return await SolarElectricPanels_Get(viewModel.Reference, viewModel.EntryPoint);
+ }
+
+ var nextStep = await answerService.UpdateSolarElectricPanels(
+ viewModel.Reference,
+ viewModel.SolarElectricPanels,
+ viewModel.EntryPoint);
+
+ return RedirectToNextStep(nextStep, viewModel.Reference, viewModel.EntryPoint);
+ }
[HttpGet("loft-space/{reference}")]
public async Task LoftSpace_Get(string reference, QuestionFlowStep? entryPoint = null)
@@ -1590,6 +1623,7 @@ private PathByActionArguments GetActionArgumentsForQuestion(
QuestionFlowStep.FloorConstruction => new PathByActionArguments(nameof(FloorConstruction_Get), "EnergyEfficiency", GetRouteValues(reference, extraRouteValues, entryPoint)),
QuestionFlowStep.FloorInsulated => new PathByActionArguments(nameof(FloorInsulated_Get), "EnergyEfficiency", GetRouteValues(reference, extraRouteValues, entryPoint)),
QuestionFlowStep.RoofConstruction => new PathByActionArguments(nameof(RoofConstruction_Get), "EnergyEfficiency", GetRouteValues(reference, extraRouteValues, entryPoint)),
+ QuestionFlowStep.SolarElectricPanels => new PathByActionArguments(nameof(SolarElectricPanels_Get), "EnergyEfficiency", GetRouteValues(reference, extraRouteValues, entryPoint)),
QuestionFlowStep.LoftSpace => new PathByActionArguments(nameof(LoftSpace_Get), "EnergyEfficiency", GetRouteValues(reference, extraRouteValues, entryPoint)),
QuestionFlowStep.LoftAccess => new PathByActionArguments(nameof(LoftAccess_Get), "EnergyEfficiency", GetRouteValues(reference, extraRouteValues, entryPoint)),
QuestionFlowStep.RoofInsulated => new PathByActionArguments(nameof(RoofInsulated_Get), "EnergyEfficiency", GetRouteValues(reference, extraRouteValues, entryPoint)),
diff --git a/SeaPublicWebsite/Models/EnergyEfficiency/SolarElectricPanelsViewModel.cs b/SeaPublicWebsite/Models/EnergyEfficiency/SolarElectricPanelsViewModel.cs
new file mode 100644
index 00000000..28284819
--- /dev/null
+++ b/SeaPublicWebsite/Models/EnergyEfficiency/SolarElectricPanelsViewModel.cs
@@ -0,0 +1,16 @@
+using GovUkDesignSystem.Attributes.ValidationAttributes;
+using SeaPublicWebsite.BusinessLogic.Models;
+using SeaPublicWebsite.BusinessLogic.Models.Enums;
+using SeaPublicWebsite.Resources;
+
+namespace SeaPublicWebsite.Models.EnergyEfficiency
+{
+ public class SolarElectricPanelsViewModel : QuestionFlowViewModel
+ {
+ [GovUkValidateRequired(ErrorMessageResourceType = typeof(ErrorMessages), ErrorMessageResourceName = nameof(ErrorMessages.SolarElectricPanelsRequired))]
+ public SolarElectricPanels? SolarElectricPanels { get; set; }
+
+ public string Reference { get; set; }
+ public Epc Epc { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/SeaPublicWebsite/Resources/ErrorMessages.Designer.cs b/SeaPublicWebsite/Resources/ErrorMessages.Designer.cs
index 7192d0d5..85d8ebd8 100644
--- a/SeaPublicWebsite/Resources/ErrorMessages.Designer.cs
+++ b/SeaPublicWebsite/Resources/ErrorMessages.Designer.cs
@@ -392,6 +392,15 @@ internal static string SelectPropertyCountryRequired {
}
}
+ ///
+ /// Looks up a localized string similar to Select if you have solar panels.
+ ///
+ internal static string SolarElectricPanelsRequired {
+ get {
+ return ResourceManager.GetString("SolarElectricPanelsRequired", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Select if your solid walls are insulated.
///
diff --git a/SeaPublicWebsite/Resources/ErrorMessages.cy.resx b/SeaPublicWebsite/Resources/ErrorMessages.cy.resx
index 80314e81..f3bc772a 100644
--- a/SeaPublicWebsite/Resources/ErrorMessages.cy.resx
+++ b/SeaPublicWebsite/Resources/ErrorMessages.cy.resx
@@ -153,4 +153,7 @@ rhwng {1} a {2}
Rhowch rif rhwng 5 a 35, neu anwybyddwch y cwestiwn hwn
+
+ Dewiswch a oes gennych baneli solar
+
\ No newline at end of file
diff --git a/SeaPublicWebsite/Resources/ErrorMessages.resx b/SeaPublicWebsite/Resources/ErrorMessages.resx
index 50fdb799..02a67e85 100644
--- a/SeaPublicWebsite/Resources/ErrorMessages.resx
+++ b/SeaPublicWebsite/Resources/ErrorMessages.resx
@@ -150,4 +150,7 @@
Enter a number between 5 and 35, or skip this question
+
+ Select if you have solar panels
+
\ No newline at end of file
diff --git a/SeaPublicWebsite/Resources/SharedResources.cy.resx b/SeaPublicWebsite/Resources/SharedResources.cy.resx
index 47887310..77b48eb6 100644
--- a/SeaPublicWebsite/Resources/SharedResources.cy.resx
+++ b/SeaPublicWebsite/Resources/SharedResources.cy.resx
@@ -2631,4 +2631,20 @@
Mae eich Tystysgrif Perfformiad Ynni {0} yn awgrymu nad ydy eich <strong>atig wedi’i inswleiddio’n llwyr</strong> a bod gennych lai na 200mm o ddeunydd inswleiddio.
EPCSuggestsYourLoftIsNotFullyInsulatedString
+
+ Mae arae ffotofoltäig solar (PV) ar ben y to yn gasgliad o baneli lliw tywyll. Yn fwyaf cyffredin mae’r paneli yn cael eu cysylltu â'r to â mownt gosod. Yn llai cyffredin maen nhw wedi’u hintegreiddio â'r to ei hun (PV integredig adeilad).
+ HelpMeAnswerSolarElectricPanelsString
+
+
+ Mae eich Tystysgrif Perfformiad Ynni ar gyfer {0} yn awgrymu <strong>nad oes paneli ffotofoltäig solar wedi'u gosod ar eich cartref. </strong>
+ EPCSuggestsNoSolarPanelsString
+
+
+ Mae eich Tystysgrif Perfformiad Ynni ar gyfer {0} yn awgrymu <strong>bod paneli ffotofoltäig solar wedi'u gosod ar eich cartref.</strong>
+ EPCSuggestsHasSolarPanelsString
+
+
+ Oes paneli Ffotofoltäig Solar (PV) wedi’u gosod ar eich eiddo chi?
+ SolarElectricPanelsQuestionString
+
\ No newline at end of file
diff --git a/SeaPublicWebsite/Resources/SharedResources.resx b/SeaPublicWebsite/Resources/SharedResources.resx
index eff9304a..c35f217a 100644
--- a/SeaPublicWebsite/Resources/SharedResources.resx
+++ b/SeaPublicWebsite/Resources/SharedResources.resx
@@ -2579,4 +2579,20 @@
Your {0} Energy Performance Certificate suggests your <strong>loft is not fully insulated</strong> as it has less than 200mm of insulation.
EPCSuggestsYourLoftIsNotFullyInsulatedString
+
+ A rooftop solar photovoltaic (PV) array is a collection of dark coloured panels. Panels are most commonly attached to the roof with a fixed mount. Less commonly they are integrated into the roof itself (building integrated PV).
+ HelpMeAnswerSolarElectricPanelsString
+
+
+ Your {0} Energy Performance Certificate suggests your home <strong>does not have solar photovoltaic panels installed.</strong>
+ EPCSuggestsNoSolarPanelsString
+
+
+ Your {0} Energy Performance Certificate suggests your home <strong>has solar photovoltaic panels installed.<strong>
+ EPCSuggestsHasSolarPanelsString
+
+
+ Is your property fitted with Solar Photovoltaic (PV) panels?
+ SolarElectricPanelsQuestionString
+
\ No newline at end of file
diff --git a/SeaPublicWebsite/Services/AnswerService.cs b/SeaPublicWebsite/Services/AnswerService.cs
index df5edb55..965972df 100644
--- a/SeaPublicWebsite/Services/AnswerService.cs
+++ b/SeaPublicWebsite/Services/AnswerService.cs
@@ -165,6 +165,16 @@ public async Task UpdateRoofConstruction(
reference);
}
+ public async Task UpdateSolarElectricPanels(
+ string reference,
+ SolarElectricPanels? solarElectricPanels,
+ QuestionFlowStep? entryPoint)
+ {
+ return await UpdatePropertyDataAsync(
+ (b, p) => b.UpdateSolarElectricPanels(p, solarElectricPanels, entryPoint),
+ reference);
+ }
+
public async Task UpdateLoftSpace(
string reference,
LoftSpace? loftSpace,
diff --git a/SeaPublicWebsite/Views/EnergyEfficiency/AnswerSummary.cshtml b/SeaPublicWebsite/Views/EnergyEfficiency/AnswerSummary.cshtml
index b8989923..5d64eb31 100644
--- a/SeaPublicWebsite/Views/EnergyEfficiency/AnswerSummary.cshtml
+++ b/SeaPublicWebsite/Views/EnergyEfficiency/AnswerSummary.cshtml
@@ -200,6 +200,36 @@
}
}
});
+
+ @if (Model.PropertyData.PropertyType is not PropertyType.ApartmentFlatOrMaisonette || Model.PropertyData.FlatType is FlatType.TopFloor)
+ {
+ rows.Add(new()
+ {
+ Key = new()
+ {
+ Classes = "govuk-!-width-one-quarter",
+ Text = SharedLocalizer["SolarElectricPanelsQuestionString"].Value
+ },
+ Value = new()
+ {
+ Classes = "govuk-!-width-one-half",
+ Text = GovUkRadioCheckboxLabelTextAttribute.GetLabelText(Model.PropertyData.SolarElectricPanels)
+ },
+ Actions = new()
+ {
+ Classes = "govuk-!-width-one-quarter",
+ Items = new()
+ {
+ new()
+ {
+ Href = Url.Action(nameof(EnergyEfficiencyController.SolarElectricPanels_Get), "EnergyEfficiency", new { reference = Model.PropertyData.Reference, entryPoint = QuestionFlowStep.SolarElectricPanels }),
+ Text = SharedLocalizer["Change"].Value,
+ VisuallyHiddenText = SharedLocalizer["SolarElectricPanelsQuestionString"].Value
+ }
+ }
+ }
+ });
+ }
if (Model.PropertyData.RoofConstruction is not RoofConstruction.Flat)
{
diff --git a/SeaPublicWebsite/Views/EnergyEfficiency/SolarElectricPanels.cshtml b/SeaPublicWebsite/Views/EnergyEfficiency/SolarElectricPanels.cshtml
new file mode 100644
index 00000000..f61d557f
--- /dev/null
+++ b/SeaPublicWebsite/Views/EnergyEfficiency/SolarElectricPanels.cshtml
@@ -0,0 +1,94 @@
+@using GovUkDesignSystem
+@using GovUkDesignSystem.GovUkDesignSystemComponents
+@using Microsoft.AspNetCore.Mvc.TagHelpers
+@using SeaPublicWebsite.BusinessLogic.Models.Enums
+@using SeaPublicWebsite.Controllers
+@using Microsoft.AspNetCore.Mvc.Localization
+@inject IHtmlLocalizer SharedLocalizer
+
+@model SeaPublicWebsite.Models.EnergyEfficiency.SolarElectricPanelsViewModel
+@{
+ ViewBag.Title = SharedLocalizer["Solar Photovoltaic (PV) panels"].Value;
+}
+
+@section BeforeMain {
+ @await Html.GovUkBackLink(new BackLinkViewModel
+ {
+ Text = SharedLocalizer["Back"].Value,
+ Href = Model.BackLink
+ })
+}
+
+
+
+
+ @await Html.PartialAsync("/Views/EnergyEfficiency/Partials/_AdditionalSupport.cshtml")
+
+
\ No newline at end of file
From a4d2c9d2368d35333cf18b54ca0aa339e91ce14f Mon Sep 17 00:00:00 2001
From: Glenn Clarke
Date: Wed, 27 Nov 2024 12:24:49 +0000
Subject: [PATCH 3/9] PC-577: Remove commented code
---
.../SolarElectricPanels.cshtml | 23 -------------------
1 file changed, 23 deletions(-)
diff --git a/SeaPublicWebsite/Views/EnergyEfficiency/SolarElectricPanels.cshtml b/SeaPublicWebsite/Views/EnergyEfficiency/SolarElectricPanels.cshtml
index f61d557f..26961109 100644
--- a/SeaPublicWebsite/Views/EnergyEfficiency/SolarElectricPanels.cshtml
+++ b/SeaPublicWebsite/Views/EnergyEfficiency/SolarElectricPanels.cshtml
@@ -33,20 +33,6 @@
@SharedLocalizer["HelpMeAnswerSolarElectricPanelsString"]
;
-
- @*Func