feat(series): rookie rounds can pick drivers from other classes, with a guide section (1.75.0)

This commit is contained in:
larssand committed 2026-11-06 23:58:24 +01:00
1 parent bea4283130
commit d5337e2cf3
11 files changed
+103 -9

No files matched your search

+6 -1
View File
@@ -104,6 +104,10 @@ function renderRoundParticipants(round, { t, escapeHtml }) {
${round.classDrivers.length ? `<div class="series-class-list">${round.classDrivers.map((driver) => `
<label class="series-class-row ${round.participantIds.includes(driver.id) ? "is-selected" : ""}"><input type="checkbox" data-round-driver="${escapeHtml(driver.id)}" ${round.participantIds.includes(driver.id) ? "checked" : ""} /><span>${escapeHtml(driver.name)}${driver.transponder ? ` <small>${escapeHtml(driver.transponder)}</small>` : ""}</span></label>`).join("")}</div>`
: `<p class="hint">${t("series.no_class_drivers")}</p>`}
${(round.otherDrivers || []).length ? `<details class="series-other-drivers" ${round.classDrivers.length ? "" : "open"}><summary>${t("events.other_class_participants", { count: round.otherDrivers.length })}</summary>
<p class="hint">${t("series.other_class_hint")}</p>
<div class="series-class-list">${round.otherDrivers.map((driver) => `
<label class="series-class-row"><input type="checkbox" data-round-driver="${escapeHtml(driver.id)}" /><span>${escapeHtml(driver.name)} <small>${escapeHtml(driver.className || "")}${driver.transponder ? ` · ${escapeHtml(driver.transponder)}` : ""}</small></span></label>`).join("")}</div></details>` : ""}
<form class="series-add-driver" data-round-add-driver>
<input name="name" required placeholder="${escapeHtml(t("series.new_driver_name"))}" />
<input name="transponder" placeholder="${escapeHtml(t("drivers.transponder_placeholder"))}" inputmode="numeric" />
@@ -397,7 +401,8 @@ export function renderSeriesView(deps) {
detail.querySelectorAll("[data-round-driver]").forEach((box) => box.addEventListener("change", () => { setSeriesRoundParticipants(eventId, ticked()); renderView(); }));
detail.querySelectorAll("[data-round-action]").forEach((button) => button.addEventListener("click", () => {
const action = button.dataset.roundAction;
if (action === "all") setSeriesRoundParticipants(eventId, [...detail.querySelectorAll("[data-round-driver]")].map((box) => box.dataset.roundDriver));
// "All" means the class's own list, not the folded drivers from other classes.
if (action === "all") setSeriesRoundParticipants(eventId, [...detail.querySelectorAll(".series-class-list:not(.series-other-drivers *) [data-round-driver]")].map((box) => box.dataset.roundDriver));
if (action === "none") setSeriesRoundParticipants(eventId, []);
if (action === "copy" && !copySeriesRoundParticipants(series, eventId)) window.alert(t("series.no_previous_round"));
renderView();