diff --git a/src/components/TemplateManager/HeaderBar.tsx b/src/components/TemplateManager/HeaderBar.tsx index 656dc02..f75486b 100644 --- a/src/components/TemplateManager/HeaderBar.tsx +++ b/src/components/TemplateManager/HeaderBar.tsx @@ -1,6 +1,6 @@ import { Button } from '@/components/ui/button' import { Template } from '@/types/template' -import { ArrowLeft, FileText, Wrench } from 'lucide-react' +import { ArrowLeft, FileText, Settings, Wrench } from 'lucide-react' import React from 'react' import { useNavigate } from 'react-router-dom' @@ -19,11 +19,13 @@ export const HeaderBar: React.FC = ({ template, onBack }) => { -
-

{template.name}

-

- Настройте Excel шаблон и значения отчета -

+
+ +

Редактор шаблонов

+ + + {template.name} +
diff --git a/src/components/TemplateManager/TemplateCard.tsx b/src/components/TemplateManager/TemplateCard.tsx index eddee43..3ccfc2c 100644 --- a/src/components/TemplateManager/TemplateCard.tsx +++ b/src/components/TemplateManager/TemplateCard.tsx @@ -18,6 +18,11 @@ const TemplateCard: React.FC = ({ }) => { const navigate = useNavigate() + // Шаблон считается готовым, когда есть хотя бы один элемент и загружена + // Excel-таблица (что подтверждается наличием mergedCells). + const isConfigured = + template.elements.length > 0 && (template.mergedCells?.length ?? 0) > 0 + return ( @@ -41,13 +46,11 @@ const TemplateCard: React.FC = ({ -
- - ) - } - - // Если шаблон не найден - if (!selectedTemplate) { - return ( -
-
- -

- Шаблон не найден -

-

- Выбранный шаблон не существует или был удален -

- +
+
+ {isLoading && 'Загрузка шаблона...'} + {error && `Ошибка загрузки: ${error}`} + {!selectedTemplate && 'Шаблон не найден'}
) } return ( -
-
-
+
+
+
- -

Редактор элементов

+ +

Редактор шаблонов

{selectedTemplate.name}
- - {/* Индикатор сохранения */} - {isSaving && ( -
-
- Сохранение... -
- )} +
+
+ +
+ {/* Индикатор сохранения */} + {isSaving && ( +
+
+ Сохранение... +
+ )} +