🏡 index : github.com/compromyse/enfold.git

{% extends 'base.html' %}
{% block title %}Home{% endblock %}

{% block content %}
<h2>Welcome, {{ user.id }}!</h2>
<p>You are logged in.</p>

<a href="{{ url_for('main.logout') }}" role="button" class="secondary">Logout</a>

{% if user.admin == True %}
<details name="example" style="margin-top: 40px;">
  <summary>Create a New User</summary>
  <form method="post" action="{{ url_for('main.create_user') }}">
      <input type="text" name="username" placeholder="New Username" required>
      <input type="password" name="password" placeholder="New Password" required>
      <label for="admin">Admin?</label>
      <input type="checkbox" name="admin" id="admin" required>
      <button type="submit">Create User</button>
  </form>

</details>
{% endif %}

<h3>Create a New Scrape Job</h3>
<form method="post" action="{{ url_for('main.enqueue_job') }}">
    <input type="text" name="name" placeholder="Name" required>

    <label for="act">Select One or More Acts:</label>
    <select name="act" id="act" multiple style="margin-bottom: 30px; padding: 5px;" required>
      {% for code, name in acts %}
        <option value="{{ code }}" style="color: black;">{{ name }}</option>
      {% endfor %}
    </select>

    <label for="act">Comma Separated Section List</label>
    <input type="text" name="section" placeholder="Sections">

    <select name="state_code">
      {% for code, name in states %}
        <option value="{{ code }}">{{ name }}</option>
      {% endfor %}
    </select>

    <button type="submit">Create Scrape Job</button>
</form>

<script>
  document.addEventListener('DOMContentLoaded', function () {
    new SlimSelect({
      select: '#act'
    });
  })
</script>

<h3>Jobs</h3>
<table>
  <thead>
    <tr>
      <th scope="col">Job Name</th>
      <th scope="col">Job Status</th>
      <th scope="col">Output</th>
    </tr>
  </thead>
  <tbody>
    {% for job in completed_jobs %}
    <tr>
      <td>{{ job['name'] }}</td>
      <td>JobStatus.COMPLETED</td>
      <td><a href="{{ url_for('main.download_output', filename=job['name']) }}">Download</a></td>
    </tr>
    {% endfor %}
    {% for job in jobs %}
    <tr>
      <td>{{ job.args[0] }}</td>
      <td>{{ job._status }}</td>
      <td>Not Available</td>
    </tr>
    {% endfor %}
  </tbody>
</table>

{% endblock %}