feat: import reports from Excel

The /Import/StroyBot/Reports endpoint only validates the file, so the
check now runs as soon as a file is picked. When there are no errors,
"Import" builds the reports from the ids in the response and saves them
with the same Dataverse code as the report form: one report per date,
company, shift and object; resources nested under their work; idle and
repair hours as separate rows.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Тимур Городецкий
2026-10-22 17:01:27 +05:00
parent eb646193fa
commit 1ba67fe4c1
32 changed files with 1382 additions and 4 deletions
@@ -73,6 +73,7 @@ export function getStatusKind(status: string | undefined): ProjectStatusKind {
* - архивный проект — закрыто всё (кроме архива, он не раздел приложения);
* - завершён — нельзя «Отправить отчёт»;
* - нет права edit0 — нельзя «Отправить отчёт».
* Импорт отчёта из Excel создаёт отчёты — те же правила, что у «Отправить отчёт».
* Привязка к справочнику — только с правом редактирования (решение при объединении).
*/
export function isSectionAvailable(page: PageId, project: IAccessibleProject): boolean {
@@ -80,7 +81,7 @@ export function isSectionAvailable(page: PageId, project: IAccessibleProject): b
const kind = getStatusKind(project.status);
if (kind === 'archive') return false;
if (page === 'report') return kind !== 'done' && project.canEdit;
if (page === 'report' || page === 'reportImport') return kind !== 'done' && project.canEdit;
if (page === 'binder') return project.canEdit;
return true;
}