Skip to content

Commit

Permalink
MLPAB-1287 MLPAB-1288 Show status on certificate provider cards and h…
Browse files Browse the repository at this point in the history
…ide when done (#729)
  • Loading branch information
hawx authored Sep 26, 2023
1 parent 3654501 commit b0bce1e
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 13 deletions.
4 changes: 4 additions & 0 deletions internal/app/dashboard_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,10 @@ func (s *dashboardStore) GetAll(ctx context.Context) (donor, attorney, certifica
return nil, nil, nil, err
}

if certificateProviderProvidedDetails.Certificate.AgreeToStatement {
delete(certificateProviderMap, certificateProviderProvidedDetails.LpaID)
}

if entry, ok := certificateProviderMap[certificateProviderProvidedDetails.LpaID]; ok {
entry.CertificateProviderTasks = certificateProviderProvidedDetails.Tasks
certificateProviderMap[certificateProviderProvidedDetails.LpaID] = entry
Expand Down
11 changes: 11 additions & 0 deletions internal/app/dashboard_store_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ func TestDashboardStoreGetAll(t *testing.T) {
LpaID: "789", Tasks: actor.AttorneyTasks{ConfirmYourDetails: actor.TaskInProgress}, SK: attorneyKey("an-id"),
}
lpaNoUID := &page.Lpa{ID: "999", UpdatedAt: time.Date(2000, time.January, 1, 0, 0, 0, 0, time.UTC), SK: donorKey("an-id"), PK: lpaKey("0")}
lpaSignedByCp := &page.Lpa{ID: "signed-by-cp", UID: "M", SK: donorKey("another-id"), PK: lpaKey("signed-by-cp")}
lpaSignedByCpProvidedDetails := &actor.CertificateProviderProvidedDetails{
LpaID: "signed-by-cp", SK: certificateProviderKey("an-id"), Certificate: actor.Certificate{AgreeToStatement: true},
}

testCases := map[string][]map[string]types.AttributeValue{
"details returned after lpas": {
Expand All @@ -34,14 +38,18 @@ func TestDashboardStoreGetAll(t *testing.T) {
makeAttributeValueMap(lpa789),
makeAttributeValueMap(lpa789AttorneyProvidedDetails),
makeAttributeValueMap(lpa0),
makeAttributeValueMap(lpaSignedByCp),
makeAttributeValueMap(lpaSignedByCpProvidedDetails),
},
"details returned before lpas": {
makeAttributeValueMap(lpaNoUID),
makeAttributeValueMap(lpa456CpProvidedDetails),
makeAttributeValueMap(lpa789AttorneyProvidedDetails),
makeAttributeValueMap(lpaSignedByCpProvidedDetails),
makeAttributeValueMap(lpa123),
makeAttributeValueMap(lpa456),
makeAttributeValueMap(lpa789),
makeAttributeValueMap(lpaSignedByCp),
makeAttributeValueMap(lpa0),
},
}
Expand All @@ -58,6 +66,7 @@ func TestDashboardStoreGetAll(t *testing.T) {
{PK: "LPA#789", SK: "#SUB#an-id", DonorKey: "#DONOR#different-id", ActorType: actor.TypeAttorney},
{PK: "LPA#0", SK: "#SUB#an-id", DonorKey: "#DONOR#an-id", ActorType: actor.TypeDonor},
{PK: "LPA#999", SK: "#SUB#an-id", DonorKey: "#DONOR#an-id", ActorType: actor.TypeDonor},
{PK: "LPA#signed-by-cp", SK: "#SUB#an-id", DonorKey: "#DONOR#another-id", ActorType: actor.TypeCertificateProvider},
}, nil)
dynamoClient.ExpectAllByKeys(ctx, []dynamo.Key{
{PK: "LPA#123", SK: "#DONOR#an-id"},
Expand All @@ -67,6 +76,8 @@ func TestDashboardStoreGetAll(t *testing.T) {
{PK: "LPA#789", SK: "#ATTORNEY#an-id"},
{PK: "LPA#0", SK: "#DONOR#an-id"},
{PK: "LPA#999", SK: "#DONOR#an-id"},
{PK: "LPA#signed-by-cp", SK: "#DONOR#another-id"},
{PK: "LPA#signed-by-cp", SK: "#CERTIFICATE_PROVIDER#an-id"},
}, attributeValues, nil)

dashboardStore := &dashboardStore{dynamoClient: dynamoClient}
Expand Down
4 changes: 2 additions & 2 deletions lang/cy.json
Original file line number Diff line number Diff line change
Expand Up @@ -706,7 +706,6 @@
"changeCompanyEmailLink": "Welsh",
"changeCompanyAddressLink": "Welsh",
"trustCorporation": "Welsh",
"readLpa": "Welsh",
"confirmYourCompanyDetails": "Welsh",
"youMustConfirmTheDetailsAboutYourCompany": "Welsh {{.DonorFullName}}",
"detailsTheDonorHasGivenAboutYourCompany": "Welsh",
Expand Down Expand Up @@ -810,5 +809,6 @@
"goToTaskList": "Welsh",
"use": "Welsh",
"registered": "Welsh",
"submittedToOpg": "Welsh"
"submittedToOpg": "Welsh",
"readyToSign": "Welsh"
}
4 changes: 2 additions & 2 deletions lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -662,7 +662,6 @@
"changeCompanyEmailLink": "Change<span class=\"govuk-visually-hidden\"> company email address</span>",
"changeCompanyAddressLink": "Change<span class=\"govuk-visually-hidden\"> address</span>",
"trustCorporation": "Trust corporation",
"readLpa": "Read LPA",
"confirmYourCompanyDetails": "Confirm your company details",
"youMustConfirmTheDetailsAboutYourCompany": "You must confirm the details {{.DonorFullName}} has given us about your company are correct.",
"detailsTheDonorHasGivenAboutYourCompany": "Details the donor has given about your company",
Expand Down Expand Up @@ -766,5 +765,6 @@
"goToTaskList": "Go to task list",
"use": "Use",
"registered": "Registered",
"submittedToOpg": "Submitted to OPG"
"submittedToOpg": "Submitted to OPG",
"readyToSign": "Ready to sign"
}
19 changes: 10 additions & 9 deletions web/template/dashboard.gohtml
Original file line number Diff line number Diff line change
Expand Up @@ -79,20 +79,21 @@
{{ if .Item.Lpa.Type.IsPropertyFinance }}{{ tr .App "lpaTypePfa" }}{{ else }}{{ tr .App "lpaTypeHw" }}{{ end }}:
<span class="govuk-!-font-weight-regular">{{ .Item.Lpa.Donor.FirstNames }} {{ .Item.Lpa.Donor.LastName }}</span>
</h3>
<div><strong class="govuk-tag">{{ tr .App "status" }}</strong></div>
<div>
{{ if and .Item.CertificateProviderTasks.ReadTheLpa.Completed (not .Item.Lpa.SignedAt.IsZero) .Item.Lpa.Tasks.PayForLpa.IsCompleted }}
<strong class="govuk-tag govuk-tag--yellow">{{ tr .App "readyToSign" }}</strong>
{{ else }}
<strong class="govuk-tag govuk-tag--blue">{{ tr .App "inProgress" }}</strong>
{{ end }}
</div>
</div>
<div class="app-dashboard-row">
<p class="govuk-body-s"><strong>{{ tr .App "applicationNumber" }}:</strong> {{ .Item.Lpa.UID }}</p>
<p class="govuk-body-s"><strong>{{ tr .App "lastSaved" }}:</strong> {{ formatDateTime .App .Item.Lpa.UpdatedAt }}</p>
<p class="govuk-body-s"><strong>{{ tr .App "referenceNumber" }}:</strong> {{ .Item.Lpa.UID }}</p>
<p class="govuk-body-s"><strong>{{ tr .App "lastUpdated" }}:</strong> {{ formatDateTime .App .Item.Lpa.UpdatedAt }}</p>
</div>
<div class="app-dashboard-row">
<div class="govuk-button-group">
{{ if .Item.CertificateProviderTasks.ReadTheLpa.Completed }}
<a class="govuk-button" href="{{ link .App (.App.Paths.CertificateProvider.ReadTheLpa.Format .Item.Lpa.ID) }}">{{ tr .App "readLpa" }}</a>
{{ else }}
<a class="govuk-button" href="{{ link .App (.App.Paths.CertificateProvider.TaskList.Format .Item.Lpa.ID) }}">{{ tr .App "continue" }}</a>
{{ end }}
<a class="govuk-button govuk-button--secondary" href="#">{{ tr .App "options" }}</a>
<a class="govuk-button" href="{{ link .App (.App.Paths.CertificateProvider.TaskList.Format .Item.Lpa.ID) }}">{{ tr .App "goToTaskList" }}</a>
</div>
</div>
</div>
Expand Down

0 comments on commit b0bce1e

Please sign in to comment.