<commit_before>{% extends "tickets/request_base.jinja" %}

{% block before_content %}
    <link rel="stylesheet" href="{{ static('css/jquery.dropdown.min.css') }}"/>
{% endblock %}


{% block inner_content %}
    <div class="page-header">
        <a href="{{ url('ticket_submit') }}" class="btn btn-primary pull-right">
            <i class="fa fa-plus"></i> {% trans %}New Request{% endtrans %}
        </a>
        <h1>{% trans %}{{ page_name }}{% endtrans %}</h1>
    </div>

    {% if filter_terms is defined %}
    <form id="filter_form" method="GET">
        {% csrf_token %}
        <div class="controls md-whiteframe-z1 material-form" style="text-align:center;">
            <div class="input-append">
                <input name="filter" value="{{filter_terms}}" placeholder="{%trans%}Filter terms{%endtrans%}" id="filter_tickets" type="search"/>
            </div>
            <div class="input-append">
                <input type="text" name="start_date" value="{{start_date}}" id="start_date" class="datepicker" style="width: 7em" placeholder="{%trans%}Start date{%endtrans%}"/>
                <span class="add-on"><i class="fa fa-calendar"></i></span>
            </div>
            <div class="input-append">
                <input type="text" name="end_date" value="{{end_date}}" id="end_date" class="datepicker" style="width: 7em" placeholder="{%trans%}End date{%endtrans%}"/>
                <span class="add-on"><i class="fa fa-calendar"></i></span>
            </div>
            <div class="input-append">
                <button type="submit" class="btn">{% trans %}Filter{% endtrans %}</button>
            </div>
        </div>
    </form>
    {% endif %}

    {% if tickets %}
    {#{ macros.render_ticket_table(tickets, ROUTE_NAME, paginator_object) }#}
    {% for ticket in tickets %}
    <div class="pull-left" style="font-size: 35px; padding-top: 20px; width: 60px; height: 80px;"><i class="fa fa-{{ticket.get_type_icon()}}"></i></div>
    <div style="border-bottom: 1px solid #ccc; padding: 20px; padding-top: 10px; margin-bottom: 10px;">
        <div class="pull-right" style="font-variant: small-caps;">{{ticket.status}} <i class="fa fa-{{ticket.get_status_icon()}}"></i></div>
        <h4><a href="{{url('ticket_details', ticket.id)}}">{{ticket.summary}}</a></h4>

        <div style="line-height: 1.2em; margin-bottom: 0.5em;">
            <span style="display:inline-block; width:6.5em;">{% trans %}Requested by{% endtrans %}</span>
            <a href="{{url('profile', ticket.requester.id)}}">{% trans %}{{ticket.requester}}</a> on <b>{{ticket.created|date('Y-m-d')}}</b>, complete by <b>{{ticket.deadline|date('Y-m-d')}}{% endtrans %}</b>.
        </div>

        <div>
            <span style="display:inline-block; width:6.5em;">{% trans %}Assigned to{% endtrans %}</span>
            {% if ticket.actors(false)|length > 0 %}
                {% for actor in ticket.actors(false) %}
                    <span class="assignee" style="background: #eee; padding: 2px; border: 1px solid #ccc;">
                        <a href="{{ url('profile', pk=actor.id)}}">{{ actor.display_name }}</a>
                        <a class="remove_user" href="#" data-key="{{ticket.id}}" data-user="{{actor.id}}"><i class="fa fa-close"></i></a>
                    </span>
                {% endfor %}
            {% else %}

            {% endif %}
            <div class="pull-right">
                {% if user.is_user or user.is_volunteer %}
                    <a style="{% if user in ticket.actors() %}display: none;{% endif %}" class="btn btn-small join_btn" data-key={{ ticket.id }} data-user={{ user.id }} data-display-name="{{ user.display_name }}"><i class="fa fa-user-plus"></i>{% trans %} Join{% endtrans %}</a>

                    <a style="{% if user not in ticket.actors() %}display: none;{% endif %}" class="btn btn-small leave_btn" data-key={{ ticket.id }} data-user={{ user.id }} data-display-name="{{ user.display_name }}"><i class="fa fa-user-times"></i>{% trans %} Leave{% endtrans %}</a>
                {% endif %}
                {% if user.is_staff %}
                    <a class="btn btn-small" data-jq-dropdown="#jq-dropdown-{{ ticket.id }}"><i class="fa fa-plus"></i> Assign</a>
                    <div id="jq-dropdown-{{ ticket.id }}" class="jq-dropdown jq-dropdown-tip jq-dropdown-anchor-right">
                        <div class="jq-dropdown-panel">
                            <select class="not_select2" data-key="{{ticket.id}}">
                                    <option value="0">--- select a user</option>
                                {% for possible_assignee in possible_assignees %}
                                    <option value="{{ possible_assignee.id }}" {% if possible_assignee in ticket.actors(false) %}
                                        style="display: none;"
                                    {% endif %}>{{ possible_assignee.display_name }}</option>
                                {% endfor %}
                            </select>
                            <a class="add_assignee_btn btn btn-small" ><i class="fa fa-plus"></i>{% trans %} Add{% endtrans %}</a>
                        </div>
                    </div>
                {% endif %}
            </div>

        </div>
    </div>
    {% endfor %}

    {% include "partials/_paginator.jinja" %}

    <div class="pull-right">
        <a class="btn btn-small" href="?format=csv"><i class="fa fa-file-excel-o"></i> {% trans %}Download as CSV{% endtrans %}</a>
        <a class="btn btn-small" href="?format=json"><i class="fa fa-file-o"></i> {% trans %}Download as JSON{% endtrans %}</a>
    </div>

    {% else %}
        <div class="alert alert-block alert-warning"><commit_msg>Fix i18n-related template bug<commit_after>{% extends "tickets/request_base.jinja" %}

{% block before_content %}
    <link rel="stylesheet" href="{{ static('css/jquery.dropdown.min.css') }}"/>
{% endblock %}


{% block inner_content %}
    <div class="page-header">
        <a href="{{ url('ticket_submit') }}" class="btn btn-primary pull-right">
            <i class="fa fa-plus"></i> {% trans %}New Request{% endtrans %}
        </a>
        <h1>{% trans %}{{ page_name }}{% endtrans %}</h1>
    </div>

    {% if filter_terms is defined %}
    <form id="filter_form" method="GET">
        {% csrf_token %}
        <div class="controls md-whiteframe-z1 material-form" style="text-align:center;">
            <div class="input-append">
                <input name="filter" value="{{filter_terms}}" placeholder="{%trans%}Filter terms{%endtrans%}" id="filter_tickets" type="search"/>
            </div>
            <div class="input-append">
                <input type="text" name="start_date" value="{{start_date}}" id="start_date" class="datepicker" style="width: 7em" placeholder="{%trans%}Start date{%endtrans%}"/>
                <span class="add-on"><i class="fa fa-calendar"></i></span>
            </div>
            <div class="input-append">
                <input type="text" name="end_date" value="{{end_date}}" id="end_date" class="datepicker" style="width: 7em" placeholder="{%trans%}End date{%endtrans%}"/>
                <span class="add-on"><i class="fa fa-calendar"></i></span>
            </div>
            <div class="input-append">
                <button type="submit" class="btn">{% trans %}Filter{% endtrans %}</button>
            </div>
        </div>
    </form>
    {% endif %}

    {% if tickets %}
    {#{ macros.render_ticket_table(tickets, ROUTE_NAME, paginator_object) }#}
    {% for ticket in tickets %}
    <div class="pull-left" style="font-size: 35px; padding-top: 20px; width: 60px; height: 80px;"><i class="fa fa-{{ticket.get_type_icon()}}"></i></div>
    <div style="border-bottom: 1px solid #ccc; padding: 20px; padding-top: 10px; margin-bottom: 10px;">
        <div class="pull-right" style="font-variant: small-caps;">{{ticket.status}} <i class="fa fa-{{ticket.get_status_icon()}}"></i></div>
        <h4><a href="{{url('ticket_details', ticket.id)}}">{{ticket.summary}}</a></h4>

        <div style="line-height: 1.2em; margin-bottom: 0.5em;">
            <span style="display:inline-block; width:6.5em;">{% trans %}Requested by{% endtrans %}</span>
            <a href="{{url('profile', ticket.requester.id)}}">{{ticket.requester}}</a> {% trans %}on{% endtrans %} <b>{{ticket.created|date('Y-m-d')}}</b>, {% trans %}complete by{% endtrans %} <b>{{ticket.deadline|date('Y-m-d')}}</b>.
        </div>

        <div>
            <span style="display:inline-block; width:6.5em;">{% trans %}Assigned to{% endtrans %}</span>
            {% if ticket.actors(false)|length > 0 %}
                {% for actor in ticket.actors(false) %}
                    <span class="assignee" style="background: #eee; padding: 2px; border: 1px solid #ccc;">
                        <a href="{{ url('profile', pk=actor.id)}}">{{ actor.display_name }}</a>
                        <a class="remove_user" href="#" data-key="{{ticket.id}}" data-user="{{actor.id}}"><i class="fa fa-close"></i></a>
                    </span>
                {% endfor %}
            {% else %}

            {% endif %}
            <div class="pull-right">
                {% if user.is_user or user.is_volunteer %}
                    <a style="{% if user in ticket.actors() %}display: none;{% endif %}" class="btn btn-small join_btn" data-key={{ ticket.id }} data-user={{ user.id }} data-display-name="{{ user.display_name }}"><i class="fa fa-user-plus"></i>{% trans %}Join{% endtrans %}</a>

                    <a style="{% if user not in ticket.actors() %}display: none;{% endif %}" class="btn btn-small leave_btn" data-key={{ ticket.id }} data-user={{ user.id }} data-display-name="{{ user.display_name }}"><i class="fa fa-user-times"></i>{% trans %}Leave{% endtrans %}</a>
                {% endif %}
                {% if user.is_staff %}
                    <a class="btn btn-small" data-jq-dropdown="#jq-dropdown-{{ ticket.id }}"><i class="fa fa-plus"></i>{% trans %}Assign{% endtrans %}</a>
                    <div id="jq-dropdown-{{ ticket.id }}" class="jq-dropdown jq-dropdown-tip jq-dropdown-anchor-right">
                        <div class="jq-dropdown-panel">
                            <select class="not_select2" data-key="{{ticket.id}}">
                                    <option value="0">--- {% trans %}select a user{% endtrans %}</option>
                                {% for possible_assignee in possible_assignees %}
                                    <option value="{{ possible_assignee.id }}" {% if possible_assignee in ticket.actors(false) %}
                                        style="display: none;"
                                    {% endif %}>{{ possible_assignee.display_name }}</option>
                                {% endfor %}
                            </select>
                            <a class="add_assignee_btn btn btn-small" ><i class="fa fa-plus"></i>{% trans %}Add{% endtrans %}</a>
                        </div>
                    </div>
                {% endif %}
            </div>

        </div>
    </div>
    {% endfor %}

    {% include "partials/_paginator.jinja" %}

    <div class="pull-right">
        <a class="btn btn-small" href="?format=csv"><i class="fa fa-file-excel-o"></i> {% trans %}Download as CSV{% endtrans %}</a>
        <a class="btn btn-small" href="?format=json"><i class="fa fa-file-o"></i> {% trans %}Download as JSON{% endtrans %}</a>
    </div>

    {% else %}
        <div class="alert alert-block alert-warning">
{'fraction_non_alphanumeric': 0.2010045899367801, 'fraction_numerical': 0.006235385814497272, 'mean_word_length': 2.266760961810467, 'pattern_counts': {'":': 0, '<': 221, '<?xml version=': 0, '>': 223, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 16, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '957989', 'n_tokens_mistral': 3799, 'n_tokens_neox': 3384, 'n_words': 748}