Oberfläche wie Plancraft: Seitenleiste mit Logo, Blautöne, Status-Etiketten

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AmyPfuNc4sCRfaF3oURXZz
This commit is contained in:
Claude
2026-10-19 18:46:21 +00:00
parent a3ab0c1d46
commit cc1116a540
5 changed files with 122 additions and 39 deletions

View File

@@ -134,17 +134,18 @@ function tabelle(spalten: { titel: string; wert: (z: Zeile) => string; klasse?:
return t;
}
// Kopf wie bei Plancraft: Titel links, Hauptknopf rechts; darunter eine Leiste für Filter
function seite(titel: string, knopf?: { text: string; aktion: () => void }): HTMLElement {
inhalt.innerHTML = `<h1>${esc(titel)}</h1>`;
const leiste = document.createElement("div");
leiste.className = "leiste";
inhalt.innerHTML = `<div class="kopf"><h1>${esc(titel)}</h1></div>`;
if (knopf) {
const b = document.createElement("button");
b.className = "haupt";
b.textContent = knopf.text;
b.onclick = knopf.aktion;
leiste.appendChild(b);
inhalt.firstElementChild!.appendChild(b);
}
const leiste = document.createElement("div");
leiste.className = "leiste";
inhalt.appendChild(leiste);
return leiste;
}
@@ -175,10 +176,18 @@ async function kontakte(): Promise<void> {
], zeilen, async (z) => (await bearbeiten("kontakte", "Kontakt bearbeiten", KONTAKT_FELDER, z)) && kontakte()));
}
const STATUS: [string, string][] = [
["anfrage", "Anfrage"], ["angebot", "Angebot"], ["auftrag", "Auftrag erhalten"], ["ausfuehrung", "Ausführung"],
["abgerechnet", "Abgerechnet"], ["gewaehrleistung", "Gewährleistung"], ["abgeschlossen", "Abgeschlossen"],
];
const STATUS_TEXT = Object.fromEntries(STATUS);
const etikett = (status: string) => `<span class="etikett ${esc(status)}">${esc(STATUS_TEXT[status] ?? status)}</span>`;
async function projekte(): Promise<void> {
const kontaktListe = await api<Zeile[]>("kontakte");
const felder: Feld[] = [
{ name: "nummer", titel: "Nummer", pflicht: true }, { name: "bezeichnung", titel: "Baustelle", pflicht: true },
{ name: "status", titel: "Status", art: "auswahl", optionen: STATUS },
{ name: "bauherr_id", titel: "Bauherr", art: "auswahl", optionen: [["", "–"], ...kontaktListe.map((k): [string, string] => [k.id, k.name])] },
{ name: "umsatz_netto", titel: "Umsatz netto", art: "euro" }, { name: "material_kosten", titel: "Materialkosten", art: "euro" },
{ name: "fremd_kosten", titel: "Fremdkosten", art: "euro" }, { name: "sonstige_kosten", titel: "Sonstige Kosten", art: "euro" },
@@ -192,15 +201,15 @@ async function projekte(): Promise<void> {
const name = Object.fromEntries(kontaktListe.map((k) => [k.id, k.name]));
const kostenSumme = (z: Zeile) => z.material_kosten + z.fremd_kosten + z.sonstige_kosten;
inhalt.appendChild(tabelle([
{ titel: "Nr.", wert: (z) => esc(z.nummer) },
{ titel: "Baustelle", wert: (z) => esc(z.bezeichnung) },
{ titel: "Bauherr", wert: (z) => esc(name[z.bauherr_id]), klasse: "optional" },
{ titel: "Umsatz netto", wert: (z) => euro(z.umsatz_netto), klasse: "zahl" },
{ titel: "Name", wert: (z) => `<strong>${esc(z.bezeichnung)}</strong><span class="unter"><span class="nur-schmal">${esc(z.nummer)} · </span>${esc(name[z.bauherr_id] ?? "–")}</span>` },
{ titel: "Nummer", wert: (z) => esc(z.nummer), klasse: "optional" },
{ titel: "Status", wert: (z) => etikett(z.status) },
{ titel: "Umsatz netto", wert: (z) => euro(z.umsatz_netto), klasse: "zahl optional" },
{ titel: "Kosten", wert: (z) => euro(kostenSumme(z)), klasse: "zahl optional" },
{ titel: "Rohertrag", wert: (z) => euro(z.umsatz_netto - kostenSumme(z)), klasse: "zahl" },
{ titel: "Rohertrag", wert: (z) => euro(z.umsatz_netto - kostenSumme(z)), klasse: "zahl optional" },
], zeilen, (z) => speichern(ohneNull(z))));
const gesamt = zeilen.reduce((s, z) => s + z.umsatz_netto - kostenSumme(z), 0);
inhalt.insertAdjacentHTML("beforeend", `<p>Rohertrag gesamt: <strong>${euro(gesamt)}</strong></p>
inhalt.insertAdjacentHTML("beforeend", `<p class="anzahl">${zeilen.length} Projekte</p><p>Rohertrag gesamt: <strong>${euro(gesamt)}</strong></p>
<p class="hinweis">Projektdetailseite, Einzelposten und Zahlungsplan folgen mit der V70-Übernahme.</p>`);
}
@@ -352,10 +361,23 @@ const REITER: [string, string, () => Promise<void>][] = [
["daten", "Daten", daten],
];
// Einfache Strichsymbole (24er Raster), Farbe kommt aus der Schrift
const SYMBOLE: Record<string, string> = {
uebersicht: '<path d="M3 11l9-7 9 7"/><path d="M5 10v10h14V10"/>',
aufgaben: '<path d="M9 11l3 3 8-8"/><path d="M20 12v7a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h11"/>',
projekte: '<path d="M3 6a1 1 0 0 1 1-1h5l2 2h9a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1z"/>',
terminplan: '<rect x="3" y="5" width="18" height="16" rx="1"/><path d="M3 10h18M8 3v4M16 3v4"/>',
kontakte: '<circle cx="12" cy="8" r="4"/><path d="M4 21c1-4 4-6 8-6s7 2 8 6"/>',
liquiditaet: '<path d="M3 17l6-6 4 4 8-8"/><path d="M15 7h6v6"/>',
"laufende-kosten": '<rect x="3" y="6" width="18" height="13" rx="1"/><path d="M3 10h18M7 15h4"/>',
daten: '<ellipse cx="12" cy="6" rx="8" ry="3"/><path d="M4 6v12c0 1.7 3.6 3 8 3s8-1.3 8-3V6M4 12c0 1.7 3.6 3 8 3s8-1.3 8-3"/>',
};
const symbol = (id: string) => `<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${SYMBOLE[id] ?? ""}</svg>`;
const nav = document.getElementById("reiter")!;
nav.innerHTML = REITER.map(([id, titel]) => `<button data-r="${id}">${titel}</button>`).join("");
nav.innerHTML = REITER.map(([id, titel]) => `<button data-r="${id}">${symbol(id)}<span>${titel}</span></button>`).join("");
nav.addEventListener("click", (ev) => {
const r = (ev.target as HTMLElement).dataset.r;
const r = ((ev.target as HTMLElement).closest("button[data-r]") as HTMLElement | null)?.dataset.r;
if (r) location.hash = r;
});