assign_am.html 2.78 KB
Newer Older
1
2
{% extends "process/nm2-base.html" %}
{% load i18n %}
Enrico Zini's avatar
Enrico Zini committed
3
4
5
6
7
8
9
10
11
12
13

{% block head %}
{{block.super}}
<style>
th.metatitle
{
  text-align: center;
  border: none;
}
</style>
<script type="text/javascript">
14
15
16
17
18
19
20
21
(function($) {
"use strict";

function main()
{
    let table = $("#amassign").DataTable({
        paging: false,
        order: [],
Enrico Zini's avatar
Enrico Zini committed
22
23
    });
}
24

25
document.addEventListener("DOMContentLoaded", evt => { main(); });
Enrico Zini's avatar
Enrico Zini committed
26

27
28
})(jQuery);
</script>
Enrico Zini's avatar
Enrico Zini committed
29
30
31
32
33
34
{% endblock %}

{% block content %}

<h1>Assign AM to {{person.fullname}}</h1>

35
<table id="amassign" class="table table-sm table-hover">
Enrico Zini's avatar
Enrico Zini committed
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
  <thead>
    <tr>
      <th rowspan="2">AM</th>
      <th rowspan="2">uid</th>
      <th colspan="4" class="metatitle">Slots</th>
    </tr>
    <tr>
      <th>Total</th>
      <th>Active</th>
      <th>Hold</th>
      <th>Free</th>
      <th>Comments</th>
      <th>Action</th>
    </tr>
  </thead>
  <tbody>
  {% for am in ams %}
53
54
55
56
57
58
59
60
61
62
63
64
65
   {% if am.person.status != "dd_e" and am.person.status != "dd_r" %}
    <tr>
      <td><a href="{{am.get_absolute_url}}">{{am.person.fullname}}</a></td>
      <td>{{am.person.ldap_fields.uid}}</td>
      <td>{{am.slots}}</td>
      <td>{{am.stats_active}}</td>
      <td>{{am.stats_held}}</td>
      <td>{{am.stats_free}}</td>
      <td>{{am.fd_comment}}</td>
      <td>
        <form action="{% url 'process_assign_am' pk=process.pk %}" method="post">{% csrf_token %}
          <input type="hidden" name="am" value="{{am.lookup_key}}">
          <button
66
          {% if am.slots == 0 %}
Mattia Rizzolo's avatar
grammar    
Mattia Rizzolo committed
67
            class="btn btn-sm btn-outline-secondary" data-toggle="tooltip" title="This AM set their slots to 0"
68
          {% elif am.stats_free == 0 %}
69
            class="btn btn-sm btn-secondary" data-toggle="tooltip" title="This AM has no free slots"
70
71
          {% elif am.stats_free < 0 %}
            class="btn btn-sm btn-dark" data-toogle="tooltip" title="This AM is working too hard already!"
72
          {% else %}
73
74
75
76
77
78
79
            {% if am.person.status == "dd_u" and process.applying_for == "dd_nu" %}
              class="btn btn-sm btn-warning" data-toggle="tooltip" title="DD_U AMs should be preferably assigned to DD_U processes"
            {% elif am.person.status == "dd_nu" and process.applying_for == "dd_u" %}
              class="btn btn-sm btn-danger" data-toggle="tooltip" title="DD_NU AMs should not be assigned to DD_U processes"
            {% else %}
                class="btn btn-sm btn-primary"
            {% endif %}
80
81
82
83
84
85
          {% endif %}
          type="submit">{% trans "Assign" %}</button>
        </form>
      </td>
    </tr>
   {% endif %}
Enrico Zini's avatar
Enrico Zini committed
86
87
88
89
90
91
  {% endfor %}
  </tbody>
</table>

<form action="{% url 'process_assign_am' pk=process.pk %}" method="post">{% csrf_token %}
  <p>Manual assignment: <input type="text" name="am"></p>
92
  <button class="btn btn-primary" type="submit">{% trans "Assign" %}</button>
Enrico Zini's avatar
Enrico Zini committed
93
94
95
96
</form>

{% endblock %}