{% include 'header.twig' %}
<script>
  // Override viewport for desktop mode
  document.addEventListener("DOMContentLoaded", function() {
    const metaViewport = document.querySelector("meta[name='viewport']");
    if (!metaViewport) {
      const newMetaViewport = document.createElement("meta");
      newMetaViewport.name = "viewport";
      newMetaViewport.content = "width=1024"; // Adjust width for desktop
      document.head.appendChild(newMetaViewport);
    } else {
      metaViewport.content = "width=1024"; // Adjust width for desktop
    }
  });
</script>


<style>
/* Font Icon */
.table a span{
 display:none;
}

/* Import Google Fonts */
@import url("//fonts.googleapis.com/css2?family=Nunito:ital,wght@0,300;0,400;0,500;0,600;0,700;1,300;1,400;1,500;1,600;1,700&display=swap");

/* Balance Unknowndown  toggle */
.sidebar-block__top div .navbar .navbar-collapse .d-flex .navbar-nav-currencies .balance-dropdown-container .balance-dropdown .balance-dropdown__toggle{
 font-family:'Nunito' !important;
}

/* Balance Unknowndown  toggle */
.navbar-nav-currencies .balance-dropdown .balance-dropdown__toggle{
 font-family:'Nunito', sans-serif;
}

/* Button */
.nav-pills .nav-item .btn-big-primary{
 font-family:'Nunito', sans-serif;
}

/* Nav link */
.nav-pills .nav-item .nav-link{
 font-family:'Nunito', sans-serif;
}

/* Wrapper content */
.wrapper-sidebar-navbar .wrapper-content{
 font-family:'Nunito', sans-serif !important;
}
/* List */
#block_82 .sidebar-block__left ul{
 font-family:'Nunito';
 transform:translatex(0px) translatey(0px);
}

/* Link */
.sidebar-block__left-menu .component-sidebar__menu-item-active a{
 font-family:'Nunito', sans-serif;
}

/* Link */
.sidebar-block__left-menu li a{
 font-family:'Nunito', sans-serif !important;
}
.data-tippy-content {
     font-family:'Nunito', sans-serif;
}
/* Button */
.table tr .btn-big-primary{
 position:relative;
 top:10px;
}
</style>
<style>.body .btn-big-primary {margin-top: 0px;padding-top: 11px;padding-bottom: 11px;}</style>
<div class="wrapper-content">
    <div class="wrapper-content__header">
          </div>
{% if PageText %}

      <div id="block_93">
    <div class="new_order-block ">
        <div class="bg"></div>
        <div class="divider-top"></div>
        <div class="divider-bottom"></div>
        <div class="container">
            <div class="row new-order-form">
                <div class="col-lg-8">
                   <div class="component_form_group component_card component_radio_button">
                      <div class=" ">
    <div class="col-md-12">
      
      <div class="card">
        {{ contentText }}
      </div>
    </div>
</div>
    </div>
  </div></div></div></div></div>
{% endif %} 
    <div class="wrapper-content__body">
      <!-- Main variables *content* -->
      <div id="block_99">
    <div class="orders-history ">
        <div class="bg"></div>
        <div class="divider-top"></div>
        <div class="divider-bottom"></div>
        <div class="container-fluid">
            <div class="row">
                <div class="col">
                    <div class="orders-history__margin-tab">
                        <div class="component_status_tabs">
                            <div class="">
      <ul class="nav nav-pills tab ">
      
        <li class="nav-item" >
        <a {% if 'all' == status %}  class="btn btn-big-primary" {% endif %} class="nav-link" href="refill">All</a>
        </li>
        <li class="nav-item"><a {% if 'Pending' == status %}  class="btn btn-big-primary" {% endif %} class="nav-link" href="refill/Pending">{{ lang['orders.status.pending'] }}</a></li>
        <li class="nav-item"><a {% if 'Refilling' == status %}  class="btn btn-big-primary" {% endif %} class="nav-link" href="refill/Refilling">Refilling</a></li>
        <li class="nav-item"><a {% if 'Completed' == status %}  class="btn btn-big-primary" {% endif %} class="nav-link" href="refill/Completed">{{ lang['orders.status.completed'] }}</a></li>
        <li class="nav-item"><a {% if 'Rejected' == status %}  class="btn btn-big-primary" {% endif %} class="nav-link" href="refill/Rejected">Rejected</a></li>
        <li class="nav-item"><a {% if 'Error' == status %}  class="btn btn-big-primary" {% endif %} class="nav-link" href="refill/Error">Error</a></li>
       
      </ul><br>
           <div class="row">
                <div class="col-12">
                    <div class="orders-history__margin-search component_card">
                        <div class="card">
                            <div class="component_form_group component_button_search">
                                <div class="">
                                    <form action="" method="get" id="history-search">
                                        <div class="input-group">
                                            <input type="text" name="search" class="form-control" value="{{ search }}" placeholder="Search">
                                            <div class="input-group-append">
                                                <button class="btn btn-big-primary" type="submit">
                                                    <span class="fas fa-search"></span>
                                                </button>
                                            </div>
                                        </div>
                                    </form>
                                </div>
                             </div>
                        </div>
                    </div>
                </div>
            </div>
     <div class="row">
                <div class="col">
                    <div class="orders-history__margin-table">
                        <div class="table-bg component_table ">
                            <div class="table-wr table-responsive">
        <table class="table ">
          <thead>
            <tr>
              <th>Order ID</th>
              <th>Date</th>
              <th>Service</th> 
              <th>Link</th>
              
              <th>Status</th>
            </tr>
          </thead>
          <tbody>
{#reject - #702283#}
{#completed-0e7f00#}
{#inprogress-0721ed#}
{#pending-42b7af#}
{#error-f71111#}

            {% for order in orders %}
              <tr>
                <td>{{ order['id'] }}</td>
                <td>{{ order['date'] }}</td> 
                <td>{{ order['service'] }}</td> 
                <td><a target="_blank" href="{{ order['link'] }}">{{ order['link'] }}</a></td>  
                
                <td>{{ order['refill_status']|capitalize }}</td>
                
              </tr>
            {% endfor %}
          </tbody>
        </table>
      </div>
    <br>
      {% if pagination["count"] > 1 %}
        <ul class="pagination">
          {% if pagination["current"] != 1 %}
            <li>
              <a href="refill/{{ 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) %}
              <div style="border:1px solid rgb(128,128,128); padding:4px; margin-left:8px; min-width:21px; text-align:center;">
                <li{% if page == pagination['current'] %} class="active" {%endif%}>
                  <a href="refill/{{ status }}/{{ page }}{% if search %}?search={{ search }}{% endif %}">{{ page }}</a>
                </li>
              </div>
            {%endif%}
          {% endfor %}

          {% if pagination['current'] < pagination['count'] %}
            <li>
              <a style="margin-left:8px;" href="refill/{{ 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></div></div></div></div></div></div>
</div>

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