Skip to content

Commit

Permalink
Merge 1446d35 into 6ff2db5
Browse files Browse the repository at this point in the history
  • Loading branch information
acsauk authored Nov 17, 2023
2 parents 6ff2db5 + 1446d35 commit 2b89d52
Show file tree
Hide file tree
Showing 9 changed files with 80 additions and 21 deletions.
19 changes: 15 additions & 4 deletions cypress/e2e/certificate-provider/certificate-provided.cy.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,21 @@
describe('Certificate provided', () => {
beforeEach(() => {
cy.visit('/fixtures/certificate-provider?redirect=/certificate-provided');
it('has a print this page link', () => {
cy.on('window:before:load', (win) => {
cy.stub(win, 'print')
})

cy.visit('/fixtures/certificate-provider?redirect=/certificate-provided')

cy.checkA11yApp();

cy.contains('a', 'Print this page').click();
cy.window().its('print').should('be.called')
});

it('has a button to the dashboard', () => {
cy.checkA11yApp();
cy.contains('a', 'Go to your dashboard');
cy.visit('/fixtures/certificate-provider?redirect=/certificate-provided')

cy.contains('a', 'Go to your dashboard').click();
cy.url().should('contain', '/dashboard');
});
})
18 changes: 14 additions & 4 deletions internal/page/certificateprovider/guidance.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,19 @@ import (
"net/http"

"github.com/ministryofjustice/opg-go-common/template"
"github.com/ministryofjustice/opg-modernising-lpa/internal/actor"
"github.com/ministryofjustice/opg-modernising-lpa/internal/page"
"github.com/ministryofjustice/opg-modernising-lpa/internal/validation"
)

type guidanceData struct {
App page.AppData
Errors validation.List
Lpa *page.Lpa
App page.AppData
Errors validation.List
Lpa *page.Lpa
CertificateProvider *actor.CertificateProviderProvidedDetails
}

func Guidance(tmpl template.Template, donorStore DonorStore) page.Handler {
func Guidance(tmpl template.Template, donorStore DonorStore, certificateProviderStore CertificateProviderStore) page.Handler {
return func(appData page.AppData, w http.ResponseWriter, r *http.Request) error {
data := &guidanceData{
App: appData,
Expand All @@ -28,6 +30,14 @@ func Guidance(tmpl template.Template, donorStore DonorStore) page.Handler {
data.Lpa = lpa
}

if certificateProviderStore != nil {
certificateProvider, err := certificateProviderStore.Get(r.Context())
if err != nil {
return err
}
data.CertificateProvider = certificateProvider
}

return tmpl(w, data)
}
}
8 changes: 4 additions & 4 deletions internal/page/certificateprovider/register.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,10 @@ func Register(
handleCertificateProvider(page.Paths.CertificateProvider.ConfirmYourDetails,
ConfirmYourDetails(tmpls.Get("certificate_provider_confirm_your_details.gohtml"), donorStore, certificateProviderStore))
handleCertificateProvider(page.Paths.CertificateProvider.YourRole,
Guidance(tmpls.Get("certificate_provider_your_role.gohtml"), donorStore))
Guidance(tmpls.Get("certificate_provider_your_role.gohtml"), donorStore, nil))

handleCertificateProvider(page.Paths.CertificateProvider.ProveYourIdentity,
Guidance(tmpls.Get("certificate_provider_prove_your_identity.gohtml"), nil))
Guidance(tmpls.Get("certificate_provider_prove_your_identity.gohtml"), nil, nil))
handleCertificateProvider(page.Paths.CertificateProvider.IdentityWithOneLogin,
IdentityWithOneLogin(logger, oneLoginClient, sessionStore, random.String))
handleCertificateProvider(page.Paths.CertificateProvider.IdentityWithOneLoginCallback,
Expand All @@ -121,11 +121,11 @@ func Register(
handleCertificateProvider(page.Paths.CertificateProvider.ReadTheLpa,
ReadTheLpa(tmpls.Get("certificate_provider_read_the_lpa.gohtml"), donorStore, certificateProviderStore))
handleCertificateProvider(page.Paths.CertificateProvider.WhatHappensNext,
Guidance(tmpls.Get("certificate_provider_what_happens_next.gohtml"), donorStore))
Guidance(tmpls.Get("certificate_provider_what_happens_next.gohtml"), donorStore, nil))
handleCertificateProvider(page.Paths.CertificateProvider.ProvideCertificate,
ProvideCertificate(tmpls.Get("provide_certificate.gohtml"), donorStore, time.Now, certificateProviderStore))
handleCertificateProvider(page.Paths.CertificateProvider.CertificateProvided,
Guidance(tmpls.Get("certificate_provided.gohtml"), donorStore))
Guidance(tmpls.Get("certificate_provided.gohtml"), donorStore, certificateProviderStore))
}

func makeHandle(mux *http.ServeMux, store sesh.Store, errorHandler page.ErrorHandler) func(page.Path, page.Handler) {
Expand Down
8 changes: 6 additions & 2 deletions lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,10 @@
"optionB": "No - I <span class=\"govuk-!-font-weight-bold\">do not</span> give my attorneys authority to give or refuse consent to life-sustaining treatment on my behalf",
"ifTheDonorGivesConsentToLifeSustainingTreatment": "if you do or do not give your attorneys authority to give or refuse consent to life-sustaining treatment on your behalf",
"youveProvidedTheCertificateForThisLpa": "You’ve provided the certificate for this LPA",
"certificateProvidedContent": "<p class=\"govuk-body\">You have now signed and provided the certificate for this LPA.</p> <p class=\"govuk-body\">This means you’ve done everything you need to do as {{ .DonorFirstNamesPossessive }} certificate provider.</p> <h2 class=\"govuk-heading-m\">What happens next</h2> <p class=\"govuk-body\">If the Office of the Public Guardian ever has any concerns about {{ .DonorFirstNamesPossessive }} LPA in future, we may contact you.</p> <p class=\"govuk-body\">If you ever need to report a concern, you can do this at any time using the <a href=\"#\" class=\"govuk-link\">report a concern about an LPA service</a>.</p>",
"certificateProvidedContent": "<p class=\"govuk-body\">{{ .CertificateProviderFullName }}, you have now signed and provided the certificate for this LPA.</p>",
"certificateDetails": "<div class=\"govuk-inset-text\"> <p class=\"govuk-!-margin-bottom-1\"><span class=\"govuk-!-font-weight-bold\">Date and time certificate signed:</span> {{ .AgreedTimeStamp }}</p> <p class=\"govuk-!-margin-bottom-1 govuk-!-margin-top-1\"><span class=\"govuk-!-font-weight-bold\">Donor name:</span> {{ .DonorFullName }}</p> <p class=\"govuk-!-margin-top-1\"><span class=\"govuk-!-font-weight-bold\">LPA reference number:</span> {{ .LpaUID }}</p></div>",
"thisMeansYouveDoneEverythingContent": "<p class=\"govuk-body\">This means you’ve done everything you need to do as {{ .DonorFullNamePossessive }} certificate provider.</p> <h2 class=\"govuk-heading-m\">What happens next</h2> <p class=\"govuk-body\">You will no longer be able to view or access this LPA from your dashboard.</p> <p class=\"govuk-body\">We have sent an email confirming that you provided your certificate for this LPA to <span class=\"govuk-!-font-weight-bold\">{{ .CertificateProviderEmail }}</span></p> <p class=\"govuk-body\">If you would like a paper record, you can also print a copy of this page.</p>",
"certificateProvidedConcerns": "<p class=\"govuk-body\">If the Office of the Public Guardian ever has any concerns about {{ .DonorFirstNamesPossessive }} LPA in future, we may contact you.</p> <p class=\"govuk-body\">If you ever need to report a concern, you can do this at any time using the <a href=\"/\" class=\"govuk-link\">report a concern about an LPA service</a>.</p>",
"goToYourDashboard": "Go to your dashboard",
"beAnAttorney": "Be an attorney on a lasting power of attorney (LPA)",
"enterYourAttorneyReferenceNumber": "Enter your reference number",
Expand Down Expand Up @@ -900,5 +903,6 @@
"yourHomeAddress": "Your home address",
"changeHomeAddressLink": "Change<span class=\"govuk-visually-hidden\"> home address</span>",
"homeAddress": "Home address",
"goToDashboard": "Go to dashboard"
"goToDashboard": "Go to dashboard",
"printThisPage": "Print this page"
}
7 changes: 7 additions & 0 deletions web/assets/scss/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,10 @@ body:not(.js-enabled) .govuk-back-link {
outline: inherit;
color: $govuk-link-colour;
}

@media print {
.app-hide-print {
display: none !important;
}
.govuk-grid-column-two-thirds { width: 100% !important; }
}
14 changes: 11 additions & 3 deletions web/template/certificate_provided.gohtml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,21 @@
{{ define "main" }}
<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
<div class="govuk-panel govuk-panel--confirmation">
<div class="govuk-panel govuk-panel--confirmation app-hide-print">
<h1 class="govuk-panel__title">{{ tr .App "youveProvidedTheCertificateForThisLpa" }}</h1>
</div>

{{ trFormatHtml .App "certificateProvidedContent" "DonorFirstNamesPossessive" (possessive .App .Lpa.Donor.FirstNames) }}
{{ trFormatHtml .App "certificateProvidedContent" "DonorFullName" .Lpa.Donor.FullName "DonorFirstNamesPossessive" (possessive .App .Lpa.Donor.FirstNames) "CertificateProviderFullName" .Lpa.CertificateProvider.FullName }}

<a href="{{ link .App .App.Paths.Dashboard.Format }}" class="govuk-button">{{ tr .App "goToYourDashboard" }}</a>
{{ trFormatHtml .App "certificateDetails" "AgreedTimeStamp" (formatDateTime .App .CertificateProvider.Certificate.Agreed) "LpaUID" .Lpa.UID "DonorFullName" .Lpa.Donor.FullName }}

{{ trFormatHtml .App "thisMeansYouveDoneEverythingContent" "DonorFullNamePossessive" (possessive .App .Lpa.Donor.FullName) "CertificateProviderEmail" .Lpa.CertificateProvider.Email }}

{{ template "print-this-page" . }}

{{ trFormatHtml .App "certificateProvidedConcerns" "DonorFirstNamesPossessive" (possessive .App .Lpa.Donor.FirstNames) }}

<a href="{{ link .App .App.Paths.Dashboard.Format }}" class="govuk-button app-hide-print">{{ tr .App "goToYourDashboard" }}</a>
</div>
</div>
{{ end }}
2 changes: 1 addition & 1 deletion web/template/layout/login-header.gohtml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
<div class="govuk-grid-column-two-thirds">
<h2 class="service-header__heading">{{ tr .App "serviceName" }}</h2>
</div>
<div class="govuk-grid-column-one-third">
<div class="govuk-grid-column-one-third app-hide-print">
<button type="button"
aria-controls="service-header__nav"
data-open-class="cross-service-header__button--open"
Expand Down
6 changes: 3 additions & 3 deletions web/template/layout/page.gohtml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
{{ end }}

<div class="govuk-width-container app-width-container">
<div class="govuk-phase-banner">
<div class="govuk-phase-banner app-hide-print">
<p class="govuk-phase-banner__content">
<strong class="govuk-tag govuk-phase-banner__content__tag">
beta
Expand All @@ -108,7 +108,7 @@
<a class="govuk-back-link" href="#">Back</a>
{{ end }}

<ul class="trans-switch" id="language-switch" aria-label="Change your language">
<ul class="trans-switch app-hide-print" id="language-switch" aria-label="Change your language">
<li class="govuk-list trans-switch__list govuk-body-s" id="language-switch-en" lang="en-gb">
{{ if isWelsh .App.Lang }}<a href="{{ .App.Path }}{{ .App.Query }}" class="govuk-link"><span class="govuk-visually-hidden">Change language to </span>{{ end }}
{{ if isEnglish .App.Lang }}<span class="govuk-visually-hidden">Current language is </span>{{ end }}
Expand All @@ -130,7 +130,7 @@
</main>
</div>

<footer class="govuk-footer " role="contentinfo">
<footer class="govuk-footer app-hide-print" role="contentinfo">
<div class="govuk-width-container ">
<div class="govuk-footer__meta">
<div class="govuk-footer__meta-item govuk-footer__meta-item--grow">
Expand Down
19 changes: 19 additions & 0 deletions web/template/layout/print-this-page.gohtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{{ define "print-this-page" }}
<p class="govuk-body">
<svg width="20" height="23" viewBox="0 0 20 23" fill="none" xmlns="http://www.w3.org/2000/svg" aria-labelledby="printer-icon-title">
<title id="printer-icon-title">{{ tr .App "printerIcon"}}</title>
<g id="Printer_icon 1" clip-path="url(#clip0_66_310)">
<path id="Vector" fill-rule="evenodd" clip-rule="evenodd" d="M20 9H15V0H9C8.23612 1.4641 7.37904 2.3923 6.29231 3.56922C5.89454 4 5.466 4.4641 5 5V9H0V18H5V23H15V18L20 17.8529V9ZM14 22H6V15H14V22ZM16 11H18V13H16V11ZM14 1H9V5H6V9H14V1Z" fill="black"/>
<path id="Vector_2" fill-rule="evenodd" clip-rule="evenodd" d="M7 16H13V17H7V16Z" fill="#0B0C0C"/>
<path id="Vector_3" fill-rule="evenodd" clip-rule="evenodd" d="M7 18H13V19H7V18Z" fill="#0B0C0C"/>
<path id="Vector_4" fill-rule="evenodd" clip-rule="evenodd" d="M7 20H13V21H7V20Z" fill="#0B0C0C"/>
</g>
<defs>
<clipPath id="clip0_66_310">
<rect width="20" height="23" fill="white"/>
</clipPath>
</defs>
</svg>
<a href="#" class="govuk-link" onclick="window.print()">{{ tr .App "printThisPage"}}</a>
</p>
{{ end }}

0 comments on commit 2b89d52

Please sign in to comment.