button
This commit is contained in:
@@ -47,7 +47,7 @@ if (currentUser && !isDeleted && !isClosed) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Действия для активных (не удалённых, не закрытых) задач
|
// Действия для активных (не удалённых, не закрытых) задач
|
||||||
if (!isDeleted && !isClosed) {
|
if (!isDeleted && !isClosed && currentUser.login === 'minicrm') {
|
||||||
if (typeof openTaskChat === 'function') {
|
if (typeof openTaskChat === 'function') {
|
||||||
actions.push({ label: '💬 Чат', handler: () => openTaskChat(taskId) });
|
actions.push({ label: '💬 Чат', handler: () => openTaskChat(taskId) });
|
||||||
log('nav-task-actions openTaskChat yes');
|
log('nav-task-actions openTaskChat yes');
|
||||||
@@ -84,13 +84,19 @@ if (currentUser && !isDeleted && !isClosed) {
|
|||||||
if (currentUser && (currentUser.role === 'admin' || (currentUser.role === 'tasks' && canEdit))) {
|
if (currentUser && (currentUser.role === 'admin' || (currentUser.role === 'tasks' && canEdit))) {
|
||||||
|
|
||||||
if (typeof assignAdd_openModal === 'function') {
|
if (typeof assignAdd_openModal === 'function') {
|
||||||
actions.push({ label: '🧑💼➕ Добавить исполнителя', handler: () => assignAdd_openModal(taskId) });
|
actions.push({ label: '🧑💼➕ Добавить исполнителя',
|
||||||
|
handler: () => assignAdd_openModal(taskId),
|
||||||
|
admin: true
|
||||||
|
});
|
||||||
log('nav-task-actions assignAdd_openModal yes');
|
log('nav-task-actions assignAdd_openModal yes');
|
||||||
} else {
|
} else {
|
||||||
log('nav-task-actions assignAdd_openModal not');
|
log('nav-task-actions assignAdd_openModal not');
|
||||||
}
|
}
|
||||||
if (typeof assignRemove_openModal === 'function') {
|
if (typeof assignRemove_openModal === 'function') {
|
||||||
actions.push({ label: '🧑💼❌ Удалить исполнителя', handler: () => assignRemove_openModal(taskId) });
|
actions.push({ label: '🧑💼❌ Удалить исполнителя',
|
||||||
|
handler: () => assignRemove_openModal(taskId),
|
||||||
|
admin: true
|
||||||
|
});
|
||||||
log('nav-task-actions assignRemove_openModal yes');
|
log('nav-task-actions assignRemove_openModal yes');
|
||||||
} else {
|
} else {
|
||||||
log('nav-task-actions assignRemove_openModal not');
|
log('nav-task-actions assignRemove_openModal not');
|
||||||
@@ -193,7 +199,8 @@ log('nav-task-actions openChangeDeadlineModal yes');
|
|||||||
|
|
||||||
// primary
|
// primary
|
||||||
const primaryActions = actions.filter(a => a.primary);
|
const primaryActions = actions.filter(a => a.primary);
|
||||||
const otherActions = actions.filter(a => !a.primary);
|
const adminActions = actions.filter(a => a.admin && !a.primary);
|
||||||
|
const userActions = actions.filter(a => !a.primary && !a.admin);
|
||||||
// Создаём затемнение
|
// Создаём затемнение
|
||||||
const overlay = document.createElement('div');
|
const overlay = document.createElement('div');
|
||||||
overlay.id = 'task-action-modal';
|
overlay.id = 'task-action-modal';
|
||||||
@@ -252,7 +259,7 @@ log('nav-task-actions openChangeDeadlineModal yes');
|
|||||||
header.appendChild(closeBtn);
|
header.appendChild(closeBtn);
|
||||||
modal.appendChild(header);
|
modal.appendChild(header);
|
||||||
|
|
||||||
// === НОВЫЙ БЛОК: primary actions ===
|
// === БЛОК: primary actions ===
|
||||||
if (primaryActions.length > 0) {
|
if (primaryActions.length > 0) {
|
||||||
const primaryContainer = document.createElement('div');
|
const primaryContainer = document.createElement('div');
|
||||||
primaryContainer.style.marginBottom = '20px';
|
primaryContainer.style.marginBottom = '20px';
|
||||||
@@ -283,8 +290,39 @@ if (primaryActions.length > 0) {
|
|||||||
});
|
});
|
||||||
modal.appendChild(primaryContainer);
|
modal.appendChild(primaryContainer);
|
||||||
}
|
}
|
||||||
// Сетка кнопок (flex-wrap с 3 колонками)
|
// === Блок admin ===
|
||||||
if (otherActions.length > 0) {
|
if (adminActions.length > 0) {
|
||||||
|
const adminContainer = document.createElement('div');
|
||||||
|
adminContainer.style.marginBottom = '20px';
|
||||||
|
adminActions.forEach(a => {
|
||||||
|
const btn = document.createElement('button');
|
||||||
|
btn.textContent = a.label;
|
||||||
|
btn.style.cssText = `
|
||||||
|
width: 100%;
|
||||||
|
padding: 14px;
|
||||||
|
background-color: #e74c3c; // красный цвет для админских
|
||||||
|
color: white;
|
||||||
|
border: none;
|
||||||
|
border-radius: 8px;
|
||||||
|
font-size: 16px;
|
||||||
|
font-weight: 500;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: background-color 0.2s;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
`;
|
||||||
|
btn.onmouseover = () => btn.style.backgroundColor = '#c0392b';
|
||||||
|
btn.onmouseout = () => btn.style.backgroundColor = '#e74c3c';
|
||||||
|
btn.onclick = (event) => {
|
||||||
|
event.stopPropagation();
|
||||||
|
a.handler();
|
||||||
|
removeModal();
|
||||||
|
};
|
||||||
|
adminContainer.appendChild(btn);
|
||||||
|
});
|
||||||
|
modal.appendChild(adminContainer);
|
||||||
|
}
|
||||||
|
// === Блок остальных (user) ===
|
||||||
|
if (userActions.length > 0) {
|
||||||
const grid = document.createElement('div');
|
const grid = document.createElement('div');
|
||||||
grid.style.cssText = `
|
grid.style.cssText = `
|
||||||
display: flex;
|
display: flex;
|
||||||
@@ -292,7 +330,7 @@ if (otherActions.length > 0) {
|
|||||||
gap: 10px;
|
gap: 10px;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
`;
|
`;
|
||||||
otherActions.forEach(a => {
|
userActions.forEach(a => {
|
||||||
const btn = document.createElement('button');
|
const btn = document.createElement('button');
|
||||||
btn.textContent = a.label;
|
btn.textContent = a.label;
|
||||||
btn.style.cssText = `
|
btn.style.cssText = `
|
||||||
@@ -308,8 +346,8 @@ if (otherActions.length > 0) {
|
|||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
transition: background-color 0.2s;
|
transition: background-color 0.2s;
|
||||||
`;
|
`;
|
||||||
btn.onmouseover = () => { btn.style.backgroundColor = '#2980b9'; };
|
btn.onmouseover = () => btn.style.backgroundColor = '#2980b9';
|
||||||
btn.onmouseout = () => { btn.style.backgroundColor = '#3498db'; };
|
btn.onmouseout = () => btn.style.backgroundColor = '#3498db';
|
||||||
btn.onclick = (event) => {
|
btn.onclick = (event) => {
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
a.handler();
|
a.handler();
|
||||||
|
|||||||
Reference in New Issue
Block a user