Commit dfe15ec2 authored by Gabriel Detraz's avatar Gabriel Detraz Committed by klafyvel

Button to remove port of a room

parent 2df79830
......@@ -42,6 +42,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<th>{% trans "Details" %}</th>
<th>{% trans "End of subscription on" %}</th>
<th>{% trans "Internet access" %}</th>
<th>{% trans "Action" %}</th>
</tr>
</thead>
{% for room in room_list %}
......@@ -51,7 +52,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<td>{% if room.port_set.all %}<span class="label label-success">AURORE{% else %}<span class="label label-danger">{% trans "Other operator" %}{% endif %}</span></td>
<td>{% if room.adherent %}<a href="{% url 'users:profil' room.adherent.id%}">{{ room.adherent }}</a>{% else %} {% trans "Aucun" %}{% endif %}</td>
<td>{{ room.details }}</td>
<td>{% if room.adherent.is_adherent %}{{ room.adherent.end_adhesion }}{% else %}{% trans "Not a member" %}{% endif %}</td>
<td>{% if room.adherent.is_adherent %}<i class="text-success">{% else %}<i class="text-danger">{% endif %}{% if room.adherent.end_adhesion %}{{ room.adherent.end_adhesion}}{% else %}{% trans "No member" %}{% endif %}</i></td>
<td>
{% if room.adherent.has_access == True %}
<i class="text-success">{% trans "Active" %}</i>
......@@ -59,6 +60,11 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<i class="text-danger">{% trans "Disabled" %}</i>
{% endif %}
</td>
<td>
{% if room.port_set.all %}
<a href="{% url 'multi_op:disconnect-room' room.id %}" class="btn btn-danger btn-sm" role="button"><i class="fa fa-expand"></i></a>
{% endif %}
</td>
</tr>
{% endfor %}
</table>
......
......@@ -34,5 +34,5 @@ urlpatterns = [
url(r'^(?P<dormitoryid>[0-9]+)$', views.aff_state_dormitory, name='aff-state-dormitory'),
url(r'^pending-connection$', views.aff_pending_connection, name='aff-pending-connection'),
url(r'^pending-disconnection$', views.aff_pending_disconnection, name='aff-pending-disconnection'),
# url(r'^multi_op/edit-preferences-multiop$', views.edit_preferences, name='edit-preferences-multiop'),
url(r'^disconnect-room/(?P<roomid>[0-9]+)$', views.disconnect_room, name='disconnect-room'),
]
......@@ -142,6 +142,18 @@ def aff_pending_disconnection(request):
)
@login_required
@can_edit(Room)
def disconnect_room(request, room, roomid):
"""Action of disconnecting a room"""
room.port_set.clear()
room.save()
messages.success(request,'Room %s disconnected' % room)
return redirect(reverse(
'multi_op:aff-pending-disconnection'
))
def edit_preferences(request):
""" View to edit the settings of the tickets """
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment