{% extends "layout.html" %}
{% block title %}{{title}}{% endblock %}
{% block content %}
<h1>{{title}}</h1>

<form role="form" action="/" method="post">
  <input type="hidden" name="id" value="{{storder.id}}">

  <div class="form-group">
    <label for="storder-name">Name</label>
    <input type="text" class="form-control" name="name" id="storder-name" value="{{storder.name}}">
  </div>

  <div class="form-group">
    <label for="storder-conn">Destination Connection</label>
    <p>Connection names are listed in the <tt>~/.hl_client.cfg</tt> file of
      the user account running the Librarian server.</p>
    <input type="text" class="form-control" name="conn" id="storder-conn" value="{{storder.conn_name}}">
  </div>

  <div class="form-group">
    <label for="storder-search">Search specification</label>

    <p>See <a href="https://github.com/HERA-Team/librarian/blob/master/docs/Searching.md">the
        online documentation</a>. If you’re having trouble with the syntax, try pasting
      your search into <a href="https://jsonlint.com/">jsonlint.com</a>.</p>

    <textarea class="form-control" rows="10" name="search" id="storder-search">{{storder.search}}</textarea>
  </div>

  <button type="submit" class="btn btn-primary" name="update"
	  formaction="/standing-orders/{{storder.name}}/update">Update</button>
  <a href="/standing-orders" class="btn btn-default">Back to standing orders</a>

  <button type="submit" class="btn btn-danger pull-right" name="delete"
	  formaction="/standing-orders/{{storder.name}}/delete">Delete</button>
</form>

<h3>Files currently matching this order</h3>

<p>Not including files that have active or pending copy tasks
  (see <a href="/tasks">the task listing</a>) or that are marked with the file
  event <tt>standing_order_succeeded:{{storder.name}}</tt>. Most orders will
  also only match recently-created files.</p>

{% if cur_files %}
{{macros.file_listing(cur_files)}}
{% else %}
<p class="text-center"><i>(No files currently match this order.)</i></p>
{% endif %}

{% endblock %}
