{% include 'header.twig' %}
	
<!-- Main variables *content* -->
<div class="appContent">
    <section class="my-3">
        <div class="row">
            <div class="col-lg-12 col-md-12 col-12">
                <div class="card card-border my-3">
                    <div class="card-body">

                        {% for order in orders %}
                        <div class="updatex" style="padding: 10px 0;">
                            <div class="row align-items-center">
                                
                                <!-- Service Name -->
                                <div class="col-md-7 col-sm-12 mb-2">
                                    <div class="sctx-text" style="font-weight: 500;"> 
                                        <strong>{{ order['service_id'] }}</strong> - {{ order['service_name'] }}
                                    </div>
                                </div>
                                
                                <!-- Date -->
                                <div class="col-md-2 col-sm-12 mb-2 text-muted">
                                    <div class="sctc-text time_format" style="font-size: 13px;">
                                        <i class="fa fa-calendar"></i> {{ order['date'] }}
                                    </div>
                                </div>
                                
                                <!-- Update Status / Description -->
                                <div class="col-md-3 col-sm-12 mb-2">
                                    <div class="op-stats neutral" style="display: inline-block;">
                                        {{ order['description'] }}                                        
                                    </div>
                                </div>

                            </div>
                        </div>
                        <hr style="margin: 5px 0;">
                        {% endfor %}

                    </div>
                </div>
            </div>
        </div>
    </section>
    
    {% if pagination["count"] > 1 %}
    <section class="my-3">
        <div class="container-fluid">
            <div class="row">
                <div class="col-lg-12">
                    <div class="text-center">
                        <ul class="pagination justify-content-center">

                            {% if pagination["current"] != 1 %}
                            <li>
                                <a class="btn btn-actions" href="updates/{{ status }}/{{ pagination["previous"] }}{% if search %}?search={{ search }}{% endif %}" aria-label="Previous">
                                    <span aria-hidden="true">«</span>
                                </a>
                            </li>
                            {% endif %}

                            {% set r, l = 3, 3 %}

                            {% if pagination['current'] == 1 %}
                                {% set r = 7 %}
                            {% endif %}

                            {% if pagination['current'] == 2 %}
                                {% set r = 5 %}
                            {% endif %}

                            {% if pagination['current'] >= pagination['count'] %}
                                {% set l = 5 %}
                            {% endif %}

                            {% for page in 1..pagination["count"] %}
                                {% if page >= (pagination['current']-l) and page <= (pagination['current']+r) %}
                                    <li{% if page == pagination['current'] %} class="active" {%endif%}>
                                        <a class="btn btn-actions" href="updates/{{ status }}/{{ page }}{% if search %}?search={{ search }}{% endif %}">{{ page }}</a>
                                    </li>
                                {%endif%}
                            {% endfor %}

                            {% if pagination['current'] < pagination['count'] %}
                            <li>
                                <a class="btn btn-actions" href="updates/{{ status }}/{{ pagination['next'] }}{% if search %}?search={{ search }}{% endif %}" aria-label="Next">
                                    <span aria-hidden="true">»</span>
                                </a>
                            </li>
                            {% endif %}

                        </ul>
                    </div>
                </div>
            </div>
        </div>
    </section>
    {% endif %}

</div>

<br><br><br><br><br>
{% include 'footer.twig' %}