{% extends "admin/base.html" %}
{% block main %}
<h1>{{ badge.name }}</h1>
<legend>Add new codes</legend>
<ul class="nav nav-tabs">
  <li class="active"><a href="#provide" data-toggle="tab">Manual Entry</a></li>
</ul>
<div class="tab-content">

  <!-- Provide your own codes -->
  <div class="tab-pane active" id="provide">
    <form method="post" action="?">
      <textarea rows="5" width="100" placeholder="{{ exampleCode }}" name="codes"></textarea>
      <span class="help-block">One code per line, please.</span>
      <p>
        <label class="checkbox">Multi-use
          <input type="checkbox" name="multi">
        </label>
        <span class="help-block">
          Multi-use codes can be claimed many times. If this box isn't
          checked, each code can only be used once.
        </span>
      </p>
      <div class="form-actions">
        <input type="hidden" name="csrf" value="{{ csrf }}">
        <input type="submit" value="Add codes" class="btn btn-primary">
      </div>
    </form>
  </div>

</div>

{% if codes.length %}
<h2>Existing Codes</h2>
  <table class="table table-hover table-bordered">
    <thead>
      <tr>
        <th>Code</th>
        <th>Batch Name</th>
        <th>Claimed By</th>
        <th>Reserved For</th>
        <th>Actions</td>
      </tr>
    </thead>
    <tbody>
      {% for claim in codes %}
      <tr>
        <td>{{ claim.code }}</td>
        <td>
          {% if claim.batchName %}
          {{ claim.batchName }}
          {% else %}
          <em>none</em>
          {% endif %}
        </td>
        <td>
          {% if claim.multi %}
            *multi*
          {% else %}
            {{ claim.claimedBy | default('<em>open</em>') }}
          {% endif %}
        </td>
        <td>
          {% if claim.reservedFor %}
          {{claim.reservedFor}}
          {% else %}
          anyone
          {% endif %}
          {% if claim.evidence.length %}
          <p class="muted">{{ claim.evidence.length }} evidence item(s)</p>
          {% endif %}
        </td>
        <td>
          <form method="post" action="{{ claim.code }}" class="claim-action js-claim-action">
            <input type="hidden" name="csrf" value="{{ csrf }}">
            <input type="hidden" name="_method" value="" class="js-claim-action-method">

            <button class="btn btn-link btn-small" data-method="delete">delete</button>
            {% if claim.claimedBy %}
            |
            <button class="btn btn-link btn-small" data-method="patch">release</button>
          {% endif %}
          </form>
        </td>
      <tr>
      {% endfor %}
    </tbody>
  </table>
{% endif %}
{% endblock %}

{% block footer %}
<script src="/js/claims.js"></script>
{% endblock %}

Remove bulk actions, auto claim code generation
Remove bulk actions, auto claim code generation
