{% macro digitalmarketplaceQuestionFormula(params) %} {%- from "govuk_frontend_jinja/components/fieldset/macro.html" import govukFieldset -%} {%- from "govuk_frontend_jinja/components/label/macro.html" import govukLabel -%} {%- from "govuk_frontend_jinja/components/hint/macro.html" import govukHint -%} {%- from "govuk_frontend_jinja/components/error-message/macro.html" import govukErrorMessage -%} {%- from "digitalmarketplace_frontend_jinja/components/question-format-hint/macro.html" import digitalmarketplaceQuestionFormatHint -%} {%- if params.question.questions -%} {% call govukFieldset({ "legend": { "text": params.question.question, "classes": 'govuk-fieldset__legend--m' } }) %} {%- if params.question.question_advice -%}
{{ params.question.question_advice | safe }}
{%- endif -%} {%- for question in params.question.questions -%} {%- if question.operation and question.operation_position == "before" -%} {%- endif -%} {%- if question.type == 'display' -%} {%- elif question.type == 'textbox_large' -%} {% set name = question.id %} {% set id = "input-" + name %} {% set questionText = question.question %} {% set value = params.data[name] if params.data and params.data[name] %} {% set describedBy = id + '-info' %} {%- elif question.type == 'text' -%} {% set name = question.id %} {% set id = "input-" + name %} {% set questionText = question.question %} {% set value = params.data[name] if params.data and params.data[name] %} {% set describedBy = '' %} {% endif %} {%- if question.operation and question.operation_position == "after" -%} {%- endif -%} {%- endfor -%}
Question Answer
{{ question.operation }}
{{ question.question }} {{ question.value }}
{{ govukLabel({ "html": questionText, "classes": "govuk-label--s", "for": id }) | trim | indent(2) }} {% if question.hint or question.question_advice %} {% set hintId = id + '-hint' %} {% set describedBy = describedBy + ' ' + hintId %} {{ govukHint({ "id": hintId, "html": digitalmarketplaceQuestionFormatHint(question) }) | trim | indent(2) }} {% endif %} {% if params.errors and params.errors[name] %} {% set errorId = id + '-error' %} {% set rowQuestionClasses = "dm-question-formula--error "%} {% set describedBy = describedBy + ' ' + errorId %} {% set errorMessage = params.errors[name]["message"] %} {{ govukErrorMessage({ "id": errorId, "text": errorMessage }) | trim | indent(2) }} {% endif %} {{ govukHint({ "text": 'You can enter up to ' + (question.max_length_in_words | string) + ' words', "id": id + '-info', "classes": 'govuk-character-count__message' }) | trim }}
{{ govukLabel({ "html": questionText, "classes": "govuk-label--s", "for": id }) | trim | indent(2) }} {% if question.hint or question.question_advice %} {% set hintId = id + '-hint' %} {% set describedBy = (describedBy + ' ' + hintId) if describedBy else hintId %} {{ govukHint({ "id": hintId, "html": digitalmarketplaceQuestionFormatHint(question) }) | trim | indent(2) }} {% endif %} {% if params.errors and params.errors[name] %} {% set errorId = id + '-error' %} {% set rowQuestionClasses = "dm-question-formula--error "%} {% set describedBy = (describedBy + ' ' + errorId) if describedBy else errorId %} {% set errorMessage = params.errors[name]["message"] %} {{ govukErrorMessage({ "id": errorId, "text": errorMessage }) | trim | indent(2) }} {% endif %}
{{ question.operation }}
{% endcall %} {%- endif %} {% endmacro %}