{% extends "index.html" %}

{% block main_info %}
<div class="card">
  <div class="card-body">
    <table id="workFlowsTable" class="fullTable table table-responsive-sm stripe table-outline mb-0">
      <thead>
      <tr>
        <th>Id
        </th>
        <th >Name

        </th>
        <th class="text-center">Status</th>
        <th class="text-center">Date</th>
        <th class="text-center">Current jobs</th>
        <th class="text-center">Actions</th>
      </tr>
      </thead>
      <tbody>
        {% for wf in workflows %}
      <tr class="tableRow">
        <td>
          <a href='/workflow/{{ wf.id }}'> {{ wf.id }} </a>
        </td>
        <td class="nameColumn">
          <a href='/workflow/{{ wf.id }}'> {{ wf.name }} </a>
        </td>
        <td>
          <span class="badge badge-{{ 'success' if wf.status=='Done' else ('danger' if wf.status=='Error' else ('info' if wf.status=='Running' else 'light text-dark'))}}"> {{ wf.status }} </span>
        </td>
        <td>
          <a> {{ wf.started_at|formatdatetime }} </a>
        </td>
        <td>
           <a> {{ wf.jobs_done }}/{{ wf.jobs_total }} </a>
        </td>
        <td class="dt-nowrap">
            <button id="addBtn" title="Add workflow" class="btn btn-success add"><i class="fas fa-check fa-xs"></i></button>
            <button id="editBtn" title="Edit workflow"class="btn btn-success edit"><i class="fas fa-edit fa-xs"></i></button>
            <button id="deleteBtn" title="Delete workflow" class="btn btn-danger delete"><i class="far fa-trash-alt fa-xs"></i></button>
        </td>
      {% endfor %}
      </tbody>
    </table>
  </div>
</div>

{% endblock %}