<commit_before>{% extends 'AppBundle:Layouts:application.html.twig' %}

{% trans_default_domain "admin-documents" %}
{% set transOptions = {} %}
{% set isNewPage = (filters.status == 'new') %}
{% set baseRoute = 'admin_documents' %}

{% block htmlTitle %}{{ 'page.htmlTitle' | trans }}{% endblock %}
{% block pageTitle %}{{ 'page.pageTitle' | trans }}{% endblock %}
{% block pageTitleClass %}heading-large{% endblock %}

{% block supportTitleBottom %}
    <span class="heading-secondary">{{ 'page.supportTitle' | transchoice(counts[filters.status]) }}</span>
{% endblock %}

{% block helpline %}{% endblock %}

{% block pageContent %}

    {# params #}
    {% set filtersToPreserveInTabs = {
        'q': filters.q,
        'created_by_role': filters.created_by_role
    } %}
    {% set filtersToPreserveInPagination = {
        'status': filters.status,
        'q': filters.q,
        'created_by_role': filters.created_by_role,
    } %}
    {% set filtersToPreserveAfterArchiving = filtersToPreserveInPagination %}

    {# search form #}
    <form action="{{ path(baseRoute, {'status': filters.status}) }}" method="GET" class="search-form push--ends">
        <fieldset>
            <legend class="visuallyhidden">Search</legend>
            <label for="search" class="search-label">Search by client, deputy or case number</label>
            <input type="text" id="search" name="q" value="{{ filters.q }}"
                   class="js-search-focus search-input form-control">
            <input type="hidden" name="status" value="{{ filters.status }}" />
            <select name="created_by_role" class="search-dropdown form-control">
                <option value="">All</option>
                {% for value, label in {'ROLE_PA': 'Public authority', 'ROLE_LAY_DEPUTY': 'Lay deputy'} %}
                    <option value="{{ value }}" {{ filters.created_by_role == value ? 'selected="selected"' : '' }}>{{ label }}</option>
                {% endfor %}
            </select>
            <input id="search_submit" class="button flush--bottom push-half--right behat-link-search" type="submit" value="Search">
            {% if filters.q or filters.created_by_role %}
                <a href="{{ path(baseRoute, {'status': filters.status}) }}">Clear filters</a>
            {% endif %}
        </fieldset>
    </form>

    {# tabs #}

    <div class="tabs push--ends">
        <div class="tabs-nav">
            <ul class="tabs-list" role="tablist">
                <li class="tab-item clients {% if isNewPage %}active{% endif %}" role="presentation">
                    <a href="{{ path(baseRoute, {'status': 'new'} | merge(filtersToPreserveInTabs) ) }}" role="tab" tabindex="0" aria-selected="true">
                        <span class="data-item bold-large">{{ counts.new }}</span>
                        <span class="data-item bold-xsmall">{{ 'page.tabs.new.label' | trans }}</span>
                    </a>
                </li>
                <li class="tab-item unstarted {% if not isNewPage %}active{% endif %}" role="presentation">
                    <a href="{{ path(baseRoute, {'status': 'archived'} | merge(filtersToPreserveInTabs)) }}" role="tab" tabindex="0" >
                        <span class="data-item bold-large">{{ counts.archived }}</span>
                        <span class="data-item bold-xsmall">{{ 'page.tabs.archived.label' | trans }}</span>
                    </a>
                </li>
            </ul>
        </div>
    </div>

    {# table with records #}
    {% if  records | length %}
      <table class="push--bottom">
        <thead>
        <tr>
            <th>Deputy</th>
            <th>Case</th>
            <th>Documents</th>
            <th>Date</th>
            <th>
                {% if isNewPage %}
                {% else %}
                    User
                {% endif %}
            </th>
        </tr>
        </thead>
        <tbody>
        {% for reportSubmission in records %}
            {% set report = reportSubmission.report %}
            <tr class="behat-region-report-submission-{{ reportSubmission.id }}">
                <td>
                    {{ reportSubmission.createdBy.fullname }}<br/>
                    Type: {{ reportSubmission.createdBy.roleFullName }}
                </td>
                <td>
                    {{ report.client.fullname }}<br/>
                    Number: {{ report.client.caseNumber }}<br/>
                    Type: {{ report.type }}
                </td>
                <td>
                    <details class="push--bottom">
                        <summary>
                            <span class="summary">{{ 'page.table.rows.documents' | transchoice(reportSubmission.documents | length) }}</span>
                        </summary>
                        <div class="panel panel-border-narrow">
                            <ul class="list list-group" id="docs">
                                {% for document in reportSubmission.documents %}
                                    <li>{{ document.fileName }}{# | {{ document.createdOn | date(" d F Y") }}#}
                                    </li>
                                {% endfor %}
                            </ul>
                        </div>
                    </details>
                </td>
                <td>
                    {% set submissionDate = reportSubmission.createdOn %}
                    {# shows "Today" or "d/m/Y"e #}
                    {% if ("now" | date('Y-m-d') == submissionDate | date('Y-m-d')) %}
                        Today
                    {% else %}
                        {{ submissionDate | date('d/m/Y') }}
                    {% endif %}
                    <br/>
                    {# show hour and time #}
                    {{ submissionDate | date('g:ia') }}
                </td>
                <td class=""><commit_msg>DDPB-1395-bugs bug 7 - report period<commit_after>{% extends 'AppBundle:Layouts:application.html.twig' %}

{% trans_default_domain "admin-documents" %}
{% set transOptions = {} %}
{% set isNewPage = (filters.status == 'new') %}
{% set baseRoute = 'admin_documents' %}

{% block htmlTitle %}{{ 'page.htmlTitle' | trans }}{% endblock %}
{% block pageTitle %}{{ 'page.pageTitle' | trans }}{% endblock %}
{% block pageTitleClass %}heading-large{% endblock %}

{% block supportTitleBottom %}
    <span class="heading-secondary">{{ 'page.supportTitle' | transchoice(counts[filters.status]) }}</span>
{% endblock %}

{% block helpline %}{% endblock %}

{% block pageContent %}

    {# params #}
    {% set filtersToPreserveInTabs = {
        'q': filters.q,
        'created_by_role': filters.created_by_role
    } %}
    {% set filtersToPreserveInPagination = {
        'status': filters.status,
        'q': filters.q,
        'created_by_role': filters.created_by_role,
    } %}
    {% set filtersToPreserveAfterArchiving = filtersToPreserveInPagination %}

    {# search form #}
    <form action="{{ path(baseRoute, {'status': filters.status}) }}" method="GET" class="search-form push--ends">
        <fieldset>
            <legend class="visuallyhidden">Search</legend>
            <label for="search" class="search-label">Search by client, deputy or case number</label>
            <input type="text" id="search" name="q" value="{{ filters.q }}"
                   class="js-search-focus search-input form-control">
            <input type="hidden" name="status" value="{{ filters.status }}" />
            <select name="created_by_role" class="search-dropdown form-control">
                <option value="">All</option>
                {% for value, label in {'ROLE_PA': 'Public authority', 'ROLE_LAY_DEPUTY': 'Lay deputy'} %}
                    <option value="{{ value }}" {{ filters.created_by_role == value ? 'selected="selected"' : '' }}>{{ label }}</option>
                {% endfor %}
            </select>
            <input id="search_submit" class="button flush--bottom push-half--right behat-link-search" type="submit" value="Search">
            {% if filters.q or filters.created_by_role %}
                <a href="{{ path(baseRoute, {'status': filters.status}) }}">Clear filters</a>
            {% endif %}
        </fieldset>
    </form>

    {# tabs #}

    <div class="tabs push--ends">
        <div class="tabs-nav">
            <ul class="tabs-list" role="tablist">
                <li class="tab-item clients {% if isNewPage %}active{% endif %}" role="presentation">
                    <a href="{{ path(baseRoute, {'status': 'new'} | merge(filtersToPreserveInTabs) ) }}" role="tab" tabindex="0" aria-selected="true">
                        <span class="data-item bold-large">{{ counts.new }}</span>
                        <span class="data-item bold-xsmall">{{ 'page.tabs.new.label' | trans }}</span>
                    </a>
                </li>
                <li class="tab-item unstarted {% if not isNewPage %}active{% endif %}" role="presentation">
                    <a href="{{ path(baseRoute, {'status': 'archived'} | merge(filtersToPreserveInTabs)) }}" role="tab" tabindex="0" >
                        <span class="data-item bold-large">{{ counts.archived }}</span>
                        <span class="data-item bold-xsmall">{{ 'page.tabs.archived.label' | trans }}</span>
                    </a>
                </li>
            </ul>
        </div>
    </div>

    {# table with records #}
    {% if  records | length %}
      <table class="push--bottom">
        <thead>
        <tr>
            <th></th>
            <th>Documents</th>
            <th>Date</th>
            <th>
                {% if isNewPage %}
                {% else %}
                    User
                {% endif %}
            </th>
        </tr>
        </thead>
        <tbody>
        {% for reportSubmission in records %}
            {% set report = reportSubmission.report %}
            <tr class="behat-region-report-submission-{{ reportSubmission.id }}">
                <td>
                    <div class="bold">Deputy</div>
                    {{ reportSubmission.createdBy.fullname }}
                    ({{ reportSubmission.createdBy.roleFullName }})
                    <div class="bold">Case</div>
                    {{ report.client.fullname }}, case number: {{ report.client.caseNumber }}<br/>
                    <div class="bold">Report</div>
                    Period: {{ report.period }}, type: {{ report.type }}
                </td>
                <td>
                    <details class="push--bottom">
                        <summary>
                            <span class="summary">{{ 'page.table.rows.documents' | transchoice(reportSubmission.documents | length) }}</span>
                        </summary>
                        <div class="panel panel-border-narrow">
                            <ul class="list list-group" id="docs">
                                {% for document in reportSubmission.documents %}
                                    <li>{{ document.fileName }}{# | {{ document.createdOn | date(" d F Y") }}#}
                                    </li>
                                {% endfor %}
                            </ul>
                        </div>
                    </details>
                </td>
                <td>
                    {% set submissionDate = reportSubmission.createdOn %}
                    {# shows "Today" or "d/m/Y"e #}
                    {% if ("now" | date('Y-m-d') == submissionDate | date('Y-m-d')) %}
                        Today
                    {% else %}
                        {{ submissionDate | date('d/m/Y') }}
                    {% endif %}
                    <br/>
                    {# show hour and time #}
                    {{ submissionDate | date('g:ia') }}
                </td>
                <td class="">
{'fraction_non_alphanumeric': 0.1608592692828146, 'fraction_numerical': 0.0007611637347767253, 'mean_word_length': 1.6149933657673596, 'pattern_counts': {'":': 0, '<': 173, '<?xml version=': 0, '>': 173, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3110169', 'n_tokens_mistral': 3430, 'n_tokens_neox': 3127, 'n_words': 660}