v1.8.4: единая стилистика — замена confirm/alert/prompt на кастомные модалки, SERVICE_STYLE_GUIDE.md, обновлен AGENTS.md
This commit is contained in:
@@ -17,7 +17,7 @@
|
||||
<td class="actions">
|
||||
<button class="btn btn-secondary btn-sm" onclick="editObject({{ o.id }},'{{ o.name|e }}','{{ o.customer_id or '' }}','{{ o.object_type|e }}','{{ o.address|e }}','{{ o.contact_person|e }}','{{ o.contact_phone|e }}','{{ o.status }}','{{ o.notes|e }}')">✎</button>
|
||||
{% if user.role == 'owner' %}
|
||||
<form method="post" action="/service/objects/delete" style="display:inline" onsubmit="return confirm('Удалить объект?')"><input type="hidden" name="id" value="{{ o.id }}"><button class="btn btn-danger btn-sm">✕</button></form>
|
||||
<form method="post" action="/service/objects/delete" style="display:inline" id="delete-object-form-{{ o.id }}"><input type="hidden" name="id" value="{{ o.id }}"><button type="button" class="btn btn-danger btn-sm" onclick="openConfirmDeleteObject({{ o.id }},'{{ o.name|e }}')" title="Удалить">✕</button></form>
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>{% endfor %}</tbody></table>
|
||||
@@ -48,7 +48,34 @@
|
||||
</div>
|
||||
</form>
|
||||
</div></div>
|
||||
<div class="modal-overlay" id="confirm-delete-object">
|
||||
<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-object-name"></strong> будет удалён навсегда. Это действие нельзя отменить.
|
||||
</p>
|
||||
<div class="modal-actions" style="justify-content:flex-end;">
|
||||
<button type="button" class="btn btn-danger" onclick="confirmDeleteObject()">Удалить</button>
|
||||
<button type="button" class="btn" onclick="closeConfirmDeleteObject()">Отмена</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
var deleteObjectId = null;
|
||||
function openConfirmDeleteObject(id, name){
|
||||
deleteObjectId = id;
|
||||
document.getElementById('delete-object-name').textContent = name || '#' + id;
|
||||
document.getElementById('confirm-delete-object').classList.add('open');
|
||||
}
|
||||
function closeConfirmDeleteObject(){
|
||||
document.getElementById('confirm-delete-object').classList.remove('open');
|
||||
deleteObjectId = null;
|
||||
}
|
||||
function confirmDeleteObject(){
|
||||
if(!deleteObjectId) return;
|
||||
document.getElementById('delete-object-form-' + deleteObjectId).submit();
|
||||
closeConfirmDeleteObject();
|
||||
}
|
||||
function editObject(id,name,cid,type,addr,person,phone,status,notes){
|
||||
document.getElementById('modal-object').classList.add('open');
|
||||
document.getElementById('modal-object-title').textContent = 'Редактировать объект';
|
||||
|
||||
Reference in New Issue
Block a user