Skip to content

Commit

Permalink
VEGA-2494 frontend anomaly changes for attorney decisions
Browse files Browse the repository at this point in the history
  • Loading branch information
MishNajam committed Sep 26, 2024
1 parent 7ef199c commit 1a7ebab
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 2 deletions.
8 changes: 8 additions & 0 deletions cypress/e2e/anomaly.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,13 @@ describe("View and edit anomalies for a digital LPA", () => {
ruleType: "empty",
fieldOwnerUid: "replacement-attorney-1-uid",
},
{
id: 127,
status: "detected",
fieldName: "howAttorneysMakeDecisions",
ruleType: "empty",
fieldOwnerUid: "",
},
],
},
});
Expand All @@ -88,5 +95,6 @@ describe("View and edit anomalies for a digital LPA", () => {
cy.contains("Review attorney's last name");
cy.contains("Review replacement attorney's first names");
cy.contains("Review replacement attorney's last name");
cy.contains("Review how attorney's can make decisions");
});
});
25 changes: 25 additions & 0 deletions internal/sirius/anomaly_display_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,12 @@ func TestAnomalyDisplay_Group(t *testing.T) {
FieldName: ObjectFieldName("lastName"),
FieldOwnerUid: ObjectUid("2"),
},
// root
{
Status: AnomalyDetected,
FieldName: ObjectFieldName("howAttorneysMakeDecisions"),
FieldOwnerUid: ObjectUid(""),
},
}

ad.Group(&lpa, anomalies)
Expand Down Expand Up @@ -199,8 +205,27 @@ func TestAnomalyDisplay_Group(t *testing.T) {
},
}

expectedRootAnomalies := AnomaliesForSection{
Section: RootSection,
Objects: map[ObjectUid]AnomaliesForObject{
ObjectUid(""): {
Uid: ObjectUid(""),
Anomalies: map[ObjectFieldName][]Anomaly{
ObjectFieldName("howAttorneysMakeDecisions"): {
{
Status: AnomalyDetected,
FieldName: ObjectFieldName("howAttorneysMakeDecisions"),
FieldOwnerUid: ObjectUid(""),
},
},
},
},
},
}

assert.Equal(t, expectedDonorAnomalies, *ad.GetAnomaliesForSection("donor"))
assert.Equal(t, expectedAttorneyAnomalies, *ad.GetAnomaliesForSection("attorneys"))
assert.Equal(t, expectedRootAnomalies, *ad.GetAnomaliesForSection("root"))
assert.Equal(t, AnomaliesForSection{}, *ad.GetAnomaliesForSection("certificateProvider"))
}

Expand Down
15 changes: 13 additions & 2 deletions web/template/mlpa-details.gohtml
Original file line number Diff line number Diff line change
Expand Up @@ -321,11 +321,15 @@
{{ end }}
</div>
</div>

<!-- decisions -->
{{ $anomaliesForSection = .AnomalyDisplay.GetAnomaliesForSection "root" }}
<div class="govuk-accordion__section">
<div class="govuk-accordion__section-header">
<div class="govuk-accordion__section-header{{ if $anomaliesForSection.HasAnomalies }} govuk-form-group--error{{ end }}">
<h2 class="govuk-accordion__section-heading">
<span class="govuk-accordion__section-button" id="accordion-default-heading-3">
Decisions
{{ if $anomaliesForSection.HasAnomalies }}<span class="govuk-error-message">For review</span>{{ end }}
</span>
</h2>
</div>
Expand All @@ -339,14 +343,21 @@
</p>
</dd>
</div>
{{ $rootAnomalies := $anomaliesForSection.GetAnomaliesForObject "" }}
{{ $decisionFieldAnomalies := $rootAnomalies.GetAnomaliesForFieldWithStatus "howAttorneysMakeDecisions" "detected" }}
<div class="govuk-summary-list__row govuk-summary-list__row--no-border">
<dt class="govuk-summary-list__key">How attorneys must make decisions</dt>
<dd class="govuk-summary-list__value">
<dd class="govuk-summary-list__value"{{ if gt (len $decisionFieldAnomalies) 0 }} govuk-form-group--error{{ end }}>
<div class="govuk-body">
{{ howAttorneysMakeDecisionsLongForm .DigitalLpa.LpaStoreData.HowAttorneysMakeDecisions }}

{{ if (gt (len .DigitalLpa.LpaStoreData.HowAttorneysMakeDecisionsDetails) 0) }}
<p class="app-newlines-as-br">{{ .DigitalLpa.LpaStoreData.HowAttorneysMakeDecisionsDetails }}</p>
{{ end }}

{{ if gt (len $decisionFieldAnomalies) 0 }}
<br><span class="govuk-error-message">Review how attorney's can make decisions</span>
{{ end }}
</div>
</dd>
</div>
Expand Down

0 comments on commit 1a7ebab

Please sign in to comment.