Feature: QR-Druck, Monatsprotokoll PDF, Pricing-Sektion

This commit is contained in:
rene 2026-05-17 14:36:59 +02:00
parent 984f3c9162
commit c5a640911c
6 changed files with 808 additions and 70 deletions

View file

@ -84,6 +84,53 @@
</div>
</section>
<!-- PRICING -->
<section class="pricing">
<div class="container">
<h2>Einfache, transparente Preise</h2>
<p class="pricing-sub">Keine Einrichtungsgebühr. Monatlich kündbar.</p>
<div class="pricing-grid">
<div class="plan">
<div class="plan-name">Basic</div>
<div class="plan-price">249 €<span>/Monat</span></div>
<ul class="plan-features">
<li>✓ Bis zu 500 Assets / QR-Tags</li>
<li>✓ Eigenes Logo & CI-Farben</li>
<li>✓ Standard-Protokoll-Templates</li>
<li>✓ PDF-Export</li>
<li>✓ Subdomain (firma.checkflo.de)</li>
</ul>
<a href="mailto:hallo@checkflo.de?subject=Basic-Plan Anfrage" class="btn-plan">Demo anfragen</a>
</div>
<div class="plan plan-featured">
<div class="plan-badge">Beliebt</div>
<div class="plan-name">Pro</div>
<div class="plan-price">499 €<span>/Monat</span></div>
<ul class="plan-features">
<li>✓ Unlimitierte Assets</li>
<li>✓ Custom Domain (app.ihr-betrieb.de)</li>
<li>✓ Individueller Formular-Generator</li>
<li>✓ API-Zugang (ERP, Excel-Export)</li>
<li>✓ Prioritäts-Support</li>
</ul>
<a href="mailto:hallo@checkflo.de?subject=Pro-Plan Anfrage" class="btn-plan btn-plan-featured">Demo anfragen</a>
</div>
<div class="plan">
<div class="plan-name">Enterprise</div>
<div class="plan-price">ab 1.500 €<span>/Monat</span></div>
<ul class="plan-features">
<li>✓ Eigene Server-Infrastruktur</li>
<li>✓ SAP / MS Dynamics Anbindung</li>
<li>✓ Dedizierter Support & SLA</li>
<li>✓ On-Premise möglich</li>
<li>✓ Individuelle Entwicklung</li>
</ul>
<a href="mailto:hallo@checkflo.de?subject=Enterprise Anfrage" class="btn-plan">Angebot anfragen</a>
</div>
</div>
</div>
</section>
<!-- CTA -->
<section class="cta">
<div class="container">
@ -254,6 +301,64 @@
.feature-card h3 { font-size: 1.1rem; margin-bottom: 0.5rem; }
.feature-card p { color: #555; font-size: 0.95rem; }
/* PRICING */
.pricing { padding: 5rem 2rem; background: #F5F7FA; }
.pricing-sub { text-align: center; color: #666; margin-top: -2rem; margin-bottom: 3rem; }
.pricing-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
gap: 1.5rem;
align-items: stretch;
}
.plan {
background: #fff;
border-radius: 16px;
padding: 2rem;
border: 1.5px solid #eee;
display: flex;
flex-direction: column;
position: relative;
}
.plan-featured {
border-color: #F97316;
box-shadow: 0 4px 24px rgba(249,115,22,0.12);
}
.plan-badge {
position: absolute;
top: -12px;
left: 50%;
transform: translateX(-50%);
background: #F97316;
color: #fff;
padding: 0.2rem 0.9rem;
border-radius: 20px;
font-size: 0.75rem;
font-weight: 700;
}
.plan-name { font-size: 0.85rem; font-weight: 700; color: #888; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 0.75rem; }
.plan-price { font-size: 2rem; font-weight: 800; color: #0B1023; margin-bottom: 1.5rem; }
.plan-price span { font-size: 1rem; font-weight: 400; color: #888; }
.plan-features { list-style: none; margin: 0 0 2rem; padding: 0; display: flex; flex-direction: column; gap: 0.6rem; flex: 1; }
.plan-features li { font-size: 0.9rem; color: #444; }
.btn-plan {
display: block;
text-align: center;
padding: 0.75rem;
border-radius: 8px;
font-weight: 700;
font-size: 0.95rem;
border: 1.5px solid #0B1023;
color: #0B1023;
transition: all 0.15s;
}
.btn-plan:hover { background: #0B1023; color: #fff; }
.btn-plan-featured { background: #F97316; border-color: #F97316; color: #fff; }
.btn-plan-featured:hover { background: #ea6c10; border-color: #ea6c10; }
/* CTA */
.cta {
background: #0B1023;

View file

@ -14,9 +14,10 @@
}
const navItems = [
{ href: '/admin/dashboard', label: 'Dashboard', icon: '◈' },
{ href: '/admin/logs', label: 'Protokoll', icon: '≡' },
{ href: '/admin/stations', label: 'Stationen', icon: '⊞' }
{ href: '/admin/dashboard', label: 'Dashboard', icon: '◈' },
{ href: '/admin/logs', label: 'Einträge', icon: '≡' },
{ href: '/admin/protokoll', label: 'Protokoll', icon: '📄' },
{ href: '/admin/stations', label: 'Stationen', icon: '⊞' }
];
</script>

View file

@ -0,0 +1,255 @@
<script lang="ts">
import { pb } from '$lib/pb';
import { onMount } from 'svelte';
const STATUS_LABEL: Record<string, string> = { ok: 'OK', abweichung: 'Abweichung', kritisch: 'Kritisch' };
const STATUS_COLOR: Record<string, string> = { ok: '#16a34a', abweichung: '#ea580c', kritisch: '#dc2626' };
const now = new Date();
let selectedMonth = $state(now.getMonth() + 1);
let selectedYear = $state(now.getFullYear());
let logs = $state<any[]>([]);
let tenantName = $state('');
let loading = $state(true);
const months = ['Januar','Februar','März','April','Mai','Juni',
'Juli','August','September','Oktober','November','Dezember'];
onMount(() => loadData());
async function loadData() {
loading = true;
try {
const user = await pb.collection('users').getOne(pb.authStore.record!.id);
const tenant = await pb.collection('tenants').getOne(user.tenant);
tenantName = tenant.name;
const from = `${selectedYear}-${String(selectedMonth).padStart(2,'0')}-01 00:00:00`;
const lastDay = new Date(selectedYear, selectedMonth, 0).getDate();
const to = `${selectedYear}-${String(selectedMonth).padStart(2,'0')}-${lastDay} 23:59:59`;
const result = await pb.collection('check_logs').getFullList({
filter: `tenant = '${user.tenant}' && created >= '${from}' && created <= '${to}'`,
expand: 'station',
sort: 'created'
});
logs = result;
} catch {
} finally {
loading = false;
}
}
function formatDate(iso: string) {
if (!iso) return '—';
const d = new Date(iso);
if (isNaN(d.getTime())) return '—';
return d.toLocaleString('de-DE', { day:'2-digit', month:'2-digit', year:'2-digit', hour:'2-digit', minute:'2-digit' });
}
// Logs nach Station gruppieren
const byStation = $derived(() => {
const map: Record<string, any[]> = {};
for (const log of logs) {
const name = log.expand?.station?.name ?? 'Unbekannt';
(map[name] ??= []).push(log);
}
return map;
});
</script>
<svelte:head><title>Protokoll {months[selectedMonth-1]} {selectedYear} — checkflo</title></svelte:head>
<!-- Steuerung (nicht drucken) -->
<div class="controls no-print">
<div class="controls-left">
<h1>Monatsprotokoll</h1>
</div>
<div class="controls-right">
<select bind:value={selectedMonth} onchange={loadData}>
{#each months as m, i}
<option value={i+1}>{m}</option>
{/each}
</select>
<select bind:value={selectedYear} onchange={loadData}>
{#each [2025, 2026, 2027] as y}
<option value={y}>{y}</option>
{/each}
</select>
<button class="btn-print" onclick={() => window.print()}>🖨 Drucken / PDF</button>
</div>
</div>
<!-- Protokoll (wird gedruckt) -->
<div class="protokoll">
<div class="protokoll-header">
<div>
<div class="protokoll-title">HACCP-Temperatur & Hygieneprotokoll</div>
<div class="protokoll-subtitle">{months[selectedMonth-1]} {selectedYear}</div>
</div>
<div class="protokoll-tenant">{tenantName}</div>
</div>
{#if loading}
<p class="hint no-print">Lädt…</p>
{:else if logs.length === 0}
<p class="hint no-print">Keine Einträge im gewählten Zeitraum.</p>
<p class="empty-print">Keine Einträge im {months[selectedMonth-1]} {selectedYear}.</p>
{:else}
{#each Object.entries(byStation()) as [stationName, stationLogs]}
<div class="station-block">
<div class="station-header">{stationName}</div>
<table>
<thead>
<tr>
<th>Datum / Zeit</th>
<th>Temp. (°C)</th>
<th>Status</th>
<th>Notiz</th>
<th>Geprüft von</th>
</tr>
</thead>
<tbody>
{#each stationLogs as log}
<tr>
<td>{formatDate(log.created)}</td>
<td>{log.temperature ? log.temperature + ' °C' : '—'}</td>
<td>
<span class="badge" style="color:{STATUS_COLOR[log.status]}">
{STATUS_LABEL[log.status] ?? log.status}
</span>
</td>
<td>{log.notes || '—'}</td>
<td>{log.checked_by}</td>
</tr>
{/each}
</tbody>
</table>
</div>
{/each}
<div class="summary">
<strong>Gesamt:</strong> {logs.length} Einträge ·
{logs.filter(l=>l.status==='ok').length} OK ·
{logs.filter(l=>l.status==='abweichung').length} Abweichungen ·
{logs.filter(l=>l.status==='kritisch').length} Kritisch
</div>
{/if}
<div class="protokoll-footer">
<div>Erstellt: {new Date().toLocaleDateString('de-DE')} · checkflo.de</div>
<div class="signature-block">
<div class="signature-line">___________________________</div>
<div class="signature-label">Unterschrift Verantwortlicher</div>
</div>
</div>
</div>
<style>
.controls {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 2rem;
flex-wrap: wrap;
gap: 1rem;
}
h1 { font-size: 1.6rem; font-weight: 800; color: #0B1023; }
.controls-right { display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; }
select {
padding: 0.5rem 0.75rem;
border: 1.5px solid #ddd;
border-radius: 8px;
font-size: 0.9rem;
background: #fff;
}
.btn-print {
padding: 0.6rem 1.25rem;
background: #0B1023;
color: #fff;
border: none;
border-radius: 8px;
font-size: 0.9rem;
font-weight: 600;
cursor: pointer;
}
.btn-print:hover { background: #1a2640; }
.hint { color: #aaa; }
.empty-print { display: none; }
/* Protokoll-Layout */
.protokoll {
background: #fff;
border-radius: 12px;
padding: 2rem;
box-shadow: 0 1px 4px rgba(0,0,0,0.06);
max-width: 900px;
}
.protokoll-header {
display: flex;
justify-content: space-between;
align-items: flex-start;
border-bottom: 2px solid #0B1023;
padding-bottom: 1rem;
margin-bottom: 1.5rem;
}
.protokoll-title { font-size: 1.1rem; font-weight: 800; color: #0B1023; }
.protokoll-subtitle { font-size: 0.9rem; color: #666; margin-top: 0.25rem; }
.protokoll-tenant { font-weight: 700; color: #0B1023; text-align: right; }
.station-block { margin-bottom: 2rem; }
.station-header {
background: #F5F7FA;
padding: 0.5rem 1rem;
font-weight: 700;
font-size: 0.95rem;
color: #0B1023;
border-left: 3px solid #F97316;
margin-bottom: 0.5rem;
border-radius: 0 4px 4px 0;
}
table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
th { background: #F5F7FA; padding: 0.5rem 0.75rem; text-align: left; font-size: 0.75rem; color: #888; text-transform: uppercase; }
td { padding: 0.5rem 0.75rem; border-bottom: 1px solid #f0f0f0; }
tr:last-child td { border-bottom: none; }
.badge { font-weight: 700; }
.summary {
margin-top: 1.5rem;
padding: 0.75rem 1rem;
background: #F5F7FA;
border-radius: 8px;
font-size: 0.9rem;
color: #555;
}
.protokoll-footer {
margin-top: 3rem;
display: flex;
justify-content: space-between;
align-items: flex-end;
font-size: 0.8rem;
color: #aaa;
}
.signature-block { text-align: center; }
.signature-line { border-top: 1px solid #999; width: 200px; margin-bottom: 0.25rem; }
.signature-label { font-size: 0.75rem; color: #888; }
@media print {
.no-print { display: none !important; }
.empty-print { display: block; }
.protokoll {
box-shadow: none;
padding: 0;
border-radius: 0;
}
table { font-size: 0.8rem; }
@page { margin: 15mm; size: A4; }
}
</style>

View file

@ -1,6 +1,7 @@
<script lang="ts">
import { pb } from '$lib/pb';
import { onMount } from 'svelte';
import QRCode from 'qrcode';
const TYPE_LABEL: Record<string, string> = {
kuehlschrank: 'Kühlschrank',
@ -11,20 +12,32 @@
};
let stations = $state<any[]>([]);
let qrCodes = $state<Record<string, string>>({});
let loading = $state(true);
let copied = $state<string | null>(null);
let tenantName = $state('');
onMount(async () => {
try {
const user = await pb.collection('users').getOne(pb.authStore.record!.id);
const tenantId = user.tenant;
const tenant = await pb.collection('tenants').getOne(tenantId);
tenantName = tenant.name;
const result = await pb.collection('stations').getFullList({
filter: `tenant = '${tenantId}' && active = true`,
sort: 'name'
});
stations = result;
// QR-Codes generieren
const codes: Record<string, string> = {};
for (const s of result) {
codes[s.qr_id] = await QRCode.toDataURL(qrUrl(s.qr_id), {
width: 200, margin: 1, color: { dark: '#0B1023', light: '#ffffff' }
});
}
qrCodes = codes;
} catch {
// Keine Stationen
} finally {
loading = false;
}
@ -34,18 +47,23 @@
return `https://checkflo.de/s/${qrId}`;
}
async function copyUrl(qrId: string) {
await navigator.clipboard.writeText(qrUrl(qrId));
copied = qrId;
setTimeout(() => copied = null, 2000);
function printAll() {
window.print();
}
</script>
<svelte:head><title>Stationen — checkflo</title></svelte:head>
<div class="page">
<h1>Stationen</h1>
<p class="hint-text">Jeden QR-Code ausdrucken und an der Station befestigen. Der Link öffnet die Checkliste direkt im Browser.</p>
<div class="page no-print">
<div class="header-row">
<div>
<h1>Stationen</h1>
<p class="hint-text">QR-Codes ausdrucken und an den Stationen befestigen.</p>
</div>
{#if stations.length > 0}
<button class="btn-print" onclick={printAll}>🖨 Alle drucken</button>
{/if}
</div>
{#if loading}
<p class="hint">Lädt…</p>
@ -53,29 +71,19 @@
<div class="list">
{#each stations as s}
<div class="card">
<div class="card-head">
<div>
<div class="card-body">
<div class="card-info">
<div class="station-name">{s.name}</div>
<div class="station-type">{TYPE_LABEL[s.type] ?? s.type}
{#if s.target_temp_min || s.target_temp_max}
· {s.target_temp_min}° bis {s.target_temp_max}°C
{/if}
</div>
<code class="qr-url">{qrUrl(s.qr_id)}</code>
</div>
</div>
<div class="qr-row">
<code class="qr-url">{qrUrl(s.qr_id)}</code>
<button class="btn-copy" onclick={() => copyUrl(s.qr_id)}>
{copied === s.qr_id ? '✓ Kopiert' : 'Kopieren'}
</button>
<a
href="https://api.qrserver.com/v1/create-qr-code/?size=200x200&data={encodeURIComponent(qrUrl(s.qr_id))}"
target="_blank"
class="btn-qr"
>
QR öffnen
</a>
{#if qrCodes[s.qr_id]}
<img src={qrCodes[s.qr_id]} alt="QR {s.name}" class="qr-img" />
{/if}
</div>
</div>
{/each}
@ -83,65 +91,98 @@
{/if}
</div>
<!-- Druckansicht -->
{#if !loading}
<div class="print-sheet">
{#each stations as s}
<div class="print-card">
<div class="print-tenant">{tenantName}</div>
<div class="print-name">{s.name}</div>
<div class="print-type">{TYPE_LABEL[s.type] ?? s.type}
{#if s.target_temp_min || s.target_temp_max}
· Zielbereich {s.target_temp_min}° bis {s.target_temp_max}°C
{/if}
</div>
{#if qrCodes[s.qr_id]}
<img src={qrCodes[s.qr_id]} alt="QR" class="print-qr" />
{/if}
<div class="print-url">{qrUrl(s.qr_id)}</div>
<div class="print-footer">Scan → Checkliste ausfüllen → fertig</div>
</div>
{/each}
</div>
{/if}
<style>
.page { max-width: 800px; }
h1 { font-size: 1.6rem; font-weight: 800; color: #0B1023; margin-bottom: 0.5rem; }
.hint-text { color: #666; font-size: 0.9rem; margin-bottom: 2rem; }
.header-row { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 2rem; }
h1 { font-size: 1.6rem; font-weight: 800; color: #0B1023; margin-bottom: 0.25rem; }
.hint-text { color: #666; font-size: 0.9rem; }
.hint { color: #aaa; }
.list { display: flex; flex-direction: column; gap: 1rem; }
.btn-print {
padding: 0.6rem 1.25rem;
background: #0B1023;
color: #fff;
border: none;
border-radius: 8px;
font-size: 0.9rem;
font-weight: 600;
cursor: pointer;
white-space: nowrap;
}
.btn-print:hover { background: #1a2640; }
.list { display: flex; flex-direction: column; gap: 1rem; }
.card {
background: #fff;
border-radius: 12px;
padding: 1.25rem 1.5rem;
box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.card-head { margin-bottom: 1rem; }
.card-body { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.card-info { flex: 1; }
.station-name { font-weight: 700; font-size: 1.05rem; color: #0B1023; }
.station-type { font-size: 0.85rem; color: #888; margin-top: 0.2rem; }
.qr-row {
display: flex;
align-items: center;
gap: 0.75rem;
flex-wrap: wrap;
}
.station-type { font-size: 0.85rem; color: #888; margin: 0.2rem 0 0.75rem; }
.qr-url {
flex: 1;
font-size: 0.8rem;
font-size: 0.75rem;
background: #F5F7FA;
padding: 0.5rem 0.75rem;
border-radius: 6px;
padding: 0.4rem 0.6rem;
border-radius: 5px;
color: #555;
min-width: 0;
display: block;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
max-width: 400px;
}
.btn-copy, .btn-qr {
padding: 0.5rem 1rem;
border-radius: 6px;
font-size: 0.85rem;
font-weight: 600;
cursor: pointer;
white-space: nowrap;
transition: all 0.15s;
}
.btn-copy {
background: #F5F7FA;
border: 1.5px solid #ddd;
color: #555;
}
.btn-copy:hover { border-color: #F97316; color: #F97316; }
.qr-img { width: 100px; height: 100px; flex-shrink: 0; }
.btn-qr {
background: #F97316;
color: #fff;
border: none;
text-decoration: none;
display: inline-flex;
align-items: center;
/* Druckansicht — nur beim Drucken sichtbar */
.print-sheet { display: none; }
@media print {
.no-print { display: none !important; }
.print-sheet {
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 0;
}
.print-card {
border: 1px solid #ddd;
padding: 1.5rem;
text-align: center;
page-break-inside: avoid;
break-inside: avoid;
}
.print-tenant { font-size: 0.7rem; color: #888; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 0.5rem; }
.print-name { font-size: 1.2rem; font-weight: 800; color: #0B1023; margin-bottom: 0.25rem; }
.print-type { font-size: 0.8rem; color: #666; margin-bottom: 1rem; }
.print-qr { width: 160px; height: 160px; margin: 0 auto 0.75rem; display: block; }
.print-url { font-size: 0.65rem; color: #888; margin-bottom: 0.5rem; word-break: break-all; }
.print-footer { font-size: 0.7rem; color: #F97316; font-weight: 600; }
}
.btn-qr:hover { background: #ea6c10; }
</style>