{{ template "header.html" .}}
{{ template "comics/menu.html" .}}
<ul class="nav nav-tabs">
  <li role="presentation" class="active"><a href="/comics/comic">Comics</a></li>
  <li role="presentation"><a href="/comics/publisher">Publishers</a></li>
  <li role="presentation"><a href="/comics/artist">Artists</a></li>
</ul>
<div class="panel-body">
  {{ if .ErrorTitle}}
  <p class="bg-danger">
    {{.ErrorTitle}}: {{.ErrorMessage}}
  </p>
  {{end}}
  <form action="/comics/comic/validate" method="POST">
    <div class="form-group">
      <label for="title">Title</label>
      {{ if .payload.Title }}
        <input type="text" class="form-control" id="title" name="title" value={{.payload.Title}}>
      {{ else }}
        <input type="text" class="form-control" id="title" name="title" placeholder="Title">
      {{ end }}
    </div>
    <div class="form-check">
      <input type="checkbox" class="form-check-input" value="true" name="completed" id="completed" {{ if .payload.Completed }}checked{{end}}>
      <label class="form-check-label" for="completed">Completed</label>
    </div>
    <input type="hidden" name="comicid" id="comicid" value={{.payload.ID.Hex}}>
    <button type="submit" class="btn btn-primary" name="action" value={{.action}}>{{.action}}</button>
    {{ if eq .action "Save" }}
      <button type="submit" class="btn btn-primary" name="action" value="Delete">Delete</button>
    {{ end }}
  </form>
</div>
{{ template "footer.html" .}}
