{% extends 'base.html.twig' %}
{% block title %}List inspections{% endblock %}
{% block pagetitle %}List inspections <span class="float-right d-none" id="brand">Brand: <span class="brand-name">-</span></spane> — <a href="{{ path('homepage') }}">Change</a></span>{% endblock %}
{% block body %}
<p>
<a class="btn btn-primary" href="{{ path('forms_form') }}">Create new inspection</a>
<button class="d-none btn btn-secondary float-right" id="btn-sync-forms" href="#">Upload inspections</button>
</p>
<div class="alert alert-info d-none display-offline">
<i class="fas fa-info-circle"></i> You currently have no internet connection.
Inspections will be temporarily saved to your device and will show below, but will only be uploaded and printable when you re-connect to the internet
</div>
<form id="form-filter" class="form-inline mt-4 mb-4">
<label for="filter" class="text-sm">Search</label>
<input type="text" class="form-control form-control-sm mx-1" name="filter" id="filter" />
<button class="btn btn-sm btn-secondary">Search</button>
<button class="btn btn-sm btn-link" id="filter-reset">Clear</button>
</form>
{# <h3 class="h6 mt-5 mb-3">Saved Forms</h3> #}
<div class="table-responsive">
<table class="table" id="forms">
<thead>
<tr>
<th>Date</th>
<th>Property Name</th>
<th>Total Score</th>
<th>Star rating</th>
<th>Status</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
{# {% for f in forms %}
<tr>
<td>{% if f.date %}{{ f.date | date('Y-m-d')}}{% endif %}</td>
<td><a href="{{ path('forms_form', {'uuid': f.uuid}) }}">{{ f.propname }}</a></td>
<td>{{ f.totalScore | number_format(2) }}</td>
<td>{{ f.stars }}</td>
<td>
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 15a4 4 0 004 4h9a5 5 0 10-.1-9.999 5.002 5.002 0 10-9.78 2.096A4.001 4.001 0 003 15z" />
</svg>
<small>Online only</small>
</td>
<td>
<a class="btn btn-sm btn-secondary" href="{{ path('forms_form', {'uuid': f.uuid}) }}">Edit</a>
</td>
</tr>
{% else %}
<tr>
<td colspan="6">No forms found</td>
</tr>
{% endfor %} #}
<tr>
<td colspan="6">Loading...</td>
</tr>
</tbody>
</table>
</div>
{# <nav> #}
{# <ul class="pagination"> #}
{# First page #}
{# <li class="page-item{{ currentPage == 1 ? ' disabled' }}">
<a class="page-link" href="{{ path(routeName, { page : 1 }) }}">First</a>
</li> #}
{# Previous page #}
{# <li class="page-item{{ currentPage == 1 ? ' disabled' }}">
<a class="page-link" href="{{ path(routeName, { page : currentPage-1 }) }}">Previous</a>
</li> #}
{# Render each page number #}
{# {% set lastPage = totalResults == 0 ? 1 : (totalResults/perPage )|round(0, 'ceil') %}
{% set showFrom = max( 1, currentPage - 2 ) %}
{% set showTo = min( lastPage, currentPage + 2 ) %}
{% for i in showFrom..showTo %}
<li class="page-item{{ currentPage == i ? ' active' }}">
<a class="page-link" href="{{ path(routeName, { page : i }) }}">{{ i }}</a>
</li>
{% endfor %} #}
{# Next page #}
{# <li class="page-item{{ currentPage == lastPage ? ' disabled' }}">
<a class="page-link" href="{{ path(routeName, { page : currentPage+1 }) }}">Next</a>
</li> #}
{# Last page #}
{# <li class="page-item{{ currentPage == lastPage ? ' disabled' }}">
<a class="page-link" href="{{ path(routeName, { page : lastPage }) }}">Last</a>
</li> #}
{# </ul> #}
{# </nav> #}
{% endblock %}
{% block javascripts %}
{{ parent() }}
{% endblock %}