Skip to content

Commit

Permalink
Merge branch 'main' into certificate-provider-handler
Browse files Browse the repository at this point in the history
  • Loading branch information
hawx authored Jul 24, 2024
2 parents 050a728 + abd4e01 commit eee40a1
Show file tree
Hide file tree
Showing 5 changed files with 86 additions and 43 deletions.
4 changes: 3 additions & 1 deletion internal/page/paths.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,9 @@ func (p LpaPath) canVisit(donor *actor.DonorProvidedDetails) bool {
Paths.WitnessingAsCertificateProvider,
Paths.WitnessingAsIndependentWitness,
Paths.YouHaveSubmittedYourLpa:
return donor.DonorIdentityConfirmed() || donor.RegisteringWithCourtOfProtection || donor.Voucher.FirstNames != ""
return section1Completed &&
(donor.Tasks.PayForLpa.IsCompleted() || donor.Tasks.PayForLpa.IsPending()) &&
(donor.DonorIdentityConfirmed() || donor.RegisteringWithCourtOfProtection || donor.Voucher.FirstNames != "")

case Paths.ConfirmYourCertificateProviderIsNotRelated,
Paths.CheckYourLpa:
Expand Down
28 changes: 28 additions & 0 deletions internal/page/paths_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (

"github.com/ministryofjustice/opg-modernising-lpa/internal/actor"
"github.com/ministryofjustice/opg-modernising-lpa/internal/form"
"github.com/ministryofjustice/opg-modernising-lpa/internal/identity"
"github.com/ministryofjustice/opg-modernising-lpa/internal/localize"
"github.com/stretchr/testify/assert"
)
Expand Down Expand Up @@ -341,6 +342,33 @@ func TestDonorCanGoTo(t *testing.T) {
url: Paths.IdentityWithOneLogin.Format("123"),
expected: true,
},
"read lpa without task": {
donor: &actor.DonorProvidedDetails{},
url: Paths.ReadYourLpa.Format("123"),
expected: false,
},
"read lpa with tasks": {
donor: &actor.DonorProvidedDetails{
Donor: actor.Donor{
CanSign: form.Yes,
},
DonorIdentityUserData: identity.UserData{Status: identity.StatusConfirmed},
Type: actor.LpaTypePersonalWelfare,
Tasks: actor.DonorTasks{
YourDetails: actor.TaskCompleted,
ChooseAttorneys: actor.TaskCompleted,
ChooseReplacementAttorneys: actor.TaskCompleted,
LifeSustainingTreatment: actor.TaskCompleted,
Restrictions: actor.TaskCompleted,
CertificateProvider: actor.TaskCompleted,
PeopleToNotify: actor.TaskCompleted,
CheckYourLpa: actor.TaskCompleted,
PayForLpa: actor.PaymentTaskCompleted,
},
},
url: Paths.ReadYourLpa.Format("123"),
expected: true,
},
}

for name, tc := range testCases {
Expand Down
4 changes: 3 additions & 1 deletion lang/cy.json
Original file line number Diff line number Diff line change
Expand Up @@ -1309,5 +1309,7 @@
"whenYouConfirmWeWillContactToExplain": "Welsh {{.DonorFullName}}",
"youHaveConfirmedYouDoNotWantToBeAttorney": "Welsh",
"youHaveConfirmedYouDoNotWantToBeDonorsAttorney": "Welsh {{.DonorFullNamePossessive}}",
"youHaveConfirmedYouDoNotWantToBeAttorneyContent": "<p class=\"govuk-body\">Welsh {{.DonorFirstNames}}</p>"
"youHaveConfirmedYouDoNotWantToBeAttorneyContent": "<p class=\"govuk-body\">Welsh {{.DonorFirstNames}}</p>",
"youHaveChosenNotToFormallyNotifyAnyone": "Welsh",
"theDonorHasChosenNotToFormallyNotifyAnyone": "Welsh"
}
4 changes: 3 additions & 1 deletion lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1238,5 +1238,7 @@
"whenYouConfirmWeWillContactToExplain": "When you confirm, we will contact {{.DonorFullName}} to explain what they can do next.",
"youHaveConfirmedYouDoNotWantToBeAttorney": "You have confirmed that you do not want to be an attorney",
"youHaveConfirmedYouDoNotWantToBeDonorsAttorney": "You have confirmed that you do not want to be {{.DonorFullNamePossessive}} attorney.",
"youHaveConfirmedYouDoNotWantToBeAttorneyContent": "<p class=\"govuk-body\">We have let {{.DonorFirstNames}} know about your decision.</p><p class=\"govuk-body\">You do not need to do anything else.</p>"
"youHaveConfirmedYouDoNotWantToBeAttorneyContent": "<p class=\"govuk-body\">We have let {{.DonorFirstNames}} know about your decision.</p><p class=\"govuk-body\">You do not need to do anything else.</p>",
"youHaveChosenNotToFormallyNotifyAnyone": "You have chosen not to formally notify anyone of the registration of this LPA.",
"theDonorHasChosenNotToFormallyNotifyAnyone": "The donor has chosen not to formally notify anyone of the registration of this LPA."
}
89 changes: 49 additions & 40 deletions web/template/layout/contextual-lpa.gohtml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
.Email
""
.FullName false $isDonor) }}

