Skip to content

Commit

Permalink
PP-13312 [squash] move includes into main template
Browse files Browse the repository at this point in the history
  • Loading branch information
james-peacock-gds committed Dec 13, 2024
1 parent 2349ec2 commit 7e9851c
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 68 deletions.

This file was deleted.

This file was deleted.

66 changes: 64 additions & 2 deletions app/views/simplified-account/settings/card-types/index.njk
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,71 @@
<h1 class="govuk-heading-l page-title">Card types</h1>

{% if isAdminUser %}
{% include "./_card-types-checkboxes.njk" %}
<p class="govuk-body">Choose which credit and debit cards you want to accept.</p>
<form method="post" novalidate>
<input id="csrf" name="csrfToken" type="hidden" value="{{csrf}}"/>
<input type="hidden" name="currentAcceptedCardTypeIds" value="{{ currentAcceptedCardTypeIds }}" />
{{
govukCheckboxes({
idPrefix: "debit",
name: "debit",
classes: "with-border govuk-!-padding-top-3 pay-!-border-top",
fieldset: {
legend: {
text: "Debit cards",
classes: "govuk-fieldset__legend--s"
}
},
items: cardTypes.debitCards
})
}}

{{
govukCheckboxes({
idPrefix: "credit",
name: "credit",
classes: "with-border govuk-!-padding-top-3 pay-!-border-top",
fieldset: {
legend: {
text: "Credit cards",
classes: "govuk-fieldset__legend--s"
}
},
items: cardTypes.creditCards
})
}}

{{
govukButton({
text: 'Save changes',
attributes: {
id: "save-card-types"
}
})
}}
</form>
{% else %}
{% include "./_card-types-list.njk" %}
{% for category, items in cardTypes %}
{% if (items.length > 0) %}
<h3 class="govuk-heading-m">
{{ category }}
</h3>
{% set cardList = [] %}
{% for card in items %}
{% set cardListItem = {
key: {
text: card,
classes: "govuk-!-display-none"
},
value: {
html: card
}
} %}
{% set cardList = (cardList.push(cardListItem), cardList) %}
{% endfor %}
{{ govukSummaryList({ rows: cardList }) }}
{% endif %}
{% endfor %}
{% endif %}

{% endblock %}

0 comments on commit 7e9851c

Please sign in to comment.