{% extends 'base.html.twig' %}
{% block title %}API REST!{% endblock %}
{% block body %}
<div class="container mt-3">
<div class="row">
<div class="col">
Hello <b>{{ app.user.firstname }} {{ app.user.lastname }}</b>
</div>
<div class="col text-end">
<a href="{{path('app_logout')}}">Logout</a>
</div>
</div>
<div class="row mt-5">
<h2>List of Requests</h2>
</div>
<div class="row text-end mt-3">
<div class="col">
<a class="btn btn-primary" href="{{path('add_request')}}" role="button">Add new Request</a>
</div>
</div>
<div class="row mt-5">
<table class="table">
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">Name</th>
<th scope="col">Type</th>
<th scope="col">Entity</th>
<th scope="col">Params</th>
<th scope="col">Actions</th>
</tr>
</thead>
<tbody>
{% for request in requests %}
<tr>
<th scope="row">{{ request.id }}</th>
<td>{{ request.name }}</td>
<td>{{ request.type }} (All: {% if request.getAll == 1 %}True{% else %}False{% endif %})</td>
<td>{{ request.entity }}</td>
<td>{{ request.params }}</td>
<td>
{% if request.type != "delete" %}
<a href="{{path('add_params', {'id':request.id})}}">Parameters</a>
{% endif %}
<a href="{{path('request_delete', {'id':request.id})}}">Delete</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
{% endblock %}