{{ template "address-summary-row" (summaryRow $.App "address"
.Address
(fromLink $.App global.Paths.YourAddress "#f-address-line-1")
Expand Down Expand Up @@ -257,33 +257,42 @@
{{ end }}
{{ end }}

{{ range .Donor.PeopleToNotify }}
<div class="govuk-summary-card">
<div class="govuk-summary-card__title-wrapper">
<h2 class="govuk-summary-card__title">{{ tr $.App "personToNotify" }}: <span class="app-unbold">{{ .FullName }}</span></h2>
{{ if .Donor.DoYouWantToNotifyPeople.IsYes }}
{{ range .Donor.PeopleToNotify }}
<div class="govuk-summary-card">
<div class="govuk-summary-card__title-wrapper">
<h2 class="govuk-summary-card__title">{{ tr $.App "personToNotify" }}: <span class="app-unbold">{{ .FullName }}</span></h2>

{{ if $canChange }}
<ul class="govuk-summary-card__actions">
<li class="govuk-summary-card__action">
<a class="govuk-link govuk-link--no-visited-state" href="{{ fromLinkActor $.App global.Paths.RemovePersonToNotify .UID "" }}">{{ tr $.App "removePersonToNotify" }}</a>
</li>
</ul>
{{ end }}
</div>
<div class="govuk-summary-card__content">
<dl class="govuk-summary-list">
{{ template "summary-row" (summaryRow $.App "name"
.FullName
(fromLinkActor $.App global.Paths.ChoosePeopleToNotify .UID "#f-first-names")
.FullName $canChange false ) }}
{{ if $canChange }}
<ul class="govuk-summary-card__actions">
<li class="govuk-summary-card__action">
<a class="govuk-link govuk-link--no-visited-state" href="{{ fromLinkActor $.App global.Paths.RemovePersonToNotify .UID "" }}">{{ tr $.App "removePersonToNotify" }}</a>
</li>
</ul>
{{ end }}
</div>
<div class="govuk-summary-card__content">
<dl class="govuk-summary-list">
{{ template "summary-row" (summaryRow $.App "name"
.FullName
(fromLinkActor $.App global.Paths.ChoosePeopleToNotify .UID "#f-first-names")
.FullName $canChange false ) }}

{{ template "address-summary-row" (summaryRow $.App "address"
.Address
(fromLinkActor $.App global.Paths.ChoosePeopleToNotifyAddress .UID "#f-address-line-1")
.FullName $canChange false ) }}
</dl>
{{ template "address-summary-row" (summaryRow $.App "address"
.Address
(fromLinkActor $.App global.Paths.ChoosePeopleToNotifyAddress .UID "#f-address-line-1")
.FullName $canChange false ) }}
</dl>
</div>
</div>
</div>
{{ end }}
{{ else }}
{{ $label := "theDonorHasChosenNotToFormallyNotifyAnyone" }}
{{ if $isDonor }}
{{ $label = "youHaveChosenNotToFormallyNotifyAnyone" }}
{{ end }}

<p class="govuk-body">{{ tr .App $label }}</p>
{{ end }}

{{ if .Donor.AuthorisedSignatory.FirstNames }}
Expand All @@ -303,7 +312,7 @@
</div>
{{ end }}
{{ end }}

{{ if .Donor.IndependentWitness.FirstNames }}
{{ with .Donor.IndependentWitness }}
<div class="govuk-summary-card">
Expand Down Expand Up @@ -336,7 +345,7 @@

<h2 class="govuk-heading-m">{{ tr .App "howLpaCanBeUsed" }}</h2>

<dl class="govuk-summary-list app-stacked-summary-list">
<dl class="govuk-summary-list app-stacked-summary-list">
{{ with .Donor.WhenCanTheLpaBeUsed }}
{{ $label := "whenAttorneysCanUseTheLpa" }}
{{ $value := printf "%s:3rd" .String }}
Expand All @@ -345,13 +354,13 @@
{{ $label = "whenYourAttorneysCanUseYourLpa" }}
{{ $value = .String }}
{{ end }}

{{ template "summary-row" (summaryRow $.App $label
(tr $.App $value)
(fromLink $.App global.Paths.WhenCanTheLpaBeUsed "")
$donorFullName (and $canChange $isPropertyAndAffairs) $isDonor) }}
{{ end }}

{{ if .Donor.Type.IsPersonalWelfare }}
{{ $value := "optionB" }}
{{ if .Donor.LifeSustainingTreatmentOption.IsOptionA }}
Expand All @@ -363,17 +372,17 @@
(fromLink .App global.Paths.LifeSustainingTreatment "")
$donorFullName $canChange $isDonor) }}
{{ end }}

