{% include 'header.twig' %}




        <div class="app-content">
	<div class="container-fluid">
        <div class="d-card dc-dash">
            <div class="row">
                <div class="col-lg-6 col-md-8 col-12">
                    <div class="py-3 px-5">
                        <div class="dch-title">
                            Refill History
                        </div>
                        <div class="dch-text">
                          You can see all your refill on our site here.
                        </div>
                    </div>                        
                </div>
            </div>
        </div>

        <section class="neworder">
            <div class="row">
                <div class="col-lg-12 col-12 mb-5 mb-lg-0">
                    <div class="orders-btn py-3">
                        <ul class="nav nav-pills app-ord-nav ">
                            <li class="mr-2">
                                	<a {% if 'all' == status %}  class=" active" {% endif %} class="nav-link" href="refill">All</a>
                              </li>
                              <li class="mr-2">
                                <a {% if 'Pending' == status %}  class=" active" {% endif %} class="nav-link" href="refill/Pending">{{ lang['orders.status.pending'] }}</a>
                              </li>
                              <li class="mr-2">
                               <a {% if 'Refilling' == status %}  class=" active" {% endif %} class="nav-link" href="refill/Refilling">Refilling</a>
                              </li>
                              <li class="mr-2">
                                <a {% if 'Completed' == status %}  class=" active" {% endif %} class="nav-link" href="refill/Completed">{{ lang['orders.status.completed'] }}</a>
                              </li>
                              <li class="mr-2">
							<a {% if 'Rejected' == status %}  class=" active" {% endif %} class="nav-link" href="refill/Rejected">Rejected</a></li>
                              <li class="mr-2">
                                 <a {% if 'Error' == status %}  class=" active" {% endif %} class="nav-link" href="refill/Error">Error</a>
                              </li>
                             
                            <li class="pull-right search">
                                <form action="/" method="get" id="history-search">
                                    <div class="app-ord-search">
                                        <input type="text" name="search" class="form-control" value="{{ search }}" placeholder="Search">
                                        <button type="submit" class="app-ord-submit">
                                            <i class="fas fa-search"></i>
                                        </button>
                                    </div>
                                </form>
                            </li>
                        </ul>
                    </div>

<div class="d-card" style="">
                        <div class="d-card-body table-responsive">
                            <table class="table app-mtable">
                                <thead>
                                    <tr class="thead-tr">
                                        
                                         <th>Refill ID</th>
<th>Date </th>
<th>Order ID</th>
              <th>Link</th>
<th>Service</th> 
              <th>Status</th>
                                        </tr> 
                                    </thead>
                                    <tbody>
                                        
                                        
                                        
                                      {% for order in orders %}
              <tr>
<td>{{ order['refill_id'] }}</td> 
<td>{{ order['date'] }}</td> 
                <td><a href="orders/?search={{order['id']}}">{{ order['id'] }}</a></td>
               
                 <td><a   target="_blank" href="{{ order['link'] }}">{{ order['link'] }}</a></td>  
<td>{{ order['service'] }}</td> 
      
          <td><div style=" line-height:{% if order['refill_status'] == "Pending" %}1 {% endif %}; cursor:pointer; padding:3px 5px;  text-align:center; border-radius:20px; color:white; background:#{% if order['refill_status'] == "Completed"  %}0e7f00 {% elseif order['refill_status'] == "Refilling" %}260bc1  {% elseif order['refill_status'] == "Pending" %}42b7af {% elseif order['refill_status'] == "Error" %}42b7af {% elseif order['refill_status'] == "Rejected" %}702283 {% else %}f25800 {% endif %} ;" >{{ order['refill_status'] }}</div></td>
               

              </tr>
            {% endfor %}
                 
                 
                 
              </tr>
          
          </tbody>
        </table>
      </div>

      {% if pagination["count"] > 1 %}
        <ul class="pagination">

          {% if pagination["current"] != 1 %}
            <li>
              <a class="btn btn-actions" href="orders/{{ 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="orders/{{ status }}/{{ page }}{% if search %}?search={{ search }}{% endif %}">{{ page }}</a></li>
            {%endif%}
          {% endfor %}

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

        </ul>
      {% endif %}

    </div>
                    </div>
                   </div>
               </div>
            </div>
        </div>
    </div>
</section>

 {% include 'footer.twig' %}