{% extends "helpdesk/base.html" %}

{% load i18n %}

{% block helpdesk_title %}{% trans "Ticket CC Settings" %}{% endblock %}

{% block helpdesk_breadcrumb %}
    <li class="breadcrumb-item">
        <a href="{% url 'helpdesk:list' %}">{% trans "Tickets" %}</a>
    </li>
    <li class="breadcrumb-item">
        <a href="{% url 'helpdesk:list' %}{{ ticket.id }}/">{{ ticket.queue.slug }}-{{ ticket.id }}</a>
    </li>
    <li class="breadcrumb-item active">{% trans "CC Settings" %}</li>
{% endblock %}

{% block helpdesk_body %}{% blocktrans with ticket.title as ticket_title and ticket.id as ticket_id %}
<h2>Ticket CC Settings</h2>

<p>The following people will receive an e-mail whenever <em><a href='../'>{{ ticket_title }}</a></em> is updated. Some people can also view or edit the ticket via the public ticket views.</p>

<p>You can add a new recipient to the list or delete any of the items below as required.</p>{% endblocktrans %}

    <div class="row">
        <div class="col-lg-12">
            <div class="panel panel-primary">
                <div class="panel-heading">
                    {% trans "Ticket CC List" %}
                </div>
                <!-- /.panel-heading -->
                <div class="panel-body">
                    <div><a href='add/'><button class="btn btn-success btn-sm"><i class="fa fa-plus-circle"></i>{% trans "Add an Email or Helpdesk User" %}</button></a></div>
                    <div class="table-responsive">
                        <table class="table table-striped table-bordered table-hover">
                            <thead>
                                <tr>
                                    <th>{% trans "E-Mail Address or Helpdesk User" %}</th>
                                    <th class="text-center">{% trans "View?" %}</th>
                                    <th class="text-center">{% trans "Update?" %}</th>
                                    <th class="text-center">{% trans "Delete" %}</th>
                                </tr>
                            </thead>
                            <tbody>
                                {% for person in copies_to %}
                                    <tr class='row_{% cycle 'odd' 'even' %}'>
                                        <td>{{ person.display }}</td>
                                        <td class="text-center">
                                            {% if person.can_view %}
                                                <i class="fa fa-2x fa-check text-success"></i>
                                            {% else %}
                                                <i class="fa fa-2x fa-times text-danger"></i>
                                            {% endif %}
                                        </td>
                                        <td class="text-center">
                                            {% if person.can_update %}
                                                <i class="fa fa-2x fa-check text-success"></i>
                                            {% else %}
                                                <i class="fa fa-2x fa-times text-danger"></i>
                                            {% endif %}
                                        </td>
                                        <td class="text-center">
                                            <a href='{% url 'helpdesk:ticket_cc_del' ticket.id person.id %}'>
                                                <button class="btn btn-danger btn-xs">
                                                    {% trans "Delete" %}
                                                </button>
                                            </a>
                                        </td>
                                    </tr>
                                {% endfor %}
                            </tbody>
                        </table>
                    </div>
                    <!-- /.table-responsive -->
                </div>
                <!-- /.panel-body -->
            </div>
            <!-- /.panel -->
        </div>
        <!-- /.col-lg-12 -->
    </div>
    <!-- /.row -->

    <p>
        <a href='{% url 'helpdesk:view' ticket.id %}'>
            <button class="btn btn-primary btn-lg">
                {% blocktrans with ticket.title as ticket_title %}Return to <em>{{ ticket_title }}</em>{% endblocktrans %}
            </button>
        </a>
    </p>

{% endblock %}
