m/paliad#61 Slice C frontend pass. Discovery (Geteilte Vorlagen): - New 4th tab on /checklists between "Meine Vorlagen" and "Vorhandene Instanzen". Filters the merged catalog response to authored entries not owned by the caller (firm-visible OR globally-promoted OR share-recipient). Tab state round-trips via ?tab=gallery. - Regime filter pills (UPC / DE / EPA / OTHER) operate independently from the main Vorlagen tab. - Cards show regime badge, item count, author line, visibility chip. - Self-filter relies on /api/me email match — loadMe() fires once on page boot and is idempotent. Versioning UI on /checklists/instances/{id}: - "Vorlage aktualisiert" badge appears when the instance's template_version is known AND lags the live template version (only for authored templates; static templates never bump). Shows "v{from} → v{to}" delta. - "Änderungen anzeigen" button opens a diff modal that compares the instance's template_snapshot against the live template body. Item-level grouping by (section title, item label). Surfaces added / removed / changed items with localised section labels. Empty state when only metadata changed. i18n: 13 new keys per language (DE + EN) under checklisten.tab.gallery, checklisten.gallery.*, checklisten.filter.other, and checklisten.instance.{outdated,diff}.*. Total 2666 keys. Build hygiene: bun run build clean; i18n scan clean. Go build/vet/test + TestBootSmoke ./cmd/server/ all green.
147 lines
7.9 KiB
TypeScript
147 lines
7.9 KiB
TypeScript
import { h } from "./jsx";
|
|
import { Sidebar } from "./components/Sidebar";
|
|
import { PaliadinWidget } from "./components/PaliadinWidget";
|
|
import { BottomNav } from "./components/BottomNav";
|
|
import { Footer } from "./components/Footer";
|
|
import { PWAHead } from "./components/PWAHead";
|
|
|
|
// Interactive instance page. Loads template + instance JSON, renders
|
|
// checkboxes, PATCHes /api/checklist-instances/{id} on every toggle.
|
|
// Reset button POSTs to .../reset.
|
|
export function renderChecklistsInstance(): string {
|
|
return "<!DOCTYPE html>" + (
|
|
<html lang="de">
|
|
<head>
|
|
<meta charset="UTF-8" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" />
|
|
<meta name="theme-color" content="#BFF355" />
|
|
<meta name="apple-mobile-web-app-capable" content="yes" />
|
|
<meta name="apple-mobile-web-app-status-bar-style" content="default" />
|
|
<PWAHead />
|
|
<title data-i18n="checklisten.instance.title">Checklisten-Instanz — Paliad</title>
|
|
<link rel="stylesheet" href="/assets/global.css" />
|
|
</head>
|
|
<body className="has-sidebar">
|
|
<Sidebar currentPath="/checklists" />
|
|
<BottomNav currentPath="/checklists" />
|
|
|
|
<main>
|
|
<section className="tool-page">
|
|
<div className="container">
|
|
<a href="#" id="instance-back" className="checklist-back">
|
|
<span className="checklist-back-arrow">←</span>
|
|
<span data-i18n="checklisten.instance.back">Zurück zur Vorlage</span>
|
|
</a>
|
|
|
|
<div id="instance-loading" className="entity-loading">
|
|
<p data-i18n="checklisten.instance.loading">Lädt…</p>
|
|
</div>
|
|
|
|
<div id="instance-notfound" className="entity-empty" style="display:none">
|
|
<p data-i18n="checklisten.instance.notfound">Instanz nicht gefunden oder keine Berechtigung.</p>
|
|
</div>
|
|
|
|
<div id="instance-body" style="display:none">
|
|
<div className="tool-header checklist-detail-header">
|
|
<div className="checklist-detail-head-row">
|
|
<div className="checklist-instance-titles">
|
|
<div className="checklist-instance-name-row">
|
|
<h1 id="instance-name-display" />
|
|
<input type="text" id="instance-name-edit" className="entity-title-input" maxLength={200} style="display:none" />
|
|
<button id="instance-rename-btn" className="btn-icon" type="button" aria-label="Umbenennen" data-i18n-title="checklisten.instance.rename" title="Umbenennen">
|
|
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
<path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7" />
|
|
<path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z" />
|
|
</svg>
|
|
</button>
|
|
<button id="instance-name-save" className="btn-primary btn-cta-lime btn-small" type="button" style="display:none" data-i18n="checklisten.instance.rename.save">Speichern</button>
|
|
</div>
|
|
<p className="tool-subtitle" id="instance-template-title"> </p>
|
|
<dl className="checklist-meta" id="instance-meta" />
|
|
{/* Slice C: 'template updated since this instance
|
|
was created' banner. Populated by the client
|
|
when instance.template_version < template.version. */}
|
|
<div id="instance-outdated-slot" />
|
|
</div>
|
|
<div className="checklist-actions">
|
|
<button type="button" id="btn-print" className="btn-ghost" data-i18n="checklisten.print">Drucken</button>
|
|
<button type="button" id="btn-reset" className="btn-ghost" data-i18n="checklisten.reset">Zurücksetzen</button>
|
|
<button type="button" id="btn-feedback" className="btn-suggest">
|
|
<span data-i18n="checklisten.feedback.btn">Feedback</span>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
|
|
<div className="checklist-progress">
|
|
<div className="checklist-progress-bar">
|
|
<div className="checklist-progress-fill" id="progress-fill" />
|
|
</div>
|
|
<span className="checklist-progress-label" id="progress-label">0 / 0</span>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="checklist-groups" className="checklist-groups" />
|
|
|
|
<div className="checklist-print-footer">
|
|
<p className="checklist-disclaimer" data-i18n="checklisten.disclaimer">
|
|
Hinweis: Diese Checklisten dienen als Gedächtnisstütze und ersetzen keine Prüfung im Einzelfall. Maßgeblich sind die jeweils geltenden Verfahrensregeln.
|
|
</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
</main>
|
|
|
|
{/* Feedback modal */}
|
|
<div className="modal-overlay" id="feedback-modal" style="display:none">
|
|
<div className="modal-card">
|
|
<div className="modal-header">
|
|
<h2 data-i18n="checklisten.feedback.title">Feedback zur Checkliste</h2>
|
|
<button className="modal-close" id="modal-close" type="button">×</button>
|
|
</div>
|
|
<form id="feedback-form">
|
|
<div className="form-field">
|
|
<label htmlFor="feedback-type" data-i18n="checklisten.feedback.type">Art</label>
|
|
<select id="feedback-type" required>
|
|
<option value="error" data-i18n="checklisten.feedback.error">Fehler gefunden</option>
|
|
<option value="missing" data-i18n="checklisten.feedback.missing">Fehlender Punkt</option>
|
|
<option value="suggestion" data-i18n="checklisten.feedback.suggestion">Verbesserungsvorschlag</option>
|
|
<option value="other" data-i18n="checklisten.feedback.other">Sonstiges</option>
|
|
</select>
|
|
</div>
|
|
<div className="form-field">
|
|
<label htmlFor="feedback-message" data-i18n="checklisten.feedback.message">Nachricht</label>
|
|
<textarea id="feedback-message" rows={4} required />
|
|
</div>
|
|
<div className="form-actions">
|
|
<button type="button" className="btn-cancel" id="modal-cancel" data-i18n="checklisten.feedback.cancel">Abbrechen</button>
|
|
<button type="submit" className="btn-submit" data-i18n="checklisten.feedback.submit">Absenden</button>
|
|
</div>
|
|
<p className="form-msg" id="feedback-msg" />
|
|
</form>
|
|
</div>
|
|
</div>
|
|
|
|
{/* Slice C: template-diff modal — opened from the
|
|
"Änderungen anzeigen" button on the outdated banner. */}
|
|
<div className="modal-overlay" id="instance-diff-modal" style="display:none">
|
|
<div className="modal-card modal-card-wide">
|
|
<div className="modal-header">
|
|
<h2 data-i18n="checklisten.instance.diff.title">Geänderte Punkte</h2>
|
|
<button className="modal-close" id="instance-diff-close" type="button">×</button>
|
|
</div>
|
|
<div id="instance-diff-body" />
|
|
<div className="form-actions">
|
|
<button type="button" className="btn-cancel" id="instance-diff-close-bottom" data-i18n="checklisten.instance.diff.close">Schließen</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<Footer />
|
|
<PaliadinWidget />
|
|
<script src="/assets/checklists-instance.js"></script>
|
|
</body>
|
|
</html>
|
|
);
|
|
}
|