{% from "../scorecard/view.njk" import dprScoreCard %}

{% macro dprScoreCardGroup(id, scorecardGroup) %}

  {% for group in scorecardGroup %}
    {% set title = group.title %}
    {% set scorecards = group.scorecards %}

    {% if title %}
      <h4 id="{{ id }}_scorecard_group_{{ loop.index }}" class="govuk-heading-s"><strong>{{ title }}</strong></h4>
    {% endif %}

    <div
      class="dpr-scorecard-group"
      {% if title %}aria-labelledby="{{ id }}_scorecard_group_{{ loop.index }}"{% endif %}
    >
    {% if scorecards.length %}
      {% for scorecard in scorecards %}
        {{ dprScoreCard(scorecard, loop.index) }}
      {% endfor %}
    {% else %}
      <p>No values in dataset</p>
    {% endif %}
    </div>
  {% endfor %}
{% endmacro %}
