diff --git a/index.html b/index.html
index 1cc2144..e5a9d3a 100644
--- a/index.html
+++ b/index.html
@@ -362,6 +362,21 @@
+
+
diff --git a/js/app.js b/js/app.js
index d9ef57e..9dca250 100644
--- a/js/app.js
+++ b/js/app.js
@@ -88,9 +88,11 @@ class App {
// Disable folder buttons
const btnIn = document.getElementById('btnSelectInput');
const btnOut = document.getElementById('btnSelectOutput');
+ const btnInvrptOut = document.getElementById('btnSelectInvrptOutput');
const btnStart = document.getElementById('btnStartWatcher');
if (btnIn) btnIn.disabled = true;
if (btnOut) btnOut.disabled = true;
+ if (btnInvrptOut) btnInvrptOut.disabled = true;
if (btnStart) btnStart.disabled = true;
} else {
// Load saved settings
@@ -101,6 +103,9 @@ class App {
if (settings.outputDir) {
document.getElementById('outputDirPath').value = settings.outputDir;
}
+ if (settings.invrptOutputDir) {
+ document.getElementById('invrptOutputPath').value = settings.invrptOutputDir;
+ }
});
}
}
@@ -1195,18 +1200,28 @@ class App {
}
}
+ async selectInvrptOutputFolder() {
+ if (!this.watcher) return;
+ const folder = await this.watcher.selectFolder();
+ if (folder) {
+ document.getElementById('invrptOutputPath').value = folder;
+ this.watcher.saveSettings({ invrptOutputDir: folder });
+ }
+ }
+
// ─── Settings: Watcher Controls ──────────────────────────────────
async startWatcher() {
if (!this.watcher) return;
const inputDir = document.getElementById('inputDirPath').value;
const outputDir = document.getElementById('outputDirPath').value;
+ const invrptOutputDir = document.getElementById('invrptOutputPath').value;
if (!inputDir || !outputDir) {
alert('Bitte beide Ordner (Input & Output) angeben.');
return;
}
- const result = await this.watcher.start(inputDir, outputDir);
+ const result = await this.watcher.start(inputDir, outputDir, invrptOutputDir);
if (result.error) {
alert('Watcher-Fehler: ' + result.error);
}
diff --git a/js/watcher-bridge.js b/js/watcher-bridge.js
index 122034e..eed5f64 100644
--- a/js/watcher-bridge.js
+++ b/js/watcher-bridge.js
@@ -40,7 +40,7 @@ class WatcherBridge {
}
async _processDetectedFile(data) {
- const { filePath, fileName, content, outputDir } = data;
+ const { filePath, fileName, content, outputDir, invrptOutputDir } = data;
this._addLog('info', fileName, 'Datei erkannt, starte Konvertierung...');
let konvertierungsmodus = 'Unbekannt';
@@ -71,7 +71,9 @@ class WatcherBridge {
const baseName = fileName.replace(/\.[^.]+$/, '');
const outExt = result.format === 'vda' ? '.vda' : (result.format === 'xml' ? '.xml' : '.edi');
outFileName = baseName + '_converted' + outExt;
- const outPath = outputDir + '\\' + outFileName;
+ const isInvrpt = result.type && result.type.includes('INVRPT');
+ const effectiveOutputDir = (isInvrpt && invrptOutputDir) ? invrptOutputDir : outputDir;
+ const outPath = effectiveOutputDir + '\\' + outFileName;
// Write converted file
const writeResult = await window.electronAPI.writeFile(outPath, result.output);
@@ -275,11 +277,11 @@ class WatcherBridge {
if (this.onLogEntry) this.onLogEntry(entry);
}
- async start(inputDir, outputDir) {
+ async start(inputDir, outputDir, invrptOutputDir) {
if (!window.electronAPI) {
return { error: 'Electron API nicht verfügbar. App läuft im Browser-Modus.' };
}
- const result = await window.electronAPI.startWatcher({ inputDir, outputDir });
+ const result = await window.electronAPI.startWatcher({ inputDir, outputDir, invrptOutputDir });
if (result.success) {
this.status = 'running';
this._addLog('info', '', `Watcher gestartet. Überwache: ${inputDir}`);
diff --git a/main.js b/main.js
index 07120a5..ae34fb7 100644
--- a/main.js
+++ b/main.js
@@ -15,7 +15,7 @@ const edifactValidator = require('./js/edifact-validator');
let mainWindow = null;
let watcher = null;
let watcherPaused = false;
-let watcherConfig = { inputDir: '', outputDir: '', mode: 'auto' };
+let watcherConfig = { inputDir: '', outputDir: '', invrptOutputDir: '', mode: 'auto' };
let outboundWatcher = null;
let outboundWatcherPaused = false;
@@ -116,8 +116,8 @@ function loadSettings() {
}
} catch (e) { console.error('Settings load error:', e); }
return {
- inputDir: '', outputDir: '', mode: 'auto',
- outboundInputDir: '', outboundOutputDir: '', mode: 'auto',
+ inputDir: '', outputDir: '', invrptOutputDir: '', mode: 'auto',
+ outboundInputDir: '', outboundOutputDir: '',
werksInputDir: '', werksOutputDir: ''
};
}
@@ -219,6 +219,7 @@ ipcMain.handle('start-watcher', (_, config) => {
const inputDir = watcherConfig.inputDir;
const outputDir = watcherConfig.outputDir;
+ const invrptOutputDir = watcherConfig.invrptOutputDir || '';
if (!inputDir || !outputDir) {
return { error: 'Input- und Output-Ordner müssen angegeben werden.' };
@@ -293,7 +294,8 @@ ipcMain.handle('start-watcher', (_, config) => {
filePath,
fileName,
content,
- outputDir
+ outputDir,
+ invrptOutputDir
});
console.log(`[Watcher] Sent to renderer: ${fileName} (${content.length} bytes)`);