{# Template : Contact #}
{% extends 'layouts/admin.twig' %}

{% block content %}

    <ul class="breadcrumbs el">
        <li><a href="/admin/">Home</a> /</li>
        <li><a href="/shop/admin/orders/manage.orders.php">Manage Orders</a> /</li>
        <li class="end">{{ page_meta.title }}</li>
    </ul>

    <h1>{{ page_meta.title }}</h1>

    <form action="?action=print_pharmacy_labels_multi&order_ids={{ order_ids.implode(',') }}" method="post" target="_blank">

        <div class="js-vue-environment">
            {% for order in orders %}
                {% for order_item in order.pharmacy_label_items %}
                    <print-labels-manager
                        :order-item="{{ order_item.toJson() }}"
                        :groups="{{ order_item.getCustomersForLabels() | json_encode }}"
                    ></print-labels-manager>
                {% endfor %}
            {% endfor %}
        </div>

        <div class="row">
            <button type="submit" class="btn">
                Print Labels
            </button>
        </div>

        <div class="row">

            {% if orders.length > 1 %}
                <a href="/shop/admin/orders/manage.orders.php" class="btn">
                    Back to Orders
                </a>
            {% else %}
                <a href="/shop/admin/orders/manage.order.php?id={{ orders.0.id }}" class="btn">
                    Back to Order
                </a>
            {% endif %}

            &nbsp;&nbsp;

            {% if prescriptions_to_print %}
                <a href="?action=print_prescriptions&order_ids={{ order_ids.implode(',') }}" class="btn" target="_blank">
                    Print Prescriptions
                </a>&nbsp;&nbsp;
            {% else %}
                <span title="Order items not approved yet." class="btn disabled">
                    Print Prescriptions
                </span>&nbsp;&nbsp;
            {% endif %}

            <a href="?action=print_split_labels&order_ids={{ order_ids.implode(',') }}" class="btn" target="_blank">
                Print Invoice
            </a>

        </div>

    </form>
{% endblock %}
