better usage limit and deletion warnings

This commit is contained in:
2025-06-06 09:44:23 +02:00
parent 51cea567ca
commit f6abdb5c63
2 changed files with 88 additions and 52 deletions

View File

@@ -91,24 +91,34 @@
</div>
</div>
</div>
{% if current_user.is_admin or (current_user.is_manager and room.member_permissions|selectattr('user_id', 'equalto', current_user.id)|list|length > 0) %}
{% if current_user.is_admin %}
<!-- Delete Room Modal -->
<div class="modal fade" id="deleteRoomModal{{ room.id }}" tabindex="-1" aria-labelledby="deleteRoomModalLabel{{ room.id }}" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="deleteRoomModalLabel{{ room.id }}">Delete Room</h5>
<h5 class="modal-title" id="deleteRoomModalLabel{{ room.id }}">Move to Trash</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<p>Are you sure you want to delete the room "{{ room.name }}"? This action cannot be undone.</p>
<div class="d-flex align-items-center gap-3 mb-3">
<i class="fas fa-trash text-danger" style="font-size: 2rem;"></i>
<div>
<h6 class="mb-1">Move to Trash</h6>
<p class="text-muted mb-0" id="deleteRoomName{{ room.id }}">{{ room.name }}</p>
</div>
</div>
<div class="alert alert-warning">
<i class="fas fa-exclamation-triangle me-2"></i>
This room will be permanently deleted and cannot be recovered. All documents and files will be lost. Are you sure you want to proceed?
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Cancel</button>
<form action="{{ url_for('rooms.delete_room', room_id=room.id) }}" method="POST" class="d-inline">
<input type="hidden" name="csrf_token" value="{{ csrf_token }}">
<button type="submit" class="btn btn-danger">
<i class="fas fa-trash me-2"></i>Move to Trash
<i class="fas fa-trash me-2"></i>Delete Room
</button>
</form>
</div>