удалить

This commit is contained in:
2026-02-13 00:57:50 +05:00
parent 6cf551a8bf
commit f44553d4a5
7 changed files with 813 additions and 1023 deletions

View File

@@ -118,7 +118,7 @@ function renderTasks() {
<div class="file-list" id="files-${task.id}">
<strong>Файлы:</strong>
${task.files && task.files.length > 0 ? renderGroupedFiles(task) : '<span class="no-files">нет файлов</span>'}
${task.files && task.files.length > 0 ? renderGroupedFilesWithDelete(task) : '<span class="no-files">нет файлов</span>'}
</div>
@@ -807,25 +807,25 @@ function closeAddFileModal() {
async function loadTaskFiles(taskId) {
try {
const response = await fetch(`/api/tasks/${taskId}/files`);
const allFiles = await response.json(); // Получаем ВСЕ файлы
const allFiles = await response.json();
// Получаем задачу
const taskIndex = tasks.findIndex(t => t.id === taskId);
if (taskIndex === -1) {
console.error('Задача не найдена:', taskId);
return;
}
// Сохраняем ВСЕ файлы в задаче (не фильтруем здесь!)
tasks[taskIndex].files = allFiles;
// Обновляем отображение файлов с помощью renderGroupedFiles
// Она сама отфильтрует что показывать
const fileContainer = document.getElementById(`files-${taskId}`);
if (fileContainer) {
fileContainer.innerHTML = `
<strong>Файлы:</strong>
${allFiles.length > 0 ? renderGroupedFiles(tasks[taskIndex]) : '<span class="no-files">нет файлов</span>'}
${allFiles.length > 0 ?
(typeof renderGroupedFilesWithDelete === 'function' ?
renderGroupedFilesWithDelete(tasks[taskIndex]) :
renderGroupedFiles(tasks[taskIndex])) :
'<span class="no-files">нет файлов</span>'}
`;
}
} catch (error) {