From b9eac0a6007361afc766a074d8f98a5eeb24b68b Mon Sep 17 00:00:00 2001 From: tbg2003 <72973046+tbg2003@users.noreply.github.com> Date: Tue, 7 Jan 2025 15:57:08 +0000 Subject: [PATCH] SASS-10526: Implements navigation functionality for 'Structures and building allowance' journey --- ...StructureBuildingAllowanceController.scala | 5 +- .../ForeignSbaCompleteController.scala | 42 +++++++------- ...reignSbaRemoveConfirmationController.scala | 4 +- ...ureBuildingAllowanceClaimsController.scala | 8 +-- ...tureBuildingQualifyingDateController.scala | 2 +- ...esBuildingAllowanceAddressController.scala | 7 +-- ...reBuildingAllowanceClaimFormProvider.scala | 2 +- app/navigation/ForeignPropertyNavigator.scala | 56 +++++++++++++++++++ .../foreign/ForeignPropertySummaryPage.scala | 39 ++++++++++++- ...oreignStructureBuildingAllowancePage.scala | 1 + ...uctureBuildingAllowanceClaimsSummary.scala | 8 +-- ...ructureBuildingQualifyingDateSummary.scala | 5 +- ...mStructureBuildingAllowanceView.scala.html | 6 +- .../ForeignSbaCheckYourAnswersView.scala.html | 4 +- ...tureBuildingAllowanceClaimsView.scala.html | 4 +- ...nStructureBuildingAllowanceView.scala.html | 7 +-- ...ctureBuildingQualifyingDateView.scala.html | 31 ++++------ conf/foreign.routes | 2 +- conf/messages.cy | 18 ++++-- conf/messages.en | 40 +++++++------ ...ctureBuildingAllowanceControllerSpec.scala | 2 + .../ForeignSbaCompleteControllerSpec.scala | 8 +-- ...uildingAllowanceClaimsControllerSpec.scala | 5 +- ...ildingAllowanceAddressControllerSpec.scala | 4 +- 24 files changed, 203 insertions(+), 107 deletions(-) diff --git a/app/controllers/foreign/structuresbuildingallowance/ForeignAddClaimStructureBuildingAllowanceController.scala b/app/controllers/foreign/structuresbuildingallowance/ForeignAddClaimStructureBuildingAllowanceController.scala index 3b294d0f..b0c93965 100644 --- a/app/controllers/foreign/structuresbuildingallowance/ForeignAddClaimStructureBuildingAllowanceController.scala +++ b/app/controllers/foreign/structuresbuildingallowance/ForeignAddClaimStructureBuildingAllowanceController.scala @@ -20,7 +20,7 @@ import controllers.actions._ import play.api.i18n.{I18nSupport, MessagesApi} import play.api.mvc.{Action, AnyContent, MessagesControllerComponents} import uk.gov.hmrc.play.bootstrap.frontend.controller.FrontendBaseController -import pages.foreign.structurebuildingallowance.ForeignStructureBuildingAllowancePage +import pages.foreign.structurebuildingallowance.{ForeignStructureBuildingAllowanceGroup, ForeignStructureBuildingAllowancePage} import views.html.foreign.structurebuildingallowance.ForeignStructureBuildingAllowanceView import javax.inject.Inject @@ -38,6 +38,7 @@ class ForeignAddClaimStructureBuildingAllowanceController @Inject()( def onPageLoad(taxYear: Int, countryCode: String): Action[AnyContent] = (identify andThen getData andThen requireData) { implicit request => - Ok(view(ForeignStructureBuildingAllowancePage(taxYear, countryCode, request.user.isAgentMessageKey))) + val nextIndex = request.userAnswers.get(ForeignStructureBuildingAllowanceGroup(countryCode)).map(_.length).getOrElse(0) + Ok(view(ForeignStructureBuildingAllowancePage(taxYear, countryCode, nextIndex, request.user.isAgentMessageKey))) } } diff --git a/app/controllers/foreign/structuresbuildingallowance/ForeignSbaCompleteController.scala b/app/controllers/foreign/structuresbuildingallowance/ForeignSbaCompleteController.scala index 63c704f7..c53bbd2c 100644 --- a/app/controllers/foreign/structuresbuildingallowance/ForeignSbaCompleteController.scala +++ b/app/controllers/foreign/structuresbuildingallowance/ForeignSbaCompleteController.scala @@ -18,10 +18,11 @@ package controllers.foreign.structuresbuildingallowance import controllers.ControllerUtils.statusForPage import controllers.actions.{DataRequiredAction, DataRetrievalAction, IdentifierAction} +import controllers.exceptions.InternalErrorFailure import forms.foreign.structurebuildingallowance.ForeignSbaCompleteFormProvider -import models.JourneyPath.ForeignStructureBuildingAllowance -import navigation.ForeignPropertyNavigator +import models.JourneyPath.ForeignPropertyAllowances import models.{JourneyContext, NormalMode} +import navigation.ForeignPropertyNavigator import pages.foreign.structurebuildingallowance.ForeignSbaCompletePage import play.api.data.Form import play.api.i18n.{I18nSupport, MessagesApi} @@ -76,28 +77,29 @@ class ForeignSbaCompleteController @Inject()( taxYear = taxYear, mtditid = request.user.mtditid, nino = request.user.nino, - journeyPath = ForeignStructureBuildingAllowance + journeyPath = ForeignPropertyAllowances ), status = statusForPage(value), request.user - ) - } yield status.fold( - _ => - //TODO: When we implement navigation story, update the route to show message from backend or error - Redirect(controllers.routes.SummaryController.show(taxYear) - ), - _ => - Redirect( - foreignPropertyNavigator - .nextPage( - ForeignSbaCompletePage(countryCode), - taxYear, - NormalMode, - request.userAnswers, - updatedAnswers + ).flatMap { + case Right(_) => + Future.successful(Redirect( + foreignPropertyNavigator + .nextPage( + ForeignSbaCompletePage(countryCode), + taxYear, + NormalMode, + request.userAnswers, + updatedAnswers + ) + )) + case Left(_) => + Future.failed( + InternalErrorFailure(s"Failed to save the status for SBA section in tax year: $taxYear") ) - ) - ) + } + } yield status ) } } + diff --git a/app/controllers/foreign/structuresbuildingallowance/ForeignSbaRemoveConfirmationController.scala b/app/controllers/foreign/structuresbuildingallowance/ForeignSbaRemoveConfirmationController.scala index d4c92b00..7377c441 100644 --- a/app/controllers/foreign/structuresbuildingallowance/ForeignSbaRemoveConfirmationController.scala +++ b/app/controllers/foreign/structuresbuildingallowance/ForeignSbaRemoveConfirmationController.scala @@ -20,7 +20,7 @@ import controllers.actions._ import forms.foreign.structurebuildingallowance.ForeignSbaRemoveConfirmationFormProvider import models.{Mode, UserAnswers} import navigation.ForeignPropertyNavigator -import pages.foreign.structurebuildingallowance.{ForeignSbaRemoveConfirmationPage, ForeignStructureBuildingAllowanceClaimPage} +import pages.foreign.structurebuildingallowance.{ForeignSbaRemoveConfirmationPage, ForeignStructureBuildingAllowanceClaimPage, ForeignStructureBuildingAllowanceWithIndex} import play.api.i18n.{I18nSupport, Messages, MessagesApi} import play.api.mvc.{Action, AnyContent, MessagesControllerComponents} import repositories.SessionRepository @@ -73,7 +73,7 @@ class ForeignSbaRemoveConfirmationController @Inject() ( updatedAnswers <- Future.fromTry { if (value) { - updatedAnswers.remove(ForeignStructureBuildingAllowanceClaimPage(countryCode, index)) + updatedAnswers.remove(ForeignStructureBuildingAllowanceWithIndex(index, countryCode)) } else { Success(updatedAnswers) } diff --git a/app/controllers/foreign/structuresbuildingallowance/ForeignStructureBuildingAllowanceClaimsController.scala b/app/controllers/foreign/structuresbuildingallowance/ForeignStructureBuildingAllowanceClaimsController.scala index df24bc40..d684ee4f 100644 --- a/app/controllers/foreign/structuresbuildingallowance/ForeignStructureBuildingAllowanceClaimsController.scala +++ b/app/controllers/foreign/structuresbuildingallowance/ForeignStructureBuildingAllowanceClaimsController.scala @@ -23,8 +23,7 @@ import forms.ForeignStructureBuildingAllowanceClaimsFormProvider import models.backend.PropertyDetails import models.requests.DataRequest import models.{AccountingMethod, AuditPropertyType, JourneyContext, JourneyName, JourneyPath, NormalMode, SectionName, UserAnswers} -import org.apache.pekko.actor.FSM.Normal -import pages.foreign.structurebuildingallowance.{ForeignSbaInfo, ForeignStructureBuildingAllowanceClaimsPage, ForeignStructureBuildingAllowanceGroup, SaveForeignSba} +import pages.foreign.structurebuildingallowance.{ForeignSbaInfo, ForeignStructureBuildingAllowanceClaimsPage, ForeignStructureBuildingAllowanceGroup} import play.api.data.Form import play.api.i18n.Lang.logger import play.api.i18n.{I18nSupport, Messages, MessagesApi} @@ -61,7 +60,7 @@ class ForeignStructureBuildingAllowanceClaimsController @Inject() ( val form: Form[Boolean] = formProvider() val list: SummaryList = summaryList(taxYear, request.userAnswers, countryCode) - Ok(view(form, list, taxYear, countryCode)) + Ok(view(form, list, taxYear, countryCode, request.user.isAgentMessageKey)) } private def summaryList(taxYear: Int, userAnswers: UserAnswers, countryCode: String)(implicit @@ -81,7 +80,7 @@ class ForeignStructureBuildingAllowanceClaimsController @Inject() ( form .bindFromRequest() .fold( - formWithErrors => Future.successful(BadRequest(view(formWithErrors, list, taxYear, countryCode))), + formWithErrors => Future.successful(BadRequest(view(formWithErrors, list, taxYear, countryCode, request.user.isAgentMessageKey))), value => handleValidForm(value, taxYear, request, countryCode) ) } @@ -178,6 +177,7 @@ class ForeignStructureBuildingAllowanceClaimsController @Inject() ( Future.failed(InternalErrorFailure("Foreign Structure and Building Allowance not found in userAnswers")) } +// TODO - revise audit model/method for Foreign Property private def auditSBAClaims( taxYear: Int, request: DataRequest[AnyContent], diff --git a/app/controllers/foreign/structuresbuildingallowance/ForeignStructureBuildingQualifyingDateController.scala b/app/controllers/foreign/structuresbuildingallowance/ForeignStructureBuildingQualifyingDateController.scala index 2f13ee79..589da709 100644 --- a/app/controllers/foreign/structuresbuildingallowance/ForeignStructureBuildingQualifyingDateController.scala +++ b/app/controllers/foreign/structuresbuildingallowance/ForeignStructureBuildingQualifyingDateController.scala @@ -73,7 +73,7 @@ class ForeignStructureBuildingQualifyingDateController @Inject()( _ <- sessionRepository.set(updatedAnswers) } yield Redirect( foreignNavigator.nextPage( - ForeignStructureBuildingAllowanceClaimPage(countryCode, index), + ForeignStructureBuildingQualifyingDatePage(countryCode, index), taxYear, mode, request.userAnswers, diff --git a/app/controllers/foreign/structuresbuildingallowance/ForeignStructuresBuildingAllowanceAddressController.scala b/app/controllers/foreign/structuresbuildingallowance/ForeignStructuresBuildingAllowanceAddressController.scala index 6f0ec5cc..cf5333b0 100644 --- a/app/controllers/foreign/structuresbuildingallowance/ForeignStructuresBuildingAllowanceAddressController.scala +++ b/app/controllers/foreign/structuresbuildingallowance/ForeignStructuresBuildingAllowanceAddressController.scala @@ -19,7 +19,7 @@ package controllers.foreign.structuresbuildingallowance import controllers.actions._ import forms.foreign.structurebuildingallowance.ForeignStructuresBuildingAllowanceAddressFormProvider import models.Mode -import navigation.Navigator +import navigation.ForeignPropertyNavigator import pages.foreign.structurebuildingallowance.ForeignStructuresBuildingAllowanceAddressPage import play.api.i18n.{I18nSupport, MessagesApi} import play.api.mvc.{Action, AnyContent, MessagesControllerComponents} @@ -33,7 +33,7 @@ import scala.concurrent.{ExecutionContext, Future} class ForeignStructuresBuildingAllowanceAddressController @Inject() ( override val messagesApi: MessagesApi, sessionRepository: SessionRepository, - navigator: Navigator, + foreignNavigator: ForeignPropertyNavigator, identify: IdentifierAction, getData: DataRetrievalAction, requireData: DataRequiredAction, @@ -70,11 +70,10 @@ class ForeignStructuresBuildingAllowanceAddressController @Inject() ( ) _ <- sessionRepository.set(updatedAnswers) } yield Redirect( - navigator.sbaNextPage( + foreignNavigator.nextPage( ForeignStructuresBuildingAllowanceAddressPage(index, countryCode), taxYear, mode, - index, request.userAnswers, updatedAnswers ) diff --git a/app/forms/foreign/structurebuildingallowance/ForeignStructureBuildingAllowanceClaimFormProvider.scala b/app/forms/foreign/structurebuildingallowance/ForeignStructureBuildingAllowanceClaimFormProvider.scala index bec37051..311e9b00 100644 --- a/app/forms/foreign/structurebuildingallowance/ForeignStructureBuildingAllowanceClaimFormProvider.scala +++ b/app/forms/foreign/structurebuildingallowance/ForeignStructureBuildingAllowanceClaimFormProvider.scala @@ -30,7 +30,7 @@ class ForeignStructureBuildingAllowanceClaimFormProvider @Inject() extends Mappi Form( "foreignStructureBuildingAllowanceClaim" -> currency( s"foreignStructureBuildingAllowanceClaim.error.required.$individualOrAgent", - s"foreignStructureBuildingAllowanceClaim.error.twoDecimalPlaces.${individualOrAgent}", + s"foreignStructureBuildingAllowanceClaim.error.twoDecimalPlaces.$individualOrAgent", "foreignStructureBuildingAllowanceClaim.error.nonNumeric") .verifying(inRange(BigDecimal(minimum), BigDecimal(maximum), "foreignStructureBuildingAllowanceClaim.error.outOfRange")) ) diff --git a/app/navigation/ForeignPropertyNavigator.scala b/app/navigation/ForeignPropertyNavigator.scala index d2b7e95a..a140d0f5 100644 --- a/app/navigation/ForeignPropertyNavigator.scala +++ b/app/navigation/ForeignPropertyNavigator.scala @@ -21,12 +21,14 @@ import controllers.foreign.allowances.routes._ import controllers.foreign.expenses.routes._ import controllers.foreign.income.routes._ import controllers.foreign.routes._ +import controllers.foreign.structuresbuildingallowance.routes._ import controllers.routes.{IndexController, SummaryController} import models.ForeignTotalIncome.{LessThanOneThousand, OneThousandAndMore} import models._ import pages.Page import pages.foreign._ import pages.foreign.allowances._ +import pages.foreign.structurebuildingallowance._ import pages.foreign.expenses._ import pages.foreign.income._ import play.api.mvc.Call @@ -94,6 +96,7 @@ class ForeignPropertyNavigator { taxYear => _ => userAnswers => consolidatedExpensesNavigation(taxYear, userAnswers, countryCode) case ForeignExpensesSectionCompletePage(_) => taxYear => _ => _ => SummaryController.show(taxYear) + //Allowances case ForeignZeroEmissionCarAllowancePage(countryCode) => taxYear => _ => _ => ForeignZeroEmissionGoodsVehiclesController.onPageLoad(taxYear, countryCode, NormalMode) @@ -103,9 +106,40 @@ class ForeignPropertyNavigator { taxYear => _ => _ => ForeignOtherCapitalAllowancesController.onPageLoad(taxYear, countryCode, NormalMode) case ForeignOtherCapitalAllowancesPage(countryCode) => // TODO route to CYA page once created taxYear => _ => _ => ForeignAllowancesCheckYourAnswersController.onPageLoad(taxYear, countryCode) + // Allowances // Structure Building Allowance + case ForeignClaimStructureBuildingAllowancePage(countryCode) => + taxYear => _ => userAnswers => foreignSbaNavigation(taxYear, userAnswers, countryCode) + case ForeignStructureBuildingQualifyingDatePage(countryCode, index) => + taxYear => _ => _ => ForeignStructureBuildingQualifyingAmountController.onPageLoad(taxYear, countryCode, index, NormalMode) + case ForeignStructureBuildingQualifyingAmountPage(countryCode, index) => + taxYear => _ => _ => ForeignStructureBuildingAllowanceClaimController.onPageLoad(taxYear, countryCode, index, NormalMode) + case ForeignStructureBuildingAllowanceClaimPage(countryCode, index) => + taxYear => _ => _ => ForeignStructuresBuildingAllowanceAddressController.onPageLoad(taxYear, index, countryCode, NormalMode) + case ForeignStructuresBuildingAllowanceAddressPage(index, countryCode) => + taxYear => _ => _ => ForeignSbaCheckYourAnswersController.onPageLoad(taxYear,countryCode, index) + case ForeignSbaRemoveConfirmationPage(countryCode) => + taxYear => _ => userAnswers => foreignSbaRemoveConfirmationNavigationNormalMode(taxYear, userAnswers, countryCode) + case ForeignSbaCompletePage(_) => + taxYear => _ => _ => SummaryController.show(taxYear) + + case _ => _ => _ => _ => controllers.routes.IndexController.onPageLoad } + private def foreignSbaRemoveConfirmationNavigationNormalMode( + taxYear: Int, + userAnswers: UserAnswers, + countryCode: String + ): Call = ( + userAnswers.get(ForeignSbaRemoveConfirmationPage(countryCode)), + userAnswers.get(ForeignStructureBuildingAllowanceGroup(countryCode)) + ) match { + case (Some(true), Some(sbaForm)) if sbaForm.isEmpty => + ForeignAddClaimStructureBuildingAllowanceController.onPageLoad(taxYear, countryCode) + case (_, Some(sbaForm)) if sbaForm.nonEmpty => ForeignStructureBuildingAllowanceClaimsController.onPageLoad(taxYear, countryCode) + case (_, _) => SummaryController.show(taxYear) + } + private def consolidatedExpensesNavigation(taxYear: Int, userAnswers: UserAnswers, countryCode: String): Call = userAnswers.get(ConsolidatedOrIndividualExpensesPage(countryCode)) match { case Some(ConsolidatedOrIndividualExpenses(true, _)) => @@ -184,6 +218,17 @@ class ForeignPropertyNavigator { taxYear => _ => _ => ForeignAllowancesCheckYourAnswersController.onPageLoad(taxYear, countryCode) case ForeignOtherCapitalAllowancesPage(countryCode) => taxYear => _ => _ => ForeignAllowancesCheckYourAnswersController.onPageLoad(taxYear, countryCode) + // Allowances // Structure Building Allowance + case ForeignStructureBuildingQualifyingDatePage(countryCode, index) => + taxYear => _ => _ => ForeignSbaCheckYourAnswersController.onPageLoad(taxYear,countryCode, index) + case ForeignStructureBuildingQualifyingAmountPage(countryCode, index) => + taxYear => _ => _ => ForeignSbaCheckYourAnswersController.onPageLoad(taxYear,countryCode, index) + case ForeignStructureBuildingAllowanceClaimPage(countryCode, index) => + taxYear => _ => _ => ForeignSbaCheckYourAnswersController.onPageLoad(taxYear,countryCode, index) + case ForeignStructuresBuildingAllowanceAddressPage(index, countryCode) => + taxYear => _ => _ => ForeignSbaCheckYourAnswersController.onPageLoad(taxYear,countryCode, index) + + case _ => _ => _ => _ => controllers.routes.IndexController.onPageLoad } @@ -309,4 +354,15 @@ class ForeignPropertyNavigator { case _ => ForeignTaxCheckYourAnswersController.onSubmit(taxYear, countryCode) } + + private def foreignSbaNavigation( + taxYear: Int, + userAnswers: UserAnswers, + countryCode: String + ): Call = + userAnswers.get(ForeignClaimStructureBuildingAllowancePage(countryCode)) match { + case Some(true) => ForeignAddClaimStructureBuildingAllowanceController.onPageLoad(taxYear, countryCode) + // TODO - redirect to CYA for No Journey + case _ => SummaryController.show(taxYear) + } } diff --git a/app/pages/foreign/ForeignPropertySummaryPage.scala b/app/pages/foreign/ForeignPropertySummaryPage.scala index d3ae006d..a39c0d89 100644 --- a/app/pages/foreign/ForeignPropertySummaryPage.scala +++ b/app/pages/foreign/ForeignPropertySummaryPage.scala @@ -16,11 +16,12 @@ package pages.foreign -import models.{CheckMode, NormalMode, UserAnswers} +import models.{NormalMode, UserAnswers} import pages.foreign.allowances.ForeignAllowancesCompletePage import pages.foreign.expenses.ForeignExpensesSectionCompletePage import pages.foreign.income.ForeignIncomeSectionCompletePage -import pages.foreign.structurebuildingallowance.ForeignSbaCompletePage +import pages.foreign.structurebuildingallowance.{ForeignClaimStructureBuildingAllowancePage, ForeignSbaCompletePage, ForeignStructureBuildingAllowanceGroup} +import play.api.mvc.Call import viewmodels.summary.{TaskListItem, TaskListTag} case class ForeignPropertySummaryPage( @@ -150,7 +151,7 @@ object ForeignPropertySummaryPage { ), TaskListItem( "summary.structuresAndBuildingAllowance", - controllers.foreign.structuresbuildingallowance.routes.ForeignClaimStructureBuildingAllowanceController.onPageLoad(taxYear, countryCode, CheckMode), + getSbaRouteDestination(taxYear, countryCode, userAnswers, taskListTagForSba), taskListTagForSba, s"foreign_structure_and_building_allowance_$countryCode" ) @@ -159,4 +160,36 @@ object ForeignPropertySummaryPage { case None => taskList } } + + private def getSbaRouteDestination( + taxYear: Int, + countryCode: String, + userAnswers: Option[UserAnswers], + taskListTag: TaskListTag.TaskListTag + ): Call = { + taskListTag match { + case TaskListTag.InProgress | TaskListTag.Completed => + val answers = userAnswers.get + ( + answers.get(ForeignClaimStructureBuildingAllowancePage(countryCode)), + answers.get(ForeignStructureBuildingAllowanceGroup(countryCode)) + ) + match { + case (Some(true), Some(sbaForm)) if sbaForm.nonEmpty => + controllers.foreign.structuresbuildingallowance.routes + .ForeignStructureBuildingAllowanceClaimsController.onPageLoad(taxYear, countryCode) + + case (Some(false), _) => + controllers.foreign.structuresbuildingallowance.routes + // TODO - Redirect to CYA for No Journey + .ForeignClaimStructureBuildingAllowanceController.onPageLoad(taxYear, countryCode, NormalMode) + + case (_, _) => + controllers.foreign.structuresbuildingallowance.routes + .ForeignClaimStructureBuildingAllowanceController.onPageLoad(taxYear, countryCode, NormalMode) + } + case _ => + controllers.foreign.structuresbuildingallowance.routes.ForeignClaimStructureBuildingAllowanceController.onPageLoad(taxYear, countryCode, NormalMode) + } + } } diff --git a/app/pages/foreign/structurebuildingallowance/ForeignStructureBuildingAllowancePage.scala b/app/pages/foreign/structurebuildingallowance/ForeignStructureBuildingAllowancePage.scala index 94c3a5eb..abd7a94f 100644 --- a/app/pages/foreign/structurebuildingallowance/ForeignStructureBuildingAllowancePage.scala +++ b/app/pages/foreign/structurebuildingallowance/ForeignStructureBuildingAllowancePage.scala @@ -19,5 +19,6 @@ package pages.foreign.structurebuildingallowance case class ForeignStructureBuildingAllowancePage( taxYear: Int, countryCode: String, + nextIndex: Int, individualOrAgent: String ) diff --git a/app/viewmodels/checkAnswers/foreign/structurebuildingallowance/ForeignStructureBuildingAllowanceClaimsSummary.scala b/app/viewmodels/checkAnswers/foreign/structurebuildingallowance/ForeignStructureBuildingAllowanceClaimsSummary.scala index c1085f88..89dc57b0 100644 --- a/app/viewmodels/checkAnswers/foreign/structurebuildingallowance/ForeignStructureBuildingAllowanceClaimsSummary.scala +++ b/app/viewmodels/checkAnswers/foreign/structurebuildingallowance/ForeignStructureBuildingAllowanceClaimsSummary.scala @@ -17,7 +17,7 @@ package viewmodels.checkAnswers.foreign.structurebuildingallowance import controllers.foreign.structuresbuildingallowance.routes -import models.{CheckMode, ForeignSbaOnIndex, UserAnswers} +import models.{ForeignSbaOnIndex, UserAnswers} import play.api.i18n.Messages import play.twirl.api.HtmlFormat import uk.gov.hmrc.govukfrontend.views.Aliases.HtmlContent @@ -44,9 +44,8 @@ object ForeignStructureBuildingAllowanceClaimsSummary { actions = Seq( ActionItemViewModel( "site.change", - // TODO - change to CYA page load - routes.ForeignStructureBuildingAllowanceClaimController - .onPageLoad(taxYear, countryCode, index, CheckMode) + routes.ForeignSbaCheckYourAnswersController + .onPageLoad(taxYear, countryCode, index) .url ).withVisuallyHiddenText(messages("foreignStructureBuildingAllowanceClaims.change.hidden")), @@ -57,6 +56,5 @@ object ForeignStructureBuildingAllowanceClaimsSummary { ), actionsCss = "w-25" ) - }.orElse(Option.empty[SummaryListRow]) } diff --git a/app/viewmodels/checkAnswers/foreign/structurebuildingallowance/ForeignStructureBuildingQualifyingDateSummary.scala b/app/viewmodels/checkAnswers/foreign/structurebuildingallowance/ForeignStructureBuildingQualifyingDateSummary.scala index 70b05c45..481ed2a2 100644 --- a/app/viewmodels/checkAnswers/foreign/structurebuildingallowance/ForeignStructureBuildingQualifyingDateSummary.scala +++ b/app/viewmodels/checkAnswers/foreign/structurebuildingallowance/ForeignStructureBuildingQualifyingDateSummary.scala @@ -16,6 +16,7 @@ package viewmodels.checkAnswers.foreign.structurebuildingallowance +import controllers.foreign.structuresbuildingallowance.routes import models.{CheckMode, UserAnswers} import pages.foreign.structurebuildingallowance.ForeignStructureBuildingQualifyingDatePage import play.api.i18n.Messages @@ -40,7 +41,9 @@ object ForeignStructureBuildingQualifyingDateSummary { actions = Seq( ActionItemViewModel( "site.change", - controllers.foreign.structuresbuildingallowance.routes.ForeignStructureBuildingQualifyingDateController.onPageLoad(taxYear, countryCode, index, CheckMode).url + routes.ForeignStructureBuildingQualifyingDateController + .onPageLoad(taxYear, countryCode, index, CheckMode) + .url ) .withVisuallyHiddenText(messages("foreignStructureBuildingQualifyingDate.change.hidden")) ) diff --git a/app/views/foreign/structurebuildingallowance/ForeignClaimStructureBuildingAllowanceView.scala.html b/app/views/foreign/structurebuildingallowance/ForeignClaimStructureBuildingAllowanceView.scala.html index 681f488b..cda0cf17 100644 --- a/app/views/foreign/structurebuildingallowance/ForeignClaimStructureBuildingAllowanceView.scala.html +++ b/app/views/foreign/structurebuildingallowance/ForeignClaimStructureBuildingAllowanceView.scala.html @@ -27,7 +27,7 @@ @(form: Form[_], taxYear: Int, countryCode: String, mode: Mode, individualOrAgent: String)(implicit request: Request[_], messages: Messages) - @layout(pageTitle = title(form, messages("foreignClaimStructureBuildingAllowance.title"))) { + @layout(pageTitle = title(form, messages(s"foreignClaimStructureBuildingAllowance.title.$individualOrAgent"))) { @formHelper(action = controllers.foreign.structuresbuildingallowance.routes.ForeignClaimStructureBuildingAllowanceController.onSubmit(taxYear, countryCode, mode), Symbol("autoComplete") -> "off") { @@ -38,8 +38,8 @@

@messages("foreignClaimStructureBuildingAllowance.heading")

-

@messages("foreignClaimStructureBuildingAllowance.details.content")

-

@messages(s"foreignClaimStructureBuildingAllowance.details.p1")

+

@messages(s"foreignClaimStructureBuildingAllowance.details.content.$individualOrAgent")

+

@messages(s"foreignClaimStructureBuildingAllowance.details.p1.$individualOrAgent")