templates/forms/index.html.twig line 1

Open in your IDE?
  1. {% extends 'base.html.twig' %}
  2. {% block title %}List inspections{% endblock %}
  3. {% block pagetitle %}List inspections <span class="float-right d-none" id="brand">Brand: <span class="brand-name">-</span></spane> &#8212; <a href="{{ path('homepage') }}">Change</a></span>{% endblock %}
  4. {% block body %}
  5.     <p>
  6.         <a class="btn btn-primary" href="{{ path('forms_form') }}">Create new inspection</a>
  7.         <button class="d-none btn btn-secondary float-right" id="btn-sync-forms"  href="#">Upload inspections</button>
  8.     </p>
  9.     <div class="alert alert-info d-none display-offline">
  10.         <i class="fas fa-info-circle"></i> You currently have no internet connection. 
  11.         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
  12.     </div>
  13.     <form id="form-filter" class="form-inline mt-4 mb-4">
  14.         <label for="filter" class="text-sm">Search</label>
  15.         <input type="text" class="form-control form-control-sm mx-1" name="filter" id="filter" />
  16.         <button class="btn btn-sm btn-secondary">Search</button>
  17.         <button class="btn btn-sm btn-link" id="filter-reset">Clear</button>
  18.     </form>
  19.     {# <h3 class="h6 mt-5 mb-3">Saved Forms</h3> #}
  20.     <div class="table-responsive">
  21.     <table class="table" id="forms">
  22.         <thead>
  23.             <tr>
  24.                 <th>Date</th>
  25.                 <th>Property Name</th>
  26.                 <th>Total Score</th>
  27.                 <th>Star rating</th>
  28.                 <th>Status</th>
  29.                 <th>Actions</th>
  30.             </tr>
  31.         </thead>
  32.         <tbody>
  33.         {# {% for f in forms %}
  34.             <tr>
  35.                 <td>{% if f.date %}{{ f.date | date('Y-m-d')}}{% endif %}</td>
  36.                 <td><a href="{{ path('forms_form', {'uuid': f.uuid}) }}">{{ f.propname }}</a></td>
  37.                 <td>{{ f.totalScore | number_format(2) }}</td>
  38.                 <td>{{ f.stars }}</td>
  39.                 <td>
  40.                     <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="none" viewBox="0 0 24 24" stroke="currentColor">
  41.                         <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" />
  42.                     </svg>
  43.                     <small>Online only</small>
  44.                 </td>
  45.                 <td>
  46.                     <a class="btn btn-sm btn-secondary" href="{{ path('forms_form', {'uuid': f.uuid}) }}">Edit</a>
  47.                 </td>
  48.             </tr>
  49.         {% else %}
  50.             <tr>
  51.                 <td colspan="6">No forms found</td>
  52.             </tr>
  53.         {% endfor %} #}
  54.             <tr>
  55.                 <td colspan="6">Loading...</td>
  56.             </tr>
  57.         </tbody>
  58.     </table>
  59.     </div>
  60.     
  61.     {# <nav> #}
  62.     {# <ul class="pagination"> #}
  63.         {# First page #}
  64.         {# <li class="page-item{{ currentPage == 1 ? ' disabled' }}">
  65.             <a class="page-link" href="{{ path(routeName, { page : 1 }) }}">First</a>
  66.         </li> #}
  67.         {# Previous page  #}
  68.         {# <li class="page-item{{ currentPage == 1 ? ' disabled' }}">
  69.             <a class="page-link" href="{{ path(routeName, { page : currentPage-1 }) }}">Previous</a>
  70.         </li> #}
  71.     
  72.         {# Render each page number #}
  73.         {# {% set lastPage = totalResults == 0 ? 1 : (totalResults/perPage )|round(0, 'ceil') %}
  74.         {% set showFrom = max( 1, currentPage - 2 ) %}
  75.         {% set showTo = min( lastPage, currentPage + 2 ) %}
  76.         {% for i in showFrom..showTo %}
  77.         <li class="page-item{{ currentPage == i ? ' active' }}">
  78.             <a class="page-link" href="{{ path(routeName, { page : i }) }}">{{ i }}</a>
  79.         </li>
  80.         {% endfor %} #}
  81.     
  82.         {# Next page #}
  83.         {# <li class="page-item{{ currentPage == lastPage ? ' disabled' }}">
  84.             <a class="page-link" href="{{ path(routeName, { page : currentPage+1 }) }}">Next</a>
  85.         </li> #}
  86.         {# Last page #}
  87.         {# <li class="page-item{{ currentPage == lastPage ? ' disabled' }}">
  88.             <a class="page-link" href="{{ path(routeName, { page : lastPage }) }}">Last</a>
  89.         </li> #}
  90.     {# </ul> #}
  91.     {# </nav> #}
  92. {% endblock %}
  93. {% block javascripts %}
  94.     {{ parent() }}
  95. {% endblock %}