<!DOCTYPE html>

<!--
  ~ Copyright (c) 2025 Andrew Grant of Carrick Software .
  ~ All rights reserved.
  -->
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8"/>
    <title>People </title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet"
          integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
</head>
<body>
<div th:insert="~{fragments/layout::banner}"></div>


<div class="container text-center">
    <!--/*@thymesVar id="place" type="scot.carricksoftware.grants.domains.places.Place"*/-->
    <!--/*@thymesVar id="country" type="scot.carricksoftware.grants.domains.places.Country"*/-->
    <!--/*@thymesVar id="region" type="scot.carricksoftware.grants.domains.places.Region"*/-->
    <div class="container border border-info
                    rounded-3 text-center p-4">
        <h3>Places</h3>
        <table class="table table-striped table-bordered">
            <thead class="table-dark">
            <tr>
                <th>ID</th>
                <th>Name</th>
                <th>Region</th>
                <th>Country</th>
                <th></th>
            </tr>
            </thead>

            <tr th:each="place   : ${places}">

                <td th:text="${place.id}">123</td>
                <td th:text="${place.name}"> First</td>
                <td th:text="${place.region != null} ? ${place.region.name}"></td>
                <td th:text="${place.region.country != null} ? ${place.region.country.name}"></td>
                <td><span>
                        <a th:action="delete" class="btn btn-danger btn-sm"
                           th:href="@{/place/{id}/delete(id=${place.id})}"
                           th:text="Delete"></a>
                    <a th:action="edit" class="btn btn-warning btn-sm"
                       th:href="@{/place/{id}/edit(id=${place.id})}"
                       th:text="Edit"></a>

                    </span></td>
            </tr>
            <tfoot>
            <tr>
                <td colspan="4"><span>
                        <a th:action="rewind" class="btn btn-secondary btn-sm" th:href="@{/places/rewind}"
                           th:text="'<<'"></a>
                         <a th:action="back" class="btn btn-secondary btn-sm"
                            th:href="@{/places/prev}" th:text="'<'"></a>
                         <a th:action="new" class="btn btn-primary btn-sm" th:href="@{/place/new}"
                            th:text="'New Place'"></a>
                         <a th:action="home" class="btn btn-success btn-sm"
                            th:href="@{/}" th:text="'Home'"></a>
                         <a th:action="forward" class="btn btn-secondary btn-sm"
                            th:href="@{/places/next}" th:text="'>'"></a>
                         <a th:action="end" class="btn btn-secondary btn-sm" th:href="@{/places/ff}"
                            th:text="'>>'"></a>
                        </span></td>
            </tr>
            </tfoot>
        </table>
    </div>
</div>
</body>
</html>

