{% extends '@ChillMain/Admin/layoutWithVerticalMenu.html.twig' %}

{% block title %}{{ 'admin.users.job_scope_histories.index.histories'|trans }}{% endblock title %}

{% block admin_content %}
    <h2>{{ user.usernameCanonical }}</h2>
    <h1>{{ 'admin.users.job_scope_histories.index.histories'|trans }}</h1>

    <h3 class="mt-5">{{ 'admin.users.job_scope_histories.index.job_history.title'|trans }}</h3>
    <table class="records_list table table-bordered border-dark">
        <thead>
            <tr>
                <th class="w-25">{{ 'admin.users.job_scope_histories.index.job_history.start'|trans }}</th>
                <th class="w-25">{{ 'admin.users.job_scope_histories.index.job_history.end'|trans }}</th>
                <th>{{ 'admin.users.job_scope_histories.index.job_history.job'|trans }}</th>
            </tr>
        </thead>
        <tbody>
            {% for entity in jobHistories %}
                <tr>
                    <td>{{ entity.startDate|format_datetime('medium') }}</td>
                    <td>
                        {% if entity.endDate is not null %}
                            {{ entity.endDate|format_datetime('medium') }}
                        {% else %}
                            <i class="opacity-50">{{ "admin.users.job_scope_histories.index.job_history.today"|trans }}</i>
                        {% endif %}
                    </td>
                    <td>
                        {% if entity.job %}
                            {{ entity.job.label|localize_translatable_string }}
                        {% else %}
                            <i class="opacity-50">{{ 'admin.users.job_scope_histories.index.job_history.undefined'|trans }}</i>
                        {% endif %}
                    </td>
                </tr>
            {% endfor %}
        </tbody>
    </table>

    <h3 class="mt-5">{{ 'admin.users.job_scope_histories.index.scope_history.title'|trans }}</h3>
    <table class="records_list table table-bordered border-dark">
        <thead>
        <tr>
            <th class="w-25">{{ 'admin.users.job_scope_histories.index.scope_history.start'|trans }}</th>
            <th class="w-25">{{ 'admin.users.job_scope_histories.index.scope_history.end'|trans }}</th>
            <th>{{ 'admin.users.job_scope_histories.index.scope_history.scope'|trans }}</th>
        </tr>
        </thead>
        <tbody>
        {% for entity in scopeHistories %}
            <tr>
                <td>{{ entity.startDate|format_datetime('medium') }}</td>
                <td>
                    {% if entity.endDate is not null %}
                        {{ entity.endDate|format_datetime('medium') }}
                    {% else %}
                        <i class="opacity-50">{{ "admin.users.job_scope_histories.index.scope_history.today"|trans }}</i>
                    {% endif %}
                </td>
                <td>
                    {% if entity.scope %}
                        {{ entity.scope.name|localize_translatable_string }}
                    {% else %}
                        <i class="opacity-50">{{ 'admin.users.job_scope_histories.index.scope_history.undefined'|trans }}</i>
                    {% endif %}
                </td>
            </tr>
        {% endfor %}
        </tbody>
    </table>

    <ul class="record_actions sticky-form-buttons">
        <li class='cancel'>
            <a href="{{ path('chill_crud_admin_user_edit', {id: user.id}) }}" class="btn btn-cancel">
                {{'admin.users.job_scope_histories.index.Back to user job'|trans }}
            </a>
        </li>
    </ul>

{% endblock %}
