Sortieren und Filtern wie in Excel in jeder Tabelle, Ansichten je Benutzer (0.13.0)
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:
@@ -3,6 +3,7 @@
|
||||
|
||||
import { type Abzugsart, dauerText, minuten, rechneTag, regelPause, uhrzeit } from "../domain/zeit.js";
|
||||
import { type Zeile, api, dat, dateiSpeichern, esc, heute, inhalt, lies, merke, seite } from "./ui.js";
|
||||
import { liste as tabelleMit } from "./liste.js";
|
||||
|
||||
const WT = ["So", "Mo", "Di", "Mi", "Do", "Fr", "Sa"];
|
||||
const WT_LANG = ["Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag"];
|
||||
@@ -266,14 +267,22 @@ export async function stundenSeite(): Promise<void> {
|
||||
return `<div><small>${esc(l.name)}</small><b>${dauerText(ist)} Std.</b>${soll ? `<small>Soll ${dauerText(soll)} · <span class="${ist - soll < 0 ? "fehler" : ""}">${ist - soll >= 0 ? "+" : ""}${dauerText(ist - soll)}</span></small>` : ""}</div>`;
|
||||
}).join("")}</div>`);
|
||||
|
||||
const tabelle = document.createElement("div");
|
||||
tabelle.className = "tabelle-rolle";
|
||||
tabelle.innerHTML = d.tage.length ? `<table><thead><tr><th>Tag</th><th>Person</th><th>Zeit</th><th class="zahl">Pause</th><th class="zahl">Abzug</th><th class="zahl">Arbeitszeit</th><th class="optional">Baustellen</th></tr></thead>
|
||||
<tbody>${d.tage.map((t: Zeile, i: number) => `<tr class="klickbar" data-i="${i}"><td>${WT[wt(t.datum)]} ${dat(t.datum).slice(0, 6)}</td><td>${esc(t.name)}</td><td>${t.beginn}–${t.ende}</td>
|
||||
<td class="zahl">${t.pause_min || ""}</td><td class="zahl">${t.abzug_min || ""}</td><td class="zahl"><b>${dauerText(t.netto_min)}</b></td>
|
||||
<td class="optional">${esc(t.anteile.map((a: Zeile) => `${a.nummer ? `${a.nummer}${a.vorgang ? ` ${a.vorgang}` : ""}` : a.taetigkeit || "ohne Baustelle"}${t.anteile.length > 1 ? ` ${zahl(a.stunden)}` : ""}`).join(", "))}${t.notiz ? ` <i>${esc(t.notiz)}</i>` : ""}</td></tr>`).join("")}</tbody></table>`
|
||||
: '<p class="hinweis leer">In diesem Monat sind keine Stunden gebucht.</p>';
|
||||
inhalt.appendChild(tabelle);
|
||||
const baustellen = (t: Zeile) => t.anteile.map((a: Zeile) => `${a.nummer ? `${a.nummer}${a.vorgang ? ` ${a.vorgang}` : ""}` : a.taetigkeit || "ohne Baustelle"}${t.anteile.length > 1 ? ` ${zahl(a.stunden)}` : ""}`).join(", ");
|
||||
inhalt.appendChild(tabelleMit({
|
||||
schluessel: "stunden", einheit: ["Tag", "Tage"], leer: "In diesem Monat sind keine Stunden gebucht.",
|
||||
zeilen: d.tage.map((t: Zeile) => ({ ...t, id: t.id ?? `${t.kontakt_id}-${t.datum}` })),
|
||||
spalten: [
|
||||
{ id: "tag", titel: "Tag", art: "datum", wert: (t) => `${WT[wt(t.datum)]} ${dat(t.datum).slice(0, 6)}`, sortWert: (t) => t.datum },
|
||||
{ id: "person", titel: "Person", wert: (t) => esc(t.name) },
|
||||
{ id: "zeit", titel: "Zeit", wert: (t) => `${t.beginn}–${t.ende}`, sortWert: (t) => t.beginn },
|
||||
{ id: "pause", titel: "Pause", art: "zahl", wert: (t) => String(t.pause_min || ""), sortWert: (t) => t.pause_min || 0, klasse: "zahl" },
|
||||
{ id: "abzug", titel: "Abzug", art: "zahl", wert: (t) => String(t.abzug_min || ""), sortWert: (t) => t.abzug_min || 0, klasse: "zahl" },
|
||||
{ id: "arbeitszeit", titel: "Arbeitszeit", art: "zahl", wert: (t) => `<b>${dauerText(t.netto_min)}</b>`, sortWert: (t) => t.netto_min, klasse: "zahl" },
|
||||
{ id: "baustellen", titel: "Baustellen", text: baustellen, wert: (t) => `${esc(baustellen(t))}${t.notiz ? ` <i>${esc(t.notiz)}</i>` : ""}`, klasse: "optional" },
|
||||
],
|
||||
klick: (t) => void oeffne(d.tage.find((x: Zeile) => x.kontakt_id === t.kontakt_id && x.datum === t.datum) ?? t),
|
||||
fuss: (l) => (l.length && l.length !== d.tage.length ? `<p>Summe der gezeigten Tage: <strong>${dauerText(l.reduce((s, t) => s + t.netto_min, 0))} Std.</strong></p>` : ""),
|
||||
}));
|
||||
|
||||
const oeffne = async (t: Zeile | null) => {
|
||||
const huelle = document.getElementById("dialog-huelle")!;
|
||||
@@ -321,10 +330,6 @@ export async function stundenSeite(): Promise<void> {
|
||||
}
|
||||
});
|
||||
leiste.querySelector<HTMLSelectElement>("#person")!.onchange = (ev) => { person = (ev.target as HTMLSelectElement).value; void stundenSeite(); };
|
||||
tabelle.onclick = (ev) => {
|
||||
const tr = (ev.target as HTMLElement).closest<HTMLElement>("tr[data-i]");
|
||||
if (tr) void oeffne(d.tage[Number(tr.dataset.i)]);
|
||||
};
|
||||
}
|
||||
|
||||
/** Inhaber und Büro: zwischen eigenen Stunden und allen umschalten */
|
||||
|
||||
Reference in New Issue
Block a user