Skip to content

Commit

Permalink
PSR-1510_Check-Status | (WIP) - functional but no tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ccatosdevelopment committed Oct 22, 2024
1 parent 9cd4a52 commit 1efb26d
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 7 deletions.
16 changes: 10 additions & 6 deletions app/utils/nonsipp/TaskListStatusUtils.scala
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import pages.nonsipp.landorproperty._
import pages.nonsipp.receivetransfer.{DidSchemeReceiveTransferPage, TransfersInSectionCompleted}
import pages.nonsipp.landorpropertydisposal.{LandOrPropertyDisposalPage, LandPropertyDisposalCompletedPages}
import pages.nonsipp.sharesdisposal._
import play.api.libs.json.{JsObject, JsPath}
import pages.nonsipp.membersurrenderedbenefits.{SurrenderedBenefitsCompleted, SurrenderedBenefitsPage}
import models._
import pages.nonsipp.loansmadeoroutstanding._
Expand All @@ -39,6 +38,8 @@ import pages.nonsipp.accountingperiod.Paths.accountingPeriodDetails
import pages.nonsipp.memberreceivedpcls.{PensionCommencementLumpSumAmountPage, PensionCommencementLumpSumPage}
import pages.nonsipp.memberpensionpayments.{PensionPaymentsReceivedPage, TotalAmountPensionPaymentsPage}
import eu.timepit.refined.refineV
import utils.nonsipp.ValidationUtils.answersMissingLandOrPropertySection
import play.api.libs.json.{JsObject, JsPath}
import viewmodels.models.TaskListStatus._
import pages.nonsipp.schemedesignatory.Paths.schemeDesignatory
import pages.nonsipp.common.IdentityTypes
Expand Down Expand Up @@ -453,11 +454,14 @@ object TaskListStatusUtils {
.url
)

(wereLandOrProperties, numRecorded) match {
case (None, _) => (NotStarted, firstQuestionPageUrl)
case (Some(false), _) => (Recorded(0, ""), firstQuestionPageUrl)
case (Some(true), 0) => (InProgress, inProgressCalculatedUrl)
case (Some(true), _) => (Recorded(numRecorded, "landOrProperties"), listPageUrl)
val ifNeedsChecking = answersMissingLandOrPropertySection(userAnswers, srn)

(wereLandOrProperties, numRecorded, ifNeedsChecking) match {
case (_, _, true) => (Check, listPageUrl) // TODO: navigate to new list page
case (None, _, false) => (NotStarted, firstQuestionPageUrl)
case (Some(false), _, false) => (Recorded(0, ""), firstQuestionPageUrl)
case (Some(true), 0, false) => (InProgress, inProgressCalculatedUrl)
case (Some(true), _, false) => (Recorded(numRecorded, "landOrProperties"), listPageUrl)
}
}

Expand Down
3 changes: 2 additions & 1 deletion app/utils/nonsipp/TaskListUtils.scala
Original file line number Diff line number Diff line change
Expand Up @@ -501,8 +501,9 @@ object TaskListUtils {
val numSectionsUnableToStart = items.count(_.status == UnableToStart)
val numSectionsNotStarted = items.count(_.status == NotStarted)
val numSectionsInProgress = items.count(_.status == InProgress)
val numSectionsCheck = items.count(_.status == Check)
val numSectionsReadyForSubmission =
numSectionsTotal - (numSectionsUnableToStart + numSectionsNotStarted + numSectionsInProgress)
numSectionsTotal - (numSectionsUnableToStart + numSectionsNotStarted + numSectionsInProgress + numSectionsCheck)

(numSectionsReadyForSubmission, numSectionsTotal)
}
Expand Down
2 changes: 2 additions & 0 deletions app/viewmodels/models/TaskListViewModel.scala
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ object TaskListStatus {

case object Updated extends TaskListStatus("tasklist.updated")

case object Check extends TaskListStatus("tasklist.check")

case object Recorded extends TaskListStatus("tasklist.recorded")

case class Recorded(numRecorded: Int, itemKey: String)
Expand Down
11 changes: 11 additions & 0 deletions app/views/components/TaskListItems.scala.html
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,17 @@
</strong>
</span>
</li>
} else if(item.status == Check) {
<li class="govuk-task-list__item govuk-task-list__item--with-link">
<span class="govuk-task-list__name-and-hint">
@renderMessage(item.link.withAttr("aria-describedby", id).withAttr("class", "govuk-task-list__link"))
</span>
<span class="govuk-task-list__status" id="@id">
<strong class="govuk-tag govuk-tag--yellow">
@renderMessage(item.status.description)
</strong>
</span>
</li>
} else {
<li class="govuk-task-list__item govuk-task-list__item--with-link">
<span class="govuk-task-list__name-and-hint">
Expand Down
1 change: 1 addition & 0 deletions conf/messages.en
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ tasklist.updated = Updated
tasklist.recorded = Recorded
tasklist.noneRecorded = None recorded
tasklist.numItems = {0} {1}
tasklist.check = Check

members.singular = member
members.plural = members
Expand Down

0 comments on commit 1efb26d

Please sign in to comment.