{% load i18n %}

<div class="table-header">
    <h3>{% trans "Offer summary" %}</h3>
</div>
<div>
    {% if session_offer.name %}
        <div class="card card-body">
            <div class="d-flex">
                <a href="{% if session_offer.pk %}{% url 'dashboard:offer-metadata' pk=session_offer.pk %}{% else %}{% url 'dashboard:offer-metadata' %}{% endif %}" class="btn btn-secondary ml-auto">{% trans "Edit" %}</a>
            </div>
            <p><strong>{% trans "Name" %}:</strong><br /> {{ session_offer.name }}</p>
            {% if session_offer.description %}
            <p><strong>{% trans "Description" %}:</strong><br /> {{ session_offer.description|safe|striptags|truncatewords:8 }}</p>
            {% endif %}
            <p><strong>{% trans "Type" %}:</strong><br /> {{ session_offer.offer_type }}</p>
        </div>
    {% endif %}
    {% if session_offer.benefit %}
        <div class="card card-body">
            <div class="d-flex">
                <a href="{% if session_offer.pk %}{% url 'dashboard:offer-benefit' pk=session_offer.pk %}{% else %}{% url 'dashboard:offer-benefit' %}{% endif %}" class="btn btn-secondary ml-auto">{% trans "Edit" %}</a>
            </div>
            <p><strong>{% trans "Incentive" %}:</strong><br /> {{ session_offer.benefit.description|safe }}</p>
        </div>
    {% endif %}
    {% if session_offer.condition %}
        <div class="card card-body">
            <div class="d-flex">
              <a href="{% if session_offer.pk %}{% url 'dashboard:offer-condition' pk=session_offer.pk %}{% else %}{% url 'dashboard:offer-condition' %}{% endif %}" class="btn btn-secondary ml-auto">{% trans "Edit" %}</a>
            </div>
            <p><strong>{% trans "Condition" %}:</strong><br />{{ session_offer.condition.description|safe }}</p>
        </div>
    {% endif %}
    {% if session_offer.pk %}
        <div class="card card-body">
            <div class="d-flex">
                <a href="{% if session_offer.pk %}{% url 'dashboard:offer-restrictions' pk=session_offer.pk %}{% else %}{% url 'dashboard:offer-restrictions' %}{% endif %}" class="btn btn-secondary ml-auto">{% trans "Edit" %}</a>
            </div>
            <p><strong>{% trans "Restrictions" %}:</strong></p>
            {% if offer.availability_restrictions %}
                <ul>
                    {% for restriction in offer.availability_restrictions %}
                        <li>{{ restriction.description }}</li>
                    {% endfor %}
                </ul>
            {% else %}
            -
            {% endif %}
        </div>
    {% endif %}
</div>
