{% from "govuk/components/button/macro.njk" import govukButton %} {% from "govuk/components/summary-list/macro.njk" import govukSummaryList -%} {% set noPaymentFields = true %} {% set hasIncompletePayment = false %} {% for comp in components %} {% if comp.type == 'PaymentField' %} {% set noPaymentFields = false %} {# Check if payment is incomplete (no preAuth status) #} {% if not comp.model.paymentState or not comp.model.paymentState.preAuth or comp.model.paymentState.preAuth.status != 'success' %} {% set hasIncompletePayment = true %} {% endif %} {% endif %} {% endfor %}
{{ componentList(components) }} {% if isStartPage %} {% set buttonText = "Start now" %} {% elif submitButtonText %} {% set buttonText = submitButtonText %} {% else %} {% set buttonText = "Continue" %} {% endif %}
{% if showSubmitButton !== false and not hasIncompletePayment %} {{ govukButton({ text: buttonText, isStartButton: isStartPage, preventDoubleClick: true }) }} {% endif %} {% if allowSaveAndExit %} {{ govukButton({ text: "Save and exit", classes: "govuk-button--secondary", name: "action", value: "save-and-exit", preventDoubleClick: true }) }} {% endif %}