v1.8.4: единая стилистика — замена confirm/alert/prompt на кастомные модалки, SERVICE_STYLE_GUIDE.md, обновлен AGENTS.md
This commit is contained in:
@@ -16,9 +16,9 @@
|
||||
<td class="actions">
|
||||
<button class="btn btn-secondary btn-sm" onclick="editUser({{ u.id }},'{{ u.login }}','{{ u.full_name }}','{{ u.role }}','{{ u.phone }}','{{ u.email }}','{{ u.max_user_id or '' }}',{{ 'true' if u.is_active else 'false' }})">✎</button>
|
||||
{% if u.role != 'owner' %}
|
||||
<form method="post" action="/service/users/delete" style="display:inline" onsubmit="return confirm('Удалить пользователя?')">
|
||||
<form method="post" action="/service/users/delete" style="display:inline" id="delete-user-form-{{ u.id }}">
|
||||
<input type="hidden" name="id" value="{{ u.id }}">
|
||||
<button type="submit" class="btn btn-danger btn-sm">✕</button>
|
||||
<button type="button" class="btn btn-danger btn-sm" onclick="openConfirmDeleteUser({{ u.id }},'{{ u.login|e }}')" title="Удалить">✕</button>
|
||||
</form>{% endif %}
|
||||
</td>
|
||||
</tr>{% endfor %}</tbody></table>
|
||||
@@ -53,7 +53,34 @@
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-overlay" id="confirm-delete-user">
|
||||
<div class="modal" style="max-width:420px;">
|
||||
<h2 style="font-size:16px;margin-bottom:8px;">Удалить пользователя?</h2>
|
||||
<p style="color:var(--text-secondary);font-size:14px;margin-bottom:20px;">
|
||||
<strong id="delete-user-name"></strong> будет удалён навсегда. Это действие нельзя отменить.
|
||||
</p>
|
||||
<div class="modal-actions" style="justify-content:flex-end;">
|
||||
<button type="button" class="btn btn-danger" onclick="confirmDeleteUser()">Удалить</button>
|
||||
<button type="button" class="btn" onclick="closeConfirmDeleteUser()">Отмена</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
var deleteUserId = null;
|
||||
function openConfirmDeleteUser(id, name){
|
||||
deleteUserId = id;
|
||||
document.getElementById('delete-user-name').textContent = name || '#' + id;
|
||||
document.getElementById('confirm-delete-user').classList.add('open');
|
||||
}
|
||||
function closeConfirmDeleteUser(){
|
||||
document.getElementById('confirm-delete-user').classList.remove('open');
|
||||
deleteUserId = null;
|
||||
}
|
||||
function confirmDeleteUser(){
|
||||
if(!deleteUserId) return;
|
||||
document.getElementById('delete-user-form-' + deleteUserId).submit();
|
||||
closeConfirmDeleteUser();
|
||||
}
|
||||
function editUser(id,login,name,role,phone,email,maxId,active){
|
||||
document.getElementById('modal-user').classList.add('open');
|
||||
document.getElementById('modal-user-title').textContent = 'Редактировать сотрудника';
|
||||
|
||||
Reference in New Issue
Block a user