diff --git a/public/chat-ui.js b/public/chat-ui.js index b1ed7a4..cf76716 100644 --- a/public/chat-ui.js +++ b/public/chat-ui.js @@ -70,7 +70,7 @@ class TaskChat { >
- +
diff --git a/public/nav-task-actions.js b/public/nav-task-actions.js index c4aab88..aabb6a8 100644 --- a/public/nav-task-actions.js +++ b/public/nav-task-actions.js @@ -29,7 +29,7 @@ if (currentUser && !isDeleted && !isClosed) { actions.push({ label: '▶️ Приступить', handler: () => window.updateStatus(taskId, currentUser.id, 'in_progress'), - primary: true + primary: true }); } // Кнопка "Выполнено" (если статус 'in_progress', 'overdue' или 'rework') @@ -41,11 +41,21 @@ if (currentUser && !isDeleted && !isClosed) { actions.push({ label: '✅ Выполнено', handler: handler, - primary: true + primary: true }); } } } + // Копия – доступна всем, у кого есть кнопка + if (typeof openCopyModal === 'function') { + actions.push({ label: '📋 Создать копию', + handler: () => openCopyModal(taskId), + primary: true + }); + log('nav-task-actions assignRemove_openModal yes'); + } else { + log('nav-task-actions assignRemove_openModal not'); + } // Действия для активных (не удалённых, не закрытых) задач if (!isDeleted && !isClosed && currentUser.login === 'minicrm') { if (typeof openTaskChat === 'function') { @@ -81,7 +91,7 @@ if (currentUser && !isDeleted && !isClosed) { // ${currentUser && currentUser.role === 'tasks' && canEdit || currentUser.role === 'admin' // Администраторы и роль tasks - if (currentUser && (currentUser.role === 'admin' || (currentUser.role === 'tasks' && canEdit))) { +if (currentUser && (currentUser.role === 'admin' || (currentUser.role === 'tasks' && canEdit))) { if (typeof assignAdd_openModal === 'function') { actions.push({ label: '🧑‍💼➕ Добавить исполнителя', @@ -102,35 +112,27 @@ if (currentUser && !isDeleted && !isClosed) { log('nav-task-actions assignRemove_openModal not'); } //} - - // Копия – доступна всем, у кого есть кнопка - if (typeof openCopyModal === 'function') { - actions.push({ label: '📋 Создать копию', handler: () => openCopyModal(taskId) }); - log('nav-task-actions assignRemove_openModal yes'); - } else { - log('nav-task-actions assignRemove_openModal not'); - } - // Доработка для документа (исполнитель) - //if (task.task_type === 'document' && userRole === 'Исполнитель') { + if (currentUser && (currentUser.role === 'admin' && currentUser.login === 'minicrm')) { if (typeof openReworkModal === 'function') { actions.push({ label: '🔄 Переделать документ', handler: () => openReworkModal(taskId) }); log('nav-task-actions assignRemove_openModal yes'); } else { log('nav-task-actions assignRemove_openModal not'); } - //} - - // Доработка и изменение срока для необычных задач (исполнитель) -//if (!isDeleted && !isClosed && task.task_type !== 'regular' &&task.assignments && task.assignments.some(a => parseInt(a.user_id) === window.currentUser?.id)) { -if (typeof openReworkModal === 'function') { actions.push({ label: '🔄 Доработка', handler: () => openReworkModal(taskId) }); + } +} + // Доработка и изменение срока для необычных задач (исполнитель) +if (!isDeleted && !isClosed && task.task_type !== 'regular' && task.assignments && task.assignments.some(a => parseInt(a.user_id) === currentUser?.id)) { +if (typeof openReworkModal === 'function') { actions.push({ label: '🔄 Доработка', handler: () => openReworkModal(taskId),primary_task: true}); log('nav-task-actions openReworkModal yes'); } else {log('nav-task-actions openReworkModal not');} -if (typeof openChangeDeadlineModal === 'function') { actions.push({ label: '📅 Изменить срок', handler: () => openChangeDeadlineModal(taskId) }); +if (typeof openChangeDeadlineModal === 'function') { actions.push({ label: '📅 Изменить срок', handler: () => openChangeDeadlineModal(taskId),primary_task: true }); log('nav-task-actions openChangeDeadlineModal yes'); } else {log('nav-task-actions openChangeDeadlineModal not');} - //} - +} + +if (currentUser && currentUser.login === 'minicrm') { // Закрытие (только minicrm) //if (window.currentUser && window.currentUser.login === 'minicrm') { if (typeof closeTask === 'function') actions.push({ label: '🔒 Закрыть задачу', handler: () => closeTask(taskId) }); @@ -200,7 +202,8 @@ log('nav-task-actions openChangeDeadlineModal yes'); // primary const primaryActions = actions.filter(a => a.primary); const adminActions = actions.filter(a => a.admin && !a.primary); - const userActions = actions.filter(a => !a.primary && !a.admin); + const taskActions = actions.filter(a => a.primary_task && !a.primary && !a.primary); + const userActions = actions.filter(a => !a.primary && !a.admin && !a.primary_task); // Создаём затемнение const overlay = document.createElement('div'); overlay.id = 'task-action-modal'; @@ -290,6 +293,37 @@ if (primaryActions.length > 0) { }); modal.appendChild(primaryContainer); } +// === Блок taskActions === +if (taskActions.length > 0) { + const taskContainer = document.createElement('div'); + taskContainer.style.marginBottom = '20px'; + taskActions.forEach(a => { + const btn = document.createElement('button'); + btn.textContent = a.label; + btn.style.cssText = ` + width: 100%; + padding: 14px; + background-color: #dfc63cff; // цвет + 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 = '#dfc63cff'; + btn.onmouseout = () => btn.style.backgroundColor = '#dfc63cff'; + btn.onclick = (event) => { + event.stopPropagation(); + a.handler(); + removeModal(); + }; + taskContainer.appendChild(btn); + }); + modal.appendChild(taskContainer); +} // === Блок admin === if (adminActions.length > 0) { const adminContainer = document.createElement('div'); @@ -321,6 +355,7 @@ if (adminActions.length > 0) { }); modal.appendChild(adminContainer); } + // === Блок остальных (user) === if (userActions.length > 0) { const grid = document.createElement('div'); diff --git a/public/ui.js b/public/ui.js index cca1292..7d25245 100644 --- a/public/ui.js +++ b/public/ui.js @@ -179,9 +179,9 @@ ${currentUser && currentUser.login === 'minicrm' ? `` : ''} -${task.task_type === 'document' && userRole === 'Исполнитель' ? `` : ''} +${task.task_type === 'document' && userRole === 'Исполнитель' && currentUser.login === 'minicrm' ? `` : ''} -${!isDeleted && !isClosed && task.task_type !== 'regular' && task.assignments && task.assignments.some(a => parseInt(a.user_id) === currentUser.id) ? ` +${!isDeleted && !isClosed && task.task_type !== 'regular' && task.assignments && task.assignments.some(a => parseInt(a.user_id) === currentUser.id) && currentUser.login === 'minicrm' ? ` ` : ''} @@ -1035,7 +1035,7 @@ function openAddFileModal(taskId) {
- + Максимальный размер: 10MB
@@ -1043,11 +1043,13 @@ function openAddFileModal(taskId) {
+ placeholder="название фаила ограничено 45 символами">
diff --git a/server.js b/server.js index a917ccf..701adb2 100644 --- a/server.js +++ b/server.js @@ -1584,7 +1584,7 @@ initializeServer().then(() => { // Запускаем фоновые задачи setInterval(checkOverdueTasks, 60000); setInterval(checkUpcomingDeadlines, 60000); - setInterval(() => cronJobs.checkDocumentsForCompletion(db), 5*60000); + setInterval(() => cronJobs.checkDocumentsForCompletion(db), 60000); }); }).catch(error => { console.error('❌ Не удалось запустить сервер:', error);