Strichliste Paket 2
This commit is contained in:
+1058
-13
File diff suppressed because it is too large
Load Diff
+140
-2
@@ -108,6 +108,8 @@ $reportRows = [];
|
||||
$importResult = ['rows' => [], 'summary' => ['imported' => 0, 'duplicates' => 0, 'unmatched' => 0]];
|
||||
$scanImportJobs = [];
|
||||
$scanTemplates = [];
|
||||
$activeScanJob = null;
|
||||
$activeScanRows = [];
|
||||
$surveyBoard = ['all' => [], 'published' => []];
|
||||
$activeSurvey = null;
|
||||
$surveyResults = [];
|
||||
@@ -234,6 +236,15 @@ if ($auth !== null && $pdo instanceof PDO) {
|
||||
if (function_exists('app_scan_import_jobs_for_tenant')) {
|
||||
$scanImportJobs = app_scan_import_jobs_for_tenant($pdo, (string) $auth['tenant_id']);
|
||||
}
|
||||
$activeScanJobId = trim((string) ($_GET['scan_job'] ?? ''));
|
||||
if ($activeScanJobId !== '') {
|
||||
if (function_exists('app_scan_import_job_for_tenant')) {
|
||||
$activeScanJob = app_scan_import_job_for_tenant($pdo, (string) $auth['tenant_id'], $activeScanJobId);
|
||||
}
|
||||
if (is_array($activeScanJob) && function_exists('app_scan_import_rows_for_job')) {
|
||||
$activeScanRows = app_scan_import_rows_for_job($pdo, (string) $auth['tenant_id'], $activeScanJobId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($page === 'surveys') {
|
||||
@@ -1684,6 +1695,7 @@ $marketing = app_marketing_messages();
|
||||
$csvDuplicates = (int) ($csvSummary['duplicates'] ?? 0);
|
||||
$csvUnmatched = (int) ($csvSummary['unmatched'] ?? 0);
|
||||
$csvSummaryTotal = $csvImported + $csvDuplicates + $csvUnmatched;
|
||||
$selectedScanJobId = is_array($activeScanJob) ? (string) ($activeScanJob['id'] ?? '') : '';
|
||||
?>
|
||||
<?php if ($csvSummaryTotal > 0): ?>
|
||||
<section class="metric" style="margin-top:18px">
|
||||
@@ -1709,16 +1721,21 @@ $marketing = app_marketing_messages();
|
||||
<th>Status</th>
|
||||
<th>Template</th>
|
||||
<th>Fehler</th>
|
||||
<th>Aktion</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($scanImportJobs as $job): ?>
|
||||
<?php
|
||||
$jobId = (string) ($job['id'] ?? '');
|
||||
$jobCreatedAt = (string) ($job['created_at'] ?? $job['created_at_local'] ?? '');
|
||||
$jobFileName = (string) ($job['file_name'] ?? $job['filename'] ?? $job['original_filename'] ?? '-');
|
||||
$jobFileName = (string) ($job['file_name'] ?? $job['filename'] ?? $job['original_filename'] ?? $job['source_filename'] ?? '-');
|
||||
$jobStatus = (string) ($job['status'] ?? $job['state'] ?? '-');
|
||||
$jobTemplate = (string) ($job['template_name'] ?? $job['template_label'] ?? $job['template_title'] ?? $job['template_id'] ?? '-');
|
||||
$jobError = (string) ($job['error_message'] ?? $job['error'] ?? $job['last_error'] ?? '');
|
||||
$jobStatusNormalized = strtolower(trim($jobStatus));
|
||||
$canProcessJob = in_array($jobStatusNormalized, ['uploaded', 'failed'], true);
|
||||
$isSelectedScanJob = $selectedScanJobId !== '' && $selectedScanJobId === $jobId;
|
||||
?>
|
||||
<tr>
|
||||
<td><?= dt($jobCreatedAt !== '' ? $jobCreatedAt : null) ?></td>
|
||||
@@ -1726,15 +1743,136 @@ $marketing = app_marketing_messages();
|
||||
<td><?= h($jobStatus !== '' ? $jobStatus : '-') ?></td>
|
||||
<td><?= h($jobTemplate !== '' ? $jobTemplate : '-') ?></td>
|
||||
<td><?= h($jobError !== '' ? $jobError : '-') ?></td>
|
||||
<td>
|
||||
<div class="actions">
|
||||
<?php if ($canProcessJob && $jobId !== ''): ?>
|
||||
<form method="post" action="/imports/">
|
||||
<input type="hidden" name="action" value="process-scan-import-job">
|
||||
<input type="hidden" name="job_id" value="<?= h($jobId) ?>">
|
||||
<button type="submit" class="button secondary">Verarbeiten</button>
|
||||
</form>
|
||||
<?php endif; ?>
|
||||
<?php if ($jobId !== ''): ?>
|
||||
<a class="button <?= $isSelectedScanJob ? '' : 'secondary' ?>" href="/imports/?scan_job=<?= h($jobId) ?>">Review öffnen</a>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
<?php if ($scanImportJobs === []): ?>
|
||||
<tr><td colspan="5">Noch keine Scan-Jobs vorhanden.</td></tr>
|
||||
<tr><td colspan="6">Noch keine Scan-Jobs vorhanden.</td></tr>
|
||||
<?php endif; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<?php if (is_array($activeScanJob)): ?>
|
||||
<?php
|
||||
$activeJobId = (string) ($activeScanJob['id'] ?? '');
|
||||
$activeJobStatus = (string) ($activeScanJob['status'] ?? $activeScanJob['state'] ?? '-');
|
||||
$activeJobFileName = (string) ($activeScanJob['file_name'] ?? $activeScanJob['filename'] ?? $activeScanJob['original_filename'] ?? $activeScanJob['source_filename'] ?? '-');
|
||||
?>
|
||||
<section class="card" style="margin-top:18px">
|
||||
<div class="actions" style="justify-content:space-between;align-items:flex-start;margin-bottom:14px">
|
||||
<div>
|
||||
<div class="eyebrow">Review</div>
|
||||
<h2 style="margin:0">Scan-Import prüfen</h2>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<section class="grid grid-3" style="margin-bottom:18px">
|
||||
<article class="metric">
|
||||
<strong><?= h($activeJobId !== '' ? $activeJobId : '-') ?></strong>
|
||||
<h3>Job-ID</h3>
|
||||
<p>Aktiver Review-Kontext.</p>
|
||||
</article>
|
||||
<article class="metric">
|
||||
<strong><?= h($activeJobStatus !== '' ? $activeJobStatus : '-') ?></strong>
|
||||
<h3>Status</h3>
|
||||
<p>Aktueller Verarbeitungsstand des Jobs.</p>
|
||||
</article>
|
||||
<article class="metric">
|
||||
<strong><?= h($activeJobFileName !== '' ? $activeJobFileName : '-') ?></strong>
|
||||
<h3>Datei</h3>
|
||||
<p>Quelle des Scan-Imports.</p>
|
||||
</article>
|
||||
</section>
|
||||
|
||||
<form method="post" action="/imports/">
|
||||
<input type="hidden" name="action" value="save-scan-import-review">
|
||||
<input type="hidden" name="job_id" value="<?= h($activeJobId) ?>">
|
||||
<div class="table">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Mitglied</th>
|
||||
<th>erkannt front</th>
|
||||
<th>erkannt back</th>
|
||||
<th>confidence</th>
|
||||
<th>korrigiert front</th>
|
||||
<th>korrigiert back</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($activeScanRows as $row): ?>
|
||||
<?php
|
||||
$rowId = (string) ($row['id'] ?? '');
|
||||
$rowMemberName = trim((string) ($row['member_name_raw'] ?? ''));
|
||||
if ($rowMemberName === '') {
|
||||
$rowMemberName = trim((string) ($row['display_name'] ?? $row['member_display_name'] ?? ''));
|
||||
}
|
||||
$rowFrontDetected = (string) ($row['front_strokes_detected'] ?? $row['detected_front'] ?? $row['front_detected'] ?? '0');
|
||||
$rowBackDetected = (string) ($row['back_strokes_detected'] ?? $row['detected_back'] ?? $row['back_detected'] ?? '0');
|
||||
$rowConfidence = $row['confidence'] ?? null;
|
||||
$rowCorrectedFront = (string) ($row['corrected_front_strokes'] ?? $row['corrected_front'] ?? $rowFrontDetected);
|
||||
$rowCorrectedBack = (string) ($row['corrected_back_strokes'] ?? $row['corrected_back'] ?? $rowBackDetected);
|
||||
?>
|
||||
<tr>
|
||||
<td><?= h($rowMemberName !== '' ? $rowMemberName : 'Unbekannt') ?></td>
|
||||
<td><?= h($rowFrontDetected) ?></td>
|
||||
<td><?= h($rowBackDetected) ?></td>
|
||||
<td><?= $rowConfidence === null || $rowConfidence === '' ? '-' : h((string) $rowConfidence) ?></td>
|
||||
<td>
|
||||
<input
|
||||
type="number"
|
||||
name="corrected_front[<?= h($rowId) ?>]"
|
||||
min="0"
|
||||
step="1"
|
||||
value="<?= h($rowCorrectedFront) ?>"
|
||||
>
|
||||
</td>
|
||||
<td>
|
||||
<input
|
||||
type="number"
|
||||
name="corrected_back[<?= h($rowId) ?>]"
|
||||
min="0"
|
||||
step="1"
|
||||
value="<?= h($rowCorrectedBack) ?>"
|
||||
>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
<?php if ($activeScanRows === []): ?>
|
||||
<tr><td colspan="6">Für diesen Job liegen noch keine Review-Zeilen vor.</td></tr>
|
||||
<?php endif; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="actions" style="margin-top:16px">
|
||||
<button type="submit" class="button secondary">Review speichern</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<form method="post" action="/imports/" style="margin-top:12px">
|
||||
<input type="hidden" name="action" value="approve-scan-import-review">
|
||||
<input type="hidden" name="job_id" value="<?= h($activeJobId) ?>">
|
||||
<div class="actions">
|
||||
<button type="submit">Review freigeben</button>
|
||||
</div>
|
||||
</form>
|
||||
</section>
|
||||
<?php endif; ?>
|
||||
<?php elseif ($page === 'content'): ?>
|
||||
<section class="hero"><div class="eyebrow">Hinweise und FAQ</div><h1>Hinweise und FAQ</h1><p>Hinweise und häufige Fragen werden pro Tenant gepflegt und direkt an die Mitglieder ausgespielt.</p></section>
|
||||
<section class="grid grid-2">
|
||||
|
||||
Reference in New Issue
Block a user