{{ if .Donor.AttorneyDecisions.How }}
{{ with .Donor.AttorneyDecisions.How }}
{{ $label := "howAttorneysMustMakeDecisions" }}
{{ $value := .String }}

{{ if $isDonor }}
{{ $label = "howYourAttorneysMustMakeDecisions" }}
{{ $value = printf "your-%s" .String }}
{{ end }}

{{ template "summary-row" (summaryRow $.App $label
(tr $.App $value)
(fromLink $.App global.Paths.HowShouldAttorneysMakeDecisions "")
Expand All @@ -394,37 +403,37 @@
{{ else if .IsWhenAllCanNoLongerAct }}
{{ $value = "whenNoneCanNoLongerAct" }}
{{ end }}

{{ template "summary-row" (summaryRow $.App $label
(trHtml $.App $value)
(fromLink $.App global.Paths.HowShouldReplacementAttorneysStepIn "")
$donorFullName $canChange $isDonor) }}
$donorFullName $canChange $isDonor) }}
{{ end }}
{{ end }}

{{ if .Donor.ReplacementAttorneyDecisions.How }}
{{ with .Donor.ReplacementAttorneyDecisions.How }}
{{ $label := "howReplacementAttorneysMustMakeDecisions" }}
{{ $value := .String }}

{{ if $isDonor }}
{{ $label = "howYourReplacementAttorneysMustMakeDecisions" }}
{{ $value = printf "your-%s" .String }}
{{ end }}

{{ template "summary-row" (summaryRow $.App $label
(tr $.App $value)
(fromLink $.App global.Paths.HowShouldReplacementAttorneysMakeDecisions "")
$donorFullName $canChange $isDonor) }}
{{ end }}
{{ end }}
</dl>

{{ template "contextual-lpa-warning" . }}

<h2 class="govuk-heading-m">{{ tr .App "restrictions" }}</h2>

<dl class="govuk-summary-list app-stacked-summary-list">
<dl class="govuk-summary-list app-stacked-summary-list">
{{ if .Donor.AttorneyDecisions.How.IsJointlyForSomeSeverallyForOthers }}
{{ $label := "decisionsAttorneysMustMakeTogether" }}

Expand All @@ -450,7 +459,7 @@
(fromLink $.App global.Paths.HowShouldReplacementAttorneysStepIn "#f-other-details")
$donorFullName $canChange $isDonor) }}
{{ end }}

{{ if .Donor.ReplacementAttorneyDecisions.How.IsJointlyForSomeSeverallyForOthers }}
{{ $label := "decisionsReplacementAttorneysMustMakeTogether" }}

Expand Down

0 comments on commit eee40a1

Please sign in to comment.