<!DOCTYPE html>
<html  layout:decorate="~{layout.htm}" 
xmlns:th="http://www.thymeleaf.org" xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout">
<head>

<title>Home</title>
</head>
<body>
<div  layout:fragment="content"  class="container">
    <!-- have a button POST a click via AJAX -->
    <div style="display:inline-flex">
      <p th:text="${version}">ver</p>
      <sl-button hx-get="http://v2.jokeapi.dev/joke/Any?format=txt&amp;safe-mode&amp;type=single" hx-target="#joke-container" variant="default" hx-confirm="Do you want a Joke?">
      <sl-icon slot="prefix" name="emoji-laughing"></sl-icon>Joke
      </sl-button>
      <p id="joke-container" style="flex-grow:4"> </p>
    </div>
    <hr />
   
    <form hx-put="/pdf3/api/contact/1" hx-target="this" hx-swap="outerHTML">
      <div>
        <label>First Name</label>
        <input type="text" name="firstName" value="Joe"/>
      </div>
      <div class="form-group">
        <label>Last Name</label>
        <input type="text" name="lastName" value="Blow"/>
      </div>
      <div class="form-group">
        <label>Email Address</label>
        <input type="email" name="email" value="joe@blow.com"/>
      </div>
      <button class="btn">Submit</button>
      <button class="btn" hx-get="/contact/1">Cancel</button>
    </form>
    <hr />
    <h2>Contacts</h2>
    <table class="table">
      <thead>
        <tr>
          <th>Name</th>
          <th>Email</th>
          <th></th>
        </tr>
      </thead>
      <tbody id="contacts-table" hx-get="/pdf3/api/contacts/table" hx-trigger="newContact from:body">
      </tbody>
    </table>
    <h2>Add A Contact</h2>
    <form hx-post="/pdf3/api/contacts">
      <label>
        Name
        <input name="name" type="text"/>
      </label>
      <label>
        Email
        <input name="email" type="email"/>
      </label>
    </form>
    <hr />
   
  </div>
</body>
</html>