удалить
This commit is contained in:
14
public/ui.js
14
public/ui.js
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user