{% extends "core/base.html" %}
{% block section_title %}{{ backup.name }}{% endblock %}
{% block content %}
<div class="row">
    <div class="col">
        <div class="card mt-3">
            <h2 class="card-header">Backup Details</h2>
            <div class="card-body">
                <p><b>Description</b></p>
                <div class="card-text"><p>{{ backup.description }}</p></div>
                <table class="table table-bordered">
                    <tr>
                        <td><b>Computer:</b></td>
                        <td><a href="{% url 'computer' backup.computer.id %}">{{ backup.computer }}</a></td>
                    </tr>
                    <tr>
                        <td><b>Backup Method:</b></td>
                        <td>{{ backup.method }}</td>
                    </tr>
                    <tr>
                        <td><b>Backup Software:</b></td>
                        <td>{{ backup.software }}</td>
                    </tr>
                    <tr>
                        <td><b>Exec Time:</b></td>
                        <td>{{ backup.exec_time }}</td>
                    </tr>
                    <tr>
                        <td><b>Exec Day:</b></td>
                        <td>
                            {% for backup in backup.exec_days.all %}{{ backup }}<br/>{% endfor %}
                        </td>
                    </tr>
                </table>
            </div>
        </div>
    </div>

    {% if target_device_list %}
    <div class="col">
        <div class="card mt-3">
            <h2 class="card-header">Target Devices</h2>
            <div class="card-body">
            {% for device in target_device_list %}
                <table class="table table-bordered">
                    <tr>
                        <td><b>Target Device:</b></td>
                        <td><a href="{% url 'computer' device.device.id %}">{{ device.device }}</a></td>
                    </tr>
                    <tr>
                        <td><b>Target Path:</b></td>
                        <td>{{ device.target_path }}</td>
                    </tr>
                </table>
            </div>
            {% endfor %}
        </div>
    </div>
    {% endif %}

    {% if notifications %}
    <div class="col">
        <div class="card mt-3">
            <h2 class="card-header">Notifications</h2>
            <div class="card-body">
                {% for notification in notifications %}
                <table class="table table-bordered">
                    <tr>
                        <td><b>Name:</b></td>
                        <td>{{ notification.notification }}</td>
                    </tr>
                    <tr>
                        <td><b>Description:</b></td>
                        <td>{{ notification.notification.description }}</td>
                    </tr>
                    <tr>
                        <td><b>Recipient:</b></td>
                        <td>{{ notification.notification.recipient }}</td>
                    </tr>
                    <tr>
                        <td><b>Type:</b></td>
                        <td>{{ notification.notification.notification_type }}</td>
                    </tr>
                </table>
                {% endfor %}
            </div>
        </div>
    </div>
    {% endif %}
</div>

{% endblock %}
