{% extends 'main_header.html' %}
{% block body %}

{% import 'block_time_window_selector.html' as block_time_window %}
{{ block_time_window.time_window_selector(details, 2) }}

<div><table class="one-column-emphasis context-menu synergy_datatable" id="dashboard_table">
    <thead>
    <tr class="one-column-emphasis-first">
        <th scope="col"><input type='checkbox' name='select_all' onclick='toggle_all_checkboxes(this)'/> </th>
        <th scope="col">Process Name</th>
        <th scope="col">Time period</th>
        <th scope="col">State</th>
        <th scope="col"></th>  <!-- View Uow -->
        <th scope="col"></th>  <!-- View Log -->
    </tr>
    </thead>
    <tbody>

    {%- for process_name, job_entry in details.managed.items() -%}
    <tr class="{{ job_entry.state }}">
        {% set value = "{ process_name: '" + job_entry.process_name + "', timeperiod: '" + job_entry.timeperiod + "' }" %}
        <td><input type='checkbox' name='batch_processing' value="{{ value }}" /></td>
        <td>{{ job_entry.process_name }}</td>
        <td>{{ job_entry.timeperiod }}</td>
        <td>{{ job_entry.state }}</td>
        <td>
            {% set url = 'action=action/get_uow' + '&process_name=' + job_entry.process_name + '&timeperiod=' + job_entry.timeperiod %}
            <form method="GET" onsubmit="window.open('/object_viewer/?{{ url }}','Get Uow',
                 'toolbar=no,scrollbars=yes,resizable=yes,top=250,left=250,width=400,height=350'); return false;">
                <input type="submit" class="action_button fa-input" title="View Uow" value="&#xf1c9;&nbsp;Uow"/>
            </form>
        </td>
        <td>
            {% set url = 'action=action/get_log' + '&process_name=' + job_entry.process_name + '&timeperiod=' + job_entry.timeperiod %}
            <form method="GET" onsubmit="window.open('/object_viewer/?{{ url }}','View Log',
                 'toolbar=no,scrollbars=yes,resizable=yes,top=250,left=250,width=720,height=480'); return false;">
                <input type="submit" class="action_button fa-input" title="View Log" value="&#xf00b;&nbsp;Log"/>
            </form>
        </td>
    </tr>
    {%- endfor -%}

    </tbody>
</table></div>

{% import 'block_context_menu.html' as context_menu %}
{{ context_menu.job_menu() }}

{% endblock %}
