Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HWPV-195: View & Edit individual claim page #650

Open
wants to merge 35 commits into
base: main
Choose a base branch
from

Conversation

ashleygyngell
Copy link
Contributor

No description provided.

@ashleygyngell ashleygyngell changed the title HWPV-195: WIP update to move to new component library & design tweaks HWPV-195: Moving 'update claim editing page' to new component library Jul 3, 2024
@ashleygyngell ashleygyngell marked this pull request as ready for review July 9, 2024 16:43
@ashleygyngell ashleygyngell marked this pull request as draft July 10, 2024 09:39
@ashleygyngell ashleygyngell changed the title HWPV-195: Moving 'update claim editing page' to new component library HWPV-195: View & Edit individual claim page Jul 12, 2024
@ashleygyngell ashleygyngell marked this pull request as ready for review July 12, 2024 19:00
@@ -4,6 +4,7 @@
// $govuk-compatibility-govukfrontendtoolkit: true;

$govuk-global-styles: true;
$moj-images-path: "../../../node_modules/@ministryofjustice/frontend/moj/assets/images/";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All these hardwired references to node_modules will want addressing at some point, it's not the usual way to reference this and should they change the names or folder structure, which they could do as they don't say this is the way to reference the files, then it could all break.

However, this is as it currently is so it's not going to stop me approving 🙂 Possibly one for @simonnebMOJ to add a ticket for separately?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@psoleckimoj Ah yes, the app kept crashing when it wasn't referenced like this so yes def one to have a look at making a ticket for @simonnebMOJ

Same with all the moj component imports a few lines down in this file. For some reason I couldn't import them with just @import'../../../node_modules/@ministryofjustice/frontend/moj/components/all

}

.justify-content-end {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So not keen on this. Rules should reflect the block and what it does, not just be named after a specific CSS statement, better to create or extend the existing rule that this is being applied to. Like view-claim-display-helper is a good name.

background-color: #00823b;
color:#00823b;
background-color: $govuk-success-colour;
color: $govuk-success-colour
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a comment on your update, just realised this rule and the one below are exactly the same 😁


.claim-approve-different-input {
margin: 0px;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need for px etc when the value is 0


.claim-table-decision-error-margin {
margin-top: 30px!important;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally want to try and get around this as !important is not good practice.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried a few alternative approaches but to no avail. Rule only gets set when a specific error pops up upon submitting a claim rejection - so hopefully okay as only a rare case?

@@ -452,19 +456,17 @@ function handleError (error, req, res, updateConflict, next) {
}
}

function populateNewData (data, req) {
function populateNewData (data, req, keepUnassignedChanges) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe default to false to make it clearer, i.e. keepUnassignedChanges = false

if (!data.claim.AssignedTo) {
populateNewData(data, req)
} else {
populateNewData(data, req, true)
Copy link
Contributor

@psoleckimoj psoleckimoj Jul 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One for the original developers not requiring it, this ideally wants to be an object rather than separate args purely because we don't know what true is doing here.

<div class="claim-table-deduction-section-container">
<div>
<span class="govuk-!-margin-top-2 govuk-!-margin-right-4 govuk-!-font-weight-bold">Type</span>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could just put the classes on the div and remove the span? Also if it's bold maybe it's a heading?

<div class="claim-table-deduction-section-container">
<div>
<span class="govuk-!-margin-top-2 govuk-!-margin-right-4 govuk-!-font-weight-bold">Amount</span>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As above

},
{
html: deductionAmount,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, going back to the CSS naming, maybe this class should be deduction-amount and just have the values you're setting here?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

..and the same for others.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My thinking was - theres quite a few variants of classes i've set up in the claim table that use the GOV design classes, so set them individually in the html for clarity

{% if Claim['IsOverpaid'] != true %}
{% set overPaymentTitleText = 'Amount' %}
{% set overPaymentInput = 'overpayment-amount' %}
{% elseif Claim['IsOverpaid'] == true %}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Things like this can probably just be an else ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or flip so you do the true check first, then everything else will set it otherwise.

<span class="text-warning">Payout barcode can not be expired on a rejected claim</span>
{% else %}
<span class="text-pending">This will cause the original payment to be resubmitted (excluding top ups)</span>
<br><br>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally want to use CSS for spacing and not <br>


{% set visitRules %}
<span class="govuk-caption-xl">Visit rules</span>
<h1 class="govuk-heading-xl govuk-!-margin-bottom-4">{{ displayHelper.getRegionRulesByValue(Claim['Country']) }}</h1>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Heading needs to be meaningful, so caption text would go inside the header tag and restyle there. Think about what a screenreader would say out loud 🙂

]
}) }}
</fieldset>
{% else %}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could do an elsif then else


{% if TopUps.length > 0 %}

{% set tableRows = [
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need some indentation

@@ -1,67 +1,130 @@
{% from "govuk/components/warning-text/macro.njk" import govukWarningText %}

{# DUPLICATE #}
{% if duplicates.length > 0 %}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can just do if duplicates | length 🤔

</div>
{% set disabledReason %}
{% if Claim.DisabledReason %}
This Reference has been disabled <br>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could move this line of text before the if as it is always required.

@psoleckimoj
Copy link
Contributor

Main comments:

  • Rather than using HTML <br> etc for layout, try using margins/padding etc on surrounding/containing blocks.
  • CSS rules, better to extend existing rules or a sub-class (in SASS) than naming a class after the rule it's implementing

$(this).next('input').on('input').removeClass('approved-amount')
} totalApproved()
})
if ($('#unassign').length) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure how I missed this, the code inside the if and the else are identical so no need for the statement?

if (isValidValue(value)) {
approvedCost += parseFloat(value)
}
approvedCost += +$(this).text().replace('£', '').trim()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually this doesn't make sense, you're using approvedCost as both a running total but you're also appending string/text to it, then using it as a number on line 32?

document.getElementById('additional-info-reject-manual').style.display = 'block'
document.getElementById('manual-label').style.display = 'block'
}
function isValidValue (value) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry I seem to spot things after re-reading. Is value a string or Number? isNan doesn't make sense if you're also using trim on a string? isNaN will be OK with 1e3 for example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants