<!DOCTYPE html>
<html lang="en">
  {% set facet='save' %}
  <head>
    <title>Data settings @ HXL Proxy</title>
    {% include "includes/headers.html" %}
  </head>
  <body class="container-fluid">
    {% include "includes/navbar.html" %}
    <header>
      {% include "includes/data-tabs.html" %}
      <h1>
        {% if recipe.recipe_id %}
        {{ recipe.name }}: settings
        {% else %}
        Save recipe
        {% endif %}
      </h1>
    </header>
    <main class="row">
      <div class="col-md-12">
        {% include "includes/source.html" %}
      </div>
      <form class="form" method="POST" action="{{ url_for('do_data_save') }}">
        <div class="form-group required col-md-6">
          <label for="name">Recipe name</label>
          <input name="name" required="required" class="form-control" value="{{ recipe.name|nonone }}" />
        </div>
        <div class="form-group col-md-6">
          <label for="description">Short description</label>
          <textarea name="description" class="form-control">{{ recipe.description|nonone }}</textarea>
        </div>
        <div class="form-group col-md-6">
          <label for="stub">
            Basename for download (will add extension like .csv).
          </label>
          <input name="stub" class="form-control" value="{{ recipe.stub|nonone }}" />
        </div>
        <div class="form-group col-md-6">
          <label for="schema_url">Default schema URL for validation</label>
          <input name="schema_url" id="schema_url" class="form-control" value="{{ recipe.args.schema_url|nonone }}" />
          {% with id='#schema_url' %}{% include "includes/selectors.html" %}{% endwith %}
        </div>
        <div class="form-group col-md-6{% if not recipe.recipe_id %} required{% endif %}">
          <label for="password">Editing password</label>
          <input name="password" type="password"{% if not recipe.recipe_id %} required="required"{% endif %} class="form-control" />
        </div>
        <div class="form-group col-md-6{% if not recipe.recipe_id %} required{% endif %}">
          <label for="password-repeat">Editing password (repeat)</label>
          <input name="password-repeat" type="password"{% if not recipe.recipe_id %} required="required"{% endif %} class="form-control" />
        </div>
        <div class="checkbox form-group col-md-6">
          <label>
            <input name="cloneable" type="checkbox"{% if recipe.cloneable or (not recipe.recipe_id) %} checked="checked"{% endif %} />
            Users may clone (will expose original URL)
          </label>
        </div>
        <div class="form-group col-md-6">
          <button type="submit" class="btn btn-success">Save this filter</button>
        </div>
        {% if recipe.recipe_id %}
        <input type="hidden" name="recipe_id" value="{{ recipe.recipe_id }}" />
        {% endif %}
        {% with excludes=['name', 'description', 'schema_url', 'stub', 'cloneable' ] %}
        {% include "includes/params.html" %}
        {% endwith %}
      </form>
    </main>
    {% include "includes/scripts.html" %}
    {% include "includes/chooser-scripts.html" %}
  </body>
</html>
