feat: v3.0 - canvas editor, JSON-only, no Excel, new UI
Some checks failed
Build & Push Docker / build (push) Has been cancelled
Some checks failed
Build & Push Docker / build (push) Has been cancelled
- Remove all Excel code (import, export, template, pandas, openpyxl) - New canvas-based schedule editor with drag & drop (interact.js) - Modern 3-panel UI: sidebar, canvas, documentation tab - New data model: Block with id/date/start/end, ProgramType with id/name/color - Clean API: GET /api/health, POST /api/validate, GET /api/sample, POST /api/generate-pdf - Rewritten PDF generator using ScenarioDocument directly (no DataFrame) - Professional PDF output: dark header, colored blocks, merged cells, legend, footer - Sample JSON: "Zimní výjezd oddílu" with 11 blocks, 3 program types - 30 tests passing (API, core models, PDF generation) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,33 +1,31 @@
|
||||
/**
|
||||
* JSON import/export for Scenar Creator.
|
||||
* JSON import/export for Scenar Creator v3.
|
||||
*/
|
||||
|
||||
function exportJson() {
|
||||
if (!window.currentDocument) {
|
||||
showStatus('No document to export', 'error');
|
||||
const doc = App.getDocument();
|
||||
if (!doc) {
|
||||
App.toast('Žádný scénář k exportu', 'error');
|
||||
return;
|
||||
}
|
||||
const json = JSON.stringify(window.currentDocument, null, 2);
|
||||
const json = JSON.stringify(doc, null, 2);
|
||||
const blob = new Blob([json], { type: 'application/json' });
|
||||
API.downloadBlob(blob, 'scenar_export.json');
|
||||
App.toast('JSON exportován', 'success');
|
||||
}
|
||||
|
||||
function handleJsonImport(event) {
|
||||
const file = event.target.files[0];
|
||||
if (!file) return;
|
||||
|
||||
function importJson(file) {
|
||||
const reader = new FileReader();
|
||||
reader.onload = function (e) {
|
||||
try {
|
||||
const doc = JSON.parse(e.target.result);
|
||||
if (!doc.event || !doc.blocks || !doc.program_types) {
|
||||
throw new Error('Invalid ScenarioDocument format');
|
||||
throw new Error('Neplatný formát ScenarioDocument');
|
||||
}
|
||||
window.currentDocument = doc;
|
||||
showImportedDocument(doc);
|
||||
showStatus('JSON imported successfully', 'success');
|
||||
App.loadDocument(doc);
|
||||
App.toast('JSON importován', 'success');
|
||||
} catch (err) {
|
||||
showStatus('JSON import error: ' + err.message, 'error');
|
||||
App.toast('Chyba importu: ' + err.message, 'error');
|
||||
}
|
||||
};
|
||||
reader.readAsText(file);
|
||||
|
||||
Reference in New Issue
Block a user