<!DOCTYPE html>

<html xmlns:th="http://www.thymeleaf.org"
  th:replace="~{fragments/layout :: layout (~{::body},'parents')}">

  <body>
  
  
    <h2>Parent Information</h2>
  
  
    <table class="table table-striped" th:object="${parents}">
      <tr>
        <th>Name</th>
        <td><b th:text="*{firstName + ' ' + lastName}"></b></td>
      </tr>
      <tr>
        <th>Address</th>
        <td th:text="*{address}" /></td>
      </tr>
      <tr>
        <th>City</th>
        <td th:text="*{city}" /></td>
      </tr>
      <tr>
        <th>Telephone</th>
        <td th:text="*{telephone}" /></td>
      </tr>
    </table>
  
    <a th:href="@{{id}/edit(id=${parent.id})}" class="btn btn-default">Edit
      Parent</a>
    <a th:href="@{{id}/kids/new(id=${parent.id})}" class="btn btn-default">Add
      New Child</a>
  
    <br />
    <br />
    <br />
    <h2>Children and Visits</h2>
  
    <table class="table table-striped">
  
      <tr th:each="kid : ${parent.kids}">
        <td valign="top">
          <dl class="dl-horizontal">
            <dt>Name</dt>
            <dd th:text="${kid.name}" /></dd>
            <dt>Birth Date</dt>
            <dd
              th:text="${#calendars.format(kid.birthDate, 'yyyy-MM-dd')}" /></dd>
            <dt>Type</dt>
            <dd th:text="${kid.gender}" /></dd>
          </dl>
        </td>
        <td valign="top">
          <table class="table-condensed">
            <thead>
              <tr>
                <th>Visit Date</th>
                <th>Description</th>
              </tr>
            </thead>
            <tr th:each="visit : ${kid.visits}">
              <td th:text="${#calendars.format(visit.date, 'yyyy-MM-dd')}"></td>
              <td th:text="${visit?.description}"></td>
            </tr>
            <tr>
              <td><a
                th:href="@{{parentId}/kids/{kidId}/edit(parentId=${parent.id},kidId=${kid.id})}">Edit
                  Child</a></td>
              <td><a
                th:href="@{{parentId}/kids/{kidId}/visits/new(parentId=${parent.id},kidId=${kid.id})}">Add
                  Visit</a></td>
            </tr>
          </table>
        </td>
      </tr>
  
    </table>
  
  </body>

</html>