{% extends "base.html" %}
{% block content %}
<h1 class="page-title">Add project</h1>
{% if show_sign_in_notice %}
<div class="alert board-task-error-hint py-2 px-3 mb-3" role="alert">
  You must be signed in to add a project (sign in via the sidebar or <a href="/login?next=/addproject">open the sign-in page</a>).
</div>
{% endif %}
<div class="card">
  <div class="card-body">
    <form action="/addproject" method="post" enctype="multipart/form-data" class="needs-validation" novalidate>
      <div class="mb-3" id="project_name_wrapper">
        <label class="form-label required" for="project_name">Project Name</label>
        <input type="text" class="form-control" id="project_name" name="project_name" required
               placeholder="my-repo" autocomplete="off">
        <small class="form-hint">Unique name for the project (no path segments).</small>
      </div>

      <div class="mb-3">
        <label class="form-label">Project Type</label>
        <radio-picker aria-label="Project source" role="radiogroup">
          <label><input type="radio" name="project_source_type" id="empty-repo" value="empty" checked>Empty Repo</label>
          <label><input type="radio" name="project_source_type" id="upload-zip" value="zip">Upload Zip</label>
        </radio-picker>
        <radio-tabs>
          <div id="tab-empty-repo" tabindex="0" class="mt-3">
            {{ empty_repo_form_content | safe }}
          </div>
          <div id="tab-upload-zip" tabindex="0" class="mt-3 d-none">
            {{ upload_zip_form_content | safe }}
          </div>
        </radio-tabs>
      </div>

      <div class="mb-3">
        <div class="form-check">
          <input type="checkbox" class="form-check-input" id="perform_maintenance" name="perform_maintenance" value="on">
          <label class="form-check-label" for="perform_maintenance">Perform maintenance</label>
        </div>
        <small class="form-hint">Run <code>git maintenance start</code> to schedule gc and other maintenance at a specified interval.</small>
      </div>

      <div class="mb-3">
        <div class="form-check">
          <input type="checkbox" class="form-check-input" id="create_task_board" name="create_task_board" value="on">
          <label class="form-check-label" for="create_task_board">Create task board</label>
        </div>
        <small class="form-hint">Create a task board for this project; tasks are stored in the object database.</small>
      </div>

      <div class="form-footer">
        <button type="submit" class="btn btn-primary">Add project</button>
        <a href="/" class="btn btn-ghost-secondary">Cancel</a>
      </div>
    </form>
  </div>
</div>
{% endblock %}
{% block scripts %}
<script type="module" src="/static/addproject.js"></script>
{% endblock %}